Demagic all the WorkspaceStructure children who aren't WorkspaceObjects. NFC.
This commit is contained in:
@ -3,9 +3,8 @@ from workspaceStructure import WorkspaceStructure
|
|||||||
|
|
||||||
class Bond(WorkspaceStructure):
|
class Bond(WorkspaceStructure):
|
||||||
# pylint: disable=too-many-arguments
|
# pylint: disable=too-many-arguments
|
||||||
def __init__(self, source, destination, bondCategory, bondFacet,
|
def __init__(self, ctx, source, destination, bondCategory, bondFacet,
|
||||||
sourceDescriptor, destinationDescriptor):
|
sourceDescriptor, destinationDescriptor):
|
||||||
from context import context as ctx
|
|
||||||
WorkspaceStructure.__init__(self, ctx)
|
WorkspaceStructure.__init__(self, ctx)
|
||||||
slipnet = self.ctx.slipnet
|
slipnet = self.ctx.slipnet
|
||||||
self.source = source
|
self.source = source
|
||||||
@ -31,7 +30,7 @@ class Bond(WorkspaceStructure):
|
|||||||
|
|
||||||
def flippedVersion(self):
|
def flippedVersion(self):
|
||||||
slipnet = self.ctx.slipnet
|
slipnet = self.ctx.slipnet
|
||||||
return Bond(
|
return Bond(self.ctx,
|
||||||
self.destination, self.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)
|
||||||
@ -198,7 +197,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.source, bondCategory,
|
bond = Bond(bond.ctx, bond.destination, bond.source, bondCategory,
|
||||||
bondFacet, bond.destinationDescriptor,
|
bondFacet, bond.destinationDescriptor,
|
||||||
bond.sourceDescriptor)
|
bond.sourceDescriptor)
|
||||||
result += [bond]
|
result += [bond]
|
||||||
|
|||||||
@ -351,7 +351,7 @@ def replacement_finder(ctx, codelet):
|
|||||||
else:
|
else:
|
||||||
relation = None
|
relation = None
|
||||||
logging.info('no relation found')
|
logging.info('no relation found')
|
||||||
letterOfInitialString.replacement = Replacement(
|
letterOfInitialString.replacement = Replacement(ctx,
|
||||||
letterOfInitialString, letterOfModifiedString, relation)
|
letterOfInitialString, letterOfModifiedString, relation)
|
||||||
if relation != slipnet.sameness:
|
if relation != slipnet.sameness:
|
||||||
letterOfInitialString.changed = True
|
letterOfInitialString.changed = True
|
||||||
@ -777,7 +777,7 @@ def group_builder(ctx, codelet):
|
|||||||
destination = object1
|
destination = object1
|
||||||
category = group.groupCategory.getRelatedNode(slipnet.bondCategory)
|
category = group.groupCategory.getRelatedNode(slipnet.bondCategory)
|
||||||
facet = group.facet
|
facet = group.facet
|
||||||
newBond = Bond(source, destination, category, facet,
|
newBond = Bond(ctx, source, destination, category, facet,
|
||||||
source.getDescriptor(facet),
|
source.getDescriptor(facet),
|
||||||
destination.getDescriptor(facet))
|
destination.getDescriptor(facet))
|
||||||
newBond.buildBond()
|
newBond.buildBond()
|
||||||
|
|||||||
@ -197,7 +197,7 @@ class Coderack(object):
|
|||||||
The new codelet has urgency a function of
|
The new codelet has urgency a function of
|
||||||
the degree of conceptual-depth of the descriptions in the rule
|
the degree of conceptual-depth of the descriptions in the rule
|
||||||
"""
|
"""
|
||||||
rule = Rule(facet, description, category, relation)
|
rule = Rule(self.ctx, facet, description, category, relation)
|
||||||
rule.updateStrength()
|
rule.updateStrength()
|
||||||
if description and relation:
|
if description and relation:
|
||||||
depths = description.conceptualDepth + relation.conceptualDepth
|
depths = description.conceptualDepth + relation.conceptualDepth
|
||||||
@ -209,7 +209,7 @@ class Coderack(object):
|
|||||||
|
|
||||||
def proposeCorrespondence(self, initialObject, targetObject,
|
def proposeCorrespondence(self, initialObject, targetObject,
|
||||||
conceptMappings, flipTargetObject, oldCodelet):
|
conceptMappings, flipTargetObject, oldCodelet):
|
||||||
correspondence = Correspondence(initialObject, targetObject,
|
correspondence = Correspondence(self.ctx, initialObject, targetObject,
|
||||||
conceptMappings, flipTargetObject)
|
conceptMappings, flipTargetObject)
|
||||||
for mapping in conceptMappings:
|
for mapping in conceptMappings:
|
||||||
mapping.initialDescriptionType.buffer = 100.0
|
mapping.initialDescriptionType.buffer = 100.0
|
||||||
@ -256,7 +256,7 @@ class Coderack(object):
|
|||||||
bondFacet.buffer = 100.0
|
bondFacet.buffer = 100.0
|
||||||
sourceDescriptor.buffer = 100.0
|
sourceDescriptor.buffer = 100.0
|
||||||
destinationDescriptor.buffer = 100.0
|
destinationDescriptor.buffer = 100.0
|
||||||
bond = Bond(source, destination, bondCategory, bondFacet,
|
bond = Bond(self.ctx, source, destination, bondCategory, bondFacet,
|
||||||
sourceDescriptor, destinationDescriptor)
|
sourceDescriptor, destinationDescriptor)
|
||||||
urgency = bondCategory.bondDegreeOfAssociation()
|
urgency = bondCategory.bondDegreeOfAssociation()
|
||||||
self.newCodelet('bond-strength-tester', oldCodelet, urgency, bond)
|
self.newCodelet('bond-strength-tester', oldCodelet, urgency, bond)
|
||||||
|
|||||||
@ -5,9 +5,8 @@ import formulas
|
|||||||
|
|
||||||
|
|
||||||
class Correspondence(WorkspaceStructure):
|
class Correspondence(WorkspaceStructure):
|
||||||
def __init__(self, objectFromInitial, objectFromTarget,
|
def __init__(self, ctx, objectFromInitial, objectFromTarget,
|
||||||
conceptMappings, flipTargetObject):
|
conceptMappings, flipTargetObject):
|
||||||
from context import context as ctx
|
|
||||||
WorkspaceStructure.__init__(self, ctx)
|
WorkspaceStructure.__init__(self, ctx)
|
||||||
self.objectFromInitial = objectFromInitial
|
self.objectFromInitial = objectFromInitial
|
||||||
self.objectFromTarget = objectFromTarget
|
self.objectFromTarget = objectFromTarget
|
||||||
|
|||||||
@ -4,8 +4,7 @@ from workspaceStructure import WorkspaceStructure
|
|||||||
|
|
||||||
class Description(WorkspaceStructure):
|
class Description(WorkspaceStructure):
|
||||||
def __init__(self, workspaceObject, descriptionType, descriptor):
|
def __init__(self, workspaceObject, descriptionType, descriptor):
|
||||||
from context import context as ctx
|
WorkspaceStructure.__init__(self, workspaceObject.ctx)
|
||||||
WorkspaceStructure.__init__(self, ctx)
|
|
||||||
self.object = workspaceObject
|
self.object = workspaceObject
|
||||||
self.string = workspaceObject.string
|
self.string = workspaceObject.string
|
||||||
self.descriptionType = descriptionType
|
self.descriptionType = descriptionType
|
||||||
|
|||||||
@ -2,8 +2,7 @@ from workspaceStructure import WorkspaceStructure
|
|||||||
|
|
||||||
|
|
||||||
class Replacement(WorkspaceStructure):
|
class Replacement(WorkspaceStructure):
|
||||||
def __init__(self, objectFromInitial, objectFromModified, relation):
|
def __init__(self, ctx, objectFromInitial, objectFromModified, relation):
|
||||||
from context import context as ctx
|
|
||||||
WorkspaceStructure.__init__(self, ctx)
|
WorkspaceStructure.__init__(self, ctx)
|
||||||
self.objectFromInitial = objectFromInitial
|
self.objectFromInitial = objectFromInitial
|
||||||
self.objectFromModified = objectFromModified
|
self.objectFromModified = objectFromModified
|
||||||
|
|||||||
@ -6,8 +6,7 @@ import formulas
|
|||||||
|
|
||||||
|
|
||||||
class Rule(WorkspaceStructure):
|
class Rule(WorkspaceStructure):
|
||||||
def __init__(self, facet, descriptor, category, relation):
|
def __init__(self, ctx, facet, descriptor, category, relation):
|
||||||
from context import context as ctx
|
|
||||||
WorkspaceStructure.__init__(self, ctx)
|
WorkspaceStructure.__init__(self, ctx)
|
||||||
self.facet = facet
|
self.facet = facet
|
||||||
self.descriptor = descriptor
|
self.descriptor = descriptor
|
||||||
|
|||||||
Reference in New Issue
Block a user