hep.wired.cut
Class Cut

java.lang.Object
  extended by hep.wired.cut.Cut

public class Cut
extends Object

Cut that can be applied to displayable objects.

Version:
$Id: Cut.java 13832 2011-05-10 23:25:08Z onoprien $
Author:
Dmitry Onoprienko

Nested Class Summary
static class Cut.Result
           
 
Field Summary
protected  ChangeEvent _defaultEvent
           
protected static String _defaultName
           
protected  boolean _eventsPending
           
protected  boolean _valueIsAdjusting
           
 
Constructor Summary
Cut()
           
Cut(String name)
           
 
Method Summary
 void add(Condition condition)
          Adds condition to this cut.
 void addAll(Collection<? extends Condition> conditions)
           
 void addChangeListener(ChangeListener a)
           
 void addCutSet(CutSet set)
          Adds the specified CutSet to the list of known sets.
 void fireStateChanged()
           
 void fireStateChanged(ChangeEvent e)
           
 Condition getCondition(int index)
          Returns condition specified by the index.
 List<Condition> getConditions()
          Returns the list of conditions in this cut.
 Set getEnabledConditions()
          Returns a set of enabled conditions.
 String getName()
          Returns the name of the cut.
 Cut.Result pass(Map<String,org.freehep.util.Value> data, boolean invert)
          Tells the client whether this cut is satisfied by the supplied data.
 Cut.Result pass(Map<String,org.freehep.util.Value> data, Object moreData, boolean invert)
          Tells the client whether this cut is satisfied by the supplied data.
 void remove()
          Called when this Cut needs to be deleted.
 void remove(Condition condition)
          Removes the specified condition from this cut.
 void removeAll()
          Removes all conditions from this cut.
 void removeChangeListener(ChangeListener r)
           
 void removeCutSet(CutSet set)
          Removes the specified CutSet from the list of known sets.
 void removeDisabled()
          Removes disabled conditions from this cut.
 void reset()
          Resets all conditions to their default state.
 void setName(String newName)
          Sets the name of this cut.
 void setValueIsAdjusting(boolean valueIsAdjusting)
          Sets valueIsAdjusting property.
 int size()
          Returns the number of conditions in this cut.
 void synchronize(Collection<ConditionDefinition> definitions)
          Removes conditions whose definitions are not in the supplied collection, creates and adds disabled condition for every definition from the collection that is not already used by this cut.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_defaultName

protected static final String _defaultName
See Also:
Constant Field Values

_defaultEvent

protected final ChangeEvent _defaultEvent

_valueIsAdjusting

protected boolean _valueIsAdjusting

_eventsPending

protected boolean _eventsPending
Constructor Detail

Cut

public Cut()

Cut

public Cut(String name)
Method Detail

getName

public String getName()
Returns the name of the cut.


getCondition

public Condition getCondition(int index)
Returns condition specified by the index.


getConditions

public List<Condition> getConditions()
Returns the list of conditions in this cut.


size

public int size()
Returns the number of conditions in this cut.


getEnabledConditions

public Set getEnabledConditions()
Returns a set of enabled conditions.


setName

public void setName(String newName)
Sets the name of this cut.


addCutSet

public void addCutSet(CutSet set)
Adds the specified CutSet to the list of known sets. CutSet will be notified of any changes in this Cut.


removeCutSet

public void removeCutSet(CutSet set)
Removes the specified CutSet from the list of known sets. CutSet will be notified of any changes in this Cut.


add

public void add(Condition condition)
Adds condition to this cut.


addAll

public void addAll(Collection<? extends Condition> conditions)

remove

public void remove(Condition condition)
Removes the specified condition from this cut.


removeAll

public void removeAll()
Removes all conditions from this cut.


removeDisabled

public void removeDisabled()
Removes disabled conditions from this cut.


synchronize

public void synchronize(Collection<ConditionDefinition> definitions)
Removes conditions whose definitions are not in the supplied collection, creates and adds disabled condition for every definition from the collection that is not already used by this cut.


reset

public void reset()
Resets all conditions to their default state.


remove

public void remove()
Called when this Cut needs to be deleted. Removes itself from all CutSets, unregisters its Conditions from ConditionDefinitions.


pass

public Cut.Result pass(Map<String,org.freehep.util.Value> data,
                       boolean invert)
Tells the client whether this cut is satisfied by the supplied data. If the cut is not inverted, returns PASS if the data satisfies all applicable conditions, FAIL if the data fails at least one condition, IGNORE is there are no enabled applicable conditions. If the cut is inverted, returns PASS if the data fails at least one condition, FAIL if all applicable conditions are satisfied, IGNORE is there are no enabled applicable conditions. The condition is deemed applicable if data maps its name to non-null Value with compatible type.

Parameters:
data - Map of attribute names to values.
invert - True if this cut should be inverted.
Returns:
PASS if the data satisfies this cut, FAIL if the data fails the cut, and IGNORE if the cut is inapplicable.

pass

public Cut.Result pass(Map<String,org.freehep.util.Value> data,
                       Object moreData,
                       boolean invert)
Tells the client whether this cut is satisfied by the supplied data. The implementation provided by this class forwards the call to pass(java.util.Map, boolean), ignoring moreData parameter. Subclasses may override to implement more complex filtering.

Parameters:
data - Map of attribute names to values.
moreData - Additional data to be used in filtering.
invert - True if this cut should be inverted.
Returns:
PASS if the data satisfies this cut, FAIL if the data fails the cut, and IGNORE if the cut is inapplicable.

addChangeListener

public void addChangeListener(ChangeListener a)

removeChangeListener

public void removeChangeListener(ChangeListener r)

fireStateChanged

public void fireStateChanged(ChangeEvent e)

fireStateChanged

public void fireStateChanged()

setValueIsAdjusting

public void setValueIsAdjusting(boolean valueIsAdjusting)
Sets valueIsAdjusting property. If valueIsAdjusting is false, any calls to fireStateChanged() methods will result in listeners being notified immediately. If valueIsAdjusting is true, notification will be postponed until the next call to setValueIsAdjusting(false), and a single event with this cut as a source will be sent then.


toString

public String toString()
Overrides:
toString in class Object


Copyright © 1996-2013 FreeHEP. All Rights Reserved.