fr.umlv.tatoo.runtime.tools
Class DataViewer<B,D>

java.lang.Object
  extended by fr.umlv.tatoo.runtime.tools.DataViewer<B,D>
Type Parameters:
B - type of the buffer.
D - type of data.

public abstract class DataViewer<B,D>
extends Object

Acts as a projection. Allow to get the buffer or a view of the buffer in the parser processor.

Author:
Remi Forax

Constructor Summary
DataViewer()
           
 
Method Summary
static
<B> DataViewer<B,B>
getIdentityDataViewer()
          Returns the identity projection.
static
<D> DataViewer<TokenBuffer<D>,D>
getTokenBufferViewer()
          Returns the TokenBuffer.view() projection.
abstract  D view(B buffer)
          Defines the projection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataViewer

public DataViewer()
Method Detail

view

public abstract D view(B buffer)
Defines the projection.

Parameters:
buffer - the buffer
Returns:
the data sent to the semantic part.

getIdentityDataViewer

public static <B> DataViewer<B,B> getIdentityDataViewer()
Returns the identity projection. The buffer will be sent to the parser processor.

Type Parameters:
B - type of the buffer.
Returns:
a data viewer that performs an identity projection.

getTokenBufferViewer

public static <D> DataViewer<TokenBuffer<D>,D> getTokenBufferViewer()
Returns the TokenBuffer.view() projection. The result of a call to will TokenBuffer.view() on the buffer will be sent to the parser processor.

Type Parameters:
D - type of view's items.
Returns:
a data viewer that performs a TokenBuffer.view() projection.