jitas.core
Class SimpleFeedback

java.lang.Object
  extended by jitas.core.SimpleFeedback
All Implemented Interfaces:
java.io.Serializable, Feedback

public class SimpleFeedback
extends java.lang.Object
implements Feedback, java.io.Serializable

A simple implementation of the Feedback class. Messages are stored in a Map, of String-Map pairs. Messages are keys to additional data maps, which contain key-value pairs. This gives a format of: <(message, <(key, value), (key2, value2)>), (message2, <(key, value), (key2, value2)>)>

Version:
18 August 2007
Author:
DeathMarch (c314g2)
See Also:
Serialized Form

Constructor Summary
SimpleFeedback()
          Constructor - initialises globals.
 
Method Summary
 void addAdditionalData(java.lang.String s, java.lang.String key, java.lang.String value)
          Adds additional data to a message.
 void addMessage(java.lang.String s)
          Add a message to the Errors, with no additional data.
 void addMessage(java.lang.String s, java.util.Map<java.lang.String,java.lang.String> map)
          Add a message to the Errors, with a Map of additional data.
 void addSatisfiedConstraint(java.lang.String name)
          Add the name of a satisfied constraint to the collection of violated constraints.
 void addViolatedConstraint(java.lang.String name)
          Add the name of a violated constraint to the collection of violated constraints.
 java.util.Map<java.lang.String,java.lang.String> getAdditionalData(java.lang.String message)
          Get any additional data associated with a given message.
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getErrors()
          Get all the errors, including all additional data
 java.util.Set<java.lang.String> getMessages()
          Get the feedback messages, ignoring any additional data
 java.util.Set<java.lang.String> getRelevantConstraints()
          Get all the relevant constraints of a problem
 java.util.Collection<java.lang.String> getSatisfiedConstraints()
          Get the collection of satisfied constraint names
 java.util.Collection<java.lang.String> getViolatedConstraints()
          Get the collection of violated constraint names
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleFeedback

public SimpleFeedback()
Constructor - initialises globals.

Method Detail

addMessage

public void addMessage(java.lang.String s)
Add a message to the Errors, with no additional data.

Specified by:
addMessage in interface Feedback
Parameters:
s - The message to add

addMessage

public void addMessage(java.lang.String s,
                       java.util.Map<java.lang.String,java.lang.String> map)
Add a message to the Errors, with a Map of additional data.

Specified by:
addMessage in interface Feedback
Parameters:
s - The message to add
map - The map of additional data

addAdditionalData

public void addAdditionalData(java.lang.String s,
                              java.lang.String key,
                              java.lang.String value)
Adds additional data to a message. If the message already exists, the key-value pair is added to the additional data for that message. If the message doesn't exist, a new error Map entry is made, with additional data of the key-value pair.

Specified by:
addAdditionalData in interface Feedback
Parameters:
s - The existing message
key - The key for the additional data
value - The value for the additional data

getMessages

public java.util.Set<java.lang.String> getMessages()
Get the feedback messages, ignoring any additional data

Specified by:
getMessages in interface Feedback
Returns:
A set of feedback messages

getAdditionalData

public java.util.Map<java.lang.String,java.lang.String> getAdditionalData(java.lang.String message)
Get any additional data associated with a given message.

Specified by:
getAdditionalData in interface Feedback
Parameters:
message - The message you want the additional data of
Returns:
A map of additional data.

getErrors

public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getErrors()
Get all the errors, including all additional data

Specified by:
getErrors in interface Feedback
Returns:
A Map> of messages-additional data pairs.

addViolatedConstraint

public void addViolatedConstraint(java.lang.String name)
Add the name of a violated constraint to the collection of violated constraints.

Specified by:
addViolatedConstraint in interface Feedback
Parameters:
name - The name of the constraint to add

getViolatedConstraints

public java.util.Collection<java.lang.String> getViolatedConstraints()
Get the collection of violated constraint names

Specified by:
getViolatedConstraints in interface Feedback
Returns:
violatedConstraints The violated constraints names

getSatisfiedConstraints

public java.util.Collection<java.lang.String> getSatisfiedConstraints()
Get the collection of satisfied constraint names

Specified by:
getSatisfiedConstraints in interface Feedback
Returns:
satisfiedConstraints The satisfied constraint names

addSatisfiedConstraint

public void addSatisfiedConstraint(java.lang.String name)
Add the name of a satisfied constraint to the collection of violated constraints.

Specified by:
addSatisfiedConstraint in interface Feedback
Parameters:
name - The name of the constraint to add

getRelevantConstraints

public java.util.Set<java.lang.String> getRelevantConstraints()
Get all the relevant constraints of a problem

Specified by:
getRelevantConstraints in interface Feedback
Returns:
s A set of relevant constraints