Package org.jcsp.util.filter

# Class FilteredChannelFactory

java.lang.Object
org.jcsp.util.filter.FilteredChannelFactory

All Implemented Interfaces:
  `BufferedChannelArrayFactory`, `BufferedChannelFactory`, `ChannelArrayFactory`, `ChannelFactory`

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

This class is used for constructing Filtered Channels. The objects returned by instances of this class will implement the appropriate Filtered Channel interfaces even though the return types are not declared as being Filtered Channels. This is so that this class can implement the `ChannelFactory` and `ChannelArrayFactory` interfaces. Instances of this class can therefore be used in place of the standard channel factory classes.

A set of read and/or write filters can be specified so that all of the channels created by this factory will have the same buffering properties.

Author:
  Quickstone Technologies Limited

## Constructor Summary

Constructors
Constructor
Description
`FilteredChannelFactory()`
All channels constructed with a Factory constructed with this constructor will default to having no pre-installed filters.
`FilteredChannelFactory(Filter[] readFilters, Filter[] writeFilters)`
All channels constructed with this Factory instance will have the specified `Filter` objects inserted into them.

## Method Summary

Modifier and Type
Method
Description
`Any2AnyChannel`
`createAny2Any()`
Creates a new Any2Any channel with the filtering options set for this factory.
`Any2AnyChannel[]`
`createAny2Any(int n)`
Constructs and returns an array of `Any2AnyChannel` objects.
`Any2AnyChannel`
`createAny2Any(ChannelDataStore buffer)`
Creates a new Any2Any channel with the filtering options set for this factory and the specified data buffer.
`Any2AnyChannel[]`
`createAny2Any(ChannelDataStore buffer, int n)`
Constructs and returns an array of `Any2AnyChannel` objects with a given buffering behaviour.
`Any2OneChannel`
`createAny2One()`
Creates a new Any2One channel with the filtering options set for this factory.
`Any2OneChannel[]`
`createAny2One(int n)`
Constructs and returns an array of `Any2OneChannel` objects.
`Any2OneChannel`
`createAny2One(ChannelDataStore buffer)`
Creates a new Any2One channel with the filtering options set for this factory and the specified data buffer.
`Any2OneChannel[]`
`createAny2One(ChannelDataStore buffer, int n)`
Constructs and returns an array of `Any2OneChannel` objects with a given buffering behaviour.
`One2AnyChannel`
`createOne2Any()`
Creates a new One2Any channel with the filtering options set for this factory.
`One2AnyChannel[]`
`createOne2Any(int n)`
Constructs and returns an array of `One2AnyChannel` objects.
`One2AnyChannel`
`createOne2Any(ChannelDataStore buffer)`
Creates a new One2Any channel with the filtering options set for this factory and the specified data buffer.
`One2AnyChannel[]`
`createOne2Any(ChannelDataStore buffer, int n)`
Constructs and returns an array of `One2AnyChannel` objects with a given buffering behaviour.
`One2OneChannel`
`createOne2One()`
Creates a new One2One channel with the filtering options set for this factory.
`One2OneChannel[]`
`createOne2One(int n)`
Constructs and returns an array of `One2OneChannel` objects.
`One2OneChannel`
`createOne2One(ChannelDataStore buffer)`
Creates a new One2One channel with the filtering options set for this factory and the specified data buffer.
`One2OneChannel[]`
`createOne2One(ChannelDataStore buffer, int n)`
Constructs and returns an array of `One2OneChannel` objects with a given buffering behaviour.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### FilteredChannelFactory

public FilteredChannelFactory()
All channels constructed with a Factory constructed with this constructor will default to having no pre-installed filters.

### FilteredChannelFactory

public FilteredChannelFactory(Filter[] readFilters, Filter[] writeFilters)

All channels constructed with this Factory instance will have the specified `Filter` objects inserted into them. The same instances of the filters will be inserted into each channel.

Either of the parameters may be `null` if read/write filters are not required.

Parameters:
  `readFilters` - optional read filters to install in new channels.
  `writeFilters` - optional write filters to install in new channels.

## Method Details

### createOne2One

public One2OneChannel createOne2One()
Creates a new One2One channel with the filtering options set for this factory.

Specified by:
  `createOne2One` in interface `ChannelFactory`
Returns:
  the created channel with the filters installed.

### createAny2One

public Any2OneChannel createAny2One()
Creates a new Any2One channel with the filtering options set for this factory.

Specified by:
  `createAny2One` in interface `ChannelFactory`
Returns:
  the created channel with the filters installed.

### createOne2Any

public One2AnyChannel createOne2Any()
Creates a new One2Any channel with the filtering options set for this factory.

Specified by:
  `createOne2Any` in interface `ChannelFactory`
Returns:
  the created channel with the filters installed.

### createAny2Any

public Any2AnyChannel createAny2Any()
Creates a new Any2Any channel with the filtering options set for this factory.

Specified by:
  `createAny2Any` in interface `ChannelFactory`
Returns:
  the created channel with the filters installed.

### 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)
Creates a new One2One channel with the filtering options set for this factory and the specified data buffer.

Specified by:
  `createOne2One` in interface `BufferedChannelFactory`
Parameters:
  `buffer` - the buffer implementation to use.
Returns:
  the created filtered channel.

### createAny2One

public Any2OneChannel createAny2One(ChannelDataStore buffer)
Creates a new Any2One channel with the filtering options set for this factory and the specified data buffer.

Specified by:
  `createAny2One` in interface `BufferedChannelFactory`
Parameters:
  `buffer` - the buffer implementation to use.
Returns:
  the created filtered channel.

### createOne2Any

public One2AnyChannel createOne2Any(ChannelDataStore buffer)
Creates a new One2Any channel with the filtering options set for this factory and the specified data buffer.

Specified by:
  `createOne2Any` in interface `BufferedChannelFactory`
Parameters:
  `buffer` - the buffer implementation to use.
Returns:
  the created filtered channel.

### createAny2Any

public Any2AnyChannel createAny2Any(ChannelDataStore buffer)
Creates a new Any2Any channel with the filtering options set for this factory and the specified data buffer.

Specified by:
  `createAny2Any` in interface `BufferedChannelFactory`
Parameters:
  `buffer` - the buffer implementation to use.
Returns:
  the created filtered channel.

### createOne2One

public One2OneChannel[] createOne2One(ChannelDataStore buffer, int n)
Constructs and returns an array of `One2OneChannel` objects with a given buffering behaviour.

Specified by:
  `createOne2One` in interface `BufferedChannelArrayFactory`
Parameters:
  `buffer` - the buffer implementation to use.
  `n` - the size of the array of channels.
Returns:
  the array of channels.
See Also:
  - `ChannelArrayFactory.createOne2One(int)`

### createAny2One

public Any2OneChannel[] createAny2One(ChannelDataStore buffer, int n)
Constructs and returns an array of `Any2OneChannel` objects with a given buffering behaviour.

Specified by:
  `createAny2One` in interface `BufferedChannelArrayFactory`
Parameters:
  `buffer` - the buffer implementation to use.
  `n` - the size of the array of channels.
Returns:
  the array of channels.
See Also:
  - `ChannelArrayFactory.createAny2One(int)`

### createOne2Any

public One2AnyChannel[] createOne2Any(ChannelDataStore buffer, int n)
Constructs and returns an array of `One2AnyChannel` objects with a given buffering behaviour.

Specified by:
  `createOne2Any` in interface `BufferedChannelArrayFactory`
Parameters:
  `buffer` - the buffer implementation to use.
  `n` - the size of the array of channels.
Returns:
  the array of channels.
See Also:
  - `ChannelArrayFactory.createOne2Any(int)`

### createAny2Any

public Any2AnyChannel[] createAny2Any(ChannelDataStore buffer, int n)
Constructs and returns an array of `Any2AnyChannel` objects with a given buffering behaviour.

Specified by:
  `createAny2Any` in interface `BufferedChannelArrayFactory`
Parameters:
  `buffer` - the buffer implementation to use.
  `n` - the size of the array of channels.
Returns:
  the array of channels.
See Also:
  - `ChannelArrayFactory.createAny2Any(int)`