Inline trivial function Bond.get_source(). NFC.
This commit is contained in:
@ -31,7 +31,7 @@ class Bond(WorkspaceStructure):
|
|||||||
|
|
||||||
def flippedVersion(self):
|
def flippedVersion(self):
|
||||||
return Bond(
|
return Bond(
|
||||||
self.destination, self.get_source(),
|
self.destination, self.source,
|
||||||
self.category.getRelatedNode(slipnet.opposite),
|
self.category.getRelatedNode(slipnet.opposite),
|
||||||
self.facet, self.destinationDescriptor, self.sourceDescriptor)
|
self.facet, self.destinationDescriptor, self.sourceDescriptor)
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ class Bond(WorkspaceStructure):
|
|||||||
def updateInternalStrength(self):
|
def updateInternalStrength(self):
|
||||||
# bonds between objects of same type(ie. letter or group) are
|
# bonds between objects of same type(ie. letter or group) are
|
||||||
# stronger than bonds between different types
|
# stronger than bonds between different types
|
||||||
sourceGap = self.get_source().leftIndex != self.get_source().rightIndex
|
sourceGap = self.source.leftIndex != self.source.rightIndex
|
||||||
destinationGap = (self.destination.leftIndex !=
|
destinationGap = (self.destination.leftIndex !=
|
||||||
self.destination.rightIndex)
|
self.destination.rightIndex)
|
||||||
if sourceGap == destinationGap:
|
if sourceGap == destinationGap:
|
||||||
@ -128,7 +128,7 @@ class Bond(WorkspaceStructure):
|
|||||||
|
|
||||||
def numberOfLocalSupportingBonds(self):
|
def numberOfLocalSupportingBonds(self):
|
||||||
return len([b for b in self.string.bonds if
|
return len([b for b in self.string.bonds if
|
||||||
b.string == self.get_source().string and
|
b.string == self.source.string and
|
||||||
self.leftObject.letterDistance(b.leftObject) != 0 and
|
self.leftObject.letterDistance(b.leftObject) != 0 and
|
||||||
self.rightObject.letterDistance(b.rightObject) != 0 and
|
self.rightObject.letterDistance(b.rightObject) != 0 and
|
||||||
self.category == b.category and
|
self.category == b.category and
|
||||||
@ -139,15 +139,16 @@ class Bond(WorkspaceStructure):
|
|||||||
self.directionCategory == other.directionCategory)
|
self.directionCategory == other.directionCategory)
|
||||||
|
|
||||||
def myEnds(self, object1, object2):
|
def myEnds(self, object1, object2):
|
||||||
if self.get_source() == object1 and self.destination == object2:
|
if self.source == object1 and self.destination == object2:
|
||||||
return True
|
return True
|
||||||
return self.get_source() == object2 and self.destination == object1
|
return self.source == object2 and self.destination == object1
|
||||||
|
|
||||||
def localDensity(self):
|
def localDensity(self):
|
||||||
# returns a rough measure of the density in the string
|
# returns a rough measure of the density in the string
|
||||||
# of the same bond-category and the direction-category of
|
# of the same bond-category and the direction-category of
|
||||||
# the given bond
|
# the given bond
|
||||||
slotSum = supportSum = 0.0
|
slotSum = 0.0
|
||||||
|
supportSum = 0.0
|
||||||
for object1 in workspace.objects:
|
for object1 in workspace.objects:
|
||||||
if object1.string == self.string:
|
if object1.string == self.string:
|
||||||
for object2 in workspace.objects:
|
for object2 in workspace.objects:
|
||||||
@ -171,9 +172,6 @@ class Bond(WorkspaceStructure):
|
|||||||
def getIncompatibleBonds(self):
|
def getIncompatibleBonds(self):
|
||||||
return [b for b in self.string.bonds if self.sameNeighbors(b)]
|
return [b for b in self.string.bonds if self.sameNeighbors(b)]
|
||||||
|
|
||||||
def get_source(self):
|
|
||||||
return self.source
|
|
||||||
|
|
||||||
def set_source(self, value):
|
def set_source(self, value):
|
||||||
self.source = value
|
self.source = value
|
||||||
|
|
||||||
@ -193,7 +191,7 @@ def possibleGroupBonds(bondCategory, directionCategory, bondFacet, bonds):
|
|||||||
return None # a different bond cannot be made here
|
return None # a different bond cannot be made here
|
||||||
if bond.category == slipnet.sameness:
|
if bond.category == slipnet.sameness:
|
||||||
return None
|
return None
|
||||||
bond = Bond(bond.destination, bond.get_source(), bondCategory,
|
bond = Bond(bond.destination, bond.source, bondCategory,
|
||||||
bondFacet, bond.destinationDescriptor,
|
bondFacet, bond.destinationDescriptor,
|
||||||
bond.sourceDescriptor)
|
bond.sourceDescriptor)
|
||||||
result += [bond]
|
result += [bond]
|
||||||
|
|||||||
Reference in New Issue
Block a user