Package gnu.trove

Examples of gnu.trove.TIntArrayList


    return chunks;
  }
 
  public static <Node> Graph<Chunk<Node>> toChunkGraph(final Graph<Node> graph) {
    final DFSTBuilder<Node> builder = new DFSTBuilder<Node>(graph);
    final TIntArrayList sccs = builder.getSCCs();

    final List<Chunk<Node>> chunks = new ArrayList<Chunk<Node>>(sccs.size());
    final Map<Node, Chunk<Node>> nodeToChunkMap = new LinkedHashMap<Node, Chunk<Node>>();
    sccs.forEach(new TIntProcedure() {
      int myTNumber = 0;
      public boolean execute(int size) {
        final Set<Node> chunkNodes = new LinkedHashSet<Node>();
        final Chunk<Node> chunk = new Chunk<Node>(chunkNodes);
        chunks.add(chunk);
View Full Code Here


  }

  private int[] discard(int[] needed, int[] toDiscard, int arrayIndex) {
    myOriginalLengths[arrayIndex] = toDiscard.length;
    int[] sorted1 = createSorted(needed);
    TIntArrayList discarded = new TIntArrayList(toDiscard.length);
    TIntArrayList oldIndecies = new TIntArrayList(toDiscard.length);
    for (int i = 0; i < toDiscard.length; i++) {
      int index = toDiscard[i];
      if (Arrays.binarySearch(sorted1, index) >= 0) {
        discarded.add(index);
        oldIndecies.add(i);
      }
    }
    myOldIndecies[arrayIndex] = oldIndecies.toNativeArray();
    return discarded.toNativeArray();
  }
View Full Code Here

    {
      LabelsAssignment lblseq = (LabelsAssignment) inst.getTarget ();
      factors = new TIntArrayList [lblseq.numSlices ()];
      for (int i = 0; i < lblseq.numSlices (); i++) {
        LabelAlphabet dict = lblseq.getOutputAlphabet (i);
        factors[i] = new TIntArrayList (dict.size ());
        for (int j = 0; j < dict.size (); j++) {
          int idx = alphabet.lookupIndex (dict.lookupObject (j));
          factors[i].add (idx);
        }
      }
View Full Code Here

    return (Variable[]) vars.toArray (new Variable [vars.size ()]);
  }

  private int[] toValueArray ()
  {
    TIntArrayList vals = new TIntArrayList (maxTime () * numSlices ());
    for (int t = 0; t < lblseq.size (); t++) {
      Labels lbls = lblseq.getLabels (t);
      for (int j = 0; j < lbls.size (); j++) {
        Label lbl = lbls.get (j);
        vals.add (lbl.getIndex ());
      }
    }
    return vals.toNativeArray ();
  }
View Full Code Here

/*     */   static class TroveIntArrayListCreator
/*     */     implements MemoryUsage.Creator
/*     */   {
/*     */     public Object create()
/*     */     {
/* 133 */       TIntArrayList list = new TIntArrayList();
/* 134 */       for (int i = 0; i < 1000; i++) {
/* 135 */         list.add(i);
/*     */       }
/* 137 */       list.trimToSize();
/* 138 */       return list;
/*     */     }
View Full Code Here

  private TIntArrayList scanForFreeRecords() {
    final int filelength = (int)myStorage.length();
    assert filelength % RECORD_SIZE == 0;

    final TIntArrayList result = new TIntArrayList();

    int lastRecord = filelength / RECORD_SIZE;
    for (int i = FIRST_RECORD; i < lastRecord; i++) {
      if (getAddress(i) == 0) {
        result.add(i);
      }
    }

    return result;
  }
View Full Code Here

  private void build_T() {
    if (myTBuilt) return;

    myInvT = (Node[])new Object[myGraph.getNodes().size()];
    mySCCs = new TIntArrayList ();

    int currT = 0;
    int size = myGraph.getNodes().size();

    myNodeToTNumber = new LinkedHashMap<Node, Integer>(size);
View Full Code Here

      boolean[] map = new boolean[(int)(myFileLength / CLUSTER_SIZE)];
      Arrays.fill(map, false);

      int firstFreePage = getFirstFreePage();
      if (firstFreePage != 0) {
        checkTraverseLinks(firstFreePage, map, true, new TIntArrayList());
      }
      for (int i = 1; i < map.length; i++) {
        boolean b = map[i];
        if (!b) {
          assertTrue(!shouldBeFree);
          checkTraverseLinks(i, map, false, new TIntArrayList());
        }
      }
      for (int i = 1; i < map.length; i++) {
        assertTrue(map[i]);
      }
View Full Code Here

TOP

Related Classes of gnu.trove.TIntArrayList

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.