edu.isi.powerloom.logic
Class QuerySolutionTable

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.powerloom.logic.QuerySolutionTable

public class QuerySolutionTable
extends Dictionary

Special key/value map for query solutions indexed by output variable binding vectors that also preserves the order of solution generation.


Field Summary
 QuerySolution first
           
 QuerySolution last
           
 QueryIterator query
           
 KeyValueMap theMap
           
 
Constructor Summary
QuerySolutionTable()
           
 
Method Summary
static Stella_Object accessQuerySolutionTableSlotValue(QuerySolutionTable self, Symbol slotname, Stella_Object value, boolean setvalueP)
           
 AbstractIterator allocateIterator()
           
 void clear()
           
 Cons consify()
          Collect all solutions of self into a cons list and return the result.
 boolean emptyP()
          Return TRUE if self has zero entries.
 void insertAt(Vector key, QuerySolution value)
          Insert value identified by key into self.
 int length()
          Return the number of entries in self.
 Stella_Object lookup(Vector key)
          Lookup the solution identified by key in self and return its value, or NULL if no such solution exists.
static QuerySolutionTable newQuerySolutionTable()
           
 boolean nonEmptyP()
          Return TRUE if self has at least 1 entry.
 QuerySolution nth(int position)
          Return the nth solution in self, or NULL if it is empty.
 QuerySolution pop()
          Remove and return the first solution of self or NULL if the table is empty.
 Surrogate primaryType()
          Returns the primary type of self.
 void removeAt(Vector key)
          Remove the solution identified by key from self.
 QuerySolutionTable sort(java.lang.reflect.Method predicate)
          Perform a stable, destructive sort of self according to predicate, and return the result.
 
Methods inherited from class edu.isi.stella.Dictionary
insertAt, lookup
 
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, equalHashCode, 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, objectEqualP, objectHashCode, one, oneI, onlyIf, parametricTypeSpecifierP, parseArrayDimensionsSpec, parseTokenizerCharacterSpec, parseTokenizerStateModifiers, permanentCopy, permanentify, permanentifyForm, po, prettyPrintLiteral, primaryClass, printObject, 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

theMap

public KeyValueMap theMap

query

public QueryIterator query

first

public QuerySolution first

last

public QuerySolution last
Constructor Detail

QuerySolutionTable

public QuerySolutionTable()
Method Detail

newQuerySolutionTable

public static QuerySolutionTable newQuerySolutionTable()

allocateIterator

public AbstractIterator allocateIterator()
Overrides:
allocateIterator in class Dictionary

sort

public QuerySolutionTable 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.

Parameters:
predicate -
Returns:
QuerySolutionTable

consify

public Cons consify()
Collect all solutions of self into a cons list and return the result.

Overrides:
consify in class Stella_Object
Returns:
Cons

clear

public void clear()

nth

public QuerySolution nth(int position)
Return the nth solution in self, or NULL if it is empty.

Parameters:
position -
Returns:
QuerySolution

nonEmptyP

public boolean nonEmptyP()
Return TRUE if self has at least 1 entry.

Returns:
boolean

emptyP

public boolean emptyP()
Return TRUE if self has zero entries.

Returns:
boolean

length

public int length()
Return the number of entries in self.

Overrides:
length in class AbstractCollection
Returns:
int

pop

public QuerySolution pop()
Remove and return the first solution of self or NULL if the table is empty.

Returns:
QuerySolution

removeAt

public void removeAt(Vector key)
Remove the solution identified by key from self. To preserve the solution ordering chain, the solution is marked as deleted and will be completely removed upon the next iteration through self.

Parameters:
key -

insertAt

public void insertAt(Vector key,
                     QuerySolution value)
Insert value identified by key into self. If a solution with that key already exists, destructively modify it with the slot values of value. This is necessary to preserve the order of solutions in self.

Parameters:
key -
value -

lookup

public Stella_Object lookup(Vector key)
Lookup the solution identified by key in self and return its value, or NULL if no such solution exists.

Parameters:
key -
Returns:
Stella_Object

accessQuerySolutionTableSlotValue

public static Stella_Object accessQuerySolutionTableSlotValue(QuerySolutionTable 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