Class MostDirectConnectionSelector<C extends SCPSenderReceiver>

java.lang.Object
uk.ac.manchester.spinnaker.connections.MostDirectConnectionSelector<C>
Type Parameters:
C - The type of connections selected between.
All Implemented Interfaces:
ConnectionSelector<C>, MachineAware

public final class MostDirectConnectionSelector<C extends SCPSenderReceiver>
extends Object
implements ConnectionSelector<C>, MachineAware
A selector that goes for the most direct connection for the message.
  • Constructor Details

    • MostDirectConnectionSelector

      public MostDirectConnectionSelector​(Machine machine, Collection<C> connections)
      Create a selector.
      Parameters:
      machine - The machine, used to work out efficient routing strategies.
      connections - The connections that can be chosen between.
  • Method Details

    • getNextConnection

      public C getNextConnection​(SCPRequest<?> request)
      Description copied from interface: ConnectionSelector
      Get the next connection for the process from a list of connections that might satisfy the request.
      Specified by:
      getNextConnection in interface ConnectionSelector<C extends SCPSenderReceiver>
      Parameters:
      request - The SCP message to be sent
      Returns:
      The connection on which the message should be sent.
    • hasDirectConnectionFor

      public boolean hasDirectConnectionFor​(Chip ethernetChip)
      Tests if this connection selector will be able to make a direct connection to the given ethernet chip.
      Parameters:
      ethernetChip - The ethernet chip that we are testing for direct routing to.
      Returns:
      True iff we can talk directly to it using a connection that this selector knows about.
    • getMachine

      public Machine getMachine()
      Specified by:
      getMachine in interface MachineAware
      Returns:
      The machine that the class was told about.
    • setMachine

      public void setMachine​(Machine machine)
      Specified by:
      setMachine in interface MachineAware
      Parameters:
      machine - The machine to tell the class about.