Package cern.colt.list

Examples of cern.colt.list.IntArrayList


/**
* 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.
*/
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

* This method can be used to iterate over the values of the receiver.
*
* @return the values.
*/
public IntArrayList values() {
  IntArrayList list = new IntArrayList(size());
  values(list);
  return list;
}
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 DoubleArrayList keyList) {
  pairsSortedByValue(keyList, new IntArrayList(size()));
}
View Full Code Here

* This method can be used to iterate over the values of the receiver.
*
* @return the values.
*/
public IntArrayList values() {
  IntArrayList list = new IntArrayList(size());
  values(list);
  return list;
}
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

 
  int to = index+1;
  while (to<list.size() && list.get(to)==element) to++;
  to--;
 
  return new IntArrayList(new int[] {from,to});
}
View Full Code Here

  int exactRank = (int) Utils.epsilonCeiling(phi * N) - 1;
  //System.out.println("exactRank="+exactRank);
  exactFinder.quantileElements(new DoubleArrayList(new double[] {phi})).get(0); // just to ensure exactFinder is sorted
  double approxElement = approxFinder.quantileElements(new DoubleArrayList(new double[] {phi})).get(0);
  //System.out.println("approxElem="+approxElement);
  IntArrayList approxRanks = binaryMultiSearch(exactFinder.buffer, approxElement);
  int from = approxRanks.get(0);
  int to = approxRanks.get(1);

  int distance;
  if (from<=exactRank && exactRank<=to) distance = 0;
  else {
    if (from>exactRank) distance=Math.abs(from-exactRank);
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.