type
stringclasses
1 value
dataset
stringclasses
1 value
input
stringlengths
75
160k
instruction
stringlengths
117
171
output
stringlengths
88
168k
Inversion-Mutation
megadiff
"public void renderCSS(ResourceRenderer renderer, String path) throws RenderingException, IOException { Orientation orientation = Orientation.LT; if (path.endsWith("-lt.css")) { path = path.substring(0, path.length() - "-lt.css".length()) + ".css"; } else if (path.endsWith("-rt.css")) { path = path.substring(0, path.length() - "-rt.css".length()) + ".css"; orientation = Orientation.RT; } // Try cache first if (!PropertyManager.isDevelopping()) { if (path.startsWith("/portal/resource")) { renderer.setExpiration(ONE_MONTH); } else { renderer.setExpiration(ONE_HOUR); } // Map<String, String> cache = orientation == Orientation.LT ? ltCache : rtCache; String css = cache.get(path); if (css == null) { StringBuilder sb = new StringBuilder(); processCSS(sb, path, orientation, true); css = sb.toString(); cache.put(path, css); } renderer.getAppendable().append(css); } else { processCSS(renderer.getAppendable(), path, orientation, false); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "renderCSS"
"public void renderCSS(ResourceRenderer renderer, String path) throws RenderingException, IOException { Orientation orientation = Orientation.LT; if (path.endsWith("-lt.css")) { path = path.substring(0, path.length() - "-lt.css".length()) + ".css"; } else if (path.endsWith("-rt.css")) { path = path.substring(0, path.length() - "-rt.css".length()) + ".css"; orientation = Orientation.RT; } // Try cache first if (!PropertyManager.isDevelopping()) { if (path.startsWith("/portal/resource")) { renderer.setExpiration(ONE_MONTH); } else { renderer.setExpiration(ONE_HOUR); } // Map<String, String> cache = orientation == Orientation.LT ? ltCache : rtCache; String css = cache.get(path); if (css == null) { StringBuilder sb = new StringBuilder(); processCSS(sb, path, orientation, true); css = sb.toString(); cache.put(path, css); <MASK>renderer.getAppendable().append(css);</MASK> } } else { processCSS(renderer.getAppendable(), path, orientation, false); } }"
Inversion-Mutation
megadiff
"public int delete(String table, String whereClause, String[] whereArgs) throws BPFDBException { PreparedStatement statement = null; try { if (whereClause != null && !whereClause.isEmpty()) { String sql = "DELETE FROM " + table + " WHERE " + whereClause; statement = connection.prepareStatement(sql); if (whereArgs != null) { for (int i=0; i < whereArgs.length; i++) { statement.setString(i + 1, whereArgs[i]); } } logger.debug(TAG, "Deleting with SQL: " + sql); } else { statement = connection.prepareStatement("DELETE FROM " + table); logger.warning(TAG, "Deleting all items in: " + table); } return statement.executeUpdate(); } catch (SQLException e) { throw new BPFDBException("Couldn't delete, there was an SQLException: " + e.getMessage()); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "delete"
"public int delete(String table, String whereClause, String[] whereArgs) throws BPFDBException { PreparedStatement statement = null; try { if (whereClause != null && !whereClause.isEmpty()) { String sql = "DELETE FROM " + table + " WHERE " + whereClause; if (whereArgs != null) { <MASK>statement = connection.prepareStatement(sql);</MASK> for (int i=0; i < whereArgs.length; i++) { statement.setString(i + 1, whereArgs[i]); } } logger.debug(TAG, "Deleting with SQL: " + sql); } else { statement = connection.prepareStatement("DELETE FROM " + table); logger.warning(TAG, "Deleting all items in: " + table); } return statement.executeUpdate(); } catch (SQLException e) { throw new BPFDBException("Couldn't delete, there was an SQLException: " + e.getMessage()); } }"
Inversion-Mutation
megadiff
"private final boolean interpretShort(InstructionF99b ins) { int fromPC = iblock.pc; MachineOperandF99b mop1 = (MachineOperandF99b)ins.getOp1(); switch (ins.getInst()) { case Icmp: case Icmp+1: case Icmp+2: case Icmp+3: case Icmp+4: case Icmp+5: case Icmp+6: case Icmp+7: { short r = cpu.pop(); short l = cpu.pop(); boolean c = false; switch (ins.getInst() & 0x7) { case InstF99b.CMP_GE: c = l >= r; break; case InstF99b.CMP_GT: c = l > r; break; case InstF99b.CMP_LE: c = l <= r; break; case InstF99b.CMP_LT: c = l < r; break; case InstF99b.CMP_UGE: c = (l & 0xffff) >= (r & 0xffff); break; case InstF99b.CMP_UGT: c = (l & 0xffff) > (r & 0xffff); break; case InstF99b.CMP_ULE: c = (l & 0xffff) <= (r & 0xffff); break; case InstF99b.CMP_ULT: c = (l & 0xffff) < (r & 0xffff); break; } cpu.push((short) (c ? -1 : 0)); return false; } case Imath_start: case Imath_start+1: case Imath_start+2: case Imath_start+3: case Imath_start+4: case Imath_start+5: { short r = cpu.pop(); short l = cpu.pop(); cpu.push((short) binOp(l, r, ins.getInst() - Imath_start)); return false; } case Imath_start+8: case Imath_start+9: case Imath_start+10: case Imath_start+11: case Imath_start+12: case Imath_start+13: case Imath_start+14: case Imath_start+15: { short v = cpu.pop(); cpu.push((short) unaryOp(v, ins.getInst() - Imath_start)); return false; } case Iload: cpu.push(memory.readWord(cpu.pop())); break; case Icload: cpu.push((short) (memory.readByte(cpu.pop()) & 0xff)); break; case Istore: { int addr = cpu.pop(); memory.writeWord(addr, cpu.pop()); break; } case Icstore: { int addr = cpu.pop(); memory.writeByte(addr, (byte) cpu.pop()); break; } case IplusStore: { short addr = cpu.pop(); iblock.domain.writeWord(addr, (short) (iblock.domain.readWord(addr) + cpu.pop())); break; } case IcplusStore: { short addr = cpu.pop(); iblock.domain.writeByte(addr, (byte) (iblock.domain.readByte(addr) + cpu.pop())); break; } case IlitB: case IlitW: case IlitX: cpu.push(mop1.immed); break; case Iexit: cpu.setPC(cpu.rpop()); return true; case Iexiti: cpu.setPC(cpu.rpop()); cpu.setST(cpu.rpop()); cpu.noIntCount+=2; return true; case Idup: cpu.push(cpu.peek()); break; case Iqdup: { short val = cpu.peek(); if (val != 0) cpu.push(val); break; } case I0branchX: case I0branchB: case I0branchW: { short targ = (short) (fromPC + mop1.immed); if (cpu.pop() == 0) { cpu.setPC(targ); return true; } break; } case IbranchX: case IbranchB: case IbranchW: { short targ = (short) (fromPC + mop1.immed); cpu.setPC(targ); return true; } case I0equ: cpu.push((short) (cpu.pop() == 0 ? -1 : 0)); break; case Iequ: cpu.push((short) (cpu.pop() == cpu.pop() ? -1 : 0)); break; case Idrop: cpu.pop(); break; case Iswap: { short x = cpu.pop(); short y = cpu.pop(); cpu.push(x); cpu.push(y); break; } case Iover: cpu.push(iblock.getStackEntry(1)); break; case Irot: { short x = cpu.pop(); short y = cpu.pop(); short z = cpu.pop(); cpu.push(y); cpu.push(x); cpu.push(z); break; } case Iumul: { int mul = (cpu.pop() & 0xffff) * (cpu.pop() & 0xffff); cpu.push((short) (mul & 0xffff)); cpu.push((short) (mul >> 16)); break; } case Iudivmod: { int div = cpu.pop() & 0xffff; int num = cpu.popd(); if (div == 0) { cpu.push((short) -1); cpu.push((short) 0); } else { int quot = num / div; int rem = num % div; if (quot >= 65536) { cpu.push((short) -1); cpu.push((short) 0); } else { cpu.push((short) rem); cpu.push((short) quot); } } break; } case Iand: cpu.push((short) (cpu.pop() & cpu.pop())); break; case Ior: cpu.push((short) (cpu.pop() | cpu.pop())); break; case Ixor: cpu.push((short) (cpu.pop() ^ cpu.pop())); break; case Inot: cpu.push((short) (cpu.pop() != 0 ? 0 : -1)); break; case Inand: { short v = cpu.pop(); short m = cpu.pop(); cpu.push((short) (v & ~m)); break; } case Icall: cpu.rpush(iblock.pc); cpu.setPC(mop1.immed); return true; case Iexecute: cpu.rpush(iblock.pc); cpu.setPC(cpu.pop()); return true; case Idovar: { short next = cpu.rpop(); cpu.push(iblock.pc); cpu.setPC(next); return true; } case ItoR: cpu.rpush(cpu.pop()); break; case IRfrom: cpu.push(cpu.rpop()); break; case Irdrop: cpu.rpop(); break; case IatR: cpu.push(cpu.rpeek()); break; case Ispidx: cpu.push(iblock.getStackEntry(mop1.immed)); break; case Irpidx: cpu.push(iblock.getReturnStackEntry(mop1.immed)); break; case Ilpidx: cpu.push(iblock.getLocalStackEntry(mop1.immed)); break; case Ilocal: cpu.push((short) (iblock.lp - (mop1.immed + 1) * 2)); break; case Iupidx: cpu.push((short) (iblock.up + (mop1.val & 0xff) * 2)); break; case Iuser: cpu.push((short) (iblock.up + (cpu.pop() * 2))); break; case IloopUp: { short next = (short) (iblock.getReturnStackEntry(0) + 1); short lim = iblock.getReturnStackEntry(1); cpu.rpop(); cpu.rpush(next); cpu.push((short) ((lim != 0 ? next < lim : next >= 1) ? 0 : -1)); break; } case IuloopUp: { int next = (iblock.getReturnStackEntry(0) + 1) & 0xffff; short lim = iblock.getReturnStackEntry(1); cpu.rpop(); cpu.rpush((short) next); cpu.push((short) ((lim != 0 ? next < (lim & 0xffff) : next >= (1 & 0xffff)) ? 0 : -1)); break; } case IplusLoopUp: { short change = cpu.pop(); short cur = iblock.getReturnStackEntry(0); int next = (cur + change); short lim = iblock.getReturnStackEntry(1); cpu.rpop(); cpu.rpush((short) next); cpu.push((short) ((lim != 0 ? next < lim : next >= change) ? 0 : -1)); break; } case IuplusLoopUp: { short change = cpu.pop(); short cur = iblock.getReturnStackEntry(0); int next = (cur & 0xffff) + change; short lim = iblock.getReturnStackEntry(1); cpu.rpop(); cpu.rpush((short) next); cpu.push((short) ((lim != 0 ? next < (lim & 0xffff) : (next & 0xffff) >= (change & 0xffff)) ? 0 : -1)); break; } case Icfill: { int step = cpu.pop(); int len = cpu.pop() & 0xffff; int addr = cpu.pop(); byte ch = (byte) cpu.pop(); while (len-- > 0) { memory.writeByte(addr, ch); addr += step; cpu.addCycles(2); } break; } case Ifill: { int step = cpu.pop(); int len = cpu.pop() & 0xffff; int addr = cpu.pop(); short w = cpu.pop(); while (len-- > 0) { memory.writeWord(addr, w); addr += step*2; cpu.addCycles(2); } break; } case Icmove: { doCmove(); break; } case Ilalloc: { cpu.push((short) iblock.sp); cpu.push((short) (iblock.rp - mop1.immed * 2)); cpu.push((short) (mop1.immed * 2)); cpu.push((short) -1); cpu.push((short) -1); doCmove(); ((CpuStateF99b)cpu.getState()).setSP((short) (iblock.sp + mop1.immed * 2)); ((CpuStateF99b)cpu.getState()).setRP((short) (iblock.rp - mop1.immed * 2)); break; } case IcontextFrom: switch (mop1.immed) { case CTX_INT: cpu.push((short) cpu.getStatus().getIntMask()); break; case CTX_SP: cpu.push(((CpuStateF99b)cpu.getState()).getSP()); break; case CTX_SP0: cpu.push(((CpuStateF99b)cpu.getState()).getBaseSP()); break; case CTX_RP: cpu.push(((CpuStateF99b)cpu.getState()).getRP()); break; case CTX_RP0: cpu.push(((CpuStateF99b)cpu.getState()).getBaseRP()); break; case CTX_UP: cpu.push(((CpuStateF99b)cpu.getState()).getUP()); break; case CTX_LP: cpu.push(((CpuStateF99b)cpu.getState()).getLP()); break; case CTX_PC: cpu.push(cpu.getPC()); break; default: cpu.push((short) -1); break; } break; case ItoContext: switch (mop1.immed) { case CTX_INT: ((StatusF99b) ((CpuStateF99b)cpu.getState()).getStatus()).setIntMask(cpu.pop()); break; case CTX_SP: ((CpuStateF99b)cpu.getState()).setSP(cpu.pop()); break; case CTX_SP0: ((CpuStateF99b)cpu.getState()).setBaseSP(cpu.pop()); break; case CTX_RP: ((CpuStateF99b)cpu.getState()).setRP(cpu.pop()); break; case CTX_RP0: ((CpuStateF99b)cpu.getState()).setBaseRP(cpu.pop()); break; case CTX_UP: ((CpuStateF99b)cpu.getState()).setUP(cpu.pop()); break; case CTX_LP: ((CpuStateF99b)cpu.getState()).setLP(cpu.pop()); break; case CTX_PC: ((CpuStateF99b)cpu.getState()).setPC(cpu.pop()); return true; default: cpu.pop(); break; } break; case Isyscall: switch (mop1.immed) { case SYSCALL_DEBUG_OFF: { int oldCount = machine.getExecutor().debugCount; machine.getExecutor().debugCount++; if ((oldCount == 0) != (machine.getExecutor().debugCount == 0)) Executor.settingDumpFullInstructions.setBoolean(false); break; } case SYSCALL_DEBUG_ON: { int oldCount = machine.getExecutor().debugCount; machine.getExecutor().debugCount--; if ((oldCount == 0) != (machine.getExecutor().debugCount == 0)) Executor.settingDumpFullInstructions.setBoolean(true); break; } case SYSCALL_IDLE: { machine.getCpu().setIdle(true); break; } case SYSCALL_REGISTER_SYMBOL: { int xt = cpu.pop(); int nfa = xt; StringBuilder sb = new StringBuilder(); char ch; while (nfa-- > 0) { ch = (char) iblock.domain.readByte(nfa); if (sb.length() == 0 && (ch == 0x20 || ch == 0)) continue; if ((ch & 0x1f) == sb.length()) break; sb.insert(0, ch); } iblock.domain.getEntryAt(xt).defineSymbol(xt, sb.toString()); break; } /* case SYSCALL_INTERPRET: { int dp = cpu.pop(); int len = cpu.pop(); int addr = cpu.pop(); StringBuilder text = new StringBuilder(); while (len-- > 0) { text.append((char) iblock.domain.readByte(addr++)); } TargetContext targCtx = new F99bTargetContext(65536); HostContext hostCtx = new HostContext(targCtx); ForthComp comp = new ForthComp(hostCtx, targCtx); ByteArrayOutputStream diag = new ByteArrayOutputStream(); targCtx.setDP(dp); targCtx.importMemory(iblock.domain); comp.setLog(new PrintStream(diag)); try { comp.parseString(text.toString()); } catch (AbortException e) { e.printStackTrace(); try { diag.write(e.toString().getBytes()); } catch (IOException e1) { e1.printStackTrace(); } } comp.finish(); if (comp.getErrors() != 0) { System.err.println("Errors during compilation"); } try { targCtx.exportMemory(iblock.domain); } catch (AbortException e) { e.printStackTrace(); try { diag.write(e.toString().getBytes()); } catch (IOException e1) { e1.printStackTrace(); } } cpu.push((short) targCtx.getDP()); break; } */ } break; default: unsupported(ins); } return false; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "interpretShort"
"private final boolean interpretShort(InstructionF99b ins) { int fromPC = iblock.pc; MachineOperandF99b mop1 = (MachineOperandF99b)ins.getOp1(); switch (ins.getInst()) { case Icmp: case Icmp+1: case Icmp+2: case Icmp+3: case Icmp+4: case Icmp+5: case Icmp+6: case Icmp+7: { short r = cpu.pop(); short l = cpu.pop(); boolean c = false; switch (ins.getInst() & 0x7) { case InstF99b.CMP_GE: c = l >= r; break; case InstF99b.CMP_GT: c = l > r; break; case InstF99b.CMP_LE: c = l <= r; break; case InstF99b.CMP_LT: c = l < r; break; case InstF99b.CMP_UGE: c = (l & 0xffff) >= (r & 0xffff); break; case InstF99b.CMP_UGT: c = (l & 0xffff) > (r & 0xffff); break; case InstF99b.CMP_ULE: c = (l & 0xffff) <= (r & 0xffff); break; case InstF99b.CMP_ULT: c = (l & 0xffff) < (r & 0xffff); break; } cpu.push((short) (c ? -1 : 0)); return false; } case Imath_start: case Imath_start+1: case Imath_start+2: case Imath_start+3: case Imath_start+4: case Imath_start+5: { short r = cpu.pop(); short l = cpu.pop(); cpu.push((short) binOp(l, r, ins.getInst() - Imath_start)); return false; } case Imath_start+8: case Imath_start+9: case Imath_start+10: case Imath_start+11: case Imath_start+12: case Imath_start+13: case Imath_start+14: case Imath_start+15: { short v = cpu.pop(); cpu.push((short) unaryOp(v, ins.getInst() - Imath_start)); return false; } case Iload: cpu.push(memory.readWord(cpu.pop())); break; case Icload: cpu.push((short) (memory.readByte(cpu.pop()) & 0xff)); break; case Istore: { int addr = cpu.pop(); memory.writeWord(addr, cpu.pop()); break; } case Icstore: { int addr = cpu.pop(); memory.writeByte(addr, (byte) cpu.pop()); break; } case IplusStore: { short addr = cpu.pop(); iblock.domain.writeWord(addr, (short) (iblock.domain.readWord(addr) + cpu.pop())); break; } case IcplusStore: { short addr = cpu.pop(); iblock.domain.writeByte(addr, (byte) (iblock.domain.readByte(addr) + cpu.pop())); break; } case IlitB: case IlitW: case IlitX: cpu.push(mop1.immed); break; case Iexit: cpu.setPC(cpu.rpop()); return true; case Iexiti: cpu.setPC(cpu.rpop()); cpu.setST(cpu.rpop()); cpu.noIntCount+=2; return true; case Idup: cpu.push(cpu.peek()); break; case Iqdup: { short val = cpu.peek(); if (val != 0) cpu.push(val); break; } case I0branchX: case I0branchB: case I0branchW: { short targ = (short) (fromPC + mop1.immed); if (cpu.pop() == 0) { cpu.setPC(targ); return true; } break; } case IbranchX: case IbranchB: case IbranchW: { short targ = (short) (fromPC + mop1.immed); cpu.setPC(targ); return true; } case I0equ: cpu.push((short) (cpu.pop() == 0 ? -1 : 0)); break; case Iequ: cpu.push((short) (cpu.pop() == cpu.pop() ? -1 : 0)); break; case Idrop: cpu.pop(); break; case Iswap: { short x = cpu.pop(); short y = cpu.pop(); cpu.push(x); cpu.push(y); break; } case Iover: cpu.push(iblock.getStackEntry(1)); break; case Irot: { short x = cpu.pop(); short y = cpu.pop(); short z = cpu.pop(); cpu.push(y); cpu.push(x); cpu.push(z); break; } case Iumul: { int mul = (cpu.pop() & 0xffff) * (cpu.pop() & 0xffff); cpu.push((short) (mul & 0xffff)); cpu.push((short) (mul >> 16)); break; } case Iudivmod: { int div = cpu.pop() & 0xffff; int num = cpu.popd(); if (div == 0) { cpu.push((short) -1); cpu.push((short) 0); } else { int quot = num / div; int rem = num % div; if (quot >= 65536) { cpu.push((short) -1); cpu.push((short) 0); } else { cpu.push((short) quot); <MASK>cpu.push((short) rem);</MASK> } } break; } case Iand: cpu.push((short) (cpu.pop() & cpu.pop())); break; case Ior: cpu.push((short) (cpu.pop() | cpu.pop())); break; case Ixor: cpu.push((short) (cpu.pop() ^ cpu.pop())); break; case Inot: cpu.push((short) (cpu.pop() != 0 ? 0 : -1)); break; case Inand: { short v = cpu.pop(); short m = cpu.pop(); cpu.push((short) (v & ~m)); break; } case Icall: cpu.rpush(iblock.pc); cpu.setPC(mop1.immed); return true; case Iexecute: cpu.rpush(iblock.pc); cpu.setPC(cpu.pop()); return true; case Idovar: { short next = cpu.rpop(); cpu.push(iblock.pc); cpu.setPC(next); return true; } case ItoR: cpu.rpush(cpu.pop()); break; case IRfrom: cpu.push(cpu.rpop()); break; case Irdrop: cpu.rpop(); break; case IatR: cpu.push(cpu.rpeek()); break; case Ispidx: cpu.push(iblock.getStackEntry(mop1.immed)); break; case Irpidx: cpu.push(iblock.getReturnStackEntry(mop1.immed)); break; case Ilpidx: cpu.push(iblock.getLocalStackEntry(mop1.immed)); break; case Ilocal: cpu.push((short) (iblock.lp - (mop1.immed + 1) * 2)); break; case Iupidx: cpu.push((short) (iblock.up + (mop1.val & 0xff) * 2)); break; case Iuser: cpu.push((short) (iblock.up + (cpu.pop() * 2))); break; case IloopUp: { short next = (short) (iblock.getReturnStackEntry(0) + 1); short lim = iblock.getReturnStackEntry(1); cpu.rpop(); cpu.rpush(next); cpu.push((short) ((lim != 0 ? next < lim : next >= 1) ? 0 : -1)); break; } case IuloopUp: { int next = (iblock.getReturnStackEntry(0) + 1) & 0xffff; short lim = iblock.getReturnStackEntry(1); cpu.rpop(); cpu.rpush((short) next); cpu.push((short) ((lim != 0 ? next < (lim & 0xffff) : next >= (1 & 0xffff)) ? 0 : -1)); break; } case IplusLoopUp: { short change = cpu.pop(); short cur = iblock.getReturnStackEntry(0); int next = (cur + change); short lim = iblock.getReturnStackEntry(1); cpu.rpop(); cpu.rpush((short) next); cpu.push((short) ((lim != 0 ? next < lim : next >= change) ? 0 : -1)); break; } case IuplusLoopUp: { short change = cpu.pop(); short cur = iblock.getReturnStackEntry(0); int next = (cur & 0xffff) + change; short lim = iblock.getReturnStackEntry(1); cpu.rpop(); cpu.rpush((short) next); cpu.push((short) ((lim != 0 ? next < (lim & 0xffff) : (next & 0xffff) >= (change & 0xffff)) ? 0 : -1)); break; } case Icfill: { int step = cpu.pop(); int len = cpu.pop() & 0xffff; int addr = cpu.pop(); byte ch = (byte) cpu.pop(); while (len-- > 0) { memory.writeByte(addr, ch); addr += step; cpu.addCycles(2); } break; } case Ifill: { int step = cpu.pop(); int len = cpu.pop() & 0xffff; int addr = cpu.pop(); short w = cpu.pop(); while (len-- > 0) { memory.writeWord(addr, w); addr += step*2; cpu.addCycles(2); } break; } case Icmove: { doCmove(); break; } case Ilalloc: { cpu.push((short) iblock.sp); cpu.push((short) (iblock.rp - mop1.immed * 2)); cpu.push((short) (mop1.immed * 2)); cpu.push((short) -1); cpu.push((short) -1); doCmove(); ((CpuStateF99b)cpu.getState()).setSP((short) (iblock.sp + mop1.immed * 2)); ((CpuStateF99b)cpu.getState()).setRP((short) (iblock.rp - mop1.immed * 2)); break; } case IcontextFrom: switch (mop1.immed) { case CTX_INT: cpu.push((short) cpu.getStatus().getIntMask()); break; case CTX_SP: cpu.push(((CpuStateF99b)cpu.getState()).getSP()); break; case CTX_SP0: cpu.push(((CpuStateF99b)cpu.getState()).getBaseSP()); break; case CTX_RP: cpu.push(((CpuStateF99b)cpu.getState()).getRP()); break; case CTX_RP0: cpu.push(((CpuStateF99b)cpu.getState()).getBaseRP()); break; case CTX_UP: cpu.push(((CpuStateF99b)cpu.getState()).getUP()); break; case CTX_LP: cpu.push(((CpuStateF99b)cpu.getState()).getLP()); break; case CTX_PC: cpu.push(cpu.getPC()); break; default: cpu.push((short) -1); break; } break; case ItoContext: switch (mop1.immed) { case CTX_INT: ((StatusF99b) ((CpuStateF99b)cpu.getState()).getStatus()).setIntMask(cpu.pop()); break; case CTX_SP: ((CpuStateF99b)cpu.getState()).setSP(cpu.pop()); break; case CTX_SP0: ((CpuStateF99b)cpu.getState()).setBaseSP(cpu.pop()); break; case CTX_RP: ((CpuStateF99b)cpu.getState()).setRP(cpu.pop()); break; case CTX_RP0: ((CpuStateF99b)cpu.getState()).setBaseRP(cpu.pop()); break; case CTX_UP: ((CpuStateF99b)cpu.getState()).setUP(cpu.pop()); break; case CTX_LP: ((CpuStateF99b)cpu.getState()).setLP(cpu.pop()); break; case CTX_PC: ((CpuStateF99b)cpu.getState()).setPC(cpu.pop()); return true; default: cpu.pop(); break; } break; case Isyscall: switch (mop1.immed) { case SYSCALL_DEBUG_OFF: { int oldCount = machine.getExecutor().debugCount; machine.getExecutor().debugCount++; if ((oldCount == 0) != (machine.getExecutor().debugCount == 0)) Executor.settingDumpFullInstructions.setBoolean(false); break; } case SYSCALL_DEBUG_ON: { int oldCount = machine.getExecutor().debugCount; machine.getExecutor().debugCount--; if ((oldCount == 0) != (machine.getExecutor().debugCount == 0)) Executor.settingDumpFullInstructions.setBoolean(true); break; } case SYSCALL_IDLE: { machine.getCpu().setIdle(true); break; } case SYSCALL_REGISTER_SYMBOL: { int xt = cpu.pop(); int nfa = xt; StringBuilder sb = new StringBuilder(); char ch; while (nfa-- > 0) { ch = (char) iblock.domain.readByte(nfa); if (sb.length() == 0 && (ch == 0x20 || ch == 0)) continue; if ((ch & 0x1f) == sb.length()) break; sb.insert(0, ch); } iblock.domain.getEntryAt(xt).defineSymbol(xt, sb.toString()); break; } /* case SYSCALL_INTERPRET: { int dp = cpu.pop(); int len = cpu.pop(); int addr = cpu.pop(); StringBuilder text = new StringBuilder(); while (len-- > 0) { text.append((char) iblock.domain.readByte(addr++)); } TargetContext targCtx = new F99bTargetContext(65536); HostContext hostCtx = new HostContext(targCtx); ForthComp comp = new ForthComp(hostCtx, targCtx); ByteArrayOutputStream diag = new ByteArrayOutputStream(); targCtx.setDP(dp); targCtx.importMemory(iblock.domain); comp.setLog(new PrintStream(diag)); try { comp.parseString(text.toString()); } catch (AbortException e) { e.printStackTrace(); try { diag.write(e.toString().getBytes()); } catch (IOException e1) { e1.printStackTrace(); } } comp.finish(); if (comp.getErrors() != 0) { System.err.println("Errors during compilation"); } try { targCtx.exportMemory(iblock.domain); } catch (AbortException e) { e.printStackTrace(); try { diag.write(e.toString().getBytes()); } catch (IOException e1) { e1.printStackTrace(); } } cpu.push((short) targCtx.getDP()); break; } */ } break; default: unsupported(ins); } return false; }"
Inversion-Mutation
megadiff
"public static Test suite() { TestSuite suite = new TestSuite("Tests for org.eclipse.xtext.generator.tests"); suite.addTestSuite(org.eclipse.xtext.actions.AntlrParserTest.class); suite.addTestSuite(org.eclipse.xtext.actions.PackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.common.services.DefaultTerminalConverterTest.class); suite.addTestSuite(org.eclipse.xtext.concurrent.StateAccessTest.class); suite.addTestSuite(org.eclipse.xtext.EcoreUtil2Test.class); suite.addTestSuite(org.eclipse.xtext.enumrules.AntlrEnumAndReferenceTest.class); suite.addTestSuite(org.eclipse.xtext.enumrules.AntlrParserTest.class); suite.addTestSuite(org.eclipse.xtext.enumrules.GrammarParserTest.class); suite.addTestSuite(org.eclipse.xtext.enumrules.PackratEnumAndReferenceTest.class); suite.addTestSuite(org.eclipse.xtext.enumrules.PackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.enumrules.SerializationTest.class); suite.addTestSuite(org.eclipse.xtext.generator.grammarAccess.ElementFinderTest.class); suite.addTestSuite(org.eclipse.xtext.generator.grammarAccess.EmptyPackageAwareGrammarAccessFragmentTest.class); suite.addTestSuite(org.eclipse.xtext.generator.grammarAccess.FragmentFakingEcoreResourceTest.class); suite.addTestSuite(org.eclipse.xtext.generator.grammarAccess.ParserTest.class); suite.addTestSuite(org.eclipse.xtext.generator.ManifestMergerTest.class); suite.addTestSuite(org.eclipse.xtext.generator.resource.ResourceTest.class); suite.addTestSuite(org.eclipse.xtext.grammarinheritance.AnotherInheritanceTest.class); suite.addTestSuite(org.eclipse.xtext.grammarinheritance.Bug265111Test.class); suite.addTestSuite(org.eclipse.xtext.grammarinheritance.Inheritance2Test.class); suite.addTestSuite(org.eclipse.xtext.grammarinheritance.InheritanceTest.class); suite.addTestSuite(org.eclipse.xtext.grammarinheritance.ToEcoreTrafoTest.class); suite.addTestSuite(org.eclipse.xtext.GrammarUtilGetReferenceTest.class); suite.addTestSuite(org.eclipse.xtext.GrammarUtilTest.class); suite.addTestSuite(org.eclipse.xtext.lexer.Bug282355Test.class); suite.addTestSuite(org.eclipse.xtext.lexer.IngoreCaseTest.class); suite.addTestSuite(org.eclipse.xtext.lexer.LexerErrorTest.class); suite.addTestSuite(org.eclipse.xtext.linking.Bug266082Test.class); suite.addTestSuite(org.eclipse.xtext.linking.Bug287988Test.class); suite.addTestSuite(org.eclipse.xtext.linking.Bug287988WithEagerLinkingTest.class); suite.addTestSuite(org.eclipse.xtext.linking.CrossRefTest.class); suite.addTestSuite(org.eclipse.xtext.linking.lazy.BasicLazyLinkingTest.class); suite.addTestSuite(org.eclipse.xtext.linking.lazy.Bug289059Test.class); suite.addTestSuite(org.eclipse.xtext.linking.lazy.LazyLinkerTest.class); suite.addTestSuite(org.eclipse.xtext.linking.lazy.LazyLinkingResourceTest.class); suite.addTestSuite(org.eclipse.xtext.linking.lazy.LazyURIEncoderTest.class); suite.addTestSuite(org.eclipse.xtext.linking.LinkingErrorTest.class); suite.addTestSuite(org.eclipse.xtext.linking.PartialLinkingTest.class); suite.addTestSuite(org.eclipse.xtext.linking.SimpleAttributeResolverTest.class); suite.addTestSuite(org.eclipse.xtext.metamodelreferencing.tests.ExceptionTest.class); suite.addTestSuite(org.eclipse.xtext.metamodelreferencing.tests.MetamodelRefTest.class); suite.addTestSuite(org.eclipse.xtext.metamodelreferencing.tests.MultiGenMMTest.class); suite.addTestSuite(org.eclipse.xtext.MweReaderTest.class); suite.addTestSuite(org.eclipse.xtext.parseerrorhandling.ParseErrorHandlingTest.class); suite.addTestSuite(org.eclipse.xtext.parser.antlr.Bug289515Test.class); suite.addTestSuite(org.eclipse.xtext.parser.antlr.Bug289524ExTest.class); suite.addTestSuite(org.eclipse.xtext.parser.antlr.Bug289524Test.class); suite.addTestSuite(org.eclipse.xtext.parser.antlr.LexerProviderTest.class); suite.addTestSuite(org.eclipse.xtext.parser.antlr.TokenAcceptorTest.class); suite.addTestSuite(org.eclipse.xtext.parser.AntlrDatatypeRuleTokenTest.class); suite.addTestSuite(org.eclipse.xtext.parser.assignments.Bug287184Test.class); suite.addTestSuite(org.eclipse.xtext.parser.assignments.Bug288432Test.class); suite.addTestSuite(org.eclipse.xtext.parser.assignments.ParserBug281962Test.class); suite.addTestSuite(org.eclipse.xtext.parser.CrossContainmentTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.GrammarTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.MetamodelTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.MetamodelTransformationErrorTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.MetamodelTransformationTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.PackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.ParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.PartialParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.SerializationTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.ValueConverterTest.class); suite.addTestSuite(org.eclipse.xtext.parser.DefaultEcoreElementFactoryTest.class); suite.addTestSuite(org.eclipse.xtext.parser.epatch.EpatchComparingTest.class); suite.addTestSuite(org.eclipse.xtext.parser.keywords.AntlrParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.keywords.GrammarAccessTest.class); suite.addTestSuite(org.eclipse.xtext.parser.keywords.PackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.OffsetInformationTest.class); suite.addTestSuite(org.eclipse.xtext.parser.packrat.PackratParserGenUtilTest.class); suite.addTestSuite(org.eclipse.xtext.parser.packrat.PerformanceTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParserCrossContainmentMultiTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParserCrossContainmentSingleTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParserReplaceTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParsingPerformanceTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParsingPointerTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.DynamicChannelTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.HiddensTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.InterpreterTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.PackratHiddensTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.PackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.ParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.XtextGrammarComparingTest.class); suite.addTestSuite(org.eclipse.xtext.parser.XtextParserBugsTest.class); suite.addTestSuite(org.eclipse.xtext.parser.XtextParserTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.ASTChangeTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.CommentTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.EmptyModelTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.formatter.FormatterTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.formatter.XtextFormatterTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.HiddenTokensTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.impl.ParsetreeUtilLinuxAndMacTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.impl.ParsetreeUtilTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.impl.ParsetreeUtilWindowsTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.InvalidTokenTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.LengthOffsetLineTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.NodeContentAdapterTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.NodeModelTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.NodeTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.NodeUtilTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.ParseTreeUtilTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.ComplexReconstrTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.HiddenTokensMergerTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.SerializationBug269362Test.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.SerializationErrorTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.SimpleReconstrTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.WhitespacePreservingCallbackTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.XtextGrammarReconcilationTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.SerializeTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.transientvalues.TransientValuesTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.unassignedtext.UnassignedTextTest.class); suite.addTestSuite(org.eclipse.xtext.reference.CommentOnEofBug_234135_Test.class); suite.addTestSuite(org.eclipse.xtext.reference.LeafNodeBug_234132_Test.class); suite.addTestSuite(org.eclipse.xtext.resource.EObjectHandleImplTest.class); suite.addTestSuite(org.eclipse.xtext.resource.ResourceSetReferencingResourceSetTest.class); suite.addTestSuite(org.eclipse.xtext.resource.XtextResourcePerformanceTest.class); suite.addTestSuite(org.eclipse.xtext.resource.XtextResourceTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.impl.DeclarativeScopeProviderTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.impl.ImportUriUtilTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.impl.IndexBasedQualifiedNameScopeProviderTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.impl.QualifiedNameScopeProviderTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.impl.SimpleNameScopeProviderTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.ScopesTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.ScopeTest.class); suite.addTestSuite(org.eclipse.xtext.service.GenericModuleTest.class); suite.addTestSuite(org.eclipse.xtext.util.ChainedIteratorTest.class); suite.addTestSuite(org.eclipse.xtext.util.FilteringIteratorTest.class); suite.addTestSuite(org.eclipse.xtext.util.LineFilterOutputStreamTest.class); suite.addTestSuite(org.eclipse.xtext.util.MappingIteratorTest.class); suite.addTestSuite(org.eclipse.xtext.util.PolymorphicDispatcherTest.class); suite.addTestSuite(org.eclipse.xtext.util.ReflectionTest.class); suite.addTestSuite(org.eclipse.xtext.util.SimpleCacheTest.class); suite.addTestSuite(org.eclipse.xtext.util.StringsTest.class); suite.addTestSuite(org.eclipse.xtext.util.TailWriterTest.class); suite.addTestSuite(org.eclipse.xtext.util.TuplesTest.class); suite.addTestSuite(org.eclipse.xtext.validation.CompositeValidatorWithEObjectValidatorTest.class); suite.addTestSuite(org.eclipse.xtext.validation.CompositeValidatorWithoutEObjectValidatorTest.class); suite.addTestSuite(org.eclipse.xtext.validation.ConcurrentValidationTest.class); suite.addTestSuite(org.eclipse.xtext.validation.DeclarativeValidatorTest.class); suite.addTestSuite(org.eclipse.xtext.validation.ImportUriValidatorTest.class); suite.addTestSuite(org.eclipse.xtext.validation.ValidatorTestingTest.class); suite.addTestSuite(org.eclipse.xtext.valueconverter.Bug250313AntlrTest.class); suite.addTestSuite(org.eclipse.xtext.valueconverter.Bug250313PackratTest.class); suite.addTestSuite(org.eclipse.xtext.valueconverter.ParserComparingTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.Bug285605Test.class); suite.addTestSuite(org.eclipse.xtext.xtext.Bug290919Test.class); suite.addTestSuite(org.eclipse.xtext.xtext.ecoreInference.MultiValueFeatureTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.ecoreInference.UnassignedRuleCallTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.ecoreInference.Xtext2EcoreTransformerTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.ExceptionTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.KeywordInspectorTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.OverriddenValueInspectorTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.parser.packrat.XtextPackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.ResourceLoadTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.RuleWithoutInstantiationInspectorTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.ValidEntryRuleInspectorTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.XtextGrammarSerializationTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.XtextLinkerTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.XtextScopingTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.XtextValidationTest.class); suite.addTestSuite(org.eclipse.xtext.XtextGrammarTest.class); return suite; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "suite"
"public static Test suite() { TestSuite suite = new TestSuite("Tests for org.eclipse.xtext.generator.tests"); suite.addTestSuite(org.eclipse.xtext.actions.AntlrParserTest.class); suite.addTestSuite(org.eclipse.xtext.actions.PackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.common.services.DefaultTerminalConverterTest.class); <MASK>suite.addTestSuite(org.eclipse.xtext.resource.EObjectHandleImplTest.class);</MASK> suite.addTestSuite(org.eclipse.xtext.concurrent.StateAccessTest.class); suite.addTestSuite(org.eclipse.xtext.EcoreUtil2Test.class); suite.addTestSuite(org.eclipse.xtext.enumrules.AntlrEnumAndReferenceTest.class); suite.addTestSuite(org.eclipse.xtext.enumrules.AntlrParserTest.class); suite.addTestSuite(org.eclipse.xtext.enumrules.GrammarParserTest.class); suite.addTestSuite(org.eclipse.xtext.enumrules.PackratEnumAndReferenceTest.class); suite.addTestSuite(org.eclipse.xtext.enumrules.PackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.enumrules.SerializationTest.class); suite.addTestSuite(org.eclipse.xtext.generator.grammarAccess.ElementFinderTest.class); suite.addTestSuite(org.eclipse.xtext.generator.grammarAccess.EmptyPackageAwareGrammarAccessFragmentTest.class); suite.addTestSuite(org.eclipse.xtext.generator.grammarAccess.FragmentFakingEcoreResourceTest.class); suite.addTestSuite(org.eclipse.xtext.generator.grammarAccess.ParserTest.class); suite.addTestSuite(org.eclipse.xtext.generator.ManifestMergerTest.class); suite.addTestSuite(org.eclipse.xtext.generator.resource.ResourceTest.class); suite.addTestSuite(org.eclipse.xtext.grammarinheritance.AnotherInheritanceTest.class); suite.addTestSuite(org.eclipse.xtext.grammarinheritance.Bug265111Test.class); suite.addTestSuite(org.eclipse.xtext.grammarinheritance.Inheritance2Test.class); suite.addTestSuite(org.eclipse.xtext.grammarinheritance.InheritanceTest.class); suite.addTestSuite(org.eclipse.xtext.grammarinheritance.ToEcoreTrafoTest.class); suite.addTestSuite(org.eclipse.xtext.GrammarUtilGetReferenceTest.class); suite.addTestSuite(org.eclipse.xtext.GrammarUtilTest.class); suite.addTestSuite(org.eclipse.xtext.lexer.Bug282355Test.class); suite.addTestSuite(org.eclipse.xtext.lexer.IngoreCaseTest.class); suite.addTestSuite(org.eclipse.xtext.lexer.LexerErrorTest.class); suite.addTestSuite(org.eclipse.xtext.linking.Bug266082Test.class); suite.addTestSuite(org.eclipse.xtext.linking.Bug287988Test.class); suite.addTestSuite(org.eclipse.xtext.linking.Bug287988WithEagerLinkingTest.class); suite.addTestSuite(org.eclipse.xtext.linking.CrossRefTest.class); suite.addTestSuite(org.eclipse.xtext.linking.lazy.BasicLazyLinkingTest.class); suite.addTestSuite(org.eclipse.xtext.linking.lazy.Bug289059Test.class); suite.addTestSuite(org.eclipse.xtext.linking.lazy.LazyLinkerTest.class); suite.addTestSuite(org.eclipse.xtext.linking.lazy.LazyLinkingResourceTest.class); suite.addTestSuite(org.eclipse.xtext.linking.lazy.LazyURIEncoderTest.class); suite.addTestSuite(org.eclipse.xtext.linking.LinkingErrorTest.class); suite.addTestSuite(org.eclipse.xtext.linking.PartialLinkingTest.class); suite.addTestSuite(org.eclipse.xtext.linking.SimpleAttributeResolverTest.class); suite.addTestSuite(org.eclipse.xtext.metamodelreferencing.tests.ExceptionTest.class); suite.addTestSuite(org.eclipse.xtext.metamodelreferencing.tests.MetamodelRefTest.class); suite.addTestSuite(org.eclipse.xtext.metamodelreferencing.tests.MultiGenMMTest.class); suite.addTestSuite(org.eclipse.xtext.MweReaderTest.class); suite.addTestSuite(org.eclipse.xtext.parseerrorhandling.ParseErrorHandlingTest.class); suite.addTestSuite(org.eclipse.xtext.parser.antlr.Bug289515Test.class); suite.addTestSuite(org.eclipse.xtext.parser.antlr.Bug289524ExTest.class); suite.addTestSuite(org.eclipse.xtext.parser.antlr.Bug289524Test.class); suite.addTestSuite(org.eclipse.xtext.parser.antlr.LexerProviderTest.class); suite.addTestSuite(org.eclipse.xtext.parser.antlr.TokenAcceptorTest.class); suite.addTestSuite(org.eclipse.xtext.parser.AntlrDatatypeRuleTokenTest.class); suite.addTestSuite(org.eclipse.xtext.parser.assignments.Bug287184Test.class); suite.addTestSuite(org.eclipse.xtext.parser.assignments.Bug288432Test.class); suite.addTestSuite(org.eclipse.xtext.parser.assignments.ParserBug281962Test.class); suite.addTestSuite(org.eclipse.xtext.parser.CrossContainmentTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.GrammarTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.MetamodelTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.MetamodelTransformationErrorTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.MetamodelTransformationTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.PackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.ParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.PartialParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.SerializationTest.class); suite.addTestSuite(org.eclipse.xtext.parser.datatyperules.ValueConverterTest.class); suite.addTestSuite(org.eclipse.xtext.parser.DefaultEcoreElementFactoryTest.class); suite.addTestSuite(org.eclipse.xtext.parser.epatch.EpatchComparingTest.class); suite.addTestSuite(org.eclipse.xtext.parser.keywords.AntlrParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.keywords.GrammarAccessTest.class); suite.addTestSuite(org.eclipse.xtext.parser.keywords.PackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.OffsetInformationTest.class); suite.addTestSuite(org.eclipse.xtext.parser.packrat.PackratParserGenUtilTest.class); suite.addTestSuite(org.eclipse.xtext.parser.packrat.PerformanceTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParserCrossContainmentMultiTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParserCrossContainmentSingleTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParserReplaceTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParsingPerformanceTest.class); suite.addTestSuite(org.eclipse.xtext.parser.PartialParsingPointerTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.DynamicChannelTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.HiddensTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.InterpreterTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.PackratHiddensTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.PackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.terminalrules.ParserTest.class); suite.addTestSuite(org.eclipse.xtext.parser.XtextGrammarComparingTest.class); suite.addTestSuite(org.eclipse.xtext.parser.XtextParserBugsTest.class); suite.addTestSuite(org.eclipse.xtext.parser.XtextParserTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.ASTChangeTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.CommentTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.EmptyModelTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.formatter.FormatterTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.formatter.XtextFormatterTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.HiddenTokensTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.impl.ParsetreeUtilLinuxAndMacTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.impl.ParsetreeUtilTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.impl.ParsetreeUtilWindowsTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.InvalidTokenTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.LengthOffsetLineTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.NodeContentAdapterTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.NodeModelTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.NodeTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.NodeUtilTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.ParseTreeUtilTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.ComplexReconstrTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.HiddenTokensMergerTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.SerializationBug269362Test.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.SerializationErrorTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.SimpleReconstrTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.WhitespacePreservingCallbackTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.reconstr.XtextGrammarReconcilationTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.SerializeTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.transientvalues.TransientValuesTest.class); suite.addTestSuite(org.eclipse.xtext.parsetree.unassignedtext.UnassignedTextTest.class); suite.addTestSuite(org.eclipse.xtext.reference.CommentOnEofBug_234135_Test.class); suite.addTestSuite(org.eclipse.xtext.reference.LeafNodeBug_234132_Test.class); suite.addTestSuite(org.eclipse.xtext.resource.ResourceSetReferencingResourceSetTest.class); suite.addTestSuite(org.eclipse.xtext.resource.XtextResourcePerformanceTest.class); suite.addTestSuite(org.eclipse.xtext.resource.XtextResourceTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.impl.DeclarativeScopeProviderTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.impl.ImportUriUtilTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.impl.IndexBasedQualifiedNameScopeProviderTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.impl.QualifiedNameScopeProviderTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.impl.SimpleNameScopeProviderTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.ScopesTest.class); suite.addTestSuite(org.eclipse.xtext.scoping.ScopeTest.class); suite.addTestSuite(org.eclipse.xtext.service.GenericModuleTest.class); suite.addTestSuite(org.eclipse.xtext.util.ChainedIteratorTest.class); suite.addTestSuite(org.eclipse.xtext.util.FilteringIteratorTest.class); suite.addTestSuite(org.eclipse.xtext.util.LineFilterOutputStreamTest.class); suite.addTestSuite(org.eclipse.xtext.util.MappingIteratorTest.class); suite.addTestSuite(org.eclipse.xtext.util.PolymorphicDispatcherTest.class); suite.addTestSuite(org.eclipse.xtext.util.ReflectionTest.class); suite.addTestSuite(org.eclipse.xtext.util.SimpleCacheTest.class); suite.addTestSuite(org.eclipse.xtext.util.StringsTest.class); suite.addTestSuite(org.eclipse.xtext.util.TailWriterTest.class); suite.addTestSuite(org.eclipse.xtext.util.TuplesTest.class); suite.addTestSuite(org.eclipse.xtext.validation.CompositeValidatorWithEObjectValidatorTest.class); suite.addTestSuite(org.eclipse.xtext.validation.CompositeValidatorWithoutEObjectValidatorTest.class); suite.addTestSuite(org.eclipse.xtext.validation.ConcurrentValidationTest.class); suite.addTestSuite(org.eclipse.xtext.validation.DeclarativeValidatorTest.class); suite.addTestSuite(org.eclipse.xtext.validation.ImportUriValidatorTest.class); suite.addTestSuite(org.eclipse.xtext.validation.ValidatorTestingTest.class); suite.addTestSuite(org.eclipse.xtext.valueconverter.Bug250313AntlrTest.class); suite.addTestSuite(org.eclipse.xtext.valueconverter.Bug250313PackratTest.class); suite.addTestSuite(org.eclipse.xtext.valueconverter.ParserComparingTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.Bug285605Test.class); suite.addTestSuite(org.eclipse.xtext.xtext.Bug290919Test.class); suite.addTestSuite(org.eclipse.xtext.xtext.ecoreInference.MultiValueFeatureTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.ecoreInference.UnassignedRuleCallTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.ecoreInference.Xtext2EcoreTransformerTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.ExceptionTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.KeywordInspectorTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.OverriddenValueInspectorTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.parser.packrat.XtextPackratParserTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.ResourceLoadTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.RuleWithoutInstantiationInspectorTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.ValidEntryRuleInspectorTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.XtextGrammarSerializationTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.XtextLinkerTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.XtextScopingTest.class); suite.addTestSuite(org.eclipse.xtext.xtext.XtextValidationTest.class); suite.addTestSuite(org.eclipse.xtext.XtextGrammarTest.class); return suite; }"
Inversion-Mutation
megadiff
"private void doDownload(final String requestId, final NasProductTemplate template) { if (DownloadManagerDialog.showAskingForUserTitle( CismapBroker.getInstance().getMappingComponent())) { final String jobname = (!DownloadManagerDialog.getJobname().equals("")) ? DownloadManagerDialog .getJobname() : null; DownloadManager.instance() .add( new NASDownload( "NAS-Download", "", jobname, requestId, template, generateSearchGeomCollection())); } else { DownloadManager.instance() .add( new NASDownload( "NAS-Download", "", "", requestId, template, generateSearchGeomCollection())); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "doDownload"
"private void doDownload(final String requestId, final NasProductTemplate template) { if (DownloadManagerDialog.showAskingForUserTitle( CismapBroker.getInstance().getMappingComponent())) { final String jobname = (!DownloadManagerDialog.getJobname().equals("")) ? DownloadManagerDialog .getJobname() : null; DownloadManager.instance() .add( new NASDownload( "NAS-Download", <MASK>jobname,</MASK> "", requestId, template, generateSearchGeomCollection())); } else { DownloadManager.instance() .add( new NASDownload( "NAS-Download", "", "", requestId, template, generateSearchGeomCollection())); } }"
Inversion-Mutation
megadiff
"WebserverGui(Integer port) throws IOException{ setSize(300,150); setTitle(title); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); addMouseListener(this); if(port != null){ WWWServer.DEF_PORT = port; } (webserverthread = new Thread(web = new WWWServer(variant))).start(); if(usedOptions.generate_BOT){ web.setAttribute("bot", botentry); new Thread(botentry).start(); } url = "http://localhost:" + WWWServer.DEF_PORT + "/" + variant; init = true; this.repaint(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "WebserverGui"
"WebserverGui(Integer port) throws IOException{ setSize(300,150); setTitle(title); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); addMouseListener(this); if(port != null){ WWWServer.DEF_PORT = port; } (webserverthread = new Thread(web = new WWWServer(variant))).start(); if(usedOptions.generate_BOT){ web.setAttribute("bot", botentry); new Thread(botentry).start(); } url = "http://localhost:" + WWWServer.DEF_PORT + "/" + variant; <MASK>this.repaint();</MASK> init = true; }"
Inversion-Mutation
megadiff
"private void draw(PaintContext pc, SingleTile t, int w, int xPoints[], int yPoints[], int hl[], int count, byte highlight,boolean ortho /*, byte mode*/) { IntPoint closestP = new IntPoint(); int wClosest = 0; boolean dividedSeg = false; boolean dividedHighlight = true; IntPoint closestDestP = new IntPoint(); boolean dividedFinalRouteSeg = false; boolean dividedFinalDone = false; int originalFinalRouteSegX = 0; int originalFinalRouteSegY = 0; int pathIndexOfNewSeg = 0; boolean routeIsForwardOnWay = false; int originalX = 0; int originalY = 0; int wOriginal = w; if (w <1) { w=1; } int wDraw = w; int turn = 0; //#if polish.api.bigstyles WayDescription wayDesc = Legend.getWayDescription(type); //#else WayDescription wayDesc = Legend.getWayDescription((short) (type & 0xff)); //#endif Vector route = pc.trace.getRoute(); for (int i = 0; i < count; i++) { wDraw = w; // draw route line wider if ( highlight == HIGHLIGHT_ROUTEPATH_CONTAINED && hl[i] >= 0 && wDraw < Configuration.getMinRouteLineWidth() ) { wDraw = Configuration.getMinRouteLineWidth(); } if (dividedSeg) { // if this is a divided seg, draw second part of it xPoints[i] = xPoints[i + 1]; yPoints[i] = yPoints[i + 1]; xPoints[i + 1] = originalX; yPoints[i + 1] = originalY; dividedHighlight = !dividedHighlight; } else { // if not turn off the highlight dividedHighlight = false; if (dividedFinalRouteSeg) { //System.out.println ("restore i " + i); xPoints[i] = xPoints[i + 1]; yPoints[i] = yPoints[i + 1]; xPoints[i + 1] = originalFinalRouteSegX; yPoints[i + 1] = originalFinalRouteSegY; wDraw = w; if (routeIsForwardOnWay) { hl[i] = PATHSEG_DO_NOT_HIGHLIGHT; } else { hl[i] = route.size() - 2; if (wDraw < Configuration.getMinRouteLineWidth()) { wDraw = Configuration.getMinRouteLineWidth(); } } dividedFinalRouteSeg = false; dividedFinalDone = true; } } // divide final segment on the route if ( //false && highlight == HIGHLIGHT_ROUTEPATH_CONTAINED && route != null && hl[i] == route.size() - 2 ) { // get direction we go on the way ConnectionWithNode c = (ConnectionWithNode) route.elementAt(hl[i]); routeIsForwardOnWay = (c.wayFromConAt < c.wayToConAt); pathIndexOfNewSeg = (routeIsForwardOnWay ? c.wayToConAt - 1 : c.wayToConAt); //System.out.println ("waytoconat: " + c.wayToConAt + " wayfromconat: " + c.wayFromConAt + " i: " + i); if ( i == pathIndexOfNewSeg && !dividedFinalDone && !dividedFinalRouteSeg ) { pc.getP().forward(RouteInstructions.getClosestPointOnDestWay(), closestDestP); originalFinalRouteSegX = xPoints[i + 1]; originalFinalRouteSegY = yPoints[i + 1]; xPoints[i + 1] = closestDestP.x; yPoints[i + 1] = closestDestP.y; if (routeIsForwardOnWay) { ; } else { hl[i] = PATHSEG_DO_NOT_HIGHLIGHT; wDraw = w; } //pc.g.setColor(0x00ff00); //pc.g.drawString("closest:" + i, closestDestP.x, closestDestP.y, Graphics.TOP | Graphics.LEFT); //System.out.println("Insert closest point at " + (i + 1) ); dividedFinalRouteSeg = true; } } else { dividedFinalRouteSeg = false; } if (hl[i] >= 0 // if this is the closest segment of the closest connection && RouteInstructions.routePathConnection == hl[i] && i == RouteInstructions.pathIdxInRoutePathConnection - 1 && !dividedSeg ) { IntPoint centerP = new IntPoint(); // this is a divided seg (partly prior route line, partly current route line) dividedSeg = true; centerP=pc.getP().getImageCenter(); /** centerP is now provided by Projection implementation */ // pc.getP().forward( // (short)(MoreMath.FIXPT_MULT * (pc.center.radlat - t.centerLat)), // (short)(MoreMath.FIXPT_MULT * (pc.center.radlon - t.centerLon)), centerP, t); // get point dividing the seg closestP = MoreMath.closestPointOnLine(xPoints[i], yPoints[i], xPoints[i + 1], yPoints[i + 1], centerP.x, centerP.y); // remember original next point originalX = xPoints[i + 1]; originalY = yPoints[i + 1]; // replace next point with closest point xPoints[i + 1] = closestP.x; yPoints[i + 1] = closestP.y; // remember width for drawing the closest point wClosest = wDraw; // get direction we go on the way ConnectionWithNode c = (ConnectionWithNode) route.elementAt(hl[i]); dividedHighlight = (c.wayFromConAt > c.wayToConAt); if (isCircleway() && isOneway() && dividedHighlight) { dividedHighlight = false; } // fix dstToRoutePath on way part of divided final route seg for off route display if ( (dividedFinalDone || dividedFinalRouteSeg) &&closestP.equals(closestDestP) ) { pc.squareDstToRoutePath = MoreMath.ptSegDistSq( closestDestP.x, closestDestP.y, closestDestP.x, closestDestP.y, centerP.x, centerP.y ); } } else { dividedSeg = false; } // if (hl[i] >= 0) { // pc.g.setColor(0xffff80); // pc.g.drawString("i:" + i, xPoints[i], yPoints[i],Graphics.TOP | Graphics.LEFT); // } // Get the four outer points of the wDraw-wide waysegment if (ortho){ getParLines(xPoints, yPoints, i , wDraw, l1b, l2b, l1e, l2e); } else { pc.getP().getParLines(xPoints, yPoints, i , wDraw, l1b, l2b, l1e, l2e); } if (hl[i] != PATHSEG_DO_NOT_DRAW) { // if (mode == DRAW_AREA) { setColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); int xbcentre = (l2b.x + l1b.x) / 2; int xecentre = (l2e.x + l1e.x) / 2; int ybcentre = (l2b.y + l1b.y) / 2; int yecentre = (l2e.y + l1e.y) / 2; int xbdiameter = Math.abs(l2b.x - l1b.x); int xediameter = Math.abs(l2e.x - l1e.x); int ybdiameter = Math.abs(l2b.y - l1b.y); int yediameter = Math.abs(l2e.y - l1e.y); // FIXME we would need rotated ellipsis for clean rounded endings, // but lacking that we can apply some heuristics if (xbdiameter/3 > ybdiameter) { ybdiameter = xbdiameter/3; } if (ybdiameter/3 > xbdiameter) { xbdiameter = ybdiameter/3; } if (xediameter/3 > yediameter) { yediameter = xediameter/3; } if (yediameter/3 > xediameter) { xediameter = yediameter/3; } // when this is not render as lines (for the non-highlighted part of the way) or it is a highlighted part, draw as area if (wOriginal != 0 || hl[i] >= 0) { //#if polish.api.areaoutlines // FIXME would be more efficient to construct a line // from all the triangles (for filling turn corners and // round road ends) // Path aPath = new Path(); pc.g.getPaint().setStyle(Style.FILL); aPath.moveTo(l2b.x + pc.g.getTranslateX(), l2b.y + pc.g.getTranslateY()); aPath.lineTo(l1b.x + pc.g.getTranslateX(), l1b.y + pc.g.getTranslateY()); aPath.lineTo(l1e.x + pc.g.getTranslateX(), l1e.y + pc.g.getTranslateY()); aPath.lineTo(l2e.x + pc.g.getTranslateX(), l2e.y + pc.g.getTranslateY()); aPath.close(); pc.g.getCanvas().drawPath(aPath, pc.g.getPaint()); pc.g.getPaint().setStyle(Style.STROKE); //#else pc.g.fillTriangle(l2b.x, l2b.y, l1b.x, l1b.y, l1e.x, l1e.y); pc.g.fillTriangle(l1e.x, l1e.y, l2e.x, l2e.y, l2b.x, l2b.y); //#endif if (i == 0) { // if this is the first segment, draw the lines // draw circular endings if (Configuration.getCfgBitState(Configuration.CFGBIT_ROUND_WAY_ENDS) && wDraw > 2) { if (ortho) { circleWayEnd(pc, xbcentre, ybcentre, wDraw); circleWayEnd(pc, xecentre, yecentre, wDraw); } else { // ellipse is close, but rotation is missing // FIXME fix the bad appearance for eagle projection pc.g.fillArc(xbcentre - xbdiameter/2, ybcentre - ybdiameter/2, xbdiameter, ybdiameter, 0, 360); pc.g.fillArc(xecentre - xediameter/2, yecentre - yediameter/2, xediameter, yediameter, 0, 360); } } setBorderColor(pc, wayDesc,(hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); if (! Configuration.getCfgBitState(Configuration.CFGBIT_NOSTREETBORDERS) || isCurrentRoutePath(pc, i)) { pc.g.drawLine(l2b.x, l2b.y, l2e.x, l2e.y); pc.g.drawLine(l1b.x, l1b.y, l1e.x, l1e.y); } } // Now look at the turns(corners) of the waysegment and fill them if necessary. // We always look back to the turn between current and previous waysegment. if (i > 0) { // as we look back, there is no turn at the first segment turn = getVectorTurn(xPoints[i - 1], yPoints[i - 1], xPoints[i], yPoints[i], xPoints[i + 1], yPoints[i + 1] ); if (turn < 0 ) { // turn right intersectionPoint(l4b, l4e, l2b, l2e, intersecP, 1); setColor(pc, wayDesc,(hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); // Fills the gap of the corner with a small triangle pc.g.fillTriangle(xPoints[i], yPoints[i] , l3e.x, l3e.y, l1b.x,l1b.y); if (Configuration.getCfgBitState(Configuration.CFGBIT_ROUND_WAY_ENDS) && wDraw > 2) { if (ortho) { circleWayEnd(pc, xbcentre, ybcentre, wDraw); circleWayEnd(pc, xecentre, yecentre, wDraw ); } else { // ellipse is close, but rotation is missing // FIXME fix the bad appearance for eagle projection pc.g.fillArc(xbcentre - xbdiameter/2, ybcentre - ybdiameter/2, xbdiameter, ybdiameter, 0, 360); pc.g.fillArc(xecentre - xediameter/2, yecentre - yediameter/2, xediameter, yediameter, 0, 360); } } setBorderColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); if (! Configuration.getCfgBitState(Configuration.CFGBIT_NOSTREETBORDERS) || isCurrentRoutePath(pc, i)) { if (highlight == HIGHLIGHT_NONE) { //paint the inner turn border to the intersection point between old and current waysegment pc.g.drawLine(intersecP.x, intersecP.y, l2e.x, l2e.y); } else { //painting full border of the inner turn while routing pc.g.drawLine(l2b.x, l2b.y, l2e.x, l2e.y); } // paint the full outer turn border pc.g.drawLine(l1b.x, l1b.y, l1e.x, l1e.y); // paint the full outer turn border pc.g.drawLine(l1b.x, l1b.y, l3e.x, l3e.y); } } else if (turn > 0 ) { // turn left intersectionPoint(l3b,l3e,l1b,l1e,intersecP,1); setColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); // Fills the gap of the corner with a small triangle pc.g.fillTriangle(xPoints[i], yPoints[i] , l4e.x, l4e.y, l2b.x,l2b.y); if (Configuration.getCfgBitState(Configuration.CFGBIT_ROUND_WAY_ENDS) && wDraw > 2) { if (ortho) { circleWayEnd(pc, xbcentre, ybcentre, wDraw); circleWayEnd(pc, xecentre, yecentre, wDraw); } else { // ellipse is close, but rotation is missing // FIXME fix the bad appearance for eagle projection pc.g.fillArc(xbcentre - xbdiameter/2, ybcentre - ybdiameter/2, xbdiameter, ybdiameter, 0, 360); pc.g.fillArc(xecentre - xediameter/2, yecentre - yediameter/2, xediameter, yediameter, 0, 360); } } setBorderColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); if (! Configuration.getCfgBitState(Configuration.CFGBIT_NOSTREETBORDERS) || isCurrentRoutePath(pc, i)) { if (highlight == HIGHLIGHT_NONE) { //see comments above pc.g.drawLine(intersecP.x, intersecP.y, l1e.x, l1e.y); } else { pc.g.drawLine(l1b.x, l1b.y, l1e.x, l1e.y); } pc.g.drawLine(l2b.x, l2b.y, l2e.x, l2e.y); //corner pc.g.drawLine(l2b.x, l2b.y, l4e.x, l4e.y); } } else { //no turn, way is straight setColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); if (Configuration.getCfgBitState(Configuration.CFGBIT_ROUND_WAY_ENDS) && wDraw > 2) { if (ortho) { circleWayEnd(pc, xbcentre, ybcentre, wDraw); circleWayEnd(pc, xecentre, yecentre, wDraw); } else { // ellipse is close, but rotation is missing // FIXME fix the bad appearance for eagle projection pc.g.fillArc(xbcentre - xbdiameter/2, ybcentre - ybdiameter/2, xbdiameter, ybdiameter, 0, 360); pc.g.fillArc(xecentre - xediameter/2, yecentre - yediameter/2, xediameter, yediameter, 0, 360); } } setBorderColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); if (! Configuration.getCfgBitState(Configuration.CFGBIT_NOSTREETBORDERS) || isCurrentRoutePath(pc, i)) { pc.g.drawLine(l2b.x, l2b.y, l2e.x, l2e.y); // paint the full outer turn border pc.g.drawLine(l1b.x, l1b.y, l1e.x, l1e.y); } } } } else { // Draw streets as lines (only 1px wide) setColor(pc,wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); pc.g.drawLine(xPoints[i], yPoints[i], xPoints[i + 1], yPoints[i + 1]); } if (isBridge()) { waySegment.drawBridge(pc, xPoints, yPoints, i, count - 1, w, l1b, l1e, l2b, l2e); } if (isTunnel()) { waySegment.drawTunnel(pc, xPoints, yPoints, i, count - 1, w, l1b, l1e, l2b, l2e); } if (isTollRoad()) { waySegment.drawTollRoad(pc, xPoints, yPoints, i, count - 1, w, l1b, l1e, l2b, l2e); } if (isDamaged()) { waySegment.drawDamage(pc, xPoints, yPoints, i, count - 1, w, l1b, l1e, l2b, l2e); } } //Save the way-corners for the next loop to fill segment-gaps l3b.set(l1b); l4b.set(l2b); l3e.set(l1e); l4e.set(l2e); if (dividedSeg || dividedFinalRouteSeg) { // if this is a divided seg, in the next step draw the second part i--; } } if (isOneway()) { // Loop through all waysegments for painting the OnewayArrows as overlay // TODO: Maybe, we can integrate this one day in the main loop. Currently, we have troubles // with "not completely fitting arrows" getting overpainted by the next waysegment. paintPathOnewayArrows(count, wayDesc, pc); } //now as we painted all ways, do the things we should only do once if (wClosest != 0) { // if we got a closest seg, draw closest point to the center in it RouteInstructions.drawRouteDot(pc.g, closestP, wClosest); } if (nameAsForArea()) { paintAreaName(pc,t); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "draw"
"private void draw(PaintContext pc, SingleTile t, int w, int xPoints[], int yPoints[], int hl[], int count, byte highlight,boolean ortho /*, byte mode*/) { IntPoint closestP = new IntPoint(); int wClosest = 0; boolean dividedSeg = false; boolean dividedHighlight = true; IntPoint closestDestP = new IntPoint(); boolean dividedFinalRouteSeg = false; boolean dividedFinalDone = false; int originalFinalRouteSegX = 0; int originalFinalRouteSegY = 0; int pathIndexOfNewSeg = 0; boolean routeIsForwardOnWay = false; int originalX = 0; int originalY = 0; int wOriginal = w; if (w <1) { w=1; } int <MASK>wDraw = w;</MASK> int turn = 0; //#if polish.api.bigstyles WayDescription wayDesc = Legend.getWayDescription(type); //#else WayDescription wayDesc = Legend.getWayDescription((short) (type & 0xff)); //#endif Vector route = pc.trace.getRoute(); for (int i = 0; i < count; i++) { <MASK>wDraw = w;</MASK> // draw route line wider if ( highlight == HIGHLIGHT_ROUTEPATH_CONTAINED && hl[i] >= 0 && wDraw < Configuration.getMinRouteLineWidth() ) { wDraw = Configuration.getMinRouteLineWidth(); } if (dividedSeg) { // if this is a divided seg, draw second part of it xPoints[i] = xPoints[i + 1]; yPoints[i] = yPoints[i + 1]; xPoints[i + 1] = originalX; yPoints[i + 1] = originalY; dividedHighlight = !dividedHighlight; } else { // if not turn off the highlight dividedHighlight = false; if (dividedFinalRouteSeg) { //System.out.println ("restore i " + i); xPoints[i] = xPoints[i + 1]; yPoints[i] = yPoints[i + 1]; xPoints[i + 1] = originalFinalRouteSegX; yPoints[i + 1] = originalFinalRouteSegY; if (routeIsForwardOnWay) { hl[i] = PATHSEG_DO_NOT_HIGHLIGHT; } else { hl[i] = route.size() - 2; <MASK>wDraw = w;</MASK> if (wDraw < Configuration.getMinRouteLineWidth()) { wDraw = Configuration.getMinRouteLineWidth(); } } dividedFinalRouteSeg = false; dividedFinalDone = true; } } // divide final segment on the route if ( //false && highlight == HIGHLIGHT_ROUTEPATH_CONTAINED && route != null && hl[i] == route.size() - 2 ) { // get direction we go on the way ConnectionWithNode c = (ConnectionWithNode) route.elementAt(hl[i]); routeIsForwardOnWay = (c.wayFromConAt < c.wayToConAt); pathIndexOfNewSeg = (routeIsForwardOnWay ? c.wayToConAt - 1 : c.wayToConAt); //System.out.println ("waytoconat: " + c.wayToConAt + " wayfromconat: " + c.wayFromConAt + " i: " + i); if ( i == pathIndexOfNewSeg && !dividedFinalDone && !dividedFinalRouteSeg ) { pc.getP().forward(RouteInstructions.getClosestPointOnDestWay(), closestDestP); originalFinalRouteSegX = xPoints[i + 1]; originalFinalRouteSegY = yPoints[i + 1]; xPoints[i + 1] = closestDestP.x; yPoints[i + 1] = closestDestP.y; if (routeIsForwardOnWay) { ; } else { hl[i] = PATHSEG_DO_NOT_HIGHLIGHT; <MASK>wDraw = w;</MASK> } //pc.g.setColor(0x00ff00); //pc.g.drawString("closest:" + i, closestDestP.x, closestDestP.y, Graphics.TOP | Graphics.LEFT); //System.out.println("Insert closest point at " + (i + 1) ); dividedFinalRouteSeg = true; } } else { dividedFinalRouteSeg = false; } if (hl[i] >= 0 // if this is the closest segment of the closest connection && RouteInstructions.routePathConnection == hl[i] && i == RouteInstructions.pathIdxInRoutePathConnection - 1 && !dividedSeg ) { IntPoint centerP = new IntPoint(); // this is a divided seg (partly prior route line, partly current route line) dividedSeg = true; centerP=pc.getP().getImageCenter(); /** centerP is now provided by Projection implementation */ // pc.getP().forward( // (short)(MoreMath.FIXPT_MULT * (pc.center.radlat - t.centerLat)), // (short)(MoreMath.FIXPT_MULT * (pc.center.radlon - t.centerLon)), centerP, t); // get point dividing the seg closestP = MoreMath.closestPointOnLine(xPoints[i], yPoints[i], xPoints[i + 1], yPoints[i + 1], centerP.x, centerP.y); // remember original next point originalX = xPoints[i + 1]; originalY = yPoints[i + 1]; // replace next point with closest point xPoints[i + 1] = closestP.x; yPoints[i + 1] = closestP.y; // remember width for drawing the closest point wClosest = wDraw; // get direction we go on the way ConnectionWithNode c = (ConnectionWithNode) route.elementAt(hl[i]); dividedHighlight = (c.wayFromConAt > c.wayToConAt); if (isCircleway() && isOneway() && dividedHighlight) { dividedHighlight = false; } // fix dstToRoutePath on way part of divided final route seg for off route display if ( (dividedFinalDone || dividedFinalRouteSeg) &&closestP.equals(closestDestP) ) { pc.squareDstToRoutePath = MoreMath.ptSegDistSq( closestDestP.x, closestDestP.y, closestDestP.x, closestDestP.y, centerP.x, centerP.y ); } } else { dividedSeg = false; } // if (hl[i] >= 0) { // pc.g.setColor(0xffff80); // pc.g.drawString("i:" + i, xPoints[i], yPoints[i],Graphics.TOP | Graphics.LEFT); // } // Get the four outer points of the wDraw-wide waysegment if (ortho){ getParLines(xPoints, yPoints, i , wDraw, l1b, l2b, l1e, l2e); } else { pc.getP().getParLines(xPoints, yPoints, i , wDraw, l1b, l2b, l1e, l2e); } if (hl[i] != PATHSEG_DO_NOT_DRAW) { // if (mode == DRAW_AREA) { setColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); int xbcentre = (l2b.x + l1b.x) / 2; int xecentre = (l2e.x + l1e.x) / 2; int ybcentre = (l2b.y + l1b.y) / 2; int yecentre = (l2e.y + l1e.y) / 2; int xbdiameter = Math.abs(l2b.x - l1b.x); int xediameter = Math.abs(l2e.x - l1e.x); int ybdiameter = Math.abs(l2b.y - l1b.y); int yediameter = Math.abs(l2e.y - l1e.y); // FIXME we would need rotated ellipsis for clean rounded endings, // but lacking that we can apply some heuristics if (xbdiameter/3 > ybdiameter) { ybdiameter = xbdiameter/3; } if (ybdiameter/3 > xbdiameter) { xbdiameter = ybdiameter/3; } if (xediameter/3 > yediameter) { yediameter = xediameter/3; } if (yediameter/3 > xediameter) { xediameter = yediameter/3; } // when this is not render as lines (for the non-highlighted part of the way) or it is a highlighted part, draw as area if (wOriginal != 0 || hl[i] >= 0) { //#if polish.api.areaoutlines // FIXME would be more efficient to construct a line // from all the triangles (for filling turn corners and // round road ends) // Path aPath = new Path(); pc.g.getPaint().setStyle(Style.FILL); aPath.moveTo(l2b.x + pc.g.getTranslateX(), l2b.y + pc.g.getTranslateY()); aPath.lineTo(l1b.x + pc.g.getTranslateX(), l1b.y + pc.g.getTranslateY()); aPath.lineTo(l1e.x + pc.g.getTranslateX(), l1e.y + pc.g.getTranslateY()); aPath.lineTo(l2e.x + pc.g.getTranslateX(), l2e.y + pc.g.getTranslateY()); aPath.close(); pc.g.getCanvas().drawPath(aPath, pc.g.getPaint()); pc.g.getPaint().setStyle(Style.STROKE); //#else pc.g.fillTriangle(l2b.x, l2b.y, l1b.x, l1b.y, l1e.x, l1e.y); pc.g.fillTriangle(l1e.x, l1e.y, l2e.x, l2e.y, l2b.x, l2b.y); //#endif if (i == 0) { // if this is the first segment, draw the lines // draw circular endings if (Configuration.getCfgBitState(Configuration.CFGBIT_ROUND_WAY_ENDS) && wDraw > 2) { if (ortho) { circleWayEnd(pc, xbcentre, ybcentre, wDraw); circleWayEnd(pc, xecentre, yecentre, wDraw); } else { // ellipse is close, but rotation is missing // FIXME fix the bad appearance for eagle projection pc.g.fillArc(xbcentre - xbdiameter/2, ybcentre - ybdiameter/2, xbdiameter, ybdiameter, 0, 360); pc.g.fillArc(xecentre - xediameter/2, yecentre - yediameter/2, xediameter, yediameter, 0, 360); } } setBorderColor(pc, wayDesc,(hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); if (! Configuration.getCfgBitState(Configuration.CFGBIT_NOSTREETBORDERS) || isCurrentRoutePath(pc, i)) { pc.g.drawLine(l2b.x, l2b.y, l2e.x, l2e.y); pc.g.drawLine(l1b.x, l1b.y, l1e.x, l1e.y); } } // Now look at the turns(corners) of the waysegment and fill them if necessary. // We always look back to the turn between current and previous waysegment. if (i > 0) { // as we look back, there is no turn at the first segment turn = getVectorTurn(xPoints[i - 1], yPoints[i - 1], xPoints[i], yPoints[i], xPoints[i + 1], yPoints[i + 1] ); if (turn < 0 ) { // turn right intersectionPoint(l4b, l4e, l2b, l2e, intersecP, 1); setColor(pc, wayDesc,(hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); // Fills the gap of the corner with a small triangle pc.g.fillTriangle(xPoints[i], yPoints[i] , l3e.x, l3e.y, l1b.x,l1b.y); if (Configuration.getCfgBitState(Configuration.CFGBIT_ROUND_WAY_ENDS) && wDraw > 2) { if (ortho) { circleWayEnd(pc, xbcentre, ybcentre, wDraw); circleWayEnd(pc, xecentre, yecentre, wDraw ); } else { // ellipse is close, but rotation is missing // FIXME fix the bad appearance for eagle projection pc.g.fillArc(xbcentre - xbdiameter/2, ybcentre - ybdiameter/2, xbdiameter, ybdiameter, 0, 360); pc.g.fillArc(xecentre - xediameter/2, yecentre - yediameter/2, xediameter, yediameter, 0, 360); } } setBorderColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); if (! Configuration.getCfgBitState(Configuration.CFGBIT_NOSTREETBORDERS) || isCurrentRoutePath(pc, i)) { if (highlight == HIGHLIGHT_NONE) { //paint the inner turn border to the intersection point between old and current waysegment pc.g.drawLine(intersecP.x, intersecP.y, l2e.x, l2e.y); } else { //painting full border of the inner turn while routing pc.g.drawLine(l2b.x, l2b.y, l2e.x, l2e.y); } // paint the full outer turn border pc.g.drawLine(l1b.x, l1b.y, l1e.x, l1e.y); // paint the full outer turn border pc.g.drawLine(l1b.x, l1b.y, l3e.x, l3e.y); } } else if (turn > 0 ) { // turn left intersectionPoint(l3b,l3e,l1b,l1e,intersecP,1); setColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); // Fills the gap of the corner with a small triangle pc.g.fillTriangle(xPoints[i], yPoints[i] , l4e.x, l4e.y, l2b.x,l2b.y); if (Configuration.getCfgBitState(Configuration.CFGBIT_ROUND_WAY_ENDS) && wDraw > 2) { if (ortho) { circleWayEnd(pc, xbcentre, ybcentre, wDraw); circleWayEnd(pc, xecentre, yecentre, wDraw); } else { // ellipse is close, but rotation is missing // FIXME fix the bad appearance for eagle projection pc.g.fillArc(xbcentre - xbdiameter/2, ybcentre - ybdiameter/2, xbdiameter, ybdiameter, 0, 360); pc.g.fillArc(xecentre - xediameter/2, yecentre - yediameter/2, xediameter, yediameter, 0, 360); } } setBorderColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); if (! Configuration.getCfgBitState(Configuration.CFGBIT_NOSTREETBORDERS) || isCurrentRoutePath(pc, i)) { if (highlight == HIGHLIGHT_NONE) { //see comments above pc.g.drawLine(intersecP.x, intersecP.y, l1e.x, l1e.y); } else { pc.g.drawLine(l1b.x, l1b.y, l1e.x, l1e.y); } pc.g.drawLine(l2b.x, l2b.y, l2e.x, l2e.y); //corner pc.g.drawLine(l2b.x, l2b.y, l4e.x, l4e.y); } } else { //no turn, way is straight setColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); if (Configuration.getCfgBitState(Configuration.CFGBIT_ROUND_WAY_ENDS) && wDraw > 2) { if (ortho) { circleWayEnd(pc, xbcentre, ybcentre, wDraw); circleWayEnd(pc, xecentre, yecentre, wDraw); } else { // ellipse is close, but rotation is missing // FIXME fix the bad appearance for eagle projection pc.g.fillArc(xbcentre - xbdiameter/2, ybcentre - ybdiameter/2, xbdiameter, ybdiameter, 0, 360); pc.g.fillArc(xecentre - xediameter/2, yecentre - yediameter/2, xediameter, yediameter, 0, 360); } } setBorderColor(pc, wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); if (! Configuration.getCfgBitState(Configuration.CFGBIT_NOSTREETBORDERS) || isCurrentRoutePath(pc, i)) { pc.g.drawLine(l2b.x, l2b.y, l2e.x, l2e.y); // paint the full outer turn border pc.g.drawLine(l1b.x, l1b.y, l1e.x, l1e.y); } } } } else { // Draw streets as lines (only 1px wide) setColor(pc,wayDesc, (hl[i] >= 0), (isCurrentRoutePath(pc, i) || dividedHighlight), (highlight == HIGHLIGHT_DEST)); pc.g.drawLine(xPoints[i], yPoints[i], xPoints[i + 1], yPoints[i + 1]); } if (isBridge()) { waySegment.drawBridge(pc, xPoints, yPoints, i, count - 1, w, l1b, l1e, l2b, l2e); } if (isTunnel()) { waySegment.drawTunnel(pc, xPoints, yPoints, i, count - 1, w, l1b, l1e, l2b, l2e); } if (isTollRoad()) { waySegment.drawTollRoad(pc, xPoints, yPoints, i, count - 1, w, l1b, l1e, l2b, l2e); } if (isDamaged()) { waySegment.drawDamage(pc, xPoints, yPoints, i, count - 1, w, l1b, l1e, l2b, l2e); } } //Save the way-corners for the next loop to fill segment-gaps l3b.set(l1b); l4b.set(l2b); l3e.set(l1e); l4e.set(l2e); if (dividedSeg || dividedFinalRouteSeg) { // if this is a divided seg, in the next step draw the second part i--; } } if (isOneway()) { // Loop through all waysegments for painting the OnewayArrows as overlay // TODO: Maybe, we can integrate this one day in the main loop. Currently, we have troubles // with "not completely fitting arrows" getting overpainted by the next waysegment. paintPathOnewayArrows(count, wayDesc, pc); } //now as we painted all ways, do the things we should only do once if (wClosest != 0) { // if we got a closest seg, draw closest point to the center in it RouteInstructions.drawRouteDot(pc.g, closestP, wClosest); } if (nameAsForArea()) { paintAreaName(pc,t); } }"
Inversion-Mutation
megadiff
"protected List<JCStatement> transformIntermediate(Condition condition, java.util.List<Condition> rest) { Cond transformedCond = statementGen().transformCondition(condition, null); JCExpression test = transformedCond.makeTest(); SyntheticName resultVarName = addVarSubs(transformedCond); return transformCommon(transformedCond, test, transformList(rest), resultVarName); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "transformIntermediate"
"protected List<JCStatement> transformIntermediate(Condition condition, java.util.List<Condition> rest) { Cond transformedCond = statementGen().transformCondition(condition, null); <MASK>SyntheticName resultVarName = addVarSubs(transformedCond);</MASK> JCExpression test = transformedCond.makeTest(); return transformCommon(transformedCond, test, transformList(rest), resultVarName); }"
Inversion-Mutation
megadiff
"@Transactional @RequestMapping(value="/save", method=RequestMethod.POST) public ModelAndView save(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException { request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); ModelAndView modelAndView = new ModelAndView("savedResource"); commonModelObjectsService.populateCommonLocal(modelAndView); modelAndView.addObject("heading", "Resource Saved"); User loggedInUser = loggedInUserFilter.getLoggedInUser(); Resource editResource = null; adminRequestFilter.loadAttributesOntoRequest(request); if (request.getAttribute("resource") != null) { editResource = (Resource) request.getAttribute("resource"); } else { log.info("Creating new resource."); if (request.getParameter("type") != null) { String type = request.getParameter("type"); if (type.equals("W")) { editResource = resourceFactory.createNewWebsite(); } else if (type.equals("N")) { editResource = resourceFactory.createNewNewsitem(); } else if (type.equals("F")) { editResource = resourceFactory.createNewFeed(); } else if (type.equals("L")) { editResource = resourceFactory.createNewWatchlist(); } else if (type.equals("C")) { editResource = resourceFactory.createNewCalendarFeed(""); } else { // TODO this should be a caught error. editResource = resourceFactory.createNewWebsite(); } } } log.info("In save"); if (editResource != null) { boolean newSubmission = editResource.getId() == 0; if (loggedInUser == null) { loggedInUser = createAndSetAnonUser(request); } if (newSubmission) { // TODO is wrong place - needs to be shared with the api. editResource.setOwner(loggedInUser); } submissionProcessingService.processUrl(request, editResource); submissionProcessingService.processTitle(request, editResource); editResource.setGeocode(submissionProcessingService.processGeocode(request)); submissionProcessingService.processDate(request, editResource); submissionProcessingService.processHeld(request, editResource); submissionProcessingService.processEmbargoDate(request, editResource); submissionProcessingService.processDescription(request, editResource); submissionProcessingService.processPublisher(request, editResource); if (editResource.getType().equals("N")) { submissionProcessingService.processImage(request, (Newsitem) editResource, loggedInUser); submissionProcessingService.processAcceptance(request, editResource, loggedInUser); } // Update urlwords. if (editResource.getType().equals("W") || editResource.getType().equals("F")) { editResource.setUrlWords(urlWordsGenerator.makeUrlWordsFromName(editResource.getName())); } processFeedAcceptancePolicy(request, editResource); SpamFilter spamFilter = new SpamFilter(); boolean isSpamUrl = spamFilter.isSpam(editResource); boolean isPublicSubmission = loggedInUser == null || (loggedInUser.isUnlinkedAccount()); if (isPublicSubmission) { log.info("This is a public submission; marking as held"); editResource.setHeld(true); } boolean okToSave = !newSubmission || !isSpamUrl || loggedInUser != null; // TODO validate. - what exactly? if (okToSave) { // TODO could be a collection? saveResource(request, loggedInUser, editResource); log.info("Saved resource; id is now: " + editResource.getId()); submissionProcessingService.processTags(request, editResource, loggedInUser); if (newSubmission) { log.info("Applying the auto tagger to new submission."); autoTagger.autotag(editResource); } } else { log.info("Could not save resource. Spam question not answered?"); } modelAndView.addObject("item", editResource); } else { log.warn("No edit resource could be setup."); } return modelAndView; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "save"
"@Transactional @RequestMapping(value="/save", method=RequestMethod.POST) public ModelAndView save(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException { request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); ModelAndView modelAndView = new ModelAndView("savedResource"); commonModelObjectsService.populateCommonLocal(modelAndView); modelAndView.addObject("heading", "Resource Saved"); User loggedInUser = loggedInUserFilter.getLoggedInUser(); Resource editResource = null; adminRequestFilter.loadAttributesOntoRequest(request); if (request.getAttribute("resource") != null) { editResource = (Resource) request.getAttribute("resource"); } else { log.info("Creating new resource."); if (request.getParameter("type") != null) { String type = request.getParameter("type"); if (type.equals("W")) { editResource = resourceFactory.createNewWebsite(); } else if (type.equals("N")) { editResource = resourceFactory.createNewNewsitem(); } else if (type.equals("F")) { editResource = resourceFactory.createNewFeed(); } else if (type.equals("L")) { editResource = resourceFactory.createNewWatchlist(); } else if (type.equals("C")) { editResource = resourceFactory.createNewCalendarFeed(""); } else { // TODO this should be a caught error. editResource = resourceFactory.createNewWebsite(); } } } log.info("In save"); if (editResource != null) { boolean newSubmission = editResource.getId() == 0; if (loggedInUser == null) { loggedInUser = createAndSetAnonUser(request); } if (newSubmission) { // TODO is wrong place - needs to be shared with the api. editResource.setOwner(loggedInUser); } submissionProcessingService.processUrl(request, editResource); submissionProcessingService.processTitle(request, editResource); editResource.setGeocode(submissionProcessingService.processGeocode(request)); submissionProcessingService.processDate(request, editResource); submissionProcessingService.processHeld(request, editResource); submissionProcessingService.processEmbargoDate(request, editResource); submissionProcessingService.processDescription(request, editResource); submissionProcessingService.processPublisher(request, editResource); if (editResource.getType().equals("N")) { submissionProcessingService.processImage(request, (Newsitem) editResource, loggedInUser); submissionProcessingService.processAcceptance(request, editResource, loggedInUser); } <MASK>processFeedAcceptancePolicy(request, editResource);</MASK> // Update urlwords. if (editResource.getType().equals("W") || editResource.getType().equals("F")) { editResource.setUrlWords(urlWordsGenerator.makeUrlWordsFromName(editResource.getName())); } SpamFilter spamFilter = new SpamFilter(); boolean isSpamUrl = spamFilter.isSpam(editResource); boolean isPublicSubmission = loggedInUser == null || (loggedInUser.isUnlinkedAccount()); if (isPublicSubmission) { log.info("This is a public submission; marking as held"); editResource.setHeld(true); } boolean okToSave = !newSubmission || !isSpamUrl || loggedInUser != null; // TODO validate. - what exactly? if (okToSave) { // TODO could be a collection? saveResource(request, loggedInUser, editResource); log.info("Saved resource; id is now: " + editResource.getId()); submissionProcessingService.processTags(request, editResource, loggedInUser); if (newSubmission) { log.info("Applying the auto tagger to new submission."); autoTagger.autotag(editResource); } } else { log.info("Could not save resource. Spam question not answered?"); } modelAndView.addObject("item", editResource); } else { log.warn("No edit resource could be setup."); } return modelAndView; }"
Inversion-Mutation
megadiff
"public synchronized void run() { if (isClose.get()) { return; } if (this.nettyResponseFuture != null && this.nettyResponseFuture.hasExpired()) { log.debug("Request Timeout expired for {}\n", this.nettyResponseFuture); int requestTimeout = config.getRequestTimeoutInMs(); PerRequestConfig p = this.nettyResponseFuture.getRequest().getPerRequestConfig(); if (p != null && p.getRequestTimeoutInMs() != -1) { requestTimeout = p.getRequestTimeoutInMs(); } markChannelNotReadable(channel.getPipeline().getContext(NettyAsyncHttpProvider.class)); abort(this.nettyResponseFuture, new TimeoutException(String.format("No response received after %s", requestTimeout))); this.nettyResponseFuture = null; this.channel = null; } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "run"
"public synchronized void run() { if (isClose.get()) { return; } if (this.nettyResponseFuture != null && this.nettyResponseFuture.hasExpired()) { log.debug("Request Timeout expired for {}\n", this.nettyResponseFuture); int requestTimeout = config.getRequestTimeoutInMs(); PerRequestConfig p = this.nettyResponseFuture.getRequest().getPerRequestConfig(); if (p != null && p.getRequestTimeoutInMs() != -1) { requestTimeout = p.getRequestTimeoutInMs(); } <MASK>abort(this.nettyResponseFuture, new TimeoutException(String.format("No response received after %s", requestTimeout)));</MASK> markChannelNotReadable(channel.getPipeline().getContext(NettyAsyncHttpProvider.class)); this.nettyResponseFuture = null; this.channel = null; } }"
Inversion-Mutation
megadiff
"@Override protected IStatus run(IProgressMonitor monitor) { // Generate real-time job IStatus returnStatus = Status.CANCEL_STATUS; this.monitor = monitor; if (this.monitor == null) { this.monitor = new NullProgressMonitor(); } if (realTime && (job == null || job.getResult()==null)) { job = new RunTimeJob("RealTimeParser"); //$NON-NLS-1$ job.schedule(); } else { returnStatus = nonRealTimeParsing(); } makeView(); if (!returnStatus.isOK()){ return returnStatus; } setData(this); return returnStatus; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "run"
"@Override protected IStatus run(IProgressMonitor monitor) { // Generate real-time job IStatus returnStatus = Status.CANCEL_STATUS; this.monitor = monitor; if (this.monitor == null) { this.monitor = new NullProgressMonitor(); } <MASK>makeView();</MASK> if (realTime && (job == null || job.getResult()==null)) { job = new RunTimeJob("RealTimeParser"); //$NON-NLS-1$ job.schedule(); } else { returnStatus = nonRealTimeParsing(); } if (!returnStatus.isOK()){ return returnStatus; } setData(this); return returnStatus; }"
Inversion-Mutation
megadiff
"protected <T, C extends SshAction<T>> T acquire(C connection) { for (int i = 0; i < sshTries; i++) { try { connection.clear(); if (LOG.isDebugEnabled()) LOG.debug(">> ({}) acquiring {}", toString(), connection); T returnVal = connection.create(); if (LOG.isTraceEnabled()) LOG.trace("<< ({}) acquired {}", toString(), returnVal); return returnVal; } catch (Exception from) { String errorMessage = String.format("(%s) error acquiring %s", toString(), connection); try { disconnect(); } catch (Exception e1) { LOG.warn("<< ("+toString()+") error closing connection", from); } if (i + 1 == sshTries) { throw propagate(from, errorMessage + " (out of retries - max " + sshTries + ")"); } else { LOG.info("<< " + errorMessage + " (attempt " + (i + 1) + " of " + sshTries + "): " + from.getMessage()); backoffForAttempt(i + 1, errorMessage + ": " + from.getMessage()); if (connection != sshClientConnection) connect(); continue; } } } assert false : "should not reach here"; return null; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "acquire"
"protected <T, C extends SshAction<T>> T acquire(C connection) { <MASK>String errorMessage = String.format("(%s) error acquiring %s", toString(), connection);</MASK> for (int i = 0; i < sshTries; i++) { try { connection.clear(); if (LOG.isDebugEnabled()) LOG.debug(">> ({}) acquiring {}", toString(), connection); T returnVal = connection.create(); if (LOG.isTraceEnabled()) LOG.trace("<< ({}) acquired {}", toString(), returnVal); return returnVal; } catch (Exception from) { try { disconnect(); } catch (Exception e1) { LOG.warn("<< ("+toString()+") error closing connection", from); } if (i + 1 == sshTries) { throw propagate(from, errorMessage + " (out of retries - max " + sshTries + ")"); } else { LOG.info("<< " + errorMessage + " (attempt " + (i + 1) + " of " + sshTries + "): " + from.getMessage()); backoffForAttempt(i + 1, errorMessage + ": " + from.getMessage()); if (connection != sshClientConnection) connect(); continue; } } } assert false : "should not reach here"; return null; }"
Inversion-Mutation
megadiff
"@Override public void messageReceived( ChannelHandlerContext ctx , DefaultFullHttpRequest request) { System.out.println("[Daemon] Connection started"); String body = request.data().toString(CharsetUtil.UTF_8); try { HashMap<String, String> args = parseBody(body); // TODO add session tokens // TODO add specifier of C++ vs Python String userId = args.get("usrid"); String debuggerId = args.get("dbgid"); String wrapperKey = userId + "_" + debuggerId; String commandString = args.get("call"); DebuggerCommand command = DebuggerCommand.fromString(commandString); String data = args.get("data"); if (data == null) { data = ""; } DebuggerRequest debuggerRequest = new DebuggerRequest(command, data); // TODO determine the cases when we want to create a new one Wrapper wrapper = wrapperMap.get(wrapperKey); // FIXME synchronize on the session key if (wrapper == null) { // TODO switch off of language here wrapper = new GdbWrapper(Integer.parseInt(userId), Integer.parseInt(debuggerId)); wrapper.start(); wrapperMap.put(wrapperKey, wrapper); // FIXME data race here } System.out.println("[daemon] Submitting a request..."); if (debuggerRequest.command == DebuggerCommand.GIVEINPUT) { wrapper.provideInput(debuggerRequest.data); debuggerRequest.result = ""; } else { System.out.println("[daemon] Waiting on the monitor..."); synchronized (debuggerRequest.monitor) { wrapper.submitRequest(debuggerRequest); debuggerRequest.monitor.wait(); } System.out.println("[daemon] Woke up!"); } System.out.println("[daemon] Got result: " + debuggerRequest.result); FullHttpResponse response = new DefaultFullHttpResponse( HTTP_1_1, OK, Unpooled.copiedBuffer(debuggerRequest.result , CharsetUtil.UTF_8)); response.headers().set(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); response.headers().set(CONTENT_LENGTH, debuggerRequest.result.length()); response.headers().set(CONTENT_TYPE, "text/plain; charset=UTF-8"); ctx.nextOutboundMessageBuffer().add(response); ctx.flush().addListener(ChannelFutureListener.CLOSE); } catch(Exception e) { System.out.println("[daemon] Got an exception. Printing the stack trace:"); e.printStackTrace(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "messageReceived"
"@Override public void messageReceived( ChannelHandlerContext ctx , DefaultFullHttpRequest request) { System.out.println("[Daemon] Connection started"); String body = request.data().toString(CharsetUtil.UTF_8); try { HashMap<String, String> args = parseBody(body); // TODO add session tokens // TODO add specifier of C++ vs Python String userId = args.get("usrid"); String debuggerId = args.get("dbgid"); String wrapperKey = userId + "_" + debuggerId; String commandString = args.get("call"); DebuggerCommand command = DebuggerCommand.fromString(commandString); String data = args.get("data"); if (data == null) { data = ""; } DebuggerRequest debuggerRequest = new DebuggerRequest(command, data); // TODO determine the cases when we want to create a new one Wrapper wrapper = wrapperMap.get(wrapperKey); // FIXME synchronize on the session key if (wrapper == null) { // TODO switch off of language here wrapper = new GdbWrapper(Integer.parseInt(userId), Integer.parseInt(debuggerId)); wrapper.start(); wrapperMap.put(wrapperKey, wrapper); // FIXME data race here } System.out.println("[daemon] Submitting a request..."); if (debuggerRequest.command == DebuggerCommand.GIVEINPUT) { wrapper.provideInput(debuggerRequest.data); debuggerRequest.result = ""; } else { <MASK>wrapper.submitRequest(debuggerRequest);</MASK> System.out.println("[daemon] Waiting on the monitor..."); synchronized (debuggerRequest.monitor) { debuggerRequest.monitor.wait(); } System.out.println("[daemon] Woke up!"); } System.out.println("[daemon] Got result: " + debuggerRequest.result); FullHttpResponse response = new DefaultFullHttpResponse( HTTP_1_1, OK, Unpooled.copiedBuffer(debuggerRequest.result , CharsetUtil.UTF_8)); response.headers().set(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); response.headers().set(CONTENT_LENGTH, debuggerRequest.result.length()); response.headers().set(CONTENT_TYPE, "text/plain; charset=UTF-8"); ctx.nextOutboundMessageBuffer().add(response); ctx.flush().addListener(ChannelFutureListener.CLOSE); } catch(Exception e) { System.out.println("[daemon] Got an exception. Printing the stack trace:"); e.printStackTrace(); } }"
Inversion-Mutation
megadiff
"private String replaceVariables(final String formula, final CidsBean kaBean) { String breadth = (String)kaBean.getProperty("gewaesserbreite_id.name"); final Double bedBreadth = (Double)kaBean.getProperty("sohlenbreite"); final Integer wbType = (Integer)kaBean.getProperty("gewaessertyp_id.value"); final Double sohlsubstrKuenst = (Double)kaBean.getProperty("sohlensubstrat_kue"); if (breadth != null) { breadth = "\"" + breadth + "\""; } String newFormula = formula.replaceAll("LAENGE", String.valueOf(getKaLength(kaBean))); newFormula = newFormula.replaceAll("SOHLBREITE", String.valueOf(bedBreadth)); newFormula = newFormula.replaceAll("BREITE", String.valueOf(breadth)); newFormula = newFormula.replaceAll("TYP", String.valueOf(wbType)); newFormula = newFormula.replaceAll("SUBSTRAT", String.valueOf(sohlsubstrKuenst)); return newFormula; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "replaceVariables"
"private String replaceVariables(final String formula, final CidsBean kaBean) { String breadth = (String)kaBean.getProperty("gewaesserbreite_id.name"); final Double bedBreadth = (Double)kaBean.getProperty("sohlenbreite"); final Integer wbType = (Integer)kaBean.getProperty("gewaessertyp_id.value"); final Double sohlsubstrKuenst = (Double)kaBean.getProperty("sohlensubstrat_kue"); if (breadth != null) { breadth = "\"" + breadth + "\""; } String newFormula = formula.replaceAll("LAENGE", String.valueOf(getKaLength(kaBean))); newFormula = newFormula.replaceAll("BREITE", String.valueOf(breadth)); newFormula = newFormula.replaceAll("TYP", String.valueOf(wbType)); newFormula = newFormula.replaceAll("SUBSTRAT", String.valueOf(sohlsubstrKuenst)); <MASK>newFormula = newFormula.replaceAll("SOHLBREITE", String.valueOf(bedBreadth));</MASK> return newFormula; }"
Inversion-Mutation
megadiff
"PlayerListener(final JavaPlugin plugin) { org.bukkit.plugin.PluginManager pluginManager = plugin.getServer().getPluginManager(); pluginManager.registerEvent(Event.Type.PLAYER_LOGIN, this, Main.getEventPriority("PLAYER_LOGIN"), plugin); pluginManager.registerEvent(Event.Type.PLAYER_JOIN, this, Main.getEventPriority("PLAYER_JOIN"), plugin); pluginManager.registerEvent(Event.Type.PLAYER_CHAT, this, Main.getEventPriority("PLAYER_CHAT"), plugin); pluginManager.registerEvent(Event.Type.PLAYER_QUIT, this, Main.getEventPriority("PLAYER_QUIT"), plugin); pluginManager.registerEvent(Event.Type.PLAYER_KICK, this, Main.getEventPriority("PLAYER_KICK"), plugin); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "PlayerListener"
"PlayerListener(final JavaPlugin plugin) { org.bukkit.plugin.PluginManager pluginManager = plugin.getServer().getPluginManager(); pluginManager.registerEvent(Event.Type.PLAYER_JOIN, this, Main.getEventPriority("PLAYER_JOIN"), plugin); pluginManager.registerEvent(Event.Type.PLAYER_CHAT, this, Main.getEventPriority("PLAYER_CHAT"), plugin); pluginManager.registerEvent(Event.Type.PLAYER_QUIT, this, Main.getEventPriority("PLAYER_QUIT"), plugin); pluginManager.registerEvent(Event.Type.PLAYER_KICK, this, Main.getEventPriority("PLAYER_KICK"), plugin); <MASK>pluginManager.registerEvent(Event.Type.PLAYER_LOGIN, this, Main.getEventPriority("PLAYER_LOGIN"), plugin);</MASK> }"
Inversion-Mutation
megadiff
"public void sendQuestion(View v) { // get all necessary fields String category = ((Spinner) findViewById( R.id.category_spinner_question)).getSelectedItem().toString(); Category c = Category.valueOf(category); String solutionText = ((EditText) findViewById( R.id.edit_solution_q)).getText().toString(); String questionText = ((EditText) findViewById( R.id.edit_question)).getText().toString(); String titleText = ((EditText) findViewById( R.id.edit_question_title)).getText().toString(); // chack fields for correctness if (titleText.trim().equals("")){ displayMessage(0, getString(R.string.badInputDialog_title)); } else if (questionText.trim().equals("")){ displayMessage(0, getString(R.string.badInputDialog_question)); } else if (solutionText.trim().equals("")){ displayMessage(0, getString(R.string.badInputDialog_solution)); } else { // all fields are correct, try and send it! Question q = new Question(questionText, titleText, Category.COMPSCI, diff); QuestionService qs = QuestionService.getInstance(); Solution s = new Solution(q.getQuestionId(), solutionText); try { qs.postQuestion(q); qs.postSolution(s); displayMessage(1, getString(R.string.successDialog_title_q)); } catch (NetworkException e) { Log.w("Network error", e.getMessage()); displayMessage(-1, getString(R.string.retryDialog_title)); } catch (Exception e) { Log.e("Internal Error", e.getMessage()); displayMessage(-1, getString(R.string.internalError_title)); } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "sendQuestion"
"public void sendQuestion(View v) { // get all necessary fields String category = ((Spinner) findViewById( R.id.category_spinner_question)).getSelectedItem().toString(); Category c = Category.valueOf(category); String solutionText = ((EditText) findViewById( R.id.edit_solution_q)).getText().toString(); String questionText = ((EditText) findViewById( R.id.edit_question)).getText().toString(); String titleText = ((EditText) findViewById( R.id.edit_question_title)).getText().toString(); // chack fields for correctness if (titleText.trim().equals("")){ displayMessage(0, getString(R.string.badInputDialog_title)); } else if (questionText.trim().equals("")){ displayMessage(0, getString(R.string.badInputDialog_question)); } else if (solutionText.trim().equals("")){ displayMessage(0, getString(R.string.badInputDialog_solution)); } else { // all fields are correct, try and send it! Question q = new Question(questionText, titleText, Category.COMPSCI, diff); QuestionService qs = QuestionService.getInstance(); Solution s = new Solution(q.getQuestionId(), solutionText); try { qs.postQuestion(q); qs.postSolution(s); } catch (NetworkException e) { Log.w("Network error", e.getMessage()); displayMessage(-1, getString(R.string.retryDialog_title)); } catch (Exception e) { Log.e("Internal Error", e.getMessage()); displayMessage(-1, getString(R.string.internalError_title)); } <MASK>displayMessage(1, getString(R.string.successDialog_title_q));</MASK> } }"
Inversion-Mutation
megadiff
"private void collectStatsImpl(Connection c, long clientHandle, String selector) throws Exception { assert(selector.equals("WAN")); if (m_pendingRequests.size() > MAX_IN_FLIGHT_REQUESTS) { /* * Defensively check for an expired request not caught * by timeout check. Should never happen. */ Iterator<PendingStatsRequest> iter = m_pendingRequests.values().iterator(); final long now = System.currentTimeMillis(); boolean foundExpiredRequest = false; while (iter.hasNext()) { PendingStatsRequest psr = iter.next(); if (now - psr.startTime > STATS_COLLECTION_TIMEOUT * 2) { iter.remove(); foundExpiredRequest = true; } } if (!foundExpiredRequest) { final ClientResponseImpl errorResponse = new ClientResponseImpl(ClientResponse.GRACEFUL_FAILURE, new VoltTable[0], "Too many pending stat requests", clientHandle); c.writeStream().enqueue(errorResponse); return; } } PendingStatsRequest psr = new PendingStatsRequest( selector, c, clientHandle, VoltDB.instance().getCatalogContext().numberOfNodes, new VoltTable[2], System.currentTimeMillis()); final long requestId = m_nextRequestId++; m_pendingRequests.put(requestId, psr); m_es.schedule(new Runnable() { @Override public void run() { checkForRequestTimeout(requestId); } }, STATS_COLLECTION_TIMEOUT, TimeUnit.MILLISECONDS); JSONObject obj = new JSONObject(); obj.put("requestId", requestId); obj.put("returnAddress", m_mailbox.getSiteId()); obj.put("selector", "WANNODE"); byte payloadBytes[] = CompressionService.compressBytes(obj.toString(4).getBytes("UTF-8")); final SiteTracker st = VoltDB.instance().getCatalogContext().siteTracker; for (Integer host : st.getAllLiveHosts()) { BinaryPayloadMessage bpm = new BinaryPayloadMessage(new byte[] {JSON_PAYLOAD}, payloadBytes); m_mailbox.send( st.getFirstNonExecSiteForHost(host), VoltDB.STATS_MAILBOX_ID, bpm); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "collectStatsImpl"
"private void collectStatsImpl(Connection c, long clientHandle, String selector) throws Exception { assert(selector.equals("WAN")); if (m_pendingRequests.size() > MAX_IN_FLIGHT_REQUESTS) { /* * Defensively check for an expired request not caught * by timeout check. Should never happen. */ Iterator<PendingStatsRequest> iter = m_pendingRequests.values().iterator(); final long now = System.currentTimeMillis(); boolean foundExpiredRequest = false; while (iter.hasNext()) { PendingStatsRequest psr = iter.next(); if (now - psr.startTime > STATS_COLLECTION_TIMEOUT * 2) { iter.remove(); foundExpiredRequest = true; } } if (!foundExpiredRequest) { final ClientResponseImpl errorResponse = new ClientResponseImpl(ClientResponse.GRACEFUL_FAILURE, new VoltTable[0], "Too many pending stat requests", clientHandle); c.writeStream().enqueue(errorResponse); return; } } PendingStatsRequest psr = new PendingStatsRequest( selector, c, clientHandle, VoltDB.instance().getCatalogContext().numberOfNodes, new VoltTable[2], System.currentTimeMillis()); final long requestId = m_nextRequestId++; m_pendingRequests.put(requestId, psr); m_es.schedule(new Runnable() { @Override public void run() { checkForRequestTimeout(requestId); } }, STATS_COLLECTION_TIMEOUT, TimeUnit.MILLISECONDS); JSONObject obj = new JSONObject(); obj.put("requestId", requestId); obj.put("returnAddress", m_mailbox.getSiteId()); obj.put("selector", "WANNODE"); byte payloadBytes[] = CompressionService.compressBytes(obj.toString(4).getBytes("UTF-8")); <MASK>BinaryPayloadMessage bpm = new BinaryPayloadMessage(new byte[] {JSON_PAYLOAD}, payloadBytes);</MASK> final SiteTracker st = VoltDB.instance().getCatalogContext().siteTracker; for (Integer host : st.getAllLiveHosts()) { m_mailbox.send( st.getFirstNonExecSiteForHost(host), VoltDB.STATS_MAILBOX_ID, bpm); } }"
Inversion-Mutation
megadiff
"public static HashMap<String, String> createEncodings(ArrayList<Trackpoint> points, int level, int step) { StringBuffer encodedPoints = new StringBuffer(); StringBuffer encodedLevels = new StringBuffer(); int counter = 0; int listSize = points.size(); int plat = 0, plng = 0; int late5, lnge5, dlat, dlng; for (int i = 0; i < listSize; i += step) { counter++; late5 = Util.floor1e5(points.get(i).lat()); lnge5 = Util.floor1e5(points.get(i).lng()); dlat = late5 - plat; dlng = lnge5 - plng; encodedPoints.append(encodeSignedNumber(dlat)); encodedPoints.append(encodeSignedNumber(dlng)); encodedLevels.append(encodeNumber(level)); plat = late5; plng = lnge5; } System.out.println("listSize: " + listSize + " step: " + step + " counter: " + counter); HashMap<String, String> resultMap = new HashMap<String, String>(); resultMap.put("encodedPoints", encodedPoints.toString()); resultMap.put("encodedPointsLiteral", encodeDoubleBackslash(encodedPoints.toString())); resultMap.put("encodedLevels", encodedLevels.toString()); return resultMap; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "createEncodings"
"public static HashMap<String, String> createEncodings(ArrayList<Trackpoint> points, int level, int step) { StringBuffer encodedPoints = new StringBuffer(); StringBuffer encodedLevels = new StringBuffer(); <MASK>int plat = 0, plng = 0;</MASK> int counter = 0; int listSize = points.size(); int late5, lnge5, dlat, dlng; for (int i = 0; i < listSize; i += step) { counter++; late5 = Util.floor1e5(points.get(i).lat()); lnge5 = Util.floor1e5(points.get(i).lng()); dlat = late5 - plat; dlng = lnge5 - plng; encodedPoints.append(encodeSignedNumber(dlat)); encodedPoints.append(encodeSignedNumber(dlng)); encodedLevels.append(encodeNumber(level)); plat = late5; plng = lnge5; } System.out.println("listSize: " + listSize + " step: " + step + " counter: " + counter); HashMap<String, String> resultMap = new HashMap<String, String>(); resultMap.put("encodedPoints", encodedPoints.toString()); resultMap.put("encodedPointsLiteral", encodeDoubleBackslash(encodedPoints.toString())); resultMap.put("encodedLevels", encodedLevels.toString()); return resultMap; }"
Inversion-Mutation
megadiff
"private static void showHelp(PrepareConfiguration conf, String[] args) { if (conf.hasHelpOption()) { try { conf.showHelp(); } catch (IOException e) { throw new IllegalArgumentException(e); } System.exit(0); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "showHelp"
"private static void showHelp(PrepareConfiguration conf, String[] args) { if (conf.hasHelpOption()) { try { conf.showHelp(); } catch (IOException e) { throw new IllegalArgumentException(e); } } <MASK>System.exit(0);</MASK> }"
Inversion-Mutation
megadiff
"public static MediaItem createMediaItemFromUri(Context context, Uri target, int mediaType) { MediaItem item = null; long id = ContentUris.parseId(target); ContentResolver cr = context.getContentResolver(); String whereClause = Images.ImageColumns._ID + "=" + Long.toString(id); try { final Uri uri = (mediaType == MediaItem.MEDIA_TYPE_IMAGE) ? Images.Media.EXTERNAL_CONTENT_URI : Video.Media.EXTERNAL_CONTENT_URI; final String[] projection = (mediaType == MediaItem.MEDIA_TYPE_IMAGE) ? CacheService.PROJECTION_IMAGES : CacheService.PROJECTION_VIDEOS; Cursor cursor = cr.query(uri, projection, whereClause, null, null); if (cursor != null) { if (cursor.moveToFirst()) { item = new MediaItem(); CacheService.populateMediaItemFromCursor(item, cr, cursor, uri.toString() + "/"); item.mId = id; } cursor.close(); cursor = null; } } catch (Exception e) { // If the database operation failed for any reason. ; } return item; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "createMediaItemFromUri"
"public static MediaItem createMediaItemFromUri(Context context, Uri target, int mediaType) { MediaItem item = null; long id = ContentUris.parseId(target); ContentResolver cr = context.getContentResolver(); String whereClause = Images.ImageColumns._ID + "=" + Long.toString(id); try { final Uri uri = (mediaType == MediaItem.MEDIA_TYPE_IMAGE) ? Images.Media.EXTERNAL_CONTENT_URI : Video.Media.EXTERNAL_CONTENT_URI; final String[] projection = (mediaType == MediaItem.MEDIA_TYPE_IMAGE) ? CacheService.PROJECTION_IMAGES : CacheService.PROJECTION_VIDEOS; Cursor cursor = cr.query(uri, projection, whereClause, null, null); if (cursor != null) { if (cursor.moveToFirst()) { item = new MediaItem(); CacheService.populateMediaItemFromCursor(item, cr, cursor, uri.toString() + "/"); } cursor.close(); cursor = null; } } catch (Exception e) { // If the database operation failed for any reason. ; } <MASK>item.mId = id;</MASK> return item; }"
Inversion-Mutation
megadiff
"@Override public void cleanupInstance() throws Exception { Details details = new Details(exhibitor); if ( !details.isValid() ) { return; } // see http://zookeeper.apache.org/doc/r3.3.3/zookeeperAdmin.html#Ongoing+Data+Directory+Cleanup ProcessBuilder builder = new ProcessBuilder ( "java", "-cp", String.format("%s:%s:%s", details.zooKeeperJarPath, details.logPaths, details.configDirectory.getPath()), "org.apache.zookeeper.server.PurgeTxnLog", details.logDirectory.getPath(), details.dataDirectory.getPath(), "-n", Integer.toString(exhibitor.getConfigManager().getConfig().getInt(IntConfigs.CLEANUP_MAX_FILES)) ); exhibitor.getProcessMonitor().monitor(ProcessTypes.CLEANUP, builder.start(), "Cleanup task completed", ProcessMonitor.Mode.DESTROY_ON_INTERRUPT, ProcessMonitor.Streams.ERROR); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "cleanupInstance"
"@Override public void cleanupInstance() throws Exception { Details details = new Details(exhibitor); if ( !details.isValid() ) { return; } // see http://zookeeper.apache.org/doc/r3.3.3/zookeeperAdmin.html#Ongoing+Data+Directory+Cleanup ProcessBuilder builder = new ProcessBuilder ( "java", "-cp", String.format("%s:%s:%s", details.zooKeeperJarPath, details.logPaths, details.configDirectory.getPath()), "org.apache.zookeeper.server.PurgeTxnLog", <MASK>details.dataDirectory.getPath(),</MASK> details.logDirectory.getPath(), "-n", Integer.toString(exhibitor.getConfigManager().getConfig().getInt(IntConfigs.CLEANUP_MAX_FILES)) ); exhibitor.getProcessMonitor().monitor(ProcessTypes.CLEANUP, builder.start(), "Cleanup task completed", ProcessMonitor.Mode.DESTROY_ON_INTERRUPT, ProcessMonitor.Streams.ERROR); }"
Inversion-Mutation
megadiff
"@Override protected void doSdpEvent(final SdpPortManagerEvent event) { if (event.getEventType().equals(SdpPortManagerEvent.OFFER_GENERATED) || event.getEventType().equals(SdpPortManagerEvent.ANSWER_GENERATED)) { if (event.isSuccessful()) { try { final byte[] sdp = event.getMediaServerSdp(); _call1.setLocalSDP(sdp); ((SIPOutgoingCall) _call1).call(sdp); return; } catch (final Exception e) { done(Cause.ERROR, e); _call1.fail(e); } } Exception ex = new NegotiateException(event); done(Cause.ERROR, ex); _call1.fail(ex); } else if (event.getEventType().equals(SdpPortManagerEvent.ANSWER_PROCESSED)) { if (event.isSuccessful()) { if (processedAnswer && _call1.getSIPCallState() == SIPCall.State.ANSWERED) { try { _response.createAck().send(); done(JoinCompleteEvent.Cause.JOINED, null); } catch (IOException e) { LOG.error("IOException when sending back ACK", e); Exception ex = new NegotiateException(e); done(Cause.ERROR, ex); _call1.fail(ex); } } return; } Exception ex = new NegotiateException(event); done(Cause.ERROR, ex); _call1.fail(ex); } Exception ex = new NegotiateException(event); done(Cause.ERROR, ex); _call1.fail(ex); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "doSdpEvent"
"@Override protected void doSdpEvent(final SdpPortManagerEvent event) { if (event.getEventType().equals(SdpPortManagerEvent.OFFER_GENERATED) || event.getEventType().equals(SdpPortManagerEvent.ANSWER_GENERATED)) { if (event.isSuccessful()) { try { final byte[] sdp = event.getMediaServerSdp(); _call1.setLocalSDP(sdp); ((SIPOutgoingCall) _call1).call(sdp); <MASK>return;</MASK> } catch (final Exception e) { done(Cause.ERROR, e); _call1.fail(e); } } Exception ex = new NegotiateException(event); done(Cause.ERROR, ex); _call1.fail(ex); } else if (event.getEventType().equals(SdpPortManagerEvent.ANSWER_PROCESSED)) { if (event.isSuccessful()) { if (processedAnswer && _call1.getSIPCallState() == SIPCall.State.ANSWERED) { try { _response.createAck().send(); done(JoinCompleteEvent.Cause.JOINED, null); } catch (IOException e) { LOG.error("IOException when sending back ACK", e); Exception ex = new NegotiateException(e); done(Cause.ERROR, ex); _call1.fail(ex); } <MASK>return;</MASK> } } Exception ex = new NegotiateException(event); done(Cause.ERROR, ex); _call1.fail(ex); } Exception ex = new NegotiateException(event); done(Cause.ERROR, ex); _call1.fail(ex); }"
Inversion-Mutation
megadiff
"private void showNotification(int icon, int icon_level, CharSequence ticker_text, CharSequence content_title, CharSequence content_text, Class<?> activity_class, int flags) { long when = System.currentTimeMillis(); Notification notify = new Notification(icon, ticker_text, when); Intent intent = new Intent(getApplicationContext(), activity_class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent content_intent = PendingIntent.getActivity(this, 0, intent, 0); notify.setLatestEventInfo(getApplicationContext(), content_title, content_text, content_intent); notify.iconLevel = icon_level; notify.flags = flags; NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(NOTIFY_ID, notify); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "showNotification"
"private void showNotification(int icon, int icon_level, CharSequence ticker_text, CharSequence content_title, CharSequence content_text, Class<?> activity_class, int flags) { long when = System.currentTimeMillis(); Notification notify = new Notification(icon, ticker_text, when); <MASK>notify.iconLevel = icon_level;</MASK> Intent intent = new Intent(getApplicationContext(), activity_class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent content_intent = PendingIntent.getActivity(this, 0, intent, 0); notify.setLatestEventInfo(getApplicationContext(), content_title, content_text, content_intent); notify.flags = flags; NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(NOTIFY_ID, notify); }"
Inversion-Mutation
megadiff
"@Override protected void doGenerate(IProgressMonitor monitor) throws Exception { // TODO: IoC IGraphwizService graphwizService = TacoCorePlugin.getDefault().getGraphwizService(); if (!GraphwizDiagnostics.diagnoze(getShell(), graphwizService)) { graphwizService = null; } LatexGenerator generator = new LatexGenerator(model.getSourceEcoreFile(), model.getTargetOutput(), properties, graphwizService); generator.generate(monitor); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "doGenerate"
"@Override protected void doGenerate(IProgressMonitor monitor) throws Exception { IGraphwizService graphwizService = TacoCorePlugin.getDefault().getGraphwizService(); if (!GraphwizDiagnostics.diagnoze(getShell(), graphwizService)) { graphwizService = null; } <MASK>// TODO: IoC</MASK> LatexGenerator generator = new LatexGenerator(model.getSourceEcoreFile(), model.getTargetOutput(), properties, graphwizService); generator.generate(monitor); }"
Inversion-Mutation
megadiff
"public static void saveToFileAsJSON(ArrayList<Shuttle> shuttleList) { try { JsonFactory f = new JsonFactory(); JsonGenerator gen = f.createJsonGenerator(new FileWriter(new File("shuttleOutputData.txt"))); HashMap<String, Integer> map = null; //gen.writeArrayFieldStart("ShuttleETA"); gen.writeStartObject(); for(Shuttle shuttle : shuttleList) { gen.writeObjectFieldStart(shuttle.getName()); gen.writeNumberField("Longitude", shuttle.getCurrentLocation().getLon()); gen.writeNumberField("Latitude", shuttle.getCurrentLocation().getLat()); gen.writeArrayFieldStart("ETA"); map = shuttle.getStopETA(); for(String stop : map.keySet()) { gen.writeString(stop + " " + map.get((stop)) + " " + shuttle.getStops().get(stop).toString()); } gen.writeEndArray(); gen.writeEndObject(); } //gen.writeEndArray(); gen.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "saveToFileAsJSON"
"public static void saveToFileAsJSON(ArrayList<Shuttle> shuttleList) { try { JsonFactory f = new JsonFactory(); JsonGenerator gen = f.createJsonGenerator(new FileWriter(new File("shuttleOutputData.txt"))); HashMap<String, Integer> map = null; //gen.writeArrayFieldStart("ShuttleETA"); gen.writeStartObject(); for(Shuttle shuttle : shuttleList) { gen.writeObjectFieldStart(shuttle.getName()); gen.writeNumberField("Longitude", shuttle.getCurrentLocation().getLon()); gen.writeNumberField("Latitude", shuttle.getCurrentLocation().getLat()); gen.writeArrayFieldStart("ETA"); map = shuttle.getStopETA(); for(String stop : map.keySet()) { gen.writeString(stop + " " + map.get((stop)) + " " + shuttle.getStops().get(stop).toString()); } gen.writeEndArray(); } <MASK>gen.writeEndObject();</MASK> //gen.writeEndArray(); gen.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }"
Inversion-Mutation
megadiff
"public String parse() throws IOException { BufferedReader in = new BufferedReader(new FileReader(file)); StringBuilder pluginTimes = new StringBuilder(); StringBuilder pluginNames = new StringBuilder(); String currentPlugin = null; long totalTime = 0; pluginTimes.append("https://chart.googleapis.com/chart?cht=p3&chd=t:"); while (in.ready()) { String line = in.readLine(); if (line.contains("Total time ")) { totalTime = Long.parseLong(getWord(line, 3)) + totalTime; } } in.close(); in = new BufferedReader(new FileReader(file)); while (in.ready()) { String line = in.readLine(); if (currentPlugin == null) { currentPlugin = getWord(line, 0); } if (line.contains("Total time ")) { int percent = Math.round((float) Long.parseLong(getWord(line, 3)) * 100 / totalTime); if (percent != 0) { pluginNames.append(currentPlugin); pluginNames.append(" (" + percent + "%)|"); pluginTimes.append(percent + ","); } currentPlugin = null; } } in.close(); return pluginTimes.toString().substring(0, pluginTimes.toString().length() - 1) + "&chs=750x300&chl=" + pluginNames.toString().substring(0, pluginNames.toString().length() - 1); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "parse"
"public String parse() throws IOException { BufferedReader in = new BufferedReader(new FileReader(file)); StringBuilder pluginTimes = new StringBuilder(); StringBuilder pluginNames = new StringBuilder(); String currentPlugin = null; long totalTime = 0; pluginTimes.append("https://chart.googleapis.com/chart?cht=p3&chd=t:"); while (in.ready()) { String line = in.readLine(); if (line.contains("Total time ")) { totalTime = Long.parseLong(getWord(line, 3)) + totalTime; } } in.close(); in = new BufferedReader(new FileReader(file)); while (in.ready()) { String line = in.readLine(); if (currentPlugin == null) { currentPlugin = getWord(line, 0); } if (line.contains("Total time ")) { int percent = Math.round((float) Long.parseLong(getWord(line, 3)) * 100 / totalTime); if (percent != 0) { pluginNames.append(" (" + percent + "%)|"); pluginTimes.append(percent + ","); <MASK>pluginNames.append(currentPlugin);</MASK> } currentPlugin = null; } } in.close(); return pluginTimes.toString().substring(0, pluginTimes.toString().length() - 1) + "&chs=750x300&chl=" + pluginNames.toString().substring(0, pluginNames.toString().length() - 1); }"
Inversion-Mutation
megadiff
"public TupleCache( DirectoryServiceConfiguration factoryCfg ) throws NamingException { normalizerMap = factoryCfg.getRegistries().getAttributeTypeRegistry().getNormalizerMapping(); this.nexus = factoryCfg.getPartitionNexus(); attributeTypeRegistry = factoryCfg.getRegistries().getAttributeTypeRegistry(); OidRegistry oidRegistry = factoryCfg.getRegistries().getOidRegistry(); NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeTypeRegistry, oidRegistry ); aciParser = new ACIItemParser( ncn, normalizerMap ); env = ( Hashtable ) factoryCfg.getEnvironment().clone(); prescriptiveAciAT = attributeTypeRegistry.lookup( SchemaConstants.PRESCRIPTIVE_ACI_AT ); initialize(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "TupleCache"
"public TupleCache( DirectoryServiceConfiguration factoryCfg ) throws NamingException { normalizerMap = factoryCfg.getRegistries().getAttributeTypeRegistry().getNormalizerMapping(); this.nexus = factoryCfg.getPartitionNexus(); attributeTypeRegistry = factoryCfg.getRegistries().getAttributeTypeRegistry(); OidRegistry oidRegistry = factoryCfg.getRegistries().getOidRegistry(); NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeTypeRegistry, oidRegistry ); aciParser = new ACIItemParser( ncn, normalizerMap ); env = ( Hashtable ) factoryCfg.getEnvironment().clone(); <MASK>initialize();</MASK> prescriptiveAciAT = attributeTypeRegistry.lookup( SchemaConstants.PRESCRIPTIVE_ACI_AT ); }"
Inversion-Mutation
megadiff
"@Override public void onEnable() { initVariables(); createConfig(); getDBV(); if(config.getBoolean("autoupdate", true)) checkForUpdates(); usesSP = config.getBoolean("superperm", true); hasData = config.getIntegerList("hasData"); loadItems(); getCommand("preview").setExecutor(preview); getCommand("unpreview").setExecutor(preview); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "onEnable"
"@Override public void onEnable() { initVariables(); <MASK>getDBV();</MASK> createConfig(); if(config.getBoolean("autoupdate", true)) checkForUpdates(); usesSP = config.getBoolean("superperm", true); hasData = config.getIntegerList("hasData"); loadItems(); getCommand("preview").setExecutor(preview); getCommand("unpreview").setExecutor(preview); }"
Inversion-Mutation
megadiff
"private void bindMailboxItem(View view, Context context, Cursor cursor, boolean isLastChild) { // Reset the view (in case it was recycled) and prepare for binding AccountFolderListItem itemView = (AccountFolderListItem) view; itemView.bindViewInit(this, false); // Invisible (not "gone") to maintain spacing view.findViewById(R.id.chip).setVisibility(View.INVISIBLE); String text = cursor.getString(MAILBOX_DISPLAY_NAME); if (text != null) { TextView nameView = (TextView) view.findViewById(R.id.name); nameView.setText(text); } // TODO get/track live folder status text = null; TextView statusView = (TextView) view.findViewById(R.id.status); if (text != null) { statusView.setText(text); statusView.setVisibility(View.VISIBLE); } else { statusView.setVisibility(View.GONE); } int count = -1; text = cursor.getString(MAILBOX_UNREAD_COUNT); if (text != null) { count = Integer.valueOf(text); } TextView unreadCountView = (TextView) view.findViewById(R.id.new_message_count); TextView allCountView = (TextView) view.findViewById(R.id.all_message_count); int id = cursor.getInt(MAILBOX_COLUMN_ID); // If the unread count is zero, not to show countView. if (count > 0) { if (id == Mailbox.QUERY_ALL_FAVORITES || id == Mailbox.QUERY_ALL_DRAFTS || id == Mailbox.QUERY_ALL_OUTBOX) { allCountView.setVisibility(View.GONE); unreadCountView.setVisibility(View.VISIBLE); unreadCountView.setText(text); } else { unreadCountView.setVisibility(View.GONE); allCountView.setVisibility(View.VISIBLE); allCountView.setText(text); } } else { allCountView.setVisibility(View.GONE); unreadCountView.setVisibility(View.GONE); } view.findViewById(R.id.folder_button).setVisibility(View.GONE); view.findViewById(R.id.folder_separator).setVisibility(View.GONE); view.findViewById(R.id.default_sender).setVisibility(View.GONE); view.findViewById(R.id.folder_icon).setVisibility(View.VISIBLE); ((ImageView)view.findViewById(R.id.folder_icon)).setImageDrawable( Utility.FolderProperties.getInstance(context).getSummaryMailboxIconIds(id)); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "bindMailboxItem"
"private void bindMailboxItem(View view, Context context, Cursor cursor, boolean isLastChild) { // Reset the view (in case it was recycled) and prepare for binding AccountFolderListItem itemView = (AccountFolderListItem) view; itemView.bindViewInit(this, false); // Invisible (not "gone") to maintain spacing view.findViewById(R.id.chip).setVisibility(View.INVISIBLE); String text = cursor.getString(MAILBOX_DISPLAY_NAME); if (text != null) { TextView nameView = (TextView) view.findViewById(R.id.name); nameView.setText(text); } // TODO get/track live folder status text = null; TextView statusView = (TextView) view.findViewById(R.id.status); if (text != null) { statusView.setText(text); statusView.setVisibility(View.VISIBLE); } else { statusView.setVisibility(View.GONE); } int count = -1; text = cursor.getString(MAILBOX_UNREAD_COUNT); if (text != null) { count = Integer.valueOf(text); } TextView unreadCountView = (TextView) view.findViewById(R.id.new_message_count); TextView allCountView = (TextView) view.findViewById(R.id.all_message_count); // If the unread count is zero, not to show countView. if (count > 0) { <MASK>int id = cursor.getInt(MAILBOX_COLUMN_ID);</MASK> if (id == Mailbox.QUERY_ALL_FAVORITES || id == Mailbox.QUERY_ALL_DRAFTS || id == Mailbox.QUERY_ALL_OUTBOX) { allCountView.setVisibility(View.GONE); unreadCountView.setVisibility(View.VISIBLE); unreadCountView.setText(text); } else { unreadCountView.setVisibility(View.GONE); allCountView.setVisibility(View.VISIBLE); allCountView.setText(text); } } else { allCountView.setVisibility(View.GONE); unreadCountView.setVisibility(View.GONE); } view.findViewById(R.id.folder_button).setVisibility(View.GONE); view.findViewById(R.id.folder_separator).setVisibility(View.GONE); view.findViewById(R.id.default_sender).setVisibility(View.GONE); view.findViewById(R.id.folder_icon).setVisibility(View.VISIBLE); ((ImageView)view.findViewById(R.id.folder_icon)).setImageDrawable( Utility.FolderProperties.getInstance(context).getSummaryMailboxIconIds(id)); }"
Inversion-Mutation
megadiff
"@Override public void execute(String commandString, ConnectionContext context) throws IOException { Session session = context.getSession(); if (!session.getHasSender()) { context.sendResponse("503 Error: need MAIL command"); return; } else if (session.getRecipientCount() == 0) { context.sendResponse("503 Error: need RCPT command"); return; } session.setDataMode(true); context.sendResponse("354 End data with <CR><LF>.<CR><LF>"); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "execute"
"@Override public void execute(String commandString, ConnectionContext context) throws IOException { Session session = context.getSession(); if (!session.getHasSender()) { context.sendResponse("503 Error: need MAIL command"); return; } else if (session.getRecipientCount() == 0) { context.sendResponse("503 Error: need RCPT command"); return; } <MASK>context.sendResponse("354 End data with <CR><LF>.<CR><LF>");</MASK> session.setDataMode(true); }"
Inversion-Mutation
megadiff
"public Map<QName, Object> getAnyAttribute(Object target) { try { Map<QName, Object> map = (Map<QName, Object>) anyAttributeField.get(target); if (map == null) { map = Maps.newHashMap(); anyAttributeField.set(target, map); } return map; } catch (IllegalAccessException e) { throw new IllegalStateException("Error getting field value", e); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getAnyAttribute"
"public Map<QName, Object> getAnyAttribute(Object target) { try { Map<QName, Object> map = (Map<QName, Object>) anyAttributeField.get(target); if (map == null) { <MASK>anyAttributeField.set(target, map);</MASK> map = Maps.newHashMap(); } return map; } catch (IllegalAccessException e) { throw new IllegalStateException("Error getting field value", e); } }"
Inversion-Mutation
megadiff
"public static List<Element> handlePropertyName(String[] propertyNames, ServiceContext context, boolean freq, int maxRecords, String cswServiceSpecificConstraint, LuceneConfig luceneConfig) throws Exception { List<Element> domainValuesList = null; if(Log.isDebugEnabled(Geonet.CSW)) Log.debug(Geonet.CSW,"Handling property names '"+Arrays.toString(propertyNames)+"' with max records of "+maxRecords); for (int i=0; i < propertyNames.length; i++) { if (i==0) domainValuesList = new ArrayList<Element>(); // Initialize list of values element. Element listOfValues = null; // Generate DomainValues element Element domainValues = new Element("DomainValues", Csw.NAMESPACE_CSW); // FIXME what should be the type ??? domainValues.setAttribute("type", "csw:Record"); String property = propertyNames[i].trim(); // Set propertyName in any case. Element pn = new Element("PropertyName", Csw.NAMESPACE_CSW); domainValues.addContent(pn.setText(property)); GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME); SearchManager sm = gc.getSearchmanager(); IndexAndTaxonomy indexAndTaxonomy= sm.getNewIndexReader(null); try { GeonetworkMultiReader reader = indexAndTaxonomy.indexReader; BooleanQuery groupsQuery = (BooleanQuery) CatalogSearcher.getGroupsQuery(context); BooleanQuery query = null; // Apply CSW service specific constraint if (StringUtils.isNotEmpty(cswServiceSpecificConstraint)) { Query constraintQuery = CatalogSearcher.getCswServiceSpecificConstraintQuery(cswServiceSpecificConstraint, luceneConfig); query = new BooleanQuery(); BooleanClause.Occur occur = LuceneUtils .convertRequiredAndProhibitedToOccur(true, false); query.add(groupsQuery, occur); query.add(constraintQuery, occur); } else { query = groupsQuery; } List<Pair<String, Boolean>> sortFields = Collections.singletonList(Pair.read(Geonet.SearchResult.SortBy.RELEVANCE, true)); Sort sort = LuceneSearcher.makeSort(sortFields, context.getLanguage(), false); CachingWrapperFilter filter = null; Pair<TopDocs,Element> searchResults = LuceneSearcher.doSearchAndMakeSummary( maxRecords, 0, maxRecords, context.getLanguage(), null, reader, query, filter, sort, null, false, false, false, false // Scoring is useless for GetDomain operation ); TopDocs hits = searchResults.one(); try { // Get mapped lucene field in CSW configuration String indexField = CatalogConfiguration.getFieldMapping().get( property.toLowerCase()); if (indexField != null) property = indexField; // check if params asked is in the index using getFieldNames ? @SuppressWarnings("resource") FieldInfos fi = new SlowCompositeReaderWrapper(reader).getFieldInfos(); if (fi.fieldInfo(property) == null) continue; boolean isRange = false; if (CatalogConfiguration.getGetRecordsRangeFields().contains( property)) isRange = true; if (isRange) listOfValues = new Element("RangeOfValues", Csw.NAMESPACE_CSW); else listOfValues = new Element("ListOfValues", Csw.NAMESPACE_CSW); Set<String> fields = new HashSet<String>(); fields.add(property); fields.add("_isTemplate"); // parse each document in the index String[] fieldValues; SortedSet<String> sortedValues = new TreeSet<String>(); ObjectKeyIntOpenHashMap duplicateValues = new ObjectKeyIntOpenHashMap(); for (int j = 0; j < hits.scoreDocs.length; j++) { DocumentStoredFieldVisitor selector = new DocumentStoredFieldVisitor(fields); reader.document(hits.scoreDocs[j].doc, selector); Document doc = selector.getDocument(); // Skip templates and subTemplates String[] isTemplate = doc.getValues("_isTemplate"); if (isTemplate[0] != null && !isTemplate[0].equals("n")) continue; // Get doc values for specified property fieldValues = doc.getValues(property); if (fieldValues == null) continue; addtoSortedSet(sortedValues, fieldValues, duplicateValues); } SummaryComparator valuesComparator = new SummaryComparator(SortOption.FREQUENCY, Type.STRING, context.getLanguage(), null); TreeSet<SummaryComparator.SummaryElement> sortedValuesFrequency = new TreeSet<SummaryComparator.SummaryElement>(valuesComparator); ObjectKeyIntMapIterator entries = duplicateValues.entries(); while(entries.hasNext()) { entries.next(); sortedValuesFrequency.add(new SummaryComparator.SummaryElement(entries)); } if (freq) return createValuesByFrequency(sortedValuesFrequency); else listOfValues.addContent(createValuesElement(sortedValues, isRange)); } finally { // any children means that the catalog was unable to determine // anything about the specified parameter if (listOfValues!= null && listOfValues.getChildren().size() != 0) domainValues.addContent(listOfValues); // Add current DomainValues to the list domainValuesList.add(domainValues); } } finally { sm.releaseIndexReader(indexAndTaxonomy); } } return domainValuesList; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "handlePropertyName"
"public static List<Element> handlePropertyName(String[] propertyNames, ServiceContext context, boolean freq, int maxRecords, String cswServiceSpecificConstraint, LuceneConfig luceneConfig) throws Exception { List<Element> domainValuesList = null; if(Log.isDebugEnabled(Geonet.CSW)) Log.debug(Geonet.CSW,"Handling property names '"+Arrays.toString(propertyNames)+"' with max records of "+maxRecords); for (int i=0; i < propertyNames.length; i++) { if (i==0) domainValuesList = new ArrayList<Element>(); // Initialize list of values element. Element listOfValues = null; // Generate DomainValues element Element domainValues = new Element("DomainValues", Csw.NAMESPACE_CSW); // FIXME what should be the type ??? domainValues.setAttribute("type", "csw:Record"); String property = propertyNames[i].trim(); // Set propertyName in any case. Element pn = new Element("PropertyName", Csw.NAMESPACE_CSW); domainValues.addContent(pn.setText(property)); GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME); SearchManager sm = gc.getSearchmanager(); IndexAndTaxonomy indexAndTaxonomy= sm.getNewIndexReader(null); try { GeonetworkMultiReader reader = indexAndTaxonomy.indexReader; BooleanQuery groupsQuery = (BooleanQuery) CatalogSearcher.getGroupsQuery(context); BooleanQuery query = null; // Apply CSW service specific constraint if (StringUtils.isNotEmpty(cswServiceSpecificConstraint)) { Query constraintQuery = CatalogSearcher.getCswServiceSpecificConstraintQuery(cswServiceSpecificConstraint, luceneConfig); query = new BooleanQuery(); BooleanClause.Occur occur = LuceneUtils .convertRequiredAndProhibitedToOccur(true, false); query.add(groupsQuery, occur); query.add(constraintQuery, occur); } else { query = groupsQuery; } List<Pair<String, Boolean>> sortFields = Collections.singletonList(Pair.read(Geonet.SearchResult.SortBy.RELEVANCE, true)); Sort sort = LuceneSearcher.makeSort(sortFields, context.getLanguage(), false); CachingWrapperFilter filter = null; Pair<TopDocs,Element> searchResults = LuceneSearcher.doSearchAndMakeSummary( maxRecords, 0, maxRecords, context.getLanguage(), null, reader, query, filter, sort, null, false, false, false, false // Scoring is useless for GetDomain operation ); TopDocs hits = searchResults.one(); try { // Get mapped lucene field in CSW configuration String indexField = CatalogConfiguration.getFieldMapping().get( property.toLowerCase()); if (indexField != null) property = indexField; // check if params asked is in the index using getFieldNames ? @SuppressWarnings("resource") FieldInfos fi = new SlowCompositeReaderWrapper(reader).getFieldInfos(); if (fi.fieldInfo(property) == null) continue; boolean isRange = false; if (CatalogConfiguration.getGetRecordsRangeFields().contains( property)) isRange = true; if (isRange) listOfValues = new Element("RangeOfValues", Csw.NAMESPACE_CSW); else listOfValues = new Element("ListOfValues", Csw.NAMESPACE_CSW); Set<String> fields = new HashSet<String>(); fields.add(property); fields.add("_isTemplate"); // parse each document in the index String[] fieldValues; SortedSet<String> sortedValues = new TreeSet<String>(); ObjectKeyIntOpenHashMap duplicateValues = new ObjectKeyIntOpenHashMap(); for (int j = 0; j < hits.scoreDocs.length; j++) { DocumentStoredFieldVisitor selector = new DocumentStoredFieldVisitor(fields); reader.document(hits.scoreDocs[j].doc, selector); Document doc = selector.getDocument(); // Skip templates and subTemplates String[] isTemplate = doc.getValues("_isTemplate"); if (isTemplate[0] != null && !isTemplate[0].equals("n")) continue; // Get doc values for specified property fieldValues = doc.getValues(property); if (fieldValues == null) continue; addtoSortedSet(sortedValues, fieldValues, duplicateValues); } SummaryComparator valuesComparator = new SummaryComparator(SortOption.FREQUENCY, Type.STRING, context.getLanguage(), null); TreeSet<SummaryComparator.SummaryElement> sortedValuesFrequency = new TreeSet<SummaryComparator.SummaryElement>(valuesComparator); ObjectKeyIntMapIterator entries = duplicateValues.entries(); while(entries.hasNext()) { <MASK>sortedValuesFrequency.add(new SummaryComparator.SummaryElement(entries));</MASK> entries.next(); } if (freq) return createValuesByFrequency(sortedValuesFrequency); else listOfValues.addContent(createValuesElement(sortedValues, isRange)); } finally { // any children means that the catalog was unable to determine // anything about the specified parameter if (listOfValues!= null && listOfValues.getChildren().size() != 0) domainValues.addContent(listOfValues); // Add current DomainValues to the list domainValuesList.add(domainValues); } } finally { sm.releaseIndexReader(indexAndTaxonomy); } } return domainValuesList; }"
Inversion-Mutation
megadiff
"@Override public Image getImage() { synchronized (this) { if (image == null) { image = AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "/icons/brick.png").createImage(); } return image; } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getImage"
"@Override public Image getImage() { synchronized (this) { if (image == null) { image = AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "/icons/brick.png").createImage(); } } <MASK>return image;</MASK> }"
Inversion-Mutation
megadiff
"public int removeItemsFromPlayer(Player p, ItemStack i, int amount) { int taken = 0; if(configManager.brautec == 1) { int firstempty = p.getInventory().firstEmpty(); if(firstempty == -1) { Main.lng.msg(p,"err_full_inv"); return 0; } else { for (int u = 0; u < 36; u++) { ItemStack tmp = p.getInventory().getItem(u); if(tmp != null && tmp.getTypeId() == i.getTypeId()) { if(tmp.getDurability() == i.getDurability()) { if(canbeSold(tmp)) { if(amount > 0) { if(tmp.getAmount() <= amount) { taken += tmp.getAmount(); amount -= tmp.getAmount(); p.getInventory().setItem(u, null); } else { ItemStack n = new ItemStack(tmp.getType()); n.setDurability(tmp.getDurability()); n.setAmount(tmp.getAmount() - amount); p.getInventory().setItem(u, null); p.getInventory().setItem(firstempty,n); taken += amount; amount = 0; } } } } } } } } else { HashMap<Integer, ? extends ItemStack> stacks = p.getInventory().all(i.getTypeId()); for (Entry<Integer, ? extends ItemStack> en : stacks.entrySet()) { ItemStack stack = en.getValue(); if(stack != null) { if(stack.getDurability() == i.getDurability()) { if(canbeSold(stack)) { if(amount > 0) { if(stack.getAmount() <= amount) { taken += stack.getAmount(); amount -= stack.getAmount(); p.getInventory().removeItem(stack); stack.setType(Material.AIR); } else { stack.setAmount(stack.getAmount() - amount); taken += amount; amount = 0; } } } } } if(amount <= 0) return taken; } } return taken; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "removeItemsFromPlayer"
"public int removeItemsFromPlayer(Player p, ItemStack i, int amount) { int taken = 0; if(configManager.brautec == 1) { int firstempty = p.getInventory().firstEmpty(); if(firstempty == -1) { Main.lng.msg(p,"err_full_inv"); return 0; } else { for (int u = 0; u < 36; u++) { ItemStack tmp = p.getInventory().getItem(u); if(tmp != null && tmp.getTypeId() == i.getTypeId()) { if(tmp.getDurability() == i.getDurability()) { if(canbeSold(tmp)) { if(amount > 0) { if(tmp.getAmount() <= amount) { taken += tmp.getAmount(); amount -= tmp.getAmount(); p.getInventory().setItem(u, null); } else { ItemStack n = new ItemStack(tmp.getType()); n.setDurability(tmp.getDurability()); n.setAmount(tmp.getAmount() - amount); p.getInventory().setItem(u, null); p.getInventory().setItem(firstempty,n); taken += amount; amount = 0; } } } } } } } } else { HashMap<Integer, ? extends ItemStack> stacks = p.getInventory().all(i.getTypeId()); for (Entry<Integer, ? extends ItemStack> en : stacks.entrySet()) { ItemStack stack = en.getValue(); if(stack != null) { if(stack.getDurability() == i.getDurability()) { if(canbeSold(stack)) { if(amount > 0) { if(stack.getAmount() <= amount) { taken += stack.getAmount(); amount -= stack.getAmount(); <MASK>stack.setType(Material.AIR);</MASK> p.getInventory().removeItem(stack); } else { stack.setAmount(stack.getAmount() - amount); taken += amount; amount = 0; } } } } } if(amount <= 0) return taken; } } return taken; }"
Inversion-Mutation
megadiff
"@Deprecated public static void destroyAll(Application app) { if (isManaged(app)) { ManagementContext managementContext = app.getManagementContext(); if (app instanceof Startable) Entities.invokeEffector((EntityLocal)app, app, Startable.STOP).getUnchecked(); if (app instanceof AbstractEntity) ((AbstractEntity)app).destroy(); unmanage(app); if (managementContext instanceof ManagementContextInternal) ((ManagementContextInternal)managementContext).terminate(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "destroyAll"
"@Deprecated public static void destroyAll(Application app) { if (isManaged(app)) { ManagementContext managementContext = app.getManagementContext(); if (app instanceof Startable) Entities.invokeEffector((EntityLocal)app, app, Startable.STOP).getUnchecked(); if (app instanceof AbstractEntity) ((AbstractEntity)app).destroy(); <MASK>if (managementContext instanceof ManagementContextInternal) ((ManagementContextInternal)managementContext).terminate();</MASK> unmanage(app); } }"
Inversion-Mutation
megadiff
"protected int computeAdornmentFlags(Object obj) { try { if (obj instanceof IModelElement) { IModelElement element = (IModelElement) obj; int type = element.getElementType(); switch (type) { case IModelElement.SCRIPT_MODEL: case IModelElement.SCRIPT_PROJECT: case IModelElement.PROJECT_FRAGMENT: case IModelElement.SCRIPT_FOLDER: return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_INFINITE, null); case IModelElement.SOURCE_MODULE: return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_ONE, null); case IModelElement.TYPE: case IModelElement.METHOD: case IModelElement.FIELD: ISourceModule cu = (ISourceModule) element .getAncestor(IModelElement.SOURCE_MODULE); if (cu != null) { ISourceReference ref = (type == IModelElement.SOURCE_MODULE) ? null : (ISourceReference) element; // The assumption is that only source elements in // compilation unit can have markers IAnnotationModel model = isInScriptAnnotationModel(cu); int result = 0; if (model != null) { // open in Script editor: look at annotation model result = getErrorTicksFromAnnotationModel(model, ref); } else { result = getErrorTicksFromMarkers(cu.getResource(), IResource.DEPTH_ONE, ref); } fCachedRange = null; return result; } break; default: } } else if (obj instanceof IResource) { return getErrorTicksFromMarkers((IResource) obj, IResource.DEPTH_INFINITE, null); } } catch (CoreException e) { if (e instanceof ModelException) { if (((ModelException) e).isDoesNotExist()) { return 0; } } if (e.getStatus().getCode() == IResourceStatus.MARKER_NOT_FOUND) { return 0; } DLTKUIPlugin.log(e); } return 0; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "computeAdornmentFlags"
"protected int computeAdornmentFlags(Object obj) { try { if (obj instanceof IModelElement) { IModelElement element = (IModelElement) obj; int type = element.getElementType(); switch (type) { case IModelElement.SCRIPT_MODEL: case IModelElement.SCRIPT_PROJECT: case IModelElement.PROJECT_FRAGMENT: return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_INFINITE, null); <MASK>case IModelElement.SCRIPT_FOLDER:</MASK> case IModelElement.SOURCE_MODULE: return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_ONE, null); case IModelElement.TYPE: case IModelElement.METHOD: case IModelElement.FIELD: ISourceModule cu = (ISourceModule) element .getAncestor(IModelElement.SOURCE_MODULE); if (cu != null) { ISourceReference ref = (type == IModelElement.SOURCE_MODULE) ? null : (ISourceReference) element; // The assumption is that only source elements in // compilation unit can have markers IAnnotationModel model = isInScriptAnnotationModel(cu); int result = 0; if (model != null) { // open in Script editor: look at annotation model result = getErrorTicksFromAnnotationModel(model, ref); } else { result = getErrorTicksFromMarkers(cu.getResource(), IResource.DEPTH_ONE, ref); } fCachedRange = null; return result; } break; default: } } else if (obj instanceof IResource) { return getErrorTicksFromMarkers((IResource) obj, IResource.DEPTH_INFINITE, null); } } catch (CoreException e) { if (e instanceof ModelException) { if (((ModelException) e).isDoesNotExist()) { return 0; } } if (e.getStatus().getCode() == IResourceStatus.MARKER_NOT_FOUND) { return 0; } DLTKUIPlugin.log(e); } return 0; }"
Inversion-Mutation
megadiff
"private JPanel createSummaryInfoPanel() { JPanel summaryPanel = new JPanel(); summaryPanel.setLayout(new BorderLayout(10, 5)); summaryPanel.setSize(this.getWidth(), this.getHeight()); // Create the avatar panel. JPanel avatarPanel = new JPanel(); avatarPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); byte[] bytes = this.contact.getImage(); ImageIcon avatarImage = null; // If the user has a contact image, let's use it. If not, add the // default if (bytes != null) avatarImage = new ImageIcon(bytes); else avatarImage = Resources.getImage("defaultPersonIcon"); ImageIcon scaledImage = new ImageIcon(avatarImage.getImage().getScaledInstance(105, 130, Image.SCALE_SMOOTH)); JLabel label = new JLabel(scaledImage); avatarPanel.add(label); summaryPanel.add(avatarPanel, BorderLayout.WEST); // Create the summary details panel. JPanel detailsPanel = new JPanel(); detailsPanel.setLayout(new BorderLayout()); detailsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); summaryPanel.add(detailsPanel); // Labels panel. JPanel labelsPanel = new JPanel(new GridLayout(0, 1, 5, 5)); labelsPanel.add(new JLabel(Resources.getString("firstNameNS"))); labelsPanel.add(new JLabel(Resources.getString("middleNameNS"))); labelsPanel.add(new JLabel(Resources.getString("lastNameNS"))); labelsPanel.add(new JLabel(Resources.getString("genderNS"))); labelsPanel.add(new JLabel(Resources.getString("bdayNS"))); labelsPanel.add(new JLabel(Resources.getString("ageNS"))); labelsPanel.add(new JLabel(Resources.getString("emailNS"))); labelsPanel.add(new JLabel(Resources.getString("phoneNS"))); detailsPanel.add(labelsPanel, BorderLayout.WEST); // Values panel. JPanel valuesPanel = new JPanel(new GridLayout(0, 1, 5, 5)); detailsPanel.add(valuesPanel, BorderLayout.CENTER); Iterator contactDetails; GenericDetail genericDetail; // First name details. contactDetails = contactInfoOpSet.getDetails(contact, FirstNameDetail.class); String firstNameDetail = ""; while (contactDetails.hasNext()) { genericDetail = (FirstNameDetail) contactDetails.next(); firstNameDetail = firstNameDetail + " " + genericDetail.getDetailValue(); } if (firstNameDetail.equals("")) firstNameDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(firstNameDetail)); // Middle name details. contactDetails = contactInfoOpSet.getDetails(contact, MiddleNameDetail.class); String middleNameDetail = ""; while (contactDetails.hasNext()) { genericDetail = (MiddleNameDetail) contactDetails.next(); middleNameDetail = middleNameDetail + " " + genericDetail.getDetailValue(); } if (middleNameDetail.trim().equals("")) middleNameDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(middleNameDetail)); // Last name details. contactDetails = contactInfoOpSet.getDetails(contact, LastNameDetail.class); String lastNameDetail = ""; while (contactDetails.hasNext()) { genericDetail = (LastNameDetail) contactDetails.next(); lastNameDetail = lastNameDetail + " " + genericDetail.getDetailValue(); } if (lastNameDetail.trim().equals("")) lastNameDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(lastNameDetail)); // Gender details. contactDetails = contactInfoOpSet.getDetails(contact, GenderDetail.class); String genderDetail = ""; while (contactDetails.hasNext()) { genericDetail = (GenderDetail) contactDetails.next(); genderDetail = genderDetail + " " + genericDetail.getDetailValue(); } if (genderDetail.trim().equals("")) genderDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(genderDetail)); // Birthday details. contactDetails = contactInfoOpSet.getDetails(contact, BirthDateDetail.class); String birthDateDetail = ""; String ageDetail = ""; if (contactDetails.hasNext()) { genericDetail = (BirthDateDetail) contactDetails.next(); Calendar calendarDetail = (Calendar) genericDetail.getDetailValue(); Date birthDate = calendarDetail.getTime(); DateFormat dateFormat = DateFormat.getDateInstance(); birthDateDetail = dateFormat.format(birthDate).trim(); Calendar c = Calendar.getInstance(); int age = c.get(Calendar.YEAR) - calendarDetail.get(Calendar.YEAR); if (c.get(Calendar.MONTH) < calendarDetail.get(Calendar.MONTH)) age--; ageDetail = new Integer(age).toString().trim(); } if (birthDateDetail.equals("")) birthDateDetail = Resources.getString("notSpecified"); if (ageDetail.equals("")) ageDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(birthDateDetail)); valuesPanel.add(new JLabel(ageDetail)); // Email details. contactDetails = contactInfoOpSet.getDetails(contact, EmailAddressDetail.class); String emailDetail = ""; while (contactDetails.hasNext()) { genericDetail = (EmailAddressDetail) contactDetails.next(); emailDetail = emailDetail + " " + genericDetail.getDetailValue(); } if (emailDetail.trim().equals("")) emailDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(emailDetail)); // Phone number details. contactDetails = contactInfoOpSet.getDetails(contact, PhoneNumberDetail.class); String phoneNumberDetail = ""; while (contactDetails.hasNext()) { genericDetail = (PhoneNumberDetail) contactDetails.next(); phoneNumberDetail = phoneNumberDetail + " " + genericDetail.getDetailValue(); } if (phoneNumberDetail.trim().equals("")) phoneNumberDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(phoneNumberDetail)); return summaryPanel; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "createSummaryInfoPanel"
"private JPanel createSummaryInfoPanel() { JPanel summaryPanel = new JPanel(); summaryPanel.setLayout(new BorderLayout(10, 5)); summaryPanel.setSize(this.getWidth(), this.getHeight()); // Create the avatar panel. JPanel avatarPanel = new JPanel(); avatarPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); byte[] bytes = this.contact.getImage(); ImageIcon avatarImage = null; // If the user has a contact image, let's use it. If not, add the // default if (bytes != null) avatarImage = new ImageIcon(bytes); else avatarImage = Resources.getImage("defaultPersonIcon"); ImageIcon scaledImage = new ImageIcon(avatarImage.getImage().getScaledInstance(105, 130, Image.SCALE_SMOOTH)); JLabel label = new JLabel(scaledImage); avatarPanel.add(label); summaryPanel.add(avatarPanel, BorderLayout.WEST); // Create the summary details panel. JPanel detailsPanel = new JPanel(); detailsPanel.setLayout(new BorderLayout()); detailsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); summaryPanel.add(detailsPanel); // Labels panel. JPanel labelsPanel = new JPanel(new GridLayout(0, 1, 5, 5)); labelsPanel.add(new JLabel(Resources.getString("firstNameNS"))); labelsPanel.add(new JLabel(Resources.getString("middleNameNS"))); labelsPanel.add(new JLabel(Resources.getString("lastNameNS"))); labelsPanel.add(new JLabel(Resources.getString("genderNS"))); <MASK>labelsPanel.add(new JLabel(Resources.getString("ageNS")));</MASK> labelsPanel.add(new JLabel(Resources.getString("bdayNS"))); labelsPanel.add(new JLabel(Resources.getString("emailNS"))); labelsPanel.add(new JLabel(Resources.getString("phoneNS"))); detailsPanel.add(labelsPanel, BorderLayout.WEST); // Values panel. JPanel valuesPanel = new JPanel(new GridLayout(0, 1, 5, 5)); detailsPanel.add(valuesPanel, BorderLayout.CENTER); Iterator contactDetails; GenericDetail genericDetail; // First name details. contactDetails = contactInfoOpSet.getDetails(contact, FirstNameDetail.class); String firstNameDetail = ""; while (contactDetails.hasNext()) { genericDetail = (FirstNameDetail) contactDetails.next(); firstNameDetail = firstNameDetail + " " + genericDetail.getDetailValue(); } if (firstNameDetail.equals("")) firstNameDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(firstNameDetail)); // Middle name details. contactDetails = contactInfoOpSet.getDetails(contact, MiddleNameDetail.class); String middleNameDetail = ""; while (contactDetails.hasNext()) { genericDetail = (MiddleNameDetail) contactDetails.next(); middleNameDetail = middleNameDetail + " " + genericDetail.getDetailValue(); } if (middleNameDetail.trim().equals("")) middleNameDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(middleNameDetail)); // Last name details. contactDetails = contactInfoOpSet.getDetails(contact, LastNameDetail.class); String lastNameDetail = ""; while (contactDetails.hasNext()) { genericDetail = (LastNameDetail) contactDetails.next(); lastNameDetail = lastNameDetail + " " + genericDetail.getDetailValue(); } if (lastNameDetail.trim().equals("")) lastNameDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(lastNameDetail)); // Gender details. contactDetails = contactInfoOpSet.getDetails(contact, GenderDetail.class); String genderDetail = ""; while (contactDetails.hasNext()) { genericDetail = (GenderDetail) contactDetails.next(); genderDetail = genderDetail + " " + genericDetail.getDetailValue(); } if (genderDetail.trim().equals("")) genderDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(genderDetail)); // Birthday details. contactDetails = contactInfoOpSet.getDetails(contact, BirthDateDetail.class); String birthDateDetail = ""; String ageDetail = ""; if (contactDetails.hasNext()) { genericDetail = (BirthDateDetail) contactDetails.next(); Calendar calendarDetail = (Calendar) genericDetail.getDetailValue(); Date birthDate = calendarDetail.getTime(); DateFormat dateFormat = DateFormat.getDateInstance(); birthDateDetail = dateFormat.format(birthDate).trim(); Calendar c = Calendar.getInstance(); int age = c.get(Calendar.YEAR) - calendarDetail.get(Calendar.YEAR); if (c.get(Calendar.MONTH) < calendarDetail.get(Calendar.MONTH)) age--; ageDetail = new Integer(age).toString().trim(); } if (birthDateDetail.equals("")) birthDateDetail = Resources.getString("notSpecified"); if (ageDetail.equals("")) ageDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(birthDateDetail)); valuesPanel.add(new JLabel(ageDetail)); // Email details. contactDetails = contactInfoOpSet.getDetails(contact, EmailAddressDetail.class); String emailDetail = ""; while (contactDetails.hasNext()) { genericDetail = (EmailAddressDetail) contactDetails.next(); emailDetail = emailDetail + " " + genericDetail.getDetailValue(); } if (emailDetail.trim().equals("")) emailDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(emailDetail)); // Phone number details. contactDetails = contactInfoOpSet.getDetails(contact, PhoneNumberDetail.class); String phoneNumberDetail = ""; while (contactDetails.hasNext()) { genericDetail = (PhoneNumberDetail) contactDetails.next(); phoneNumberDetail = phoneNumberDetail + " " + genericDetail.getDetailValue(); } if (phoneNumberDetail.trim().equals("")) phoneNumberDetail = Resources.getString("notSpecified"); valuesPanel.add(new JLabel(phoneNumberDetail)); return summaryPanel; }"
Inversion-Mutation
megadiff
"protected void onCreate(Bundle savedInstanceState) { try { super.onCreate(savedInstanceState); nversion = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; /*mNotificationManagerUpdate = (NotificationManager)getBaseContext().getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManagerUpdate.cancel(SIMPLE_NOTFICATION_UPDATE); ajustes=getSharedPreferences("JiayuesAjustes",Context.MODE_PRIVATE); editorAjustes=ajustes.edit(); String tmpFecha=""; tmpFecha=ajustes.getString("fechaUltimoAccesoDescargas", ""); if("".equals(tmpFecha)){ editorAjustes.putString("fechaUltimoAccesoDescargas", asignaFecha()); editorAjustes.commit(); } Calendar calc = Calendar.getInstance(); calc.add(Calendar.SECOND,20); Intent intent2 = new Intent(getBaseContext(), NotifyService.class); PendingIntent pintent = PendingIntent.getService(getBaseContext(), 0, intent2, 0); AlarmManager alarm = (AlarmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); alarm.setRepeating(AlarmManager.RTC_WAKEUP, calc.getTimeInMillis(),20*1000, pintent); getBaseContext().startService(new Intent(getBaseContext(),NotifyService.class)); Calendar calc2 = Calendar.getInstance(); calc2.add(Calendar.SECOND,20); Intent intent3 = new Intent(getBaseContext(), NotifyNewsService.class); PendingIntent pintent2 = PendingIntent.getService(getBaseContext(), 0, intent3, 0); AlarmManager alarm2 = (AlarmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); alarm2.setRepeating(AlarmManager.RTC_WAKEUP, calc2.getTimeInMillis(),20*1000, pintent2); getBaseContext().startService(new Intent(getBaseContext(),NotifyNewsService.class));*/ version = "Jiayu.es "; version = version + nversion; File f1 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/APP/"); if (!f1.exists()) { f1.mkdirs(); } File f2 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/ROMS/"); if (!f2.exists()) { f2.mkdirs(); } File f3 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/RECOVERY/"); if (!f3.exists()) { f3.mkdirs(); } File f4 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/DOWNLOADS/"); if (!f4.exists()) { f4.mkdirs(); } File f5 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/IMEI/"); if (!f5.exists()) { f5.mkdirs(); } File f6 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/BOOTANIMATION/"); if (!f6.exists()) { f6.mkdirs(); } Resources res = this.getResources(); setContentView(R.layout.activity_app); addListenerOnButton(); comprobarVersionInicio(version); descargas = (Button) findViewById(R.id.button1); about = (Button) findViewById(R.id.button2); salir = (Button) findViewById(R.id.button11); videotutoriales = (Button) findViewById(R.id.button3); foro = (Button) findViewById(R.id.button4); driversherramientas = (Button) findViewById(R.id.button9); herramientasROM = (Button) findViewById(R.id.button10); descargas.setEnabled(false); //accesorios.setEnabled(false); videotutoriales.setEnabled(false); driversherramientas.setEnabled(false); herramientasROM.setEnabled(false); foro.setEnabled(false); ImageButton img = new ImageButton(this); img = (ImageButton) findViewById(R.id.imageButton1); TextView t = new TextView(this); TextView t2 = new TextView(this); TextView t4 = new TextView(this); TextView t5 = new TextView(this); t4 = (TextView) findViewById(R.id.textView4); t5 = (TextView) findViewById(R.id.textView5); t4.setText(version); compilacion = Build.DISPLAY; fabricante = infoBrand(); t = (TextView) findViewById(R.id.textView1); t2 = (TextView) findViewById(R.id.textView2); if ("".equals(modelo)) { calcularTelefono(); modelo = model; } else { recalcularTelefono(); descargas.setEnabled(true); herramientasROM.setEnabled(true); //accesorios.setEnabled(true); foro.setEnabled(true); driversherramientas.setEnabled(true); videotutoriales.setEnabled(true); } if (modelo.length() < 8) { /*Calendar cal=Calendar.getInstance(); editorAjustes = ajustes.edit(); editorAjustes.putString("modelo", modelo); editorAjustes.commit();*/ descargas.setEnabled(true); //accesorios.setEnabled(true); foro.setEnabled(true); driversherramientas.setEnabled(true); videotutoriales.setEnabled(true); herramientasROM.setEnabled(true); if (!"JIAYU".equals(fabricante.toUpperCase().trim())) { t5.setTextColor(Color.RED); t5.setText(res.getString(R.string.msgIdentificado1) +" "+ modelo + res.getString(R.string.msgIdentificado2)); }else{ t5.setVisibility(View.INVISIBLE); } } t.setText(res.getString(R.string.msgModelo) + modelo); t2.setText(res.getString(R.string.msgCompilacion) + compilacion); } catch (Exception e) { Toast.makeText(getBaseContext(), getResources().getString(R.string.msgGenericError), Toast.LENGTH_SHORT).show(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "onCreate"
"protected void onCreate(Bundle savedInstanceState) { try { super.onCreate(savedInstanceState); /*mNotificationManagerUpdate = (NotificationManager)getBaseContext().getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManagerUpdate.cancel(SIMPLE_NOTFICATION_UPDATE); <MASK>nversion = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;</MASK> ajustes=getSharedPreferences("JiayuesAjustes",Context.MODE_PRIVATE); editorAjustes=ajustes.edit(); String tmpFecha=""; tmpFecha=ajustes.getString("fechaUltimoAccesoDescargas", ""); if("".equals(tmpFecha)){ editorAjustes.putString("fechaUltimoAccesoDescargas", asignaFecha()); editorAjustes.commit(); } Calendar calc = Calendar.getInstance(); calc.add(Calendar.SECOND,20); Intent intent2 = new Intent(getBaseContext(), NotifyService.class); PendingIntent pintent = PendingIntent.getService(getBaseContext(), 0, intent2, 0); AlarmManager alarm = (AlarmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); alarm.setRepeating(AlarmManager.RTC_WAKEUP, calc.getTimeInMillis(),20*1000, pintent); getBaseContext().startService(new Intent(getBaseContext(),NotifyService.class)); Calendar calc2 = Calendar.getInstance(); calc2.add(Calendar.SECOND,20); Intent intent3 = new Intent(getBaseContext(), NotifyNewsService.class); PendingIntent pintent2 = PendingIntent.getService(getBaseContext(), 0, intent3, 0); AlarmManager alarm2 = (AlarmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); alarm2.setRepeating(AlarmManager.RTC_WAKEUP, calc2.getTimeInMillis(),20*1000, pintent2); getBaseContext().startService(new Intent(getBaseContext(),NotifyNewsService.class));*/ version = "Jiayu.es "; version = version + nversion; File f1 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/APP/"); if (!f1.exists()) { f1.mkdirs(); } File f2 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/ROMS/"); if (!f2.exists()) { f2.mkdirs(); } File f3 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/RECOVERY/"); if (!f3.exists()) { f3.mkdirs(); } File f4 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/DOWNLOADS/"); if (!f4.exists()) { f4.mkdirs(); } File f5 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/IMEI/"); if (!f5.exists()) { f5.mkdirs(); } File f6 = new File(Environment.getExternalStorageDirectory() + "/JIAYUES/BOOTANIMATION/"); if (!f6.exists()) { f6.mkdirs(); } Resources res = this.getResources(); setContentView(R.layout.activity_app); addListenerOnButton(); comprobarVersionInicio(version); descargas = (Button) findViewById(R.id.button1); about = (Button) findViewById(R.id.button2); salir = (Button) findViewById(R.id.button11); videotutoriales = (Button) findViewById(R.id.button3); foro = (Button) findViewById(R.id.button4); driversherramientas = (Button) findViewById(R.id.button9); herramientasROM = (Button) findViewById(R.id.button10); descargas.setEnabled(false); //accesorios.setEnabled(false); videotutoriales.setEnabled(false); driversherramientas.setEnabled(false); herramientasROM.setEnabled(false); foro.setEnabled(false); ImageButton img = new ImageButton(this); img = (ImageButton) findViewById(R.id.imageButton1); TextView t = new TextView(this); TextView t2 = new TextView(this); TextView t4 = new TextView(this); TextView t5 = new TextView(this); t4 = (TextView) findViewById(R.id.textView4); t5 = (TextView) findViewById(R.id.textView5); t4.setText(version); compilacion = Build.DISPLAY; fabricante = infoBrand(); t = (TextView) findViewById(R.id.textView1); t2 = (TextView) findViewById(R.id.textView2); if ("".equals(modelo)) { calcularTelefono(); modelo = model; } else { recalcularTelefono(); descargas.setEnabled(true); herramientasROM.setEnabled(true); //accesorios.setEnabled(true); foro.setEnabled(true); driversherramientas.setEnabled(true); videotutoriales.setEnabled(true); } if (modelo.length() < 8) { /*Calendar cal=Calendar.getInstance(); editorAjustes = ajustes.edit(); editorAjustes.putString("modelo", modelo); editorAjustes.commit();*/ descargas.setEnabled(true); //accesorios.setEnabled(true); foro.setEnabled(true); driversherramientas.setEnabled(true); videotutoriales.setEnabled(true); herramientasROM.setEnabled(true); if (!"JIAYU".equals(fabricante.toUpperCase().trim())) { t5.setTextColor(Color.RED); t5.setText(res.getString(R.string.msgIdentificado1) +" "+ modelo + res.getString(R.string.msgIdentificado2)); }else{ t5.setVisibility(View.INVISIBLE); } } t.setText(res.getString(R.string.msgModelo) + modelo); t2.setText(res.getString(R.string.msgCompilacion) + compilacion); } catch (Exception e) { Toast.makeText(getBaseContext(), getResources().getString(R.string.msgGenericError), Toast.LENGTH_SHORT).show(); } }"
Inversion-Mutation
megadiff
"public void hidePlaceholder() { if (super.getTextBox().getText().equals(this.getPlaceholderText())) { super.getTextBox().setText(""); } super.getTextBox().removeStyleName(this.getPlaceholderStyleName()); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "hidePlaceholder"
"public void hidePlaceholder() { if (super.getTextBox().getText().equals(this.getPlaceholderText())) { super.getTextBox().setText(""); <MASK>super.getTextBox().removeStyleName(this.getPlaceholderStyleName());</MASK> } }"
Inversion-Mutation
megadiff
"public ArrayList<String> resolveMemory(Variable m1, Variable m2) { RegisterHandler registerHanlder = RegisterHandler.getInstance(); ArrayList<String> result = new ArrayList<String>(); String reg1 = registerHanlder.getRegister(); CodeGenerator.assembler.add("MOV "+reg1+" , "+m2.getName()); result.add(m1.getName()); result.add(reg1); return result; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "resolveMemory"
"public ArrayList<String> resolveMemory(Variable m1, Variable m2) { RegisterHandler registerHanlder = RegisterHandler.getInstance(); ArrayList<String> result = new ArrayList<String>(); String reg1 = registerHanlder.getRegister(); CodeGenerator.assembler.add("MOV "+reg1+" , "+m2.getName()); <MASK>result.add(reg1);</MASK> result.add(m1.getName()); return result; }"
Inversion-Mutation
megadiff
"public AbstractTempRegion(RegionBroker broker, DestinationStatistics destinationStatistics, SystemUsage memoryManager, TaskRunnerFactory taskRunnerFactory, DestinationFactory destinationFactory) { super(broker, destinationStatistics, memoryManager, taskRunnerFactory, destinationFactory); this.doCacheTempDestinations=broker.getBrokerService().isCacheTempDestinations(); this.purgeTime = broker.getBrokerService().getTimeBeforePurgeTempDestinations(); if (this.doCacheTempDestinations) { this.purgeTimer = new Timer(true); this.purgeTask = new TimerTask() { public void run() { doPurge(); } }; this.purgeTimer.schedule(purgeTask, purgeTime, purgeTime); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "AbstractTempRegion"
"public AbstractTempRegion(RegionBroker broker, DestinationStatistics destinationStatistics, SystemUsage memoryManager, TaskRunnerFactory taskRunnerFactory, DestinationFactory destinationFactory) { super(broker, destinationStatistics, memoryManager, taskRunnerFactory, destinationFactory); this.doCacheTempDestinations=broker.getBrokerService().isCacheTempDestinations(); this.purgeTime = broker.getBrokerService().getTimeBeforePurgeTempDestinations(); if (this.doCacheTempDestinations) { this.purgeTimer = new Timer(true); this.purgeTask = new TimerTask() { public void run() { doPurge(); } }; } <MASK>this.purgeTimer.schedule(purgeTask, purgeTime, purgeTime);</MASK> }"
Inversion-Mutation
megadiff
"public static void init(File mainDir){ log("Starting up..."); try{ ApiBase.mainDir = mainDir; apiDir = new File(mainDir, "/BL/"); if(!apiDir.exists() && !apiDir.mkdir()){ log("[ERROR] Could not create main API directory!"); } settingsFile = new File(apiDir, "BLConfig.json"); if(!settingsFile.exists()){ BlazeLoader.log("Config file does not exist! It will be created."); saveSettings(); } loadSettings(); saveSettings(); ApiBase.modDir = new File(mainDir, Settings.modDir); ApiTick.gameTimer = getTimer(); if(!ApiBase.modDir.exists() || !ApiBase.modDir.isDirectory()){ log("Mods folder not found! Creating new folder..."); log(ApiBase.modDir.mkdir() ? "Creating folder succeeded!" : "Creating folder failed! Check file permissions!"); } if(Settings.enableMods){ loadMods(); ModList.load(); }else{ log("Mods are disabled in config, skipping mod loading."); } log("Mods loaded with no issues."); FixManager.onInit(); }catch(Exception e){ log("Exception occurred while starting BlazeLoader!"); e.printStackTrace(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "init"
"public static void init(File mainDir){ log("Starting up..."); try{ ApiBase.mainDir = mainDir; apiDir = new File(mainDir, "/BL/"); if(!apiDir.exists() && !apiDir.mkdir()){ log("[ERROR] Could not create main API directory!"); } settingsFile = new File(apiDir, "BLConfig.json"); if(!settingsFile.exists()){ BlazeLoader.log("Config file does not exist! It will be created."); saveSettings(); } loadSettings(); saveSettings(); ApiBase.modDir = new File(mainDir, Settings.modDir); ApiTick.gameTimer = getTimer(); <MASK>FixManager.onInit();</MASK> if(!ApiBase.modDir.exists() || !ApiBase.modDir.isDirectory()){ log("Mods folder not found! Creating new folder..."); log(ApiBase.modDir.mkdir() ? "Creating folder succeeded!" : "Creating folder failed! Check file permissions!"); } if(Settings.enableMods){ loadMods(); ModList.load(); }else{ log("Mods are disabled in config, skipping mod loading."); } log("Mods loaded with no issues."); }catch(Exception e){ log("Exception occurred while starting BlazeLoader!"); e.printStackTrace(); } }"
Inversion-Mutation
megadiff
"@Override public List<BeanMetaData> getBeans() { ArrayList<BeanMetaData> result = new ArrayList<BeanMetaData>(); //Create AspectBinding AbstractBeanMetaData stack = new AbstractBeanMetaData(); stack.setName(name); BeanMetaDataUtil.setSimpleProperty(stack, "name", name); stack.setBean(Stack.class.getName()); util.setAspectManagerProperty(stack, "manager"); result.add(stack); if (interceptors.size() > 0) { AbstractListMetaData almd = new AbstractListMetaData(); int i = 0; for (BaseInterceptorData interceptor : interceptors) { AbstractBeanMetaData bmd = new AbstractBeanMetaData(interceptor.getBeanClassName()); String intName = name + "$" + i++; bmd.setName(intName); util.setAspectManagerProperty(bmd, "manager"); BeanMetaDataUtil.setSimpleProperty(bmd, "forStack", Boolean.TRUE); if (interceptor instanceof AdviceData) { BeanMetaDataUtil.DependencyBuilder db = new BeanMetaDataUtil.DependencyBuilder(bmd, "aspect", interceptor.getRefName()); BeanMetaDataUtil.setDependencyProperty(db); if (((AdviceData)interceptor).getAdviceMethod() != null) { BeanMetaDataUtil.setSimpleProperty(bmd, "aspectMethod", ((AdviceData)interceptor).getAdviceMethod()); } BeanMetaDataUtil.setSimpleProperty(bmd, "type", ((AdviceData)interceptor).getType()); } else { BeanMetaDataUtil.DependencyBuilder db = new BeanMetaDataUtil.DependencyBuilder(bmd, "stack", interceptor.getRefName()); BeanMetaDataUtil.setDependencyProperty(db); } result.add(bmd); almd.add(new AbstractInjectionValueMetaData(intName)); } BeanMetaDataUtil.setSimpleProperty(stack, "advices", almd); } return result; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getBeans"
"@Override public List<BeanMetaData> getBeans() { ArrayList<BeanMetaData> result = new ArrayList<BeanMetaData>(); //Create AspectBinding AbstractBeanMetaData stack = new AbstractBeanMetaData(); stack.setName(name); BeanMetaDataUtil.setSimpleProperty(stack, "name", name); stack.setBean(Stack.class.getName()); util.setAspectManagerProperty(stack, "manager"); result.add(stack); if (interceptors.size() > 0) { AbstractListMetaData almd = new AbstractListMetaData(); int i = 0; for (BaseInterceptorData interceptor : interceptors) { AbstractBeanMetaData bmd = new AbstractBeanMetaData(interceptor.getBeanClassName()); String intName = name + "$" + i++; bmd.setName(intName); util.setAspectManagerProperty(bmd, "manager"); BeanMetaDataUtil.setSimpleProperty(bmd, "forStack", Boolean.TRUE); if (interceptor instanceof AdviceData) { BeanMetaDataUtil.DependencyBuilder db = new BeanMetaDataUtil.DependencyBuilder(bmd, "aspect", interceptor.getRefName()); BeanMetaDataUtil.setDependencyProperty(db); if (((AdviceData)interceptor).getAdviceMethod() != null) { BeanMetaDataUtil.setSimpleProperty(bmd, "aspectMethod", ((AdviceData)interceptor).getAdviceMethod()); } BeanMetaDataUtil.setSimpleProperty(bmd, "type", ((AdviceData)interceptor).getType()); } else { BeanMetaDataUtil.DependencyBuilder db = new BeanMetaDataUtil.DependencyBuilder(bmd, "stack", interceptor.getRefName()); BeanMetaDataUtil.setDependencyProperty(db); } result.add(bmd); almd.add(new AbstractInjectionValueMetaData(intName)); <MASK>BeanMetaDataUtil.setSimpleProperty(stack, "advices", almd);</MASK> } } return result; }"
Inversion-Mutation
megadiff
"@Override public void bindView(View view, Context context, Cursor cursor) { Account account = getAccountFromCursor(cursor); String fromList = cursor.getString(SENDER_LIST_COLUMN); String toList = cursor.getString(TO_LIST_COLUMN); String ccList = cursor.getString(CC_LIST_COLUMN); Address[] fromAddrs = Address.unpack(fromList); Address[] toAddrs = Address.unpack(toList); Address[] ccAddrs = Address.unpack(ccList); boolean fromMe = mMessageHelper.toMe(account, fromAddrs); boolean toMe = mMessageHelper.toMe(account, toAddrs); boolean ccMe = mMessageHelper.toMe(account, ccAddrs); CharSequence displayName = mMessageHelper.getDisplayName(account, fromAddrs, toAddrs); CharSequence displayDate = DateUtils.getRelativeTimeSpanString(context, cursor.getLong(DATE_COLUMN)); Address counterpartyAddress = null; if (fromMe) { if (toAddrs.length > 0) { counterpartyAddress = toAddrs[0]; } else if (ccAddrs.length > 0) { counterpartyAddress = ccAddrs[0]; } } else if (fromAddrs.length > 0) { counterpartyAddress = fromAddrs[0]; } int threadCount = (mThreadedList) ? cursor.getInt(THREAD_COUNT_COLUMN) : 0; String subject = cursor.getString(SUBJECT_COLUMN); if (StringUtils.isNullOrEmpty(subject)) { subject = getString(R.string.general_no_subject); } else if (threadCount > 1) { // If this is a thread, strip the RE/FW from the subject. "Be like Outlook." subject = Utility.stripSubject(subject); } boolean read = (cursor.getInt(READ_COLUMN) == 1); boolean flagged = (cursor.getInt(FLAGGED_COLUMN) == 1); boolean answered = (cursor.getInt(ANSWERED_COLUMN) == 1); boolean forwarded = (cursor.getInt(FORWARDED_COLUMN) == 1); boolean hasAttachments = (cursor.getInt(ATTACHMENT_COUNT_COLUMN) > 0); MessageViewHolder holder = (MessageViewHolder) view.getTag(); int maybeBoldTypeface = (read) ? Typeface.NORMAL : Typeface.BOLD; long uniqueId = cursor.getLong(mUniqueIdColumn); boolean selected = mSelected.contains(uniqueId); if (!mCheckboxes && selected) { holder.chip.setBackgroundDrawable(account.getCheckmarkChip().drawable()); } else { holder.chip.setBackgroundDrawable(account.generateColorChip(read, toMe, ccMe, fromMe, flagged).drawable()); } if (mCheckboxes) { holder.selected.setChecked(selected); } holder.position = cursor.getPosition(); if (holder.contactBadge != null) { if (counterpartyAddress != null) { holder.contactBadge.assignContactFromEmail(counterpartyAddress.getAddress(), true); /* * At least in Android 2.2 a different background + padding is used when no * email address is available. ListView reuses the views but QuickContactBadge * doesn't reset the padding, so we do it ourselves. */ holder.contactBadge.setPadding(0, 0, 0, 0); mContactsPictureLoader.loadContactPicture(counterpartyAddress, holder.contactBadge); } else { holder.contactBadge.setImageResource(R.drawable.ic_contact_picture); } } // Background color if (selected || K9.useBackgroundAsUnreadIndicator()) { int res; if (selected) { res = R.attr.messageListSelectedBackgroundColor; } else if (read) { res = R.attr.messageListReadItemBackgroundColor; } else { res = R.attr.messageListUnreadItemBackgroundColor; } TypedValue outValue = new TypedValue(); getActivity().getTheme().resolveAttribute(res, outValue, true); view.setBackgroundColor(outValue.data); } else { view.setBackgroundColor(Color.TRANSPARENT); } if (mActiveMessage != null) { String uid = cursor.getString(UID_COLUMN); String folderName = cursor.getString(FOLDER_NAME_COLUMN); if (account.getUuid().equals(mActiveMessage.accountUuid) && folderName.equals(mActiveMessage.folderName) && uid.equals(mActiveMessage.uid)) { int res = R.attr.messageListActiveItemBackgroundColor; TypedValue outValue = new TypedValue(); getActivity().getTheme().resolveAttribute(res, outValue, true); view.setBackgroundColor(outValue.data); } } // Thread count if (threadCount > 1) { holder.threadCount.setText(Integer.toString(threadCount)); holder.threadCount.setVisibility(View.VISIBLE); } else { holder.threadCount.setVisibility(View.GONE); } CharSequence beforePreviewText = (mSenderAboveSubject) ? subject : displayName; String sigil = recipientSigil(toMe, ccMe); SpannableStringBuilder messageStringBuilder = new SpannableStringBuilder(sigil) .append(beforePreviewText); if (mPreviewLines > 0) { String preview = cursor.getString(PREVIEW_COLUMN); if (preview != null) { messageStringBuilder.append(" ").append(preview); } } holder.preview.setText(messageStringBuilder, TextView.BufferType.SPANNABLE); Spannable str = (Spannable)holder.preview.getText(); // Create a span section for the sender, and assign the correct font size and weight int fontSize = (mSenderAboveSubject) ? mFontSizes.getMessageListSubject(): mFontSizes.getMessageListSender(); AbsoluteSizeSpan span = new AbsoluteSizeSpan(fontSize, true); str.setSpan(span, 0, beforePreviewText.length() + sigil.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); //TODO: make this part of the theme int color = (K9.getK9Theme() == K9.Theme.LIGHT) ? Color.rgb(105, 105, 105) : Color.rgb(160, 160, 160); // Set span (color) for preview message str.setSpan(new ForegroundColorSpan(color), beforePreviewText.length() + sigil.length(), str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); Drawable statusHolder = null; if (forwarded && answered) { statusHolder = mForwardedAnsweredIcon; } else if (answered) { statusHolder = mAnsweredIcon; } else if (forwarded) { statusHolder = mForwardedIcon; } if (holder.from != null ) { holder.from.setTypeface(null, maybeBoldTypeface); if (mSenderAboveSubject) { holder.from.setCompoundDrawablesWithIntrinsicBounds( statusHolder, // left null, // top hasAttachments ? mAttachmentIcon : null, // right null); // bottom holder.from.setText(displayName); } else { holder.from.setText(new SpannableStringBuilder(sigil).append(displayName)); } } if (holder.subject != null ) { if (!mSenderAboveSubject) { holder.subject.setCompoundDrawablesWithIntrinsicBounds( statusHolder, // left null, // top hasAttachments ? mAttachmentIcon : null, // right null); // bottom } holder.subject.setTypeface(null, maybeBoldTypeface); holder.subject.setText(subject); } holder.date.setText(displayDate); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "bindView"
"@Override public void bindView(View view, Context context, Cursor cursor) { Account account = getAccountFromCursor(cursor); String fromList = cursor.getString(SENDER_LIST_COLUMN); String toList = cursor.getString(TO_LIST_COLUMN); String ccList = cursor.getString(CC_LIST_COLUMN); Address[] fromAddrs = Address.unpack(fromList); Address[] toAddrs = Address.unpack(toList); Address[] ccAddrs = Address.unpack(ccList); boolean fromMe = mMessageHelper.toMe(account, fromAddrs); boolean toMe = mMessageHelper.toMe(account, toAddrs); boolean ccMe = mMessageHelper.toMe(account, ccAddrs); CharSequence displayName = mMessageHelper.getDisplayName(account, fromAddrs, toAddrs); CharSequence displayDate = DateUtils.getRelativeTimeSpanString(context, cursor.getLong(DATE_COLUMN)); Address counterpartyAddress = null; if (fromMe) { if (toAddrs.length > 0) { counterpartyAddress = toAddrs[0]; } else if (ccAddrs.length > 0) { counterpartyAddress = ccAddrs[0]; } } else if (fromAddrs.length > 0) { counterpartyAddress = fromAddrs[0]; } int threadCount = (mThreadedList) ? cursor.getInt(THREAD_COUNT_COLUMN) : 0; String subject = cursor.getString(SUBJECT_COLUMN); if (StringUtils.isNullOrEmpty(subject)) { subject = getString(R.string.general_no_subject); } else if (threadCount > 1) { // If this is a thread, strip the RE/FW from the subject. "Be like Outlook." subject = Utility.stripSubject(subject); } boolean read = (cursor.getInt(READ_COLUMN) == 1); boolean flagged = (cursor.getInt(FLAGGED_COLUMN) == 1); boolean answered = (cursor.getInt(ANSWERED_COLUMN) == 1); boolean forwarded = (cursor.getInt(FORWARDED_COLUMN) == 1); boolean hasAttachments = (cursor.getInt(ATTACHMENT_COUNT_COLUMN) > 0); MessageViewHolder holder = (MessageViewHolder) view.getTag(); int maybeBoldTypeface = (read) ? Typeface.NORMAL : Typeface.BOLD; long uniqueId = cursor.getLong(mUniqueIdColumn); boolean selected = mSelected.contains(uniqueId); if (!mCheckboxes && selected) { holder.chip.setBackgroundDrawable(account.getCheckmarkChip().drawable()); } else { holder.chip.setBackgroundDrawable(account.generateColorChip(read, toMe, ccMe, fromMe, flagged).drawable()); } if (mCheckboxes) { holder.selected.setChecked(selected); } holder.position = cursor.getPosition(); if (holder.contactBadge != null) { <MASK>holder.contactBadge.assignContactFromEmail(counterpartyAddress.getAddress(), true);</MASK> if (counterpartyAddress != null) { /* * At least in Android 2.2 a different background + padding is used when no * email address is available. ListView reuses the views but QuickContactBadge * doesn't reset the padding, so we do it ourselves. */ holder.contactBadge.setPadding(0, 0, 0, 0); mContactsPictureLoader.loadContactPicture(counterpartyAddress, holder.contactBadge); } else { holder.contactBadge.setImageResource(R.drawable.ic_contact_picture); } } // Background color if (selected || K9.useBackgroundAsUnreadIndicator()) { int res; if (selected) { res = R.attr.messageListSelectedBackgroundColor; } else if (read) { res = R.attr.messageListReadItemBackgroundColor; } else { res = R.attr.messageListUnreadItemBackgroundColor; } TypedValue outValue = new TypedValue(); getActivity().getTheme().resolveAttribute(res, outValue, true); view.setBackgroundColor(outValue.data); } else { view.setBackgroundColor(Color.TRANSPARENT); } if (mActiveMessage != null) { String uid = cursor.getString(UID_COLUMN); String folderName = cursor.getString(FOLDER_NAME_COLUMN); if (account.getUuid().equals(mActiveMessage.accountUuid) && folderName.equals(mActiveMessage.folderName) && uid.equals(mActiveMessage.uid)) { int res = R.attr.messageListActiveItemBackgroundColor; TypedValue outValue = new TypedValue(); getActivity().getTheme().resolveAttribute(res, outValue, true); view.setBackgroundColor(outValue.data); } } // Thread count if (threadCount > 1) { holder.threadCount.setText(Integer.toString(threadCount)); holder.threadCount.setVisibility(View.VISIBLE); } else { holder.threadCount.setVisibility(View.GONE); } CharSequence beforePreviewText = (mSenderAboveSubject) ? subject : displayName; String sigil = recipientSigil(toMe, ccMe); SpannableStringBuilder messageStringBuilder = new SpannableStringBuilder(sigil) .append(beforePreviewText); if (mPreviewLines > 0) { String preview = cursor.getString(PREVIEW_COLUMN); if (preview != null) { messageStringBuilder.append(" ").append(preview); } } holder.preview.setText(messageStringBuilder, TextView.BufferType.SPANNABLE); Spannable str = (Spannable)holder.preview.getText(); // Create a span section for the sender, and assign the correct font size and weight int fontSize = (mSenderAboveSubject) ? mFontSizes.getMessageListSubject(): mFontSizes.getMessageListSender(); AbsoluteSizeSpan span = new AbsoluteSizeSpan(fontSize, true); str.setSpan(span, 0, beforePreviewText.length() + sigil.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); //TODO: make this part of the theme int color = (K9.getK9Theme() == K9.Theme.LIGHT) ? Color.rgb(105, 105, 105) : Color.rgb(160, 160, 160); // Set span (color) for preview message str.setSpan(new ForegroundColorSpan(color), beforePreviewText.length() + sigil.length(), str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); Drawable statusHolder = null; if (forwarded && answered) { statusHolder = mForwardedAnsweredIcon; } else if (answered) { statusHolder = mAnsweredIcon; } else if (forwarded) { statusHolder = mForwardedIcon; } if (holder.from != null ) { holder.from.setTypeface(null, maybeBoldTypeface); if (mSenderAboveSubject) { holder.from.setCompoundDrawablesWithIntrinsicBounds( statusHolder, // left null, // top hasAttachments ? mAttachmentIcon : null, // right null); // bottom holder.from.setText(displayName); } else { holder.from.setText(new SpannableStringBuilder(sigil).append(displayName)); } } if (holder.subject != null ) { if (!mSenderAboveSubject) { holder.subject.setCompoundDrawablesWithIntrinsicBounds( statusHolder, // left null, // top hasAttachments ? mAttachmentIcon : null, // right null); // bottom } holder.subject.setTypeface(null, maybeBoldTypeface); holder.subject.setText(subject); } holder.date.setText(displayDate); }"
Inversion-Mutation
megadiff
"public GuiSetupGui(GpsMidDisplayable parent, boolean initialSetup) { super(Locale.get("guisetupgui.GUIOptions")/*GUI Options*/); this.parent = parent; this.initialSetup = initialSetup; try { String [] imenu = new String[5]; imenu[0] = Locale.get("guisetupgui.UseIconMenu")/*Use icon menu*/; imenu[1] = Locale.get("guisetupgui.FullscreenIconMenu")/*Fullscreen icon menu*/; imenu[2] = Locale.get("guisetupgui.LargeTabButtons")/*Large tab buttons*/; imenu[3] = Locale.get("guisetupgui.IconsMappedOnKeys")/*Icons mapped on keys*/; imenu[4] = Locale.get("guisetupgui.OptimiseForRouting")/*Optimise for routing*/; imenuOpts = new ChoiceGroup(Locale.get("guisetupgui.IconMenu")/*Icon Menu:*/, Choice.MULTIPLE, imenu, null); imenuOpts.setSelectedIndex(0, Configuration.getCfgBitSavedState(Configuration.CFGBIT_ICONMENUS)); imenuOpts.setSelectedIndex(1, Configuration.getCfgBitSavedState(Configuration.CFGBIT_ICONMENUS_FULLSCREEN)); imenuOpts.setSelectedIndex(2, Configuration.getCfgBitSavedState(Configuration.CFGBIT_ICONMENUS_BIG_TAB_BUTTONS)); imenuOpts.setSelectedIndex(3, Configuration.getCfgBitState(Configuration.CFGBIT_ICONMENUS_MAPPED_ICONS)); imenuOpts.setSelectedIndex(4, Configuration.getCfgBitSavedState(Configuration.CFGBIT_ICONMENUS_ROUTING_OPTIMIZED)); append(imenuOpts); String [] search = new String[1]; search[0] = Locale.get("guisetupgui.numberkeypad")/*Enable virtual keypad*/; searchSettings = new ChoiceGroup(Locale.get("guisetupgui.searchopts")/*Search options*/, Choice.MULTIPLE, search, null); searchSettings.setSelectedIndex(0, Configuration.getCfgBitSavedState(Configuration.CFGBIT_SEARCH_TOUCH_NUMBERKEYPAD)); append(searchSettings); String [] other = new String[1]; other[0] = "Predefined way points"; otherOpts = new ChoiceGroup("Other options:", Choice.MULTIPLE, other, null); imenuOpts.setSelectedIndex(0, Configuration.getCfgBitSavedState(Configuration.CFGBIT_WAYPT_OFFER_PREDEF)); append(otherOpts); long mem = Configuration.getPhoneAllTimeMaxMemory(); if (mem == 0) { mem = Runtime.getRuntime().totalMemory(); } mem = mem / 1024; memField = new TextField(Locale.get("guisetupgui.DefineMaxMem")/*Define maxMem (kbyte)*/, Long.toString(mem), 8, TextField.DECIMAL); append(memField); addCommand(CMD_SAVE); addCommand(CMD_CANCEL); // Set up this Displayable to listen to command events setCommandListener(this); } catch (Exception e) { e.printStackTrace(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "GuiSetupGui"
"public GuiSetupGui(GpsMidDisplayable parent, boolean initialSetup) { super(Locale.get("guisetupgui.GUIOptions")/*GUI Options*/); this.parent = parent; this.initialSetup = initialSetup; try { String [] imenu = new String[5]; imenu[0] = Locale.get("guisetupgui.UseIconMenu")/*Use icon menu*/; imenu[1] = Locale.get("guisetupgui.FullscreenIconMenu")/*Fullscreen icon menu*/; imenu[2] = Locale.get("guisetupgui.LargeTabButtons")/*Large tab buttons*/; imenu[3] = Locale.get("guisetupgui.IconsMappedOnKeys")/*Icons mapped on keys*/; imenu[4] = Locale.get("guisetupgui.OptimiseForRouting")/*Optimise for routing*/; imenuOpts = new ChoiceGroup(Locale.get("guisetupgui.IconMenu")/*Icon Menu:*/, Choice.MULTIPLE, imenu, null); imenuOpts.setSelectedIndex(0, Configuration.getCfgBitSavedState(Configuration.CFGBIT_ICONMENUS)); imenuOpts.setSelectedIndex(1, Configuration.getCfgBitSavedState(Configuration.CFGBIT_ICONMENUS_FULLSCREEN)); imenuOpts.setSelectedIndex(2, Configuration.getCfgBitSavedState(Configuration.CFGBIT_ICONMENUS_BIG_TAB_BUTTONS)); imenuOpts.setSelectedIndex(3, Configuration.getCfgBitState(Configuration.CFGBIT_ICONMENUS_MAPPED_ICONS)); imenuOpts.setSelectedIndex(4, Configuration.getCfgBitSavedState(Configuration.CFGBIT_ICONMENUS_ROUTING_OPTIMIZED)); append(imenuOpts); <MASK>searchSettings.setSelectedIndex(0, Configuration.getCfgBitSavedState(Configuration.CFGBIT_SEARCH_TOUCH_NUMBERKEYPAD));</MASK> String [] search = new String[1]; search[0] = Locale.get("guisetupgui.numberkeypad")/*Enable virtual keypad*/; searchSettings = new ChoiceGroup(Locale.get("guisetupgui.searchopts")/*Search options*/, Choice.MULTIPLE, search, null); append(searchSettings); String [] other = new String[1]; other[0] = "Predefined way points"; otherOpts = new ChoiceGroup("Other options:", Choice.MULTIPLE, other, null); imenuOpts.setSelectedIndex(0, Configuration.getCfgBitSavedState(Configuration.CFGBIT_WAYPT_OFFER_PREDEF)); append(otherOpts); long mem = Configuration.getPhoneAllTimeMaxMemory(); if (mem == 0) { mem = Runtime.getRuntime().totalMemory(); } mem = mem / 1024; memField = new TextField(Locale.get("guisetupgui.DefineMaxMem")/*Define maxMem (kbyte)*/, Long.toString(mem), 8, TextField.DECIMAL); append(memField); addCommand(CMD_SAVE); addCommand(CMD_CANCEL); // Set up this Displayable to listen to command events setCommandListener(this); } catch (Exception e) { e.printStackTrace(); } }"
Inversion-Mutation
megadiff
"@Override public void start(BundleContext bundleContext) throws Exception { super.start(bundleContext); plugin = this; DebugUtil.configurePluginDebugOptions(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "start"
"@Override public void start(BundleContext bundleContext) throws Exception { super.start(bundleContext); <MASK>DebugUtil.configurePluginDebugOptions();</MASK> plugin = this; }"
Inversion-Mutation
megadiff
"private void sendPacket(FCpacket packet) { DatagramPacket outgoing; outgoing = new DatagramPacket(packet.getSeqNumBytesAndData(), packet.getSeqNumBytesAndData().length, server, FileCopyServer.SERVER_PORT); testOut("Sending packet: " + packet.getSeqNum()); packet.setTimestamp(System.nanoTime()); try { socket.send(outgoing); } catch (IOException e) { testOut("Error sending packet: " + e.getMessage()); } if(!packet.isValidACK()){ startTimer(packet); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "sendPacket"
"private void sendPacket(FCpacket packet) { DatagramPacket outgoing; outgoing = new DatagramPacket(packet.getSeqNumBytesAndData(), packet.getSeqNumBytesAndData().length, server, FileCopyServer.SERVER_PORT); testOut("Sending packet: " + packet.getSeqNum()); try { socket.send(outgoing); } catch (IOException e) { testOut("Error sending packet: " + e.getMessage()); } if(!packet.isValidACK()){ <MASK>packet.setTimestamp(System.nanoTime());</MASK> startTimer(packet); } }"
Inversion-Mutation
megadiff
"@Override protected void onResume() { super.onResume(); mWifiEnabler.resume(); mBtEnabler.resume(); mAirplaneModeEnabler.resume(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "onResume"
"@Override protected void onResume() { super.onResume(); mWifiEnabler.resume(); <MASK>mAirplaneModeEnabler.resume();</MASK> mBtEnabler.resume(); }"
Inversion-Mutation
megadiff
"public void checkGhosts() { for (Ghost ghost : this.mGhosts) { if (this.mTheMan.isCollidingWith(ghost)) { switch (ghost.getState()) { case CHASE: case SCATTER: if (this.mIsGhostDeadly && (this.mTheMan.getState() == TheMan.State.ALIVE)) { //Kill "The Man" this.mLives -= 1; this.mTheMan.setState(TheMan.State.DEAD); this.setState(Game.State.DYING); } break; case FRIGHTENED: //Eat ghost this.addToScore(Game.POINTS_FLEEING_GHOSTS[this.mFleeingGhostsEaten]); this.mFleeingGhostsEaten += 1; ghost.setState(this, Ghost.State.EATEN); //See if we have eaten all the ghosts for this juggerdot if (this.mFleeingGhostsEaten == this.mGhostCount) { this.mAllFleeingGhostsEaten += 1; //See if we have eaten all the ghosts for every juggerdot if (this.mAllFleeingGhostsEaten == Game.NUMBER_OF_JUGGERDOTS) { this.addToScore(Game.POINTS_ALL_FLEEING_GHOSTS); } } break; } } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "checkGhosts"
"public void checkGhosts() { for (Ghost ghost : this.mGhosts) { if (this.mTheMan.isCollidingWith(ghost)) { switch (ghost.getState()) { case CHASE: case SCATTER: if (this.mIsGhostDeadly && (this.mTheMan.getState() == TheMan.State.ALIVE)) { //Kill "The Man" this.mLives -= 1; this.mTheMan.setState(TheMan.State.DEAD); this.setState(Game.State.DYING); } break; case FRIGHTENED: //Eat ghost <MASK>this.mFleeingGhostsEaten += 1;</MASK> this.addToScore(Game.POINTS_FLEEING_GHOSTS[this.mFleeingGhostsEaten]); ghost.setState(this, Ghost.State.EATEN); //See if we have eaten all the ghosts for this juggerdot if (this.mFleeingGhostsEaten == this.mGhostCount) { this.mAllFleeingGhostsEaten += 1; //See if we have eaten all the ghosts for every juggerdot if (this.mAllFleeingGhostsEaten == Game.NUMBER_OF_JUGGERDOTS) { this.addToScore(Game.POINTS_ALL_FLEEING_GHOSTS); } } break; } } } }"
Inversion-Mutation
megadiff
"private void parseInitialEngineOutput() { if (lue.nextLine().equals("A")) { team = true; } else { team = false; } int rowNum = 0; while (lue.hasNextLine()) { String line = lue.nextLine(); if (line.length() < 2) { break; } wallMap.add(rowNum, new ArrayList<Boolean>()); for (int i = 0; i < line.length(); i++) { if (line.charAt(i) == '#') { wallMap.get(rowNum).add(false); } } rowNum++; } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "parseInitialEngineOutput"
"private void parseInitialEngineOutput() { if (lue.nextLine().equals("A")) { team = true; } else { team = false; } int rowNum = 0; while (lue.hasNextLine()) { String line = lue.nextLine(); if (line.length() < 2) { break; } for (int i = 0; i < line.length(); i++) { <MASK>wallMap.add(rowNum, new ArrayList<Boolean>());</MASK> if (line.charAt(i) == '#') { wallMap.get(rowNum).add(false); } } rowNum++; } }"
Inversion-Mutation
megadiff
"@Override public int getCount() { if (itemsAddedWithoutNotify > 0) { itemsAddedWithoutNotify = 0; notifyDataSetChanged(); // This is incase getCount is called between our data set updates, which triggers IllegalStateException, listView does a simple if (mItemCount != mAdapter.getCount()) { } return itemsSize; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getCount"
"@Override public int getCount() { if (itemsAddedWithoutNotify > 0) { <MASK>notifyDataSetChanged(); // This is incase getCount is called between our data set updates, which triggers IllegalStateException, listView does a simple if (mItemCount != mAdapter.getCount()) {</MASK> itemsAddedWithoutNotify = 0; } return itemsSize; }"
Inversion-Mutation
megadiff
"protected void verifyTrustInCerts( X509Certificate[] certificates, Crypto crypto, RequestData data, boolean enableRevocation ) throws WSSecurityException { // // Use the validation method from the crypto to check whether the subjects' // certificate was really signed by the issuer stated in the certificate // crypto.verifyTrust(certificates, enableRevocation); if (LOG.isDebugEnabled()) { String subjectString = certificates[0].getSubjectX500Principal().getName(); LOG.debug( "Certificate path has been verified for certificate with subject " + subjectString ); } Collection<Pattern> subjectCertConstraints = data.getSubjectCertConstraints(); if (!matches(certificates[0], subjectCertConstraints)) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "verifyTrustInCerts"
"protected void verifyTrustInCerts( X509Certificate[] certificates, Crypto crypto, RequestData data, boolean enableRevocation ) throws WSSecurityException { <MASK>String subjectString = certificates[0].getSubjectX500Principal().getName();</MASK> // // Use the validation method from the crypto to check whether the subjects' // certificate was really signed by the issuer stated in the certificate // crypto.verifyTrust(certificates, enableRevocation); if (LOG.isDebugEnabled()) { LOG.debug( "Certificate path has been verified for certificate with subject " + subjectString ); } Collection<Pattern> subjectCertConstraints = data.getSubjectCertConstraints(); if (!matches(certificates[0], subjectCertConstraints)) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); } }"
Inversion-Mutation
megadiff
"private List<Mutant> generateMutants(JavaClass clazz, Method bcelMethod, EMutationOperator operator) throws ClassNotFoundException { List<Mutant> mutants = new ArrayList<Mutant>(); Set<EMutationInstruction> instructions = operator.getInstructions(); if (instructions == null || instructions.size() == 0) return mutants; Code code = bcelMethod.getCode(); if (code == null) return mutants; InstructionList bcelInstructions = new InstructionList(bcelMethod.getCode().getCode()); InstructionFinder finder = new InstructionFinder(bcelInstructions); for (EMutationInstruction instruction : instructions) { Iterator instructionIterator = finder.search(instruction.name()); while (instructionIterator.hasNext()) { InstructionHandle[] handles = (InstructionHandle[]) instructionIterator.next(); IMutator mutator = mutatorRepository.getMutator(instruction); Instruction originalInstruction = handles[0].getInstruction().copy(); mutator.performMutation(handles[0]); ClassGen classGen = new ClassGen(clazz); MethodGen methodGen = new MethodGen(bcelMethod, clazz.getClassName(), classGen.getConstantPool()); methodGen.setInstructionList(bcelInstructions); classGen.replaceMethod(bcelMethod, methodGen.getMethod()); SourceCodeMapping sourceCodeMapping = new SourceCodeMapping(); sourceCodeMapping.setClassName(clazz.getClassName()); sourceCodeMapping.setSourceFile(clazz.getSourceFileName()); sourceCodeMapping.setLineNo(bcelMethod.getCode().getLineNumberTable().getSourceLine( handles[0].getPosition())); Mutant newMutant = new Mutant(); newMutant.setClassName(clazz.getClassName()); newMutant.setSourceMapping(sourceCodeMapping); newMutant.setByteCode(classGen.getJavaClass().getBytes()); newMutant.setMutationType(operator); newMutant.setMutationOperator(mutator.getMutationOperator()); mutants.add(newMutant); handles[0].setInstruction(originalInstruction); } } bcelInstructions.dispose(); return mutants; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "generateMutants"
"private List<Mutant> generateMutants(JavaClass clazz, Method bcelMethod, EMutationOperator operator) throws ClassNotFoundException { List<Mutant> mutants = new ArrayList<Mutant>(); Set<EMutationInstruction> instructions = operator.getInstructions(); if (instructions == null || instructions.size() == 0) return mutants; Code code = bcelMethod.getCode(); if (code == null) return mutants; InstructionList bcelInstructions = new InstructionList(bcelMethod.getCode().getCode()); InstructionFinder finder = new InstructionFinder(bcelInstructions); for (EMutationInstruction instruction : instructions) { Iterator instructionIterator = finder.search(instruction.name()); while (instructionIterator.hasNext()) { InstructionHandle[] handles = (InstructionHandle[]) instructionIterator.next(); IMutator mutator = mutatorRepository.getMutator(instruction); Instruction originalInstruction = handles[0].getInstruction().copy(); mutator.performMutation(handles[0]); ClassGen classGen = new ClassGen(clazz); MethodGen methodGen = new MethodGen(bcelMethod, clazz.getClassName(), classGen.getConstantPool()); methodGen.setInstructionList(bcelInstructions); classGen.replaceMethod(bcelMethod, methodGen.getMethod()); SourceCodeMapping sourceCodeMapping = new SourceCodeMapping(); sourceCodeMapping.setClassName(clazz.getClassName()); sourceCodeMapping.setSourceFile(clazz.getSourceFileName()); sourceCodeMapping.setLineNo(bcelMethod.getCode().getLineNumberTable().getSourceLine( handles[0].getPosition())); Mutant newMutant = new Mutant(); newMutant.setClassName(clazz.getClassName()); newMutant.setSourceMapping(sourceCodeMapping); newMutant.setByteCode(classGen.getJavaClass().getBytes()); newMutant.setMutationType(operator); newMutant.setMutationOperator(mutator.getMutationOperator()); mutants.add(newMutant); handles[0].setInstruction(originalInstruction); } <MASK>bcelInstructions.dispose();</MASK> } return mutants; }"
Inversion-Mutation
megadiff
"public void add(String cmd) { if (cmd != null && !cmd.equals("") && (cmds.size() == 0 || !cmds.get(cmds.size() - 1).equals(cmd))) { cmds.add(cmd); } pos = cmds.size(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "add"
"public void add(String cmd) { if (cmd != null && !cmd.equals("") && (cmds.size() == 0 || !cmds.get(cmds.size() - 1).equals(cmd))) { cmds.add(cmd); <MASK>pos = cmds.size();</MASK> } }"
Inversion-Mutation
megadiff
"public void removeItem(Item item) { int amount = item.getAmount(); int itemId = item.getItemId(); for (int i = 0; getArray().length > i; i++) { if (getArray()[i] == null) continue; if (getArray()[i].c == itemId) { int tempAmount = getArray()[i].a; tempAmount -= amount; amount -= getArray()[i].a; if (tempAmount <= 0) { getArray()[i] = null; } else { getArray()[i].a = tempAmount; } if (amount <= 0) return; } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "removeItem"
"public void removeItem(Item item) { int amount = item.getAmount(); int itemId = item.getItemId(); for (int i = 0; getArray().length > i; i++) { if (getArray()[i] == null) continue; if (getArray()[i].c == itemId) { int tempAmount = getArray()[i].a; tempAmount -= amount; if (tempAmount <= 0) { <MASK>amount -= getArray()[i].a;</MASK> getArray()[i] = null; } else { getArray()[i].a = tempAmount; } if (amount <= 0) return; } } }"
Inversion-Mutation
megadiff
"@Override protected Boolean doInBackgroundInternal(Geocache[] caches) { final StringBuilder fieldNoteBuffer = new StringBuilder(); try { int i = 0; for (final Geocache cache : caches) { if (cache.isLogOffline()) { final LogEntry log = cgData.loadLogOffline(cache.getGeocode()); if (!onlyNew || onlyNew && log.date > Settings.getFieldnoteExportDate()) { appendFieldNote(fieldNoteBuffer, cache, log); } } publishProgress(++i); } } catch (final Exception e) { Log.e("FieldnoteExport.ExportTask generation", e); return false; } fieldNoteBuffer.append('\n'); if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { return false; } exportLocation.mkdirs(); final SimpleDateFormat fileNameDateFormat = new SimpleDateFormat("yyyyMMddHHmmss", Locale.US); exportFile = new File(exportLocation.toString() + '/' + fileNameDateFormat.format(new Date()) + ".txt"); Writer fileWriter = null; BufferedOutputStream buffer = null; try { final OutputStream os = new FileOutputStream(exportFile); buffer = new BufferedOutputStream(os); fileWriter = new OutputStreamWriter(buffer, CharEncoding.UTF_16); fileWriter.write(fieldNoteBuffer.toString()); } catch (final IOException e) { Log.e("FieldnoteExport.ExportTask export", e); return false; } finally { IOUtils.closeQuietly(fileWriter); IOUtils.closeQuietly(buffer); } if (upload) { publishProgress(STATUS_UPLOAD); if (!Login.isActualLoginStatus()) { // no need to upload (possibly large file) if we're not logged in final StatusCode loginState = Login.login(); if (loginState != StatusCode.NO_ERROR) { Log.e("FieldnoteExport.ExportTask upload: Login failed"); } } final String uri = "http://www.geocaching.com/my/uploadfieldnotes.aspx"; final String page = Login.getRequestLogged(uri, null); if (StringUtils.isBlank(page)) { Log.e("FieldnoteExport.ExportTask get page: No data from server"); return false; } final String[] viewstates = Login.getViewstates(page); final Parameters uploadParams = new Parameters( "__EVENTTARGET", "", "__EVENTARGUMENT", "", "ctl00$ContentBody$btnUpload", "Upload Field Note"); Login.putViewstates(uploadParams, viewstates); Network.getResponseData(Network.postRequest(uri, uploadParams, "ctl00$ContentBody$FieldNoteLoader", "text/plain", exportFile)); if (StringUtils.isBlank(page)) { Log.e("FieldnoteExport.ExportTask upload: No data from server"); return false; } } return true; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "doInBackgroundInternal"
"@Override protected Boolean doInBackgroundInternal(Geocache[] caches) { final StringBuilder fieldNoteBuffer = new StringBuilder(); try { int i = 0; for (final Geocache cache : caches) { if (cache.isLogOffline()) { final LogEntry log = cgData.loadLogOffline(cache.getGeocode()); if (!onlyNew || onlyNew && log.date > Settings.getFieldnoteExportDate()) { appendFieldNote(fieldNoteBuffer, cache, log); } <MASK>publishProgress(++i);</MASK> } } } catch (final Exception e) { Log.e("FieldnoteExport.ExportTask generation", e); return false; } fieldNoteBuffer.append('\n'); if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { return false; } exportLocation.mkdirs(); final SimpleDateFormat fileNameDateFormat = new SimpleDateFormat("yyyyMMddHHmmss", Locale.US); exportFile = new File(exportLocation.toString() + '/' + fileNameDateFormat.format(new Date()) + ".txt"); Writer fileWriter = null; BufferedOutputStream buffer = null; try { final OutputStream os = new FileOutputStream(exportFile); buffer = new BufferedOutputStream(os); fileWriter = new OutputStreamWriter(buffer, CharEncoding.UTF_16); fileWriter.write(fieldNoteBuffer.toString()); } catch (final IOException e) { Log.e("FieldnoteExport.ExportTask export", e); return false; } finally { IOUtils.closeQuietly(fileWriter); IOUtils.closeQuietly(buffer); } if (upload) { publishProgress(STATUS_UPLOAD); if (!Login.isActualLoginStatus()) { // no need to upload (possibly large file) if we're not logged in final StatusCode loginState = Login.login(); if (loginState != StatusCode.NO_ERROR) { Log.e("FieldnoteExport.ExportTask upload: Login failed"); } } final String uri = "http://www.geocaching.com/my/uploadfieldnotes.aspx"; final String page = Login.getRequestLogged(uri, null); if (StringUtils.isBlank(page)) { Log.e("FieldnoteExport.ExportTask get page: No data from server"); return false; } final String[] viewstates = Login.getViewstates(page); final Parameters uploadParams = new Parameters( "__EVENTTARGET", "", "__EVENTARGUMENT", "", "ctl00$ContentBody$btnUpload", "Upload Field Note"); Login.putViewstates(uploadParams, viewstates); Network.getResponseData(Network.postRequest(uri, uploadParams, "ctl00$ContentBody$FieldNoteLoader", "text/plain", exportFile)); if (StringUtils.isBlank(page)) { Log.e("FieldnoteExport.ExportTask upload: No data from server"); return false; } } return true; }"
Inversion-Mutation
megadiff
"@Override protected void processUnsolicited (Parcel p) { Object ret; int dataPosition = p.dataPosition(); // save off position within the Parcel int response = p.readInt(); switch(response) { case RIL_UNSOL_RIL_CONNECTED: // Fix for NV/RUIM setting on CDMA SIM devices // skip getcdmascriptionsource as if qualcomm handles it in the ril binary ret = responseInts(p); setRadioPower(false, null); setPreferredNetworkType(mPreferredNetworkType, null); notifyRegistrantsRilConnectionChanged(((int[])ret)[0]); isGSM = (mPhoneType != RILConstants.CDMA_PHONE); samsungDriverCall = (needsOldRilFeature("newDriverCall") && !isGSM) || mRilVersion < 7 ? false : true; break; case RIL_UNSOL_NITZ_TIME_RECEIVED: handleNitzTimeReceived(p); break; default: // Rewind the Parcel p.setDataPosition(dataPosition); // Forward responses that we are not overriding to the super class super.processUnsolicited(p); return; } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "processUnsolicited"
"@Override protected void processUnsolicited (Parcel p) { Object ret; int dataPosition = p.dataPosition(); // save off position within the Parcel int response = p.readInt(); switch(response) { case RIL_UNSOL_RIL_CONNECTED: // Fix for NV/RUIM setting on CDMA SIM devices // skip getcdmascriptionsource as if qualcomm handles it in the ril binary ret = responseInts(p); setRadioPower(false, null); setPreferredNetworkType(mPreferredNetworkType, null); notifyRegistrantsRilConnectionChanged(((int[])ret)[0]); <MASK>samsungDriverCall = (needsOldRilFeature("newDriverCall") && !isGSM) || mRilVersion < 7 ? false : true;</MASK> isGSM = (mPhoneType != RILConstants.CDMA_PHONE); break; case RIL_UNSOL_NITZ_TIME_RECEIVED: handleNitzTimeReceived(p); break; default: // Rewind the Parcel p.setDataPosition(dataPosition); // Forward responses that we are not overriding to the super class super.processUnsolicited(p); return; } }"
Inversion-Mutation
megadiff
"protected void installAuthHeader(SOAPMessageContext context) { Map<String, List<String>> httpResponseHeaders = getHttpResponseHeaders(context); if (httpResponseHeaders == null) { httpResponseHeaders = new HashMap<String, List<String>>(); } List<String> basicAuthToken = new LinkedList<String>(); basicAuthToken.add("Basic realm=\"" + getRealm() + "\""); httpResponseHeaders.put("WWW-Authenticate", basicAuthToken); context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_UNAUTHORIZED); context.put(MessageContext.HTTP_RESPONSE_HEADERS, httpResponseHeaders); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "installAuthHeader"
"protected void installAuthHeader(SOAPMessageContext context) { Map<String, List<String>> httpResponseHeaders = getHttpResponseHeaders(context); if (httpResponseHeaders == null) { httpResponseHeaders = new HashMap<String, List<String>>(); } List<String> basicAuthToken = new LinkedList<String>(); basicAuthToken.add("Basic realm=\"" + getRealm() + "\""); httpResponseHeaders.put("WWW-Authenticate", basicAuthToken); <MASK>context.put(MessageContext.HTTP_RESPONSE_HEADERS, httpResponseHeaders);</MASK> context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_UNAUTHORIZED); }"
Inversion-Mutation
megadiff
"public static void spout(Player player) { WaterSpout spout = instances.get(player); player.setSprinting(false); // if (player.getVelocity().length() > threshold) { // // Tools.verbose("Too fast!"); // player.setVelocity(player.getVelocity().clone().normalize() // .multiply(threshold * .5)); // } player.removePotionEffect(PotionEffectType.SPEED); Location location = player.getLocation().clone().add(0, .2, 0); Block block = location.clone().getBlock(); int height = spoutableWaterHeight(location, player); // Tools.verbose(height + " " + WaterSpout.height + " " // + affectedblocks.size()); if (height != -1) { location = spout.base.getLocation(); for (int i = 1; i <= height; i++) { block = location.clone().add(0, i, 0).getBlock(); if (!TempBlock.isTempBlock(block)) { new TempBlock(block, Material.WATER, full); } // block.setType(Material.WATER); // block.setData(full); if (!affectedblocks.containsKey(block)) { affectedblocks.put(block, block); } newaffectedblocks.put(block, block); } if (player.getLocation().getBlockY() > block.getY()) { player.setFlying(false); } else { player.setFlying(true); } } else { instances.get(player).remove(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "spout"
"public static void spout(Player player) { WaterSpout spout = instances.get(player); player.setSprinting(false); // if (player.getVelocity().length() > threshold) { // // Tools.verbose("Too fast!"); // player.setVelocity(player.getVelocity().clone().normalize() // .multiply(threshold * .5)); // } player.removePotionEffect(PotionEffectType.SPEED); Location location = player.getLocation().clone().add(0, .2, 0); Block block = location.clone().getBlock(); int height = spoutableWaterHeight(location, player); <MASK>location = spout.base.getLocation();</MASK> // Tools.verbose(height + " " + WaterSpout.height + " " // + affectedblocks.size()); if (height != -1) { for (int i = 1; i <= height; i++) { block = location.clone().add(0, i, 0).getBlock(); if (!TempBlock.isTempBlock(block)) { new TempBlock(block, Material.WATER, full); } // block.setType(Material.WATER); // block.setData(full); if (!affectedblocks.containsKey(block)) { affectedblocks.put(block, block); } newaffectedblocks.put(block, block); } if (player.getLocation().getBlockY() > block.getY()) { player.setFlying(false); } else { player.setFlying(true); } } else { instances.get(player).remove(); } }"
Inversion-Mutation
megadiff
"protected final Watchers getWatches(NotifyType type) throws OrmException { Watchers matching = new Watchers(); Set<Account.Id> projectWatchers = new HashSet<Account.Id>(); for (AccountProjectWatch w : args.db.get().accountProjectWatches() .byProject(change.getProject())) { if (w.isNotify(type)) { projectWatchers.add(w.getAccountId()); add(matching, w); } } for (AccountProjectWatch w : args.db.get().accountProjectWatches() .byProject(args.allProjectsName)) { if (!projectWatchers.contains(w.getAccountId()) && w.isNotify(type)) { add(matching, w); } } ProjectState state = projectState; while (state != null) { for (NotifyConfig nc : state.getConfig().getNotifyConfigs()) { if (nc.isNotify(type)) { try { add(matching, nc, state.getProject().getNameKey()); } catch (QueryParseException e) { log.warn(String.format( "Project %s has invalid notify %s filter \"%s\": %s", state.getProject().getName(), nc.getName(), nc.getFilter(), e.getMessage())); } } } state = state.getParentState(); } return matching; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getWatches"
"protected final Watchers getWatches(NotifyType type) throws OrmException { Watchers matching = new Watchers(); Set<Account.Id> projectWatchers = new HashSet<Account.Id>(); for (AccountProjectWatch w : args.db.get().accountProjectWatches() .byProject(change.getProject())) { <MASK>projectWatchers.add(w.getAccountId());</MASK> if (w.isNotify(type)) { add(matching, w); } } for (AccountProjectWatch w : args.db.get().accountProjectWatches() .byProject(args.allProjectsName)) { if (!projectWatchers.contains(w.getAccountId()) && w.isNotify(type)) { add(matching, w); } } ProjectState state = projectState; while (state != null) { for (NotifyConfig nc : state.getConfig().getNotifyConfigs()) { if (nc.isNotify(type)) { try { add(matching, nc, state.getProject().getNameKey()); } catch (QueryParseException e) { log.warn(String.format( "Project %s has invalid notify %s filter \"%s\": %s", state.getProject().getName(), nc.getName(), nc.getFilter(), e.getMessage())); } } } state = state.getParentState(); } return matching; }"
Inversion-Mutation
megadiff
"@Override protected void onDestroy() { super.onDestroy(); if(!m_isRetainingNonConfig) { try { m_model.close(); } catch (IOException e) { } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "onDestroy"
"@Override protected void onDestroy() { if(!m_isRetainingNonConfig) { try { m_model.close(); } catch (IOException e) { } } <MASK>super.onDestroy();</MASK> }"
Inversion-Mutation
megadiff
"public void sceMpegRingbufferAvailableSize(Processor processor) { CpuState cpu = processor.cpu; // New-Style Processor // Processor cpu = processor; // Old-Style Processor Memory mem = Processor.memory; int ringbuffer_addr = cpu.gpr[4]; if (enableMpeg) { SceMpegRingbuffer ringbuffer = SceMpegRingbuffer.fromMem(mem, ringbuffer_addr); cpu.gpr[2] = ringbuffer.packetsFree; Modules.log.debug("sceMpegRingbufferAvailableSize(ringbuffer=0x" + Integer.toHexString(ringbuffer_addr) + ") ret:" + cpu.gpr[2]); } else { cpu.gpr[2] = 0; // fake Modules.log.warn("IGNORING:sceMpegRingbufferAvailableSize(ringbuffer=0x" + Integer.toHexString(ringbuffer_addr) + ") ret:" + cpu.gpr[2]); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "sceMpegRingbufferAvailableSize"
"public void sceMpegRingbufferAvailableSize(Processor processor) { CpuState cpu = processor.cpu; // New-Style Processor // Processor cpu = processor; // Old-Style Processor Memory mem = Processor.memory; int ringbuffer_addr = cpu.gpr[4]; if (enableMpeg) { SceMpegRingbuffer ringbuffer = SceMpegRingbuffer.fromMem(mem, ringbuffer_addr); cpu.gpr[2] = ringbuffer.packetsFree; Modules.log.debug("sceMpegRingbufferAvailableSize(ringbuffer=0x" + Integer.toHexString(ringbuffer_addr) + ") ret:" + cpu.gpr[2]); } else { Modules.log.warn("IGNORING:sceMpegRingbufferAvailableSize(ringbuffer=0x" + Integer.toHexString(ringbuffer_addr) + ") ret:" + cpu.gpr[2]); <MASK>cpu.gpr[2] = 0; // fake</MASK> } }"
Inversion-Mutation
megadiff
"private static void createFormComponent(final SchemaField field, final HtmlViewContentForm iForm, final Object fieldValue) { final AreaComponent areaForRendering = iForm.searchAreaForRendering(field.getFeature(ViewFieldFeatures.POSITION), field); if (areaForRendering == null) { return; } SchemaObject newSchemaObject = Roma.session().getSchemaObject(fieldValue); final HtmlViewConfigurableEntityForm newComponent = new HtmlViewConfigurableEntityForm(iForm, newSchemaObject, field, iForm.getScreenAreaObject(), null, null, null); if (areaForRendering instanceof HtmlViewFormArea) { if (iForm.getFieldComponent(field.getName()) == null) { ((HtmlViewFormArea) areaForRendering).addComponent(newComponent); } } else { final HtmlViewScreenArea screenArea = (HtmlViewScreenArea) areaForRendering; try { screenArea.bindForm(newComponent); } catch (final Exception e) { // TODO remove log.error("Cannot retrieve the container component", e); } } iForm.addChild(field.getName(), areaForRendering, newComponent); newComponent.setContent(fieldValue); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "createFormComponent"
"private static void createFormComponent(final SchemaField field, final HtmlViewContentForm iForm, final Object fieldValue) { final AreaComponent areaForRendering = iForm.searchAreaForRendering(field.getFeature(ViewFieldFeatures.POSITION), field); if (areaForRendering == null) { return; } SchemaObject newSchemaObject = Roma.session().getSchemaObject(fieldValue); final HtmlViewConfigurableEntityForm newComponent = new HtmlViewConfigurableEntityForm(iForm, newSchemaObject, field, iForm.getScreenAreaObject(), null, null, null); <MASK>newComponent.setContent(fieldValue);</MASK> if (areaForRendering instanceof HtmlViewFormArea) { if (iForm.getFieldComponent(field.getName()) == null) { ((HtmlViewFormArea) areaForRendering).addComponent(newComponent); } } else { final HtmlViewScreenArea screenArea = (HtmlViewScreenArea) areaForRendering; try { screenArea.bindForm(newComponent); } catch (final Exception e) { // TODO remove log.error("Cannot retrieve the container component", e); } } iForm.addChild(field.getName(), areaForRendering, newComponent); }"
Inversion-Mutation
megadiff
"public Object put(Object key, Object value) { Object oldValue = null; if (test != null) { oldValue = delegate.put(key, value); Object result = null; if (test.getMaximumNumberOfParameters() == 2) { result = test.call(new Object[] {key, value}); } else { result = test.call(value); } if (result != null && result instanceof Boolean && ((Boolean) result).booleanValue()) { if (oldValue != value) { pcs.firePropertyChange(String.valueOf(key), oldValue, value); } } } else { oldValue = delegate.put(key, value); if (oldValue != value) { pcs.firePropertyChange(String.valueOf(key), oldValue, value); } } return oldValue; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "put"
"public Object put(Object key, Object value) { Object oldValue = null; if (test != null) { Object result = null; if (test.getMaximumNumberOfParameters() == 2) { result = test.call(new Object[] {key, value}); } else { result = test.call(value); } if (result != null && result instanceof Boolean && ((Boolean) result).booleanValue()) { <MASK>oldValue = delegate.put(key, value);</MASK> if (oldValue != value) { pcs.firePropertyChange(String.valueOf(key), oldValue, value); } } } else { <MASK>oldValue = delegate.put(key, value);</MASK> if (oldValue != value) { pcs.firePropertyChange(String.valueOf(key), oldValue, value); } } return oldValue; }"
Inversion-Mutation
megadiff
"private void close(){ AppMgr.saveSettings(); ProjectMgr.closeProject(); dispose(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "close"
"private void close(){ <MASK>ProjectMgr.closeProject();</MASK> AppMgr.saveSettings(); dispose(); }"
Inversion-Mutation
megadiff
"public void handleTableContentPosition(TableContentPosition tcpos) { log.debug("===handleTableContentPosition(" + tcpos); if (lastRow != tcpos.row && lastRow != null) { addAreasAndFlushRow(false); yoffset += lastRowHeight; this.accumulatedBPD += lastRowHeight; } rowFO = null; lastRow = tcpos.row; Iterator partIter = tcpos.gridUnitParts.iterator(); //Iterate over all grid units in the current step while (partIter.hasNext()) { GridUnitPart gup = (GridUnitPart)partIter.next(); log.debug(">" + gup); int colIndex = gup.pgu.getStartCol(); if (gridUnits[colIndex] != gup.pgu) { gridUnits[colIndex] = gup.pgu; start[colIndex] = gup.start; end[colIndex] = gup.end; } else { if (gup.end < end[colIndex]) { throw new IllegalStateException("Internal Error: stepper problem"); } end[colIndex] = gup.end; } if (rowFO == null) { //Find the row if any rowFO = gridUnits[colIndex].getRow(); } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "handleTableContentPosition"
"public void handleTableContentPosition(TableContentPosition tcpos) { log.debug("===handleTableContentPosition(" + tcpos); <MASK>rowFO = null;</MASK> if (lastRow != tcpos.row && lastRow != null) { addAreasAndFlushRow(false); yoffset += lastRowHeight; this.accumulatedBPD += lastRowHeight; } lastRow = tcpos.row; Iterator partIter = tcpos.gridUnitParts.iterator(); //Iterate over all grid units in the current step while (partIter.hasNext()) { GridUnitPart gup = (GridUnitPart)partIter.next(); log.debug(">" + gup); int colIndex = gup.pgu.getStartCol(); if (gridUnits[colIndex] != gup.pgu) { gridUnits[colIndex] = gup.pgu; start[colIndex] = gup.start; end[colIndex] = gup.end; } else { if (gup.end < end[colIndex]) { throw new IllegalStateException("Internal Error: stepper problem"); } end[colIndex] = gup.end; } if (rowFO == null) { //Find the row if any rowFO = gridUnits[colIndex].getRow(); } } }"
Inversion-Mutation
megadiff
"public void build() throws Exception { names = new Hashtable(); int access = superclass.getModifiers(); if ((access & Modifier.FINAL) != 0) { throw new InstantiationException("can't subclass final class"); } access = Modifier.PUBLIC | Modifier.SYNCHRONIZED; classfile = new ClassFile(myClass, mapClass(superclass), access); addProxy(); addConstructors(superclass); classfile.addInterface("org/python/core/PyProxy"); Hashtable seenmethods = new Hashtable(); addMethods(superclass, seenmethods); for (int i=0; i<interfaces.length; i++) { if (interfaces[i].isAssignableFrom(superclass)) { Py.writeWarning("compiler", "discarding redundant interface: "+ interfaces[i].getName()); continue; } classfile.addInterface(mapClass(interfaces[i])); addMethods(interfaces[i], seenmethods); } doConstants(); addClassDictInit(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "build"
"public void build() throws Exception { names = new Hashtable(); int access = superclass.getModifiers(); if ((access & Modifier.FINAL) != 0) { throw new InstantiationException("can't subclass final class"); } access = Modifier.PUBLIC | Modifier.SYNCHRONIZED; classfile = new ClassFile(myClass, mapClass(superclass), access); addProxy(); addConstructors(superclass); classfile.addInterface("org/python/core/PyProxy"); Hashtable seenmethods = new Hashtable(); for (int i=0; i<interfaces.length; i++) { if (interfaces[i].isAssignableFrom(superclass)) { Py.writeWarning("compiler", "discarding redundant interface: "+ interfaces[i].getName()); continue; } classfile.addInterface(mapClass(interfaces[i])); addMethods(interfaces[i], seenmethods); } <MASK>addMethods(superclass, seenmethods);</MASK> doConstants(); addClassDictInit(); }"
Inversion-Mutation
megadiff
"public void testActionLinkReferences() throws Throwable { myFixture.copyFileToProject("/WEB-INF/web.xml"); createStrutsFileSet("struts-actionLink.xml"); checkActionReference("/jsp/actionLink-reference_1.jsp", "actionLink1"); checkActionReference("/jsp/actionLink-reference_2.jsp", "rootActionLink"); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "testActionLinkReferences"
"public void testActionLinkReferences() throws Throwable { <MASK>createStrutsFileSet("struts-actionLink.xml");</MASK> myFixture.copyFileToProject("/WEB-INF/web.xml"); checkActionReference("/jsp/actionLink-reference_1.jsp", "actionLink1"); checkActionReference("/jsp/actionLink-reference_2.jsp", "rootActionLink"); }"
Inversion-Mutation
megadiff
"public void moveNode(OwnerStreamNode n, SuccessCallback cb) { mOwner = n; moveNodeByIndex(mOwner.getIndex(), cb); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "moveNode"
"public void moveNode(OwnerStreamNode n, SuccessCallback cb) { <MASK>moveNodeByIndex(mOwner.getIndex(), cb);</MASK> mOwner = n; }"
Inversion-Mutation
megadiff
"private void createNetworkGame() throws GameException, IOException { game = new NetworkGame(); Player p = null; if(uiNewGamePanel.network_type == UIResourcesLoader.SERVER_GAME) { gServer = new GameServer(); gClient = new GameClient(Token.PLAYER_1); p = new HumanPlayer("Player1", Token.PLAYER_1, Game.NUM_PIECES_PER_PLAYER); // display IP addresses Enumeration<NetworkInterface> nets; try { nets = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netint : Collections.list(nets)) { Enumeration<InetAddress> inetAddresses = netint.getInetAddresses(); for (InetAddress inetAddress : Collections.list(inetAddresses)) { Log.info(inetAddress.toString()); } } } catch (SocketException e) { e.printStackTrace(); } } else if(uiNewGamePanel.network_type == UIResourcesLoader.CLIENT_GAME) { gClient = new GameClient(Token.PLAYER_2); p = new HumanPlayer("Player2", Token.PLAYER_2, Game.NUM_PIECES_PER_PLAYER); } ((NetworkGame)game).setPlayer(p); int numberTries = 15; if(gServer == null) { // this is only a client trying to connect while(true) { System.out.println("Connect to GameServer at IP address: "); String ip = JOptionPane.showInputDialog(null, "Connect to GameServer at IP address:","localhost"); try { if(ip != null) { gClient.connectToServer(ip); break; } } catch (Exception e){ Log.info("No GameServer detected!"); if(--numberTries == 0) { System.out.println("Giving up!"); // TODO improve this } try { Thread.sleep(1000); } catch (InterruptedException e1) { e1.printStackTrace(); } Log.info("Trying another connection."); } } } else { // this computer has the GameServer gClient.connectToServer("localhost"); while(true) { if(gServer.hasConnectionEstablished()){ break; } if(numberTries-- == 15) { Log.info("Server initialized. Waiting for connection from GameClient of this computer"); } try { Thread.sleep(50); } catch (InterruptedException e1) { e1.printStackTrace(); } } } while(gClient.isWaitingForGameStart()) { Log.info("Waiting for game to start"); try { Thread.sleep(200); } catch (InterruptedException e1) { e1.printStackTrace(); } } turnPlayer = uiResourcesLoader.getPlayerTurn(gClient.getPlayerThatPlaysFirst()); repaint(); Log.info("Game is starting"); if(gClient.getPlayerThatPlaysFirst() == p.getPlayerToken()) { Log.info("I'm the one who plays first"); ((NetworkGame)game).setTurn(true); } new Thread(new Runnable(){ @Override public void run() { while(true) { if(!((NetworkGame)game).isThisPlayerTurn()) { try { Thread.sleep(100); } catch (InterruptedException e1) { e1.printStackTrace(); } if(gClient.isThisPlayerTurn()) { // update game with opponent moves try { ArrayList<Move> opponentMoves = gClient.getOpponentMoves(); ((NetworkGame)game).updateGameWithOpponentMoves(opponentMoves); } catch (GameException e) { e.printStackTrace(); System.exit(-1); } } repaint(); ((NetworkGame)game).setTurn(true); } } } }).start(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "createNetworkGame"
"private void createNetworkGame() throws GameException, IOException { game = new NetworkGame(); Player p = null; if(uiNewGamePanel.network_type == UIResourcesLoader.SERVER_GAME) { gServer = new GameServer(); gClient = new GameClient(Token.PLAYER_1); p = new HumanPlayer("Player1", Token.PLAYER_1, Game.NUM_PIECES_PER_PLAYER); // display IP addresses Enumeration<NetworkInterface> nets; try { nets = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netint : Collections.list(nets)) { Enumeration<InetAddress> inetAddresses = netint.getInetAddresses(); for (InetAddress inetAddress : Collections.list(inetAddresses)) { Log.info(inetAddress.toString()); } } } catch (SocketException e) { e.printStackTrace(); } } else if(uiNewGamePanel.network_type == UIResourcesLoader.CLIENT_GAME) { gClient = new GameClient(Token.PLAYER_2); p = new HumanPlayer("Player2", Token.PLAYER_2, Game.NUM_PIECES_PER_PLAYER); } ((NetworkGame)game).setPlayer(p); int numberTries = 15; if(gServer == null) { // this is only a client trying to connect while(true) { System.out.println("Connect to GameServer at IP address: "); String ip = JOptionPane.showInputDialog(null, "Connect to GameServer at IP address:","localhost"); try { if(ip != null) { gClient.connectToServer(ip); break; } } catch (Exception e){ Log.info("No GameServer detected!"); if(--numberTries == 0) { System.out.println("Giving up!"); // TODO improve this } try { Thread.sleep(1000); } catch (InterruptedException e1) { e1.printStackTrace(); } Log.info("Trying another connection."); } } } else { // this computer has the GameServer gClient.connectToServer("localhost"); while(true) { if(gServer.hasConnectionEstablished()){ break; } if(numberTries-- == 15) { Log.info("Server initialized. Waiting for connection from GameClient of this computer"); } try { Thread.sleep(50); } catch (InterruptedException e1) { e1.printStackTrace(); } } } while(gClient.isWaitingForGameStart()) { Log.info("Waiting for game to start"); try { Thread.sleep(200); } catch (InterruptedException e1) { e1.printStackTrace(); } } turnPlayer = uiResourcesLoader.getPlayerTurn(gClient.getPlayerThatPlaysFirst()); repaint(); Log.info("Game is starting"); if(gClient.getPlayerThatPlaysFirst() == p.getPlayerToken()) { Log.info("I'm the one who plays first"); <MASK>((NetworkGame)game).setTurn(true);</MASK> } new Thread(new Runnable(){ @Override public void run() { while(true) { if(!((NetworkGame)game).isThisPlayerTurn()) { try { Thread.sleep(100); } catch (InterruptedException e1) { e1.printStackTrace(); } if(gClient.isThisPlayerTurn()) { // update game with opponent moves try { ArrayList<Move> opponentMoves = gClient.getOpponentMoves(); ((NetworkGame)game).updateGameWithOpponentMoves(opponentMoves); } catch (GameException e) { e.printStackTrace(); System.exit(-1); } } <MASK>((NetworkGame)game).setTurn(true);</MASK> repaint(); } } } }).start(); }"
Inversion-Mutation
megadiff
"@Override public void run() { while(true) { if(!((NetworkGame)game).isThisPlayerTurn()) { try { Thread.sleep(100); } catch (InterruptedException e1) { e1.printStackTrace(); } if(gClient.isThisPlayerTurn()) { // update game with opponent moves try { ArrayList<Move> opponentMoves = gClient.getOpponentMoves(); ((NetworkGame)game).updateGameWithOpponentMoves(opponentMoves); } catch (GameException e) { e.printStackTrace(); System.exit(-1); } } repaint(); ((NetworkGame)game).setTurn(true); } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "run"
"@Override public void run() { while(true) { if(!((NetworkGame)game).isThisPlayerTurn()) { try { Thread.sleep(100); } catch (InterruptedException e1) { e1.printStackTrace(); } if(gClient.isThisPlayerTurn()) { // update game with opponent moves try { ArrayList<Move> opponentMoves = gClient.getOpponentMoves(); ((NetworkGame)game).updateGameWithOpponentMoves(opponentMoves); } catch (GameException e) { e.printStackTrace(); System.exit(-1); } } <MASK>((NetworkGame)game).setTurn(true);</MASK> repaint(); } } }"
Inversion-Mutation
megadiff
"public TalkingLine() { condPar = new ArrayList<ConditionParser>(); consPar = new ArrayList<ConsequenceParser>(); condPar.add(new illarion.easynpc.parser.talk.conditions.State()); condPar.add(new illarion.easynpc.parser.talk.conditions.Skill()); condPar.add(new illarion.easynpc.parser.talk.conditions.Attribute()); condPar.add(new illarion.easynpc.parser.talk.conditions.MagicType()); condPar.add(new illarion.easynpc.parser.talk.conditions.Money()); condPar.add(new illarion.easynpc.parser.talk.conditions.Race()); condPar.add(new illarion.easynpc.parser.talk.conditions.Rank()); condPar.add(new illarion.easynpc.parser.talk.conditions.Queststatus()); condPar.add(new illarion.easynpc.parser.talk.conditions.Item()); condPar.add(new illarion.easynpc.parser.talk.conditions.Language()); condPar.add(new illarion.easynpc.parser.talk.conditions.Chance()); condPar.add(new illarion.easynpc.parser.talk.conditions.Town()); condPar.add(new illarion.easynpc.parser.talk.conditions.TalkMode()); condPar.add(new illarion.easynpc.parser.talk.conditions.Sex()); condPar.add(new illarion.easynpc.parser.talk.conditions.Trigger()); condPar.add(new illarion.easynpc.parser.talk.conditions.Admin()); condPar.add(new illarion.easynpc.parser.talk.conditions.Talkstate()); condPar.add(new illarion.easynpc.parser.talk.conditions.Number()); consPar.add(new illarion.easynpc.parser.talk.consequences.Inform()); consPar.add(new illarion.easynpc.parser.talk.consequences.State()); consPar.add(new illarion.easynpc.parser.talk.consequences.Skill()); consPar.add(new illarion.easynpc.parser.talk.consequences.Attribute()); consPar.add(new illarion.easynpc.parser.talk.consequences.Rune()); consPar.add(new illarion.easynpc.parser.talk.consequences.Money()); consPar.add(new illarion.easynpc.parser.talk.consequences.DeleteItem()); consPar.add(new illarion.easynpc.parser.talk.consequences.Item()); consPar.add(new illarion.easynpc.parser.talk.consequences.Queststatus()); consPar.add(new illarion.easynpc.parser.talk.consequences.Rankpoints()); consPar.add(new illarion.easynpc.parser.talk.consequences.Talkstate()); consPar.add(new illarion.easynpc.parser.talk.consequences.Town()); consPar.add(new illarion.easynpc.parser.talk.consequences.Treasure()); consPar.add(new illarion.easynpc.parser.talk.consequences.Warp()); consPar.add(new illarion.easynpc.parser.talk.consequences.Answer()); consPar.add(new illarion.easynpc.parser.talk.consequences.Trade()); consPar.add(new illarion.easynpc.parser.talk.consequences.Gemcraft()); consPar.add(new illarion.easynpc.parser.talk.consequences.Introduce()); final List<ConditionParser> conditionsList = condPar; final List<ConsequenceParser> consequenceList = consPar; conditionDocu = new DocuEntry() { @SuppressWarnings("nls") @Override public DocuEntry getChild(final int index) { if ((index < 0) || (index >= conditionsList.size())) { throw new IllegalArgumentException("Index out of range"); } return conditionsList.get(index); } @Override public int getChildCount() { return conditionsList.size(); } @SuppressWarnings("nls") @Override public String getDescription() { return Lang.getMsg(TalkingLine.class, "Conditions.Docu.description"); } @Nullable @Override public String getExample() { return null; } @Nullable @Override public String getSyntax() { return null; } @Override @SuppressWarnings("nls") public String getTitle() { return Lang.getMsg(TalkingLine.class, "Conditions.Docu.title"); } }; consequenceDocu = new DocuEntry() { @SuppressWarnings("nls") @Override public DocuEntry getChild(final int index) { if ((index < 0) || (index >= consequenceList.size())) { throw new IllegalArgumentException("Index out of range"); } return consequenceList.get(index); } @Override public int getChildCount() { return consequenceList.size(); } @SuppressWarnings("nls") @Override public String getDescription() { return Lang.getMsg(TalkingLine.class, "Consequence.Docu.description"); } @Nullable @Override public String getExample() { return null; } @Nullable @Override public String getSyntax() { return null; } @Override @SuppressWarnings("nls") public String getTitle() { return Lang .getMsg(TalkingLine.class, "Consequence.Docu.title"); } }; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "TalkingLine"
"public TalkingLine() { condPar = new ArrayList<ConditionParser>(); consPar = new ArrayList<ConsequenceParser>(); condPar.add(new illarion.easynpc.parser.talk.conditions.State()); condPar.add(new illarion.easynpc.parser.talk.conditions.Skill()); condPar.add(new illarion.easynpc.parser.talk.conditions.Attribute()); condPar.add(new illarion.easynpc.parser.talk.conditions.MagicType()); condPar.add(new illarion.easynpc.parser.talk.conditions.Money()); condPar.add(new illarion.easynpc.parser.talk.conditions.Race()); condPar.add(new illarion.easynpc.parser.talk.conditions.Rank()); condPar.add(new illarion.easynpc.parser.talk.conditions.Queststatus()); condPar.add(new illarion.easynpc.parser.talk.conditions.Item()); condPar.add(new illarion.easynpc.parser.talk.conditions.Language()); condPar.add(new illarion.easynpc.parser.talk.conditions.Chance()); condPar.add(new illarion.easynpc.parser.talk.conditions.Town()); condPar.add(new illarion.easynpc.parser.talk.conditions.TalkMode()); condPar.add(new illarion.easynpc.parser.talk.conditions.Sex()); condPar.add(new illarion.easynpc.parser.talk.conditions.Trigger()); condPar.add(new illarion.easynpc.parser.talk.conditions.Admin()); condPar.add(new illarion.easynpc.parser.talk.conditions.Talkstate()); condPar.add(new illarion.easynpc.parser.talk.conditions.Number()); consPar.add(new illarion.easynpc.parser.talk.consequences.Inform()); consPar.add(new illarion.easynpc.parser.talk.consequences.State()); consPar.add(new illarion.easynpc.parser.talk.consequences.Skill()); consPar.add(new illarion.easynpc.parser.talk.consequences.Attribute()); consPar.add(new illarion.easynpc.parser.talk.consequences.Rune()); consPar.add(new illarion.easynpc.parser.talk.consequences.Money()); consPar.add(new illarion.easynpc.parser.talk.consequences.DeleteItem()); consPar.add(new illarion.easynpc.parser.talk.consequences.Item()); consPar.add(new illarion.easynpc.parser.talk.consequences.Queststatus()); consPar.add(new illarion.easynpc.parser.talk.consequences.Rankpoints()); consPar.add(new illarion.easynpc.parser.talk.consequences.Talkstate()); consPar.add(new illarion.easynpc.parser.talk.consequences.Town()); consPar.add(new illarion.easynpc.parser.talk.consequences.Treasure()); consPar.add(new illarion.easynpc.parser.talk.consequences.Warp()); <MASK>consPar.add(new illarion.easynpc.parser.talk.consequences.Gemcraft());</MASK> consPar.add(new illarion.easynpc.parser.talk.consequences.Answer()); consPar.add(new illarion.easynpc.parser.talk.consequences.Trade()); consPar.add(new illarion.easynpc.parser.talk.consequences.Introduce()); final List<ConditionParser> conditionsList = condPar; final List<ConsequenceParser> consequenceList = consPar; conditionDocu = new DocuEntry() { @SuppressWarnings("nls") @Override public DocuEntry getChild(final int index) { if ((index < 0) || (index >= conditionsList.size())) { throw new IllegalArgumentException("Index out of range"); } return conditionsList.get(index); } @Override public int getChildCount() { return conditionsList.size(); } @SuppressWarnings("nls") @Override public String getDescription() { return Lang.getMsg(TalkingLine.class, "Conditions.Docu.description"); } @Nullable @Override public String getExample() { return null; } @Nullable @Override public String getSyntax() { return null; } @Override @SuppressWarnings("nls") public String getTitle() { return Lang.getMsg(TalkingLine.class, "Conditions.Docu.title"); } }; consequenceDocu = new DocuEntry() { @SuppressWarnings("nls") @Override public DocuEntry getChild(final int index) { if ((index < 0) || (index >= consequenceList.size())) { throw new IllegalArgumentException("Index out of range"); } return consequenceList.get(index); } @Override public int getChildCount() { return consequenceList.size(); } @SuppressWarnings("nls") @Override public String getDescription() { return Lang.getMsg(TalkingLine.class, "Consequence.Docu.description"); } @Nullable @Override public String getExample() { return null; } @Nullable @Override public String getSyntax() { return null; } @Override @SuppressWarnings("nls") public String getTitle() { return Lang .getMsg(TalkingLine.class, "Consequence.Docu.title"); } }; }"
Inversion-Mutation
megadiff
"private Collection<FilePath> dirtyPaths(boolean includeChanges) { // TODO collapse paths with common prefix ArrayList<FilePath> paths = new ArrayList<FilePath>(); FilePath rootPath = VcsUtil.getFilePath(myVcsRoot.getPath(), true); for (FilePath p : myDirtyScope.getRecursivelyDirtyDirectories()) { addToPaths(rootPath, paths, p); } ArrayList<FilePath> candidatePaths = new ArrayList<FilePath>(); candidatePaths.addAll(myDirtyScope.getDirtyFilesNoExpand()); if (includeChanges) { try { for (Change c : myChangeListManager.getChangesIn(myVcsRoot)) { switch (c.getType()) { case NEW: case DELETED: case MOVED: case MODIFICATION: if (c.getAfterRevision() != null) { addToPaths(rootPath, paths, c.getAfterRevision().getFile()); } if (c.getBeforeRevision() != null) { addToPaths(rootPath, paths, c.getBeforeRevision().getFile()); } default: // do nothing } } } catch (Exception t) { // ignore exceptions } } for (FilePath p : candidatePaths) { addToPaths(rootPath, paths, p); } return paths; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "dirtyPaths"
"private Collection<FilePath> dirtyPaths(boolean includeChanges) { // TODO collapse paths with common prefix ArrayList<FilePath> paths = new ArrayList<FilePath>(); FilePath rootPath = VcsUtil.getFilePath(myVcsRoot.getPath(), true); for (FilePath p : myDirtyScope.getRecursivelyDirtyDirectories()) { addToPaths(rootPath, paths, p); } ArrayList<FilePath> candidatePaths = new ArrayList<FilePath>(); candidatePaths.addAll(myDirtyScope.getDirtyFilesNoExpand()); if (includeChanges) { try { for (Change c : myChangeListManager.getChangesIn(myVcsRoot)) { switch (c.getType()) { case NEW: case DELETED: case MOVED: if (c.getAfterRevision() != null) { addToPaths(rootPath, paths, c.getAfterRevision().getFile()); } if (c.getBeforeRevision() != null) { addToPaths(rootPath, paths, c.getBeforeRevision().getFile()); } <MASK>case MODIFICATION:</MASK> default: // do nothing } } } catch (Exception t) { // ignore exceptions } } for (FilePath p : candidatePaths) { addToPaths(rootPath, paths, p); } return paths; }"
Inversion-Mutation
megadiff
"public ObjectTreePanel(ISession session) { super(); if (session == null) { throw new IllegalArgumentException("ISession == null"); } _session = session; _emptyTabPane = new ObjectTreeTabbedPane(_session); CreateGUI(); // Register tabs to display in the details panel for database nodes. addDetailTab(DatabaseObjectType.SESSION, new MetaDataTab()); addDetailTab(DatabaseObjectType.SESSION, new ConnectionStatusTab()); final SQLDatabaseMetaData md = session.getSQLConnection().getSQLMetaData(); try { if (md.supportsCatalogs()) { addDetailTab(DatabaseObjectType.SESSION, new CatalogsTab()); } } catch (Throwable th) { s_log.error("Error in supportsCatalogs()", th); } try { if (md.supportsSchemas()) { addDetailTab(DatabaseObjectType.SESSION, new SchemasTab()); } } catch (Throwable th) { s_log.error("Error in supportsCatalogs()", th); } addDetailTab(DatabaseObjectType.SESSION, new TableTypesTab()); addDetailTab(DatabaseObjectType.SESSION, new DataTypesTab()); addDetailTab(DatabaseObjectType.SESSION, new NumericFunctionsTab()); addDetailTab(DatabaseObjectType.SESSION, new StringFunctionsTab()); addDetailTab(DatabaseObjectType.SESSION, new SystemFunctionsTab()); addDetailTab(DatabaseObjectType.SESSION, new TimeDateFunctionsTab()); addDetailTab(DatabaseObjectType.SESSION, new KeywordsTab()); // Register tabs to display in the details panel for catalog nodes. addDetailTab(DatabaseObjectType.CATALOG, new DatabaseObjectInfoTab()); // Register tabs to display in the details panel for schema nodes. addDetailTab(DatabaseObjectType.SCHEMA, new DatabaseObjectInfoTab()); // Register tabs to display in the details panel for table nodes. addDetailTab(DatabaseObjectType.TABLE, new DatabaseObjectInfoTab()); addDetailTab(DatabaseObjectType.TABLE, new ContentsTab()); addDetailTab(DatabaseObjectType.TABLE, new RowCountTab()); addDetailTab(DatabaseObjectType.TABLE, new ColumnsTab()); addDetailTab(DatabaseObjectType.TABLE, new PrimaryKeyTab()); addDetailTab(DatabaseObjectType.TABLE, new ExportedKeysTab()); addDetailTab(DatabaseObjectType.TABLE, new ImportedKeysTab()); addDetailTab(DatabaseObjectType.TABLE, new IndexesTab()); addDetailTab(DatabaseObjectType.TABLE, new TablePriviligesTab()); addDetailTab(DatabaseObjectType.TABLE, new ColumnPriviligesTab()); addDetailTab(DatabaseObjectType.TABLE, new RowIDTab()); addDetailTab(DatabaseObjectType.TABLE, new VersionColumnsTab()); // Register tabs to display in the details panel for procedure nodes. addDetailTab(DatabaseObjectType.PROCEDURE, new DatabaseObjectInfoTab()); addDetailTab(DatabaseObjectType.PROCEDURE, new ProcedureColumnsTab()); // Register tabs to display in the details panel for UDT nodes. addDetailTab(DatabaseObjectType.UDT, new DatabaseObjectInfoTab()); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "ObjectTreePanel"
"public ObjectTreePanel(ISession session) { super(); if (session == null) { throw new IllegalArgumentException("ISession == null"); } _session = session; _emptyTabPane = new ObjectTreeTabbedPane(_session); CreateGUI(); // Register tabs to display in the details panel for database nodes. addDetailTab(DatabaseObjectType.SESSION, new MetaDataTab()); addDetailTab(DatabaseObjectType.SESSION, new ConnectionStatusTab()); final SQLDatabaseMetaData md = session.getSQLConnection().getSQLMetaData(); try { if (md.supportsCatalogs()) { addDetailTab(DatabaseObjectType.SESSION, new CatalogsTab()); } } catch (Throwable th) { s_log.error("Error in supportsCatalogs()", th); } try { if (md.supportsSchemas()) { addDetailTab(DatabaseObjectType.SESSION, new SchemasTab()); } } catch (Throwable th) { s_log.error("Error in supportsCatalogs()", th); } addDetailTab(DatabaseObjectType.SESSION, new TableTypesTab()); addDetailTab(DatabaseObjectType.SESSION, new DataTypesTab()); addDetailTab(DatabaseObjectType.SESSION, new NumericFunctionsTab()); addDetailTab(DatabaseObjectType.SESSION, new StringFunctionsTab()); addDetailTab(DatabaseObjectType.SESSION, new SystemFunctionsTab()); addDetailTab(DatabaseObjectType.SESSION, new TimeDateFunctionsTab()); addDetailTab(DatabaseObjectType.SESSION, new KeywordsTab()); // Register tabs to display in the details panel for catalog nodes. addDetailTab(DatabaseObjectType.CATALOG, new DatabaseObjectInfoTab()); // Register tabs to display in the details panel for schema nodes. addDetailTab(DatabaseObjectType.SCHEMA, new DatabaseObjectInfoTab()); // Register tabs to display in the details panel for table nodes. <MASK>addDetailTab(DatabaseObjectType.TABLE, new ContentsTab());</MASK> addDetailTab(DatabaseObjectType.TABLE, new DatabaseObjectInfoTab()); addDetailTab(DatabaseObjectType.TABLE, new RowCountTab()); addDetailTab(DatabaseObjectType.TABLE, new ColumnsTab()); addDetailTab(DatabaseObjectType.TABLE, new PrimaryKeyTab()); addDetailTab(DatabaseObjectType.TABLE, new ExportedKeysTab()); addDetailTab(DatabaseObjectType.TABLE, new ImportedKeysTab()); addDetailTab(DatabaseObjectType.TABLE, new IndexesTab()); addDetailTab(DatabaseObjectType.TABLE, new TablePriviligesTab()); addDetailTab(DatabaseObjectType.TABLE, new ColumnPriviligesTab()); addDetailTab(DatabaseObjectType.TABLE, new RowIDTab()); addDetailTab(DatabaseObjectType.TABLE, new VersionColumnsTab()); // Register tabs to display in the details panel for procedure nodes. addDetailTab(DatabaseObjectType.PROCEDURE, new DatabaseObjectInfoTab()); addDetailTab(DatabaseObjectType.PROCEDURE, new ProcedureColumnsTab()); // Register tabs to display in the details panel for UDT nodes. addDetailTab(DatabaseObjectType.UDT, new DatabaseObjectInfoTab()); }"
Inversion-Mutation
megadiff
"public void saveUserAddons(ISdkLog log) { FileOutputStream fos = null; try { String folder = AndroidLocation.getFolder(); File f = new File(folder, SRC_FILENAME); fos = new FileOutputStream(f); Properties props = new Properties(); int count = 0; for (SdkSource s : getSources(SdkSourceCategory.USER_ADDONS)) { props.setProperty(String.format("%s%02d", KEY_SRC, count), s.getUrl()); //$NON-NLS-1$ count++; } props.setProperty(KEY_COUNT, Integer.toString(count)); props.store( fos, "## User Sources for Android tool"); //$NON-NLS-1$ } catch (AndroidLocationException e) { log.error(e, null); } catch (IOException e) { log.error(e, null); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { } } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "saveUserAddons"
"public void saveUserAddons(ISdkLog log) { FileOutputStream fos = null; try { String folder = AndroidLocation.getFolder(); File f = new File(folder, SRC_FILENAME); fos = new FileOutputStream(f); Properties props = new Properties(); int count = 0; for (SdkSource s : getSources(SdkSourceCategory.USER_ADDONS)) { <MASK>count++;</MASK> props.setProperty(String.format("%s%02d", KEY_SRC, count), s.getUrl()); //$NON-NLS-1$ } props.setProperty(KEY_COUNT, Integer.toString(count)); props.store( fos, "## User Sources for Android tool"); //$NON-NLS-1$ } catch (AndroidLocationException e) { log.error(e, null); } catch (IOException e) { log.error(e, null); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { } } } }"
Inversion-Mutation
megadiff
"public AbsPropagator Propagator( int kind, Rsrcc_src_dstc_dst simple, Rsrcc_src_fld_dstc_dst load, Rsrcc_src_dstc_dst_fld store, Robjc_obj_varc_var alloc, Qvarc_var_objc_obj propout, AbsPAG pag ) { switch( kind ) { case PaddleOptions.propagator_worklist: return new PropWorklist(simple, load, store, alloc, propout, pag); case PaddleOptions.propagator_iter: return new PropIter(simple, load, store, alloc, propout, pag); case PaddleOptions.propagator_alias: return new PropAlias(simple, load, store, alloc, propout, pag); case PaddleOptions.propagator_bdd: return new PropBDD(simple, load, store, alloc, propout, pag); case PaddleOptions.propagator_auto: case PaddleOptions.propagator_incbdd: return new PropBDDInc(simple, load, store, alloc, propout, pag); default: throw new RuntimeException( "Unimplemented propagator specified "+kind ); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "Propagator"
"public AbsPropagator Propagator( int kind, Rsrcc_src_dstc_dst simple, Rsrcc_src_fld_dstc_dst load, Rsrcc_src_dstc_dst_fld store, Robjc_obj_varc_var alloc, Qvarc_var_objc_obj propout, AbsPAG pag ) { switch( kind ) { case PaddleOptions.propagator_worklist: return new PropWorklist(simple, load, store, alloc, propout, pag); case PaddleOptions.propagator_iter: return new PropIter(simple, load, store, alloc, propout, pag); case PaddleOptions.propagator_alias: return new PropAlias(simple, load, store, alloc, propout, pag); <MASK>case PaddleOptions.propagator_auto:</MASK> case PaddleOptions.propagator_bdd: return new PropBDD(simple, load, store, alloc, propout, pag); case PaddleOptions.propagator_incbdd: return new PropBDDInc(simple, load, store, alloc, propout, pag); default: throw new RuntimeException( "Unimplemented propagator specified "+kind ); } }"
Inversion-Mutation
megadiff
"protected String searchFor(final String target, String start) { ArrayList matches = (ArrayList) allBundles.get(target); if (matches == null) return null; int numberOfMatches = matches.size(); if (numberOfMatches == 1) { return ((BundleInfo) matches.get(0)).location; } if (numberOfMatches == 0) return null; String[] versions = new String[numberOfMatches]; int highest = 0; for (int i = 0; i < versions.length; i++) { versions[i] = ((BundleInfo) matches.get(i)).version; } highest = findMax(versions); return ((BundleInfo) matches.get(highest)).location; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "searchFor"
"protected String searchFor(final String target, String start) { ArrayList matches = (ArrayList) allBundles.get(target); if (matches == null) return null; int numberOfMatches = matches.size(); if (numberOfMatches == 1) { return ((BundleInfo) matches.get(0)).location; } if (numberOfMatches == 0) return null; String[] versions = new String[numberOfMatches]; int highest = 0; for (int i = 0; i < versions.length; i++) { versions[i] = ((BundleInfo) matches.get(i)).version; <MASK>highest = findMax(versions);</MASK> } return ((BundleInfo) matches.get(highest)).location; }"
Inversion-Mutation
megadiff
"public void setPhysicsSpace(PhysicsSpace space) { if (space == null) { removeFromPhysicsSpace(); this.space = space; } else { if (this.space == space) { return; } this.space = space; addToPhysicsSpace(); this.space.addCollisionListener(this); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "setPhysicsSpace"
"public void setPhysicsSpace(PhysicsSpace space) { if (space == null) { removeFromPhysicsSpace(); this.space = space; } else { if (this.space == space) { return; } this.space = space; addToPhysicsSpace(); } <MASK>this.space.addCollisionListener(this);</MASK> }"
Inversion-Mutation
megadiff
"public void addSeamRuntime(String name, String version, String seamHome) { log.info("Adding Seam Runtime: " + name + "\nVersion: " + version + "\nHome: " + seamHome); SWTBot wiz = open.preferenceOpen(ActionItem.Preference.JBossToolsWebSeam.LABEL); SWTBotTable tbRuntimeEnvironments = bot.table(); boolean createRuntime = true; // first check if Environment doesn't exist int numRows = tbRuntimeEnvironments.rowCount(); if (numRows > 0) { int currentRow = 0; while (createRuntime && currentRow < numRows) { if (tbRuntimeEnvironments.cell(currentRow, 1).equalsIgnoreCase( name)) { createRuntime = false; } else { currentRow++; } } } if (createRuntime) { wiz.button("Add").click(); bot.shell(IDELabel.Shell.NEW_SEAM_RUNTIME).activate(); bot.text(0).setText(seamHome); bot.text(1).setText(name); // find and select version String[] versions = bot.comboBox().items(); int myIndex =0; for (int index=0;index<versions.length;index++) { if (version.equals(versions[index])) { myIndex=index; break; } } bot.comboBox().setSelection(myIndex); open.finish(bot.activeShell().bot()); } open.finish(wiz, IDELabel.Button.OK); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "addSeamRuntime"
"public void addSeamRuntime(String name, String version, String seamHome) { log.info("Adding Seam Runtime: " + name + "\nVersion: " + version + "\nHome: " + seamHome); SWTBot wiz = open.preferenceOpen(ActionItem.Preference.JBossToolsWebSeam.LABEL); SWTBotTable tbRuntimeEnvironments = bot.table(); boolean createRuntime = true; // first check if Environment doesn't exist int numRows = tbRuntimeEnvironments.rowCount(); if (numRows > 0) { int currentRow = 0; while (createRuntime && currentRow < numRows) { if (tbRuntimeEnvironments.cell(currentRow, 1).equalsIgnoreCase( name)) { createRuntime = false; } else { currentRow++; } } } if (createRuntime) { wiz.button("Add").click(); bot.shell(IDELabel.Shell.NEW_SEAM_RUNTIME).activate(); bot.text(0).setText(seamHome); bot.text(1).setText(name); // find and select version String[] versions = bot.comboBox().items(); int myIndex =0; for (int index=0;index<versions.length;index++) { if (version.equals(versions[index])) { myIndex=index; break; } } bot.comboBox().setSelection(myIndex); open.finish(bot.activeShell().bot()); <MASK>open.finish(wiz, IDELabel.Button.OK);</MASK> } }"
Inversion-Mutation
megadiff
"public void draw() { if(!visible) { return; } antFarm.translate(position.x, position.y); antFarm.rotate(rotation); antFarm.strokeWeight(1f); if(antFarm.isDrawViewDirectionEnabled()) { antFarm.stroke(Color.RED.getRGB()); antFarm.line(0, 0, 0, -4f * SIZE); } antFarm.stroke(0); antFarm.fill(color); antFarm.beginShape(); antFarm.vertex(-SIZE, SIZE); antFarm.vertex(0, -SIZE); antFarm.vertex(SIZE, SIZE); antFarm.endShape(); if(carriesFood) { antFarm.stroke(Food.OUTLINE_COLOR); antFarm.fill(Food.COLOR); antFarm.ellipse(0, -SIZE, Food.SIZE, Food.SIZE); } antFarm.rotate(-rotation); antFarm.translate(-position.x, -position.y); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "draw"
"public void draw() { if(!visible) { return; } antFarm.translate(position.x, position.y); antFarm.rotate(rotation); if(antFarm.isDrawViewDirectionEnabled()) { antFarm.stroke(Color.RED.getRGB()); antFarm.line(0, 0, 0, -4f * SIZE); } antFarm.stroke(0); antFarm.fill(color); <MASK>antFarm.strokeWeight(1f);</MASK> antFarm.beginShape(); antFarm.vertex(-SIZE, SIZE); antFarm.vertex(0, -SIZE); antFarm.vertex(SIZE, SIZE); antFarm.endShape(); if(carriesFood) { antFarm.stroke(Food.OUTLINE_COLOR); antFarm.fill(Food.COLOR); antFarm.ellipse(0, -SIZE, Food.SIZE, Food.SIZE); } antFarm.rotate(-rotation); antFarm.translate(-position.x, -position.y); }"
Inversion-Mutation
megadiff
"@Override public void encodeEnd(final FacesContext context, final UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); Tooltip tooltip = (Tooltip) component; String clientId = tooltip.getClientId(context); boolean global = tooltip.isGlobal(); boolean shared = tooltip.isShared(); boolean autoShow = tooltip.isAutoShow(); boolean mouseTracking = tooltip.isMouseTracking(); String target = null; if (!global || (tooltip.getFor() != null || tooltip.getForSelector() != null)) { target = ComponentUtils.findTarget(context, tooltip); } startScript(writer, clientId); writer.write("$(function() {"); writer.write("PrimeFacesExt.cw('Tooltip', '" + tooltip.resolveWidgetVar() + "',{"); writer.write("id:'" + clientId + "'"); writer.write(",global:" + global); writer.write(",shared:" + shared); writer.write(",autoShow:" + autoShow); if (target == null) { writer.write(",forTarget:null"); } else { writer.write(",forTarget:'" + target + "'"); } if (!global) { writer.write(",content:\""); if (tooltip.getChildCount() > 0) { FastStringWriter fsw = new FastStringWriter(); ResponseWriter clonedWriter = writer.cloneWithWriter(fsw); context.setResponseWriter(clonedWriter); renderChildren(context, tooltip); context.setResponseWriter(writer); writer.write(escapeText(fsw.toString())); } else { String valueToRender = ComponentUtils.getValueToRender(context, tooltip); if (valueToRender != null) { writer.write(escapeText(valueToRender)); } } writer.write("\""); } // events if (mouseTracking) { writer.write(",hide:{fixed:true}"); } else if (shared && !global) { writer.write(",show:{target:$('" + target + "')" + ",delay:" + tooltip.getShowDelay() + ",effect:function(){$(this)." + tooltip.getShowEffect() + "(" + tooltip.getShowEffectLength() + ");}}"); writer.write(",hide:{target:$('" + target + "')" + ",delay:" + tooltip.getHideDelay() + ",effect:function(){$(this)." + tooltip.getHideEffect() + "(" + tooltip.getHideEffectLength() + ");}}"); } else if (autoShow) { writer.write(",show:{when:false,ready:true}"); writer.write(",hide:false"); } else { writer.write(",show:{event:'" + tooltip.getShowEvent() + "',delay:" + tooltip.getShowDelay() + ",effect:function(){$(this)." + tooltip.getShowEffect() + "(" + tooltip.getShowEffectLength() + ");}}"); writer.write(",hide:{event:'" + tooltip.getHideEvent() + "',delay:" + tooltip.getHideDelay() + ",effect:function(){$(this)." + tooltip.getHideEffect() + "(" + tooltip.getHideEffectLength() + ");}}"); } // position writer.write(",position: {"); writer.write("at:'" + tooltip.getAtPosition() + "'"); writer.write(",my:'" + tooltip.getMyPosition() + "'"); writer.write(",adjust:{x:" + tooltip.getAdjustX() + ",y:" + tooltip.getAdjustY() + "}"); writer.write(",viewport:$(window)"); if (mouseTracking) { writer.write(",target:'mouse'"); } else if (shared && !global) { writer.write(",target:'event'"); writer.write(",effect:false"); } writer.write("}},true);});"); endScript(writer); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "encodeEnd"
"@Override public void encodeEnd(final FacesContext context, final UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); Tooltip tooltip = (Tooltip) component; String clientId = tooltip.getClientId(context); boolean global = tooltip.isGlobal(); boolean shared = tooltip.isShared(); boolean autoShow = tooltip.isAutoShow(); boolean mouseTracking = tooltip.isMouseTracking(); String target = null; if (!global || (tooltip.getFor() != null || tooltip.getForSelector() != null)) { target = ComponentUtils.findTarget(context, tooltip); } startScript(writer, clientId); writer.write("$(function() {"); writer.write("PrimeFacesExt.cw('Tooltip', '" + tooltip.resolveWidgetVar() + "',{"); writer.write("id:'" + clientId + "'"); writer.write(",global:" + global); writer.write(",shared:" + shared); writer.write(",autoShow:" + autoShow); if (target == null) { writer.write(",forTarget:null"); } else { writer.write(",forTarget:'" + target + "'"); } if (!global) { writer.write(",content:\""); if (tooltip.getChildCount() > 0) { FastStringWriter fsw = new FastStringWriter(); ResponseWriter clonedWriter = writer.cloneWithWriter(fsw); context.setResponseWriter(clonedWriter); renderChildren(context, tooltip); context.setResponseWriter(writer); writer.write(escapeText(fsw.toString())); } else { String valueToRender = ComponentUtils.getValueToRender(context, tooltip); if (valueToRender != null) { writer.write(escapeText(valueToRender)); } } writer.write("\""); } // events if (mouseTracking) { writer.write(",hide:{fixed:true}"); } else if (shared && !global) { writer.write(",show:{target:$('" + target + "')" + ",delay:" + tooltip.getShowDelay() + ",effect:function(){$(this)." + tooltip.getShowEffect() + "(" + tooltip.getShowEffectLength() + ");}}"); writer.write(",hide:{target:$('" + target + "')" + ",delay:" + tooltip.getHideDelay() + ",effect:function(){$(this)." + tooltip.getHideEffect() + "(" + tooltip.getHideEffectLength() + ");}}"); } else if (autoShow) { writer.write(",show:{when:false,ready:true}"); writer.write(",hide:false"); } else { writer.write(",show:{event:'" + tooltip.getShowEvent() + "',delay:" + tooltip.getShowDelay() + ",effect:function(){$(this)." + tooltip.getShowEffect() + "(" + tooltip.getShowEffectLength() + ");}}"); writer.write(",hide:{event:'" + tooltip.getHideEvent() + "',delay:" + tooltip.getHideDelay() + ",effect:function(){$(this)." + tooltip.getHideEffect() + "(" + tooltip.getHideEffectLength() + ");}}"); } // position writer.write(",position: {"); writer.write("at:'" + tooltip.getAtPosition() + "'"); writer.write(",my:'" + tooltip.getMyPosition() + "'"); writer.write(",adjust:{x:" + tooltip.getAdjustX() + ",y:" + tooltip.getAdjustY() + "}"); if (mouseTracking) { writer.write(",target:'mouse'"); <MASK>writer.write(",viewport:$(window)");</MASK> } else if (shared && !global) { writer.write(",target:'event'"); writer.write(",effect:false"); } writer.write("}},true);});"); endScript(writer); }"
Inversion-Mutation
megadiff
"protected void createAndShowGUI(MainPanelStandalone mainPanel) { initLog(); GuiInit.init(); //Create and set up the window. frame = new JFrame(Globals.APPLICATION_NAME); // dispose on close, otherwise windowClosed event is not called. frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.add(mainPanel); frame.setJMenuBar(mainPanel.getMenuBar()); try { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { Logger.log.error("Unable to load native look and feel", ex); } frame.pack(); frame.setSize(800, 600); frame.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent arg0) { GuiMain.this.shutdown(); } }); //Display the window. frame.setVisible(true); int spPercent = Engine.getCurrent().getPreferences().getInt (GlobalPreference.GUI_SIDEPANEL_SIZE); double spSize = (100 - spPercent) / 100.0; mainPanel.getSplitPane().setDividerLocation(spSize); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "createAndShowGUI"
"protected void createAndShowGUI(MainPanelStandalone mainPanel) { initLog(); GuiInit.init(); //Create and set up the window. frame = new JFrame(Globals.APPLICATION_NAME); // dispose on close, otherwise windowClosed event is not called. frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.add(mainPanel); frame.setJMenuBar(mainPanel.getMenuBar()); <MASK>frame.setSize(800, 600);</MASK> try { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { Logger.log.error("Unable to load native look and feel", ex); } frame.pack(); frame.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent arg0) { GuiMain.this.shutdown(); } }); //Display the window. frame.setVisible(true); int spPercent = Engine.getCurrent().getPreferences().getInt (GlobalPreference.GUI_SIDEPANEL_SIZE); double spSize = (100 - spPercent) / 100.0; mainPanel.getSplitPane().setDividerLocation(spSize); }"
Inversion-Mutation
megadiff
"public static ArrayList<String> getJarFiles(Class<?> jarClass, String path) throws IOException { String jarPath = jarClass.getResource("/" + path).getPath(); jarPath = jarPath.substring(5, jarPath.indexOf("!")); ArrayList<String> fileNameList = new ArrayList<>(); JarFile jar = new JarFile(jarPath); Enumeration<JarEntry> entries = jar.entries(); while(entries.hasMoreElements()) { String fileName = entries.nextElement().getName(); if(fileName.startsWith(path) && !fileName.endsWith("/")) { fileNameList.add(fileName); } } jar.close(); return fileNameList; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getJarFiles"
"public static ArrayList<String> getJarFiles(Class<?> jarClass, String path) throws IOException { String jarPath = jarClass.getResource("/" + path).getPath(); jarPath = jarPath.substring(5, jarPath.indexOf("!")); ArrayList<String> fileNameList = new ArrayList<>(); JarFile jar = new JarFile(jarPath); Enumeration<JarEntry> entries = jar.entries(); <MASK>jar.close();</MASK> while(entries.hasMoreElements()) { String fileName = entries.nextElement().getName(); if(fileName.startsWith(path) && !fileName.endsWith("/")) { fileNameList.add(fileName); } } return fileNameList; }"
Inversion-Mutation
megadiff
"public static void poll(int delta) { if (currentMusic != null) { SoundStore.get().poll(delta); if (!SoundStore.get().isMusicPlaying()) { currentMusic = null; currentMusic.fireMusicEnded(); } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "poll"
"public static void poll(int delta) { if (currentMusic != null) { SoundStore.get().poll(delta); if (!SoundStore.get().isMusicPlaying()) { <MASK>currentMusic.fireMusicEnded();</MASK> currentMusic = null; } } }"
Inversion-Mutation
megadiff
"public List<InputSplit> getSplits(JobContext context) throws IOException { log.setLevel(getLogLevel(context)); validateOptions(context); LinkedList<InputSplit> splits = new LinkedList<InputSplit>(); Map<String,BatchScanConfig> tableConfigs = getBatchScanConfigs(context); for (Map.Entry<String,BatchScanConfig> tableConfigEntry : tableConfigs.entrySet()) { String tableName = tableConfigEntry.getKey(); BatchScanConfig tableConfig = tableConfigEntry.getValue(); boolean autoAdjust = tableConfig.shouldAutoAdjustRanges(); String tableId = null; List<Range> ranges = autoAdjust ? Range.mergeOverlapping(tableConfig.getRanges()) : tableConfig.getRanges(); if (ranges.isEmpty()) { ranges = new ArrayList<Range>(1); ranges.add(new Range()); } // get the metadata information for these ranges Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>(); TabletLocator tl; try { if (tableConfig.isOfflineScan()) { binnedRanges = binOfflineTable(context, tableName, ranges); while (binnedRanges == null) { // Some tablets were still online, try again UtilWaitThread.sleep(100 + (int) (Math.random() * 100)); // sleep randomly between 100 and 200 ms binnedRanges = binOfflineTable(context, tableName, ranges); } } else { Instance instance = getInstance(context); tl = getTabletLocator(context, tableName); // its possible that the cache could contain complete, but old information about a tables tablets... so clear it tl.invalidateCache(); Credentials creds = new Credentials(getPrincipal(context), getAuthenticationToken(context)); while (!tl.binRanges(creds, ranges, binnedRanges).isEmpty()) { if (!(instance instanceof MockInstance)) { tableId = Tables.getTableId(instance, tableName); if (!Tables.exists(instance, tableId)) throw new TableDeletedException(tableId); if (Tables.getTableState(instance, tableId) == TableState.OFFLINE) throw new TableOfflineException(instance, tableId); } binnedRanges.clear(); log.warn("Unable to locate bins for specified ranges. Retrying."); UtilWaitThread.sleep(100 + (int) (Math.random() * 100)); // sleep randomly between 100 and 200 ms tl.invalidateCache(); } } } catch (Exception e) { throw new IOException(e); } HashMap<Range,ArrayList<String>> splitsToAdd = null; if (!autoAdjust) splitsToAdd = new HashMap<Range,ArrayList<String>>(); HashMap<String,String> hostNameCache = new HashMap<String,String>(); for (Map.Entry<String,Map<KeyExtent,List<Range>>> tserverBin : binnedRanges.entrySet()) { String ip = tserverBin.getKey().split(":", 2)[0]; String location = hostNameCache.get(ip); if (location == null) { InetAddress inetAddress = InetAddress.getByName(ip); location = inetAddress.getHostName(); hostNameCache.put(ip, location); } for (Map.Entry<KeyExtent,List<Range>> extentRanges : tserverBin.getValue().entrySet()) { Range ke = extentRanges.getKey().toDataRange(); for (Range r : extentRanges.getValue()) { if (autoAdjust) { // divide ranges into smaller ranges, based on the tablets splits.add(new RangeInputSplit(tableName, tableId, ke.clip(r), new String[] {location})); } else { // don't divide ranges ArrayList<String> locations = splitsToAdd.get(r); if (locations == null) locations = new ArrayList<String>(1); locations.add(location); splitsToAdd.put(r, locations); } } } } if (!autoAdjust) for (Map.Entry<Range,ArrayList<String>> entry : splitsToAdd.entrySet()) splits.add(new RangeInputSplit(tableName, tableId, entry.getKey(), entry.getValue().toArray(new String[0]))); } return splits; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getSplits"
"public List<InputSplit> getSplits(JobContext context) throws IOException { log.setLevel(getLogLevel(context)); validateOptions(context); LinkedList<InputSplit> splits = new LinkedList<InputSplit>(); Map<String,BatchScanConfig> tableConfigs = getBatchScanConfigs(context); for (Map.Entry<String,BatchScanConfig> tableConfigEntry : tableConfigs.entrySet()) { String tableName = tableConfigEntry.getKey(); BatchScanConfig tableConfig = tableConfigEntry.getValue(); boolean autoAdjust = tableConfig.shouldAutoAdjustRanges(); String tableId = null; List<Range> ranges = autoAdjust ? Range.mergeOverlapping(tableConfig.getRanges()) : tableConfig.getRanges(); if (ranges.isEmpty()) { ranges = new ArrayList<Range>(1); ranges.add(new Range()); } // get the metadata information for these ranges Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>(); TabletLocator tl; try { if (tableConfig.isOfflineScan()) { binnedRanges = binOfflineTable(context, tableName, ranges); while (binnedRanges == null) { // Some tablets were still online, try again UtilWaitThread.sleep(100 + (int) (Math.random() * 100)); // sleep randomly between 100 and 200 ms binnedRanges = binOfflineTable(context, tableName, ranges); } } else { Instance instance = getInstance(context); tl = getTabletLocator(context, tableName); // its possible that the cache could contain complete, but old information about a tables tablets... so clear it tl.invalidateCache(); Credentials creds = new Credentials(getPrincipal(context), getAuthenticationToken(context)); while (!tl.binRanges(creds, ranges, binnedRanges).isEmpty()) { if (!(instance instanceof MockInstance)) { if (!Tables.exists(instance, tableId)) throw new TableDeletedException(tableId); if (Tables.getTableState(instance, tableId) == TableState.OFFLINE) throw new TableOfflineException(instance, tableId); <MASK>tableId = Tables.getTableId(instance, tableName);</MASK> } binnedRanges.clear(); log.warn("Unable to locate bins for specified ranges. Retrying."); UtilWaitThread.sleep(100 + (int) (Math.random() * 100)); // sleep randomly between 100 and 200 ms tl.invalidateCache(); } } } catch (Exception e) { throw new IOException(e); } HashMap<Range,ArrayList<String>> splitsToAdd = null; if (!autoAdjust) splitsToAdd = new HashMap<Range,ArrayList<String>>(); HashMap<String,String> hostNameCache = new HashMap<String,String>(); for (Map.Entry<String,Map<KeyExtent,List<Range>>> tserverBin : binnedRanges.entrySet()) { String ip = tserverBin.getKey().split(":", 2)[0]; String location = hostNameCache.get(ip); if (location == null) { InetAddress inetAddress = InetAddress.getByName(ip); location = inetAddress.getHostName(); hostNameCache.put(ip, location); } for (Map.Entry<KeyExtent,List<Range>> extentRanges : tserverBin.getValue().entrySet()) { Range ke = extentRanges.getKey().toDataRange(); for (Range r : extentRanges.getValue()) { if (autoAdjust) { // divide ranges into smaller ranges, based on the tablets splits.add(new RangeInputSplit(tableName, tableId, ke.clip(r), new String[] {location})); } else { // don't divide ranges ArrayList<String> locations = splitsToAdd.get(r); if (locations == null) locations = new ArrayList<String>(1); locations.add(location); splitsToAdd.put(r, locations); } } } } if (!autoAdjust) for (Map.Entry<Range,ArrayList<String>> entry : splitsToAdd.entrySet()) splits.add(new RangeInputSplit(tableName, tableId, entry.getKey(), entry.getValue().toArray(new String[0]))); } return splits; }"
Inversion-Mutation
megadiff
"@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); getPreferenceManager().setSharedPreferencesName(Wallpaper.SHARED_PREFS_NAME); addPreferencesFromResource(R.xml.settings); mFile = findPreference("file"); mRendererMode = (ListPreference) findPreference("rendererMode"); mTimeChange = (ListPreference) findPreference("time"); mRandomFile = (CheckBoxPreference) findPreference("random_file"); fileText(); rendererText(); timeText(); mFile.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference arg0) { Intent mainIntent = new Intent(Settings.this, FileChooserActivity.class); mainIntent.putStringArrayListExtra(FileChooserActivity.EXTRA_FILTER_INCLUDE_EXTENSIONS, INCLUDE_EXTENSIONS_LIST); mainIntent.putExtra(FileChooserActivity.EXTRA_SELECT_FOLDER, true); startActivityForResult(mainIntent, REQUEST_CHOOSER); return false; } }); getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "onCreate"
"@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); getPreferenceManager().setSharedPreferencesName(Wallpaper.SHARED_PREFS_NAME); addPreferencesFromResource(R.xml.settings); <MASK>getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);</MASK> mFile = findPreference("file"); mRendererMode = (ListPreference) findPreference("rendererMode"); mTimeChange = (ListPreference) findPreference("time"); mRandomFile = (CheckBoxPreference) findPreference("random_file"); fileText(); rendererText(); timeText(); mFile.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference arg0) { Intent mainIntent = new Intent(Settings.this, FileChooserActivity.class); mainIntent.putStringArrayListExtra(FileChooserActivity.EXTRA_FILTER_INCLUDE_EXTENSIONS, INCLUDE_EXTENSIONS_LIST); mainIntent.putExtra(FileChooserActivity.EXTRA_SELECT_FOLDER, true); startActivityForResult(mainIntent, REQUEST_CHOOSER); return false; } }); }"
Inversion-Mutation
megadiff
"public static IStatus handleError(final String title, final String message, Throwable e, final Shell shell) { IStatus status = createStatus(e); log(status); openErrorDialog(title, message, status, shell); return status; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "handleError"
"public static IStatus handleError(final String title, final String message, Throwable e, final Shell shell) { IStatus status = createStatus(e); <MASK>openErrorDialog(title, message, status, shell);</MASK> log(status); return status; }"
Inversion-Mutation
megadiff
"private void appendContentTitle(StringBuilder builder, FocusPoint focusPoint) { FocusPoint childFocusPoint = focusPoint.getChild(); builder.append(focusPoint.getName()); if (childFocusPoint != null) { builder.append(TITLE_SEPARATOR); appendContentTitle(builder, childFocusPoint); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "appendContentTitle"
"private void appendContentTitle(StringBuilder builder, FocusPoint focusPoint) { FocusPoint childFocusPoint = focusPoint.getChild(); builder.append(focusPoint.getName()); <MASK>builder.append(TITLE_SEPARATOR);</MASK> if (childFocusPoint != null) { appendContentTitle(builder, childFocusPoint); } }"
Inversion-Mutation
megadiff
"@Override public void handleMessage(Message msg) { BluetoothAudioGateway.IncomingConnectionInfo info = (BluetoothAudioGateway.IncomingConnectionInfo)msg.obj; int type = BluetoothHandsfree.TYPE_UNKNOWN; switch(msg.what) { case BluetoothAudioGateway.MSG_INCOMING_HEADSET_CONNECTION: type = BluetoothHandsfree.TYPE_HEADSET; break; case BluetoothAudioGateway.MSG_INCOMING_HANDSFREE_CONNECTION: type = BluetoothHandsfree.TYPE_HANDSFREE; break; } Log.i(TAG, "Incoming rfcomm (" + BluetoothHandsfree.typeToString(type) + ") connection from " + info.mRemoteDevice + "on channel " + info.mRfcommChan); int priority = BluetoothHeadset.PRIORITY_OFF; HeadsetBase headset; try { priority = mBinder.getPriority(info.mRemoteDevice); } catch (RemoteException e) {} if (priority <= BluetoothHeadset.PRIORITY_OFF) { Log.i(TAG, "Rejecting incoming connection because priority = " + priority); headset = new HeadsetBase(mPowerManager, mAdapter, info.mRemoteDevice, info.mSocketFd, info.mRfcommChan, null); headset.disconnect(); return; } switch (mState) { case BluetoothHeadset.STATE_DISCONNECTED: // headset connecting us, lets join mRemoteDevice = info.mRemoteDevice; setState(BluetoothHeadset.STATE_CONNECTING); headset = new HeadsetBase(mPowerManager, mAdapter, mRemoteDevice, info.mSocketFd, info.mRfcommChan, mConnectedStatusHandler); mHeadsetType = type; mConnectingStatusHandler.obtainMessage(RFCOMM_CONNECTED, headset).sendToTarget(); break; case BluetoothHeadset.STATE_CONNECTING: if (!info.mRemoteDevice.equals(mRemoteDevice)) { // different headset, ignoring Log.i(TAG, "Already attempting connect to " + mRemoteDevice + ", disconnecting " + info.mRemoteDevice); headset = new HeadsetBase(mPowerManager, mAdapter, info.mRemoteDevice, info.mSocketFd, info.mRfcommChan, null); headset.disconnect(); } // If we are here, we are in danger of a race condition // incoming rfcomm connection, but we are also attempting an // outgoing connection. Lets try and interrupt the outgoing // connection. Log.i(TAG, "Incoming and outgoing connections to " + info.mRemoteDevice + ". Cancel outgoing connection."); if (mConnectThread != null) { mConnectThread.interrupt(); } // Now continue with new connection, including calling callback mHeadset = new HeadsetBase(mPowerManager, mAdapter, mRemoteDevice, info.mSocketFd, info.mRfcommChan, mConnectedStatusHandler); mHeadsetType = type; setState(BluetoothHeadset.STATE_CONNECTED, BluetoothHeadset.RESULT_SUCCESS); mBtHandsfree.connectHeadset(mHeadset, mHeadsetType); // Make sure that old outgoing connect thread is dead. if (mConnectThread != null) { try { // TODO: Don't block in the main thread Log.w(TAG, "Block in main thread to join stale outgoing connection thread"); mConnectThread.join(); } catch (InterruptedException e) { Log.e(TAG, "Connection cancelled twice eh?", e); } mConnectThread = null; } if (DBG) log("Successfully used incoming connection, and cancelled outgoing " + " connection"); break; case BluetoothHeadset.STATE_CONNECTED: Log.i(TAG, "Already connected to " + mRemoteDevice + ", disconnecting " + info.mRemoteDevice); headset = new HeadsetBase(mPowerManager, mAdapter, info.mRemoteDevice, info.mSocketFd, info.mRfcommChan, null); headset.disconnect(); break; } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "handleMessage"
"@Override public void handleMessage(Message msg) { BluetoothAudioGateway.IncomingConnectionInfo info = (BluetoothAudioGateway.IncomingConnectionInfo)msg.obj; int type = BluetoothHandsfree.TYPE_UNKNOWN; switch(msg.what) { case BluetoothAudioGateway.MSG_INCOMING_HEADSET_CONNECTION: type = BluetoothHandsfree.TYPE_HEADSET; break; case BluetoothAudioGateway.MSG_INCOMING_HANDSFREE_CONNECTION: type = BluetoothHandsfree.TYPE_HANDSFREE; break; } Log.i(TAG, "Incoming rfcomm (" + BluetoothHandsfree.typeToString(type) + ") connection from " + info.mRemoteDevice + "on channel " + info.mRfcommChan); int priority = BluetoothHeadset.PRIORITY_OFF; HeadsetBase headset; try { priority = mBinder.getPriority(info.mRemoteDevice); } catch (RemoteException e) {} if (priority <= BluetoothHeadset.PRIORITY_OFF) { Log.i(TAG, "Rejecting incoming connection because priority = " + priority); headset = new HeadsetBase(mPowerManager, mAdapter, info.mRemoteDevice, info.mSocketFd, info.mRfcommChan, null); headset.disconnect(); return; } switch (mState) { case BluetoothHeadset.STATE_DISCONNECTED: // headset connecting us, lets join <MASK>setState(BluetoothHeadset.STATE_CONNECTING);</MASK> mRemoteDevice = info.mRemoteDevice; headset = new HeadsetBase(mPowerManager, mAdapter, mRemoteDevice, info.mSocketFd, info.mRfcommChan, mConnectedStatusHandler); mHeadsetType = type; mConnectingStatusHandler.obtainMessage(RFCOMM_CONNECTED, headset).sendToTarget(); break; case BluetoothHeadset.STATE_CONNECTING: if (!info.mRemoteDevice.equals(mRemoteDevice)) { // different headset, ignoring Log.i(TAG, "Already attempting connect to " + mRemoteDevice + ", disconnecting " + info.mRemoteDevice); headset = new HeadsetBase(mPowerManager, mAdapter, info.mRemoteDevice, info.mSocketFd, info.mRfcommChan, null); headset.disconnect(); } // If we are here, we are in danger of a race condition // incoming rfcomm connection, but we are also attempting an // outgoing connection. Lets try and interrupt the outgoing // connection. Log.i(TAG, "Incoming and outgoing connections to " + info.mRemoteDevice + ". Cancel outgoing connection."); if (mConnectThread != null) { mConnectThread.interrupt(); } // Now continue with new connection, including calling callback mHeadset = new HeadsetBase(mPowerManager, mAdapter, mRemoteDevice, info.mSocketFd, info.mRfcommChan, mConnectedStatusHandler); mHeadsetType = type; setState(BluetoothHeadset.STATE_CONNECTED, BluetoothHeadset.RESULT_SUCCESS); mBtHandsfree.connectHeadset(mHeadset, mHeadsetType); // Make sure that old outgoing connect thread is dead. if (mConnectThread != null) { try { // TODO: Don't block in the main thread Log.w(TAG, "Block in main thread to join stale outgoing connection thread"); mConnectThread.join(); } catch (InterruptedException e) { Log.e(TAG, "Connection cancelled twice eh?", e); } mConnectThread = null; } if (DBG) log("Successfully used incoming connection, and cancelled outgoing " + " connection"); break; case BluetoothHeadset.STATE_CONNECTED: Log.i(TAG, "Already connected to " + mRemoteDevice + ", disconnecting " + info.mRemoteDevice); headset = new HeadsetBase(mPowerManager, mAdapter, info.mRemoteDevice, info.mSocketFd, info.mRfcommChan, null); headset.disconnect(); break; } }"
Inversion-Mutation
megadiff
"public DBObject getEntity(String coll, String qKey, String qValue, String filters, String sort, int limit, int skip, String successMsg, boolean count, String...fieldNames) { DBObject query; BasicDBObject fields; try { query = new BasicDBObject(); if(qKey != null && qValue != null && (qKey.equalsIgnoreCase("_id") || qKey.endsWith(".cid"))) { query.put(qKey, new ObjectId(qValue)); } else if(qKey != null && qValue != null) { try{ if(filters != null) query = (DBObject)JSON.parse(filters); else query = new BasicDBObject(); }catch(Exception e) { return jSON2Rrn.createJSONError("Cannot get entity for collection: " + coll + ", error in filters: " + filters ,e); } query.put(qKey, qValue); } fields = new BasicDBObject(); for(String fieldName: fieldNames) { fields.put(fieldName, 1); } }catch(Exception e) { return jSON2Rrn.createJSONError("Cannot get entity for collection: " + coll + " with qKey=" + qKey + " and qValue=" + qValue,e); } return new MongoDBQueries().executeFindQuery( coll,query,fields, successMsg, sort, limit, skip, count); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getEntity"
"public DBObject getEntity(String coll, String qKey, String qValue, String filters, String sort, int limit, int skip, String successMsg, boolean count, String...fieldNames) { DBObject query; BasicDBObject fields; try { query = new BasicDBObject(); if(qKey != null && qValue != null && (qKey.equalsIgnoreCase("_id") || qKey.endsWith(".cid"))) { query.put(qKey, new ObjectId(qValue)); } else if(qKey != null && qValue != null) { try{ if(filters != null) query = (DBObject)JSON.parse(filters); else query = new BasicDBObject(); }catch(Exception e) { return jSON2Rrn.createJSONError("Cannot get entity for collection: " + coll + ", error in filters: " + filters ,e); } } <MASK>query.put(qKey, qValue);</MASK> fields = new BasicDBObject(); for(String fieldName: fieldNames) { fields.put(fieldName, 1); } }catch(Exception e) { return jSON2Rrn.createJSONError("Cannot get entity for collection: " + coll + " with qKey=" + qKey + " and qValue=" + qValue,e); } return new MongoDBQueries().executeFindQuery( coll,query,fields, successMsg, sort, limit, skip, count); }"
Inversion-Mutation
megadiff
"public synchronized void receivePosition(Position pos) { // FIXME signal on location gained //#debug info logger.info("New position: " + pos); collected++; if (Configuration.getAutoRecenterToGpsMilliSecs() !=0 && getDurationSinceLastUserActionTime() > Configuration.getAutoRecenterToGpsMilliSecs() && isShown() ) { gpsRecenter = true; //autoZoomed = true; } if (Configuration.getLocationProvider() == Configuration.LOCATIONPROVIDER_JSR179) { if (pos.type == Position.TYPE_GPS_LASTKNOWN) { // if we have a current cell id fix from cellid location, // don't overwrite it with a stale GPS location, but ignore the position // FIXME perhaps compare timestamps here in case the last known gps is later if (this.pos.type == Position.TYPE_CELLID) { return; } gpsRecenterInvalid = false; gpsRecenterStale = true; } } this.pos = pos; if (pos.type == Position.TYPE_GPS || pos.type == Position.TYPE_CELLID || pos.type == Position.TYPE_MANUAL) { gpsRecenterInvalid = false; gpsRecenterStale = false; } if (gpsRecenter) { center.setLatLonDeg(pos.latitude, pos.longitude); speed = (int) (pos.speed * 3.6f); if (speed > 2 && pos.course != Float.NaN) { /* don't rotate too fast */ coursegps = (int) pos.course; if ((coursegps - course)> 180) course = course + 360; if ((course-coursegps)> 180) coursegps = coursegps + 360; course = (int) course + (int)((coursegps - course)*1)/4 + 360; while (course > 360) { course -= 360; } } } if (gpx.isRecordingTrk()) { try { // don't tracklog manual cellid position or gps start/stop last known position if ((Configuration.getLocationProvider() == Configuration.LOCATIONPROVIDER_JSR179 && pos.type == Position.TYPE_CELLID) || pos.type == Position.TYPE_GPS_LASTKNOWN) { } else { gpx.addTrkPt(pos); } } catch (Exception e) { receiveMessage(e.getMessage()); } } altitude = (int) (pos.altitude); if (Configuration.getCfgBitState(Configuration.CFGBIT_AUTOZOOM) && gpsRecenter && (isGpsConnected() || TrackPlayer.isPlaying) && autoZoomed && pc.getP() != null && pos.speed != Float.NaN // if speed is unknown do not autozoom ) { // the minimumScale at 20km/h and below is equivalent to having zoomed in manually once from the startup zoom level final float minimumScale = Configuration.getRealBaseScale() / 1.5f; final int minimumSpeed = 20; // the maximumScale at 160km/h and above is equivalent to having zoomed out manually once from the startup zoom level final float maximumScale = Configuration.getRealBaseScale() * 1.5f; final int maximumSpeed = 160; int speedForScale = speed; float newScale = minimumScale + (maximumScale - minimumScale) * (speedForScale - minimumSpeed) / (maximumSpeed - minimumSpeed); // make sure the new scale is within the minimum / maximum scale values if (newScale < minimumScale) { newScale = minimumScale; } else if (newScale > maximumScale) { newScale = maximumScale; } scale = newScale; // // calculate meters to top of screen // float topLat = pc.getP().getMaxLat(); // float topLon = (pc.getP().getMinLon() + pc.getP().getMaxLon()) / 2f; // float distance = MoreMath.dist(center.radlat, center.radlon, topLat, topLon ); // System.out.println("current distance to top of screen: " + distance); // // // avoid zooming in or out too far // int speedForScale = course; // if (speedForScale < 30) { // speedForScale = 30; // } else if (speedForScale > 160) { // speedForScale = 160; // } // // final float SECONDS_TO_PREVIEW = 45f; // float metersToPreview = (float) speedForScale / 3.6f * SECONDS_TO_PREVIEW; // System.out.println(metersToPreview + "meters to preview at " + speedForScale + "km/h"); // // if (metersToPreview < 2000) { // // calculate top position that needs to be visible to preview the metersToPreview // topLat = center.radlat + (topLat - center.radlat) * metersToPreview / distance; // topLon = center.radlon + (topLon - center.radlon) * metersToPreview / distance; // System.out.println("new distance to top:" + MoreMath.dist(center.radlat, center.radlon, topLat, topLon )); // // /* // * calculate scale factor, we multiply this again with 2 * 1.2 = 2.4 to take into account we calculated half the screen height // * and 1.2f is probably the factor the PaintContext is larger than the display size // * (new scale is calculated similiar to GuiWaypoint) // */ // IntPoint intPoint1 = new IntPoint(0, 0); // IntPoint intPoint2 = new IntPoint(getWidth(), getHeight()); // Node n1 = new Node(center.radlat, center.radlon, true); // Node n2 = new Node(topLat, topLon, true); // scale = pc.getP().getScale(n1, n2, intPoint1, intPoint2) * 2.4f; // } } updatePosition(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "receivePosition"
"public synchronized void receivePosition(Position pos) { // FIXME signal on location gained //#debug info logger.info("New position: " + pos); <MASK>this.pos = pos;</MASK> collected++; if (Configuration.getAutoRecenterToGpsMilliSecs() !=0 && getDurationSinceLastUserActionTime() > Configuration.getAutoRecenterToGpsMilliSecs() && isShown() ) { gpsRecenter = true; //autoZoomed = true; } if (Configuration.getLocationProvider() == Configuration.LOCATIONPROVIDER_JSR179) { if (pos.type == Position.TYPE_GPS_LASTKNOWN) { // if we have a current cell id fix from cellid location, // don't overwrite it with a stale GPS location, but ignore the position // FIXME perhaps compare timestamps here in case the last known gps is later if (this.pos.type == Position.TYPE_CELLID) { return; } gpsRecenterInvalid = false; gpsRecenterStale = true; } } if (pos.type == Position.TYPE_GPS || pos.type == Position.TYPE_CELLID || pos.type == Position.TYPE_MANUAL) { gpsRecenterInvalid = false; gpsRecenterStale = false; } if (gpsRecenter) { center.setLatLonDeg(pos.latitude, pos.longitude); speed = (int) (pos.speed * 3.6f); if (speed > 2 && pos.course != Float.NaN) { /* don't rotate too fast */ coursegps = (int) pos.course; if ((coursegps - course)> 180) course = course + 360; if ((course-coursegps)> 180) coursegps = coursegps + 360; course = (int) course + (int)((coursegps - course)*1)/4 + 360; while (course > 360) { course -= 360; } } } if (gpx.isRecordingTrk()) { try { // don't tracklog manual cellid position or gps start/stop last known position if ((Configuration.getLocationProvider() == Configuration.LOCATIONPROVIDER_JSR179 && pos.type == Position.TYPE_CELLID) || pos.type == Position.TYPE_GPS_LASTKNOWN) { } else { gpx.addTrkPt(pos); } } catch (Exception e) { receiveMessage(e.getMessage()); } } altitude = (int) (pos.altitude); if (Configuration.getCfgBitState(Configuration.CFGBIT_AUTOZOOM) && gpsRecenter && (isGpsConnected() || TrackPlayer.isPlaying) && autoZoomed && pc.getP() != null && pos.speed != Float.NaN // if speed is unknown do not autozoom ) { // the minimumScale at 20km/h and below is equivalent to having zoomed in manually once from the startup zoom level final float minimumScale = Configuration.getRealBaseScale() / 1.5f; final int minimumSpeed = 20; // the maximumScale at 160km/h and above is equivalent to having zoomed out manually once from the startup zoom level final float maximumScale = Configuration.getRealBaseScale() * 1.5f; final int maximumSpeed = 160; int speedForScale = speed; float newScale = minimumScale + (maximumScale - minimumScale) * (speedForScale - minimumSpeed) / (maximumSpeed - minimumSpeed); // make sure the new scale is within the minimum / maximum scale values if (newScale < minimumScale) { newScale = minimumScale; } else if (newScale > maximumScale) { newScale = maximumScale; } scale = newScale; // // calculate meters to top of screen // float topLat = pc.getP().getMaxLat(); // float topLon = (pc.getP().getMinLon() + pc.getP().getMaxLon()) / 2f; // float distance = MoreMath.dist(center.radlat, center.radlon, topLat, topLon ); // System.out.println("current distance to top of screen: " + distance); // // // avoid zooming in or out too far // int speedForScale = course; // if (speedForScale < 30) { // speedForScale = 30; // } else if (speedForScale > 160) { // speedForScale = 160; // } // // final float SECONDS_TO_PREVIEW = 45f; // float metersToPreview = (float) speedForScale / 3.6f * SECONDS_TO_PREVIEW; // System.out.println(metersToPreview + "meters to preview at " + speedForScale + "km/h"); // // if (metersToPreview < 2000) { // // calculate top position that needs to be visible to preview the metersToPreview // topLat = center.radlat + (topLat - center.radlat) * metersToPreview / distance; // topLon = center.radlon + (topLon - center.radlon) * metersToPreview / distance; // System.out.println("new distance to top:" + MoreMath.dist(center.radlat, center.radlon, topLat, topLon )); // // /* // * calculate scale factor, we multiply this again with 2 * 1.2 = 2.4 to take into account we calculated half the screen height // * and 1.2f is probably the factor the PaintContext is larger than the display size // * (new scale is calculated similiar to GuiWaypoint) // */ // IntPoint intPoint1 = new IntPoint(0, 0); // IntPoint intPoint2 = new IntPoint(getWidth(), getHeight()); // Node n1 = new Node(center.radlat, center.radlon, true); // Node n2 = new Node(topLat, topLon, true); // scale = pc.getP().getScale(n1, n2, intPoint1, intPoint2) * 2.4f; // } } updatePosition(); }"
Inversion-Mutation
megadiff
"public final void removeMyselfNoConfirm(final Host dcHost, final boolean testOnly) { final List<ServiceInfo> children = new ArrayList<ServiceInfo>(); if (!testOnly) { final Enumeration e = getNode().children(); while (e.hasMoreElements()) { final DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement(); final ServiceInfo child = (ServiceInfo) n.getUserObject(); child.getService().setRemoved(true); children.add(child); } } if (getService().isNew()) { if (!testOnly) { getService().setNew(false); getBrowser().getHeartbeatGraph().killRemovedVertices(); } } else { String cloneId = null; boolean master = false; final CloneInfo ci = getCloneInfo(); if (ci != null) { cloneId = ci.getHeartbeatId(testOnly); master = ci.getService().isMaster(); } super.removeMyselfNoConfirm(dcHost, testOnly); CRM.removeResource(dcHost, null, getHeartbeatId(testOnly), cloneId, /* clone id */ master, testOnly); for (final ServiceInfo child : children) { child.cleanupResource(dcHost, testOnly); } } if (!testOnly) { for (final ServiceInfo child : children) { getBrowser().removeFromServiceInfoHash(child); child.cleanup(); child.getService().doneRemoving(); } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "removeMyselfNoConfirm"
"public final void removeMyselfNoConfirm(final Host dcHost, final boolean testOnly) { final List<ServiceInfo> children = new ArrayList<ServiceInfo>(); if (!testOnly) { final Enumeration e = getNode().children(); while (e.hasMoreElements()) { final DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement(); final ServiceInfo child = (ServiceInfo) n.getUserObject(); child.getService().setRemoved(true); children.add(child); } } if (getService().isNew()) { if (!testOnly) { getService().setNew(false); getBrowser().getHeartbeatGraph().killRemovedVertices(); } } else { <MASK>super.removeMyselfNoConfirm(dcHost, testOnly);</MASK> String cloneId = null; boolean master = false; final CloneInfo ci = getCloneInfo(); if (ci != null) { cloneId = ci.getHeartbeatId(testOnly); master = ci.getService().isMaster(); } CRM.removeResource(dcHost, null, getHeartbeatId(testOnly), cloneId, /* clone id */ master, testOnly); for (final ServiceInfo child : children) { child.cleanupResource(dcHost, testOnly); } } if (!testOnly) { for (final ServiceInfo child : children) { getBrowser().removeFromServiceInfoHash(child); child.cleanup(); child.getService().doneRemoving(); } } }"
Inversion-Mutation
megadiff
"private void notifyStatus(ConnectionStatus status, ConnectionError error, String errorMsg) { try { connectionStatus = status; if (this.statusDelegate != null) { //create structure final HStatus hstatus = new HStatus(); hstatus.setStatus(status); hstatus.setErrorCode(error); hstatus.setErrorMsg(errorMsg); //return status asynchronously (new Thread(new Runnable() { public void run() { try { statusDelegate.onStatus(hstatus); } catch (Exception e) { // TODO: Add a message to message logger e.printStackTrace(); } } })).start(); } } catch (Exception e) { e.printStackTrace(); // TODO: Add a message to message logger } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "notifyStatus"
"private void notifyStatus(ConnectionStatus status, ConnectionError error, String errorMsg) { try { <MASK>if (this.statusDelegate != null) {</MASK> connectionStatus = status; //create structure final HStatus hstatus = new HStatus(); hstatus.setStatus(status); hstatus.setErrorCode(error); hstatus.setErrorMsg(errorMsg); //return status asynchronously (new Thread(new Runnable() { public void run() { try { statusDelegate.onStatus(hstatus); } catch (Exception e) { // TODO: Add a message to message logger e.printStackTrace(); } } })).start(); } } catch (Exception e) { e.printStackTrace(); // TODO: Add a message to message logger } }"
Inversion-Mutation
megadiff
"@Override public void close() { if (store != null) { getFolder().close(); try { store.close(); } catch (MessagingException e) { throw new RuntimeException(e); } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "close"
"@Override public void close() { if (store != null) { try { store.close(); } catch (MessagingException e) { throw new RuntimeException(e); } <MASK>getFolder().close();</MASK> } }"
Inversion-Mutation
megadiff
"@Override protected void onResume() { super.onResume(); mWifiEnabler.resume(); mBtEnabler.resume(); mAirplaneModeEnabler.resume(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "onResume"
"@Override protected void onResume() { super.onResume(); mWifiEnabler.resume(); <MASK>mAirplaneModeEnabler.resume();</MASK> mBtEnabler.resume(); }"
Inversion-Mutation
megadiff
"protected synchronized void handleResponse(int color, String line, Scanner s) { if (color == oregoColor && line.contains("playout")) { out.println(";C[" + line.substring(line.indexOf(' ') + 1) + "]"); out.flush(); endPrograms(); return; } if (line.startsWith("=")) { if (mode == REQUESTING_MOVE) { // accumulate the time the player spent their total timeUsedInMilliseconds[getColorToPlay()] += System .currentTimeMillis() - timeLastMoveWasRequested; double timeLeftForThisPlayer = GAME_TIME_IN_SECONDS - timeUsedInMilliseconds[getColorToPlay()] / 1000.0; String timeLeftIndicator = (getColorToPlay() == BLACK ? "BL" : "WL") + "[" + timeLeftForThisPlayer + "]"; String coordinates = line.substring(line.indexOf(' ') + 1); // sgf output if (coordinates.equals("PASS")) { out.println((getColorToPlay() == BLACK ? ";B" : ";W") + "[]" + timeLeftIndicator); out.flush(); } else if (coordinates.toLowerCase().equals("resign")) { // do nothing. } else { out.println((getColorToPlay() == BLACK ? ";B" : ";W") + "[" + rowToSgfChar(row(at(coordinates))) + columnToSgfChar(column(at(coordinates))) + "]" + timeLeftIndicator); out.flush(); } // end sgf output if (coordinates.toLowerCase().equals("resign")) { winner = opposite(getColorToPlay()); out.println(";RE[" + (winner == BLACK ? "B" : "W") + "+R]"); out.flush(); out.println(";C[moves:" + board.getTurn() + "]"); out.flush(); toPrograms[oregoColor].println("playout_count"); toPrograms[oregoColor].flush(); return; } board.play(at(coordinates)); if (board.getPasses() == 2) { out.println(";RE[" + (board.finalWinner() == BLACK ? "B" : "W") + "+" + Math.abs(board.finalScore()) + "]"); out.flush(); out.println(";C[moves:" + board.getTurn() + "]"); out.flush(); toPrograms[oregoColor].println("playout_count"); toPrograms[oregoColor].flush(); return; } if (GAME_TIME_IN_SECONDS > 0) { mode = SENDING_MOVE; } else { mode = SENDING_TIME_LEFT; } // Note the color reversal here, because the color to play has // already been switched toPrograms[getColorToPlay()] .println(COLOR_NAMES[opposite(getColorToPlay())] + " " + coordinates); toPrograms[getColorToPlay()].flush(); } else if (mode == SENDING_MOVE) { mode = SENDING_TIME_LEFT; // tell the player how much time they have left in the game int timeLeftInSeconds = GAME_TIME_IN_SECONDS - timeUsedInMilliseconds[getColorToPlay()] / 1000; toPrograms[getColorToPlay()].println("time_left " + COLOR_NAMES[getColorToPlay()] + " " + timeLeftInSeconds + " 0"); toPrograms[getColorToPlay()].flush(); } else if (mode == SENDING_TIME_LEFT) { // ignore the player's response to the time_left command. // request a move. mode = REQUESTING_MOVE; toPrograms[getColorToPlay()].println("genmove " + COLOR_NAMES[getColorToPlay()]); toPrograms[getColorToPlay()].flush(); timeLastMoveWasRequested = System.currentTimeMillis(); } else { // Mode is QUITTING // Do nothing } } else { if (line.length() > 0) { crashed = true; out.println("In " + filename + ":"); out.println(board); out.println("Got something other than an acknowledgment: " + line); endPrograms(); while (s.hasNextLine()) { out.println(s.nextLine()); } out.flush(); System.exit(1); } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "handleResponse"
"protected synchronized void handleResponse(int color, String line, Scanner s) { if (color == oregoColor && line.contains("playout")) { out.println(";C[" + line.substring(line.indexOf(' ') + 1) + "]"); out.flush(); endPrograms(); return; } if (line.startsWith("=")) { if (mode == REQUESTING_MOVE) { // accumulate the time the player spent their total timeUsedInMilliseconds[getColorToPlay()] += System .currentTimeMillis() - timeLastMoveWasRequested; double timeLeftForThisPlayer = GAME_TIME_IN_SECONDS - timeUsedInMilliseconds[getColorToPlay()] / 1000.0; String timeLeftIndicator = (getColorToPlay() == BLACK ? "BL" : "WL") + "[" + timeLeftForThisPlayer + "]"; String coordinates = line.substring(line.indexOf(' ') + 1); // sgf output if (coordinates.equals("PASS")) { out.println((getColorToPlay() == BLACK ? ";B" : ";W") + "[]" + timeLeftIndicator); out.flush(); } else if (coordinates.toLowerCase().equals("resign")) { // do nothing. } else { out.println((getColorToPlay() == BLACK ? ";B" : ";W") + "[" + rowToSgfChar(row(at(coordinates))) + columnToSgfChar(column(at(coordinates))) + "]" + timeLeftIndicator); out.flush(); } // end sgf output if (coordinates.toLowerCase().equals("resign")) { winner = opposite(getColorToPlay()); out.println(";RE[" + (winner == BLACK ? "B" : "W") + "+R]"); out.flush(); out.println(";C[moves:" + board.getTurn() + "]"); out.flush(); toPrograms[oregoColor].println("playout_count"); toPrograms[oregoColor].flush(); return; } if (board.getPasses() == 2) { out.println(";RE[" + (board.finalWinner() == BLACK ? "B" : "W") + "+" + Math.abs(board.finalScore()) + "]"); out.flush(); out.println(";C[moves:" + board.getTurn() + "]"); out.flush(); toPrograms[oregoColor].println("playout_count"); toPrograms[oregoColor].flush(); return; } <MASK>board.play(at(coordinates));</MASK> if (GAME_TIME_IN_SECONDS > 0) { mode = SENDING_MOVE; } else { mode = SENDING_TIME_LEFT; } // Note the color reversal here, because the color to play has // already been switched toPrograms[getColorToPlay()] .println(COLOR_NAMES[opposite(getColorToPlay())] + " " + coordinates); toPrograms[getColorToPlay()].flush(); } else if (mode == SENDING_MOVE) { mode = SENDING_TIME_LEFT; // tell the player how much time they have left in the game int timeLeftInSeconds = GAME_TIME_IN_SECONDS - timeUsedInMilliseconds[getColorToPlay()] / 1000; toPrograms[getColorToPlay()].println("time_left " + COLOR_NAMES[getColorToPlay()] + " " + timeLeftInSeconds + " 0"); toPrograms[getColorToPlay()].flush(); } else if (mode == SENDING_TIME_LEFT) { // ignore the player's response to the time_left command. // request a move. mode = REQUESTING_MOVE; toPrograms[getColorToPlay()].println("genmove " + COLOR_NAMES[getColorToPlay()]); toPrograms[getColorToPlay()].flush(); timeLastMoveWasRequested = System.currentTimeMillis(); } else { // Mode is QUITTING // Do nothing } } else { if (line.length() > 0) { crashed = true; out.println("In " + filename + ":"); out.println(board); out.println("Got something other than an acknowledgment: " + line); endPrograms(); while (s.hasNextLine()) { out.println(s.nextLine()); } out.flush(); System.exit(1); } } }"
Inversion-Mutation
megadiff
"public void addSeamRuntime(String name, String version, String seamHome) { log.info("Adding Seam Runtime: " + name + "\nVersion: " + version + "\nHome: " + seamHome); SWTBot wiz = open.preferenceOpen(ActionItem.Preference.JBossToolsWebSeam.LABEL); SWTBotTable tbRuntimeEnvironments = bot.table(); boolean createRuntime = true; // first check if Environment doesn't exist int numRows = tbRuntimeEnvironments.rowCount(); if (numRows > 0) { int currentRow = 0; while (createRuntime && currentRow < numRows) { if (tbRuntimeEnvironments.cell(currentRow, 1).equalsIgnoreCase( name)) { createRuntime = false; } else { currentRow++; } } } if (createRuntime) { wiz.button("Add").click(); bot.shell(IDELabel.Shell.NEW_SEAM_RUNTIME).activate(); bot.text(0).setText(seamHome); bot.text(1).setText(name); // find and select version String[] versions = bot.comboBox().items(); int myIndex =0; for (int index=0;index<versions.length;index++) { if (version.equals(versions[index])) { myIndex=index; break; } } bot.comboBox().setSelection(myIndex); open.finish(bot.activeShell().bot()); } open.finish(wiz, IDELabel.Button.OK); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "addSeamRuntime"
"public void addSeamRuntime(String name, String version, String seamHome) { log.info("Adding Seam Runtime: " + name + "\nVersion: " + version + "\nHome: " + seamHome); SWTBot wiz = open.preferenceOpen(ActionItem.Preference.JBossToolsWebSeam.LABEL); SWTBotTable tbRuntimeEnvironments = bot.table(); boolean createRuntime = true; // first check if Environment doesn't exist int numRows = tbRuntimeEnvironments.rowCount(); if (numRows > 0) { int currentRow = 0; while (createRuntime && currentRow < numRows) { if (tbRuntimeEnvironments.cell(currentRow, 1).equalsIgnoreCase( name)) { createRuntime = false; } else { currentRow++; } } } if (createRuntime) { wiz.button("Add").click(); bot.shell(IDELabel.Shell.NEW_SEAM_RUNTIME).activate(); bot.text(0).setText(seamHome); bot.text(1).setText(name); // find and select version String[] versions = bot.comboBox().items(); int myIndex =0; for (int index=0;index<versions.length;index++) { if (version.equals(versions[index])) { myIndex=index; break; } } bot.comboBox().setSelection(myIndex); open.finish(bot.activeShell().bot()); <MASK>open.finish(wiz, IDELabel.Button.OK);</MASK> } }"
Inversion-Mutation
megadiff
"@Override public void load(CompoundTag myplayerNBT) { if (myplayerNBT.getValue().containsKey("AutoRespawn")) { setAutoRespawnEnabled(((ByteTag) myplayerNBT.getValue().get("AutoRespawn")).getBooleanValue()); } if (myplayerNBT.getValue().containsKey("AutoRespawnMin")) { setAutoRespawnMin(((IntTag) myplayerNBT.getValue().get("AutoRespawnMin")).getValue()); } if (myplayerNBT.getValue().containsKey("CaptureMode")) { if (myplayerNBT.getValue().get("CaptureMode").getType() == TagType.TAG_STRING) { if (!((StringTag) myplayerNBT.getValue().get("CaptureMode")).getValue().equals("Deactivated")) { setCaptureHelperActive(true); } } else if (myplayerNBT.getValue().get("CaptureMode").getType() == TagType.TAG_BYTE) { setCaptureHelperActive(((ByteTag) myplayerNBT.getValue().get("CaptureMode")).getBooleanValue()); } } if (myplayerNBT.getValue().containsKey("LastActiveMyPetUUID")) { String lastActive = ((StringTag) myplayerNBT.getValue().get("LastActiveMyPetUUID")).getValue(); if (!lastActive.equalsIgnoreCase("")) { UUID lastActiveUUID = UUID.fromString(lastActive); World newWorld = Bukkit.getServer().getWorlds().get(0); MyPetWorldGroup lastActiveGroup = MyPetWorldGroup.getGroup(newWorld.getName()); this.setMyPetForWorldGroup(lastActiveGroup.getName(), lastActiveUUID); } } if (myplayerNBT.getValue().containsKey("ExtendedInfo")) { setExtendedInfo((CompoundTag) myplayerNBT.getValue().get("ExtendedInfo")); } if (myplayerNBT.getValue().containsKey("MultiWorld")) { CompoundMap map = ((CompoundTag) myplayerNBT.getValue().get("MultiWorld")).getValue(); for (String worldGroupName : map.keySet()) { String petUUID = ((StringTag) map.get(worldGroupName)).getValue(); setMyPetForWorldGroup(worldGroupName, UUID.fromString(petUUID)); } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "load"
"@Override public void load(CompoundTag myplayerNBT) { if (myplayerNBT.getValue().containsKey("AutoRespawn")) { setAutoRespawnEnabled(((ByteTag) myplayerNBT.getValue().get("AutoRespawn")).getBooleanValue()); } if (myplayerNBT.getValue().containsKey("AutoRespawnMin")) { setAutoRespawnMin(((IntTag) myplayerNBT.getValue().get("AutoRespawnMin")).getValue()); } if (myplayerNBT.getValue().containsKey("CaptureMode")) { if (myplayerNBT.getValue().get("CaptureMode").getType() == TagType.TAG_STRING) { if (!((StringTag) myplayerNBT.getValue().get("CaptureMode")).getValue().equals("Deactivated")) { setCaptureHelperActive(true); } } else if (myplayerNBT.getValue().get("CaptureMode").getType() == TagType.TAG_BYTE) { setCaptureHelperActive(((ByteTag) myplayerNBT.getValue().get("CaptureMode")).getBooleanValue()); } } if (myplayerNBT.getValue().containsKey("LastActiveMyPetUUID")) { String lastActive = ((StringTag) myplayerNBT.getValue().get("LastActiveMyPetUUID")).getValue(); <MASK>UUID lastActiveUUID = UUID.fromString(lastActive);</MASK> if (!lastActive.equalsIgnoreCase("")) { World newWorld = Bukkit.getServer().getWorlds().get(0); MyPetWorldGroup lastActiveGroup = MyPetWorldGroup.getGroup(newWorld.getName()); this.setMyPetForWorldGroup(lastActiveGroup.getName(), lastActiveUUID); } } if (myplayerNBT.getValue().containsKey("ExtendedInfo")) { setExtendedInfo((CompoundTag) myplayerNBT.getValue().get("ExtendedInfo")); } if (myplayerNBT.getValue().containsKey("MultiWorld")) { CompoundMap map = ((CompoundTag) myplayerNBT.getValue().get("MultiWorld")).getValue(); for (String worldGroupName : map.keySet()) { String petUUID = ((StringTag) map.get(worldGroupName)).getValue(); setMyPetForWorldGroup(worldGroupName, UUID.fromString(petUUID)); } } }"
Inversion-Mutation
megadiff
"public static UILink make(UIContainer parent, String ID, String text, String target) { UILink togo = new UILink(); togo.ID = ID; togo.target = new UIOutput(); if (target != null) { togo.target.setValue(target); } if (text != null) { togo.linktext = new UIOutput(); togo.linktext.setValue(text); } parent.addComponent(togo); return togo; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "make"
"public static UILink make(UIContainer parent, String ID, String text, String target) { UILink togo = new UILink(); togo.ID = ID; togo.target = new UIOutput(); if (target != null) { togo.target.setValue(target); } <MASK>togo.linktext = new UIOutput();</MASK> if (text != null) { togo.linktext.setValue(text); } parent.addComponent(togo); return togo; }"
Inversion-Mutation
megadiff
"private void execute(Process process) throws IOException { InputStream processIS = null; ServletOutputStream servletOS = null; try { processErrorStreamAsync(process); processServletInput(process); processIS = process.getInputStream(); parseHeaders(processIS); servletOS = response.getOutputStream(); long content = ByteStreams.copy(processIS, servletOS); waitForFinish(process, servletOS, content); } finally { IOUtil.close(processIS); IOUtil.close(servletOS); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "execute"
"private void execute(Process process) throws IOException { InputStream processIS = null; ServletOutputStream servletOS = null; try { processErrorStreamAsync(process); processServletInput(process); processIS = process.getInputStream(); <MASK>servletOS = response.getOutputStream();</MASK> parseHeaders(processIS); long content = ByteStreams.copy(processIS, servletOS); waitForFinish(process, servletOS, content); } finally { IOUtil.close(processIS); IOUtil.close(servletOS); } }"