org.argouml.cognitive
Class Designer

java.lang.Object
  extended by org.argouml.cognitive.Designer
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.lang.Runnable, java.util.EventListener, Poster

public final class Designer
extends java.lang.Object
implements Poster, java.lang.Runnable, java.beans.PropertyChangeListener

This class models the designer who is building a complex design in some application domain and needs continuous feedback to aid in the making of good design decisions.

This area needs work, especially as it is a central idea of Argo.

Currently (almost) everything is hardcoded. What can be configurable??

The ToDoList is dependent on this class, i.e. each designer has its ToDoList.

Each designer has his own Agency, which is the only class that knows all the critics.

This class listens to property changes from ...?

A designer can create ToDo Items, just like the critics. Hence the designer implements the Poster interface.

TODO: There is a strong dependency cycle between Agency and Designer. They either need to be merged into a single class or partitioned differently, perhaps using an interface to break the cycle. The Designer singleton gets passed to almost every single part of the Critic subsystem, creating strong coupling throughout. - tfm 20070620


Field Summary
static org.argouml.configuration.ConfigurationKey AUTO_CRITIQUE
          The key to remember persistently the latest choice made for the menuitem Toggle Auto-Critique.
static java.lang.String MODEL_TODOITEM_ADDED
          Property Names.
static java.lang.String MODEL_TODOITEM_DISMISSED
          Property Names.
 
Method Summary
static void addListener(java.beans.PropertyChangeListener pcl)
          Adds a property change listener.
 boolean canFixIt(ToDoItem item)
           
static void clearCritiquing()
          Clear all critiquing results.
 boolean containsKnowledgeType(java.lang.String type)
           
 void critique(java.lang.Object des)
          Look for potential problems or open issues in the given design.
 void critiqueASAP(java.lang.Object dm, java.lang.String reason)
          A modelelement has been changed.
 void determineActiveCritics()
          Ask this designer's agency to select which critics should be active.
static void disableCritiquing()
          Disable critiquing.
static void enableCritiquing()
          Enable critiquing.
 java.lang.String expand(java.lang.String desc, ListSet offs)
          Customize the description string just before it is displayed.
static void firePropertyChange(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
           
 void fixIt(ToDoItem item, java.lang.Object arg)
          TODO: Not implemented yet.
 Agency getAgency()
          Reply the Agency object that is helping this Designer.
 boolean getAutoCritique()
          autoCritique and critiquingInterval are two prameters that control how the critiquing thread operates.
 org.tigris.gef.util.ChildGenerator getChildGenerator()
           
 javax.swing.Icon getClarifier()
           
 int getCritiquingInterval()
          Get the Critiquing interval.
static java.lang.Object getCritiquingRoot()
           
 DecisionModel getDecisionModel()
           
 java.lang.String getDesignerName()
          query the name of the designer.
 java.util.List<Goal> getGoalList()
           
 GoalModel getGoalModel()
           
 java.util.Vector<Goal> getGoals()
          Deprecated. for 0.25.4 by tfmorris. Use getGoalList().
 java.util.Properties getPrefs()
          Reply the designers personal preferences.
 java.util.List<Decision> getSupportedDecisions()
           
 java.util.List<Goal> getSupportedGoals()
           
 ToDoList getToDoList()
           
 boolean hasGoal(java.lang.String goal)
          Record the extent to which the designer desires the given goal.
 void inform(ToDoItem item)
          Inform the human designer using this system that the given ToDoItem should be considered.
 boolean isConsidering(Decision d)
           
static boolean isUserWorking()
           
 void propertyChange(java.beans.PropertyChangeEvent pce)
           
static void removeListener(java.beans.PropertyChangeListener p)
          Removes a property change listener.
 void removeToDoItems(ToDoList list)
          Remove all the items in the given list from my list.
 void run()
          Continuously select and execute critics against this designer's design.
 void setAutoCritique(boolean b)
           
 void setChildGenerator(org.tigris.gef.util.ChildGenerator cg)
           
 void setClarifier(javax.swing.Icon clar)
          Get the generic clarifier for this designer/poster.
 void setCritiquingInterval(int i)
          Set the Critiquing Interval.
static void setCritiquingRoot(java.lang.Object d)
           
 void setDecisionPriority(java.lang.String decision, int priority)
          Record the extent to which the designer is considering the given decision.
 void setDesignerName(java.lang.String name)
          set the name of this designer.
 void setGoalPriority(java.lang.String goal, int priority)
           
static void setSaveAction(javax.swing.Action theSaveAction)
          Setter for saveAction.
static void setUserWorking(boolean working)
           
 void snooze()
          Temporarily disable this Poster.
 void spawnCritiquer(java.lang.Object root)
          Start a separate thread to continually select and execute critics that are relevant to this designer's work.
 void startDesiring(java.lang.String goal)
           
 boolean stillValid(ToDoItem i, Designer d)
          This method returns true.
 void stopDesiring(java.lang.String goal)
           
 boolean supports(Decision d)
           
 boolean supports(Goal g)
           
static Designer theDesigner()
           
 java.lang.String toString()
           
 void unsnooze()
          Unsnooze this Poster, it may resume posting without further delay.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AUTO_CRITIQUE

public static final org.argouml.configuration.ConfigurationKey AUTO_CRITIQUE
The key to remember persistently the latest choice made for the menuitem Toggle Auto-Critique.


MODEL_TODOITEM_ADDED

public static final java.lang.String MODEL_TODOITEM_ADDED
Property Names.

See Also:
Constant Field Values

MODEL_TODOITEM_DISMISSED

public static final java.lang.String MODEL_TODOITEM_DISMISSED
Property Names.

See Also:
Constant Field Values
Method Detail

theDesigner

public static Designer theDesigner()
Returns:
the designer singleton

spawnCritiquer

public void spawnCritiquer(java.lang.Object root)
Start a separate thread to continually select and execute critics that are relevant to this designer's work.

Parameters:
root - the rootobject the critiques will check

run

public void run()
Continuously select and execute critics against this designer's design. spawnCritiquer(Object) is used to start a Thread that runs this.

Specified by:
run in interface java.lang.Runnable

critiqueASAP

public void critiqueASAP(java.lang.Object dm,
                         java.lang.String reason)
A modelelement has been changed. Now we give it priority to be checked by the critics ASAP. TODO: why is is synchronised? TODO: what about when objects are first created?

Parameters:
dm - the design material
reason - the reason

critique

public void critique(java.lang.Object des)
Look for potential problems or open issues in the given design. This is currently done by invoking the Agency.

Parameters:
des - the design to be checked

addListener

public static void addListener(java.beans.PropertyChangeListener pcl)
Adds a property change listener.

Parameters:
pcl - The property change listener to add

removeListener

public static void removeListener(java.beans.PropertyChangeListener p)
Removes a property change listener.

Parameters:
p - The class to remove as a property change listener.

setSaveAction

public static void setSaveAction(javax.swing.Action theSaveAction)
Setter for saveAction.

Parameters:
theSaveAction - The new saveAction.

firePropertyChange

public static void firePropertyChange(java.lang.String property,
                                      java.lang.Object oldValue,
                                      java.lang.Object newValue)
Parameters:
property - the property name
oldValue - the old value
newValue - the new value

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent pce)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

determineActiveCritics

public void determineActiveCritics()
Ask this designer's agency to select which critics should be active.


getAutoCritique

public boolean getAutoCritique()
autoCritique and critiquingInterval are two prameters that control how the critiquing thread operates. If autoCritique is false then now critiquing is done in the background. The critiquingInterval determines how often the critiquing thread executes. The concept of an interval between runs will become less important as Argo is redesigned to be more trigger driven.

Returns:
autoCritique

setAutoCritique

public void setAutoCritique(boolean b)
Parameters:
b - true to set auto critique on, false for off
See Also:
getAutoCritique()

getCritiquingInterval

public int getCritiquingInterval()
Get the Critiquing interval.

Returns:
The interval.

setCritiquingInterval

public void setCritiquingInterval(int i)
Set the Critiquing Interval.

Parameters:
i - The new interval.

disableCritiquing

public static void disableCritiquing()
Disable critiquing.


enableCritiquing

public static void enableCritiquing()
Enable critiquing.


clearCritiquing

public static void clearCritiquing()
Clear all critiquing results.


setCritiquingRoot

public static void setCritiquingRoot(java.lang.Object d)
Parameters:
d - the critiquing root

getCritiquingRoot

public static java.lang.Object getCritiquingRoot()
Returns:
the critiquing root

getChildGenerator

public org.tigris.gef.util.ChildGenerator getChildGenerator()
Returns:
the childgenerator

setChildGenerator

public void setChildGenerator(org.tigris.gef.util.ChildGenerator cg)
Parameters:
cg - the childgenerator

getDecisionModel

public DecisionModel getDecisionModel()
Returns:
the decisions

getGoalModel

public GoalModel getGoalModel()
Returns:
the goals

getGoals

@Deprecated
public java.util.Vector<Goal> getGoals()
Deprecated. for 0.25.4 by tfmorris. Use getGoalList().

Returns:
the goals

getGoalList

public java.util.List<Goal> getGoalList()
Returns:
the goals.

stillValid

public boolean stillValid(ToDoItem i,
                          Designer d)
This method returns true.

ToDoItem's that are posted by the designer are assumed to be valid until the designer explicitly removes them. Perhaps in the future the designer could specify a condition to determine when his items expire.

Specified by:
stillValid in interface Poster
Parameters:
i - the todo item
d - the designer
Returns:
true if still valid
See Also:
ToDoItem, Critic.stillValid(org.argouml.cognitive.ToDoItem, org.argouml.cognitive.Designer), Poster.stillValid( org.argouml.cognitive.ToDoItem, org.argouml.cognitive.Designer)

supports

public boolean supports(Decision d)
Specified by:
supports in interface Poster
Parameters:
d - the decision
Returns:
true if the decision is still supported

getSupportedDecisions

public java.util.List<Decision> getSupportedDecisions()
Specified by:
getSupportedDecisions in interface Poster
Returns:
the list of supported decisions

supports

public boolean supports(Goal g)
Specified by:
supports in interface Poster
Parameters:
g - the goal
Returns:
true if the goal is still supported

getSupportedGoals

public java.util.List<Goal> getSupportedGoals()
Specified by:
getSupportedGoals in interface Poster
Returns:
the list of supported goals

containsKnowledgeType

public boolean containsKnowledgeType(java.lang.String type)
Specified by:
containsKnowledgeType in interface Poster
Parameters:
type - the knowledge type
Returns:
true if it is valid

expand

public java.lang.String expand(java.lang.String desc,
                               ListSet offs)
Description copied from interface: Poster
Customize the description string just before it is displayed.

Specified by:
expand in interface Poster
Parameters:
desc - the description
offs - the offenders
Returns:
the customized/expanded string

getClarifier

public javax.swing.Icon getClarifier()
Specified by:
getClarifier in interface Poster
Returns:
the icon shown on the todo item to show the wizard's progress

setClarifier

public void setClarifier(javax.swing.Icon clar)
Get the generic clarifier for this designer/poster.

Parameters:
clar - the clarifier icon

getToDoList

public ToDoList getToDoList()
Returns:
this Designer's ToDoList, a list of pending problems and issues that the designer might be interested in.
See Also:
ToDoList

removeToDoItems

public void removeToDoItems(ToDoList list)
Remove all the items in the given list from my list.

Parameters:
list - the items to be removed

getPrefs

public java.util.Properties getPrefs()
Reply the designers personal preferences. Currently not used (?).

Returns:
the preferences

isConsidering

public boolean isConsidering(Decision d)
Parameters:
d - the decision
Returns:
true if the given decision is considered

setDecisionPriority

public void setDecisionPriority(java.lang.String decision,
                                int priority)
Record the extent to which the designer is considering the given decision.

Parameters:
decision - the decision
priority - the priority

hasGoal

public boolean hasGoal(java.lang.String goal)
Record the extent to which the designer desires the given goal.

Parameters:
goal - the given goal
Returns:
true if this goal is desired

setGoalPriority

public void setGoalPriority(java.lang.String goal,
                            int priority)
Parameters:
goal - the given goal
priority - the priority

startDesiring

public void startDesiring(java.lang.String goal)
Parameters:
goal - the goal I (me, the designer) desire

stopDesiring

public void stopDesiring(java.lang.String goal)
Parameters:
goal - the goal that is not desired any more

snooze

public void snooze()
Description copied from interface: Poster
Temporarily disable this Poster.

Specified by:
snooze in interface Poster

unsnooze

public void unsnooze()
Description copied from interface: Poster
Unsnooze this Poster, it may resume posting without further delay.

Specified by:
unsnooze in interface Poster

getAgency

public Agency getAgency()
Reply the Agency object that is helping this Designer.

Returns:
my agency

inform

public void inform(ToDoItem item)
Inform the human designer using this system that the given ToDoItem should be considered. This can be disruptive if the item is urgent, or (more commonly) it is added to his ToDoList so that he can consider it at his leisure.

Parameters:
item - the todo item

setDesignerName

public void setDesignerName(java.lang.String name)
set the name of this designer.

Parameters:
name - the designer name

getDesignerName

public java.lang.String getDesignerName()
query the name of the designer.

Returns:
the designer name

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

fixIt

public void fixIt(ToDoItem item,
                  java.lang.Object arg)
Description copied from interface: Poster
TODO: Not implemented yet. If the given ToDoItem can be fixed automatically, and the user wants that to happen, then do it. Obviously, this depends on the specific Critic and problem. By default this method does nothing.

Specified by:
fixIt in interface Poster
Parameters:
item - the todo item
arg - the design material (?)

canFixIt

public boolean canFixIt(ToDoItem item)
Specified by:
canFixIt in interface Poster
Parameters:
item - the todo item
Returns:
true if it can be fixed

setUserWorking

public static void setUserWorking(boolean working)
Parameters:
working - true if the user is working (i.e. this is not the startup phase of ArgoUML)

isUserWorking

public static boolean isUserWorking()
Returns:
true if the user is working (i.e. this is not the startup phase of ArgoUML)


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Cookbook