Class Chunk

java.lang.Object
com.teamten.typeset.Chunk

public class Chunk extends Object
Represents a sequence of elements being considered for fitting into a space, either horizontally into a line or vertically into a page.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Functional interface for getting the size of an element.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Given what we found about this line or page, compute the badness, which basically tells us how much we had to stretch or shrink.
    static Chunk
    create(List<Element> elements, long maxSize, long actualSize, boolean extractImagesAndFootnotes, boolean placeFootnotes, Chunk.ElementSizer elementSizer)
    Create a new Chunk object given a list of elements and a size they must fit into.
    Returns a copy of the element list but with the flexible element fixed so that all the elements will fit properly in the size that was specified when this object was created.
    long
     
    The list of footnotes that were extracted from the original list of elements.
    The list of images that were extracted from the original list of elements.
    double
     
    long
     
    boolean
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getImages

      public List<Image> getImages()
      The list of images that were extracted from the original list of elements. If there were none, this returns an empty list.
    • getFootnotes

      public List<Footnote> getFootnotes()
      The list of footnotes that were extracted from the original list of elements. If there were none, this returns an empty list.
    • getExtraSpace

      public long getExtraSpace()
    • getSize

      public long getSize()
    • getRatio

      public double getRatio()
    • isOverfull

      public boolean isOverfull()
    • create

      public static Chunk create(List<Element> elements, long maxSize, long actualSize, boolean extractImagesAndFootnotes, boolean placeFootnotes, Chunk.ElementSizer elementSizer)
      Create a new Chunk object given a list of elements and a size they must fit into.
      Parameters:
      actualSize - the total size of the elements. Use -1 to have this method compute it.
      extractImagesAndFootnotes - whether to pull images and footnotes into the separate images and footnotes properties.
      elementSizer - returns the size of an element.
    • computeBadness

      public long computeBadness()
      Given what we found about this line or page, compute the badness, which basically tells us how much we had to stretch or shrink.
    • fixed

      public List<Element> fixed()
      Returns a copy of the element list but with the flexible element fixed so that all the elements will fit properly in the size that was specified when this object was created.