|
@@ -691,6 +691,25 @@ class ReadDictionaryEdgeInstruction(StateInstruction):
|
|
|
"""Gets this state instruction's argument list."""
|
|
|
return [self.node_id, self.key]
|
|
|
|
|
|
+class ReadEdgeInstruction(StateInstruction):
|
|
|
+ """An instruction that reads an edge."""
|
|
|
+ def __init__(self, node_id):
|
|
|
+ StateInstruction.__init__(self)
|
|
|
+ self.node_id = node_id
|
|
|
+
|
|
|
+ def simplify(self):
|
|
|
+ """Applies basic simplification to this instruction and its children."""
|
|
|
+ return ReadEdgeInstruction(
|
|
|
+ self.node_id.simplify())
|
|
|
+
|
|
|
+ def get_opcode(self):
|
|
|
+ """Gets the opcode for this state instruction."""
|
|
|
+ return "RE"
|
|
|
+
|
|
|
+ def get_arguments(self):
|
|
|
+ """Gets this state instruction's argument list."""
|
|
|
+ return [self.node_id]
|
|
|
+
|
|
|
class CreateNodeInstruction(StateInstruction):
|
|
|
"""An instruction that creates an empty node."""
|
|
|
|
|
@@ -720,9 +739,29 @@ class CreateNodeWithValueInstruction(StateInstruction):
|
|
|
"""Gets this state instruction's argument list."""
|
|
|
return [self.value]
|
|
|
|
|
|
+class CreateEdgeInstruction(StateInstruction):
|
|
|
+ """An instruction that creates an edge."""
|
|
|
+ def __init__(self, source_id, target_id):
|
|
|
+ StateInstruction.__init__(self)
|
|
|
+ self.source_id = source_id
|
|
|
+ self.target_id = target_id
|
|
|
+
|
|
|
+ def simplify(self):
|
|
|
+ """Applies basic simplification to this instruction and its children."""
|
|
|
+ return CreateEdgeInstruction(
|
|
|
+ self.source_id.simplify(),
|
|
|
+ self.target_id.simplify())
|
|
|
+
|
|
|
+ def get_opcode(self):
|
|
|
+ """Gets the opcode for this state instruction."""
|
|
|
+ return "CE"
|
|
|
+
|
|
|
+ def get_arguments(self):
|
|
|
+ """Gets this state instruction's argument list."""
|
|
|
+ return [self.source_id, self.target_id]
|
|
|
+
|
|
|
class CreateDictionaryEdgeInstruction(StateInstruction):
|
|
|
"""An instruction that creates a dictionary edge."""
|
|
|
-
|
|
|
def __init__(self, source_id, key, target_id):
|
|
|
StateInstruction.__init__(self)
|
|
|
self.source_id = source_id
|