MinimalEncoder class

Encoder that encodes minimally

Algorithm:

The eleventh commandment was "Thou Shalt Compute" or "Thou Shalt Not Compute" - I forget which (Alan Perilis).

This implementation computes. As an alternative, the QR-Code specification suggests heuristics like this one:

If initial input data is in the exclusive subset of the Alphanumeric character set AND if there are less than 6,7,8 characters followed by data from the remainder of the 8-bit byte character set, THEN select the 8- bit byte mode ELSE select Alphanumeric mode;

This is probably right for 99.99% of cases but there is at least this one counter example: The string "AAAAAAa" encodes 2 bits smaller as ALPHANUMERIC(AAAAAA), BYTE(a) than by encoding it as BYTE(AAAAAAa). Perhaps that is the only counter example but without having proof, it remains unclear.

ECI switching:

In multi language content the algorithm selects the most compact representation using ECI modes. For example the most compact representation of the string "\u0150\u015C" (O-double-acute, S-circumflex) is ECI(UTF-8), BYTE(\u0150\u015C) while prepending one or more times the same leading character as in "\u0150\u0150\u015C", the most compact representation uses two ECIs so that the string is encoded as ECI(ISO-8859-2), BYTE(\u0150\u0150), ECI(ISO-8859-3), BYTE(\u015C).

@author Alex Geller

Constructors

MinimalEncoder(String stringToEncode, Encoding? priorityCharset, bool isGS1, ErrorCorrectionLevel ecLevel)
Creates a MinimalEncoder

Properties

ecLevel ErrorCorrectionLevel
final
encoders → ECIEncoderSet
final
hashCode int
The hash code for this object.
no setterinherited
isGS1 bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringToEncode String
final

Methods

addEdge(List<List<List<Edge?>>> edges, int position, Edge edge) → void
addEdges(Version version, List<List<List<Edge?>>> edges, int from, Edge? previous) → void
canEncode(Mode mode, int c) bool
doEncode(Version? version) ResultList
encodeSpecificVersion(Version version) ResultList
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

encode(String stringToEncode, Version? version, Encoding? priorityCharset, bool isGS1, ErrorCorrectionLevel ecLevel) ResultList
Encodes the string minimally
getCompactedOrdinal(Mode? mode) int
getVersion(VersionSize versionSize) Version
getVersionSize(Version version) VersionSize
isAlphanumeric(int c) bool
isDoubleByteKanji(int c) bool
isNumeric(int c) bool