コード例 #1
0
  /*
   * add the given vertex info into this vertex
   * combine name and weights
   */
  public void concatVertex(SeqVertex vertex, Double w, int lastRealID) {
    int prevLen = getName().length();
    setName(getName() + vertex.getName());
    _weights.add(w);
    _weights.addAll(vertex.getWeights());
    // System.out.println(toStringWeights());
    Vector<Integer> newV = new Vector<Integer>();
    if (vertex.getID() <= lastRealID) {
      newV.add(vertex.getID());
      _prevVerticesID.add(newV);
    }
    _prevVerticesID.addAll(vertex.getPrevVerIDs());

    if (vertex.getDegenerativeFreq().size() > 0) {
      // 			System.err.println(vertex.getID()+":"+vertex.getDegenerativeFreq());
      // 			System.err.println(vertex.getID()+":"+vertex.getDegenerativeLocations());
      // 			System.err.println(vertex.getID()+":"+vertex.getDegenerativeLetters());
      // 			System.err.println(getID()+":"+getName());
      // 			System.err.println(prevLen);

      _degenerativeLocations.add(prevLen + 1);
      _degenerativeFreq.addAll(vertex.getDegenerativeFreq());
      _degenerativeLetters.addAll(vertex.getDegenerativeLetters());
    }
  }
コード例 #2
0
  /**
   * add the ver id from the vToRemove to this vertex previous ids
   *
   * @param vToKeep
   * @param vToRemove
   */
  public void addToPrevIDs(SeqVertex vToKeep, SeqVertex vToRemove, int lastRealID) {
    if (_prevVerticesID.isEmpty()) {
      Vector<Integer> thisV = new Vector<Integer>();
      if (vToKeep.getID() >= lastRealID) thisV.add(vToKeep.getID());
      if (vToRemove.getID() >= lastRealID) thisV.add(vToRemove.getID());
      if (!vToKeep.getPrevVerIDs().isEmpty()) thisV.addAll(vToKeep.getPrevVerIDs().firstElement());
      if (!vToRemove.getPrevVerIDs().isEmpty())
        thisV.addAll(vToRemove.getPrevVerIDs().firstElement());

      _prevVerticesID.add(thisV);
    } else {
      assert (true);
    }
  }
コード例 #3
0
  public void addIDsAsFirstPrevIDs(Collection<SeqVertex> vWithL, int lAST_REAL_ID) {
    Vector<Integer> prevIDs = new Vector<Integer>();
    for (SeqVertex v : vWithL) {
      int vid = v.getID();
      if (vid >= 0)
        if (vid <= lAST_REAL_ID) prevIDs.add(vid);
        else if (!v.getPrevVerIDs().isEmpty()) {
          prevIDs.addAll(v.getPrevVerIDs().get(0));
          v.getPrevVerIDs().remove(0);
        }
    }

    _prevVerticesID.add(prevIDs);
  }