Class AbstractActuator

    • Field Detail

      • id

        protected java.lang.String id
      • name

        protected java.lang.String name
      • valueTypeConfirmed

        protected boolean valueTypeConfirmed
      • defaultOnDouble

        protected java.lang.Double defaultOnDouble
      • defaultOnString

        protected java.lang.String defaultOnString
      • defaultOffDouble

        protected java.lang.Double defaultOffDouble
      • defaultOffString

        protected java.lang.String defaultOffString
      • interlockActuator

        protected boolean interlockActuator
      • head

        protected Head head
    • Constructor Detail

      • AbstractActuator

        public AbstractActuator()
    • Method Detail

      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface Identifiable
      • getHead

        public Head getHead()
        Description copied from interface: HeadMountable
        Gets the Head that this HeadMountable is attached to. If it is not attached to a Head this method returns null.
        Specified by:
        getHead in interface HeadMountable
        Returns:
      • setHead

        public void setHead​(Head head)
        Description copied from interface: HeadMountable
        Set the Head that this HeadMountable is attached to. Called by the Head when the HeadMountable is added to it.
        Specified by:
        setHead in interface HeadMountable
      • getDriver

        public Driver getDriver()
        Specified by:
        getDriver in interface Actuator
        Returns:
        the driver through which this Actuator is controlled.
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface Named
      • setName

        public void setName​(java.lang.String name)
        Specified by:
        setName in interface Named
      • getValueType

        public Actuator.ActuatorValueType getValueType()
        Description copied from interface: Actuator
        Declares the primary value type of the Actuator. This will allow the GUI to present the proper control for value editing.
        Specified by:
        getValueType in interface Actuator
        Returns:
      • isValueTypeConfirmed

        public boolean isValueTypeConfirmed()
        Returns:
        true if the valueType was confirmed by functional usage or user interaction.
      • setValueTypeConfirmed

        public void setValueTypeConfirmed​(boolean valueTypeConfirmed)
      • suggestValueType

        public static void suggestValueType​(Actuator actuator,
                                            Actuator.ActuatorValueType valueType)
        Suggest a specific valueType for the actuator, based on its functional use. This will only set the valueType once, if not yet otherwise confirmed by GUI user interaction etc. (mixed type usage must remain possible). Performs null and type checking on the actuator.
        Parameters:
        actuator -
        valueType -
      • typedValue

        public java.lang.Object typedValue​(java.lang.Object value)
        As the user might change the valueType() in the life-time of the actuator, we try to re-interpret persisted values in the most tolerant fashion.
        Parameters:
        value -
        Returns:
      • typedValue

        public static java.lang.Object typedValue​(java.lang.Object value,
                                                  Actuator actuator)
        Convenience null- and type-checked call to typedValue().
        Parameters:
        value -
        actuator -
        Returns:
      • getDefaultOnDouble

        public java.lang.Double getDefaultOnDouble()
      • setDefaultOnDouble

        public void setDefaultOnDouble​(java.lang.Double defaultOnDouble)
      • getDefaultOnString

        public java.lang.String getDefaultOnString()
      • setDefaultOnString

        public void setDefaultOnString​(java.lang.String defaultOnString)
      • getDefaultOffDouble

        public java.lang.Double getDefaultOffDouble()
      • setDefaultOffDouble

        public void setDefaultOffDouble​(java.lang.Double defaultOffDouble)
      • getDefaultOffString

        public java.lang.String getDefaultOffString()
      • setDefaultOffString

        public void setDefaultOffString​(java.lang.String defaultOffString)
      • getDefaultOnProfile

        protected abstract java.lang.String getDefaultOnProfile()
      • getDefaultOffProfile

        protected abstract java.lang.String getDefaultOffProfile()
      • isActuated

        public java.lang.Boolean isActuated()
        Description copied from interface: Actuator
        Returns the Boolean state of the actuator i.e. whether the last actuation was not equal to the default off value. Returns null when the actuator state is unknown, i.e. when it was never actuated.
        Specified by:
        isActuated in interface Actuator
        Returns:
      • actuate

        public void actuate​(java.lang.Object value)
                     throws java.lang.Exception
        Description copied from interface: Actuator
        Provides the actuator with a generic value to which it can respond in an implementation dependent manner. This will ultimately call typed actuate() methods according to getValueType().
        Specified by:
        actuate in interface Actuator
        Throws:
        java.lang.Exception
      • actuateBoolean

        public final void actuateBoolean​(boolean value)
                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • actuateDouble

        public final void actuateDouble​(double value)
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • actuateString

        public final void actuateString​(java.lang.String value)
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • actuateObject

        public final void actuateObject​(java.lang.Object value)
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • assertOnOffDefined

        public void assertOnOffDefined()
                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • assertOnOffDefined

        public static void assertOnOffDefined​(Actuator actuator)
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • coordinateWithMachineBeforeActuate

        protected void coordinateWithMachineBeforeActuate()
                                                   throws java.lang.Exception
        The following three methods are used to execute the requested coordination between actuator and machine. They are separated by type to allow checking if coordination is requested and to use the minimum completion types required.
        Throws:
        java.lang.Exception
      • coordinateWithMachineAfterActuate

        protected void coordinateWithMachineAfterActuate()
                                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • coordinateWithMachineBeforeRead

        protected void coordinateWithMachineBeforeRead()
                                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • read

        public java.lang.String read()
                              throws java.lang.Exception
        Description copied from interface: Actuator
        Read a value from the actuator. The value will be returned exactly as provided by the Actuator and can be interpreted as needed by the caller.
        Specified by:
        read in interface Actuator
        Returns:
        The value read.
        Throws:
        java.lang.Exception - if there was an error reading the actuator.
      • isInterlockActuator

        public boolean isInterlockActuator()
      • setInterlockActuator

        public void setInterlockActuator​(boolean interlockActuator)