-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathP5.py
More file actions
26 lines (21 loc) · 664 Bytes
/
P5.py
File metadata and controls
26 lines (21 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from typing import List
from Graph import Graph
from Production import Production
from Vertex import Vertex
class P5(Production):
@staticmethod
def apply(vertices: List[Vertex], graph: Graph):
if vertices[0].label == 'P':
for vertex in graph.vertices.values():
if vertex.label == 'O':
graph.create_add_edge('d', vertices[0], vertex)
break
@staticmethod
def description() -> str:
return ('name: P5\n'
'L: (P)\n'
'P: (P) --d--> (O)\n'
'c: {CopyRest}\n')
@staticmethod
def to_string():
return "P5"