Package cern.colt.list

Examples of cern.colt.list.IntArrayList


                    throw new AssertionError("BG and HSS should be isomorphic");
                }
               
                //  Shift each vertex of the tier along associated edges to the next tier
               
                IntArrayList keys = basicPrevTierVertices.keys();
                int keysSize = keys.size();
                for (int k = 0; k < keysSize; k++)
                {
                    int tierKeyOfTheVertexToShift = keys.get(k);
   
                    IVertex prevTierVertex = (IVertex) ((OpenIntObjectHashMap) basicGraph.getTiers().get(prevTierIndex)).get(tierKeyOfTheVertexToShift);
   
                    ITripletValue tripletValue = prevTierVertex.getTripletValue();
   
View Full Code Here


    {
        IHyperStructure firstHS = (IHyperStructure) hss.get(0);

        final OpenIntObjectHashMap basicTierVertices = (OpenIntObjectHashMap) firstHS.getTiers().get(tierIndex);

        IntArrayList keys = basicTierVertices.keys();
       
        if (LOGGER.isDebugEnabled())
        {
            LOGGER.debug("Tier #{} of HSS contained {} vertices before unification: {}",
                    new Object[] { tierIndex + 1, basicTierVertices.size(), verticesTripletsToString(basicTierVertices) });
        }

        for (int j = 0; j < keys.size(); j++)
        {
            int vertexTierKey = keys.get(j);
           
            //  List of ICompactTripletsStructureHolder
            ObjectArrayList vertices = new ObjectArrayList(hss.size());
           
            for (int i = 0; i < hss.size(); i++)
View Full Code Here

    private boolean elementsHashDirty;
    private int elementsHash;
   
    public SimplePermutation()
    {
        permutation = new IntArrayList();
        permutationHash = new OpenIntIntHashMap();
        positionHash = new OpenIntIntHashMap();
        elementsHashDirty = true;
    }
View Full Code Here

       
        // internal var name -> original var name
        OpenIntIntHashMap internalToOriginalMap = new OpenIntIntHashMap();
        // original var name -> internal var name
        OpenIntIntHashMap sourceIndices = new OpenIntIntHashMap();
        IntArrayList sourceValues = readSourceValues(reader, sourceIndices);
       
        for (int originalVarName : sourceIndices.keys().elements())
        {
            internalToOriginalMap.put(sourceIndices.get(originalVarName), originalVarName);
        }
       
        IntArrayList values = new IntArrayList();

        for (int i = 0; i < sourceValues.size(); i++)
        {
            int sourceVar = sourceValues.get(i);
            if (sourceVar != 0)
            {
                int sign = sourceVar > 0 ? 1 : -1;
                int var = sign * sourceIndices.get(Math.abs(sourceVar));
                values.add(var);
            }
            else
            {
                if(!values.isEmpty())
                {
                    addTriplets(internalToOriginalMap, values);
                    values.clear();
                }
            }
        }
       
        formula.setVarMappings(internalToOriginalMap);
View Full Code Here


    private IntArrayList readSourceValues(BufferedReader reader, OpenIntIntHashMap sourceIndices)
            throws IOException
    {
        IntArrayList sourceValues = new IntArrayList();
        OpenIntIntHashMap originalVarNames = new OpenIntIntHashMap();
       
        int sign = 1;
        int r = 0;
        int ch;
        while ((ch = reader.read()) != -1)
        {
            if (Character.isWhitespace(ch))
            {
                if (r != 0)
                {
                    originalVarNames.put(r, r);
                    r = r * sign;
                    sourceValues.add(r);
                   
                    r = 0;
                    sign = 1;
                }
                continue;
            }
            if (ch == '0' && r == 0)
            {
                sourceValues.add(0);
                continue;
            }
            if (ch == '-')
            {
                sign = -1;
            }

            if ('0' <= ch && ch < '0' + 10)
            {
                r = r * 10 + ch - '0';
            }
        }
       
        IntArrayList sortedVarNames = originalVarNames.keys();
        sortedVarNames.sort();
        for (int i = 0; i < sortedVarNames.size(); i++)
        {
            sourceIndices.put(sortedVarNames.get(i), i + 1);
        }
       
        return sourceValues;
    }
View Full Code Here

    public boolean remove(int value) {
        return super.removeKey(value);
    }

    public int[] getAll() {
        IntArrayList keys = new IntArrayList(size());
        keys(keys);
        assert keys.size() == size() : keys.size() + " vs " + size();
        int[] all = keys.elements();
        assert all.length == size();
        return all;
    }
View Full Code Here

* This method can be used to iterate over the keys of the receiver.
*
* @return the keys.
*/
public IntArrayList keys() {
  IntArrayList list = new IntArrayList(size());
  keys(list);
  return list;
}
View Full Code Here

/**
* Returns a string representation of the receiver, containing
* the String representation of each key-value pair, sorted ascending by key.
*/
public String toString() {
  IntArrayList theKeys = keys();
  theKeys.sort();

  StringBuffer buf = new StringBuffer();
  buf.append("[");
  int maxIndex = theKeys.size() - 1;
  for (int i = 0; i <= maxIndex; i++) {
    int key = theKeys.get(i);
      buf.append(String.valueOf(key));
    buf.append("->");
      buf.append(String.valueOf(get(key)));
    if (i < maxIndex) buf.append(", ");
  }
View Full Code Here

/**
* Returns a string representation of the receiver, containing
* the String representation of each key-value pair, sorted ascending by value, according to natural ordering.
*/
public String toStringByValue() {
  IntArrayList theKeys = new IntArrayList();
  keysSortedByValue(theKeys);

  StringBuffer buf = new StringBuffer();
  buf.append("[");
  int maxIndex = theKeys.size() - 1;
  for (int i = 0; i <= maxIndex; i++) {
    int key = theKeys.get(i);
      buf.append(String.valueOf(key));
    buf.append("->");
      buf.append(String.valueOf(get(key)));
    if (i < maxIndex) buf.append(", ");
  }
View Full Code Here

* <tt>keys = (8,7,6), values = (1,2,2) --> keyList = (8,6,7)</tt>
*
* @param keyList the list to be filled, can have any size.
*/
public void keysSortedByValue(final LongArrayList keyList) {
  pairsSortedByValue(keyList, new IntArrayList(size()));
}
View Full Code Here

TOP

Related Classes of cern.colt.list.IntArrayList

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.