org.eclipse.ocl.internal.helper
Class OCLSyntaxHelper<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>

java.lang.Object
  extended by org.eclipse.ocl.internal.helper.OCLSyntaxHelper<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
All Implemented Interfaces:
OCLSyntaxHelper
Direct Known Subclasses:
OCLSyntaxHelper

public class OCLSyntaxHelper<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
extends java.lang.Object
implements OCLSyntaxHelper

Engine for computation of possible syntax completions at a point in the an OCL expression.

Author:
Yasser Lulu, Christian W. Damus (cdamus)

Nested Class Summary
protected  class OCLSyntaxHelper.ASTVisitor
           
 
Constructor Summary
OCLSyntaxHelper(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> env)
           
 
Method Summary
protected  OCLSyntaxHelper.ASTVisitor createASTVisitor(ConstraintKind constraintType, java.lang.String txt, int position)
           
protected  Choice createChoice(java.lang.String name, java.lang.String description, ChoiceKind kind, java.lang.Object element)
           
protected  java.util.List<Choice> getChoices(OCLExpression<C> expression, ConstraintKind constraintType)
          returns the syntax help choices applicable for the passed OCLExpression
protected  java.lang.String getDescription(java.lang.Object namedElement)
          Gets the most appropriate description available of the specified named element.
protected  Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> getEnvironment()
           
protected  java.util.List<Choice> getPropertyChoices(C eClass)
          returns the choices list of structural features for the passed eclass
 java.util.List<Choice> getSyntaxHelp(ConstraintKind constraintType, java.lang.String txt)
          Gets syntax help choices for the specified context classifier or operation.
static java.lang.String initialLower(java.lang.String name)
          Gets the name of a named element with its initial character in lower case.
protected  boolean isOclIsInState(lpg.runtime.IToken token)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OCLSyntaxHelper

public OCLSyntaxHelper(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> env)
Method Detail

getPropertyChoices

protected java.util.List<Choice> getPropertyChoices(C eClass)
returns the choices list of structural features for the passed eclass

Parameters:
eClass - the eclass to get features from
Returns:
List oclchoices list for structural features

createChoice

protected Choice createChoice(java.lang.String name,
                              java.lang.String description,
                              ChoiceKind kind,
                              java.lang.Object element)

initialLower

public static java.lang.String initialLower(java.lang.String name)
Gets the name of a named element with its initial character in lower case.

Parameters:
elem - a named element
Returns:
the element's name, with an initial lower case letter

getChoices

protected java.util.List<Choice> getChoices(OCLExpression<C> expression,
                                            ConstraintKind constraintType)
returns the syntax help choices applicable for the passed OCLExpression

Parameters:
expression - the AST node to check and return relevant syntax help choices for.
constraintType - the type of constraint that we are completing
Returns:
syntax help choices for user (list of Choices; could be empty

getEnvironment

protected Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> getEnvironment()

getDescription

protected java.lang.String getDescription(java.lang.Object namedElement)
Gets the most appropriate description available of the specified named element.

Parameters:
namedElement - a named element presented to the user as a choice
Returns:
the most appropriate description for the element

getSyntaxHelp

public java.util.List<Choice> getSyntaxHelp(ConstraintKind constraintType,
                                            java.lang.String txt)
Gets syntax help choices for the specified context classifier or operation.

Specified by:
getSyntaxHelp in interface OCLSyntaxHelper
Parameters:
constraintType - the kind of constraint for which to get completion suggestions
txt - the string we got from client that contains the ocl expression
context - the context classifier or operation to use for the ocl expression parsing
Returns:
a list of Choices representing the syntax help choices for the user; could be empty

createASTVisitor

protected OCLSyntaxHelper.ASTVisitor createASTVisitor(ConstraintKind constraintType,
                                                      java.lang.String txt,
                                                      int position)

isOclIsInState

protected boolean isOclIsInState(lpg.runtime.IToken token)