com.miginfocom.util.gfx.geometry.links
Class BoundsLinkNumber

java.lang.Object
  extended by com.miginfocom.util.gfx.geometry.links.BoundsLinkNumber
All Implemented Interfaces:
AtNumber, AtRefNumber, AtRefRangeNumber, java.io.Serializable
Direct Known Subclasses:
AShapeLinkNumber, ShapeLinkNumber

public abstract class BoundsLinkNumber
extends java.lang.Object
implements AtNumber

A link to a number relative to the bounds.

Subclasses should just implements the two abstract methods and return the appropriate value.

See Also:
Serialized Form

Field Summary
protected  AtRefRangeNumber align
          The value used to get a return value in one dimension.
protected  int dim
          X ot Y
static int X
           
static int Y
           
 
Constructor Summary
protected BoundsLinkNumber(AtRefRangeNumber align, int dim)
          Constructor for a relative (percentage) value.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 AtRefRangeNumber getAlign()
          Returns the value that this link represents.
 int getDimension()
          Returns if x or y are the main dimension to use.
protected abstract  float getHorizontalValue(AtRefRangeNumber align)
          Uses the horizontal start and end value to get the value.
 int getIntValue()
          Returns a size without a reference size, rounded to an int.
 int getIntValue(float ref)
          Just calls get getIntValue()
 int getIntValue(float start, float end)
          Just calls get getIntValue()
 float getValue()
          Returns a size without a reference size.
 float getValue(float ref)
          Just calls get getValue()
 float getValue(float start, float end)
          Just calls get getValue()
protected abstract  float getVerticalValue(AtRefRangeNumber align)
          Uses the vertival start and end value to get the value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

X

public static final int X
See Also:
Constant Field Values

Y

public static final int Y
See Also:
Constant Field Values

align

protected final transient AtRefRangeNumber align
The value used to get a return value in one dimension.


dim

protected final transient int dim
X ot Y

Constructor Detail

BoundsLinkNumber

protected BoundsLinkNumber(AtRefRangeNumber align,
                           int dim)
Constructor for a relative (percentage) value.

Parameters:
align - If the value that this link represents. Can be relative to the left, right or both bounds edges of the shape. The start and end position in dim will be ussed to get the value.
dim - The dimension. ShapeLinkNumber.X or ShapeLinkNumber.Y.
Method Detail

getHorizontalValue

protected abstract float getHorizontalValue(AtRefRangeNumber align)
Uses the horizontal start and end value to get the value.

Parameters:
align - The value to call AtRefRangeNumber.getValue(float, float) on.
Returns:
The value that getValue returns.

getVerticalValue

protected abstract float getVerticalValue(AtRefRangeNumber align)
Uses the vertival start and end value to get the value.

Parameters:
align - The value to call AtRefRangeNumber.getValue(float, float) on.
Returns:
The value that getValue returns.

getValue

public final float getValue()
Description copied from interface: AtNumber
Returns a size without a reference size.

Specified by:
getValue in interface AtNumber
Returns:
The size.

getValue

public final float getValue(float ref)
Just calls get getValue()

Specified by:
getValue in interface AtRefNumber
Parameters:
ref - Some reference value. Might be used or disregarded depending on implementation.
Returns:
The value

getValue

public final float getValue(float start,
                            float end)
Just calls get getValue()

Specified by:
getValue in interface AtRefRangeNumber
Parameters:
start - The start value.
end - The end value.
Returns:
The returned value that depends on one or both of the arguments.

getIntValue

public final int getIntValue()
Description copied from interface: AtNumber
Returns a size without a reference size, rounded to an int.

Specified by:
getIntValue in interface AtNumber
Returns:
The size, rounded to an int.

getIntValue

public final int getIntValue(float ref)
Just calls get getIntValue()

Specified by:
getIntValue in interface AtRefNumber
Parameters:
ref - Some reference value. Might be used or disregarded depending on implementation.
Returns:
The value, rounded to an int.

getIntValue

public final int getIntValue(float start,
                             float end)
Just calls get getIntValue()

Specified by:
getIntValue in interface AtRefRangeNumber
Parameters:
start - The start value.
end - The end value.
Returns:
The returned value that depends on one or both of the arguments.

getAlign

public AtRefRangeNumber getAlign()
Returns the value that this link represents. Can be relative to the left, right or both bounds edges of the shape.

Returns:
The value that this link represents.

getDimension

public int getDimension()
Returns if x or y are the main dimension to use. ShapeLinkNumber.X or ShapeLinkNumber.Y.

Returns:
If x or y are the main dimension to use.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.