|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hecl.ListThing
public class ListThing
The ListThing
class implements lists, storing them internally
as a Vector.
Field Summary | |
---|---|
protected java.util.Vector |
val
|
Constructor Summary | |
---|---|
ListThing()
Creates a new, empty ListThing instance. |
|
ListThing(java.lang.String s)
Attempts to create a new ListThing instance from a string. |
|
ListThing(java.util.Vector v)
Creates a new ListThing instance from a vector. |
Method Summary | |
---|---|
static java.lang.StringBuffer |
appendListItem(java.lang.StringBuffer buf,
Thing thing)
|
static Thing |
buildCmdList(Thing cmd,
Thing[] args)
The buildCmdList method takes a Thing, treats it as a
list, and adds arguments to it from the args array. |
static Thing |
create(java.util.Vector v)
create allocates and returns a new ListThing typed Thing. |
RealThing |
deepcopy()
deepcopy copies a list and all of its elements. |
static java.util.Vector |
get(Thing thing)
get attempts to transform the given Thing into a List, and
return its Vector value. |
static Thing[] |
getArray(Thing thing)
getArray attempts to transform the given Thing
into a List, and return it as an array of Things. |
java.lang.String |
getStringRep()
getStringRep returns a string representation of a
ListThing. |
static Thing |
stringSplit(java.lang.String str,
java.lang.String splitstr)
The stringSplit method takes a string and splits
it according to another string, |
java.lang.String |
thingclass()
|
static java.lang.String |
toListString(Thing thing)
toListString transforms list elements into the
string form {foo bar} if the element contains a space. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Vector val
Constructor Detail |
---|
public ListThing()
ListThing
instance.
public ListThing(java.util.Vector v)
ListThing
instance from a vector.
v
- a Vector
valuepublic ListThing(java.lang.String s) throws HeclException
ListThing
instance from a string.
May fail if the string can't be parsed into a list.
s
- a String
value
HeclException
- if an error occursMethod Detail |
---|
public static Thing create(java.util.Vector v)
create
allocates and returns a new ListThing typed Thing.
v
- a Vector
value. Note that the Vector
must contain Things, rather than, say, int's or Strings or
something else!
Thing
valuepublic java.lang.String thingclass()
thingclass
in interface RealThing
public static java.util.Vector get(Thing thing) throws HeclException
get
attempts to transform the given Thing into a List, and
return its Vector value.
thing
- a Thing
value
Vector
value
HeclException
- if an error occurspublic static Thing[] getArray(Thing thing) throws HeclException
getArray
attempts to transform the given Thing
into a List, and return it as an array of Things.
thing
- a Thing
value
Thing[]
value
HeclException
- if an error occurspublic RealThing deepcopy() throws HeclException
deepcopy
copies a list and all of its elements.
deepcopy
in interface RealThing
RealThing
value
HeclException
public static java.lang.String toListString(Thing thing)
toListString
transforms list elements into the
string form {foo bar} if the element contains a space.
thing
- a Thing
value
String
valuepublic static java.lang.StringBuffer appendListItem(java.lang.StringBuffer buf, Thing thing)
public java.lang.String getStringRep()
getStringRep
returns a string representation of a
ListThing.
getStringRep
in interface RealThing
String
valuepublic static Thing stringSplit(java.lang.String str, java.lang.String splitstr)
stringSplit
method takes a string and splits
it according to another string,
str
- a String
valuesplitstr
- a String
value
Thing
valuepublic static Thing buildCmdList(Thing cmd, Thing[] args) throws HeclException
buildCmdList
method takes a Thing, treats it as a
list, and adds arguments to it from the args array. The whole
thing is returned and is ready to be executed by interp.eval().
This is a convenience function utilized in various callbacks
throughout the code.
cmd
- a Thing
valueargs
- an array of Thing
values
Thing
value
HeclException
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |