Package gnu.trove.list.linked

Examples of gnu.trove.list.linked.TIntLinkedList


     *
     * @param newCapacity an <code>int</code> value
     */
    @Override
    protected void rehash(int newCapacity) {
        TIntLinkedList oldOrder = new TIntLinkedList(order);
        int oldSize = size();

        Object oldSet[] = _set;

        order.clear();
        _set = new Object[newCapacity];
        Arrays.fill(_set, FREE);

        for (TIntIterator iterator = oldOrder.iterator(); iterator.hasNext();) {
            int i = iterator.next();
            E o = (E) oldSet[i];
            if (o == FREE || o == REMOVED) {
                throw new IllegalStateException("Iterating over empty location while rehashing");
            }
View Full Code Here



    private PropLargeGACSTRPos(IntVar[] vs, TuplesList relation) {
        super(vs, relation);
        this.arity = vs.length;
        this.futureVars = new TIntLinkedList();
        this.gacValues = new BitSet[arity];
        this.nbGacValues = new int[arity];

        this.offsets = new int[arity];
        for (int i = 0; i < arity; i++) {
View Full Code Here

  }

  public Predict(int n) {
    this.n = n;
    scores = new TFloatLinkedList();
    labels = new TIntLinkedList();
  }
View Full Code Here

 
  StringBuffer alignment;
 
  public Counter(StringBuffer alignment){
    this.alignment = alignment;
    matches = new TIntLinkedList();
    indelReplace = new TIntLinkedList();
  }
View Full Code Here

    }
    String s = s1.toString(); //cast the StringBuffer to string, so we could handle it in the DiagoalSequenceAlignment class
   
    Counter c = new Counter(new StringBuffer(s));
    c.count();
    TIntLinkedList m = c.getMatchesList();
    TIntLinkedList idr = c.getIndelsReplaceList();
  /*  System.out.println("matches: ");
    for(int i=0; i<m.size(); i++){
      System.out.print(m.get(i) + " ");
    }
    System.out.println("");
    System.out.println("R/I/D: ");
    for(int i=0; i<idr.size(); i++){
      System.out.print(idr.get(i) + " ");
    }
    */
    try {
      FileWriter fw = new FileWriter("stat_res_" + args[0].substring(args[0].lastIndexOf(File.separator)+1, args[0].lastIndexOf('.')) + "_" + args[1].substring(args[1].lastIndexOf(File.separator)+1, args[1].lastIndexOf('.')) + "_.txt");
      BufferedWriter bw = new BufferedWriter(fw);
      bw.write("matches: ");
      bw.newLine();
      for(int i=0; i<m.size(); i++){
        bw.write(m.get(i) + " ");
      }
      bw.newLine();
      bw.write("R/I/D: ");
      bw.newLine();
      for(int i=0; i<idr.size(); i++){
        bw.write(idr.get(i) + " ");
      }
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
View Full Code Here

   */
  public void matchKTuples(){
   
    HashMap<String, TIntLinkedList> s1Map = new HashMap<String, TIntLinkedList>();
    String s;
    TIntLinkedList l1;
   
    //map k-tuples in s1
    for(int i=start1; i<=(end1+1-k); i++){
      s = s1.substring(i, i+k);
     
      if(s1Map.containsKey(s)){
        l1 = s1Map.get(s);
        l1.add(i);
      }
      else{
        l1 = new TIntLinkedList();
        l1.add(i);
        s1Map.put(s, l1);
      }
    }
   
    //the fornt list - will be updated as we're moving along s2
    List<StringRange> front = new ArrayList<StringRange>();
   
   
    //lookup k-tuples in s2
    for(int i=start2; i<=(end2+1-k); i++){
     
      s = s2.substring(i, i+k);
           
      l1 = s1Map.get(s);
     
     
      if(l1 == null){ //no matches for this key in s1Map
        for(int p=0; p<front.size(); p++){
          indices.add(front.get(p)); //stop point for every range on the front list
        }
        front.clear();
      }
      else{
        //create new front list according the previous front list and l1
        List<StringRange> newFront = new ArrayList<StringRange>();
        int l1Pos = 0;
        int frontPos = 0;
       
        //move over the front list (newFront) and the list of indices from s1 (l1) and act according to the case:
        while(l1Pos < l1.size() && frontPos < front.size()){
         
          int l1Element = l1.get(l1Pos);
          StringRange frontElement = front.get(frontPos);
         
          //increase k-tuple length by 1
          if(l1Element - frontElement.getI1() == frontElement.getLength()-k+1){
            newFront.add(new StringRange(frontElement.getI1(), frontElement.getI2(), frontElement.getLength()+1));
            l1Pos++;
            frontPos++;
          }
          //add new k-tuple indices to the front list
          else if(l1Element - frontElement.getI1() < frontElement.getLength()-k+1){
            newFront.add(new StringRange(l1Element, i, k));
            l1Pos++;
          }
          //end of k-tuple - can't get any longer
          else{
            indices.add(frontElement);
            frontPos++;
          }
         
        }
       
        //deal with cases of unfinished lists:
       
        while(l1Pos < l1.size()){ //meaning the list of s1 indices is not over
          int l1Element = l1.get(l1Pos);
          newFront.add(new StringRange(l1Element, i, k));
          l1Pos++;
        }
       
        while(frontPos < front.size()){ //meaning the front list is not over
View Full Code Here

   
//    String alignmentString = align.toString();
    Counter counter = new Counter(align);
   
    counter.count();
    TIntLinkedList mat = counter.getMatchesList();
    TIntLinkedList idr = counter.getIndelsReplaceList();
  /*  System.out.println("matches: ");
    for(int i=0; i<m.size(); i++){
      System.out.print(m.get(i) + " ");
    }
    System.out.println("");
    System.out.println("R/I/D: ");
    for(int i=0; i<idr.size(); i++){
      System.out.print(idr.get(i) + " ");
    }
    */
    try {
      FileWriter fw = new FileWriter("stat_res_" + args[0].substring(args[0].lastIndexOf(File.separator)+1, args[0].lastIndexOf('.')) + "_" + args[1].substring(args[1].lastIndexOf(File.separator)+1, args[1].lastIndexOf('.')) + "_.txt");
      BufferedWriter bw = new BufferedWriter(fw);
      bw.write("matches: ");
      bw.newLine();
      for(int i=0; i<mat.size(); i++){
        bw.write(mat.get(i) + " ");
      }
      bw.newLine();
      bw.write("R/I/D: ");
      bw.newLine();
      for(int i=0; i<idr.size(); i++){
        bw.write(idr.get(i) + " ");
      }
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of gnu.trove.list.linked.TIntLinkedList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.