public ListIterator<Node> getRemaining(Node current) {
   Vector<Node> v = new Vector<Node>();
   for (Node n : list.subList(indexOf(current), list.size())) {
     v.add(n.getLookup().lookup(ModelComponentNode.class));
   }
   return (v.listIterator());
 }
Exemple #2
1
 protected Shape getShape() {
   if (points.isEmpty()) {
     return null;
   }
   java.awt.geom.GeneralPath gp = new java.awt.geom.GeneralPath();
   gp.moveTo(
       (float) ((Point2d) points.firstElement()).x, (float) ((Point2d) points.firstElement()).y);
   java.util.ListIterator li = points.listIterator(1);
   while (li.hasNext()) {
     Point2d cur = (Point2d) li.next();
     gp.lineTo((float) cur.x, (float) cur.y);
   }
   gp.closePath();
   return gp;
 }
Exemple #3
0
  public Vector _clone_sort(Vector dati, Vector dati_cr) {
    Vector result = new Vector();
    Vector index = new Vector();
    for (int i = 0; i < dati_cr.size(); i++) index.add(new Integer(i));
    try {

      Object a[] = dati_cr.toArray();
      Object a_index[] = index.toArray();
      Object src_index[] = (Object[]) a_index.clone();
      Object src[] = (Object[]) a.clone();
      _clone_mergeSort(src, a, 0, a.length, src_index, a_index);
      ListIterator li = dati_cr.listIterator();
      ListIterator l_index = index.listIterator();
      for (int j = 0; j < a.length; j++) {
        li.next();
        li.set(a[j]);
        l_index.next();
        l_index.set(a_index[j]);
      }
    } catch (Exception e) {
      e.toString();
    }

    for (int i = 0; i < index.size(); i++)
      result.add(dati.elementAt(((Integer) index.elementAt(i)).intValue()));
    return result;
  }
Exemple #4
0
  private static void _clone_sortSelf(Vector dati, Vector dati_cr, int start, int finish) {
    if (dati == null
        || dati.size() == 0
        || start < 0
        || start > dati.size()
        || finish < 0
        || finish > dati.size()
        || start > finish
        || dati_cr == null
        || dati_cr.size() != dati.size()) return;

    Vector result = (Vector) dati.clone();
    Vector index = new Vector();
    for (int i = start; i < finish; i++) index.add(new Integer(i));
    try {

      Object a_buf[] = dati_cr.toArray();
      Object a[] = new Object[finish - start];
      for (int j = start; j < finish; j++) a[j - start] = a_buf[j];
      Object a_index[] = index.toArray();
      Object src_index[] = (Object[]) a_index.clone();
      Object src[] = (Object[]) a.clone();
      _clone_mergeSort(src, a, 0, a.length, src_index, a_index);
      ListIterator li = dati_cr.listIterator();
      ListIterator l_index = index.listIterator();
      for (int j = 0; j < finish; j++) {
        if (j >= start) {
          li.next();
          li.set(a[j - start]);
          l_index.next();
          l_index.set(a_index[j - start]);
        } else li.next();
      }
    } catch (Exception e) {
      e.toString();
    }

    for (int i = start; i < finish; i++)
      dati.setElementAt(result.elementAt(((Integer) index.elementAt(i - start)).intValue()), i);
  }
  public boolean matches(String path) {

    boolean needsAcl = false;
    ListIterator<String> list = paths.listIterator();
    String filterPath = null;
    while (list.hasNext() && !needsAcl) {
      filterPath = list.next();
      if (path.matches(filterPath)) {
        needsAcl = true;
      }
    }
    return needsAcl;
  }
  public int getRouteRequestAssociatedReceiver(int routeRequestId) {
    RouteRequestAndReceiverAssociationItem item;
    ListIterator<RouteRequestAndReceiverAssociationItem> iter =
        routeRequestAndReceiverAssociation.listIterator();

    while (iter.hasNext()) {
      item = iter.next();
      if (item.routeRequest == routeRequestId) {
        int sender = item.sender;
        iter.remove();
        return sender;
      }
    }

    return MWACNetworkPartialKnowledgeManager.UNDEFINED_ID;
  }
Exemple #7
0
 private void truncateDataOutsideWindow(java.util.Vector vector) {
   if (vector == null) {
     return;
   }
   long l = (new Date()).getTime() / 1000L;
   java.util.ListIterator listiterator = vector.listIterator();
   do {
     if (!listiterator.hasNext()) {
       break;
     }
     COM.dragonflow.SiteView.RealTimeReportingData realtimereportingdata =
         (COM.dragonflow.SiteView.RealTimeReportingData) listiterator.next();
     if (l - realtimereportingdata.getTime() <= realTimeDataWindow) {
       break;
     }
     listiterator.remove();
   } while (true);
 }
Exemple #8
0
 public void addMessToVectorInSortedOrder(Vector v, MhrEvent ev) {
   ListIterator iter = v.listIterator();
   MhrEvent vEv;
   while (iter.hasNext()) {
     vEv = (MhrEvent) iter.next();
     if (ev.eventTime.compareTo(vEv.eventTime) >= 0) {
       iter.previous();
       iter.add(ev);
       return;
     }
   }
   try {
     iter.add(ev);
   } catch (UnsupportedOperationException e) {
     System.out.println(e.toString());
   } catch (Exception e) {
     System.out.println(e.toString());
   }
 }
Exemple #9
0
 @Override
 public void widgetSelected(SelectionEvent ev) {
   SendMapMessage sender = new SendMapMessage();
   try {
     sender.startSender();
     MapMessage message = sender.getSessionMessageObject();
     PropertyList properties = messageTable.getPropertyList();
     Vector<Property> propertyList = properties.getProperties();
     ListIterator<Property> it = propertyList.listIterator();
     while (it.hasNext()) {
       Property p = (Property) it.next();
       message.setString(p.getProperty(), p.getValue());
     }
     int count;
     try {
       count = Integer.parseInt(_countField.getText());
     } catch (NumberFormatException e) {
       count = 1;
     }
     if (count == 1) {
       message.setString("EVENTTIME", (_jmsDateFormat.format(Calendar.getInstance().getTime())));
       sender.sendMessage(_topicField.getText());
     } else {
       for (int i = 0; i < count; i++) {
         String name = message.getString("NAME");
         String[] nameParts = name.split("_");
         name = nameParts[0] + "_" + i;
         message.setString("NAME", name);
         message.setString(
             "EVENTTIME", (_jmsDateFormat.format(Calendar.getInstance().getTime())));
         sender.sendMessage(_topicField.getText());
       }
     }
   } catch (Exception e) {
     MessageDialog.openError(null, "JMS Sender", "Error sending JMS message: " + e.getMessage());
   } finally {
     try {
       sender.stopSender();
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
 }
 public static Vector<StrokeNetwork> mutateAll(
     Vector<StrokeNetwork> parents,
     double mutationFactor,
     int numMutations,
     int allocateParent,
     int numGenerationsSinceImproved) {
   Vector<StrokeNetwork> mutations = new Vector<StrokeNetwork>();
   Iterator<StrokeNetwork> iterator = parents.listIterator();
   int counter = 0;
   while (iterator.hasNext()) {
     mutations.addAll(
         mutate1(
             iterator.next(),
             mutationFactor,
             numMutations,
             allocateParent,
             numGenerationsSinceImproved));
     counter++;
   }
   return mutations;
 }
Exemple #11
0
  public TaskObject readScriptFile() {
    try {
      // File file = new File(scriptFile);
      int count = 0;
      Scanner scanner = new Scanner(scriptFile);
      while (scanner.hasNext()) {
        if (count == 0) {
          // System.out.println("script: " +scanner.next());
          taskObject.setTaskName(scanner.next());
        }
        tmpList.add(scanner.next());
        count++;
      }
      // iterate tmpList
      ListIterator<String> itr = tmpList.listIterator();

      while (itr.hasNext()) {
        String tmp = itr.next();
        if (tmp.equals("xyzin") || tmp.equals("hklin") || tmp.equals("alignin")) {
          // System.out.println(tmp);
          taskObject.setInputFileName(itr.next());
        }
        if (tmp.equals("xyzout") || tmp.equals("hklout") || tmp.equals("alignout")) {
          // System.out.println(tmp);
          taskObject.setOutputFileName(itr.next());
        }
      }
      scanner.close();

      //	String outputFileName = outputFileNames.elementAt(0);
      //	System.out.println(outputFileName);

    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    return taskObject;
  }
Exemple #12
0
  public void genSideStrips(double extz /* , boolean outside */) {
    sideVertices = null;
    indices = null;
    if (points.isEmpty()) {
      return;
    }

    sideVertices = new Vertex3d[points.size() * 4];
    indices = new int[points.size() * 6];

    java.util.ListIterator li = points.listIterator();
    for (int i = 0; li.hasNext(); i++) {
      Point2d point = (Point2d) li.next();

      Point3d pos = new Point3d(point.x, point.y, -extz / 2);
      sideVertices[i * 2] =
          new Vertex3d(
              pos, new Vector3d((Vector3f) normals.elementAt(i * 2)), null, null, new TexCoord2f());
      sideVertices[i * 2 + 1] =
          new Vertex3d(
              pos,
              new Vector3d((Vector3f) normals.elementAt(i * 2 + 1)),
              null,
              null,
              new TexCoord2f());
      pos = new Point3d(point.x, point.y, extz / 2);
      sideVertices[points.size() * 2 + i * 2] =
          new Vertex3d(
              pos, new Vector3d((Vector3f) normals.elementAt(i * 2)), null, null, new TexCoord2f());
      sideVertices[points.size() * 2 + i * 2 + 1] =
          new Vertex3d(
              pos,
              new Vector3d((Vector3f) normals.elementAt(i * 2 + 1)),
              null,
              null,
              new TexCoord2f());
    }

    for (int i = 0; i < points.size() - 1; i++) {
      // if (outside) {
      indices[i * 6] = 2 * i;
      indices[i * 6 + 1] = 2 * i + 3;
      indices[i * 6 + 2] = 2 * i + 3 + points.size() * 2;
      indices[i * 6 + 3] = 2 * i;
      indices[i * 6 + 4] = 2 * i + 3 + points.size() * 2;
      indices[i * 6 + 5] = 2 * i + points.size() * 2;
      /*
       * } else { indices[i*6]=2*i; indices[i*6+1]=2*i+3+points.length*2;
       * indices[i*6+2]=2*i+3; indices[i*6+3]=2*i;
       * indices[i*6+4]=2*i+points.length*2;
       * indices[i*6+5]=2*i+3+points.length*2; }
       */
    }
    // if (outside) {
    indices[(points.size() - 1) * 6] = 2 * (points.size() - 1);
    indices[(points.size() - 1) * 6 + 1] = 1;
    indices[(points.size() - 1) * 6 + 2] = 1 + points.size() * 2;
    indices[(points.size() - 1) * 6 + 3] = 2 * (points.size() - 1);
    indices[(points.size() - 1) * 6 + 4] = 1 + points.size() * 2;
    indices[(points.size() - 1) * 6 + 5] = 2 * (points.size() - 1) + points.size() * 2;
    /*
     * } else { indices[(points.length-1)*6]=2*(points.length-1);
     * indices[(points.length-1)*6+1]=1+points.length*2;
     * indices[(points.length-1)*6+2]=1;
     * indices[(points.length-1)*6+3]=2*(points.length-1);
     * indices[(points.length-1)*6+4]=2*(points.length-1)+points.length*2;
     * indices[(points.length-1)*6+5]=1+points.length*2; }
     */

  }
 /**
  * Gets a listIterator of all layers.
  *
  * @return a listIterator
  */
 public ListIterator<MapLayer> getLayers() {
   return layers.listIterator();
 }