|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.annot.Support
public class Support
This class represents the support level for an annotation.
$Id: Support.java,v 1.24 2007-08-13 12:32:02 burrill Exp $
Copyright 2007 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
A particular support for annotations.
The belief values and combination rule are specified using enumerations, which are as follows:
false
improbable
unlikely
neutral
possible
probable
true
neutral
expresses no belief,
positive or negative, and is therefore identical to the
annotation not existing. For many annotations, the absence
of an annotation implies a value; hence in these cases,
neutral
will be equivalent to one of false or
true. To make dealing with this unfortunate situation
easier, I would like the elements of the enumeration to
have a method that returns an integer value (e.g., value()
or order()), so that we can do something like the
following:
if (ann.belief().value() <= cNeutral) // annotation is false. else // annotation is true.False is less than true, and the values are ordered as shown above. Generally,
neutral
is used to
indicate that an annotation is to be ignored.
For some annotations, beliefs do not make sense. For example, an annotation indicating originating source position is inherently true. Nevertheless, they will be assigned beliefs.
cStrongestSystem:
Use whichever value
represents the strongest belief. In the case of a tie,
use the system's value. Strength is the distance from
neutral
cStrongestUser:
Use whichever value
represents the strongest belief. In the case of a tie,
use the user's value.
cSystem:
Use the system's value.
cUser:
Use the user's value
cOptismistic:
Return whichever value
reprsents the more optimistic belief.
cPessimistic:
Return whichever value
reprsents the more pessimistic belief.
cStrongestSystem
is the default rule, and is
automatically set by the annotation constructor. The
combination rule field is mutable, and may be changed to
something other than the default by calling a method of the
annotation class.
Situation | User belief | System belief | Combining rule |
User creates annotation | possible | neutral | default |
Annotation derived from source language construct | neutral | true | default |
Annotation from an accurate analysis | neutral | true | default |
Annotation from a conservative analysis | neutral | probable | default |
User overrides annotation created by system | neutral | unchanged | user |
System choses to drop a user annotation | unchanged | neutral | system |
Annotation
Nested Class Summary | |
---|---|
static class |
Support.Belief
Annotations retain a measure of belief in the accuracy of the annotation. |
static class |
Support.Rule
The combining rule specifies how the user and system belief values will be combined. |
Field Summary | |
---|---|
static Support |
systemTrue
System belief is true. |
Method Summary | |
---|---|
Support |
combine(Support a)
Combine two supports. |
static Support |
create(boolean isUser,
Support.Belief belief)
|
static Support |
create(Support.Belief user,
Support.Belief system,
Support.Rule rule)
Re-use an existing instance of a particular support. |
Support.Rule |
getRule()
Return the rule used in the support. |
Support.Belief |
getSystemBelief()
Return the user system used in the support. |
Support.Belief |
getUserBelief()
Return the user belief used in the support. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Support systemTrue
Method Detail |
---|
public static Support create(Support.Belief user, Support.Belief system, Support.Rule rule)
public static Support create(boolean isUser, Support.Belief belief)
public Support combine(Support a)
public final Support.Rule getRule()
public final Support.Belief getUserBelief()
public final Support.Belief getSystemBelief()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |