CatInterpreter class

CatInterpreter is a singleton class that creates a single instance of cat.CATInterpreter when the first call to CatInterpreter() is made

Mixed in types

Constructors

CatInterpreter()
_catInterpreter is a singleton instance of CatInterpreter that is created when the first call to CatInterpreter() is made
factory

Properties

allCommandsBuffer List<SimpleContainer>
A buffer that stores all the commands that have been executed.
read / write
copyCommandsBuffer List<String>
A buffer that stores the commands that are executed when the user is copying cells.
final
executedCommands int
A getter that returns the number of commands that have been executed.
read-only
getLastState → BasicShape
A getter that returns the last state of the interpreter.
read-only
getResults → Results
A getter that returns the number of commands that have been executed.
read-only
hashCode int
The hash code for this object.
read-onlyinherited
hasListeners bool
Whether any listeners are currently registered.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
validCommandsBuffer List<String>
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
copyCells(List<Pair<int, int>> origins, List<Pair<int, int>> destinations, String languageCode) bool
It takes two lists of pairs of integers, and returns a string that represents the code that will be executed by the interpreter
deleteCopyCommands() → void
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
executeCommands(String commands, String languageCode) → void
It takes a string of commands, validates them against the current schema, and then notifies the listeners
fillEmpty(String color, String languageCode) → void
It takes a color as a parameter, and then it calls the fill_empty function on the Scheme interpreter
initialize() → void
mirror(String direction, String languageCode) → void
It takes a direction as a parameter, and then it calls the mirror function on the _interpreter object, passing the direction as a parameter
mirrorCells(String direction, List<Pair<int, int>> origins, String languageCode) → void
It takes a direction and a list of origins, and then it creates a string that represents the code that the user would have to write in order to mirror the cells in the given direction
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
paint(int a, int b, String color, String languageCode, {required bool copyCommands}) → void
It takes in two integers and a string, and then it paints the cell at the given coordinates with the given color
paintMultiple(List<Pair<int, int>> positions, List<String> colors, String languageCode, {required bool copyCommands}) → void
It takes a list of positions and a list of colors, and for each position, it goes to that position and paints it with the corresponding color
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reset() → void
resetInterpreter() → void
It resets the interpreter and notifies the listeners
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited