Dresden OCL Toolkit

tudresden.ocl.codegen.decl
Class Guide

java.lang.Object
  extended bytudresden.ocl.codegen.decl.Guide

public class Guide
extends Object

This class holds information about navigation in relational schemes as kind of steps of select-from-where clauses. One guide is dedicated to describe either navigations over tables or simple attribute access. If a guide is dedicated to describe a navigation or attribute access can be queried by the according methode. If a navigation or attribute access requires more than one table access, each access must be described with a separate Guide object. In that case, MappedClass objects then return an array of Guide objects. Guides must lead from the target table to the table from where the navigation or attribute starts. The start table is called the context table. Since it is possible to start from a table that uses an alias, the alias in use should be stored within the Guide object too.

Author:
Sten Loecher
See Also:
MappedClass

Nested Class Summary
private  class Guide.Step
           
 
Field Summary
private  String contextAlias
          the alias for the context table, should be null if it is no final guide
private static String EX_NO_ALIAS
           
private  boolean isNavigation
          a flag that holds information about the interpretation of the class data
private  int pointer
          a pointer that points the current step
private  List steps
          a List containing all the steps
 
Constructor Summary
Guide(boolean navigation)
          Creates a new Guide.
Guide(boolean navigation, String contextAlias)
          Creates a new Guide.
 
Method Summary
 void add(String select, String from, String where)
          Add a select-from-where clause.
 String getAlias()
           
 String getFrom()
           
 String getSelect()
           
 String getWhere()
           
 boolean hasMoreSteps()
           
 boolean isNavigation()
           
 void next()
          Set the navigation pointer to next select-from-where clause.
 int numberOfSteps()
           
 void reset()
          Resets the navigation pointer.
 void setAlias(String contextAlias)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EX_NO_ALIAS

private static String EX_NO_ALIAS

steps

private List steps
a List containing all the steps


isNavigation

private boolean isNavigation
a flag that holds information about the interpretation of the class data


pointer

private int pointer
a pointer that points the current step


contextAlias

private String contextAlias
the alias for the context table, should be null if it is no final guide

Constructor Detail

Guide

public Guide(boolean navigation,
             String contextAlias)
Creates a new Guide.

Parameters:
navigation - true if the guide describes a navigation, false otherwise
contextAlias - the context alias of the start table

Guide

public Guide(boolean navigation)
Creates a new Guide.

Parameters:
navigation - true if the guide describes a navigation, false otherwise
Method Detail

add

public void add(String select,
                String from,
                String where)
         throws NullPointerException
Add a select-from-where clause. The steps must be added in the order they are going to be queried.

Parameters:
select - the select part
from - the from part
where - the where part
Throws:
NullPointerException - if one of the parameters is null

reset

public void reset()
Resets the navigation pointer. To query the first step, next() must be called first.


next

public void next()
          throws IllegalStateException
Set the navigation pointer to next select-from-where clause.

Throws:
IllegalStateException - if there is no next step

hasMoreSteps

public boolean hasMoreSteps()
Returns:
true if there is a next step available, false otherwise

getSelect

public String getSelect()
                 throws IllegalStateException
Returns:
the select part of the current step
Throws:
IllegalStateException - if the client failed to call next() after reset() or object creation

getFrom

public String getFrom()
               throws IllegalStateException
Returns:
the from part of the current step
Throws:
IllegalStateException - if the client failed to call next() after reset() or object creation

getWhere

public String getWhere()
                throws IllegalStateException
Returns:
the where part of the current step
Throws:
IllegalStateException - if the client failed to call next() after reset() or object creation

isNavigation

public boolean isNavigation()
Returns:
true if the guide describes a navigation, false otherwise

numberOfSteps

public int numberOfSteps()
Returns:
the number of steps

setAlias

public void setAlias(String contextAlias)

getAlias

public String getAlias()
                throws NullPointerException
Returns:
the alias of the context table
Throws:
NullPointerException - if no context alias is specified

toString

public String toString()
Returns:
a description of this guide

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.