Small library for observation mechanism
Project description
ntt-command-service
Library for implementing Command Pattern
Examples
from ntt_command_service import *
from typing import List
fScores: List[float] = []
class AppendDataCommand(ICommand):
def __init__(self, fScores: List[float], fScore: float):
self._fScores = fScores
self._fScore = fScore
def Execute(self) -> None:
self._fScores.append(self._fScore)
def CanExecute(self) -> bool:
return True
def Undo(self) -> None:
self._fScore.pop()
serCommandService = CommandService()
serCommandService.AddCommand(AppendDataCommand(fScores, 3))
# ----> fScores = [3]
serCommandService.AddCommand(AppendDataCommand(fScores, 5))
# ----> fScores = [3, 5]
serCommandService.AddCommand(AppendDataCommand(fScores, 1))
# ----> fScores = [3, 5, 1]
serCommandService.Undo()
# ----> fScores = [3, 5]
serCommandService.Clear()
serCommandService.CanUndo()
# ----> False
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for ntt-command-service-1.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2c6fed89cdfb84c44fd6c2dd3aca9eabe412a6823c676137df27bc01c827d92 |
|
MD5 | 4f5467e24c6ecdd9dc99b84a7f985353 |
|
BLAKE2b-256 | e6be485b938b2f24bccfedaf83c573fd1d53df5fd92d057f891ec97263e10198 |
Close
Hashes for ntt_command_service-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c35f26a84f7c8f32907ed096677fa46170a1f9f6ce296d3baf2294108f603392 |
|
MD5 | dc857477b26821e2f04b09571ec70931 |
|
BLAKE2b-256 | c92a47e0442aa6950c0e63c0cae2296c74e23a402f9a90eef5c3e55a16d4ec1e |