Vector of object - reading

Hey,
I created a vector private Vector v = new Vector();I have a class called message which hold 2 Strings. Its all set up with get and sets.
I think I saved the objects correctly;
Message line = new Message(username,theMessage);
v.add(line); now I want to read back the username and theMessage to the screen.
v.elementAt(i).toString()I thought I'd be able to do something like->
v.elementAt(i).getUsername()and
v.elementAt(i).getTheMessage()I'd really appreciate ur help.

elementAt(int) returns an Object
so you need to either make the Vector generic:
private Vector<Message> v = new Vector<Message>();...
String username = v.elementAt(i).getUsername();or cast the result to a Message instace before calling any methods on it:
Message m = (Message)v.elementAt(i);
String username = m.getUsername();

Similar Messages

  • Is it possible to export Vector Smart Objects as vector SVG files from Photoshop CC 2014?

    I have Vector Smart Objects copied from Illustrator and pasted into Photoshop. I would like to export them as vector SVG files (using Generator or Extract Assets). I can add the .svg extension to the layer and actually export an SVG just fine. The problem is any SVG I have exported have all been raster images. It defeats the purpose of having that as an option as far as I'm concerned.
    I remember watching and listening to keynotes and other speakers at Adobe MAX 2014 who said it was so powerful and amazing to create SVG files from Photoshop. If we're still exporting raster SVG files from Photoshop...that's not very impressive or exciting--especially since this era of modern web development benefits greatly from using vector SVG files.
    I understand that Shape Layers can be exported as vector SVG files but that seems very limiting. I also realize that users can create some impressive vectors in Photoshop, but that is not optimal. Illustrator is a better tool for creating vectors and I normally use Photoshop and Illustrator side-by-side. I know that vector SVG files can be exported from Illustrator but that isn't as user friendly and convenient as utilizing Photoshop > Generator > Reflow.
    My idea was to create my assets in Illustrator, paste them into Photoshop as Vector Smart Objects, set up my layout, and then use the Generator/Reflow method or Extract Assets to get a new web design started.
    Maybe I misunderstood what the speakers at Adobe MAX had said. Perhaps it's just user error and I'm just missing something simple (it happens).
    Photoshop CC 2014 notes the following under Help > System Info:
    Adobe Photoshop Version: 2014.2.2 20141204.r.310 2014/12/04:23:59:59 CL 994532  x64
    Operating System: Windows 8.1 64-bit
    Any help or suggestions would be greatly appreciated! Thank you in advance for your time.

    Not quite the same, but have a look at the new Libraries feature that came with 2014.2.2  I just tried it, and dragging a vector object into a library I created in Photoshop, was there in Illustrator.  This happens without having to close and reopen Illustrator.  Just use the drop down at the top of the Libraries panel (in Illustrator) to find your custom, or job specific library.

  • How to copy objects from Pages (5.5.1) and paste it into Photoshop as a vector smart object with high resolution?

    I recently have bought a new Macbook Pro (Version 10.10.1) with the OS X Yosemite. The computer comes with the new Pages (version 5.5.1).
    Here is the problem: I like to create artwork using the shapes on Pages. Previously, on my old mac, I used Pages 4.3 to create objects, which I would copy then paste to Photoshop and it would become a vector smart object. However, in the new Pages (version 5.5.1), when I copy objects, they would appear on Photoshop as instead, a layer and it would not be in full resolution.
    Also, I know there is nothing wrong with the Pages file itself because I have converted the document to PDF form and it is high resolution when inserted into Photoshop that way.
    Does anyone know how I can copy individual objects from Pages (5.5.1) and paste it into Photoshop as a vector smart object with high resolution as I have done before?
    Thanks!

    ghotiz wrote:
    copy the image and have it in a high-quality PNG format that does not include the background from the Pages document.
    Oh, well if you don't actually need vector objects then it looks like this is possible. As I said earlier, Pages is putting a PNG on the clipboard. I tested it and it does paste into Photoshop as a transparent layer, because I can see the transparent background of the pasted PNG graphic if I either turn off all layers behind it in Photoshop, or if I start a new Photoshop document to paste into but make sure I choose Transparent for the Background Contents in the New Document dialog.

  • Keynote 6.0 vector smart object conversion to Photoshop CS6

    Hi,
    I upgraded to OS 10.9 and Keynote 6.0. In the previous version of Keynote, I was able to easily paste Keynote content (words, shapes, charts) into Photoshop CS6 & Illustrator CS6 as vector objects, of which the elements could be independently manipulated by releasing the clipping mask.
    However, with Keynote 6.0, it appears the content mentioned above pastes into CS6 software as .tiff files with no option to convert to a vector smart object?  Is there a way to force a vector object placement or does this new Keynote version no allow (and if so why eliminate such a convenient function as vector smart objects)?
    Thanks for the help...

    Hello  thanks for your answers,
    i posted this when i was upset because it was a very frustrating situation. I create Vector art in Illustrator and most of the times i just copy and paste them into Photoshop. I dont use Illustrator Cs6 because some Issues with the color Picker and because i Use Scriptographer alot. So i use Photoshop CS6 and Illustrator CS 5.
    Somehow recently i noticed this strange behaviour. When i close Illustrator completely and doubleclick the Layer in Photoshop it works fine.

  • Vector of objects problem

    Hello All,
    I am trying out a program which uses vector of objects.It is throwing an exception when I compile it.The aim of the program is.
    for eg if we have a set of producers
    count =5
    P1 P2 P3 P4 P5
    7 8 9 10 11
    C1 C2 C3 C4 C5
    1 2 3 4 5
    store all those pairs of consumers and producers where (Ci <=Pi).
    Hash table keys will be of the form S0,S1,S2..SN
    in this Case SO should correspond to a vector which is (7 1),(8 1),(9,1),(10,1),(11,1)
    similarly
    S1 should be (8,1),(8,2) etc.
    I have tried writing the code it doesnt work why.
    Thanks.
    Regards.
    NP
    import java.io.*;
    import java.util.*;
    import java.lang.StrictMath;
    import java.util.ArrayList;
    class CollectionCache
    private final Map cache;
    public CollectionCache()
    cache=new Hashtable();
    public Collection put(Object key,Collection value)
    return(Collection)cache.put(key,value);
    public Collection get(Object key)
    return(Collection)cache.get(key);
    public class Participant
    boolean isProducer;
    double value;
    String name;
    static double resources_used;
    static int p=0;
    static int q=0;
    //static int[] final_index_pro=new int[100];
    //static int[] final_index_con=new int[100];
    public void set_is_pro_or_con(boolean ispro)
    isProducer=ispro;
    public boolean get_is_pro_or_con()
    return isProducer;
    public void set_is_pro_or_con_value(double value)
    this.value=value;
    public double get_is_pro_or_con_value()
    return value;
    public void set_is_pro_or_con_name(String name)
    this.name=name;
    public String get_is_pro_or_con_name()
    return name;
    public static void main(String args[]) throws IOException
    ArrayList Producer=new ArrayList();
    ArrayList Consumer=new ArrayList();
    Collection c=new Vector();
    int i;
    BufferedReader console= new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter the number of resources you want to input");
    String input=console.readLine();
    int count=Integer.parseInt(input);
    System.out.println(count);
    for(i=0;i<count;i++)
    Producer.add(i,new Participant());
    for(i=0;i<count;i++)
    Consumer.add(i,new Participant());
    System.out.println("Reading values into producer array");
    for(i=0;i<count;i++)
    ((Participant)Producer.get(i)).set_is_pro_or_con(true);
    String t="P"+ i;
    ((Participant)Producer.get(i)).set_is_pro_or_con_name(t);
    ((Participant)Producer.get(i)).set_is_pro_or_con_value((int)(StrictMath.random()*10 + 1));
    System.out.println("Reading values into consumer array");
    for(i=0;i<count;i++)
    ((Participant)Consumer.get(i)).set_is_pro_or_con(true);
    String t="P"+ i;
    ((Participant)Consumer.get(i)).set_is_pro_or_con_name(t);
    ((Participant)Consumer.get(i)).set_is_pro_or_con_value((int)(StrictMath.random()*10 + 1));
    //Making Graph topology
    System.out.println("producer array");
    for(i=0;i<count;i++)
    //System.out.println(dup_producer.get_is_pro_or_con());
    //System.out.println(dup_producer[i].get_is_pro_or_con_name());
    System.out.println(((Participant)Producer.get(i)).get_is_pro_or_con_value());
    System.out.println("consumer array");
    for(i=0;i<count;i++)
    //System.out.println(dup_consumer[i].get_is_pro_or_con());
    //System.out.println(dup_consumer[i].get_is_pro_or_con_name());
    System.out.println(((Participant)Consumer.get(i)).get_is_pro_or_con_value());
    System.out.println("Values Printed");
    //String s;
    CollectionCache cc=new CollectionCache();
    int j=0;
    while(j<count)
    for(i=0;i<count;i++)
    if( (((Participant)Consumer.get(j)).get_is_pro_or_con_value()) <= (((Participant)Producer.get(i)).get_is_pro_or_con_value()))
    c.add(Double.toString((((Participant)Consumer.get(j)).get_is_pro_or_con_value())));
    c.add(Double.toString((((Participant)Producer.get(i)).get_is_pro_or_con_value())));
    final Object s="S" +j;
    cc.put(s,c);
    j++;
    j=0;
    while(j<count)
    Collection value=cc.get("S" + j);
    if(value!=null)
    for(Iterator it=value.iterator(); ;it.next())
    System.out.println(it.next().toString());
    j++;

    Or if you want to keep it in as small a scope as possible:
    Iterator it = valu      e.iterator();
      while (it.hasNe                                                       xt()) {
        System.out.println(it
    .next
    }

  • How do I print out a vector of objects?

    Hi,
    I am having trouble printing out the contents of my vector. Can somebody please help me out. Im trying to create a vector of objects. I keep getting output like this:
    There are 5 total classes
    5
    ClassObject@13f5d07
    Here is my code:
    //Test.java
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    public class Test {
            ClassObject co = new ClassObject();
            Vector vec = new Vector();
            public Test () throws Exception {
                    Read("input.dat");
            public void Read(String fileName) {
                    String num; //number of cells
                    String cells; //cell data
                    int x = 0;
                    try {
                            FileReader file = new FileReader(fileName);
                            BufferedReader in = new BufferedReader (file);
                            num = in.readLine();
                            int number = Integer.valueOf(num).intValue(); //convert string to int
                            System.out.println("There are " + number + " total classes");
                            while ((cells = in.readLine()) != null) {
                                    StringTokenizer st = new StringTokenizer(cells, "- ");
                                    while (st.hasMoreTokens()) {
                                           co.classNumber = Integer.valueOf(st.nextToken()).intValue();
                                           co.classRelation = Integer.valueOf(st.nextToken()).intValue();
                                          // System.out.println(co[x].classRelation);
                                           vec.addElement(co);
                                           x++;
                                    System.out.println("\n" + x);
                                    System.out.println(vec.lastElement());
                    catch (IOException e) {
                            System.out.println("cannot read file");
                            System.exit(0);
            public static void main (String[] args) throws Exception {
                    new Test ();
    //ClassObject.java
    import java.util.*;
    import java.lang.*;
    public class ClassObject {
            int classNumber;
            int classRelation;
    //input.dat
    5
    1-2 1-3 2-4 3-4 4-5Thanks!!!!!

    public class ClassObject
        int classNumber;
        int classRelation;
        public String toString()
            return classNumber + "-" + classRelation;
    }

  • Sort a vector of objects by one of its attributes

    Hi all!
    I have created this class:
    public class Client {
    private int numero;
    private double tempsEntrada;
    private double tempsServei;
    private double tempsIniciSessio;
    private char tipus;
    * Creates a new instance of Client
    public Client(int num, double temp,double servei, char tip) {
    numero = num;
    arrivalTime = temp;
    serviceTime = servei;
    tipus = tip;
    public char getTipus()
    return tipus;
    public int getNumero()
    return numero;
    public double getTempsEntrada()
    return arrivalTime;
    public double getTempsServei()
    return serviceTime;
    Now I've done a java vector of this object, and I want to sort it by arrivalTime.
    The class comparer looks like this
    public class Comparer implements Comparator {
    public int compare(Object obj1, Object obj2)
    double temps1 = ((Client)obj1).getTempsEntrada();
    double temps2 = ((Client)obj2).getTempsEntrada();
    return (int)(temps1 - temps2);
    now when I do Collections.sort(vector);
    this is the error reported:
    Exception in thread "main" java.lang.ClassCastException: cafevirtual.Client cannot be cast to java.lang.Comparable
    at java.util.Arrays.mergeSort(Arrays.java:1144)
    at java.util.Arrays.mergeSort(Arrays.java:1155)
    at java.util.Arrays.mergeSort(Arrays.java:1155)
    at java.util.Arrays.sort(Arrays.java:1079)
    at java.util.Collections.sort(Collections.java:117)
    at cafevirtual.Main.main(Main.java:76)
    Java Result: 1
    what's wrong?
    thanks!

    Your Client class does not implement Comparable. You have to specify the Comparator to use: Collections.sort(vector, new Comparer());

  • Sorting a vector of objects using attribute of object class as comparator

    i would like to sort a vector of objects using an attribute of object class as comparator. let me explain, i'm not sure to be clear.
    class MyObject{
    String name;
    int value1;
    int value2;
    int value3;
    i've got a Vector made of MyObject objects, and i would sort it, for instance, into ascending numerical order of the value1 attribute. Could someone help me please?
    KINSKI.

    Vector does not implement a sorted collection, so you can't use a Comparator. Why don't you use a TreeSet? Then you couldclass MyObject
      String name;
      int value1;
      int value2;
      int value3;
      // Override equals() in this class to match what our comparator does
      boolean equals (Object cand)
        // Verify comparability; this will also allow subclasses.
        if (cand !instanceof MyObject)
          throw new ClassCastException();
        return value1 = cand.value1;
      // Provide the comparator for this class. Make it static; instance not required
      static Comparator getComparator ()
        // Return this class's comparator
        return new MyClassComparator();
      // Define a comparator for this class
      private static class MyClassComparator implements Comparator
        compare (Object cand1, Object cand2)
          // Verify comparability; this will also allow subclasses.
          if ((cand1 !instanceof MyObject) || (cand2 !instanceof MyObject))
            throw new ClassCastException();
          // Compare. Less-than return -1
          if ((MyObject) cand1.value1 < (MyObject) cand2.value1))
            return -1;
          // Greater-than return 1
          else if ((MyObject) cand1.value1 > (MyObject) cand2.value1))
            return 1;
          // Equal-to return 0.
          else
            return 0;
    }then just pass MyObject.getComparator() (you don't need to create an instance) when you create the TreeSet.

  • Vector smart Object wont open

    Dear Adobe,
    i'm getting furious when i'm bombarded with new options and messages that i should hurry uprading to CC when the CS 6 release is still buggy. Illustrator CS 6 is nearly inusable. When i double click on a vector smart object Layer Icon in Photoshop Ilustrator opens and... nothing happens. Please dont tell me to get subscription when i just payed 4000 € for a buggy Version of Creative Suite. Make it worth the money.
    Please find out why i cant use vector smart Object like i did in CS 5.5 or give me my money back.
    J.

    Hello  thanks for your answers,
    i posted this when i was upset because it was a very frustrating situation. I create Vector art in Illustrator and most of the times i just copy and paste them into Photoshop. I dont use Illustrator Cs6 because some Issues with the color Picker and because i Use Scriptographer alot. So i use Photoshop CS6 and Illustrator CS 5.
    Somehow recently i noticed this strange behaviour. When i close Illustrator completely and doubleclick the Layer in Photoshop it works fine.

  • Vector smart object? Big deal.

    My primary use for Photoshop is for producing illustrations rather than manipulating photographs. With that in mind, I don't understand the revolutionary nature of "Vector" Smart Objects, since once they land in Photoshop they cease to have any "vector" qualities. They can be resized, distorted, and made more or less transparent, which is fine, but all those things can be done to any raster Photoshop layer.  So my feature request is: since Photoshop's Path tool  can deal in vector art within Photoshop, why can't that facility be extended to the Smart Objects? I realize that what I am asking amounts to asking for Illustrator to be installed inside Photoshop, but why not? I think there was an app that worked that way-Deneba Canvas? I don't know, maybe only illustrators who work in both Photoshop and Illustrator would care about this, but I do a lot of it-produce an item in Adobe Illustrator for use in a picture, then copy and paste it into a scanned figure opened in Photoshop, then add shadows and tones. It would be helpful to be able to manipulate the vector art as vector art in Photoshop.

    ya, you  have to open it up in ai like the above post said if you want to edit it. but also one of the advantages to smart objects is that when you resize it, the quality remains unchanged as long as it is equal to or smaller than the original size. for example, if you design a button in illustrator, then you put it on a web page in photoshop and scale it down and hit enter, you can always make it bigger (up to original size) without losing quality. if you did this with a regular raster image you cannot size it up without losing quality.
      the reason you cannot edit the vectors in photoshop is that vector and raster are different types of files. it's kindof like trying to edit videos in photoshop. just wont work. it'd be cool if you could though because i am in your shoes too.

  • Quality Loss of Vector Smart Objects

    In Photoshop CC, when I paste the vectors from illustrator, I get this. The upper one was typed in photoshop CC but the above one was copied and pasted from Illustrator CC. I've been using this two program since CS3 and I never see a thing like this. Is there any solutions to fix it?

    You have antialiasing turned off for the lower one. Select the transform tool and turn antialiasing back on for that smart object.

  • Wewy simple (Vector of Object[]s)

    Yeah, very simple, but I still don't get it. I have a Vector of Object[]s, and I want to freely manipulate the data inside the Object[]s. I am still having trouble in getting the data from within Object[]s back to their String representation, instead of having their address in the JVM.
         Object[] single = new Object[3];
         Vector many = new Vector();
              single[0] = ("first");
              single[1] = ("second");
              single[2] = ("third");
         many.add (single);
              single[0] = ("fourth");
              single[1] = ("fifth");
              single[2] = ("sixth");
         many.add (single);     What kind of magick trickery does it take to a) extract, say, "fifth" out of the Vector, and b) to change that "fifth" to a "5th" in an efficient, simple and sophisticated manner?

    This is my solution, and it works, but is not simple nor sophisticated. How efficient it is, I don't know. Suggestions?
         ArrayList single = new ArrayList();
              for (int i=0 ; i < 3 ; i++)
                   single.add("");
         ArrayList many = new ArrayList();
              single.set (0, "first");
              single.set (1, "second");
              single.set (2, "third");
         many.add (single.clone());
              single.set (0, "fourth");
              single.set (1, "fifth");
              single.set (2, "sixth");
         many.add (single.clone());     
         System.out.println(many);
         System.out.println(many.get(0));
         System.out.println(     ((ArrayList)many.get(0)).get(0)     );
         ((ArrayList)many.get(0)).set(0,"1st");
         ((ArrayList)many.get(0)).set(1,"2nd");
         ((ArrayList)many.get(0)).set(2,"3rd");
         ArrayList extr = new ArrayList();
              for (int i=0 ; i < 3 ; i++)
                   extr.add (     ((ArrayList)many.get(0)).get(i)     );
         System.out.println(extr);
         System.out.println(extr.get(0));

  • Passing vector of object with multiple datatype

    Hi
    I want to pass vector of objects to stored procedure and I am facing some problem
    please suggest is it possible or I need to follow some other way.
    I have one class detail with two attributes i.e int ID and string course
    In main I have created 1000 objects of different ID and course and pushed back the objects to avector of detail and passed to a function my function is
    void bulkdatainsert(vector<detail>rec)
    stmt = conn->createStatement ("begin storeBulk(:1);end;");
         stmt->setMaxIterations(rec.size());
         stmt->setMaxParamSize(1,1024);
         setVector(stmt,1,rec,"course"); // The error coming here
    The error is due to the type rec .
    I want to know can we pass objects of multiple data to stored procedure through OCCI ?
    If not do we need to break every attribute and make vector of corresponding attributes and pass to stored procedure?
    please suggest me
    Thanks

    I think Custom objects are not supported directly.
    Following are the normal ones which you can use
    void setVector(
    Statement *stmt,
    unsigned int paramIndex,
    const vector< T > &vect,
    const string &schemaName,
    const string &typeName);
    Intended for use on platforms
    where partial ordering of function
    templates is not supported, such
    as Windows NT. Multibyte
    support.
    void setVector(
    Statement *stmt,
    unsigned int paramIndex,
    const vector<T* > &vect,
    const string &schemaName,
    const string &typeName);
    Intended for use on platforms
    where partial ordering of function
    templates is supported. Multibyte
    support.
    void setVector(
    Statement *stmt,
    unsigned int paramIndex,
    const vector<BDouble> &vect
    const string &sqltype);
    void setVector(
    Statement *stmt,
    unsigned int paramIndex,
    const vector<Bfile> &vect,
    const string &schemaName,
    const string &typeName);
    void setVector(
    Statement *stmt,
    unsigned int paramIndex,
    const vector<BFloat> &vect
    const string &sqltype);
    void setVector(
    Statement *stmt,
    unsigned int paramIndex,
    const vector<Blob> &vect,
    const string &schemaName,
    const string &typeName);
    void setVector(
    Statement *stmt,
    unsigned int paramIndex,
    const vector<Blob> &vect,
    const UString &schemaName,
    const UString &typeName);
    Sets a const Blob vector; UTF16
    support.
    void setVector(
    Statement *stmt,
    unsigned int paramIndex,
    const vector<Clob> &vect,
    const string &schemaName,
    const string &typeName);
    Sets a const Clob vector;
    multibyte support.
    void setVector(
    Statement *stmt,
    unsigned int paramIndex,
    const vector<Clob> &vect,
    const UString &schemaName,
    const UString &typeName);
    Sets a const Clob vector; UTF16
    support.
    void setVector(
    Statement *stmt,
    unsigned int paramIndex,
    const vector<Date> &vect,
    const string &schemaName,
    const string &typeName);
    Sets a const Date vector;
    multibyte support.

  • Vector of Object?!

    Can someone explain to me the constructor for an vector of object?! i kinda dont get the API .. Please and Thank You

    is array list like a vector? Yes, they both (currently) implement the List interface, so they are quite similar.
    but is a arraylist
    resizeable...Yes.
    i m just a high school student tryin to learn..
    sorry..No worries - but I think you need to read some tutorials - try something in here:
    http://java.sun.com/docs/books/tutorial/
    Good Luck
    Lee

  • Illustrator CC crashing during Vector Smart Object save

    I have a user who is running Adobe CC under Yosemite  on a new 5K iMac.
    After a few weeks of no issues she is suddenly unable to open Vector Smart Objects from Photoshop into Illustrator and save them after editing.
    Illustrator crashes as soon as she tries to save.

    Do you mean that you are double clicking on placed smart object and you get the error. Is the smart object originally from Illustrator and does Illustrator open open?
    Would help to know more detail about EXACTLY when your error happens and far you get. This way we can determine if you have a file association problem, memory problem, corrupt font/image problem.

Maybe you are looking for