org.hecl
Class ListThing
- java.lang.Object
-
- org.hecl.ListThing
-
-
Constructor Summary
Constructors Constructor and Description ListThing()Creates a new, emptyListThinginstance.ListThing(java.lang.String s)Attempts to create a newListThinginstance from a string.ListThing(java.util.Vector v)Creates a newListThinginstance from a vector.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static java.lang.StringBufferappendListItem(java.lang.StringBuffer buf, Thing thing)static ThingbuildCmdList(Thing cmd, Thing[] args)ThebuildCmdListmethod takes a Thing, treats it as a list, and adds arguments to it from the args array.static Thingcreate(java.util.Vector v)createallocates and returns a new ListThing typed Thing.RealThingdeepcopy()deepcopycopies a list and all of its elements.static java.util.Vectorget(Thing thing)getattempts to transform the given Thing into a List, and return its Vector value.static Thing[]getArray(Thing thing)getArrayattempts to transform the given Thing into a List, and return it as an array of Things.java.lang.StringgetStringRep()getStringRepreturns a string representation of a ListThing.static ThingstringSplit(java.lang.String str, java.lang.String splitstr)ThestringSplitmethod takes a string and splits it according to another string,java.lang.Stringthingclass()static java.lang.StringtoListString(Thing thing)toListStringtransforms list elements into the string form {foo bar} if the element contains a space.
-
-
-
Constructor Detail
-
ListThing
public ListThing()
Creates a new, emptyListThinginstance.
-
ListThing
public ListThing(java.util.Vector v)
Creates a newListThinginstance from a vector.- Parameters:
v- aVectorvalue
-
ListThing
public ListThing(java.lang.String s) throws HeclExceptionAttempts to create a newListThinginstance from a string. May fail if the string can't be parsed into a list.- Parameters:
s- aStringvalue- Throws:
HeclException- if an error occurs
-
-
Method Detail
-
create
public static Thing create(java.util.Vector v)
createallocates and returns a new ListThing typed Thing.- Parameters:
v- aVectorvalue. Note that the Vector must contain Things, rather than, say, int's or Strings or something else!- Returns:
- a
Thingvalue
-
thingclass
public java.lang.String thingclass()
- Specified by:
thingclassin interfaceRealThing
-
get
public static java.util.Vector get(Thing thing) throws HeclException
getattempts to transform the given Thing into a List, and return its Vector value.- Parameters:
thing- aThingvalue- Returns:
- a
Vectorvalue - Throws:
HeclException- if an error occurs
-
getArray
public static Thing[] getArray(Thing thing) throws HeclException
getArrayattempts to transform the given Thing into a List, and return it as an array of Things.- Parameters:
thing- aThingvalue- Returns:
- a
Thing[]value - Throws:
HeclException- if an error occurs
-
deepcopy
public RealThing deepcopy() throws HeclException
deepcopycopies a list and all of its elements.- Specified by:
deepcopyin interfaceRealThing- Returns:
- a
RealThingvalue - Throws:
HeclException
-
toListString
public static java.lang.String toListString(Thing thing)
toListStringtransforms list elements into the string form {foo bar} if the element contains a space.- Parameters:
thing- aThingvalue- Returns:
- a
Stringvalue
-
appendListItem
public static java.lang.StringBuffer appendListItem(java.lang.StringBuffer buf, Thing thing)
-
getStringRep
public java.lang.String getStringRep()
getStringRepreturns a string representation of a ListThing.- Specified by:
getStringRepin interfaceRealThing- Returns:
- a
Stringvalue
-
stringSplit
public static Thing stringSplit(java.lang.String str, java.lang.String splitstr)
ThestringSplitmethod takes a string and splits it according to another string,- Parameters:
str- aStringvaluesplitstr- aStringvalue- Returns:
- a
Thingvalue
-
buildCmdList
public static Thing buildCmdList(Thing cmd, Thing[] args) throws HeclException
ThebuildCmdListmethod 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.- Parameters:
cmd- aThingvalueargs- an array ofThingvalues- Returns:
- a
Thingvalue - Throws:
HeclException- if an error occurs
-
-
DataMelt 3.0 © DataMelt by jWork.ORG