org.argouml.cognitive
Class Designer

java.lang.Object
  extended byorg.argouml.cognitive.Designer
All Implemented Interfaces:
EventListener, Poster, PropertyChangeListener, Runnable

public final class Designer
extends Object
implements Poster, Runnable, 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.

This class listens to property changes from ...?

A Designer can as well create ToDO Items, such as critics do. Hence he implements the Poster interface.


Field Summary
static org.argouml.application.api.ConfigurationKey AUTO_CRITIQUE
          The key to remember persistently the latest choice made for the menuitem Toggle Auto-Critique.
static String MODEL_TODOITEM_ADDED
          Property Names.
static String MODEL_TODOITEM_DISMISSED
          Property Names.
 
Method Summary
static void addListener(PropertyChangeListener pcl)
          Adds a property change listener.
 boolean canFixIt(ToDoItem item)
          Just returns false.
static void clearCritiquing()
          Clear all critiquing results.
 boolean containsKnowledgeType(String type)
           
 void critique(Object des)
          Look for potential problems or open issues in the given design.
 void critiqueASAP(Object dm, 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.
 void disruptivelyWarn(ToDoItem item)
          Inform the human designer that there is an urgent ToDoItem that (s)he must consider before doing any more work.
 int disruptiveThreshold()
          Used to determine which ToDoItems are urgent.
static void enableCritiquing()
          Enable critiquing.
 String expand(String desc, ListSet offs)
          Just returns the descr param.
static void firePropertyChange(String property, Object oldValue, Object newValue)
           
 void fixIt(ToDoItem item, Object arg)
          Does not do anything.
 org.argouml.cognitive.critics.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.
 ChildGenerator getChildGenerator()
           
 Icon getClarifier()
          Get the generic clarifier for this designer/poster.
 int getCritiquingInterval()
          Get the Critiquing interval.
static Object getCritiquingRoot()
           
 DecisionModel getDecisionModel()
           
 String getDesignerName()
          query the name of the designer.
 String getExpertEmail()
          Get some contact information on the Poster.
 GoalModel getGoalModel()
           
 Vector getGoals()
           
 Properties getPrefs()
          Reply the designers personal preferneces.
 Vector getSupportedDecisions()
           
 Vector getSupportedGoals()
           
 ToDoList getToDoList()
           
 boolean hasGoal(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 nondisruptivelyWarn(ToDoItem item)
          Inform the human designer that there is a ToDoItem that is relevant to his design work, and allow him to consider it on his own initiative.
 void propertyChange(PropertyChangeEvent pce)
          Performs critique asap.
static void removeListener(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(ChildGenerator cg)
           
 void setClarifier(Icon clar)
          Get the generic clarifier for this designer/poster.
 void setCritiquingInterval(int i)
          Set the Critiquing Interval.
static void setCritiquingRoot(Object d)
           
 void setDecisionPriority(String decision, int priority)
          Record the extent to which the designer is considering the given decision.
 void setDesignerName(String name)
          set the name of this designer.
 void setExpertEmail(String addr)
          Update the Poster's contact info.
 void setGoalPriority(String goal, int priority)
           
static void setSaveAction(Action theSaveAction)
          Setter for saveAction.
static void setUserWorking(boolean working)
           
 void snooze()
          Temporarily disable this Poster.
 void spawnCritiquer(Object root)
          Start a separate thread to continually select and execute critics that are relevant to this designer's work.
 void startDesiring(String goal)
           
 boolean stillValid(ToDoItem i, Designer d)
          This method returns true.
 void stopDesiring(String goal)
           
 boolean supports(Decision d)
           
 boolean supports(Goal g)
           
static Designer theDesigner()
           
 String toString()
          This is used in the todo panel, when "By Poster" is chosen for a manually created todo item.
 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.application.api.ConfigurationKey AUTO_CRITIQUE
The key to remember persistently the latest choice made for the menuitem Toggle Auto-Critique.


MODEL_TODOITEM_ADDED

public static final String MODEL_TODOITEM_ADDED
Property Names.

See Also:
Constant Field Values

MODEL_TODOITEM_DISMISSED

public static final 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(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 Runnable

critiqueASAP

public void critiqueASAP(Object dm,
                         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(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(PropertyChangeListener pcl)
Adds a property change listener.

Parameters:
pcl - The property change listener to add

removeListener

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

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

setSaveAction

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

Parameters:
theSaveAction - The new saveAction.

firePropertyChange

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

propertyChange

public void propertyChange(PropertyChangeEvent pce)
Performs critique asap.

Specified by:
propertyChange in interface PropertyChangeListener
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

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 -
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(Object d)
Parameters:
d - the critiquing root

getCritiquingRoot

public static Object getCritiquingRoot()
Returns:
the critiquing root

getChildGenerator

public ChildGenerator getChildGenerator()
Returns:
the childgenerator

setChildGenerator

public void setChildGenerator(ChildGenerator cg)
Parameters:
cg - the childgenerator

getDecisionModel

public DecisionModel getDecisionModel()
Returns:
the decisions

getGoalModel

public GoalModel getGoalModel()
Returns:
the goals

getGoals

public Vector getGoals()
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
See Also:
Poster.supports(org.argouml.cognitive.Decision)

getSupportedDecisions

public Vector getSupportedDecisions()
Specified by:
getSupportedDecisions in interface Poster
Returns:
the list of supported decisions
See Also:
Poster.getSupportedDecisions()

supports

public boolean supports(Goal g)
Specified by:
supports in interface Poster
Parameters:
g - the goal
Returns:
true if the goal is still supported
See Also:
Poster.supports(org.argouml.cognitive.Goal)

getSupportedGoals

public Vector getSupportedGoals()
Specified by:
getSupportedGoals in interface Poster
Returns:
the list of supported goals
See Also:
Poster.getSupportedGoals()

containsKnowledgeType

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

expand

public String expand(String desc,
                     ListSet offs)
Just returns the descr param.

Specified by:
expand in interface Poster
Parameters:
desc - the description
offs - the offenders
Returns:
the customized/expanded string
See Also:
Poster.expand(java.lang.String, ListSet)

getClarifier

public Icon getClarifier()
Get the generic clarifier for this designer/poster.

Specified by:
getClarifier in interface Poster
Returns:
the icon shown on the todo item to show the wizard's progress
See Also:
Poster.getClarifier()

setClarifier

public void setClarifier(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 Properties getPrefs()
Reply the designers personal preferneces. 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(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(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(String goal,
                            int priority)
Parameters:
goal - the given goal
priority - the priority

startDesiring

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

stopDesiring

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

getExpertEmail

public String getExpertEmail()
Description copied from interface: Poster
Get some contact information on the Poster.

Specified by:
getExpertEmail in interface Poster
Returns:
the email address of the poster
See Also:
Poster.getExpertEmail()

setExpertEmail

public void setExpertEmail(String addr)
Description copied from interface: Poster
Update the Poster's contact info. Is this needed?

Specified by:
setExpertEmail in interface Poster
Parameters:
addr - the emailaddress
See Also:
Poster.setExpertEmail(java.lang.String)

snooze

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

Specified by:
snooze in interface Poster
See Also:
Poster.snooze()

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
See Also:
Poster.unsnooze()

getAgency

public org.argouml.cognitive.critics.Agency getAgency()
Reply the Agency object that is helping this Designer.

Returns:
my agancy

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

disruptivelyWarn

public void disruptivelyWarn(ToDoItem item)
Inform the human designer that there is an urgent ToDoItem that (s)he must consider before doing any more work. Currently not implemented.

Parameters:
item - the todoitem

nondisruptivelyWarn

public void nondisruptivelyWarn(ToDoItem item)
Inform the human designer that there is a ToDoItem that is relevant to his design work, and allow him to consider it on his own initiative.

Parameters:
item - the todo item

disruptiveThreshold

public int disruptiveThreshold()
Used to determine which ToDoItems are urgent. Just returns the value 9.

Returns:
from this priority, we warn disruptively

setDesignerName

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

Parameters:
name - the designer name

getDesignerName

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

Returns:
the designer name

toString

public String toString()
This is used in the todo panel, when "By Poster" is chosen for a manually created todo item.

See Also:
Object.toString()

fixIt

public void fixIt(ToDoItem item,
                  Object arg)
Does not do anything.

Specified by:
fixIt in interface Poster
Parameters:
item - the todo item
arg - the design material (?)
See Also:
Poster.fixIt(org.argouml.cognitive.ToDoItem, java.lang.Object)

canFixIt

public boolean canFixIt(ToDoItem item)
Just returns false.

Specified by:
canFixIt in interface Poster
Parameters:
item - the todo item
Returns:
true if it can be fixed
See Also:
Poster.canFixIt(org.argouml.cognitive.ToDoItem)

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