ua.gradsoft.termware.util
Class ConditionalRuleTransformer

java.lang.Object
  extended by ua.gradsoft.termware.util.AbstractRuleTransformer
      extended by ua.gradsoft.termware.util.ConditionalRuleTransformer
All Implemented Interfaces:
ITermTransformer

public class ConditionalRuleTransformer
extends AbstractRuleTransformer

Transformer for if_rule (i. e. rules with conditions)


Constructor Summary
ConditionalRuleTransformer(Term rule)
           
 
Method Summary
 Term getCondition()
           
 String getDescription()
          return human-readable description of transformer
 Term getInPattern()
          get input pattern
 String getName()
          return name of transformer.
 Term getOutPattern()
          get output pattern
 String getSource()
          return source-code of this term, if one is aviable.
 Term getTerm()
          return representation of this rule as term
 Term non_static_transform(Term inPattern, Term outPattern, Term condition, Term elifConditions, Term failOutPattern, Term t, TermSystem system, TransformationContext ctx)
           
 Term transform(Term t, TermSystem system, TransformationContext ctx)
          attempt to transform term t .
 
Methods inherited from class ua.gradsoft.termware.util.AbstractRuleTransformer
isActionPattern, isLetPattern, isWherePattern
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConditionalRuleTransformer

public ConditionalRuleTransformer(Term rule)
                           throws TermWareException
Throws:
TermWareException
Method Detail

transform

public Term transform(Term t,
                      TermSystem system,
                      TransformationContext ctx)
               throws TermWareException
Description copied from interface: ITermTransformer
attempt to transform term t .

Specified by:
transform in interface ITermTransformer
Specified by:
transform in class AbstractRuleTransformer
Parameters:
t - - term to transform
system - - system which give us access to ebvironment.
ctx - - context of transformation.
Returns:
- transformed term.
Throws:
TermWareException

non_static_transform

public Term non_static_transform(Term inPattern,
                                 Term outPattern,
                                 Term condition,
                                 Term elifConditions,
                                 Term failOutPattern,
                                 Term t,
                                 TermSystem system,
                                 TransformationContext ctx)
                          throws TermWareException
Throws:
TermWareException

getInPattern

public final Term getInPattern()
Description copied from class: AbstractRuleTransformer
get input pattern

Specified by:
getInPattern in class AbstractRuleTransformer

getOutPattern

public final Term getOutPattern()
Description copied from class: AbstractRuleTransformer
get output pattern

Specified by:
getOutPattern in class AbstractRuleTransformer

getCondition

public final Term getCondition()

getDescription

public String getDescription()
Description copied from interface: ITermTransformer
return human-readable description of transformer


getName

public String getName()
Description copied from interface: ITermTransformer
return name of transformer. (usually is a name of top-level reduced term). this name is not used internally by termware engine, but can be printed in system description for human.

Returns:
name of transformer.

getTerm

public Term getTerm()
             throws TermWareException
Description copied from class: AbstractRuleTransformer
return representation of this rule as term

Specified by:
getTerm in class AbstractRuleTransformer
Throws:
TermWareException

getSource

public String getSource()
Description copied from interface: ITermTransformer
return source-code of this term, if one is aviable.