java.lang.Cloneable
, java.lang.Iterable<java.lang.Object>
public class LPair extends LList implements java.lang.Cloneable
USEJOLLYTOKEN
Constructor | Description |
---|---|
LPair() |
Constructs an unbound logical pair with default name.
|
LPair(java.lang.Object first,
java.lang.Object second) |
Constructs a logical pair
[first,second] with default name. |
LPair(java.lang.String name) |
Constructs an unbound logical pair with name
name . |
LPair(java.lang.String name,
java.lang.Object first,
java.lang.Object second) |
Constructs a logical pair
[first,second] with external name name . |
LPair(java.lang.String name,
LPair lPair) |
Constructs a logical pair equal to the logical pair
lPair with the given name. |
LPair(LPair lPair) |
Constructs a logical pair equal to the logical pair
lPair with default name. |
Modifier and Type | Method | Description |
---|---|---|
java.lang.Object |
accept(jsetl.Visitor visitor) |
Needed for the visitor design pattern.
|
LPair |
clone() |
Returns a bit-by-bit clone of this object.
|
java.lang.Object |
getFirst() |
Returns the first element of this logical pair, if the pair is bound.
|
java.lang.Object |
getSecond() |
Returns the second element of this logical pair, if the pair is bound.
|
LPair |
setName(java.lang.String name) |
Sets the name of this logical pair to
name . |
LPair |
setValue(java.util.List<?> pair) |
Sets the value of this logical pair to
pair . |
forallElems, isClosed, isEmpty, isGround, iterator, printElems, testContains, toArray, toString
public LPair()
public LPair(@NotNull java.lang.String name)
name
.name
- the name of the logical pair.public LPair(@NotNull java.lang.Object first, @NotNull java.lang.Object second)
[first,second]
with default name.first
- the first element of the pair.second
- the second element of the pair.public LPair(@NotNull java.lang.String name, @NotNull java.lang.Object first, @NotNull java.lang.Object second)
[first,second]
with external name name
.name
- the name of the pair.first
- the first element of the pair.second
- the second element of the pair.public LPair(@NotNull LPair lPair)
lPair
with default name.
Using this constructor is equivalent to creating a new unbound logical pair
and posting and solving the constraint this.eq(lPair)
.lPair
- the other logical pair.public LPair(@NotNull java.lang.String name, @NotNull LPair lPair)
lPair
with the given name.
Using this constructor is equivalent to creating a new unbound logical pair
and posting and solving the constraint this.eq(lPair)
.name
- the name of the pair.lPair
- the other logical pair.@NotNull public LPair setName(@NotNull java.lang.String name)
name
.public LPair setValue(@NotNull java.util.List<?> pair)
pair
.setValue
in class LList
pair
- a list that must have length 2.this
with the value assigned.InitLObjectException
- if this pair
is bound.java.lang.NullPointerException
- if pair
contains null
values.java.lang.IllegalArgumentException
- if pair
has not size 2
.@Nullable public java.lang.Object accept(@NotNull jsetl.Visitor visitor)
@NotNull public java.lang.Object getFirst()
NotInitLObjectException
- if this logical collection is not bound.@NotNull public java.lang.Object getSecond()
NotInitLObjectException
- if this logical collection is not bound.java.lang.IndexOutOfBoundsException
- if this logical collection is bound to an open list with only one
known element.