input
stringlengths 10
828
| output
stringlengths 5
107
|
---|---|
public llist without first equal object e collection remove object is similar but returns boolean the test car e car equals e allows null elements to be removed if is null return this else if car e car equals e return cdr else llist now cdr llist then now without first e if now then return this else return new cons car then | returns an llist that does not contain the first element if any |
public jpanel make logo panel image icon icon null try icon parameters have parameter logo image util get image icon logo image allow files urls etc util resource image icon logo image only class loader catch exception e debug display exception e return new logo panel symbol name logo line1 logo line2 icon | makes the logo panel for the applications main frame |
public object top level eval expr e return e eval in global env | evaluates the expression in the top level enviromnent |
public object top level apply object function object args if function instanceof function function fn function function fn check arity args length return fn apply to args else if function instanceof symbol object fval global env lookup symbol function if fval instanceof function function fn function fval fn check arity args length return fn apply to args throw new illegal argument exception function is not defined as a function | applies the function to the specified arguments |
public boolean is safe return accept only safe builtins | says whether the interpreter can safely be used in cases where |
public int hash object obj integer h integer object to hash get obj if h null h new integer hash to object size object to hash put obj h hash to object add obj return h int value | maps an object to an int that can be given to |
public object unhash int h return hash to object get h | the inverse of |
public string hash name object obj class c obj get class string class name xml name for class c return class name hash obj | returns a name of the form class name hash value |
public object parse hash name string name int h 1 if name starts with name ends with int i name last index of if i 0 string number name substring i 1 name length 1 try h integer value of number int value catch number format exception e if h 0 h hash to object size return unhash h else throw new illegal argument exception can t find an object ref in strings quote name | the inverse of |
public llist map nth final int n return mapcar new function1 public object funcall object list return llist list element at n | returns a list of the nth elements from a list of lists |
public boolean is true object value return interpreter this is true value | calls its interpreters is true method |
public int length return first free | returns the number of characters currently in the buffer |
public void append string s int len s length s get chars 0 len chars first free first free len | appends all the characters in a string |
public void append string s int begin index int end index s get chars begin index end index chars first free first free end index begin index | appends a substring |
public void append capitalized string s chars first free character to upper case s char at 0 int len s length if len 1 s get chars 1 len chars first free first free len 1 | appends the string with its first character converted to upper case |
public void append uncapitalized string s chars first free character to lower case s char at 0 int len s length if len 1 s get chars 1 len chars first free first free len 1 | appends the string with its first character converted to lower case |
public void append char c chars first free c | appends a single character |
public string to string return new string chars 0 first free | returns a string containing all the characters that have so far |
public boolean is safe return true | says whether the function can safely be used in cases where |
public object map element object elt return copy elt | called on subobjects of the object being copied to determine |
public void run try inner run catch throwable except debug note exception except handle exception except | calls inner run inside a catch that calls the |
protected void inner run if inner runnable null inner runnable run else nothing to do unless this method is redefined by a subclass | calls the run method of the inner runnable passed to the |
public map get possible values return get possible values get variables | returns a map variable set of possible values one entry |
public map get possible values set vars debug expect changed since recalc is true map result new tree map for iterator i vars iterator i has next variable v variable i next set values get possible values v result put v values return result | returns a map variable set of possible values one entry |
public map get variable bindings class variable class map bindings null create if needed for iterator i this entry set iterator i has next map entry e map entry i next object var e get key if variable class is instance var if bindings null bindings new hash map bindings put var e get value return bindings | returns a map containing any variable to value pairs specified |
public object eval in env env debug noteln evaluating xml object to xmlstring external form object result null try result eval in env if result null throw new consistency exception null result from this return result catch thrown result r result r get result throw r finally if result null try system out println backtrace this catch throwable t debug display exception exception in eval finally clause t | provides public access to this expressions semantics |
public list satisfy refinement preconditions activity act refinement r llist pattern act get pattern pattern put variables in pattern pattern just in case match env e matcher match r get pattern pattern if e null return null else list of constraint pre conds r get filter constraints if pre conds is empty return collections singleton list e list envs eval filters pre conds e debug noteln satisfy preconditions act r envs return envs | returns a list of |
public object get pattern return pattern | get pattern returns this match cases pattern |
public object if selected object data object match result return match result | if selected is called by the match table when try match returns |
public void add case match case c cases add element c | add case adds a new match case i after i those that were |
public refinement fill in refinement refinement r match env env fill in variable values in the refinement return r instantiate env | returns a copy of the refinement in which each |
public vector get cases return cases | get cases returns a vector of this tables match cases |
public void set default match case c default case c | set default assigns a match case as the tables default case |
public object match object data object result null int n cases size match case c try each case for int i 0 i n i c match case cases element at i result c try match data if result null return c if selected data result no match if default case null return null the default default else return default case if selected data null | match tries to find a match case in the match table that matches |
protected object match cases object data vector selected cases object result null int n selected cases size match case c try each case for int i 0 i n i c match case selected cases element at i result c try match data if result null return c if selected data result no match return null | a variant of match that can be used internally to match a subset |
protected object match default object data if default case null return null the default default else return default case if selected data null | applies the default case if there is one |
public void execute refinement effects refinement r match env env bind any variables that now have bindings map bindings env get variable bindings variable class if bindings null this bind variables bindings execute the effects from the refinement list effects r get effect constraints if effects is empty this add constraints effects | applies the tt world state effect tt s specified by the |
public class get described class return the class | returns the described class |
public void set infer element classes boolean v this infer element classes v | sets whether this class syntax is allowed to infer list and set |
public void add test test element test test add to menu frame | adds the specified test to the main frames test menu |
protected void add handlers list class names for iterator i class names iterator i has next string name i next to string item handler handler null make the handler try handler item handler make handler ip2 this name catch exception e debug display exception cannot make a handler of class name e continue install it debug expect handler null controller add handler handler | add one instance of each of the specified classes as a |
public string get upper name return upper name | returns an all upper case version of the external name |
public list get field descrs ensure fields return fields get fields | returns a list of |
protected void add initial names explicitly specify the mapping for primitive types because class for name string will not work add name byte byte type add name char character type add name short short type add name int integer type add name long long type add name float float type add name double double type add name boolean boolean type add name void void type | adds the initial set of name mappings |
protected void add initial imports standard imports add import java lang add import java util | adds the initial set of imports |
public string java name string external name external name strings replace external name return strings dash name to full java name external name | returns the java name that corresponds to an dash syntax name |
public void add name string name class c name to class put name c class to name put c name caches may no longer be valid used to do name to class cache clear class to name cache clear we could just call cache both ways here name to class cache remove name class to name cache remove c | adds an explicit mapping in both directions between a name |
public string java field name string external name return strings uncapitalize java name external name | returns the java name that corresponds to an external field name |
public string external name string java name return strings replace strings full java name to dash name java name | returns the dash syntax name that corresponds to a java name |
protected void cache both ways string name class c debug noteln cache both ways name c name to class cache put name c class to name cache put c name | caches the mapping from name to class and from class to name |
public string java name string external name return external name | returns the java name that corresponds to an external class name |
public string java field name string external name return java name external name | returns the java name that corresponds to an external field name |
public string external name string java name return java name | returns the external name that corresponds to a java class name |
public string external field name string java name return external name java name | returns the external name that corresponds to a java field name |
protected class find import class string name class result null import source null for iterator i imports iterator i has next import imp import i next class c imp try name name if c null if result null result c source imp else throw new runtime exception ambiguous name util quote name imported via both source and imp return result | tries to find a class by asking each import in turn |
public list relevant classes class c return relevant classes lisp list c | returns a recursively composed list of classes that are related |
public int add int incr int i get incr set i return i | increment by the indicated amount then return the new value |
public int incr before int i get 1 set i return i | increment then return the new value |
public int incr after int i get set i 1 return i | increment then return the old value |
public list relevant classes class top classes return relevant classes arrays as list top classes | returns a recursively composed list of classes that are related |
public class try name string name if star return try class for name prefix name else if prefix equals name return try class for name prefix in case name is fully qual else if prefix ends with name return try class for name prefix explicit import else return null | tries to find a class for the name |
public list relevant classes list top classes list relevant classes new linked list for iterator i top classes iterator i has next class c class i next collect relevant classes c relevant classes lisp nil relevant classes remove object class return relevant classes | returns a recursively composed list of classes that are related |
public list expand relevant classes list top classes debug noteln expanding relevant classes in top classes list collect new linked list for llist tail llist new llist top classes tail is empty tail tail cdr class c class tail car debug expect collect contains c collect relevant classes c collect tail cdr collect remove object class debug noteln expanded to collect return collect | returns a recursively composed list of classes that are related |
public void push e o set llcontents new cons o contents | add an object to the front of the list |
public e pop llist c contents if c lisp nil throw new index out of bounds exception llqueue pop when empty set llcontents c cdr return e c car | remove and return the first element of the list |
public void discard synchronized context class remove this from parent s children if parent null parent children remove this recursively discard discard subtree this | remove this context and all of its descendents from the |
public void set object o throw new unsupported operation exception cannot set using an llqueue list iterator | always throws an unsupported operation exception |
public void set context holder context holder h throw new unsupported operation exception can t set context holder | changes the context holder that would be returned if that |
public object copy object obj if obj null return null class c obj get class class descr cd syntax get class descr c return cd map object obj this | returns a copy of the object |
public object get value cond wait until true if except null return value else throw new rethrown exception except | returns the computed value once it is available |
public object map element object elt return elt | called on subobjects of the object being copied to determine |
public object map primitive object obj class descr cd return obj | copies a primitive object |
public object map struct object obj class descr cd object copy util make instance cd the class list fields cd get field descrs try for iterator fi fields iterator fi has next field descr fd field descr fi next object value map element fd get value obj if value null fd set value copy value return copy catch exception e debug note exception e throw new rethrown exception e can t copy struct because debug describe exception e | copies a structure calling |
public void clear completely map clear key chain new entry null null key chain last key chain | remove all entries in all contexts |
public object map xml literal document xml class descr cd return xml | copies embedded xml |
public object map list list obj class descr cd if llist class is instance obj return copy llist llist obj list copy list util make instance obj get class for iterator i obj iterator i has next copy add map element i next return copy | copies a list calling |
public llist copy llist llist obj this is tricky becuase the cons sub class might change as we go through the list if obj lisp nil return lisp nil cons copy cons typed cons obj get class null lisp nil cons ctail copy cons at cons obj for object elt map element at car ctail set car elt llist next at at cdr if next at lisp nil return copy cons cnext cons typed cons next at get class null lisp nil ctail set cdr cnext ctail cnext at cons next at | copies an llist that has a spine made of instances of any |
protected void breakup long total long t total negative t 0 if negative t t this ms int t 1000 t t 1000 this seconds int t 60 t t 60 this minutes int t 60 t t 60 this hours int t 24 t t 24 this days t debug expect hours 24 debug expect minutes 60 debug expect seconds 60 debug expect ms 1000 debug expect combine days hours minutes seconds ms math abs total | separate the total milliseconds into days hours minutes |
public object map set set obj class descr cd set copy set util make instance obj get class for iterator i obj iterator i has next copy add map element i next return copy | copies a set calling |
public object map map map obj class descr cd map copy map util make instance obj get class for iterator i obj entry set iterator i has next map entry entry map entry i next copy put map element entry get key map element entry get value return copy | copies a map calling |
public duration round long granularity long t milliseconds granularity long rem milliseconds granularity if rem granularity 2 t 1 milliseconds t granularity breakup milliseconds don t forget this return this | returns this duration after rounding the time to the nearest |
public duration round to seconds return round 1 1000 | equivalent to round 1000 |
public duration round to minutes return round 1 60 1000 | equivalent to round 60 1000 |
public int compare object a object b if a b return 0 try to find an appropriate comparison if a instanceof symbol b instanceof symbol return compare symbol a b else if a instanceof string b instanceof string return string a compare to string b else if a instanceof number b instanceof number return compare numbers number a number b else if a instanceof list b instanceof list return compare lists list a list b else if a instanceof comparable b instanceof comparable return compare comparable comparable a comparable b else return default compare a b | returns an int 0 0 or 0 depending on whether the |
public object put object key object value if value null value instanceof collection throw new illegal argument exception value must be a collection return super put key value | set the entire colletion of values associated with the key |
public long as milliseconds return milliseconds | return the total number of milliseconds represented by this |
public void walk object obj if obj null return class c obj get class class descr cd syntax get class descr c cd visit object obj this | visits the subobjects of an object |
public void visit element object elt walk elt | called on subobjects of the object being walked |
public void visit primitive object obj class descr cd | visits a primitive object |
public void visit struct object obj class descr cd list fields cd get field descrs for iterator fi fields iterator fi has next field descr fd field descr fi next object val try val fd get value obj catch exception e fd get value can throw too many things debug note exception e throw new rethrown exception e visit element val | walks a structure calling |
public void visit xml literal document xml class descr cd | walks embedded xml |
public void visit list list obj class descr cd for iterator i obj iterator i has next visit element i next | walks a list calling |
public void visit set set obj class descr cd for iterator i obj iterator i has next visit element i next | walks a set calling |
public void visit map map obj class descr cd for iterator i obj entry set iterator i has next map entry entry map entry i next visit element entry get key visit element entry get value | walks a map calling |
public string map long name string long name string s string long to short get long name if s null s generate short name long name set mapping long name s debug noteln short name for strings quote long name strings quote s return s | returns a suitable short name for a long name generating |
public string to string if milliseconds 0 return 0 seconds string buffer result new string buffer add value result days day add value result hours hour add value result minutes minute add value result seconds second add value result ms millisecond if negative result insert 0 negative must be after the above return result to string | returns an easy to read description of this duration |
public map get result map if result null compute result return result | return the result as a map |
public void describe class class c describe class c system out | prints a description of a class on code system |
public int hash code return int milliseconds milliseconds 32 | returns a hash value for this duration |
public void describe class class c print stream out class descr cd get class descr c list fields cd get field descrs out println cd to string out println java name cd the class get name out println external name cd get external name out println fields is empty no fields fields for iterator i fields iterator i has next field descr fd field descr i next out println fd get name fd get type descr out println getter fd getter out println setter fd setter | prints a description of a class on the designated print stream |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.