CSP for Java
(JCSP) 1.1-rc4

org.jcsp.lang
Class StandardChannelFactory

java.lang.Object
  extended by org.jcsp.lang.StandardChannelFactory
All Implemented Interfaces:
BufferedChannelArrayFactory, BufferedChannelFactory, ChannelArrayFactory, ChannelFactory

public class StandardChannelFactory
extends Object
implements ChannelFactory, ChannelArrayFactory, BufferedChannelFactory, BufferedChannelArrayFactory

This class acts as a Factory for creating channels. It can create non-buffered and buffered channels and also arrays of non-buffered and buffered channels.

The Channel objects created by this Factory are formed of separate objects for the read and write ends. Therefore the ChannelInput object cannot be cast into the ChannelOutput object and vice-versa.

The current implementation uses an instance of the RiskyChannelFactory to construct the underlying raw channels.

Author:
Quickstone Technologies Limited

Constructor Summary
StandardChannelFactory()
          Constructs a new factory.
 
Method Summary
 Any2AnyChannel createAny2Any()
          Constructs and returns an Any2AnyChannel object.
 Any2AnyChannel createAny2Any(ChannelDataStore buffer)
          Constructs and returns a Any2AnyChannel object which uses the specified ChannelDataStore object as a buffer.
 Any2AnyChannel[] createAny2Any(ChannelDataStore buffer, int n)
          Constructs and returns an array of Any2AnyChannel objects which use the specified ChannelDataStore object as a buffer.
 Any2AnyChannel[] createAny2Any(int n)
          Constructs and returns an array of Any2AnyChannel objects.
 Any2OneChannel createAny2One()
          Constructs and returns an Any2OneChannel object.
 Any2OneChannel createAny2One(ChannelDataStore buffer)
          Constructs and returns a Any2OneChannel object which uses the specified ChannelDataStore object as a buffer.
 Any2OneChannel[] createAny2One(ChannelDataStore buffer, int n)
          Constructs and returns an array of Any2OneChannel objects which use the specified ChannelDataStore object as a buffer.
 Any2OneChannel[] createAny2One(int n)
          Constructs and returns an array of Any2OneChannel objects.
 One2AnyChannel createOne2Any()
          Constructs and returns a One2AnyChannel object.
 One2AnyChannel createOne2Any(ChannelDataStore buffer)
          Constructs and returns a One2AnyChannel object which uses the specified ChannelDataStore object as a buffer.
 One2AnyChannel[] createOne2Any(ChannelDataStore buffer, int n)
          Constructs and returns an array of One2AnyChannel objects which use the specified ChannelDataStore object as a buffer.
 One2AnyChannel[] createOne2Any(int n)
          Constructs and returns an array of One2AnyChannel objects.
 One2OneChannel createOne2One()
          Constructs and returns a One2OneChannel object.
 One2OneChannel createOne2One(ChannelDataStore buffer)
          Constructs and returns a One2OneChannel object which uses the specified ChannelDataStore object as a buffer.
 One2OneChannel[] createOne2One(ChannelDataStore buffer, int n)
          Constructs and returns an array of One2OneChannel objects which use the specified ChannelDataStore object as a buffer.
 One2OneChannel[] createOne2One(int n)
          Constructs and returns an array of One2OneChannel objects.
static StandardChannelFactory getDefaultInstance()
          Returns a default instance of a channel factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardChannelFactory

public StandardChannelFactory()
Constructs a new factory.

Method Detail

getDefaultInstance

public static StandardChannelFactory getDefaultInstance()
Returns a default instance of a channel factory.


createOne2One

public One2OneChannel createOne2One()
Constructs and returns a One2OneChannel object.

Specified by:
createOne2One in interface ChannelFactory
Returns:
the channel object.
See Also:
ChannelFactory.createOne2One()

createAny2One

public Any2OneChannel createAny2One()
Constructs and returns an Any2OneChannel object.

Specified by:
createAny2One in interface ChannelFactory
Returns:
the channel object.
See Also:
ChannelFactory.createAny2One()

createOne2Any

public One2AnyChannel createOne2Any()
Constructs and returns a One2AnyChannel object.

Specified by:
createOne2Any in interface ChannelFactory
Returns:
the channel object.
See Also:
ChannelFactory.createOne2Any()

createAny2Any

public Any2AnyChannel createAny2Any()
Constructs and returns an Any2AnyChannel object.

Specified by:
createAny2Any in interface ChannelFactory
Returns:
the channel object.
See Also:
ChannelFactory.createAny2Any()

createOne2One

public One2OneChannel[] createOne2One(int n)
Constructs and returns an array of One2OneChannel objects.

Specified by:
createOne2One in interface ChannelArrayFactory
Parameters:
n - the size of the array of channels.
Returns:
the array of channels.
See Also:
ChannelArrayFactory.createOne2One(int)

createAny2One

public Any2OneChannel[] createAny2One(int n)
Constructs and returns an array of Any2OneChannel objects.

Specified by:
createAny2One in interface ChannelArrayFactory
Parameters:
n - the size of the array of channels.
Returns:
the array of channels.
See Also:
ChannelArrayFactory.createAny2One(int)

createOne2Any

public One2AnyChannel[] createOne2Any(int n)
Constructs and returns an array of One2AnyChannel objects.

Specified by:
createOne2Any in interface ChannelArrayFactory
Parameters:
n - the size of the array of channels.
Returns:
the array of channels.
See Also:
ChannelArrayFactory.createOne2Any(int)

createAny2Any

public Any2AnyChannel[] createAny2Any(int n)
Constructs and returns an array of Any2AnyChannel objects.

Specified by:
createAny2Any in interface ChannelArrayFactory
Parameters:
n - the size of the array of channels.
Returns:
the array of channels.
See Also:
ChannelArrayFactory.createAny2Any(int)

createOne2One

public One2OneChannel createOne2One(ChannelDataStore buffer)

Constructs and returns a One2OneChannel object which uses the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel.

Specified by:
createOne2One in interface BufferedChannelFactory
Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createOne2One(org.jcsp.util.ChannelDataStore), ChannelDataStore

createAny2One

public Any2OneChannel createAny2One(ChannelDataStore buffer)

Constructs and returns a Any2OneChannel object which uses the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel.

Specified by:
createAny2One in interface BufferedChannelFactory
Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createAny2One(org.jcsp.util.ChannelDataStore), ChannelDataStore

createOne2Any

public One2AnyChannel createOne2Any(ChannelDataStore buffer)

Constructs and returns a One2AnyChannel object which uses the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel.

Specified by:
createOne2Any in interface BufferedChannelFactory
Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createOne2Any(org.jcsp.util.ChannelDataStore), ChannelDataStore

createAny2Any

public Any2AnyChannel createAny2Any(ChannelDataStore buffer)

Constructs and returns a Any2AnyChannel object which uses the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel.

Specified by:
createAny2Any in interface BufferedChannelFactory
Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createAny2Any(org.jcsp.util.ChannelDataStore), ChannelDataStore

createOne2One

public One2OneChannel[] createOne2One(ChannelDataStore buffer,
                                      int n)

Constructs and returns an array of One2OneChannel objects which use the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel. This is why an array of buffers is not required.

Specified by:
createOne2One in interface BufferedChannelArrayFactory
Parameters:
buffer - the ChannelDataStore to use.
n - the size of the array of channels.
Returns:
the array of buffered channels.
See Also:
BufferedChannelArrayFactory.createOne2One(org.jcsp.util.ChannelDataStore,int), ChannelDataStore

createAny2One

public Any2OneChannel[] createAny2One(ChannelDataStore buffer,
                                      int n)

Constructs and returns an array of Any2OneChannel objects which use the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel. This is why an array of buffers is not required.

Specified by:
createAny2One in interface BufferedChannelArrayFactory
Parameters:
buffer - the ChannelDataStore to use.
n - the size of the array of channels.
Returns:
the array of buffered channels.
See Also:
BufferedChannelArrayFactory.createAny2One(org.jcsp.util.ChannelDataStore,int), ChannelDataStore

createOne2Any

public One2AnyChannel[] createOne2Any(ChannelDataStore buffer,
                                      int n)

Constructs and returns an array of One2AnyChannel objects which use the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel. This is why an array of buffers is not required.

Specified by:
createOne2Any in interface BufferedChannelArrayFactory
Parameters:
buffer - the ChannelDataStore to use.
n - the size of the array of channels.
Returns:
the array of buffered channels.
See Also:
BufferedChannelArrayFactory.createOne2Any(org.jcsp.util.ChannelDataStore,int), ChannelDataStore

createAny2Any

public Any2AnyChannel[] createAny2Any(ChannelDataStore buffer,
                                      int n)

Constructs and returns an array of Any2AnyChannel objects which use the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel. This is why an array of buffers is not required.

Specified by:
createAny2Any in interface BufferedChannelArrayFactory
Parameters:
buffer - the ChannelDataStore to use.
n - the size of the array of channels.
Returns:
the array of buffered channels.
See Also:
BufferedChannelArrayFactory.createAny2Any(org.jcsp.util.ChannelDataStore,int), ChannelDataStore

CSP for Java
(JCSP) 1.1-rc4

Submit a bug or feature to jcsp-team@kent.ac.uk
Version 1.1-rc4 of the JCSP API Specification (Copyright 1997-2008 P.D.Austin and P.H.Welch - All Rights Reserved)
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.