public class OtpErlangList extends OtpErlangObject implements java.lang.Iterable<OtpErlangObject>
The arity of the list is the number of elements it contains.
Modifier and Type | Class and Description |
---|---|
static class |
OtpErlangList.SubList |
Constructor and Description |
---|
OtpErlangList()
Create an empty list.
|
OtpErlangList(OtpErlangObject elem)
Create a list containing one element.
|
OtpErlangList(OtpErlangObject[] elems)
Create a list from an array of arbitrary Erlang terms.
|
OtpErlangList(OtpErlangObject[] elems,
int start,
int count)
Create a list from an array of arbitrary Erlang terms.
|
OtpErlangList(OtpErlangObject[] elems,
OtpErlangObject lastTail)
Create a list from an array of arbitrary Erlang terms.
|
OtpErlangList(OtpInputStream buf)
Create a list from a stream containing an list encoded in Erlang external
format.
|
OtpErlangList(java.lang.String str)
Create a list of Erlang integers representing Unicode codePoints.
|
Modifier and Type | Method and Description |
---|---|
int |
arity()
Get the arity of the list.
|
<T> OtpErlangObject |
bind(T binds)
Make new Erlang term replacing variables with the respective values from
bindings argument(s).
|
java.lang.Object |
clone() |
OtpErlangObject |
elementAt(int i)
Get the specified element from the list.
|
OtpErlangObject[] |
elements()
Get all the elements from the list as an array.
|
void |
encode(OtpOutputStream buf)
Convert this list to the equivalent Erlang external representation.
|
boolean |
equals(java.lang.Object o)
Determine if two lists are equal.
|
OtpErlangObject |
getHead() |
OtpErlangObject |
getLastTail() |
OtpErlangObject |
getNthTail(int n) |
OtpErlangObject |
getTail() |
boolean |
isProper() |
java.util.Iterator<OtpErlangObject> |
iterator() |
<T> boolean |
match(OtpErlangObject term,
T bindings)
Perform match operation against given term.
|
java.lang.String |
stringValue()
Convert a list of integers into a Unicode string, interpreting each
integer as a Unicode code point value.
|
java.lang.String |
toString()
Get the string representation of the list.
|
decode, hashCode
public OtpErlangList()
public OtpErlangList(OtpErlangObject elem)
elem
- the elememet to make the list from.public OtpErlangList(OtpErlangObject[] elems)
elems
- the array of terms from which to create the list.public OtpErlangList(OtpErlangObject[] elems, int start, int count)
elems
- the array of terms from which to create the list.start
- the offset of the first term to insert.count
- the number of terms to insert.public OtpErlangList(OtpErlangObject[] elems, OtpErlangObject lastTail) throws OtpErlangException
elems
- array of terms from which to create the listlastTail
- OtpErlangException
public OtpErlangList(OtpInputStream buf) throws OtpErlangDecodeException
buf
- the stream containing the encoded list.OtpErlangDecodeException
- if the buffer does not contain a valid external
representation of an Erlang list.public OtpErlangList(java.lang.String str)
str
- the characters from which to create the list.public int arity()
public <T> OtpErlangObject bind(T binds) throws OtpErlangException
OtpErlangObject
bind
in class OtpErlangObject
binds
- variable bindingsOtpErlangException
public java.lang.Object clone()
clone
in class OtpErlangObject
public OtpErlangObject elementAt(int i)
i
- the index of the requested element. List elements are numbered
as array elements, starting at 0.public OtpErlangObject[] elements()
public void encode(OtpOutputStream buf)
encode
in class OtpErlangObject
buf
- An output stream to which the encoded list should be written.public boolean equals(java.lang.Object o)
equals
in class OtpErlangObject
o
- the list to compare to.public OtpErlangObject getHead()
public OtpErlangObject getLastTail()
public OtpErlangObject getNthTail(int n)
public OtpErlangObject getTail()
public boolean isProper()
public java.util.Iterator<OtpErlangObject> iterator()
iterator
in interface java.lang.Iterable<OtpErlangObject>
public <T> boolean match(OtpErlangObject term, T bindings)
OtpErlangObject
match
in class OtpErlangObject
term
- the object to matchbindings
- variable bindingspublic java.lang.String stringValue() throws OtpErlangException
OtpErlangException
- for non-proper and non-integer lists.OtpErlangRangeException
- if any integer does not fit into a Java int.java.security.InvalidParameterException
- if any integer is not within the Unicode range.String.String(int[], int, int)
public java.lang.String toString()
toString
in class OtpErlangObject