stella.parameter
Class UserShare

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.parameter.AbstractParameter
                  extended by stella.parameter.AbstractValue
                      extended by stella.parameter.UserShare
All Implemented Interfaces:
Cloneable, Parameter, ParameterDepending, Value, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying

public class UserShare
extends AbstractValue
implements ParameterDepending, Reloadable

A parameter that represents the current time share of a user group. It depends on two StopWatch parameters, one giving the total observation time of the telescope, and the second giving the time the telescope was dedicated to the particular user group. The name of the parameter stems from the user group it points to KEY_USERTIME, augmented with the #SHARECURRENT appendix. The stop watch it uses for the user time is named according to the KEY_USERTIME, augmented with #SHAREREQUEST. Note that this parameter cannot be set, but its value is influenced by actions on the two StopWatches it relies on. Note also that it is in principle possible to assign not the total observation time of the telescope but rather a different StopWatch to the user share, using the KEY_TOTALTIME key.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static String CURRENT
          The parameter name extension to define current user group total time.
private static String DEFNAME
          The default name of the paramter.
private static String DEFTOTALTIME
          The default name of the total time stop watch.
private static DecimalFormat df
          The formatter for the user share.
static String KEY_TOTALTIME
          The key to the unique trigger name.
static String KEY_USERTIME
          The key to the unique trigger name.
static String REQUEST
          The parameter name extension to define requested user time shares.
static String SHARE
          The parameter name extension to define current user time shares.
private  Value timetotal
          The value counting total observation time of the telescope.
private  StopWatch timeuser
          The stop watch counting total observation time of a user group.
 
Fields inherited from class stella.parameter.AbstractParameter
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWN
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
UserShare(Map info)
          Constructs a new user share parameter.
 
Method Summary
 Number getValue()
          Gets the current user group share.
 void registerParameter(Parameter add)
          Registers an additional parameter to this parameter.
 double rescanned(String key, String old, String newval)
          As any parameter depending instance we fail if the parameter we depend on is now a different one.
 Number setValue(Number val)
          Sets the current user time share.
 
Methods inherited from class stella.parameter.AbstractValue
get, set
 
Methods inherited from class stella.parameter.AbstractParameter
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, init, register, setName, toString
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, setObject, setProperties, setProperty, stringProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.Reloadable
reload
 
Methods inherited from interface stella.Parameter
getFormatted, getName, getString
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface util.Initializable
init
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

CURRENT

public static final String CURRENT
The parameter name extension to define current user group total time.

See Also:
Constant Field Values

REQUEST

public static final String REQUEST
The parameter name extension to define requested user time shares.

See Also:
Constant Field Values

SHARE

public static final String SHARE
The parameter name extension to define current user time shares.

See Also:
Constant Field Values

KEY_TOTALTIME

public static final String KEY_TOTALTIME
The key to the unique trigger name.

See Also:
Constant Field Values

KEY_USERTIME

public static final String KEY_USERTIME
The key to the unique trigger name.

See Also:
Constant Field Values

DEFNAME

private static final String DEFNAME
The default name of the paramter. Also used for the default user time.

See Also:
Constant Field Values

DEFTOTALTIME

private static final String DEFTOTALTIME
The default name of the total time stop watch.

See Also:
Constant Field Values

timetotal

private Value timetotal
The value counting total observation time of the telescope.


timeuser

private StopWatch timeuser
The stop watch counting total observation time of a user group.


df

private static final DecimalFormat df
The formatter for the user share.

Constructor Detail

UserShare

public UserShare(Map info)
Constructs a new user share parameter. Values may only be retrieved after the total time and the user time has been added to this parameter.

Method Detail

rescanned

public double rescanned(String key,
                        String old,
                        String newval)
As any parameter depending instance we fail if the parameter we depend on is now a different one.

Specified by:
rescanned in interface Reloadable
Overrides:
rescanned in class AbstractParameter

registerParameter

public void registerParameter(Parameter add)
Registers an additional parameter to this parameter. A user share needs two StopWatches, one counting total observation time of the telescope and another one counting total observation time of a user group. The total time is identified by its name, KEY_TOTALTIME, the user group time must have a name according to KEY_USERTIME.

Specified by:
registerParameter in interface ParameterDepending

getValue

public Number getValue()
Gets the current user group share. This means dividing the user group time through the total observation time.

Specified by:
getValue in interface Value

setValue

public Number setValue(Number val)
                throws UnsupportedOperationException
Sets the current user time share. This is a read-only variable, therefore this method throws an UnsupportedOperationException.

Specified by:
setValue in interface Value
Throws:
UnsupportedOperationException