com.miginfocom.util.gfx.geometry.filters
Class SizeConstraint

java.lang.Object
  extended by com.miginfocom.util.gfx.geometry.filters.SizeConstraint
All Implemented Interfaces:
java.io.Serializable

public class SizeConstraint
extends java.lang.Object
implements java.io.Serializable

A constraint to constrain the size of a Range. Can cut or expand to comply with the size constraint. The cut/expand can be aligned.

See Also:
Serialized Form

Field Summary
static SizeConstraint SIZE_MIN_MAX_END
          Static reference to a new SizeConstraint(FIXED0, FRACTION1, 0f)/code> object.
static SizeConstraint SIZE_MIN_MAX_START
          Static reference to a new SizeConstraint(FIXED0, FRACTION1, 0f)/code> object.
 
Constructor Summary
SizeConstraint(AtRefNumber min, AtRefNumber max, float sizeAlign)
          Convenience constructor for setting min and max size.
SizeConstraint(RefOperFilter filterConstr, float sizeAlign)
          Constructor.
 
Method Summary
 void constrain(Range r, float refSize)
           
 boolean equals(java.lang.Object o)
           
 RefOperFilter getConstraint()
          Returns the constraint sent into the constructor.
 float getSizeAlign()
          Returns the size alignment sent into the constructor.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIZE_MIN_MAX_START

public static final SizeConstraint SIZE_MIN_MAX_START
Static reference to a new SizeConstraint(FIXED0, FRACTION1, 0f)/code> object. Can be used freely since it's immutable.


SIZE_MIN_MAX_END

public static final SizeConstraint SIZE_MIN_MAX_END
Static reference to a new SizeConstraint(FIXED0, FRACTION1, 0f)/code> object. Can be used freely since it's immutable.

Constructor Detail

SizeConstraint

public SizeConstraint(AtRefNumber min,
                      AtRefNumber max,
                      float sizeAlign)
Convenience constructor for setting min and max size.

Parameters:
min - The minimum size. Not null.
max - The maximum size. Not null.
sizeAlign - If the size is adjusted, this tells how to align the new range relative to the old. 0.0 menas left align and 1.0 right align. Any value inbetween is also valid of course.
See Also:
RefOperFilter

SizeConstraint

public SizeConstraint(RefOperFilter filterConstr,
                      float sizeAlign)
Constructor.

Parameters:
filterConstr - The constraint. Can be nested constraints.
sizeAlign - If the size is adjusted, this tells how to align the new range relative to the old. 0.0 let align and 1.0 right align. Any value inbetween is also valid.
See Also:
RefOperFilter
Method Detail

constrain

public void constrain(Range r,
                      float refSize)

getConstraint

public final RefOperFilter getConstraint()
Returns the constraint sent into the constructor.

Returns:
The constraint sent into the constructor.

getSizeAlign

public final float getSizeAlign()
Returns the size alignment sent into the constructor.

Returns:
The size alignment sent into the constructor.

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.