Package edu.wpi.grip.core.sockets
Class InputSocket.Decorator<T>
- java.lang.Object
-
- edu.wpi.grip.core.sockets.InputSocket.Decorator<T>
-
- Type Parameters:
T- The type of the value that this socket stores.
- All Implemented Interfaces:
InputSocket<T>,Socket<T>
- Enclosing interface:
- InputSocket<T>
public abstract static class InputSocket.Decorator<T> extends java.lang.Object implements InputSocket<T>
A decorator for theInputSocket.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface edu.wpi.grip.core.sockets.InputSocket
InputSocket.Decorator<T>, InputSocket.Factory
-
Nested classes/interfaces inherited from interface edu.wpi.grip.core.sockets.Socket
Socket.Direction
-
-
Constructor Summary
Constructors Constructor Description Decorator(InputSocket<T> socket)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnection(Connection connection)Adds a connection to the socket.booleandirtied()Checks if the socket has been dirtied and rests it to false.booleanequals(java.lang.Object o)java.util.Set<Connection>getConnections()Socket.DirectiongetDirection()INPUTif this is the input to a step,OUTPUTif this is the output of a step or source.SocketHint<T>getSocketHint()java.util.Optional<Source>getSource()If this socket is in a source return it.java.util.Optional<Step>getStep()If this socket is in a step return it.java.util.Optional<T>getValue()inthashCode()voidonValueChanged()Should be only called by parent classes.voidremoveConnection(Connection connection)Removes a connnection from this socket.voidsetSource(java.util.Optional<Source> source)voidsetStep(java.util.Optional<Step> step)voidsetValueOptional(java.util.Optional<? extends T> optionalValue)Set the value of the socket using anOptional, and fire off aSocketChangedEvent.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.wpi.grip.core.sockets.Socket
flagChanged, setValue, simpleString
-
-
-
-
Constructor Detail
-
Decorator
public Decorator(InputSocket<T> socket)
- Parameters:
socket- the decorated socket.
-
-
Method Detail
-
getDirection
public Socket.Direction getDirection()
Description copied from interface:SocketINPUTif this is the input to a step,OUTPUTif this is the output of a step or source.- Specified by:
getDirectionin interfaceSocket<T>- Returns:
- The direction of the socket.
-
getSource
public java.util.Optional<Source> getSource()
Description copied from interface:SocketIf this socket is in a source return it.- Specified by:
getSourcein interfaceSocket<T>- Returns:
- The source that this socket is part of.
- See Also:
Socket.getStep()
-
setSource
public void setSource(java.util.Optional<Source> source)
-
getStep
public java.util.Optional<Step> getStep()
Description copied from interface:SocketIf this socket is in a step return it.- Specified by:
getStepin interfaceSocket<T>- Returns:
- The step that this socket is part of
- See Also:
Socket.getSource()
-
setStep
public void setStep(java.util.Optional<Step> step)
-
getValue
public java.util.Optional<T> getValue()
-
addConnection
public void addConnection(Connection connection)
Description copied from interface:SocketAdds a connection to the socket.- Specified by:
addConnectionin interfaceSocket<T>- Parameters:
connection- The connection to add to this socket.
-
removeConnection
public void removeConnection(Connection connection)
Description copied from interface:SocketRemoves a connnection from this socket.- Specified by:
removeConnectionin interfaceSocket<T>- Parameters:
connection- The connection to remove from this socket.
-
getConnections
public java.util.Set<Connection> getConnections()
- Specified by:
getConnectionsin interfaceSocket<T>- Returns:
- The set of connections that have this socket as an input or output.
-
getSocketHint
public SocketHint<T> getSocketHint()
- Specified by:
getSocketHintin interfaceSocket<T>- Returns:
- A hint at what sort of data is in this socket.
-
setValueOptional
public void setValueOptional(java.util.Optional<? extends T> optionalValue)
Description copied from interface:SocketSet the value of the socket using anOptional, and fire off aSocketChangedEvent.- Specified by:
setValueOptionalin interfaceSocket<T>- Parameters:
optionalValue- The optional value to assign this socket to.
-
dirtied
public boolean dirtied()
Description copied from interface:InputSocketChecks if the socket has been dirtied and rests it to false.- Specified by:
dirtiedin interfaceInputSocket<T>- Returns:
- True if the socket has been dirtied.
-
onValueChanged
public void onValueChanged()
Description copied from interface:InputSocketShould be only called by parent classes.- Specified by:
onValueChangedin interfaceInputSocket<T>- Specified by:
onValueChangedin interfaceSocket<T>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-