Package uk.ac.starlink.topcat.plot2
Class NextSupplier
- java.lang.Object
-
- uk.ac.starlink.topcat.plot2.NextSupplier
-
public class NextSupplier extends java.lang.ObjectManages 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
Constructors Constructor Description NextSupplier()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description uk.ac.starlink.ttools.plot2.config.ConfigKey<?>[]getKeys()Returns the keys managed by this supplier.<T> TgetNextValue(uk.ac.starlink.ttools.plot2.config.ConfigKey<T> key)Returns the next unused value to use for a given key.<T> voidputValues(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.
-
-
-
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 suppliervalues- list of distinct values to provide successive defaults forkey
-
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
-
-