|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
org.argouml.cognitive.Critic
public class 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 | |
|---|---|
static javax.swing.Icon |
DEFAULT_CLARIFIER
The icon representing the resource. |
static java.lang.String |
KT_COMPLETENESS
Type of knowledge that critics can deliver. |
static java.lang.String |
KT_CONSISTENCY
Type of knowledge that critics can deliver. |
static java.lang.String |
KT_CORRECTNESS
Type of knowledge that critics can deliver. |
static java.lang.String |
KT_DESIGNERS
Type of knowledge that critics can deliver. |
static java.lang.String |
KT_EXPERIENCIAL
Type of knowledge that critics can deliver. |
static java.lang.String |
KT_OPTIMIZATION
Type of knowledge that critics can deliver. |
static java.lang.String |
KT_ORGANIZATIONAL
Type of knowledge that critics can deliver. |
static java.lang.String |
KT_PRESENTATION
Type of knowledge that critics can deliver. |
static java.lang.String |
KT_SEMANTICS
Type of knowledge that critics can deliver. |
static java.lang.String |
KT_SYNTAX
Type of knowledge that critics can deliver. |
static java.lang.String |
KT_TOOL
Type of knowledge that critics can deliver. |
static boolean |
NO_PROBLEM
NO_PROBLEM is used for the result of the check of a critic. |
static boolean |
PROBLEM_FOUND
PROBLEM_FOUND is used for the result of the check of a critic. |
| 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)
|
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,
ListSet offs)
Customize the description string just before it is displayed. |
void |
fixIt(ToDoItem item,
java.lang.Object arg)
TODO: Not implemented yet. |
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. |
java.util.Set<java.lang.Object> |
getCriticizedDesignMaterials()
Get the design materials to be criticized by this critic |
org.argouml.configuration.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(ListSet offenders,
Designer dsgr)
Reply the description used in feedback produced by this Critic. |
java.lang.String |
getDescriptionTemplate()
|
java.lang.String |
getHeadline()
Reply the headline used in feedback produced by this Critic. |
java.lang.String |
getHeadline(ListSet offenders,
Designer dsgr)
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. |
ListSet<java.lang.String> |
getKnowledgeTypes()
|
java.lang.String |
getMoreInfoURL()
|
java.lang.String |
getMoreInfoURL(ListSet offenders,
Designer dsgr)
Reply the moreInfoURL used in feedback produced by this Critic. |
int |
getPriority()
|
int |
getPriority(ListSet offenders,
Designer dsgr)
Reply the priority used in feedback produced by this Critic. |
java.util.List<Decision> |
getSupportedDecisions()
|
java.util.List<Goal> |
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(org.argouml.cognitive.critics.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. |
boolean |
isSnoozed()
Checks if the critic is currently snoozed. |
org.argouml.cognitive.critics.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 |
setDecisionCategory(java.lang.String c)
Set the decisionCategory, usually done in the constructor. |
void |
setDescription(java.lang.String d)
|
void |
setEnabled(boolean e)
|
void |
setHeadline(java.lang.String h)
Set the headline used in feedback produced by this Critic. |
void |
setKnowledgeTypes(ListSet<java.lang.String> kt)
|
void |
setKnowledgeTypes(java.lang.String t1)
Reset all knowledgetypes, and add the given one. |
void |
setKnowledgeTypes(java.lang.String t1,
java.lang.String t2)
Reset all knowledgetypes, and add the given ones. |
void |
setKnowledgeTypes(java.lang.String t1,
java.lang.String t2,
java.lang.String t3)
Reset all knowledgetypes, and add the given ones. |
void |
setMoreInfoURL(java.lang.String m)
|
void |
setPriority(int p)
|
void |
snooze()
Disable this Critic for the next few minutes. |
org.argouml.cognitive.critics.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()
|
void |
unsnooze()
Lift any previous SnoozeOrder. |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final boolean PROBLEM_FOUND
public static final boolean NO_PROBLEM
public static final java.lang.String KT_DESIGNERS
public static final java.lang.String KT_CORRECTNESS
public static final java.lang.String KT_COMPLETENESS
public static final java.lang.String KT_CONSISTENCY
public static final java.lang.String KT_SYNTAX
public static final java.lang.String KT_SEMANTICS
public static final java.lang.String KT_OPTIMIZATION
public static final java.lang.String KT_PRESENTATION
public static final java.lang.String KT_ORGANIZATIONAL
public static final java.lang.String KT_EXPERIENCIAL
public static final java.lang.String KT_TOOL
public static final javax.swing.Icon DEFAULT_CLARIFIER
| Constructor Detail |
|---|
public Critic()
Agency.register(Critic, Object) with that instance.
| Method Detail |
|---|
public final java.lang.String defaultMoreInfoURL()
public org.argouml.configuration.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:
Configuration.makeKey(String,
String, String),
getCriticCategory(),
getCriticName()public java.lang.String getCriticCategory()
public java.lang.String getCriticName()
public void critique(java.lang.Object dm,
Designer dsgr)
dm - the design materialdsgr - the designerpredicate(java.lang.Object, org.argouml.cognitive.Designer),
toDoItem(java.lang.Object, org.argouml.cognitive.Designer)
public void postItem(ToDoItem item,
java.lang.Object dm,
Designer dsgr)
item - the todo itemdm - the designmaterial/offender to be informeddsgr - the designer
public boolean predicate(java.lang.Object dm,
Designer dsgr)
dm - the design material, which is to be checkeddsgr - the designer
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. Reply true if the given item should be kept on the Designer's ToDoList, false if it is no longer valid.
stillValid in interface Posteri - the todo itemdsgr - the designer
public boolean supports(Decision d)
supports in interface Posterd - the decision
public java.util.List<Decision> getSupportedDecisions()
getSupportedDecisions in interface Posterpublic void addSupportedDecision(Decision d)
d - the decisionpublic boolean supports(Goal g)
supports in interface Posterg - the goal
public java.util.List<Goal> getSupportedGoals()
getSupportedGoals in interface Posterpublic void addSupportedGoal(Goal g)
g - the goalpublic boolean containsKnowledgeType(java.lang.String type)
containsKnowledgeType in interface Postertype - the knowledge type
public void addKnowledgeType(java.lang.String type)
type - the knowledgetypepublic ListSet<java.lang.String> getKnowledgeTypes()
public void setKnowledgeTypes(ListSet<java.lang.String> kt)
kt - the knowledgetypespublic void setKnowledgeTypes(java.lang.String t1)
t1 - the only knowledgetype in string format
public void setKnowledgeTypes(java.lang.String t1,
java.lang.String t2)
t1 - a knowledgetype in string formatt2 - a knowledgetype in string format
public void setKnowledgeTypes(java.lang.String t1,
java.lang.String t2,
java.lang.String t3)
t1 - a knowledgetype in string formatt2 - a knowledgetype in string formatt3 - a knowledgetype in string formatpublic static int reasonCodeFor(java.lang.String s)
s - the reason
public long getTriggerMask()
public void addTrigger(java.lang.String s)
s - the trigger to be added (is ORed into the mask)public boolean matchReason(long patternCode)
patternCode - the mask to be checked
public java.lang.String expand(java.lang.String desc,
ListSet offs)
Poster
expand in interface Posterdesc - the descriptionoffs - the offenders
public javax.swing.Icon getClarifier()
getClarifier in interface Posterpublic boolean isActive()
public void beActive()
public void beInactive()
public java.lang.Object addControlRec(java.lang.String name,
java.lang.Object controlData)
name - the keycontrolData - the value
null
if it did not have onepublic java.lang.Object getControlRec(java.lang.String name)
name - the key
public boolean isEnabled()
public void setEnabled(boolean e)
e - the value to be set for the key ENABLEDpublic org.argouml.cognitive.critics.SnoozeOrder snoozeOrder()
public void snooze()
snooze in interface Posterpublic void unsnooze()
unsnooze in interface Posterpublic boolean isSnoozed()
public boolean isRelevantToDecisions(Designer dsgr)
dsgr - the designer
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.
dsgr - the designer
public org.argouml.cognitive.critics.Wizard makeWizard(ToDoItem item)
item - the todo item
public java.lang.Class getWizardClass(ToDoItem item)
item - the todo item
public void initWizard(org.argouml.cognitive.critics.Wizard w)
w - the wizardpublic java.lang.String getDecisionCategory()
protected void setDecisionCategory(java.lang.String c)
c - the categorypublic java.lang.String getCriticType()
public java.lang.String getHeadline(java.lang.Object dm,
Designer dsgr)
dm - the design materialdsgr - the designer
public java.lang.String getHeadline(ListSet offenders,
Designer dsgr)
offenders - the set of offendersdsgr - the designer
public java.lang.String getHeadline()
public void setHeadline(java.lang.String h)
h - the headline
public int getPriority(ListSet offenders,
Designer dsgr)
offenders - the offendersdsgr - the designer
public void setPriority(int p)
p - the prioritypublic int getPriority()
public java.lang.String getDescription(ListSet offenders,
Designer dsgr)
offenders - the offendersdsgr - the designer
public void setDescription(java.lang.String d)
d - the descriptionpublic java.lang.String getDescriptionTemplate()
public java.lang.String getMoreInfoURL(ListSet offenders,
Designer dsgr)
offenders - the offendersdsgr - the designer
public void setMoreInfoURL(java.lang.String m)
m - the more-info-urlpublic java.lang.String getMoreInfoURL()
public java.util.Set<java.lang.Object> getCriticizedDesignMaterials()
public ToDoItem toDoItem(java.lang.Object dm,
Designer dsgr)
dm - the offenderdsgr - the designer
critique(java.lang.Object, org.argouml.cognitive.Designer)public boolean canFixIt(ToDoItem item)
canFixIt in interface Posteritem - the todo item
public void fixIt(ToDoItem item,
java.lang.Object arg)
Poster
fixIt in interface Posteritem - the todo itemarg - the design material (?)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-2006 | ArgoUML Homepage | ArgoUML Cookbook |