public final class ESExpr
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static ESExpr |
cons(ESExpr lhs,
ESExpr rhs)
Create dotted pair for given S-expressions.
|
static ESExpr |
createAtom(java.lang.String literal)
Create atom for given string literal.
|
static ESExpr |
createList(java.util.List<ESExpr> items)
Create list of given S-expressions.
|
static ESExpr |
createTuple(java.util.List<ESExpr> items)
Create tuple of given S-expressions.
|
boolean |
equals(java.lang.Object o) |
java.util.List<ESExpr> |
getItems()
Returns list of S-expressions contained in this expression.
|
java.util.List<ESExpr> |
getListItems()
Returns list of S-expressions contained in this list excluding last
NIL. |
java.lang.String |
getLiteral()
Returns string literal for given expression.
|
boolean |
isAtom()
Returns
true if this expression is atom. |
boolean |
isList()
Returns
true if this expression is list. |
boolean |
isNil()
Returns
true if this expression is NIL atom. |
boolean |
isTuple()
Returns
true if this expression is tuple. |
ESExpr |
normalizePairs()
Returns deepest equivalent of this expression.
|
ESExpr |
normalizeTuples()
Returns shallowest equivalent of this expression.
|
java.lang.String |
toString() |
public static final ESExpr NIL
public boolean isAtom()
true if this expression is atom.true if this expression is atompublic boolean isNil()
true if this expression is NIL atom.true if this expression is NIL atompublic boolean isList()
true if this expression is list.
List expression is NIL atom or tuple containing NIL
at last position.true if this expression is listpublic boolean isTuple()
true if this expression is tuple.true if this expression is tuplepublic java.lang.String getLiteral()
toString()
instead.public java.util.List<ESExpr> getItems()
public java.util.List<ESExpr> getListItems()
NIL.NILjava.lang.UnsupportedOperationException - if this expression is not listpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic ESExpr normalizeTuples()
public ESExpr normalizePairs()
public static ESExpr createAtom(java.lang.String literal)
literal - string literal for atom being createdjava.lang.IllegalArgumentException - if literal is nullpublic static ESExpr createList(java.util.List<ESExpr> items)
NIL atom at the end
of list.items - list of S-expressionsitems listjava.lang.IllegalArgumentException - if items list is nullpublic static ESExpr createTuple(java.util.List<ESExpr> items)
items - list of S-expressionsitems listjava.lang.IllegalArgumentException - if items list is nullpublic static ESExpr cons(ESExpr lhs, ESExpr rhs)
lhs - left expression in dotted pairrhs - right expression in dotted pairlhs and rhs expressionsjava.lang.IllegalArgumentException - if any of given expressions is null