Decouple Slipnode from the global slipnet.
This commit is contained in:
@ -1,5 +1,3 @@
|
|||||||
#from slipnode import Slipnode
|
|
||||||
|
|
||||||
|
|
||||||
class Sliplink(object):
|
class Sliplink(object):
|
||||||
def __init__(self, source, destination, label=None, length=0.0):
|
def __init__(self, source, destination, label=None, length=0.0):
|
||||||
|
|||||||
@ -265,7 +265,7 @@ class SlipNet(object):
|
|||||||
self.__addSlipLink(destination, source, label=self.opposite)
|
self.__addSlipLink(destination, source, label=self.opposite)
|
||||||
|
|
||||||
def __addNode(self, name, depth, length=0):
|
def __addNode(self, name, depth, length=0):
|
||||||
slipnode = Slipnode(name, depth, length)
|
slipnode = Slipnode(self, name, depth, length)
|
||||||
self.slipnodes += [slipnode]
|
self.slipnodes += [slipnode]
|
||||||
return slipnode
|
return slipnode
|
||||||
|
|
||||||
|
|||||||
@ -13,10 +13,11 @@ def jump_threshold():
|
|||||||
|
|
||||||
class Slipnode(object):
|
class Slipnode(object):
|
||||||
# pylint: disable=too-many-instance-attributes
|
# pylint: disable=too-many-instance-attributes
|
||||||
def __init__(self, name, depth, length=0.0):
|
def __init__(self, slipnet, name, depth, length=0.0):
|
||||||
|
self.slipnet = slipnet
|
||||||
|
self.name = name
|
||||||
self.conceptualDepth = depth
|
self.conceptualDepth = depth
|
||||||
self.usualConceptualDepth = depth
|
self.usualConceptualDepth = depth
|
||||||
self.name = name
|
|
||||||
self.intrinsicLinkLength = length
|
self.intrinsicLinkLength = length
|
||||||
self.shrunkLinkLength = length * 0.4
|
self.shrunkLinkLength = length * 0.4
|
||||||
|
|
||||||
@ -111,9 +112,7 @@ class Slipnode(object):
|
|||||||
|
|
||||||
If no linked node is found, return None
|
If no linked node is found, return None
|
||||||
"""
|
"""
|
||||||
from slipnet import slipnet
|
if relation == self.slipnet.identity:
|
||||||
|
|
||||||
if relation == slipnet.identity:
|
|
||||||
return self
|
return self
|
||||||
destinations = [l.destination
|
destinations = [l.destination
|
||||||
for l in self.outgoingLinks if l.label == relation]
|
for l in self.outgoingLinks if l.label == relation]
|
||||||
@ -126,11 +125,9 @@ class Slipnode(object):
|
|||||||
|
|
||||||
If it does not exist return None
|
If it does not exist return None
|
||||||
"""
|
"""
|
||||||
from slipnet import slipnet
|
|
||||||
|
|
||||||
result = None
|
result = None
|
||||||
if self == destination:
|
if self == destination:
|
||||||
result = slipnet.identity
|
result = self.slipnet.identity
|
||||||
else:
|
else:
|
||||||
for link in self.outgoingLinks:
|
for link in self.outgoingLinks:
|
||||||
if link.destination == destination:
|
if link.destination == destination:
|
||||||
|
|||||||
Reference in New Issue
Block a user