ecologylab.collections
Class FloatSetElement

java.lang.Object
  extended by ecologylab.generic.Debug
      extended by ecologylab.collections.FloatSetElement

public class FloatSetElement
extends Debug

A FloatWeightSet element. Basic implementation of SetElement for cases when you can inherit from here


Field Summary
static int NOT_A_MEMBER
           
 float weight
          Cached version of weight.
 
Constructor Summary
FloatSetElement()
           
FloatSetElement(float initial)
           
 
Method Summary
 void clear()
          Only for use by FloatWeightSet.clear(), and delete.
 void delaySetWeight(float newWeight)
          Change the weight of the element, without propogating the new weight into the data structure.
 void delete()
          Delete in the most expedient manner possible.
 boolean delete(int recompute)
          Delete the element from the set.
 void deleteHook()
          Callback that happens at the end of a delete, and when an element gets pruned.
 boolean filteredOut()
          This can be overridden to exclude elements from selection while keeping them in the set.
 int getIndex()
           
 float getWeight()
           
 void insertHook()
          A callback method for when an element is inserted into a floatWeightSet.
 boolean isInSet()
           
 boolean recycle()
          Free resources associated w this element.
protected  BasicFloatSet set()
          The set object that this element is part of, or null if its not a member of any set.
 void setIndex(int newIndex)
           
 void setSet(BasicFloatSet setArg)
           
 void setWeight(float newWeight)
          Set the weight slot.
 java.lang.String toString()
           
 
Methods inherited from class ecologylab.generic.Debug
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, warning, warning, weird, weird
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOT_A_MEMBER

public static final int NOT_A_MEMBER
See Also:
Constant Field Values

weight

public float weight
Cached version of weight. Made accessible for efficiency's sake. Use carefully, at your own risk, and only w inside, deep understanding.

Constructor Detail

FloatSetElement

public FloatSetElement()

FloatSetElement

public FloatSetElement(float initial)
Method Detail

getWeight

public float getWeight()

filteredOut

public boolean filteredOut()
This can be overridden to exclude elements from selection while keeping them in the set.

Returns:
The default implementation always returns false, including all elements for selection.

getIndex

public int getIndex()

setIndex

public void setIndex(int newIndex)

setSet

public void setSet(BasicFloatSet setArg)

isInSet

public boolean isInSet()

delete

public final void delete()
Delete in the most expedient manner possible. This is final because you should override deleteHook() to provide custom behavior.


delete

public final boolean delete(int recompute)
Delete the element from the set. This means changing the set's structure, and also changing slots in this to reflect its lack of membership.

Parameters:
recompute - -1 for absolutely no recomputation of the set's internal structures. 0 for recompute upwards from el 1 for recompute all
Returns:
true if the element was a member of a set, and thus, if the delete does something; false if the element was not a member of a set, and thus, if the delete does *nothing*.

deleteHook

public void deleteHook()
Callback that happens at the end of a delete, and when an element gets pruned. This implementation is empty. Override to provide custom behaviors.


insertHook

public void insertHook()
A callback method for when an element is inserted into a floatWeightSet. This implementation is empty. Override to provide custom behaviors.


clear

public void clear()
Only for use by FloatWeightSet.clear(), and delete. This is used to reset state of this, in cases when the state of the FloatWeightSet we were part of is being reset some other way, or if it is being discarded.


delaySetWeight

public void delaySetWeight(float newWeight)
Change the weight of the element, without propogating the new weight into the data structure. The result of the change will be propogated later by some other operation (such as delete) which performs a recompute


setWeight

public void setWeight(float newWeight)
Set the weight slot. Doesn't effect the set if no longer a member.


toString

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

recycle

public boolean recycle()
Free resources associated w this element.


set

protected BasicFloatSet set()
The set object that this element is part of, or null if its not a member of any set.

Returns: