Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AttributeBearer ¶
type AttributeBearer interface {
//GetAttributeNames return the name
//of all the attributes the current
//object has
GetAttributeNames() []string
//HasAttribute checks if an attribute is present
//in the current entity.
HasAttribute(attrName string) bool
//GetAttribute returns the value of the attribute
//or an error if this atrribute did not exists
GetAttribute(attrName string) (interface{}, error)
//SetAttribute set the value for a given attribute.
//If the attribute already exists then it is overriden
//and the previous value is returned Otherwise is added
//and nil is returned
SetAttribute(attrName string, value interface{}) interface{}
}
AttributeBearer is an interface that when fullfilled from an object, dynamic attributes can be assigned to this object
type TimeTrackedEntity ¶
type TimeTrackedEntity interface {
//IsExistentAt returns true if the
//current object is still valid,
//meaning that it doesn't have
//an ending time (and has started being in a pit)
IsExistentAt(pit time.Time) bool
//ExistentFrom returns the time this object
//started to exist. A TimedTrackedEntity SHOULD ALWAYS
//have a started pit
ExistentFrom() time.Time
//ValidUntil returns the pit that this
//object came out of existence.
//If this object is still "active" then
//calling this method SHOULD return NilTime
ValidUntil() time.Time
//ActiveDuration returns the duration
//that this entity is "existent". If
//the entity is still in an active state
//then calling this method returns the
//difference between activation and now
ActiveDuration() time.Duration
}
TimeTrackedEntity is an interface that is obeyed from all objects that have a time dimension, meaning that come into existence in some specific point in time (pit) and may stop being in a later pit. A TimeTrackedEntity cannot be "stopped" in a pit and then later come again "alive"
type TimeTrackedEntityCollection ¶
type TimeTrackedEntityCollection struct {
// contains filtered or unexported fields
}
TimeTrackedEntityCollection is a structure used for storing time track entities and provide utility functions for searching and filtering them. It is based on an augmented interval tree
func (*TimeTrackedEntityCollection) AddEntity ¶
func (ts *TimeTrackedEntityCollection) AddEntity(e TimeTrackedEntity)
AddEntity adds a new entity to the tracked collections. It doesn't test if the entity already exists in the collection
func (TimeTrackedEntityCollection) String ¶
func (ts TimeTrackedEntityCollection) String() string
String implementation traverse the collection and return the result