How do I pull object information out of a vector.

I started in VB, and am now developing with java, so I'm finding small trip-ups which are to be expected.
Anyways, I'm trying to get an object element from an object in a vector.
I tried this, but it wouldn't return the "Name" query method:
System.out.println(myvector.get(0).Name.toString);
The object is a "Product" which I made the class for and everything. I even tried using typecast with no avail:
System.out.println((Product)myvector.get(0).Name.toString);
This is prolly one of the most basic things, yet I've found nothing on object attribute retrieval from a vector on google and wikipedia for that matter.

Yea, it is..sorry
The Product class looks like this:
public class Product
private int mProductID;
private String mName;
private double mPrice;
private int mQuantity;
// Update Methods
public void ProdID(int id) {mProductID = id}
public void Quantity " "
etc
etc
// Query methods
public int ProdID() {return this.mProductID;}
etc
etc
Basically, I want a function in my main class to accept a Vector filled with product objects and calculate a sum of all the products and return a double type value.
I'm fine with manipulating the vector, I just don't know how to state the function.
Message was edited by:
zensunni

Similar Messages

  • How to make an object getting out of the screen ?

    Hello everybody !
    I am creating a game introduction with Flash pro CS6 and here's is my problem.
    I want a object in my animation to leave the screen, but I dont know how to do it.
    Is there for example, a way to delimited the working area, so that when I make an object go out of this area, it does not appear in my final animation ( no matter the format, .avi, .mov, spritesheets ... ) or can eventualy be "cut" ( if I make my object half inside the working arear and half outside ) ?
    Is there an other way to do this ?
    Thanks !

    Using a mask might be one way.

  • HT5654 How do i pull my phone out of recovery mode if itunes will not load the iPhone support check?

    I need someones help and can tell me the reason why my itunes is flashing error 23 when I go to pull my phone out of recovery mode

    Hi there SarahM426,
    I would recommend taking a look at the troubleshooting steps found in the article below.
    iTunes: Specific update-and-restore error messages and advanced troubleshooting
    http://support.apple.com/kb/TS3694
    Error 20, 21, 23, 26, 28, 29, 34, 36, 37, 40
    These errors typically occur when security software interferes with the restore and update process. Use the steps to troubleshoot security software issues to resolve this issue. In rare cases, these errors may be a hardware issue. If the errors persist on another computer, the device may need service.
    Also, check your hosts file to verify that it's not blocking iTunes from communicating with the update server. See the steps under the heading "Blocked by configuration (Mac OS X / Windows) > Rebuild network information > Mac OS X > The hosts file may also be blocking the iTunes Store." If you have software used to perform unauthorized modifications to the iOS device, uninstall this software prior to editing the hosts file to prevent that software from automatically modifying the hosts file again on restart.
    -Griff W.

  • HT4910 how do I pull my information from icloud?

    For some unknown reason, iTunes has all of the sudden started saying that it cannot recognize my iPhone and I need to "Restore" the phone.  During this process, it asked me if I wanted to backup everything on the phone and it would restore everything after the process was over.  It restored everything to the day that I bought the phone.  Luckily, I backed everything up on iCloud a couple weeks ago.  How do I withdraw my apps and photos off of iCloud?  This has been a very frustrating process.

    Welcome to the Apple community.
    Unfortunately you cannot extract data from an iCloud backup, you can only use it to restore your device.

  • Object informations

    Dear Friends,
    We have defined the basic settings for object information .But still we need to have to call it manually when notification or order is created. How to open the Object information window automatically when creating a notification or Order?The other things is i want to know whether Is it possible to assign catalog profile for technical objects other than Notifications?

    hi have you assigned your object information key to order types?
    this will automatically display object information key.
    then you have to assign object information key to notification types
    hope it will solve your problem.
    thanks
    mzeee

  • Object Information

    Hi,
    How to get the Object Information, I am able to get the Object names from TADIR table, I want to retrieve the Method and Attribute names in my program.
    Thanks in advance,
    Murty.

    Hi,
    Using SEOCOMPODF, I am able to get the Method names, Any tables to get the Method Parameters?
    Thanks,
    Murty.

  • Pulling Objects out of a Vector

    Hi, all:
    I am trying to pull Objects out of this vector, and the given method only wants to let me get integers. How do I go about getting Objects out of a vector like this one? The problem comes in with the last line, where the "get" method complains that it wants an integer. The API says the same; I just can't find a method that lets me pull an Object out of a vector instead of an integer. Any ideas?
              neighborList = new Vector();
              soldierNeighbors = new Vector();
              neighborList = world.getMooreNeighbors(x, y, false);
              for (int i = 0; i < neighborList.size(); i++){
              Soldier soldier = neighborList.get (soldier);

    Soldier soldier = neighborList.get (soldier);You'll want to use "i" as your index, not "soldier", since you presumably want to get the soldier reference at element 'i'. Note that since you're not using generics, the get() method returns an Object reference. You'll need to cast it to Soldier. Example:
    Soldier soldier = (Soldier) neighborList.get(i);Read more here: http://java.sun.com/docs/books/tutorial/collections/
    ~

  • Specifying which Objects to pull out of a Vector

    I'm pulling certain objects out of a vector to play with them. My problem is that I only want certain ones. Inside the vector "neighborList when I getMooreNeighbors are objects other than Soldiers (there are Democrats, Monarchs, etc, etc). I only want to fiddle with the Soldiers. I'm getting an NPE when I get to the "get" method because I'm casting the objects as Soldiers when it's possible some aren't. What do I do? How do I only get the Soldiers out of the Vector?
    {code}
         public void getMyNeighbor () {
              neighborList = new Vector();
              soldierNeighbors = new Vector();
              neighborList = world.getMooreNeighbors(x, y, false);
              for (int i = 0; i < neighborList.size(); i++){
                   Soldier otherSoldier = (Soldier) neighborList.get (i);//NPE here
                   otherSoldier.getMyColor();
                   otherSoldier.getStrength();
              if (otherSoldier.getMyColor()!=this.getMyColor()){
                   fight();
    {code}

    So I think I tracked down that NPE, but another one seems to have cropped up. Is there a better way to write this? I'm asking my soldier to compare his color with the other guy and fight him if they don't match.
         public void getMyNeighbor () {
              neighborList = new Vector();
              soldierNeighbors = new Vector();
              neighborList = world.getMooreNeighbors(x, y, false);
              for (int i = 0; i < neighborList.size(); i++){
                   Object o = neighborList.get (i);
                   if (o instanceof Soldier) {
                        Soldier otherSoldier = (Soldier)o;
                        otherSoldier.getMyColor();
                        otherSoldier.getStrength();
              if (otherSoldier.getMyColor()!=this.getMyColor()){//NPE here
                   fight();
              }

  • OIM 11gR2 - Push/Pull account locked out information from Active Directory

    Hi
    At this moment, we are using the default reconciliation method from the Active Directory Connector in OIM 11G R2 to fetch incremental information from AD. This runs every 15 minutes.
    However, the customer complains that the time from which the user gets himself locked out due to too many failed login attempts, until it shows up on the OIM account is too long. Worst case, this could be 15 minutes after the user gets himself locked out.
    Do anyone have any tips on how we could either push this information from AD-side, or pull this information from OIM more often? Could we create a special scheduled job that just looks for Locked Accounts, and reconciles this each minute?
    Best Regards
    lloberg

    Hi,
    Sure, that's definitely possible. You can use the Active Directory cmdlets to retrieve this information. Here's an example of reading input from a text file (just usernames in the text file):
    Get-Content .\userList.txt | ForEach {
    Get-ADUser -Identity $_ -Properties EmailAddress
    You can also read input from a CSV file quite easily. This example assumes a header of Username:
    Import-Csv .\userList.csv | ForEach {
    Get-ADUser -Identity $_.Username -Properties EmailAddress
    Finally, here's a link to the Get-ADUser syntax:
    http://technet.microsoft.com/en-us/library/ee617241.aspx
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)

  • How can i pull out data from a spreadsheet only from the current month?

    Data is constantly being fed into a spreadsheet using a VI, this data comprises of such things as month, year, weights, std dev, etc.  I want to do some data manipulation on the current months data while the VI is running, how can I pull out only the data relating to the current month?  Each input into the spreadsheet stores the values for that run on one row, and there are perhaps 150 runs each month
    Any thoughts are greatefully received
    Thanks
    Ross
    Attachments:
    Results.xls ‏1 KB

    Hi Ross,
    I thought I would go away and make you an example VI for the results xls that you have sent me.
    Here it is:  I have added a few comments here and there but if you need more info please don't hessitate to post back on the forum
    Hope if helps
    AdamB
    National Instruments
    Applications Engineering Team Leader | National Instruments | UK & Ireland
    Attachments:
    MonthExtract.vi ‏43 KB

  • How do I get a disc out of my super drive when I forgot to eject it from the drive before pulling out the USB cable ?

    how do I get a disc out of my super drive when I forgot to eject it from the drive before pulling out the USB cable ?

    How force eject disc: Apple Support Communities
    Mac Mini: Eject DVD Apple Support Communities

  • How do I pull up the left control panel that allows you to move from text to moving objects on page?

    How do I pull up the left control panel that allows you to move from text to moving objects on page?

    Do you mean this one:
    If so, go to the Window menu and make sure that Tools is checked.

  • Thought I knew Adobe...but can't figure out how to rotate an object in AdobeMUSE. Help?

    I can't figure out how to rotate an object in Adobe Muse. I want an object to be half a bubble off plumb.

    Hi ,
    You can rotate an object in Muse by using the Transform toolbar and selecting the rotation angle. Please refer to this screenshot :- http://prntscr.com/52vtux
    However, if you want to create a circular looking object , then all you need to do is, set the corners as Rounded, Make the Height and Width Equal and then increase the corner radius. This would give you the desired result.
    Please refer to this screenshot :- http://prntscr.com/52vu9n
    Hope this helps
    Regards,
    Rohit Nair 

  • HT4528 I downloaded the ios7 and it wiped out some of my notes, I thought iCloud stores this information but I can't find it. How do I get this information back?

    I downloaded ios 7 and it wiped out some of my notes. I thought the iCloud backed up all my information, but I can't find it. How do I get this information back?

    YOu restore your phone from your icloud backup.
    http://support.apple.com/kb/HT1766

  • I don't know how to use the property node to get information out of my sub vi while it is working.

    I had a question answered earlier about passing information out of a sub vi, and was helped out. The problem is that I don't understand what is happening as I can not reproduce the results. I am now trying to take results of a comparison (true-false) and pass that back out of my sub vi. I tried a property node and to connect a refnum control to it in the sub vi. Then I tried to connect an indicator to its terminal in the main vi, but was unsuccessful can someone tell me how and why, step by step, to pass this information out. Starting with the point of information in the sub vi to the indicator in the vi. I would appreciate any help that you could give m
    e.
    Attachments:
    Pass_a_Reference.vi ‏15 KB
    GL_Flicker_mod.vi ‏77 KB

    Step by step:
    1. On your main vi Front Panel, create your boolean indicator.
    2. On the block diagram, right click the new boolean indicator and select Create - Reference.
    3. On sub-vi front panel, create boolean indicator (or use one that is already created).
    4. On sub-vi front panel, create a reference (Controls Palette - Refnum - Control Refnum).
    5. Right click on the newly created Refnum and select Select Vi Server Class - Generic - GObject - Control - Boolean. The refnum label changes to BoolRefnum.
    6. On sub-vi block diagram, create Property Node (Functions - Application Control - Property Node). Find the BoolRefnum and move it close to the new Property Node.
    7. Wire the BoolRefnum to the reference input of the property node.
    8.
    Right click on the property node and select Change to All Write.
    9. Move mouse to point to Visible inside property node box, left click and select Value.
    10. Wire the boolean indicator from step 3 to the Value input of the property node.
    11. On sub-vi front panel, right click on icon and select Show Connector.
    12. Click on empty connector spot then click on the new BoolRefnum. Save your sub-vi.
    13. On main vi block diagram, connect refernece created in step 2 to the new connector terminal of sub-vi.
    14. Save and run.
    Here are the modified vi's.
    - tbob
    Inventor of the WORM Global
    Attachments:
    Pass_a_Reference.vi ‏20 KB
    GL_Flicker_mod.vi ‏83 KB

Maybe you are looking for