UKS
Loading...
Searching...
No Matches
UKS.Thing Class Reference

In the lexicon of graphs, a Thing is a "node". A Thing can represent anything, physical object, attribute, word, action, etc. More...

Public Member Functions

override string ToString ()
 Returns a Thing's label. Even though it shows zero references, don't delete this ToString() because the debugger uses it when mousing over a Thing.
string ToString (bool showProperties=false)
 Formats a displayable Thing as a string.
IList< ThingAncestorList ()
bool HasAncestorLabeled (string label)
 Determines whether a Thing has a specific ancestor.
bool HasAncestor (Thing t)
 Determines whether a Thing has a specific ancestor.
int GetDescendentsCount ()
 Determines how many descendants a Thing has.
IList< ThingDescendentsList ()
 Returns a list of all of a thing's descendandants. CAUTION: this may be large and time-consuming.
void SetFired ()
 Updates the last-fired time on a Thing.
Relationship AddRelationship (Thing target, Thing relationshipType)
 Adds a relationship to a Thing if it does not already exist. The Thing is the source of the relationship.
void RemoveRelationship (Relationship r)
 Removes a relationship.
Relationship HasRelationship (Thing source, Thing relType, Thing targett)
Thing HasRelationshipWithParent (Thing t)
Thing HasRelationshipWithAncestorLabeled (string s)
Relationship RemoveRelationship (Thing t2, Thing relationshipType)
List< RelationshipGetRelationshipsWithAncestor (Thing t)
List< RelationshipGetRelationshipByWithAncestor (Thing t)
void AddParent (Thing newParent)
 Addsa a parent to a Thing.
void RemoveParent (Thing t)
 Remove a parent from a Thing.
Relationship AddChild (Thing t)
void RemoveChild (Thing t)
Thing AttributeOfType (string label)
Thing GetAttribute (Thing t)
List< ThingGetAttributes ()
Relationship SetAttribute (Thing attributeValue)
bool HasProperty (Thing t)

Static Public Member Functions

static implicit operator Thing (string label)
 This is the magic which allows for strings to be put in place of Things for any method Paramter.

Public Attributes

int useCount = 0
DateTime lastFiredTime = new()

Properties

static Thing HasChild [get]
IList< RelationshipRelationshipsNoCount [get]
 Only used by the tree control.
List< RelationshipRelationshipsWriteable [get]
 Get an "unsafe" writeable list of a Thing's Relationships. This list may change while it is in use and so should not be used as a foreach iterator.
IList< RelationshipRelationshipsFrom [get]
 Get a "safe" list of relationships which target this Thing.
List< RelationshipRelationshipsFromWriteable [get]
 Get an "unsafe" writeable list of Relationships which target this Thing.
List< RelationshipRelationshipsAsTypeWriteable [get]
 Get an "unsafe" writeable list of Relationships for which this Thing is the relationship type.
object V [get, set]
 Any serializable object can be attached to a Thing.
string Label [get, set]
 Manages a Thing's label and maintais a hash table.
IList< ThingParents [get]
 "Safe" list of direct ancestors
IList< ThingChildren [get]
 "Safe" list of direct descendants
IList< ThingChildrenWithSubclasses [get]
IList< RelationshipRelationships [get]
 Full "Safe" list or relationships.
IEnumerable< ThingAncestors [get]
 Recursively gets all the ancestors of a Thing.
IEnumerable< ThingDescendents [get]
 Recursively gets all descendents of a Thing. Use with caution as this might be a large list.

Detailed Description

In the lexicon of graphs, a Thing is a "node". A Thing can represent anything, physical object, attribute, word, action, etc.

Things often have labels which are any string. Like comments, these are typically used for programmer convenience and are not usually used for functionality. Labels are case-insensitive although the initial case is preserved within the UKS. Methods which return a Thing may return null in the event no Thing matches the result of the method. Methods which return lists of Things will return a list of zero elements if no Things match the result of the method. A Thing may be referenced by its Label. You can write AddParent("color") [where a Thing is a required parameter.] The system sill automatically retreive a Thing with the given label or throw an exception if none exists.

Member Function Documentation

◆ AddParent()

void UKS.Thing.AddParent ( Thing newParent)
inline

Addsa a parent to a Thing.

Parameters
newParent

◆ AddRelationship()

Relationship UKS.Thing.AddRelationship ( Thing target,
Thing relationshipType )
inline

Adds a relationship to a Thing if it does not already exist. The Thing is the source of the relationship.

Parameters
targetTarget Thing
relationshipTypeRelatinoshipType Thing
Returns
the new or existing Relationship

◆ DescendentsList()

IList< Thing > UKS.Thing.DescendentsList ( )
inline

Returns a list of all of a thing's descendandants. CAUTION: this may be large and time-consuming.

Returns

◆ GetDescendentsCount()

int UKS.Thing.GetDescendentsCount ( )
inline

Determines how many descendants a Thing has.

Returns
the count

◆ HasAncestor()

bool UKS.Thing.HasAncestor ( Thing t)
inline

Determines whether a Thing has a specific ancestor.

Parameters
label
Returns

◆ HasAncestorLabeled()

bool UKS.Thing.HasAncestorLabeled ( string label)
inline

Determines whether a Thing has a specific ancestor.

Parameters
label
Returns

◆ operator Thing()

implicit UKS.Thing.operator Thing ( string label)
inlinestatic

This is the magic which allows for strings to be put in place of Things for any method Paramter.

Parameters
label

Throse

◆ RemoveParent()

void UKS.Thing.RemoveParent ( Thing t)
inline

Remove a parent from a Thing.

Parameters
tIf the Thing is not a parent, the function does nothing

◆ RemoveRelationship()

void UKS.Thing.RemoveRelationship ( Relationship r)
inline

Removes a relationship.

Parameters
rThe Relationship's source neede not be this Thing

◆ ToString() [1/2]

override string UKS.Thing.ToString ( )
inline

Returns a Thing's label. Even though it shows zero references, don't delete this ToString() because the debugger uses it when mousing over a Thing.

Returns
the Thing's label

◆ ToString() [2/2]

string UKS.Thing.ToString ( bool showProperties = false)
inline

Formats a displayable Thing as a string.

Parameters
showPropertiesAppends a parenthetical list of relationships to the label
Returns
The string to display

The documentation for this class was generated from the following file:
  • Thing.cs