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

java.lang.Object
  extended by com.miginfocom.util.gfx.geometry.filters.RefRangeOperFilter
      extended by com.miginfocom.util.gfx.geometry.filters.RefOperFilter
          extended by com.miginfocom.util.gfx.geometry.filters.OperFilter
All Implemented Interfaces:
AtNumber, AtRefNumber, AtRefRangeNumber, java.io.Serializable

public class OperFilter
extends RefOperFilter
implements AtNumber

A constraint that set a constraint typed as AtNumber.
For a thourough explanation of how th use the filters see RefRangeOperFilter.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.miginfocom.util.gfx.geometry.filters.RefRangeOperFilter
ADD, auxValue, constr, DIV, MAX, MIN, MUL, oper, PERCENT, SET, SUB, wrap
 
Constructor Summary
OperFilter(AtNumber wrap, int oper, AtNumber constr)
          Constructor.
OperFilter(AtNumber wrap, int oper, AtNumber constr, float auxValue)
          Constructor.
 
Method Summary
 OperFilter derive(AtNumber newWrap)
          Creates a clone with a new wrapped number.
 boolean equals(java.lang.Object o)
           
 float filter(float value)
          Filters value through this filter.
 AtNumber getConstraint()
          Returns the constraint value.
 int getIntValue()
          Returns a size without a reference size, rounded to an int.
 float getValue()
          Returns a size without a reference size.
 AtNumber getWrapped()
          Returns the constraint value.
 
Methods inherited from class com.miginfocom.util.gfx.geometry.filters.RefOperFilter
derive, filter, getIntValue, getRefConstraint, getRefWrapped, getValue
 
Methods inherited from class com.miginfocom.util.gfx.geometry.filters.RefRangeOperFilter
constrainByType, derive, filter, getAuxValue, getIntValue, getOperation, getRefRangeConstraint, getRefRangeWrapped, getValue, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.miginfocom.util.gfx.geometry.numbers.AtRefNumber
getIntValue, getValue
 
Methods inherited from interface com.miginfocom.util.gfx.geometry.numbers.AtRefRangeNumber
getIntValue, getValue
 

Constructor Detail

OperFilter

public OperFilter(AtNumber wrap,
                  int oper,
                  AtNumber constr)
Constructor.

Parameters:
constr - The cut-value to use in the operation. Normally the min or max value.
oper - The operation. E.g. RefRangeOperFilter.MIN or RefRangeOperFilter.MAX
wrap - Wrapped value to be constraint. If null this constraint will only be funcional as a builder. Call derive(com.miginfocom.util.gfx.geometry.numbers.AtNumber) to get a constraint that can be used.
See Also:
RefRangeOperFilter.ADD, RefRangeOperFilter.SUB, RefRangeOperFilter.MUL, RefRangeOperFilter.DIV, RefRangeOperFilter.MIN, RefRangeOperFilter.MAX

OperFilter

public OperFilter(AtNumber wrap,
                  int oper,
                  AtNumber constr,
                  float auxValue)
Constructor.

Parameters:
constr - The cut-value to use in the operation. Normally the min or max value.
oper - The operation. E.g. RefRangeOperFilter.MIN or RefRangeOperFilter.MAX
wrap - Wrapped value to be constraint. If null this constraint will only be funcional as a builder. Call derive(com.miginfocom.util.gfx.geometry.numbers.AtNumber) to get a constraint that can be used.
auxValue - If the operation needs an extra value, such as RefRangeOperFilter.PERCENT, that value goes here.
See Also:
RefRangeOperFilter.ADD, RefRangeOperFilter.SUB, RefRangeOperFilter.MUL, RefRangeOperFilter.DIV, RefRangeOperFilter.MIN, RefRangeOperFilter.MAX, RefRangeOperFilter.PERCENT
Method Detail

getConstraint

public AtNumber getConstraint()
Returns the constraint value.

Returns:
The constraint value. Not null.

getWrapped

public AtNumber getWrapped()
Returns the constraint value.

Returns:
The constraint value. Not null.

getValue

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

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

getIntValue

public 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.

filter

public float filter(float value)
Filters value through this filter. In effect value will ripple from the innermost filter and out, being constrained/filtered/ operated on on the way out to the outmost filter. Similar to getValue() but with the core value replaced with value.

Parameters:
value - The value to filter
Returns:
The filtered value.

derive

public OperFilter derive(AtNumber newWrap)
Creates a clone with a new wrapped number. Shallow clone except for setting the new wrapper. If this constraint wraps another OperFilter the method will call derive(com.miginfocom.util.gfx.geometry.numbers.AtNumber) on that object effectively replacing the innermost wrapped non-OperFilter.

Parameters:
newWrap - The wrapped number for the clone.
Returns:
A clone with a new wrapped number.

equals

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


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.