java.lang.Object
org.refcodes.component.LinkAutomatonImpl
- All Implemented Interfaces:
Closable,Closable.CloseAutomaton,ClosedAccessor,ConnectionStatusAccessor,LinkComponent,LinkComponent.LinkAutomaton,Openable,Openable.OpenAutomaton,OpenedAccessor
This class implements a
LifecycleComponent.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.ClosedPropertyNested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor
ConnectionStatusAccessor.ConnectionStatusMutator, ConnectionStatusAccessor.ConnectionStatusPropertyNested 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 -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor, suchLifecycleComponent.LifecycleAutomatoncannot do much more than decline the variousLifecycleStatusstates for you.LinkAutomatonImpl(LinkComponent aConnectionComponent) This constructor uses aLifecycleStatusfor wrapping it inside theLinkAutomatonImpl, making sure of obeying and guarding the correctLifecycleStatus's order ofLifecycleStatusstates for you. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the component's connection(s).Retrieves theConnectionStatusproperty from the property.booleanDetermines whether the component's connection(s) may get closed.booleanisClosed()Retrieves the is-closed status.booleanDetermines 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUncheckedMethods inherited from interface org.refcodes.component.Openable
openUnchecked
-
Field Details
-
_connectionComponent
-
-
Constructor Details
-
LinkAutomatonImpl
public LinkAutomatonImpl()Empty constructor, suchLifecycleComponent.LifecycleAutomatoncannot do much more than decline the variousLifecycleStatusstates for you. -
LinkAutomatonImpl
This constructor uses aLifecycleStatusfor wrapping it inside theLinkAutomatonImpl, 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 Details
-
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
Open the component's connection(s).- Specified by:
openin interfaceOpenable- Throws:
IOException- 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 interfaceConnectionStatusAccessor- 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
Closes the component's connection(s). Throws aIOExceptionas upon close we may have to do things like flushing buffers which can fail (and would otherwise fail unhandled or even worse unnoticed).- Specified by:
closein interfaceClosable- Throws:
IOException- thrown in case closing failed.
-