Class $k.Type
Represents a type
- Defined in: Type.js
- Extends: $k.SemanticElement Extended by: $k.PropertyType, $k.InstanceType
Constructor Attributes | Constructor Name and Description |
---|---|
$k.Type()
|
Method Summary
Class Detail
$k.Type()
Method Detail
-
addSupertype(type)Add a supertype
- Parameters:
- type
- Type or internal name
- Throws:
- {$k.exception.TypeError}
- If the argument is not a valid supertype
- {$k.exception.SchemaError}
- If the argument cannot be added as supertype
- {$k.exception.AccessDenied}
- If adding the type is not allowed
- {$k.exception.TransactionError}
- If no write transaction is active
-
Returns all subtypes
- Returns:
- {$k.Type[]}
-
Returns all supertypes
- Returns:
- {$k.Type[]}
-
{boolean} canCreateExtensions()Returns true if instances of this type can be created as extensions of instances. Only either canCreateExtensions() or canCreateInstances() can be true. isAbstract() is true if neither canCreateExtensions() nor canCreateInstances() is true.
- Returns:
- {boolean}
- See:
- $k.Instance#createExtension
- $k.Type#canCreateInstances
- $k.Type#isAbstract
-
{boolean} canCreateInstances()Returns true if instances / properties of this type can be created. Only either canCreateExtensions() or canCreateInstances() can be true. isAbstract() is true if neither canCreateExtensions() nor canCreateInstances() is true.
- Returns:
- {boolean}
- See:
- $k.Type#canCreateExtensions
- $k.Type#isAbstract
-
Returns the domain of the instances of this type
- Returns:
- {$k.Domain}
-
{number} estimatedNumberOfInstances()Returns the estimated number of instances of this type
- Returns:
- {number}
-
{number} getCounter()Returns the value of the counter associated with this type.
- Returns:
- {number}
-
{number} increaseCounter()Increases and returns the value of the counter associated with this type. The counter can be increased concurrently.
- Returns:
- {number}
-
{string} internalName()Returns the internal name
- Returns:
- {string}
-
{boolean} isAbstract()Returns true if this is an abstract type (cannot create properties/instances/extensions). isAbstract() is true if neither canCreateExtensions() nor canCreateInstances() is true.
- Returns:
- {boolean}
-
{boolean} isKindOf(type)Returns true if this is equal to or a direct or indirect type of the other type
- Parameters:
- type
- Type or internal name
- Throws:
- {$k.exception.TypeError}
- If the argument is not a type
- {$k.exception.SchemaError}
- If the argument is an unknown internal name
- Returns:
- {boolean}
-
{number} numberOfInstances()Returns the exact number of instances of this type
- Returns:
- {number}
-
removeSupertype(supertype)Remove a supertype
- Parameters:
- supertype
- Throws:
- {$k.exception.TypeError}
- If the argument is not a valid supertype
- {$k.exception.AccessDenied}
- If removing the type is not allowed
- {$k.exception.TransactionError}
- If no write transaction is active
-
setCanCreateExtensions(canCreate)Set to true if it should be possible to extend other instances with instances of this tyoe. The flag cannot be set to false if extensions exist. Only either canCreateExtensions() or canCreateInstances() can be true.
- Parameters:
- {boolean} canCreate
- Throws:
- {$k.exception.SchemaError}
- If it is not possible to change the schema, e.g. when the type already allows to create instances
- See:
- $k.Type#canCreateExtensions
- $k.Type#setCanCreateInstances
-
setCanCreateInstances(canCreate)Set to true if it should be possible to create instances / properties this type. The flag cannot be set to false if instances exist. Only either canCreateExtensions() or canCreateInstances() can be true.
- Parameters:
- {boolean} canCreate
- Throws:
- {$k.exception.SchemaError}
- If it is not possible to change the schema, e.g. when the type already allows to create extensions
- See:
- $k.Type#canCreateInstances
- $k.Type#setCanCreateExtensions
-
{number} setCounter(counterValue)Set the initial value of the counter associated with this type. Note: this cannot be done concurrently. Use increaseCounter() instead.
- Parameters:
- {number} counterValue
- Must be an integer
- Returns:
- {number} The counter value
- See:
- $k.Type#increaseCounter
-
setInternalName(name)Sets the internal name, or removes the internal name if null is passed
- Parameters:
- name
- New internal name or null
- Throws:
- {$k.exception.TypeError}
- If the argument is not a valid internal name
- {$k.exception.AccessDenied}
- If modifying the type is not allowed
- {$k.exception.NotUnique}
- If the internal name is not unique
- {$k.exception.TransactionError}
- If no write transaction is active
-
Returns the direct subtypes
- Returns:
- {$k.Type[]}
-
Returns the direct supertypes
- Returns:
- {$k.Type[]}
-
Returns the domain that represents this type and its subtype
- Returns:
- {$k.Domain}