1
//////////////////////////////////////////////////////////////////////
3
// JCSP ("CSP for Java") Libraries //
4
// Copyright (C) 1996-2008 Peter Welch and Paul Austin. //
5
// 2001-2004 Quickstone Technologies Limited. //
7
// This library is free software; you can redistribute it and/or //
8
// modify it under the terms of the GNU Lesser General Public //
9
// License as published by the Free Software Foundation; either //
10
// version 2.1 of the License, or (at your option) any later //
13
// This library is distributed in the hope that it will be //
14
// useful, but WITHOUT ANY WARRANTY; without even the implied //
15
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
16
// PURPOSE. See the GNU Lesser General Public License for more //
19
// You should have received a copy of the GNU Lesser General //
20
// Public License along with this library; if not, write to the //
21
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, //
22
// Boston, MA 02111-1307, USA. //
24
// Author contact: P.H.Welch@kent.ac.uk //
27
//////////////////////////////////////////////////////////////////////
29
package org.jcsp.plugNplay;
31
import org.jcsp.lang.*;
34
* The output stream is the tail of its input stream.
35
* <H2>Process Diagram</H2>
36
* <p><img src="doc-files/Tail1.gif"></p>
37
* <H2>Description</H2>
38
* The first Object (i.e. <i>head</i>) of its input stream is not forwarded.
39
* The rest (i.e. <i>tail</i>) is copied through unchanged.
41
* Two inputs are needed before any output
42
* is produced but, thereafter, one output is produced for each input.
44
* <H2>Channel Protocols</H2>
47
* <TH COLSPAN="3">Input Channels</TH>
51
* <TD>java.lang.Object</TD>
53
* The in Channel can accept data of any Class.
57
* <TH COLSPAN="3">Output Channels</TH>
61
* <TD>java.lang.Object</TD>
63
* The out Channel will send data of the same type
64
* as that sent down the in Channel.
69
* <H2>Implementation Note</H2>
70
* The implementation uses an {@link Identity} process for the copy loop:
72
* public void run () {
73
* in.read (); // accept, but discard, the first item
74
* new Identity (in, out).run (); // copy the rest of the stream
78
* @author P.H. Welch and P.D. Austin
81
public final class Tail implements CSProcess
83
/** The input Channel */
84
private ChannelInput in;
86
/** The output Channel */
87
private ChannelOutput out;
90
* Construct a new Tail process with the input Channel in and the
93
* @param in the input Channel
94
* @param out the output Channel
96
public Tail(ChannelInput in, ChannelOutput out)
103
* The main body of this process.
108
new Identity(in, out).run();