cz.cuni.mff.procasor.core.helper
Class SemanticsHelper

java.lang.Object
  extended bycz.cuni.mff.procasor.core.helper.SemanticsHelper

public class SemanticsHelper
extends java.lang.Object

Helper class for Semnatics

Author:
michal

Field Summary
static int ABORT
          Constant
static int CONDITION
          Constant
static int GOTO
          Constant
static java.lang.String[] GUI_STEP_TYPES
          Names of the step types that will be shown in GUI (without condition)
static java.lang.String[] GUI_STEP_TYPES_ALL
          Names of all step typas, that will be shown in GUI
static int INCLUDE_USECASE
          Constant
static int INTERNAL_ACTION
          Constant
static int REQUEST_RECEIVED
          Constant
static int REQUEST_SENT
          Constant
static int TERMINATE_BRANCH
          Constant
static int TERMINATE_USECASE
          Constant
static int UNKNOWN
          Constant
 
Method Summary
static void addWord(Semantics semantics, int index, java.lang.String word, java.lang.String lemma, java.lang.String pos)
          Add new word to the semantics.
static Semantics createSemantics()
          Create new Semantics with type UNKNOWN
static java.lang.String doToken(Semantics sem, TypeSentence ts)
          This method build up the the token, from informations in the semantics.
static java.lang.String eliminateWrongChars(java.lang.String in)
          Replaces all wrong characters ('{', '}', '*', ...) with ' '
static char getActionsTypeCharacter(Semantics sem)
          Returns the first character of token - which indicates the type of action.
static int getSentenceType(Semantics s)
          Gets the sentence's type.
static Word getWord(Semantics semantics, int index)
          Gets word from semantics
static boolean hasSubject(Semantics semantics)
          Check if semantics has a subject
static boolean isGeneratedActiv(TypeSentence sentence)
          Chceck what type of semantics is activ
static void markWord(Semantics semantics, int index, int role)
          Set word type from position index to new role.
static java.lang.String setFirstLetterToLowerCase(java.lang.String s)
          Sets first letter of string to lower case
static void setSentenceType(Semantics s, int type)
          Sets the sentence's type.
static int wordCount(Semantics semantics)
          Return count of words from semantics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
Constant

See Also:
Constant Field Values

REQUEST_RECEIVED

public static final int REQUEST_RECEIVED
Constant

See Also:
Constant Field Values

REQUEST_SENT

public static final int REQUEST_SENT
Constant

See Also:
Constant Field Values

INTERNAL_ACTION

public static final int INTERNAL_ACTION
Constant

See Also:
Constant Field Values

GOTO

public static final int GOTO
Constant

See Also:
Constant Field Values

ABORT

public static final int ABORT
Constant

See Also:
Constant Field Values

TERMINATE_USECASE

public static final int TERMINATE_USECASE
Constant

See Also:
Constant Field Values

TERMINATE_BRANCH

public static final int TERMINATE_BRANCH
Constant

See Also:
Constant Field Values

INCLUDE_USECASE

public static final int INCLUDE_USECASE
Constant

See Also:
Constant Field Values

CONDITION

public static final int CONDITION
Constant

See Also:
Constant Field Values

GUI_STEP_TYPES

public static final java.lang.String[] GUI_STEP_TYPES
Names of the step types that will be shown in GUI (without condition)


GUI_STEP_TYPES_ALL

public static final java.lang.String[] GUI_STEP_TYPES_ALL
Names of all step typas, that will be shown in GUI

Method Detail

getActionsTypeCharacter

public static char getActionsTypeCharacter(Semantics sem)
Returns the first character of token - which indicates the type of action.

Parameters:
sem - Semantics
Returns:
character - type of action

setSentenceType

public static void setSentenceType(Semantics s,
                                   int type)
Sets the sentence's type. Converts given role constant to a string - strings are used internally

Parameters:
s - the sentence
type - type to be set. Should be a constant defined in SentenceHelper class

getSentenceType

public static int getSentenceType(Semantics s)
Gets the sentence's type. Returns the role as an integer, comparable to constants defined in SentenceHelper class

Parameters:
s - the sentence
Returns:
sentence's type

createSemantics

public static Semantics createSemantics()
Create new Semantics with type UNKNOWN

Returns:
newly created sentence

addWord

public static void addWord(Semantics semantics,
                           int index,
                           java.lang.String word,
                           java.lang.String lemma,
                           java.lang.String pos)
Add new word to the semantics.

Parameters:
semantics - semantics word is adding to
index - position of the word in the List of words
word - adding word
lemma - parameter of word
pos - position of lemma

markWord

public static void markWord(Semantics semantics,
                            int index,
                            int role)
Set word type from position index to new role.

Parameters:
semantics - semantics word is come from
index - position of the word in list of words
role - new role

wordCount

public static int wordCount(Semantics semantics)
Return count of words from semantics

Parameters:
semantics - semantics words are counted from
Returns:
count of words

getWord

public static Word getWord(Semantics semantics,
                           int index)
Gets word from semantics

Parameters:
semantics - semantics words is getted from
index - position of the word
Returns:
finded word

hasSubject

public static boolean hasSubject(Semantics semantics)
Check if semantics has a subject

Parameters:
semantics - semantics which is checked
Returns:
true if semantics has a subject, false otherwise

doToken

public static java.lang.String doToken(Semantics sem,
                                       TypeSentence ts)
This method build up the the token, from informations in the semantics. First it decide which action mark. Than it pick up the entity objects acronym. And finaly the rest of token.

Parameters:
sem - Semantics
ts - TypeSentence
Returns:
String active token

setFirstLetterToLowerCase

public static java.lang.String setFirstLetterToLowerCase(java.lang.String s)
Sets first letter of string to lower case

Parameters:
s - string
Returns:
string with first letter in lower case

eliminateWrongChars

public static java.lang.String eliminateWrongChars(java.lang.String in)
Replaces all wrong characters ('{', '}', '*', ...) with ' '

Parameters:
in - string which is replaced
Returns:
changed string

isGeneratedActiv

public static boolean isGeneratedActiv(TypeSentence sentence)
Chceck what type of semantics is activ

Parameters:
sentence - sentence with semantics
Returns:
true if generated semantics is active, false otherwise