blob: 7cbb1cc463f9f49034cdc904bdbed19cd6392053 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
package net.cshift.transit.network;
import net.cshift.transit.network.packet.*;
/**
* @author Kyle Gunger
* @apiNote A node inside or outside a system.
*/
public interface INode
{
/** Returns a pool manifest for the INode
*
*/
public PoolManifest getManifest();
/** Get the system managing the node or {@code null} if there isn't one
*
*/
public ISystem getSystem();
// ###############
// # Connections #
// ###############
/** Call this function to establish a connection with a node.
*
* @param <T> The type of connection being asked for
* @param poolID The ID of the pool the channel will interface with (see PoolManifest)
* @param asker The asking node
* @return A channel if the node accepts the request, {@code null} otherwise
*/
public <T> Channel<T> connect(int poolID, INode asker);
/** Accept a packet from a channel (or not).
*
* @apiNote Do not call this function, use Channel.send(packet) instead.
* @param <T> The type of the packet and channel
* @param packet The packet to be vetted
* @param channel The channel which the packet is coming through
* @return The overflow data if the packet is only partially accepted. {@code null} otherwise.
*/
public <T> IStaticPacket<T> accept(IStaticPacket<T> packet, Channel<T> channel);
/** Pressure
*
* @apiNote Do not call this function, use Channel.pressure() instead.
* @param channel The channel asking for the pressure
* @return A Number representing the pressure from the channel (in base group units).
*/
public <T> Number getPressure(Channel<T> channel);
/** Transfer rate
*
* @apiNote Do not call this function, use Channel.rate() instead.
* @param channel The channel asking for the transfer rate
* @return A Number representing the transfer rate from the channel (in base group units per tick).
*/
public <T> Number getRate(Channel<T> channel);
/** Called when a channel is terminated
*
* @apiNote Do not call this function, use Channel.terminate() instead.
* @param <T> The type of the channel
* @param channel The channel being terminated
*/
public <T> void onTerminate(Channel<T> channel);
}
|