|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectua.gradsoft.termware.TermSystem
public class TermSystem
TermSystem is set < rules,facts,strategy,env > where
IFacts,
ITermRewritingStrategy,
IEnv| Constructor Summary | |
|---|---|
TermSystem(ITermRewritingStrategy strategy,
IFacts facts)
create new instance of ITermSystem in default TermWare environment. |
|
TermSystem(ITermRewritingStrategy strategy,
IFacts facts,
TermWareInstance instance)
create new instance of ITermSystem |
|
| Method Summary | |
|---|---|
void |
addNormalizer(String termName,
ITermTransformer transformer)
add normalizer transformer for terms with name termName |
void |
addRule(String s)
add rule s to system. |
void |
addRule(Term t)
add rule t to system with default priority. |
Term |
apply(String x)
synonim of appply(ITermFactory.createParsedTerm(x)) |
Term |
apply(String x,
SourceCodeLocation scl)
synonim of appply(ITermFactory.createParsedTerm(x,scl)) |
Term |
apply(Term x)
apply system to term x. |
boolean |
checkFact(String s)
synonim of checkFact(ITermFactory.createParsedTerm(x)) |
boolean |
checkFact(Term t,
TransformationContext ctx)
check fact t in associated facts database. |
boolean |
checkLoggedEntity(String s)
|
void |
clearLoggedEntities()
|
IEnv |
getEnv()
get environment for input/output operations. |
IFacts |
getFacts()
get facts base. |
TermWareInstance |
getInstance()
get instance of runtime environment. |
Set<String> |
getLoggedEntities()
|
SortedSet<String> |
getPatternNames()
get patterns for all rules, added to system. |
ITermRewritingStrategy |
getStrategy()
get strategy |
boolean |
isLoggingMode()
|
boolean |
isReduceFacts()
true, if facts are reduced by system before passing to facts database in checkFact and setFact methods. |
boolean |
isStop()
|
void |
printHelp(PrintStream out)
print to output stream name and descriptions of all rules in system. |
Term |
reduce(Term x)
reduce term x |
Term |
reduce(Term x,
TransformationContext ctx)
reduce term in given transformation context. |
void |
setEnv(IEnv env)
set environment for input/output operations. |
void |
setFact(String s)
set fact s . |
void |
setFact(Term t,
TransformationContext ctx)
set fact t |
void |
setFacts(IFacts facts)
set facts base |
void |
setLoggedEntities(Collection<String> loggedEntities)
|
void |
setLoggedEntity(String s)
|
void |
setLoggingMode(boolean mode)
|
void |
setReduceFacts(boolean reduceFacts)
if set to true, then facts are reduced by system before passing to facts database in checkFact and setFact methods. |
void |
setStop(boolean stop)
|
void |
unsetLoggedEntity(String s)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TermSystem(ITermRewritingStrategy strategy,
IFacts facts,
TermWareInstance instance)
strategy - - strategyfacts - - database of factsinstance - - instance of TermWare environment.
public TermSystem(ITermRewritingStrategy strategy,
IFacts facts)
strategy - - strategyfacts - - database of facts| Method Detail |
|---|
public Term apply(Term x)
x - term to reduce
public final Term apply(String x)
appply(ITermFactory.createParsedTerm(x))
x - string, with term to reduce.
public final Term apply(String x,
SourceCodeLocation scl)
appply(ITermFactory.createParsedTerm(x,scl))
x - string, with term to reduce.scl - source code location of x.
public boolean checkFact(Term t,
TransformationContext ctx)
throws TermWareException
t in associated facts database.
(after reducing of t, if ReduceFacts property set to true).
t - fact to check.ctx - transformation context of system.
t is checked, false otherwise.
TermWareExceptionisReduceFacts(),
setReduceFacts(boolean),
setFact(ua.gradsoft.termware.Term, ua.gradsoft.termware.TransformationContext)
public boolean checkFact(String s)
throws TermWareException
checkFact(ITermFactory.createParsedTerm(x))
s - - sring with facts to reduce.
TermWareException
public void setFact(Term t,
TransformationContext ctx)
throws TermWareException
t
TermWareException
public final void setFact(String s)
throws TermWareException
s .
TermWareExceptionpublic boolean isReduceFacts()
checkFact and setFact methods.
setReduceFacts(boolean)public void setReduceFacts(boolean reduceFacts)
checkFact and setFact methods.
otherwise, facts terms are passed to facts database directly.
isReduceFacts(),
checkFact(ua.gradsoft.termware.Term, ua.gradsoft.termware.TransformationContext),
setFact(ua.gradsoft.termware.Term, ua.gradsoft.termware.TransformationContext)
public void addRule(Term t)
throws TermWareException
t to system with default priority.
TermWareException
public final void addRule(String s)
throws TermWareException
s to system.
alias for addRule(ITermFactory.createParsedTerm(s));
TermWareException
public void addNormalizer(String termName,
ITermTransformer transformer)
throws TermWareException
transformer for terms with name termName
TermWareException
public Term reduce(Term x)
throws TermWareException
x
TermWareException
public Term reduce(Term x,
TransformationContext ctx)
throws TermWareException
TermWareExceptionpublic final IEnv getEnv()
IEnv,
TermWareInstance.getEnv(),
setEnv(ua.gradsoft.termware.IEnv)public final void setEnv(IEnv env)
IEnv,
TermWareInstance.getEnv(),
getEnv()public final boolean isStop()
public final void setStop(boolean stop)
public final boolean isLoggingMode()
public final void setLoggingMode(boolean mode)
public final boolean checkLoggedEntity(String s)
public final void setLoggedEntity(String s)
public final void unsetLoggedEntity(String s)
public final Set<String> getLoggedEntities()
public final void setLoggedEntities(Collection<String> loggedEntities)
public final void clearLoggedEntities()
public final ITermRewritingStrategy getStrategy()
public final IFacts getFacts()
public void setFacts(IFacts facts)
facts - - new facts to set.public final TermWareInstance getInstance()
public void printHelp(PrintStream out)
output stream name and descriptions of all rules in system.
- Parameters:
out - - where we print help messages.
public SortedSet<String> getPatternNames()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||