|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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 Hashtable |
args
Arguments used to configure the critic. |
private Icon |
clarifier
|
private Hashtable |
controlRecs
Control records used in determining if this Critic should be active. |
private String |
criticType
The decision type of this critic. |
private String |
decisionCategory
The decision category that this critic is relevant to. |
static Icon |
DEFAULT_CLARIFIER
The icon representing the resource. |
private String |
description
The description of the ToDoItem produced. |
private String |
emailAddr
The email address of the author/maintainer of this critic. |
private static String |
ENABLED
The keys of some predefined control records. |
private 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. |
private org.tigris.gef.util.VectorSet |
knowledgeTypes
|
static String |
KT_COMPLETENESS
Type of knowledge that critics can deliver |
static String |
KT_CONSISTENCY
Type of knowledge that critics can deliver |
static String |
KT_CORRECTNESS
Type of knowledge that critics can deliver |
static String |
KT_DESIGNERS
Type of knowledge that critics can deliver |
static String |
KT_EXPERIENCIAL
Type of knowledge that critics can deliver |
static String |
KT_OPTIMIZATION
Type of knowledge that critics can deliver |
static String |
KT_ORGANIZATIONAL
Type of knowledge that critics can deliver |
static String |
KT_PRESENTATION
Type of knowledge that critics can deliver |
static String |
KT_SEMANTICS
Type of knowledge that critics can deliver |
static String |
KT_SYNTAX
Type of knowledge that critics can deliver |
static String |
KT_TOOL
Type of knowledge that critics can deliver |
private static Logger |
LOG
Logger. |
private String |
moreInfoURL
The moreInfoURL of the ToDoItem produced. |
static boolean |
NO_PROBLEM
NO_PROBLEM is used for the result of the check of a critic. |
private static int |
numCriticsFired
|
private int |
priority
The priority of the ToDoItem produced. |
static boolean |
PROBLEM_FOUND
PROBLEM_FOUND is used for the result of the check of a critic. |
private static String |
SNOOZE_ORDER
|
private Vector |
supportedDecisions
|
private Vector |
supportedGoals
|
private long |
triggerMask
|
Constructor Summary | |
Critic()
Construct a new critic instance. |
Method Summary | |
Object |
addControlRec(String name,
Object controlData)
Add some attribute used by ControlMech to determine if this Critic should be active. |
void |
addKnowledgeType(String type)
|
void |
addSupportedDecision(Decision d)
|
void |
addSupportedGoal(Goal g)
|
void |
addTrigger(String s)
|
void |
beActive()
Make this critic active. |
void |
beInactive()
Make this critic inactive. |
boolean |
canFixIt(ToDoItem item)
TODO: Not implemented yet. |
boolean |
containsKnowledgeType(String type)
|
void |
critique(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. |
String |
defaultMoreInfoURL()
This function calculates the default url to describe this critic. |
String |
expand(String desc,
org.tigris.gef.util.VectorSet offs)
Customize the description string just before it is displayed. |
void |
fixIt(ToDoItem item,
Object arg)
TODO: Not implemented yet. |
protected Object |
getArg(String name)
|
Hashtable |
getArgs()
|
Icon |
getClarifier()
|
Object |
getControlRec(String name)
Reply the named control record, or null if not defined. |
String |
getCriticCategory()
Returns a default critic category. |
ConfigurationKey |
getCriticKey()
Returns the ConfigurationKey
that the critic uses to determine if it is enabled or disabled. |
String |
getCriticName()
Returns a default critic name. |
String |
getCriticType()
Reply a string used to contol critics according to type. |
String |
getDecisionCategory()
Reply a string used to determine if this critic would be relevant to current design decisions. |
String |
getDescription(org.tigris.gef.util.VectorSet offenders,
Designer dsgr)
Reply the description used in feedback produced by this Critic. |
String |
getDescriptionTemplate()
|
String |
getExpertEmail()
Reply the email address of the person who is the author or maintainer of this critic. |
String |
getHeadline()
Reply the headline used in feedback produced by this Critic. |
String |
getHeadline(Object dm,
Designer dsgr)
Reply the headline used in feedback produced by this Critic. |
String |
getHeadline(org.tigris.gef.util.VectorSet offenders,
Designer dsgr)
Reply the headline used in feedback produced by this Critic. |
org.tigris.gef.util.VectorSet |
getKnowledgeTypes()
|
String |
getMoreInfoURL()
|
String |
getMoreInfoURL(org.tigris.gef.util.VectorSet offenders,
Designer dsgr)
Reply the moreInfoURL used in feedback produced by this Critic. |
int |
getPriority()
|
int |
getPriority(org.tigris.gef.util.VectorSet offenders,
Designer dsgr)
Reply the priority used in feedback produced by this Critic. |
Vector |
getSupportedDecisions()
|
Vector |
getSupportedGoals()
|
long |
getTriggerMask()
|
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,
Object dm,
Designer dsgr)
|
boolean |
predicate(Object dm,
Designer dsgr)
Perform the Critic's analysis of the design. |
static int |
reasonCodeFor(String s)
|
protected void |
setArg(String name,
Object value)
|
void |
setArgs(Hashtable h)
|
protected void |
setDecisionCategory(String c)
Set the decisionCategory, usually done in the constructor. |
void |
setDescription(String d)
|
void |
setEnabled(boolean e)
|
void |
setExpertEmail(String addr)
Set the email address of the person who is the author or maintainer of this critic. |
void |
setHeadline(String h)
Set the headline used in feedback produced by this Critic. |
void |
setKnowledgeTypes(String t1)
Reset all knowledgetypes, and add the given one. |
void |
setKnowledgeTypes(String t1,
String t2)
Reset all knowledgetypes, and add the given ones. |
void |
setKnowledgeTypes(String t1,
String t2,
String t3)
Reset all knowledgetypes, and add the given ones. |
void |
setKnowledgeTypes(org.tigris.gef.util.VectorSet kt)
|
void |
setMoreInfoURL(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(Object dm,
Designer dsgr)
Reply the ToDoItem that the designer should see iff predicate() returns true. |
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 final Logger LOG
public static final boolean PROBLEM_FOUND
public static final boolean NO_PROBLEM
private static final String ENABLED
private static final String SNOOZE_ORDER
public static final String KT_DESIGNERS
public static final String KT_CORRECTNESS
public static final String KT_COMPLETENESS
public static final String KT_CONSISTENCY
public static final String KT_SYNTAX
public static final String KT_SEMANTICS
public static final String KT_OPTIMIZATION
public static final String KT_PRESENTATION
public static final String KT_ORGANIZATIONAL
public static final String KT_EXPERIENCIAL
public static final String KT_TOOL
private String emailAddr
private int priority
private String headline
private String description
private String moreInfoURL
private Hashtable args
public static final Icon DEFAULT_CLARIFIER
private Icon clarifier
private String decisionCategory
Decision categories are defined in the DecisionModel of a particular domain.
ControlMech
private Vector supportedDecisions
private Vector supportedGoals
private String criticType
private boolean isActive
private Hashtable controlRecs
private org.tigris.gef.util.VectorSet knowledgeTypes
private long triggerMask
private static int numCriticsFired
Constructor Detail |
public Critic()
Agency.register(java.lang.String, java.lang.String)
with that instance.
Method Detail |
public final 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:
Configuration.makeKey(java.lang.String)
,
getCriticCategory()
,
getCriticName()
public String getCriticCategory()
public String getCriticName()
public void critique(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, Object dm, Designer dsgr)
item
- the todo itemdm
- the designmaterialdsgr
- the designerpublic boolean predicate(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.
stillValid
in interface Poster
i
- the todo itemdsgr
- the designer
Poster.stillValid(
org.argouml.cognitive.ToDoItem, org.argouml.cognitive.Designer)
public boolean supports(Decision d)
supports
in interface Poster
d
- the decision
Poster.supports(org.argouml.cognitive.Decision)
public Vector getSupportedDecisions()
getSupportedDecisions
in interface Poster
Poster.getSupportedDecisions()
public void addSupportedDecision(Decision d)
d
- the decisionpublic boolean supports(Goal g)
supports
in interface Poster
g
- the goal
Poster.supports(org.argouml.cognitive.Goal)
public Vector getSupportedGoals()
getSupportedGoals
in interface Poster
Poster.getSupportedGoals()
public void addSupportedGoal(Goal g)
g
- the goalpublic boolean containsKnowledgeType(String type)
containsKnowledgeType
in interface Poster
type
- the knowledge type
Poster.containsKnowledgeType(java.lang.String)
public void addKnowledgeType(String type)
type
- the knowledgetypepublic org.tigris.gef.util.VectorSet getKnowledgeTypes()
public void setKnowledgeTypes(org.tigris.gef.util.VectorSet kt)
kt
- the knowledgetypespublic void setKnowledgeTypes(String t1)
t1
- the only knowledgetype in string formatpublic void setKnowledgeTypes(String t1, String t2)
t1
- a knowledgetype in string formatt2
- a knowledgetype in string formatpublic void setKnowledgeTypes(String t1, String t2, String t3)
t1
- a knowledgetype in string formatt2
- a knowledgetype in string formatt3
- a knowledgetype in string formatpublic static int reasonCodeFor(String s)
s
- the reason
public long getTriggerMask()
public void addTrigger(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 String expand(String desc, org.tigris.gef.util.VectorSet offs)
Poster
expand
in interface Poster
desc
- the descriptionoffs
- the offenders
Poster.expand(java.lang.String,
org.tigris.gef.util.VectorSet)
public Icon getClarifier()
getClarifier
in interface Poster
Poster.getClarifier()
public boolean isActive()
public void beActive()
public void beInactive()
public Object addControlRec(String name, Object controlData)
name
- the keycontrolData
- the value
null
if it did not have onepublic Object getControlRec(String name)
name
- the key
public boolean isEnabled()
public void setEnabled(boolean e)
e
- the value to be set for the key ENABLEDpublic SnoozeOrder snoozeOrder()
public void snooze()
snooze
in interface Poster
public void unsnooze()
unsnooze
in interface Poster
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 Wizard makeWizard(ToDoItem item)
item
- the todo item
public Class getWizardClass(ToDoItem item)
item
- the todo item
public void initWizard(Wizard w)
w
- the wizardpublic String getDecisionCategory()
protected void setDecisionCategory(String c)
c
- the categorypublic String getCriticType()
public String getExpertEmail()
getExpertEmail
in interface Poster
Poster.getExpertEmail()
public void setExpertEmail(String addr)
setExpertEmail
in interface Poster
addr
- the emailaddressPoster.setExpertEmail(java.lang.String)
public String getHeadline(Object dm, Designer dsgr)
dm
- the design materialdsgr
- the designer
public String getHeadline(org.tigris.gef.util.VectorSet offenders, Designer dsgr)
offenders
- the set of offendersdsgr
- the designer
public String getHeadline()
public void setHeadline(String h)
h
- the headlinepublic int getPriority(org.tigris.gef.util.VectorSet offenders, Designer dsgr)
offenders
- the offendersdsgr
- the designer
public void setPriority(int p)
p
- the prioritypublic int getPriority()
public String getDescription(org.tigris.gef.util.VectorSet offenders, Designer dsgr)
offenders
- the offendersdsgr
- the designer
public void setDescription(String d)
d
- the descriptionpublic String getDescriptionTemplate()
public String getMoreInfoURL(org.tigris.gef.util.VectorSet offenders, Designer dsgr)
offenders
- the offendersdsgr
- the designer
public void setMoreInfoURL(String m)
m
- the more-info-urlpublic String getMoreInfoURL()
protected void setArg(String name, Object value)
name
- the keyvalue
- the valueprotected Object getArg(String name)
name
- the key
public Hashtable getArgs()
public void setArgs(Hashtable h)
h
- the new table of (key, value) pairspublic ToDoItem toDoItem(Object dm, Designer dsgr)
critique(java.lang.Object, org.argouml.cognitive.Designer)
public boolean canFixIt(ToDoItem item)
canFixIt
in interface Poster
item
- the todo item
fixIt(org.argouml.cognitive.ToDoItem, java.lang.Object)
public void fixIt(ToDoItem item, Object arg)
fixIt
in interface Poster
item
- the todo itemarg
- the design material (?)canFixIt(org.argouml.cognitive.ToDoItem)
public String toString()
Object.toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20050222) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |