cz.cuni.pogamut.shed.presenter
Class AcceptActionFactory

Package class diagram package AcceptActionFactory
java.lang.Object
  extended by cz.cuni.pogamut.shed.presenter.AcceptActionFactory

public class AcceptActionFactory
extends Object

Factory for accept actions used for presenter (IPresenter.getAcceptProviders()).

Author:
Honza Havlicek

Constructor Summary
AcceptActionFactory()
           
 
Method Summary
static AbstractAcceptAction createAction2Action(TriggeredAction action)
          This is complex accept action for an action with any parent.
static AbstractAcceptAction<ActionPattern,TriggeredAction> createActionPatternAction(TriggeredAction targetAction)
          Create accept action the the TriggeredAction that will accept the ActionPattern.
static AbstractAcceptAction<Competence,TriggeredAction> createCompetence2Action(TriggeredAction targetAction)
          Create an accept action for the @targetAction that will accept an competence, when dropped on it.
static AbstractAcceptAction createDrive2Competence(Competence competence)
          Allow drive to be dropped onto a competence, convert drive to choice and add it as first child of competence.
static AbstractAcceptAction<DriveElement,DriveElement> createDrive2Drive(DriveElement drive)
          Move the drive in the DriveCollection.
static AbstractAcceptAction createDrive2Choice(CompetenceElement choice)
          Accept drive dropped onto a choice into a Competence.
static AbstractAcceptAction createChoice2Competence(Competence competence)
          Accept action for dropping choice to competence.
static AbstractAcceptAction createChoice2Drive(DriveElement drive)
          Accept choice dropped onto a drive into a DriveCollection.
static AbstractAcceptAction<CompetenceElement,CompetenceElement> createChoice2Choice(CompetenceElement targetChoice)
          Create accept action for the @targetChoice for another CompetenceElement.
static AbstractAcceptAction<Sense,DriveElement> createSense2Drive(DriveElement drive)
          When sense is dropped to the @drive, remove the sense from its parent (it it has one) and add it as first trigger sense of the drive.
static AbstractAcceptAction createSense2Choice(CompetenceElement targetChoice)
          Create accept action where target choice will acc dropped sense as its first trigger sense.
static AbstractAcceptAction<Sense,Sense> createSense2Sense(Sense sense)
          Create accept action for the @sense that will accept another sense at the position of the target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AcceptActionFactory

public AcceptActionFactory()
Method Detail

createSense2Drive

public static AbstractAcceptAction<Sense,DriveElement> createSense2Drive(DriveElement drive)
When sense is dropped to the @drive, remove the sense from its parent (it it has one) and add it as first trigger sense of the drive.

Parameters:
drive - Drive whcih will accept the sense
Returns:

createSense2Sense

public static AbstractAcceptAction<Sense,Sense> createSense2Sense(Sense sense)
Create accept action for the @sense that will accept another sense at the position of the target. If the dropped sense is in same trigger, use Trigger.moveSense(int, cz.cuni.amis.pogamut.sposh.elements.Sense), if it is another trigger, delete dropped sense from the original trigger and add it to the target trigger. If the sense is newly created one, simply add it.

Parameters:
sense - Sense that will accept another sense that will be dropped at it.
Returns:

createDrive2Drive

public static AbstractAcceptAction<DriveElement,DriveElement> createDrive2Drive(DriveElement drive)
Move the drive in the DriveCollection.

Parameters:
drive - Drive that will be the target, the one that when another drive is dropped at it, will be movied to make place for the antoher drive.
Returns:

createChoice2Competence

public static AbstractAcceptAction createChoice2Competence(Competence competence)
Accept action for dropping choice to competence. Removes choice from its original place and adds it as first child of @competence.

Parameters:
competence - Competence that will accept dropped chocie
Returns:
Created action.

createChoice2Drive

public static AbstractAcceptAction createChoice2Drive(DriveElement drive)
Accept choice dropped onto a drive into a DriveCollection.

Parameters:
drive - Drive the choice is dropped onto.
Returns:
Accepting action

createDrive2Choice

public static AbstractAcceptAction createDrive2Choice(CompetenceElement choice)
Accept drive dropped onto a choice into a Competence.

Parameters:
choice - Choice the drive is dropped onto
Returns:
Accepting action

createDrive2Competence

public static AbstractAcceptAction createDrive2Competence(Competence competence)
Allow drive to be dropped onto a competence, convert drive to choice and add it as first child of competence.

Parameters:
competence - Competence at which the drive will be dropped
Returns:
Created accept action

createChoice2Choice

public static AbstractAcceptAction<CompetenceElement,CompetenceElement> createChoice2Choice(CompetenceElement targetChoice)
Create accept action for the @targetChoice for another CompetenceElement. When user drops a CompetenceElement to the @targetChoice, it will check if the dropped choice is in same Competence as the

Parameters:
targetChoice - Choice that will be accepting another choice to be dropped on it.
Returns:

createCompetence2Action

public static AbstractAcceptAction<Competence,TriggeredAction> createCompetence2Action(TriggeredAction targetAction)
Create an accept action for the @targetAction that will accept an competence, when dropped on it. If competence is a new one, it will also be added to the plan.

Parameters:
targetAction -
Returns:

createActionPatternAction

public static AbstractAcceptAction<ActionPattern,TriggeredAction> createActionPatternAction(TriggeredAction targetAction)
Create accept action the the TriggeredAction that will accept the ActionPattern. If the pattern is not part of the PoshPlan, add it. Once we are sure that AP is in the plan, change reference of the @targetAction to the AP.

Parameters:
targetAction - Target action that will accept dropped AP.
Returns:

createAction2Action

public static AbstractAcceptAction createAction2Action(TriggeredAction action)
This is complex accept action for an action with any parent. It is obvious that accept action for action in AP (insert action) should have different behavior from action in the DE (change action reference). This unified accept action can be used no matter what is the parent of the target action and no matter what is the parent of the source action. Possible parents of source action: ActionPattern, CompetenceElement, DriveElement and none for newly created action from palette. Possible parents of target action: ActionPattern, CompetenceElement, DriveElement. That gives us 12 combinations, that can be categorized like this: If source is AP, the source action will be removed from the AP, otherwise nothing will happen to the source. If target is AP, action will be inserted at the index of the target action, otherwise the target action will be synchronized with the source. If both target and source are from same AP, move source to the index of the target.

Parameters:
action -
Returns:

createSense2Choice

public static AbstractAcceptAction createSense2Choice(CompetenceElement targetChoice)
Create accept action where target choice will acc dropped sense as its first trigger sense.

Parameters:
targetChoice - Choice that will accept having sense dropped at it.
Returns:


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