|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.molae.pipe.binop.AbstractBinaryFunction<S1,S2,T>
public abstract class AbstractBinaryFunction<S1,S2,T>
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 T |
compute(S1 arg1,
S2 arg2)
Performs a computation on the specified arguments and returns the result of that computation. |
BinaryFunction<T,S1,S2> |
getFirstInverse()
Returns the first inverse of this function. |
BinaryFunction<S2,S1,T> |
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<T,S1,S2> firstInverse)
Sets the first inverse of this function. |
void |
setPermuted(BinaryFunction<S2,S1,T> 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 T compute(S1 arg1,
S2 arg2)
BinaryFunction
compute in interface BinaryFunction<S1,S2,T>arg1 - the first argumentarg2 - the second argument
public final BinaryFunction<S2,S1,T> 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 BinaryFunction<S1,S2,T>public final void setPermuted(BinaryFunction<S2,S1,T> permuted)
permuted - the permuted function of this function
IllegalStateException - if the permuted function was already
set before.getPermuted()public BinaryFunction<T,S1,S2> 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 BinaryFunction<S1,S2,T>null if the first inverse function does not exist or is
not defined.public void setFirstInverse(BinaryFunction<T,S1,S2> 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 BinaryFunction<S1,S2,T>true if this function is associative.protected boolean isAnIdentityElement(Object obj)
obj - the candidate for an identity element
true 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 BinaryFunction<S1,S2,T>obj - the candidate for a right identity element
true if the specified object is a right identity
element of this function.protected boolean isASink(Object obj)
obj - the candidate for a sink
true 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 BinaryFunction<S1,S2,T>obj - the candidate for a left sink
true 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: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||