|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
org.argouml.cognitive.critics.Agency
Agency manages Critics. Since classes are not really first class objects in java, a singleton instance of Agency is made and passed around as needed. The Agency keeps a registry of all Critics that should be applied to each type of design material. When a design material instance is critiqued it asks Agency to apply all registered Critic's. In the current scheme there is a thread that proactively, continuously critiques the Design at hand, even if the user is idle! This is simple and it works. The disadvantage is that _all_ active critics related to a given design material are applied, regardless of the reason for the critiquing and a lot of CPU time is basically wasted.
TODO: I am moving toward a more reactionary scheme in which specific design manipulations in the editor cause critics relevant to those manipulations to be applied. This transition is still half done. Trigger's are the critiquing requests. The code for triggers is currently dormant (latent?).
Field Summary | |
private static Hashtable |
cachedCritics
|
private ControlMech |
controlMech
The main control mechanism for determining which critics should be active. |
private static Hashtable |
criticRegistry
A registery of all critics that are currently loaded into the design environment. |
private static Vector |
critics
|
private static Logger |
LOG
|
private static int |
numCriticsApplied
|
private static Hashtable |
singletonCritics
|
Fields inherited from class java.util.Observable |
|
Constructor Summary | |
Agency()
Contruct a new Agency instance and use a StandardCM as the main control mechanism for determining which critics should be active. |
|
Agency(ControlMech cm)
Contruct a new Agency instance with the given ControlMech as the main control mechanism for determining which critics should be active. |
Method Summary | |
protected static void |
addCritic(Critic cr)
|
static void |
addStaticObserver(Observer obs)
Let some object recieve notifications when the Agency changes state. |
static void |
applyAllCritics(Object dm,
Designer d)
|
static void |
applyAllCritics(Object dm,
Designer d,
long reasonCode)
Apply all critics that can be applied to the given design material instance as appropriate for the given Designer. |
static void |
applyCritics(Object dm,
Designer d,
Collection theCritics,
long reasonCode)
|
static Collection |
criticsForClass(Class clazz)
Return a collection of all critics that can be applied to the design material subclass, including inherited critics. |
protected static Vector |
criticsForSpecificClass(Class clazz)
Return the Vector of all critics that are directly
associated with the given design material subclass. |
void |
determineActiveCritics(Designer d)
Compute which critics should be active (i.e., they can be applied by applyAllCritics) for a given Designer. |
private static Hashtable |
getCriticRegistry()
Reply the registery. |
static Vector |
getCritics()
|
static void |
notifyStaticObservers(Object o)
When the agency changes, notify observers. |
static void |
register(Critic cr,
Object clazz)
Register a critic in the global table of critics that have been loaded. |
static void |
register(String crClassName,
String dmClassName)
|
static Agency |
theAgency()
Since Java does not really suport classes as first class objects, there is one instance of Agency that is passed around as needed. |
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, toString, wait, wait, wait |
Field Detail |
private static final Logger LOG
private static Hashtable criticRegistry
private static Vector critics
private ControlMech controlMech
private static int numCriticsApplied
private static Hashtable singletonCritics
private static Hashtable cachedCritics
Constructor Detail |
public Agency(ControlMech cm)
cm
- the given controlMechpublic Agency()
Method Detail |
public static Agency theAgency()
Designer.theDesigner()
private static Hashtable getCriticRegistry()
public static Vector getCritics()
protected static void addCritic(Critic cr)
cr
- the critic to add/registerpublic static void register(String crClassName, String dmClassName)
crClassName
- the critic class namedmClassName
- the design material class namepublic static void register(Critic cr, Object clazz)
cr
- the critic to registerclazz
- the design material class that is to be criticizedpublic static Collection criticsForClass(Class clazz)
clazz
- the design material to criticize
protected static Vector criticsForSpecificClass(Class clazz)
Vector
of all critics that are directly
associated with the given design material subclass.If there aren't any an empty Vector is returned.
clazz
- the design material
public static void applyAllCritics(Object dm, Designer d, long reasonCode)
I would call this critique, but it causes a compilation error because it conflicts with the instance method critique!
dm
- the design materiald
- the designerreasonCode
- the reasonpublic static void applyAllCritics(Object dm, Designer d)
dm
- the design materiald
- the designerpublic static void applyCritics(Object dm, Designer d, Collection theCritics, long reasonCode)
dm
- the design materiald
- the designertheCritics
- the criticsreasonCode
- the reasonpublic void determineActiveCritics(Designer d)
TODO: I am setting global data, the isEnabled bit in each critic, based on the needs of one designer. I don't really support more than one Designer. TODO: should loop over simpler vector of critics, not CompoundCritics
d
- the designerpublic static void addStaticObserver(Observer obs)
obs
- the notified objectpublic static void notifyStaticObservers(Object o)
o
- the notified object
|
|||||||||||
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 |