|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.sf.molae.pipe.binop.AbstractBinaryFunction
Skeleton implementation of BinaryFunction, that stores the
related functions as properties.
Only the compute(Object, Object) operation has to be implemented.
| Constructor Summary | |
AbstractBinaryFunction(String name)
Constructs a new AbstractBinaryFunction from the specified properties. |
|
AbstractBinaryFunction(String name,
boolean associative,
boolean hasRightIdentityElements,
boolean hasLeftSinks)
Constructs a new AbstractBinaryFunction from the specified properties. |
|
AbstractBinaryFunction(String name,
boolean associative,
boolean hasRightIdentityElements,
boolean hasLeftSinks,
boolean hasLeftIdentityElements,
boolean hasRightSinks,
String nameOfPermuted)
Constructs a new AbstractBinaryFunction from the specified properties. |
|
| Method Summary | |
abstract Object |
compute(Object arg1,
Object arg2)
Performs a computation on the specified arguments and returns the result of that computation. |
BinaryFunction |
getFirstInverse()
Returns the first inverse of this function. |
BinaryFunction |
getPermuted()
Returns the permuted function of this function. |
protected boolean |
isAnIdentityElement(Object obj)
Tests if the specified object is an identity element in at least one function of the circle. |
protected boolean |
isASink(Object obj)
Tests if the specified object is a sink in at least one function of the circle. |
boolean |
isAssociative()
Indicates if this function is associative. |
boolean |
isLeftSink(Object obj)
Tests if the specified element is a left sink of this function. |
boolean |
isRightIdentityElement(Object obj)
Tests if the specified element is a right identity element of this function. |
void |
setFirstInverse(BinaryFunction firstInverse)
Sets the first inverse of this function. |
void |
setPermuted(BinaryFunction permuted)
Specifies the permuted value. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public AbstractBinaryFunction(String name,
boolean associative,
boolean hasRightIdentityElements,
boolean hasLeftSinks)
name - the result of the toString() methodassociative - this value is returned by the
isAssociative() method.hasRightIdentityElements - specifies if this method has one or
more right identity elements.hasLeftSinks - specifies if this method has one or more left
sinks.
public AbstractBinaryFunction(String name,
boolean associative,
boolean hasRightIdentityElements,
boolean hasLeftSinks,
boolean hasLeftIdentityElements,
boolean hasRightSinks,
String nameOfPermuted)
name - the result of the toString() methodassociative - this value is returned by the
isAssociative() method.hasRightIdentityElements - specifies if this method has one or
more right identity elements.hasLeftSinks - specifies if this method has one or more left
sinks.hasLeftIdentityElements - specifies if this method has one or
more left identity elements.hasRightSinks - specifies if this method has one or more right
sinks.nameOfPermuted - the name of the associated permuted function.public AbstractBinaryFunction(String name)
name - the result of the toString() method| Method Detail |
public abstract Object compute(Object arg1,
Object arg2)
BinaryFunctioncompute in interface BinaryFunctionnet.sf.molae.pipe.binop.BinaryFunctionarg1 - the first argumentarg2 - the second argumentIllegalArgumentException - Some aspect of either argument
prevents it from being computed.ClassCastException - if the class of either argument is
not accepted by this function.NullPointerException - if one of the or both arguments are
null and the computation does not allow
null values.public final BinaryFunction getPermuted()
BinaryFunctionFormally, for all a and b
where compute is defined:
compute(a,b).equals(getPermuted().compute(b,a))If the implementing function is commutative, it is expected that
equals(getPermuted()) returns true.getPermuted in interface BinaryFunctionnet.sf.molae.pipe.binop.BinaryFunctionpublic final void setPermuted(BinaryFunction permuted)
permuted - the permuted function of this functionIllegalStateException - if the permuted function was already
set before.getPermuted()public BinaryFunction getFirstInverse()
BinaryFunctionFormally, for all a and b
where the implementing function is defined:
compute(a,b).equals(c) ⇔ getFirstInverse().compute(c,a).equals(b)
getFirstInverse in interface BinaryFunctionnet.sf.molae.pipe.binop.BinaryFunctionnull if the first inverse function does not exist or is
not defined.public void setFirstInverse(BinaryFunction firstInverse)
firstInverse - the new value of the first inverse.getFirstInverse()public final boolean isAssociative()
BinaryFunctiontrue if for two objects
a and b:
compute(a,compute(b,c)).equals(compute(compute(a,b),c)
It is not required that this method returns true,
if the method is associative,
so if no statement about associativity can be made,
false is returned.
isAssociative in interface BinaryFunctionnet.sf.molae.pipe.binop.BinaryFunctiontrue if this function is associative.protected boolean isAnIdentityElement(Object obj)
obj - the candidate for an identity elementtrue if the specified object is an
identity element in at least one function of the circle.public boolean isRightIdentityElement(Object obj)
hasRightElements property and
isAnIdentityElement(Object).isRightIdentityElement in interface BinaryFunctionobj - the candidate for a right identity elementtrue if the specified object is a right identity
element of this function.protected boolean isASink(Object obj)
obj - the candidate for a sinktrue if the specified object is a
sink in at least one function of the circle.public boolean isLeftSink(Object obj)
hasLeftSinks property and
isASink(Object).isLeftSink in interface BinaryFunctionobj - the candidate for a left sinktrue if the specified object is a left sink
of this function.public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||