Ignore:
Timestamp:
04/04/13 16:06:07 (11 years ago)
Author:
pharms
Message:
  • complete refactoring of task tree model with a separation of task models and task instances
  • appropriate adaptation of task tree generation process
  • appropriate adaptation of commands and task tree visualization
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Optional.java

    r1126 r1146  
    1616 
    1717import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
    18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 
     18import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    1919 
    2020/** 
     
    2424 * @author 2012, last modified by $Author: patrick$ 
    2525 */ 
    26 public class Optional extends TaskTreeNode implements IOptional { 
     26class Optional extends MarkingTemporalRelationship implements IOptional { 
     27 
     28    /**  */ 
     29    private static final long serialVersionUID = 1L; 
    2730 
    2831    /** 
     
    3033     */ 
    3134    Optional() { 
    32         super("Optional"); 
     35        super("optionality"); 
    3336    } 
    34  
    35     /* 
    36      * (non-Javadoc) 
    37      *  
    38      * @see de.ugoe.cs.tasktree.treeifc.TaskTreeNode#addChild(TaskTreeNode) 
     37     
     38    /* (non-Javadoc) 
     39     * @see MarkingTemporalRelationship#setMarkedTask(ITask) 
    3940     */ 
    4041    @Override 
    41     public void addChild(ITaskTreeNode child) { 
    42         // adding more children is not allowed 
    43         throw new UnsupportedOperationException 
    44             ("optionalities may not have a list of children. Use setChild() instead."); 
    45     } 
    46  
    47     /** 
    48      * TODO: comment 
    49      *  
    50      * @param selection 
    51      * @return 
    52      */ 
    53     public void setChild(ITaskTreeNode child) { 
    54         if (super.getChildren().size() > 0) { 
    55             super.removeChild(0); 
     42    protected void setMarkedTask(ITask markedTask) { 
     43        if (markedTask instanceof IOptional) { 
     44            throw new IllegalArgumentException 
     45                ("the marked task of an optional must not be an optional"); 
    5646        } 
    57         super.addChild(child); 
     47         
     48        super.setMarkedTask(markedTask); 
    5849    } 
    5950 
     
    6758        return (Optional) super.clone(); 
    6859    } 
    69  
    7060} 
Note: See TracChangeset for help on using the changeset viewer.