org.openpermis.policy.bean.basic.predicate
Class AbstractPredicate<T>

java.lang.Object
  extended by org.openpermis.policy.bean.basic.BasicPart
      extended by org.openpermis.policy.bean.basic.BasicPartBean
          extended by org.openpermis.policy.bean.basic.predicate.AbstractPredicate<T>
Type Parameters:
T - type of the operands.
All Implemented Interfaces:
Serializable, PartBean, PredicateBean, Part, Predicate
Direct Known Subclasses:
And, Not, Or, Present, SubstringOf, ValueRelationalPredicate, ValueSetRelationalPredicate

public abstract class AbstractPredicate<T>
extends BasicPartBean
implements PredicateBean

A node in the predicate tree consisting in a predicate having two generic operands.

See Also:
Serialized Form
Since:
0.1.0

Constructor Summary
AbstractPredicate(Class<PartBean> partBeanType, SerialNumber serialNumber, T... operands)
          Creates an abstract predicate with operands.
 
Method Summary
 void accept(List<PartBean> parents, MultiPartBeanVisitor visitor)
          Allows traversing the model according to the visitor pattern.
protected abstract  int basicHashCode()
          Returns the hash code of this basic.
protected  boolean equalPart(BasicPart part)
          Compares another part to this part.
 T getOperand(int index)
          Returns the n-th operand of this predicate.
 int getOperandCount()
          Returns the number of operands.
 List<T> getOperands()
          Returns a list of operands.
protected  int partHashCode()
          Returns the hash code of the extended part state.
 
Methods inherited from class org.openpermis.policy.bean.basic.BasicPartBean
accept, addPropertyChangeListener, equalSerialNumber, findBySerialNumber, firePropertyChange, getPartBeanType, getSerialNumber, getSerialNumberString, instanceOf, notifyIdentityChange, notifyNameChange, removePropertyChangeListener, toShortString
 
Methods inherited from class org.openpermis.policy.bean.basic.BasicPart
appendDetails, appendPartDetails, areIdentitiesUnique, areNamesUnique, checkLocalConsistency, checkLocalPartConsistency, comparablePart, equals, getIdentity, getName, getSimpleClassName, hashCode, hasPartIdentity, hasPartName, isIdentityValid, isNameValid, reportProblem, setIdentity, setName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openpermis.policy.Predicate
isMatchable, matches
 
Methods inherited from interface org.openpermis.policy.bean.PartBean
accept, addPropertyChangeListener, checkLocalPartConsistency, equalSerialNumber, findBySerialNumber, getPartBeanType, getSerialNumber, instanceOf, removePropertyChangeListener, toShortString
 
Methods inherited from interface org.openpermis.policy.Part
equals, hashCode, toString
 

Constructor Detail

AbstractPredicate

public AbstractPredicate(Class<PartBean> partBeanType,
                         SerialNumber serialNumber,
                         T... operands)
Creates an abstract predicate with operands.

Parameters:
partBeanType - the primary part bean interface class that this part implements.
serialNumber - the serial number of this part.
operands - an array of operands.
Since:
0.1.0
0.9.0 added partBeanType and serialNumber.
Method Detail

getOperandCount

public int getOperandCount()
Returns the number of operands.

Returns:
the number of operands.
Since:
0.1.0

getOperand

public T getOperand(int index)
Returns the n-th operand of this predicate.

Parameters:
index - the position of the desired operand.
Returns:
the n-th operand.
Since:
0.1.0

getOperands

public List<T> getOperands()
Returns a list of operands.

Returns:
a list of operands
Since:
0.1.0

basicHashCode

protected abstract int basicHashCode()
Returns the hash code of this basic.

Returns:
hash code of this basic.
Since:
0.1.0

equalPart

protected final boolean equalPart(BasicPart part)
Description copied from class: BasicPart
Compares another part to this part.

Overrides:
equalPart in class BasicPart
Parameters:
part - the part to compare to this part.
See Also:
BasicUtilities.equalObjects(Object, Object), BasicPart
Returns:
true if the part supplied is considered equivalent to this part.
Since:
0.9.0

partHashCode

protected final int partHashCode()
Description copied from class: BasicPart
Returns the hash code of the extended part state.

Overrides:
partHashCode in class BasicPart
See Also:
BasicPart, BasicUtilities.multiHashCode(int...)
Returns:
the hash code of the extended part state.
Since:
0.9.0

accept

public void accept(List<PartBean> parents,
                   MultiPartBeanVisitor visitor)
Description copied from interface: PartBean
Allows traversing the model according to the visitor pattern. Visit may be called more than once on each part in the domain model, but it is called exactly once for each tuple (parent path, part).

Each part bean must call method visitor.visit(this)

Specified by:
accept in interface PartBean
Parameters:
parents - the path of parents of this part.
visitor - a PartBeanVisitor.
Since:
0.9.0


OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:16:59
Copyright (c) 2002-2007 Ergon Informatik AG