type
stringclasses
1 value
dataset
stringclasses
1 value
input
stringlengths
75
160k
instruction
stringlengths
117
171
output
stringlengths
88
168k
Inversion-Mutation
megadiff
"@Override public void onEnable() { instance = this; configManager = new ConfigManager(); groupMediator = new GroupMediator(); jaLogger = new JukeAlertLogger(); snitchManager = new SnitchManager(); registerEvents(); registerCommands(); snitchManager.loadSnitches(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "onEnable"
"@Override public void onEnable() { instance = this; configManager = new ConfigManager(); jaLogger = new JukeAlertLogger(); snitchManager = new SnitchManager(); <MASK>groupMediator = new GroupMediator();</MASK> registerEvents(); registerCommands(); snitchManager.loadSnitches(); }"
Inversion-Mutation
megadiff
"public void setContent(String content) { // SAK-2470 if (this.content == null) this.content = ""; this.content= content.replaceAll("[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\ud800-\\udfff\\uffff\\ufffe]", ""); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "setContent"
"public void setContent(String content) { <MASK>this.content= content.replaceAll("[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\ud800-\\udfff\\uffff\\ufffe]", "");</MASK> // SAK-2470 if (this.content == null) this.content = ""; }"
Inversion-Mutation
megadiff
"public void statusChanged(DifferenceEvent event) { if (event == DifferenceEvent.DIFF_COMPLETED) { renderer = RenderingService.get(diffs.getEngine()); fillEntityBasedDiffList(); } else if (event == DifferenceEvent.DIFF_RESET) { entityBasedDiffList.removeAll(); diffModel.clear(); } else if (event == DifferenceEvent.SELECTION_CHANGED) { selectionChanged(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "statusChanged"
"public void statusChanged(DifferenceEvent event) { if (event == DifferenceEvent.DIFF_COMPLETED) { <MASK>fillEntityBasedDiffList();</MASK> renderer = RenderingService.get(diffs.getEngine()); } else if (event == DifferenceEvent.DIFF_RESET) { entityBasedDiffList.removeAll(); diffModel.clear(); } else if (event == DifferenceEvent.SELECTION_CHANGED) { selectionChanged(); } }"
Inversion-Mutation
megadiff
"protected void endTextObject() { if (textutil.isInTextObject()) { textutil.endTextObject(); if (this.inMarkedContentSequence) { endMarkedContentSequence(); } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "endTextObject"
"protected void endTextObject() { if (textutil.isInTextObject()) { if (this.inMarkedContentSequence) { endMarkedContentSequence(); } <MASK>textutil.endTextObject();</MASK> } }"
Inversion-Mutation
megadiff
"public void destroy() { super.destroy(); LinuxDisplay.lockAWT(); LinuxDisplay.decDisplay(); GLContext.unloadOpenGLLibrary(); LinuxDisplay.unlockAWT(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "destroy"
"public void destroy() { super.destroy(); LinuxDisplay.lockAWT(); <MASK>GLContext.unloadOpenGLLibrary();</MASK> LinuxDisplay.decDisplay(); LinuxDisplay.unlockAWT(); }"
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
"@Override public PS3ControllerState read() throws IOException { int n = dev.read(buf); if(n != EXPECTED_BUFSIZE && n != EXPECTED_BUFSIZE_2) { throw new IOException("Received packed with unexpected size " + n); } BitSet bs = new BitSet(24); for(int i = 0; i < 8; i++) { if((1 & (buf[2] >> i)) == 1) bs.set(i); } for(int i = 0; i < 8; i++) { if((1 & (buf[3] >> i)) == 1) bs.set(8 + i); } for(int i = 0; i < 8; i++) { if((1 & (buf[4] >> i)) == 1) bs.set(16 + i); } int i = 0; boolean select = bs.get(i++); boolean leftJoystickPress = bs.get(i++); boolean rightJoystickPress = bs.get(i++); boolean start = bs.get(i++); bs.get(i++); bs.get(i++); bs.get(i++); bs.get(i++); boolean L2 = bs.get(i++); boolean R2 = bs.get(i++); boolean R1 = bs.get(i++); boolean L1 = bs.get(i++); boolean triangle = bs.get(i++); boolean circle = bs.get(i++); boolean cross = bs.get(i++); boolean square = bs.get(i++); boolean PS = bs.get(i++); int leftJoystickX = joystickCoordConv(buf[6]); int leftJoystickY = joystickCoordConv(buf[7]); int rightJoystickX = joystickCoordConv(buf[8]); int rightJoystickY = joystickCoordConv(buf[9]); // TODO: decode HAT switch int hatSwitchLeftRight = 0; int hatSwitchUpDown = 0; PS3ControllerState res = new PS3ControllerState(square, cross, circle, triangle, L1, R1, L2, R2, select, start, leftJoystickPress, rightJoystickPress, PS, hatSwitchLeftRight, hatSwitchUpDown, leftJoystickX, leftJoystickY, rightJoystickX, rightJoystickY); return res; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "read"
"@Override public PS3ControllerState read() throws IOException { int n = dev.read(buf); if(n != EXPECTED_BUFSIZE && n != EXPECTED_BUFSIZE_2) { throw new IOException("Received packed with unexpected size " + n); } BitSet bs = new BitSet(24); for(int i = 0; i < 8; i++) { if((1 & (buf[2] >> i)) == 1) bs.set(i); } for(int i = 0; i < 8; i++) { if((1 & (buf[3] >> i)) == 1) bs.set(8 + i); } for(int i = 0; i < 8; i++) { if((1 & (buf[4] >> i)) == 1) bs.set(16 + i); } int i = 0; boolean select = bs.get(i++); boolean leftJoystickPress = bs.get(i++); boolean rightJoystickPress = bs.get(i++); boolean start = bs.get(i++); bs.get(i++); bs.get(i++); bs.get(i++); bs.get(i++); boolean L2 = bs.get(i++); boolean R2 = bs.get(i++); <MASK>boolean L1 = bs.get(i++);</MASK> boolean R1 = bs.get(i++); boolean triangle = bs.get(i++); boolean circle = bs.get(i++); boolean cross = bs.get(i++); boolean square = bs.get(i++); boolean PS = bs.get(i++); int leftJoystickX = joystickCoordConv(buf[6]); int leftJoystickY = joystickCoordConv(buf[7]); int rightJoystickX = joystickCoordConv(buf[8]); int rightJoystickY = joystickCoordConv(buf[9]); // TODO: decode HAT switch int hatSwitchLeftRight = 0; int hatSwitchUpDown = 0; PS3ControllerState res = new PS3ControllerState(square, cross, circle, triangle, L1, R1, L2, R2, select, start, leftJoystickPress, rightJoystickPress, PS, hatSwitchLeftRight, hatSwitchUpDown, leftJoystickX, leftJoystickY, rightJoystickX, rightJoystickY); return res; }"
Inversion-Mutation
megadiff
"@Override public void onReceive(final Context context, Intent intent) { final String action = intent.getAction(); if (Log.LOGV) Log.v("AlarmInitReceiver" + action); final PendingResult result = goAsync(); final WakeLock wl = AlarmAlertWakeLock.createPartialWakeLock(context); wl.acquire(); AsyncHandler.post(new Runnable() { @Override public void run() { // Remove the snooze alarm after a boot. if (action.equals(Intent.ACTION_BOOT_COMPLETED)) { Alarms.saveSnoozeAlert(context, Alarms.INVALID_ALARM_ID, -1); Alarms.disableExpiredAlarms(context); } Alarms.setNextAlert(context); result.finish(); Log.v("AlarmInitReceiver finished"); wl.release(); } }); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "onReceive"
"@Override public void onReceive(final Context context, Intent intent) { final String action = intent.getAction(); if (Log.LOGV) Log.v("AlarmInitReceiver" + action); final PendingResult result = goAsync(); final WakeLock wl = AlarmAlertWakeLock.createPartialWakeLock(context); wl.acquire(); AsyncHandler.post(new Runnable() { @Override public void run() { // Remove the snooze alarm after a boot. if (action.equals(Intent.ACTION_BOOT_COMPLETED)) { Alarms.saveSnoozeAlert(context, Alarms.INVALID_ALARM_ID, -1); } <MASK>Alarms.disableExpiredAlarms(context);</MASK> Alarms.setNextAlert(context); result.finish(); Log.v("AlarmInitReceiver finished"); wl.release(); } }); }"
Inversion-Mutation
megadiff
"@Override public void run() { // Remove the snooze alarm after a boot. if (action.equals(Intent.ACTION_BOOT_COMPLETED)) { Alarms.saveSnoozeAlert(context, Alarms.INVALID_ALARM_ID, -1); Alarms.disableExpiredAlarms(context); } Alarms.setNextAlert(context); result.finish(); Log.v("AlarmInitReceiver finished"); wl.release(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "run"
"@Override public void run() { // Remove the snooze alarm after a boot. if (action.equals(Intent.ACTION_BOOT_COMPLETED)) { Alarms.saveSnoozeAlert(context, Alarms.INVALID_ALARM_ID, -1); } <MASK>Alarms.disableExpiredAlarms(context);</MASK> Alarms.setNextAlert(context); result.finish(); Log.v("AlarmInitReceiver finished"); wl.release(); }"
Inversion-Mutation
megadiff
"private void checkCollition() { try { itemCollition(); tileCollition(); iObjectCollition(); creatureCollition(); checkFalling(); } catch (ArrayIndexOutOfBoundsException e) { new Sound().play("resources/sfx/kangaroo_death.WAV", false); restartLevel(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "checkCollition"
"private void checkCollition() { try { <MASK>creatureCollition();</MASK> itemCollition(); tileCollition(); iObjectCollition(); checkFalling(); } catch (ArrayIndexOutOfBoundsException e) { new Sound().play("resources/sfx/kangaroo_death.WAV", false); restartLevel(); } }"
Inversion-Mutation
megadiff
"public String getHelp() { StringBuffer help = new StringBuffer(); help.append("---"); //$NON-NLS-1$ help.append("Configurator Commands"); //$NON-NLS-1$ help.append("---"); //$NON-NLS-1$ help.append(NEW_LINE); help.append("\tconfapply [<config URL>] - Applies a configuration"); //$NON-NLS-1$ help.append(NEW_LINE); return help.toString(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getHelp"
"public String getHelp() { StringBuffer help = new StringBuffer(); <MASK>help.append(NEW_LINE);</MASK> help.append("---"); //$NON-NLS-1$ help.append("Configurator Commands"); //$NON-NLS-1$ help.append("---"); //$NON-NLS-1$ <MASK>help.append(NEW_LINE);</MASK> help.append("\tconfapply [<config URL>] - Applies a configuration"); //$NON-NLS-1$ return help.toString(); }"
Inversion-Mutation
megadiff
"@Override protected void mergeRatio(Ratio old, Ratio ratio) { old.setTotalCount(old.getTotalCount() + ratio.getTotalCount()); old.setTotalTime(old.getTotalTime() + ratio.getTotalTime()); if (old.getMin() == 0) { old.setMin(ratio.getMin()); } if (ratio.getMin() < old.getMin()) { old.setMin(ratio.getMin()); } if (ratio.getMax() > old.getMax()) { old.setMax(ratio.getMax()); old.setUrl(ratio.getUrl()); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "mergeRatio"
"@Override protected void mergeRatio(Ratio old, Ratio ratio) { <MASK>old.setUrl(ratio.getUrl());</MASK> old.setTotalCount(old.getTotalCount() + ratio.getTotalCount()); old.setTotalTime(old.getTotalTime() + ratio.getTotalTime()); if (old.getMin() == 0) { old.setMin(ratio.getMin()); } if (ratio.getMin() < old.getMin()) { old.setMin(ratio.getMin()); } if (ratio.getMax() > old.getMax()) { old.setMax(ratio.getMax()); } }"
Inversion-Mutation
megadiff
"public void setPosition(double lat, double lon, int zoom){ MapController mc = map.getController(); GeoPoint p = new GeoPoint((int)(lat*1E6), (int)(lon*1E6)); logOverlay.add(p); mc.setCenter(p); mc.setZoom(zoom); this.myOverlay.getMyLocation(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "setPosition"
"public void setPosition(double lat, double lon, int zoom){ MapController mc = map.getController(); GeoPoint p = new GeoPoint((int)(lat*1E6), (int)(lon*1E6)); mc.setCenter(p); mc.setZoom(zoom); this.myOverlay.getMyLocation(); <MASK>logOverlay.add(p);</MASK> }"
Inversion-Mutation
megadiff
"private Element upload(Element params, ServiceContext context) throws Exception { String uploadDir = context.getUploadDir(); Element uploadResult = null; // Upload RDF file String fname = null; String url = null; File rdfFile = null; Element param = params.getChild(Params.FNAME); if (param == null) { url = Util.getParam(params, "url", ""); // -- get the rdf file from the net if (!"".equals(url)) { Log.debug("Thesaurus", "Uploading thesaurus: " + url); URI uri = new URI(url); rdfFile = File.createTempFile("thesaurus", ".rdf"); XmlRequest httpReq = new XmlRequest(uri.getHost(), uri.getPort()); httpReq.setAddress(uri.getPath()); Lib.net.setupProxy(context, httpReq); httpReq.executeLarge(rdfFile); fname = url.substring(url.lastIndexOf("/") + 1, url.length()); } else { Log.debug("Thesaurus", "No URL or file name provided for thesaurus upload."); } } else { fname = param.getTextTrim(); if (fname.contains("..")) { throw new BadParameterEx("Invalid character found in thesaurus name.", fname); } rdfFile = new File(uploadDir, fname); } if (fname == null || "".equals(fname)) { throw new OperationAbortedEx( "File upload from URL or file return null."); } long fsize = 0; if (rdfFile.exists()) { fsize = rdfFile.length(); } else { throw new OperationAbortedEx("Thesaurus file doesn't exist"); } // -- check that the archive actually has something in it if (fsize == 0) { throw new OperationAbortedEx("Thesaurus file has zero size"); } // Thesaurus Type (local, external) String type = Util.getParam(params, Params.TYPE, "external"); // Thesaurus directory - one of the ISO theme (Discipline, Place, // Stratum, Temporal, Theme) String dir = Util.getParam(params, Params.DIR, "theme"); // no XSL to be applied String style = Util.getParam(params, Params.STYLESHEET, "_none_"); Element eTSResult; String extension = fname.substring(fname.lastIndexOf('.')) .toLowerCase(); if (extension.equals(".rdf") || extension.equals(".xml")) { Log.debug("Thesaurus", "Uploading thesaurus: " + fname); eTSResult = UploadThesaurus(rdfFile, style, context, fname, type, dir); } else { Log.debug("Thesaurus", "Incorrect extension for thesaurus named: " + fname); throw new Exception("Incorrect extension for thesaurus named: " + fname); } uploadResult = new Element("record").setText("Thesaurus uploaded"); uploadResult.addContent(eTSResult); return uploadResult; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "upload"
"private Element upload(Element params, ServiceContext context) throws Exception { String uploadDir = context.getUploadDir(); Element uploadResult = null; // Upload RDF file String fname = null; String url = null; File rdfFile = null; Element param = params.getChild(Params.FNAME); if (param == null) { url = Util.getParam(params, "url", ""); // -- get the rdf file from the net if (!"".equals(url)) { Log.debug("Thesaurus", "Uploading thesaurus: " + url); URI uri = new URI(url); rdfFile = File.createTempFile("thesaurus", ".rdf"); XmlRequest httpReq = new XmlRequest(uri.getHost(), uri.getPort()); httpReq.setAddress(uri.getPath()); Lib.net.setupProxy(context, httpReq); httpReq.executeLarge(rdfFile); fname = url.substring(url.lastIndexOf("/") + 1, url.length()); } else { Log.debug("Thesaurus", "No URL or file name provided for thesaurus upload."); } } else { if (fname.contains("..")) { throw new BadParameterEx("Invalid character found in thesaurus name.", fname); } <MASK>fname = param.getTextTrim();</MASK> rdfFile = new File(uploadDir, fname); } if (fname == null || "".equals(fname)) { throw new OperationAbortedEx( "File upload from URL or file return null."); } long fsize = 0; if (rdfFile.exists()) { fsize = rdfFile.length(); } else { throw new OperationAbortedEx("Thesaurus file doesn't exist"); } // -- check that the archive actually has something in it if (fsize == 0) { throw new OperationAbortedEx("Thesaurus file has zero size"); } // Thesaurus Type (local, external) String type = Util.getParam(params, Params.TYPE, "external"); // Thesaurus directory - one of the ISO theme (Discipline, Place, // Stratum, Temporal, Theme) String dir = Util.getParam(params, Params.DIR, "theme"); // no XSL to be applied String style = Util.getParam(params, Params.STYLESHEET, "_none_"); Element eTSResult; String extension = fname.substring(fname.lastIndexOf('.')) .toLowerCase(); if (extension.equals(".rdf") || extension.equals(".xml")) { Log.debug("Thesaurus", "Uploading thesaurus: " + fname); eTSResult = UploadThesaurus(rdfFile, style, context, fname, type, dir); } else { Log.debug("Thesaurus", "Incorrect extension for thesaurus named: " + fname); throw new Exception("Incorrect extension for thesaurus named: " + fname); } uploadResult = new Element("record").setText("Thesaurus uploaded"); uploadResult.addContent(eTSResult); return uploadResult; }"
Inversion-Mutation
megadiff
"public List getUserGroupIDs(String playerName) { if (config.webappSecondaryGroupStorageMethod.toLowerCase().startsWith("sin")) { return getUserGroupIDsSingleColumn(playerName); } else if (config.webappSecondaryGroupStorageMethod.toLowerCase().startsWith("jun")) { return getUserGroupIDsJunction(playerName); } else if (config.webappSecondaryGroupStorageMethod.toLowerCase().startsWith("key")) { return getUserGroupIDsKeyValue(playerName); } log.severe("Invalid storage method for secondary groups."); return null; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getUserGroupIDs"
"public List getUserGroupIDs(String playerName) { if (config.webappSecondaryGroupStorageMethod.toLowerCase().startsWith("sin")) { return getUserGroupIDsSingleColumn(playerName); } else if (config.webappSecondaryGroupStorageMethod.toLowerCase().startsWith("jun")) { return getUserGroupIDsJunction(playerName); } else if (config.webappSecondaryGroupStorageMethod.toLowerCase().startsWith("key")) { <MASK>log.severe("Invalid storage method for secondary groups.");</MASK> return getUserGroupIDsKeyValue(playerName); } return null; }"
Inversion-Mutation
megadiff
"public SessionImpl(String workspaceName, ConversationState userState, ExoContainer container) throws RepositoryException { this.workspaceName = workspaceName; this.container = container; this.live = true; this.id = System.currentTimeMillis() + "_" + SEQUENCE.incrementAndGet(); this.userState = userState; this.txResourceManager = (TransactionableResourceManager)container.getComponentInstanceOfType(TransactionableResourceManager.class); this.repository = (RepositoryImpl)container.getComponentInstanceOfType(RepositoryImpl.class); this.systemLocationFactory = (LocationFactory)container.getComponentInstanceOfType(LocationFactory.class); this.accessManager = (AccessManager)container.getComponentInstanceOfType(AccessManager.class); WorkspaceEntry wsConfig = (WorkspaceEntry)container.getComponentInstanceOfType(WorkspaceEntry.class); this.lazyReadThreshold = wsConfig.getLazyReadThreshold() > 0 ? wsConfig.getLazyReadThreshold() : DEFAULT_LAZY_READ_THRESHOLD; this.locationFactory = new LocationFactory(this); this.cleanerHolder = (FileCleanerHolder)container.getComponentInstanceOfType(FileCleanerHolder.class); this.valueFactory = new ValueFactoryImpl(locationFactory, wsConfig, cleanerHolder); this.namespaces = new LinkedHashMap<String, String>(); this.prefixes = new LinkedHashMap<String, String>(); // Observation manager per session ObservationManagerRegistry observationManagerRegistry = (ObservationManagerRegistry)container.getComponentInstanceOfType(ObservationManagerRegistry.class); ObservationManager observationManager = observationManagerRegistry.createObservationManager(this); LocalWorkspaceDataManagerStub workspaceDataManager = (LocalWorkspaceDataManagerStub)container.getComponentInstanceOfType(LocalWorkspaceDataManagerStub.class); this.dataManager = new SessionDataManager(this, workspaceDataManager); this.lockManager = ((WorkspaceLockManager)container.getComponentInstanceOfType(WorkspaceLockManager.class)) .getSessionLockManager(id, dataManager); this.nodeTypeManager = (NodeTypeDataManager)container.getComponentInstanceOfType(NodeTypeDataManager.class); this.workspace = new WorkspaceImpl(workspaceName, container, this, observationManager); this.lifecycleListeners = new ArrayList<SessionLifecycleListener>(); this.registerLifecycleListener((ObservationManagerImpl)observationManager); this.registerLifecycleListener(lockManager); SessionActionCatalog catalog = (SessionActionCatalog)container.getComponentInstanceOfType(SessionActionCatalog.class); actionHandler = new SessionActionInterceptor(catalog, container, workspaceName); sessionRegistry = (SessionRegistry)container.getComponentInstanceOfType(SessionRegistry.class); sessionRegistry.registerSession(this); this.lastAccessTime = System.currentTimeMillis(); // check bad spelled this.triggerEventsForDescendantsOnRename = wsConfig.getContainer().getParameterBoolean(WorkspaceDataContainer.TRIGGER_EVENTS_FOR_DESCENDENTS_ON_RENAME, WorkspaceDataContainer.TRIGGER_EVENTS_FOR_DESCENDANTS_ON_RENAME_DEFAULT); this.triggerEventsForDescendantsOnRename = wsConfig.getContainer().getParameterBoolean(WorkspaceDataContainer.TRIGGER_EVENTS_FOR_DESCENDANTS_ON_RENAME, triggerEventsForDescendantsOnRename); this.lazyNodeIteatorPageSize = wsConfig.getContainer().getParameterInteger(WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE, WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_DEFAULT); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "SessionImpl"
"public SessionImpl(String workspaceName, ConversationState userState, ExoContainer container) throws RepositoryException { this.workspaceName = workspaceName; this.container = container; this.live = true; this.id = System.currentTimeMillis() + "_" + SEQUENCE.incrementAndGet(); this.userState = userState; this.txResourceManager = (TransactionableResourceManager)container.getComponentInstanceOfType(TransactionableResourceManager.class); this.repository = (RepositoryImpl)container.getComponentInstanceOfType(RepositoryImpl.class); this.systemLocationFactory = (LocationFactory)container.getComponentInstanceOfType(LocationFactory.class); this.accessManager = (AccessManager)container.getComponentInstanceOfType(AccessManager.class); WorkspaceEntry wsConfig = (WorkspaceEntry)container.getComponentInstanceOfType(WorkspaceEntry.class); this.lazyReadThreshold = wsConfig.getLazyReadThreshold() > 0 ? wsConfig.getLazyReadThreshold() : DEFAULT_LAZY_READ_THRESHOLD; this.locationFactory = new LocationFactory(this); this.cleanerHolder = (FileCleanerHolder)container.getComponentInstanceOfType(FileCleanerHolder.class); this.valueFactory = new ValueFactoryImpl(locationFactory, wsConfig, cleanerHolder); this.namespaces = new LinkedHashMap<String, String>(); this.prefixes = new LinkedHashMap<String, String>(); // Observation manager per session ObservationManagerRegistry observationManagerRegistry = (ObservationManagerRegistry)container.getComponentInstanceOfType(ObservationManagerRegistry.class); ObservationManager observationManager = observationManagerRegistry.createObservationManager(this); LocalWorkspaceDataManagerStub workspaceDataManager = (LocalWorkspaceDataManagerStub)container.getComponentInstanceOfType(LocalWorkspaceDataManagerStub.class); this.dataManager = new SessionDataManager(this, workspaceDataManager); this.lockManager = ((WorkspaceLockManager)container.getComponentInstanceOfType(WorkspaceLockManager.class)) .getSessionLockManager(id, dataManager); this.nodeTypeManager = (NodeTypeDataManager)container.getComponentInstanceOfType(NodeTypeDataManager.class); this.workspace = new WorkspaceImpl(workspaceName, container, this, observationManager); this.lifecycleListeners = new ArrayList<SessionLifecycleListener>(); this.registerLifecycleListener((ObservationManagerImpl)observationManager); this.registerLifecycleListener(lockManager); SessionActionCatalog catalog = (SessionActionCatalog)container.getComponentInstanceOfType(SessionActionCatalog.class); actionHandler = new SessionActionInterceptor(catalog, container, workspaceName); sessionRegistry = (SessionRegistry)container.getComponentInstanceOfType(SessionRegistry.class); sessionRegistry.registerSession(this); this.lastAccessTime = System.currentTimeMillis(); this.triggerEventsForDescendantsOnRename = wsConfig.getContainer().getParameterBoolean(WorkspaceDataContainer.TRIGGER_EVENTS_FOR_DESCENDENTS_ON_RENAME, WorkspaceDataContainer.TRIGGER_EVENTS_FOR_DESCENDANTS_ON_RENAME_DEFAULT); <MASK>// check bad spelled</MASK> this.triggerEventsForDescendantsOnRename = wsConfig.getContainer().getParameterBoolean(WorkspaceDataContainer.TRIGGER_EVENTS_FOR_DESCENDANTS_ON_RENAME, triggerEventsForDescendantsOnRename); this.lazyNodeIteatorPageSize = wsConfig.getContainer().getParameterInteger(WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE, WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_DEFAULT); }"
Inversion-Mutation
megadiff
"public void dispose() { if (scp == null) { // already disposed! return; } if (Activator.DEBUG) { Activator.log.debug("ComponentInstanceImpl.dispose(): disposing instance of component " + scp.name, null); //$NON-NLS-1$ } if (!scp.isComponentFactory() && scp.serviceComponent.factory != null) { // this is a component factory instance, so dispose SCP scp.serviceComponent.componentProps.removeElement(scp); Vector toDispose = new Vector(1); toDispose.addElement(scp); InstanceProcess.resolver.disposeComponentConfigs(toDispose, ComponentConstants.DEACTIVATION_REASON_DISPOSED); if (scp != null) { scp.setState(Component.STATE_DISPOSED); } } else { scp.dispose(this, ComponentConstants.DEACTIVATION_REASON_DISPOSED); } // free service references if some are left ungotten freeServiceReferences(); scp = null; componentContext = null; instance = null; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "dispose"
"public void dispose() { if (scp == null) { // already disposed! return; } if (Activator.DEBUG) { Activator.log.debug("ComponentInstanceImpl.dispose(): disposing instance of component " + scp.name, null); //$NON-NLS-1$ } if (!scp.isComponentFactory() && scp.serviceComponent.factory != null) { // this is a component factory instance, so dispose SCP scp.serviceComponent.componentProps.removeElement(scp); Vector toDispose = new Vector(1); toDispose.addElement(scp); InstanceProcess.resolver.disposeComponentConfigs(toDispose, ComponentConstants.DEACTIVATION_REASON_DISPOSED); if (scp != null) { scp.setState(Component.STATE_DISPOSED); <MASK>scp = null;</MASK> } } else { scp.dispose(this, ComponentConstants.DEACTIVATION_REASON_DISPOSED); } // free service references if some are left ungotten freeServiceReferences(); componentContext = null; instance = null; }"
Inversion-Mutation
megadiff
"public HttpAccess getHttpAccess() { return new HttpAccess() { public void handleAccess(HttpServletRequest req, HttpServletResponse res, Reference ref, Collection copyrightAcceptedRefs) throws EntityPermissionException, EntityNotDefinedException, EntityAccessOverloadException, EntityCopyrightException { try { Site site = (Site) ref.getEntity(); String skin = getSiteSkin(site.getId()); String skinRepo = serverConfigurationService().getString("skin.repo"); String skinDefault = serverConfigurationService().getString("skin.default"); // make sure that it points to the default if there is no skin if (skin == null) { skin = skinDefault; } res.setContentType("text/html; charset=UTF-8"); PrintWriter out = res.getWriter(); out .println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); out.println("<html xmlns=\"http://www.w3.org/1999/xhtml\">"); out.println("<head>"); out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"); out.println("<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />"); out.println("<link href=\"" + skinRepo + "/tool_base.css\" type=\"text/css\" rel=\"stylesheet\" media=\"all\" />"); out.println("<link href=\"" + skinRepo + "/" + skin + "/tool.css\" type=\"text/css\" rel=\"stylesheet\" media=\"all\" />"); out.println("<title>"); out.println(site.getTitle()); out.println("</title>"); out.println("</head><body><div class=\"portletBody\">"); out.println("<br />"); // get the description - if missing, use the site title String description = site.getDescription(); if (description == null) { description = site.getTitle(); } // make it safe for html description = Validator.escapeHtml(description); out.println(description); out.println("</div></body></html>"); } catch (Throwable t) { throw new EntityNotDefinedException(ref.getReference()); } } }; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getHttpAccess"
"public HttpAccess getHttpAccess() { return new HttpAccess() { public void handleAccess(HttpServletRequest req, HttpServletResponse res, Reference ref, Collection copyrightAcceptedRefs) throws EntityPermissionException, EntityNotDefinedException, EntityAccessOverloadException, EntityCopyrightException { try { Site site = (Site) ref.getEntity(); String skin = getSiteSkin(site.getId()); String skinRepo = serverConfigurationService().getString("skin.repo"); String skinDefault = serverConfigurationService().getString("skin.default"); // make sure that it points to the default if there is no skin if (skin == null) { skin = skinDefault; } res.setContentType("text/html; charset=UTF-8"); PrintWriter out = res.getWriter(); out .println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); out.println("<html xmlns=\"http://www.w3.org/1999/xhtml\">"); <MASK>out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />");</MASK> out.println("<head>"); out.println("<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />"); out.println("<link href=\"" + skinRepo + "/tool_base.css\" type=\"text/css\" rel=\"stylesheet\" media=\"all\" />"); out.println("<link href=\"" + skinRepo + "/" + skin + "/tool.css\" type=\"text/css\" rel=\"stylesheet\" media=\"all\" />"); out.println("<title>"); out.println(site.getTitle()); out.println("</title>"); out.println("</head><body><div class=\"portletBody\">"); out.println("<br />"); // get the description - if missing, use the site title String description = site.getDescription(); if (description == null) { description = site.getTitle(); } // make it safe for html description = Validator.escapeHtml(description); out.println(description); out.println("</div></body></html>"); } catch (Throwable t) { throw new EntityNotDefinedException(ref.getReference()); } } }; }"
Inversion-Mutation
megadiff
"public void handleAccess(HttpServletRequest req, HttpServletResponse res, Reference ref, Collection copyrightAcceptedRefs) throws EntityPermissionException, EntityNotDefinedException, EntityAccessOverloadException, EntityCopyrightException { try { Site site = (Site) ref.getEntity(); String skin = getSiteSkin(site.getId()); String skinRepo = serverConfigurationService().getString("skin.repo"); String skinDefault = serverConfigurationService().getString("skin.default"); // make sure that it points to the default if there is no skin if (skin == null) { skin = skinDefault; } res.setContentType("text/html; charset=UTF-8"); PrintWriter out = res.getWriter(); out .println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); out.println("<html xmlns=\"http://www.w3.org/1999/xhtml\">"); out.println("<head>"); out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"); out.println("<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />"); out.println("<link href=\"" + skinRepo + "/tool_base.css\" type=\"text/css\" rel=\"stylesheet\" media=\"all\" />"); out.println("<link href=\"" + skinRepo + "/" + skin + "/tool.css\" type=\"text/css\" rel=\"stylesheet\" media=\"all\" />"); out.println("<title>"); out.println(site.getTitle()); out.println("</title>"); out.println("</head><body><div class=\"portletBody\">"); out.println("<br />"); // get the description - if missing, use the site title String description = site.getDescription(); if (description == null) { description = site.getTitle(); } // make it safe for html description = Validator.escapeHtml(description); out.println(description); out.println("</div></body></html>"); } catch (Throwable t) { throw new EntityNotDefinedException(ref.getReference()); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "handleAccess"
"public void handleAccess(HttpServletRequest req, HttpServletResponse res, Reference ref, Collection copyrightAcceptedRefs) throws EntityPermissionException, EntityNotDefinedException, EntityAccessOverloadException, EntityCopyrightException { try { Site site = (Site) ref.getEntity(); String skin = getSiteSkin(site.getId()); String skinRepo = serverConfigurationService().getString("skin.repo"); String skinDefault = serverConfigurationService().getString("skin.default"); // make sure that it points to the default if there is no skin if (skin == null) { skin = skinDefault; } res.setContentType("text/html; charset=UTF-8"); PrintWriter out = res.getWriter(); out .println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); out.println("<html xmlns=\"http://www.w3.org/1999/xhtml\">"); <MASK>out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />");</MASK> out.println("<head>"); out.println("<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />"); out.println("<link href=\"" + skinRepo + "/tool_base.css\" type=\"text/css\" rel=\"stylesheet\" media=\"all\" />"); out.println("<link href=\"" + skinRepo + "/" + skin + "/tool.css\" type=\"text/css\" rel=\"stylesheet\" media=\"all\" />"); out.println("<title>"); out.println(site.getTitle()); out.println("</title>"); out.println("</head><body><div class=\"portletBody\">"); out.println("<br />"); // get the description - if missing, use the site title String description = site.getDescription(); if (description == null) { description = site.getTitle(); } // make it safe for html description = Validator.escapeHtml(description); out.println(description); out.println("</div></body></html>"); } catch (Throwable t) { throw new EntityNotDefinedException(ref.getReference()); } }"
Inversion-Mutation
megadiff
"public void drawAll(){ // Runtime.getRuntime().exec("cls"); System.out.print(String.format("%c8", escCode)); // int row = 0; // int column =0; // System.out.print(String.format("%c[%d;%df", escCode, row, column)); for(int i = 0; i < size; i++){ for(int j = 0; j < size; j++){ if(grid[i][j] != null){ grid[i][j].drawyoself(); }else{ System.out.print(" "); } } System.out.println(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "drawAll"
"public void drawAll(){ // Runtime.getRuntime().exec("cls"); System.out.print(String.format("%c8", escCode)); // int row = 0; // int column =0; // System.out.print(String.format("%c[%d;%df", escCode, row, column)); <MASK>System.out.println();</MASK> for(int i = 0; i < size; i++){ for(int j = 0; j < size; j++){ if(grid[i][j] != null){ grid[i][j].drawyoself(); }else{ System.out.print(" "); } } } }"
Inversion-Mutation
megadiff
"public void run() { int priority = Thread.currentThread().getPriority(); Thread.currentThread().setPriority(Thread.MAX_PRIORITY); try { stop = true; while(stop) { try { // attempt masking at this rate Thread.currentThread().sleep(1); }catch (InterruptedException iex) { Thread.currentThread().interrupt(); return; } System.out.print("\010" + echochar); } } finally { // restore the original priority Thread.currentThread().setPriority(priority); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "run"
"public void run() { int priority = Thread.currentThread().getPriority(); Thread.currentThread().setPriority(Thread.MAX_PRIORITY); try { stop = true; while(stop) { <MASK>System.out.print("\010" + echochar);</MASK> try { // attempt masking at this rate Thread.currentThread().sleep(1); }catch (InterruptedException iex) { Thread.currentThread().interrupt(); return; } } } finally { // restore the original priority Thread.currentThread().setPriority(priority); } }"
Inversion-Mutation
megadiff
"public void test() throws Exception { testTransaction(false); testCreateDrop(); if (config.memory) { return; } testMultiThreaded(); testStreamLob(); test(false, "VARCHAR"); test(false, "CLOB"); testPerformance(false); testReopen(false); String luceneFullTextClassName = "org.h2.fulltext.FullTextLucene"; try { Class.forName(luceneFullTextClassName); testTransaction(true); test(true, "VARCHAR"); test(true, "CLOB"); testPerformance(true); testReopen(true); } catch (ClassNotFoundException e) { println("Class not found, not tested: " + luceneFullTextClassName); // ok } catch (NoClassDefFoundError e) { println("Class not found, not tested: " + luceneFullTextClassName); // ok } FullText.closeAll(); deleteDb("fullText"); deleteDb("fullTextReopen"); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "test"
"public void test() throws Exception { testTransaction(false); <MASK>testTransaction(true);</MASK> testCreateDrop(); if (config.memory) { return; } testMultiThreaded(); testStreamLob(); test(false, "VARCHAR"); test(false, "CLOB"); testPerformance(false); testReopen(false); String luceneFullTextClassName = "org.h2.fulltext.FullTextLucene"; try { Class.forName(luceneFullTextClassName); test(true, "VARCHAR"); test(true, "CLOB"); testPerformance(true); testReopen(true); } catch (ClassNotFoundException e) { println("Class not found, not tested: " + luceneFullTextClassName); // ok } catch (NoClassDefFoundError e) { println("Class not found, not tested: " + luceneFullTextClassName); // ok } FullText.closeAll(); deleteDb("fullText"); deleteDb("fullTextReopen"); }"
Inversion-Mutation
megadiff
"@Override public synchronized void onSuccess(BaseClientPutter state, ObjectContainer container) { try { synchronized(mMessageManager) { WoTOwnMessage m = (WoTOwnMessage)mMessageManager.getOwnMessage(mMessageIDs.get(state)); m.markAsInserted(state.getURI()); mMessageManager.addMessageToMessageList(m); Logger.debug(this, "Successful insert of " + m.getRealURI()); } } catch(Exception e) { Logger.error(this, "Message insert finished but onSuccess() failed", e); } finally { removeInsert(state); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "onSuccess"
"@Override public synchronized void onSuccess(BaseClientPutter state, ObjectContainer container) { try { synchronized(mMessageManager) { WoTOwnMessage m = (WoTOwnMessage)mMessageManager.getOwnMessage(mMessageIDs.get(state)); m.markAsInserted(state.getURI()); mMessageManager.addMessageToMessageList(m); } <MASK>Logger.debug(this, "Successful insert of " + m.getRealURI());</MASK> } catch(Exception e) { Logger.error(this, "Message insert finished but onSuccess() failed", e); } finally { removeInsert(state); } }"
Inversion-Mutation
megadiff
"@Test public void testPidParameter02() throws Exception { String containerXml = this.theContainerXml; Document containerDoc = EscidocAbstractTest.getDocument(containerXml); String containerId = getObjidValue(containerDoc); DateTime lmd = getLastModificationDateValue2(containerDoc); String pidToRegister = "hdl:testPrefix/" + containerId; AssignParam assignPidParam = new AssignParam(); assignPidParam.setPid(pidToRegister); String taskParam = getAssignPidTaskParam(lmd, assignPidParam); String pidXML = assignVersionPid(containerId, taskParam); compareContainerVersionPid(containerId, pidXML); Document pidDoc = getDocument(pidXML); Node returnedPid = selectSingleNode(pidDoc, XPATH_RESULT_PID); assertEquals(pidToRegister, returnedPid.getTextContent()); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "testPidParameter02"
"@Test public void testPidParameter02() throws Exception { <MASK>String pidToRegister = "hdl:testPrefix/" + containerId;</MASK> String containerXml = this.theContainerXml; Document containerDoc = EscidocAbstractTest.getDocument(containerXml); String containerId = getObjidValue(containerDoc); DateTime lmd = getLastModificationDateValue2(containerDoc); AssignParam assignPidParam = new AssignParam(); assignPidParam.setPid(pidToRegister); String taskParam = getAssignPidTaskParam(lmd, assignPidParam); String pidXML = assignVersionPid(containerId, taskParam); compareContainerVersionPid(containerId, pidXML); Document pidDoc = getDocument(pidXML); Node returnedPid = selectSingleNode(pidDoc, XPATH_RESULT_PID); assertEquals(pidToRegister, returnedPid.getTextContent()); }"
Inversion-Mutation
megadiff
"@Override public void processHttpResponse(Context context) { ContentResolver resolver = context.getContentResolver(); // Delete old logins resolver.delete(RedditContract.Login.CONTENT_URI, null, null); RedditLoginResponse response = JsonDeserializer.deserialize(result.getJson(), RedditLoginResponse.class); if (response == null) { Log.e(TAG, "Error parsing Reddit login response"); return; } // The username isn't sent back with the login response, so we have it passed // through from the login request String username = result.getExtraData().getString(RedditContract.Login.USERNAME); if (response.getLoginResponse() != null && response.getLoginResponse().getData() != null) { response.getLoginResponse().getData().setUsername(username); } ContentValues loginValues = response.getContentValues(); Intent loginNotify = new Intent(Consts.BROADCAST_LOGIN_COMPLETE); loginNotify.putExtra(Consts.EXTRA_USERNAME, username); if (loginValues.getAsBoolean(RedditContract.Login.SUCCESS)) { loginNotify.putExtra(Consts.EXTRA_SUCCESS, true); resolver.insert(RedditContract.Login.CONTENT_URI, loginValues); } else { loginNotify.putExtra(Consts.EXTRA_SUCCESS, false); loginNotify.putExtra(Consts.EXTRA_ERROR_MESSAGE, loginValues.getAsString(RedditContract.Login.ERROR_MESSAGE)); } LocalBroadcastManager.getInstance(context).sendBroadcast(loginNotify); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "processHttpResponse"
"@Override public void processHttpResponse(Context context) { ContentResolver resolver = context.getContentResolver(); // Delete old logins resolver.delete(RedditContract.Login.CONTENT_URI, null, null); RedditLoginResponse response = JsonDeserializer.deserialize(result.getJson(), RedditLoginResponse.class); if (response == null) { Log.e(TAG, "Error parsing Reddit login response"); return; } // The username isn't sent back with the login response, so we have it passed // through from the login request String username = result.getExtraData().getString(RedditContract.Login.USERNAME); if (response.getLoginResponse() != null && response.getLoginResponse().getData() != null) { response.getLoginResponse().getData().setUsername(username); } ContentValues loginValues = response.getContentValues(); Intent loginNotify = new Intent(Consts.BROADCAST_LOGIN_COMPLETE); loginNotify.putExtra(Consts.EXTRA_USERNAME, username); if (loginValues.getAsBoolean(RedditContract.Login.SUCCESS)) { loginNotify.putExtra(Consts.EXTRA_SUCCESS, true); } else { loginNotify.putExtra(Consts.EXTRA_SUCCESS, false); loginNotify.putExtra(Consts.EXTRA_ERROR_MESSAGE, loginValues.getAsString(RedditContract.Login.ERROR_MESSAGE)); } <MASK>resolver.insert(RedditContract.Login.CONTENT_URI, loginValues);</MASK> LocalBroadcastManager.getInstance(context).sendBroadcast(loginNotify); }"
Inversion-Mutation
megadiff
"public String formatDateDiff(long date) { Calendar now = new GregorianCalendar(); Calendar c = new GregorianCalendar(); c.setTimeInMillis(date); return formatDateDiff(now, c); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "formatDateDiff"
"public String formatDateDiff(long date) { Calendar c = new GregorianCalendar(); c.setTimeInMillis(date); <MASK>Calendar now = new GregorianCalendar();</MASK> return formatDateDiff(now, c); }"
Inversion-Mutation
megadiff
"private void handleCommand(Command cmd) { switch (cmd) { case LEFT: this.client.write("se;"); this.client.write("ga;"); break; case RIGHT: this.client.write("a;"); this.client.write("ba;"); break; case UP: this.client.write("la;"); this.client.write("pr;"); break; case DOWN: this.client.write("ty;"); this.client.write("ma;"); break; case QUIT: this.client.write("quit;"); this.source = null; this.client = null; return; } try { while (this.source.poll(500, TimeUnit.MILLISECONDS) != null) { // will handle result here } } catch (InterruptedException e) { throw new RuntimeException(e); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "handleCommand"
"private void handleCommand(Command cmd) { switch (cmd) { case LEFT: this.client.write("se;"); this.client.write("ga;"); break; case RIGHT: this.client.write("a;"); this.client.write("ba;"); break; case UP: this.client.write("la;"); this.client.write("pr;"); break; case DOWN: this.client.write("ty;"); this.client.write("ma;"); break; case QUIT: this.source = null; this.client = null; <MASK>this.client.write("quit;");</MASK> return; } try { while (this.source.poll(500, TimeUnit.MILLISECONDS) != null) { // will handle result here } } catch (InterruptedException e) { throw new RuntimeException(e); } }"
Inversion-Mutation
megadiff
"@SuppressWarnings("unchecked") private void executeRewrite() { BufferedReader reader = null; PrintStream output = null; try { try { reader = new BufferedReader(new FileReader(input)); output = new PrintStream(new File(destDir, input.getName())); int i, num = 0; String line, key, value; OverrideType override; while ((line = reader.readLine()) != null) { num ++; i = line.indexOf(':'); if (i == -1) throw new BuildException("unexpected line in jad file: "+num); key = line.substring(0, i); value = line.substring(i+1); if (key.startsWith("RIM-COD-URL") || key.startsWith("RIM-COD-SHA1") || key.startsWith("RIM-COD-Size")) { continue; // ignore line } // check for .jad element override, remove from map if found override = overrideMap.get(key.toLowerCase()); if (override != null) { value = override.getValue(); overrideMap.remove(key.toLowerCase()); } output.printf("%s: %s\n", key, value); } } catch (IOException e) { throw new BuildException("error creating jad file", e); } try { int num = 0; File destFile; Resource r; for (ResourceCollection rc : resources) { Iterator<Resource> i = rc.iterator(); while (i.hasNext()) { r = i.next(); destFile = new File(destDir, Utils.getFilePart(r)); if (Utils.isZip(r)) { String[] zipEntries = Utils.extract(r, destDir); for (String entry : zipEntries) { destFile = new File(destDir, entry); if (num == 0) { output.printf("RIM-COD-URL: %s\n", destFile.getName()); output.printf("RIM-COD-SHA1: %s\n", Utils.getSHA1(destFile)); output.printf("RIM-COD-Size: %d\n", destFile.length()); } else { output.printf("RIM-COD-URL-%d: %s\n", num, destFile.getName()); output.printf("RIM-COD-SHA1-%d: %s\n", num, Utils.getSHA1(destFile)); output.printf("RIM-COD-Size-%d: %d\n", num, destFile.length()); } num++; } } else { ResourceUtils.copyResource(r, new FileResource(destFile)); if (num == 0) { output.printf("RIM-COD-URL: %s\n", destFile.getName()); output.printf("RIM-COD-SHA1: %s\n", Utils.getSHA1(destFile)); output.printf("RIM-COD-Size: %d\n", destFile.length()); } else { output.printf("RIM-COD-URL-%d: %s\n", num, destFile.getName()); output.printf("RIM-COD-SHA1-%d: %s\n", num, Utils.getSHA1(destFile)); output.printf("RIM-COD-Size-%d: %d\n", num, destFile.length()); } num ++; } } } } catch (IOException e) { throw new BuildException("error copying cod file", e); } // flush remaining overrides into target .jad for (OverrideType override : overrideMap.values()) { output.printf("%s: %s\n", override.getKey(), override.getValue()); } } finally { FileUtils.close(reader); FileUtils.close(output); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "executeRewrite"
"@SuppressWarnings("unchecked") private void executeRewrite() { BufferedReader reader = null; PrintStream output = null; try { try { reader = new BufferedReader(new FileReader(input)); output = new PrintStream(new File(destDir, input.getName())); int i, num = 0; String line, key, value; OverrideType override; while ((line = reader.readLine()) != null) { <MASK>num ++;</MASK> i = line.indexOf(':'); if (i == -1) throw new BuildException("unexpected line in jad file: "+num); key = line.substring(0, i); value = line.substring(i+1); if (key.startsWith("RIM-COD-URL") || key.startsWith("RIM-COD-SHA1") || key.startsWith("RIM-COD-Size")) { continue; // ignore line } // check for .jad element override, remove from map if found override = overrideMap.get(key.toLowerCase()); if (override != null) { value = override.getValue(); overrideMap.remove(key.toLowerCase()); } output.printf("%s: %s\n", key, value); } } catch (IOException e) { throw new BuildException("error creating jad file", e); } try { int num = 0; File destFile; Resource r; for (ResourceCollection rc : resources) { Iterator<Resource> i = rc.iterator(); while (i.hasNext()) { r = i.next(); destFile = new File(destDir, Utils.getFilePart(r)); if (Utils.isZip(r)) { String[] zipEntries = Utils.extract(r, destDir); for (String entry : zipEntries) { destFile = new File(destDir, entry); if (num == 0) { output.printf("RIM-COD-URL: %s\n", destFile.getName()); output.printf("RIM-COD-SHA1: %s\n", Utils.getSHA1(destFile)); output.printf("RIM-COD-Size: %d\n", destFile.length()); } else { output.printf("RIM-COD-URL-%d: %s\n", num, destFile.getName()); output.printf("RIM-COD-SHA1-%d: %s\n", num, Utils.getSHA1(destFile)); output.printf("RIM-COD-Size-%d: %d\n", num, destFile.length()); } num++; } } else { ResourceUtils.copyResource(r, new FileResource(destFile)); if (num == 0) { output.printf("RIM-COD-URL: %s\n", destFile.getName()); output.printf("RIM-COD-SHA1: %s\n", Utils.getSHA1(destFile)); output.printf("RIM-COD-Size: %d\n", destFile.length()); } else { output.printf("RIM-COD-URL-%d: %s\n", num, destFile.getName()); output.printf("RIM-COD-SHA1-%d: %s\n", num, Utils.getSHA1(destFile)); output.printf("RIM-COD-Size-%d: %d\n", num, destFile.length()); } } <MASK>num ++;</MASK> } } } catch (IOException e) { throw new BuildException("error copying cod file", e); } // flush remaining overrides into target .jad for (OverrideType override : overrideMap.values()) { output.printf("%s: %s\n", override.getKey(), override.getValue()); } } finally { FileUtils.close(reader); FileUtils.close(output); } }"
Inversion-Mutation
megadiff
"@Override protected void configure() { DynamicMap.mapOf(binder(), PROJECT_KIND); DynamicMap.mapOf(binder(), DASHBOARD_KIND); get(PROJECT_KIND).to(GetProject.class); get(PROJECT_KIND, "description").to(GetDescription.class); put(PROJECT_KIND, "description").to(SetDescription.class); delete(PROJECT_KIND, "description").to(SetDescription.class); get(PROJECT_KIND, "parent").to(GetParent.class); put(PROJECT_KIND, "parent").to(SetParent.class); get(DASHBOARD_KIND).to(GetDashboard.class); put(DASHBOARD_KIND).to(SetDashboard.class); delete(DASHBOARD_KIND).to(DeleteDashboard.class); child(PROJECT_KIND, "dashboards").to(DashboardsCollection.class); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "configure"
"@Override protected void configure() { DynamicMap.mapOf(binder(), PROJECT_KIND); DynamicMap.mapOf(binder(), DASHBOARD_KIND); get(PROJECT_KIND).to(GetProject.class); get(PROJECT_KIND, "description").to(GetDescription.class); put(PROJECT_KIND, "description").to(SetDescription.class); delete(PROJECT_KIND, "description").to(SetDescription.class); get(PROJECT_KIND, "parent").to(GetParent.class); put(PROJECT_KIND, "parent").to(SetParent.class); <MASK>child(PROJECT_KIND, "dashboards").to(DashboardsCollection.class);</MASK> get(DASHBOARD_KIND).to(GetDashboard.class); put(DASHBOARD_KIND).to(SetDashboard.class); delete(DASHBOARD_KIND).to(DeleteDashboard.class); }"
Inversion-Mutation
megadiff
"private List<SearchItem> getAllItems(FindByProduct productRequest, FindItemsByProductResponse response, List<SearchItem> items) { List<SearchItem> totalItems = new ArrayList<SearchItem>(); PaginationOutput outPage = response.getPaginationOutput(); totalItems.addAll(items); if (items.size() < outPage.getTotalEntries()) { for (int i=2;i!=outPage.getTotalPages()+1;++i) { PaginationInput pi = new PaginationInput(); pi.setPageNumber(i); productRequest.setPaginationInput(pi); response = serviceClient.findItemsByProduct(productRequest); SearchResult result = response.getSearchResult(); totalItems.addAll(result.getItem()); } } return totalItems; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "getAllItems"
"private List<SearchItem> getAllItems(FindByProduct productRequest, FindItemsByProductResponse response, List<SearchItem> items) { List<SearchItem> totalItems = new ArrayList<SearchItem>(); PaginationOutput outPage = response.getPaginationOutput(); if (items.size() < outPage.getTotalEntries()) { <MASK>totalItems.addAll(items);</MASK> for (int i=2;i!=outPage.getTotalPages()+1;++i) { PaginationInput pi = new PaginationInput(); pi.setPageNumber(i); productRequest.setPaginationInput(pi); response = serviceClient.findItemsByProduct(productRequest); SearchResult result = response.getSearchResult(); totalItems.addAll(result.getItem()); } } return totalItems; }"
Inversion-Mutation
megadiff
"protected void mergeInDefaultConfigs(ConfigObject config, List<Class<?>> defaultConfigClasses, GroovyClassLoader classLoader) { ConfigSlurper configSlurper = new ConfigSlurper(Environment .getCurrent().getName()); configSlurper.setClassLoader(classLoader); for (Class<?> defaultConfigClass : defaultConfigClasses) { configSlurper.setBinding(config); ConfigObject newConfig = configSlurper.parse(defaultConfigClass); config.merge(newConfig); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "mergeInDefaultConfigs"
"protected void mergeInDefaultConfigs(ConfigObject config, List<Class<?>> defaultConfigClasses, GroovyClassLoader classLoader) { ConfigSlurper configSlurper = new ConfigSlurper(Environment .getCurrent().getName()); <MASK>configSlurper.setBinding(config);</MASK> configSlurper.setClassLoader(classLoader); for (Class<?> defaultConfigClass : defaultConfigClasses) { ConfigObject newConfig = configSlurper.parse(defaultConfigClass); config.merge(newConfig); } }"
Inversion-Mutation
megadiff
"public void shutdown(ShutdownListener listener) { synchronized (monitor) { if (this.listener != null) { throw new ElasticSearchIllegalStateException("Shutdown was already called on this thread pool"); } if (isTerminated()) { listener.onTerminated(); } else { this.listener = listener; } } shutdown(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "shutdown"
"public void shutdown(ShutdownListener listener) { synchronized (monitor) { if (this.listener != null) { throw new ElasticSearchIllegalStateException("Shutdown was already called on this thread pool"); } if (isTerminated()) { listener.onTerminated(); } else { this.listener = listener; } <MASK>shutdown();</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
"private void initialize(Concept concept, ConceptName conceptName, Locale locale) { if (concept != null) { conceptId = concept.getConceptId(); ConceptName conceptShortName = concept.getShortNameInLocale(locale); name = shortName = description = ""; if (conceptName != null) { conceptNameId = conceptName.getConceptNameId(); name = WebUtil.escapeHTML(conceptName.getName()); // if the name hit is not the preferred one, put the preferred one here if (!conceptName.isPreferred()) { ConceptName preferredNameObj = concept.getPreferredName(locale); preferredName = preferredNameObj.getName(); } } if (conceptShortName != null) { shortName = WebUtil.escapeHTML(conceptShortName.getName()); } ConceptDescription conceptDescription = concept.getDescription(locale, false); if (conceptDescription != null) { description = WebUtil.escapeHTML(conceptDescription.getDescription()); } retired = concept.isRetired(); hl7Abbreviation = concept.getDatatype().getHl7Abbreviation(); className = concept.getConceptClass().getName(); isSet = concept.isSet(); isNumeric = concept.isNumeric(); if (isNumeric) { // TODO: There's probably a better way to do this, but just doing "(ConceptNumeric) concept" throws "java.lang.ClassCastException: org.openmrs.Concept$$EnhancerByCGLIB$$85e62ac7" ConceptNumeric num = Context.getConceptService().getConceptNumeric(concept.getConceptId()); hiAbsolute = num.getHiAbsolute(); hiCritical = num.getHiCritical(); hiNormal = num.getHiNormal(); lowAbsolute = num.getLowAbsolute(); lowCritical = num.getLowCritical(); lowNormal = num.getLowNormal(); units = num.getUnits(); } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "initialize"
"private void initialize(Concept concept, ConceptName conceptName, Locale locale) { if (concept != null) { conceptId = concept.getConceptId(); <MASK>conceptNameId = conceptName.getConceptNameId();</MASK> ConceptName conceptShortName = concept.getShortNameInLocale(locale); name = shortName = description = ""; if (conceptName != null) { name = WebUtil.escapeHTML(conceptName.getName()); // if the name hit is not the preferred one, put the preferred one here if (!conceptName.isPreferred()) { ConceptName preferredNameObj = concept.getPreferredName(locale); preferredName = preferredNameObj.getName(); } } if (conceptShortName != null) { shortName = WebUtil.escapeHTML(conceptShortName.getName()); } ConceptDescription conceptDescription = concept.getDescription(locale, false); if (conceptDescription != null) { description = WebUtil.escapeHTML(conceptDescription.getDescription()); } retired = concept.isRetired(); hl7Abbreviation = concept.getDatatype().getHl7Abbreviation(); className = concept.getConceptClass().getName(); isSet = concept.isSet(); isNumeric = concept.isNumeric(); if (isNumeric) { // TODO: There's probably a better way to do this, but just doing "(ConceptNumeric) concept" throws "java.lang.ClassCastException: org.openmrs.Concept$$EnhancerByCGLIB$$85e62ac7" ConceptNumeric num = Context.getConceptService().getConceptNumeric(concept.getConceptId()); hiAbsolute = num.getHiAbsolute(); hiCritical = num.getHiCritical(); hiNormal = num.getHiNormal(); lowAbsolute = num.getLowAbsolute(); lowCritical = num.getLowCritical(); lowNormal = num.getLowNormal(); units = num.getUnits(); } } }"
Inversion-Mutation
megadiff
"@Override public void setDisplayName(String name) { Preconditions.checkArgument( name.length() <= 16, "Display name cannot be longer than 16 characters" ); bungee.getTabListHandler().onDisconnect( this ); displayName=name; bungee.getTabListHandler().onConnect( this ); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "setDisplayName"
"@Override public void setDisplayName(String name) { Preconditions.checkArgument( name.length() <= 16, "Display name cannot be longer than 16 characters" ); <MASK>displayName=name;</MASK> bungee.getTabListHandler().onDisconnect( this ); bungee.getTabListHandler().onConnect( this ); }"
Inversion-Mutation
megadiff
"public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { Player send; if(!(sender instanceof Player)){ sender.sendMessage(title + ChatColor.RED + "Player context is required!"); return true; } send = (Player) sender; // /home if(args.length==0){ if(plugin.homesManager.homes.containsKey(send.getName())){ Home home = plugin.homesManager.homes.get(send.getName()); Location loc = send.getLocation(); send.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); send.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); send.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); loc = home.pos; loc.getWorld().loadChunk(loc.getWorld().getChunkAt(loc)); loc.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); send.teleport(home.pos); send.sendMessage(title + "Home, sweet home."); } else{ sender.sendMessage(title + ChatColor.RED + "You need a home!"); } return true; }else if(args.length==1){ // /home help if(args[0].equals("help")){ return false; } else // /home set if(args[0].equals("set")){ Location loc = send.getLocation(); plugin.homesManager.homes.put(send.getName(), new Home(loc)); FileConfiguration config = plugin.homesYML; String name = send.getName(); boolean newHome; newHome = config.getString(send.getName()) == null; config.set(name + ".x", loc.getX()); config.set(name + ".y", loc.getY()); config.set(name + ".z", loc.getZ()); config.set(name + ".yaw", loc.getPitch()); config.set(name + ".pitch", loc.getYaw()); config.set(name + ".world", loc.getWorld().getName()); if(newHome) config.set(name + ".open", false); plugin.saveHomes(); loc.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); send.sendMessage(title + "Home set."); } else // /home open if(args[0].equals("open")){ if(plugin.homesManager.homes.containsKey(send.getName())){ plugin.homesManager.openHomes.add(send.getName()); FileConfiguration config = plugin.homesYML; config.set(send.getName() + ".open", true); plugin.saveHomes(); Location home = plugin.homesManager.homes.get(send.getName()).pos; home.getWorld().playEffect(home, Effect.ENDER_SIGNAL, 1); home.getWorld().playEffect(home, Effect.MOBSPAWNER_FLAMES, 1); home.getWorld().playEffect(home, Effect.STEP_SOUND, 111); send.sendMessage(title + "Your home is now " + ChatColor.DARK_GREEN + "open" + ChatColor.GRAY + " to guests."); } else{ send.sendMessage(title + ChatColor.RED + "You need a home!"); } } else // /home close if(args[0].equals("close")){ if(plugin.homesManager.homes.containsKey(send.getName())){ plugin.homesManager.openHomes.remove(send.getName()); FileConfiguration config = plugin.homesYML; config.set(send.getName() + ".open", false); plugin.saveHomes(); Location home = plugin.homesManager.homes.get(send.getName()).pos; home.getWorld().playEffect(home, Effect.ENDER_SIGNAL, 1); home.getWorld().playEffect(home, Effect.MOBSPAWNER_FLAMES, 1); home.getWorld().playEffect(home, Effect.STEP_SOUND, 40); send.sendMessage(title + "Your home is now " + ChatColor.DARK_RED + "closed" + ChatColor.DARK_GRAY + " to guests."); } else{ send.sendMessage(title + ChatColor.RED + "You need a home!"); } } else // /home [player] { Player target = plugin.getServer().getPlayer(args[0]); String name; if(target==null){ if(plugin.homesManager.homes.containsKey(args[0])){ name = args[0]; } else{ send.sendMessage(title + ChatColor.RED + "That player does not exist!"); return true; } } name = target.getName(); if(!plugin.homesManager.homes.containsKey(name)){ send.sendMessage(title + ChatColor.RED + "That player does not have a home!"); }else if(!plugin.homesManager.openHomes.contains(name)&&!send.isOp()&&!send.getName().equals(target.getName())){ send.sendMessage(title + ChatColor.RED + "That player's home is " + ChatColor.DARK_RED + "closed" + ChatColor.RED + "!"); } else{ Location loc = send.getLocation(); Home home = plugin.homesManager.homes.get(name); send.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); send.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); send.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); loc = home.pos; loc.getWorld().loadChunk(loc.getWorld().getChunkAt(loc)); send.teleport(home.pos); loc.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); send.sendMessage(title + "Welcome."); } } return true; } else if(args.length==2){ if(args[0].equals("set")&&args[1].equals("bed")){ Location loc = send.getBedSpawnLocation(); if(loc==null){ send.sendMessage(title + ChatColor.RED + "You need a bed!"); return true; } plugin.homesManager.homes.put(send.getName(), new Home(loc)); FileConfiguration config = plugin.homesYML; String name = send.getName(); boolean newHome; newHome = config.getString(send.getName()) == null; config.set(name + ".x", loc.getX()); config.set(name + ".y", loc.getY()); config.set(name + ".z", loc.getZ()); config.set(name + ".yaw", loc.getPitch()); config.set(name + ".pitch", loc.getYaw()); config.set(name + ".world", loc.getWorld().getName()); if(newHome) config.set(name + ".open", false); plugin.saveHomes(); loc.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); send.sendMessage(title + "Home set to bed."); return true; } return false; } return false; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "onCommand"
"public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { Player send; if(!(sender instanceof Player)){ sender.sendMessage(title + ChatColor.RED + "Player context is required!"); return true; } send = (Player) sender; // /home if(args.length==0){ if(plugin.homesManager.homes.containsKey(send.getName())){ Home home = plugin.homesManager.homes.get(send.getName()); Location loc = send.getLocation(); send.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); send.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); send.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); loc = home.pos; loc.getWorld().loadChunk(loc.getWorld().getChunkAt(loc)); <MASK>send.teleport(home.pos);</MASK> loc.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); send.sendMessage(title + "Home, sweet home."); } else{ sender.sendMessage(title + ChatColor.RED + "You need a home!"); } return true; }else if(args.length==1){ // /home help if(args[0].equals("help")){ return false; } else // /home set if(args[0].equals("set")){ Location loc = send.getLocation(); plugin.homesManager.homes.put(send.getName(), new Home(loc)); FileConfiguration config = plugin.homesYML; String name = send.getName(); boolean newHome; newHome = config.getString(send.getName()) == null; config.set(name + ".x", loc.getX()); config.set(name + ".y", loc.getY()); config.set(name + ".z", loc.getZ()); config.set(name + ".yaw", loc.getPitch()); config.set(name + ".pitch", loc.getYaw()); config.set(name + ".world", loc.getWorld().getName()); if(newHome) config.set(name + ".open", false); plugin.saveHomes(); loc.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); send.sendMessage(title + "Home set."); } else // /home open if(args[0].equals("open")){ if(plugin.homesManager.homes.containsKey(send.getName())){ plugin.homesManager.openHomes.add(send.getName()); FileConfiguration config = plugin.homesYML; config.set(send.getName() + ".open", true); plugin.saveHomes(); Location home = plugin.homesManager.homes.get(send.getName()).pos; home.getWorld().playEffect(home, Effect.ENDER_SIGNAL, 1); home.getWorld().playEffect(home, Effect.MOBSPAWNER_FLAMES, 1); home.getWorld().playEffect(home, Effect.STEP_SOUND, 111); send.sendMessage(title + "Your home is now " + ChatColor.DARK_GREEN + "open" + ChatColor.GRAY + " to guests."); } else{ send.sendMessage(title + ChatColor.RED + "You need a home!"); } } else // /home close if(args[0].equals("close")){ if(plugin.homesManager.homes.containsKey(send.getName())){ plugin.homesManager.openHomes.remove(send.getName()); FileConfiguration config = plugin.homesYML; config.set(send.getName() + ".open", false); plugin.saveHomes(); Location home = plugin.homesManager.homes.get(send.getName()).pos; home.getWorld().playEffect(home, Effect.ENDER_SIGNAL, 1); home.getWorld().playEffect(home, Effect.MOBSPAWNER_FLAMES, 1); home.getWorld().playEffect(home, Effect.STEP_SOUND, 40); send.sendMessage(title + "Your home is now " + ChatColor.DARK_RED + "closed" + ChatColor.DARK_GRAY + " to guests."); } else{ send.sendMessage(title + ChatColor.RED + "You need a home!"); } } else // /home [player] { Player target = plugin.getServer().getPlayer(args[0]); String name; if(target==null){ if(plugin.homesManager.homes.containsKey(args[0])){ name = args[0]; } else{ send.sendMessage(title + ChatColor.RED + "That player does not exist!"); return true; } } name = target.getName(); if(!plugin.homesManager.homes.containsKey(name)){ send.sendMessage(title + ChatColor.RED + "That player does not have a home!"); }else if(!plugin.homesManager.openHomes.contains(name)&&!send.isOp()&&!send.getName().equals(target.getName())){ send.sendMessage(title + ChatColor.RED + "That player's home is " + ChatColor.DARK_RED + "closed" + ChatColor.RED + "!"); } else{ Location loc = send.getLocation(); Home home = plugin.homesManager.homes.get(name); send.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); send.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); send.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); loc = home.pos; loc.getWorld().loadChunk(loc.getWorld().getChunkAt(loc)); <MASK>send.teleport(home.pos);</MASK> loc.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); send.sendMessage(title + "Welcome."); } } return true; } else if(args.length==2){ if(args[0].equals("set")&&args[1].equals("bed")){ Location loc = send.getBedSpawnLocation(); if(loc==null){ send.sendMessage(title + ChatColor.RED + "You need a bed!"); return true; } plugin.homesManager.homes.put(send.getName(), new Home(loc)); FileConfiguration config = plugin.homesYML; String name = send.getName(); boolean newHome; newHome = config.getString(send.getName()) == null; config.set(name + ".x", loc.getX()); config.set(name + ".y", loc.getY()); config.set(name + ".z", loc.getZ()); config.set(name + ".yaw", loc.getPitch()); config.set(name + ".pitch", loc.getYaw()); config.set(name + ".world", loc.getWorld().getName()); if(newHome) config.set(name + ".open", false); plugin.saveHomes(); loc.getWorld().playEffect(loc, Effect.ENDER_SIGNAL, 1); loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1); loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 51); send.sendMessage(title + "Home set to bed."); return true; } return false; } return false; }"
Inversion-Mutation
megadiff
"private void cameraZoomOut(State toState, boolean animated) { final Resources res = getResources(); final boolean toAllApps = (toState == State.ALL_APPS); final int duration = toAllApps ? res.getInteger(R.integer.config_allAppsZoomInTime) : res.getInteger(R.integer.config_customizeZoomInTime); final float scale = toAllApps ? (float) res.getInteger(R.integer.config_allAppsZoomScaleFactor) : (float) res.getInteger(R.integer.config_customizeZoomScaleFactor); final View toView = toAllApps ? (View) mAllAppsGrid : mHomeCustomizationDrawer; setPivotsForZoom(toView, toState, scale); if (toAllApps) { mWorkspace.shrink(ShrinkState.BOTTOM_HIDDEN, animated); } else { mWorkspace.shrink(ShrinkState.TOP, animated); } if (animated) { ValueAnimator scaleAnim = ObjectAnimator.ofPropertyValuesHolder(toView, PropertyValuesHolder.ofFloat("scaleX", scale, 1.0f), PropertyValuesHolder.ofFloat("scaleY", scale, 1.0f)); scaleAnim.setDuration(duration); if (toAllApps) { toView.setAlpha(0f); ObjectAnimator alphaAnim = ObjectAnimator.ofPropertyValuesHolder(toView, PropertyValuesHolder.ofFloat("alpha", 1.0f)); alphaAnim.setInterpolator(new DecelerateInterpolator(1.5f)); alphaAnim.setDuration(duration); alphaAnim.start(); } scaleAnim.setInterpolator(new Workspace.ZoomOutInterpolator()); scaleAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { // Prepare the position toView.setTranslationX(0.0f); toView.setTranslationY(0.0f); toView.setVisibility(View.VISIBLE); if (!toAllApps) { toView.setAlpha(1.0f); } } @Override public void onAnimationEnd(Animator animation) { // If we don't set the final scale values here, if this animation is cancelled // it will have the wrong scale value and subsequent cameraPan animations will // not fix that toView.setScaleX(1.0f); toView.setScaleY(1.0f); } }); AnimatorSet toolbarHideAnim = new AnimatorSet(); AnimatorSet toolbarShowAnim = new AnimatorSet(); hideAndShowToolbarButtons(toState, toolbarShowAnim, toolbarHideAnim); // toView should appear right at the end of the workspace shrink animation final int startDelay = 0; if (mStateAnimation != null) mStateAnimation.cancel(); mStateAnimation = new AnimatorSet(); mStateAnimation.playTogether(scaleAnim, toolbarHideAnim); mStateAnimation.play(scaleAnim).after(startDelay); // Show the new toolbar buttons just as the main animation is ending final int fadeInTime = res.getInteger(R.integer.config_toolbarButtonFadeInTime); mStateAnimation.play(toolbarShowAnim).after(duration + startDelay - fadeInTime); mStateAnimation.start(); } else { toView.setTranslationX(0.0f); toView.setTranslationY(0.0f); toView.setScaleX(1.0f); toView.setScaleY(1.0f); toView.setVisibility(View.VISIBLE); hideAndShowToolbarButtons(toState, null, null); } mWorkspace.setVerticalWallpaperOffset(toAllApps ? Workspace.WallpaperVerticalOffset.TOP : Workspace.WallpaperVerticalOffset.BOTTOM); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "cameraZoomOut"
"private void cameraZoomOut(State toState, boolean animated) { final Resources res = getResources(); final boolean toAllApps = (toState == State.ALL_APPS); final int duration = toAllApps ? res.getInteger(R.integer.config_allAppsZoomInTime) : res.getInteger(R.integer.config_customizeZoomInTime); final float scale = toAllApps ? (float) res.getInteger(R.integer.config_allAppsZoomScaleFactor) : (float) res.getInteger(R.integer.config_customizeZoomScaleFactor); final View toView = toAllApps ? (View) mAllAppsGrid : mHomeCustomizationDrawer; setPivotsForZoom(toView, toState, scale); if (toAllApps) { mWorkspace.shrink(ShrinkState.BOTTOM_HIDDEN, animated); <MASK>toView.setAlpha(0f);</MASK> } else { mWorkspace.shrink(ShrinkState.TOP, animated); } if (animated) { ValueAnimator scaleAnim = ObjectAnimator.ofPropertyValuesHolder(toView, PropertyValuesHolder.ofFloat("scaleX", scale, 1.0f), PropertyValuesHolder.ofFloat("scaleY", scale, 1.0f)); scaleAnim.setDuration(duration); if (toAllApps) { ObjectAnimator alphaAnim = ObjectAnimator.ofPropertyValuesHolder(toView, PropertyValuesHolder.ofFloat("alpha", 1.0f)); alphaAnim.setInterpolator(new DecelerateInterpolator(1.5f)); alphaAnim.setDuration(duration); alphaAnim.start(); } scaleAnim.setInterpolator(new Workspace.ZoomOutInterpolator()); scaleAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { // Prepare the position toView.setTranslationX(0.0f); toView.setTranslationY(0.0f); toView.setVisibility(View.VISIBLE); if (!toAllApps) { toView.setAlpha(1.0f); } } @Override public void onAnimationEnd(Animator animation) { // If we don't set the final scale values here, if this animation is cancelled // it will have the wrong scale value and subsequent cameraPan animations will // not fix that toView.setScaleX(1.0f); toView.setScaleY(1.0f); } }); AnimatorSet toolbarHideAnim = new AnimatorSet(); AnimatorSet toolbarShowAnim = new AnimatorSet(); hideAndShowToolbarButtons(toState, toolbarShowAnim, toolbarHideAnim); // toView should appear right at the end of the workspace shrink animation final int startDelay = 0; if (mStateAnimation != null) mStateAnimation.cancel(); mStateAnimation = new AnimatorSet(); mStateAnimation.playTogether(scaleAnim, toolbarHideAnim); mStateAnimation.play(scaleAnim).after(startDelay); // Show the new toolbar buttons just as the main animation is ending final int fadeInTime = res.getInteger(R.integer.config_toolbarButtonFadeInTime); mStateAnimation.play(toolbarShowAnim).after(duration + startDelay - fadeInTime); mStateAnimation.start(); } else { toView.setTranslationX(0.0f); toView.setTranslationY(0.0f); toView.setScaleX(1.0f); toView.setScaleY(1.0f); toView.setVisibility(View.VISIBLE); hideAndShowToolbarButtons(toState, null, null); } mWorkspace.setVerticalWallpaperOffset(toAllApps ? Workspace.WallpaperVerticalOffset.TOP : Workspace.WallpaperVerticalOffset.BOTTOM); }"
Inversion-Mutation
megadiff
"protected void disconnected ( final Throwable reason ) { IoSession session; boolean doClose = false; synchronized ( this ) { // disconnect the messenger here this.messenger.disconnected (); session = this.session; if ( session != null ) { logger.info ( "Session disconnected", reason ); if ( !session.isConnected () ) { logger.debug ( "Connection is not connected. Switch to CLOSED" ); setState ( ConnectionState.CLOSED, reason ); // only dispose when connection is closed disposeConnector (); this.session = null; } else { logger.debug ( "Connection still connected. Close it first!" ); setState ( ConnectionState.CLOSING, reason ); doClose = true; } } } if ( session != null && doClose ) { session.close ( true ); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "disconnected"
"protected void disconnected ( final Throwable reason ) { IoSession session; boolean doClose = false; synchronized ( this ) { // disconnect the messenger here this.messenger.disconnected (); session = this.session; if ( session != null ) { logger.info ( "Session disconnected", reason ); if ( !session.isConnected () ) { logger.debug ( "Connection is not connected. Switch to CLOSED" ); setState ( ConnectionState.CLOSED, reason ); // only dispose when connection is closed disposeConnector (); } else { logger.debug ( "Connection still connected. Close it first!" ); setState ( ConnectionState.CLOSING, reason ); doClose = true; } <MASK>this.session = null;</MASK> } } if ( session != null && doClose ) { session.close ( true ); } }"
Inversion-Mutation
megadiff
"public static void main(String args[]) { if (args.length != 4) { System.out.println("error: Wrong number of arguments."); System.out.println("usage: java diff <sents.ans> <sents.out> <model_file> <report>"); System.exit(1); } // take in params String ansFile = args[0]; String outFile = args[1]; String modelFile = args[2]; String reportFile = args[3]; try { // evaluate output against answers FileReader outReader = new FileReader(outFile); BufferedReader outBr = new BufferedReader(outReader); FileReader ansReader = new FileReader(ansFile); BufferedReader ansBr = new BufferedReader(ansReader); FileReader modelReader = new FileReader(modelFile); BufferedReader modelBr = new BufferedReader(modelReader); FileWriter reportWriter = new FileWriter(reportFile); BufferedWriter reportBw = new BufferedWriter(reportWriter); String modelLine; int lineCount = 1; Set<String> wordSet = new HashSet<String>(); while ((modelLine = modelBr.readLine()) != null) { if (lineCount == 2) { String[] modelTokens = modelLine.trim().split("\\s+"); for (int i = 0; i < modelTokens.length; i++) wordSet.add(modelTokens[i]); } lineCount ++; } String outLine; String ansLine; int correctCount = 0; int totalCount = 0; while ((outLine = outBr.readLine()) != null) { ansLine = ansBr.readLine(); String[] outTokens = outLine.trim().split("\\s+"); String[] ansTokens = ansLine.trim().split("\\s+"); for (int k = 0; k < outTokens.length; k++) { String oov = ""; // for each "word/tag" token, break it by "/" // the last entity will be the tag // everything before the last "/" will be the word String[] wordAndTag = outTokens[k].split("/"); String word = wordAndTag[0]; String tag = wordAndTag[wordAndTag.length - 1]; for (int j = 0; j < wordAndTag.length; j++) { if (j != 0 && j < wordAndTag.length - 1) { word += "/" + wordAndTag[j]; } } if (!wordSet.contains(word)) { oov = "[OOV]"; } totalCount += 1; if (outTokens[k].equals(ansTokens[k])) { correctCount += 1; } else { reportBw.write( ansTokens[k] + " <=> " + outTokens[k] + " " + oov ); reportBw.newLine(); } } } outBr.close(); ansBr.close(); modelBr.close(); reportBw.close(); double acc = correctCount / (double) totalCount; System.out.println("Acc = " + String.format("%.2f", acc * 100) + "%"); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "main"
"public static void main(String args[]) { if (args.length != 4) { System.out.println("error: Wrong number of arguments."); System.out.println("usage: java diff <sents.ans> <sents.out> <model_file> <report>"); System.exit(1); } // take in params String ansFile = args[0]; String outFile = args[1]; String modelFile = args[2]; String reportFile = args[3]; try { // evaluate output against answers FileReader outReader = new FileReader(outFile); BufferedReader outBr = new BufferedReader(outReader); FileReader ansReader = new FileReader(ansFile); BufferedReader ansBr = new BufferedReader(ansReader); FileReader modelReader = new FileReader(modelFile); BufferedReader modelBr = new BufferedReader(modelReader); FileWriter reportWriter = new FileWriter(reportFile); BufferedWriter reportBw = new BufferedWriter(reportWriter); String modelLine; int lineCount = 1; Set<String> wordSet = new HashSet<String>(); while ((modelLine = modelBr.readLine()) != null) { if (lineCount == 2) { String[] modelTokens = modelLine.trim().split("\\s+"); for (int i = 0; i < modelTokens.length; i++) wordSet.add(modelTokens[i]); } lineCount ++; } String outLine; String ansLine; int correctCount = 0; int totalCount = 0; while ((outLine = outBr.readLine()) != null) { ansLine = ansBr.readLine(); <MASK>String oov = "";</MASK> String[] outTokens = outLine.trim().split("\\s+"); String[] ansTokens = ansLine.trim().split("\\s+"); for (int k = 0; k < outTokens.length; k++) { // for each "word/tag" token, break it by "/" // the last entity will be the tag // everything before the last "/" will be the word String[] wordAndTag = outTokens[k].split("/"); String word = wordAndTag[0]; String tag = wordAndTag[wordAndTag.length - 1]; for (int j = 0; j < wordAndTag.length; j++) { if (j != 0 && j < wordAndTag.length - 1) { word += "/" + wordAndTag[j]; } } if (!wordSet.contains(word)) { oov = "[OOV]"; } totalCount += 1; if (outTokens[k].equals(ansTokens[k])) { correctCount += 1; } else { reportBw.write( ansTokens[k] + " <=> " + outTokens[k] + " " + oov ); reportBw.newLine(); } } } outBr.close(); ansBr.close(); modelBr.close(); reportBw.close(); double acc = correctCount / (double) totalCount; System.out.println("Acc = " + String.format("%.2f", acc * 100) + "%"); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } }"
Inversion-Mutation
megadiff
"public VisualizadorHorarioObjeto(java.awt.Window parent, boolean modal, Object objetoQueVerHorario, int modo, Profesor profesorAAsignar) { super(parent); initComponents(); this.modo = modo; int i, j; this.horasOcupadasDelProfe = new ArrayList(); this.horasDispDelProfe = new ArrayList(); this.horasAMostrar = new ArrayList(); this.listaHorasSeleccionadas = new ArrayList(); this.listModelHoras = new DefaultListModel(); this.claseDelObjeto = objetoQueVerHorario.getClass(); this.setLocationRelativeTo(parent); if ((modo == VisualizadorHorarioObjeto.EDICION) && (objetoQueVerHorario.getClass() == Curso.class)) { this.dialogoEdicionCursoPadre = (DialogoEdicionCurso)parent; } if ((modo == VisualizadorHorarioObjeto.VISUALIZACION) && (objetoQueVerHorario.getClass() == Curso.class)) this.botonCerrarHorario.setAlignmentY(TOP_ALIGNMENT); if (objetoQueVerHorario.getClass().equals(Curso.class)) { horasAMostrar = ((Curso)objetoQueVerHorario).getHorasAsigArrayList(); this.labelClaseObjeto.setText("Curso"); this.labelNombreObjeto.setText(((Curso)objetoQueVerHorario).getNombreCurso()); this.panelCursos.setVisible(false); this.labelCursos.setVisible(false); this.setSize(782, 300); this.botonCerrarHorario.setText("Aceptar"); } if (objetoQueVerHorario.getClass().equals(Profesor.class)) { this.horasAMostrar = ((Profesor)objetoQueVerHorario).getHorasDispArrayList(); this.horasOcupadasDelProfe = ((Profesor)objetoQueVerHorario).getHorasAsigArrayList(); this.labelClaseObjeto.setText("Profesor"); this.labelNombreObjeto.setText(((Profesor)objetoQueVerHorario).getNombreProfesor()); //muestor los cursos que tenga asignados el profesor en la tabla de cursos DefaultTableModel modelo = new DefaultTableModel(new Object [][] {},new String [] {"Curso", "Asignatura"}); Vector vectorFila = new Vector(3); for (Curso curso :((Profesor)objetoQueVerHorario).getCursosAsigArrayList()) { vectorFila.add(curso.getCodigoCurso()+" - " +curso.getSeccion()); vectorFila.add(curso.getNombreCurso()); modelo.addRow(vectorFila); vectorFila = new Vector(3); } this.tablaCursos.setModel(modelo); } if (objetoQueVerHorario.getClass().equals(Semestre.class)) { horasAMostrar = ((Profesor)objetoQueVerHorario).getHorasAsigArrayList(); this.labelClaseObjeto.setText("Semestre"); this.labelNombreObjeto.setText("N° "+((Semestre)objetoQueVerHorario).getNumeroSemestre()); //muestor los cursos que tenga asignados el profesor en la tabla de cursos DefaultTableModel modelo = new DefaultTableModel(new Object [][] {},new String [] {"Curso", "Asignatura"}); Vector vectorFila = new Vector(3); for (Curso curso :((Semestre)objetoQueVerHorario).getCursosArrayList()) { vectorFila.add(curso.getCodigoCurso()+" - " +curso.getSeccion()); vectorFila.add(curso.getNombreCurso()); modelo.addRow(vectorFila); vectorFila = new Vector(3); } this.tablaCursos.setModel(modelo); } if (modo == VisualizadorHorarioObjeto.VISUALIZACION) { this.horarioMostrado.setCellSelectionEnabled(false); this.JListHorasSeleccionadas.setVisible(false); this.JListHorasSeleccionadas.setEnabled(false); } if (modo == VisualizadorHorarioObjeto.EDICION) { this.horarioMostrado.setCellSelectionEnabled(false); this.panelCursos.setVisible(false); this.labelCursos.setVisible(false); this.setSize(852, 300); this.botonCerrarHorario.setText("Aceptar"); this.JListHorasSeleccionadas.setEnabled(true); this.JListHorasSeleccionadas.setVisible(true); this.JListHorasSeleccionadas.setModel(this.listModelHoras); if (profesorAAsignar != null) { this.horasAMostrar = profesorAAsignar.getHorasDispArrayList(); this.horasOcupadasDelProfe = profesorAAsignar.getHorasAsigArrayList(); this.horasDispDelProfe = profesorAAsignar.getHorasDispArrayList(); } } Hora horaTemp; //dibujo las horas en las celdas de la tabla try { for(i = 1; i < 7; i++) { for (j = 0; j < 9; j++) { horaTemp = new Hora((i-1)*9 + j+1); if (horasAMostrar.contains(horaTemp)) { if (this.claseDelObjeto == Profesor.class) this.horarioMostrado.setValueAt("Disponible", j, i); if ((this.claseDelObjeto == Curso.class) && (this.modo == VisualizadorHorarioObjeto.VISUALIZACION)) this.horarioMostrado.setValueAt("Asignado", j, i); if (this.claseDelObjeto == Semestre.class) this.horarioMostrado.setValueAt("Asignado", j, i); } else { this.horarioMostrado.setValueAt("", j, i); } if (this.horasDispDelProfe.contains(horaTemp)) this.horarioMostrado.setValueAt("Disponible", j, i); if (this.horasOcupadasDelProfe.contains(horaTemp)) { this.horarioMostrado.setValueAt("Ocupada", j, i); } } } } catch (HourOutOfRangeException e) { System.out.println("Error al mostrar la hora en la tabla"); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "VisualizadorHorarioObjeto"
"public VisualizadorHorarioObjeto(java.awt.Window parent, boolean modal, Object objetoQueVerHorario, int modo, Profesor profesorAAsignar) { super(parent); initComponents(); this.modo = modo; int i, j; this.horasOcupadasDelProfe = new ArrayList(); this.horasDispDelProfe = new ArrayList(); this.horasAMostrar = new ArrayList(); this.listaHorasSeleccionadas = new ArrayList(); this.listModelHoras = new DefaultListModel(); this.claseDelObjeto = objetoQueVerHorario.getClass(); this.setLocationRelativeTo(parent); if ((modo == VisualizadorHorarioObjeto.EDICION) && (objetoQueVerHorario.getClass() == Curso.class)) { this.dialogoEdicionCursoPadre = (DialogoEdicionCurso)parent; <MASK>this.horasDispDelProfe = profesorAAsignar.getHorasDispArrayList();</MASK> } if ((modo == VisualizadorHorarioObjeto.VISUALIZACION) && (objetoQueVerHorario.getClass() == Curso.class)) this.botonCerrarHorario.setAlignmentY(TOP_ALIGNMENT); if (objetoQueVerHorario.getClass().equals(Curso.class)) { horasAMostrar = ((Curso)objetoQueVerHorario).getHorasAsigArrayList(); this.labelClaseObjeto.setText("Curso"); this.labelNombreObjeto.setText(((Curso)objetoQueVerHorario).getNombreCurso()); this.panelCursos.setVisible(false); this.labelCursos.setVisible(false); this.setSize(782, 300); this.botonCerrarHorario.setText("Aceptar"); } if (objetoQueVerHorario.getClass().equals(Profesor.class)) { this.horasAMostrar = ((Profesor)objetoQueVerHorario).getHorasDispArrayList(); this.horasOcupadasDelProfe = ((Profesor)objetoQueVerHorario).getHorasAsigArrayList(); this.labelClaseObjeto.setText("Profesor"); this.labelNombreObjeto.setText(((Profesor)objetoQueVerHorario).getNombreProfesor()); //muestor los cursos que tenga asignados el profesor en la tabla de cursos DefaultTableModel modelo = new DefaultTableModel(new Object [][] {},new String [] {"Curso", "Asignatura"}); Vector vectorFila = new Vector(3); for (Curso curso :((Profesor)objetoQueVerHorario).getCursosAsigArrayList()) { vectorFila.add(curso.getCodigoCurso()+" - " +curso.getSeccion()); vectorFila.add(curso.getNombreCurso()); modelo.addRow(vectorFila); vectorFila = new Vector(3); } this.tablaCursos.setModel(modelo); } if (objetoQueVerHorario.getClass().equals(Semestre.class)) { horasAMostrar = ((Profesor)objetoQueVerHorario).getHorasAsigArrayList(); this.labelClaseObjeto.setText("Semestre"); this.labelNombreObjeto.setText("N° "+((Semestre)objetoQueVerHorario).getNumeroSemestre()); //muestor los cursos que tenga asignados el profesor en la tabla de cursos DefaultTableModel modelo = new DefaultTableModel(new Object [][] {},new String [] {"Curso", "Asignatura"}); Vector vectorFila = new Vector(3); for (Curso curso :((Semestre)objetoQueVerHorario).getCursosArrayList()) { vectorFila.add(curso.getCodigoCurso()+" - " +curso.getSeccion()); vectorFila.add(curso.getNombreCurso()); modelo.addRow(vectorFila); vectorFila = new Vector(3); } this.tablaCursos.setModel(modelo); } if (modo == VisualizadorHorarioObjeto.VISUALIZACION) { this.horarioMostrado.setCellSelectionEnabled(false); this.JListHorasSeleccionadas.setVisible(false); this.JListHorasSeleccionadas.setEnabled(false); } if (modo == VisualizadorHorarioObjeto.EDICION) { this.horarioMostrado.setCellSelectionEnabled(false); this.panelCursos.setVisible(false); this.labelCursos.setVisible(false); this.setSize(852, 300); this.botonCerrarHorario.setText("Aceptar"); this.JListHorasSeleccionadas.setEnabled(true); this.JListHorasSeleccionadas.setVisible(true); this.JListHorasSeleccionadas.setModel(this.listModelHoras); if (profesorAAsignar != null) { this.horasAMostrar = profesorAAsignar.getHorasDispArrayList(); this.horasOcupadasDelProfe = profesorAAsignar.getHorasAsigArrayList(); } } Hora horaTemp; //dibujo las horas en las celdas de la tabla try { for(i = 1; i < 7; i++) { for (j = 0; j < 9; j++) { horaTemp = new Hora((i-1)*9 + j+1); if (horasAMostrar.contains(horaTemp)) { if (this.claseDelObjeto == Profesor.class) this.horarioMostrado.setValueAt("Disponible", j, i); if ((this.claseDelObjeto == Curso.class) && (this.modo == VisualizadorHorarioObjeto.VISUALIZACION)) this.horarioMostrado.setValueAt("Asignado", j, i); if (this.claseDelObjeto == Semestre.class) this.horarioMostrado.setValueAt("Asignado", j, i); } else { this.horarioMostrado.setValueAt("", j, i); } if (this.horasDispDelProfe.contains(horaTemp)) this.horarioMostrado.setValueAt("Disponible", j, i); if (this.horasOcupadasDelProfe.contains(horaTemp)) { this.horarioMostrado.setValueAt("Ocupada", j, i); } } } } catch (HourOutOfRangeException e) { System.out.println("Error al mostrar la hora en la tabla"); } }"
Inversion-Mutation
megadiff
"public Scene(SceneElement e) { this(e.toString()); String title = e.getName(); this.setTitle(title); int height = e.getHeight() + e.getY(); int width = e.getWidth() + e.getX(); this.setSize(width, height); this.add(e); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "Scene"
"public Scene(SceneElement e) { this(e.toString()); <MASK>this.setTitle(title);</MASK> String title = e.getName(); int height = e.getHeight() + e.getY(); int width = e.getWidth() + e.getX(); this.setSize(width, height); this.add(e); }"
Inversion-Mutation
megadiff
"@Override public void regionAdded(RegionEvent evt) { if (!isActive()) return; if (evt.getRegion()!=null) { IRegion region = evt.getRegion(); region.addROIListener(this); region.getROI().setPlot(true); // set the Region isActive flag region.setActive(true); } if (viewer!=null) viewer.refresh(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "regionAdded"
"@Override public void regionAdded(RegionEvent evt) { if (!isActive()) return; <MASK>if (viewer!=null) viewer.refresh();</MASK> if (evt.getRegion()!=null) { IRegion region = evt.getRegion(); region.addROIListener(this); region.getROI().setPlot(true); // set the Region isActive flag region.setActive(true); } }"
Inversion-Mutation
megadiff
"@Override public boolean equals(Object o){ if(!(o instanceof ValueString)) return false; ValueString str = (ValueString)o; if(_skips.isEmpty() && str._skips.isEmpty()){ // no skipped chars if(str._length != _length)return false; for(int i = 0; i < _length; ++i) if(_buf[_off+i] != str._buf[str._off+i]) return false; }else if(str._skips.isEmpty()){ // only this has skipped chars if(_length - _skips.size() != str._length)return false; int j = 0; int i = _off; for(int n:_skips){ for(; i < _off+n; ++i) if(_buf[i] != str._buf[j++])return false; ++i; } int n = _off + _length; for(; i < n; ++i) if(_buf[i] != str._buf[j++])return false; } else return toString().equals(str.toString()); // both strings have skipped chars, unnecessarily complicated so just turn it into a string (which skips the chars), should not happen too often return true; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "equals"
"@Override public boolean equals(Object o){ if(!(o instanceof ValueString)) return false; ValueString str = (ValueString)o; <MASK>if(str._length != _length)return false;</MASK> if(_skips.isEmpty() && str._skips.isEmpty()){ // no skipped chars for(int i = 0; i < _length; ++i) if(_buf[_off+i] != str._buf[str._off+i]) return false; }else if(str._skips.isEmpty()){ // only this has skipped chars if(_length - _skips.size() != str._length)return false; int j = 0; int i = _off; for(int n:_skips){ for(; i < _off+n; ++i) if(_buf[i] != str._buf[j++])return false; ++i; } int n = _off + _length; for(; i < n; ++i) if(_buf[i] != str._buf[j++])return false; } else return toString().equals(str.toString()); // both strings have skipped chars, unnecessarily complicated so just turn it into a string (which skips the chars), should not happen too often return true; }"
Inversion-Mutation
megadiff
"public boolean hasSideEffects() { switch (type) { case Token.EXPR_VOID: case Token.COMMA: if (last != null) return last.hasSideEffects(); else return true; case Token.HOOK: if (first == null || first.next == null || first.next.next == null) Kit.codeBug(); return first.next.hasSideEffects() && first.next.next.hasSideEffects(); case Token.ERROR: // Avoid cascaded error messages case Token.EXPR_RESULT: case Token.ASSIGN: case Token.ASSIGN_ADD: case Token.ASSIGN_SUB: case Token.ASSIGN_MUL: case Token.ASSIGN_DIV: case Token.ASSIGN_MOD: case Token.ASSIGN_BITOR: case Token.ASSIGN_BITXOR: case Token.ASSIGN_BITAND: case Token.ASSIGN_LSH: case Token.ASSIGN_RSH: case Token.ASSIGN_URSH: case Token.ENTERWITH: case Token.LEAVEWITH: case Token.RETURN: case Token.GOTO: case Token.IFEQ: case Token.IFNE: case Token.NEW: case Token.DELPROP: case Token.SETNAME: case Token.SETPROP: case Token.SETELEM: case Token.CALL: case Token.THROW: case Token.RETHROW: case Token.SETVAR: case Token.CATCH_SCOPE: case Token.RETURN_RESULT: case Token.SET_REF: case Token.DEL_REF: case Token.REF_CALL: case Token.TRY: case Token.SEMI: case Token.INC: case Token.DEC: case Token.EXPORT: case Token.IMPORT: case Token.IF: case Token.ELSE: case Token.SWITCH: case Token.WHILE: case Token.DO: case Token.FOR: case Token.BREAK: case Token.CONTINUE: case Token.VAR: case Token.CONST: case Token.WITH: case Token.CATCH: case Token.FINALLY: case Token.BLOCK: case Token.LABEL: case Token.TARGET: case Token.LOOP: case Token.JSR: case Token.SETPROP_OP: case Token.SETELEM_OP: case Token.LOCAL_BLOCK: case Token.SET_REF_OP: case Token.YIELD: return true; default: return false; } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "hasSideEffects"
"public boolean hasSideEffects() { switch (type) { case Token.EXPR_VOID: <MASK>case Token.EXPR_RESULT:</MASK> case Token.COMMA: if (last != null) return last.hasSideEffects(); else return true; case Token.HOOK: if (first == null || first.next == null || first.next.next == null) Kit.codeBug(); return first.next.hasSideEffects() && first.next.next.hasSideEffects(); case Token.ERROR: // Avoid cascaded error messages case Token.ASSIGN: case Token.ASSIGN_ADD: case Token.ASSIGN_SUB: case Token.ASSIGN_MUL: case Token.ASSIGN_DIV: case Token.ASSIGN_MOD: case Token.ASSIGN_BITOR: case Token.ASSIGN_BITXOR: case Token.ASSIGN_BITAND: case Token.ASSIGN_LSH: case Token.ASSIGN_RSH: case Token.ASSIGN_URSH: case Token.ENTERWITH: case Token.LEAVEWITH: case Token.RETURN: case Token.GOTO: case Token.IFEQ: case Token.IFNE: case Token.NEW: case Token.DELPROP: case Token.SETNAME: case Token.SETPROP: case Token.SETELEM: case Token.CALL: case Token.THROW: case Token.RETHROW: case Token.SETVAR: case Token.CATCH_SCOPE: case Token.RETURN_RESULT: case Token.SET_REF: case Token.DEL_REF: case Token.REF_CALL: case Token.TRY: case Token.SEMI: case Token.INC: case Token.DEC: case Token.EXPORT: case Token.IMPORT: case Token.IF: case Token.ELSE: case Token.SWITCH: case Token.WHILE: case Token.DO: case Token.FOR: case Token.BREAK: case Token.CONTINUE: case Token.VAR: case Token.CONST: case Token.WITH: case Token.CATCH: case Token.FINALLY: case Token.BLOCK: case Token.LABEL: case Token.TARGET: case Token.LOOP: case Token.JSR: case Token.SETPROP_OP: case Token.SETELEM_OP: case Token.LOCAL_BLOCK: case Token.SET_REF_OP: case Token.YIELD: return true; default: return false; } }"
Inversion-Mutation
megadiff
"protected static synchronized void initDriver(QueryServices services, String url) throws Exception { if (driver == null) { if (driverRefCount == 0) { BaseTest.driver = new PhoenixTestDriver(services, url, TEST_PROPERTIES); DriverManager.registerDriver(driver); assertTrue(DriverManager.getDriver(url) == driver); driverRefCount++; } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "initDriver"
"protected static synchronized void initDriver(QueryServices services, String url) throws Exception { if (driver == null) { if (driverRefCount == 0) { <MASK>driverRefCount++;</MASK> BaseTest.driver = new PhoenixTestDriver(services, url, TEST_PROPERTIES); DriverManager.registerDriver(driver); assertTrue(DriverManager.getDriver(url) == driver); } } }"
Inversion-Mutation
megadiff
"@Subscribe public void constructMod(FMLConstructionEvent event) { try { ModClassLoader modClassLoader = event.getModClassLoader(); modClassLoader.addFile(source); modClassLoader.clearNegativeCacheFor(candidate.getClassList()); Class<?> clazz = Class.forName(className, true, modClassLoader); Certificate[] certificates = clazz.getProtectionDomain().getCodeSource().getCertificates(); int len = 0; if (certificates != null) { len = certificates.length; } Builder<String> certBuilder = ImmutableList.<String>builder(); for (int i = 0; i < len; i++) { certBuilder.add(CertificateHelper.getFingerprint(certificates[i])); } ImmutableList<String> certList = certBuilder.build(); sourceFingerprints = ImmutableSet.copyOf(certList); String expectedFingerprint = (String) descriptor.get("certificateFingerprint"); fingerprintNotPresent = true; if (expectedFingerprint != null && !expectedFingerprint.isEmpty()) { if (!sourceFingerprints.contains(expectedFingerprint)) { Level warnLevel = Level.SEVERE; if (source.isDirectory()) { warnLevel = Level.FINER; } FMLLog.log(getModId(), warnLevel, "The mod %s is expecting signature %s for source %s, however there is no signature matching that description", getModId(), expectedFingerprint, source.getName()); } else { certificate = certificates[certList.indexOf(expectedFingerprint)]; fingerprintNotPresent = false; } } CustomProperty[] props = (CustomProperty[]) descriptor.get("customProperties"); if (props!=null && props.length > 0) { com.google.common.collect.ImmutableMap.Builder<String, String> builder = ImmutableMap.<String,String>builder(); for (CustomProperty p : props) { builder.put(p.k(),p.v()); } customModProperties = builder.build(); } else { customModProperties = EMPTY_PROPERTIES; } Method factoryMethod = gatherAnnotations(clazz); modInstance = getLanguageAdapter().getNewInstance(this,clazz, modClassLoader, factoryMethod); isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, clazz, event.getASMHarvestedData()); if (fingerprintNotPresent) { eventBus.post(new FMLFingerprintViolationEvent(source.isDirectory(), source, ImmutableSet.copyOf(this.sourceFingerprints), expectedFingerprint)); } ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide(), getLanguageAdapter()); processFieldAnnotations(event.getASMHarvestedData()); } catch (Throwable e) { controller.errorOccurred(this, e); Throwables.propagateIfPossible(e); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "constructMod"
"@Subscribe public void constructMod(FMLConstructionEvent event) { try { ModClassLoader modClassLoader = event.getModClassLoader(); modClassLoader.addFile(source); modClassLoader.clearNegativeCacheFor(candidate.getClassList()); Class<?> clazz = Class.forName(className, true, modClassLoader); Certificate[] certificates = clazz.getProtectionDomain().getCodeSource().getCertificates(); int len = 0; if (certificates != null) { len = certificates.length; } Builder<String> certBuilder = ImmutableList.<String>builder(); for (int i = 0; i < len; i++) { certBuilder.add(CertificateHelper.getFingerprint(certificates[i])); } ImmutableList<String> certList = certBuilder.build(); sourceFingerprints = ImmutableSet.copyOf(certList); String expectedFingerprint = (String) descriptor.get("certificateFingerprint"); fingerprintNotPresent = true; if (expectedFingerprint != null && !expectedFingerprint.isEmpty()) { if (!sourceFingerprints.contains(expectedFingerprint)) { Level warnLevel = Level.SEVERE; if (source.isDirectory()) { warnLevel = Level.FINER; } FMLLog.log(getModId(), warnLevel, "The mod %s is expecting signature %s for source %s, however there is no signature matching that description", getModId(), expectedFingerprint, source.getName()); } else { certificate = certificates[certList.indexOf(expectedFingerprint)]; fingerprintNotPresent = false; } } CustomProperty[] props = (CustomProperty[]) descriptor.get("customProperties"); if (props!=null && props.length > 0) { com.google.common.collect.ImmutableMap.Builder<String, String> builder = ImmutableMap.<String,String>builder(); for (CustomProperty p : props) { builder.put(p.k(),p.v()); } customModProperties = builder.build(); } else { customModProperties = EMPTY_PROPERTIES; } Method factoryMethod = gatherAnnotations(clazz); <MASK>isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, clazz, event.getASMHarvestedData());</MASK> modInstance = getLanguageAdapter().getNewInstance(this,clazz, modClassLoader, factoryMethod); if (fingerprintNotPresent) { eventBus.post(new FMLFingerprintViolationEvent(source.isDirectory(), source, ImmutableSet.copyOf(this.sourceFingerprints), expectedFingerprint)); } ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide(), getLanguageAdapter()); processFieldAnnotations(event.getASMHarvestedData()); } catch (Throwable e) { controller.errorOccurred(this, e); Throwables.propagateIfPossible(e); } }"
Inversion-Mutation
megadiff
"private synchronized void init() { if (isInit) return; isInit = true; // Note: we mark the initial contact point as UP, because we have no prior // notion of their state and no real way to know until we connect to them // (since the node status is not exposed by C* in the System tables). This // may not be correct. for (InetAddress address : contactPoints) { Host host = addHost(address, false); if (host != null) host.setUp(); } loadBalancingPolicy().init(Cluster.this, metadata.allHosts()); try { controlConnection.connect(); } catch (NoHostAvailableException e) { try { shutdown(0, TimeUnit.MILLISECONDS); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } throw e; } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "init"
"private synchronized void init() { if (isInit) return; // Note: we mark the initial contact point as UP, because we have no prior // notion of their state and no real way to know until we connect to them // (since the node status is not exposed by C* in the System tables). This // may not be correct. for (InetAddress address : contactPoints) { Host host = addHost(address, false); if (host != null) host.setUp(); } loadBalancingPolicy().init(Cluster.this, metadata.allHosts()); try { controlConnection.connect(); } catch (NoHostAvailableException e) { try { shutdown(0, TimeUnit.MILLISECONDS); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } throw e; } <MASK>isInit = true;</MASK> }"
Inversion-Mutation
megadiff
"@Test public void testShutdownDuringReacquireDelay() throws Exception { ServiceTriggers leaderTriggers = new ServiceTriggers(); ServiceTriggers triggers1 = new ServiceTriggers(); ServiceTriggers triggers2 = new ServiceTriggers(); LeaderService leader = leaderTriggers.listenTo(newLeaderService(15, TimeUnit.MINUTES, supply( triggers1.listenTo(new NopService()), triggers2.listenTo(new NopService())))); leader.start(); assertTrue(triggers1.getRunning().firedWithin(1, TimeUnit.MINUTES)); assertTrue(leader.hasLeadership()); leader.getCurrentDelegateService().get().stop(); assertTrue(triggers1.getTerminated().firedWithin(1, TimeUnit.SECONDS)); // Should be waiting for the reacquire delay now. Make sure we don't immediately start the 2nd service. Thread.sleep(50); assertFalse(leader.hasLeadership()); assertFalse(triggers2.getStarting().hasFired()); // Stop the leader service and verify that we interrupt the reacquire delay sleep. assertFalse(leaderTriggers.getTerminated().hasFired()); leader.stop(); assertTrue(leaderTriggers.getTerminated().firedWithin(1, TimeUnit.SECONDS)); // One last check that the 2nd service was never started... assertFalse(triggers2.getStarting().hasFired()); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "testShutdownDuringReacquireDelay"
"@Test public void testShutdownDuringReacquireDelay() throws Exception { ServiceTriggers leaderTriggers = new ServiceTriggers(); ServiceTriggers triggers1 = new ServiceTriggers(); ServiceTriggers triggers2 = new ServiceTriggers(); LeaderService leader = leaderTriggers.listenTo(newLeaderService(15, TimeUnit.MINUTES, supply( triggers1.listenTo(new NopService()), triggers2.listenTo(new NopService())))); leader.start(); assertTrue(triggers1.getRunning().firedWithin(1, TimeUnit.MINUTES)); assertTrue(leader.hasLeadership()); leader.getCurrentDelegateService().get().stop(); assertTrue(triggers1.getTerminated().firedWithin(1, TimeUnit.SECONDS)); <MASK>assertFalse(leader.hasLeadership());</MASK> // Should be waiting for the reacquire delay now. Make sure we don't immediately start the 2nd service. Thread.sleep(50); assertFalse(triggers2.getStarting().hasFired()); // Stop the leader service and verify that we interrupt the reacquire delay sleep. assertFalse(leaderTriggers.getTerminated().hasFired()); leader.stop(); assertTrue(leaderTriggers.getTerminated().firedWithin(1, TimeUnit.SECONDS)); // One last check that the 2nd service was never started... assertFalse(triggers2.getStarting().hasFired()); }"
Inversion-Mutation
megadiff
"protected void drawClock(Svg g, int clock, int position, HashMap<String, Color> colorScheme) { Transform t = new Transform(); t.rotate(Math.toRadians(position*30)); int netX = 0; int netY = 0; int deltaX, deltaY; if(clock < 9) { deltaX = radius + gap; deltaY = radius + gap; t.translate(deltaX, deltaY); netX += deltaX; netY += deltaY; } else { deltaX = 3*(radius + gap); deltaY = radius + gap; t.translate(deltaX, deltaY); netX += deltaX; netY += deltaY; clock -= 9; } deltaX = 2*((clock%3) - 1)*clockOuterRadius; deltaY = 2*((clock/3) - 1)*clockOuterRadius; t.translate(deltaX, deltaY); netX += deltaX; netY += deltaY; Path arrow = new Path(); arrow.moveTo(0, 0); arrow.lineTo(arrowRadius*Math.cos(arrowAngle), -arrowRadius*Math.sin(arrowAngle)); arrow.lineTo(0, -arrowHeight); arrow.lineTo(-arrowRadius*Math.cos( arrowAngle ), -arrowRadius*Math.sin(arrowAngle)); arrow.closePath(); arrow.setStroke(colorScheme.get("HandBorder")); arrow.setTransform(t); g.appendChild(arrow); Circle handBase = new Circle(0, 0, arrowRadius); handBase.setStroke(colorScheme.get("HandBorder")); handBase.setTransform(t); g.appendChild(handBase); arrow = new Path(arrow); arrow.setFill(colorScheme.get("Hand")); arrow.setStroke(null); arrow.setTransform(t); g.appendChild(arrow); handBase = new Circle(handBase); handBase.setFill(colorScheme.get("Hand")); handBase.setStroke(null); handBase.setTransform(t); g.appendChild(handBase); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "drawClock"
"protected void drawClock(Svg g, int clock, int position, HashMap<String, Color> colorScheme) { Transform t = new Transform(); int netX = 0; int netY = 0; int deltaX, deltaY; if(clock < 9) { deltaX = radius + gap; deltaY = radius + gap; t.translate(deltaX, deltaY); netX += deltaX; netY += deltaY; } else { deltaX = 3*(radius + gap); deltaY = radius + gap; t.translate(deltaX, deltaY); netX += deltaX; netY += deltaY; clock -= 9; } deltaX = 2*((clock%3) - 1)*clockOuterRadius; deltaY = 2*((clock/3) - 1)*clockOuterRadius; t.translate(deltaX, deltaY); netX += deltaX; netY += deltaY; <MASK>t.rotate(Math.toRadians(position*30));</MASK> Path arrow = new Path(); arrow.moveTo(0, 0); arrow.lineTo(arrowRadius*Math.cos(arrowAngle), -arrowRadius*Math.sin(arrowAngle)); arrow.lineTo(0, -arrowHeight); arrow.lineTo(-arrowRadius*Math.cos( arrowAngle ), -arrowRadius*Math.sin(arrowAngle)); arrow.closePath(); arrow.setStroke(colorScheme.get("HandBorder")); arrow.setTransform(t); g.appendChild(arrow); Circle handBase = new Circle(0, 0, arrowRadius); handBase.setStroke(colorScheme.get("HandBorder")); handBase.setTransform(t); g.appendChild(handBase); arrow = new Path(arrow); arrow.setFill(colorScheme.get("Hand")); arrow.setStroke(null); arrow.setTransform(t); g.appendChild(arrow); handBase = new Circle(handBase); handBase.setFill(colorScheme.get("Hand")); handBase.setStroke(null); handBase.setTransform(t); g.appendChild(handBase); }"
Inversion-Mutation
megadiff
"@Test public void testShip() { IPlayer p = new Player("test"); HashMap<String, ICell> map1 = new HashMap<String, ICell>(); map1.put(Cell.createKey(c1.getX(), c1.getY()), c1); assertNull(c1.getShip()); Ship s1 = new Ship(p, map1); c1.setShip(s1); assertEquals(c1.getShip(), s1); HashMap<String, ICell> map2 = new HashMap<String, ICell>(); map1.put(Cell.createKey(c2.getX(), c2.getY()), c2); Ship s2 = new Ship(p, map2); assertNull(c2.getShip()); c2.setShip(s2); assertEquals(c2.getShip(), s2); assertEquals(c1.getShip(), s1); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "testShip"
"@Test public void testShip() { IPlayer p = new Player("test"); HashMap<String, ICell> map1 = new HashMap<String, ICell>(); map1.put(Cell.createKey(c1.getX(), c1.getY()), c1); <MASK>Ship s1 = new Ship(p, map1);</MASK> assertNull(c1.getShip()); c1.setShip(s1); assertEquals(c1.getShip(), s1); HashMap<String, ICell> map2 = new HashMap<String, ICell>(); map1.put(Cell.createKey(c2.getX(), c2.getY()), c2); Ship s2 = new Ship(p, map2); assertNull(c2.getShip()); c2.setShip(s2); assertEquals(c2.getShip(), s2); assertEquals(c1.getShip(), s1); }"
Inversion-Mutation
megadiff
"@Override public boolean warpPlayerExecute(WarpSuitePlayer player, List<String> args, List<String> variables) { if(args.size() == 0) { return false; } if(!Permissions.WARP_SET.check(player)) { return Util.invalidPermissions(player); } int allowedWarps = NumeralPermissions.COUNT.getAmount(player); int warpsOwned = player.getWarpManager().getAmountOfSetWarps(); if(allowedWarps != -1 && warpsOwned >= allowedWarps) { player.sendMessage(NEGATIVE_PRIMARY + "You already have the maximum warps you're allowed to set! (" + NEGATIVE_SECONDARY + allowedWarps + NEGATIVE_PRIMARY + ")"); return true; } String warpName = args.get(0); if(!Util.isValidWarpName(warpName)) { player.sendMessage(NEGATIVE_PRIMARY + "\'" + NEGATIVE_SECONDARY + warpName + NEGATIVE_PRIMARY + "\' is an invalid warp name!"); return true; } boolean overwritten = player.getWarpManager().warpIsSet(warpName); player.getWarpManager().setWarp(warpName, new SimpleLocation(player.getPlayer().getLocation())); player.sendMessage(POSITIVE_PRIMARY + "Warp \'" + POSITIVE_SECONDARY + warpName + POSITIVE_PRIMARY + "\' has been " + (overwritten ? "overwritten" : "set") + "."); return true; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "warpPlayerExecute"
"@Override public boolean warpPlayerExecute(WarpSuitePlayer player, List<String> args, List<String> variables) { if(args.size() == 0) { return false; } if(!Permissions.WARP_SET.check(player)) { return Util.invalidPermissions(player); } int allowedWarps = NumeralPermissions.COUNT.getAmount(player); int warpsOwned = player.getWarpManager().getAmountOfSetWarps(); if(allowedWarps != -1 && warpsOwned >= allowedWarps) { player.sendMessage(NEGATIVE_PRIMARY + "You already have the maximum warps you're allowed to set! (" + NEGATIVE_SECONDARY + allowedWarps + NEGATIVE_PRIMARY + ")"); return true; } String warpName = args.get(0); if(!Util.isValidWarpName(warpName)) { player.sendMessage(NEGATIVE_PRIMARY + "\'" + NEGATIVE_SECONDARY + warpName + NEGATIVE_PRIMARY + "\' is an invalid warp name!"); return true; } <MASK>player.getWarpManager().setWarp(warpName, new SimpleLocation(player.getPlayer().getLocation()));</MASK> boolean overwritten = player.getWarpManager().warpIsSet(warpName); player.sendMessage(POSITIVE_PRIMARY + "Warp \'" + POSITIVE_SECONDARY + warpName + POSITIVE_PRIMARY + "\' has been " + (overwritten ? "overwritten" : "set") + "."); return true; }"
Inversion-Mutation
megadiff
"public Canvas compile(File file, OutputStream ostr, Properties props, CompilationEnvironment env) throws CompilationError, IOException { mLogger.info("compiling " + file + "..."); CompilationErrorHandler errors = env.getErrorHandler(); env.setApplicationFile(file); // Copy target properties (debug, logdebug, profile, krank, // runtime) from props arg to CompilationEnvironment String runtime = props.getProperty(env.RUNTIME_PROPERTY); boolean linking = (! "false".equals(env.getProperty(CompilationEnvironment.LINK_PROPERTY))); boolean noCodeGeneration = "true".equals(env.getProperty(CompilationEnvironment.NO_CODE_GENERATION)); if (runtime != null) { mLogger.info("canvas compiler compiling runtime = " + runtime); env.setProperty(env.RUNTIME_PROPERTY, runtime); if (! KNOWN_RUNTIMES.contains(runtime)) { List runtimes = new Vector(); for (Iterator iter = KNOWN_RUNTIMES.iterator(); iter.hasNext(); ) { runtimes.add("\"" + iter.next() + "\""); } throw new CompilationError( MessageFormat.format( "Request for unknown runtime: The \"lzr\" query parameter has the value \"{0}\". It must be {1}{2}.", new String[] { runtime, new ChoiceFormat( "1#| 2#either | 2<one of "). format(runtimes.size()), new ListFormat("or").format(runtimes) })); } } String proxied = props.getProperty(CompilationEnvironment.PROXIED_PROPERTY); mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="looking for lzproxied, props= " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( Compiler.class.getName(),"051018-257", new Object[] {props.toString()}) ); if (proxied != null) { mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="setting lzproxied to " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( Compiler.class.getName(),"051018-266", new Object[] {proxied}) ); env.setProperty(CompilationEnvironment.PROXIED_PROPERTY, proxied); } String debug = props.getProperty(CompilationEnvironment.DEBUG_PROPERTY); if (debug != null) { env.setProperty(CompilationEnvironment.DEBUG_PROPERTY, debug); } String lzconsoledebug = props.getProperty(CompilationEnvironment.CONSOLEDEBUG_PROPERTY); if (lzconsoledebug != null) { env.setProperty(CompilationEnvironment.CONSOLEDEBUG_PROPERTY, lzconsoledebug); } String backtrace = props.getProperty(CompilationEnvironment.BACKTRACE_PROPERTY); if (backtrace != null) { if ("true".equals(backtrace)) { env.setProperty(CompilationEnvironment.DEBUG_PROPERTY, "true" ); } env.setProperty(CompilationEnvironment.BACKTRACE_PROPERTY, backtrace); } String profile = props.getProperty(CompilationEnvironment.PROFILE_PROPERTY); if (profile != null) { env.setProperty(CompilationEnvironment.PROFILE_PROPERTY, profile); } String logdebug = props.getProperty(CompilationEnvironment.LOGDEBUG_PROPERTY); if (logdebug != null) { env.setProperty(CompilationEnvironment.LOGDEBUG_PROPERTY, logdebug); } String sourcelocators = props.getProperty(CompilationEnvironment.SOURCELOCATOR_PROPERTY); if (sourcelocators != null) { env.setProperty(CompilationEnvironment.SOURCELOCATOR_PROPERTY, sourcelocators); } String trackLines = props.getProperty(CompilationEnvironment.TRACK_LINES); if (trackLines != null) { env.setProperty(CompilationEnvironment.TRACK_LINES, trackLines); } String nameFunctions = props.getProperty(CompilationEnvironment.NAME_FUNCTIONS); if (nameFunctions != null) { env.setProperty(CompilationEnvironment.NAME_FUNCTIONS, nameFunctions); } try { mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="Parsing " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( Compiler.class.getName(),"051018-303", new Object[] {file.getAbsolutePath()}) ); // Initialize the schema from the base LFC interface file try { env.getSchema().loadSchema(env); } catch (org.jdom.JDOMException e) { throw new ChainedException(e); } Document doc = env.getParser().parse(file, env); Element root = doc.getRootElement(); // Override passed in runtime target properties with the // canvas values. if ("true".equals(root.getAttributeValue("debug"))) { env.setProperty(CompilationEnvironment.DEBUG_PROPERTY, true); } if ("true".equals(root.getAttributeValue("profile"))) { env.setProperty(CompilationEnvironment.PROFILE_PROPERTY, true); } // cssfile cannot be set in the canvas tag String cssfile = props.getProperty(CompilationEnvironment.CSSFILE_PROPERTY); if (cssfile != null) { mLogger.info("Got cssfile named: " + cssfile); cssfile = root.getAttributeValue("cssfile"); throw new CompilationError( "cssfile attribute of canvas is no longer supported. Use <stylesheet> instead."); } mLogger.debug("Making a writer..."); ViewSchema schema = env.getSchema(); Set externalLibraries = null; // If we are not linking, then we consider all external // files to have already been imported. if (! linking) { externalLibraries = env.getImportedLibraryFiles(); } if (root.getName().intern() != (linking ? "canvas" : "library")) { throw new CompilationError( /* (non-Javadoc) * @i18n.test * @org-mes="invalid root element type: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( Compiler.class.getName(),"051018-357", new Object[] {root.getName()}) ); } Compiler.updateRootSchema(root, env, schema, externalLibraries); if (noCodeGeneration) { return null; } Properties nprops = (Properties) env.getProperties().clone(); Map compileTimeConstants = new HashMap(); compileTimeConstants.put("$debug", new Boolean( env.getBooleanProperty(CompilationEnvironment.DEBUG_PROPERTY))); compileTimeConstants.put("$profile", new Boolean( env.getBooleanProperty(CompilationEnvironment.PROFILE_PROPERTY))); boolean backtraceValue = env.getBooleanProperty(CompilationEnvironment.BACKTRACE_PROPERTY); compileTimeConstants.put("$backtrace", new Boolean(backtraceValue)); runtime = env.getProperty(env.RUNTIME_PROPERTY); // Must be kept in sync with server/sc/lzsc.py main compileTimeConstants.put("$runtime", runtime); compileTimeConstants.put("$swf7", Boolean.valueOf("swf7".equals(runtime))); compileTimeConstants.put("$swf8", Boolean.valueOf("swf8".equals(runtime))); compileTimeConstants.put("$as2", Boolean.valueOf(Arrays.asList(new String[] {"swf7", "swf8"}).contains(runtime))); compileTimeConstants.put("$swf9", Boolean.valueOf("swf9".equals(runtime))); compileTimeConstants.put("$as3", Boolean.valueOf(Arrays.asList(new String[] {"swf9"}).contains(runtime))); compileTimeConstants.put("$dhtml", Boolean.valueOf("dhtml".equals(runtime))); compileTimeConstants.put("$j2me", Boolean.valueOf("j2me".equals(runtime))); compileTimeConstants.put("$svg", Boolean.valueOf("svg".equals(runtime))); compileTimeConstants.put("$js1", Boolean.valueOf(Arrays.asList(new String[] {"dhtml", "j2me", "svg"}).contains(runtime))); // [todo: 2006-04-17 hqm] These compileTimeConstants will be used by the script compiler // at compile time, but they won't be emitted into the object code for user apps. Only // the compiled LFC emits code which defines these constants. We need to have some // better way to ensure that the LFC's constants values match the app code's. nprops.put("compileTimeConstants", compileTimeConstants); ObjectWriter writer = createObjectWriter(nprops, ostr, env, root); env.setObjectWriter(writer); mLogger.debug("new env..." + env.getProperties().toString()); processCompilerInstructions(root, env); compileElement(root, env); if (linking) { ViewCompiler.checkUnresolvedResourceReferences (env); } mLogger.debug("done..."); // This isn't in a finally clause, because it won't generally // succeed if an error occurs. writer.close(); Canvas canvas = env.getCanvas(); if (!errors.isEmpty()) { if (canvas != null) { canvas.setCompilationWarningText( errors.toCompilationError().getMessage()); canvas.setCompilationWarningXML( errors.toXML()); } System.err.println(errors.toCompilationError().getMessage()); } if (canvas != null) { canvas.setBacktrace(backtraceValue); // set file path (relative to webapp) in canvas canvas.setFilePath(FileUtils.relativePath(file, LPS.HOME())); } mLogger.info("done"); return canvas; } catch (CompilationError e) { // TBD: e.initPathname(file.getPath()); e.attachErrors(errors.getErrors()); throw e; //errors.addError(new CompilationError(e.getMessage() + "; compilation aborted")); //throw errors.toCompilationError(); } catch (org.openlaszlo.xml.internal.MissingAttributeException e) { /* The validator will have caught this, but if we simply * pass the error through, the vaildation warnings will * never be printed. Create a new message that includes * them so that we get the source information. */ errors.addError(new CompilationError( /* (non-Javadoc) * @i18n.test * @org-mes=p[0] + "; compilation aborted" */ org.openlaszlo.i18n.LaszloMessages.getMessage( Compiler.class.getName(),"051018-399", new Object[] {e.getMessage()}) )); throw errors.toCompilationError(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "compile"
"public Canvas compile(File file, OutputStream ostr, Properties props, CompilationEnvironment env) throws CompilationError, IOException { mLogger.info("compiling " + file + "..."); CompilationErrorHandler errors = env.getErrorHandler(); env.setApplicationFile(file); // Copy target properties (debug, logdebug, profile, krank, // runtime) from props arg to CompilationEnvironment String runtime = props.getProperty(env.RUNTIME_PROPERTY); boolean linking = (! "false".equals(env.getProperty(CompilationEnvironment.LINK_PROPERTY))); boolean noCodeGeneration = "true".equals(env.getProperty(CompilationEnvironment.NO_CODE_GENERATION)); if (runtime != null) { mLogger.info("canvas compiler compiling runtime = " + runtime); env.setProperty(env.RUNTIME_PROPERTY, runtime); if (! KNOWN_RUNTIMES.contains(runtime)) { List runtimes = new Vector(); for (Iterator iter = KNOWN_RUNTIMES.iterator(); iter.hasNext(); ) { runtimes.add("\"" + iter.next() + "\""); } throw new CompilationError( MessageFormat.format( "Request for unknown runtime: The \"lzr\" query parameter has the value \"{0}\". It must be {1}{2}.", new String[] { runtime, new ChoiceFormat( "1#| 2#either | 2<one of "). format(runtimes.size()), new ListFormat("or").format(runtimes) })); } } String proxied = props.getProperty(CompilationEnvironment.PROXIED_PROPERTY); mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="looking for lzproxied, props= " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( Compiler.class.getName(),"051018-257", new Object[] {props.toString()}) ); if (proxied != null) { mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="setting lzproxied to " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( Compiler.class.getName(),"051018-266", new Object[] {proxied}) ); env.setProperty(CompilationEnvironment.PROXIED_PROPERTY, proxied); } String debug = props.getProperty(CompilationEnvironment.DEBUG_PROPERTY); if (debug != null) { env.setProperty(CompilationEnvironment.DEBUG_PROPERTY, debug); } String lzconsoledebug = props.getProperty(CompilationEnvironment.CONSOLEDEBUG_PROPERTY); if (lzconsoledebug != null) { env.setProperty(CompilationEnvironment.CONSOLEDEBUG_PROPERTY, lzconsoledebug); } String backtrace = props.getProperty(CompilationEnvironment.BACKTRACE_PROPERTY); if (backtrace != null) { if ("true".equals(backtrace)) { env.setProperty(CompilationEnvironment.DEBUG_PROPERTY, "true" ); } env.setProperty(CompilationEnvironment.BACKTRACE_PROPERTY, backtrace); } String profile = props.getProperty(CompilationEnvironment.PROFILE_PROPERTY); if (profile != null) { env.setProperty(CompilationEnvironment.PROFILE_PROPERTY, profile); } String logdebug = props.getProperty(CompilationEnvironment.LOGDEBUG_PROPERTY); if (logdebug != null) { env.setProperty(CompilationEnvironment.LOGDEBUG_PROPERTY, logdebug); } String sourcelocators = props.getProperty(CompilationEnvironment.SOURCELOCATOR_PROPERTY); if (sourcelocators != null) { env.setProperty(CompilationEnvironment.SOURCELOCATOR_PROPERTY, sourcelocators); } String trackLines = props.getProperty(CompilationEnvironment.TRACK_LINES); if (trackLines != null) { env.setProperty(CompilationEnvironment.TRACK_LINES, trackLines); } String nameFunctions = props.getProperty(CompilationEnvironment.NAME_FUNCTIONS); if (nameFunctions != null) { env.setProperty(CompilationEnvironment.NAME_FUNCTIONS, nameFunctions); } try { mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="Parsing " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( Compiler.class.getName(),"051018-303", new Object[] {file.getAbsolutePath()}) ); // Initialize the schema from the base LFC interface file try { env.getSchema().loadSchema(env); } catch (org.jdom.JDOMException e) { throw new ChainedException(e); } Document doc = env.getParser().parse(file, env); Element root = doc.getRootElement(); // Override passed in runtime target properties with the // canvas values. if ("true".equals(root.getAttributeValue("debug"))) { env.setProperty(CompilationEnvironment.DEBUG_PROPERTY, true); } if ("true".equals(root.getAttributeValue("profile"))) { env.setProperty(CompilationEnvironment.PROFILE_PROPERTY, true); } // cssfile cannot be set in the canvas tag String cssfile = props.getProperty(CompilationEnvironment.CSSFILE_PROPERTY); if (cssfile != null) { mLogger.info("Got cssfile named: " + cssfile); cssfile = root.getAttributeValue("cssfile"); throw new CompilationError( "cssfile attribute of canvas is no longer supported. Use <stylesheet> instead."); } mLogger.debug("Making a writer..."); ViewSchema schema = env.getSchema(); Set externalLibraries = null; // If we are not linking, then we consider all external // files to have already been imported. if (! linking) { externalLibraries = env.getImportedLibraryFiles(); } if (root.getName().intern() != (linking ? "canvas" : "library")) { throw new CompilationError( /* (non-Javadoc) * @i18n.test * @org-mes="invalid root element type: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( Compiler.class.getName(),"051018-357", new Object[] {root.getName()}) ); } Compiler.updateRootSchema(root, env, schema, externalLibraries); if (noCodeGeneration) { return null; } Properties nprops = (Properties) env.getProperties().clone(); Map compileTimeConstants = new HashMap(); compileTimeConstants.put("$debug", new Boolean( env.getBooleanProperty(CompilationEnvironment.DEBUG_PROPERTY))); compileTimeConstants.put("$profile", new Boolean( env.getBooleanProperty(CompilationEnvironment.PROFILE_PROPERTY))); boolean backtraceValue = env.getBooleanProperty(CompilationEnvironment.BACKTRACE_PROPERTY); compileTimeConstants.put("$backtrace", new Boolean(backtraceValue)); runtime = env.getProperty(env.RUNTIME_PROPERTY); // Must be kept in sync with server/sc/lzsc.py main compileTimeConstants.put("$runtime", runtime); compileTimeConstants.put("$swf7", Boolean.valueOf("swf7".equals(runtime))); compileTimeConstants.put("$swf8", Boolean.valueOf("swf8".equals(runtime))); compileTimeConstants.put("$as2", Boolean.valueOf(Arrays.asList(new String[] {"swf7", "swf8"}).contains(runtime))); compileTimeConstants.put("$swf9", Boolean.valueOf("swf9".equals(runtime))); compileTimeConstants.put("$as3", Boolean.valueOf(Arrays.asList(new String[] {"swf9"}).contains(runtime))); compileTimeConstants.put("$dhtml", Boolean.valueOf("dhtml".equals(runtime))); compileTimeConstants.put("$j2me", Boolean.valueOf("j2me".equals(runtime))); compileTimeConstants.put("$svg", Boolean.valueOf("svg".equals(runtime))); compileTimeConstants.put("$js1", Boolean.valueOf(Arrays.asList(new String[] {"dhtml", "j2me", "svg"}).contains(runtime))); // [todo: 2006-04-17 hqm] These compileTimeConstants will be used by the script compiler // at compile time, but they won't be emitted into the object code for user apps. Only // the compiled LFC emits code which defines these constants. We need to have some // better way to ensure that the LFC's constants values match the app code's. nprops.put("compileTimeConstants", compileTimeConstants); ObjectWriter writer = createObjectWriter(nprops, ostr, env, root); env.setObjectWriter(writer); mLogger.debug("new env..." + env.getProperties().toString()); processCompilerInstructions(root, env); compileElement(root, env); if (linking) { ViewCompiler.checkUnresolvedResourceReferences (env); } mLogger.debug("done..."); // This isn't in a finally clause, because it won't generally // succeed if an error occurs. writer.close(); Canvas canvas = env.getCanvas(); <MASK>canvas.setBacktrace(backtraceValue);</MASK> if (!errors.isEmpty()) { if (canvas != null) { canvas.setCompilationWarningText( errors.toCompilationError().getMessage()); canvas.setCompilationWarningXML( errors.toXML()); } System.err.println(errors.toCompilationError().getMessage()); } if (canvas != null) { // set file path (relative to webapp) in canvas canvas.setFilePath(FileUtils.relativePath(file, LPS.HOME())); } mLogger.info("done"); return canvas; } catch (CompilationError e) { // TBD: e.initPathname(file.getPath()); e.attachErrors(errors.getErrors()); throw e; //errors.addError(new CompilationError(e.getMessage() + "; compilation aborted")); //throw errors.toCompilationError(); } catch (org.openlaszlo.xml.internal.MissingAttributeException e) { /* The validator will have caught this, but if we simply * pass the error through, the vaildation warnings will * never be printed. Create a new message that includes * them so that we get the source information. */ errors.addError(new CompilationError( /* (non-Javadoc) * @i18n.test * @org-mes=p[0] + "; compilation aborted" */ org.openlaszlo.i18n.LaszloMessages.getMessage( Compiler.class.getName(),"051018-399", new Object[] {e.getMessage()}) )); throw errors.toCompilationError(); } }"
Inversion-Mutation
megadiff
"public Protocol findProtocol(String protocolName) { Protocol protocol = null; try { if (knownProtocols.containsKey(protocolName)) { protocol = (Protocol) knownProtocols.get(protocolName).newInstance(); } else { Class protocolClass = classLoader.findClass(protocolName); if (protocolClass != null) { protocol = (Protocol) protocolClass.newInstance(); knownProtocols.put(protocolName, protocolClass); } } } catch (InstantiationException e) { System.err.println("Failed to instantiate protocol"); } catch (IllegalAccessException e) { System.err.println("IllegalAccessExeption when instantiating class"); } return protocol; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "findProtocol"
"public Protocol findProtocol(String protocolName) { Protocol protocol = null; try { if (knownProtocols.containsKey(protocolName)) { protocol = (Protocol) knownProtocols.get(protocolName).newInstance(); } else { Class protocolClass = classLoader.findClass(protocolName); if (protocolClass != null) { protocol = (Protocol) protocolClass.newInstance(); } <MASK>knownProtocols.put(protocolName, protocolClass);</MASK> } } catch (InstantiationException e) { System.err.println("Failed to instantiate protocol"); } catch (IllegalAccessException e) { System.err.println("IllegalAccessExeption when instantiating class"); } return protocol; }"
Inversion-Mutation
megadiff
"private void setupNavigationList() { ArrayAdapter<String> navAdapter = new CustomArrayAdapter(mContext, R.layout.people_navigation_item); navAdapter.add(mContext.getString(R.string.contactsFavoritesLabel)); navAdapter.add(mContext.getString(R.string.contactsAllLabel)); navAdapter.add(mContext.getString(R.string.contactsGroupsLabel)); mActionBar.setListNavigationCallbacks(navAdapter, mNavigationListener); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "setupNavigationList"
"private void setupNavigationList() { ArrayAdapter<String> navAdapter = new CustomArrayAdapter(mContext, R.layout.people_navigation_item); <MASK>navAdapter.add(mContext.getString(R.string.contactsAllLabel));</MASK> navAdapter.add(mContext.getString(R.string.contactsFavoritesLabel)); navAdapter.add(mContext.getString(R.string.contactsGroupsLabel)); mActionBar.setListNavigationCallbacks(navAdapter, mNavigationListener); }"
Inversion-Mutation
megadiff
"public void testInstrumentClass() throws Exception { assertEquals(6, MyClass.staticSix()); final MyClass c1 = new MyClass(); assertEquals(0, c1.getA()); m_recorderStubFactory.assertNoMoreCalls(); m_instrumenter.createInstrumentedProxy(null, m_recorder, MyClass.class); m_recorderStubFactory.assertNoMoreCalls(); MyClass.staticSix(); m_recorderStubFactory.assertSuccess("start"); m_recorderStubFactory.assertSuccess("end", true); m_recorderStubFactory.assertNoMoreCalls(); assertEquals(0, c1.getA()); m_recorderStubFactory.assertNoMoreCalls(); final MyClass c2 = new MyClass(); m_recorderStubFactory.assertSuccess("start"); m_recorderStubFactory.assertSuccess("start"); m_recorderStubFactory.assertSuccess("end", true); m_recorderStubFactory.assertSuccess("end", true); assertEquals(0, c1.getA()); assertEquals(0, c2.getA()); m_recorderStubFactory.assertNoMoreCalls(); m_instrumenter.createInstrumentedProxy(null, m_recorder, MyExtendedClass.class); m_recorderStubFactory.assertNoMoreCalls(); MyClass.staticSix(); // Single call - instrumenting extension shouldn't instrument superclass // statics. m_recorderStubFactory.assertSuccess("start"); m_recorderStubFactory.assertSuccess("end", true); m_recorderStubFactory.assertNoMoreCalls(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "testInstrumentClass"
"public void testInstrumentClass() throws Exception { assertEquals(6, MyClass.staticSix()); final MyClass c1 = new MyClass(); assertEquals(0, c1.getA()); m_recorderStubFactory.assertNoMoreCalls(); m_instrumenter.createInstrumentedProxy(null, m_recorder, MyClass.class); m_recorderStubFactory.assertNoMoreCalls(); MyClass.staticSix(); m_recorderStubFactory.assertSuccess("start"); <MASK>m_recorderStubFactory.assertSuccess("end", true);</MASK> m_recorderStubFactory.assertNoMoreCalls(); assertEquals(0, c1.getA()); m_recorderStubFactory.assertNoMoreCalls(); final MyClass c2 = new MyClass(); m_recorderStubFactory.assertSuccess("start"); <MASK>m_recorderStubFactory.assertSuccess("end", true);</MASK> m_recorderStubFactory.assertSuccess("start"); <MASK>m_recorderStubFactory.assertSuccess("end", true);</MASK> assertEquals(0, c1.getA()); assertEquals(0, c2.getA()); m_recorderStubFactory.assertNoMoreCalls(); m_instrumenter.createInstrumentedProxy(null, m_recorder, MyExtendedClass.class); m_recorderStubFactory.assertNoMoreCalls(); MyClass.staticSix(); // Single call - instrumenting extension shouldn't instrument superclass // statics. m_recorderStubFactory.assertSuccess("start"); <MASK>m_recorderStubFactory.assertSuccess("end", true);</MASK> m_recorderStubFactory.assertNoMoreCalls(); }"
Inversion-Mutation
megadiff
"public void popRTFContext() { int previous=m_last_pushed_rtfdtm.pop(); if(null==m_rtfdtm_stack) return; if(m_which_rtfdtm==previous) { if(previous>=0) // guard against none-active { boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(previous))).popRewindMark(); } } else while(m_which_rtfdtm!=previous) { // Empty each DTM before popping, so it's ready for reuse // _DON'T_ pop the previous, since it's still open (which is why we // stacked up more of these) and did not receive a mark. boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(m_which_rtfdtm))).popRewindMark(); --m_which_rtfdtm; } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "popRTFContext"
"public void popRTFContext() { if(null==m_rtfdtm_stack) return; <MASK>int previous=m_last_pushed_rtfdtm.pop();</MASK> if(m_which_rtfdtm==previous) { if(previous>=0) // guard against none-active { boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(previous))).popRewindMark(); } } else while(m_which_rtfdtm!=previous) { // Empty each DTM before popping, so it's ready for reuse // _DON'T_ pop the previous, since it's still open (which is why we // stacked up more of these) and did not receive a mark. boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(m_which_rtfdtm))).popRewindMark(); --m_which_rtfdtm; } }"
Inversion-Mutation
megadiff
"public TestSuiteState validateSaveState(ITestSuitePO ts) { if (Plugin.getDefault().anyDirtyStar()) { boolean isSaved = Plugin.getDefault().showSaveEditorDialog(); if (isSaved) { SortedSet<ITestSuitePO> allTestSuites = getAllTestSuites(); if (allTestSuites.contains(ts)) { return TestSuiteState.complete; } } return TestSuiteState.incomplete; } return TestSuiteState.unchanged; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "validateSaveState"
"public TestSuiteState validateSaveState(ITestSuitePO ts) { if (Plugin.getDefault().anyDirtyStar()) { boolean isSaved = Plugin.getDefault().showSaveEditorDialog(); if (isSaved) { SortedSet<ITestSuitePO> allTestSuites = getAllTestSuites(); if (allTestSuites.contains(ts)) { return TestSuiteState.complete; } <MASK>return TestSuiteState.incomplete;</MASK> } } return TestSuiteState.unchanged; }"
Inversion-Mutation
megadiff
"synchronized public void shutdown() { _log.notice("shutting down"); Enumeration e = _providers.elements(); while (e.hasMoreElements()) { Provider pr = (Provider) e.nextElement(); _log.info("stopping: " + pr); pr.destroy(); } _providers.clear(); _ls.flush(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "shutdown"
"synchronized public void shutdown() { _log.notice("shutting down"); Enumeration e = _providers.elements(); <MASK>_providers.clear();</MASK> while (e.hasMoreElements()) { Provider pr = (Provider) e.nextElement(); _log.info("stopping: " + pr); pr.destroy(); } _ls.flush(); }"
Inversion-Mutation
megadiff
"protected void fillManifest(boolean compatibilityManifest) { generateManifestVersion(); generateHeaders(); generateClasspath(); generateActivator(); generatePluginClass(); generateProvidePackage(); generateRequireBundle(); generateLocalizationEntry(); generateEclipseHeaders(); if (compatibilityManifest) { generateTimestamp(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "fillManifest"
"protected void fillManifest(boolean compatibilityManifest) { generateManifestVersion(); generateHeaders(); generateClasspath(); generateActivator(); generatePluginClass(); generateProvidePackage(); generateRequireBundle(); generateLocalizationEntry(); if (compatibilityManifest) { generateTimestamp(); <MASK>generateEclipseHeaders();</MASK> } }"
Inversion-Mutation
megadiff
"public RentPropertiesManager(String propertiesName){ this.propertiesName = propertiesName; propFile = new File(RentDirectoryManager.getPathInDir(propertiesName)); prop = new Properties(); logManager = new RentLogManager(Logger.getLogger("Minecraft")); setupDefaults(); update(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "RentPropertiesManager"
"public RentPropertiesManager(String propertiesName){ this.propertiesName = propertiesName; propFile = new File(RentDirectoryManager.getPathInDir(propertiesName)); prop = new Properties(); logManager = new RentLogManager(Logger.getLogger("Minecraft")); <MASK>update();</MASK> setupDefaults(); }"
Inversion-Mutation
megadiff
"private void restoreAudio() { if (systemVolume != -1) { Log.i(LOG_TAG, "Resetting volume to " + systemVolume); audioManager.setStreamVolume(READING_AUDIO_STREAM, systemVolume, 0); } audioManager.setStreamSolo(READING_AUDIO_STREAM, false); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "restoreAudio"
"private void restoreAudio() { if (systemVolume != -1) { Log.i(LOG_TAG, "Resetting volume to " + systemVolume); audioManager.setStreamVolume(READING_AUDIO_STREAM, systemVolume, 0); <MASK>audioManager.setStreamSolo(READING_AUDIO_STREAM, false);</MASK> } }"
Inversion-Mutation
megadiff
"public void run(){ BufferedReader is; try { os = s.getOutputStream(); os.write(new String("Welcome!").getBytes()); is = new BufferedReader(new InputStreamReader(s.getInputStream())); setupDone = true; while (running){ if (!s.isConnected()){//Disconnect running = false; break; } String line = is.readLine(); if (line != null){ chats.add(line); }else{// This means someone disconnected. running = false; break; } System.out.println(line); } } catch (IOException e) { e.printStackTrace(); System.out.println("FAILURE ON READ: THREAD "+id+"!!"); running = false; } System.out.println("Client closed: "+id); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "run"
"public void run(){ BufferedReader is; try { <MASK>os.write(new String("Welcome!").getBytes());</MASK> os = s.getOutputStream(); is = new BufferedReader(new InputStreamReader(s.getInputStream())); setupDone = true; while (running){ if (!s.isConnected()){//Disconnect running = false; break; } String line = is.readLine(); if (line != null){ chats.add(line); }else{// This means someone disconnected. running = false; break; } System.out.println(line); } } catch (IOException e) { e.printStackTrace(); System.out.println("FAILURE ON READ: THREAD "+id+"!!"); running = false; } System.out.println("Client closed: "+id); }"
Inversion-Mutation
megadiff
"@Override public boolean next() { if (firstMatch) { firstMatch = false; ctx.goodPushEnv(); leftResult = left.next(); right.init(); return leftResult && right.next(); } if (right.hasNext()) { // first do the right.next because && would short cut it which leads to an infinite loop // because right will always have a true hasNext() then. boolean rightResult = right.next(); return leftResult && rightResult; } ctx.goodPushEnv(); leftResult = left.next(); right.init(); return leftResult && right.next(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "next"
"@Override public boolean next() { if (firstMatch) { firstMatch = false; ctx.goodPushEnv(); leftResult = left.next(); <MASK>right.init();</MASK> return leftResult && right.next(); } if (right.hasNext()) { // first do the right.next because && would short cut it which leads to an infinite loop // because right will always have a true hasNext() then. boolean rightResult = right.next(); return leftResult && rightResult; } ctx.goodPushEnv(); <MASK>right.init();</MASK> leftResult = left.next(); return leftResult && right.next(); }"
Inversion-Mutation
megadiff
"protected void init() throws IOException { securityMap = new HashMap<String, List<SecurityEntry>>(); Set<String> authNames = attrAdapter.getAuthorityUrls().keySet(); for (String authName : authNames) { List<SecurityEntry> securityEntries = new ArrayList<SecurityEntry>(); InputStream in = getClass().getClassLoader().getResourceAsStream( authName + "-whitelist.txt"); if (in != null) { BufferedReader bin = new BufferedReader(new InputStreamReader( in)); String line = null; while ((line = bin.readLine()) != null) { line = line.trim(); // bypass comment lines or empty lines if (line.length() == 0 || line.startsWith("#")) { continue; } String[] token = line.split(","); SecurityEntry se = new SecurityEntry(); se.setNameValue(token[0].trim()); se.setSurnameValue(token[1].trim()); if (token.length > 2) { String[] idNames = token[2].split("\\|"); String[] idValues = token[3].split("\\|"); for (int i = 0; i < idNames.length; i++) { se.addIdSecurityEntry(idNames[i].trim(), idValues[i].trim()); } } securityEntries.add(se); } securityMap.put(authName, securityEntries); bin.close(); in.close(); } } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "init"
"protected void init() throws IOException { securityMap = new HashMap<String, List<SecurityEntry>>(); <MASK>List<SecurityEntry> securityEntries = new ArrayList<SecurityEntry>();</MASK> Set<String> authNames = attrAdapter.getAuthorityUrls().keySet(); for (String authName : authNames) { InputStream in = getClass().getClassLoader().getResourceAsStream( authName + "-whitelist.txt"); if (in != null) { BufferedReader bin = new BufferedReader(new InputStreamReader( in)); String line = null; while ((line = bin.readLine()) != null) { line = line.trim(); // bypass comment lines or empty lines if (line.length() == 0 || line.startsWith("#")) { continue; } String[] token = line.split(","); SecurityEntry se = new SecurityEntry(); se.setNameValue(token[0].trim()); se.setSurnameValue(token[1].trim()); if (token.length > 2) { String[] idNames = token[2].split("\\|"); String[] idValues = token[3].split("\\|"); for (int i = 0; i < idNames.length; i++) { se.addIdSecurityEntry(idNames[i].trim(), idValues[i].trim()); } } securityEntries.add(se); } securityMap.put(authName, securityEntries); bin.close(); in.close(); } } }"
Inversion-Mutation
megadiff
"protected void readFromXMLImpl(XMLStreamReader in) throws XMLStreamException { final String id = in.getAttributeValue(null, "id"); if (id == null && getId().equals("NO_ID")){ throw new XMLStreamException("invalid <" + getXMLElementTagName() + "> tag : no id attribute found."); } while (in.nextTag() != XMLStreamConstants.END_ELEMENT) { if (in.getLocalName().equals("value")) { // TODO: remove support for old format setValueIds(readFromListElement("value", in, String.class)); in.nextTag(); } else if (VALUE_TAG.equals(in.getLocalName())) { String valueId = in.getAttributeValue(null, ID_ATTRIBUTE_TAG); value.add(selector.getObject(valueId)); in.nextTag(); } } setValue(value); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "readFromXMLImpl"
"protected void readFromXMLImpl(XMLStreamReader in) throws XMLStreamException { final String id = in.getAttributeValue(null, "id"); if (id == null && getId().equals("NO_ID")){ throw new XMLStreamException("invalid <" + getXMLElementTagName() + "> tag : no id attribute found."); } <MASK>in.nextTag();</MASK> while (in.nextTag() != XMLStreamConstants.END_ELEMENT) { if (in.getLocalName().equals("value")) { // TODO: remove support for old format setValueIds(readFromListElement("value", in, String.class)); } else if (VALUE_TAG.equals(in.getLocalName())) { String valueId = in.getAttributeValue(null, ID_ATTRIBUTE_TAG); value.add(selector.getObject(valueId)); <MASK>in.nextTag();</MASK> } } setValue(value); }"
Inversion-Mutation
megadiff
"public void tick() { if(_mustUpdate) { _mustUpdate = false; updatePowerLevels(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "tick"
"public void tick() { if(_mustUpdate) { <MASK>updatePowerLevels();</MASK> _mustUpdate = false; } }"
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.Number()); condPar.add(new illarion.easynpc.parser.talk.conditions.Talkstate()); condPar.add(new illarion.easynpc.parser.talk.conditions.Sex()); condPar.add(new illarion.easynpc.parser.talk.conditions.Admin()); condPar.add(new illarion.easynpc.parser.talk.conditions.Trigger()); 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.Trade()); consPar.add(new illarion.easynpc.parser.talk.consequences.Treasure()); consPar.add(new illarion.easynpc.parser.talk.consequences.Introduce()); consPar.add(new illarion.easynpc.parser.talk.consequences.Warp()); consPar.add(new illarion.easynpc.parser.talk.consequences.Gemcraft()); consPar.add(new illarion.easynpc.parser.talk.consequences.Answer()); 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"); } @Override public String getExample() { return null; } @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"); } @Override public String getExample() { return null; } @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.Number()); condPar.add(new illarion.easynpc.parser.talk.conditions.Talkstate()); condPar.add(new illarion.easynpc.parser.talk.conditions.Sex()); condPar.add(new illarion.easynpc.parser.talk.conditions.Admin()); condPar.add(new illarion.easynpc.parser.talk.conditions.Trigger()); consPar.add(new illarion.easynpc.parser.talk.consequences.Inform()); <MASK>consPar.add(new illarion.easynpc.parser.talk.consequences.Answer());</MASK> 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.Trade()); consPar.add(new illarion.easynpc.parser.talk.consequences.Treasure()); consPar.add(new illarion.easynpc.parser.talk.consequences.Introduce()); consPar.add(new illarion.easynpc.parser.talk.consequences.Warp()); consPar.add(new illarion.easynpc.parser.talk.consequences.Gemcraft()); 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"); } @Override public String getExample() { return null; } @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"); } @Override public String getExample() { return null; } @Override public String getSyntax() { return null; } @Override @SuppressWarnings("nls") public String getTitle() { return Lang .getMsg(TalkingLine.class, "Consequence.Docu.title"); } }; }"
Inversion-Mutation
megadiff
"public void decode(String batchFile) { BatchItem batchItem; int count = 0; try { recognizer.allocate(); setBatchFile(batchFile); batchManager.start(); logger.info("BatchDecoder: decoding files in " + batchManager.getFilename()); while (count < totalCount && (batchItem = batchManager.getNextItem()) != null) { setInputStream(batchItem.getFilename()); Result result = recognizer.recognize(batchItem.getTranscript()); logger.info("File : " + batchItem.getFilename()); logger.info("Result: " + result); count++; } batchManager.stop(); recognizer.deallocate(); } catch (IOException io) { logger.severe("I/O error during decoding: " + io.getMessage()); } logger.info("BatchDecoder: " + count + " files decoded"); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "decode"
"public void decode(String batchFile) { BatchItem batchItem; int count = 0; try { recognizer.allocate(); setBatchFile(batchFile); batchManager.start(); logger.info("BatchDecoder: decoding files in " + batchManager.getFilename()); while (count < totalCount && (batchItem = batchManager.getNextItem()) != null) { setInputStream(batchItem.getFilename()); Result result = recognizer.recognize(batchItem.getTranscript()); logger.info("File : " + batchItem.getFilename()); logger.info("Result: " + result); count++; } batchManager.stop(); } catch (IOException io) { logger.severe("I/O error during decoding: " + io.getMessage()); } <MASK>recognizer.deallocate();</MASK> logger.info("BatchDecoder: " + count + " files decoded"); }"
Inversion-Mutation
megadiff
"public void testAll() { runTests(new TestDescriptor[] { new TestDescriptor(TEST1, "", 1, new ConstructorCallsOverridableMethodRule()), new TestDescriptor(TEST2, "", 1, new ConstructorCallsOverridableMethodRule()), new TestDescriptor(TEST3, "", 1, new ConstructorCallsOverridableMethodRule()), new TestDescriptor(TEST4, "", 0, new ConstructorCallsOverridableMethodRule()), new TestDescriptor(TEST5, "", 1, new ConstructorCallsOverridableMethodRule()), new TestDescriptor(TEST6, "calling method on literal bug", 0, new ConstructorCallsOverridableMethodRule()), // FIXME //new TestDescriptor(TEST7, "method in anonymous inner class is ok", 0, new ConstructorCallsOverridableMethodRule()), }); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "testAll"
"public void testAll() { runTests(new TestDescriptor[] { new TestDescriptor(TEST1, "", 1, new ConstructorCallsOverridableMethodRule()), new TestDescriptor(TEST2, "", 1, new ConstructorCallsOverridableMethodRule()), new TestDescriptor(TEST3, "", 1, new ConstructorCallsOverridableMethodRule()), new TestDescriptor(TEST4, "", 0, new ConstructorCallsOverridableMethodRule()), new TestDescriptor(TEST5, "", 1, new ConstructorCallsOverridableMethodRule()), <MASK>// FIXME</MASK> new TestDescriptor(TEST6, "calling method on literal bug", 0, new ConstructorCallsOverridableMethodRule()), //new TestDescriptor(TEST7, "method in anonymous inner class is ok", 0, new ConstructorCallsOverridableMethodRule()), }); }"
Inversion-Mutation
megadiff
"public final boolean cancel( boolean mayInterruptIfRunning ) { boolean did = false; synchronized(this) { // Install the answer under lock if( !isCancelled() ) { did = true; // Did cancel (was not cancelled already) _target.taskRemove(_tasknum); _target = null; // Flag as canceled UDPTimeOutThread.PENDING.remove(this); } notifyAll(); // notify in any case } return did; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "cancel"
"public final boolean cancel( boolean mayInterruptIfRunning ) { boolean did = false; synchronized(this) { // Install the answer under lock if( !isCancelled() ) { did = true; // Did cancel (was not cancelled already) _target = null; // Flag as canceled UDPTimeOutThread.PENDING.remove(this); <MASK>_target.taskRemove(_tasknum);</MASK> } notifyAll(); // notify in any case } return did; }"
Inversion-Mutation
megadiff
"public boolean generate(World world, int x, int y, int z) { int orientation = 0; if (this.getSchematicPath()!=null) { //Get the correct filters GatewayBlockFilter filter = new GatewayBlockFilter(); DungeonSchematic schematic = this.getSchematicToBuild(world, x, y, z); //apply filters schematic.applyFilter(filter); schematic.applyImportFilters(properties); Point3D doorLocation = filter.getEntranceDoorLocation(); orientation = filter.getEntranceOrientation(); // I suspect that the location used below is wrong. Gateways should be placed vertically based on // the Y position of the surface where they belong. I'm pretty sure including doorLocation.getY() // messes up the calculation. ~SenseiKiwi //schematic.copyToWorld(world, x - doorLocation.getX(), y, z - doorLocation.getZ()); schematic.copyToWorld(world, x - doorLocation.getX(), y + 1 - doorLocation.getY(), z - doorLocation.getZ()); } this.generateRandomBits(world, x, y, z); DimLink link = PocketManager.getDimensionData(world).createLink(x, y + 1, z, LinkTypes.DUNGEON, orientation); NewDimData data = PocketManager.registerPocket(PocketManager.getDimensionData(world), true); PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, this.getStartingDungeon(data,world.rand)); return true; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "generate"
"public boolean generate(World world, int x, int y, int z) { int orientation = 0; if (this.getSchematicPath()!=null) { //Get the correct filters GatewayBlockFilter filter = new GatewayBlockFilter(); DungeonSchematic schematic = this.getSchematicToBuild(world, x, y, z); //apply filters <MASK>schematic.applyImportFilters(properties);</MASK> schematic.applyFilter(filter); Point3D doorLocation = filter.getEntranceDoorLocation(); orientation = filter.getEntranceOrientation(); // I suspect that the location used below is wrong. Gateways should be placed vertically based on // the Y position of the surface where they belong. I'm pretty sure including doorLocation.getY() // messes up the calculation. ~SenseiKiwi //schematic.copyToWorld(world, x - doorLocation.getX(), y, z - doorLocation.getZ()); schematic.copyToWorld(world, x - doorLocation.getX(), y + 1 - doorLocation.getY(), z - doorLocation.getZ()); } this.generateRandomBits(world, x, y, z); DimLink link = PocketManager.getDimensionData(world).createLink(x, y + 1, z, LinkTypes.DUNGEON, orientation); NewDimData data = PocketManager.registerPocket(PocketManager.getDimensionData(world), true); PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, this.getStartingDungeon(data,world.rand)); return true; }"
Inversion-Mutation
megadiff
"public void destroy() { mCache.destroy(); // close all listeners final Iterator it = mListeners.iterator(); while (it.hasNext()) { final AuditListener listener = (AuditListener) it.next(); final OutputStream os = listener.getOutputStream(); // close only those that can be closed... if ((os != System.out) && (os != System.err) && (os != null)) { try { os.flush(); os.close(); } catch (IOException ignored) { } } it.remove(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "destroy"
"public void destroy() { mCache.destroy(); // close all listeners final Iterator it = mListeners.iterator(); while (it.hasNext()) { final AuditListener listener = (AuditListener) it.next(); final OutputStream os = listener.getOutputStream(); // close only those that can be closed... if ((os != System.out) && (os != System.err) && (os != null)) { try { os.flush(); os.close(); } catch (IOException ignored) { } } } <MASK>it.remove();</MASK> }"
Inversion-Mutation
megadiff
"private void followTradeRoute(Unit unit) { Stop stop = unit.getCurrentStop(); if (stop == null) { return; } Location location = unit.getLocation(); if (location instanceof Tile) { location = ((Tile) location).getColony(); } GoodsContainer warehouse = location.getGoodsContainer(); if (warehouse == null) { throw new IllegalStateException("Not warehouse in a stop's location"); } // unload cargo that should not be on board and complete loaded goods with less than 100 units ArrayList<Integer> goodsTypesToLoad = stop.getCargo(); Iterator<Goods> goodsIterator = unit.getGoodsIterator(); test: while (goodsIterator.hasNext()) { Goods goods = goodsIterator.next(); for (int index = 0; index < goodsTypesToLoad.size(); index++) { int goodsType = goodsTypesToLoad.get(index).intValue(); if (goods.getType() == goodsType) { if (goods.getAmount() < 100) { // comlete goods until 100 units int amountPresent = warehouse.getGoodsCount(goodsType); if (amountPresent > 0) { logger.finest("Automatically loading goods " + goods.getName()); int amountToLoad = Math.min(100 - goods.getAmount(), amountPresent); loadCargo(new Goods(freeColClient.getGame(), location, goods.getType(), amountToLoad), unit); } } // remove item: other items of the same type // may or may not be present goodsTypesToLoad.remove(index); continue test; } } // this type of goods was not in the cargo list logger.finest("Automatically unloading " + goods.getName()); unloadCargo(goods); } // load cargo that should be on board for (Integer goodsType : goodsTypesToLoad) { int amountPresent = warehouse.getGoodsCount(goodsType.intValue()); if (amountPresent > 0) { if (unit.getSpaceLeft() > 0) { logger.finest("Automatically loading goods " + Goods.getName(goodsType.intValue())); loadCargo(new Goods(freeColClient.getGame(), location, goodsType.intValue(), Math.min( amountPresent, 100)), unit); } } } // TODO: do we want to load/unload units as well? // if so, when? // Set destination to next stop's location stop = unit.nextStop(); if (stop == null) { return; } else { setDestination(unit, stop.getLocation()); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "followTradeRoute"
"private void followTradeRoute(Unit unit) { Stop stop = unit.getCurrentStop(); if (stop == null) { return; } <MASK>// load cargo that should be on board</MASK> Location location = unit.getLocation(); if (location instanceof Tile) { location = ((Tile) location).getColony(); } GoodsContainer warehouse = location.getGoodsContainer(); if (warehouse == null) { throw new IllegalStateException("Not warehouse in a stop's location"); } // unload cargo that should not be on board and complete loaded goods with less than 100 units ArrayList<Integer> goodsTypesToLoad = stop.getCargo(); Iterator<Goods> goodsIterator = unit.getGoodsIterator(); test: while (goodsIterator.hasNext()) { Goods goods = goodsIterator.next(); for (int index = 0; index < goodsTypesToLoad.size(); index++) { int goodsType = goodsTypesToLoad.get(index).intValue(); if (goods.getType() == goodsType) { if (goods.getAmount() < 100) { // comlete goods until 100 units int amountPresent = warehouse.getGoodsCount(goodsType); if (amountPresent > 0) { logger.finest("Automatically loading goods " + goods.getName()); int amountToLoad = Math.min(100 - goods.getAmount(), amountPresent); loadCargo(new Goods(freeColClient.getGame(), location, goods.getType(), amountToLoad), unit); } } // remove item: other items of the same type // may or may not be present goodsTypesToLoad.remove(index); continue test; } } // this type of goods was not in the cargo list logger.finest("Automatically unloading " + goods.getName()); unloadCargo(goods); } for (Integer goodsType : goodsTypesToLoad) { int amountPresent = warehouse.getGoodsCount(goodsType.intValue()); if (amountPresent > 0) { if (unit.getSpaceLeft() > 0) { logger.finest("Automatically loading goods " + Goods.getName(goodsType.intValue())); loadCargo(new Goods(freeColClient.getGame(), location, goodsType.intValue(), Math.min( amountPresent, 100)), unit); } } } // TODO: do we want to load/unload units as well? // if so, when? // Set destination to next stop's location stop = unit.nextStop(); if (stop == null) { return; } else { setDestination(unit, stop.getLocation()); } }"
Inversion-Mutation
megadiff
"public static void writeExcelSheet(PafExcelInput input, List<PafExcelRow> paceRowList) throws PafException { if ( input == null ) { throw new IllegalArgumentException("Pace Excel Input cannot be null"); } else if ( input.getFullWorkbookName() == null && input.getWorkbook() == null ) { throw new IllegalArgumentException("A Full workbook name and a workbook haven't not been provided. One is required."); } Workbook wb = null; if ( input.getWorkbook() != null ) { wb = input.getWorkbook(); } else { wb = readWorkbook(input.getFullWorkbookName()); } if ( wb == null ) { throw new PafException("Couldn't get a reference to the workbook " + input.getFullWorkbookName() , PafErrSeverity.Error); } Sheet sheet = wb.getSheet(input.getSheetId()); if ( sheet == null ) { sheet = wb.createSheet(input.getSheetId()); } else { sheet = clearSheetValues(sheet); } if ( paceRowList != null ) { FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); int rowNdx = 0; int maxNumberOfColumns = 0; CellStyle boldCellStyle = null; boolean isFirstHeader = true; for (PafExcelRow paceRow : paceRowList ) { if ( paceRow != null ) { //if row is header and need to exclude, continue to next row if ( paceRow.isHeader() && input.isExcludeHeaderRows()) { continue; } if ( paceRow.numberOfColumns() > maxNumberOfColumns) { maxNumberOfColumns = paceRow.numberOfColumns(); } for (int i = 0; i < paceRow.numberOfCompressedRows(); i++ ) { Row row = sheet.createRow(rowNdx++); if ( isFirstHeader && paceRow.isHeader() ) { //freeze 1st header row sheet.createFreezePane(0, 1); isFirstHeader = false; } for ( Integer index : paceRow.getRowItemOrderedIndexes() ) { List<PafExcelValueObject> rowItemList = paceRow.getPafExcelValueObjectListMap().get(index); //Cell cell = row.createCell(rowItemNdx++);; Cell cell = row.createCell(index); if ( i < rowItemList.size()) { PafExcelValueObject rowItem = rowItemList.get(i); if ( rowItem == null ) { cell.setCellType(Cell.CELL_TYPE_BLANK); } else { //if header, bold item if ( paceRow.isHeader() || rowItem.isBoldItem() ) { if ( boldCellStyle == null ) { boldCellStyle = getBoldCellStyle(wb); //turn word wrap on boldCellStyle.setWrapText(true); } cell.setCellStyle(boldCellStyle); } switch ( rowItem.getType() ) { case Blank: cell.setCellType(Cell.CELL_TYPE_BLANK); break; case Boolean: if ( rowItem.getBoolean() != null ) { Boolean boolValue = rowItem.getBoolean(); if ( input.isExcludeDefaultValuesOnWrite()) { //if default, clear value if ( boolValue.equals(Boolean.FALSE)) { boolValue = null; } } //true or false if ( boolValue != null ) { cell.setCellType(Cell.CELL_TYPE_BOOLEAN); cell.setCellValue(boolValue); } } break; case Double: if ( rowItem.getDouble() != null ) { Double doubleVal = rowItem.getDouble(); if ( doubleVal != null && input.isExcludeDefaultValuesOnWrite()) { if ( doubleVal == 0 ) { doubleVal = null; } } if ( doubleVal != null ) { cell.setCellType(Cell.CELL_TYPE_NUMERIC); cell.setCellValue(doubleVal); } } break; case Integer: if ( rowItem.getInteger() != null ) { Integer intValue = rowItem.getInteger(); if ( intValue != null && input.isExcludeDefaultValuesOnWrite()) { if ( intValue == 0 ) { intValue = null; } } if ( intValue != null ) { cell.setCellType(Cell.CELL_TYPE_NUMERIC); cell.setCellValue(intValue); } } break; case Formula: cell.setCellType(Cell.CELL_TYPE_FORMULA); String formula = rowItem.getFormula(); String formulas[] = formula.split(" & \" \\| \" & "); //there is only 1 formula if( formulas.length >= 1 ) { formula = formulas[0]; String tokens[] = formula.split("!"); if( tokens.length > 1 ) { String sheetName = tokens[0]; //if sheet name contains special chars, replace it by surrounding it with single quote if( ! sheetName.matches("[a-zA-Z0123456789]*") ) { formula = "'" + sheetName + "'!" + tokens[1]; } } } // more than 1 formula concatenated if ( formulas.length > 1 ) { String tmp = ""; for( int j=1;j<formulas.length;j++ ) { tmp = formulas[j]; String tokens[] = formulas[j].split("!"); if( tokens.length > 1 ) { String sheetName = tokens[0]; //if sheet name contains special chars, replace it by surrounding it with single quote if( ! sheetName.matches("[a-zA-Z0123456789]*") ) { tmp = "'" + sheetName + "'!" + tokens[1]; } } formula += " & \" | \" & " + tmp; //append to the previous one } } cell.setCellFormula(formula); evaluator.evaluateFormulaCell(cell); break; case String: cell.setCellType(Cell.CELL_TYPE_STRING); cell.setCellValue(rowItem.getString()); break; } } } else { cell.setCellType(Cell.CELL_TYPE_BLANK); } } } } } //add end of sheet ident if ( input.getEndOfSheetIdnt() != null ) { int lastSheetRowNumber = sheet.getLastRowNum() + 1; Row lastRow = sheet.createRow(lastSheetRowNumber); Cell eosCell = lastRow.createCell(0, Cell.CELL_TYPE_STRING); eosCell.setCellValue(input.getEndOfSheetIdnt()); //set bold style eosCell.setCellStyle(getBoldCellStyle(wb)); } //auto size columns? if ( input.isAutoSizeColumns() ) { for (int i = 0; i <= maxNumberOfColumns; i++) { sheet.autoSizeColumn((short) i); } } } logger.info("\tSaving sheet: " + input.getSheetId() ); wb.setActiveSheet(wb.getSheetIndex(sheet.getSheetName())); //if write to filesystem, close workbook if ( input.isAutoWriteToFileSystem() ) { writeWorkbook(wb, input.getFullWorkbookName()); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "writeExcelSheet"
"public static void writeExcelSheet(PafExcelInput input, List<PafExcelRow> paceRowList) throws PafException { if ( input == null ) { throw new IllegalArgumentException("Pace Excel Input cannot be null"); } else if ( input.getFullWorkbookName() == null && input.getWorkbook() == null ) { throw new IllegalArgumentException("A Full workbook name and a workbook haven't not been provided. One is required."); } Workbook wb = null; if ( input.getWorkbook() != null ) { wb = input.getWorkbook(); } else { wb = readWorkbook(input.getFullWorkbookName()); } if ( wb == null ) { throw new PafException("Couldn't get a reference to the workbook " + input.getFullWorkbookName() , PafErrSeverity.Error); } Sheet sheet = wb.getSheet(input.getSheetId()); if ( sheet == null ) { sheet = wb.createSheet(input.getSheetId()); } else { sheet = clearSheetValues(sheet); } if ( paceRowList != null ) { FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); int rowNdx = 0; int maxNumberOfColumns = 0; CellStyle boldCellStyle = null; boolean isFirstHeader = true; for (PafExcelRow paceRow : paceRowList ) { if ( paceRow != null ) { //if row is header and need to exclude, continue to next row if ( paceRow.isHeader() && input.isExcludeHeaderRows()) { continue; } if ( paceRow.numberOfColumns() > maxNumberOfColumns) { maxNumberOfColumns = paceRow.numberOfColumns(); } for (int i = 0; i < paceRow.numberOfCompressedRows(); i++ ) { Row row = sheet.createRow(rowNdx++); if ( isFirstHeader && paceRow.isHeader() ) { //freeze 1st header row sheet.createFreezePane(0, 1); isFirstHeader = false; } for ( Integer index : paceRow.getRowItemOrderedIndexes() ) { List<PafExcelValueObject> rowItemList = paceRow.getPafExcelValueObjectListMap().get(index); //Cell cell = row.createCell(rowItemNdx++);; Cell cell = row.createCell(index); if ( i < rowItemList.size()) { PafExcelValueObject rowItem = rowItemList.get(i); if ( rowItem == null ) { cell.setCellType(Cell.CELL_TYPE_BLANK); } else { //if header, bold item if ( paceRow.isHeader() || rowItem.isBoldItem() ) { if ( boldCellStyle == null ) { boldCellStyle = getBoldCellStyle(wb); //turn word wrap on boldCellStyle.setWrapText(true); } cell.setCellStyle(boldCellStyle); } switch ( rowItem.getType() ) { case Blank: cell.setCellType(Cell.CELL_TYPE_BLANK); break; case Boolean: if ( rowItem.getBoolean() != null ) { Boolean boolValue = rowItem.getBoolean(); if ( input.isExcludeDefaultValuesOnWrite()) { //if default, clear value if ( boolValue.equals(Boolean.FALSE)) { boolValue = null; } } //true or false if ( boolValue != null ) { cell.setCellType(Cell.CELL_TYPE_BOOLEAN); cell.setCellValue(boolValue); } } break; case Double: if ( rowItem.getDouble() != null ) { Double doubleVal = rowItem.getDouble(); if ( doubleVal != null && input.isExcludeDefaultValuesOnWrite()) { if ( doubleVal == 0 ) { doubleVal = null; } } if ( doubleVal != null ) { cell.setCellType(Cell.CELL_TYPE_NUMERIC); cell.setCellValue(doubleVal); } } break; case Integer: if ( rowItem.getInteger() != null ) { Integer intValue = rowItem.getInteger(); if ( intValue != null && input.isExcludeDefaultValuesOnWrite()) { if ( intValue == 0 ) { intValue = null; } } if ( intValue != null ) { cell.setCellType(Cell.CELL_TYPE_NUMERIC); cell.setCellValue(intValue); } } break; case Formula: cell.setCellType(Cell.CELL_TYPE_FORMULA); String formula = rowItem.getFormula(); String formulas[] = formula.split(" & \" \\| \" & "); //there is only 1 formula if( formulas.length >= 1 ) { formula = formulas[0]; String tokens[] = formula.split("!"); if( tokens.length > 1 ) { String sheetName = tokens[0]; //if sheet name contains special chars, replace it by surrounding it with single quote if( ! sheetName.matches("[a-zA-Z0123456789]*") ) { formula = "'" + sheetName + "'!" + tokens[1]; } } } // more than 1 formula concatenated if ( formulas.length > 1 ) { String tmp = ""; for( int j=1;j<formulas.length;j++ ) { tmp = formulas[j]; String tokens[] = formulas[j].split("!"); if( tokens.length > 1 ) { String sheetName = tokens[0]; //if sheet name contains special chars, replace it by surrounding it with single quote if( ! sheetName.matches("[a-zA-Z0123456789]*") ) { tmp = "'" + sheetName + "'!" + tokens[1]; } <MASK>formula += " & \" | \" & " + tmp; //append to the previous one</MASK> } } } cell.setCellFormula(formula); evaluator.evaluateFormulaCell(cell); break; case String: cell.setCellType(Cell.CELL_TYPE_STRING); cell.setCellValue(rowItem.getString()); break; } } } else { cell.setCellType(Cell.CELL_TYPE_BLANK); } } } } } //add end of sheet ident if ( input.getEndOfSheetIdnt() != null ) { int lastSheetRowNumber = sheet.getLastRowNum() + 1; Row lastRow = sheet.createRow(lastSheetRowNumber); Cell eosCell = lastRow.createCell(0, Cell.CELL_TYPE_STRING); eosCell.setCellValue(input.getEndOfSheetIdnt()); //set bold style eosCell.setCellStyle(getBoldCellStyle(wb)); } //auto size columns? if ( input.isAutoSizeColumns() ) { for (int i = 0; i <= maxNumberOfColumns; i++) { sheet.autoSizeColumn((short) i); } } } logger.info("\tSaving sheet: " + input.getSheetId() ); wb.setActiveSheet(wb.getSheetIndex(sheet.getSheetName())); //if write to filesystem, close workbook if ( input.isAutoWriteToFileSystem() ) { writeWorkbook(wb, input.getFullWorkbookName()); } }"
Inversion-Mutation
megadiff
"public Application(){ this.gameOver = false; this.gh = new GameHelper(); this.dotComField = new DotComField[7][7]; this.oppenedFields = new boolean[7][7]; for(int i = 0; i < 7; i++){ for(int j = 0; j < 7; j++){ this.dotComField[i][j]=null; this.oppenedFields[i][j]=false; } } //TODO: make this dinamic DotCom d1 = new DotCom("apple.com"); DotCom d2 = new DotCom("imasters.com.br"); DotCom d3 = new DotCom("baixeturbo.org"); this.dotComField[0][2] = new DotComField(d1); this.dotComField[0][3] = new DotComField(d1); this.dotComField[0][4] = new DotComField(d1); this.dotComField[4][4] = new DotComField(d2); this.dotComField[4][5] = new DotComField(d2); this.dotComField[4][6] = new DotComField(d2); this.dotComField[1][3] = new DotComField(d3); this.dotComField[2][3] = new DotComField(d3); this.dotComField[3][3] = new DotComField(d3); String InputLine; while(!gameOver){ int x = -1; int y = -1; while(x < 0 || y < 0 || x > 7 || y > 7){ x = this.gh.getUserInput("Insire um palpite para o eixo X")-1; y = this.gh.getUserInput("Insire um palpite para o eixo Y")-1; } if(this.dotComField[x][y]!=null){ if(this.dotComField[x][y].getStatus()){ System.out.println("Este campo ja estava aberto!"); } else { this.dotComField[x][y].open(); System.out.println("Voce acertou "+this.dotComField[x][y].getDotCom().getName()); } } else { if(this.oppenedFields[x][y]){ System.out.println("Este campo ja estava aberto!"); } else{ this.oppenedFields[x][y] = true; } } this.printField(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "Application"
"public Application(){ this.gameOver = false; this.gh = new GameHelper(); this.dotComField = new DotComField[7][7]; this.oppenedFields = new boolean[7][7]; for(int i = 0; i < 7; i++){ for(int j = 0; j < 7; j++){ this.dotComField[i][j]=null; this.oppenedFields[i][j]=false; } } //TODO: make this dinamic DotCom d1 = new DotCom("apple.com"); DotCom d2 = new DotCom("imasters.com.br"); DotCom d3 = new DotCom("baixeturbo.org"); this.dotComField[0][2] = new DotComField(d1); this.dotComField[0][3] = new DotComField(d1); this.dotComField[0][4] = new DotComField(d1); this.dotComField[4][4] = new DotComField(d2); this.dotComField[4][5] = new DotComField(d2); this.dotComField[4][6] = new DotComField(d2); this.dotComField[1][3] = new DotComField(d3); this.dotComField[2][3] = new DotComField(d3); this.dotComField[3][3] = new DotComField(d3); String InputLine; while(!gameOver){ int x = -1; int y = -1; while(x < 0 || y < 0 || x > 7 || y > 7){ <MASK>y = this.gh.getUserInput("Insire um palpite para o eixo Y")-1;</MASK> x = this.gh.getUserInput("Insire um palpite para o eixo X")-1; } if(this.dotComField[x][y]!=null){ if(this.dotComField[x][y].getStatus()){ System.out.println("Este campo ja estava aberto!"); } else { this.dotComField[x][y].open(); System.out.println("Voce acertou "+this.dotComField[x][y].getDotCom().getName()); } } else { if(this.oppenedFields[x][y]){ System.out.println("Este campo ja estava aberto!"); } else{ this.oppenedFields[x][y] = true; } } this.printField(); } }"
Inversion-Mutation
megadiff
"@Override public void run() { tx = indexService.beginTx(); lastCommit = System.currentTimeMillis(); try { while ( run || !queue.isEmpty() ) { QueueElement qe = queue.poll(); try { if ( qe != null ) { performIndexOperation( qe ); } else { synchronized ( this ) { this.wait( 100 ); } currentTimestamp = System.currentTimeMillis(); if ( currentTimestamp - lastCommit > MAX_WAIT_TIME ) { tx.success(); tx.finish(); tx = indexService.beginTx(); } } } catch ( InterruptedException e ) { Thread.interrupted(); } } tx.success(); } finally { done = true; tx.finish(); } synchronized ( indexService ) { indexService.notify(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "run"
"@Override public void run() { tx = indexService.beginTx(); lastCommit = System.currentTimeMillis(); try { while ( run || !queue.isEmpty() ) { QueueElement qe = queue.poll(); try { if ( qe != null ) { performIndexOperation( qe ); } else { synchronized ( this ) { this.wait( 100 ); } currentTimestamp = System.currentTimeMillis(); if ( currentTimestamp - lastCommit > MAX_WAIT_TIME ) { tx.success(); tx.finish(); tx = indexService.beginTx(); } } } catch ( InterruptedException e ) { Thread.interrupted(); } } tx.success(); } finally { tx.finish(); } synchronized ( indexService ) { <MASK>done = true;</MASK> indexService.notify(); } }"
Inversion-Mutation
megadiff
"private void write(Graph linkset) throws IOException { for (Link link : linkset) { if (link.hasReferenceSource()) { if (link.hasReferenceTarget()) { link(link.getSourceAsReference(), link.getTypeRef(), link .getTargetAsReference()); } else if (link.hasLiteralTarget()) { link(link.getSourceAsReference(), link.getTypeRef(), link .getTargetAsLiteral()); } else { org.restlet.Context .getCurrentLogger() .warning( "Cannot write the representation of a statement due to the fact that the object is neither a Reference nor a literal."); } } else if (link.hasGraphSource()) { org.restlet.Context .getCurrentLogger() .warning( "Cannot write the representation of a statement due to the fact that the subject is not a Reference."); } this.bw.write(".\n"); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "write"
"private void write(Graph linkset) throws IOException { for (Link link : linkset) { if (link.hasReferenceSource()) { if (link.hasReferenceTarget()) { link(link.getSourceAsReference(), link.getTypeRef(), link .getTargetAsReference()); } else if (link.hasLiteralTarget()) { link(link.getSourceAsReference(), link.getTypeRef(), link .getTargetAsLiteral()); } else { org.restlet.Context .getCurrentLogger() .warning( "Cannot write the representation of a statement due to the fact that the object is neither a Reference nor a literal."); } } else if (link.hasGraphSource()) { org.restlet.Context .getCurrentLogger() .warning( "Cannot write the representation of a statement due to the fact that the subject is not a Reference."); } } <MASK>this.bw.write(".\n");</MASK> }"
Inversion-Mutation
megadiff
"@Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); setProgressBarIndeterminate(true); setContentView(R.layout.activity_song_list); setTitle(R.string.sn_songs_activity_title); searchWidget = V.get(this, R.id.searchWidget); lsSong = V.get(this, R.id.lsSong); bChangeBook = V.get(this, R.id.bChangeBook); cDeepSearch = V.get(this, R.id.cDeepSearch); panelFilter = V.get(this, R.id.panelFilter); searchWidget.setSubmitButtonEnabled(false); searchWidget.setOnQueryTextListener(searchWidget_queryText); lsSong.setAdapter(adapter = new SongAdapter()); lsSong.setOnItemClickListener(lsSong_itemClick); qaChangeBook = SongBookUtil.getSongBookQuickAction(this, true); qaChangeBook.setOnActionItemClickListener(SongBookUtil.getOnActionItemConverter(songBookSelected)); bChangeBook.setOnClickListener(bChangeBook_click); cDeepSearch.setOnCheckedChangeListener(cDeepSearch_checkedChange); // if we're using SearchBar instead of SearchView, move filter panel to // the bottom view of the SearchBar for better appearance if (searchWidget.getSearchBarIfUsed() != null) { ((ViewGroup) panelFilter.getParent()).removeView(panelFilter); searchWidget.getSearchBarIfUsed().setBottomView(panelFilter); // the background of the search bar is bright, so let's make all text black cDeepSearch.setTextColor(0xff000000); } loader = new SongLoader(); SearchState searchState = getIntent().getParcelableExtra(EXTRA_searchState); if (searchState != null) { stillUsingInitialSearchState = true; { // prevent triggering searchWidget.setText(searchState.filter_string); adapter.setData(searchState.result); cDeepSearch.setChecked(searchState.deepSearch); lsSong.setSelection(searchState.selectedPosition); loader.setSelectedBookName(searchState.bookName); if (searchState.bookName == null) { bChangeBook.setText(R.string.sn_bookselector_all); } else { bChangeBook.setText(searchState.bookName); } } stillUsingInitialSearchState = false; setProgressBarIndeterminateVisibility(false); // somehow this is needed. } else { startSearch(); } getSupportLoaderManager().initLoader(0, null, new LoaderManager.LoaderCallbacks<List<SongInfo>>() { @Override public Loader<List<SongInfo>> onCreateLoader(int id, Bundle args) { return loader; } @Override public void onLoadFinished(Loader<List<SongInfo>> loader, List<SongInfo> data) { adapter.setData(data); setProgressBarIndeterminateVisibility(false); } @Override public void onLoaderReset(Loader<List<SongInfo>> loader) { adapter.setData(null); setProgressBarIndeterminateVisibility(false); } }); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "onCreate"
"@Override protected void onCreate(Bundle savedInstanceState) { <MASK>super.onCreate(savedInstanceState);</MASK> requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setProgressBarIndeterminate(true); setContentView(R.layout.activity_song_list); setTitle(R.string.sn_songs_activity_title); searchWidget = V.get(this, R.id.searchWidget); lsSong = V.get(this, R.id.lsSong); bChangeBook = V.get(this, R.id.bChangeBook); cDeepSearch = V.get(this, R.id.cDeepSearch); panelFilter = V.get(this, R.id.panelFilter); searchWidget.setSubmitButtonEnabled(false); searchWidget.setOnQueryTextListener(searchWidget_queryText); lsSong.setAdapter(adapter = new SongAdapter()); lsSong.setOnItemClickListener(lsSong_itemClick); qaChangeBook = SongBookUtil.getSongBookQuickAction(this, true); qaChangeBook.setOnActionItemClickListener(SongBookUtil.getOnActionItemConverter(songBookSelected)); bChangeBook.setOnClickListener(bChangeBook_click); cDeepSearch.setOnCheckedChangeListener(cDeepSearch_checkedChange); // if we're using SearchBar instead of SearchView, move filter panel to // the bottom view of the SearchBar for better appearance if (searchWidget.getSearchBarIfUsed() != null) { ((ViewGroup) panelFilter.getParent()).removeView(panelFilter); searchWidget.getSearchBarIfUsed().setBottomView(panelFilter); // the background of the search bar is bright, so let's make all text black cDeepSearch.setTextColor(0xff000000); } loader = new SongLoader(); SearchState searchState = getIntent().getParcelableExtra(EXTRA_searchState); if (searchState != null) { stillUsingInitialSearchState = true; { // prevent triggering searchWidget.setText(searchState.filter_string); adapter.setData(searchState.result); cDeepSearch.setChecked(searchState.deepSearch); lsSong.setSelection(searchState.selectedPosition); loader.setSelectedBookName(searchState.bookName); if (searchState.bookName == null) { bChangeBook.setText(R.string.sn_bookselector_all); } else { bChangeBook.setText(searchState.bookName); } } stillUsingInitialSearchState = false; setProgressBarIndeterminateVisibility(false); // somehow this is needed. } else { startSearch(); } getSupportLoaderManager().initLoader(0, null, new LoaderManager.LoaderCallbacks<List<SongInfo>>() { @Override public Loader<List<SongInfo>> onCreateLoader(int id, Bundle args) { return loader; } @Override public void onLoadFinished(Loader<List<SongInfo>> loader, List<SongInfo> data) { adapter.setData(data); setProgressBarIndeterminateVisibility(false); } @Override public void onLoaderReset(Loader<List<SongInfo>> loader) { adapter.setData(null); setProgressBarIndeterminateVisibility(false); } }); }"
Inversion-Mutation
megadiff
"Wad(WadParse w, MainFrame m, String filename) { wp = w; wr = w.wr; mf = m; mf.msg("writing wad to "+filename); try { f = new RandomAccessFile(filename,"rw"); f.writeBytes("PWAD"); writeInt(wr.hexen ? 7 : 6); // numentries writeInt(12); // dir offset int tsize = writethings(); int vsize = writevertices(); int lsize = writelines(); int dsize = writesides(); int ssize = writesectors(); int bsize = writebehaviour(); long dpos = f.getFilePointer(); writedir("MAP01",0); writedir("THINGS",tsize); writedir("LINEDEFS",lsize); writedir("SIDEDEFS",dsize); writedir("VERTEXES",vsize); writedir("SECTORS",ssize); if(wr.hexen) writedir("BEHAVIOR", bsize); f.seek(8); writeInt((int)dpos); f.close(); mf.msg("wrote wad succesfully"); } catch(IOException i) { mf.msg("saving wad unsuccesful"); }; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "Wad"
"Wad(WadParse w, MainFrame m, String filename) { wp = w; wr = w.wr; mf = m; mf.msg("writing wad to "+filename); try { f = new RandomAccessFile(filename,"rw"); f.writeBytes("PWAD"); writeInt(wr.hexen ? 7 : 6); // numentries writeInt(12); // dir offset int tsize = writethings(); int vsize = writevertices(); int lsize = writelines(); int dsize = writesides(); int ssize = writesectors(); int bsize = writebehaviour(); long dpos = f.getFilePointer(); writedir("MAP01",0); writedir("THINGS",tsize); <MASK>writedir("VERTEXES",vsize);</MASK> writedir("LINEDEFS",lsize); writedir("SIDEDEFS",dsize); writedir("SECTORS",ssize); if(wr.hexen) writedir("BEHAVIOR", bsize); f.seek(8); writeInt((int)dpos); f.close(); mf.msg("wrote wad succesfully"); } catch(IOException i) { mf.msg("saving wad unsuccesful"); }; }"
Inversion-Mutation
megadiff
"void toggleWifi() { if(PENDINGWIFITOGGLE) return; PENDINGWIFITOGGLE=true; cleanupPosts(); tempLock(CONNECTWAIT); hMainWrapper(WIFI_OFF); hMain.removeMessages(WIFI_ON); hMain.sendEmptyMessageDelayed(WIFI_ON, LOOPWAIT); PENDINGSCAN=true; startScan(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "toggleWifi"
"void toggleWifi() { if(PENDINGWIFITOGGLE) return; PENDINGWIFITOGGLE=true; tempLock(CONNECTWAIT); hMainWrapper(WIFI_OFF); hMain.removeMessages(WIFI_ON); <MASK>cleanupPosts();</MASK> hMain.sendEmptyMessageDelayed(WIFI_ON, LOOPWAIT); PENDINGSCAN=true; startScan(); }"
Inversion-Mutation
megadiff
"public List<String> createCommandLine() { List<String> cmdline = new ArrayList<String>(50); cmdline.add(javaExecutable); cmdline.add("-XX:-ReduceInitialCardMarks"); cmdline.add("-XX:+HeapDumpOnOutOfMemoryError"); cmdline.add("-Djava.library.path=" + java_library_path); if (rmi_host_name != null) cmdline.add("-Djava.rmi.server.hostname=" + rmi_host_name); cmdline.add("-Dlog4j.configuration=" + log4j); if (m_vemTag != null) { cmdline.add("-D" + VEM_TAG_PROPERTY + "=" + m_vemTag); } if (gcRollover) { cmdline.add("-Xloggc:"+ volt_root + "/" + VEM_GC_ROLLOVER_FILE_NAME+" -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles="+VEM_GC_ROLLOVER_FILE_COUNT+" -XX:GCLogFileSize="+VEM_GC_ROLLOVER_FILE_SIZE); } cmdline.add(maxHeap); cmdline.add("-classpath"); cmdline.add(classPath); if (includeTestOpts) { cmdline.add("-DLOG_SEGMENT_SIZE=8"); cmdline.add("-DVoltFilePrefix=" + voltFilePrefix); cmdline.add("-ea"); cmdline.add("-XX:MaxDirectMemorySize=2g"); } else { cmdline.add("-server"); cmdline.add("-XX:HeapDumpPath=/tmp"); cmdline.add(initialHeap); } if (m_isEnterprise) { cmdline.add("-Dvolt.rmi.agent.port=" + jmxPort); cmdline.add("-Dvolt.rmi.server.hostname=" + jmxHost); } if (javaProperties != null) { for (Entry<String, String> e : javaProperties.entrySet()) { if (e.getValue() != null) { cmdline.add("-D" + e.getKey() + "=" + e.getValue()); } else { cmdline.add("-D" + e.getKey()); } } } if (debugPort > -1) { cmdline.add("-Xdebug"); cmdline.add("-agentlib:jdwp=transport=dt_socket,address=" + debugPort + ",server=y,suspend=n"); } // // Process JVM options passed through the VOLTDB_OPTS environment variable // List<String> additionalJvmOptions = new ArrayList<String>(); String nonJvmOptions = AdditionalJvmOptionsProcessor .getJvmOptionsFromVoltDbOptsEnvironmentVariable(additionalJvmOptions); cmdline.addAll(additionalJvmOptions); // // VOLTDB main() parameters // cmdline.add("org.voltdb.VoltDB"); if (m_startAction == START_ACTION.LIVE_REJOIN) { // annoying, have to special case live rejoin cmdline.add("live rejoin"); } else { cmdline.add(m_startAction.toString().toLowerCase()); } cmdline.add("host"); cmdline.add(m_leader); cmdline.add("catalog"); cmdline.add(jarFileName()); cmdline.add("deployment"); cmdline.add(pathToDeployment()); // rejoin has no replication role if (m_startAction != START_ACTION.REJOIN && m_startAction != START_ACTION.LIVE_REJOIN) { if (m_replicationRole == ReplicationRole.REPLICA) { cmdline.add("replica"); } } if (includeTestOpts) { cmdline.add("timestampsalt"); cmdline.add(Long.toString(m_timestampTestingSalt)); } cmdline.add("port"); cmdline.add(Integer.toString(m_port)); cmdline.add("internalport"); cmdline.add(Integer.toString(m_internalPort)); if (m_adminPort != -1) { cmdline.add("adminport"); cmdline.add(Integer.toString(m_adminPort)); } if (zkport != -1) { cmdline.add("zkport"); cmdline.add(Integer.toString(zkport)); } if (m_drAgentPortStart != -1) { cmdline.add("replicationport"); cmdline.add(Integer.toString(m_drAgentPortStart)); } if (target() == BackendTarget.NATIVE_EE_VALGRIND_IPC) { cmdline.add("valgrind"); } if (m_internalInterface != null && !m_internalInterface.isEmpty()) { cmdline.add("internalinterface"); cmdline.add(m_internalInterface); } if (m_internalInterface != null && !m_externalInterface.isEmpty()) { cmdline.add("externalinterface"); cmdline.add(m_externalInterface); } if (m_enableIV2) { cmdline.add("enableiv2"); } if (m_isEnterprise) { cmdline.add("license"); cmdline.add(m_pathToLicense); } if (customCmdLn != null && !customCmdLn.trim().isEmpty()) { cmdline.add(customCmdLn); } // // append non JVM options from the value of the VOLTDB_OPTIONS // environment variable to customCmdLn // if( nonJvmOptions != null && !nonJvmOptions.trim().isEmpty()) { cmdline.add(nonJvmOptions); } if ((m_ipcPorts != null) && (m_ipcPorts.size() > 0)) { cmdline.add("ipcports"); cmdline.add(org.apache.commons.lang3.StringUtils.join(m_ipcPorts, ",")); } if (m_tag != null) { cmdline.add("tag"); cmdline.add(m_tag); } return cmdline; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "createCommandLine"
"public List<String> createCommandLine() { List<String> cmdline = new ArrayList<String>(50); cmdline.add(javaExecutable); cmdline.add("-XX:-ReduceInitialCardMarks"); cmdline.add("-XX:+HeapDumpOnOutOfMemoryError"); <MASK>if (rmi_host_name != null)</MASK> cmdline.add("-Djava.library.path=" + java_library_path); cmdline.add("-Djava.rmi.server.hostname=" + rmi_host_name); cmdline.add("-Dlog4j.configuration=" + log4j); if (m_vemTag != null) { cmdline.add("-D" + VEM_TAG_PROPERTY + "=" + m_vemTag); } if (gcRollover) { cmdline.add("-Xloggc:"+ volt_root + "/" + VEM_GC_ROLLOVER_FILE_NAME+" -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles="+VEM_GC_ROLLOVER_FILE_COUNT+" -XX:GCLogFileSize="+VEM_GC_ROLLOVER_FILE_SIZE); } cmdline.add(maxHeap); cmdline.add("-classpath"); cmdline.add(classPath); if (includeTestOpts) { cmdline.add("-DLOG_SEGMENT_SIZE=8"); cmdline.add("-DVoltFilePrefix=" + voltFilePrefix); cmdline.add("-ea"); cmdline.add("-XX:MaxDirectMemorySize=2g"); } else { cmdline.add("-server"); cmdline.add("-XX:HeapDumpPath=/tmp"); cmdline.add(initialHeap); } if (m_isEnterprise) { cmdline.add("-Dvolt.rmi.agent.port=" + jmxPort); cmdline.add("-Dvolt.rmi.server.hostname=" + jmxHost); } if (javaProperties != null) { for (Entry<String, String> e : javaProperties.entrySet()) { if (e.getValue() != null) { cmdline.add("-D" + e.getKey() + "=" + e.getValue()); } else { cmdline.add("-D" + e.getKey()); } } } if (debugPort > -1) { cmdline.add("-Xdebug"); cmdline.add("-agentlib:jdwp=transport=dt_socket,address=" + debugPort + ",server=y,suspend=n"); } // // Process JVM options passed through the VOLTDB_OPTS environment variable // List<String> additionalJvmOptions = new ArrayList<String>(); String nonJvmOptions = AdditionalJvmOptionsProcessor .getJvmOptionsFromVoltDbOptsEnvironmentVariable(additionalJvmOptions); cmdline.addAll(additionalJvmOptions); // // VOLTDB main() parameters // cmdline.add("org.voltdb.VoltDB"); if (m_startAction == START_ACTION.LIVE_REJOIN) { // annoying, have to special case live rejoin cmdline.add("live rejoin"); } else { cmdline.add(m_startAction.toString().toLowerCase()); } cmdline.add("host"); cmdline.add(m_leader); cmdline.add("catalog"); cmdline.add(jarFileName()); cmdline.add("deployment"); cmdline.add(pathToDeployment()); // rejoin has no replication role if (m_startAction != START_ACTION.REJOIN && m_startAction != START_ACTION.LIVE_REJOIN) { if (m_replicationRole == ReplicationRole.REPLICA) { cmdline.add("replica"); } } if (includeTestOpts) { cmdline.add("timestampsalt"); cmdline.add(Long.toString(m_timestampTestingSalt)); } cmdline.add("port"); cmdline.add(Integer.toString(m_port)); cmdline.add("internalport"); cmdline.add(Integer.toString(m_internalPort)); if (m_adminPort != -1) { cmdline.add("adminport"); cmdline.add(Integer.toString(m_adminPort)); } if (zkport != -1) { cmdline.add("zkport"); cmdline.add(Integer.toString(zkport)); } if (m_drAgentPortStart != -1) { cmdline.add("replicationport"); cmdline.add(Integer.toString(m_drAgentPortStart)); } if (target() == BackendTarget.NATIVE_EE_VALGRIND_IPC) { cmdline.add("valgrind"); } if (m_internalInterface != null && !m_internalInterface.isEmpty()) { cmdline.add("internalinterface"); cmdline.add(m_internalInterface); } if (m_internalInterface != null && !m_externalInterface.isEmpty()) { cmdline.add("externalinterface"); cmdline.add(m_externalInterface); } if (m_enableIV2) { cmdline.add("enableiv2"); } if (m_isEnterprise) { cmdline.add("license"); cmdline.add(m_pathToLicense); } if (customCmdLn != null && !customCmdLn.trim().isEmpty()) { cmdline.add(customCmdLn); } // // append non JVM options from the value of the VOLTDB_OPTIONS // environment variable to customCmdLn // if( nonJvmOptions != null && !nonJvmOptions.trim().isEmpty()) { cmdline.add(nonJvmOptions); } if ((m_ipcPorts != null) && (m_ipcPorts.size() > 0)) { cmdline.add("ipcports"); cmdline.add(org.apache.commons.lang3.StringUtils.join(m_ipcPorts, ",")); } if (m_tag != null) { cmdline.add("tag"); cmdline.add(m_tag); } return cmdline; }"
Inversion-Mutation
megadiff
"@Override public void processTick(double dt) { if(hit) { return; } Vector3 targetPos = target != null ? target.getPosition() : staticTarget; Vector3 dir = targetPos.subtract(getPosition()).normalized(); setOrientation(Math.atan2(dir.y, dir.x)); setVelocity(dir.multiply(speed)); super.processTick(dt); Vector3 newPos = getPosition(); if(newPos.subtract(targetPos).length() < speed * dt * 1.5) { hit = true; getSimulation().detonate(new Detonation(getSimulation(), weapon, target, staticTarget)); getSimulation().removeEntity(this); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "processTick"
"@Override public void processTick(double dt) { if(hit) { return; } Vector3 targetPos = target != null ? target.getPosition() : staticTarget; Vector3 dir = targetPos.subtract(getPosition()).normalized(); setOrientation(Math.atan2(dir.y, dir.x)); setVelocity(dir.multiply(speed)); super.processTick(dt); Vector3 newPos = getPosition(); if(newPos.subtract(targetPos).length() < speed * dt * 1.5) { hit = true; <MASK>getSimulation().removeEntity(this);</MASK> getSimulation().detonate(new Detonation(getSimulation(), weapon, target, staticTarget)); } }"
Inversion-Mutation
megadiff
"protected MockServletContext createMockServletContext(Woko woko) { MockServletContext mockServletContext = new CloseableMockServletContext(contextName); mockServletContext.setAttribute(Woko.CTX_KEY, woko); mockServletContext.addFilter(StripesFilter.class, "StripesFilter", getParamsMap()); mockServletContext.setServlet(DispatcherServlet.class, "DispatcherServlet", null); return mockServletContext; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "createMockServletContext"
"protected MockServletContext createMockServletContext(Woko woko) { MockServletContext mockServletContext = new CloseableMockServletContext(contextName); mockServletContext.addFilter(StripesFilter.class, "StripesFilter", getParamsMap()); mockServletContext.setServlet(DispatcherServlet.class, "DispatcherServlet", null); <MASK>mockServletContext.setAttribute(Woko.CTX_KEY, woko);</MASK> return mockServletContext; }"
Inversion-Mutation
megadiff
"public InputVolumeControlButton(Call call, boolean fullScreen, boolean selected) { this( call, ImageLoader.MICROPHONE, ImageLoader.MUTE_BUTTON, fullScreen, true, selected); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "InputVolumeControlButton"
"public InputVolumeControlButton(Call call, boolean fullScreen, boolean selected) { this( call, ImageLoader.MICROPHONE, ImageLoader.MUTE_BUTTON, <MASK>true,</MASK> fullScreen, selected); }"
Inversion-Mutation
megadiff
"protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); Connection c = null; PreparedStatement stmt = null; ResultSet rs = null; String statement; String course = request.getParameter("course"); String archived = request.getParameter("archived"); if (archived == null || !archived.equalsIgnoreCase("true")) { archived = "false"; } boolean archivedBoolean = Boolean.parseBoolean(archived); try { Class.forName("com.mysql.jdbc.Driver"); c = DriverManager.getConnection( "jdbc:mysql://localhost:3306/automaatnehindaja", "ahindaja", "k1rven2gu"); if (request.isUserInRole("tudeng")) { statement = "SELECT " + "tasks.id, tasks.name, tasks.deadline, attempt.result, tasks.active " + "FROM tasks " + "LEFT OUTER JOIN " + "attempt on tasks.id = attempt.task " + "AND " + "attempt.username = ? " + "WHERE tasks.coursename = ?"; if (!archivedBoolean) { statement = statement + " AND tasks.active = 1"; } stmt = c.prepareStatement(statement); stmt.setString(2, course); stmt.setString(1, request.getUserPrincipal().getName()); } else if (request.isUserInRole("admin") || request.isUserInRole("responsible")) { statement = "SELECT tasks.id, tasks.name, tasks.deadline, count(attempt.task) AS attempts, " + "(SELECT count(*) FROM attempt where attempt.task = tasks.id AND " + "attempt.result = 'OK') AS successful, tasks.active " + "FROM tasks " + "LEFT JOIN attempt " + "ON tasks.id = attempt.task " + "WHERE tasks.coursename = ?"; if (!archivedBoolean) { statement = statement + " AND tasks.active = 1"; } statement = statement + " GROUP BY tasks.id;"; stmt = c.prepareStatement(statement); stmt.setString(1, course); } else { return; } rs = stmt.executeQuery(); response.setContentType("application/json"); JSONObject json = new JSONObject(); if (request.isUserInRole("tudeng")) { try { json.put("role", "tudeng"); while (rs.next()) { json.append("id", rs.getString(1)); json.append("name", rs.getString(2)); json.append("deadline", rs.getDate(3).toString()); String tulemus = rs.getString(4); if (tulemus == null) { tulemus = "Esitamata"; } json.append("result", tulemus); json.append("active", rs.getBoolean(5)); } } catch (JSONException e) { logger.debug("JSONEXCEPTION", e); } } else if (request.isUserInRole("admin") || request.isUserInRole("responsible")) { try { json.put("role", "admin"); while (rs.next()) { json.append("id", rs.getString(1)); json.append("name", rs.getString(2)); json.append("deadline", rs.getDate(3).toString()); json.append("resultCount", rs.getInt(4)); json.append("successCount", rs.getInt(5)); json.append("active", rs.getBoolean(6)); } } catch (JSONException e) { logger.debug("JSONEXCEPTION", e); } } else { response.sendRedirect("/automaatnehindaja/error.html"); return; } c.close(); response.getWriter().write(json.toString()); } catch (SQLException e) { logger.debug("SQLEXCEPTION", e); } catch (ClassNotFoundException f) { logger.debug("CLASSNOTFOUNDEXCEPTION", f); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "doGet"
"protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { <MASK>response.setCharacterEncoding("UTF-8");</MASK> request.setCharacterEncoding("UTF-8"); Connection c = null; PreparedStatement stmt = null; ResultSet rs = null; String statement; String course = request.getParameter("course"); String archived = request.getParameter("archived"); if (archived == null || !archived.equalsIgnoreCase("true")) { archived = "false"; } boolean archivedBoolean = Boolean.parseBoolean(archived); try { Class.forName("com.mysql.jdbc.Driver"); c = DriverManager.getConnection( "jdbc:mysql://localhost:3306/automaatnehindaja", "ahindaja", "k1rven2gu"); if (request.isUserInRole("tudeng")) { statement = "SELECT " + "tasks.id, tasks.name, tasks.deadline, attempt.result, tasks.active " + "FROM tasks " + "LEFT OUTER JOIN " + "attempt on tasks.id = attempt.task " + "AND " + "attempt.username = ? " + "WHERE tasks.coursename = ?"; if (!archivedBoolean) { statement = statement + " AND tasks.active = 1"; } stmt = c.prepareStatement(statement); stmt.setString(2, course); stmt.setString(1, request.getUserPrincipal().getName()); } else if (request.isUserInRole("admin") || request.isUserInRole("responsible")) { statement = "SELECT tasks.id, tasks.name, tasks.deadline, count(attempt.task) AS attempts, " + "(SELECT count(*) FROM attempt where attempt.task = tasks.id AND " + "attempt.result = 'OK') AS successful, tasks.active " + "FROM tasks " + "LEFT JOIN attempt " + "ON tasks.id = attempt.task " + "WHERE tasks.coursename = ?"; if (!archivedBoolean) { statement = statement + " AND tasks.active = 1"; } statement = statement + " GROUP BY tasks.id;"; stmt = c.prepareStatement(statement); stmt.setString(1, course); } else { return; } rs = stmt.executeQuery(); response.setContentType("application/json"); JSONObject json = new JSONObject(); if (request.isUserInRole("tudeng")) { try { json.put("role", "tudeng"); while (rs.next()) { json.append("id", rs.getString(1)); json.append("name", rs.getString(2)); json.append("deadline", rs.getDate(3).toString()); String tulemus = rs.getString(4); if (tulemus == null) { tulemus = "Esitamata"; } json.append("result", tulemus); json.append("active", rs.getBoolean(5)); } } catch (JSONException e) { logger.debug("JSONEXCEPTION", e); } } else if (request.isUserInRole("admin") || request.isUserInRole("responsible")) { try { json.put("role", "admin"); while (rs.next()) { json.append("id", rs.getString(1)); json.append("name", rs.getString(2)); json.append("deadline", rs.getDate(3).toString()); json.append("resultCount", rs.getInt(4)); json.append("successCount", rs.getInt(5)); json.append("active", rs.getBoolean(6)); } } catch (JSONException e) { logger.debug("JSONEXCEPTION", e); } } else { response.sendRedirect("/automaatnehindaja/error.html"); return; } c.close(); response.getWriter().write(json.toString()); } catch (SQLException e) { logger.debug("SQLEXCEPTION", e); } catch (ClassNotFoundException f) { logger.debug("CLASSNOTFOUNDEXCEPTION", f); } }"
Inversion-Mutation
megadiff
"public void resume(boolean fireNotification) throws DebugException { if (!isSuspended()) { return; } try { setSuspended(false); resumeThreads(); getVM().resume(); if (fireNotification) { fireResumeEvent(DebugEvent.CLIENT_REQUEST); } } catch (VMDisconnectedException e) { disconnected(); return; } catch (RuntimeException e) { setSuspended(true); fireSuspendEvent(DebugEvent.CLIENT_REQUEST); targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.getString("JDIDebugTarget.exception_resume"), new String[] {e.toString()}), e); //$NON-NLS-1$ } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "resume"
"public void resume(boolean fireNotification) throws DebugException { if (!isSuspended()) { return; } try { setSuspended(false); <MASK>getVM().resume();</MASK> resumeThreads(); if (fireNotification) { fireResumeEvent(DebugEvent.CLIENT_REQUEST); } } catch (VMDisconnectedException e) { disconnected(); return; } catch (RuntimeException e) { setSuspended(true); fireSuspendEvent(DebugEvent.CLIENT_REQUEST); targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.getString("JDIDebugTarget.exception_resume"), new String[] {e.toString()}), e); //$NON-NLS-1$ } }"
Inversion-Mutation
megadiff
"@Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { List<ScriptQueue> queues = new ArrayList<ScriptQueue>(); // Use current queue if none specified. queues.add(ScriptQueue._getQueue(scriptEntry.getResidingQueue())); for (String arg : scriptEntry.getArguments()) { if (aH.matchesQueue(arg)) queues.clear(); for (String queueName : aH.getListFrom(arg)) { try { queues.add(aH.getQueueFrom(queueName)); } catch (Exception e) { // must be null, don't add } } else throw new InvalidArgumentsException(dB.Messages.ERROR_UNKNOWN_ARGUMENT, arg); } if (queues.isEmpty()) throw new InvalidArgumentsException("Must specify at least one ScriptQueue!"); scriptEntry.addObject("queues", queues); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "parseArgs"
"@Override public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { List<ScriptQueue> queues = new ArrayList<ScriptQueue>(); // Use current queue if none specified. queues.add(ScriptQueue._getQueue(scriptEntry.getResidingQueue())); for (String arg : scriptEntry.getArguments()) { if (aH.matchesQueue(arg)) for (String queueName : aH.getListFrom(arg)) { <MASK>queues.clear();</MASK> try { queues.add(aH.getQueueFrom(queueName)); } catch (Exception e) { // must be null, don't add } } else throw new InvalidArgumentsException(dB.Messages.ERROR_UNKNOWN_ARGUMENT, arg); } if (queues.isEmpty()) throw new InvalidArgumentsException("Must specify at least one ScriptQueue!"); scriptEntry.addObject("queues", queues); }"
Inversion-Mutation
megadiff
"public Gui_StreamRipStar(Boolean openPreferences) { super("StreamRipStar"); setIconImage( windowIcon.getImage() ); controlStreams = new Control_Stream(this); table = new Gui_TablePanel(controlStreams,this); addWindowListener(this); setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE ); Container contPane = getContentPane(); BorderLayout mainLayout = new BorderLayout(); contPane.setLayout(mainLayout); contPane.add(iconBar,BorderLayout.PAGE_START); contPane.add(table, BorderLayout.CENTER); //Add that shows all streams buildMenuBar(); loadProp(); buildIconBar(); setSystemTray(); setLanguage(); //and pre-load the audio system; if it fails, the internal audio player is //disabled automatically table.loadFirstAudioPlayer(); if(useInternalPlayer) { //load the audio panel audioPanel = new InternAudioControlPanel(this,volumeManager); contPane.add(this.audioPanel, BorderLayout.SOUTH); hearMusicButton.setEnabled(false); } //Center StreamRipStar //get size of window Dimension frameDim = getSize(); //get resolution Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); //calculates the app. values int x = (screenDim.width - frameDim.width)/2; int y = (screenDim.height - frameDim.height)/2; //set location setLocation(x, y); setVisible(true); //create object to control the next 2 Threads Control_Threads controlThreads = new Control_Threads(); // start filling the table with streams Thread_FillTableWithStreams fill = new Thread_FillTableWithStreams(controlStreams,table,controlThreads); fill.start(); //the schedul control is an thread -> start it controlJob = new Thread_Control_Schedul(this,controlThreads); controlJob.start(); //if preferences should open, do it here if(openPreferences) { JOptionPane.showMessageDialog(this, trans.getString("firstTime")); new Gui_Settings2(this); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "Gui_StreamRipStar"
"public Gui_StreamRipStar(Boolean openPreferences) { super("StreamRipStar"); setIconImage( windowIcon.getImage() ); controlStreams = new Control_Stream(this); table = new Gui_TablePanel(controlStreams,this); addWindowListener(this); setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE ); Container contPane = getContentPane(); BorderLayout mainLayout = new BorderLayout(); contPane.setLayout(mainLayout); contPane.add(iconBar,BorderLayout.PAGE_START); contPane.add(table, BorderLayout.CENTER); //Add that shows all streams buildMenuBar(); <MASK>setLanguage();</MASK> loadProp(); buildIconBar(); setSystemTray(); //and pre-load the audio system; if it fails, the internal audio player is //disabled automatically table.loadFirstAudioPlayer(); if(useInternalPlayer) { //load the audio panel audioPanel = new InternAudioControlPanel(this,volumeManager); contPane.add(this.audioPanel, BorderLayout.SOUTH); hearMusicButton.setEnabled(false); } //Center StreamRipStar //get size of window Dimension frameDim = getSize(); //get resolution Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); //calculates the app. values int x = (screenDim.width - frameDim.width)/2; int y = (screenDim.height - frameDim.height)/2; //set location setLocation(x, y); setVisible(true); //create object to control the next 2 Threads Control_Threads controlThreads = new Control_Threads(); // start filling the table with streams Thread_FillTableWithStreams fill = new Thread_FillTableWithStreams(controlStreams,table,controlThreads); fill.start(); //the schedul control is an thread -> start it controlJob = new Thread_Control_Schedul(this,controlThreads); controlJob.start(); //if preferences should open, do it here if(openPreferences) { JOptionPane.showMessageDialog(this, trans.getString("firstTime")); new Gui_Settings2(this); } }"
Inversion-Mutation
megadiff
"@Override public DropAction dragEnter(Component component, Manifest dragContent, int supportedDropActions, DropAction userDropAction) { DropAction action = null; if (dragContent.containsFileList() && DropAction.COPY.isSelected(supportedDropActions)) { action = DropAction.COPY; } else if (dragContent.containsValue("node")) { designTree = (TreeView) component; action = DropAction.MOVE; } return action; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "dragEnter"
"@Override public DropAction dragEnter(Component component, Manifest dragContent, int supportedDropActions, DropAction userDropAction) { <MASK>designTree = (TreeView) component;</MASK> DropAction action = null; if (dragContent.containsFileList() && DropAction.COPY.isSelected(supportedDropActions)) { action = DropAction.COPY; } else if (dragContent.containsValue("node")) { action = DropAction.MOVE; } return action; }"
Inversion-Mutation
megadiff
"private void processLoginAttempt(final Connection con, final String username, final String password) { LOGGER.trace("Processing login attempt"); // TODO Exceeded maximum login attempts HibernateUtils.beginTransaction(); Account account = accountDAO.findByUsername(username); HibernateUtils.commitTransaction(); HibernateUtils.beginTransaction(); LoginAttempt attempt = new LoginAttempt(); attempt.setTime(System.currentTimeMillis()); attempt.setAccount(account); attempt.setConnection(con.toString()); System.out.println(attempt.getTime()); loginAttemptDAO.save(attempt); HibernateUtils.commitTransaction(); if (account != null) { if (!account.getPassword().equals(password)) { processFailedLogin(con, attempt, account); } else { //Handle account already logged in Set<Account> currentAccounts = accounts.keySet(); for (Account a: currentAccounts) { if (a.getUsername().equals(username)) { logger.log(Level.INFO, ALREADY_LOGGED_IN_MESSAGE); processFailedLogin(con, attempt, account); return; } } processSuccesfulLogin(con, attempt, account); } } else { processFailedLogin(con, attempt); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "processLoginAttempt"
"private void processLoginAttempt(final Connection con, final String username, final String password) { LOGGER.trace("Processing login attempt"); // TODO Exceeded maximum login attempts HibernateUtils.beginTransaction(); Account account = accountDAO.findByUsername(username); HibernateUtils.commitTransaction(); HibernateUtils.beginTransaction(); LoginAttempt attempt = new LoginAttempt(); attempt.setTime(System.currentTimeMillis()); attempt.setAccount(account); attempt.setConnection(con.toString()); System.out.println(attempt.getTime()); loginAttemptDAO.save(attempt); HibernateUtils.commitTransaction(); if (account != null) { if (!account.getPassword().equals(password)) { processFailedLogin(con, attempt, account); } else { //Handle account already logged in <MASK>logger.log(Level.INFO, ALREADY_LOGGED_IN_MESSAGE);</MASK> Set<Account> currentAccounts = accounts.keySet(); for (Account a: currentAccounts) { if (a.getUsername().equals(username)) { processFailedLogin(con, attempt, account); return; } } processSuccesfulLogin(con, attempt, account); } } else { processFailedLogin(con, attempt); } }"
Inversion-Mutation
megadiff
"public BoardView(Parent parent) { super(parent); firstTime = System.currentTimeMillis(); setAutoCellSize(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "BoardView"
"public BoardView(Parent parent) { <MASK>firstTime = System.currentTimeMillis();</MASK> super(parent); setAutoCellSize(); }"
Inversion-Mutation
megadiff
"public static String viewPost(String username, String boardName, String regionName, int postNum) { Connection dbconn = DBManager.getConnection(); String bname = boardName.trim().toLowerCase(); if (bname.equals("freeforall")) { Boolean postExists = postExists("freeforall", null, postNum); if (postExists == null) { return "print Error: Database error while verifying existence of post. " + "If the problem persists, contact an admin."; } else if (postExists.booleanValue()) { String msg = SocialNetworkDatabasePosts.getPostFreeForAll(dbconn, username, postNum); DBManager.closeConnection(dbconn); return msg; } else { return "print Error: Post does not exist. Refresh. " + "If the problem persists, contact an admin."; } } String rname = regionName.trim().toLowerCase(); Boolean boardExists = SocialNetworkBoards.boardExists(bname); if (boardExists == null) { return "print Error: Database error while verifying existence of board. " + "If the problem persists, contact an admin."; } else if (boardExists.booleanValue()) { Boolean regionExists = SocialNetworkRegions.regionExists(bname, rname); if (regionExists == null) { return "print Error: Database error while verifying existence of region. " + "If the problem persists, contact an admin."; } else if (regionExists.booleanValue()) { Boolean postExists = postExists(bname, rname, postNum); if (postExists == null) { return "print Error: Database error while verifying existence of post. " + "If the problem persists, contact an admin."; } else if (postExists.booleanValue()) { String msg = SocialNetworkDatabasePosts.getPost(dbconn, username, bname, rname, postNum); DBManager.closeConnection(dbconn); return msg; } else { return "print Error: Post does not exist. Refresh. " + "If the problem persists, contact an admin."; } } else { return "print Error: Encapsulating Region does not exist. Refresh. " + "If the problem persists, contact an admin."; } } else { return "print Error: Encapsulating Board does not exist. Refresh. " + "If the problem persists, contact an admin."; } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "viewPost"
"public static String viewPost(String username, String boardName, String regionName, int postNum) { Connection dbconn = DBManager.getConnection(); String bname = boardName.trim().toLowerCase(); <MASK>String rname = regionName.trim().toLowerCase();</MASK> if (bname.equals("freeforall")) { Boolean postExists = postExists("freeforall", null, postNum); if (postExists == null) { return "print Error: Database error while verifying existence of post. " + "If the problem persists, contact an admin."; } else if (postExists.booleanValue()) { String msg = SocialNetworkDatabasePosts.getPostFreeForAll(dbconn, username, postNum); DBManager.closeConnection(dbconn); return msg; } else { return "print Error: Post does not exist. Refresh. " + "If the problem persists, contact an admin."; } } Boolean boardExists = SocialNetworkBoards.boardExists(bname); if (boardExists == null) { return "print Error: Database error while verifying existence of board. " + "If the problem persists, contact an admin."; } else if (boardExists.booleanValue()) { Boolean regionExists = SocialNetworkRegions.regionExists(bname, rname); if (regionExists == null) { return "print Error: Database error while verifying existence of region. " + "If the problem persists, contact an admin."; } else if (regionExists.booleanValue()) { Boolean postExists = postExists(bname, rname, postNum); if (postExists == null) { return "print Error: Database error while verifying existence of post. " + "If the problem persists, contact an admin."; } else if (postExists.booleanValue()) { String msg = SocialNetworkDatabasePosts.getPost(dbconn, username, bname, rname, postNum); DBManager.closeConnection(dbconn); return msg; } else { return "print Error: Post does not exist. Refresh. " + "If the problem persists, contact an admin."; } } else { return "print Error: Encapsulating Region does not exist. Refresh. " + "If the problem persists, contact an admin."; } } else { return "print Error: Encapsulating Board does not exist. Refresh. " + "If the problem persists, contact an admin."; } }"
Inversion-Mutation
megadiff
"public void shutdown() { dataNode.shutdown(); nameNode.shutdown(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "shutdown"
"public void shutdown() { <MASK>nameNode.shutdown();</MASK> dataNode.shutdown(); }"
Inversion-Mutation
megadiff
"public WorkerImpl(final Config config, final Collection<String> queues, final Map<String, ? extends Class<?>> jobTypes) { if (config == null) { throw new IllegalArgumentException("config must not be null"); } checkQueues(queues); checkJobTypes(jobTypes); this.config = config; this.namespace = config.getNamespace(); this.jedis = new Jedis(config.getHost(), config.getPort(), config.getTimeout()); authenticateAndSelectDB(); setQueues(queues); setJobTypes(jobTypes); this.name = createName(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "WorkerImpl"
"public WorkerImpl(final Config config, final Collection<String> queues, final Map<String, ? extends Class<?>> jobTypes) { if (config == null) { throw new IllegalArgumentException("config must not be null"); } checkQueues(queues); checkJobTypes(jobTypes); this.config = config; this.namespace = config.getNamespace(); this.jedis = new Jedis(config.getHost(), config.getPort(), config.getTimeout()); authenticateAndSelectDB(); <MASK>this.name = createName();</MASK> setQueues(queues); setJobTypes(jobTypes); }"
Inversion-Mutation
megadiff
"public static Test suite( ) { TestSuite suite = new TestSuite( "Test for org.eclipse.birt.data.engine" ); /* in package: org.eclipse.birt.data.engine.aggregation */ suite.addTestSuite( org.eclipse.birt.data.engine.aggregation.FinanceTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.aggregation.TotalTest.class ); /* in package org.eclipse.birt.data.engine.api */ suite.addTestSuite( org.eclipse.birt.data.engine.api.ClobAndBlobTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.DataSetCacheTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.DteLevelDataSetCacheTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.GroupLevelTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.ScriptedDSTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.ScriptTest.class ); // ?? suite.addTestSuite( org.eclipse.birt.data.engine.api.StoredProcedureTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.UsesDetailFalseTest.class ); /* in package org.eclipse.birt.data.engine.binding */ suite.addTestSuite( org.eclipse.birt.data.engine.binding.ColumnBindingTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.ColumnHintTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.ComputedColumnTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.DataSetCacheTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.DefineDataSourceTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.DistinctValueTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.FeaturesTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.FilterByRowTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.GroupOnRowTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.InputParameterTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.MaxRowsTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.MultiplePassTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.NestedQueryTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.SubQueryTest.class ); /* in package org.eclipse.birt.data.engine.binding.newbinding */ suite.addTestSuite( org.eclipse.birt.data.engine.binding.newbinding.MultiplePassTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.newbinding.ColumnBindingTest.class ); /* in package org.eclipse.birt.data.engine.executor.cache */ suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheClobAndBlobTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheComputedColumnTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CachedMultiplePassTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheFeaturesTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheNestedQueryTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheSortTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheSubqueryTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.MemoryCacheTest.class ); /* in package org.eclipse.birt.data.engine.executor.transform */ suite.addTestSuite( org.eclipse.birt.data.engine.executor.transform.CachedResultSetTest.class ); /* in package org.eclipse.birt.data.engine.executor.transform.group */ suite.addTestSuite( org.eclipse.birt.data.engine.executor.transform.group.GroupByDistinctValueTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.executor.transform.group.GroupByRowKeyCountTest.class); /* in package org.eclipse.birt.data.engine.expression */ suite.addTestSuite( org.eclipse.birt.data.engine.expression.ComplexExpressionCompilerTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.expression.ExpressionCompilerTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.expression.ExpressionCompilerUtilTest.class); /* in package org.eclipse.birt.data.engine.impl */ suite.addTestSuite( org.eclipse.birt.data.engine.impl.AggregationTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.ExprManagerUtilTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.JointDataSetTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.ResultMetaDataTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.ScriptEvalTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.ConfigFileParserTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.impl.IncreCacheDataSetTest.class); /* in package org.eclipse.birt.data.engine.impl.binding */ suite.addTestSuite( org.eclipse.birt.data.engine.impl.binding.AggregationTest.class ); /* in package org.eclipse.birt.data.engine.impl.document */ suite.addTestSuite( org.eclipse.birt.data.engine.impl.document.GroupInfoUtilTest.class); /* in package org.eclipse.birt.data.engine.impl.rd */ suite.addTestSuite( org.eclipse.birt.data.engine.impl.rd.ViewingTest2.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.rd.ReportDocumentTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.rd.ReportDocumentTest2.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.rd.ViewingTest.class); /* in package org.eclipse.birt.data.engine.reg */ suite.addTestSuite( org.eclipse.birt.data.engine.regre.DataSourceTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.regre.FeatureTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.regre.SortTest.class); /* in package org.eclipse.birt.data.engine.olap.api */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.api.CubeFeaturesTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.olap.api.CubeIVTest.class); /* in package org.eclipse.birt.data.engine.olap.data.document*/ suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.document.BufferedRandomAccessObjectTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.document.CachedDocumentObjectManagerTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.document.DocumentManagerTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.document.FileDocumentManagerTest.class ); /* in package org.eclipse.birt.data.engine.olap.data.impl*/ suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.CubeAggregationTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.DimensionKeyTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.LevelMemberTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.TraversalorTest.class ); /* in package org.eclipse.birt.data.engine.olap.data.impl.dimension */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.dimension.DimensionTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.dimension.DimensionTest2.class ); /* in package org.eclipse.birt.data.engine.olap.data.impl.facttable */ // suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.facttable.DimensionSegmentsTest.class ); // suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.facttable.FactTableHelperTest.class ); // suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.facttable.FactTableHelperTest2.class ); // suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.facttable.FactTableRowTest.class ); // suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.facttable.FactTableRowIteratorWithFilterTest.class ); /* in package org.eclipse.birt.data.engine.olap.data.util */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.BufferedPrimitiveDiskArrayTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.BufferedRandomAccessFileTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.BufferedStructureArrayTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.DiskIndexTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.DiskSortedStackTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.ObjectArrayUtilTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.PrimaryDiskArrayTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.PrimarySortedStackTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.SetUtilTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.StructureDiskArrayTest.class ); /* in package org.eclipse.birt.data.engine.olap.util.filter */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.util.filter.CubePosFilterTest.class ); /* in package org.eclipse.birt.data.engine.olap.cursor */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.cursor.CursorNavigatorTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.cursor.CursorModelTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.cursor.MirrorCursorModelTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.cursor.MirrorCursorNavigatorTest.class ); /* in package org.eclipse.birt.data.engine.olap.util */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.util.OlapExpressionUtilTest.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( "Test for org.eclipse.birt.data.engine" ); /* in package: org.eclipse.birt.data.engine.aggregation */ suite.addTestSuite( org.eclipse.birt.data.engine.aggregation.FinanceTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.aggregation.TotalTest.class ); /* in package org.eclipse.birt.data.engine.api */ suite.addTestSuite( org.eclipse.birt.data.engine.api.ClobAndBlobTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.DataSetCacheTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.DteLevelDataSetCacheTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.GroupLevelTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.ScriptedDSTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.ScriptTest.class ); // ?? suite.addTestSuite( org.eclipse.birt.data.engine.api.StoredProcedureTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.api.UsesDetailFalseTest.class ); /* in package org.eclipse.birt.data.engine.binding */ suite.addTestSuite( org.eclipse.birt.data.engine.binding.ColumnBindingTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.ColumnHintTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.ComputedColumnTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.DataSetCacheTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.DefineDataSourceTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.DistinctValueTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.FeaturesTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.FilterByRowTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.GroupOnRowTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.InputParameterTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.MaxRowsTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.MultiplePassTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.NestedQueryTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.SubQueryTest.class ); /* in package org.eclipse.birt.data.engine.binding.newbinding */ suite.addTestSuite( org.eclipse.birt.data.engine.binding.newbinding.MultiplePassTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.binding.newbinding.ColumnBindingTest.class ); /* in package org.eclipse.birt.data.engine.executor.cache */ suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheClobAndBlobTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheComputedColumnTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CachedMultiplePassTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheFeaturesTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheNestedQueryTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheSortTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.CacheSubqueryTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.executor.cache.MemoryCacheTest.class ); /* in package org.eclipse.birt.data.engine.executor.transform */ suite.addTestSuite( org.eclipse.birt.data.engine.executor.transform.CachedResultSetTest.class ); /* in package org.eclipse.birt.data.engine.executor.transform.group */ suite.addTestSuite( org.eclipse.birt.data.engine.executor.transform.group.GroupByDistinctValueTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.executor.transform.group.GroupByRowKeyCountTest.class); /* in package org.eclipse.birt.data.engine.expression */ suite.addTestSuite( org.eclipse.birt.data.engine.expression.ComplexExpressionCompilerTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.expression.ExpressionCompilerTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.expression.ExpressionCompilerUtilTest.class); /* in package org.eclipse.birt.data.engine.impl */ suite.addTestSuite( org.eclipse.birt.data.engine.impl.AggregationTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.ExprManagerUtilTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.JointDataSetTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.ResultMetaDataTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.ScriptEvalTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.ConfigFileParserTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.impl.IncreCacheDataSetTest.class); /* in package org.eclipse.birt.data.engine.impl.binding */ suite.addTestSuite( org.eclipse.birt.data.engine.impl.binding.AggregationTest.class ); /* in package org.eclipse.birt.data.engine.impl.document */ suite.addTestSuite( org.eclipse.birt.data.engine.impl.document.GroupInfoUtilTest.class); /* in package org.eclipse.birt.data.engine.impl.rd */ suite.addTestSuite( org.eclipse.birt.data.engine.impl.rd.ReportDocumentTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.impl.rd.ReportDocumentTest2.class); <MASK>suite.addTestSuite( org.eclipse.birt.data.engine.impl.rd.ViewingTest2.class);</MASK> suite.addTestSuite( org.eclipse.birt.data.engine.impl.rd.ViewingTest.class); /* in package org.eclipse.birt.data.engine.reg */ suite.addTestSuite( org.eclipse.birt.data.engine.regre.DataSourceTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.regre.FeatureTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.regre.SortTest.class); /* in package org.eclipse.birt.data.engine.olap.api */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.api.CubeFeaturesTest.class); suite.addTestSuite( org.eclipse.birt.data.engine.olap.api.CubeIVTest.class); /* in package org.eclipse.birt.data.engine.olap.data.document*/ suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.document.BufferedRandomAccessObjectTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.document.CachedDocumentObjectManagerTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.document.DocumentManagerTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.document.FileDocumentManagerTest.class ); /* in package org.eclipse.birt.data.engine.olap.data.impl*/ suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.CubeAggregationTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.DimensionKeyTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.LevelMemberTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.TraversalorTest.class ); /* in package org.eclipse.birt.data.engine.olap.data.impl.dimension */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.dimension.DimensionTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.dimension.DimensionTest2.class ); /* in package org.eclipse.birt.data.engine.olap.data.impl.facttable */ // suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.facttable.DimensionSegmentsTest.class ); // suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.facttable.FactTableHelperTest.class ); // suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.facttable.FactTableHelperTest2.class ); // suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.facttable.FactTableRowTest.class ); // suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.impl.facttable.FactTableRowIteratorWithFilterTest.class ); /* in package org.eclipse.birt.data.engine.olap.data.util */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.BufferedPrimitiveDiskArrayTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.BufferedRandomAccessFileTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.BufferedStructureArrayTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.DiskIndexTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.DiskSortedStackTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.ObjectArrayUtilTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.PrimaryDiskArrayTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.PrimarySortedStackTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.SetUtilTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.data.util.StructureDiskArrayTest.class ); /* in package org.eclipse.birt.data.engine.olap.util.filter */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.util.filter.CubePosFilterTest.class ); /* in package org.eclipse.birt.data.engine.olap.cursor */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.cursor.CursorNavigatorTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.cursor.CursorModelTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.cursor.MirrorCursorModelTest.class ); suite.addTestSuite( org.eclipse.birt.data.engine.olap.cursor.MirrorCursorNavigatorTest.class ); /* in package org.eclipse.birt.data.engine.olap.util */ suite.addTestSuite( org.eclipse.birt.data.engine.olap.util.OlapExpressionUtilTest.class ); return suite; }"
Inversion-Mutation
megadiff
"private void addDoLoadMethod(StringComposite sc) { sc.add("protected void doLoad(" + INPUT_STREAM + " inputStream, " + MAP + "<?,?> options) throws " + IO_EXCEPTION + " {"); sc.add(STRING + " encoding = null;"); sc.add(INPUT_STREAM + " actualInputStream = inputStream;"); sc.add(OBJECT + " inputStreamPreProcessorProvider = null;"); sc.add("if (options!=null) {"); sc.add("inputStreamPreProcessorProvider = options.get(" + I_OPTIONS + ".INPUT_STREAM_PREPROCESSOR_PROVIDER);"); sc.add("}"); sc.add("if (inputStreamPreProcessorProvider != null) {"); sc.add("if (inputStreamPreProcessorProvider instanceof " + I_INPUT_STREAM_PROCESSOR_PROVIDER + ") {"); sc.add(I_INPUT_STREAM_PROCESSOR_PROVIDER + " provider = (" + I_INPUT_STREAM_PROCESSOR_PROVIDER + ") inputStreamPreProcessorProvider;"); sc.add(INPUT_STREAM_PROCESSOR + " processor = provider.getInputStreamProcessor(inputStream);"); sc.add("actualInputStream = processor;"); sc.add("encoding = processor.getOutputEncoding();"); sc.add("}"); sc.add("}"); sc.addLineBreak(); sc.add("parser = getMetaInformation().createParser(actualInputStream, encoding);"); sc.add("parser.setOptions(options);"); sc.add(I_REFERENCE_RESOLVER_SWITCH + " referenceResolverSwitch = getReferenceResolverSwitch();"); sc.add("referenceResolverSwitch.setOptions(options);"); sc.add(I_PARSE_RESULT + " result = parser.parse();"); sc.add("clearState();"); sc.add("if (result != null) {"); sc.add(E_OBJECT + " root = result.getRoot();"); sc.add("if (root != null) {"); sc.add("getContents().add(root);"); sc.add("}"); sc.add(COLLECTION + "<" + I_COMMAND + "<" + I_TEXT_RESOURCE + ">> commands = result.getPostParseCommands();"); sc.add("if (commands != null) {"); sc.add("for (" + I_COMMAND + "<" + I_TEXT_RESOURCE + "> command : commands) {"); sc.add("command.execute(this);"); sc.add("}"); sc.add("}"); sc.add("}"); sc.add("getReferenceResolverSwitch().setOptions(options);"); sc.add("runPostProcessors(options);"); sc.add("}"); sc.addLineBreak(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "addDoLoadMethod"
"private void addDoLoadMethod(StringComposite sc) { sc.add("protected void doLoad(" + INPUT_STREAM + " inputStream, " + MAP + "<?,?> options) throws " + IO_EXCEPTION + " {"); sc.add(STRING + " encoding = null;"); sc.add(INPUT_STREAM + " actualInputStream = inputStream;"); sc.add(OBJECT + " inputStreamPreProcessorProvider = null;"); sc.add("if (options!=null) {"); sc.add("inputStreamPreProcessorProvider = options.get(" + I_OPTIONS + ".INPUT_STREAM_PREPROCESSOR_PROVIDER);"); sc.add("}"); sc.add("if (inputStreamPreProcessorProvider != null) {"); sc.add("if (inputStreamPreProcessorProvider instanceof " + I_INPUT_STREAM_PROCESSOR_PROVIDER + ") {"); sc.add(I_INPUT_STREAM_PROCESSOR_PROVIDER + " provider = (" + I_INPUT_STREAM_PROCESSOR_PROVIDER + ") inputStreamPreProcessorProvider;"); sc.add(INPUT_STREAM_PROCESSOR + " processor = provider.getInputStreamProcessor(inputStream);"); sc.add("actualInputStream = processor;"); sc.add("encoding = processor.getOutputEncoding();"); sc.add("}"); sc.add("}"); sc.addLineBreak(); sc.add("parser = getMetaInformation().createParser(actualInputStream, encoding);"); sc.add("parser.setOptions(options);"); sc.add(I_REFERENCE_RESOLVER_SWITCH + " referenceResolverSwitch = getReferenceResolverSwitch();"); sc.add("referenceResolverSwitch.setOptions(options);"); sc.add(I_PARSE_RESULT + " result = parser.parse();"); sc.add("if (result != null) {"); sc.add(E_OBJECT + " root = result.getRoot();"); sc.add("if (root != null) {"); sc.add("getContents().add(root);"); sc.add("}"); <MASK>sc.add("clearState();");</MASK> sc.add(COLLECTION + "<" + I_COMMAND + "<" + I_TEXT_RESOURCE + ">> commands = result.getPostParseCommands();"); sc.add("if (commands != null) {"); sc.add("for (" + I_COMMAND + "<" + I_TEXT_RESOURCE + "> command : commands) {"); sc.add("command.execute(this);"); sc.add("}"); sc.add("}"); sc.add("}"); sc.add("getReferenceResolverSwitch().setOptions(options);"); sc.add("runPostProcessors(options);"); sc.add("}"); sc.addLineBreak(); }"
Inversion-Mutation
megadiff
"@Override @Before public void setUp() throws Exception { System.setProperty("vfs.sftp.sshdir", new File("./tests/sshd-config/").getAbsolutePath()); super.setUp(); ConnectionDescription dst = new ConnectionDescription(new URI("sftp://127.0.0.1:2222/")); dst.setParameter("bufferStrategy", ""); dst.setParameter("username", "SampleUser"); dst.setSecretParameter("password", "SampleUser"); profile.setDestination(dst); testingDst.delete(); testingDst = sshServer.getUserHome(); }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "setUp"
"@Override @Before public void setUp() throws Exception { super.setUp(); ConnectionDescription dst = new ConnectionDescription(new URI("sftp://127.0.0.1:2222/")); dst.setParameter("bufferStrategy", ""); dst.setParameter("username", "SampleUser"); dst.setSecretParameter("password", "SampleUser"); profile.setDestination(dst); testingDst.delete(); testingDst = sshServer.getUserHome(); <MASK>System.setProperty("vfs.sftp.sshdir", new File("./tests/sshd-config/").getAbsolutePath());</MASK> }"
Inversion-Mutation
megadiff
"public void popupDismissed(boolean topPopupOnly) { initializePopup(); // if the 2nd level popup gets dismissed if (mPopupStatus == POPUP_SECOND_LEVEL) { mPopupStatus = POPUP_FIRST_LEVEL; if (topPopupOnly) mModule.showPopup(mPopup); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "popupDismissed"
"public void popupDismissed(boolean topPopupOnly) { // if the 2nd level popup gets dismissed if (mPopupStatus == POPUP_SECOND_LEVEL) { <MASK>initializePopup();</MASK> mPopupStatus = POPUP_FIRST_LEVEL; if (topPopupOnly) mModule.showPopup(mPopup); } }"
Inversion-Mutation
megadiff
"@Override public synchronized ProcessWrapper launchTranscode( DLNAResource dlna, DLNAMediaInfo media, OutputParams params ) throws IOException { params.minBufferSize = params.minFileSize; params.secondread_minsize = 100000; RendererConfiguration renderer = params.mediaRenderer; String filename = dlna.getSystemName(); setAudioAndSubs(filename, media, params, configuration); File tempSubs = null; if (!isDisableSubtitles(params)) { tempSubs = getSubtitles(dlna, media, params); } // XXX work around an ffmpeg bug: http://ffmpeg.org/trac/ffmpeg/ticket/998 if (filename.startsWith("mms:")) { filename = "mmsh:" + filename.substring(4); } // check if we have modifier for this url String r = replacements.match(filename); if (r != null) { filename = filename.replaceAll(r, replacements.get(r)); LOGGER.debug("modified url: " + filename); } FFmpegOptions customOptions = new FFmpegOptions(); // Gather custom options from various sources in ascending priority: // - automatic options String match = autoOptions.match(filename); if (match != null) { List<String> opts = autoOptions.get(match); if (opts != null) { customOptions.addAll(opts); } } // - (http) header options if (params.header != null && params.header.length > 0) { String hdr = new String(params.header); customOptions.addAll(parseOptions(hdr)); } // - attached options String attached = (String) dlna.getAttachment(ID); if (attached != null) { customOptions.addAll(parseOptions(attached)); } // - renderer options if (StringUtils.isNotEmpty(renderer.getCustomFFmpegOptions())) { customOptions.addAll(parseOptions(renderer.getCustomFFmpegOptions())); } // basename of the named pipe: // ffmpeg -loglevel warning -threads nThreads -i URL -threads nThreads -transcode-video-options /path/to/fifoName String fifoName = String.format( "ffmpegwebvideo_%d_%d", Thread.currentThread().getId(), System.currentTimeMillis() ); // This process wraps the command that creates the named pipe PipeProcess pipe = new PipeProcess(fifoName); pipe.deleteLater(); // delete the named pipe later; harmless if it isn't created ProcessWrapper mkfifo_process = pipe.getPipeProcess(); // Start the process as early as possible mkfifo_process.runInNewThread(); params.input_pipes[0] = pipe; // Build the command line List<String> cmdList = new ArrayList<>(); if (!dlna.isURLResolved()) { URLResult r1 = ExternalFactory.resolveURL(filename); if (r1 != null) { if (r1.precoder != null) { filename = "-"; if (Platform.isWindows()) { cmdList.add("cmd.exe"); cmdList.add("/C"); } cmdList.addAll(r1.precoder); cmdList.add("|"); } else { if (StringUtils.isNotEmpty(r1.url)) { filename = r1.url; } } if (r1.args != null && r1.args.size() > 0) { customOptions.addAll(r1.args); } } } cmdList.add(executable().replace("/", "\\\\")); // XXX squashed bug - without this, ffmpeg hangs waiting for a confirmation // that it can write to a file that already exists i.e. the named pipe cmdList.add("-y"); cmdList.add("-loglevel"); if (LOGGER.isTraceEnabled()) { // Set -loglevel in accordance with LOGGER setting cmdList.add("info"); // Could be changed to "verbose" or "debug" if "info" level is not enough } else { cmdList.add("warning"); } int nThreads = configuration.getNumberOfCpuCores(); // Decoder threads cmdList.add("-threads"); cmdList.add("" + nThreads); // Add global and input-file custom options, if any if (!customOptions.isEmpty()) { customOptions.transferGlobals(cmdList); customOptions.transferInputFileOptions(cmdList); } if (params.timeseek > 0) { cmdList.add("-ss"); cmdList.add("" + params.timeseek); } cmdList.add("-i"); cmdList.add(filename); cmdList.addAll(getVideoFilterOptions(dlna, media, params, tempSubs)); // Encoder threads cmdList.add("-threads"); cmdList.add("" + nThreads); // Add the output options (-f, -c:a, -c:v, etc.) cmdList.addAll(getVideoTranscodeOptions(dlna, media, params)); // Add video bitrate options cmdList.addAll(getVideoBitrateOptions(dlna, media, params)); // Add audio bitrate options cmdList.addAll(getAudioBitrateOptions(dlna, media, params)); // Add any remaining custom options if (!customOptions.isEmpty()) { customOptions.transferAll(cmdList); } // Output file cmdList.add(pipe.getInputPipe()); // Convert the command list to an array String[] cmdArray = new String[cmdList.size()]; cmdList.toArray(cmdArray); // Hook to allow plugins to customize this command line cmdArray = finalizeTranscoderArgs( filename, dlna, media, params, cmdArray ); // Now launch FFmpeg ProcessWrapperImpl pw = new ProcessWrapperImpl(cmdArray, params); pw.attachProcess(mkfifo_process); // Clean up the mkfifo process when the transcode ends // Give the mkfifo process a little time try { Thread.sleep(300); } catch (InterruptedException e) { LOGGER.error("Thread interrupted while waiting for named pipe to be created", e); } // Launch the transcode command... pw.runInNewThread(); // ...and wait briefly to allow it to start try { Thread.sleep(200); } catch (InterruptedException e) { LOGGER.error("Thread interrupted while waiting for transcode to start", e); } return pw; }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "launchTranscode"
"@Override public synchronized ProcessWrapper launchTranscode( DLNAResource dlna, DLNAMediaInfo media, OutputParams params ) throws IOException { params.minBufferSize = params.minFileSize; params.secondread_minsize = 100000; RendererConfiguration renderer = params.mediaRenderer; setAudioAndSubs(filename, media, params, configuration); File tempSubs = null; <MASK>String filename = dlna.getSystemName();</MASK> if (!isDisableSubtitles(params)) { tempSubs = getSubtitles(dlna, media, params); } // XXX work around an ffmpeg bug: http://ffmpeg.org/trac/ffmpeg/ticket/998 if (filename.startsWith("mms:")) { filename = "mmsh:" + filename.substring(4); } // check if we have modifier for this url String r = replacements.match(filename); if (r != null) { filename = filename.replaceAll(r, replacements.get(r)); LOGGER.debug("modified url: " + filename); } FFmpegOptions customOptions = new FFmpegOptions(); // Gather custom options from various sources in ascending priority: // - automatic options String match = autoOptions.match(filename); if (match != null) { List<String> opts = autoOptions.get(match); if (opts != null) { customOptions.addAll(opts); } } // - (http) header options if (params.header != null && params.header.length > 0) { String hdr = new String(params.header); customOptions.addAll(parseOptions(hdr)); } // - attached options String attached = (String) dlna.getAttachment(ID); if (attached != null) { customOptions.addAll(parseOptions(attached)); } // - renderer options if (StringUtils.isNotEmpty(renderer.getCustomFFmpegOptions())) { customOptions.addAll(parseOptions(renderer.getCustomFFmpegOptions())); } // basename of the named pipe: // ffmpeg -loglevel warning -threads nThreads -i URL -threads nThreads -transcode-video-options /path/to/fifoName String fifoName = String.format( "ffmpegwebvideo_%d_%d", Thread.currentThread().getId(), System.currentTimeMillis() ); // This process wraps the command that creates the named pipe PipeProcess pipe = new PipeProcess(fifoName); pipe.deleteLater(); // delete the named pipe later; harmless if it isn't created ProcessWrapper mkfifo_process = pipe.getPipeProcess(); // Start the process as early as possible mkfifo_process.runInNewThread(); params.input_pipes[0] = pipe; // Build the command line List<String> cmdList = new ArrayList<>(); if (!dlna.isURLResolved()) { URLResult r1 = ExternalFactory.resolveURL(filename); if (r1 != null) { if (r1.precoder != null) { filename = "-"; if (Platform.isWindows()) { cmdList.add("cmd.exe"); cmdList.add("/C"); } cmdList.addAll(r1.precoder); cmdList.add("|"); } else { if (StringUtils.isNotEmpty(r1.url)) { filename = r1.url; } } if (r1.args != null && r1.args.size() > 0) { customOptions.addAll(r1.args); } } } cmdList.add(executable().replace("/", "\\\\")); // XXX squashed bug - without this, ffmpeg hangs waiting for a confirmation // that it can write to a file that already exists i.e. the named pipe cmdList.add("-y"); cmdList.add("-loglevel"); if (LOGGER.isTraceEnabled()) { // Set -loglevel in accordance with LOGGER setting cmdList.add("info"); // Could be changed to "verbose" or "debug" if "info" level is not enough } else { cmdList.add("warning"); } int nThreads = configuration.getNumberOfCpuCores(); // Decoder threads cmdList.add("-threads"); cmdList.add("" + nThreads); // Add global and input-file custom options, if any if (!customOptions.isEmpty()) { customOptions.transferGlobals(cmdList); customOptions.transferInputFileOptions(cmdList); } if (params.timeseek > 0) { cmdList.add("-ss"); cmdList.add("" + params.timeseek); } cmdList.add("-i"); cmdList.add(filename); cmdList.addAll(getVideoFilterOptions(dlna, media, params, tempSubs)); // Encoder threads cmdList.add("-threads"); cmdList.add("" + nThreads); // Add the output options (-f, -c:a, -c:v, etc.) cmdList.addAll(getVideoTranscodeOptions(dlna, media, params)); // Add video bitrate options cmdList.addAll(getVideoBitrateOptions(dlna, media, params)); // Add audio bitrate options cmdList.addAll(getAudioBitrateOptions(dlna, media, params)); // Add any remaining custom options if (!customOptions.isEmpty()) { customOptions.transferAll(cmdList); } // Output file cmdList.add(pipe.getInputPipe()); // Convert the command list to an array String[] cmdArray = new String[cmdList.size()]; cmdList.toArray(cmdArray); // Hook to allow plugins to customize this command line cmdArray = finalizeTranscoderArgs( filename, dlna, media, params, cmdArray ); // Now launch FFmpeg ProcessWrapperImpl pw = new ProcessWrapperImpl(cmdArray, params); pw.attachProcess(mkfifo_process); // Clean up the mkfifo process when the transcode ends // Give the mkfifo process a little time try { Thread.sleep(300); } catch (InterruptedException e) { LOGGER.error("Thread interrupted while waiting for named pipe to be created", e); } // Launch the transcode command... pw.runInNewThread(); // ...and wait briefly to allow it to start try { Thread.sleep(200); } catch (InterruptedException e) { LOGGER.error("Thread interrupted while waiting for transcode to start", e); } return pw; }"
Inversion-Mutation
megadiff
"@Override public void actionPerformed(ActionEvent e) { // TODO: abfragen, welche Bits gesetzt sind und ensprechend handeln player = (Player)level.getPlayer(); Vector2d position = player.getPosition(); if(!(direction.getX() == 0 && direction.getY() == 0)){ lastDirection = direction; } direction = new Vector2d(0,0); if (keys.get(100)) {// cheat left player.setPosition(position.addX(-10)); System.out.println("CHEAT LEFT"); } if (keys.get(104)) {// cheat up player.setPosition(position.addY(-10)); System.out.println("CHEAT UP"); } if (keys.get(98)) {// cheat down player.setPosition(position.addY(10)); System.out.println("CHEAT DOWN"); } if (keys.get(102)) {// cheat right player.setPosition(position.addX(10)); System.out.println("CHEAT RIGHT"); } if (keys.get(101)) {// cheat Leben player.setHealth(player.getHealth()+1000); System.out.println("CHEAT Leben"); } if (keys.get(103)) {// position output System.out.println("x= " + player.getPosition().getX() + "y= " + player.getPosition().getY()); } if (keys.get(99)) {// Exit if (level.getExit() != null){ level.getPlayer().setPosition(level.getExit().getPosition().addX(10).addY(60));} System.out.println("CHEAT EXIT"); } if (keys.get(37)) {// left arrow direction = direction.addX(-1); System.out.println("LEFT"); } if (keys.get(38)) {// up arrow direction = direction.addY(-1); System.out.println("UP"); } if (keys.get(39)) {// right arrow direction = direction.addX(1); System.out.println("RIGHT"); } if (keys.get(40)) {// down arrow direction = direction.addY(1); System.out.println("DOWN"); } if (keys.get(83)) { // s keys.clear(); if (level.getPlayer() != null) { if (shop == null) { // initialize shop shop = new DirtyShopSystem((Player)level.getPlayer()); shop.setvermoegen(100); shop.gui(shop.getvermoegen()); } System.out.println("Shop Visable you have " + player.getMoney() + " Geld"); shop.startDirtyShop(); player.setMoney(shop.getvermoegen()); } } if(delay[32] >= 0){ delay[32] -= 1; } if (keys.get(32)){ if (player.hasBow()) { if(delay[32] < 0){ delay[32] = 70; Vector2d pos = new Vector2d(position.add(player.size.mul(0.5)).add(new Vector2d(-5, -5))); if(lastDirection.getX() > 0) pos = pos.add(new Vector2d(player.size.getX()-2,0)); if(lastDirection.getX() < 0) pos = pos.add(new Vector2d(-player.size.getX()+2,0)); if(lastDirection.getY() > 0) pos = pos.add(new Vector2d(0,player.size.getX()-2)); if(lastDirection.getY() < 0) pos = pos.add(new Vector2d(0,-player.size.getX()+2)); Bullet tmp = new Bullet(pos, new Vector2d(10, 10)); tmp.setDirection(lastDirection.mul(3)); level.addGameElement(tmp); } } } if(delay[KeyEvent.VK_Q] >= 0){ delay[KeyEvent.VK_Q] -= 1; } if (keys.get(KeyEvent.VK_Q)){ if(delay[KeyEvent.VK_Q] < 0 && player.reduceMana(8, this)){ delay[KeyEvent.VK_Q] = 70; Vector2d pos = new Vector2d(position.add(player.size.mul(0.5)).add(new Vector2d(-5, -5))); if(lastDirection.getX() > 0) pos = pos.add(new Vector2d(player.size.getX()-2,0)); if(lastDirection.getX() < 0) pos = pos.add(new Vector2d(-player.size.getX()+2,0)); if(lastDirection.getY() > 0) pos = pos.add(new Vector2d(0,player.size.getX()-2)); if(lastDirection.getY() < 0) pos = pos.add(new Vector2d(0,-player.size.getX()+2)); Spell tmp = new Spell(pos, new Vector2d(10, 10)); tmp.setDirection(lastDirection.mul(2)); level.addGameElement(tmp); } } if(!keys.isEmpty()) moveElement(player, direction); if (((Player) player).getHealth()<=0){ app.cp.removeAll(); app.cp.validate(); app.gameContent = new GameContent(); app.loader = new LevelLoader(app.gameContent, app); this.timer.stop(); app.startMainMenu(); } if (e.getActionCommand() == "Timer"){ GameElement tmpRem = null; for(GameElement element : level.getGameElements()){ GameEvent event = new GameEvent(null, EventType.TIMER, this); element.GameEventPerformed(event); if(element.size.getX() == 0 || element.size.getY() == 0){ tmpRem = element; } } if (tmpRem != null) { level.removeElement(tmpRem); } app.camera.repaint(); } }"
You are a Java Developer and you want to perform "Inversion-Mutation" by changing order of statementsfor provided "actionPerformed"
"@Override public void actionPerformed(ActionEvent e) { // TODO: abfragen, welche Bits gesetzt sind und ensprechend handeln player = (Player)level.getPlayer(); Vector2d position = player.getPosition(); if(!(direction.getX() == 0 && direction.getY() == 0)){ lastDirection = direction; <MASK>}</MASK> direction = new Vector2d(0,0); if (keys.get(100)) {// cheat left player.setPosition(position.addX(-10)); System.out.println("CHEAT LEFT"); <MASK>}</MASK> if (keys.get(104)) {// cheat up player.setPosition(position.addY(-10)); System.out.println("CHEAT UP"); <MASK>}</MASK> if (keys.get(98)) {// cheat down player.setPosition(position.addY(10)); System.out.println("CHEAT DOWN"); <MASK>}</MASK> if (keys.get(102)) {// cheat right player.setPosition(position.addX(10)); System.out.println("CHEAT RIGHT"); <MASK>}</MASK> if (keys.get(101)) {// cheat Leben player.setHealth(player.getHealth()+1000); System.out.println("CHEAT Leben"); <MASK>}</MASK> if (keys.get(103)) {// position output System.out.println("x= " + player.getPosition().getX() + "y= " + player.getPosition().getY()); <MASK>}</MASK> if (keys.get(99)) {// Exit if (level.getExit() != null){ level.getPlayer().setPosition(level.getExit().getPosition().addX(10).addY(60));<MASK>}</MASK> System.out.println("CHEAT EXIT"); <MASK>}</MASK> if (keys.get(37)) {// left arrow direction = direction.addX(-1); System.out.println("LEFT"); <MASK>}</MASK> if (keys.get(38)) {// up arrow direction = direction.addY(-1); System.out.println("UP"); <MASK>}</MASK> if (keys.get(39)) {// right arrow direction = direction.addX(1); System.out.println("RIGHT"); <MASK>}</MASK> if (keys.get(40)) {// down arrow direction = direction.addY(1); System.out.println("DOWN"); <MASK>}</MASK> if (keys.get(83)) { // s keys.clear(); if (level.getPlayer() != null) { if (shop == null) { // initialize shop shop = new DirtyShopSystem((Player)level.getPlayer()); shop.setvermoegen(100); shop.gui(shop.getvermoegen()); <MASK>}</MASK> System.out.println("Shop Visable you have " + player.getMoney() + " Geld"); shop.startDirtyShop(); player.setMoney(shop.getvermoegen()); <MASK>}</MASK> <MASK>}</MASK> if(delay[32] >= 0){ delay[32] -= 1; <MASK>}</MASK> if (keys.get(32)){ if (player.hasBow()) { if(delay[32] < 0){ delay[32] = 70; <MASK>}</MASK> Vector2d pos = new Vector2d(position.add(player.size.mul(0.5)).add(new Vector2d(-5, -5))); if(lastDirection.getX() > 0) pos = pos.add(new Vector2d(player.size.getX()-2,0)); if(lastDirection.getX() < 0) pos = pos.add(new Vector2d(-player.size.getX()+2,0)); if(lastDirection.getY() > 0) pos = pos.add(new Vector2d(0,player.size.getX()-2)); if(lastDirection.getY() < 0) pos = pos.add(new Vector2d(0,-player.size.getX()+2)); Bullet tmp = new Bullet(pos, new Vector2d(10, 10)); tmp.setDirection(lastDirection.mul(3)); level.addGameElement(tmp); <MASK>}</MASK> <MASK>}</MASK> if(delay[KeyEvent.VK_Q] >= 0){ delay[KeyEvent.VK_Q] -= 1; <MASK>}</MASK> if (keys.get(KeyEvent.VK_Q)){ if(delay[KeyEvent.VK_Q] < 0 && player.reduceMana(8, this)){ delay[KeyEvent.VK_Q] = 70; Vector2d pos = new Vector2d(position.add(player.size.mul(0.5)).add(new Vector2d(-5, -5))); if(lastDirection.getX() > 0) pos = pos.add(new Vector2d(player.size.getX()-2,0)); if(lastDirection.getX() < 0) pos = pos.add(new Vector2d(-player.size.getX()+2,0)); if(lastDirection.getY() > 0) pos = pos.add(new Vector2d(0,player.size.getX()-2)); if(lastDirection.getY() < 0) pos = pos.add(new Vector2d(0,-player.size.getX()+2)); Spell tmp = new Spell(pos, new Vector2d(10, 10)); tmp.setDirection(lastDirection.mul(2)); level.addGameElement(tmp); <MASK>}</MASK> <MASK>}</MASK> if(!keys.isEmpty()) moveElement(player, direction); if (((Player) player).getHealth()<=0){ app.cp.removeAll(); app.cp.validate(); app.gameContent = new GameContent(); app.loader = new LevelLoader(app.gameContent, app); this.timer.stop(); app.startMainMenu(); <MASK>}</MASK> if (e.getActionCommand() == "Timer"){ GameElement tmpRem = null; for(GameElement element : level.getGameElements()){ GameEvent event = new GameEvent(null, EventType.TIMER, this); element.GameEventPerformed(event); if(element.size.getX() == 0 || element.size.getY() == 0){ tmpRem = element; <MASK>}</MASK> <MASK>}</MASK> if (tmpRem != null) { level.removeElement(tmpRem); <MASK>}</MASK> app.camera.repaint(); <MASK>}</MASK> <MASK>}</MASK>"