org.kite9.diagram.position
Class CostedDimension

java.lang.Object
  extended by java.awt.geom.Dimension2D
      extended by java.awt.Dimension
          extended by org.kite9.diagram.position.Dimension2D
              extended by org.kite9.diagram.position.CostedDimension
All Implemented Interfaces:
Serializable, Cloneable, Comparable<CostedDimension>

public class CostedDimension
extends Dimension2D
implements Comparable<CostedDimension>

This extends the idea of dimension, but allows you to associate a cost with the dimension other than simply the size.

Author:
robmoffat
See Also:
Serialized Form

Field Summary
 long cost
           
static CostedDimension NOT_DISPLAYABLE
           
static CostedDimension UNBOUNDED
           
static CostedDimension ZERO
           
 
Fields inherited from class java.awt.Dimension
height, width
 
Constructor Summary
CostedDimension()
           
CostedDimension(Dimension2D d)
           
CostedDimension(double width, double height, Dimension2D within)
          Works out cost based on how well the new CostedDimension fits into within.
CostedDimension(double arg0, double arg1, long cost)
           
 
Method Summary
static CostedDimension chooseBest(CostedDimension a, CostedDimension b)
           
 int compareTo(CostedDimension o)
           
 long getCost()
           
 void setCost(int cost)
           
 
Methods inherited from class org.kite9.diagram.position.Dimension2D
add, divide, equals, getHeight, getSize, getWidth, increaseX, increaseY, minus, multiply, multiply, roundUpTo, setSize, setSize, setSize, setX, setY, toString, x, y
 
Methods inherited from class java.awt.Dimension
hashCode
 
Methods inherited from class java.awt.geom.Dimension2D
clone, setSize
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final CostedDimension ZERO

NOT_DISPLAYABLE

public static final CostedDimension NOT_DISPLAYABLE

UNBOUNDED

public static final CostedDimension UNBOUNDED

cost

public long cost
Constructor Detail

CostedDimension

public CostedDimension()

CostedDimension

public CostedDimension(Dimension2D d)

CostedDimension

public CostedDimension(double arg0,
                       double arg1,
                       long cost)

CostedDimension

public CostedDimension(double width,
                       double height,
                       Dimension2D within)
Works out cost based on how well the new CostedDimension fits into within.

Method Detail

getCost

public long getCost()

setCost

public void setCost(int cost)

chooseBest

public static CostedDimension chooseBest(CostedDimension a,
                                         CostedDimension b)

compareTo

public int compareTo(CostedDimension o)
Specified by:
compareTo in interface Comparable<CostedDimension>


Copyright © 2011. All Rights Reserved.