Unified Typesetting API M1-20040817

de.inghuimische.uta.linebreaking
Class DefaultBreakpoint

java.lang.Object
  extended byde.inghuimische.uta.linebreaking.AbstractBreakpoint
      extended byde.inghuimische.uta.linebreaking.DefaultBreakpoint
All Implemented Interfaces:
Breakpoint

public class DefaultBreakpoint
extends AbstractBreakpoint

Default implementation of a breakpoint.

Author:
Christian Ziesemer

Field Summary
protected  boolean alreadyProcessed
           
protected  Item item
           
protected  Hashtable previousBreakpoints
           
 
Constructor Summary
DefaultBreakpoint(Item associatedItem)
          Creates a new breakpoint with the item associated to it.
 
Method Summary
 void addPreviousBreakpoint(Breakpoint prevBp, Line edge)
          Links this breakpoint to its predecessor assigning the cost to come from the previous point to this one (specified by demerits).
 Item getItem()
          Returns the item this breakpoint breaks after.
 Line getLine(Breakpoint prevBp)
          Returns the line this breakpoint determinates.
 List getPreviousBreakpoints()
          Returns a list of all previous breakpoints.
 boolean isProcessed()
          Returns true if this breakpoint has been marked as processed, false otherwise.
 void setProcessed(boolean alreadyProcessed)
          Sets the already processed flag.
 
Methods inherited from class de.inghuimische.uta.linebreaking.AbstractBreakpoint
getDemerits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

item

protected Item item

previousBreakpoints

protected Hashtable previousBreakpoints

alreadyProcessed

protected boolean alreadyProcessed
Constructor Detail

DefaultBreakpoint

public DefaultBreakpoint(Item associatedItem)
Creates a new breakpoint with the item associated to it.

Parameters:
associatedItem - The item associated with the breakpoint.
Method Detail

getLine

public Line getLine(Breakpoint prevBp)
Description copied from interface: Breakpoint
Returns the line this breakpoint determinates.

Returns:
The line this breakpoint determinates.

addPreviousBreakpoint

public void addPreviousBreakpoint(Breakpoint prevBp,
                                  Line edge)
Description copied from interface: Breakpoint
Links this breakpoint to its predecessor assigning the cost to come from the previous point to this one (specified by demerits).

While simple linebreak algorithms may not build more than a list of breakpoints, complex algorithms mostly will build a tree or graph of such points.

Parameters:
prevBp - The previous breakpoint to link to.
edge - The line linking prevBp with this one.

isProcessed

public boolean isProcessed()
Returns true if this breakpoint has been marked as processed, false otherwise.

See setProcessed(boolean) if you need this flag.

Returns:
true if this breakpoint has been marked as processed, false otherwise.

setProcessed

public void setProcessed(boolean alreadyProcessed)
Sets the already processed flag.

This is neccessary to avoid multiple processing of a single breakpoint. E.g. if there are three possible breakpoints in line one, you have to calculate all their possible successors. If all of those three breakpoints return one common possible successor this successor would be processed thrice.

Parameters:
alreadyProcessed - Specifies whether this breakpoint has already been processed or not.

getPreviousBreakpoints

public List getPreviousBreakpoints()
Description copied from interface: Breakpoint
Returns a list of all previous breakpoints.

Returns:
A list of all previous breakpoints.

getItem

public Item getItem()
Description copied from interface: Breakpoint
Returns the item this breakpoint breaks after. This is the item immediatly before this breakpoint.

Returns:
The item this breakpoint breaks after.

Unified Typesetting API M1-20040817


An inghuimische.de project.
Copyright (C) 2004 Christian Ziesemer; See the Mozilla Public License for more details.