diff --git a/solve/.gitignore b/solve/.gitignore index c39d3955656052e302296f782bacc5c207aef732..bef26b50e99f1e8efd8d681885b6ea2870f80b3d 100644 --- a/solve/.gitignore +++ b/solve/.gitignore @@ -2,3 +2,5 @@ /src/gen-res/ /build/ events.txt +/src/main/jastadd/SocialNetworkGen.ast +/src/main/jastadd/SocialNetworkGen.jadd diff --git a/solve/libs/relast-compiler.jar b/solve/libs/relast-compiler.jar index 2be3103df77d31dd78987c3988a8925d9316ab12..071b1ada529fc6a87987e9756fd049058d99dbc9 100644 Binary files a/solve/libs/relast-compiler.jar and b/solve/libs/relast-compiler.jar differ diff --git a/solve/src/main/jastadd/SocialNetwork.relast b/solve/src/main/jastadd/SocialNetwork.relast index 929751f19b3336b21a456ccb2c52bad74b864742..7348089702aa576b817429cf3f207c1985a16e56 100644 --- a/solve/src/main/jastadd/SocialNetwork.relast +++ b/solve/src/main/jastadd/SocialNetwork.relast @@ -4,8 +4,7 @@ SocialNetwork : ModelElement ::= User* Post* ; User:ModelElement ::= <Name:String> ; abstract Submission : ModelElement ::= <Timestamp:Long> <Content:String> Comment* ; -// Comment : Submission ::= /<Post:Post>/ ; -Comment : Submission ::= <Post:Post> ; +Comment : Submission ::= ; Post : Submission ::= ; rel User.friends* -> User ; diff --git a/solve/src/main/jastadd/SocialNetworkGen.ast b/solve/src/main/jastadd/SocialNetworkGen.ast deleted file mode 100644 index 8a3d32f824591f4a6484b427b86bc04ddc7181ba..0000000000000000000000000000000000000000 --- a/solve/src/main/jastadd/SocialNetworkGen.ast +++ /dev/null @@ -1,6 +0,0 @@ -abstract ModelElement ::= <Id:Long>; -SocialNetwork : ModelElement ::= User* Post*; -User : ModelElement ::= <Name:String> <_impl_friends:RefList<User>> <_impl_submissions:RefList<Submission>> <_impl_likes:RefList<Comment>>; -abstract Submission : ModelElement ::= <Timestamp:Long> <Content:String> Comment*; -Comment : Submission ::= /<Post:Post>/ <_impl_likedBy:RefList<User>>; -Post : Submission; diff --git a/solve/src/main/jastadd/SocialNetworkGen.jadd b/solve/src/main/jastadd/SocialNetworkGen.jadd deleted file mode 100644 index 0400cf4dcfefc74080e08b57a13e58ce0fa9e704..0000000000000000000000000000000000000000 --- a/solve/src/main/jastadd/SocialNetworkGen.jadd +++ /dev/null @@ -1,157 +0,0 @@ -import java.util.ArrayList; -import java.util.Collections; -aspect RelAstAPI { - public User.User(Long Id, String Name) { - setId(Id); - setName(Name); - } - public Comment.Comment(Long Id, Long Timestamp, String Content, List<Comment> Comment) { - setId(Id); - setTimestamp(Timestamp); - setContent(Content); - setCommentList(Comment); - } - // rel User.friends* -> User - public java.util.List<User> User.friends() { - RefList<User> l = get_impl_friends(); - return l != null ? Collections.unmodifiableList(l) : Collections.emptyList(); - } - public void User.addToFriends(User o) { - assertNotNull(o); - RefList<User> list = get_impl_friends(); - if (list == null) { - list = new RefList<>(); - } - list.add(o); - set_impl_friends(list); - } - public void User.removeFromFriends(User o) { - assertNotNull(o); - RefList<User> list = get_impl_friends(); - if (list != null && list.remove(o)) { - set_impl_friends(list); - } - } - - // rel User.submissions* -> Submission - public java.util.List<Submission> User.submissions() { - RefList<Submission> l = get_impl_submissions(); - return l != null ? Collections.unmodifiableList(l) : Collections.emptyList(); - } - public void User.addToSubmissions(Submission o) { - assertNotNull(o); - RefList<Submission> list = get_impl_submissions(); - if (list == null) { - list = new RefList<>(); - } - list.add(o); - set_impl_submissions(list); - } - public void User.removeFromSubmissions(Submission o) { - assertNotNull(o); - RefList<Submission> list = get_impl_submissions(); - if (list != null && list.remove(o)) { - set_impl_submissions(list); - } - } - - // rel User.likes* <-> Comment.likedBy* - public java.util.List<Comment> User.likes() { - RefList<Comment> l = get_impl_likes(); - return l != null ? Collections.unmodifiableList(l) : Collections.emptyList(); - } - public void User.addToLikes(Comment o) { - assertNotNull(o); - RefList<Comment> list = get_impl_likes(); - if (list == null) { - list = new RefList<>(); - } - RefList<User> list2 = o.get_impl_likedBy(); - if (list2 == null) { - list2 = new RefList<>(); - } - list.add(o); - list2.add(this); - set_impl_likes(list); - o.set_impl_likedBy(list2); - } - public void User.removeFromLikes(Comment o) { - assertNotNull(o); - RefList<Comment> list = get_impl_likes(); - if (list != null && list.remove(o)) { - RefList<User> list2 = o.get_impl_likedBy(); - if (list2 != null) list2.remove(this); - set_impl_likes(list); - o.set_impl_likedBy(list2); - } - } - public java.util.List<User> Comment.likedBy() { - RefList<User> l = get_impl_likedBy(); - return l != null ? Collections.unmodifiableList(l) : Collections.emptyList(); - } - public void Comment.addToLikedBy(User o) { - assertNotNull(o); - RefList<User> list = get_impl_likedBy(); - if (list == null) { - list = new RefList<>(); - } - RefList<Comment> list2 = o.get_impl_likes(); - if (list2 == null) { - list2 = new RefList<>(); - } - list.add(o); - list2.add(this); - set_impl_likedBy(list); - o.set_impl_likes(list2); - } - public void Comment.removeFromLikedBy(User o) { - assertNotNull(o); - RefList<User> list = get_impl_likedBy(); - if (list != null && list.remove(o)) { - RefList<Comment> list2 = o.get_impl_likes(); - if (list2 != null) list2.remove(this); - set_impl_likedBy(list); - o.set_impl_likes(list2); - } - } - - public boolean ASTNode.violateLowerBounds() { - return !getLowerBoundsViolations().isEmpty(); - } - public java.util.List<Pair<ASTNode, String>> ASTNode.getLowerBoundsViolations() { - ArrayList<Pair<ASTNode, String>> list = new ArrayList<>(); - computeLowerBoundsViolations(list); - return list; - } - public void ASTNode.computeLowerBoundsViolations(java.util.List<Pair<ASTNode, String>> list) { - for (int i = 0; i < getNumChildNoTransform(); i++) { - getChildNoTransform(i).computeLowerBoundsViolations(list); - } - } - public class Pair<T1, T2> { - public final T1 _1; - public final T2 _2; - public Pair(T1 _1, T2 _2) { - ASTNode.assertNotNull(_1); - ASTNode.assertNotNull(_2); - this._1 = _1; - this._2 = _2; - } - public boolean equals(Object other) { - if (other instanceof Pair) { - Pair<?,?> p = (Pair<?,?>) other; - return _1.equals(p._1) && _2.equals(p._2); - } else { - return false; - } - } - public int hashCode() { - return 31*_1.hashCode() + _2.hashCode(); - } - } - public static void ASTNode.assertNotNull(Object obj) { - if (obj == null) { - throw new NullPointerException(); - } - } -}