Adding Vector to another Vector

Hi there,
Does this code correct by adding Vector to another Vector?
vector1.add(vector2);Thanks
Neo

Hi,
If you see the add method as shown below
add
public boolean add(Object o)
Appends the specified element to the end of this Vector.
You can see that add() method takes in the any Object parameter and we know that Object is the super class for all the classes.
So till vector2 is any Object , there is no problem of adding it to another vector.
Regards,
Shishank

Similar Messages

  • Compare newly added Vector Element with all previous

    Hi all
    I am adding Point2D elements to a vector "Numbers" in such a way that every newly randomly created element that is at a distance of 0.3 from all the previous points is added else not.
    I have written a code that only checks from the last element but not all the previous elements.
    Can someone check what wrong am I doing.
    The code is runnable.
    import java.awt.geom.Point2D;
    import java.util.*;
    public class Distance
         Vector<Point2D> numbers = new Vector<Point2D>();
         Random rnd = new Random();
         void getList()
         double xCoord,yCoord;
         for(int i=0;i<5;i++)// is is the no. of coordinates stored later only "b" to be used
         xCoord = rnd.nextDouble();          // X-coord of AP
         yCoord = rnd.nextDouble();          // Y coord of AP
         if(i<2)
              numbers.addElement(new Point2D.Double(xCoord,yCoord));
              System.out.println("0th n 1st element added : "+i+ "   "+numbers.get(i));
         else
         for(int j=i-1;j>i-2;j--)
              if((numbers.get(j).distance(xCoord,yCoord))>0.3)
                   numbers.addElement(new Point2D.Double(xCoord,yCoord));
                   System.out.println("next element added : "+i+ "   "+numbers.get(j)+"  with distance: "
                             +(numbers.get(j).distance(xCoord,yCoord))+"from "+ xCoord + " "+ yCoord);
         Iterator it = numbers.iterator ();
           while (it.hasNext ())
            System.out.println(it.next());
         public static void main(String[] argv)
              Distance d = new Distance();
              d.getList();
    }Thanks a lot

    Hi all
    I am adding Point2D elements to a vector "Numbers" in such a way that every newly randomly created element that is at a distance of 0.3 from all the previous points is added else not.
    I have written a code that only checks from the last element but not all the previous elements.
    Can someone check what wrong am I doing.
    The code is runnable.
    import java.awt.geom.Point2D;
    import java.util.*;
    public class Distance
         Vector<Point2D> numbers = new Vector<Point2D>();
         Random rnd = new Random();
         void getList()
         double xCoord,yCoord;
         for(int i=0;i<5;i++)// is is the no. of coordinates stored later only "b" to be used
         xCoord = rnd.nextDouble();          // X-coord of AP
         yCoord = rnd.nextDouble();          // Y coord of AP
         if(i<2)
              numbers.addElement(new Point2D.Double(xCoord,yCoord));
              System.out.println("0th n 1st element added : "+i+ "   "+numbers.get(i));
         else
         for(int j=i-1;j>i-2;j--)
              if((numbers.get(j).distance(xCoord,yCoord))>0.3)
                   numbers.addElement(new Point2D.Double(xCoord,yCoord));
                   System.out.println("next element added : "+i+ "   "+numbers.get(j)+"  with distance: "
                             +(numbers.get(j).distance(xCoord,yCoord))+"from "+ xCoord + " "+ yCoord);
         Iterator it = numbers.iterator ();
           while (it.hasNext ())
            System.out.println(it.next());
         public static void main(String[] argv)
              Distance d = new Distance();
              d.getList();
    }Thanks a lot

  • Adding vector shapes to GUI

    Hi, I'm new to Flex but I come from Flash and have a good
    knowledge of ActionScript. I'm just not sure how to apply it at the
    moment.
    I'm building a GUI and I just want to add a vector rectangle
    or anything to a panel. I tried putting this in a Script tag but I
    have no idea how I add the child to the Panel in the MXML (if that
    is even possible).
    import flash.display.*;
    var square:Sprite = new Sprite();
    square.graphics.lineStyle(1, 0);
    square.graphics.beginFill(0xFF0000);
    square.graphics.drawRect(500, 100, 100, 100);
    square.graphics.endFill();
    addChild(square);
    I just get told
    "Access of undefined property square" on all the square
    lines, or if I use
    this.addChild(square) I don't get told that, but instead I
    get told I can't use
    this in a static method (how is it a static method?).
    It's kind of confusing without an apparent root level at
    which the code starts. I must be missing something.

    The code you wrote needs to be in a function that gets called
    by the Flex framework. It looks like you put the code inside of a
    class, but not inside of a function.
    In the Flex framework you should put your code in 2 places:
    First, make sure your class extends a Flex framework class,
    like UIComponent or Panel. Then you should override the
    createChildren() function where you can create your Sprite:
    override protected function createChildren() : void
    super.createChildren(); // allow the super class function to
    run
    // create the Sprite
    // use addChild() to put it on the component's display list.
    See caveat below
    Then you need to draw your graphics. If you are using a Flash
    construct, you can draw it when you create it, but that's not the
    best thing in Flex. Perhaps you will want to use a property or
    style on your class to determine the color, for example.
    Override the updateDisplayList() function and include your
    drawing code:
    override protected function updateDisplayList(
    unscaledWidth:Number, unscaledHeight:Number ) : void
    super.updateDisplayList( unscaledWidth, unscaledHeight );
    // draw here
    The Flex framework calls updateDisplayList() when it is the
    time to put up the graphics. This includes sizing and positioning
    children, so it is also a good place to position your sprite.
    There is a caveat: If your class extends UIComponent (the
    basis of all Flex components), you can use Flash objects like Spite
    and Shape. But if you extend another class, like Panel, the
    addChild() function won't allow you to have a child that isn't an
    extension of UIComponent. That's because the "higher" classes in
    the Flex framework require their children to be true Flex
    components.
    So if you are extending Panel, don't create a Sprite. Just
    create a UIComponent and use it as you would a Sprite or a Shape.
    Take a moment to read up on the Flex framework functions such
    as createChildren(), commitProperties(), measure(), and
    updateDisplayList().

  • Adding vector mask as guide layer?

    I have a template that uses a vector mask as one of the layers to line up images. What I need to do is have the vector mask serve as a guide layer so when I go to export it does not appear on export. Is this possible?

    No its not. You can Action or script a deleting of your "Guide" layer before you export or Save the file. Probably your best option 

  • Adding Vector entries

    I need to try and add two elements/components (What's the difference between the two anyway?) of a vector, but they need to be integers. I think I was able to sucessfully accept the input data as integers, but now I can't seem to add them. I tried many things, and I would appreciate any help anone can give me.
    Current code:
    import java.io.*;
    import java.util.*;
    public class DigitalSums
         public static Vector numbers = new Vector(1,1);
         public static final void main(String[] args)
              int counter = 0;
              System.out.println("Input an integer, then press [enter].\nWhen you are done, input a 0.");
              do
                   numbers.addElement(new Integer(InputNumbers()));
                   counter++;
                   if (InputNumbers() == 0)
                        break;
              while(counter <= 10);
              addingNumbers();
              printingOut(numbers.size());
              System.exit(0);
         private static final int InputNumbers()
              int output = 0;
              BufferedReader reader;
              reader = new BufferedReader(new InputStreamReader(System.in));
              try
                   output = Integer.parseInt(reader.readLine());
                   if (output == 0)
                        reader.close();
                        return output;
                   System.out.println("\nNext number:\n");
              catch(IOException ioe)
                   System.out.println("I/O error occured. Exiting.");
                   System.exit(0);
              return output;
         private static final void addingNumbers ()
              int addedNumbers = 0;
              for (int elementCounter = 0; numbers.elementCount() > 0; elementCounter++)
                   addedNumbers = (Integer) numbers.elementAt(elementCounter) + (Integer) numbers.elementAt(elementCounter + 1);
                   numbers.setElementAt(elementCounter, addedNumbers);
    }

    Thanks for the speedy reply.
    This is JCreator's output:
    \\svr1\home\imholti\My Documents\Programming\Java2\ContestProblems\DigitalSums.java:58: cannot resolve symbol
    symbol : method elementCount ()
    location: class java.util.Vector
    for (int elementCounter = 0; numbers.elementCount() > 0; elementCounter++)
    ^
    \\svr1\home\imholti\My Documents\Programming\Java2\ContestProblems\DigitalSums.java:60: operator + cannot be applied to java.lang.Integer,java.lang.Integer
    addedNumbers = (Integer) numbers.elementAt(elementCounter) + (Integer) numbers.elementAt(elementCounter + 1);
    ^
    \\svr1\home\imholti\My Documents\Programming\Java2\ContestProblems\DigitalSums.java:61: setElementAt(java.lang.Object,int) in java.util.Vector cannot be applied to (int,int)
    numbers.setElementAt(elementCounter, addedNumbers);
    ^
    3 errors
    Process completed.
    What is the difference between ArrayList and Vector?

  • I created a new playlist and added tunes to another.  When I synched my ipod showed the new playlist heading but 0 songs, although it correctly received the new songs on the updated playlist.  Tried to synch several times with the same result.

    I created a new playlist and added some songs to another existing one.  When I synched with my PC, it loaded the new playlist heading but 0 songs, but did add the new songs to the existing playlist.  Repeated the process several times without success.

    This earlier post may help.
    https://discussions.apple.com/message/10859194#10859194
    For me,  (long winded way) I drag the playlist from the bottom tree to the iPod branch.
    Then select iPod.
    Click the music tab on the right window.
    click sync tick music
    go down to the playlist section and tick the playlist.
    Apply.
    Good Luck.

  • S_TCODE object is not coming in role after adding profile of another role.

    Dear Gurus,
    I have added profile of a existed role to a newly created role in pfcg (edit->insert authorisation-> from profile), but I can't see the S_TCODE object of that role of the added profile.
    For some roles, it appears, but for some, it don't come.
    Please let me know the reason behind this, so that I can go forward.
    Regards,
    Nilutpal.

    Hi,
    S_TCODE will be added in your authorization profile when you add some T-Codes in Menu Tab of that role in PFCG.
    This may be the case for your role.  In this case it will not be copied with profile. It will be added only if you add the T-Code in Menu Tab.
    The other case is if you directly insert it in bthe authorization objects. In this case it will be copied with profile.
    Please revert.
    Regards,
    Jaya

  • Extracting time from date and adding it to another date.

    Dear All,
    The values of two fields in my table are as follows:
    n_date n_time
    12/7/2007 1/1/1970 5:50:23 PM
    Both of these fields are of date data type.
    How can i add the time from n_time to n_date so that n_date will reflect a date with time added?
    The problem is that i want to sort on n_date and i am not getting result when two dates are having same values for n_date but different for n_time.
    How can i create a new expression for sorting these values?
    Thanks in advance.
    Regards,
    Sameer

    Hi,
    Check this.
    with data as
    ( select to_date('12/7/2007','dd/mm/yyyy') as ndate, to_date('1/1/1970 5:50:23','dd/mm/yyyy hh24:mi:ss') ntime from dual)
    select ndate + (ntime - trunc(ntime)) from data
    Regards
    RK

  • Adding music from another source to itunes - won't allow me to add to playlist

    I have tried to add music from another source - namely a hard drive onto my itunes playlists... which I could do before subscribing to the cloud, but now I can't - I get an error message saying that the playlist will be deleted, and all music has to be "compatible" meaning, bought from itunes.
    is there any way around this ??
    thanks for any help offered

    Hi AT2013,
    Welcome to the Support Communities!
    The article below may be able to help you with this issue.
    Click on the link to see more details and screenshots. 
    iTunes: About the Add to Library, Import, and Convert functions
    http://support.apple.com/kb/HT1347
    Cheers,
    - Judy

  • Remove row from table when adding values to another table

    hi am adding value programticaly how can i remove the row i just  add from the table
    this is how am adding value
    public void addMember(javax.faces.event.ActionEvent actionEvent) {
    List<String> tempTable = new ArrayList<String>();
    //Code to get the bindings for TargetVO :
    RowKeySet selectedEmps = getEmpTable().getSelectedRowKeys(); 
    Iterator selectedEmpIter = selectedEmps.iterator();
    DCBindingContainer bindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding empIter = bindings.findIteratorBinding("UserDetailsViewVO1Iterator");
    RowSetIterator empRSIter = empIter.getRowSetIterator();
    while(selectedEmpIter.hasNext()){
    Key key = (Key)((List)selectedEmpIter.next()).get(0);
    Row currentRow = empRSIter.getRow(key);
    onRowCreate(currentRow);
    boolean b = selectedEmps.remove(currentRow);
            i what to clear the row i just selected from the table
    AdfFacesContext.getCurrentInstance().addPartialTarget(empTable);
    // empTable
    public void onRowCreate( Row currentRow ) {
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    //access the name of the iterator the table is bound to.
    DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("addmemberBeanIterator");
    //access the underlying RowSetIterator
    RowSetIterator rsi = dciter.getRowSetIterator();
    //get handle to the last row
    Row lastRow = rsi.last();
    //obtain the index of the last row
    int lastRowIndex = rsi.getRangeIndexOf(lastRow);
    /*check if the user is added already*/
    /*OperationBinding oper2 = (OperationBinding) bindings.get("check if user exists method binding");
    oper2.getParamsMap().put("attributeName1", uniqueUserAttributeValue);
    Object ret = oper2.execute();*/
    //create a new row
    Row newRow = rsi.createRow();
    String f = (String)currentRow.getAttribute("Firstname");
    String s = (String)currentRow.getAttribute("Surname");
    String u = (String)currentRow.getAttribute("Username");
    String n = (String)currentRow.getAttribute("Emailaddress");
    // String orgid = (String)currentRow.getAttribute("Organisationid");
    newRow.setAttribute("firstname", f);
    newRow.setAttribute("surname", s);
    newRow.setAttribute("name", u);
    newRow.setAttribute("emailaddress", n);
    // newRow.setAttribute("Organisationid1",orgid);
    //initialize the row
    newRow.setNewRowState(Row.STATUS_INITIALIZED);
    //add row to last index + 1 so it becomes last in the range set
    rsi.insertRowAtRangeIndex(lastRowIndex +1,  newRow);
    //make row the current row so it is displayed correctly
    rsi.setCurrentRow(newRow); 
    System.out.println("Username " + u);
    System.out.println("firstname " + f);
    System.out.println("surname " + s);
    System.out.println("email " + n);
    // refereshpage();
    // return null;
    am in jdevloper 11.1.1.6.0
    my table is
    public void onRowCreate( Row currentRow ) {
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    //access the name of the iterator the table is bound to.
    DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("addmemberBeanIterator");
    //access the underlying RowSetIterator
    RowSetIterator rsi = dciter.getRowSetIterator();
    //get handle to the last row
    Row lastRow = rsi.last();
    //obtain the index of the last row
    int lastRowIndex = rsi.getRangeIndexOf(lastRow);
    /*check if the user is added already*/
    /*OperationBinding oper2 = (OperationBinding) bindings.get("check if user exists method binding");
    oper2.getParamsMap().put("attributeName1", uniqueUserAttributeValue);
    Object ret = oper2.execute();*/
    //create a new row
    Row newRow = rsi.createRow();
    String f = (String)currentRow.getAttribute("Firstname");
    String s = (String)currentRow.getAttribute("Surname");
    String u = (String)currentRow.getAttribute("Username");
    String n = (String)currentRow.getAttribute("Emailaddress");
    // String orgid = (String)currentRow.getAttribute("Organisationid");
    newRow.setAttribute("firstname", f);
    newRow.setAttribute("surname", s);
    newRow.setAttribute("name", u);
    newRow.setAttribute("emailaddress", n);
    // newRow.setAttribute("Organisationid1",orgid);
    //initialize the row
    newRow.setNewRowState(Row.STATUS_INITIALIZED);
    //add row to last index + 1 so it becomes last in the range set
    rsi.insertRowAtRangeIndex(lastRowIndex +1,  newRow);
    //make row the current row so it is displayed correctly
    rsi.setCurrentRow(newRow);  
    System.out.println("Username " + u);
    System.out.println("firstname " + f);
    System.out.println("surname " + s);
    System.out.println("email " + n);
    // refereshpage();
    // return null;

    hi,
    make the table selection single and use this links 4 ur task.
    http://www.baigzeeshan.com/2010/06/deleting-multi-selected-rows-from-adf.html
    http://deepakcs.blogspot.com/2013/01/ejb-dc-deleting-multi-selected-rows.html
    https://forums.oracle.com/thread/2534813
    https://blogs.oracle.com/jdevotnharvest/entry/iterating_selected_rows_in_an
    txs

  • I just recently added itunes to another pc and now my ipad will not sync on the new pc. It isnt even recognized. What should I do? HELP!!!

    I just recently downloaded the newest iTunes and moved all my purchased and already owned music to another PC. Every since I did that I cannot get my iPad 1 to even be recognized in iTunes. I have Authorized the PC in iTunes, but my iPad still will not allow me to sync. I'm at a loss...PLEASE HELP!!!

    1.  You need to authorize iTunes on the new computer with your Apple ID.
    2.  Make sure you turn off auto sync in iTunes
    3.  Connect your iPad to iTunes via USB and when it is recognized, right click on the device from the Device list on the left of your iTunes page and choose transfer purchases.
    4.  Once purchases are transfered and you have authorized the iTunes account, you should be able to sync.

  • Strange error when adding book on another book (LibraryEntitlementHelper?!)

    Hi,
    when I try to add book to another book with PortalCustomizationManager I get this strange error:
    java.lang.IllegalArgumentException: Argument [webAppName] to method [createResource] in class [com.bea.netuix.application.manager.entitlement
    s.LibraryEntitlementHelper] cannot have error/be [null].
    What the hell is LibraryEntitlementHelper and why google, bea edocs and bea portal javadoc knows nothing about it?

    How did you create the CustomizationContext when calling the method on the EJB.
    you need to make sure you pass in the ServletRequest. If you are calling this from outside a web container. you wil need to use a mock request or take a look at ExportImportManager.
    Chris Jolley
    Portal Architect

  • Error message when adding values to another table

    hi i have a situation where am adding values from a view to a bean,my use case is i have a list of user in my view where am adding them to my bean by clicking the button,but now i what to validate when adding a user in such a way that if i added a use in my bean and i try to add that user again in current selection i must have validating error saying the user have been added already my code is
    Edited by: adf0994 on 2012/12/13 2:19 PM

    looks like you should have asked this in the ADF-forum...
    JDeveloper and ADF
    Why don't you simply configure the user name beeing unique in your entity?
    ADF would raise an exeption for you.
    public String onRowCreate( Row currentRow ) {
    return null;
    }Don't do that.
    returning a literal null is almost ever a mistake! In this certain case you should declare you methods return type as void and ommit the return statement.
    bye
    TPD

  • Adding files from another library

    I am trying to add songs to my ipod that I got on my library on my home computer. The songs that I am trying to add are from another computer that has the same version of itunes and is a HP with windows Xp. I know there is a way I can do this because the other computer saw my ipod and put the files on there just fine.
    Thanks

    You'll need to switch to manual update (iPod preferences after the iPod is attached).
    After that, you'll need to drag the songs to the iPod icon in the source panel.
    Good luck!

  • Adding behavior inside another behaviour

    Hi
    could I add another behaviour in an existing behaviour
    the first one is as follows
    public class DF_Beh extends SimpleBehaviour {
      SubDF sdf= new SubDF();
      public DF_Beh(Agent a) {
    super (a);
    //AID parentName= getDefaultDF();
        //super(a);
      public boolean done()
          return true;
    public void action()
    ((MobileAgent) myAgent).SerSetup();                 
    return;
    }the other one is
    class Test_Beh extends SimpleBehaviour
    //  Location lac;
         Test_Beh(Agent a)
              super(a);
         public boolean done()
              return true;
         public void action()
                String locname = ((MobileAgent) myAgent).getLocalName();
                Location t = new locationtest();
                ((MobileAgent) myAgent).doClone(t,"cloned "+locname);
              Behaviour test_beh = new DF_Beh(this);
              addBehaviour(test_beh);
                 String   CName = myAgent.getName();
               System.out.println("the agent  "+CName+" is clones at "+ t.getName().toString());
              return;
    }the Behaviour test_beh = new DF_Beh(this);
              addBehaviour(test_beh); gives me two errors
    as follows
    "Test_Beh.java": cannot resolve symbol: constructor DF_Beh (examples.mobile.Test_Beh)in class examples.mobile.DF_Beh at line 48, column 32
    "Test_Beh.java": cannot resolve symbol: method addBehaviour (jade.core.behaviours.Behaviour)in class examples.mobile.Test_Beh at line 49, column 11
    how could i solve this problem?
    thanks

    "Test_Beh.java": cannot resolve symbol:
    constructor DF_Beh (examples.mobile.Test_Beh)in class
    examples.mobile.DF_Beh at line 48, column 32
    "Test_Beh.java": cannot resolve symbol: method
    addBehaviour (jade.core.behaviours.Behaviour)in class
    examples.mobile.Test_Beh at line 49, column
    11It's exactly as the error messages tell you:
    1) You're trying to construct a DF_Beh by passing a Test_Beh as an arg to the ctor. There is no such ctor.
    2) You're trying to call addBehaviour(Behaviour) on a Test_Beh, but there is no such method.
    Either add the appropriate ctor and method, or change your code to call the ones that exist.

Maybe you are looking for