Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lochana-chathura opened this issue Nov 28, 2022 · 0 comments · May be fixed by #1161
Open

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

lochana-chathura opened this issue Nov 28, 2022 · 0 comments · May be fixed by #1161
Assignees
Labels
in progress Currently being implemented semtype Relates to types module Type/Improvement

Comments

@lochana-chathura
Copy link
Member

lochana-chathura commented Nov 28, 2022

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 };

@lochana-chathura lochana-chathura added the semtype Relates to types module label Nov 28, 2022
@lochana-chathura lochana-chathura self-assigned this Nov 28, 2022
@lochana-chathura lochana-chathura added the in progress Currently being implemented label Nov 28, 2022
@lochana-chathura lochana-chathura changed the title Refactor pre-defined atom section Avoid maintaining the order of pre-defined atoms in two places Nov 28, 2022
@lochana-chathura lochana-chathura removed the in progress Currently being implemented label Dec 19, 2022
@lochana-chathura lochana-chathura added the in progress Currently being implemented label Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Currently being implemented semtype Relates to types module Type/Improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants