org.eclipse.ocl.examples.eventmanager.framework
Class LogicalOperationFilterImpl

java.lang.Object
  extended by org.eclipse.ocl.examples.eventmanager.filters.AbstractEventFilter
      extended by org.eclipse.ocl.examples.eventmanager.framework.LogicalOperationFilterImpl
All Implemented Interfaces:
EventFilter, LogicalOperationFilter
Direct Known Subclasses:
AndFilter, NotFilter, OrFilter

public abstract class LogicalOperationFilterImpl
extends AbstractEventFilter
implements LogicalOperationFilter

Is the basis for any LogicalOperationFilter implementation. Contains a set of filters and offers package intern methods to modify this set

Author:
Philipp Berger

Constructor Summary
LogicalOperationFilterImpl(EventFilter... filters)
          Creates a filter containing the given filters as operands
 
Method Summary
protected  void addOperand(EventFilter filter)
          Adds an filter to the operands
protected  void addOperands(java.util.Collection<EventFilter> filters)
          Set.addAll(Collection) a collection of filters to the operands
protected  void clearOperands()
          Clears the operands
protected  EventFilter[] cloneContents()
          Creates a new Array with clone for each contained operand
 boolean equals(java.lang.Object obj)
           
 java.lang.Object getFilterCriterion()
          Returns the unique property for an AbstractEventFilter object
 java.util.Set<EventFilter> getOperands()
          Returns a read-only collection containing the filters
 int hashCode()
           
 boolean isNegated()
          logical filters are never negated, negation is done by combining with a NotFilter
 void setNegated(boolean b)
          filter cannot be negated
 
Methods inherited from class org.eclipse.ocl.examples.eventmanager.filters.AbstractEventFilter
clone, expandNewAndOldValueCollections
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.eventmanager.EventFilter
matchesFor
 

Constructor Detail

LogicalOperationFilterImpl

public LogicalOperationFilterImpl(EventFilter... filters)
Creates a filter containing the given filters as operands

Parameters:
filters - to be operands
Method Detail

getOperands

public java.util.Set<EventFilter> getOperands()
Returns a read-only collection containing the filters

Specified by:
getOperands in interface LogicalOperationFilter

clearOperands

protected void clearOperands()
Clears the operands


addOperand

protected void addOperand(EventFilter filter)
Adds an filter to the operands

Parameters:
filter - to add

addOperands

protected void addOperands(java.util.Collection<EventFilter> filters)
Set.addAll(Collection) a collection of filters to the operands

Parameters:
filters - to add

cloneContents

protected EventFilter[] cloneContents()
Creates a new Array with clone for each contained operand

Returns:
the array of clones

getFilterCriterion

public java.lang.Object getFilterCriterion()
Description copied from class: AbstractEventFilter
Returns the unique property for an AbstractEventFilter object

Specified by:
getFilterCriterion in interface EventFilter
Specified by:
getFilterCriterion in class AbstractEventFilter
Returns:
a modifiable set of getOperands()

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in class AbstractEventFilter

setNegated

public void setNegated(boolean b)
filter cannot be negated

Overrides:
setNegated in class AbstractEventFilter
Parameters:
b - true for negating the filter, false for not
Throws:
java.lang.IllegalArgumentException
See Also:
AbstractEventFilter.setNegated(boolean)

isNegated

public boolean isNegated()
logical filters are never negated, negation is done by combining with a NotFilter

Specified by:
isNegated in interface EventFilter
Overrides:
isNegated in class AbstractEventFilter
Returns:
false
See Also:
EventFilter.isNegated()

hashCode

public int hashCode()
Specified by:
hashCode in class AbstractEventFilter