Get rid of 'null' as first entry in `VarInfoBuilder.varInfos`
From !351 (comment 981052):
what I don't understand here: why is the first entry
null
? (VarInfoBuilder
mentions this forvarInfos
field, and in constructor, but not why)
From !351 (comment 982592):
You stopped digging too early.
The static data of tree
Node
instances is stored inVarInfo
instances, reducing the size of aNode
and enabling sharing. That information includes level in the tree, number of child nodes, etc. The level is also used as index to get more information about the variable associated with a node level, so you can find the variable itself, its name, etc.In addition,
Tree.ZERO
andTree.ONE
exist. Since they are nodes due to type system requirements, these need a level number as well. I picked0
for those, thus regular variables start at index1
.To create
VarInfo
instances insideTree
(VarInfoBuilder
didn't exist yet) I had aList<VarInfo>
with anull
value at index0
.That setup turned out to be horrible if you wanted to use MDD in non-CIF context as you had to use a CIF variable to construct a
VarInfo
instance. To simplify that,VarInfo
instance creation was unglued fromTree
and moved into the newVarInfoBuilder
class that generalizes on the variable type. The only connection of the builder class to theTree
is thatList<VarInfo>
list with an intialnull
value.
From !351 (comment 982957):
[...]
ZERO
andONE
are actually at levels -1 and -2, not at level 0. Other variables do start at index 1, but could thus start at level 0, getting rid of thisnull
weirdness, it seems.