/** * Private constructor for creating a One2NetChannel. This is called by the create method. * * @param ackChannel * The channel used to receive acknowledgements from Links * @param toLink * The channel used to send messages to the input end * @param link * The Link that this channel is connected to * @param chanData * The structure used to store the state of the channel * @param loc * The location of the input end that this channel is connected to * @param immunity * The poison immunity level of the channel * @param filter * Filter used to encode outgoing messages */ private One2NetChannel(AltingChannelInput ackChannel, ChannelOutput toLink, Link link, ChannelData chanData, NetChannelLocation loc, int immunity, NetworkMessageFilter.FilterTx filter) { // Set all the object properties for the channel this.toLinkTx = toLink; this.theAckChannel = ackChannel; this.data = chanData; this.remoteLocation = loc; this.localLocation = new NetChannelLocation(Node.getInstance().getNodeID(), chanData.vcn); this.data.immunityLevel = immunity; this.messageFilter = filter; // We now must either register with the Link connecting us to the input end, or we connect directly to the // channel if it is local if (link != null) { // We are connected to a remote Node. Register with Link this.linkConnectedTo = link; this.linkConnectedTo.registerChannel(this.data); // Set the localised parameters accordingly this.isLocal = false; this.localChannel = null; } else { // We are connected to an input end on this Node. Set the localised parameters this.isLocal = true; // Get hold of the local channel data structure this.localChannel = ChannelManager.getInstance().getChannel(this.remoteLocation.getVCN()); // Set the Link connected to to null this.linkConnectedTo = null; } }
public Regulate(AltingChannelInput In, AltingChannelInput reset, ChannelOutput Out, long initialInterval) { this.In = In; this.reset = reset; this.Out = Out; this.initialInterval = initialInterval; }
private NetAltingConnectionClient(AltingChannelInput input, ChannelOutput toLink, Link link, ConnectionData connData, NetConnectionLocation loc, NetworkMessageFilter.FilterTx filterTX, NetworkMessageFilter.FilterRx filterRX) : base(input) { this.toLinkTX = toLink; this.In = input; this.data = connData; this.serverLocation = loc; this.localLocation = new NetConnectionLocation(Node.getInstance().getNodeID(), connData.vconnn); this.outputFilter = filterTX; this.inputFilter = filterRX; if (link != null) { this.linkConnectedTo = link; // TODO: registration stuff this.isLocal = false; this.localConnection = null; } else { this.isLocal = true; this.localConnection = ConnectionManager.getInstance().getConnection(this.serverLocation.getVConnN()); this.linkConnectedTo = null; } }
public ResetUser(ChannelOutput resetValue, ChannelOutput toConsole, AltingChannelInput fromConverter, ChannelOutput toClearOutput) { this.resetValue = resetValue; this.toConsole = toConsole; this.fromConverter = fromConverter; this.toClearOutput = toClearOutput; }
public AltingBarrierGadget0( AltingChannelInput click, AltingBarrier group, ChannelOutput configure ) { this.click = click; this.group = group; this.configure = configure; }
public ResetPrefix(int prefixValue, ChannelOutput outChannel, AltingChannelInput inChannel, ChannelInput resetChannel) { this.prefixValue = prefixValue; this.outChannel = outChannel; this.inChannel = inChannel; this.resetChannel = resetChannel; }
public AltingBarrierExampleProcess( AltingChannelInput click, AltingBarrier group, ChannelOutput configure ) { this.click = click; this.group = group; this.configure = configure; }
/** * Constructs a new server instance. This must be called by a subclass which is responsible for * creating the channels. */ protected internal AltingConnectionServerImpl(AltingChannelInput openIn, AltingChannelInput furtherRequestIn) : base(openIn) { this.openIn = openIn; this.furtherRequestIn = furtherRequestIn; this.currentInputChannel = openIn; currentServerState = SERVER_STATE_CLOSED; }
public AltingBarrierExampleProcess( AltingChannelInput input, AltingBarrier barrier, ChannelOutput output, int num ) { this.input = input; this.barrier = barrier; this.output = output; this.num = num; }
private NetAltingConnectionServer(AltingChannelInput openChan, AltingChannelInput requestChan, ConnectionData connData, NetworkMessageFilter.FilterRx filterRX, NetworkMessageFilter.FilterTx filterTX) : base(openChan) ////throws JCSPNetworkException { this.openIn = openChan; this.requestIn = requestChan; this.data = connData; this.inputFilter = filterRX; this.outputFilter = filterTX; this.location = new NetConnectionLocation(Node.getInstance().getNodeID(), this.data.vconnn); }
/** * Constructs a new instance. This constructor must be called by a subclass which is responsible * for creating the channels used by the connection and must pass them into this constructor. */ protected internal AltingConnectionClientImpl(AltingChannelInput fromServer, ChannelOutput openToServer, ChannelOutput reqToServer, ChannelOutput backToClient) : base(fromServer) { this.fromServer = fromServer; this.openToServer = openToServer; this.reqToServer = reqToServer; this.backToClient = backToClient; currentClientState = CLIENT_STATE_CLOSED; }
protected internal SharedConnectionServerImpl(AltingChannelInput openIn, AltingChannelInput requestIn, ChannelInput synchIn, SharedChannelOutput synchOut, ConnectionWithSharedAltingServer parent) { connectionServerToUse = new AltingConnectionServerImpl(openIn, requestIn); this.synchOut = synchOut; this.synchIn = synchIn; this.parent = parent; }
/** * Private constructor for creating a new instance of a Net2OneChannel. This is called by the create method to * create the channel. * * @param input * The input channel connecting to the networked channel. * @param chanData * The ChannelData object representing the networked channel. * @param filter * The filter used to convert the incoming byte array to an object * @//throws JCSPNetworkException */ private Net2OneChannel(AltingChannelInput input, ChannelData chanData, NetworkMessageFilter.FilterRx filter) : base(input) //throws JCSPNetworkException { // Set the wrapper's alting channel input so the channel can be used as a guard // Set the various properties this.In = input; this.data = chanData; this.data.state = ChannelDataState.OK_INPUT; this.location = new NetChannelLocation(Node.getInstance().getNodeID(), this.data.vcn); this.messageFilter = filter; }
protected internal SharedAltingConnectionClient(AltingChannelInput fromServer, ChannelInput synchIn, ChannelOutput openToServer, ChannelOutput reqToServer, SharedChannelOutput synchOut, ChannelOutput backToClient, ConnectionWithSharedAltingClient parent) : base(fromServer, openToServer, reqToServer, backToClient) { this.synchIn = synchIn; this.synchOut = synchOut; this.parent = parent; }
public Polling( AltingChannelInput in0, AltingChannelInput in1, AltingChannelInput in2, AltingChannelInput in3, AltingChannelInput in4, ChannelOutput Out) { this.In0 = in0; this.In1 = in1; this.In2 = in2; this.In3 = in3; this.In4 = in4; this.Out = Out; }
/** * Creates a new filtered channel input end around an existing channel end. The created channel end * can be used as a guard in an <code>Alternative</code>. * * @param in the existing channel end. * @return the created channel end. */ public FilteredAltingChannelInput createFiltered(AltingChannelInput In) { return(new FilteredAltingChannelInput(In)); }
private AltingChannelInput supply; // from the Chef (1-1) public Canteen(AltingChannelInput service, AltingChannelInput supply, ChannelOutput deliver) { this.service = service; this.deliver = deliver; this.supply = supply; }
/** * <p> * Constructor. * </p> * <p> * Note that this is only intended for use by JCSP, and should * not be called by user processes. Users should use one of the * subclasses. * </p> * @param altingChannel The channel used to implement the Guard */ protected AltingConnectionClient(AltingChannelInput altingChannel) { this.altingChannel = altingChannel; }
public ResetNumbers(AltingChannelInput resetChannel, int initialValue, ChannelOutput outChannel) { this.resetChannel = resetChannel; this.initialValue = initialValue; this.outChannel = outChannel; }
/** * Creates a new filtered input channel end around an existing input channel end. The channel end * can be used as a guard in an <code>Alternative</code>. * * @param in the existing channel end to create a filtered form of. * @return the new channel end with filtering ability. */ public static FilteredAltingChannelInput createFiltered(AltingChannelInput In) { return(factory.createFiltered(In)); }
/** * Constructs a new channel end that supports filtering by wrapping up an existing channel end. * * @param altingChannelInput the existing channel end. */ internal FilteredAltingChannelInput(AltingChannelInput altingChannelInput) : base(altingChannelInput) { }
/** * Constructor. * * Note that this is only intended for use by JCSP, and should * not be called by user processes. Users should use one of the * subclasses. * * @param altingChannel The channel used to implement the Guard */ protected AltingConnectionServer(AltingChannelInput altingChannel) { this.altingChannel = altingChannel; }
/** * <code>ConnectionServer</code> implementations are likely to be * implemented over channels. Multiple channels from the client * to server may be used; one could be used for the initial * connection while another one could be used for data requests. * * This method allows sub-classes to specify which channel should * be the next one to be alted over. * * @param chan the channel to be ALTed over. */ protected void setAltingChannel(AltingChannelInput chan) { altingChannel = chan; }
/** * Creates a new NetAltingChannelInput, with the given channel as the guard * * @param in * The channel that is used within the alternative */ protected NetAltingChannelInput(AltingChannelInput In) : base(In) { }
public AltingExample(/*final*/ AltingChannelInput in0, /*final*/ AltingChannelInput in1) { this.in0 = in0; this.in1 = in1; }
/** * Sets the real channel to be used. * * @param chan the real channel to be used. */ protected void setChannel(AltingChannelInput chan) { this.channel = chan; }
/** * The constructor for a NetBarrier * * @param barData * The data structure defining the Barrier * @param numToEnroll * The number of local processes to enroll * @param netNumToEnroll * The number of network processes that will enroll * @param serverLocation * The location of the server end of the NetBarrier * @param inToBar * The channel into the NetBarrier from the Link * @param toLink * The channel connecting the client end of a NetBarrierer to its Link * @//throws ArgumentException * Thrown if the number of local enrolled processes is less than 1, or remote enrolled is less than 0 */ private NetBarrier(BarrierData barData, int numToEnroll, int netNumToEnroll, NetBarrierLocation serverLocation, AltingChannelInput inToBar, ChannelOutput toLink) ////throws ArgumentException { // First do some sanity checks if (numToEnroll < 1) { throw new ArgumentException("*** Attempt to set an enrollment of less than 1 on a NetBarrier *** \n"); } if (netNumToEnroll < 0) { throw new ArgumentException("*** Attempt to create a NetBarrier with negative remote enrolls *** \n"); } // Now set the standard parameters this.localEnrolled = numToEnroll; this.localCountDown = numToEnroll; this.data = barData; this.localLocation = new NetBarrierLocation(Node.getInstance().getNodeID(), this.data.vbn); this.In = inToBar; // Now check if we are a server or client end. if (this.data.state == BarrierDataState.OK_SERVER) { // We are a server end. There is no remote location, and we must set the networked enrolls this.remoteLocation = null; this.initialNetEnrollCountdown = netNumToEnroll; this.netEnrolled = netNumToEnroll; this.netCountDown = netNumToEnroll; } else { // We are a client end. Set the remote location this.remoteLocation = serverLocation; // Now, are we a locally connected barrier, or remote connected barrier if (serverLocation.getNodeID().equals(Node.getInstance().getNodeID())) { this.localBar = BarrierManager.getInstance().getBarrier(serverLocation.getVBN()); // We are remotely connected. Get the channel connected to the server end this.toLinkTX = this.localBar.toBarrier; // Now we need to check if we can still enroll with it lock (this.localBar) { if (this.localBar.state != BarrierDataState.OK_SERVER) { throw new JCSPNetworkException( "Attempted to enroll with a NetBarrier that is not a server end."); } // Set the locally connected flag to true. this.locallyConnected = true; // Send an enroll message NetworkMessage msg = new NetworkMessage(); msg.type = NetworkProtocol.ENROLL; // Destination is the VBN of the location, although this isn't used as we are locally connected msg.attr1 = serverLocation.getVBN(); // Attrubute 2 is not used msg.attr2 = -1; // Write the enroll to the server end this.toLinkTX.write(msg); // We do not need to register with a Link, as we do not go down to that layer. } } else { // Otherwise we are remotely connected. Set the link connection channel to the given one. this.toLinkTX = toLink; } } }
/** * Creates a new AltingChannelInputWrapper which wraps the specified * channel. */ public AltingChannelInputWrapper(AltingChannelInput channel) { this.channel = channel; }