Class StandardChannelFactory<T>
- java.lang.Object
-
- 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
ChannelInputobject cannot be cast into theChannelOutputobject and vice-versa.The current implementation uses an instance of the
RiskyChannelFactoryto construct the underlying raw channels.- Author:
- Quickstone Technologies Limited
-
-
Constructor Summary
Constructors Constructor Description StandardChannelFactory()Constructs a new factory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Any2AnyChannel<T>createAny2Any()Constructs and returns anAny2AnyChannelobject.Any2AnyChannel[]createAny2Any(int n)Constructs and returns an array ofAny2AnyChannelobjects.Any2AnyChannel<T>createAny2Any(ChannelDataStore<T> buffer)Constructs and returns aAny2AnyChannelobject which uses the specifiedChannelDataStoreobject as a buffer.Any2AnyChannel<T>[]createAny2Any(ChannelDataStore<T> buffer, int n)Constructs and returns an array ofAny2AnyChannelobjects which use the specifiedChannelDataStoreobject as a buffer.Any2OneChannel<T>createAny2One()Constructs and returns anAny2OneChannelobject.Any2OneChannel<T>[]createAny2One(int n)Constructs and returns an array ofAny2OneChannelobjects.Any2OneChannel<T>createAny2One(ChannelDataStore<T> buffer)Constructs and returns aAny2OneChannelobject which uses the specifiedChannelDataStoreobject as a buffer.Any2OneChannel<T>[]createAny2One(ChannelDataStore<T> buffer, int n)Constructs and returns an array ofAny2OneChannelobjects which use the specifiedChannelDataStoreobject as a buffer.One2AnyChannel<T>createOne2Any()Constructs and returns aOne2AnyChannelobject.One2AnyChannel<T>[]createOne2Any(int n)Constructs and returns an array ofOne2AnyChannelobjects.One2AnyChannel<T>createOne2Any(ChannelDataStore<T> buffer)Constructs and returns aOne2AnyChannelobject which uses the specifiedChannelDataStoreobject as a buffer.One2AnyChannel<T>[]createOne2Any(ChannelDataStore<T> buffer, int n)Constructs and returns an array ofOne2AnyChannelobjects which use the specifiedChannelDataStoreobject as a buffer.One2OneChannel<T>createOne2One()Constructs and returns aOne2OneChannelobject.One2OneChannel<T>[]createOne2One(int n)Constructs and returns an array ofOne2OneChannelobjects.One2OneChannel<T>createOne2One(ChannelDataStore<T> buffer)Constructs and returns aOne2OneChannelobject which uses the specifiedChannelDataStoreobject as a buffer.One2OneChannel<T>[]createOne2One(ChannelDataStore<T> buffer, int n)Constructs and returns an array ofOne2OneChannelobjects which use the specifiedChannelDataStoreobject as a buffer.static StandardChannelFactorygetDefaultInstance()Returns a default instance of a channel factory.
-
-
-
Method Detail
-
getDefaultInstance
public static StandardChannelFactory getDefaultInstance()
Returns a default instance of a channel factory.
-
createOne2One
public One2OneChannel<T> createOne2One()
Constructs and returns aOne2OneChannelobject.- Specified by:
createOne2Onein interfaceChannelFactory<T>- Returns:
- the channel object.
- See Also:
ChannelFactory.createOne2One()
-
createAny2One
public Any2OneChannel<T> createAny2One()
Constructs and returns anAny2OneChannelobject.- Specified by:
createAny2Onein interfaceChannelFactory<T>- Returns:
- the channel object.
- See Also:
ChannelFactory.createAny2One()
-
createOne2Any
public One2AnyChannel<T> createOne2Any()
Constructs and returns aOne2AnyChannelobject.- Specified by:
createOne2Anyin interfaceChannelFactory<T>- Returns:
- the channel object.
- See Also:
ChannelFactory.createOne2Any()
-
createAny2Any
public Any2AnyChannel<T> createAny2Any()
Constructs and returns anAny2AnyChannelobject.- Specified by:
createAny2Anyin interfaceChannelFactory<T>- Returns:
- the channel object.
- See Also:
ChannelFactory.createAny2Any()
-
createOne2One
public One2OneChannel<T>[] createOne2One(int n)
Constructs and returns an array ofOne2OneChannelobjects.- Specified by:
createOne2Onein interfaceChannelArrayFactory<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 ofAny2OneChannelobjects.- Specified by:
createAny2Onein interfaceChannelArrayFactory<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 ofOne2AnyChannelobjects.- Specified by:
createOne2Anyin interfaceChannelArrayFactory<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 ofAny2AnyChannelobjects.- Specified by:
createAny2Anyin interfaceChannelArrayFactory<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
One2OneChannelobject which uses the specifiedChannelDataStoreobject as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Specified by:
createOne2Onein interfaceBufferedChannelFactory<T>- Parameters:
buffer- theChannelDataStoreto 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
Any2OneChannelobject which uses the specifiedChannelDataStoreobject as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Specified by:
createAny2Onein interfaceBufferedChannelFactory<T>- Parameters:
buffer- theChannelDataStoreto 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
One2AnyChannelobject which uses the specifiedChannelDataStoreobject as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Specified by:
createOne2Anyin interfaceBufferedChannelFactory<T>- Parameters:
buffer- theChannelDataStoreto 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
Any2AnyChannelobject which uses the specifiedChannelDataStoreobject as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Specified by:
createAny2Anyin interfaceBufferedChannelFactory<T>- Parameters:
buffer- theChannelDataStoreto 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
One2OneChannelobjects which use the specifiedChannelDataStoreobject 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:
createOne2Onein interfaceBufferedChannelArrayFactory<T>- Parameters:
buffer- theChannelDataStoreto 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
Any2OneChannelobjects which use the specifiedChannelDataStoreobject 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:
createAny2Onein interfaceBufferedChannelArrayFactory<T>- Parameters:
buffer- theChannelDataStoreto 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
One2AnyChannelobjects which use the specifiedChannelDataStoreobject 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:
createOne2Anyin interfaceBufferedChannelArrayFactory<T>- Parameters:
buffer- theChannelDataStoreto 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
Any2AnyChannelobjects which use the specifiedChannelDataStoreobject 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:
createAny2Anyin interfaceBufferedChannelArrayFactory<T>- Parameters:
buffer- theChannelDataStoreto 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
-
-