void AddNot() { MemoryStorage.Add("not", new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) => { return((byte)(~stateMachine.SharedContext)); }))); }
void AddFalse() { MemoryStorage.Add("false", new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) => { return((byte)(stateMachine.SharedContext = (byte)(stateMachine.SharedContext | CommandConstants.False))); }))); }
void AddAndAll() { MemoryStorage.Add("andall", new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) => { return((byte)(stateMachine.SharedContext = (byte)(stateMachine.SharedContext & CommandConstants.All))); }))); }
void AddLoad(SharedKeyEnumerable <string> codeEnum) { var load = new LoadStateDirty <SavedSharedContextState <string, byte>, string, byte>(); load.SourceStream = codeEnum; MemoryStorage.Add(nameof(load), load); }
void AddAlloc(SharedKeyEnumerable <string> codeEnum) { var alloc = new AllocateNamedSharedContextStateDirty <SavedSharedContextState <string, byte>, string, byte>(); alloc.SourceStream = codeEnum; MemoryStorage.Add(nameof(alloc), alloc); }
void AddCopy(SharedKeyEnumerable <string> codeEnum) { var copy = new CopyStateDirty <SavedSharedContextState <string, byte>, string, byte>(); copy.SourceStream = codeEnum; MemoryStorage.Add(nameof(copy), copy); }
void AddClear() { var clear = new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) => { return((byte)(CommandConstants.None)); })); MemoryStorage.Add(nameof(clear), clear); }
void AddPrint() { MemoryStorage.Add("print", new CommandStateDelegate <string, byte>((stateMachine) => { var currentContext = stateMachine.SharedContext; System.Console.WriteLine(Convert.ToString(currentContext, 2)); return(currentContext); })); }
void AddInterrupt() { var interrupt = new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) => { return((byte)(stateMachine.SharedContext = (byte)(stateMachine.SharedContext | CommandConstants.Interrupt))); })); MemoryStorage.Add(nameof(interrupt), interrupt); }
void AddMov() { var mov = new CommandStateDelegate <string, byte>(new Func <IStateMachine <string, byte>, byte>((stateMachine) => { return((byte)(stateMachine.SharedContext = (byte)(stateMachine.SharedContext | CommandConstants.Move))); })); MemoryStorage.Add(nameof(mov), mov); }
void AddSaveLast() { MemoryStorage.Add("save_to_last_new", new CommandStateDelegate <string, byte>((stateMachine) => { var currentContext = stateMachine.SharedContext; var tkey = (MemoryStorage["newInstance"] as AllocateSharedContextStateDirty <SavedSharedContextState <string, byte>, string, byte>).NewKey; stateMachine.GetService.Get(tkey).Handle(stateMachine); return(currentContext); })); }
void AddNewInstance() { var newInstance = new AllocateSharedContextStateDirty <SavedSharedContextState <string, byte>, string, byte>(); MemoryStorage.Add(nameof(newInstance), newInstance); }
void AddSave() { var save = new SavedSharedContextState <string, byte>(); MemoryStorage.Add(nameof(save), save); }