You've already forked HeurAMS-Legacy
style: 代码格式化
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import heurams.kernel.particles as pt
|
||||
from .states import PhaserState, ProcessionState
|
||||
|
||||
class Procession():
|
||||
|
||||
class Procession:
|
||||
"""队列: 标识单次记忆流程"""
|
||||
|
||||
def __init__(self, atoms: list, phase: PhaserState, name: str = ""):
|
||||
self.atoms = atoms
|
||||
self.queue = atoms.copy()
|
||||
@@ -12,7 +14,7 @@ class Procession():
|
||||
self.phase = phase
|
||||
self.state: ProcessionState = ProcessionState.RUNNING
|
||||
|
||||
def forward(self, step = 1):
|
||||
def forward(self, step=1):
|
||||
self.cursor += step
|
||||
if self.cursor == len(self.queue):
|
||||
self.state = ProcessionState.FINISHED
|
||||
@@ -20,22 +22,22 @@ class Procession():
|
||||
self.state = ProcessionState.RUNNING
|
||||
try:
|
||||
self.current_atom = self.queue[self.cursor]
|
||||
return 1 # 成功
|
||||
return 1 # 成功
|
||||
except IndexError as e:
|
||||
print(f"{e}")
|
||||
return 0
|
||||
|
||||
def append(self, atom = None):
|
||||
def append(self, atom=None):
|
||||
if atom == None:
|
||||
atom = self.current_atom
|
||||
if self.queue[len(self.queue) - 1] != atom or len(self) <= 1:
|
||||
self.queue.append(atom)
|
||||
self.queue.append(atom)
|
||||
|
||||
def __len__(self):
|
||||
return (len(self.queue) - self.cursor)
|
||||
return len(self.queue) - self.cursor
|
||||
|
||||
def process(self):
|
||||
return (self.cursor)
|
||||
return self.cursor
|
||||
|
||||
def total_length(self):
|
||||
return len(self.queue)
|
||||
|
||||
Reference in New Issue
Block a user