org.argouml.cognitive
Class CompoundCritic

java.lang.Object
  extended by java.util.Observable
      extended by org.argouml.cognitive.Critic
          extended by org.argouml.cognitive.CompoundCritic
All Implemented Interfaces:
java.io.Serializable, Poster

public class CompoundCritic
extends Critic

A CompoundCritic acts like a regular critic in that it checks the design and produces design feedback. However, a CompoundCritic is composed of several regular critics that are applied in order. The first one that produces feedback ends the application. This is useful when criticism can be ordered from specific to general: general feedback should not be produced if specific feedback is available. For example, one critic might check for the legality of the name of a design element, and another might check for the presence of any name. If a given design element has no name, both critics could produce feedback, but it would be more useful if only the first one did.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.argouml.cognitive.Critic
DEFAULT_CLARIFIER, KT_COMPLETENESS, KT_CONSISTENCY, KT_CORRECTNESS, KT_DESIGNERS, KT_EXPERIENCIAL, KT_OPTIMIZATION, KT_ORGANIZATIONAL, KT_PRESENTATION, KT_SEMANTICS, KT_SYNTAX, KT_TOOL, NO_PROBLEM, PROBLEM_FOUND
 
Constructor Summary
CompoundCritic()
          The constructor of a compound critic.
CompoundCritic(Critic c1, Critic c2)
          The constructor.
CompoundCritic(Critic c1, Critic c2, Critic c3)
          The constructor.
CompoundCritic(Critic c1, Critic c2, Critic c3, Critic c4)
          The constructor.
 
Method Summary
 void addCritic(Critic c)
           
 void addExtraCriticizedDesignMaterial(java.lang.Object dm)
          Extra criticized design material to be added to the list returned by getCriticizedDesignMaterials()
 void addKnowledgeType(java.lang.String type)
           
 void addSupportedDecision(Decision d)
           
 void addSupportedGoal(Goal g)
           
 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 expand(java.lang.String desc, ListSet offs)
          Customize the description string just before it is displayed.
 javax.swing.Icon getClarifier()
           
 java.util.Set<java.lang.Object> getCriticizedDesignMaterials()
          Get the design materials to be criticized by this critic
 java.util.List<Critic> getCriticList()
           
 java.util.Vector<Critic> getCritics()
          Deprecated. for 0.25.4 by tfmorris. Use getCriticList(). Unused in ArgoUML. Can be scheduled for speedy removal.
 java.util.List<Decision> getSupportedDecisions()
           
 java.util.List<Goal> getSupportedGoals()
           
 boolean isActive()
          Reply true iff this Critic can execute.
 boolean isEnabled()
          This is a convient method for accessing one well-known control record.
 void removeCritic(Critic c)
           
 void setCritics(java.util.List<Critic> c)
           
 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()
           
 
Methods inherited from class org.argouml.cognitive.Critic
addControlRec, addTrigger, beActive, beInactive, canFixIt, defaultMoreInfoURL, fixIt, getArg, getArgs, getControlRec, getCriticCategory, getCriticKey, getCriticName, getCriticType, getDecisionCategory, getDescription, getDescriptionTemplate, getHeadline, getHeadline, getHeadline, getKnowledgeTypes, getMoreInfoURL, getMoreInfoURL, getPriority, getPriority, getTriggerMask, getWizardClass, initWizard, isRelevantToDecisions, isRelevantToGoals, isSnoozed, makeWizard, matchReason, postItem, predicate, reasonCodeFor, setArg, setArgs, setDecisionCategory, setDescription, setEnabled, setHeadline, setKnowledgeTypes, setKnowledgeTypes, setKnowledgeTypes, setKnowledgeTypes, setMoreInfoURL, setPriority, snooze, snoozeOrder, stillValid, unsnooze
 
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
 

Constructor Detail

CompoundCritic

public CompoundCritic()
The constructor of a compound critic.


CompoundCritic

public CompoundCritic(Critic c1,
                      Critic c2)
The constructor.

Parameters:
c1 - the first critic that makes up the compound critic
c2 - the 2nd critic that makes up the compound critic

CompoundCritic

public CompoundCritic(Critic c1,
                      Critic c2,
                      Critic c3)
The constructor.

Parameters:
c1 - the first critic that makes up the compound critic
c2 - the 2nd critic that makes up the compound critic
c3 - the 3rd critic that makes up the compound critic

CompoundCritic

public CompoundCritic(Critic c1,
                      Critic c2,
                      Critic c3,
                      Critic c4)
The constructor.

Parameters:
c1 - the first critic that makes up the compound critic
c2 - the 2nd critic that makes up the compound critic
c3 - the 3rd critic that makes up the compound critic
c4 - the 4th critic that makes up the compound critic
Method Detail

setCritics

public void setCritics(java.util.List<Critic> c)
Parameters:
c - the new list of critics that completely replaces the old list

getCritics

@Deprecated
public java.util.Vector<Critic> getCritics()
Deprecated. for 0.25.4 by tfmorris. Use getCriticList(). Unused in ArgoUML. Can be scheduled for speedy removal.

Returns:
the complete list of critics

getCriticList

public java.util.List<Critic> getCriticList()
Returns:
the complete list of critics

addCritic

public void addCritic(Critic c)
Parameters:
c - the critic to be added at the end of the current list

removeCritic

public void removeCritic(Critic c)
Parameters:
c - the critic to be removed

critique

public void critique(java.lang.Object dm,
                     Designer dsgr)
Description copied from class: Critic
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. By default this is basically a simple if-statement that relies on predicate() to determine if there is some appropriate feedback, and toDoItem() to produce the ToDoItem. The predicate() and toDoItem() pair of methods is simple and convient for many critics. More sophisticated critics that produce more than one ToDoItem per critiquing, or that produce ToDoItem's that contain information that was already computed in the predicate, should override critique. If you override this method, you should call super.critique().

Overrides:
critique in class Critic
Parameters:
dm - the design material
dsgr - the designer
See Also:
Critic.predicate(java.lang.Object, org.argouml.cognitive.Designer), Critic.toDoItem(java.lang.Object, org.argouml.cognitive.Designer)

supports

public boolean supports(Decision d)
Specified by:
supports in interface Poster
Overrides:
supports in class Critic
Parameters:
d - the decision
Returns:
true if the decision is still supported

getSupportedDecisions

public java.util.List<Decision> getSupportedDecisions()
Specified by:
getSupportedDecisions in interface Poster
Overrides:
getSupportedDecisions in class Critic
Returns:
the list of supported decisions

addSupportedDecision

public void addSupportedDecision(Decision d)
Overrides:
addSupportedDecision in class Critic
Parameters:
d - the decision

supports

public boolean supports(Goal g)
Specified by:
supports in interface Poster
Overrides:
supports in class Critic
Parameters:
g - the goal
Returns:
true if the goal is still supported

getSupportedGoals

public java.util.List<Goal> getSupportedGoals()
Specified by:
getSupportedGoals in interface Poster
Overrides:
getSupportedGoals in class Critic
Returns:
the list of supported goals

addSupportedGoal

public void addSupportedGoal(Goal g)
Overrides:
addSupportedGoal in class Critic
Parameters:
g - the goal

containsKnowledgeType

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

addKnowledgeType

public void addKnowledgeType(java.lang.String type)
Overrides:
addKnowledgeType in class Critic
Parameters:
type - the knowledgetype

expand

public java.lang.String expand(java.lang.String desc,
                               ListSet offs)
Description copied from interface: Poster
Customize the description string just before it is displayed.

Specified by:
expand in interface Poster
Overrides:
expand in class Critic
Parameters:
desc - the description
offs - the offenders
Returns:
the customized/expanded string

getClarifier

public javax.swing.Icon getClarifier()
Specified by:
getClarifier in interface Poster
Overrides:
getClarifier in class Critic
Returns:
the icon shown on the todo item to show the wizard's progress

isActive

public boolean isActive()
Description copied from class: Critic
Reply true iff this Critic can execute. This fact is normally determined by a ControlMech.

Overrides:
isActive in class Critic
Returns:
true iff this Critic can execute

isEnabled

public boolean isEnabled()
Description copied from class: Critic
This is a convient method for accessing one well-known control record. The enabled control record is a boolean that the user can turn on or off to manually enable or disable this Critic. It is normally combined with other ControlMech determinations with a logic-and.

Overrides:
isEnabled in class Critic
Returns:
true if enabled

toDoItem

public ToDoItem toDoItem(java.lang.Object dm,
                         Designer dsgr)
Description copied from class: Critic
Reply the ToDoItem that the designer should see iff predicate() returns true. By default it just fills in the fields of the ToDoItem from accessor methods of this Critic. Critic Subclasses may override this method or the accessor methods to add computed fields to the ToDoItem. TODO: Critic's may want to add new fields to a ToDoItem to make stillValid more efficent.

Overrides:
toDoItem in class Critic
Parameters:
dm - the offender
dsgr - the designer
Returns:
ToDoItem
See Also:
Critic.critique(java.lang.Object, org.argouml.cognitive.Designer)

getCriticizedDesignMaterials

public java.util.Set<java.lang.Object> getCriticizedDesignMaterials()
Description copied from class: Critic
Get the design materials to be criticized by this critic

Overrides:
getCriticizedDesignMaterials in class Critic
Returns:
the design materials

addExtraCriticizedDesignMaterial

public void addExtraCriticizedDesignMaterial(java.lang.Object dm)
Extra criticized design material to be added to the list returned by getCriticizedDesignMaterials()

Parameters:
dm - extra design material

toString

public java.lang.String toString()
Overrides:
toString in class Critic


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Cookbook