summaryrefslogtreecommitdiff
path: root/src-py/model/model.py
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2014-10-21 19:56:58 +0200
committerLV-426 <lv-426@taproot.org.il>2014-10-21 19:56:58 +0200
commit8d35498c06d3e832bdbcad2916efe2df9b23492d (patch)
tree2cc8edfcfe026dd0c493c53be2ac215d113c8df9 /src-py/model/model.py
parentc97f56e93d3bb3a7b838093b0ecb4fec9c9e0d34 (diff)
introducing the Link_Ptr concept - able to fuzzy point at a link by src_id, dst_id or both
Diffstat (limited to 'src-py/model/model.py')
-rw-r--r--src-py/model/model.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/src-py/model/model.py b/src-py/model/model.py
index 9ee61397..701074ab 100644
--- a/src-py/model/model.py
+++ b/src-py/model/model.py
@@ -1,4 +1,4 @@
-class link():
+class Link():
"""
documentation anchor - this class currently carries no implementation
and only acts as a documentation anchor
@@ -6,4 +6,25 @@ class link():
link['__src'] - meta attribute for link source
link['__dst'] - meta attribute for link destination
"""
- pass
+
+ class Link_Ptr(dict):
+ def __init__(self, src_id=None, dst_id=None):
+ assert None != src_id or None != dst_id
+
+ self['__src'] = src_id
+ self['__dst'] = dst_id
+
+ @property
+ def src_id(self):
+ return self['__src']
+
+ @property
+ def dst_id(self):
+ return self['__dst']
+
+ @staticmethod
+ def link_ptr(src_id=None, dst_id=None):
+ """
+ init from src_id or dst_id attributes - at least one must be provided
+ """
+ return Link.Link_Ptr(src_id, dst_id)