java.lang.Cloneable
, java.lang.Iterable<java.lang.Object>
LPair
public class LList extends LCollection implements java.lang.Cloneable
USEJOLLYTOKEN
Constructor | Description |
---|---|
LList() |
Constructs an unbound logical list with default name.
|
LList(java.lang.String name) |
Constructs an unbound logical list with a given name.
|
LList(java.lang.String name,
java.util.List<?> elements) |
Constructs a (completely specified) logical list with value
elements and given name. |
LList(java.lang.String name,
LList lList) |
Constructs a logical list equal to the logical list
lList and with given name. |
LList(java.util.List<?> elements) |
Constructs a (completely specified) logical list with value a
elements and default name. |
LList(LList lList) |
Constructs a logical list equal to the logical list
lList and with default name. |
Modifier and Type | Method | Description |
---|---|---|
java.lang.Object |
accept(jsetl.Visitor visitor) |
This method is used for the Visitor design pattern.
|
LList |
clone() |
Creates and returns a bit-by-bit copy of this object.
|
static LList |
empty() |
Creates and returns the empty logical list.
|
Constraint |
eq(java.util.List<?> list) |
Constructs and returns a new constraint which demands that
this is equal to list |
Constraint |
eq(LList lList) |
Constructs and returns a new constraint which demands that
this is equal to lList |
boolean |
equals(java.lang.Object other) |
Checks whether this
LList is equal to the specified Object . |
java.lang.Object |
get(int i) |
Returns the
i -th (starting from 0) element of this collection. |
int |
getSize() |
Returns the number of elements of this logical list.
|
LList |
getTail() |
Gets the tail of this
LList . |
java.util.ArrayList<?> |
getValue() |
Gets the value of this
LList as an ArrayList |
LList |
ins(java.lang.Object... objects) |
Constructs a new logical list which is the result of the addition of
objects to the head of this logical list. |
LList |
insAll(java.lang.Object[] objects) |
Constructs a new logical list which is the result of the addition of each object in
objects to the head of this logical list. |
LList |
insAll(java.util.Collection<?> newElements) |
Constructs a new logical list which is the result of the addition of each object in
objects to the head of this logical list. |
LList |
insn(java.lang.Object object) |
Constructs a new logical list which is the result of the addition of
object as the last (known) element of this logical list. |
static LList |
mkIntList(int length) |
Constructs and returns a closed logical list containing
length unbound IntLVars . |
static LList |
mkList(int length) |
Constructs and returns a closed logical list containing
length unbound LVars . |
Constraint |
neq(java.util.List<?> list) |
Constructs and returns a new constraint which demands that
this is not equal to list . |
Constraint |
neq(LList lList) |
Constructs and returns a new constraint which demands that
this is not equal to lList . |
LList |
setName(java.lang.String name) |
Sets the name of this logical list and returns the logical list.
|
LList |
setValue(java.util.List<?> list) |
Sets the value of this logical list to the parameter.
|
forallElems, isClosed, isEmpty, isGround, iterator, printElems, testContains, toArray, toString
public LList()
public LList(@NotNull java.lang.String name)
name
- name of this logical list.public LList(@NotNull java.util.List<?> elements)
elements
and default name.
Using this constructor is equivalent to creating an unbound logical list and solving the constraint
this.eq(elements)
.elements
- list of elements for this logical list. It must not contain null
values.java.lang.NullPointerException
- if elements
contains null
values.public LList(@NotNull java.lang.String name, @NotNull java.util.List<?> elements)
elements
and given name.name
- name for the logical collection.elements
- elements for the logical collection. It must not contain null
values.java.lang.NullPointerException
- if elements
contains null
values.public LList(@NotNull LList lList)
lList
and with default name.
Using this constructor is equivalent to creating an unbound LList
and posting and
solving the constraint this.eq(lList)
.lList
- the logical list to copy.@NotNull public static LList empty()
@NotNull public static LList mkList(int length)
length
unbound LVars
.length
- number of unbound LVar
s.@NotNull public static LList mkIntList(int length)
length
unbound IntLVars
.length
- number of unbound IntLVar
s.@Nullable public java.lang.Object accept(@NotNull jsetl.Visitor visitor)
visitor
- the visitor that wants to visit the object.visitor.visit(this)
.public LList setName(@NotNull java.lang.String name)
@NotNull public LList ins(@NotNull java.lang.Object... objects)
objects
to the head of this logical list.
Does not modify this logical list.objects
- the objects to insert. It must not contain null
values.java.lang.NullPointerException
- if some of objects
are null
.@NotNull public LList insn(@NotNull java.lang.Object object)
object
as the last (known) element of this logical list.
Does not modify this logical list.object
- the object to insert.@NotNull public LList insAll(@NotNull java.lang.Object[] objects)
objects
to the head of this logical list.
Does not modify this logical list.objects
- array of objects to insert. It must not contain null
elements.java.lang.NullPointerException
- if objects
contains null
values.@NotNull public LList insAll(@NotNull java.util.Collection<?> newElements)
objects
to the head of this logical list.
Does not modify this logical list.newElements
- iterable of objects to insert. It must not contain null
values.java.lang.NullPointerException
- if newElements
contains null
values.@Nullable public java.util.ArrayList<?> getValue()
LList
as an ArrayList
@NotNull public LList setValue(@NotNull java.util.List<?> list)
list
.
Using this method is equivalent to solving the constraint this.eq(list)
.list
- the new value of this logical list. It must not contain null
values.InitLObjectException
- if this
is bound.java.lang.NullPointerException
- if list
contains null
values.@NotNull public LList clone()
public boolean equals(@Nullable java.lang.Object other)
LList
is equal to the specified Object
.
The Objects
are equal when:
- they are the same object or reference to the same object,
even if the object or the reference are not initialized,
- they contain equal objects or they contain references to
equal objects (order does matter).
(ignores the unspecified rest of the logical list if present)equals
in class java.lang.Object
other
- object to check for equality with this
true
if the LLists
are equals, false
otherwise.@NotNull public LList getTail()
LList
. The tail can be either
the empty logical list (= closed logical list) or an uninitialized
LList
(= open logical list).public int getSize()
0
for the empty or uninitialized list).getSize
in class LCollection
@Nullable public java.lang.Object get(int i) throws NotInitLObjectException
i
-th (starting from 0) element of this collection.i
- the index of the element.i
-th element of this collection.java.lang.IndexOutOfBoundsException
- if i
is less than zero or greater than the size of this collection.NotInitLObjectException
- if this collection is not initialized.@NotNull public Constraint eq(@NotNull LList lList)
this
is equal to lList
lList
- second parameter of the constraint.@NotNull public Constraint eq(@NotNull java.util.List<?> list)
this
is equal to list
list
- second parameter of the constraint. It must not contain null
values.java.lang.NullPointerException
- if list
contains null
values.@NotNull public Constraint neq(@NotNull LList lList)
this
is not equal to lList
.lList
- second parameter of the constraint.@NotNull public Constraint neq(@NotNull java.util.List<?> list)
this
is not equal to list
.list
- second parameter of the constraint. It must not contain null
values.java.lang.NullPointerException
- if list
contains null
values.