org.argouml.cognitive
Class Designer

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

public class Designer
extends Object
implements Poster, Runnable, PropertyChangeListener, Serializable

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.

See Also:
Serialized Form

Nested Class Summary
(package private)  class Designer.ChildGenDMElements
           
 
Field Summary
private  Vector addQueue
           
private  Vector addReasonQueue
           
private  Agency agency
          Each designer has their own Agency instance that is responsible for selecting and executing critics that are relevant to this designer on an on going basis.
private  boolean autoCritique
           
private  org.tigris.gef.util.ChildGenerator childGenerator
           
private  Icon clarifier
           
private  int critiqueCPUPercent
           
private  long critiqueDuration
           
private  int critiqueLock
           
private  Thread critiquerThread
           
private  int critiquingInterval
           
private static Object critiquingRoot
           
private  DecisionModel decisions
          The decisions currently being considered by the designer.
private  String designerName
          The designerName is the name of the current user, as he can enter in the menuitem Edit->Settings...->User->Full Name.
private  String emailAddr
          The email address where other designers can send this designer email.
private  GoalModel goals
          The goals of the designer are likewise used by the Agency to determine what critics are relevant.
private  Vector hotQueue
          dm's that should be critiqued ASAP.
private  Vector hotReasonQueue
           
private  long lastCritique
           
private static Logger LOG
          Logger.
private static int longestAdd
           
private static int longestHot
           
static String MODEL_TODOITEM_ADDED
          Property Names
static String MODEL_TODOITEM_DISMISSED
          Property Names
private static PropertyChangeSupport pcs
           
private  Properties prefs
          Preferences -- very ill defined
private  Vector removeQueue
           
private static Designer theDesignerSingleton
          the singleton of this class.
private  ToDoList toDoList
          ToDoList items that are on the designers ToDoList because of this material.
private static Vector unspecDecisionVector
           
private static Vector unspecGoalVector
           
private static boolean userWorking
           
private  Vector warmQueue
          dm's that should be critiqued relatively soon.
 
Constructor Summary
private Designer()
          The constructor.
 
Method Summary
static void addListener(PropertyChangeListener pcl)
          Adds a property change listener.
 void addToDoItems(ToDoList list)
          Add all the items in the given list to my list.
 boolean canFixIt(ToDoItem item)
          Just returns false.
static void clearCritiquing()
          Clear all critiquing results.
 boolean containsKnowledgeType(String type)
           
 void critique(Design des)
          Look for potential problems or open issues in the given design.
 void critiqueASAP(Object dm, String reason)
          A modelelement has been changed.
 void defineDecision(String decision, int priority)
           
 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, org.tigris.gef.util.VectorSet 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.
 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()
           
 Icon getClarifier()
          Get the generic clarifier for this designer/poster.
 int getCritiquingInterval()
          Get the Critiquing interval.
static Object getCritiquingRoot()
           
 DecisionModel getDecisionModel()
           
 Vector getDecisions()
           
 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()
          Reply this Designer's ToDoList, a list of pending problems and issues that the designer might be interested in.
 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)
           
 boolean isConsidering(String decision)
          Reply true iff the designer is currently considering the given decison.
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(org.tigris.gef.util.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 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 startConsidering(Decision d)
           
 void startConsidering(String decision)
           
 void startDesiring(String goal)
           
 boolean stillValid(ToDoItem i, Designer d)
          This method returns true.
 void stopConsidering(Decision d)
           
 void stopConsidering(String decision)
           
 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

LOG

private static final Logger LOG
Logger.


theDesignerSingleton

private static Designer theDesignerSingleton
the singleton of this class.


userWorking

private static boolean userWorking

unspecDecisionVector

private static Vector unspecDecisionVector

unspecGoalVector

private static Vector unspecGoalVector

toDoList

private ToDoList toDoList
ToDoList items that are on the designers ToDoList because of this material.


prefs

private Properties prefs
Preferences -- very ill defined


emailAddr

private String emailAddr
The email address where other designers can send this designer email. This is not used yet.


designerName

private String designerName
The designerName is the name of the current user, as he can enter in the menuitem Edit->Settings...->User->Full Name.

The designerName gets updated when the user enters a new name.


decisions

private DecisionModel decisions
The decisions currently being considered by the designer.

Decisions are currently modeled as simple descriptive strings.

Each decision also has a priority number which is ill defined, but positive Ints mean that the designer is considering it. This explicit representation of what decisions the designer is interested in at a given moment allows the Agency to select relevant critics for execution.


goals

private GoalModel goals
The goals of the designer are likewise used by the Agency to determine what critics are relevant.


agency

private Agency agency
Each designer has their own Agency instance that is responsible for selecting and executing critics that are relevant to this designer on an on going basis.


clarifier

private Icon clarifier

critiquerThread

private Thread critiquerThread

critiquingInterval

private int critiquingInterval

critiqueCPUPercent

private int critiqueCPUPercent

autoCritique

private boolean autoCritique

hotQueue

private Vector hotQueue
dm's that should be critiqued ASAP.


hotReasonQueue

private Vector hotReasonQueue

addQueue

private Vector addQueue

addReasonQueue

private Vector addReasonQueue

removeQueue

private Vector removeQueue

longestAdd

private static int longestAdd

longestHot

private static int longestHot

warmQueue

private Vector warmQueue
dm's that should be critiqued relatively soon.


childGenerator

private org.tigris.gef.util.ChildGenerator childGenerator

critiquingRoot

private static Object critiquingRoot

critiqueDuration

private long critiqueDuration

critiqueLock

private int critiqueLock

lastCritique

private long lastCritique

pcs

private static PropertyChangeSupport pcs

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
Constructor Detail

Designer

private Designer()
The constructor.

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 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(Design des)
Look for potential problems or open issues in the given design.

Parameters:
des - the design to be checked

addListener

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

Parameters:
pcl - The property change listener to add

removeListener

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

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

firePropertyChange

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

getDecisions

public Vector getDecisions()
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,
                     org.tigris.gef.util.VectorSet 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, org.tigris.gef.util.VectorSet)

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()
Reply this Designer's ToDoList, a list of pending problems and issues that the designer might be interested in.

See Also:
ToDoList

addToDoItems

public void addToDoItems(ToDoList list)
Add all the items in the given list to my list.

Parameters:
list - the items to be added

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(String decision)
Reply true iff the designer is currently considering the given decison.

Parameters:
decision - the decision
Returns:
true if considered

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

defineDecision

public void defineDecision(String decision,
                           int priority)
Parameters:
decision - the decision
priority - the priority

startConsidering

public void startConsidering(String decision)
Parameters:
decision - the decision

startConsidering

public void startConsidering(Decision d)
Parameters:
d - the decision

stopConsidering

public void stopConsidering(String decision)
Parameters:
decision - the decision

stopConsidering

public void stopConsidering(Decision d)
Parameters:
d - the decision

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 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-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook