Adds a generic Metric class for lazily calculating metrics on the network.
Adds a demo Range metric that subclasses Metric.
COMMON is a Set.
The analyser uses an event emitter proxy and has a destroy() method to ensure that listeners can be cleaned up to avoid leaks.
Metrics are defined under newInfo, and dirtyMetrics() dirties all metrics. This way, registering new metrics is clean, and it's difficult to accidentally forget to dirty individual metrics.
Considerations for future:
The Sets may benefit from being Cytoscape Collections instead -- which are also sets.
We may want to put metrics under particular types (e.g. NUMBER), instead of at the top level. This requires persistent references to set. Currently `set can be reassigned.
The COMMON set should probably be a computed property, so it can be used directly but without upfront cost. We may indicate the common state with a flag rather than a static object.
We may want to call the analyser on initial load of the document as a stopgap until we cache that information on the server.
Metric
class for lazily calculating metrics on the network.Range
metric that subclassesMetric
.COMMON
is aSet
.destroy()
method to ensure that listeners can be cleaned up to avoid leaks.newInfo
, anddirtyMetrics()
dirties all metrics. This way, registering new metrics is clean, and it's difficult to accidentally forget to dirty individual metrics.Considerations for future:
Set
s may benefit from being CytoscapeCollections
instead -- which are also sets.NUMBER
), instead of at the top level. This requires persistent references toset
. Currently `set can be reassigned.COMMON
set should probably be a computed property, so it can be used directly but without upfront cost. We may indicate the common state with a flag rather than a static object.Ref. : #71 #49