edu.isi.stella
Class KeyValueList

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.AbstractDictionary
                  extended by edu.isi.stella.Dictionary
                      extended by edu.isi.stella.KeyValueList
Direct Known Subclasses:
CsValue, HookList, KeywordKeyValueList

public class KeyValueList
extends Dictionary


Field Summary
 KvCons theKvList
           
 
Constructor Summary
KeyValueList()
           
 
Method Summary
static Stella_Object accessKeyValueListSlotValue(KeyValueList self, Symbol slotname, Stella_Object value, boolean setvalueP)
           
 AbstractIterator allocateIterator()
           
 void clear()
          Make self an empty dictionary.
static void clTranslateWalkedSystemUnits(KeyValueList systemunits)
           
static List concatenateSystemUnits(KeyValueList systemunits)
           
 Cons consify()
          Return a list of key-value pairs in self.
 KeyValueList copy()
          Return a copy of the kv-list self.
static void cppTranslateWalkedSystemUnits(KeyValueList systemunits)
           
static Stella_Object dynamicSlotValue(KeyValueList dynamicslots, Symbol slotname, Stella_Object nullvalue)
           
 boolean emptyP()
           
 int equalHashCode()
          Return an equalP hash code for self.
static void fillInDateSubstitution(KeyValueList substitutionList)
          Fill in substitutionList with template variable substitions for the names YEAR and DATE which correspond to the current year and date.
 void insertAt(Stella_Object key, Stella_Object value)
          Insert the entry <key, value> into the association self.
static void insertAtVariableTable(KeyValueList self, Symbol variable, Stella_Object value)
           
 void insertEntry(Stella_Object key, Stella_Object value)
          Insert an entry <key,value> to self unless an identical entry already exists.
static void javaTranslateWalkedSystemUnits(KeyValueList systemunits)
           
static PropertyList kvlistToPlist(KeyValueList self)
          Convert self into a property list with identical and identically ordered keys and values.
 void kvPush(Stella_Object key, Stella_Object value)
          Add a new entry <key, value> to the front of the association self.
 int length()
           
 List listify()
          Return a list of key-value pairs in self.
static KeyValueList loadConfigurationFile(java.lang.String file)
          Read a configuration file and return its content as a configuration table.
 Stella_Object lookup(Stella_Object key)
           
static Stella_Object lookupVariableTable(KeyValueList self, Symbol variable)
           
 Stella_Object lookupWithDefault(Stella_Object key, Stella_Object renamed_Default)
          Lookup key in self and return the result.
static KeyValueList newKeyValueList()
           
 boolean nonEmptyP()
           
 boolean objectEqualP(Stella_Object y)
          Return TRUE if x and y represent the same set of key/value pairs.
 Stella_Object pop()
          Remove and return the value of the first element of the kv-list self.
 Surrogate primaryType()
          Returns the primary type of self.
static void printKeyValueList(KeyValueList self, java.io.PrintStream stream)
           
 void printObject(java.io.PrintStream stream)
           
 void push(KvCons value)
          Make value be the new first element of self.
 Stella_Object removeAt(Stella_Object key)
          Remove the entry that matches the key key.
 void removeEntry(Stella_Object key, Stella_Object value)
          Remove the entry that matches <key,value>.
 KeyValueList reverse()
          Destructively reverse the members of the list self.
static void saveConfigurationFile(KeyValueList table, java.lang.String file, java.lang.String title)
          Save table as a configuration file.
static Stella_Object setDynamicSlotValue(KeyValueList dynamicslots, Symbol slotname, Stella_Object value, Wrapper nullwrapper)
           
 
Methods inherited from class edu.isi.stella.StandardObject
arrayTypeSpecifierP, baseTypeToTypeSpec, cantOverwriteActiveCollectionSlot, compatibleParameterTypesP, computeAnchoredTypeSpec, computeRelativeTypeSpec, conformingTypeSpecP, copyWrappedLiteral, cppReferenceTypeP, cppReferencizeType, cppTranslateAndPointerizeTypeSpec, cppTranslateAndReferencizeTypeSpec, cppTranslateTypeSpec, 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, amPm, anchoredTypeSpecifierP, andOrNotTreeP, applyCoercionMethod, atomicExpressionP, bindToSurrogateP, booleanP, bootstrapIsaP, bquotify, cast, characterP, clTranslateAtomicTree, clTranslateATree, clTranslateBooleanTest, clTranslatePlainBooleanTest, clTranslateVerbatimBodySymbols, clYieldTypedExpressionTree, coerceATree, coerceEvaluatedTree, coerceMvTree, coerceToBoolean, coerceToModule, coerceToModuleName, coerceToSymbol, coerceToXmlElement, coercibleP, collectFeatureList, collectKeyValueList, commonLispSymbolP, computeExpressionType, cons, 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, eqlToStringP, equalConsTreesP, equalP, era, estimatedEvaluationCost, evaluate, evaluateArgumentTree, evaluateAtomicTree, evaluateCommand, expandBquoteTree, filterModuleP, floatP, free, get, getObject, 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, kvCons, legalTokenizerFromStateP, legalTokenizerStateP, legalTokenizerToStateP, literalEqlP, logLevelLE, lptrans, makeFileNameFromRelativePath, makeMemoizedValueEntry, makeMemoizedValueEntryn, matchConsTree, methodSlotP, minute, month, nameToString, nilP, noonMidn, numberWrapperToFloat, objectHashCode, one, oneI, onlyIf, parametricTypeSpecifierP, parseArrayDimensionsSpec, 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, 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, walkedExpressionType, walkExpressionTree, walkMvExpressionTree, walkMvTree, walkStatement, walkTopLevelExpression, walkWithoutTypeTree, warnAboutUnknownSourceType, weekday, withinContext, withinModule, withinWorld, withStellaTokenizer, withSystemDefinition, withTokenizer, wrapperP, wrapWhereTest, xmlAttributeP, xmlCdataFormP, xmlCdataP, xmlDeclarationFormP, xmlDeclarationP, xmlDoctypeFormP, xmlElementFormP, xmlElementP, 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

theKvList

public KvCons theKvList
Constructor Detail

KeyValueList

public KeyValueList()
Method Detail

loadConfigurationFile

public static KeyValueList loadConfigurationFile(java.lang.String file)
Read a configuration file and return its content as a configuration table. Also enter each property read into the global system configuration table. Assumes Java-style property file syntax. Each property name is represented as a wrapped string and each value as a wrapped string/integer/float or boolean.

Parameters:
file -
Returns:
KeyValueList

newKeyValueList

public static KeyValueList newKeyValueList()

javaTranslateWalkedSystemUnits

public static void javaTranslateWalkedSystemUnits(KeyValueList systemunits)

cppTranslateWalkedSystemUnits

public static void cppTranslateWalkedSystemUnits(KeyValueList systemunits)

saveConfigurationFile

public static void saveConfigurationFile(KeyValueList table,
                                         java.lang.String file,
                                         java.lang.String title)
Save table as a configuration file. Uses a Java-style property file syntax.

Parameters:
table -
file -
title -

concatenateSystemUnits

public static List concatenateSystemUnits(KeyValueList systemunits)

setDynamicSlotValue

public static Stella_Object setDynamicSlotValue(KeyValueList dynamicslots,
                                                Symbol slotname,
                                                Stella_Object value,
                                                Wrapper nullwrapper)

dynamicSlotValue

public static Stella_Object dynamicSlotValue(KeyValueList dynamicslots,
                                             Symbol slotname,
                                             Stella_Object nullvalue)

clTranslateWalkedSystemUnits

public static void clTranslateWalkedSystemUnits(KeyValueList systemunits)

insertAtVariableTable

public static void insertAtVariableTable(KeyValueList self,
                                         Symbol variable,
                                         Stella_Object value)

lookupVariableTable

public static Stella_Object lookupVariableTable(KeyValueList self,
                                                Symbol variable)

fillInDateSubstitution

public static void fillInDateSubstitution(KeyValueList substitutionList)
Fill in substitutionList with template variable substitions for the names YEAR and DATE which correspond to the current year and date. These substitutions can then be used with substituteTemplateVariablesInString

Parameters:
substitutionList -

printKeyValueList

public static void printKeyValueList(KeyValueList self,
                                     java.io.PrintStream stream)

listify

public List listify()
Return a list of key-value pairs in self.

Returns:
List

kvlistToPlist

public static PropertyList kvlistToPlist(KeyValueList self)
Convert self into a property list with identical and identically ordered keys and values.

Parameters:
self -
Returns:
PropertyList

allocateIterator

public AbstractIterator allocateIterator()
Overrides:
allocateIterator in class Dictionary

equalHashCode

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

Overrides:
equalHashCode in class Stella_Object
Returns:
int

objectEqualP

public boolean objectEqualP(Stella_Object y)
Return TRUE if x and y represent the same set of key/value pairs.

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

clear

public void clear()
Make self an empty dictionary.


copy

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

Returns:
KeyValueList

nonEmptyP

public boolean nonEmptyP()

emptyP

public boolean emptyP()

reverse

public KeyValueList reverse()
Destructively reverse the members of the list self.

Returns:
KeyValueList

pop

public Stella_Object pop()
Remove and return the value of the first element of the kv-list self. It does NOT return the KV-CONS object. Return null if the list is empty.

Returns:
Stella_Object

kvPush

public void kvPush(Stella_Object key,
                   Stella_Object value)
Add a new entry <key, value> to the front of the association self. This might duplicate an existing entry. If a previous entry existed with key key, that entry is retained, but shadowed by this new entry.

Parameters:
key -
value -

push

public void push(KvCons value)
Make value be the new first element of self. Note that the rest slot of value should be null, since it will be overwritten. This might duplicate an existing entry. If a previous entry existed with the same key as value, that entry is retained, but shadowed by this new entry.

Parameters:
value -

removeEntry

public void removeEntry(Stella_Object key,
                        Stella_Object value)
Remove the entry that matches <key,value>. Assumes that more than one entry can match key.

Parameters:
key -
value -

insertEntry

public void insertEntry(Stella_Object key,
                        Stella_Object value)
Insert an entry <key,value> to self unless an identical entry already exists. This can generate duplicate entries for key.

Parameters:
key -
value -

removeAt

public Stella_Object removeAt(Stella_Object key)
Remove the entry that matches the key key. Return the value of the matching entry, or NULL if there is no matching entry. Assumes that at most one entry matches key.

Parameters:
key -
Returns:
Stella_Object

insertAt

public void insertAt(Stella_Object key,
                     Stella_Object value)
Insert the entry <key, value> into the association self. If a previous entry existed with key key, that entry is replaced.

Overrides:
insertAt in class Dictionary
Parameters:
key -
value -

length

public int length()
Overrides:
length in class AbstractCollection

lookupWithDefault

public Stella_Object lookupWithDefault(Stella_Object key,
                                       Stella_Object renamed_Default)
Lookup key in self and return the result. Return renamed_Default if no value was found.

Parameters:
key -
renamed_Default -
Returns:
Stella_Object

lookup

public Stella_Object lookup(Stella_Object key)
Overrides:
lookup in class Dictionary

consify

public Cons consify()
Return a list of key-value pairs in self.

Overrides:
consify in class Stella_Object
Returns:
Cons

printObject

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

accessKeyValueListSlotValue

public static Stella_Object accessKeyValueListSlotValue(KeyValueList 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