|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BinaryFunction<S1,S2,T>
A binary function is a function that takes two arguments.
Method Summary | |
---|---|
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. |
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. |
Method Detail |
---|
T compute(S1 arg1, S2 arg2)
arg1
- the first argumentarg2
- the second argument
IllegalArgumentException
- 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.BinaryFunction<S2,S1,T> getPermuted()
Formally, 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
.
BinaryFunction<T,S1,S2> getFirstInverse()
Formally, for all a
and b
where the implementing function is defined:
compute(a,b).equals(c) ⇔ getFirstInverse().compute(c,a).equals(b)
null
if the first inverse function does not exist or is
not defined.boolean isAssociative()
true
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.
true
if this function is associative.boolean isRightIdentityElement(Object obj)
e
fulfils for every object
a
where compute
is defined:
a.equals(compute(a, e))
.
It is not required that this method returns true
,
if the specified object is a right identity element,
so if no statement can be made,
false
is returned.
obj
- the candidate for a right identity element
true
if the specified object is a right identity
element of this function.boolean isLeftSink(Object obj)
s
fulfils for every object
a
where compute
is defined:
s.equals(compute(s, a))
.
It is not required that this method returns true
,
if the specified object is a left sink,
so if no statement can be made,
false
is returned.
obj
- the candidate for a left sink
true
if the specified object is a left sink
of this function.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |