Skip to content

Avoid maintaining the order of pre-defined atoms in two places #1130

@lochana-chathura

Description

@lochana-chathura

Description:
$subject.

We need to refactor as follows.

  • Use constant for the indexes.
  • Define an array of atoms and loop over it to initialize. e.g. final readonly & Atom[] PREDEFINED_ATOMS = [ ...];
  • Can be accessed as follows: PREDEFINED_ATOMS[CELL_ATOM_TOP_INDEX];

Related code segment:

final Atom CELL_ATOM_TOP = { index: 0, atomicType: CELL_ATOMIC_TOP };
final Atom CELL_ATOM_BOTTOM = { index: 1, atomicType: CELL_ATOMIC_BOTTOM };
final Atom CELL_ATOM_MAPPING_TOP = { index: 2, atomicType: CELL_ATOMIC_MAPPING_TOP };
final Atom LIST_ATOM_MAPPING_TOP = { index: 3, atomicType: LIST_ATOMIC_MAPPING_TOP };
final Atom CELL_ATOM_RO = { index: 4, atomicType: CELL_ATOMIC_RO };
final Atom MAPPING_ATOM_RO = { index: 5, atomicType: MAPPING_ATOMIC_RO };
final Atom CELL_ATOM_MAPPING_RO = { index: 6, atomicType: CELL_ATOMIC_MAPPING_RO };
final Atom LIST_ATOM_MAPPING_RO = { index: 7, atomicType: LIST_ATOMIC_MAPPING_RO };

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions