Class ActivityDef


  • public class ActivityDef
    extends java.lang.Object

    A runtime definition for an activity.

    Instances of ActivityDef hold control values for the execution of a single activity. Each thread of the related activity is initialized with the associated ActivityDef. When the ActivityDef is modified, interested activity threads are notified so that they can dynamically adjust.

    The canonical values for all parameters are kept internally in the parameter map. Essentially, ActivityDef is just a type-aware wrapper around a thread-safe parameter map, with an atomic change counter which can be used to signal changes to observers.

    • Constructor Detail

      • ActivityDef

        public ActivityDef​(ParameterMap parameterMap)
    • Method Detail

      • parseActivityDefOptionally

        public static java.util.Optional<ActivityDef> parseActivityDefOptionally​(java.lang.String namedActivitySpec)
      • parseActivityDef

        public static ActivityDef parseActivityDef​(java.lang.String namedActivitySpec)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getAlias

        public java.lang.String getAlias()
        The alias that the associated activity instance is known by.
        Returns:
        the alias
      • getActivityType

        public java.lang.String getActivityType()
      • getStartCycle

        public long getStartCycle()
        The first cycle that will be used for execution of this activity, inclusive. If the value is provided as a range as in 0..10, then the first number is the start cycle and the second number is the end cycle +1. Effectively, cycle ranges are [closed,open) intervals, as in [min..max)
        Returns:
        the long start cycle
      • setStartCycle

        public void setStartCycle​(long startCycle)
      • setStartCycle

        public void setStartCycle​(java.lang.String startCycle)
      • setEndCycle

        public void setEndCycle​(java.lang.String endCycle)
      • getEndCycle

        public long getEndCycle()
        The last cycle that will be used for execution of this activity, inclusive.
        Returns:
        the long end cycle
      • setEndCycle

        public void setEndCycle​(long endCycle)
      • getThreads

        public int getThreads()
        The number of threads (AKA slots) that the associated activity should currently be using.
        Returns:
        target thread count
      • setThreads

        public void setThreads​(int threads)
      • getParams

        public ParameterMap getParams()
        Get the parameter map, which is the backing-store for all data within an ActivityDef.
        Returns:
        the parameter map
      • getChangeCounter

        public java.util.concurrent.atomic.AtomicLong getChangeCounter()
      • setCycles

        public void setCycles​(java.lang.String cycles)
      • getCycleSummary

        public java.lang.String getCycleSummary()
      • getCycleCount

        public long getCycleCount()