Package de.torstennahm.math

Examples of de.torstennahm.math.SparseIntVector


   
    this.start = start;
    this.end = end;
    this.bins = bins;
    binSize = (end - start) / (bins - 2);
    binVector = new SparseIntVector();
  }
View Full Code Here


   * Creates a fast index from an array.
   *
   * @param array array to initialize from
   */
  public FastIndex(int[] array) {
    this(new SparseIntVector(array));
  }
View Full Code Here

    return o instanceof Index && ((Index) o).nonZeroEntries() == 0;
  }

  @Override
  protected SparseIntVector toSparseIntVector() {
    return new SparseIntVector();
  }
View Full Code Here

  public int nonZeroEntries() {
    return toSparseIntVector().nonZeroEntries();
  }
 
  public int lastEntry() {
    SparseIntVector vector = toSparseIntVector();
    return vector.size() - 1;
  }
View Full Code Here

    if (o instanceof StackedIndex) {
      StackedIndex comp = (StackedIndex) o;
      return toSparseIntVector().equals(comp.toSparseIntVector());
    } else if (o instanceof Index) {
      Index comp = (Index) o;
      return toSparseIntVector().equals(new SparseIntVector(comp.iterator()));
    }
   
    return false;
  }
View Full Code Here

    }
  }
 
  @Override
  protected SparseIntVector toSparseIntVector() {
    SparseIntVector vector = base.toSparseIntVector();
    vector.add(entryNum, entryValIncrement);
    return vector;
  }
View Full Code Here

 
  public void start() {
    if (destroyed) { return; }
   
    synchronized (lock) {
      extent = new SparseIntVector();
      maxSum = 0;
      dimension = 0;
    }
   
    frame.repaint();
View Full Code Here

      int height = getHeight();
     
      g.setColor(Color.BLACK);
      int x, lastx = 0, y, lasty = 0;
     
      SparseIntVector extentCopy;
      int maxDimension;
      synchronized (lock) {
        if (extent == null) {
          return;
        }
        extentCopy = extent.duplicate();
        maxDimension = dimension != 0 ? dimension : extentCopy.size();
      }
     
      if (maxDimension <= 32) {
        lastx = 0;
        for (int i = 0; i < maxDimension; i++) {
          x = ((i + 1) * width) / maxDimension;
          for (int j = 0; j < extentCopy.get(i); j++) {
            g.fillRect(lastx, height - (j + 1) * LEVELHEIGHT, x - lastx - 1, LEVELHEIGHT - 1);
          }
          lastx = x;
        }
      } else {
        for (int i = 0; i < maxDimension; i++) {
          x = (int)(((i + 0.5) * width) / maxDimension);
          y = height - extentCopy.get(i) * LEVELHEIGHT;
          if (i > 0) {
            g.drawLine(lastx, lasty, x, y);
          }
          lastx = x;
          lasty = y;
View Full Code Here

TOP

Related Classes of de.torstennahm.math.SparseIntVector

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.