org.jcsp.lang
Class StandardChannelFactory<T>

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

public class StandardChannelFactory<T>
extends Object
implements ChannelFactory<T>, ChannelArrayFactory<T>, BufferedChannelFactory<T>, BufferedChannelArrayFactory<T>

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<T> createAny2Any()
          Constructs and returns an Any2AnyChannel object.
 Any2AnyChannel<T> createAny2Any(ChannelDataStore<T> buffer)
          Constructs and returns a Any2AnyChannel object which uses the specified ChannelDataStore object as a buffer.
 Any2AnyChannel<T>[] createAny2Any(ChannelDataStore<T> 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<T> createAny2One()
          Constructs and returns an Any2OneChannel object.
 Any2OneChannel<T> createAny2One(ChannelDataStore<T> buffer)
          Constructs and returns a Any2OneChannel object which uses the specified ChannelDataStore object as a buffer.
 Any2OneChannel<T>[] createAny2One(ChannelDataStore<T> buffer, int n)
          Constructs and returns an array of Any2OneChannel objects which use the specified ChannelDataStore object as a buffer.
 Any2OneChannel<T>[] createAny2One(int n)
          Constructs and returns an array of Any2OneChannel objects.
 One2AnyChannel<T> createOne2Any()
          Constructs and returns a One2AnyChannel object.
 One2AnyChannel<T> createOne2Any(ChannelDataStore<T> buffer)
          Constructs and returns a One2AnyChannel object which uses the specified ChannelDataStore object as a buffer.
 One2AnyChannel<T>[] createOne2Any(ChannelDataStore<T> buffer, int n)
          Constructs and returns an array of One2AnyChannel objects which use the specified ChannelDataStore object as a buffer.
 One2AnyChannel<T>[] createOne2Any(int n)
          Constructs and returns an array of One2AnyChannel objects.
 One2OneChannel<T> createOne2One()
          Constructs and returns a One2OneChannel object.
 One2OneChannel<T> createOne2One(ChannelDataStore<T> buffer)
          Constructs and returns a One2OneChannel object which uses the specified ChannelDataStore object as a buffer.
 One2OneChannel<T>[] createOne2One(ChannelDataStore<T> buffer, int n)
          Constructs and returns an array of One2OneChannel objects which use the specified ChannelDataStore object as a buffer.
 One2OneChannel<T>[] 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<T> createOne2One()
Constructs and returns a One2OneChannel object.

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

createAny2One

public Any2OneChannel<T> createAny2One()
Constructs and returns an Any2OneChannel object.

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

createOne2Any

public One2AnyChannel<T> createOne2Any()
Constructs and returns a One2AnyChannel object.

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

createAny2Any

public Any2AnyChannel<T> createAny2Any()
Constructs and returns an Any2AnyChannel object.

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

createOne2One

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

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

createAny2One

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

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

createOne2Any

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

Specified by:
createOne2Any in interface ChannelArrayFactory<T>
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<T>
Parameters:
n - the size of the array of channels.
Returns:
the array of channels.
See Also:
ChannelArrayFactory.createAny2Any(int)

createOne2One

public One2OneChannel<T> createOne2One(ChannelDataStore<T> 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<T>
Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createOne2One(org.jcsp.util.ChannelDataStore), ChannelDataStore

createAny2One

public Any2OneChannel<T> createAny2One(ChannelDataStore<T> 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<T>
Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createAny2One(org.jcsp.util.ChannelDataStore), ChannelDataStore

createOne2Any

public One2AnyChannel<T> createOne2Any(ChannelDataStore<T> 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<T>
Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createOne2Any(org.jcsp.util.ChannelDataStore), ChannelDataStore

createAny2Any

public Any2AnyChannel<T> createAny2Any(ChannelDataStore<T> 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<T>
Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createAny2Any(org.jcsp.util.ChannelDataStore), ChannelDataStore

createOne2One

public One2OneChannel<T>[] createOne2One(ChannelDataStore<T> 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<T>
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<T>[] createAny2One(ChannelDataStore<T> 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<T>
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<T>[] createOne2Any(ChannelDataStore<T> 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<T>
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<T>[] createAny2Any(ChannelDataStore<T> 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<T>
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


Copyright © 1996-2012. All Rights Reserved.