Class StandardChannelFactory
- java.lang.Object
-
- org.jcsp.lang.StandardChannelFactory
-
- All Implemented Interfaces:
BufferedChannelArrayFactory
,BufferedChannelFactory
,ChannelArrayFactory
,ChannelFactory
public class StandardChannelFactory extends java.lang.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 theChannelOutput
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
Constructors Constructor Description StandardChannelFactory()
Constructs a new factory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Any2AnyChannel
createAny2Any()
Constructs and returns anAny2AnyChannel
object.Any2AnyChannel[]
createAny2Any(int n)
Constructs and returns an array ofAny2AnyChannel
objects.Any2AnyChannel
createAny2Any(ChannelDataStore buffer)
Constructs and returns aAny2AnyChannel
object which uses the specifiedChannelDataStore
object as a buffer.Any2AnyChannel[]
createAny2Any(ChannelDataStore buffer, int n)
Constructs and returns an array ofAny2AnyChannel
objects which use the specifiedChannelDataStore
object as a buffer.Any2OneChannel
createAny2One()
Constructs and returns anAny2OneChannel
object.Any2OneChannel[]
createAny2One(int n)
Constructs and returns an array ofAny2OneChannel
objects.Any2OneChannel
createAny2One(ChannelDataStore buffer)
Constructs and returns aAny2OneChannel
object which uses the specifiedChannelDataStore
object as a buffer.Any2OneChannel[]
createAny2One(ChannelDataStore buffer, int n)
Constructs and returns an array ofAny2OneChannel
objects which use the specifiedChannelDataStore
object as a buffer.One2AnyChannel
createOne2Any()
Constructs and returns aOne2AnyChannel
object.One2AnyChannel[]
createOne2Any(int n)
Constructs and returns an array ofOne2AnyChannel
objects.One2AnyChannel
createOne2Any(ChannelDataStore buffer)
Constructs and returns aOne2AnyChannel
object which uses the specifiedChannelDataStore
object as a buffer.One2AnyChannel[]
createOne2Any(ChannelDataStore buffer, int n)
Constructs and returns an array ofOne2AnyChannel
objects which use the specifiedChannelDataStore
object as a buffer.One2OneChannel
createOne2One()
Constructs and returns aOne2OneChannel
object.One2OneChannel[]
createOne2One(int n)
Constructs and returns an array ofOne2OneChannel
objects.One2OneChannel
createOne2One(ChannelDataStore buffer)
Constructs and returns aOne2OneChannel
object which uses the specifiedChannelDataStore
object as a buffer.One2OneChannel[]
createOne2One(ChannelDataStore buffer, int n)
Constructs and returns an array ofOne2OneChannel
objects which use the specifiedChannelDataStore
object as a buffer.static StandardChannelFactory
getDefaultInstance()
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 createOne2One()
Constructs and returns aOne2OneChannel
object.- Specified by:
createOne2One
in interfaceChannelFactory
- Returns:
- the channel object.
- See Also:
ChannelFactory.createOne2One()
-
createAny2One
public Any2OneChannel createAny2One()
Constructs and returns anAny2OneChannel
object.- Specified by:
createAny2One
in interfaceChannelFactory
- Returns:
- the channel object.
- See Also:
ChannelFactory.createAny2One()
-
createOne2Any
public One2AnyChannel createOne2Any()
Constructs and returns aOne2AnyChannel
object.- Specified by:
createOne2Any
in interfaceChannelFactory
- Returns:
- the channel object.
- See Also:
ChannelFactory.createOne2Any()
-
createAny2Any
public Any2AnyChannel createAny2Any()
Constructs and returns anAny2AnyChannel
object.- Specified by:
createAny2Any
in interfaceChannelFactory
- Returns:
- the channel object.
- See Also:
ChannelFactory.createAny2Any()
-
createOne2One
public One2OneChannel[] createOne2One(int n)
Constructs and returns an array ofOne2OneChannel
objects.- Specified by:
createOne2One
in interfaceChannelArrayFactory
- 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 ofAny2OneChannel
objects.- Specified by:
createAny2One
in interfaceChannelArrayFactory
- 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 ofOne2AnyChannel
objects.- Specified by:
createOne2Any
in interfaceChannelArrayFactory
- 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 ofAny2AnyChannel
objects.- Specified by:
createAny2Any
in interfaceChannelArrayFactory
- 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 specifiedChannelDataStore
object as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Specified by:
createOne2One
in interfaceBufferedChannelFactory
- Parameters:
buffer
- theChannelDataStore
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 specifiedChannelDataStore
object as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Specified by:
createAny2One
in interfaceBufferedChannelFactory
- Parameters:
buffer
- theChannelDataStore
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 specifiedChannelDataStore
object as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Specified by:
createOne2Any
in interfaceBufferedChannelFactory
- Parameters:
buffer
- theChannelDataStore
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 specifiedChannelDataStore
object as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Specified by:
createAny2Any
in interfaceBufferedChannelFactory
- Parameters:
buffer
- theChannelDataStore
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 specifiedChannelDataStore
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 interfaceBufferedChannelArrayFactory
- Parameters:
buffer
- theChannelDataStore
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 specifiedChannelDataStore
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 interfaceBufferedChannelArrayFactory
- Parameters:
buffer
- theChannelDataStore
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 specifiedChannelDataStore
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 interfaceBufferedChannelArrayFactory
- Parameters:
buffer
- theChannelDataStore
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 specifiedChannelDataStore
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 interfaceBufferedChannelArrayFactory
- Parameters:
buffer
- theChannelDataStore
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
-
-