edu.isi.stella
Class List

java.lang.Object
  extended by edu.isi.stella.Stella_Object
      extended by edu.isi.stella.StandardObject
          extended by edu.isi.stella.AbstractCollection
              extended by edu.isi.stella.Collection
                  extended by edu.isi.stella.Sequence
                      extended by edu.isi.stella.List
Direct Known Subclasses:
ActiveList, ActiveSet, ClassExtension, Set

public class List
extends Sequence


Field Summary
 Cons theConsList
           
 
Constructor Summary
List()
           
 
Method Summary
static Stella_Object accessListSlotValue(List self, Symbol slotname, Stella_Object value, boolean setvalueP)
           
 Iterator allocateDestructiveListIterator()
           
 AbstractIterator allocateIterator()
           
 Iterator butLast()
          Generate all but the last element of the list self.
 void clear()
          Make self an empty list.
static void clOutputSystemClStructsFile(List classunits)
           
static Module computeFileUnitsModule(List fileunits)
           
 List concatenate(List list2, Cons otherlists)
          Copy list2 and all otherlists onto the end of list1.
 Cons consify()
          Return a list of elements in self.
 List copy()
          Return a copy of the list self.
static List cppSortUnitsForHeaderFile(List fileunits)
           
static List createDerivedList(List self)
          Create a new list object with the same type as self.
static boolean definedListP(List self)
          Return TRUE unless self is NULL or the NIL_LIST.
 List difference(List otherlist)
          Return the set difference of self and otherlist (i.e., all elements that are in self but not in otherSet).
static List ejectDemon(List demonlist, Demon demon)
           
 boolean emptyP()
          Return TRUE if the list self has no members.
 int equalHashCode()
          Return an equalP hash code for self.
 boolean equivalentSetsP(List otherlist)
          Return true if every element of self occurs in otherlist and vice versa.
static void extractStartupFunctionUnits(List startupunits, Symbol startupfnname)
           
 Stella_Object fifth()
          Return the fifth item in the list self, or NULL if empty.
 Stella_Object fifthSetter(Stella_Object value)
           
 Stella_Object first()
          Return the first item in the list self, or NULL if empty.
 Stella_Object firstSetter(Stella_Object value)
           
 Stella_Object fourth()
          Return the fourth item in the list self, or NULL if empty.
 Stella_Object fourthSetter(Stella_Object value)
           
static void helpPrintContextTree(List list, int level)
           
static List injectDemon(List demonlist, Demon demon)
           
 void insert(Stella_Object value)
          Add value to the front of the list self.
 void insertLast(Stella_Object value)
          Insert value as the last entry in the list self.
 void insertNew(Stella_Object value)
          Add value to the front of the list self unless its already a member.
 List intersection(List otherlist)
          Return the set intersection of self and otherlist.
 Stella_Object last()
          Return the last element of self.
 int lastPosition(Stella_Object renamed_Object, int end)
          Return the position of renamed_Object within the list self (counting from zero); or return NULL if renamed_Object does not occur within self (uses an eqlP test).
 int length()
           
static List list(Cons values)
          Return a list containing values, in order.
 List listify()
          Return self.
static List mapNullToNilList(List self)
          Return NIL-LIST iff self is NULL or self otherwise.
 boolean memberP(Stella_Object renamed_Object)
          Return TRUE iff renamed_Object is a member of the list self (uses an eqlP test).
 boolean membP(Stella_Object renamed_Object)
          Return TRUE iff renamed_Object is a member of the cons list self (uses an 'eq?' test).
static List newList()
           
 boolean nonEmptyP()
          Return TRUE if the list self has at least one member.
 Stella_Object nth(int position)
          Return the nth item in the list self, or NULL if empty.
 Stella_Object nthSetter(Stella_Object value, int position)
           
static boolean nullListP(List self)
          Return TRUE iff self is NULL or the NIL_LIST.
 boolean objectEqualP(Stella_Object y)
          Return TRUE iff the lists x and y are structurally equivalent.
 Stella_Object pop()
          Remove and return the first element in the list self.
 int position(Stella_Object renamed_Object, int start)
          Return the position of renamed_Object within the list self (counting from zero); or return NULL if renamed_Object does not occur within self (uses an eqlP test).
 List prepend(List list2)
          Copy list2 onto the front of the list self.
 Surrogate primaryType()
          Returns the primary type of self.
 void printObject(java.io.PrintStream stream)
           
 void push(Stella_Object value)
          Add value to the front of the list self.
 AbstractCollection remove(Stella_Object value)
          Destructively remove all entries in self that match value.
 List removeDeletedMembers()
           
 Collection removeDuplicates()
          Destructively remove duplicates from self and return the result.
 List removeDuplicatesEqual()
          removeDuplicates (which see) using an equalP test.
 List removeIf(java.lang.reflect.Method testP)
          Destructively remove all members of the list self for which 'test?' evaluates to TRUE.
 Cons rest()
          Return a cons list of all but the first item in the list self.
 List reverse()
          Reverse the members of self (in place).
 Stella_Object second()
          Return the second item in the list self, or NULL if empty.
 Stella_Object secondSetter(Stella_Object value)
           
 List sort(java.lang.reflect.Method predicate)
          Perform a stable, destructive sort of self according to predicate, and return the result.
static List sortClStructClasses(List unsortedclasses)
           
 boolean subsetP(List otherlist)
          Return true if every element of self also occurs in otherlist.
 List substitute(Stella_Object invalue, Stella_Object outvalue)
          Destructively replace each appearance of outvalue by invalue in the list self.
 List subtract(List otherlist)
          Return the set difference of self and otherlist by destructively removing elements from self that also occur in otherlist.
static boolean terminateListP(List self)
           
 Stella_Object third()
          Return the third item in the list self, or NULL if empty.
 Stella_Object thirdSetter(Stella_Object value)
           
 List union(List otherlist)
          Return the set union of self and otherlist.
 
Methods inherited from class edu.isi.stella.Sequence
orderedP, sequence, yieldConsListFromSequence
 
Methods inherited from class edu.isi.stella.Collection
noDuplicatesP
 
Methods inherited from class edu.isi.stella.StandardObject
arrayTypeSpecifierP, baseTypeToTypeSpec, cantOverwriteActiveCollectionSlot, compatibleParameterTypesP, computeAnchoredTypeSpec, computeRelativeTypeSpec, conformingTypeSpecP, copyWrappedLiteral, cppNonPointerTypeP, cppReferenceTypeP, cppReferencizeType, cppTranslateAndPointerizeTypeSpec, cppTranslateAndReferencizeTypeSpec, cppTranslateTypeSpec, cppTypeWithoutInteriorPointersP, dropSlotValue, extractParameterType, extractRequiredArgumentValues, getSlot, hashCode_, idlTranslateTypeSpec, inverseSlotDemon, javaLiteralP, javaNativeLiteralWrapperNames, javaSpecialSetterName, javaTranslateArrayOfTypeSpec, javaTranslateTypeSpec, javaTranslateTypeSpecForFunction, javaTranslateTypeSpecHelper, javaYieldClassObjectArrayExpression, javaYieldClassObjectExpression, javaYieldFullyQualifiedTypeName, javaYieldTranslatedClassAndMethodNames, listifyTypeSpec, lookupClTypeFromStellaType, objectEqlP, putSlotValue, readSlotValue, runConstructorDemons, runDestructorDemons, runSlotDemons, runSlotGuardDemonsP, standardObjectP, subTypeSpecOfP, twoArgumentLeastCommonSupertype, typeSpecToBaseType, typeSpecToClass, typeToWalkedNullValueTree, validateTypeSpecifier, voidP, walkTypeSpecIsNativeTypeP, writeSlotValue, yieldTypeSpecTree
 
Methods inherited from class edu.isi.stella.Stella_Object
_, accessInContext, addPropertyValue, amPm, anchoredTypeSpecifierP, andOrNotTreeP, applyCoercionMethod, atomicExpressionP, bindToSurrogateP, booleanP, bootstrapIsaP, bquotify, cast, characterP, chooseSortPredicate, clConditionalizeTypeDeclarationTree, clTranslateAtomicTree, clTranslateATree, clTranslateBooleanTest, clTranslatePlainBooleanTest, clTranslateVerbatimBodySymbols, clYieldTypedExpressionTree, coerceATree, coerceEvaluatedTree, coerceMvTree, coerceOptionValue, coerceToBoolean, coerceToFloat, coerceToHashSet, coerceToModule, coerceToModuleName, coerceToString, coerceToSymbol, coerceToXmlElement, coerceValueToBoolean, coerceValueToFloat, coerceValueToString, coerceValueToType, coercibleP, collectFeatureList, collectKeyValueList, commonLispSymbolP, computeExpressionType, consifyListsAndIterators, consP, consTreeMatchP, convertToLiteral, copyConsTree, cppArgumentIsStreamP, cppBinaryOperatorP, cppBlockP, cppMaybeOutputStatementWithParentheses, cppOperatorP, cppOutputAtomicExpression, cppOutputLiteral, cppOutputOneActualParameter, cppOutputStatement, cppOutputTypedEntity, cppPrognifyStatement, cppPrognP, cppStatementToList, cppStreamIsStandardOutputP, cpptrans, cppTranslateAtomicTree, cppTranslateATree, cppTranslatedArrayTypeP, csValueP, dateDivider, dateTimeDivider, day, dealWithAmPm, dealWithEra, dealWithNoonMidn, decrementReferenceCount, defaultOptionHandler, defineSystem, defmodule, deletedP, describe, describeObject, describeTersely, destructureMethodNameTree, deUglifyParseTree, either, eqlP, eqlToBooleanP, eqlToCharacterP, eqlToFloatP, eqlToIntegerP, eqlToLongIntegerP, eqlToStringP, equalConsTreesP, equalP, era, estimatedEvaluationCost, evaluate, evaluateArgumentTree, evaluateAtomicTree, evaluateCommand, expandBquoteTree, filterModuleP, floatP, free, get, getObject, getProperty, hashlist, hashMemoizedArguments, helpBquotify, helpClTranslateATree, helpCoerceATree, helpLptrans, helpPrintOutline, helpTransformBooleanProceduralExpression, helpWalkATree, homeModule, hour, idlOutputAtomicExpression, idlOutputLiteral, idlOutputStatement, idlTranslateAtomicTree, idlTranslateATree, illegalTreeP, implodePathname, incrementallyTranslate, incrementReferenceCount, inlineUnwrapBoolean, inlineWrapBoolean, inModule, integerP, isaP, javaBinaryOperatorP, javaBlockP, javaEndOfLineTokenP, javaHelpOutputPrintStream, javaMaybeOutputStatementWithParentheses, javaOperatorP, javaOutputLiteral, javaOutputStatement, javaPrognP, javaStreamIsStandardOutputP, javaSymbolCaseP, javaTranslateAtomicTree, javaTranslateATree, javaTranslateWithNativeWrapper, jptrans, keywordP, legalTokenizerFromStateP, legalTokenizerStateP, legalTokenizerToStateP, literalEqlP, logLevelLE, longIntegerP, lptrans, makeEvaluatableBquoteTree, makeFileNameFromRelativePath, makeMemoizedValueEntry, makeMemoizedValueEntryn, matchConsTree, methodSlotP, minute, month, nameToString, nilP, noonMidn, numberWrapperToFloat, objectHashCode, one, oneI, onlyIf, parametricTypeSpecifierP, parseArrayDimensionsSpec, parseOptions, parseTokenizerCharacterSpec, parseTokenizerStateModifiers, permanentCopy, permanentify, permanentifyForm, po, prettyPrintLiteral, primaryClass, printOutline, printStellaCode, printStellaDefinition, printUndefinedSuperClasses, proceduralExpressionP, ptrans, publicSlots, registerRecycledItem, runOptionHandlerP, safeEqualHashCode, safeHashCode, safePrimaryType, safeYieldTypeSpecifier, searchConsTreeP, searchConsTreeWithFilterP, searchForObject, secondp, setProperty, sideEffectFreeExpressionP, simplifyBquoteTree, specialp, stella_Increment, stellaClassP, stellaCollectionP, stellaNeedToCompileP, stellaNeedToTranslateP, stellaObjectP, stellify, storageSlotP, stringifyInModule, stringP, substituteConsTree, substituteOnce, surrogateP, surrogatify, sweep, symbolCaseP, symbolP, sysTree, targetLanguageType, taxonomyIsaP, timeDivider, timeMultiply, tokenizerIncludeSpecP, tokenizerToStateAlias, tokenizerToStateName, toString, traceIf, traceKeywordP, transientifyForm, transientObjectP, transientSymbolP, translateWalkedTree, treeSize, treeToTrees, trueOptionP, tryToEvaluate, typeP, typify, unmake, unregisterRecycledItem, updateInContext, valuesTreeP, variableExpressionP, verbatimStringP, verbatimTreeP, vetOptions, vrletExpressionP, walkAtomicTree, walkATree, walkCollectionTree, walkDontCallMeTree, walkedExpressionExpression, walkedExpressionType, walkExpressionTree, walkMvExpressionTree, walkMvTree, walkStatement, walkTopLevelExpression, walkWithoutTypeTree, warnAboutUnknownSourceType, weekday, withinContext, withinModule, withinWorld, withStellaTokenizer, withSystemDefinition, withTokenizer, wrapperP, wrapWhereTest, xmlAttributeP, xmlBaseAttributeP, xmlCdataFormP, xmlCdataP, xmlDeclarationFormP, xmlDeclarationP, xmlDoctypeFormP, xmlElementFormP, xmlElementP, xmlGlobalAttributeP, xmlLocalAttributeP, xmlnsAttributeP, xmlProcessingInstructionFormP, xmlProcessingInstructionP, xmlTagCase, year, yieldCondTest, yieldCondTestOrTests, yieldHardcodedCaseSymbolIdOrIds, yieldInCursorClausesForArgumentList, yieldInCursorClausesForGeneralCollection, yieldInCursorClausesForVector, yieldTypeSpecifier, zone, zoneMinute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

theConsList

public Cons theConsList
Constructor Detail

List

public List()
Method Detail

list

public static List list(Cons values)
Return a list containing values, in order.

Parameters:
values -
Returns:
List

newList

public static List newList()

cppSortUnitsForHeaderFile

public static List cppSortUnitsForHeaderFile(List fileunits)

computeFileUnitsModule

public static Module computeFileUnitsModule(List fileunits)

ejectDemon

public static List ejectDemon(List demonlist,
                              Demon demon)

injectDemon

public static List injectDemon(List demonlist,
                               Demon demon)

helpPrintContextTree

public static void helpPrintContextTree(List list,
                                        int level)

clOutputSystemClStructsFile

public static void clOutputSystemClStructsFile(List classunits)

sortClStructClasses

public static List sortClStructClasses(List unsortedclasses)

extractStartupFunctionUnits

public static void extractStartupFunctionUnits(List startupunits,
                                               Symbol startupfnname)

allocateDestructiveListIterator

public Iterator allocateDestructiveListIterator()

listify

public List listify()
Return self.

Returns:
List

subtract

public List subtract(List otherlist)
Return the set difference of self and otherlist by destructively removing elements from self that also occur in otherlist. Uses an eqlP test and a simple quadratic-time algorithm. Note that the result is only guaranteed to be a set if self is a set.

Parameters:
otherlist -
Returns:
List

difference

public List difference(List otherlist)
Return the set difference of self and otherlist (i.e., all elements that are in self but not in otherSet). Uses an eqlP test and a simple quadratic-time algorithm. Note that the result is only guaranteed to be a set if both self and otherlist are sets.

Parameters:
otherlist -
Returns:
List

union

public List union(List otherlist)
Return the set union of self and otherlist. Uses an eqlP test and a simple quadratic-time algorithm. Note that the result is only guaranteed to be a set if both self and otherlist are sets.

Parameters:
otherlist -
Returns:
List

intersection

public List intersection(List otherlist)
Return the set intersection of self and otherlist. Uses an eqlP test and a simple quadratic-time algorithm. Note that the result is only guaranteed to be a set if both self and otherlist are sets.

Parameters:
otherlist -
Returns:
List

equivalentSetsP

public boolean equivalentSetsP(List otherlist)
Return true if every element of self occurs in otherlist and vice versa. Uses an eqlP test and a simple quadratic-time algorithm. Note that this does not check whether self and otherlist actually are sets.

Parameters:
otherlist -
Returns:
boolean

subsetP

public boolean subsetP(List otherlist)
Return true if every element of self also occurs in otherlist. Uses an eqlP test and a simple quadratic-time algorithm. Note that this does not check whether self and otherlist actually are sets.

Parameters:
otherlist -
Returns:
boolean

removeDeletedMembers

public List removeDeletedMembers()

butLast

public Iterator butLast()
Generate all but the last element of the list self.

Returns:
Iterator

allocateIterator

public AbstractIterator allocateIterator()
Overrides:
allocateIterator in class Sequence

equalHashCode

public int equalHashCode()
Return an equalP hash code for self. Note that this is O(N) in the number of elements of self.

Overrides:
equalHashCode in class Stella_Object
Returns:
int

objectEqualP

public boolean objectEqualP(Stella_Object y)
Return TRUE iff the lists x and y are structurally equivalent. Uses equalP to test equality of elements.

Overrides:
objectEqualP in class Stella_Object
Parameters:
y -
Returns:
boolean

mapNullToNilList

public static List mapNullToNilList(List self)
Return NIL-LIST iff self is NULL or self otherwise.

Parameters:
self -
Returns:
List

sort

public List sort(java.lang.reflect.Method predicate)
Perform a stable, destructive sort of self according to predicate, and return the result. If predicate has a '<' semantics, the result will be in ascending order. If predicate is NULL, a suitable '<' predicate is chosen depending on the first element of self, and it is assumed that all elements of self have the same type (supported element types are GENERALIZED-SYMBOL, STRING, INTEGER, and FLOAT).

Parameters:
predicate -
Returns:
List

clear

public void clear()
Make self an empty list.


copy

public List copy()
Return a copy of the list self. The conses in the copy are freshly allocated.

Returns:
List

createDerivedList

public static List createDerivedList(List self)
Create a new list object with the same type as self.

Parameters:
self -
Returns:
List

prepend

public List prepend(List list2)
Copy list2 onto the front of the list self. The operation is destructive wrt self, but leaves list2 intact.

Parameters:
list2 -
Returns:
List

concatenate

public List concatenate(List list2,
                        Cons otherlists)
Copy list2 and all otherlists onto the end of list1. The operation is destructive wrt list1, but leaves all other lists intact. The two mandatory parameters allow us to optimize the common binary case by not relying on the somewhat less efficient variable arguments mechanism.

Parameters:
list2 -
otherlists -
Returns:
List

substitute

public List substitute(Stella_Object invalue,
                       Stella_Object outvalue)
Destructively replace each appearance of outvalue by invalue in the list self.

Parameters:
invalue -
outvalue -
Returns:
List

reverse

public List reverse()
Reverse the members of self (in place).

Returns:
List

pop

public Stella_Object pop()
Remove and return the first element in the list self. Return NULL if the list is empty.

Returns:
Stella_Object

removeDuplicatesEqual

public List removeDuplicatesEqual()
removeDuplicates (which see) using an equalP test.

Returns:
List

removeDuplicates

public Collection removeDuplicates()
Destructively remove duplicates from self and return the result. Preserves the original order of the remaining members.

Returns:
Collection

removeIf

public List removeIf(java.lang.reflect.Method testP)
Destructively remove all members of the list self for which 'test?' evaluates to TRUE. test takes a single argument of type OBJECT and returns TRUE or FALSE. Returns self.

Parameters:
testP -
Returns:
List

remove

public AbstractCollection remove(Stella_Object value)
Destructively remove all entries in self that match value.

Overrides:
remove in class Collection
Parameters:
value -
Returns:
AbstractCollection

insertLast

public void insertLast(Stella_Object value)
Insert value as the last entry in the list self.

Parameters:
value -

insertNew

public void insertNew(Stella_Object value)
Add value to the front of the list self unless its already a member.

Parameters:
value -

push

public void push(Stella_Object value)
Add value to the front of the list self.

Parameters:
value -

insert

public void insert(Stella_Object value)
Add value to the front of the list self.

Overrides:
insert in class Collection
Parameters:
value -

lastPosition

public int lastPosition(Stella_Object renamed_Object,
                        int end)
Return the position of renamed_Object within the list self (counting from zero); or return NULL if renamed_Object does not occur within self (uses an eqlP test). If end was supplied as non-NULL, only consider the sublist ending at end, however, the returned position will always be relative to the entire list.

Parameters:
renamed_Object -
end -
Returns:
int

position

public int position(Stella_Object renamed_Object,
                    int start)
Return the position of renamed_Object within the list self (counting from zero); or return NULL if renamed_Object does not occur within self (uses an eqlP test). If start was supplied as non-NULL, only consider the sublist starting at start, however, the returned position will always be relative to the entire list.

Parameters:
renamed_Object -
start -
Returns:
int

length

public int length()
Overrides:
length in class Sequence

nthSetter

public Stella_Object nthSetter(Stella_Object value,
                               int position)

fifthSetter

public Stella_Object fifthSetter(Stella_Object value)

fourthSetter

public Stella_Object fourthSetter(Stella_Object value)

thirdSetter

public Stella_Object thirdSetter(Stella_Object value)

secondSetter

public Stella_Object secondSetter(Stella_Object value)

firstSetter

public Stella_Object firstSetter(Stella_Object value)

rest

public Cons rest()
Return a cons list of all but the first item in the list self.

Returns:
Cons

last

public Stella_Object last()
Return the last element of self.

Returns:
Stella_Object

nth

public Stella_Object nth(int position)
Return the nth item in the list self, or NULL if empty.

Parameters:
position -
Returns:
Stella_Object

fifth

public Stella_Object fifth()
Return the fifth item in the list self, or NULL if empty.

Returns:
Stella_Object

fourth

public Stella_Object fourth()
Return the fourth item in the list self, or NULL if empty.

Returns:
Stella_Object

third

public Stella_Object third()
Return the third item in the list self, or NULL if empty.

Returns:
Stella_Object

second

public Stella_Object second()
Return the second item in the list self, or NULL if empty.

Returns:
Stella_Object

first

public Stella_Object first()
Return the first item in the list self, or NULL if empty.

Returns:
Stella_Object

membP

public boolean membP(Stella_Object renamed_Object)
Return TRUE iff renamed_Object is a member of the cons list self (uses an 'eq?' test).

Parameters:
renamed_Object -
Returns:
boolean

memberP

public boolean memberP(Stella_Object renamed_Object)
Return TRUE iff renamed_Object is a member of the list self (uses an eqlP test).

Overrides:
memberP in class Sequence
Parameters:
renamed_Object -
Returns:
boolean

terminateListP

public static boolean terminateListP(List self)

nonEmptyP

public boolean nonEmptyP()
Return TRUE if the list self has at least one member.

Returns:
boolean

emptyP

public boolean emptyP()
Return TRUE if the list self has no members.

Returns:
boolean

nullListP

public static boolean nullListP(List self)
Return TRUE iff self is NULL or the NIL_LIST.

Parameters:
self -
Returns:
boolean

definedListP

public static boolean definedListP(List self)
Return TRUE unless self is NULL or the NIL_LIST.

Parameters:
self -
Returns:
boolean

consify

public Cons consify()
Return a list of elements in self.

Overrides:
consify in class Stella_Object
Returns:
Cons

printObject

public void printObject(java.io.PrintStream stream)
Overrides:
printObject in class Stella_Object

accessListSlotValue

public static Stella_Object accessListSlotValue(List self,
                                                Symbol slotname,
                                                Stella_Object value,
                                                boolean setvalueP)

primaryType

public Surrogate primaryType()
Description copied from class: Stella_Object
Returns the primary type of self. Gets defined automatically for every non-abstract subclass of OBJECT.

Overrides:
primaryType in class Stella_Object
Returns:
Surrogate