operator []= method
The node will have the attribute names as strings, so we translate between those and the fields of the class.
Implementation
void operator []=(String attributeName, rawValue) {
var value = Message.from(rawValue, this);
switch (attributeName) {
case "zero":
// We prefer an explicit "=0" clause to a "ZERO"
// if both are present.
if (zero == null) zero = value;
return;
case "=0":
zero = value;
return;
case "one":
// We prefer an explicit "=1" clause to a "ONE"
// if both are present.
if (one == null) one = value;
return;
case "=1":
one = value;
return;
case "two":
// We prefer an explicit "=2" clause to a "TWO"
// if both are present.
if (two == null) two = value;
return;
case "=2":
two = value;
return;
case "few":
few = value;
return;
case "many":
many = value;
return;
case "other":
other = value;
return;
default:
return;
}
}