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

Improve collection types #523

Merged
merged 51 commits into from
Jan 16, 2020
Merged
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
04bf1bd
Migrate Triggerable.targets to Set
ggalmazor Dec 16, 2019
ed1bae4
Migrate TriggerableDag.triggerablesDAG to a LinkedHashSet
ggalmazor Dec 16, 2019
beb274b
Migrate TriggerableDag.triggerIndex to a map of sets
ggalmazor Dec 16, 2019
de6efcf
Migrate TriggerableDag.unorderedTriggers to a Set
ggalmazor Dec 16, 2019
883ec3b
Migrate to immutable and side-effect free code
ggalmazor Dec 17, 2019
9b0f5a5
Migrate to immutable and side-effect free code - Phase 2
ggalmazor Dec 17, 2019
4a75184
Migrate to immutable and side-effect free code - Phase 3
ggalmazor Dec 17, 2019
e671744
Migrate to immutable and side-effect free code - Phase 4
ggalmazor Dec 17, 2019
acd8d54
Simple rearrange
ggalmazor Dec 17, 2019
49a596b
Add TODO note
ggalmazor Dec 17, 2019
73e6364
Improve naming and extract methods to reduce duplication of concepts
ggalmazor Dec 17, 2019
eaa0f81
Extract inner loop in cascade outside of the main loop
ggalmazor Dec 17, 2019
1f7d147
Inline for more concise code
ggalmazor Dec 17, 2019
aaf6114
Separate computing the DAG from assigning it
ggalmazor Jan 8, 2020
0325420
Extract method that builds the DAG
ggalmazor Jan 8, 2020
d996178
Simplify assigning a new DAG
ggalmazor Jan 8, 2020
ccc0087
Pull up computing the edges to avoid passing through dependencies
ggalmazor Jan 8, 2020
a8b9c7a
Renaming and sorting methods and variables for improved reading
ggalmazor Jan 8, 2020
2f6ddf8
Make the dag building algorithm immutable
ggalmazor Jan 8, 2020
04a39f0
Remove unnecessary sorting of the nodes added to the DAG
ggalmazor Jan 8, 2020
6b7b52f
Simplify by adding the roots collection directly
ggalmazor Jan 8, 2020
fc112c7
Make member explicitly mutable
ggalmazor Dec 17, 2019
6157ffd
Improve names and context to understand what finalizing the DAG means
ggalmazor Dec 17, 2019
8eaaff1
Remove docblock comments
ggalmazor Dec 17, 2019
bffc1be
Rename members for more clarity
ggalmazor Dec 17, 2019
901156c
Reorder members
ggalmazor Dec 17, 2019
39d8cd0
Review dag.addTriggerable to provide up-to-date context and detail
ggalmazor Dec 17, 2019
0c012b3
Add docblock detailing side effects that might not be apparent
ggalmazor Dec 17, 2019
ebb51f5
Avoid confusing value reassignation dance
ggalmazor Dec 17, 2019
303e968
Remove unused imports
ggalmazor Dec 20, 2019
2bd11f6
Avoid hitting the main instance to get the dependant triggerables
ggalmazor Jan 8, 2020
1ddaed6
Inline methods only used once
ggalmazor Jan 8, 2020
d594ef4
Reuse the ref object
ggalmazor Jan 8, 2020
d28f98a
Remove redundant check
ggalmazor Jan 8, 2020
b4c83c2
Clean up code: naming, simplify, comments
ggalmazor Jan 8, 2020
47ee88e
Replace construction that's not compatible with Android API level 16
ggalmazor Jan 9, 2020
1e3cf39
Remove unused methods
ggalmazor Jan 9, 2020
86db7bf
Add comments explaining how the sets in the dag build get mutated
ggalmazor Jan 9, 2020
150a469
Add doc blocks for TriggerableDag members. Wrap at 80 chars
ggalmazor Jan 10, 2020
8c4ef1e
Make the DAG edge building algorithm easier to understand
ggalmazor Jan 10, 2020
11537bf
Remove redundant check
ggalmazor Jan 10, 2020
6e9aba9
Improve naming for less confusion
ggalmazor Jan 10, 2020
1f31f7d
Make the getDagEdges method non-static to avoid confusion by arg names
ggalmazor Jan 13, 2020
a942f47
Improve comment by using unambiguous language
ggalmazor Jan 13, 2020
3cfecc1
Change the collection type to set for conformity
ggalmazor Jan 13, 2020
f764f82
Add end-to-end test to verify that the DAG is sorted
ggalmazor Jan 13, 2020
0a25712
Revert getChidlrenOfReference method to the original implementation
ggalmazor Jan 13, 2020
ac646eb
Rename to avoid misguiding use of "children"
ggalmazor Jan 13, 2020
757ea20
Remove unnecessary comment
ggalmazor Jan 16, 2020
0fa1549
Add TO DO notes to remember code exploration insights and questions
ggalmazor Jan 16, 2020
a3b7a18
Make private all the protected members
ggalmazor Jan 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/main/java/org/javarosa/core/model/TriggerableDag.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,7 @@ public final Triggerable addTriggerable(Triggerable t) {
* triggers can't be laid out appropriately
*/
public void finalizeTriggerables(FormInstance mainInstance, EvaluationContext evalContext) throws IllegalStateException {
Set<QuickTriggerable> newTriggerablesDAG = buildDag(mainInstance, evalContext);

triggerablesDAG.clear();
triggerablesDAG = newTriggerablesDAG;
triggerablesDAG = buildDag(mainInstance, evalContext);
lognaturel marked this conversation as resolved.
Show resolved Hide resolved

//
// build the condition index for repeatable nodes
Expand Down