Exemplo n.º 1
0
  /**
   * Computes a context-sensitive same-level chop from <code>sourceSet</code> to <code>sinkSet
   * </code>.
   *
   * @param sourceSet The source criterion set. Should not contain null, should not be empty.
   * @param sinkSet The target criterion set. Should not contain null, should not be empty.
   * @return The chop (a HashSet).
   * @throws InvalidCriterionException, if the nodes in sourceSet and targetSet do not belong to the
   *     same procedure or if one of the sets is empty.
   */
  public Collection<SDGNode> chop(Collection<SDGNode> sourceSet, Collection<SDGNode> sinkSet)
      throws InvalidCriterionException {
    // the bouncer
    if (!Chopper.testSameLevelSetCriteria(sourceSet, sinkSet)) {
      // Thou shall not pass!
      throw new InvalidCriterionException(
          "This is not a same-level chopping criterion: " + sourceSet + ", " + sinkSet);
    }

    // compute the initial chop
    Collection<SDGNode> currentChop = intraChopper.chop(sourceSet, sinkSet);

    // retrieve all (formal-in / formal-out) pairs that belong to a summary edge in the chop
    LinkedList<SDGNodeTuple> worklist = new LinkedList<SDGNodeTuple>();
    worklist.addAll(getSummaryEdgePairs(currentChop));
    Set<SDGNodeTuple> visitedTuples = new HashSet<SDGNodeTuple>();

    // gradually add the chops for each (formal-in / formal-out) pairs
    while (!worklist.isEmpty()) {
      SDGNodeTuple pair = worklist.pop();

      if (!visitedTuples.contains(pair)) {
        visitedTuples.add(pair);
        SDGNode m = pair.getFirstNode();
        SDGNode n = pair.getSecondNode();

        // update the worklist with new (formal-in / formal-out) pairs
        Collection<SDGNode> chop = intraChopper.chop(m, n);
        currentChop.addAll(chop);
        worklist.addAll(getSummaryEdgePairs(chop));
      }
    }

    return currentChop;
  }
Exemplo n.º 2
0
 /**
  * Replies all primitives
  *
  * @return all primitives
  */
 public List<OsmPrimitive> getPrimitives() {
   LinkedList<OsmPrimitive> ret = new LinkedList<OsmPrimitive>();
   ret.addAll(toAdd);
   ret.addAll(toUpdate);
   ret.addAll(toDelete);
   return ret;
 }
Exemplo n.º 3
0
  /** Create a list of variants from this VcfEntry */
  public List<Variant> variants() {
    if (variants != null) return variants;

    // Create list of variants
    variants = new LinkedList<>();

    // Create one Variant for each ALT
    Chromosome chr = (Chromosome) parent;

    if (!isVariant()) {
      // Not a variant?
      List<Variant> vars = variants(chr, start, ref, null, id);
      String alt = ".";

      // Add original 'ALT' field as genotype
      for (Variant variant : vars) variant.setGenotype(alt);

      variants.addAll(vars);
    } else {
      // At least one variant
      for (String alt : alts) {
        if (!isVariant(alt)) alt = null;
        List<Variant> vars = variants(chr, start, ref, alt, id);
        variants.addAll(vars);
      }
    }

    return variants;
  }
Exemplo n.º 4
0
  void mixLists(
      LinkedList<Integer> left,
      LinkedList<Integer> right,
      ArrayList<LinkedList<Integer>> mix,
      LinkedList<Integer> before) {
    if (before.isEmpty() || right.isEmpty()) {
      LinkedList<Integer> l = new LinkedList<>();
      l = (LinkedList<Integer>) before.clone();
      l.addAll(left);
      l.addAll(right);
      mix.add(l);
      return;
    }
    int hl = left.removeFirst();
    before.addLast(hl);
    mixLists(left, right, mix, before);
    before.removeLast();
    left.addFirst(hl);

    int hr = right.removeFirst();
    before.addLast(hr);
    mixLists(left, right, mix, before);
    before.removeLast();
    right.addFirst(hr);
  }
Exemplo n.º 5
0
  public void weavelists(
      LinkedList<Integer> first,
      LinkedList<Integer> second,
      ArrayList<LinkedList<Integer>> results,
      LinkedList<Integer> prefix) {
    if (first.size() == 0 || second.size() == 0) {
      LinkedList<Integer> result = (LinkedList<Integer>) prefix.clone();
      result.addAll(first);
      result.addAll(second);
      results.add(result);
      return;
    }

    int headFirst = first.removeFirst();
    prefix.addLast(headFirst);
    weavelists(first, second, results, prefix);
    prefix.removeLast();
    first.addFirst(headFirst);

    int secondHead = second.removeFirst();
    prefix.addLast(secondHead);
    weavelists(first, second, results, prefix);
    prefix.removeLast();
    second.addFirst(secondHead);
  }
  @Override
  public Action generateAchievementAction(String focus) {
    myToken.setStrategyType(AgentToken.STRATEGY_ZONE_BUILDER);
    // successfulParries is covered by defaultAction
    if (focus == "achievementsSurveyedEdges") {
      if (myPosition.getNumberOfUnsurveyedEdges() > 0) {
        Action ret = new Action("survey", myPosition.getIdentifier());
        return ret;
      }
    }
    if (focus == "achievementsInspectedAgents") {
      if (longNotInspectedEnemyNear(myPosition)) {
        //                return new Action("inspect", myPosition.getIdentifier());
        LinkedList<AgentToken> agentsToCheck = new LinkedList<AgentToken>();
        agentsToCheck.addAll(myPosition.getTokens());
        for (Vertex w : myPosition.getAdjacentVertices()) agentsToCheck.addAll(w.getTokens());

        for (AgentToken t : agentsToCheck) {
          if (!t.getTeam().equals(myTeam) && notRecentlyInspected(t))
            return new Action("inspect", new Identifier(t.getName()));
        }
      }
    }

    if (focus == "achievementsAreaValue") {
      Action ret = ag.buildZone();
      return ret;
    }
    return ag.expandOwnComponent();
  }
Exemplo n.º 7
0
  /**
   * Compose write and append print updates. The type write or append as well as the order of the
   * updates are taken into account.
   *
   * @param compAPI
   */
  private void composeAppend(PluginCompositionAPI compAPI) {
    for (Location l : compAPI.getAffectedLocations()) {
      if (!FILE_OUTPUT_FUNC_NAME.equals(l.name)) continue;
      LinkedList<Element> elems1 = new LinkedList<>();
      LinkedList<Element> elems2 = new LinkedList<>();
      Set<Element> contributingAgents = new HashSet<Element>();
      Set<ScannerInfo> contributingNodes = new HashSet<ScannerInfo>();
      String action = APPEND_ACTION;

      // if the second set does not have a basic update,
      // add all the updates from the first set as well
      if (!compAPI.isLocUpdatedWithActions(2, l, Update.UPDATE_ACTION)) {
        for (Update update : compAPI.getLocUpdates(1, l)) {
          if (APPEND_ACTION.equals(update.action) || WRITE_ACTION.equals(update.action)) {
            Element value = update.value;
            if (!(update.value instanceof ListElement))
              value = new ListElement(Arrays.asList(new Element[] {value}));
            ListElement list = (ListElement) value;
            elems1.addAll(list.getList());
            contributingAgents.addAll(update.agents);
            contributingNodes.addAll(update.sources);
          }
          if (WRITE_ACTION.equals(update.action)) action = WRITE_ACTION;
        }
      }
      for (Update update : compAPI.getLocUpdates(2, l)) {
        if (APPEND_ACTION.equals(update.action) || WRITE_ACTION.equals(update.action)) {
          Element value = update.value;
          if (!(update.value instanceof ListElement))
            value = new ListElement(Arrays.asList(new Element[] {value}));
          ListElement list = (ListElement) value;
          elems2.addAll(list.getList());
          contributingAgents.addAll(update.agents);
          contributingNodes.addAll(update.sources);
        }
        if (WRITE_ACTION.equals(update.action)) {
          action = WRITE_ACTION;
          elems1.clear();
        }
      }
      if (!elems1.isEmpty() || !elems2.isEmpty()) {
        LinkedList<Element> outputResult = elems1;
        if (outputResult.isEmpty()) outputResult = elems2;
        else if (!elems2.isEmpty()) {
          outputResult = new LinkedList<>();
          outputResult.addAll(elems1);
          outputResult.addAll(elems2);
        }
        compAPI.addComposedUpdate(
            new Update(
                l,
                new ListElement(new ArrayList<Element>(outputResult)),
                action,
                contributingAgents,
                contributingNodes),
            this);
      }
    }
  }
Exemplo n.º 8
0
  /**
   * Deeply list the opaque ports connected to this port on the outside. Begin by listing the ports
   * that are connected to this port. If any of those are transparent ports that we are connected to
   * from the inside, then list all the ports deeply connected on the outside to that transparent
   * port. If any are transparent ports that we are connected to from the outside, then list opaque
   * ports deeply inside that port. Note that a port may be listed more than once. The path argument
   * is the path from the port that originally calls this method to this port. If this port is
   * already on the list of ports on the path to this port in deeply traversing the topology, then
   * there is a loop in the topology, and an InvalidStateException is thrown. This method not
   * synchronized on the workspace, so the caller should.
   *
   * @param path The list of ports on the path to this port in deeply traversing the topology.
   * @return An unmodifiable list of ComponentPort objects.
   */
  protected List _deepConnectedPortList(LinkedList path) {
    if (_deepLinkedPortsVersion == _workspace.getVersion()) {
      // Cache is valid.  Use it.
      return _deepLinkedPorts;
    }

    if (path == null) {
      path = new LinkedList();
    } else {
      if (path.indexOf(this) >= 0) {
        throw new InvalidStateException(path, "Loop in topology!");
      }
    }

    path.add(0, this);

    Iterator nearRelations = linkedRelationList().iterator();
    LinkedList result = new LinkedList();

    while (nearRelations.hasNext()) {
      ComponentRelation relation = (ComponentRelation) nearRelations.next();

      // A null link (supported since indexed links) might
      // yield a null relation here. EAL 7/19/00.
      if (relation != null) {
        Iterator connectedPorts = relation.linkedPortList(this).iterator();

        while (connectedPorts.hasNext()) {
          ComponentPort port = (ComponentPort) connectedPorts.next();

          // NOTE: If level-crossing transitions are not allowed,
          // then a simpler test than that of the following
          // would work.
          if (port._isInsideLinkable(relation.getContainer())) {
            // We are coming at the port from the inside.
            if (port.isOpaque()) {
              result.add(port);
            } else {
              // Port is transparent
              result.addAll(port._deepConnectedPortList(path));
            }
          } else {
            // We are coming at the port from the outside.
            if (port.isOpaque()) {
              result.add(port);
            } else {
              // It is transparent.
              result.addAll(port._deepInsidePortList(path));
            }
          }
        }
      }
    }

    _deepLinkedPorts = Collections.unmodifiableList(result);
    _deepLinkedPortsVersion = _workspace.getVersion();
    path.remove(0);
    return _deepLinkedPorts;
  }
Exemplo n.º 9
0
 @Override
 public List<Variable> getUsedVariables() {
   LinkedList<Variable> ret = new LinkedList<Variable>();
   for (Expression e : this.arguments) {
     ret.addAll(e.getUsedVariables());
   }
   ret.addAll(this.getModifiedVars());
   return ret;
 }
Exemplo n.º 10
0
  /**
   * get all textBox displayed by the entity. TextBox returned are: - textBox for entity name -
   * textBox for attributes - textBox for methods
   *
   * @return an array containing all TextBox
   */
  public LinkedList<TextBox> getAllTextBox() {
    final LinkedList<TextBox> tb = new LinkedList<TextBox>();

    tb.add(entityName);
    tb.addAll(methodsView);
    tb.addAll(attributesView);

    return tb;
  }
Exemplo n.º 11
0
 @Override
 public List<ItemChange> getChanged(BackendSession bs)
     throws DaoException, CollectionNotFoundException, UnknownObmSyncServerException {
   LinkedList<ItemChange> changes = new LinkedList<ItemChange>();
   changes.addAll(getCalendarChanges(bs));
   changes.addAll(getMailChanges(bs));
   changes.addAll(getContactsChanges(bs));
   changes.addAll(getTasksChanges(bs));
   return changes;
 }
Exemplo n.º 12
0
  private boolean directedCompute() {

    SortedSet<Integer> degrees = new TreeSet<Integer>();
    for (IElement iE : g.getNodes()) {
      DirectedNode n = (DirectedNode) iE;
      int degree = n.getOutDegree();

      degrees.add(degree);
      if (nodesSortedByDegree.containsKey(degree)) {
        this.nodesSortedByDegree.get(degree).add(n);
      } else {
        LinkedList<Node> temp = new LinkedList<>();
        temp.add(n);
        this.nodesSortedByDegree.put(degree, temp);
      }
    }

    HashSet<Node> currentRichClub = new HashSet<Node>();
    int currentRichClubSize = 0;
    int size = degrees.size();
    for (int i = 0; i < size; i++) {
      int currentDegree = degrees.last();
      degrees.remove(currentDegree);
      LinkedList<Node> current = this.nodesSortedByDegree.get(currentDegree);
      currentRichClubSize += current.size();
      this.nodesSortedByDegree.remove(currentDegree);

      if (currentRichClubSize >= this.richClubSize) {
        int seperateAT = current.size() - (currentRichClubSize - this.richClubSize);
        LinkedList<Node> temp = new LinkedList<>();
        temp.addAll(current.subList(0, seperateAT));
        this.richClub.put(currentDegree, temp);
        currentRichClub.addAll(temp);
        LinkedList<Node> temp2 = new LinkedList<>();
        temp2.addAll(current.subList(seperateAT, current.size()));
        if (!temp2.isEmpty()) this.nodesSortedByDegree.put(currentDegree, (LinkedList<Node>) temp2);
        break;
      } else {
        richClub.put(currentDegree, current);
        currentRichClub.addAll(current);
      }
    }

    for (Node n : currentRichClub) {
      DirectedNode ne = (DirectedNode) n;
      for (IElement iE : ne.getOutgoingEdges()) {
        DirectedEdge e = (DirectedEdge) iE;
        if (currentRichClub.contains(e.getDst())) {
          edgesBetweenRichClub++;
        }
      }
    }
    return true;
  }
Exemplo n.º 13
0
  /**
   * checks for long not inspected enemy at a position and adjacent vertices
   *
   * @param v the vertex to check
   * @return true, if there is at least one long not inspected enemy, else false
   * @see {@link #notRecentlyInspected(AgentToken)}
   */
  private boolean longNotInspectedEnemyNear(Vertex v) {
    // check for uninspected enemy on own position and adjacent vertices
    LinkedList<AgentToken> agentsToCheck = new LinkedList<AgentToken>();
    agentsToCheck.addAll(v.getTokens());
    for (Vertex w : v.getAdjacentVertices()) agentsToCheck.addAll(w.getTokens());

    for (AgentToken t : agentsToCheck) {
      if (!t.getTeam().equals(myTeam) && notRecentlyInspected(t)) return true;
    }
    return false;
  }
Exemplo n.º 14
0
 public Sequence(TypedAST first, TypedAST second) {
   if (first instanceof Sequence) {
     exps.addAll(((Sequence) first).exps);
   } else if (first != null) {
     exps.add(check(first));
   }
   if (second instanceof Sequence) {
     exps.addAll(((Sequence) second).exps);
   } else if (second != null) {
     exps.add(check(second));
   }
 }
Exemplo n.º 15
0
 // FIXME: This is only here for wildcard imports, and we should be able to make it lazy like the
 // rest
 // with a bit of work in the typechecker
 // FIXME: redo this method better: https://github.com/ceylon/ceylon-spec/issues/90
 @Override
 public List<Declaration> getMembers() {
   synchronized (modelLoader) {
     // make sure the package is loaded
     modelLoader.loadPackage(getQualifiedNameString(), true);
     List<Declaration> sourceDeclarations = super.getMembers();
     LinkedList<Declaration> ret = new LinkedList<Declaration>();
     ret.addAll(sourceDeclarations);
     ret.addAll(compiledDeclarations);
     return ret;
   }
 }
Exemplo n.º 16
0
 /** On a given class (a RobotML system), retrieve all the contained systems. Recursive. */
 public static List<org.eclipse.uml2.uml.Property> getAllSubComponentsInClass(
     org.eclipse.uml2.uml.Class c) {
   LinkedList<org.eclipse.uml2.uml.Property> sub_components =
       new LinkedList<org.eclipse.uml2.uml.Property>();
   List<org.eclipse.uml2.uml.Property> level_1 = getLevel1SubComponentsForComponent(c);
   sub_components.addAll(level_1);
   for (Property prop : level_1) {
     List<Property> next_levels =
         getAllSubComponentsInClass((org.eclipse.uml2.uml.Class) prop.getType());
     sub_components.addAll(next_levels);
   }
   return sub_components;
 }
Exemplo n.º 17
0
 @Override
 public Iterator<TickClient> getTickSet(final Tickable T, final int tickID) {
   final LinkedList<TickClient> subSet = new LinkedList<TickClient>();
   if (tickID < 0)
     subSet.addAll(
         tickers.subSet(
             new StdTickClient(T, 0, 0), true, new StdTickClient(T, 0, Integer.MAX_VALUE), true));
   else
     subSet.addAll(
         tickers.subSet(
             new StdTickClient(T, 0, tickID), true, new StdTickClient(T, 0, tickID), true));
   return subSet.iterator();
 }
Exemplo n.º 18
0
  /**
   * Puts all the existing child items in a linked list, recursively following child-items if there
   * are any
   *
   * @param items
   * @return
   */
  public static LinkedList<CmdLnValue> createFlatList(CmdLnItem item) {
    LinkedList<CmdLnValue> items = new LinkedList<>();

    if (item instanceof CommandOP) {
      // Combine options and child parameters. Non-option-parameters first and then the options
      items.addAll(item.getChildrenInternal().values());
      items.addAll(((CommandOP) item).getOptions().values());
    } else {
      items.add((CmdLnValue) item);
    }

    return createFlatList(items);
  }
Exemplo n.º 19
0
 /**
  * Converts the state of this object into a list of tokens, which when combined give the command
  * to execute for starting the server program.
  */
 LinkedList getTokens() {
   LinkedList tokens = new LinkedList();
   tokens.add(mJVM);
   if (mCmdLineFlags != null) tokens.addAll(mCmdLineFlags);
   if (mVmType != null) tokens.add(mVmType);
   if (mJVMFlags != null) tokens.addAll(mJVMFlags);
   if (mLibPath != null) {
     tokens.add("-Djava.library.path=" + mLibPath);
   }
   tokens.add("-classpath");
   tokens.add(mClasspath);
   tokens.add(mMainClassName);
   if (mAppArgs != null) tokens.addAll(mAppArgs);
   return tokens;
 }
Exemplo n.º 20
0
  /**
   * Adjusts the upload order for new relations. Child relations are uploaded first, parent
   * relations second.
   *
   * <p>This method detects cyclic dependencies in new relation. Relations with cyclic dependencies
   * can't be uploaded.
   *
   * @throws CyclicUploadDependencyException thrown, if a cyclic dependency is detected
   */
  public void adjustRelationUploadOrder() throws CyclicUploadDependencyException {
    LinkedList<OsmPrimitive> newToAdd = new LinkedList<OsmPrimitive>();
    newToAdd.addAll(Utils.filteredCollection(toAdd, Node.class));
    newToAdd.addAll(Utils.filteredCollection(toAdd, Way.class));

    List<Relation> relationsToAdd =
        new ArrayList<Relation>(Utils.filteredCollection(toAdd, Relation.class));
    List<Relation> noProblemRelations = filterRelationsNotReferringToNewRelations(relationsToAdd);
    newToAdd.addAll(noProblemRelations);
    relationsToAdd.removeAll(noProblemRelations);

    RelationUploadDependencyGraph graph = new RelationUploadDependencyGraph(relationsToAdd);
    newToAdd.addAll(graph.computeUploadOrder());
    toAdd = newToAdd;
  }
Exemplo n.º 21
0
  public void action() {
    buySideOrders.addAll(MarketAgent.buySideQueue);
    Collections.sort(buySideOrders);
    sellSideOrders.addAll(MarketAgent.sellSideQueue);
    Collections.sort(sellSideOrders);

    System.out.println(myAgent.getLocalName() + " LocalBuyOrders: " + buySideOrders.size());
    System.out.println(myAgent.getLocalName() + " LocalSellOrders: " + sellSideOrders.size());

    ACLMessage tradingRequestMsg = new ACLMessage(ACLMessage.REQUEST);
    tradingRequestMsg.setConversationId("TradingRequest");
    tradingRequestMsg.setContent("ReadyToStart");
    tradingRequestMsg.addReceiver(MarketAgent.marketAID);
    myAgent.send(tradingRequestMsg);
  }
  /*
   * Main constructor to parse Javascript file
   * @param input. The string containing the file data
   */
  public VariableNameComboModel() throws FileNotFoundException {
    String input = EditorRegistry.lastFocusedComponent().getText();
    String replaceInput = removeComment(input).replaceAll("[)(;+}={,.]", "");
    // enter entries (split) by whitespace
    String words[] = replaceInput.split("\\s+");
    int counter = 0;
    // while there are still words, add them to the variableNamesArray ArrayList
    for (int i = 0; i < words.length; i++) {
      if (words[i].equals("var")) {
        variableNamesArray.add(words[i + 1]);
      } else {

      }
      counter++;
    }
    counter = 1;
    while (counter < words.length) {
      if (words[counter - 1].equals("function")) {

        functionNamesArray.add("   " + words[counter]);
      }
      counter++;
    }
    counter = 1;

    while (counter < words.length) {
      if (words[counter - 1].equals("class")) {

        classNamesArray.add("   " + words[counter]);
      }
      counter++;
    }
    int i = 0;
    // convert the arraylist to an array
    if (!variableNamesArray.isEmpty()) {
      MyList.add("Variables");
      MyList.addAll(variableNamesArray);
    }
    if (!functionNamesArray.isEmpty()) {
      MyList.add("Functions");
      MyList.addAll(functionNamesArray);
    }
    if (!classNamesArray.isEmpty()) {
      MyList.add("Classes");
      MyList.addAll(classNamesArray);
    }
    this.variableNames = (String[]) MyList.toArray(new String[0]);
  }
Exemplo n.º 23
0
  /* Search recursively for all SBML files in given path. */
  public static LinkedList<String> walk(String path) {
    LinkedList<String> sbmlList = new LinkedList<String>();

    File root = new File(path);
    File[] list = root.listFiles();

    if (list == null) {
      return sbmlList;
    }

    for (File f : list) {
      if (f.isDirectory()) {
        sbmlList.addAll(walk(f.getAbsolutePath()));
        // System.out.println( "Dir:" + f.getAbsoluteFile() );
      } else {
        // System.out.println( "File:" + f.getAbsoluteFile() );
        String fname = f.getName();
        if (fname.endsWith(".xml") && fname.contains("pass") && !skip.contains(fname)) {

          // System.out.println( "SBML:" + f.getAbsoluteFile() );
          sbmlList.add(f.getAbsolutePath());
        }
      }
    }
    return sbmlList;
  }
Exemplo n.º 24
0
  public static void visit(final IFb2Node root, final IFb2NodeVisitor visitor) {
    final LinkedList<IFb2Node> nodes = new LinkedList<IFb2Node>();
    nodes.add(root);

    try {
      for (IFb2Node node = getFirst(nodes); node != null; node = getFirst(nodes)) {
        switch (visitor.handle(node)) {
          case Stop:
            return;
          case ProcessOnlyChildren:
            nodes.clear();
          case Continue:
            if (node instanceof IFb2CompositeNode) {
              nodes.addAll(0, ((IFb2CompositeNode) node).getChildren());
            }
            break;
          case NextSibling:
            break;
        }
      }
    } catch (final Throwable th) {
      th.printStackTrace();
    } finally {
      nodes.clear();
    }
  }
Exemplo n.º 25
0
  /**
   * Searches zero locations in a neigboorhood in a code piece, starts a number of search threads
   *
   * @param cp The code piece
   * @param globalValues The global initialised values
   * @return The zero locations points
   */
  private LinkedList<Point3d> searchZeroLocations(
      CodePiece cp,
      HashMap<MultivectorComponent, Double> globalValues,
      int a,
      float dist,
      double epsilon,
      boolean renderIn2d) {
    LinkedList<Point3d> points = new LinkedList<Point3d>();

    int processorCount = Runtime.getRuntime().availableProcessors();

    RayMethodThread[] threads = new RayMethodThread[processorCount];
    for (int i = 0; i < processorCount; i++) {
      float from = (i * 2 * a) / ((float) processorCount) - a;
      float to =
          ((i != processorCount - 1) ? ((i + 1) * 2 * a) / ((float) processorCount) : 2 * a) - a;

      threads[i] = new RayMethodThread(from, to, a, dist, globalValues, cp, epsilon, renderIn2d);
      threads[i].start();
    }

    for (int i = 0; i < threads.length; i++) {
      try {
        threads[i].join();
        points.addAll(threads[i].points);
      } catch (InterruptedException ex) {
        Logger.getLogger(DiscreteCubeMethod.class.getName()).log(Level.SEVERE, null, ex);
      }
    }

    return points;
  }
Exemplo n.º 26
0
  /* (non-Javadoc)
   * @see org.apache.batik.parser.PathHandler#arcAbs(float, float, float, boolean, boolean, float, float)
   */
  public void arcAbs(
      float rx, float ry, float phi, boolean large_arc, boolean sweep, float x, float y)
      throws ParseException {
    if (verbose)
      System.out.println(
          "arcAbs: "
              + rx
              + " "
              + ry
              + " "
              + phi
              + " "
              + large_arc
              + " "
              + sweep
              + " "
              + x
              + " "
              + y);

    Vertex lastPoint = pathPoints.getLast();
    List<Vertex> arcVertices =
        Tools3D.arcTo(lastPoint.x, lastPoint.y, rx, ry, phi, large_arc, sweep, x, y, 40);

    // Prevent odd picking behavour, in which the normal is
    // not correctly computed, because the 2 points are the same
    if (!arcVertices.isEmpty() && lastPoint != null && arcVertices.get(0).equalsVector(lastPoint)) {
      arcVertices.remove(0);
    }
    pathPoints.addAll(arcVertices);
    currentSubPath.addAll(arcVertices);
  }
Exemplo n.º 27
0
 private List<RAS_Node> getAvailableNodes() {
   LinkedList<RAS_Node> nodes = new LinkedList<RAS_Node>();
   for (String clusterId : _clusterInfo.keySet()) {
     nodes.addAll(this.getAvailableNodesFromCluster(clusterId));
   }
   return nodes;
 }
Exemplo n.º 28
0
  private void generateWithLength(int length, LinkedList<EventType> posfix, EventType root) {
    if (length <= 1) {
      LinkedList<EventType> path = getPathToRoot(root);
      if (path != null) {
        path.addAll(posfix);

        writeToFile(
            TestCaseGeneratorConfiguration.OUTPUT_DIR
                + File.separator
                + TEST_NAME_PREFIX
                + (index)
                + TEST_NAME_SUFIX,
            path);
        index++;

      } else {
        GUITARLog.log.info("root: " + root.getWidgetId());
        GUITARLog.log.info(posfix + " is unreachable");
      }

    } else {
      for (EventType succEvent : succs.get(root)) {
        LinkedList<EventType> extendedPosfix = new LinkedList<EventType>(posfix);
        extendedPosfix.addLast(root);
        generateWithLength(length - 1, extendedPosfix, succEvent);
      }
    }
  }
Exemplo n.º 29
0
  /**
   * 根据参数showArea 和 showBlock 跟显示的数据内容
   *
   * @param showArea
   * @param showBlock
   */
  public void updateShowText(String showArea, String showBlock) {
    if (showArea == null || showBlock == null) {
      return;
    }
    for (int i = 0; i < groups.size(); i++) {
      if (groups.get(i).equals(showArea)) {
        // 如果showArea的值和ArrayList中的某个值相等时,将earaListViewAdapter的选中位置设置在第i个位置
        earaListViewAdapter.setSelectedPosition(i);

        childrenItem.clear(); // 立即将这个链表清掉,准备把位置腾出来给children链表的第i个位置的LinkedList
        // children为SparseArray(LinkedList<String>)
        if (i < children.size()) { // children为SparseArray(LinkedList<String>)
          childrenItem.addAll(children.get(i));
        }
        tEaraPosition = i; // 将地域的位置现在修改为之前选中的第i个位置
        break;
      }
    }
    for (int j = 0; j < childrenItem.size(); j++) {
      if (childrenItem.get(j).replace("不限", "").equals(showBlock.trim())) {
        plateListViewAdapter.setSelectedPosition(j); // 商圈的适配器设置到选中的位置
        tBlockPosition = j;
        break;
      }
    }
    setDefaultSelect();
  }
Exemplo n.º 30
0
  //
  // Methode zum Auflisten der XML-Dateien
  public LinkedList<File> listDir(File dir) {
    LinkedList<File> result = new LinkedList<File>();
    File[] files = dir.listFiles();
    if (files != null) {
      for (int i = 0; i < files.length; i++) {
        //				System.out.printf(files[i].getAbsolutePath());
        if (files[i].isDirectory()) {
          if (files[i].getAbsolutePath().contains("timeless")) {

          } else {
            //					System.out.print(" (Ordner)\n");
            result.addAll(listDir(files[i]));
          }
        }
        //				else{
        //					System.out.print(" (Datei)\n");
        //				}
        if (files[i].getAbsolutePath().contains("xml")) {
          if (files[i].getAbsolutePath().contains("timeless")) {

          } else {
            System.out.println(files[i].getAbsolutePath());
            result.add(files[i]);
          }
        }
        //				else{
        //					files[i].delete();
        //				}
      }
    }
    return result;
  }