Package eu.bandm.tools.ops
Class CoTuple<A,B,C,D>
java.lang.Object
eu.bandm.tools.ops.CoTuple<A,B,C,D>
Class realizing a "tagged union" of two(2) to four(4) different cases.
-
Field Summary
Modifier and TypeFieldDescription(package private) final A
Data store for variant 1(package private) final B
Data store for variant 2(package private) final C
Data store for variant 3(package private) final D
Data store for variant 4(package private) final int
The index of the variant realized by this instance. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkSelect
(int s) Check whether this instance is of the given variant.protected boolean
Aux function to compare to objects of unknown class.boolean
get1()
Get the value of variant 1.get2()
Get the value of variant 2.get3()
Get the value of variant 3.get4()
Get the value of variant 4.Return the data object wrapped in this instance.int
Return the index of the variant realized by this instance.int
hashCode()
static <A,
B, C, D> CoTuple<A, B, C, D> new1
(A p1) Create an instance of variant 1static <A,
B, C, D> CoTuple<A, B, C, D> new2
(B p2) Create an instance of variant 2static <A,
B, C, D> CoTuple<A, B, C, D> new3
(C p3) Create an instance of variant 3static <A,
B, C, D> CoTuple<A, B, C, D> new4
(D p4) Create an instance of variant 4toString()
-
Field Details
-
select
final int selectThe index of the variant realized by this instance. -
p1
Data store for variant 1 -
p2
Data store for variant 2 -
p3
Data store for variant 3 -
p4
Data store for variant 4
-
-
Constructor Details
-
CoTuple
Only constructor, called by factory methods.
-
-
Method Details
-
new1
Create an instance of variant 1 -
new2
Create an instance of variant 2 -
new3
Create an instance of variant 3 -
new4
Create an instance of variant 4 -
getSelect
public int getSelect()Return the index of the variant realized by this instance. -
get1
Get the value of variant 1. -
get2
Get the value of variant 2. -
get3
Get the value of variant 3. -
get4
Get the value of variant 4. -
checkSelect
protected void checkSelect(int s) Check whether this instance is of the given variant. -
getObject
Return the data object wrapped in this instance. -
toString
-
compEqual
Aux function to compare to objects of unknown class. -
equals
-
hashCode
public int hashCode()
-