org.inria.ns.reflex.processor.asl
Class TextAction.InlineType.WrappedTypeMatcher

java.lang.Object
  extended by org.inria.ns.reflex.processor.asl.ItemMatcher
      extended by org.inria.ns.reflex.processor.asl.TextAction.Matcher
          extended by org.inria.ns.reflex.processor.asl.TextAction.InlineType.WrappedTypeMatcher
All Implemented Interfaces:
Ignorable, Reducible, Unwrappable
Enclosing class:
TextAction.InlineType

public class TextAction.InlineType.WrappedTypeMatcher
extends TextAction.Matcher
implements Unwrappable

A text matcher on a type. When a type is used in a text matcher, it must be wrapped in this matcher that can deal with data model features : this matcher can indicates if it is ignorable, can retrieve the name and the value of the item


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.structures.Unwrappable
Unwrappable.Unwrapper
 
Field Summary
 
Fields inherited from class org.inria.ns.reflex.processor.asl.ItemMatcher
FOUND, NOT_FOUND
 
Fields inherited from interface org.inria.ns.reflex.structures.Unwrappable
UNWRAPPER
 
Constructor Summary
TextAction.InlineType.WrappedTypeMatcher(TypeMatcher typeMatcher)
          Wraps a type matcher in a new text matcher.
 
Method Summary
 boolean canUse()
          Indicates whether this material can be used or not.
 AbstractAction getAction()
          Return the TextAction that has created this material item.
 List getExceptions()
          Return the materials that are exceptions to this material.
 InterimStepAction getInterimStep()
          Return the interim step (used to report errors).
 int getMaxInit()
          Return the max init value.
 int getMaxRest()
          Return the max value resting.
 int getMinInit()
          Return the min init value.
 int getMinRest()
          Return the min value resting.
 Type getType()
           
 TypedData matches(String text, DataSet dataSet)
          Check if a text matches the wrapped type matcher.
 boolean mustUse()
          Indicates whether this material must be used or not.
 ValidationError reportError(Element element, Node candidate)
          Report an error raised by the wrapped type matcher.
 void reset()
          Reset the min and max occurences used to their initial values.
 boolean runInterim(DataSet dataSet)
          Run the interim step.
 void setAction(AbstractAction action)
           
 void setBoundaries(int maxOccurs, int minOccurs)
          Set the boundaries.
 void setInterimStep(InterimStepAction interimStep)
          Set the interim step to use when this matcher matches.
 String toString()
          Return wrapped type.
 Object unwrap()
          Return the type matcher wrapped.
 void use()
          Uses the material, that is to say decrements the min and max occurences that remains.
 
Methods inherited from class org.inria.ns.reflex.processor.asl.TextAction.Matcher
getItemName, getItemValue, isIgnorable, matches
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextAction.InlineType.WrappedTypeMatcher

public TextAction.InlineType.WrappedTypeMatcher(TypeMatcher typeMatcher)
Wraps a type matcher in a new text matcher.

Parameters:
typeMatcher - The type matcher to wrap.
Method Detail

toString

public String toString()
Return wrapped type.

Overrides:
toString in class Object
Returns:
"#type"

canUse

public boolean canUse()
Description copied from class: ItemMatcher
Indicates whether this material can be used or not.

Overrides:
canUse in class ItemMatcher
Returns:
true if this material can be use according to its use and max boundary , false otherwise.

getAction

public AbstractAction getAction()
Description copied from class: TextAction.Matcher
Return the TextAction that has created this material item.

Overrides:
getAction in class TextAction.Matcher
Returns:
The action that has created this material item.

getExceptions

public List getExceptions()
Description copied from class: ItemMatcher
Return the materials that are exceptions to this material.

Specified by:
getExceptions in interface Reducible
Overrides:
getExceptions in class ItemMatcher
Returns:
The non null list of ItemMatcher exceptions. If this method is not overriden, an empty list is returned.

getInterimStep

public InterimStepAction getInterimStep()
Description copied from class: ItemMatcher
Return the interim step (used to report errors).

Overrides:
getInterimStep in class ItemMatcher
Returns:
The interim step, or null.

getMaxInit

public int getMaxInit()
Description copied from class: ItemMatcher
Return the max init value.

Overrides:
getMaxInit in class ItemMatcher
Returns:
The max init value.

getMaxRest

public int getMaxRest()
Description copied from class: ItemMatcher
Return the max value resting.

Overrides:
getMaxRest in class ItemMatcher
Returns:
The max value resting.

getMinInit

public int getMinInit()
Description copied from class: ItemMatcher
Return the min init value.

Overrides:
getMinInit in class ItemMatcher
Returns:
The min init value.

getMinRest

public int getMinRest()
Description copied from class: ItemMatcher
Return the min value resting.

Overrides:
getMinRest in class ItemMatcher
Returns:
The min value resting.

getType

public Type getType()

mustUse

public boolean mustUse()
Description copied from class: ItemMatcher
Indicates whether this material must be used or not.

Overrides:
mustUse in class ItemMatcher
Returns:
true if this material must be use according to its use and min boundary , false otherwise.

reset

public void reset()
Description copied from class: ItemMatcher
Reset the min and max occurences used to their initial values.

Overrides:
reset in class ItemMatcher

runInterim

public boolean runInterim(DataSet dataSet)
                   throws ExecutionException
Description copied from class: ItemMatcher
Run the interim step.

Overrides:
runInterim in class ItemMatcher
Parameters:
dataSet - The data set to use.
Returns:
true if the interim step must replace the disrupted step, false otherwise.
Throws:
ExecutionException

setAction

public void setAction(AbstractAction action)

setBoundaries

public void setBoundaries(int maxOccurs,
                          int minOccurs)
Description copied from class: ItemMatcher
Set the boundaries.

Overrides:
setBoundaries in class ItemMatcher
Parameters:
maxOccurs - The number max of occurrences to use this matcher.
minOccurs - The number min of occurrences to use this matcher.

setInterimStep

public void setInterimStep(InterimStepAction interimStep)
Description copied from class: ItemMatcher
Set the interim step to use when this matcher matches.

Overrides:
setInterimStep in class ItemMatcher
Parameters:
interimStep - The interim step of this matcher.

use

public void use()
Description copied from class: ItemMatcher
Uses the material, that is to say decrements the min and max occurences that remains.

Overrides:
use in class ItemMatcher

matches

public TypedData matches(String text,
                         DataSet dataSet)
Check if a text matches the wrapped type matcher.

Specified by:
matches in class TextAction.Matcher
Parameters:
text - The text to test.
dataSet - The set of datas used when the matcher is matching.
Returns:
FOUND if the object matches this material and carries no data, a TypedData if the object matches this material and carries a data, NOT_FOUND otherwise.
See Also:
ItemMatcher.matches(Object,org.inria.ns.reflex.processor.DataSet)

reportError

public ValidationError reportError(Element element,
                                   Node candidate)
Report an error raised by the wrapped type matcher.

Specified by:
reportError in class ItemMatcher
Parameters:
element - The element in fault.
candidate - The candidate node that cause the fault.
Returns:
The validation error raised.
See Also:
ItemMatcher.reportError(org.w3c.dom.Element, org.w3c.dom.Node)

unwrap

public Object unwrap()
Return the type matcher wrapped.

Specified by:
unwrap in interface Unwrappable
Returns:
The type matcher wrapped.
See Also:
Unwrappable.unwrap()