Skip to content

Commit 542b39d

Browse files
committed
Dockerfile and exampleFolder added
1 parent 81c8d7b commit 542b39d

File tree

5 files changed

+75
-0
lines changed

5 files changed

+75
-0
lines changed

Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM ubuntu:20.04
2+
3+
ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
4+
RUN apt-get update
5+
RUN export PATH=$HOME/.local/bin:$PATH
6+
RUN apt-get install -y locales build-essential git default-jre maven vim
7+
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
8+
locale-gen
9+
ENV LANG en_US.UTF-8
10+
ENV LANGUAGE en_US:en
11+
ENV LC_ALL en_US.UTF-8
12+
13+
# # # INSTALL JavaSDG
14+
RUN git clone https://kaz.dsic.upv.es/git/program-slicing/SDG.git
15+
16+
WORKDIR "/SDG"
17+
18+
RUN mvn package -Dmaven.test.skip
19+
RUN mv ./sdg-cli/target/sdg-cli-1.3.0-jar-with-dependencies.jar ./javaSDG.jar
20+

examples/Example1.java

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class Example1 {
2+
public static void main(String[] args) {
3+
int sum = 0;
4+
int prod = 0;
5+
int i;
6+
int n = 10;
7+
for (i = 0; i < 10; i++) {
8+
sum += 1;
9+
prod += n;
10+
}
11+
System.out.println(sum);
12+
System.out.println(prod);
13+
}
14+
}

examples/Example2/A.java

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class A {
2+
int a = 0;
3+
public A(int val) { a = val; }
4+
public int getA() { return a; }
5+
public void setA(int val) { a = val; }
6+
public void printA() {
7+
System.out.print(a);
8+
}
9+
public void updateA(int v) { a++; }
10+
}
11+

examples/Example2/B.java

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class B extends A {
2+
int b = 5;
3+
public B(double val){
4+
super((int) val);
5+
}
6+
public void updateB(B b){
7+
b.setB(10);
8+
}
9+
public int getB() { return b; }
10+
public void setB(int val) { b = val; }
11+
public void printA() {
12+
System.out.print("Useless");
13+
}
14+
public void updateA(int v) {
15+
super.updateA(v);
16+
a += v;
17+
}
18+
}

examples/Example2/Example2.java

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class Example2 {
2+
public static void main(String[] args){
3+
A a1 = new A(1);
4+
B b1 = new B(5.6);
5+
a1.printA();
6+
b1.printA();
7+
b1.updateA(5);
8+
int z = b1.getA();
9+
System.out.print(z);
10+
}
11+
}
12+

0 commit comments

Comments
 (0)