scheduler.db.preferencesdb
Class Preferences

java.lang.Object
  extended by scheduler.db.preferencesdb.Preferences

public class Preferences
extends java.lang.Object

This class will contain the data and operations to work with schedule Preferences

Author:
Leland Garofalo

Field Summary
(package private)  java.lang.String data
          The data contained in the preference
(package private)  int importance
          Value to store the importance value of the preference
(package private)  java.lang.String name
          The name of the preference
(package private)  int type
          The type of the preference
(package private)  int violatable
          Value to store if preference can be violated
 
Constructor Summary
Preferences()
          Constructor to build a empty Preference
Preferences(java.lang.String name, java.lang.String data, int type, int importance, int violatable)
          Constructor to build a Preference
 
Method Summary
 java.lang.String getData()
          Returns the data of a preference
 int getImportance()
          Returns the importance of a preference
 java.lang.String getName()
          Returns the name of the preference
 int getType()
          Returns a int representing the type of the preference
 int getViolatable()
          Returns the value of violatable
 boolean isValid()
          Returns a boolean based on if the Preference has valid data
 java.lang.String toString()
          Returns a string representation of the Preference which is currently just the name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

int type
The type of the preference


name

java.lang.String name
The name of the preference


data

java.lang.String data
The data contained in the preference


violatable

int violatable
Value to store if preference can be violated


importance

int importance
Value to store the importance value of the preference

Constructor Detail

Preferences

public Preferences()
Constructor to build a empty Preference


Preferences

public Preferences(java.lang.String name,
                   java.lang.String data,
                   int type,
                   int importance,
                   int violatable)
Constructor to build a Preference

Parameters:
name - String that holds the name of preference
data - String that holds the data of preference
type - int that holds the type of preference
importance - int that holds the importance value of a preference
violatable - int that holds value of if a preference is violatable
Method Detail

getName

public java.lang.String getName()
Returns the name of the preference

Returns:
String The name of the preference

getData

public java.lang.String getData()
Returns the data of a preference

Returns:
String The data of the preference

getType

public int getType()
Returns a int representing the type of the preference

Returns:
Int type of preference
 // ** Pre and Post conditions ** //

 Pre:

 // Preference cannot be null
 p != nil

 Post:

 // The type must be 1,2,3 or 4
 type == 1 | type == 2 | type == 3 | type == 4

 &&

 // The return type must equal the preference type
 getType() = p.type

 

getViolatable

public int getViolatable()
Returns the value of violatable

Returns:
int returns violatable value

getImportance

public int getImportance()
Returns the importance of a preference

Returns:
int returns the importance of a preference

toString

public java.lang.String toString()
Returns a string representation of the Preference which is currently just the name

Overrides:
toString in class java.lang.Object
Returns:
String value of Preference
 // ** Pre and Post conditions ** //

 Pre:

 // Preference.name cannot be null
 p.name != nil

 Post:

 // The Preference must not have changed
 p = p'

 &&

 // The return value must equal the Preference string
 toString() = p.name

 

isValid

public boolean isValid()
Returns a boolean based on if the Preference has valid data

Returns:
Boolean value for validity of string
 // ** Pre and Post conditions ** //

 Pre:

 // Preference cannot be null
 p != nil

 Post:

 // The Preference must not have changed
 p = p'