uk.ac.starlink.topcat.plot2
Class NextSupplier

java.lang.Object
  extended by uk.ac.starlink.topcat.plot2.NextSupplier

public class NextSupplier
extends Object

Manages centrally-dispensed value sets for one or more ConfigKeys. Normally, a ConfigKey has a single default. However, in some cases (subset colours) it is desirable for the default to be one of a list, so that the first time the default is acquired it has one value, the second time it has a different value, etc. This object manages groups of default values to achieve that.

Since:
15 Mar 2013
Author:
Mark Taylor

Constructor Summary
NextSupplier()
          Constructor.
 
Method Summary
 uk.ac.starlink.ttools.plot2.config.ConfigKey[] getKeys()
          Returns the keys managed by this supplier.
<T> T
getNextValue(uk.ac.starlink.ttools.plot2.config.ConfigKey<T> key)
          Returns the next unused value to use for a given key.
<T> void
putValues(uk.ac.starlink.ttools.plot2.config.ConfigKey<T> key, T[] values)
          Adds a key to be managed by this supplier, and provides a set of values to be used for it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NextSupplier

public NextSupplier()
Constructor.

Method Detail

putValues

public <T> void putValues(uk.ac.starlink.ttools.plot2.config.ConfigKey<T> key,
                          T[] values)
Adds a key to be managed by this supplier, and provides a set of values to be used for it. The nextValues will be taken from this list cyclically.

Parameters:
key - key to be managed by this supplier
values - list of distinct values to provide successive defaults for key

getKeys

public uk.ac.starlink.ttools.plot2.config.ConfigKey[] getKeys()
Returns the keys managed by this supplier.

Returns:
managed key list

getNextValue

public <T> T getNextValue(uk.ac.starlink.ttools.plot2.config.ConfigKey<T> key)
Returns the next unused value to use for a given key. The value dispensed cycles through the items provided when the key was initialised.

Parameters:
key - one of the keys managed by this supplier
Returns:
next value for key


Copyright © 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.