Package org.refcodes.component
Class DeviceAutomatonImpl
- java.lang.Object
-
- org.refcodes.component.DeviceAutomatonImpl
-
- All Implemented Interfaces:
Closable,Closable.CloseAutomaton,ClosedAccessor,ConnectionStatusAccessor,LinkComponent,LinkComponent.LinkAutomaton,Openable,Openable.OpenAutomaton,OpenedAccessor
public class DeviceAutomatonImpl extends java.lang.Object implements LinkComponent.LinkAutomaton
This class implements aLifeCycleComponent.LifeCycleAutomaton.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.component.Closable
Closable.CloseAutomaton, Closable.CloseBuilder<B extends Closable.CloseBuilder<B>>
-
Nested classes/interfaces inherited from interface org.refcodes.component.ClosedAccessor
ClosedAccessor.ClosedMutator, ClosedAccessor.ClosedProperty
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor
ConnectionStatusAccessor.ConnectionStatusMutator, ConnectionStatusAccessor.ConnectionStatusProperty
-
Nested classes/interfaces inherited from interface org.refcodes.component.LinkComponent
LinkComponent.LinkAutomaton, LinkComponent.LinkComponentBuilder<B extends LinkComponent.LinkComponentBuilder<B>>
-
Nested classes/interfaces inherited from interface org.refcodes.component.Openable
Openable.OpenAutomaton, Openable.OpenBuilder<B extends Openable.OpenBuilder<B>>
-
Nested classes/interfaces inherited from interface org.refcodes.component.OpenedAccessor
OpenedAccessor.OpenedMutator, OpenedAccessor.OpenedProperty
-
-
Field Summary
Fields Modifier and Type Field Description protected LinkComponent_connectionComponent
-
Constructor Summary
Constructors Constructor Description DeviceAutomatonImpl()Empty constructor, suchLifeCycleComponent.LifeCycleAutomatoncannot do much more than decline the variousLifeCycleStatusstates for you.DeviceAutomatonImpl(LinkComponent aConnectionComponent)This constructor uses aLifeCycleStatusfor wrapping it inside theDeviceAutomatonImpl, making sure of obeying and guarding the correctLifeCycleStatus's order ofLifeCycleStatusstates for you.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the component's connection(s).ConnectionStatusgetConnectionStatus()Retrieves theConnectionStatusproperty from the property.booleanisClosable()Determines whether the component's connection(s) may get closed.booleanisClosed()Retrieves the is-closed status.booleanisOpenable()Determines whether the component's connection(s) may get opened.booleanisOpened()Retrieves the is-opened property from the opened property.voidopen()Open the component's connection(s).-
Methods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUnchecked
-
Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor
isConnectionOpened
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.refcodes.component.Openable
openUnchecked
-
-
-
-
Field Detail
-
_connectionComponent
protected LinkComponent _connectionComponent
-
-
Constructor Detail
-
DeviceAutomatonImpl
public DeviceAutomatonImpl()
Empty constructor, suchLifeCycleComponent.LifeCycleAutomatoncannot do much more than decline the variousLifeCycleStatusstates for you.
-
DeviceAutomatonImpl
public DeviceAutomatonImpl(LinkComponent aConnectionComponent)
This constructor uses aLifeCycleStatusfor wrapping it inside theDeviceAutomatonImpl, making sure of obeying and guarding the correctLifeCycleStatus's order ofLifeCycleStatusstates for you.- Parameters:
aConnectionComponent- The component to be guarded regarding the correct declination of theLifeCycleStatusstates.
-
-
Method Detail
-
getConnectionStatus
public ConnectionStatus getConnectionStatus()
Retrieves theConnectionStatusproperty from the property. Determines in whichConnectionStatusstatus a component is in.- Specified by:
getConnectionStatusin interfaceConnectionStatusAccessor- Returns:
- Returns the
ConnectionStatusproperty stored by the property.
-
isOpenable
public boolean isOpenable()
Determines whether the component's connection(s) may get opened.- Specified by:
isOpenablein interfaceOpenable.OpenAutomaton- Returns:
- True if
Openable.open()is possible.
-
open
public void open() throws OpenExceptionOpen the component's connection(s).- Specified by:
openin interfaceOpenable- Throws:
OpenException- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.
-
isOpened
public boolean isOpened()
Retrieves the is-opened property from the opened property. Determines whether the component's connection is opened. A component's connection is opened after being opened as ofOpenable.open()orConnectionOpenable.open(Object).- Specified by:
isOpenedin interfaceOpenedAccessor- Returns:
- True in case of being opened (returns the is-opened property stored by the opened property).
-
isClosable
public boolean isClosable()
Determines whether the component's connection(s) may get closed.- Specified by:
isClosablein interfaceClosable.CloseAutomaton- Returns:
- True if
Closable.close()is possible.
-
isClosed
public boolean isClosed()
Retrieves the is-closed status. Determines whether the component's connection is closed. A component's connection is closed after being closed as ofClosable.close().- Specified by:
isClosedin interfaceClosedAccessor- Returns:
- True in case of being closed.
-
close
public void close()
Closes the component's connection(s). Throws aCloseExceptionas upon close we may have to do things like flushing buffers which can fail (and would otherwise fail unhandled or even worse unnoticed).
-
-