Package ar.glyphsets.implicitgeometry

Examples of ar.glyphsets.implicitgeometry.IndexedEncoding


    final Number[] maxima = new Number[header.types.length];
    final Number[] minima = new Number[header.types.length];
   
    for (long i=0;i<entries; i++) {
      final long recordOffset = (i*header.recordLength)+header.dataTableOffset;
      final IndexedEncoding enc = new IndexedEncoding(header.types, recordOffset, buffer);
      for (int f=0; f<header.types.length; f++) {
        Object v = enc.get(f);
        if (v instanceof Number) {
          Number n = (Number) v;
          maxima[f] = gt(maxima[f], n) ? maxima[f] : n;
          minima[f] = lt(minima[f], n) ? minima[f] : n;
        }
View Full Code Here


      types = header.types;
      this.recordLength = header.recordLength;
      this.offsets = MemMapEncoder.recordOffsets(types);
     
      if (shaper instanceof Shaper.SafeApproximate) {
        IndexedEncoding max = entryAt(header.maximaRecordOffset);       
        IndexedEncoding min = entryAt(header.minimaRecordOffset);
        Rectangle2D maxBounds = Util.boundOne(shaper.shape(max));
        Rectangle2D minBounds = Util.boundOne(shaper.shape(min));
        bounds = Util.bounds(maxBounds, minBounds);
      }
      entryCount = (source.length()-dataTableOffset)/recordLength;
View Full Code Here

    this.dataTableOffset=dataTableOffset;
  }

  @Override
  public Glyph<G,I> get(long i) {
    IndexedEncoding entry = entryAt(recordOffset(i));
    Glyph<G,I> g = new SimpleGlyph<G,I>(shaper.shape(entry), valuer.value(entry));
    return g;
  }
View Full Code Here

  }

  protected long recordOffset(long i) {return (i*recordLength)+dataTableOffset;}
 
  protected IndexedEncoding entryAt(long recordOffset) {
    return new IndexedEncoding(types, recordOffset, buffer, offsets);
  }
View Full Code Here

  @Test
  public void minMax() throws Exception {
    BigFileByteBuffer buffer = new BigFileByteBuffer(new File(hbinName), 1000);
    MemMapEncoder.Header header = MemMapEncoder.Header.from(buffer);
   
    IndexedEncoding maxEntry = new IndexedEncoding(header.types, header.maximaRecordOffset, buffer);
    IndexedEncoding minEntry = new IndexedEncoding(header.types, header.minimaRecordOffset, buffer);
   
    double max = Double.MIN_VALUE, min=Double.MAX_VALUE;
   
    long cursor = header.dataTableOffset;
    while(cursor < buffer.fileSize()) {
      IndexedEncoding entry = new IndexedEncoding(header.types, cursor, buffer);
      cursor += header.recordLength;
      max = Math.max(max, (Double) entry.get(0));
      min = Math.min(min, (Double) entry.get(0));
    }
   
    assertEquals("Max mismatch", max, maxEntry.get(0));
    assertEquals("Min mismatch", min, minEntry.get(0));
   
View Full Code Here

TOP

Related Classes of ar.glyphsets.implicitgeometry.IndexedEncoding

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.