org.inria.ns.reflex.processor.asl.types
Class TypeMatcher

java.lang.Object
  extended by org.inria.ns.reflex.processor.asl.ItemMatcher
      extended by org.inria.ns.reflex.processor.asl.types.TypeMatcher
All Implemented Interfaces:
Reducible
Direct Known Subclasses:
StaticTypeMatcher

public abstract class TypeMatcher
extends ItemMatcher

A matcher that indicates if an attribute value or a text content matches a type or a text matcher.

Author:
Philippe Poulard

Field Summary
 
Fields inherited from class org.inria.ns.reflex.processor.asl.ItemMatcher
FOUND, NOT_FOUND
 
Constructor Summary
TypeMatcher()
          Create a new TypeMatcher.
 
Method Summary
 AbstractAction getAction()
          Return the action that built this matcher.
abstract  Type getType()
          Return the type to use for the matching.
 TypedData matches(Object o, DataSet dataSet)
          Return true if this matcher matches the given text, false otherwise.
 TypedData matches(TextCandidate text, DataSet dataSet)
          Return true if this matcher matches the given text, false otherwise.
 ValidationError reportError(Element element, Node candidate)
          Raise an error.
 void setAction(AbstractAction action)
          Set the action that built this matcher.
 
Methods inherited from class org.inria.ns.reflex.processor.asl.ItemMatcher
canUse, getExceptions, getInterimStep, getMaxInit, getMaxRest, getMinInit, getMinRest, mustUse, reset, runInterim, setBoundaries, setInterimStep, use
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeMatcher

public TypeMatcher()
Create a new TypeMatcher.

Method Detail

matches

public TypedData matches(TextCandidate text,
                         DataSet dataSet)
Return true if this matcher matches the given text, false otherwise.

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)

matches

public TypedData matches(Object o,
                         DataSet dataSet)
Return true if this matcher matches the given text, false otherwise.

Specified by:
matches in class ItemMatcher
Parameters:
o - 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)

getAction

public AbstractAction getAction()
Return the action that built this matcher.

Specified by:
getAction in class ItemMatcher
Returns:
The action that built this matcher.
See Also:
ItemMatcher.getAction()

setAction

public void setAction(AbstractAction action)
Set the action that built this matcher.

Parameters:
action - The action to set.

getType

public abstract Type getType()
Return the type to use for the matching.

Returns:
The type.

reportError

public ValidationError reportError(Element element,
                                   Node candidate)
Raise an error. This method is used by the SchemaClientHandler when a candidate material failed to match whereas it is expected.

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.