BarFactory {parabar}R Documentation

BackendFactory

Description

This class is a factory that provides concrete implementations of the Bar abstract class.

Methods

Public methods


Method get()

Obtain a concrete implementation of the abstract Bar class of the specified type.

Usage
BarFactory$get(type)
Arguments
type

A character string specifying the type of the Bar to instantiate. Possible values are "modern" and "basic". See the Details section for more information.

Details

When type = "modern" a ModernBar instance is created and returned. When type = "basic" a BasicBar instance is provided instead.

Returns

A concrete implementation of the class Bar. It throws an error if the requested bar type is not supported.


Method clone()

The objects of this class are cloneable with this method.

Usage
BarFactory$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Bar, BasicBar, and ModernBar.

Examples

# Create a bar factory.
bar_factory <- BarFactory$new()

# Get a modern bar instance.
bar <- bar_factory$get("modern")

# Check the class of the bar instance.
class(bar)

# Get a basic bar instance.
bar <- bar_factory$get("basic")

# Check the class of the bar instance.
class(bar)


[Package parabar version 1.1.1 Index]