Class ParameterSetType<T extends ParameterSetType<T>>

java.lang.Object
csw.params.core.generics.ParameterSetType<T>
Type Parameters:
T - the subclass of ParameterSetType
Direct Known Subclasses:
CurrentState, DemandState, Observe, ObserveEvent, Result, Setup, SystemEvent, Wait

public abstract class ParameterSetType<T extends ParameterSetType<T>> extends Object
The base trait for various parameter set types (commands or events)

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <P extends Parameter<?>>
    T
    add(P parameter)
    Adds a parameter to the parameter set
    final <S> Parameter<S>
    apply(Key<S> key)
    Return the parameter associated with a Key rather than an Option
    boolean
    contains(Key<?> key)
    Returns true if the data contains the given key
    protected abstract T
    create(scala.collection.immutable.Set<Parameter<?>> data)
    Method called by subclass to create a copy with the same key (or other fields) and new parameters.
    protected String
    A comma separated string representation of parameters
    <S> boolean
    exists(Key<S> key)
    Returns true if the key exists in the parameter set
    <S> scala.Option<Parameter<S>>
    find(Parameter<S> parameter)
    Find a parameter based on it's keyName and keyType
    <S> scala.Option<Parameter<S>>
    get(Key<S> key)
    Returns an Option with the parameter for the key if found, otherwise None
    <S> scala.Option<Parameter<S>>
    get(String keyName, KeyType<S> keyType)
    Returns an Option with the parameter for the key if found, otherwise None
    scala.collection.immutable.Map<String,String>
    Returns a map based on this object where the keys and values are in string get (Could be useful for exporting in a get that other languages can read).
    jFind(Parameter<S> parameter)
    A Java helper to find a parameter based on it's keyName and keyType
    jGet(Key<S> key)
    Returns an Optional with the parameter for the key if found, otherwise empty
    jGet(String keyName, KeyType<S> keyType)
    Returns an Optional with the parameter for the key if found, otherwise empty
    A Java helper that returns a map based on this object where the keys and values are in string get (Could be useful for exporting in a get that other languages can read).
    <P extends Parameter<?>>
    T
    jMadd(Set<P> parametersToAdd)
     
    jMissingKeys(Key<?>... keys)
    A Java helper that returns a set containing the names of any of the given keys that are missing in the data
    jMissingKeys(scala.collection.immutable.Seq<Key<?>> keys)
    A Java helper that returns a set containing the names of any of the given keys that are missing in the data
    A Java helper to get parameters for this parameter set
    <P extends Parameter<?>>
    T
    madd(P... parametersToAdd)
    Adds several parameters to the parameter set
    <P extends Parameter<?>>
    T
    madd(scala.collection.immutable.Seq<P> parametersToAdd)
    Adds several parameters to the parameter set
    <P extends Parameter<?>>
    T
    madd(scala.collection.immutable.Set<P> parametersToAdd)
    Adds several parameters to the parameter set
    scala.collection.immutable.Set<String>
    missingKeys(scala.collection.immutable.Seq<Key<?>> keys)
    Returns a set containing the names of any of the given keys that are missing in the data
    final <S> Parameter<S>
    parameter(Key<S> key)
    Returns the actual parameter associated with a key
    abstract scala.collection.immutable.Set<Parameter<?>>
    Holds the parameters for this parameter set
    <S> T
    remove(Key<S> key)
    Remove a parameter from the parameter set by key
    <P extends Parameter<?>>
    T
    remove(P parameter)
    Removes a parameter based on the parameter
    int
    The number of parameters in this parameter set
    A String representation of concrete implementation of this class
    A name identifying the type of parameter set, such as "setup", "observe".

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ParameterSetType

      public ParameterSetType()
  • Method Details

    • add

      public <P extends Parameter<?>> T add(P parameter)
      Adds a parameter to the parameter set

      Parameters:
      parameter - the parameter to add
      Returns:
      a new instance of this parameter set with the given parameter added
    • apply

      public final <S> Parameter<S> apply(Key<S> key)
      Return the parameter associated with a Key rather than an Option

      Parameters:
      key - the Key to be used for lookup
      Returns:
      the parameter associated with the Key or a NoSuchElementException if the key does not exist
    • contains

      public boolean contains(Key<?> key)
      Returns true if the data contains the given key
      Parameters:
      key - (undocumented)
      Returns:
      (undocumented)
    • create

      protected abstract T create(scala.collection.immutable.Set<Parameter<?>> data)
      Method called by subclass to create a copy with the same key (or other fields) and new parameters. It is protected and subclasses should also keep it as protected to avoid receiving duplicate keys.

      Parameters:
      data - a new set of Parameters after addition or deletion
      Returns:
      a concrete implementation of type T
    • dataToString

      protected String dataToString()
      A comma separated string representation of parameters
      Returns:
      (undocumented)
    • exists

      public <S> boolean exists(Key<S> key)
      Returns true if the key exists in the parameter set

      Parameters:
      key - the key to check for
      Returns:
      true if the key is found
    • find

      public <S> scala.Option<Parameter<S>> find(Parameter<S> parameter)
      Find a parameter based on it's keyName and keyType

      Parameters:
      parameter - who's keyName and keyType is used to get values and units
      Returns:
      an Option of Parameter[S] if it is found, otherwise None
    • get

      public <S> scala.Option<Parameter<S>> get(Key<S> key)
      Returns an Option with the parameter for the key if found, otherwise None

      Parameters:
      key - the Key to be used for lookup
      Returns:
      the parameter for the key, if found
    • get

      public <S> scala.Option<Parameter<S>> get(String keyName, KeyType<S> keyType)
      Returns an Option with the parameter for the key if found, otherwise None

      Parameters:
      keyName - the keyName for a key
      keyType - the keyType for a key
      Returns:
      the parameter for the key, if found
    • getStringMap

      public scala.collection.immutable.Map<String,String> getStringMap()
      Returns a map based on this object where the keys and values are in string get (Could be useful for exporting in a get that other languages can read). Derived classes might want to add values to this map for fixed fields.
      Returns:
      (undocumented)
    • jFind

      public <S> Optional<Parameter<S>> jFind(Parameter<S> parameter)
      A Java helper to find a parameter based on it's keyName and keyType

      Parameters:
      parameter - who's keyName and keyType is used to get values and units
      Returns:
      an Optional of Parameter[S] if it is found, otherwise empty
    • jGet

      public <S> Optional<Parameter<S>> jGet(Key<S> key)
      Returns an Optional with the parameter for the key if found, otherwise empty

      Parameters:
      key - the Key to be used for lookup
      Returns:
      the parameter for the key, if found
    • jGet

      public <S> Optional<Parameter<S>> jGet(String keyName, KeyType<S> keyType)
      Returns an Optional with the parameter for the key if found, otherwise empty

      Parameters:
      keyName - the keyName for a key
      keyType - the keyType for a key
      Returns:
      the parameter for the key, if found
    • jGetStringMap

      public Map<String,String> jGetStringMap()
      A Java helper that returns a map based on this object where the keys and values are in string get (Could be useful for exporting in a get that other languages can read). Derived classes might want to add values to this map for fixed fields.
      Returns:
      (undocumented)
    • jMadd

      public <P extends Parameter<?>> T jMadd(Set<P> parametersToAdd)
    • jMissingKeys

      public Set<String> jMissingKeys(Key<?>... keys)
      A Java helper that returns a set containing the names of any of the given keys that are missing in the data

      Parameters:
      keys - one or more keys
      Returns:
      (undocumented)
    • jMissingKeys

      public Set<String> jMissingKeys(scala.collection.immutable.Seq<Key<?>> keys)
      A Java helper that returns a set containing the names of any of the given keys that are missing in the data

      Parameters:
      keys - one or more keys
      Returns:
      (undocumented)
    • jParamSet

      public Set<Parameter<?>> jParamSet()
      A Java helper to get parameters for this parameter set
      Returns:
      (undocumented)
    • madd

      public <P extends Parameter<?>> T madd(P... parametersToAdd)
      Adds several parameters to the parameter set

      Parameters:
      parametersToAdd - the list of parameters to add to the parameter set
      Returns:
      a new instance of this parameter set with the given parameter added
    • madd

      public <P extends Parameter<?>> T madd(scala.collection.immutable.Seq<P> parametersToAdd)
      Adds several parameters to the parameter set

      Parameters:
      parametersToAdd - the list of parameters to add to the parameter set
      Returns:
      a new instance of this parameter set with the given parameter added
    • madd

      public <P extends Parameter<?>> T madd(scala.collection.immutable.Set<P> parametersToAdd)
      Adds several parameters to the parameter set

      Parameters:
      parametersToAdd - the list of parameters to add to the parameter set
      Returns:
      a new instance of this parameter set with the given parameter added
    • missingKeys

      public scala.collection.immutable.Set<String> missingKeys(scala.collection.immutable.Seq<Key<?>> keys)
      Returns a set containing the names of any of the given keys that are missing in the data

      Parameters:
      keys - one or more keys
      Returns:
      a Set of key names
    • paramSet

      public abstract scala.collection.immutable.Set<Parameter<?>> paramSet()
      Holds the parameters for this parameter set
      Returns:
      (undocumented)
    • parameter

      public final <S> Parameter<S> parameter(Key<S> key)
      Returns the actual parameter associated with a key

      Parameters:
      key - the Key to be used for lookup
      Returns:
      the parameter associated with the key or a NoSuchElementException if the key does not exist
    • remove

      public <S> T remove(Key<S> key)
      Remove a parameter from the parameter set by key

      Parameters:
      key - the Key to be used for removal
      Returns:
      a new T, where T is a parameter set child with the key removed or identical if the key is not present
    • remove

      public <P extends Parameter<?>> T remove(P parameter)
      Removes a parameter based on the parameter

      Parameters:
      parameter - to be removed from the parameter set
      Returns:
      a new T, where T is a parameter set child with the parameter removed or identical if the parameter is not present
    • size

      public int size()
      The number of parameters in this parameter set

      Returns:
      the number of parameters in the parameter set
    • toString

      public String toString()
      A String representation of concrete implementation of this class
      Overrides:
      toString in class Object
      Returns:
      (undocumented)
    • typeName

      public String typeName()
      A name identifying the type of parameter set, such as "setup", "observe". This is used in the JSON and toString output.
      Returns:
      (undocumented)