API

The following methods constitute the public API of the Bijections package.

Index

Reference

Bijections.Bijection — Method
Bijection()

Construct a new Bijection.

  • Bijection{S,T}() creates an empty Bijection from objects of type S to objects of type T. If S and T are omitted, then we have Bijection{Any,Any}.
  • Bijection(x::S, y::T) creates a new Bijection initialized with x mapping to y.
  • Bijection(dict::Dict{S,T}) creates a new Bijection based on the mapping in dict.
  • Bijection(pair_list::Vector{Pair{S,T}}) creates a new Bijection using the key/value pairs in pair_list.
source
Base.delete! — Method
delete!(b::Bijection, x)

Deletes the ordered pair (x,b[x]) from b.

source
Base.get — Method
get(b::Bijection, key, default)

Returns b[key] if it exists and returns default otherwise.

source
Base.getindex — Method
getindex(b::Bijection, x)

For a Bijection b and a value x in its domain, use b[x] to fetch the image value y associated with x.

source
Base.haskey — Method
Base.haskey(b::Bijection, x)

Checks if x is in the domain of the Bijection b.`

source
Base.inv — Method
inv(b::Bijection)

Creates a new Bijection that is the inverse of b. Subsequence changes to b will not affect inv(b).

See also active_inv.

source
Base.length — Method
length(b::Bijection)

Gives the number of ordered pairs in b.

source
Base.setindex! — Method
setindex!(b::Bijection, y, x)

For a Bijection b use the syntax b[x]=y to add (x,y) to b.

source
Bijections.active_inv — Method
active_inv(b::Bijection)

Creates a Bijection that is the inverse of b. The original b and the new Bijection returned are tied together so that changes to one immediately affect the other. In this way, the two Bijections remain inverses in perpetuity.

See also inv.

source
Bijections.hasvalue — Method
hasvalue(b::Bijection, y)

Checks if y is in the image of the Bijection b. It is equivalent to checking if the inverse mapping b.finv has y as a key, so it should as fast as haskey.

source
Bijections.inverse_dict_type — Method
inverse_dict_type(D::Type{<:AbstractDict})

Returns the type of the inverse dictionary for a given AbstractDict type D. This is used internally to create the inverse mapping in a Bijection.

source