public void resetBaseSubmission(Submission sub){ Structure tmpStruct = sub.struct; Token[] tok = tmpStruct.tokens; for (int z = 0; z < tmpStruct.size()-1;z++){ tok[z].basecode = false; } } }
public int size() { if (struct != null) return structSize = struct.size(); return structSize; }
public final String[] allFiles(int sub) { Structure struct = (sub==0 ? subA : subB).struct; int count = 1; for (int i=1; i<struct.size(); i++) if (!struct.tokens[i].file.equals(struct.tokens[i-1].file)) count++; String[] res = new String[count]; if (count > 0) res[0] = struct.tokens[0].file; count = 1; for (int i=1; i<struct.size(); i++) if (!struct.tokens[i].file.equals(struct.tokens[i-1].file)) res[count++] = struct.tokens[i].file; /* bubblesort by file name. (so that equally named files are displayed * approximately side by side.) */ for (int a=1; a<res.length; a++) for (int b=1; b<(res.length-a); b++) if (res[b-1].compareTo(res[b])<0) { String hilf = res[b-1]; res[b-1] = res[b]; res[b] = hilf; } return res; }
public void token_distribution() { int[] count = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // to // count // the // distribution Enumeration<Submission> enum1 = submissions.elements(); while (enum1.hasMoreElements()) { Structure struct = enum1.nextElement().struct; if (struct != null) for (int i = struct.size() - 1; i >= 0; i--) count[struct.tokens[i].type]++; } int tot = 0; for (int i = 0; i < 0; i++) { // !!!!!!!!!!!!!!! int c = count[i]; tot += c; // System.out.println(Token.type2string(i)+"\t"+c); } System.out.println((tot > 999 ? "" : (tot > 99 ? " " : (tot > 9 ? " " : " "))) + tot); }
public final AllMatches compare(Submission subA, Submission subB) { Submission A, B, tmp; if (subA.struct.size() > subB.struct.size()) { A = subB; B = subA; } else { A = subB; B = subA; } // if hashtable exists in first but not in second structure: flip around! if (B.struct.table == null && A.struct.table != null) { tmp = A; A = B; B = tmp; } return compare(A, B, this.program.get_min_token_match()); }
public final AllBasecodeMatches compareWithBasecode(Submission subA, Submission subB) { Submission A, B, tmp; if (subA.struct.size() > subB.struct.size()) { A = subB; B = subA; } else { A = subB; B = subA; } // if hashtable exists in first but not in second structure: flip around! if (B.struct.table == null && A.struct.table != null) { tmp = A; A = B; B = tmp; } return compareWithBasecode(A, B, this.program.get_min_token_match()); }
public final int diffType(String file, int line, int sub) { Structure struct = (sub==0 ? subA:subB).struct; int index = 0; for (; index < struct.size(); index++) if (struct.tokens[index].file.equals(file) && struct.tokens[index].getLine() == line) break; if (index == struct.size()) return 0; while (index < struct.size() && struct.tokens[index].getLine() == line && struct.tokens[index].file.equals(file)) { int j = 0; for (; j < size(); j++) if (matches[j].contains(index, sub)) break; if (j == size()) return 2; index++; } return 1; }
String line; while ((line = reader.readLine()) != null) { if (token < struct.size()) { boolean first = true; while (struct.tokens[token] != null && struct.tokens[token].getLine() == lineNr) {
String line; while ((line = reader.readLine()) != null) { if (token < struct.size()) { boolean first = true; while (struct.tokens[token] != null && struct.tokens[token].getLine() == lineNr) {
String line; while ((line = reader.readLine()) != null) { if (token < struct.size()) { boolean first = true; while (struct.tokens[token] != null && struct.tokens[token].getLine() == lineNr) {
String line; while ((line = reader.readLine()) != null) { if (token < struct.size()) { boolean first = true; while (struct.tokens[token] != null
String line; while ((line = reader.readLine()) != null) { if (token < struct.size()) { boolean first = true; while (struct.tokens[token] != null && struct.tokens[token].getLine() == lineNr) {
public int query(Structure struct) { struct.write(); // this makes sure all my data is being ref'd by the pointer int size = struct.size(); Pointer p = new Memory(size + 4); p.setInt(0, size); p.write(4, struct.getPointer().getByteArray(0, size), 0, size); message msg = new message(p, size); query_ex(msg); // call to native world
String line; while ((line = reader.readLine()) != null) { if (token < struct.size()) { boolean first = true; while (struct.tokens[token] != null
public void addEnd(int type, org.antlr.v4.runtime.Token tok) { struct.addToken(new Python3Token(type, (currentFile == null ? "null" : currentFile), tok.getLine(), struct.tokens[struct.size()-1].getColumn() + 1,0)); } }
public jplag.Structure filter(jplag.Structure struct) { if (struct==null) return null; jplag.Structure res = new jplag.Structure(); for (int i=0; i<struct.size(); i++) { jplag.Token oldToken = struct.tokens[i]; if (table[oldToken.type]!=-1) res.addToken(new jplag.javax.JavaToken(table[oldToken.type], oldToken.file, oldToken.getLine())); } return res; } }
public boolean parse() throws jplag.ExitException { if (!program.use_verbose_parser()) { if (files == null || files.length == 0) { program.print("ERROR: nothing to parse for submission \"" + name + "\"\n", null); return false; } } struct = this.language.parse(dir, files); if (!language.errors()) { if (struct.size() < 3) { program.print("Submission \"" + name + "\" is too short!\n", null); struct = null; errors = true; // invalidate submission return false; } return true; } struct = null; errors = true; // invalidate submission if (program.use_debugParser()) copySubmission(); return false; }