org.argouml.cognitive
Class ResolvedCritic

java.lang.Object
  extended byorg.argouml.cognitive.ResolvedCritic

public class ResolvedCritic
extends Object

This class is responsible for identifying one critic that has been resolved by the user in one specific context.


Field Summary
private  String critic
          The name of the critic.
private static Logger LOG
          The logger.
private  List offenders
          The IDs of the objects that define the context of the critic.
 
Constructor Summary
ResolvedCritic(Critic c, org.tigris.gef.util.VectorSet offs)
          Same as ResolvedCritic(c, offs, true).
ResolvedCritic(Critic c, org.tigris.gef.util.VectorSet offs, boolean canCreate)
          Creates a new ResolvedCritic from the given information.
ResolvedCritic(String cr, Vector offs)
          Creates a new ResolvedCritic using the name of the Critic and the Vector of objects that triggered the Critic given as parameters.
 
Method Summary
 boolean equals(Object obj)
          equals returns true if and only if obj also is a ResolvedCritic, has the same critic name, and has all related objects that this object has.
 String getCritic()
          Gets the content of critic.
protected  String getCriticString(Critic c)
          Obtains a String that identifies the type of Critic.
 List getOffenderList()
          Gets the list of related objects, offenders.
 int hashCode()
           
protected  void importOffenders(org.tigris.gef.util.VectorSet set, boolean canCreate)
          Imports the set of related objects in set to this object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

private static final Logger LOG
The logger.


critic

private String critic
The name of the critic.


offenders

private List offenders
The IDs of the objects that define the context of the critic.

Constructor Detail

ResolvedCritic

public ResolvedCritic(String cr,
                      Vector offs)
Creates a new ResolvedCritic using the name of the Critic and the Vector of objects that triggered the Critic given as parameters.

Parameters:
cr - The name of the Critic that has been resolved
offs - The Vector of related objects.

ResolvedCritic

public ResolvedCritic(Critic c,
                      org.tigris.gef.util.VectorSet offs)
               throws UnresolvableException
Same as ResolvedCritic(c, offs, true).

Parameters:
c - The Critic that has been resolved.
offs - The set of objects that triggered the Critic.
Throws:
UnresolvableException - If some of the objects does not have a ItemUID and does not accept a new one.

ResolvedCritic

public ResolvedCritic(Critic c,
                      org.tigris.gef.util.VectorSet offs,
                      boolean canCreate)
               throws UnresolvableException
Creates a new ResolvedCritic from the given information.

Parameters:
c - The Critic that has been resolved.
offs - The set of objects that triggered the Critic.
canCreate - If it should try to assign new ItemUIDs to objects that doesn't have.
Throws:
UnresolvableException - If some of the objects does not have a ItemUID and does not accept a new one.
Method Detail

hashCode

public int hashCode()
See Also:
This is a rather bad hash solution but with the {@link #equals(Object)} defined as below, it is not possible to do better.

equals

public boolean equals(Object obj)
equals returns true if and only if obj also is a ResolvedCritic, has the same critic name, and has all related objects that this object has. Note that it is not required that this object has all related objects that that object has.

Formally that is inconsistent with equals as specified in java.lang.Object, but it was probably practical somehow.

The param obj is the Object to compare to. Returns true if equal according to the description, false otherwise.

See Also:
Object.equals(java.lang.Object)

getCriticString

protected String getCriticString(Critic c)
                          throws UnresolvableException
Obtains a String that identifies the type of Critic.

Parameters:
c - A Critic.
Returns:
A identifying name of the critic.
Throws:
UnresolvableException - Not implemented.

importOffenders

protected void importOffenders(org.tigris.gef.util.VectorSet set,
                               boolean canCreate)
                        throws UnresolvableException
Imports the set of related objects in set to this object. If an object does not have an ItemUID, canCreate determines if one will be provided. If some object does not have an ItemUID and canCreate is false och the object does not accept and ItemUID, then UnresolvableException is thrown.

Parameters:
set - The set of related objects to import.
canCreate - If ItemUIDs are allowed to be created.
Throws:
UnresolvableException - if not all objects can be imported.

getCritic

public String getCritic()
Gets the content of critic.

Returns:
The critic this instance resolves.

getOffenderList

public List getOffenderList()
Gets the list of related objects, offenders.

Returns:
The list of offenders of the critic this instance resolved.

toString

public String toString()
See Also:
Object.toString()


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook