Searching a Vector of SimpleDateFormat objects

Hi everyone,
I have implemented a vector of vector structure. Each vector contains a list of objects which have been parserd from a log file. I need to write a method which searches one of the inner vectors containing SimpleDateFormat Objects. Two Dates will be entered by the user and the positons of the date objects found within these two dates needs to be returned. If anyone could help that would be great.
Jonny

Hi everyone,
I have implemented a vector of vector structure. Each
vector contains a list of objects which have been
parserd from a log file. I need to write a method
which searches one of the inner vectors containing
SimpleDateFormat Objects. Two Dates will be entered
by the user and the positons of the date objects found
within these two dates needs to be returned. If
anyone could help that would be great.
JonnyWhat? Is it me, or is this a little confused?
Do the inner vectors really contain instances of java.text.SimpleDateFormat?
Could you re-state the problem with an example?

Similar Messages

  • Searching a Vector of objects

    I'm embarassed to ask this question but I haven't figured out the answer myself yet so I need help.
    I need to be able to search a Vector (it could be an Array just as easily) by only certain parts of the objects in the vector. So for example I have vector v that contains 10 objects o. Objects o are a very small custom class that each have a name and a number. How do I search the vector for the object o that contains name x?
    I tried overriding the equals method of object o and using the IndexOf method of vector v but that did not work.

    I'm embarassed to ask this question but I haven't
    figured out the answer myself yet so I need help.
    I need to be able to search a Vector (it could be an
    Array just as easily) by only certain parts of the
    objects in the vector. So for example I have vector
    v that contains 10 objects o. Objects o are a very
    small custom class that each have a name and a
    number. How do I search the vector for the object o
    that contains name x?Iterate over the Vector and ask each element whether its name is x.
    I tried overriding the equals method of object o and
    using the IndexOf method of vector v but that did not
    work.What does "did not work" mean?

  • Search inside vector?

    help please.
    public class items
      String a;
      int b;
      Vector storageVector = new Vector();
    public void wootwoot();
      items weee = new items();
      a=wootest;
      b=100;
      storageVector.add(weee);
    public void search();
      //How could i search the content of 'string a' inside vector v?
      //In array, i could simply search for array[0].a but it's not compatible with vector.
    }

    _helloWorld_ wrote:
    Loop over the Vector and use elementAt(). Then check the contents using the equals() method.Or just override the equals(Object) method in the items class(and preferably the hashCode() as well) and use Vector's get(Object) to get an item from your Vector.

  • Why can't I add an Object[] to a Vector ? super Object[] ?

    I don't understand why javac rejects these two statements:
        Vector<? super Object[]> v= new Vector<Object[]>();
        v.add(new Object[0]);cannot find symbol
    symbol : method add(java.lang.Object[])
    location: class java.util.Vector<capture of ? super java.lang.Object[]>
    v.add(new Object[0]);
    ^
    The type of v can only be one of these 4:
    Vector<Object[]>, Vector<Object>, Vector<Serializable>, Vector<Cloneable>.
    Therefore, I should always be allowed to add an Object[] to it, right?
    The following example is very similar, but this one is accepted by javac.
        Vector<? super Number> v= new Vector<Number>();
        v.add(42);I didn't find a relevant difference to the first example, nor something in JLS3 that would forbid it. Is this a javac bug?

    There is a difference between legal and practical. Practical is a matter of opinion. I thought I should try the combinations to see which make sense.
    I don't find it intuative that list.add(list.get(0)) should fail to compile.
    While the definitions have a logic of their own, some are very hard to put it into english exactly what they really mean. This means finding a practical purpose for them even harder.
    For example List<? super Object>
    add(x) is legal for non-arrays
    method(list) is illegal for method(List<Object>) but is legal for method(List<? super Object[]>)
    public class A {
        public static void foo(List<? super Object[]> l) {    }
        public static void foo2(List<Object[]> l) {    }
        public static void foo3(List<? extends Object[]> l) {    }
        public static void bar(List<? super Object> l) {    }
        public static void bar2(List<Object> l) {    }
        public static void bar3(List<? extends Object> l) {    }
        public static void bar4(List<?> l) {    }
        public static void main(String[] args) {
            {   // can be { Object, Object[] }
                List<? super Object[]> l = new ArrayList<Object[]>();
                l.add(l.get(0));  // illegal
                l.add((Object) null);  // illegal
                l.add((Integer) null);  // illegal
                l.add((Object []) null); // illegal
                l.add((Integer []) null); // illegal
                l.add((Integer [][]) null); // illegal
                foo(l); // List<? super Object[]> - legal
                foo2(l); // List<Object[]> - illegal
                foo3(l); // List<? extends Object[]> - illegal
                bar(l); // List<? super Object> - illegal
                bar2(l); // List<Object> - illegal
                bar3(l); // List<? extends Object> - legal
                bar4(l); // List<?> - legal
            {   // can be Object[] or (? extends Object)[]
                List<Object[]> l = new ArrayList<Object[]>();
                l.add(l.get(0));  // legal
                l.add((Object) null);  // illegal
                l.add((Integer) null);  // illegal
                l.add((Object []) null); // legal
                l.add((Integer []) null); // legal
                l.add((Integer [][]) null); // legal
                foo(l); // List<? super Object[]> - legal
                foo2(l); // List<Object[]> - legal
                foo3(l); // List<? extends Object[]> - legal
                bar(l); // List<? super Object> - illegal
                bar2(l); // List<Object> - illegal
                bar3(l); // List<? extends Object> - legal
                bar4(l); // List<?> - legal
            {   // Only allows wildcards, Object is illegal.
                List<? extends Object[]> l = new ArrayList<Object[]>();
                l.add(l.get(0));  // illegal
                l.add((Object) null);  // illegal
                l.add((Integer) null);  // illegal
                l.add((Object []) null); // illegal
                l.add((Integer []) null); // illegal
                l.add((Integer [][]) null); // illegal
                foo(l); // List<? super Object[]> - illegal
                foo2(l); // List<Object[]> - illegal
                foo3(l); // List<? extends Object[]> - legal
                bar(l); // List<? super Object> - illegal
                bar2(l); // List<Object> - illegal
                bar3(l); // List<? extends Object> - legal
                bar4(l); // List<?> - legal
            {   // can add non-arrays but can only match ? super Object, ? super Object[], or ? extends Object, but not Object 
                List<? super Object> l = new ArrayList<Object>();
                l.add(l.get(0));  // legal
                l.add((Object) null);  // legal
                l.add((Integer) null);  // legal
                l.add((Object []) null); // illegal
                l.add((Integer []) null); // illegal
                l.add((Integer [][]) null); // illegal
                foo(l); // legal
                foo2(l); // illegal
                foo3(l); // illegal
                bar(l); // legal
                bar2(l); // illegal
                bar3(l); // legal
                bar4(l); // legal
            {   // can add array but cannot call a method which expects an array. 100% !
                List<Object> l = new ArrayList<Object>();
                l.get(0).toString();
                l.add(l.get(0));  // legal
                l.add((Object) null);  // legal
                l.add((Integer) null);  // legal
                l.add((Object []) null); // legal
                l.add((Integer []) null); // legal
                l.add((Integer [][]) null); // legal
                foo(l); // legal
                foo2(l); // illegal
                foo3(l); // illegal
                bar(l); // legal
                bar2(l); // legal
                bar3(l); // legal
                bar4(l); // legal
            {   // cannot add any type but can match ? or ? extends Object.
                List<? extends Object> l = new ArrayList<Object>();
                l.add(l.get(0));  // illegal
                l.add((Object) null);  // illegal
                l.add((Integer) null);  // illegal
                l.add((Object []) null); // illegal
                l.add((Integer []) null); // illegal
                l.add((Integer [][]) null); // illegal
                foo(l); // List<? super Object[]> - illegal
                foo2(l); // List<Object[]> - illegal
                foo3(l); // List<? extends Object[]> - illegal
                bar(l); // List<? super Object> - illegal
                bar2(l); // List<Object> - illegal
                bar3(l); // List<? extends Object> - legal
                bar4(l); // List<?> - legal
            {   // same as ? extends Object.
                List<?> l = new ArrayList<Object>();
                l.add(l.get(0));  // illegal
                l.add((Object) null);  // illegal
                l.add((Integer) null);  // illegal
                l.add((Object []) null); // illegal
                l.add((Integer []) null); // illegal
                l.add((Integer [][]) null); // illegal
                foo(l); // List<? super Object[]> - illegal
                foo2(l); // List<Object[]> - illegal
                foo3(l); // List<? extends Object[]> - illegal
                bar(l); // List<? super Object> - illegal
                bar2(l); // List<Object> - illegal
                bar3(l); // List<? extends Object> - legal
                bar4(l); // List<?> - legal
    }

  • How to search for the particular ABAP Object

    Hi,
    I am using the SAP 4.6C machine, I need to search for the particular ABAP Object. Plz can anyone help me in this.
    Regards,
    Pralhad P. Teggi

    You'll get a better response if you ask a meaningful question.
    If you want to scan for Business Objects (BOR) use transaction SWO1
    For ABAP classes / objects use a combination of transactions SE24 / SE18 / SE19 and /or SE80
    (SE 18 /  SE 19 are for Badi's)
    Cheers
    Jimbo

  • Searching a vector

    Ok, second post. I gave up on the whole array idea and moved to vectors. I got it reading the text file and adding to the vector succesfully. Now I need to search that vector. The text file looks like this:
    9876543 9876543 Y
    0612207 0612207 N
    0123456 0123456 N
    1234567 1234567 Y
    Here's my code so far:
    import java.*;
    import java.awt.*;
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class EmailForms extends JFrame implements ActionListener {
         private JTextField jtfUserName;
         private JPasswordField jpfPassword;
         private JButton jbtLogin;
         private JButton jbtCancel;
         Vector LoginData = new Vector();
         public static void main (String[] args) {     
              EmailForms LoginFrame = new EmailForms();
              LoginFrame.setSize(200, 100);
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              int screenWidth = screenSize.width;
              int screenHeight = screenSize.height;
              Dimension frameSize = LoginFrame.getSize();
              int x = (screenWidth - frameSize.width)/2;
              int y = (screenHeight - frameSize.height)/2;
              LoginFrame.setLocation(x, y);
              LoginFrame.pack();
              LoginFrame.setVisible(true);     
         public EmailForms () {     
              try {     
                   String UP1Line;
                   FileInputStream fis = new FileInputStream("UP1.txt");
                  BufferedReader br = new BufferedReader(new InputStreamReader(fis));
                  while ((UP1Line = br.readLine()) != null) {
                        StringTokenizer st = new StringTokenizer(UP1Line, " ");
                        while (st.hasMoreTokens()) {
                          LoginData.addElement(st.nextToken());
                    br.close();
                    fis.close();
              catch (IOException ex){
                   JOptionPane.showMessageDialog(this, "Fatal Systems Error", "Email Forms: File Error 1",
                   JOptionPane.INFORMATION_MESSAGE);
                   System.exit(0);     
              catch (NullPointerException ex){
                   JOptionPane.showMessageDialog(this, "Fatal Systems Error", "Email Forms: File Error 2",
                   JOptionPane.INFORMATION_MESSAGE);
                   System.exit(0);     
              setTitle("E-Forms: Login");
              JPanel jpLoginLabels = new JPanel();
              jpLoginLabels.setLayout(new GridLayout(2, 1));
              jpLoginLabels.add(new JLabel("Username:"));
              jpLoginLabels.add(new JLabel("Password:"));
              JPanel jpLoginText = new JPanel();
              jpLoginText.setLayout(new GridLayout(2, 1));
              jpLoginText.add(jtfUserName = new JTextField(10));
              jpLoginText.add(jpfPassword = new JPasswordField(10));
              JPanel p1 = new JPanel();
              p1.setLayout(new BorderLayout());     
              p1.add(jpLoginLabels, BorderLayout.WEST);
              p1.add(jpLoginText, BorderLayout.CENTER);
              JPanel p2 = new JPanel();
              p2.setLayout(new FlowLayout(FlowLayout.CENTER));     
              p2.add(jbtLogin = new JButton("Login"));
              p2.add(jbtCancel = new JButton("Cancel"));     
              getContentPane().setLayout(new BorderLayout());
              getContentPane().add(p1, BorderLayout.CENTER);
              getContentPane().add(p2, BorderLayout.SOUTH);
              jbtLogin.addActionListener(this);
              jbtCancel.addActionListener(this);
         public void actionPerformed(ActionEvent e) {
              String arg = e.getActionCommand();
              int index = find(jtfUserName.getText().trim(), new String(jpfPassword.getPassword()));
              if (arg == "Cancel") {
                   System.exit(0);
                   arg = "";
              if (arg == "Login") {
                   if (index == -1) {
                        JOptionPane.showMessageDialog(this, "Username/Password Not Found", "Email Forms: Login Error",
                        JOptionPane.INFORMATION_MESSAGE);
                   else {
                        if (index == 1 ){
                             JOptionPane.showMessageDialog(this, "Username and Password Found: Admin", "Email Forms: Good",
                             JOptionPane.INFORMATION_MESSAGE);
                        else {
                             JOptionPane.showMessageDialog(this, "Username and Password Found: User", "Email Forms: Good",
                             JOptionPane.INFORMATION_MESSAGE);          
              arg = "";
         public int find(String UName, String PWord) {
              for (int i = 0; i < LoginData.size(); i++) {                                        
                   // if ((first.element.of.first.line.UName  == LoginData.elementAt(i)) && (second.element.of.first.line.PWord == LoginData(i))) {
                   //          if (third.element.of.first.line.yes or no admin == "Y") {
                   //               goto adminside;
                   //               return 1; }
                   //          else {
                   //               goto userside;
                   //               return 2;
              return -1;
    }Essentially this is a login method. The standard username and password. The kicker is the third entry in each line of the vector "Y" or "No". This entry denotes whether or not the user is an admin. If he/she is an admin, they go to an admin program else he/she is a regular user and goes to the user program. I've done some reading on searching vectors in this forum as well as others, but none have I have read have tackled this third entry. Can someone have a look and give me their opinion.
    Thanks in advance,
    Colin

    Here you go:
    1. Use a HashMap to look up credentials.
    2. Use regular expressions to check for certain values
    The code does what you need (just checked it), but you probably wouldn't save the credentials as a "String[]" array. So there's room for improvement ;)
    import java.awt.*;
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class EmailForms extends JFrame implements ActionListener {
         private static final long serialVersionUID = -6409081110711705001L;
         private JTextField jtfUserName;
         private JPasswordField jpfPassword;
         private JButton jbtLogin;
         private JButton jbtCancel;
         private HashMap<String, String[]> users;
         public static void main (String[] args) {     
              EmailForms LoginFrame = new EmailForms();
              LoginFrame.setSize(200, 100);
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              int screenWidth = screenSize.width;
              int screenHeight = screenSize.height;
              Dimension frameSize = LoginFrame.getSize();
              int x = (screenWidth - frameSize.width)/2;
              int y = (screenHeight - frameSize.height)/2;
              LoginFrame.setLocation(x, y);
              LoginFrame.pack();
              LoginFrame.setVisible(true);     
         public EmailForms () {     
              users = new HashMap<String, String[]>();
              try {     
                   String UP1Line;
                   FileInputStream fis = new FileInputStream("UP1.txt");
                  BufferedReader br = new BufferedReader(new InputStreamReader(fis));
                  while ((UP1Line = br.readLine()) != null) {
                       String [] items = UP1Line.split(" ", 4);     //max. 6 tokens, separated by semicolon
                       users.put(items[0], new String[] { items[1], items[2] });
                       if (items[2].matches("[Yy]"))
                            System.err.println("y");
                       else
                            System.err.println("n");
                    br.close();
                    fis.close();
              catch (IOException ex){
                   JOptionPane.showMessageDialog(this, "Fatal Systems Error", "Email Forms: File Error 1",
                   JOptionPane.INFORMATION_MESSAGE);
                   System.exit(0);     
              catch (NullPointerException ex){
                   JOptionPane.showMessageDialog(this, "Fatal Systems Error", "Email Forms: File Error 2",
                   JOptionPane.INFORMATION_MESSAGE);
                   System.exit(0);     
              setTitle("E-Forms: Login");
              JPanel jpLoginLabels = new JPanel();
              jpLoginLabels.setLayout(new GridLayout(2, 1));
              jpLoginLabels.add(new JLabel("Username:"));
              jpLoginLabels.add(new JLabel("Password:"));
              JPanel jpLoginText = new JPanel();
              jpLoginText.setLayout(new GridLayout(2, 1));
              jpLoginText.add(jtfUserName = new JTextField(10));
              jpLoginText.add(jpfPassword = new JPasswordField(10));
              JPanel p1 = new JPanel();
              p1.setLayout(new BorderLayout());     
              p1.add(jpLoginLabels, BorderLayout.WEST);
              p1.add(jpLoginText, BorderLayout.CENTER);
              JPanel p2 = new JPanel();
              p2.setLayout(new FlowLayout(FlowLayout.CENTER));     
              p2.add(jbtLogin = new JButton("Login"));
              p2.add(jbtCancel = new JButton("Cancel"));     
              getContentPane().setLayout(new BorderLayout());
              getContentPane().add(p1, BorderLayout.CENTER);
              getContentPane().add(p2, BorderLayout.SOUTH);
              jbtLogin.addActionListener(this);
              jbtCancel.addActionListener(this);
         public void actionPerformed(ActionEvent e) {
              String arg = e.getActionCommand();
              int index = find(jtfUserName.getText().trim(), new String(jpfPassword.getPassword()));
              if (arg == "Cancel") {
                   System.exit(0);
                   arg = "";
              if (arg == "Login") {
                   if (index == -1) {
                        JOptionPane.showMessageDialog(this, "Username/Password Not Found", "Email Forms: Login Error",
                        JOptionPane.INFORMATION_MESSAGE);
                   else {
                        if (index == 1 ){
                             JOptionPane.showMessageDialog(this, "Username and Password Found: Admin", "Email Forms: Good",
                             JOptionPane.INFORMATION_MESSAGE);
                        else {
                             JOptionPane.showMessageDialog(this, "Username and Password Found: User", "Email Forms: Good",
                             JOptionPane.INFORMATION_MESSAGE);          
              arg = "";
         public int find(String UName, String PWord) {
              String [] creds = users.get(UName);
              if (creds!=null && creds[0].matches(PWord)) {
                   System.out.println("ok");
                   if (creds[1].matches("[Yy]"))
                        return 1;
                   else
                        return 0;
              System.err.println("not ok");
              return -1;
    }

  • Vector and my object??

    hi all,
    I am reading a binary file, then creating the object and adding that object in my vector. How can i get it back according to its id? let is say i added all the customers read from file and now i want to get customer 3?
    int thisId=dis.readInt();
    String thisName=dis.readUTF();
    double thisBalance=dis.readDouble();
    Customer cus=new Customer(thisName,thisId,thisBalance);
    cusList.add(cus);
    abdul

    Best possible way is to use Hashtable and put customerid as key and Customer object
    as value.
    Modify your code with,
    Customer cus=new Customer(thisName,thisId,thisBalance);
    some-hashtable-object.put(thisId,cus);
    now if you want to take particular Customer
    use
    Customer c = (Customer)some-hashtable-object.get(any customerid);
    Now if you don't want to use Hashtable and continue with Vector then you have to iterate the,
    Vector and whether object has id 3 .
    like
    for(int i=0;i<Vectorobject.size();i++){
    Customer c = (Customer) Vectorobject.get(i);
    id = c.getCustomerId() // or any method you have to get id;
    // check it....
    But i think Hashtable is the better way to use here.
    I think you understand what i want to say .
    Tarak.

  • Search help,F4 function& matchcode object , give difference

    hi guru
    i confuse about this 3 functionlity.
    search help,F4 function& matchcode object ,
    please tell me the differences.
    regards.
    subhasis.

    Hi,
    Search Help
    Use
    With this function you can search for objects, thereby defining and linking different selection conditions for the search help.
    Prerequisites
    You can call this function by:
    · Selecting Object ® Search... () in the main menu bar of the Integration Builder
    · Placing the cursor on a software component version and selecting Search... () in the context menu (only in the Integration Repository)
    In this case the software component version is defined as the search criteria.
    Features
    Defining the Object Type
    You can select the object type in a dropdown list in field Object Type.
    In the design (Integration Repository) you can
    · Select an object type (for example Message Interface)
    · Select a cross-object category (for example Interface Objects)
    In the configuration (Integration Directory) you can select types Values Mapping Group and schema in addition to the individual object types.
    CHECK THIS LINK TO CREATE A SEARCH HELP.
    http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_basic.htm
    CHECK THIS LINK TO CREATE A MATCHCODE OBJECT
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci553386,00.html
    more details...
    Regards,
    Priyanka.

  • Searching through an array of objects

    Hi, I am currently working on an assignment where I have to create a class called Persons with data fields of Name(String),age(int),income(int).
    All the values including the string values for name and values for income and age are all randomly generated and are stored in an array of objects of class "Persons".
    The array size is user specified.
    What I must attempt to implement now is to make a search feature that lets the user search through the array of objects for a particular name.
    I'm having some bad luck trying to implement this feature.
    If anyone can help me, I would greatly appreciate that!
    Cheers.

    Hi, Thank you for the prompt reply.
    I do not yet know HOW to start this,I mean I know how to search for individual characters in an element of an array, but to search for whole strings I am quite unsure.
    public class Persons
        //data fields
        private String name;
        private int age;
        private int income;
        //Constructor for Class Persons
        public Person(String[] name,int[] age,int[] income)
              String[] tempName = name;
              int[] tempAge = age;
              int[] itempIncome = income;
        //Instance method for returning some basic values about personal data
        public void toString(Persons ofChoice)
            System.out.println("Persons Data");
            System.out.println("Name: " + ofIntrest.name);
            System.out.println("Age: " + ofIntrest.age);
            System.out.println("Income: $" + ofIntrest.income);
    }This is my Persons class code, but I am quite stumped how to search for whole strings at the time being.

  • Search a Vector

    How do I search the objects inside a Vector?

    Have you tried Collections.binarySearch( List list,
    Object key, Comparator c )?That will work but only if the Vector is sorted.

  • Photoshop Vectors and Smart Objects Create Blurring

    I have been supplied a Photoshop document that has Illustrator Vector files that have been placed in the PSD as Smart objects.
    When I bring the PSD into InDesign and print it, all the PSD artwork is blurry.
    How can I get the PSD file to print from InDesign at high quality.
    The PSD file is at 300 dpi. I have tried bringing it into InDesign as PSD, TIFF, EPS & PDF, but it's the same issue every time.

    Here is your screenshots

  • I created a vector and added objects, but the vector is empty

    I created an object called a facility, it accepts 2 strings in the creator but stores the data as a string and a float. as you can see from the code below, i have tried to create a vector object to contain facilitys and named it entries. when i add objects to this vector, the vectors size does not change, and i cannot access elements of it via their index. but when i print the vector out i can see the elements? what is going on here. i am very confused. ps, if it helps i havent worked with vectors much before.
    FacilitysTest.java
    import java.util.*;
    public class FacilitysTest {
         public static void main (String [] args) {
         Facilitys entries = new Facilitys();
         entries.add("Stage","3.56");
         entries.add("kitchen","5.00");
         entries.add("heating","2");
    //     System.out.println(entries.firstElement() );
         System.out.println("printing out entries");
         System.out.println(entries);
         System.out.println();
         System.out.println("There are "+entries.size()+" entries");
         System.out.println();
         System.out.println("modifying entry 2");
         entries.setElementAt(new Facility("lighting","1.34"), 2);
         System.out.println(entries);
         System.out.println();
         System.out.println("deleting entry 1");
         entries.remove(1);
         System.out.println(entries);
    }the following is what happens when i run this code.
    the number (0,1,2) is taken from a unique number assigned to the facility and is not anything to do with the facilitys position in the vector.
    printing out entries
    Facility number: 0, Name: Stage , Cost/Hour: 3.56
    Facility number: 1, Name: kitchen , Cost/Hour: 5.0
    Facility number: 2, Name: heating , Cost/Hour: 2.0
    There are 0 entries
    modifying entry 2
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 >= 0
    at java.util.Vector.setElementAt(Vector.java:489)
    at FacilitysTest.main(FacilitysTest.java:17)
    Press any key to continue . . .
    Facilitys.java
    import java.util.*;
    public class Facilitys extends Vector {
         private Vector entries;
         public Facilitys( ) {
                 entries = new Vector();
        public void add( String name, String price ) {
             entries.add((new Facility( name, price) ));
        public Facility get(int index) {
              return ((Facility)entries.get(index));
         public float total() {
              float total = 0;
              for (int i = 0; i<entries.size();i++) {
                   total = total + ( (Facility)entries.get(i) ).getPricePerHour();
              return total;
        public String toString( ) {
            StringBuffer temp = new StringBuffer();
            for (int i = 0; i < entries.size(); ++i) {
                temp.append( entries.get(i).toString() + "\n" );
            return temp.toString();
    }

    are you reffering to where i have public class
    Facilitys extends Vector {
         private Vector entries;
         public Facilitys( ) {
                 entries = new Vector();
    That's correct. That's your problem.
    i added the extends Vector, because without it i got
    the following errors
    C:\Documents and Settings\george\My
    Documents\University\JavaCode\CM0112\FacilitysTest.jav
    a:14: cannot find symbol
    symbol : method size()
    location: class Facilitys
    System.out.println("There are "+entries.size()+"
    " entries");That's because you haven't implemented a size method in your class.
    ^
    C:\Documents and Settings\george\My
    Documents\University\JavaCode\CM0112\FacilitysTest.jav
    a:17: cannot find symbol
    symbol : method setElementAt(Facility,int)
    location: class Facilitys
    entries.setElementAt(new
    w Facility("lighting","1.34"), 2);That's because you haven't implemented setElementAt in your class.
    C:\Documents and Settings\george\My
    Documents\University\JavaCode\CM0112\FacilitysTest.jav
    a:21: cannot find symbol
    symbol : method remove(int)
    location: class Facilitys
         entries.remove(1);
    ^That's because you haven't implemented remove in your class.
    /Kaj

  • Search Facility in User Defined Object (Default Forms)

    Hi,
    I have created a User Defined Object in the Default Forms section and chose the 'Find' tickbox when registering the UDT.  Now I have populated the data into the UDO but I can't search for data in columns.
    Am I doing something wrong please?  Can this be done?
    Thanks.

    Hi Vankri,
    Check the thread
    UDO Default form "find" function
    Regards
    Jambulingam.P

  • Search script generator for all objects and data (!) from a user/schema ?

    Is there a way to create a script which (when run) creates all the existing
    TABLES; INDEXES, KEYS and DATA for a specified user/schema ?
    This (PL-)SQL script should contain all INSERTS for the currently existing rows of
    all the TABLEs.
    When I use e.g. export to Dumpfile I have at first find all TABLEs and components
    which I want to dump. This is rather uncomfortable.
    I just want to specify the user name similar to
    createscript user=karl@XE outfile=D:\mydata\myscript.sql
    Is this somehow possible ?

    So that I understand your requirements exactly, are you asking for your script to ...
    1/ export from database A the entire schema of a specified user
    2/ drop all objects owned by that user in database B
    3/ import the objects from database A into database B
    If so, it sounds to me that a shell script that does a schema level export as Nicholas suggested, and then drops the user from database B using the cascade keyword (e.g. drop user username cascade), recreates the user and then imports the export file into B should do the trick.
    I don't think searching for individual tables and creating the statements to recreate them is the best idea.
    Hope that helps
    Graham

  • Vector and session object...

    Hi, I have a JSP that retrieves a resultset with 3000+ rows. I use that resultset to create a summary page of grouped data, so the resulting page is only a few lines. Each group is a link that can be double clicked to call a JSP that will display the detail line items.
    From a developers viewpoint, this is how I'm doing it: On the first JSP, as I scan through the resultset creating the summary line items I add the detail data to a vector. After I'm done processing the resultset I add the vector to the session object. When the hyperlink on the first JSP is activated I call a second JSP that retreives the vector from the session object and display the results.
    Is that a good idea or a bad idea? It seems to work ok, but I'm thinking it might be alot of data to be storing on a session object especially when you consider the number of users that could be on. Is there a way to compress the vector when I add it to the session object? Is there a better way to do this? Unfortunately, I can't re-retrieve the data because the SQL takes too long. Thanks!

    Sure you could compress it... you could use the classes in java.util.zip, and use an ObjectOutputStream plus a ZipOutputStream plus a ByteArrayOutputStream (I think), using zip compression to convert your Vector into an array of bytes, and then do the reverse when you needed the data uncompressed. Chances are that would compress your data by about 80 or 90%.
    Here you would be making the classic tradeoff between memory usage and processing time; I wouldn't do this compression thing until it was clear that it was necessary, though.

Maybe you are looking for