示例#1
0
  public static void main(String[] args) {
    Vector<String> v = new Vector<String>();

    v.add("Jupiter");
    v.add("Marte");
    v.add("Mercurio");
    v.add("Neptuno");
    v.add("Pluton");
    v.add("Saturno");
    v.add("Tierra");
    v.add("Urano");
    v.add("Venus");

    System.out.println("Capacidad: " + v.capacity() + " Longitud: " + v.size());

    if (v.contains("Saturno")) {
      System.out.println("La posicion de Saturno es: " + v.indexOf("Saturno"));
    }

    System.out.println("Primer elemento: " + v.firstElement());
    System.out.println("Ultimo elemento: " + v.lastElement());

    StringBuffer log = new StringBuffer("Logroño");

    v.add(v.indexOf("Tierra"), log.toString());

    System.out.println("Capacidad: " + v.capacity() + " Longitud: " + v.size());

    Integer edad = new Integer(23);

    v.add(edad.toString());

    System.out.println(v.toString());

    v.removeAllElements();

    System.out.println("Capacidad: " + v.capacity() + " Longitud: " + v.size());
  }
示例#2
0
    @Override
    public void addRow(Object... values) throws RemoteException {
      if (stmt == null) throw new RemoteException("Bulk loader unable to continue after failure");
      if (values.length != fieldNames.length)
        throw new RemoteException(
            String.format(
                "Number of values does not match number of fields (Expected %s, received %s)",
                fieldNames.length, values.length));

      try {
        rowBuffer.add(values);
        if (rowBuffer.size() == rowBuffer.capacity()) flushBuffer();
      } catch (SQLException e) {
        throw new RemoteException("Unable to insert record", e);
      }
    }
示例#3
0
  public TimeSeries(Vector points) {
    labels = new ArrayList(); // TODO isLabeled constuctor options?
    timeReadings = new ArrayList();
    tsArray = new ArrayList();
    boolean isFirstColTime = false;
    boolean isLabeled = false;

    try {
      // Record the Label names (fropm the top row.of the input file).

      labels.add("Time");
      int currentCol = 1; // TODO input fails gracefully
      while (currentCol < 3) {
        labels.add(new String("c" + currentCol++)); // TODO add measurement with no time
      }

      int count = points.capacity();
      int x = 0;
      for (x = 0; x < count; x++) // read lines until end of file
      {
        Point p = new Point();
        com.android.gesture.Point px = (com.android.gesture.Point) points.get(x);
        p.x = px.x;
        p.y = px.y;
        final ArrayList currentLineValues = new ArrayList();
        currentCol = 0;
        currentLineValues.add(p.x);
        currentLineValues.add(p.y);

        timeReadings.add(new Double(timeReadings.size()));
        final int firstMeasurement;
        firstMeasurement = 0;
        final TimeSeriesPoint readings =
            new TimeSeriesPoint(
                currentLineValues.subList(firstMeasurement, currentLineValues.size()));
        tsArray.add(readings);
        //
      } // end if
    } // end while loop
    catch (Exception e) {
      Log.e("EE", "exveption in creating time series" + e.toString());
      e.printStackTrace();
    }
  } // end constructor
示例#4
0
  public static void main(String args[]) {
    Vector dic = new Vector(4, 3);
    dic.addElement("hool");
    dic.addElement("bye");
    dic.addElement("table");
    dic.addElement("chair");
    dic.addElement("head");
    dic.addElement("face");

    dic.removeElementAt(dic.indexOf("head", 4));
    dic.insertElementAt("Head", 1);

    System.out.println("La capa max es: " + dic.capacity());
    System.out.println("El num d'elements es: " + dic.size());
    System.out.println("L'element de la po 2 es : " + dic.elementAt(0));

    System.out.println("\nContigut de Vector\n");
    for (Enumeration e = dic.elements(); e.hasMoreElements(); ) {
      System.out.println(e.nextElement());
    }
  }
示例#5
0
 public int getSize() {
   return buffer.capacity();
 }
示例#6
0
 public int getLineReaderCount() {
   return lineReader.capacity();
 }
 /**
  * Returns the current capacity of this list.
  *
  * @return the current capacity
  * @see Vector#capacity()
  */
 public int capacity() {
   return delegate.capacity();
 }
 @Override
 public int getSize() {
   return adaptee.capacity();
 }
示例#9
0
 public int capacity() {
   return _values.capacity();
 }