cz.cuni.amis.pogamut.sposh.elements
Class LapElementsFactory

Package class diagram package LapElementsFactory
java.lang.Object
  extended by cz.cuni.amis.pogamut.sposh.elements.LapElementsFactory

public class LapElementsFactory
extends Object

This is a factory class that should be used to create various elements. Do not create elements with their constructor, if you can avoid it, this factory will make sure that returned elements are valid, e.g. all parent links in elements are correctly linked and so on.

Author:
HonzaH

Field Summary
static String DEFAULT_ACTION
          Name of action that will be used unless user specifies a name of action that should be used.
static String DEFAULT_DRIVE_COLLECTION_NAME
           
static String DEFAULT_TRIGGER_SENSE
          Name of trigger that will be used unless user specifies some other trigger in the arguments.
 
Constructor Summary
LapElementsFactory()
           
 
Method Summary
static TriggeredAction createAction()
          Create default action.
static TriggeredAction createAction(PrimitiveCall call)
          Create action for specified call.
static TriggeredAction createAction(String name)
          Create action with specified name.
static TriggeredAction createAction(TriggeredAction original)
          Copy method for an action.
static ActionPattern createActionPattern(ActionPattern ap)
          Create an AP with same structure as passed ap (only structure, no listeners or shared objects).
static ActionPattern createActionPattern(String name)
          Create new action pattern without parameters and one default action.
static ActionPattern createActionPattern(String name, FormalParameters params)
          Create empty action pattern with specified name and parameters, but without any actions in it.
static ActionPattern createActionPattern(String name, FormalParameters params, List<TriggeredAction> actions)
          Create action pattern
static ActionPattern createActionPattern(String name, TriggeredAction... actions)
          Create new action pattern without parameters and containing passed actions.
static Competence createCompetence(Competence c)
          Create a C with same structure as passed c (only structure, no listeners or shared objects).
static Competence createCompetence(String name, String... choices)
          Create a new competence with multiple choices.
static CompetenceElement createCompetenceElement(CompetenceElement choice)
          Create a copy of a passed choice.
static CompetenceElement createCompetenceElement(DriveElement drive)
          Create choice from the passed drive.
static CompetenceElement createCompetenceElement(String name)
          Create new competence element with no trigger sense and default action.
static CompetenceElement createCompetenceElement(String name, List<Sense> triggerSenses, String actionName)
           
static DriveCollection createDriveCollection()
          Create empty drive collection without trigger senses and drives, with blank name.
static DriveCollection createDriveCollection(String driveCollectionName)
          Create empty (i.e.
static DriveElement createDriveElement(CompetenceElement choice)
          Create drive based on the choice.
static DriveElement createDriveElement(DriveElement drive)
           
static DriveElement createDriveElement(String driveName)
          Create new drive with default trigger and action.
static DriveElement createDriveElement(String name, List<Sense> triggerSenses, PrimitiveCall actionCall, Freq freq, String comment)
          Create new drive element
static DriveElement createDriveElementNoTriggers(String name)
          Create new drive with specified name and empty list of triggers and default action.
static PoshPlan createPlan(String dcName)
          Create new plan with DC
static Sense createSense(Sense sense)
          Create a copy of sense (only structure, no listeners or shared objects)
static Sense createSense(String name)
          Create new sense.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ACTION

public static String DEFAULT_ACTION
Name of action that will be used unless user specifies a name of action that should be used.


DEFAULT_TRIGGER_SENSE

public static String DEFAULT_TRIGGER_SENSE
Name of trigger that will be used unless user specifies some other trigger in the arguments.


DEFAULT_DRIVE_COLLECTION_NAME

public static String DEFAULT_DRIVE_COLLECTION_NAME
Constructor Detail

LapElementsFactory

public LapElementsFactory()
Method Detail

createCompetence

public static Competence createCompetence(String name,
                                          String... choices)
                                   throws DuplicateNameException
Create a new competence with multiple choices. The choices have default action and trigger.

Parameters:
name - name of new competence
choices - unique sequence of choices for this competence
Returns:
created competence
Throws:
DuplicateNameException

createDriveElement

public static DriveElement createDriveElement(String driveName)
Create new drive with default trigger and action.

Parameters:
driveName - name of the drive

createDriveElementNoTriggers

public static DriveElement createDriveElementNoTriggers(String name)
Create new drive with specified name and empty list of triggers and default action.

Parameters:
name - name of created drive element

createCompetenceElement

public static CompetenceElement createCompetenceElement(String name)
Create new competence element with no trigger sense and default action.

Parameters:
name - name of competence element
Returns:
created element

createSense

public static Sense createSense(String name)
Create new sense.

Parameters:
name - name of the sense
Returns:
created sense

createAction

public static TriggeredAction createAction()
Create default action.


createAction

public static TriggeredAction createAction(String name)
Create action with specified name.

Parameters:
name - Name of the action
Returns:
created action

createAction

public static TriggeredAction createAction(PrimitiveCall call)
Create action for specified call.


createActionPattern

public static ActionPattern createActionPattern(String name)
Create new action pattern without parameters and one default action.

Parameters:
name - Name of new action pattern
Returns:
created AP

createActionPattern

public static ActionPattern createActionPattern(String name,
                                                TriggeredAction... actions)
Create new action pattern without parameters and containing passed actions.

Parameters:
name - Name of new action pattern
actions - Sequence of actions that will in the AP
Returns:
created AP

createActionPattern

public static ActionPattern createActionPattern(String name,
                                                FormalParameters params)
Create empty action pattern with specified name and parameters, but without any actions in it.

Parameters:
name - Name of the AP
Returns:
created AP

createActionPattern

public static ActionPattern createActionPattern(String name,
                                                FormalParameters params,
                                                List<TriggeredAction> actions)
Create action pattern

Parameters:
name - Name of the AP
params - parameters of this AP
actions - actions that will be in the AP
Returns:
created AP

createActionPattern

public static ActionPattern createActionPattern(ActionPattern ap)
Create an AP with same structure as passed ap (only structure, no listeners or shared objects).

Parameters:
ap - action pattern to copy
Returns:
ap with same structure as the ap.

createCompetence

public static Competence createCompetence(Competence c)
Create a C with same structure as passed c (only structure, no listeners or shared objects).

Parameters:
c - competence to copy
Returns:
competence with same structure as the c.

createDriveElement

public static DriveElement createDriveElement(DriveElement drive)

createSense

public static Sense createSense(Sense sense)
Create a copy of sense (only structure, no listeners or shared objects)

Parameters:
sense -
Returns:

createDriveCollection

public static DriveCollection createDriveCollection()
Create empty drive collection without trigger senses and drives, with blank name.

Returns:

createDriveCollection

public static DriveCollection createDriveCollection(String driveCollectionName)
Create empty (i.e. no drives) DriveCollection with specified name.

Parameters:
driveCollectionName - Name of the created DriveCollection
Returns:
Newly created DriveCollection.

createCompetenceElement

public static CompetenceElement createCompetenceElement(String name,
                                                        List<Sense> triggerSenses,
                                                        String actionName)

createDriveElement

public static DriveElement createDriveElement(String name,
                                              List<Sense> triggerSenses,
                                              PrimitiveCall actionCall,
                                              Freq freq,
                                              String comment)
Create new drive element

Parameters:
name - Name of the drive element
triggerSenses - list of senses that will be used as a trigger
actionCall - What to call if drive is elected
freq - How frequently can be this drive called (if called more frequently, the calls will not be elegible)
comment - Comment about the element
Returns:
Created drive

createCompetenceElement

public static CompetenceElement createCompetenceElement(DriveElement drive)
Create choice from the passed drive.

Parameters:
drive - Base for created choice
Returns:
Choice created according to the drive, infinite retries.

createCompetenceElement

public static CompetenceElement createCompetenceElement(CompetenceElement choice)
Create a copy of a passed choice.

Parameters:
choice - Choice that will be used as original
Returns:
created element

createDriveElement

public static DriveElement createDriveElement(CompetenceElement choice)
Create drive based on the choice.

Parameters:
choice - Choice used as base for new drive.
Returns:
Drive created from the choice, infinite frequency

createPlan

public static PoshPlan createPlan(String dcName)
Create new plan with DC

Parameters:
dcName - name of the DC
Returns:
created plan

createAction

public static TriggeredAction createAction(TriggeredAction original)
Copy method for an action. Parent is not copied, only the data of the element.

Parameters:
original -
Returns:


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.