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

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

public class RefOperFilter
extends RefRangeOperFilter
implements AtRefNumber

A constraint that set a constraint typed as AtRefNumber.
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
RefOperFilter(AtRefNumber wrap, int oper, AtRefNumber constr)
          Constructor.
RefOperFilter(AtRefNumber wrap, int oper, AtRefNumber constr, float auxValue)
          Constructor.
 
Method Summary
 RefOperFilter derive(AtRefNumber newWrap)
          Creates a clone with a new wrapped number.
 boolean equals(java.lang.Object o)
           
 float filter(float value, float ref)
          Filters value through this filter.
 int getIntValue(float ref)
          Returns a value rounded to an int, possibly depending on the ref.
 AtRefNumber getRefConstraint()
          Returns the constraint value.
 AtRefNumber getRefWrapped()
          Returns the constraint value.
 float getValue(float ref)
          Returns a value, possibly depending on the ref.
 
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.AtRefRangeNumber
getIntValue, getValue
 

Constructor Detail

RefOperFilter

public RefOperFilter(AtRefNumber wrap,
                     int oper,
                     AtRefNumber constr)
Constructor.

Parameters:
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.AtRefNumber) to get a constraint that can be used.
oper - The operation. E.g. RefRangeOperFilter.MIN or RefRangeOperFilter.MAX
constr - The cut-value to use in the operation. Normally the min or max value.
See Also:
RefRangeOperFilter.ADD, RefRangeOperFilter.SUB, RefRangeOperFilter.MUL, RefRangeOperFilter.DIV, RefRangeOperFilter.MIN, RefRangeOperFilter.MAX

RefOperFilter

public RefOperFilter(AtRefNumber wrap,
                     int oper,
                     AtRefNumber constr,
                     float auxValue)
Constructor.

Parameters:
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.AtRefNumber) to get a constraint that can be used.
oper - The operation. E.g. RefRangeOperFilter.MIN or RefRangeOperFilter.MAX
constr - The cut-value to use in the operation. Normally the min or max value.
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, RefRangeOperFilter.SET
Method Detail

getRefConstraint

public final AtRefNumber getRefConstraint()
Returns the constraint value.

Returns:
The constraint value. Not null.

getRefWrapped

public final AtRefNumber getRefWrapped()
Returns the constraint value.

Returns:
The constraint value. Not null.

getValue

public float getValue(float ref)
Description copied from interface: AtRefNumber
Returns a value, possibly depending on the ref.

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

getIntValue

public int getIntValue(float ref)
Description copied from interface: AtRefNumber
Returns a value rounded to an int, possibly depending on the ref.

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.

filter

public float filter(float value,
                    float ref)
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(float) but with the core value replaced with value.

Parameters:
value - The value to filter
ref - The reference value. Same as for getValue(float)
Returns:
The filtered value.

derive

public RefOperFilter derive(AtRefNumber newWrap)
Creates a clone with a new wrapped number. Shallow clone except for setting the new wrapper.

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 RefRangeOperFilter


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.