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

java.lang.Object
  extended by org.inria.ns.reflex.processor.asl.types.CompositeData
All Implemented Interfaces:
TypedData, Ignorable, IgnorableData, Unwrappable, XOperable

public class CompositeData
extends Object
implements TypedData

This class is a support for a composed data built by a Type. A composed data is a part of the data model built when parsing a text. A data model can be either a single composed data, or made of several composed data. Composed datas are linked together in a hierarchy tree. A composed data can be handled with XML operations thanks to its XOperator.

*** This class is very unstable, and not reliable. ***

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.processor.asl.types.TypedData
TypedData.DefaultTypedData, TypedData.Impl
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.structures.Unwrappable
Unwrappable.Unwrapper
 
Field Summary
static XOperator COMPOSED_DATA_XOP
          The XOperator for composed datas.
 
Fields inherited from interface org.inria.ns.reflex.processor.asl.types.TypedData
TYPE_XOP
 
Fields inherited from interface org.inria.ns.reflex.structures.Unwrappable
UNWRAPPER
 
Constructor Summary
CompositeData(Type type)
          Create an empty composed data of the type given.
 
Method Summary
 String getCanonicalValue()
          Get the canonical value of this data.
 List getData()
           
 String getLexicalValue()
          Get the lexical value of this data.
 String getNonIgnorableRemainder()
          Get the non-ignorable remainder after building this data.
 CompositeData getParent()
           
 String getRemainder()
          Return the remainder of this data.
 Type getType()
          Return the type that has created this data.
 XOperator getXOperator()
          Return the X-operator of this object.
 void ignore(IgnorableData data)
          Indicates that some remainder data has been consumed and must be ignored.
 boolean isEmpty()
           
 boolean isIgnorable()
          Indicates if this object is ignorable.
 void setData(List data)
           
 void setIgnorable(boolean isIgnorable)
          Indicates if this object is ignorable.
 void setParent(CompositeData parent)
           
 void setType(Type type)
          Set the type of this data.
 void setValue(Object value)
          Set the value of this typed data.
 int size()
          If this data is ignorable, the amount of data to ignore.
 Object unwrap()
          Return the object wrapped.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPOSED_DATA_XOP

public static final XOperator COMPOSED_DATA_XOP
The XOperator for composed datas.

Constructor Detail

CompositeData

public CompositeData(Type type)
Create an empty composed data of the type given.

Parameters:
type - The type of the composed data.
Method Detail

isEmpty

public boolean isEmpty()

unwrap

public Object unwrap()
Description copied from interface: Unwrappable
Return the object wrapped. The object wrapped must be of the same type of the wrapper.

Specified by:
unwrap in interface Unwrappable
See Also:
Unwrappable.unwrap()

getData

public List getData()
Returns:
The data.

setData

public void setData(List data)
Parameters:
data - The data to set.

setType

public void setType(Type type)
Set the type of this data.

Parameters:
type - The type to set.

getType

public Type getType()
Return the type that has created this data.

Specified by:
getType in interface TypedData
Returns:
The type that has created this data.
See Also:
TypedData.getType()

getParent

public CompositeData getParent()
Returns:
The parent.

setParent

public void setParent(CompositeData parent)
Parameters:
parent - The parent to set.

getRemainder

public String getRemainder()
Return the remainder of this data.

Specified by:
getRemainder in interface TypedData
Returns:
The remainder that has not been parsed by the type of this data.
See Also:
TypedData.getRemainder()

getNonIgnorableRemainder

public String getNonIgnorableRemainder()
Description copied from interface: TypedData
Get the non-ignorable remainder after building this data. The non-ignorable remainder MUST be consumed.

Specified by:
getNonIgnorableRemainder in interface TypedData
Returns:
The not null remainder.

ignore

public void ignore(IgnorableData data)
Description copied from interface: TypedData
Indicates that some remainder data has been consumed and must be ignored.

Specified by:
ignore in interface TypedData
Parameters:
data - The amount of data to ignore.

size

public int size()
If this data is ignorable, the amount of data to ignore.

Specified by:
size in interface IgnorableData
Returns:
The lexical value length ; this implementation return those given by the "lexical-value" facet.
See Also:
IgnorableData.size()

isIgnorable

public boolean isIgnorable()
Indicates if this object is ignorable.

Specified by:
isIgnorable in interface Ignorable
Returns:
true if this object is ignorable, false otherwise.

setIgnorable

public void setIgnorable(boolean isIgnorable)
Indicates if this object is ignorable.

Specified by:
setIgnorable in interface IgnorableData
Parameters:
isIgnorable - true if this object must be ignored, false otherwise.

setValue

public void setValue(Object value)
              throws TypeFormatException
Description copied from interface: TypedData
Set the value of this typed data.

Specified by:
setValue in interface TypedData
Parameters:
value - The value to set.
Throws:
TypeFormatException - When the value is not of the type expected.

getCanonicalValue

public String getCanonicalValue()
Description copied from interface: TypedData
Get the canonical value of this data.

Specified by:
getCanonicalValue in interface TypedData
Returns:
The canonical value of this data.

getLexicalValue

public String getLexicalValue()
Description copied from interface: TypedData
Get the lexical value of this data.

Specified by:
getLexicalValue in interface TypedData
Returns:
The lexical value of this data.

getXOperator

public XOperator getXOperator()
Return the X-operator of this object.

Specified by:
getXOperator in interface XOperable
Returns:
The non null X-operator of this object.
See Also:
XOperable.getXOperator()