|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.argouml.cognitive.critics.Critic
"Abstract" base class for design critics. Each subclass should define its own predicate method and define its own relevance tags.
A critic supports design goals and decisions, which can be adjusted accordingly. It will post todo items which may or may not be relevant to the particular designer.
Steps to follow when adding a critic are listed in the Argo cookbook under define_critic.
Field Summary | |
---|---|
private java.util.Hashtable |
_args
Arguments used to configure the critic. |
protected javax.swing.Icon |
_clarifier
|
private java.util.Hashtable |
_controlRecs
Control records used in determining if this Critic should be active. |
private java.lang.String |
_criticType
The decision type of this critic. |
private java.lang.String |
_decisionCategory
The decision category that this critic is relevant to. |
private java.lang.String |
_description
The description of the ToDoItem produced. |
private java.lang.String |
_emailAddr
The email address of the author/maintainer of this critic. |
private java.lang.String |
_headline
The headline of the ToDoItem produced. |
private boolean |
_isActive
Internal flag that stores the end result of all ControlMech evaluations of this critic. |
protected VectorSet |
_knowledgeTypes
|
private java.lang.String |
_moreInfoURL
The moreInfoURL of the ToDoItem produced. |
static int |
_numCriticsFired
|
private int |
_priority
The priority of the ToDoItem produced. |
protected java.util.Vector |
_supportedDecisions
|
protected java.util.Vector |
_supportedGoals
|
protected long |
_triggerMask
|
private static Logger |
cat
logger |
static javax.swing.Icon |
DEFAULT_CLARIFIER
The icon representing the resource. |
static java.lang.String |
ENABLED
The keys of some predefined control records. |
static java.lang.String |
KT_COMPLETENESS
|
static java.lang.String |
KT_CONSISTENCY
|
static java.lang.String |
KT_CORRECTNESS
|
static java.lang.String |
KT_DESIGNERS
Types of knowledge that critics can deliver |
static java.lang.String |
KT_EXPERIENCIAL
|
static java.lang.String |
KT_OPTIMIZATION
|
static java.lang.String |
KT_ORGANIZATIONAL
|
static java.lang.String |
KT_PRESENTATION
|
static java.lang.String |
KT_SEMANTICS
|
static java.lang.String |
KT_SYNTAX
|
static java.lang.String |
KT_TOOL
|
static boolean |
NO_PROBLEM
|
static boolean |
PROBLEM_FOUND
|
static java.lang.String |
SNOOZE_ORDER
|
Constructor Summary | |
---|---|
Critic()
Construct a new critic instance. |
Method Summary | |
---|---|
java.lang.Object |
addControlRec(java.lang.String name,
java.lang.Object controlData)
Add some attribute used by ControlMech to determine if this Critic should be active. |
void |
addKnowledgeType(java.lang.String type)
|
void |
addSupportedDecision(Decision d)
|
void |
addSupportedGoal(Goal g)
|
void |
addTrigger(java.lang.String s)
|
void |
beActive()
Make this critic active. |
void |
beInactive()
Make this critic inactive. |
boolean |
canFixIt(ToDoItem item)
TODO: Not implemented yet. |
boolean |
containsKnowledgeType(java.lang.String type)
|
void |
critique(java.lang.Object dm,
Designer dsgr)
Examine the given Object and Designer and, if appropriate, produce one or more ToDoItem's and add them to the offending design material's and the Designer's ToDoList. |
java.lang.String |
defaultMoreInfoURL()
This function calculates the default url to describe this critic. |
java.lang.String |
expand(java.lang.String desc,
VectorSet offs)
Customize the description string just before it is displayed. |
void |
fixIt(ToDoItem item,
java.lang.Object arg)
TODO: Not implemented yet. |
protected java.lang.Object |
getArg(java.lang.String name)
|
java.util.Hashtable |
getArgs()
|
javax.swing.Icon |
getClarifier()
|
java.lang.Object |
getControlRec(java.lang.String name)
Reply the named control record, or null if not defined. |
java.lang.String |
getCriticCategory()
Returns a default critic category. |
ConfigurationKey |
getCriticKey()
Returns the ConfigurationKey
that the critic uses to determine if it is enabled or disabled. |
java.lang.String |
getCriticName()
Returns a default critic name. |
java.lang.String |
getCriticType()
Reply a string used to contol critics according to type. |
java.lang.String |
getDecisionCategory()
Reply a string used to determine if this critic would be relevant to current design decisions. |
java.lang.String |
getDescription(VectorSet offenders,
Designer dsgr)
Reply the description used in feedback produced by this Critic. |
java.lang.String |
getDescriptionTemplate()
|
java.lang.String |
getExpertEmail()
Reply the email address of the person who is the author or maintainer of this critic. |
java.lang.String |
getHeadline()
Reply the headline used in feedback produced by this Critic. |
java.lang.String |
getHeadline(java.lang.Object dm,
Designer dsgr)
Reply the headline used in feedback produced by this Critic. |
java.lang.String |
getMoreInfoURL()
|
java.lang.String |
getMoreInfoURL(VectorSet offenders,
Designer dsgr)
Reply the moreInfoURL used in feedback produced by this Critic. |
int |
getPriority()
|
int |
getPriority(VectorSet offenders,
Designer dsgr)
Reply the priority used in feedback produced by this Critic. |
java.util.Vector |
getSupportedDecisions()
|
java.util.Vector |
getSupportedGoals()
|
long |
getTriggerMask()
|
java.lang.Class |
getWizardClass(ToDoItem item)
Return the Class of wizard that can fix the problem identifed by this critic. |
void |
initWizard(Wizard w)
Initialize a newly created wizard with information found by the critic. |
boolean |
isActive()
Reply true iff this Critic can execute. |
boolean |
isEnabled()
This is a convient method for accessing one well-known control record. |
boolean |
isRelevantToDecisions(Designer dsgr)
Reply true if this Critic is relevant to the decisions that the Designer is considering. |
boolean |
isRelevantToGoals(Designer dsgr)
Reply true iff this Critic is relevant to the goals that the Designer is trying to achieve. |
Wizard |
makeWizard(ToDoItem item)
Create a new Wizard to help the user fix the identified problem. |
boolean |
matchReason(long patternCode)
|
void |
postItem(ToDoItem item,
java.lang.Object dm,
Designer dsgr)
|
boolean |
predicate(java.lang.Object dm,
Designer dsgr)
Perform the Critic's analysis of the design. |
static int |
reasonCodeFor(java.lang.String s)
|
protected void |
setArg(java.lang.String name,
java.lang.Object value)
|
void |
setArgs(java.util.Hashtable h)
|
protected void |
setDecisionCategory(java.lang.String c)
Set the decisionCategory, usually done in the constructor. |
void |
setDescription(java.lang.String d)
|
void |
setEnabled(boolean e)
|
void |
setExpertEmail(java.lang.String addr)
Set the email address of the person who is the author or maintainer of this critic. |
void |
setHeadline(java.lang.String h)
Set the headline used in feedback produced by this Critic. |
void |
setKnowledgeTypes(java.lang.String t1,
java.lang.String t2)
|
void |
setKnowledgeTypes(java.lang.String t1,
java.lang.String t2,
java.lang.String t3)
|
void |
setKnowledgeTypes(VectorSet kt)
|
void |
setMoreInfoURL(java.lang.String m)
|
void |
setPriority(int p)
|
void |
snooze()
Disable this Critic for the next few minutes. |
SnoozeOrder |
snoozeOrder()
Reply the SnoozeOrder that is defined for this critic. |
boolean |
stillValid(ToDoItem i,
Designer dsgr)
Return true iff the given ToDoItem is still valid and should be kept in the given designers ToDoList. |
boolean |
supports(Decision d)
|
boolean |
supports(Goal g)
|
ToDoItem |
toDoItem(java.lang.Object dm,
Designer dsgr)
Reply the ToDoItem that the designer should see iff predicate() returns true. |
java.lang.String |
toString()
Reply a string that describes this Critic. |
void |
unsnooze()
Lift any previous SnoozeOrder. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static Logger cat
public static final boolean PROBLEM_FOUND
public static final boolean NO_PROBLEM
public static final java.lang.String ENABLED
public static final java.lang.String SNOOZE_ORDER
public static java.lang.String KT_DESIGNERS
public static java.lang.String KT_CORRECTNESS
public static java.lang.String KT_COMPLETENESS
public static java.lang.String KT_CONSISTENCY
public static java.lang.String KT_SYNTAX
public static java.lang.String KT_SEMANTICS
public static java.lang.String KT_OPTIMIZATION
public static java.lang.String KT_PRESENTATION
public static java.lang.String KT_ORGANIZATIONAL
public static java.lang.String KT_EXPERIENCIAL
public static java.lang.String KT_TOOL
private java.lang.String _emailAddr
private int _priority
private java.lang.String _headline
private java.lang.String _description
private java.lang.String _moreInfoURL
private java.util.Hashtable _args
public static javax.swing.Icon DEFAULT_CLARIFIER
protected javax.swing.Icon _clarifier
private java.lang.String _decisionCategory
Decision categories are defined in the DecisionModel of a particular domain.
ControlMech
protected java.util.Vector _supportedDecisions
protected java.util.Vector _supportedGoals
private java.lang.String _criticType
private boolean _isActive
private java.util.Hashtable _controlRecs
protected VectorSet _knowledgeTypes
protected long _triggerMask
public static int _numCriticsFired
Constructor Detail |
public Critic()
Agency.register(java.lang.String, java.lang.String)
with that instance.
Method Detail |
public final java.lang.String defaultMoreInfoURL()
public ConfigurationKey getCriticKey()
ConfigurationKey
that the critic uses to determine if it is enabled or disabled.
The string resulting from the ConfigurationKey
argo.critic.critic_category.critic_name
.
critic_category
would describe the type of critic and is
taken from getCriticCategory()
.
critic_name
would describe the function of the critic
and is taken from getCriticName()
.
Some examples:
argo.critic.layout.Overlap
argo.critic.uml.ReservedWord
argo.critic.java.ReservedWord
argo.critic.idl.ReservedWord
Configuration.makeKey(java.lang.String)
,
getCriticCategory()
,
getCriticName()
public java.lang.String getCriticCategory()
public java.lang.String getCriticName()
public void critique(java.lang.Object dm, Designer dsgr)
# @see Critic#toDoItem
public void postItem(ToDoItem item, java.lang.Object dm, Designer dsgr)
public boolean predicate(java.lang.Object dm, Designer dsgr)
public boolean stillValid(ToDoItem i, Designer dsgr)
By default this method basically asks the critic to again critique the offending Object and then it checks if the resulting ToDoItem is the same as the one already posted. This is simple and it works fine for light-weight critics. Critics that expend a lot of computational effort in making feedback that can be easily check to see if it still holds, should override this method.
TODO: Maybe ToDoItem should carry some data to make this method more efficient.
stillValid
in interface Poster
public boolean supports(Decision d)
supports
in interface Poster
public java.util.Vector getSupportedDecisions()
getSupportedDecisions
in interface Poster
public void addSupportedDecision(Decision d)
public boolean supports(Goal g)
supports
in interface Poster
public java.util.Vector getSupportedGoals()
getSupportedGoals
in interface Poster
public void addSupportedGoal(Goal g)
public boolean containsKnowledgeType(java.lang.String type)
containsKnowledgeType
in interface Poster
public void addKnowledgeType(java.lang.String type)
public void setKnowledgeTypes(VectorSet kt)
public void setKnowledgeTypes(java.lang.String t1, java.lang.String t2)
public void setKnowledgeTypes(java.lang.String t1, java.lang.String t2, java.lang.String t3)
public static int reasonCodeFor(java.lang.String s)
public long getTriggerMask()
public void addTrigger(java.lang.String s)
public boolean matchReason(long patternCode)
public java.lang.String expand(java.lang.String desc, VectorSet offs)
Poster
expand
in interface Poster
public javax.swing.Icon getClarifier()
getClarifier
in interface Poster
public boolean isActive()
public void beActive()
public void beInactive()
public java.lang.Object addControlRec(java.lang.String name, java.lang.Object controlData)
public java.lang.Object getControlRec(java.lang.String name)
public boolean isEnabled()
public void setEnabled(boolean e)
public SnoozeOrder snoozeOrder()
public void snooze()
snooze
in interface Poster
public void unsnooze()
unsnooze
in interface Poster
public boolean isRelevantToDecisions(Designer dsgr)
public boolean isRelevantToGoals(Designer dsgr)
TODO: I would like a better default action, but goals are typed and their values must be interperted by critics. They are not as generic as the DecisionModel.
public Wizard makeWizard(ToDoItem item)
public java.lang.Class getWizardClass(ToDoItem item)
public void initWizard(Wizard w)
public java.lang.String getDecisionCategory()
protected void setDecisionCategory(java.lang.String c)
public java.lang.String getCriticType()
public java.lang.String getExpertEmail()
getExpertEmail
in interface Poster
public void setExpertEmail(java.lang.String addr)
setExpertEmail
in interface Poster
public java.lang.String getHeadline(java.lang.Object dm, Designer dsgr)
public java.lang.String getHeadline()
public void setHeadline(java.lang.String h)
public int getPriority(VectorSet offenders, Designer dsgr)
public void setPriority(int p)
public int getPriority()
public java.lang.String getDescription(VectorSet offenders, Designer dsgr)
public void setDescription(java.lang.String d)
public java.lang.String getDescriptionTemplate()
public java.lang.String getMoreInfoURL(VectorSet offenders, Designer dsgr)
public void setMoreInfoURL(java.lang.String m)
public java.lang.String getMoreInfoURL()
protected void setArg(java.lang.String name, java.lang.Object value)
protected java.lang.Object getArg(java.lang.String name)
public java.util.Hashtable getArgs()
public void setArgs(java.util.Hashtable h)
public ToDoItem toDoItem(java.lang.Object dm, Designer dsgr)
critique(java.lang.Object, org.argouml.cognitive.Designer)
public boolean canFixIt(ToDoItem item)
canFixIt
in interface Poster
fixIt(org.argouml.cognitive.ToDoItem, java.lang.Object)
public void fixIt(ToDoItem item, java.lang.Object arg)
fixIt
in interface Poster
canFixIt(org.argouml.cognitive.ToDoItem)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20040306) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |