-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathState.py
41 lines (34 loc) · 1.28 KB
/
State.py
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
27
28
29
30
31
32
33
34
35
36
37
__author__ = 'lfr'
import os,sys
from Production import Production
class State:
def __init__(self,nonTerminal,Production,backtraceState,inputStringProgress,productionProgress):
self.__noTerminal = nonTerminal
self.__Production = Production
self.__backtraceStateVector=[]
self.__backtraceStateVector.append(backtraceState)
self.__inputStringProgress = inputStringProgress
self.__productionProgress = productionProgress
self.__printed = False
def getBacktraceStateVector(self):
return self.__backtraceStateVector
def getNonTerminal(self):
return self.__noTerminal
def getProduction(self):
return self.__Production
def getProductionProgress(self):
return self.__productionProgress
def getInputStringProgress(self):
return self.__inputStringProgress
def isComplete(self):
if self.getProductionProgress() == len(self.getProduction().getProductionContent()):
return True
else:
return False
def nextSymbolToProgress(self):
tmp = self.getProduction().getProductionContent()
return tmp[self.__productionProgress]
def getPrinted(self):
return self.__printed
def setPrintedTrue(self):
self.__printed = True