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

AST datastructure with Simple Parser for Text File Lines and JSON import/export #63

Merged
merged 94 commits into from
Mar 24, 2021
Merged
Changes from 1 commit
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
0136287
created library de.variantsync.core
tcerny Dec 9, 2020
ebd6b2e
refractor package name
jeremiaheinle Dec 9, 2020
40b4110
deleted openjdk10 because its not working
wurstbroteater Dec 10, 2020
fd5ea93
minor changes after creating core library project
tcerny Dec 10, 2020
2070412
first draft of a Simple Parser for Text File Lines #52
tcerny Dec 14, 2020
7a95103
implemented #51
jeremiaheinle Dec 14, 2020
2f4ad8a
added UUID as type
wurstbroteater Dec 15, 2020
b9edc59
AST: added add method WIP toString
wurstbroteater Dec 16, 2020
fba3b05
added toString
wurstbroteater Dec 16, 2020
7cc7dce
Fixed and Optimised toString()
wurstbroteater Dec 16, 2020
63b21fc
added forgotten space in toString()
wurstbroteater Dec 16, 2020
421883f
changed gitignore
wurstbroteater Dec 16, 2020
b3d8ebb
edited #51
jeremiaheinle Dec 16, 2020
a003240
removed wrong java version
wurstbroteater Dec 17, 2020
8be0f6e
del apptest, enum
jeremiaheinle Dec 17, 2020
d5417dd
changed add Method of AST and its usage. Updated POM
wurstbroteater Dec 17, 2020
b132ef9
MAVEN: set JAVA version to 11 for usage of Path
wurstbroteater Dec 17, 2020
225174a
changed toString according to pauls ideas #50
wurstbroteater Dec 17, 2020
9259bcc
prettty json and test AST.toString()
jeremiaheinle Dec 17, 2020
829e4db
Merge branch 'issue-50' into issue-51
wurstbroteater Dec 17, 2020
a3a96b7
Merge remote-tracking branch 'origin/issue-51' into issue-51
wurstbroteater Dec 17, 2020
355cec9
merge dropped LineGrammar
wurstbroteater Dec 17, 2020
06dbe23
JsonParserTest fixed
wurstbroteater Dec 17, 2020
dd854f8
exclude fiels in AST from JsonParser
jeremiaheinle Dec 17, 2020
d80b38b
added seriazable
jeremiaheinle Dec 17, 2020
94425ed
Testcase for parseDirectory
tcerny Dec 21, 2020
15c2c40
fixed bug causing that the first dir is displayed twice
wurstbroteater Jan 6, 2021
bf259dc
first try to make attributed LineGrammar Enum
wurstbroteater Jan 6, 2021
5d82215
Styleguide
wurstbroteater Jan 6, 2021
1435db5
refactoring AST.java
wurstbroteater Jan 6, 2021
84b2e15
removed main from AST.java and added toString test
wurstbroteater Jan 6, 2021
34a6d4e
added size method and WIP size testing
wurstbroteater Jan 6, 2021
4071731
removed DEBUG output
wurstbroteater Jan 6, 2021
d136154
updated travis
wurstbroteater Jan 6, 2021
6fd51b2
Update .travis.yml
wurstbroteater Jan 6, 2021
f92002d
Travis decides if this is a fix or not
wurstbroteater Jan 6, 2021
87b22c8
Refactored LineGrammar according to Pauls idea, reduced size test
wurstbroteater Jan 8, 2021
a6249c0
addressing reviewer suggestions of #53
wurstbroteater Jan 16, 2021
0e8b183
added relativePath to child pom
wurstbroteater Jan 25, 2021
fa3a8a8
added maven compiler to fix IntelliJ-only-resolving-bugs
wurstbroteater Jan 25, 2021
8fcc5cd
changes in Simple Parser for Text File Lines
tcerny Jan 26, 2021
870f484
Merge branch 'seproj_ulm_2020' into issue-52
tcerny Jan 27, 2021
4414909
applied code style to newest library
tcerny Jan 27, 2021
f06f071
implemented grammar generalisation
tcerny Jan 27, 2021
b64019b
created ast package
tcerny Jan 27, 2021
28d4135
style guide in tests
tcerny Jan 27, 2021
4bc0314
Merge branch 'seproj_ulm_2020' into issue-52
wurstbroteater Feb 2, 2021
74fed02
Issue-58 resolved
jeremiaheinle Feb 11, 2021
caaadff
processed issue 56 WIP
tcerny Feb 16, 2021
70ca60d
removed commented lines and formatted files prior to pull request
tcerny Mar 2, 2021
58ebef0
finished issue-56 and deleted previously added folder de.variantsync.…
tcerny Mar 2, 2021
84d5696
Merge branch 'issue-56' into issue-52
tcerny Mar 2, 2021
1b44903
added accidentally deleted file de.variantsync.core/.project
tcerny Mar 2, 2021
1cbeff4
adressed reviewers suggestion
tcerny Mar 3, 2021
7a57030
addressed reviewers suggestions
tcerny Mar 10, 2021
21338d5
addressed reviewers suggestion
tcerny Mar 10, 2021
0e40810
changes in LineBasedParser and LineBasedParserTest
tcerny Mar 10, 2021
22f9e9e
review fixes
jeremiaheinle Mar 10, 2021
0a6b2dd
introduced local variables to increase readability
wurstbroteater Mar 10, 2021
989f811
addressing reviewer: move toString to class bottom
wurstbroteater Mar 10, 2021
dd8fbba
removed pointer magic
wurstbroteater Mar 10, 2021
33312e1
WIP: Refactoring toString
wurstbroteater Mar 10, 2021
c571d5e
corrected mistakes made during the work on issue 56
tcerny Mar 11, 2021
fb783d2
added FormatHelper class for refactoring of code duplication
tcerny Mar 11, 2021
c902a59
removed attributes-list in LineGrammar
tcerny Mar 11, 2021
43de43f
regeneralized JsonParser String/B
jeremiaheinle Mar 12, 2021
4812732
WIP refactored separator variables as discussed
wurstbroteater Mar 20, 2021
abc220d
AST added getter, setter, getMaxDepth, docu
wurstbroteater Mar 20, 2021
13cbd01
AST added getter, setter, getMaxDepth, docu
wurstbroteater Mar 20, 2021
09823af
refactored separator vars
wurstbroteater Mar 22, 2021
769ed4f
refactored AST test and toString test
wurstbroteater Mar 22, 2021
6e466ce
added comments and java docs for readability
wurstbroteater Mar 22, 2021
0ec7870
fixed toStringTest out and restructured size test
wurstbroteater Mar 22, 2021
b79c895
naming
wurstbroteater Mar 22, 2021
2e985a6
removed unused/dangerous AST methods
wurstbroteater Mar 22, 2021
1dc99c6
added test for maxDepth of AST
wurstbroteater Mar 22, 2021
f420d69
Deactivated failing test due to new AST format
wurstbroteater Mar 22, 2021
00d542b
Code formatted and clean up
wurstbroteater Mar 22, 2021
3838c0b
Changed name of AST attribut to plural form
wurstbroteater Mar 22, 2021
c6807fe
fixed test for initial size
wurstbroteater Mar 22, 2021
e8cdf23
addressing reviewer suggestion
wurstbroteater Mar 22, 2021
70ebe21
addressing reviewer suggestion
wurstbroteater Mar 22, 2021
d8524f2
changed getSubtrees and code restructure
wurstbroteater Mar 22, 2021
a46fca3
added tests
wurstbroteater Mar 22, 2021
9fabadd
Code format and clean up
wurstbroteater Mar 22, 2021
08ab049
addressing reviewer suggestion
wurstbroteater Mar 22, 2021
063ef68
minor improvments on add methods, added tests, code format and cleanup
wurstbroteater Mar 22, 2021
0669169
renamed Test so that maven will auto exec it
wurstbroteater Mar 23, 2021
94bb0ec
refactored toString, added printTree, fixed tests for AST
wurstbroteater Mar 23, 2021
32bac5e
Code format and cleanup
wurstbroteater Mar 23, 2021
72d897c
impl. reviewer suggestions as far as possible till meeting
wurstbroteater Mar 23, 2021
d297a64
changes after meeting
wurstbroteater Mar 24, 2021
2a6957b
final after meeting changes, code format and cleanup
wurstbroteater Mar 24, 2021
954c6c6
implemented final reviewer suggestions
tcerny Mar 24, 2021
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
Prev Previous commit
Next Next commit
Changed name of AST attribut to plural form
wurstbroteater committed Mar 22, 2021
commit 3838c0bf52c9858bf389716cf35989e27094de15
24 changes: 12 additions & 12 deletions de.variantsync.core/src/main/java/de/variantsync/core/ast/AST.java
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ public class AST<G extends Grammar, Value> {
private UUID id;
private Value value;
private G type;
private List<AST<G, Value>> subtree;
private List<AST<G, Value>> subtrees;

// all attributes which should not be visible to the GSON parser need to be at least transient
public static transient final String INDENT_STRING = " ";
@@ -31,7 +31,7 @@ public AST(G type, Value value) {
this.id = UUID.randomUUID();
this.type = type;
this.value = value;
this.subtree = new ArrayList<>();
this.subtrees = new ArrayList<>();
}

public UUID getId() {
@@ -46,25 +46,25 @@ public G getType() {
return type;
}

public List<AST<G, Value>> getSubtree() {
return subtree;
public List<AST<G, Value>> getSubtrees() {
return subtrees;
}

public void addChildren(List<AST<G, Value>> toAdd) {
if (toAdd != null) {
subtree.addAll(toAdd);
subtrees.addAll(toAdd);
}
}

public void addChild(AST<G, Value> toAdd) {
if (toAdd != null) {
subtree.add(toAdd);
subtrees.add(toAdd);
}
}

public int size() {
int tmpSize = 1;
for (final AST<G, Value> act : subtree) {
for (final AST<G, Value> act : subtrees) {
tmpSize += act.size();
}
return tmpSize;
@@ -78,12 +78,12 @@ private AST() {
}

public int getMaxDepth() {
if (subtree.size() == 0) {
if (subtrees.size() == 0) {
return 0;
}

int maxDepth = 0;
for (final AST<G, Value> node : subtree) {
for (final AST<G, Value> node : subtrees) {
maxDepth = Math.max(node.getMaxDepth(), maxDepth);
}
return ++maxDepth;
@@ -130,13 +130,13 @@ private void toString(StringBuilder result, AST<G, Value> parent, int depth, Has
}
result.append(String.format("%s %s uuid: %d%n", parent.type, parent.value, parent.getId().getMostSignificantBits()));
depth++;
for (final AST<G, Value> child : parent.subtree) {
for (final AST<G, Value> child : parent.subtrees) {
isLast = false;
if (parent.subtree.indexOf(child) == (parent.subtree.size() - 1)) {
if (parent.subtrees.indexOf(child) == (parent.subtrees.size() - 1)) {
// reached last child of parent
levelFinished.add(depth - 1);
isLast = true;
} else if (parent.subtree.indexOf(child) == 0) {
} else if (parent.subtrees.indexOf(child) == 0) {
// first child of new sub tree with unfinished depth so it needs NEXT_SEPARATOR later
levelFinished.remove(depth - 1);
}
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ private void checkStringRoot(AST<LineGrammar, String> node, String[] rootAttribu

private void checkStringSubTree(AST<LineGrammar, String> node, String[] lines) {
lineIndex++;
for (final AST<LineGrammar, String> child : node.getSubtree()) {
for (final AST<LineGrammar, String> child : node.getSubtrees()) {
final String line = lines[lineIndex];
assertTrue(line.contains(AST.INDENT_STRING));
assertTrue(line.contains(AST.NEXT_SEPARATOR) || line.contains(AST.NEXT_ACT_SEPARATOR) || line.contains(AST.LAST_SEPARATOR));