org.argouml.uml.cognitive.critics
Class CrUML

java.lang.Object
  extended by java.util.Observable
      extended by org.argouml.cognitive.Critic
          extended by org.argouml.uml.cognitive.critics.CrUML
All Implemented Interfaces:
java.io.Serializable, Poster
Direct Known Subclasses:
AbstractCrTooMany, AbstractCrUnconventionalName, CrAlreadyRealizes, CrAssocNameConflict, CrAttrNameConflict, CrCircularAssocClass, CrCircularComposition, CrCircularInheritance, CrClassMustBeAbstract, CrClassWithoutComponent, CrCompInstanceWithoutNode, CrComponentInstanceWithoutClassifier, CrComponentWithoutNode, CrConflictingComposites, CrConsiderFacade, CrConsiderSingleton, CrConstructorNeeded, CrCrossNamespaceAssoc, CrDisambigClassName, CrDisambigStateName, CrDupParamName, CrDupRoleNames, CrEmptyPackage, CrFinalSubclassed, CrForkOutgoingTransition, CrIllegalGeneralization, CrIllegalName, CrInstanceWithoutClassifier, CrInterfaceAllPublic, CrInterfaceOperOnly, CrInterfaceWithoutComponent, CrInvalidBranch, CrInvalidFork, CrInvalidForkTriggerOrGuard, CrInvalidHistory, CrInvalidInitial, CrInvalidJoin, CrInvalidJoinTriggerOrGuard, CrInvalidPseudoStateTrigger, CrInvalidSynch, CrJoinIncomingTransition, CrMergeClasses, CrMissingAttrName, CrMissingClassName, CrMissingOperName, CrMissingStateName, CrMultiComposite, CrMultipleAgg, CrMultipleDeepHistoryStates, CrMultipleInitialStates, CrMultipleShallowHistoryStates, CrNameConflict, CrNameConflictAC, CrNameConfusion, CrNavFromInterface, CrNoAssociations, CrNodeInsideElement, CrNodeInstanceInsideElement, CrNodeInstanceWithoutClassifier, CrNodesOverlap, CrNoGuard, CrNoIncomingTransitions, CrNoInitialState, CrNoInstanceVariables, CrNonAggDataType, CrNoOperations, CrNoOutgoingTransitions, CrNoTransitions, CrNoTriggerOrGuard, CrNWayAgg, CrObjectWithoutClassifier, CrObjectWithoutComponent, CrOCL, CrOperNameConflict, CrOppEndConflict, CrOppEndVsAttr, CrProfile, CrReservedName, CrSeqInstanceWithoutClassifier, CrSingletonViolatedMissingStaticAttr, CrSingletonViolatedOnlyPrivateConstructors, CrSubclassReference, CrUnnavigableAssoc, CrUselessAbstract, CrUselessInterface, CrUtilityViolated, CrWrongDepEnds, CrWrongLinkEnds, CrZeroLengthEdge

public class CrUML
extends Critic

"Abstract" Critic subclass that captures commonalities among all critics in the UML domain. This class also defines and registers the categories of design decisions that the critics can address. IT also deals with particular UMLToDoItems.

See Also:
Designer, DecisionModel, 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
CrUML()
          The constructor for this class.
CrUML(java.lang.String nonDefaultLocalizationPrefix)
          The constructor for this class overriding the default localization resource.
 
Method Summary
 java.lang.String expand(java.lang.String res, ListSet offs)
          Expand text with ocl brackets in it.
protected  java.lang.String getDefaultSuggestion()
          Loads the localized wizard's default suggestion.
protected  java.lang.String getInstructions()
          Loads the localized wizard's instruction.
protected  java.lang.String getLocalizedString(java.lang.String suffix)
          Returns a localized string for the current critic class.
protected  java.lang.String getLocalizedString(java.lang.String key, java.lang.String suffix)
          Returns a localized string for the given key and suffix.
 boolean predicate(java.lang.Object dm, Designer dsgr)
          Perform the Critic's analysis of the design.
 boolean predicate2(java.lang.Object dm, Designer dsgr)
          This is the decision routine for the critic.
 void setResource(java.lang.String key)
          Set the resources for this critic based on the class name.
 void setupHeadAndDesc()
          Set up the locale specific text for the critic headline (the one liner that appears in the to-do pane) and the critic description (the detailed explanation that appears in the to-do tab of the details pane).
 ToDoItem toDoItem(java.lang.Object dm, Designer dsgr)
          Reply the ToDoItem that the designer should see iff predicate() returns true.
 
Methods inherited from class org.argouml.cognitive.Critic
addControlRec, addKnowledgeType, addSupportedDecision, addSupportedGoal, addTrigger, beActive, beInactive, canFixIt, containsKnowledgeType, critique, defaultMoreInfoURL, fixIt, getClarifier, getControlRec, getCriticCategory, getCriticizedDesignMaterials, getCriticKey, getCriticName, getCriticType, getDecisionCategory, getDescription, getDescriptionTemplate, getHeadline, getHeadline, getHeadline, getKnowledgeTypes, getMoreInfoURL, getMoreInfoURL, getPriority, getPriority, getSupportedDecisions, getSupportedGoals, getTriggerMask, getWizardClass, initWizard, isActive, isEnabled, isRelevantToDecisions, isRelevantToGoals, isSnoozed, makeWizard, matchReason, postItem, reasonCodeFor, setDecisionCategory, setDescription, setEnabled, setHeadline, setKnowledgeTypes, setKnowledgeTypes, setKnowledgeTypes, setKnowledgeTypes, setMoreInfoURL, setPriority, snooze, snoozeOrder, stillValid, supports, supports, toString, 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

CrUML

public CrUML()
The constructor for this class.


CrUML

public CrUML(java.lang.String nonDefaultLocalizationPrefix)
The constructor for this class overriding the default localization resource.

Parameters:
nonDefaultLocalizationPrefix - the overriding localization resource
Method Detail

setResource

public void setResource(java.lang.String key)
Set the resources for this critic based on the class name.

Parameters:
key - is the class name.

getLocalizedString

protected java.lang.String getLocalizedString(java.lang.String suffix)
Returns a localized string for the current critic class.

Parameters:
suffix - the suffix of the key
Returns:
the localized string

getLocalizedString

protected java.lang.String getLocalizedString(java.lang.String key,
                                              java.lang.String suffix)
Returns a localized string for the given key and suffix.

Parameters:
key - the main key
suffix - the suffix of the key
Returns:
the localized string

getInstructions

protected java.lang.String getInstructions()
Loads the localized wizard's instruction.

Returns:
the instructions

getDefaultSuggestion

protected java.lang.String getDefaultSuggestion()
Loads the localized wizard's default suggestion.

Returns:
the default suggestion

setupHeadAndDesc

public final void setupHeadAndDesc()
Set up the locale specific text for the critic headline (the one liner that appears in the to-do pane) and the critic description (the detailed explanation that appears in the to-do tab of the details pane).


predicate

public boolean predicate(java.lang.Object dm,
                         Designer dsgr)
Description copied from class: Critic
Perform the Critic's analysis of the design. Subclasses should test the given Object to make sure that it is the type of object that is expected. Each object in the design registers its own critics with the run-time system. The dm parameter is bound to each design object that registered this critic, one per call. Returning true means that feedback should be delivered to the Designer. By convention, subclasses should return their superclass predicate method if their own predicate would return false.

Overrides:
predicate in class Critic
Parameters:
dm - the design material, which is to be checked
dsgr - the designer
Returns:
the critic result

predicate2

public boolean predicate2(java.lang.Object dm,
                          Designer dsgr)
This is the decision routine for the critic.

Parameters:
dm - is the UML entity that is being checked.
dsgr - is for future development and can be ignored.
Returns:
boolean problem found

expand

public java.lang.String expand(java.lang.String res,
                               ListSet offs)
Expand text with ocl brackets in it. No recursive expansion.

Specified by:
expand in interface Poster
Overrides:
expand in class Critic
Parameters:
res - is the text to expand.
offs - is the elements to replace
Returns:
the expanded text

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)


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook