Interface ITypes<TLinkAddress>
- Namespace
- Foundation.Data.Doublets.Cli
- Assembly
- Foundation.Data.Doublets.Cli.dll
A type hierarchy kept in the links themselves (issue #148):
- the type of a link is its source:
(v: S x)is a value of typeS; - a type points at itself: the root
(Type: Type Type)is a point and a sub-type ofTis(S: T S), a value ofTwhose target is itself; - more parents (multiple inheritance) are pairs
(p: S T2)marked by(m: Extends p).
So Type -> SubType -> … -> Value is a chain of sources of any depth.
public interface ITypes<TLinkAddress> where TLinkAddress : struct, IUnsignedNumber<TLinkAddress>
Type Parameters
TLinkAddress
Properties
Extends
The Extends marker, or the null link when there is none.
TLinkAddress Extends { get; }
Property Value
- TLinkAddress
Root
The root type, (Type: Type Type).
TLinkAddress Root { get; }
Property Value
- TLinkAddress
Methods
AncestorsOf(TLinkAddress)
Every type type is, itself first, breadth first, without repeats.
IReadOnlyList<TLinkAddress> AncestorsOf(TLinkAddress type)
Parameters
typeTLinkAddress
Returns
- IReadOnlyList<TLinkAddress>
Define(TLinkAddress, params TLinkAddress[])
Defines a type (S: parent S) that also extends every type in more.
TLinkAddress Define(TLinkAddress parent, params TLinkAddress[] more)
Parameters
parentTLinkAddressmoreTLinkAddress[]
Returns
- TLinkAddress
Extend(TLinkAddress, TLinkAddress)
Makes type extend parent: the pair
(p: type parent) marked by (m: Extends p). Returns the pair.
Refused when parent is a direct sub-type
(parent: type parent) of type, whose definition is
that very doublet.
TLinkAddress Extend(TLinkAddress type, TLinkAddress parent)
Parameters
typeTLinkAddressparentTLinkAddress
Returns
- TLinkAddress
Instance(TLinkAddress)
A value (v: type v) of type.
TLinkAddress Instance(TLinkAddress type)
Parameters
typeTLinkAddress
Returns
- TLinkAddress
Instance(TLinkAddress, TLinkAddress)
A value (v: type target) of type.
TLinkAddress Instance(TLinkAddress type, TLinkAddress target)
Parameters
typeTLinkAddresstargetTLinkAddress
Returns
- TLinkAddress
IsA(IList<TLinkAddress>, TLinkAddress)
IsA(TLinkAddress, TLinkAddress) for a link given as (index, source, target), stored or not.
bool IsA(IList<TLinkAddress> link, TLinkAddress type)
Parameters
linkIList<TLinkAddress>typeTLinkAddress
Returns
IsA(TLinkAddress, TLinkAddress)
Whether link is type itself or of it.
bool IsA(TLinkAddress link, TLinkAddress type)
Parameters
linkTLinkAddresstypeTLinkAddress
Returns
IsExtension(TLinkAddress)
Whether link is a pair that gives a type one more parent.
bool IsExtension(TLinkAddress link)
Parameters
linkTLinkAddress
Returns
IsOf(IList<TLinkAddress>, TLinkAddress)
IsOf(TLinkAddress, TLinkAddress) for a link given as (index, source, target), stored or not.
bool IsOf(IList<TLinkAddress> link, TLinkAddress type)
Parameters
linkIList<TLinkAddress>typeTLinkAddress
Returns
IsOf(TLinkAddress, TLinkAddress)
Whether link is strictly of type:
starting from its source and the types the link itself extends, through
any depth of sub-types and parents, cycles included. A type is not of
itself; IsA(TLinkAddress, TLinkAddress) is.
bool IsOf(TLinkAddress link, TLinkAddress type)
Parameters
linkTLinkAddresstypeTLinkAddress
Returns
IsType(TLinkAddress)
Whether link is a type: it exists and points at itself.
bool IsType(TLinkAddress link)
Parameters
linkTLinkAddress
Returns
ParentsOf(TLinkAddress)
The direct parents of a type: its source (unless it is a point) and what it extends.
IReadOnlyList<TLinkAddress> ParentsOf(TLinkAddress type)
Parameters
typeTLinkAddress
Returns
- IReadOnlyList<TLinkAddress>
TypeOf(TLinkAddress)
The type of a link: its source; the null link for a missing link.
TLinkAddress TypeOf(TLinkAddress link)
Parameters
linkTLinkAddress
Returns
- TLinkAddress