Model<OT extends ProgramOperation> class Null safety

Our model, the main entry point to this module. See the library-level documentation for a description, and an explanation of the model's structure. Extended by Model15 and Model16.

Implemented types
Implementers

Constructors

Model(DisplayMode _displayMode, int _wordSize, int numFlags)

Properties

captureDebugLog bool
Starts or stops capturing debug log information. A debug log captures the calculator state, and subsequent keystrokes. It's meant to be a tool to facilitate bug reports.
read / write
cFlag bool
read / writeinherited
debugLog DebugLog?
read-only
display DisplayModel
latefinal
displayDisabled bool
read / write
displayLeadingZeros bool
read-only
displayMode DisplayMode
read / write
doubleWordStatus DoubleWordStatus
Gives a helper object for implementation of the double-integer multiply, remainder and divide operations.
read-only
read-only
floatOverflow bool
The float overflow flag, which is stored as gFlag on the 16C. On the 15C, it causes errorFlash to be true.
read / write
gFlag bool
read / writeinherited
hashCode int
The hash code for this object.
read-onlyinherited
integerSignMode IntegerSignMode
read / writeoverride-getter
internalSnapshot Observable<ModelSnapshot>
read-only
is15C bool
read-only
isComplexMode bool
read / write
isFloatMode bool
read-onlyoverride
lastX Value
read / write
lastXC Complex
read / write
lastXImaginary Value
read-only
logicalKeys List<List<MKey<OT>?>>
The list of "logical" keys. This has nothing to do with the UI; The order of the operations in this list determines the externalized form of the operations in the calculator's storage (the opcodes). It also determines the displayed appearance of operations in program mode, whether the calculator is in portrait or landscape orientation.
read-only
maxInt BigInt
read-onlyoverride
memory Memory<OT>
read-only
minInt BigInt
read-onlyoverride
modelName String
The name of this model of the calculator (16C or 15C).
read-only
needsSave bool
read / write
onIsPressed Observable<bool>
final
popSetResultX Value
Pop the stack and set X, setting lastX
write-only
popSetResultXC Complex
Pop the stack and set X from a Dart double, setting lastX
write-only
popSetResultXF double
Pop the stack and set X from a Dart double, setting lastX
write-only
popSetResultXI BigInt
Pop the stack and set X from a signed BigInt, setting lastX
write-only
prgmFlag bool
Are we entering a program?
read / write
program ProgramMemory<OT>
read-only
registerNumberBase int
Are register numbers base 10 (15C), or base 16 (16C)?
read-only
resultX Value
Set a result in X, which saves the old X value in lastX
write-only
resultXC Complex
write-only
resultXF double
write-only
resultXI BigInt
write-only
returnStackSize int
read-only
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
settings Settings
latefinal
shift ShiftKey
read / write
signMask BigInt
read-onlyoverride
signMode SignMode
read-only
t Value
read / write
trigMode TrigMode
read / write
userMode bool
read-only
wordMask BigInt
read-onlyoverride
wordSize int
Set the word size, and fix up the values on the stack for the new size. A size of 0 is interpreted as 64, as per the 16C.
read / writeoverride-getter
x Value
read / write
xC Complex
Get x as a complex value
read / write
xF double
Get x as a Dart double
read / write
xI BigInt
Get x as a signed BigInt
read / write
xImaginary Value
Just the imaginary part of x
read / write
xPreserveCLX Value
write-only
xRealF double
Set the real part of X, leaving the imaginary part alone, and not setting LastX. Clear clxDone. The 15C's stack management is simple! ;-)
write-only
y Value
read / write
yC Complex
read / write
yF double
read / write
yI BigInt
read / write
z Value
read / write
zC Complex
read-only
zF double
write-only

Methods

addProgramTraceToSnapshot(String f()) → void
addStuffToSnapshot(StringBuffer buf) → void
chsX() → void
Negate the value in x like the CHS key does. The behavior varies according to the current sign mode. In complex mode, it leaves the imaginary part alone, and does not change the CLX status.
clx() → void
compare(Value x, Value y) int
Compare two values according to the current sign mode
decodeJson(Map<String, dynamic> json, {required bool needsSave}) → void
Convert from a data structure that comes from JSON. If there's an error in the middle, it might be partially read, but not in a way that causes bad behavior in the calculator.
formatValue(Value v) String
getFlag(int i) bool
getStackByIndex(int i) Value
getStackByIndexC(int i) Complex
initializeFromJsonOrUri(String linkOrJson) bool
isZero(Value v) bool
Determine if this value is 0 or, if applicable, -0. Not for use with an index register value, since it can have a different representation for -0 -- cf. Memory.isZeroI()
newProgramInstruction(OT operation, ArgDone arg) ProgramInstruction<OT>
Create an instance of the model-specific ProgramInstruction subtype
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
optimizeInternalSnapshot() → void
popStack() → void
pushStack() → void
"lift" stack, after which one can write to x
readFromPersistentStorage() Future<void>
reset() → void
Reset the calculator to its default state.
resetFromPersistentStorage() Future<void>
rotateStackDown() → void
the R key
rotateStackUp() → void
The R key
selfTestContents() LcdContents
setFlag(int i, bool v) → void
setupComplex(List<Value>? imaginaryStack) → void
setXYZT(Value v) → void
setYZT(Value v) → void
swapXY() → void
toJson() Map<String, Object>
Convert to a data structure that can be serialized as JSON.
toString() String
A string representation of this object.
inherited
tryParseValue(String s) Value?
Try to parse s consistent with the current display mode, giving a Value on success.
writeToPersistentStorage() Future<void>

Operators

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