org.kuali.rice.krms.framework.engine
Class TermResolutionEngineImpl
java.lang.Object
org.kuali.rice.krms.framework.engine.TermResolutionEngineImpl
- All Implemented Interfaces:
- TermResolutionEngine
public class TermResolutionEngineImpl
- extends Object
- implements TermResolutionEngine
Method Summary |
void |
addTermResolver(TermResolver<?> termResolver)
Adds a TermResolver to the TermResolutionEngine . |
void |
addTermValue(Term term,
Object value)
Adds a fact value to the TermResolutionEngine 's internal state |
private void |
assembleLinearResolutionPlan(TermResolutionEngineImpl.Visited visited,
Map<TermResolutionEngineImpl.TermResolverKey,TermResolutionEngineImpl.Visited> visitedByKey,
List<TermResolutionEngineImpl.TermResolverKey> plan)
|
protected List<TermResolutionEngineImpl.TermResolverKey> |
buildTermResolutionPlan(TermSpecification term)
|
private TermResolutionEngineImpl.Visited |
buildVisited(TermResolver resolver,
TermResolutionEngineImpl.Visited parentVisited,
Collection<TermSpecification> metPrereqs)
|
private TermResolver<? extends Object> |
createDestination(TermSpecification term)
Create our dummy destination resolver |
private TermResolver |
getResolver(TermResolutionEngineImpl.TermResolverKey resolverKey,
TermResolver destination,
TermResolutionEngineImpl.TermResolverKey destinationKey)
our dummy destination isn't allowed to pollute termResolversByKey, hence the ugly conditional encapsulated herein |
private boolean |
isPlannedBackToDestination(TermResolutionEngineImpl.Visited visited,
TermResolutionEngineImpl.TermResolverKey destinationKey,
Map<TermResolutionEngineImpl.TermResolverKey,TermResolutionEngineImpl.Visited> visitedByKey)
|
|
resolveTerm(Term term)
Resolves a given term into a fact |
private void |
validateTermParameters(TermResolver<?> resolver,
Map<String,String> providedParameters)
This method checks that the required parameters (as returned by the TermResolver via
TermResolver.getParameterNames() ) are met in the Map of provided parameters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG
private static final org.apache.log4j.Logger LOG
termResolversByOutput
private final Map<TermSpecification,List<TermResolver<?>>> termResolversByOutput
termResolversByKey
private final Map<TermResolutionEngineImpl.TermResolverKey,TermResolver<?>> termResolversByKey
termCache
private final Map<Term,Object> termCache
TermResolutionEngineImpl
public TermResolutionEngineImpl()
addTermValue
public void addTermValue(Term term,
Object value)
- Description copied from interface:
TermResolutionEngine
- Adds a fact value to the
TermResolutionEngine
's internal state
- Specified by:
addTermValue
in interface TermResolutionEngine
- Parameters:
term
- the named Termvalue
- the fact value
addTermResolver
public void addTermResolver(TermResolver<?> termResolver)
- Description copied from interface:
TermResolutionEngine
- Adds a
TermResolver
to the TermResolutionEngine
. Once added, it may
be used (unsurprisingly) by the engine to resolve Term
s.
- Specified by:
addTermResolver
in interface TermResolutionEngine
- Parameters:
termResolver
- the TermResolver
to add.
resolveTerm
public <T> T resolveTerm(Term term)
throws TermResolutionException
- Description copied from interface:
TermResolutionEngine
- Resolves a given term into a fact
- Specified by:
resolveTerm
in interface TermResolutionEngine
- Parameters:
term
- the Term
to resolve
- Returns:
- the fact value for the given
Term
- Throws:
TermResolutionException
- if the given Term
can't be resolved
validateTermParameters
private void validateTermParameters(TermResolver<?> resolver,
Map<String,String> providedParameters)
throws TermResolutionException
- This method checks that the required parameters (as returned by the
TermResolver
via
TermResolver.getParameterNames()
) are met in the Map
of provided parameters.
- Parameters:
resolver
- providedParameters
-
- Throws:
TermResolutionException
buildTermResolutionPlan
protected List<TermResolutionEngineImpl.TermResolverKey> buildTermResolutionPlan(TermSpecification term)
buildVisited
private TermResolutionEngineImpl.Visited buildVisited(TermResolver resolver,
TermResolutionEngineImpl.Visited parentVisited,
Collection<TermSpecification> metPrereqs)
- Returns:
- the Visited object for the resolver we just, er, well, visited.
getResolver
private TermResolver getResolver(TermResolutionEngineImpl.TermResolverKey resolverKey,
TermResolver destination,
TermResolutionEngineImpl.TermResolverKey destinationKey)
- our dummy destination isn't allowed to pollute termResolversByKey, hence the ugly conditional encapsulated herein
isPlannedBackToDestination
private boolean isPlannedBackToDestination(TermResolutionEngineImpl.Visited visited,
TermResolutionEngineImpl.TermResolverKey destinationKey,
Map<TermResolutionEngineImpl.TermResolverKey,TermResolutionEngineImpl.Visited> visitedByKey)
- Parameters:
visited
- destinationKey
- visitedByKey
- plannedToDestination
-
- Returns:
assembleLinearResolutionPlan
private void assembleLinearResolutionPlan(TermResolutionEngineImpl.Visited visited,
Map<TermResolutionEngineImpl.TermResolverKey,TermResolutionEngineImpl.Visited> visitedByKey,
List<TermResolutionEngineImpl.TermResolverKey> plan)
createDestination
private TermResolver<? extends Object> createDestination(TermSpecification term)
- Create our dummy destination resolver
- Parameters:
term
-
Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.