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