|
Unified Typesetting API M1-20040817 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.inghuimische.uta.linebreaking.AbstractLinebreakAlgorithm
de.inghuimische.uta.linebreaking.LineBasedBreakAlgorithm
de.inghuimische.uta.linebreaking.FirstFitAlgorithm
A simple implementation of a line based break algorithm. This algorithm
implements the first-fit strategy. The first item that does not fit into
the current line is moved to the next. This is a sample implementation.
Using the simpleFit switch you can choose between a simple first-fit
implementation and a shortest-path based one. The shortest-path version
demonstrates the use of the BreakpointUtil
class.
Internally a state pattern is used to switch between the two implementations.
Nested Class Summary | |
class |
FirstFitAlgorithm.ShortestPathFirstFit
More complex implementation of the first-fit algorithm, meant as proof-of-concept. |
class |
FirstFitAlgorithm.SimpleFirstFit
Simple first-fit implementation conforming to UTA. |
class |
FirstFitAlgorithm.State
Simple class with utility methods to allow state pattern. |
Field Summary | |
protected Vector |
breakpoints
The breakpoints found. |
Fields inherited from class de.inghuimische.uta.linebreaking.AbstractLinebreakAlgorithm |
features, lineNumber, lineWidthModel |
Constructor Summary | |
FirstFitAlgorithm()
Constructs a new line break algorithm with the simpler first-fit implementation not using BreakpointUtil . |
|
FirstFitAlgorithm(boolean simpleFit)
The simpleFit switch tells which implementation of the first-fit method should be used. |
Method Summary | |
void |
consider(Item newItem)
Tells the line breaker that he has to consider a newly generated item. |
List |
getBreakpoints()
Returns the generated breakpoints. |
void |
linebreak(String text)
This is a simple implementation of the first-fit algorithm (break before the first item that does not fit into the line). |
Methods inherited from class de.inghuimische.uta.linebreaking.AbstractLinebreakAlgorithm |
getFeatures, getLineWidthModel, nextLineWidth, setLineWidthModel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Vector breakpoints
Constructor Detail |
public FirstFitAlgorithm()
BreakpointUtil
.
public FirstFitAlgorithm(boolean simpleFit)
true
an implementation depending on
BreakpointUtil
will be used. If false
a simple
implementation is used.
simpleFit
- Tells which implementation of the first-fit method
should be used.FirstFitAlgorithm.SimpleFirstFit
,
FirstFitAlgorithm.ShortestPathFirstFit
Method Detail |
public void consider(Item newItem)
LinebreakAlgorithm
newItem
- The new Item
to consider.public List getBreakpoints()
LinebreakAlgorithm
LinebreakAlgorithm.consider(Item)
are made.
public void linebreak(String text)
|
Unified Typesetting API M1-20040817 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
![]() An inghuimische.de project. | Copyright (C) 2004 Christian Ziesemer; See the Mozilla Public License for more details. |