se.liu.ida.critiquer.activities.parameters
Class ActivityParameter<T>

java.lang.Object
  extended by se.liu.ida.critiquer.activities.parameters.ActivityParameter<T>
All Implemented Interfaces:
Serializable, Parameter<T>
Direct Known Subclasses:
AbstractTaskViewParameter, LocationParameter, SelectionParameter, TimeParameter

public abstract class ActivityParameter<T>
extends Object
implements Parameter<T>, Serializable

This class describes the parameters that describe an activity

When creating a plan, we start by choosing the type of activity which in turn gives us a template hierarchy of activities that we can start to manipulate

This structure contains textual information on missions and possibly time dependencies.

Next, resources are assigned to missions in the resource view by dragging resources to missions

When this is done, time intervals for each mission can be calculated in the time view, according to one of several preconfigured settings (launch missions immediately after one another, set certain time slacks)

Therefore, an activity parameter has a view associated with it where one can configure the parameter

See Also:
Serialized Form

Field Summary
protected  boolean hasBeenSet
          If the user has ever set the value of this parameter, this will be true, otherwise false.
protected  String name
           
protected  T oldValue
           
protected  T value
           
protected  Semaphore valueUpdate
           
 
Constructor Summary
ActivityParameter(String name, Activity activity)
           
 
Method Summary
 Activity getActivity()
           
 String getName()
           
 T getOldValue()
           
 T getValue()
           
 boolean hasValue()
           
(package private)  void setName(String name)
           
 boolean setValue(T value)
          Update the value of this parameter iff the value is consistent for this parameter The updating is performed with a binary semaphore set so that there can be no more than one thread updating and signalling activities of a value update
 boolean setValue(T value, boolean silent)
          This may be used when we don't want to notify activities of the change.
abstract  String toString()
           
protected  void valueChanged()
          This method can be used directly by subclasses if the parameter value reference remaing the same but there has been changes to the value so listeners should be notified Also, we create a new thread to do the updating here since this may be called during the process of updating a parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected T value

oldValue

protected T oldValue

hasBeenSet

protected boolean hasBeenSet
If the user has ever set the value of this parameter, this will be true, otherwise false.


valueUpdate

protected Semaphore valueUpdate

name

protected String name
Constructor Detail

ActivityParameter

public ActivityParameter(String name,
                         Activity activity)
Parameters:
activity -
Method Detail

toString

public abstract String toString()
Overrides:
toString in class Object

getValue

public T getValue()
Specified by:
getValue in interface Parameter<T>
Returns:
Returns the value.

hasValue

public boolean hasValue()
Specified by:
hasValue in interface Parameter<T>

valueChanged

protected void valueChanged()
This method can be used directly by subclasses if the parameter value reference remaing the same but there has been changes to the value so listeners should be notified Also, we create a new thread to do the updating here since this may be called during the process of updating a parameter.


setValue

public boolean setValue(T value)
Update the value of this parameter iff the value is consistent for this parameter The updating is performed with a binary semaphore set so that there can be no more than one thread updating and signalling activities of a value update

Parameters:
value - The value to set. Sets a value and notifies all listeners
Returns:
true if the change was consistent, false otherwise.

setValue

public boolean setValue(T value,
                        boolean silent)
This may be used when we don't want to notify activities of the change. This should primarily be used in the constructor of the parameter when some default value is set.

Parameters:
value -
silent -
Returns:

getName

public String getName()
Returns:
Returns the name.

setName

void setName(String name)
Parameters:
name - The name to set.

getActivity

public Activity getActivity()
Returns:
Returns the activity.

getOldValue

public T getOldValue()
Returns:
Returns the oldValue.