Skip to content

Commit b099ea0

Browse files
constants collector
1 parent 949c3f5 commit b099ea0

File tree

27 files changed

+1848
-13
lines changed

27 files changed

+1848
-13
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package org.utbot.examples;
2+
3+
import java.lang.reflect.Field;
4+
5+
class A<R extends Number> {
6+
7+
public C<R> c = new C<R>();
8+
9+
public int getCLol3() {
10+
return c.h.lol3();
11+
}
12+
// public A(int a, R at) {
13+
// this.a = a;
14+
// this.at = at;
15+
// }
16+
17+
// public class Lil {
18+
// int a = 1;
19+
//
20+
// Lil(int a) {
21+
// this.a = a;
22+
// }
23+
// }
24+
25+
// int a = 1;
26+
// int c;
27+
// R at;
28+
// final int b = 1;
29+
30+
// public static A<Number> produceA(int a, Number b) {
31+
// return new A<Number>(777, b);
32+
// }
33+
//public static A<Number> aInstance = new A<Number>(777, 13.0);
34+
35+
// public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
36+
// Field f = A.class.getField("aInstance");
37+
// System.out.println(f.get(null));
38+
// }
39+
40+
//public int lol(R a, ArrayList<R> arr);
41+
// public static <R extends Number> A<R> getInstance1(R a, ArrayList<R> arr) {
42+
// return new B<R>(a, 777, arr);
43+
// }
44+
45+
46+
// public static final A<Number> numberA = new A<Number>(1, 3L, null);
47+
// public static final A<Integer> intA = new A<Integer>(1, 2, null);
48+
// public static final A<String> strA = new A<String>(1, "a", null);
49+
//
50+
// public static A<Object> getInstance() {
51+
// return new A<Object>(1, null, null);
52+
// }
53+
54+
//public static A<Integer> getIntegerInstance() {
55+
// return new A<Integer>(1, 3);
56+
// }
57+
// public static A<Integer> getIntegerInstance(Integer a, B<Integer> bInstance) {
58+
// return new A<Integer>(a, 3, bInstance);
59+
// }
60+
61+
// private A() {}
62+
// public A(int a, R ba, R e, B<R> bInstance) {
63+
// this.e = e;
64+
// this.a = a;
65+
// this.bInstance = bInstance;
66+
// }
67+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.utbot.examples;
2+
3+
public class B<R> {
4+
5+
R[] arr;
6+
// int a;
7+
// String b;
8+
//
9+
// public B(int a, String b) {
10+
// this.a = a;
11+
// this.b = b;
12+
// }
13+
}
14+
//public class B<T extends Number> implements A<T> {
15+
//
16+
// public T a;
17+
// public int b;
18+
// public ArrayList<T> c;
19+
//
20+
// public B(T a, int b, ArrayList<T> c) {
21+
// this.a = a;
22+
// this.b = b;
23+
// this.c = c;
24+
// }
25+
//
26+
// @Override
27+
// public int lol(T a, ArrayList<T> arr) {
28+
// return 0;
29+
// }
30+
//}
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
package org.utbot.examples;
2+
3+
/**
4+
* A dynamically extensible vector of bytes. This class is roughly equivalent to
5+
* a DataOutputStream on top of a ByteArrayOutputStream, but is more efficient.
6+
*
7+
* @author Eric Bruneton
8+
*/
9+
public class ByteVector {
10+
11+
/**
12+
* The content of this vector.
13+
*/
14+
public byte[] data;
15+
16+
/**
17+
* Actual number of bytes in this vector.
18+
*/
19+
public int length;
20+
21+
/**
22+
* Constructs a new {@link ByteVector ByteVector} with a default initial size.
23+
*/
24+
public ByteVector() {
25+
data = new byte[64];
26+
}
27+
28+
/**
29+
* Constructs a new {@link ByteVector ByteVector} with the given initial size.
30+
*
31+
* @param initialSize the initial size of the byte vector to be constructed.
32+
*/
33+
public ByteVector(final int initialSize) {
34+
data = new byte[initialSize];
35+
}
36+
37+
/**
38+
* Puts a byte into this byte vector. The byte vector is automatically enlarged
39+
* if necessary.
40+
*
41+
* @param b a byte.
42+
* @return this byte vector.
43+
*/
44+
public ByteVector putByte(final int b) {
45+
int length = this.length;
46+
if (length + 1 > data.length) {
47+
enlarge(1);
48+
}
49+
data[length++] = (byte) b;
50+
this.length = length;
51+
return this;
52+
}
53+
54+
/**
55+
* Puts two bytes into this byte vector. The byte vector is automatically
56+
* enlarged if necessary.
57+
*
58+
* @param b1 a byte.
59+
* @param b2 another byte.
60+
* @return this byte vector.
61+
*/
62+
ByteVector put11(final int b1, final int b2) {
63+
int length = this.length;
64+
if (length + 2 > data.length) {
65+
enlarge(2);
66+
}
67+
final byte[] data = this.data;
68+
data[length++] = (byte) b1;
69+
data[length++] = (byte) b2;
70+
this.length = length;
71+
return this;
72+
}
73+
74+
/**
75+
* Puts a short into this byte vector. The byte vector is automatically enlarged
76+
* if necessary.
77+
*
78+
* @param s a short.
79+
* @return this byte vector.
80+
*/
81+
public ByteVector putShort(final int s) {
82+
int length = this.length;
83+
if (length + 2 > data.length) {
84+
enlarge(2);
85+
}
86+
final byte[] data = this.data;
87+
data[length++] = (byte) (s >>> 8);
88+
data[length++] = (byte) s;
89+
this.length = length;
90+
return this;
91+
}
92+
93+
/**
94+
* Puts a byte and a short into this byte vector. The byte vector is
95+
* automatically enlarged if necessary.
96+
*
97+
* @param b a byte.
98+
* @param s a short.
99+
* @return this byte vector.
100+
*/
101+
public ByteVector put12(final int b, final int s) {
102+
int length = this.length;
103+
if (length + 3 > data.length) {
104+
enlarge(3);
105+
}
106+
final byte[] data = this.data;
107+
data[length++] = (byte) b;
108+
data[length++] = (byte) (s >>> 8);
109+
data[length++] = (byte) s;
110+
this.length = length;
111+
return this;
112+
}
113+
114+
/**
115+
* Puts an int into this byte vector. The byte vector is automatically enlarged
116+
* if necessary.
117+
*
118+
* @param i an int.
119+
* @return this byte vector.
120+
*/
121+
public ByteVector putInt(final int i) {
122+
int length = this.length;
123+
if (length + 4 > data.length) {
124+
enlarge(4);
125+
}
126+
final byte[] data = this.data;
127+
data[length++] = (byte) (i >>> 24);
128+
data[length++] = (byte) (i >>> 16);
129+
data[length++] = (byte) (i >>> 8);
130+
data[length++] = (byte) i;
131+
this.length = length;
132+
return this;
133+
}
134+
135+
/**
136+
* Puts an UTF8 string into this byte vector. The byte vector is automatically
137+
* enlarged if necessary.
138+
*
139+
* @param s a String.
140+
* @return this byte vector.
141+
*/
142+
public ByteVector putUTF8(final String s) {
143+
final int charLength = s.length();
144+
int len = length;
145+
if (len + 2 + charLength > data.length) {
146+
enlarge(2 + charLength);
147+
}
148+
final byte[] data = this.data;
149+
// optimistic algorithm: instead of computing the byte length and then
150+
// serializing the string (which requires two loops), we assume the byte
151+
// length is equal to char length (which is the most frequent case), and
152+
// we start serializing the string right away. During the serialization,
153+
// if we find that this assumption is wrong, we continue with the
154+
// general method.
155+
data[len++] = (byte) (charLength >>> 8);
156+
data[len++] = (byte) charLength;
157+
for (int i = 0; i < charLength; ++i) {
158+
final char c = s.charAt(i);
159+
if ((c >= '\001' && c <= '\177') || (c >= '\u4E00' && c <= '\u9FFF')) {
160+
data[len++] = (byte) c;
161+
} else {
162+
throw new UnsupportedOperationException();
163+
}
164+
}
165+
length = len;
166+
return this;
167+
}
168+
169+
/**
170+
* Puts an array of bytes into this byte vector. The byte vector is
171+
* automatically enlarged if necessary.
172+
*
173+
* @param b an array of bytes. May be <tt>null</tt> to put <tt>len</tt> null
174+
* bytes into this byte vector.
175+
* @param off index of the fist byte of b that must be copied.
176+
* @param len number of bytes of b that must be copied.
177+
* @return this byte vector.
178+
*/
179+
public ByteVector putByteArray(final byte[] b, final int off, final int len) {
180+
if (length + len > data.length) {
181+
enlarge(len);
182+
}
183+
if (b != null) {
184+
System.arraycopy(b, off, data, length, len);
185+
}
186+
length += len;
187+
return this;
188+
}
189+
190+
/**
191+
* Enlarge this byte vector so that it can receive n more bytes.
192+
*
193+
* @param size number of additional bytes that this byte vector should be able
194+
* to receive.
195+
*/
196+
private void enlarge(final int size) {
197+
final int length1 = 2 * data.length;
198+
final int length2 = length + size;
199+
final byte[] newData = new byte[length1 > length2 ? length1 : length2];
200+
System.arraycopy(data, 0, newData, 0, length);
201+
data = newData;
202+
}
203+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.utbot.examples;
2+
3+
public class C<T> {
4+
5+
H<T> h = new H<T>();
6+
7+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package org.utbot.examples;
2+
3+
import java.util.GregorianCalendar;
4+
5+
import static java.util.Calendar.*;
6+
7+
/* Application logic */
8+
public class CalendarLogic {
9+
// Returns true iff cal is in a leap year
10+
public static boolean isLeapYear(GregorianCalendar cal) {
11+
int year = cal.get(YEAR);
12+
if (year % 4 == 0) {
13+
return year % 100 != 0;
14+
}
15+
return false;
16+
}
17+
18+
// Returns either of -1, 0, 1 depending on whether c1 is <, =, > than c2
19+
public static int compare(GregorianCalendar c1, GregorianCalendar c2) {
20+
int cmp;
21+
cmp = Integer.compare(c1.get(YEAR), c2.get(YEAR));
22+
if (cmp == 0) {
23+
cmp = Integer.compare(c1.get(MONTH), c2.get(MONTH));
24+
if (cmp == 0) {
25+
cmp = Integer.compare(c1.get(DAY_OF_MONTH), c2.get(DAY_OF_MONTH));
26+
if (cmp == 0) {
27+
cmp = Integer.compare(c1.get(HOUR), c2.get(HOUR));
28+
if (cmp == 0) {
29+
cmp = Integer.compare(c1.get(MINUTE), c2.get(MINUTE));
30+
if (cmp == 0) {
31+
cmp = Integer.compare(c1.get(SECOND), c2.get(SECOND));
32+
if (cmp == 0) {
33+
cmp = Integer.compare(c1.get(MILLISECOND), c2.get(MILLISECOND));
34+
}
35+
}
36+
}
37+
}
38+
}
39+
}
40+
return cmp;
41+
}
42+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package org.utbot.examples;
2+
3+
public interface D {
4+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.utbot.examples;
2+
3+
public class GrAlh {
4+
int a = 1;
5+
}

0 commit comments

Comments
 (0)