Node class

This is the building block of the conversion tree. Thanks to the leafNodes parameter you can set other Nodes that depends on this parent node. Thanks to the coefficientProduct, coefficientSum, conversionType and base parameters you can set the relationship between this node and the parent node.

Constructors

Node.new({List<Node> leafNodes = const [], double coefficientProduct = 1.0, double coefficientSum = 0.0, dynamic name, double? value, String? stringValue, CONVERSION_TYPE conversionType = CONVERSION_TYPE.linearConversion, int? base, bool isConverted = false})

Properties

base int?
This is defined just for numeral system conversion. It defines the base of this number. E.g. 16 for hexadecimal, 10 for decimal, 10 for binary, etc.
getter/setter pair
coefficientProduct double
This is the product coefficient of CONVERSION_TYPE.linearConversion and CONVERSION_TYPE.reciprocalConversion. It is the a coefficient.
getter/setter pair
coefficientSum double
This is the sum coefficient of CONVERSION_TYPE.linearConversion and CONVERSION_TYPE.reciprocalConversion. It is the b coefficient.
getter/setter pair
conversionType CONVERSION_TYPE
This define the conversion type between this node and its parent. The default is CONVERSION_TYPE.linearConversion. This is useless for the root node (because it has no parent node).
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isConverted bool
If true this node is already converted, false otherwise. The node where the conversion start has isConverted = true.
getter/setter pair
leafNodes List<Node>
This are the list of the Nodes that depend by this node. These are the children of this parent node.
getter/setter pair
name ↔ dynamic
This is the name of the unit. Can be a String or an enum.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringValue String?
This the value that has the unit of measurement of this node. This is just for numeral systems conversion. In all the other cases use value.
getter/setter pair
value double?
This the value that has the unit of measurement of this node. This is valid for the most cases. But not for numeral systems conversion.
getter/setter pair

Methods

convert(dynamic name, dynamic value) → void
This method must be used on the root Node of the conversion. It converts all the Node of the tree from the Node which name is equal to name (value is assigned to this Node) to all the other Nodes of the tree.
getTreeAsList() List<Node>
Recursive function to get a list of the nodes of the tree
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