com.kpro.dataobjects
Class Action

java.lang.Object
  extended by com.kpro.dataobjects.Action

public class Action
extends java.lang.Object

holds results of a algorithmic comparison- t/f on approve, with the nearest neighbor, as well as a string & enum for exception, if it is one


Field Summary
private  boolean accepted
           
private  double confidence
           
private  boolean override
           
private  java.util.ArrayList<java.lang.String> reasonDomains
           
 
Constructor Summary
Action()
           
Action(boolean accept, java.util.ArrayList<java.lang.String> domains, double confidence, boolean override)
           
 
Method Summary
 boolean getAccepted()
          Returns true if the action was accepted, and false otherwise.
 java.lang.String getAcceptedStr()
          converts the internal accept/reject values to a String
 double getConfidence()
           
 java.util.ArrayList<java.lang.String> getReason()
           
 java.util.ArrayList<java.lang.String> getReasons()
           
 boolean isOverridden()
          Returns true if the action is manually overridden.
 Action parse(java.lang.String optionValue)
          Parse a comma-seperated string into an Action.
 void setAccepted(boolean accept)
          Sets the accepted state of the action.
 void setConfidence(double confidence)
          Sets the confidence, with checks on the value: if confidence = abs(input) if 1>=input>=-1, else negative infinity
 Action setOverride(boolean b)
           
 void setReason(java.util.ArrayList<java.lang.String> reason)
           
 java.lang.String toString()
          Overriden toString.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

accepted

private boolean accepted

reasonDomains

private java.util.ArrayList<java.lang.String> reasonDomains

override

private boolean override

confidence

private double confidence
Constructor Detail

Action

public Action()

Action

public Action(boolean accept,
              java.util.ArrayList<java.lang.String> domains,
              double confidence,
              boolean override)
Method Detail

getReason

public java.util.ArrayList<java.lang.String> getReason()

setReason

public void setReason(java.util.ArrayList<java.lang.String> reason)

getAcceptedStr

public java.lang.String getAcceptedStr()
converts the internal accept/reject values to a String

Returns:
a boolean that can be sent to the user with a accept/reject

getAccepted

public boolean getAccepted()
Returns true if the action was accepted, and false otherwise.

Returns:
boolean

setAccepted

public void setAccepted(boolean accept)
Sets the accepted state of the action.

Parameters:
boolean - accept

getReasons

public java.util.ArrayList<java.lang.String> getReasons()
Returns:
an arraylist that verbalizes why the policy was accepted or rejected

isOverridden

public boolean isOverridden()
Returns true if the action is manually overridden.

Returns:
boolean

setConfidence

public void setConfidence(double confidence)
Sets the confidence, with checks on the value: if confidence = abs(input) if 1>=input>=-1, else negative infinity


getConfidence

public double getConfidence()

parse

public Action parse(java.lang.String optionValue)
Parse a comma-seperated string into an Action. The string needs to have four comma-seperated tokens (thus three commas) and no spaces. The format is accept,domains,confidence,override where accept is 'accept' if accept==true, or anything else if accept!=true; domains is a semi-colon seperated string list of domains (no commas, no spaces, etc), eg 'www.google.com;www.yahoo.com;domain3;domain4' ; confidence is a double that is the confidence (parsed by parseDouble), and override is a boolean (parsed by parseBoolean).

Parameters:
optionValue - the option string- see above. must have 3 commas, no spaces
Returns:
an Action parsed from above

setOverride

public Action setOverride(boolean b)

toString

public java.lang.String toString()
Overriden toString. format: ('Accepted.'|'Rejected.')('Override.'|'No Override.')("Confidences: %f")["reasonDomain: [" (" string,")+].

Overrides:
toString in class java.lang.Object
Returns:
fancy string version see above. eg "Accepted. Override. Confidence: 0.5 reasonDomain: [ google.com"