Array Copy for Any Objects

Hi all,
I wrote a function which is used to concat two Arrays. HOwever, I need to specifiy the data type in the function, it's not OO and absolutely not dynamic, how can I improve it ?
    public static Object concatDualArray(Object[] A, Object[] B) {
        StandingData[] C= new StandingData[A.length+B.length];
        System.arraycopy(A, 0, C, 0, A.length);
        System.arraycopy(B, 0, C, A.length, B.length);
        return C;
     } I summon that function from my core function, which is
        StandingData[] trancheStatusListData = (StandingData[])
                TrancheUtility.concatDualArray((Object[])trancheApprovedStatusListData, (Object[])trancheApprovalStatusListData);Is there any reflection method can let my function looks more OO ?
Thanks for helping me
Transistor

Personally I wouldn't go for the array approach in the first place, because
their type can not be parameterized; e.g. the following is simply not
possible, no matter how cute it looks:public static<T> T[] concatDualArray(T[] A, T[] B) {
   T[] C= new T[A.length+B.length];
   System.arraycopy(A, 0, C, 0, A.length);
   System.arraycopy(B, 0, C, A.length, B.length);
   return C;
} Arrays are very non-OO; why not stick to a List<T> instead?
kind regards,
Jos

Similar Messages

  • Make local copy for any submit form data provided prior to send/submit

    Dear Sir/Madam,
    I am trying to achieve a behaviour of firefox 22 under Ubuntu 13.04 Linux that has to do with forms/submit.
    The result I want to achieve is to have a copy filed for each registration form, personal information provided like job application forms done on websites with multi step submit/apply button at the end.
    The copy "bill" I am after would simply be adding on a scroll the screenshot for the webpage(including scrolling areas) to a localcopy.
    The idea is to look for words like "register", "Address" "Job", "Application" on the page where a form/submit has been detected and simply compound save all displayed steps with data inserted by me.
    For me a lot of this makes sense since prior to for example sending mails or letters by post I file a local copy for my reference ect. This would be an electronic equivelent of it.Saving tremendous energy and time compared to manually saving each step and then looking for a way to name/organise and "collage" all the bits into one receit/bill/scroll.
    How can I modify or achieve this behaviour on Firefox 22 under Ubuntu?
    I have installed addons like InFormEnter, SessionManager iMacros Lastpass...
    an arrow/menu started similar to InFormEnter near a submit button as a method to confirm a loacl copy prior to sending would be ideal.
    Sincerely yours,
    Nikita K. Tsarov

    UnMHT is OK but it doesnt work well when used with the HP chat support window... Here is an attempt to explain what I am trying to get at
    https://docs.google.com/file/d/0B0Kuhf6iBidTZWZWeUxrR2dYajg/edit?usp=sharing
    Feel free to add any comments tips directions...

  • System Copy for Workflow objects

    Hi Experts,
      My client need to migrate code in some request from one system(Sandbox) to another system(Development). They r not adivicing me to transporting the request. They want to migrate each individual object. Could anyone suggest me how can I do this migration for workflow objects. Can I have an option of import and exporting the workflow template and taks.
    Regards
    Jose

    Hello Jose,
    The fastest and most painless way is to create them in the new system. There are just too many problems to sort out and the export function is a joke.
    A quick tip: have two sessions open, switch between them and copy/paste your task texts etc.
    Sorry it's not the answer you want, but it's going to save you the most time. It's not as much work as it seems, a couple of hours per workflow at most.
    Cheers,
    Mike

  • [AS2] Listeners for any Object? UIEventDispatcher -- EventDispatcher:

    HI - thx for reading.
    Class mx.events.UIEventDispatcher extends
    mx.events.EventDispatcher -
    and overrides the "dispatchEvent"_Method like this:
    function dispatchEvent(eventObj:Object):Void
    if (eventObj.target == undefined)
    eventObj.target = this;
    this[eventObj.type + "Handler"](eventObj);
    // Dispatch to objects that are registered as listeners for
    // all objects.
    this.dispatchQueue(EventDispatcher, eventObj);
    // Dispatch to objects that are registered as listeners for
    // this object.
    this.dispatchQueue(this, eventObj);
    Comment says (and that is also the difference to
    EventDispatcher´s implementation of this method) that at first
    the Event is dispatched to " to objects that are registered as
    listeners for all objects."
    But it doesn't happen...
    I guess cause we cannot do EventDispatcher.addEventListener,
    because there is no static function "addEventListener" in the
    EventDispatcher-class.
    But what is that piece of code good for?
    I'd rather like to be able to add a Listener that listens to
    an Event indepent of the object that sends the Event (e.g. if you
    have to add tracking functionallity to a project, you could
    imaganie to create a kind of "global Listener" to any "click"-Event
    an track it).
    So, if anybody understands how this coudl work: Help or
    enlightment will be greatly appreciated!
    Thanks in advance,
    tom

    HI - thx for reading.
    Class mx.events.UIEventDispatcher extends
    mx.events.EventDispatcher -
    and overrides the "dispatchEvent"_Method like this:
    function dispatchEvent(eventObj:Object):Void
    if (eventObj.target == undefined)
    eventObj.target = this;
    this[eventObj.type + "Handler"](eventObj);
    // Dispatch to objects that are registered as listeners for
    // all objects.
    this.dispatchQueue(EventDispatcher, eventObj);
    // Dispatch to objects that are registered as listeners for
    // this object.
    this.dispatchQueue(this, eventObj);
    Comment says (and that is also the difference to
    EventDispatcher´s implementation of this method) that at first
    the Event is dispatched to " to objects that are registered as
    listeners for all objects."
    But it doesn't happen...
    I guess cause we cannot do EventDispatcher.addEventListener,
    because there is no static function "addEventListener" in the
    EventDispatcher-class.
    But what is that piece of code good for?
    I'd rather like to be able to add a Listener that listens to
    an Event indepent of the object that sends the Event (e.g. if you
    have to add tracking functionallity to a project, you could
    imaganie to create a kind of "global Listener" to any "click"-Event
    an track it).
    So, if anybody understands how this coudl work: Help or
    enlightment will be greatly appreciated!
    Thanks in advance,
    tom

  • Create/update date and time for any object

    Hi All,
    How to find that at what date and time at which perticular object is created or updated.
    Thanks,
    Nitesh

    Example below:
    [email protected]> alter session set nls_date_format='dd-mm-yyyy hh24:mi:ss'
    2 /
    Session altered.
    [email protected]> select owner, object_name, last_ddl_time
    2 from dba_objects
    3 where owner = 'MOB' and object_name = 'T';
    no rows selected
    [email protected]> create table t(id int);
    Table created.
    [email protected]> select owner, object_name, last_ddl_time
    2 from dba_objects
    3 where owner = 'MOB' and object_name = 'T';
    OWNER OBJECT_NAME
    LAST_DDL_TIME
    MOB T
    30-08-2006 14:15:58
    [email protected]> column object_name format a30
    [email protected]> /
    OWNER OBJECT_NAME LAST_DDL_TIME
    MOB T 30-08-2006 14:15:58
    [email protected]> alter table t add x int;
    Table altered.
    [email protected]> select owner, object_name, last_ddl_time
    2 from dba_objects
    3 where owner = 'MOB' and object_name = 'T';
    OWNER OBJECT_NAME LAST_DDL_TIME
    MOB T 30-08-2006 14:16:25
    Best Regards
    Krystian Zieja / mob

  • Copying any object

    I know if I try to assign an object reference to other, a new object won't be created, only a copy of that reference. For example:
    String s1, s2;
    s1 = new String ("My new String");
    s2 = s1;But and if I want to copy (clone) an object (all the data inside it)? Is there a method that does it for any object, like a Copy ()?
    Note: Of course I know if I want a copy of an array of integers, for example, I can do a counter-controlled iteration to get the clone. But I want the method that copies any object.

    No, there is no method that clones every object. The clone() method that is specified by the Object class must be implemented for any class that wishes to support cloning.
    Since you cannot tell the semantics of a class externally (only the properties, methods and inner declarations) there is no fool-proof way of copying instances externally.

  • Need to find the dependent object details for an object.

    Hi,
    Is there any query to find the dependent object details for any object. Like if mview is built on a table, then i should be able to find the table name with out checking code of the mview. Thanks in-advance for your support. similar way for view and functions or procedures etc...
    Regards
    DBA.

    Hi all,
    Thanks a lot for your inputs. seems i have not given full details in my post. I need to have a SQL Query to find the dependent object details not DDL.
    if i give a metriealized view name, i should get the base table names directly not DDLs...
    if i give index name i should get its corresponding table name(off course i got this already)...
    if i give a function name, i should get all the tables which are being in the function...etc...
    i am looking for a script which will cover all the aspects.....i hope i have given now enough information for this....
    Regards
    DBA.

  • IDocs for a Object

    Hello,
    If i know the Purchase order Number can i find out the IDOCS going out this Object.
    In general for any object (can be a Delivery note or Sales order etc) if we want to know the outgoing and incoming Idocs , except by digging in to segmenst and reading teh contents is theer any other way . say FM?
    Regds,
    Ö
    Mandar : It want it in Report , we can even go through relations in forground , that is not the issue.
    We need get details in a report.

    Hi,
    If you have done the message settings for PO while creating PO in Header -> Message, then once PO get created goto ME22 or ME23 and in Header -> Messages. Select the output which you process with TYPE as EDI or ALE and select Processing Log in that you will get the IDOC number.
    OR if you are youing ENJOY Transactions then goto ME22N or ME23N and click on <b>Service For Object</b> and then click the <b>Where Used Icon</b>
    Message was edited by: Mandar Shete

  • Looking for a way to test if the lines in a path intersect any objects?

    What i'd like to do is select an open ended path, and generate an array of all the objects that path intersects.  Here's an image to illustrate:
    The green line would be selected.  The script would run and populate an array with pointers to each yellow square the line intersects.  Does anyone have any ideas on how this can be done in javascript?  Or if it is possible at all?  Help is appreacited, thanks!

    Sure it's possible. If all of your objects-to-cross are rectangles (as in your image), it's even quite trivial.
    (15 minutes later) Oh well, perhaps not "trivial" -- I'd have to check at home whether or not I got a full-fledged rectangle intersection code. This doesn't work -- the "crossObject" function needs a bit more work.
    At least it'll give you something to look at.
    if (app.selection.length != 1)
    alert ("Wot no single path selected?");
    else
    if (!(app.selection[0] instanceof PathItem))
      alert ("Wot no path?");
    else
      allObjects = [];
      for (i=0; i<app.activeDocument.pageItems.length; i++)
       if (!app.activeDocument.pageItems[i].selected)
        allObjects.push (app.activeDocument.pageItems[i]);
      thePath = [];
      for (i=0; i<app.selection[0].pathPoints.length; i++)
       thePath.push ([ app.selection[0].pathPoints[i].anchor[0],app.selection[0].pathPoints[i].anchor[1] ] );
      app.selection[0].selected = false;
      for (i=0; i<thePath.length-1; i++)
       for (j=0; j<allObjects.length; j++)
       // only check if necessary
        if (allObjects[j].selected == true)
         continue;
        if (crossObject (thePath[i], thePath[i+1], allObjects[j]))
         allObjects[j].selected = true;
    // .. to do .. (dis doesn't work)
    // (check Liang-Barsky or Cohen-Sutherland viewport clipping)
    function crossObject (a, b, obj)
    var xl = obj.visibleBounds[1];
    var xr = obj.visibleBounds[3];
    var yt = obj.visibleBounds[0];
    var yb = obj.visibleBounds[2];
    var x1 = a[0],y1 = a[1];
    var x2 = b[0],y2 = b[1];
    // if point is inside object, it (obviously) hits
    if (x1 > xl && x1 < xr && y1 > yt && y1 < yb)
      return true;
    if (x2 > xl && x2 < xr && y2 > yt && y2 < yb)
      return true;
    return false;

  • Calendar malfunction - calendar keeps freezing and displaying text I copied for another purpose - any advice?

    My 6-month old macbook air's calendar keeps freezing up.  when I open calendar, it displays across the top of the calendar some text I copied for another purpose and which I pasted into a word document yesterday.  When this happens there's nothing I can do to escape it -- all commands result in the "thud" tone.  So I keep having to force quit calendar. 
    Any advice?

    Hi Dylan2412,
    According to your description, you'd like to pass the ComboBox.Text to the second form's TextBox.
    In Form1:
    private void button1_Click(object sender, EventArgs e)
    Form2 f2 = new Form2(this.comboBox1.Text); //pass the comboBox1.Text
    f2.Show();
    In Form2:
    public Form2(string s) //get the string;
    InitializeComponent();
    this.textBox1.Text = s;
    You could get the comBoBox refer to this sample above.
    If you have any other concern regarding this issue, please feel free to let me know.
    Best regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Business Objects Homogeneous System Copy for [PCM - VENDAVO - Dataserver ]

    I am looking for any SAP supported process/method to perform system copies or transports with these products to set a standardized landscape where N1 (DEV) -> N1 (QA) --> [ Block Point ] --> N (DEV) --> N (QA) --> N (Pre-Prod) --> N (Prod).
    With ECC, BI, CRM, etc its all solid and proven processes for doing this.  However with the products from everyone else's bag of tricks without SAP standards, we are wondering how do we integrate it into the development streams for Unit Test, Integration Test, System Test to deploy.
    If anyone knows of a method for performing a homogeneous system copy from one box to another for the following, I would truely like to see it.
    1. PCM (Windows - App) - PCM (Windows - Web) - PCM (Windows - DB / SQLServer )
    2. Vendavo (Windows - APP ) -- Vendavo (LINUX - DB / Oracle)
    3. BOBJ XI Dataserver (LINUX - DB / Oracle)
    I have seem some info on the BOBJ XI side of using a biar file but I don't know if that also applies to the Dataserver piece.  At this point the message is that we build new and everyone rekeys data which flys like a lead ballon.
    If anyone has places to look, please let me know.
    Thanks
    Rick

    Hi,
    by default, BOE doesnt have such a option to copy your System like BW has.
    You could proceed as follows:
    1. setup your new BOE Server
    2. Copy thr FRS from the old to the new BOE Server
    3. Copy the CMS DB using cmsdbsetup.sh (UNIX) or the CCM from the old DB to the new DB
    4. Run the "Update Objects" option
    5. Login to the CMC of the new BOE to delete the old Server entries under "Server"
    Regards
    -Seb.

  • Is there any object in labview that contains a list of data for the user to select (selection one at a time) or add a new data?

    Is there any object in labview that contains a list of data for the user to select (selection one at a time) or add a new data?

    List and table controls -> listbox..is that what you are thinking of?
    The listbox presents the user with a list of options, and you can set it to only accept one selection at a time...Adding new data to the list can not be done directly by the user but if you make e.g. a text control and a button you can programatically insert new objects described in the text box when the button is pressed...(see example).
    If you need more than one column you have the multicolumn listbox. If you want the users to write new entries directly yu can use a table and read selected cells using it's selection start property to read what cell has been selected.
    MTO
    Attachments:
    Listbox_example.vi ‏34 KB

  • I've had this 2D array problem for ages and would apprecoate any help :)

    I've posted a few times about this in the past and with your guys help I have gradually advanced.
    Basically, all I want to do at the moment is fill the lowest position a counter can go in in a game of Connect Four.
    The first counter goes to the bottom, then if you place another counter in the same column it goes above the previous counter you put in that same column and so on...
    I have set up my 2D array and initialised integers for each player so when a counter is red the player = 1 and when yellow player = 2.
    Here is my code...
    CircleGrid [][] cArray = new CircleGrid[col][row]; //Declare array
    static final int row = 6;
    static final int col = 7;
    for (int i = 0; i < col; i++)
                        for (int h = 0; h < row; h++)
                             cArray[i][h] = new CircleGrid();
                             gameCenter.add(new CircleGrid());
                   JOptionPane.showConfirmDialog(game, "Welcome to Frenzy Fours. Press 'OK to begin or 'Cancel' to go back.", "Game", JOptionPane.OK_CANCEL_OPTION);
                   /*if (cArray[col-1][row] && cArray[col-2][row] == 1) //This doesn't work at all...array out of bounds !?
                        System.out.println("testing");
    public class CircleGrid extends JPanel implements MouseListener, MouseMotionListener
             int ifRed;
             int notIfRed;
                 boolean ifEmpty;
              String currentColour = "White";
              final int empty = 0;
              final int competitorOne = 1;
              final int competitorTwo = 2;
                 public CircleGrid()
                   ifRed = 1;
                   notIfRed = 0;
                   int redCircles = 0;
                   int yellowCircles = 0;
                   ifEmpty = true;
                   addMouseListener(this);
                 public void alternateColour()
                   ifEmpty = !ifEmpty;
                   repaint(); //Repaint upon changes
                 public void paintComponent(Graphics g)
                 if (ifEmpty)
                   g.setColor(Color.WHITE); //Set all of the ovals to white
             else if (ifRed == clicks)
                   position--;
                   addMouseListener(this);
                    g.setColor(Color.RED); //Paint red
                    currentColour = "Red";
                    System.out.println(getColour());
                    System.out.println(playerOneMove());
              else if (notIfRed == clicks)
                   addMouseListener(this);
                   g.setColor(Color.YELLOW); //Paint yellow
                   currentColour = "Yellow";
                   System.out.println(getColour());
                   System.out.println(playerTwoMove());
                   g.fillOval(5, 10, 42, 42); //Draw and fill oval
                 public String getColour()
                   return currentColour;
              public int playerOneMove()
                   return competitorOne;
              public int playerTwoMove()
                   return competitorTwo;
                 public void mousePressed(MouseEvent ev)
                   alternateColour(); //Use commands from this method
                   if (clicks == 0)
                        clicks = 1;
                        repaint(); //Paint oval red
                        number--; //Decrement number of counters left by 1
                         counterNo1.setText(number + " counters left.");
                         move++;
                         moveCount1.setText(move + " moves.");
                   else if (clicks > 0)
                        clicks = 0;
                        repaint(); //Paint oval yellow
                        number2--;
                         counterNo2.setText(number2 + " counters left.");
                        move2++;
                         moveCount2.setText(move2 + " moves.");
                 }I think that is all of the code which matters for this!
    I didn't choose to do this project and it is really stressing me out! If anybody could give me a nudge in the right direction (in really simple steps) that would be awesome. I appreciate you guys do this voluntarily (and for some even work) so I would be deeply grateful for any assistance in this matter.
    Thank you. :)
    - Jay
    Edited by: Aurora88 on Mar 5, 2008 7:18 AM

    public class CircleGrid extends JPanel implements MouseListener, MouseMotionListener
             int ifRed;
             int notIfRed;
                 boolean ifEmpty;
              String currentColour = "White";
              final int empty = 0;
              final int competitorOne = 1;
              final int competitorTwo = 2;
              static final int row = 6;
              static final int col = 7;
              Circle [][] cArray = new Circle[col][row]; //Declare array
              Circle circle = new Circle(0,0);
                 public CircleGrid()
                   ifRed = 1;
                   notIfRed = 0;
                   int redCircles = 0;
                   int yellowCircles = 0;
                   ifEmpty = true;
                   addMouseListener(this);
                 public void alternateColour()
                   ifEmpty = !ifEmpty;
                   repaint(); //Repaint upon changes
                 public void paintComponent(Graphics g)
                 if (ifEmpty)
                   g.setColor(Color.WHITE); //Set all of the ovals to white
             else if (ifRed == clicks)
                   position--;
                   addMouseListener(this);
                    g.setColor(Color.RED); //Paint red
                    currentColour = "Red";
                    System.out.println(getColour());
                    System.out.println(playerOneMove());
              else if (notIfRed == clicks)
                   addMouseListener(this);
                   g.setColor(Color.YELLOW); //Paint yellow
                   currentColour = "Yellow";
                   System.out.println(getColour());
                   System.out.println(playerTwoMove());
                   g.fillOval(5, 10, 42, 42); //Draw and fill oval
                 public String getColour()
                   return currentColour;
              public int playerOneMove()
                   return competitorOne;
              public int playerTwoMove()
                   return competitorTwo;
                 public void mousePressed(MouseEvent ev)
                   alternateColour(); //Use commands from this method
                   if (clicks == 0)
                        clicks = 1;
                        repaint(); //Paint oval red
                        number--; //Decrement number of counters left by 1
                         counterNo1.setText(number + " counters left.");
                         move++;
                         moveCount1.setText(move + " moves.");
                   else if (clicks > 0)
                        clicks = 0;
                        repaint(); //Paint oval yellow
                        number2--;
                         counterNo2.setText(number2 + " counters left.");
                        move2++;
                         moveCount2.setText(move2 + " moves.");
                   for (int i = 0; i < col; i++)
                        for (int h = 0; h < row; h++)
                             cArray[i][h] = new Circle();
                             gameCenter.add(cArray[i][h]);
                   System.out.println("LOCATION");
                   System.out.println("Row: " + circle.getRow());
                   System.out.println("Col: " + circle.getCol());
                 public void mouseClicked(MouseEvent ev)
                 public void mouseReleased(MouseEvent ev)
                   if (number < 0)
                        JOptionPane.showMessageDialog(game, "Error! You have no counters left.", "Error 001", JOptionPane.ERROR_MESSAGE);
                        System.out.println(countersGone()); //Display error when all counters are used
                        number = 22; move = 0; number2 = 22; move2 = 0;
                        counterNo1.setText(number + " counters left.");
                        moveCount1.setText(move + " moves.");
                        counterNo2.setText(number2 + " counters left.");
                        moveCount2.setText(move2 + " moves.");
                        clicks = 0;
                        game.dispose();
                 public void mouseEntered(MouseEvent ev)
                 public void mouseExited(MouseEvent ev)
                 public void mouseMoved(MouseEvent ev)
                 public void mouseDragged(MouseEvent ev)
                 public int getClickCount()
                   return clicks; //Record number of mouse clicks
                 public int getCounterNumber(int numberP1)
                      numberP1 = number; //Assigned number to numberP1
                      return number;
              public int getCounterNumber2(int numberP2)
                   numberP2 = number;
                   return number2;
              public int moveCounter1(int counterOne)
                   counterOne = move;
                   return move;
              public int moveCounter2(int counterTwo)
                   counterTwo = move2;
                   return move2;
                 public String countersGone()
                   return "You have used up all of your counters!";
         class Circle
             int rowNum, colNum;
             boolean occupied;
             String color;
        public Circle(int r, int c)
              rowNum = r;
              colNum = c;
              occupied = false;
        public int getRow()
              return rowNum;
        public int getCol()
              return colNum;
    }new Circle - cannot find symbol
    gameCenter.add - cannot find symbol
    Circle has been declared so I don't know why this is happening. :S

  • HT3910 am in tanzania. and am in need of a copy of CDdrive for a macbook pro. how can i get a copy, please any one to help

    am in tanzania.
    Am in need of a copy of DVDdrive for a macbook pro OS. how can i get a copy, please any one to help

    If you are referring to the original system reinstall discs that shipped with every Mac before Lion came out you'll need to contact Apple with the serial # of your Mac and order a replacement set of them.
    Or look on one of the Auction websites or places like iFixit.com for a replacement set.
    If your Mac came new with any of the Download Only versions of OS X, Lion, Mt Lion or Mavericks you don't need any discs to reinstall OS X. You use the Online Internet Recovery system or the built in Recovery HD partition inb the internal hard drive.
    For the built in Recovery HD hold down the Command + r keys at startup. For the Online system hold down the Command + Option/Alt + r keys and keep them held down until you see a globe on the screen.

  • Is there any best practice or standard for database object naming ?

    Hi
    Thank you for reading my post
    is there any standard or best practice for databse objects naming ?
    for example how should we name columns of a table ? should it be like TOTAL_VOTE or TOTALVOTE and many other items.
    Thanks

    what does oracle suggest as a naming schema for tables , fields , views. indexes , tablespaces , ... If you look at the data dictionary you will see that not even Oracle keeps rigidly to any specific standard, although there are tendencies :)
    "The nice thing about standards is that there are so many of them to choose from."      
    -- Andrew Tannenbaum
    Cheers, APC

Maybe you are looking for