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

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

public class SentenceHelper
extends java.lang.Object

Class with static methods for work with Sentence class

Author:
michal

Method Summary
static Semantics createManualSemanticsFromGenerated(TypeSentence sentence)
          Creates new manual semantics duplicated from generated.
static java.lang.String doToken(TypeSentence s)
          Returns the token.
static java.lang.String getActiveTypeOfSentence(TypeSentence sentence)
          Returns type of sentence "" if type is empty
static boolean includesStepNonDigitLetter(java.lang.String mark)
          Returns true if mark includes non-digit char.
static java.lang.String isStepMarkCorrect(BranchStep branchStep, UseCase useCase)
          To each BranchStep are found his parents (can be more than one) and the lists of parents to this branchStep is filled.
static java.lang.String isStepMarkCorrect(UseCaseStep useCaseStep, UseCase useCase)
          Checks whether the Mark of the UsecaseStep is correct.
static void returnToGeneratedSemnatics(TypeSentence sentence)
          Remove manual semantics and sets as active generated semantics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getActiveTypeOfSentence

public static java.lang.String getActiveTypeOfSentence(TypeSentence sentence)
Returns type of sentence "" if type is empty

Parameters:
sentence - sentence the type is checked from

isStepMarkCorrect

public static java.lang.String isStepMarkCorrect(UseCaseStep useCaseStep,
                                                 UseCase useCase)
Checks whether the Mark of the UsecaseStep is correct. rules for correct Mark: - unique - no other step with same mark - number value - its string only with number chars, his value is greater then zero If mark isnt correct, sets its SentenceIsStepMarkCorrect value to false and returns error message else sets its SentenceIsStepMarkCorrect to true and returns null.

Parameters:
useCaseStep - step which mark is chcecked
useCase - use case step is come from
Returns:
null if all is correct, error message otherwise

isStepMarkCorrect

public static java.lang.String isStepMarkCorrect(BranchStep branchStep,
                                                 UseCase useCase)
To each BranchStep are found his parents (can be more than one) and the lists of parents to this branchStep is filled. If mark isnt correct, sets his SentenceIsStepMarkCorrect value to false and returns the error message, else sets its SentenceIsStepMarkCorrect to true and returns null. To every BranchStep exists his parentUseCaseStep, parentBranchStep and his childrenBranchSteps. When verifieng branchStep we set his parentUseCaseStep, parentBranchStep and his childrenBranchSteps. At first we have to remove branchStep from all parent of children lists in UseCaseSteps and BranchSteps and then we search all UseCaseSteps and BranchSteps in order to find his parents and childrens.

Parameters:
branchStep - step which is checked
useCase - use case step comes from
Returns:
null if all is correct, error message otherwise

doToken

public static java.lang.String doToken(TypeSentence s)
Returns the token. It uses active semantics doToken.

Parameters:
s - TypeSentence
Returns:
token String

createManualSemanticsFromGenerated

public static Semantics createManualSemanticsFromGenerated(TypeSentence sentence)
Creates new manual semantics duplicated from generated. Changes manual semantics id and add new manual semantics to sentence and make it active. Returns null if generated semantics doesn't exist

Parameters:
sentence - sentece generated semantics is getted from
Returns:
new manual semantics

returnToGeneratedSemnatics

public static void returnToGeneratedSemnatics(TypeSentence sentence)
Remove manual semantics and sets as active generated semantics. Alse changes List of words between semantics, so in generated semantics Words from manual with new values.

Parameters:
sentence - sentence which is modified

includesStepNonDigitLetter

public static boolean includesStepNonDigitLetter(java.lang.String mark)
Returns true if mark includes non-digit char.

Parameters:
mark - mark which is checked
Returns:
true if mark includes non-digit char