public class StandardChannelFactory<T> extends java.lang.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.
Constructor and Description |
---|
StandardChannelFactory()
Constructs a new factory.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public static StandardChannelFactory getDefaultInstance()
public One2OneChannel<T> createOne2One()
One2OneChannel
object.createOne2One
in interface ChannelFactory<T>
ChannelFactory.createOne2One()
public Any2OneChannel<T> createAny2One()
Any2OneChannel
object.createAny2One
in interface ChannelFactory<T>
ChannelFactory.createAny2One()
public One2AnyChannel<T> createOne2Any()
One2AnyChannel
object.createOne2Any
in interface ChannelFactory<T>
ChannelFactory.createOne2Any()
public Any2AnyChannel<T> createAny2Any()
Any2AnyChannel
object.createAny2Any
in interface ChannelFactory<T>
ChannelFactory.createAny2Any()
public One2OneChannel<T>[] createOne2One(int n)
One2OneChannel
objects.createOne2One
in interface ChannelArrayFactory<T>
n
- the size of the array of channels.ChannelArrayFactory.createOne2One(int)
public Any2OneChannel<T>[] createAny2One(int n)
Any2OneChannel
objects.createAny2One
in interface ChannelArrayFactory<T>
n
- the size of the array of channels.ChannelArrayFactory.createAny2One(int)
public One2AnyChannel<T>[] createOne2Any(int n)
One2AnyChannel
objects.createOne2Any
in interface ChannelArrayFactory<T>
n
- the size of the array of channels.ChannelArrayFactory.createOne2Any(int)
public Any2AnyChannel[] createAny2Any(int n)
Any2AnyChannel
objects.createAny2Any
in interface ChannelArrayFactory<T>
n
- the size of the array of channels.ChannelArrayFactory.createAny2Any(int)
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.
createOne2One
in interface BufferedChannelFactory<T>
buffer
- the ChannelDataStore
to use.BufferedChannelFactory.createOne2One(org.jcsp.util.ChannelDataStore)
,
ChannelDataStore
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.
createAny2One
in interface BufferedChannelFactory<T>
buffer
- the ChannelDataStore
to use.BufferedChannelFactory.createAny2One(org.jcsp.util.ChannelDataStore)
,
ChannelDataStore
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.
createOne2Any
in interface BufferedChannelFactory<T>
buffer
- the ChannelDataStore
to use.BufferedChannelFactory.createOne2Any(org.jcsp.util.ChannelDataStore)
,
ChannelDataStore
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.
createAny2Any
in interface BufferedChannelFactory<T>
buffer
- the ChannelDataStore
to use.BufferedChannelFactory.createAny2Any(org.jcsp.util.ChannelDataStore)
,
ChannelDataStore
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.
createOne2One
in interface BufferedChannelArrayFactory<T>
buffer
- the ChannelDataStore
to use.n
- the size of the array of channels.BufferedChannelArrayFactory.createOne2One(org.jcsp.util.ChannelDataStore,int)
,
ChannelDataStore
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.
createAny2One
in interface BufferedChannelArrayFactory<T>
buffer
- the ChannelDataStore
to use.n
- the size of the array of channels.BufferedChannelArrayFactory.createAny2One(org.jcsp.util.ChannelDataStore,int)
,
ChannelDataStore
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.
createOne2Any
in interface BufferedChannelArrayFactory<T>
buffer
- the ChannelDataStore
to use.n
- the size of the array of channels.BufferedChannelArrayFactory.createOne2Any(org.jcsp.util.ChannelDataStore,int)
,
ChannelDataStore
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.
createAny2Any
in interface BufferedChannelArrayFactory<T>
buffer
- the ChannelDataStore
to use.n
- the size of the array of channels.BufferedChannelArrayFactory.createAny2Any(org.jcsp.util.ChannelDataStore,int)
,
ChannelDataStore
Copyright © 1996–2019. All rights reserved.