Skip to content

commit-relations #200

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added src/.DS_Store
Binary file not shown.
Binary file added src/sneps/.DS_Store
Binary file not shown.
Binary file added src/sneps/network/.DS_Store
Binary file not shown.
4,219 changes: 2,107 additions & 2,112 deletions src/sneps/network/Network.java

Large diffs are not rendered by default.

Binary file added src/sneps/network/classes/.DS_Store
Binary file not shown.
472 changes: 240 additions & 232 deletions src/sneps/network/classes/Relation.java

Large diffs are not rendered by default.

Binary file not shown.
78 changes: 78 additions & 0 deletions src/sneps/network/classes/setClasses/LinkedList_SubCollection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package sneps.network.classes.setClasses;

import java.util.LinkedList;

public class LinkedList_SubCollection {

public boolean SubList (LinkedList a , LinkedList b) {

LinkedList<Integer> counter = new LinkedList<Integer>();
int check = 0;
if(a.size() > b.size()) {
SubList(b, a);
}
else

for(int i=0; i<a.size();i++) {
for(int j=0;j<b.size();j++) {
if(b.contains(a.get(i)) == true) {
if(a.get(i) != (b.get(j))) {

}
else
if(!counter.isEmpty()) {
if(counter.get(check)<j) {
counter.add(j);
}

}
else
counter.add(j);
}
else
return false;
}
}

System.out.println(counter);

for (int i=0; i<counter.size();i++) {

if((counter.get(i)+1)-1 == (counter.get(i))) {
System.out.println("tamam");
}
else {
return false;
}
}
return true;
}
public static void main(String[] args) {

LinkedList_SubCollection x = new LinkedList_SubCollection();

LinkedList<String> object = new LinkedList<String>();

// Adding elements to the linked list
object.add("K");
object.add("H");
object.addLast("C");
System.out.println("Linked list : " + object);

LinkedList<String> a = new LinkedList<String>();

// Adding elements to the linked list
a.addFirst("T");
a.add("D");
a.add("K");
a.add("H");
a.add("C");
a.addLast("S");
System.out.println("Linked list : " + a);
System.out.println();

System.out.print(x.SubList(object,a));

}

}
242 changes: 242 additions & 0 deletions src/sneps/network/classes/setClasses/NodeCollection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
package sneps.network.classes.setClasses;

import java.util.ArrayList;
//import java.awt.Graphics;
//import java.awt.print.PageFormat;
//import java.awt.print.Printable;
//import java.awt.print.PrinterException;
//import java.io.Serializable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Vector;
import sneps.network.Node;
import sneps.network.classes.term.Term;

public class NodeCollection {

public Vector<Node> Vector_Nodes;
public LinkedList<Node> LinkedList_Nodes;
//public ArrayList<Node> ArrayList_Nodes;

public NodeCollection() {
Vector_Nodes = new Vector<Node>();
LinkedList_Nodes = new LinkedList<Node>();
}
/////////////////*///////////////// Vector Methods Start
public Node VectorgetNode(int index) {
return this.Vector_Nodes.get(index);
}
public void VectoraddNode(Node node) {
if (!this.Vector_Nodes.contains(node))
this.Vector_Nodes.add(node);
}
public int Vectorsize() {
return this.Vector_Nodes.size();
}
public void VectoraddAll(NodeCollection Vector_NodeCollection) {
for (int i = 0; i < Vector_NodeCollection.Vectorsize(); i++) {
this.VectoraddNode(Vector_NodeCollection.VectorgetNode(i));
}
}
public void VectorremoveNode(Node node) {
this.Vector_Nodes.remove(node);
}

public void Vectorclear() {
this.Vector_Nodes.clear();
}

public boolean VectorisEmpty() {
return this.Vector_Nodes.isEmpty();
}

public boolean Vectorcontains(Node node) {
return this.Vector_Nodes.contains(node);
}
public Vector<Node> VectorUnion(NodeCollection Vector_NodeCollection) {
NodeCollection unionCollection = new NodeCollection();
unionCollection.VectoraddAll(this);
unionCollection.VectoraddAll(Vector_NodeCollection);
return unionCollection.Vector_Nodes;
}
public Vector<Node> VectorIntersection(NodeCollection Vector_NodeCollection) {
NodeCollection intersectionCollection = new NodeCollection();
for (int i = 0; i < Vector_NodeCollection.Vectorsize(); i++) {
if (this.Vectorcontains(Vector_NodeCollection.VectorgetNode(i)))
intersectionCollection.VectoraddNode(Vector_NodeCollection.VectorgetNode(i));
}
return intersectionCollection.Vector_Nodes;
}
public Vector<Node> Vectordifference(NodeCollection Vector_NodeCollection) {
NodeCollection differenceCollection = new NodeCollection();
for (int i = 0; i < this.Vectorsize(); i++) {
if (!Vector_NodeCollection.Vectorcontains(this.VectorgetNode(i)))
differenceCollection.VectoraddNode(this.VectorgetNode(i));
}
return differenceCollection.Vector_Nodes;
}
public boolean Vectorequals(Object obj) {
if (!obj.getClass().getSimpleName().equals("NodeCollection"))
return false;

NodeCollection nodeCollection = (NodeCollection) obj;
if (this.Vector_Nodes.size() != nodeCollection.Vectorsize())
return false;
for (int i = 0; i < this.Vector_Nodes.size(); i++) {
if (!nodeCollection.Vectorcontains(this.Vector_Nodes.get(i)))
return false;
}
return true;
}
public Iterator<Node> Vectoriterator() {
return Vector_Nodes.iterator();
}
public String VectortoString() {
String s = "{";
for (int i = 0; i < this.Vector_Nodes.size(); i++) {
s += this.Vector_Nodes.get(i).toString();
if (i < this.Vector_Nodes.size() - 1)
s += " ";
}
s += "}";
return s;
}
/////////////////*///////////////// Vector Methods Ends
/*
*
*/
/////////////////*///////////////// LinkedList Methods Starts
public Node LinkedListgetNode(int index) {
return this.LinkedList_Nodes.get(index);
}
public void LinkedListaddNode(Node node) {
if (!this.LinkedList_Nodes.contains(node))
this.LinkedList_Nodes.add(node);
}
public void LinkedListaddNode(int index ,Node node) {
if (!this.LinkedList_Nodes.contains(node))
this.LinkedList_Nodes.add(index ,node);
}
public int LinkedListsize() {
return this.LinkedList_Nodes.size();
}
public void LinkedListaddAll(NodeCollection LinkedList_NodeCollection) {
for (int i = 0; i < LinkedList_NodeCollection.LinkedListsize(); i++) {
this.LinkedListaddNode(LinkedList_NodeCollection.LinkedListgetNode(i));
}
}
public void LinkedListremoveNode(Node node) {
this.LinkedList_Nodes.remove(node);
}
public void LinkedListclear() {
this.LinkedList_Nodes.clear();
}
public boolean LinkedListisEmpty() {
return this.LinkedList_Nodes.isEmpty();
}
public boolean LinkedListcontains(Node node) {
return this.LinkedList_Nodes.contains(node);
}
public LinkedList<Node> LinkedListUnion(NodeCollection LinkedList_NodeCollection) {
NodeCollection unionCollection = new NodeCollection();
unionCollection.LinkedListaddAll(this);
unionCollection.LinkedListaddAll(LinkedList_NodeCollection);
return unionCollection.LinkedList_Nodes;
}
public LinkedList<Node> LinkedListIntersection(NodeCollection LinkedList_NodeCollection) {
NodeCollection intersectionCollection = new NodeCollection();
for (int i = 0; i < LinkedList_NodeCollection.LinkedListsize(); i++) {
if (this.LinkedListcontains(LinkedList_NodeCollection.LinkedListgetNode(i)))
intersectionCollection.LinkedListaddNode(LinkedList_NodeCollection.LinkedListgetNode(i));
}
return intersectionCollection.LinkedList_Nodes;
}
public LinkedList<Node> LinkedListdifference(NodeCollection LinkedList_NodeCollection) {
NodeCollection differenceCollection = new NodeCollection();
for (int i = 0; i < this.LinkedListsize(); i++) {
if (!LinkedList_NodeCollection.LinkedListcontains(this.LinkedListgetNode(i)))
differenceCollection.LinkedListaddNode(this.LinkedListgetNode(i));
}
return differenceCollection.LinkedList_Nodes;
}
public boolean LinkedListequals(Object obj) {
if (!obj.getClass().getSimpleName().equals("NodeCollection"))
return false;

NodeCollection nodeCollection = (NodeCollection) obj;
if (this.LinkedList_Nodes.size() != nodeCollection.LinkedListsize())
return false;
for (int i = 0; i < this.LinkedList_Nodes.size(); i++) {
if (!nodeCollection.LinkedListcontains(this.LinkedList_Nodes.get(i)))
return false;
}
return true;
}
public Iterator<Node> LinkedListiterator() {
return LinkedList_Nodes.iterator();
}
public String LinkedListtoString() {
String s = "{";
for (int i = 0; i < this.LinkedList_Nodes.size(); i++) {
s += this.LinkedList_Nodes.get(i).toString();
if (i < this.LinkedList_Nodes.size() - 1)
s += " ";
}
s += "}";
return s;
}

public LinkedList<Node> LinkedListSubList (NodeCollection LinkedList_NodeCollection) {

NodeCollection x = new NodeCollection();

for(int i = 0; i < LinkedList_NodeCollection.LinkedListsize(); i++) {
for(int j = 0; j < this.LinkedList_Nodes.size(); j++) {
if((LinkedList_NodeCollection.LinkedListgetNode(i)) != (this.LinkedList_Nodes.get(j))) {

}
}
}
return x.LinkedList_Nodes;

}
/////////////////*///////////////// LinkedList Methods Ends
/*
*
*/
public static void main(String[] args) {

NodeCollection nc = new NodeCollection();
Term t = new Term("Tarek") {};
Term tt = new Term("Mohamed") {};
Term ttt = new Term("ElWasseif") {};
Node x = new Node(t);
Node xx = new Node(tt);
Node xxx = new Node(ttt);
nc.LinkedListaddNode(x);
nc.LinkedListaddNode(xx);
nc.LinkedListaddNode(xxx);

NodeCollection ncc = new NodeCollection();
Term t1 = new Term("Ahmed") {};
Term tt2 = new Term("Hassan") {};
Term ttt3 = new Term("Tarek") {};
Node x1 = new Node(t1);
Node xx2 = new Node(tt2);
Node xxx3 = new Node(ttt3);
ncc.LinkedListaddNode(x1);
ncc.LinkedListaddNode(xx2);
ncc.LinkedListaddNode(xxx3);

//System.out.println("Union : " + nc.VectorUnion(ncc));
//System.out.println("Intersection : " + nc.VectorIntersection(ncc));
//System.out.println("Difference : " + nc.Vectordifference(ncc));

//System.out.println("Union : " + nc.LinkedListUnion(ncc));
//System.out.println("Intersection : " + nc.LinkedListIntersection(ncc));
//System.out.println("Difference : " + nc.LinkedListdifference(ncc));

}

}

Binary file added src/sneps/snepslog/.DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions src/sneps/snepslog/parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ class CUP$parser$actions {
String id2 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
String a = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
ArrayList<String> a = (ArrayList<String>)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int lleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int lright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
String l = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
Expand Down Expand Up @@ -1692,7 +1692,7 @@ class CUP$parser$actions {
String id2 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
String a = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
ArrayList<String> a = (ArrayList<String>)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int lleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int lright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
String l = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
Expand Down Expand Up @@ -1720,7 +1720,7 @@ class CUP$parser$actions {
String id2 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
String a = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
ArrayList<String> a = (ArrayList<String>)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int lleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int lright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
String l = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
Expand Down