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

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

public class BranchStepHelper
extends java.lang.Object

Author:
gorduin Helper class for BranchStep. Implements only functions for creating and removing.

Field Summary
static java.lang.String TYPE_EXTENSION
          Type of branchStep - extension
static java.lang.String TYPE_VARIATION
          Type of branchStep - variation
 
Method Summary
static boolean canIncludeFailure(BranchStep step)
          Check if the branchStep is a condition and if the parent includes useCase.
static BranchStep create(java.lang.String stepMark, java.lang.String text)
          Creates new BranchStep and inicializes all parametrs.
static java.lang.String getExtensionStepMark(BranchStep step)
          Generates new stepMark, that extends step from parameter.
static java.lang.String getNextStepMark(BranchStep step)
          Generates new stepMark, that follows step from parameter.
static boolean isCondition(BranchStep step)
          Check if branchStep is condition or not.
static boolean isTypeExtension(BranchStep branchStep)
          Returns true, if branch step is extension.
static void reMarkSteps(UseCase useCase, BranchStep step, java.lang.String mark)
          Remarks branch mark and all it children.
static void remove(UseCase useCase, BranchStep branchStep)
          Remove branchStep from the project.
static void save(BranchStep branchStep, UseCase useCase, int position)
          Generate id for branch step and add this step to the UseCase to the specified postion.
static void setTypeExtension(BranchStep branchStep)
          Sets parametr typeOfBranchStep to extension.
static void setTypeOfBranchStep(BranchStep step, java.lang.String value)
          Sets type to the branch step.
static void setTypeVariation(BranchStep branchStep)
          Sets parametr typeOfBranchStep to variation.
static void tryToSetTypeFromParent(BranchStep step)
          Try to set up type of branchStep (var or ext) from parent, if this si possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_EXTENSION

public static final java.lang.String TYPE_EXTENSION
Type of branchStep - extension

See Also:
Constant Field Values

TYPE_VARIATION

public static final java.lang.String TYPE_VARIATION
Type of branchStep - variation

See Also:
Constant Field Values
Method Detail

create

public static BranchStep create(java.lang.String stepMark,
                                java.lang.String text)
Creates new BranchStep and inicializes all parametrs.

Parameters:
stepMark - text of stepMark
text - text of step
Returns:
new BranchStep with initialized parameters.

save

public static void save(BranchStep branchStep,
                        UseCase useCase,
                        int position)
Generate id for branch step and add this step to the UseCase to the specified postion.

Parameters:
branchStep - branchStep to be added to the use case
useCase - use case, branch step is additing to
position - position in the list of branch step use cases

remove

public static void remove(UseCase useCase,
                          BranchStep branchStep)
Remove branchStep from the project.

Parameters:
branchStep - branch step to be removed from project

setTypeExtension

public static void setTypeExtension(BranchStep branchStep)
Sets parametr typeOfBranchStep to extension.

Parameters:
branchStep - modified branch step

setTypeVariation

public static void setTypeVariation(BranchStep branchStep)
Sets parametr typeOfBranchStep to variation.

Parameters:
branchStep - modified branch step

isTypeExtension

public static boolean isTypeExtension(BranchStep branchStep)
Returns true, if branch step is extension.

Parameters:
branchStep - branch step
Returns:
whether the given BranchStep is of type EXTENSION (true) or VARIATION (false)

getNextStepMark

public static java.lang.String getNextStepMark(BranchStep step)
Generates new stepMark, that follows step from parameter.

Returns:
step mark for the step, following step from parameters

getExtensionStepMark

public static java.lang.String getExtensionStepMark(BranchStep step)
Generates new stepMark, that extends step from parameter.

Returns:
step mark for the step, extending step from parameters

isCondition

public static boolean isCondition(BranchStep step)
Check if branchStep is condition or not.

Parameters:
step - checked branch step

canIncludeFailure

public static boolean canIncludeFailure(BranchStep step)
Check if the branchStep is a condition and if the parent includes useCase.

Parameters:
step - checked branch step

tryToSetTypeFromParent

public static void tryToSetTypeFromParent(BranchStep step)
Try to set up type of branchStep (var or ext) from parent, if this si possible.

Parameters:
step - modified branch step

reMarkSteps

public static void reMarkSteps(UseCase useCase,
                               BranchStep step,
                               java.lang.String mark)
Remarks branch mark and all it children.

Parameters:
useCase - use case step mark belongs to
step - branch step, which mark has to be checked
mark - new mark fot branch step

setTypeOfBranchStep

public static void setTypeOfBranchStep(BranchStep step,
                                       java.lang.String value)
Sets type to the branch step.

Parameters:
step - modified branch step.
value - string value of the new type