CTBase.jl

The CTBase.jl package is part of the control-toolbox ecosystem.

flowchart TD B(<a href='https://control-toolbox.org/OptimalControl.jl/stable/dev-ctbase.html'>CTBase</a>) M(<a href='https://control-toolbox.org/OptimalControl.jl/stable/dev-ctmodels.html'>CTModels</a>) P(<a href='https://control-toolbox.org/OptimalControl.jl/stable/dev-ctparser.html'>CTParser</a>) O(<a href='https://control-toolbox.org/OptimalControl.jl/stable/dev-optimalcontrol.html'>OptimalControl</a>) D(<a href='https://control-toolbox.org/OptimalControl.jl/stable/dev-ctdirect.html'>CTDirect</a>) F(<a href='https://control-toolbox.org/OptimalControl.jl/stable/dev-ctflows.html'>CTFlows</a>) O --> D O --> M O --> F O --> P F --> M O --> B F --> B D --> B D --> M P --> M P --> B M --> B style B fill:#FBF275

Index

Documentation

Public

Private

CTBase.DescVarArgConstant

DescVarArg is a Vararg of symbols. DescVarArg is a type alias for a Vararg of symbols.

julia> const DescVarArg = Vararg{Symbol}

See also: Description.

source
CTBase.AmbiguousDescriptionType
struct AmbiguousDescription <: CTBase.CTException

Exception thrown when the description is ambiguous / incorrect.

Fields

  • var::Tuple{Vararg{Symbol}}

Example

julia> complete(:f; descriptions=((:a, :b), (:a, :b, :c))
ERROR: AmbiguousDescription: the description (:f,) is ambiguous / incorrect
source
CTBase.DescriptionType

A description is a tuple of symbols. Description is a type alias for a tuple of symbols.

julia> const Description = Tuple{DescVarArg}

See also: DescVarArg.

Example

Base.show is overloaded for descriptions, that is tuple of descriptions are printed as follows:

julia> display( ( (:a, :b), (:b, :c) ) )
(:a, :b)
(:b, :c)
source
CTBase.ExtensionErrorType
struct ExtensionError <: CTBase.CTException

Exception thrown when an extension is not loaded but the user tries to call a function of it.

Fields

  • weakdeps::Tuple{Vararg{Symbol}}
source
CTBase.IncorrectArgumentType
struct IncorrectArgument <: CTBase.CTException

Exception thrown when an argument is inconsistent.

Fields

  • var::String
source
CTBase.IncorrectMethodType
struct IncorrectMethod <: CTBase.CTException

Exception thrown when a method is incorrect.

Fields

  • var::Symbol
source
CTBase.IncorrectOutputType
struct IncorrectOutput <: CTBase.CTException

Exception thrown when the output is incorrect.

Fields

  • var::String
source
CTBase.NotImplementedType
struct NotImplemented <: CTBase.CTException

Exception thrown when a method is not implemented.

Fields

  • var::String
source
CTBase.ParsingErrorType
struct ParsingError <: CTBase.CTException

Exception thrown for syntax error during abstract parsing.

Fields

  • var::String
source
CTBase.UnauthorizedCallType
struct UnauthorizedCall <: CTBase.CTException

Exception thrown when a call to a function is not authorized.

Fields

  • var::String
source
Base.showMethod
show(
    io::IO,
    _::MIME{Symbol("text/plain")},
    descriptions::Tuple{Vararg{Tuple{Vararg{Symbol}}}}
)

Print a tuple of descriptions.

Example

julia> display( ( (:a, :b), (:b, :c) ) )
(:a, :b)
(:b, :c)
source
Base.showerrorMethod
showerror(io::IO, e::CTBase.AmbiguousDescription)

Print the exception.

source
CTBase.__displayMethod
__display() -> Bool

Used to set the default value of the display argument. The default value is true, which means that the output is printed during execution.

source
CTBase.addMethod
add(
    x::Tuple{Vararg{Tuple{Vararg{Symbol}}}},
    y::Tuple{Vararg{Symbol}}
) -> Tuple{Tuple{Vararg{Symbol}}}

Add the description y to the tuple of descriptions x if x does not contain y and return the new tuple of descriptions.

Throw an exception (IncorrectArgument) if the description y is already contained in x.

Example

julia> descriptions = ()
julia> descriptions = add(descriptions, (:a,))
(:a,)
julia> descriptions = add(descriptions, (:b,))
(:a,)
(:b,)
julia> descriptions = add(descriptions, (:b,))
ERROR: IncorrectArgument: the description (:b,) is already in ((:a,), (:b,))
source
CTBase.addMethod
add(
    _::Tuple{},
    y::Tuple{Vararg{Symbol}}
) -> Tuple{Tuple{Vararg{Symbol}}}

Return a tuple containing only the description y.

Example

julia> descriptions = ()
julia> descriptions = add(descriptions, (:a,))
(:a,)
julia> print(descriptions)
((:a,),)
julia> descriptions[1]
(:a,)
source
CTBase.completeMethod
complete(list::Symbol...; descriptions)

Return one description from a list of Symbols list and a set of descriptions D. If multiple descriptions are possible, then the first one is selected.

If the list is not contained in any of the descriptions, then an exception is thrown.

Example

julia> D = ((:a, :b), (:a, :b, :c), (:b, :c), (:a, :c))
(:a, :b)
(:b, :c)
(:a, :c)
julia> complete(:a; descriptions=D)
(:a, :b)
julia> complete(:a, :c; descriptions=D)
(:a, :b, :c)
julia> complete((:a, :c); descriptions=D)
(:a, :b, :c)
julia> complete(:f; descriptions=D)
ERROR: AmbiguousDescription: the description (:f,) is ambiguous / incorrect
source
CTBase.ctindiceMethod
ctindice(i::Int64) -> Char

Return i ∈ [0, 9] as a subscript.

If i is not in the range, an exception is thrown.

source
CTBase.ctindicesMethod
ctindices(i::Int64) -> String

Return i > 0 as a subscript.

If i is not in the range, an exception is thrown.

source
CTBase.ctupperscriptMethod
ctupperscript(i::Int64) -> Char

Return i ∈ [0, 9] as an upperscript.

If i is not in the range, an exception is thrown.

source
CTBase.ctupperscriptsMethod
ctupperscripts(i::Int64) -> String

Return i > 0 as an upperscript.

If i is not in the range, an exception is thrown.

source
CTBase.removeMethod
remove(
    x::Tuple{Vararg{Symbol}},
    y::Tuple{Vararg{Symbol}}
) -> Tuple{Vararg{Symbol}}

Return the difference between the description x and the description y.

Example

julia> remove((:a, :b), (:a,))
(:b,)
source