R: Abstract SetWrapper Class

SetWrapper {set6} | R Documentation

## Abstract SetWrapper Class

### Description

This class should not be constructed directly. Parent class to `SetWrapper`s.

### Details

Wrappers in set6 are utilised to facilitate lazy evaluation and symbolic representation. Each operation has an associated wrapper that will be returned if `simplify = FALSE` or if the result would be too complex to return as a simple Set. Wrappers have an identical interface to Set. Their primary advantage lies in a neat representation of any set composition (the result of an operation) and the ability to query the set contents without ever directly evaluating the set elements.

### Super class

`set6::Set` -> `SetWrapper`

### Active bindings

`wrappedSets`

  Returns the list of `Set`s that are wrapped in the given wrapper.

### Methods

#### Public methods

- `SetWrapper$new()`

- `SetWrapper$equals()`

- `SetWrapper$isSubset()`

- `SetWrapper$clone()`

Inherited methods

- `set6::Set$add()`

- `set6::Set$contains()`

- `set6::Set$multiplicity()`

- `set6::Set$print()`

- `set6::Set$remove()`

- `set6::Set$strprint()`

- `set6::Set$summary()`

#### Method `new()`

Create a new `SetWrapper` object. It is not recommended to construct this class directly.

##### Usage

    SetWrapper$new(
      setlist,
      lower = NULL,
      upper = NULL,
      type = NULL,
      class = NULL,
      cardinality
    )

##### Arguments

`setlist`

  List of Sets to wrap.

`lower`

  Set. Lower bound of wrapper.

`upper`

  Set. Upper bound of wrapper.

`type`

  character. Closure type of wrapper.

`class`

  character. Ignored.

`cardinality`

  character or integer. Cardinality of wrapper.

##### Returns

A new `SetWrapper` object.

#### Method `equals()`

Tests if `x` is equal to `self`.

##### Usage

    SetWrapper$equals(x, all = FALSE)

##### Arguments

`x`

  Set or vector of Sets.

`x`

  any. Object or vector of objects to test.

`all`

  logical. If `FALSE` tests each `x` separately. Otherwise returns `TRUE` only if all `x` pass test.

`all`

  logical. If `FALSE` tests each `x` separately. Otherwise returns `TRUE` only if all `x` pass test.

##### Returns

If `all == TRUE` then returns `TRUE` if all `x` are equal to `self`, otherwise `FALSE`. If `all == FALSE` returns a vector of logicals corresponding to the length of `x`, representing if each is equal to `self`.

#### Method `isSubset()`

Tests if `x` is a (proper) subset of `self`.

##### Usage

    SetWrapper$isSubset(x, proper = FALSE, all = FALSE)

##### Arguments

`x`

  Set or vector of Sets.

`x`

  any. Object or vector of objects to test.

`proper`

  logical. If `TRUE` tests for proper subsets.

`all`

  logical. If `FALSE` tests each `x` separately. Otherwise returns `TRUE` only if all `x` pass test.

`all`

  logical. If `FALSE` tests each `x` separately. Otherwise returns `TRUE` only if all `x` pass test.

##### Returns

If `all == TRUE` then returns `TRUE` if all `x` are (proper) subsets of `self`, otherwise `FALSE`. If `all == FALSE` returns a vector of logicals corresponding to the length of `x`, representing if each is a (proper) subset of `self`.

#### Method `clone()`

The objects of this class are cloneable with this method.

##### Usage

    SetWrapper$clone(deep = FALSE)

##### Arguments

`deep`

  Whether to make a deep clone.

[Package set6 version 0.2.1 Index]