auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shouldUnRetireAPatientIdentifierType() throws Exception { PatientIdentifierType patientIdentifierType = service.getPatientIdentifierTypeByUuid(getUuid()); patientIdentifierType.setRetired(true); patientIdentifierType.setRetireReason("random reason"); patientIdentifierType = service.savePatientIdentifierType(patientIdentifierType); assertTrue(patientIdentifierType.isRetired()); String json = "{\"deleted\": \"false\"}"; SimpleObject response = deserialize(handle(newPostRequest(getURI() + "/" + getUuid(), json))); patientIdentifierType = service.getPatientIdentifierTypeByUuid(getUuid()); assertFalse(patientIdentifierType.isRetired()); assertEquals("false", PropertyUtils.getProperty(response, "retired").toString()); }

Target:
public void shouldUnRetireAPatientIdentifierType() throws Exception { PatientIdentifierType patientIdentifierType = service.getPatientIdentifierTypeByUuid(getUuid()); patientIdentifierType.setRetired(true); patientIdentifierType.setRetireReason("random reason"); service.savePatientIdentifierType(patientIdentifierType); patientIdentifierType = service.getPatientIdentifierTypeByUuid(getUuid()); assertTrue(patientIdentifierType.isRetired()); String json = "{\"deleted\": \"false\"}"; SimpleObject response = deserialize(handle(newPostRequest(getURI() + "/" + getUuid(), json))); patientIdentifierType = service.getPatientIdentifierTypeByUuid(getUuid()); assertFalse(patientIdentifierType.isRetired()); assertEquals("false", PropertyUtils.getProperty(response, "retired").toString()); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final PublishedMessageTrace other = (PublishedMessageTrace) obj; return Objects.equals(this.messageId, other.messageId) && Objects.equals(this.timestamp, other.timestamp) && Objects.equals(this.status, other.status) && Objects.equals(this.topicName, other.topicName) && Objects.equals(this.reason, other.reason) && Objects.equals(this.message, other.message) && Objects.equals(this.cluster, other.cluster); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final PublishedMessageTrace other = (PublishedMessageTrace) obj; return Objects.equals(this.messageId, other.messageId); }
Source:
public FeedbackResponseCommentAttributes createEntity(EntityAttributes entityToAdd) throws InvalidParametersException, EntityAlreadyExistsException { FeedbackResponseComment createdEntity = (FeedbackResponseComment) super.createEntity(entityToAdd); if (createdEntity == null || JDOHelper.isDeleted(createdEntity)) { log.info("Trying to get non-existent FeedbackResponseComment, possibly entity not persistent yet."); return null; } else { FeedbackResponseCommentAttributes createdComment = new FeedbackResponseCommentAttributes(createdEntity); return createdComment; } }

Target:
public FeedbackResponseCommentAttributes createEntity(EntityAttributes entityToAdd) throws InvalidParametersException, EntityAlreadyExistsException { FeedbackResponseComment createdEntity = (FeedbackResponseComment) super.createEntity(entityToAdd); if (createdEntity == null) { log.info("Trying to get non-existent FeedbackResponseComment, possibly entity not persistent yet."); return null; } else { FeedbackResponseCommentAttributes createdComment = new FeedbackResponseCommentAttributes(createdEntity); return createdComment; } }
Source:
public void gc(long trimMark) { Timer vloGcTimer = VloMetricsParams.metrics.timer(VloMetricsParams.VLO_GC); Timer.Context vloGcDuration = MetricsUtils.getConditionalContext(vloGcTimer); long ts = lock.writeLock(); try { pendingUpcalls.removeIf(e -> e < trimMark); upcallResults.entrySet().removeIf(e -> e.getKey() < trimMark); smrStream.gc(trimMark); } finally { lock.unlock(ts); if (vloGcDuration != null) { vloGcDuration.stop(); } } }

Target:
public void gc(long trimMark) { long ts = 0; try (Timer.Context vloGcDuration = VloMetricsHelper.getVloGcContext()) { ts = lock.writeLock(); pendingUpcalls.removeIf(e -> e < trimMark); upcallResults.entrySet().removeIf(e -> e.getKey() < trimMark); smrStream.gc(trimMark); } finally { lock.unlock(ts); } }
Source:
public UomCombo getLineUomCombo(StrokeUom input){ strokeUoms = getUomProperties(); UomCombo puc = new UomCombo(input.getStrokeUom(), strokeUoms, I18N.tr(UNIT_OF_MEASURE + " - stroke width :")); ActionListener acl2 = EventHandler.create(ActionListener.class, this, "updateLUComboBox", "source.selectedIndex"); puc.addActionListener(acl2); return puc; }

Target:
public UomCombo getLineUomCombo(StrokeUom input){ strokeUoms = getUomProperties(); UomCombo puc = new UomCombo(input.getStrokeUom(), strokeUoms, I18N.tr("Line width unit")); ActionListener acl2 = EventHandler.create(ActionListener.class, this, "updateLUComboBox", "source.selectedIndex"); puc.addActionListener(acl2); return puc; }
Source:
private CompositeJobParametersValidator compositeJobParametersValidator(JobParameters jobParameters) { List<JobParametersValidator> jobParametersValidators = new ArrayList<>(); jobParametersValidators.add(new CreateDatabaseIndexesStepParametersValidator()); jobParametersValidators.add(new LoadGenesStepParametersValidator()); CompositeJobParametersValidator compositeJobParametersValidator = new CompositeJobParametersValidator(); compositeJobParametersValidator.setValidators(jobParametersValidators); return compositeJobParametersValidator; }

Target:
private CompositeJobParametersValidator compositeJobParametersValidator(JobParameters jobParameters) { List<JobParametersValidator> jobParametersValidators = new ArrayList<>(); jobParametersValidators.add(new CreateDatabaseIndexesStepParametersValidator()); jobParametersValidators.add(new LoadFeatureCoordinatesStepParameteresValidator()); CompositeJobParametersValidator compositeJobParametersValidator = new CompositeJobParametersValidator(); compositeJobParametersValidator.setValidators(jobParametersValidators); return compositeJobParametersValidator; }
Source:
public static int compareRanges(byte[] left, int leftOffset, int leftLength, byte[] right, int rightOffset, int rightLength) { int minLength = min(leftLength, rightLength); long i = 0; if (minLength >= SIZE_OF_LONG) { while (i < minLength) { long leftLong = unsafe.getLong(left, ARRAY_BYTE_BASE_OFFSET + leftOffset + i); long rightLong = unsafe.getLong(right, ARRAY_BYTE_BASE_OFFSET + rightOffset + i); if (leftLong != rightLong) { return longBytesToLong(leftLong) < longBytesToLong(rightLong) ? -1 : 1; } i += SIZE_OF_LONG; } i -= SIZE_OF_LONG; } while (i < minLength) { int leftInt = unsignedByteToInt(unsafe.getByte(left, ARRAY_BYTE_BASE_OFFSET + leftOffset + i)); int rightInt = unsignedByteToInt(unsafe.getByte(right, ARRAY_BYTE_BASE_OFFSET + rightOffset + i)); if (leftInt != rightInt) { return leftInt - rightInt; } i++; } return Integer.compare(leftLength, rightLength); }

Target:
public static int compareRanges(byte[] left, int leftOffset, int leftLength, byte[] right, int rightOffset, int rightLength) { int minLength = min(leftLength, rightLength); int i = 0; if (minLength >= SIZE_OF_LONG) { while (i < minLength) { long leftLong = unsafe.getLong(left, (long) ARRAY_BYTE_BASE_OFFSET + leftOffset + i); long rightLong = unsafe.getLong(right, (long) ARRAY_BYTE_BASE_OFFSET + rightOffset + i); if (leftLong != rightLong) { return longBytesToLong(leftLong) < longBytesToLong(rightLong) ? -1 : 1; } i += SIZE_OF_LONG; } i -= SIZE_OF_LONG; } while (i < minLength) { int leftByte = Byte.toUnsignedInt(left[leftOffset + i]); int rightByte = Byte.toUnsignedInt(right[rightOffset + i]); if (leftByte != rightByte) { return leftByte - rightByte; } i++; } return Integer.compare(leftLength, rightLength); }
Source:
public ScriptBuilder bigNum(int index, long num) { final byte[] data; if (num == 0) { data = new byte[0]; } else { Stack<Byte> result = new Stack<Byte>(); final boolean neg = num < 0; long absvalue = Math.abs(num); while (absvalue != 0) { result.push((byte) (absvalue & 0xff)); absvalue >>= 8; } if ((result.peek().byteValue() & 0x80) != 0) result.push((byte) (neg ? 0x80 : 0)); else if (neg) { result.push((byte) (result.pop() | 0x80)); } data = new byte[result.size()]; for (int byteIdx = 0; byteIdx < data.length; byteIdx++) { data[byteIdx] = result.get(byteIdx); } } int opcode; if (data.length < OP_PUSHDATA1) { opcode = data.length; } else if (data.length < 256) { opcode = OP_PUSHDATA1; } else if (data.length < 65536) { opcode = OP_PUSHDATA2; } else { throw new RuntimeException("Unimplemented"); } return addChunk(index, new ScriptChunk(opcode, data)); }

Target:
protected ScriptBuilder bigNum(int index, long num) { final byte[] data; if (num == 0) { data = new byte[0]; } else { Stack<Byte> result = new Stack<Byte>(); final boolean neg = num < 0; long absvalue = Math.abs(num); while (absvalue != 0) { result.push((byte) (absvalue & 0xff)); absvalue >>= 8; } if ((result.peek() & 0x80) != 0) { result.push((byte) (neg ? 0x80 : 0)); } else if (neg) { result.push((byte) (result.pop() | 0x80)); } data = new byte[result.size()]; for (int byteIdx = 0; byteIdx < data.length; byteIdx++) { data[byteIdx] = result.get(byteIdx); } } return addChunk(index, new ScriptChunk(data.length, data)); }
Source:
public List<String> getMetadataDatasourceIds() { List<String> metadataIds = new ArrayList<String>(); Set<String> domainIds = metadataDomainRepository.getDomainIds(); List<String> domainsIdArr = new ArrayList<>( domainIds ); for ( String id : domainsIdArr ) { if ( isMetadataDatasource( id ) ) { metadataIds.add( id ); } } return metadataIds; }

Target:
public List<String> getMetadataDatasourceIds() { List<String> metadataIds = new ArrayList<String>(); for ( String id : metadataDomainRepository.getDomainIds() ) { if ( isMetadataDatasource( id ) ) { metadataIds.add( id ); } } return metadataIds; }
Source:
public void processTemplate(final Object obj, final String templateName, final OutputStream outputStream) throws IOException { final Template template = config.getTemplate(templateName); final Writer writer = new OutputStreamWriter(outputStream); try { template.process(obj, writer); } catch (final NullPointerException e) { LOG.error("Encountered NullPointerException while processing template " + templateName, e); } catch (final TemplateException e) { LOG.error("Encountered TemplateException while processing template " + templateName, e); } }

Target:
public void processTemplate(final Object obj, final String templateName, final OutputStream outputStream) throws IOException { final Template template = config.getTemplate(templateName); final Writer writer = new OutputStreamWriter(outputStream); try { template.process(obj, writer); } catch (final NullPointerException | TemplateException e) { LOG.error("Unable to process template " + templateName, e); } }
Source:
public void run(Timeout timeout) { DefaultFuture future = FUTURES.remove(requestID); if (future.isDone()) { return; } Response timeoutResponse = new Response(future.getId()); timeoutResponse.setStatus(future.isSent() ? Response.SERVER_TIMEOUT : Response.CLIENT_TIMEOUT); timeoutResponse.setErrorMessage(future.getTimeoutMessage(true)); DefaultFuture.received(future.getChannel(), timeoutResponse, true); }

Target:
public void run(Timeout timeout) { DefaultFuture future = DefaultFuture.getFuture(requestID); if (future == null || future.isDone()) { return; } Response timeoutResponse = new Response(future.getId()); timeoutResponse.setStatus(future.isSent() ? Response.SERVER_TIMEOUT : Response.CLIENT_TIMEOUT); timeoutResponse.setErrorMessage(future.getTimeoutMessage(true)); DefaultFuture.received(future.getChannel(), timeoutResponse, true); }
Source:
public void addTask(Task task) { if (task == null) { throw new IllegalArgumentException("task not valid"); } if (tasks == null) { tasks = new HashSet<>(); } tasks.add(task); }

Target:
public void addTask(Task task) { if (task == null) { throw new IllegalArgumentException("task not valid"); } if (tasks == null) { tasks = new HashSet<>(); } task.setOrganization(this); tasks.add(task); }
Source:
public void randomTick(WorldServer worldServer, Random rand) { this.updateLCG = this.updateLCG * 3 + 1013904223; int j1 = updateLCG >> 2; int localX = j1 & 15; int localY = j1 >> 8 & 15; int localZ = j1 >> 16 & 15; IBlockState iblockstate = this.storage.get(localX, localY, localZ); Block block = iblockstate.getBlock(); if (block.getTickRandomly()) { BlockPos pos = new BlockPos(this.coords.getMinBlockX() + localX, this.coords.getMinBlockY() + localY, this.coords.getMinBlockZ() + localZ); block.randomTick(worldServer, pos, iblockstate, rand); } }

Target:
public void randomTick(WorldServer worldServer, Random rand) { this.updateLCG = this.updateLCG * 3 + 1013904223; int j1 = updateLCG >> 2; int localX = AddressTools.getLocalX(j1); int localY = AddressTools.getLocalY(j1); int localZ = AddressTools.getLocalZ(j1); IBlockState iblockstate = this.storage.get(localX, localY, localZ); Block block = iblockstate.getBlock(); if (block.getTickRandomly()) { BlockPos pos = new BlockPos(this.coords.getMinBlockX() + localX, this.coords.getMinBlockY() + localY, this.coords.getMinBlockZ() + localZ); block.randomTick(worldServer, pos, iblockstate, rand); } }
Source:
protected void onStart() { super.onStart(); isActivityStarted = true; PrefManager pmFeatures = new PrefManager(this, PrefManager.Pref.FEATURES); boolean enableSocialFeatures = NetworkUtil.isSocialFeatureFlagEnabled(this, environment.getConfig()); pmFeatures.put(PrefManager.Key.ALLOW_SOCIAL_FEATURES, enableSocialFeatures); if (runOnTick && progressMenuItem != null) { handler.sendEmptyMessage(MSG_TYPE_TICK); } ActionBar bar = getActionBar(); if (bar != null) { bar.setDisplayHomeAsUpEnabled(true); bar.setHomeButtonEnabled(true); bar.setIcon(android.R.color.transparent); if (isLandscape()) { bar.hide(); }else{ bar.show(); } } }

Target:
protected void onStart() { super.onStart(); isActivityStarted = true; PrefManager pmFeatures = new PrefManager(this, PrefManager.Pref.FEATURES); boolean enableSocialFeatures = NetworkUtil.isSocialFeatureFlagEnabled(this, environment.getConfig()); pmFeatures.put(PrefManager.Key.ALLOW_SOCIAL_FEATURES, enableSocialFeatures); if (runOnTick) { handler.sendEmptyMessage(MSG_TYPE_TICK); } ActionBar bar = getActionBar(); if (bar != null) { bar.setDisplayHomeAsUpEnabled(true); bar.setHomeButtonEnabled(true); bar.setIcon(android.R.color.transparent); if (isLandscape()) { bar.hide(); }else{ bar.show(); } } }
Source:
public CommandContext resetExecutionContext() { setExecutionContext(new ExecutionContext()); return this; }

Target:
public CommandContext resetExecutionContext() { return setExecutionContext(new ExecutionContext()); }
Source:
public void clearTempDir() { Util.recursiveFileRemove(tmpDirectory); }

Target:
public void clearTempDir() { if (tmpDirectory != null) { Util.recursiveFileRemove(tmpDirectory); } }
Source:
public MethodDeclarationTree fetchConstructor() { MethodDeclarationTree PHP5 = null; MethodDeclarationTree beforPHP5 = null; for (ClassMemberTree member : members) { if (member.is(Kind.METHOD_DECLARATION)) { String methodName = ((MethodDeclarationTree) member).name().text(); if (name.text().equals(methodName)) { beforPHP5 = (MethodDeclarationTree) member; } else if (PHP5_CONSTRUCTOR_NAME.equals(methodName)) { PHP5 = (MethodDeclarationTree) member; } } } return PHP5 != null ? PHP5 : beforPHP5; }

Target:
public MethodDeclarationTree fetchConstructor() { MethodDeclarationTree oldStyleConstructor = null; MethodDeclarationTree newStyleConstructor = null; for (ClassMemberTree member : members) { if (member.is(Kind.METHOD_DECLARATION)) { MethodDeclarationTree method = (MethodDeclarationTree) member; String methodName = method.name().text(); if (name.text().equalsIgnoreCase(methodName)) { oldStyleConstructor = method; } else if (PHP5_CONSTRUCTOR_NAME.equalsIgnoreCase(methodName)) { newStyleConstructor = method; } } } return newStyleConstructor != null ? newStyleConstructor : oldStyleConstructor; }
Source:
public void init() throws IOException { if (!slowlogTableEnabled) { LOG.info("SlowLogTable is not enabled. Quitting."); return; } if (!MetaTableAccessor.tableExists(masterServices.getConnection(), TableName.SLOW_LOG_TABLE_NAME)) { LOG.info("slowlog table not found. Creating."); this.masterServices.createSystemTable(TABLE_DESCRIPTOR_BUILDER.build()); } }

Target:
public void init() throws IOException { if (!slowlogTableEnabled) { LOG.info("Slow/Large requests logging to system table hbase:slowlog is disabled. Quitting."); return; } if (!MetaTableAccessor.tableExists(masterServices.getConnection(), SlowLogTableAccessor.SLOW_LOG_TABLE_NAME)) { LOG.info("slowlog table not found. Creating."); this.masterServices.createSystemTable(TABLE_DESCRIPTOR_BUILDER.build()); } }
Source:
void updateModel(final OperationContext context, ModelNode model, AttributeDefinition attributeDefinition, ModelNode attribute) throws OperationFailedException { String key = KEY.resolveModelAttribute(context, model).asString(); attribute.remove(key); if(attribute.asPropertyList().isEmpty()){ attribute.set(UNDEFINED); } }

Target:
void updateModel(final OperationContext context, ModelNode model, AttributeDefinition attributeDefinition, ModelNode attribute) throws OperationFailedException { String key = KEY.resolveModelAttribute(context, model).asString(); attribute.remove(key); if(attribute.asList().isEmpty()){ attribute.clear(); } }
Source:
public void testNewQuestionFrame() { ______TS("MCQ: new question (frame) link"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MCQ"); assertTrue(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); ______TS("MCQ: Check UI after cancelling and add new MCQ question again"); feedbackEditPage.clickGenerateMcqOptionsCheckbox(-QUESTION_INDEX_ONE); assertFalse(feedbackEditPage.isElementVisible("mcqChoiceTable--1")); feedbackEditPage.clickDiscardChangesLinkForNewQuestion(); feedbackEditPage.waitForConfirmationModalAndClickOk(); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MCQ"); assertTrue(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); assertFalse(feedbackEditPage.isElementVisible("mcqChoiceTable--1")); assertTrue(feedbackEditPage.isElementEnabled("mcqGenerateForSelect--1")); feedbackEditPage.clickGenerateMcqOptionsCheckbox(-QUESTION_INDEX_ONE); }

Target:
public void testNewQuestionFrame() { ______TS("MCQ: new question (frame) link"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MCQ"); assertTrue(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); ______TS("MCQ: Check UI after cancelling and add new MCQ question again"); feedbackEditPage.clickGenerateMcqOptionsCheckbox(NEW_QUESTION_INDEX); assertFalse(feedbackEditPage.isElementVisible("mcqChoiceTable--1")); feedbackEditPage.clickDiscardChangesLinkForNewQuestion(); feedbackEditPage.waitForConfirmationModalAndClickOk(); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MCQ"); assertTrue(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); assertFalse(feedbackEditPage.isElementVisible("mcqChoiceTable--1")); assertTrue(feedbackEditPage.isElementEnabled("mcqGenerateForSelect--1")); feedbackEditPage.clickGenerateMcqOptionsCheckbox(NEW_QUESTION_INDEX); }
Source:
public static void unregisterMBean(ObjectName objectName, MBeanServer mBeanServer) throws Exception { if (objectName != null && mBeanServer.isRegistered(objectName)) { SecurityActions.unregisterMBean(objectName, mBeanServer); log.tracef("Unregistered %s", objectName); } }

Target:
public static void unregisterMBean(ObjectName objectName, MBeanServer mBeanServer) throws Exception { if (mBeanServer.isRegistered(objectName)) { SecurityActions.unregisterMBean(objectName, mBeanServer); log.tracef("Unregistered %s", objectName); } }
Source:
private boolean dropPartitions(PartitionDesc partDesc, List<Partition> partitions) throws HiveException { if (partitions == null) { return true; } for (Partition partition : partitions) { if (Hive.get().dropPartition(Conduit.getHcatDBName(), partDesc.getTableName(), partition.getValues(), true)) { LOG.info("partition " + partDesc.getLocation() + " dropped" + " successfully from " + partDesc.getTableName() + " table"); } else { LOG.warn("Not able to drop the partition " + partDesc.getLocation() + "from " + partDesc.getTableName() + " table"); return false; } } return true; }

Target:
private boolean dropPartitions(PartitionDesc partDesc, List<Partition> partitions) throws HiveException { if (partitions == null) { return true; } for (Partition partition : partitions) { if (Hive.get().dropPartition(Conduit.getHcatDBName(), partDesc.getTableName(), partition.getValues(), true)) { LOG.debug("partition " + partition.getLocation() + " dropped" + " successfully from " + partDesc.getTableName() + " table"); } else { LOG.warn("Not able to drop the partition " + partDesc.getLocation() + "from " + partDesc.getTableName() + " table"); return false; } } return true; }
Source:
public final void call(final Subscriber<? super T> subscriber) { state = generateState(); final SyncOnSubscribe<S, T> self = this; final Subscription s = Subscriptions.create(new Action0() { @Override public void call() { self.onUnsubscribe(state); } }); subscriber.add(s); Action1<Subscriber<? super T>> onNext = new Action1<Subscriber<? super T>>() { @Override public void call(Subscriber<? super T> subscriber) { state = next(state, subscriber); } }; subscriber.setProducer(new SubscriptionProducer<T>(subscriber, onNext)); }

Target:
public final void call(final Subscriber<? super T> subscriber) { S state = generateState(); SubscriptionProducer<S, T> p = new SubscriptionProducer<S, T>(subscriber, this, state); subscriber.add(p); subscriber.setProducer(p); }
Source:
void checkMismatch(Object expectedReceiver, List<String> expectedMethodNames) { String expectedMethodName = expectedMethodNames.get(0); if (expectedReceiver instanceof MetaClass && expectedMethodName.equals("invokeMethod")) { return; } if (expectedReceiver instanceof GroovyObject) { Object propVal = ((GroovyObject) expectedReceiver).getMetaClass().getProperty(expectedReceiver, expectedMethodName); if (propVal instanceof Closure) { return; } } if (expectedReceiver instanceof Map && ((Map) expectedReceiver).containsKey(expectedMethodName)) { Object mapVal = ((Map) expectedReceiver).get(expectedMethodName); if (mapVal instanceof Closure) { return; } } if(methodName.equals("methodMissing")){ return; } if (!expectedMethodNames.contains(methodName)) { MismatchHandler handler = handlers.get(); if (handler != null) { handler.handle(expectedReceiver, expectedMethodName, receiver, methodName); } } }

Target:
void checkMismatch(Object expectedReceiver, List<String> expectedMethodNames) { String expectedMethodName = expectedMethodNames.get(0); if (expectedReceiver instanceof MetaClass && expectedMethodName.equals("invokeMethod")) { return; } if ("call".equals(methodName) && !expectedMethodNames.contains(methodName)) { if (expectedReceiver instanceof GroovyObject) { try { Object propVal = ((GroovyObject) expectedReceiver).getMetaClass().getProperty(expectedReceiver, expectedMethodName); if (propVal instanceof Closure) { return; } } catch (MissingPropertyException mpe) { } } if (expectedReceiver instanceof Map && ((Map) expectedReceiver).containsKey(expectedMethodName)) { Object mapVal = ((Map) expectedReceiver).get(expectedMethodName); if (mapVal instanceof Closure) { return; } } } if(methodName.equals("methodMissing")){ return; } if (!expectedMethodNames.contains(methodName)) { MismatchHandler handler = handlers.get(); if (handler != null) { handler.handle(expectedReceiver, expectedMethodName, receiver, methodName); } } }
Source:
public SetupNetworksBondModel(boolean doesBondHaveVmNetworkAttached) { setBond(new SortedListModel<>(new LexoNumericComparator())); setBondingOptions(new ListModel<Map.Entry<String, EntityModel<String>>>()); Map.Entry<String, EntityModel<String>> defaultItem = null; RefObject<Map.Entry<String, EntityModel<String>>> tempRef_defaultItem = new RefObject<>(defaultItem); ArrayList<Map.Entry<String, EntityModel<String>>> list = AsyncDataProvider.getInstance().getBondingOptionListDependingOnNetwork(tempRef_defaultItem, doesBondHaveVmNetworkAttached); defaultItem = tempRef_defaultItem.argvalue; getBondingOptions().setItems(list); getBondingOptions().setSelectedItem(defaultItem); setCustomBondEditor(new EntityModel<String>()); getCustomBondEditor().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { final String customBondValue = ((EntityModel<String>) sender).getEntity(); Map.Entry<String, EntityModel<String>> selectedItem = getBondingOptions().getSelectedItem(); if (selectedItem.getKey().equals(CUSTOM_BONDING_MODE)) { selectedItem.getValue().setEntity(customBondValue); } } }); onBondingOptionsSelectionChange(); getBondingOptions().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { ListModel<Map.Entry<String, EntityModel<String>>> list = (ListModel<Map.Entry<String, EntityModel<String>>>) sender; onBondingOptionsSelectionChange(); } }); }

Target:
public SetupNetworksBondModel(boolean doesBondHaveVmNetworkAttached) { setBond(new SortedListModel<>(new LexoNumericComparator())); setBondingOptions(new ListModel<Map.Entry<String, EntityModel<String>>>()); Map.Entry<String, EntityModel<String>> defaultItem = null; RefObject<Map.Entry<String, EntityModel<String>>> tempRef_defaultItem = new RefObject<>(defaultItem); ArrayList<Map.Entry<String, EntityModel<String>>> list = AsyncDataProvider.getInstance().getBondingOptionListDependingOnNetwork(tempRef_defaultItem, doesBondHaveVmNetworkAttached); defaultItem = tempRef_defaultItem.argvalue; getBondingOptions().setItems(list); getBondingOptions().setSelectedItem(defaultItem); setCustomBondEditor(new EntityModel<String>()); getCustomBondEditor().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { final String customBondValue = ((EntityModel<String>) sender).getEntity(); Map.Entry<String, EntityModel<String>> selectedItem = getBondingOptions().getSelectedItem(); if (selectedItem.getKey().equals(CUSTOM_BONDING_MODE)) { selectedItem.getValue().setEntity(customBondValue); } } }); onBondingOptionsSelectionChange(); getBondingOptions().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { onBondingOptionsSelectionChange(); } }); }
Source:
private synchronized Map<ArchitectureType, Map<Version, Boolean>> getMap(ArchCapabilitiesVerb archCapabilitiesVerb) { if (archCapabilitiesVerb == null) { return null; } if (verbMap.containsKey(archCapabilitiesVerb)) { return verbMap.get(archCapabilitiesVerb); } else { Map<ArchitectureType, Map<Version, Boolean>> supportMap = new EnumMap<ArchitectureType, Map<Version, Boolean>>(ArchitectureType.class); for (ArchitectureType arch : ArchitectureType.values()) { Map<Version, Boolean> archMap = new HashMap<Version, Boolean>(); for (Version version : Version.ALL) { archMap.put(version, isSupported(archCapabilitiesVerb, arch, version)); } supportMap.put(arch, archMap); } verbMap.put(archCapabilitiesVerb, supportMap); return supportMap; } }

Target:
private static Map<ArchitectureType, Map<Version, Boolean>> getMap(ArchCapabilitiesVerb archCapabilitiesVerb) { if (archCapabilitiesVerb == null) { return null; } Map<ArchitectureType, Map<Version, Boolean>> supportMap = new EnumMap<ArchitectureType, Map<Version, Boolean>>(ArchitectureType.class); for (ArchitectureType arch : ArchitectureType.values()) { Map<Version, Boolean> archMap = new HashMap<Version, Boolean>(); for (Version version : Version.ALL) { archMap.put(version, isSupported(archCapabilitiesVerb, arch, version)); } supportMap.put(arch, archMap); } return supportMap; }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } XmlEntry other = (XmlEntry) obj; if (fBaseQuark != other.fBaseQuark) { return false; } if (fDisplayQuark != other.fDisplayQuark) { return false; } if (fElement == null) { if (other.fElement != null) { return false; } } else if (fElement != null && !fElement.equals(other.fElement)) { return false; } if (fId == null) { if (other.fId != null) { return false; } } else if (!fId.equals(other.fId)) { return false; } if (fParentId == null) { if (other.fParentId != null) { return false; } } else if (!fParentId.equals(other.fParentId)) { return false; } if (!fSs.equals(other.fSs)) { return false; } if (!fTrace.equals(other.fTrace)) { return false; } if (fType != other.fType) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } XmlEntry other = (XmlEntry) obj; if (fBaseQuark != other.fBaseQuark) { return false; } if (fDisplayQuark != other.fDisplayQuark) { return false; } if (!Objects.equals(fElement, other.fElement)) { return false; } if (!Objects.equals(fId, other.fId)) { return false; } if (!Objects.equals(fParentId, other.fParentId)) { return false; } if (!fSs.equals(other.fSs)) { return false; } if (!fTrace.equals(other.fTrace)) { return false; } if (!Objects.equals(fType, other.fType)) { return false; } return true; }
Source:
public void indexed() { realm.beginTransaction(); MutableRealmIntegerTypes c1 = realm.createObject(MutableRealmIntegerTypes.class); realm.commitTransaction(); Table table = realm.getTable(MutableRealmIntegerTypes.class); assertTrue(table.hasSearchIndex(table.getColumnIndex(MutableRealmIntegerTypes.FIELD_INDEXED_MUTABLEREALMINTEGER))); assertFalse(table.hasSearchIndex(table.getColumnIndex(MutableRealmIntegerTypes.FIELD_NULLABLE_MUTABLEEALMINTEGER))); }

Target:
public void indexed() { realm.beginTransaction(); MutableRealmIntegerTypes c1 = realm.createObject(MutableRealmIntegerTypes.class); realm.commitTransaction(); assertTrue( realm.getSchema().get("MutableRealmIntegerTypes") .hasIndex(MutableRealmIntegerTypes.FIELD_INDEXED_MUTABLEREALMINTEGER)); assertFalse( realm.getSchema().get("MutableRealmIntegerTypes") .hasIndex(MutableRealmIntegerTypes.FIELD_NULLABLE_MUTABLEEALMINTEGER)); }
Source:
private SourceMapImpl() { smapFiles.forEach(sm -> sm.getLineSection().forEach(lineInfo -> { for (int i = 0; i < lineInfo.repeatCount; i++) { int inputLine = lineInfo.inputStartLine + i; Path inputFile = Paths.get(sm.getFileSection().get(lineInfo.lineFileId).sourcePath); LocationImpl location = new LocationImpl(inputFile, inputLine, inputLine); int outputStart = lineInfo.outputStartLine + (i * lineInfo.outputLineIncrement); int outputEnd = lineInfo.outputStartLine + ((i + 1) * lineInfo.outputLineIncrement) - 1; outputEnd = Math.max(outputStart, outputEnd); for (int j = outputStart; j <= outputEnd; j++) { lines.merge(j, location, LocationImpl::mergeLocations); } } })); }

Target:
private SourceMapImpl() { for (SmapFile sm : smapFiles) { for (SmapFile.LineInfo lineInfo : sm.getLineSection()) { for (int i = 0; i < lineInfo.repeatCount; i++) { int inputLine = lineInfo.inputStartLine + i; Path inputFile = Paths.get(sm.getFileSection().get(lineInfo.lineFileId).sourcePath); LocationImpl location = new LocationImpl(inputFile, inputLine, inputLine); int outputStart = lineInfo.outputStartLine + (i * lineInfo.outputLineIncrement); int outputEnd = lineInfo.outputStartLine + ((i + 1) * lineInfo.outputLineIncrement) - 1; outputEnd = max(outputStart, outputEnd); for (int j = outputStart; j <= outputEnd; j++) { lines.merge(j, location, LocationImpl::mergeLocations); } } } } }
Source:
private JLabel makeDiceRolledLabel(final List<Die> dice, final int value) { int hits = 0; for (final Die die : dice) { if (die.getType() == Die.DieType.HIT) { hits++; } } final String countString = dice.size() == 1 ? "1 die" : dice.size() + " dice"; String hitsString = hits == 1 ? "1 hit" : hits + " hits"; if (hits != 0) { hitsString = "<font color='#8B0000'>" + hitsString + "</font>"; } return new JLabel("<html><b>Rolled " + countString + " at " + value + " (" + hitsString + "):"); }

Target:
private JLabel makeDiceRolledLabel(final List<Die> dice, final int value) { final long hits = dice.stream().map(Die::getType).filter(Die.DieType.HIT::equals).count(); final String countString = dice.size() == 1 ? "1 die" : dice.size() + " dice"; final String hitsString = colorizeHitString(hits == 1 ? "1 hit" : hits + " hits"); return new JLabel("<html><b>Rolled " + countString + " at " + value + " (" + hitsString + "):"); }
Source:
public KubernetesLeaderElectionDriver( FlinkKubeClient kubeClient, KubernetesLeaderElectionConfiguration leaderConfig, LeaderElectionEventHandler leaderElectionEventHandler, FatalErrorHandler fatalErrorHandler) { this.kubeClient = checkNotNull(kubeClient, "Kubernetes client"); checkNotNull(leaderConfig, "Leader election configuration"); this.leaderElectionEventHandler = checkNotNull(leaderElectionEventHandler, "LeaderElectionEventHandler"); this.fatalErrorHandler = checkNotNull(fatalErrorHandler); this.configMapName = leaderConfig.getConfigMapName(); this.lockIdentity = leaderConfig.getLockIdentity(); this.leaderElector = kubeClient.createLeaderElector(leaderConfig, new LeaderCallbackHandlerImpl()); this.configMapLabels = KubernetesUtils.getConfigMapLabels( leaderConfig.getClusterId(), LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY); leaderElector.run(); kubernetesWatch = kubeClient.watchConfigMaps(configMapName, new ConfigMapCallbackHandlerImpl()); running = true; }

Target:
public KubernetesLeaderElectionDriver( FlinkKubeClient kubeClient, KubernetesLeaderElectionConfiguration leaderConfig, LeaderElectionEventHandler leaderElectionEventHandler, FatalErrorHandler fatalErrorHandler) { this.kubeClient = checkNotNull(kubeClient, "Kubernetes client"); checkNotNull(leaderConfig, "Leader election configuration"); this.leaderElectionEventHandler = checkNotNull(leaderElectionEventHandler, "LeaderElectionEventHandler"); this.fatalErrorHandler = checkNotNull(fatalErrorHandler); this.configMapName = leaderConfig.getConfigMapName(); this.lockIdentity = leaderConfig.getLockIdentity(); this.leaderElector = kubeClient.createLeaderElector(leaderConfig, new LeaderCallbackHandlerImpl()); this.configMapLabels = KubernetesUtils.getConfigMapLabels( leaderConfig.getClusterId(), LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY); running = true; leaderElector.run(); kubernetesWatch = kubeClient.watchConfigMaps(configMapName, new ConfigMapCallbackHandlerImpl()); }
Source:
public void showContentInfo() throws EditorFragmentNotAddedException { if (!isAdded()) { throw new EditorFragmentNotAddedException(); } getGutenbergContainerFragment().triggerGetContentInfo(new OnContentInfoReceivedListener() { @Override public void onContentInfoFailed() { ToastUtils.showToast(getActivity(), R.string.toast_content_info_failed); } @Override public void onEditorNotReady() { ToastUtils.showToast(getActivity(), R.string.toast_content_info_editor_not_ready); } @Override public void onContentInfoReceived(HashMap<String, Object> contentInfo) { int blockCount = (int) Double.parseDouble(contentInfo.get("blockCount").toString()); int wordCount = (int) Double.parseDouble(contentInfo.get("wordCount").toString()); int charCount = (int) Double.parseDouble(contentInfo.get("characterCount").toString()); if (getActivity() != null) { getActivity().runOnUiThread(() -> { AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getActivity()); builder.setTitle(getString(R.string.dialog_content_info_title)); builder.setMessage( getString(R.string.dialog_content_info_body, blockCount, wordCount, charCount)); builder.setPositiveButton(getString(R.string.dialog_button_ok), null); builder.show(); }); } } }); }

Target:
public void showContentInfo() throws EditorFragmentNotAddedException { if (!isAdded()) { throw new EditorFragmentNotAddedException(); } getGutenbergContainerFragment().triggerGetContentInfo(new OnContentInfoReceivedListener() { @Override public void onContentInfoFailed() { if (getActivity() != null) { getActivity().runOnUiThread(() -> { ToastUtils.showToast(getActivity(), R.string.toast_content_info_failed); }); } } @Override public void onEditorNotReady() { if (getActivity() != null) { getActivity().runOnUiThread(() -> { ToastUtils.showToast(getActivity(), R.string.toast_content_info_editor_not_ready); }); } } @Override public void onContentInfoReceived(HashMap<String, Object> contentInfo) { int blockCount = (int) Double.parseDouble(contentInfo.get("blockCount").toString()); int wordCount = (int) Double.parseDouble(contentInfo.get("wordCount").toString()); int charCount = (int) Double.parseDouble(contentInfo.get("characterCount").toString()); if (getActivity() != null) { getActivity().runOnUiThread(() -> { AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getActivity()); builder.setTitle(getString(R.string.dialog_content_info_title)); builder.setMessage( getString(R.string.dialog_content_info_body, blockCount, wordCount, charCount)); builder.setPositiveButton(getString(R.string.dialog_button_ok), null); builder.show(); }); } } }); }
Source:
public InstallationModel createAndroidInstallation(final Context context) { final InstallationModel d = createModel(null); d.deviceType = InstallationModel.DEVICE_TYPE_ANDROID; final String appName = context.getPackageName(); try { d.appVersion = context.getPackageManager() .getPackageInfo(appName, 0) .versionName; } catch (final PackageManager.NameNotFoundException e) { } d.status = InstallationModel.STATUS_ACTIVE; return d; }

Target:
public Installation createAndroidInstallation(final Context context) { final Installation d = createModel(null); final String appName = context.getPackageName(); try { d.appVersion = context.getPackageManager() .getPackageInfo(appName, 0) .versionName; } catch (final PackageManager.NameNotFoundException e) { } d.status = Installation.STATUS_ACTIVE; return d; }
Source:
public TieredQueueSlas(Map<Integer, ResAllocs> tierCapacities, Map<Integer, Map<String, ResAllocs>> slas) { Map<Integer, TierSla> tmpResAllocsMap = new HashMap<>(); if (!slas.isEmpty()) { for (Map.Entry<Integer, Map<String, ResAllocs>> entry : slas.entrySet()) { Integer tierIndex = entry.getKey(); if (!tierCapacities.containsKey(tierIndex)) { throw new IllegalArgumentException("Total capacity not defined for tear " + tierIndex); } final Map<String, ResAllocs> tierAllocs = entry.getValue(); TierSla tierSla = new TierSla(); tierSla.setTierAllocs(tierCapacities.get(tierIndex)); tmpResAllocsMap.put(tierIndex, tierSla); for (Map.Entry<String, ResAllocs> e : tierAllocs.entrySet()) { tierSla.setAlloc(e.getKey(), e.getValue()); } } } tierCapacities.forEach((tierIndex, capacity) -> { if (!tmpResAllocsMap.containsKey(tierIndex)) { TierSla tierSla = new TierSla(); tierSla.setTierAllocs(tierCapacities.get(tierIndex)); tmpResAllocsMap.put(tierIndex, tierSla); } }); this.slas = tmpResAllocsMap; }

Target:
public TieredQueueSlas(Map<Integer, ResAllocs> tierCapacities, Map<Integer, Map<String, ResAllocs>> slas) { Map<Integer, TierSla> tmpResAllocsMap = new HashMap<>(); if (!slas.isEmpty()) { for (Map.Entry<Integer, Map<String, ResAllocs>> entry : slas.entrySet()) { int tierNumber = entry.getKey(); final Map<String, ResAllocs> tierAllocs = entry.getValue(); TierSla tierSla = new TierSla(); tierSla.setTierCapacity(getOrComputeTierCapacity(tierNumber, tierCapacities.get(tierNumber), tierAllocs)); for (Map.Entry<String, ResAllocs> e : tierAllocs.entrySet()) { tierSla.setAlloc(e.getKey(), e.getValue()); } tmpResAllocsMap.put(tierNumber, tierSla); } } tierCapacities.forEach((tierIndex, capacity) -> { if (!tmpResAllocsMap.containsKey(tierIndex)) { TierSla tierSla = new TierSla(); tierSla.setTierCapacity(tierCapacities.get(tierIndex)); tmpResAllocsMap.put(tierIndex, tierSla); } }); this.slas = tmpResAllocsMap; }
Source:
public List<ResponseInfo> sendAndPoll(List<RequestInfo> requestInfos) throws IOException { logger.trace("Initiating Send and poll at " + time.milliseconds()); long startTime = time.milliseconds(); try { if (closed) { throw new IllegalStateException("The NetworkClient is closed."); } List<ResponseInfo> responseInfoList = new ArrayList<ResponseInfo>(); for (RequestInfo requestInfo : requestInfos) { ClientNetworkRequestMetrics clientNetworkRequestMetrics = new ClientNetworkRequestMetrics(networkMetrics.requestQueueTime, networkMetrics.requestSendTime, networkMetrics.requestSendTotalTime, 0); pendingRequests.add(new RequestMetadata(time.milliseconds(), requestInfo, clientNetworkRequestMetrics)); } List<NetworkSend> sends = prepareSends(responseInfoList); selector.poll(POLL_TIMEOUT_MS, sends); handleSelectorEvents(responseInfoList); return responseInfoList; } finally { numPendingRequests.set(pendingRequests.size()); networkMetrics.networkClientSendAndPollTime.update(time.milliseconds() - startTime); logger.trace("Time taken for this Send and poll cycle " + (time.milliseconds() - startTime)); } }

Target:
public List<ResponseInfo> sendAndPoll(List<RequestInfo> requestInfos) throws IOException { long startTime = time.milliseconds(); try { if (closed) { throw new IllegalStateException("The NetworkClient is closed."); } List<ResponseInfo> responseInfoList = new ArrayList<ResponseInfo>(); for (RequestInfo requestInfo : requestInfos) { ClientNetworkRequestMetrics clientNetworkRequestMetrics = new ClientNetworkRequestMetrics(networkMetrics.requestQueueTime, networkMetrics.requestSendTime, networkMetrics.requestSendTotalTime, 0); pendingRequests.add(new RequestMetadata(time.milliseconds(), requestInfo, clientNetworkRequestMetrics)); } List<NetworkSend> sends = prepareSends(responseInfoList); selector.poll(POLL_TIMEOUT_MS, sends); handleSelectorEvents(responseInfoList); return responseInfoList; } finally { numPendingRequests.set(pendingRequests.size()); networkMetrics.networkClientSendAndPollTime.update(time.milliseconds() - startTime); logger.trace("Completing a send and poll cycle "); } }
Source:
public static Struct toStruct(final Ds3Type ds3Type) throws ParseException { final StructConverter converter = new StructConverter(ds3Type); return converter.convert(); }

Target:
public static Struct toStruct(final Ds3Type ds3Type) throws ParseException { final ImmutableList<StructMember> variablesList = StructHelper.convertDs3Elements(ds3Type.getElements()); return new Struct( ds3Type.getName(), variablesList); }
Source:
public void unsetRM3Reranker() { this.isRerank = false; cascade = new RerankerCascade("default"); cascade.add(new ScoreTiesAdjusterReranker()); }

Target:
public void unsetRM3Reranker() { this.isRerank = false; cascade = new RerankerCascade(); cascade.add(new ScoreTiesAdjusterReranker()); }
Source:
public void replaceTypeToResponse() throws IOException { final String type = "text/plain"; MatcherAssert.assertThat( new RsPrint( new RsWithType( new RsWithType(new RsEmpty(), "text/xml"), type ) ).print(), Matchers.equalTo( Joiner.on(CRLF).join( "HTTP/1.1 200 OK", String.format("Content-Type: %s", type), "", "" ) ) ); }

Target:
public void replaceTypeToResponse() throws Exception { final String type = "text/plain"; MatcherAssert.assertThat( new RsPrint( new RsWithType( new RsWithType(new RsEmpty(), "text/xml"), type ) ).print(), Matchers.equalTo( Joiner.on(CRLF).join( "HTTP/1.1 200 OK", String.format("Content-Type: %s", type), "", "" ) ) ); }
Source:
public void voidLastState(ProgramWorkflow workflow, User voidBy, Date voidDate, String voidReason) { List<PatientState> states = statesInWorkflow(workflow, false); if (voidDate == null) { voidDate = new Date(); } PatientState last = null; PatientState nextToLast = null; if (!states.isEmpty()) { last = states.get(states.size() - 1); } if (states.size() > 1) { nextToLast = states.get(states.size() - 2); } if (last != null) { last.setVoided(true); last.setVoidedBy(voidBy); last.setDateVoided(voidDate); last.setVoidReason(voidReason); } if (nextToLast != null && nextToLast.getEndDate() != null) { nextToLast.setEndDate(null); nextToLast.setDateChanged(voidDate); nextToLast.setChangedBy(voidBy); } }

Target:
public void voidLastState(ProgramWorkflow workflow, User voidBy, Date voidDate, String voidReason) { List<PatientState> states = statesInWorkflow(workflow, false); if (voidDate == null) { voidDate = new Date(); } PatientState last = null; PatientState nextToLast = null; if (CollectionUtils.isNotEmpty(states)) { last = states.get(states.size() - 1); } if (states.size() > 1) { nextToLast = states.get(states.size() - 2); } if (last != null) { last.setVoided(true); last.setVoidedBy(voidBy); last.setDateVoided(voidDate); last.setVoidReason(voidReason); } if (nextToLast != null && nextToLast.getEndDate() != null) { nextToLast.setEndDate(null); nextToLast.setDateChanged(voidDate); nextToLast.setChangedBy(voidBy); } }
Source:
public GroupedExecutionProperties visitJoin(JoinNode node, Void context) { GroupedExecutionProperties left = node.getLeft().accept(this, null); GroupedExecutionProperties right = node.getRight().accept(this, null); if (Optional.empty().equals(node.getDistributionType())) { return new GroupedExecutionProperties(false, false); } if (Optional.of(JoinNode.DistributionType.REPLICATED).equals(node.getDistributionType())) { checkState(!right.currentNodeCapable); return left; } if (Optional.of(JoinNode.DistributionType.PARTITIONED).equals(node.getDistributionType())) { if (left.currentNodeCapable && right.currentNodeCapable) { return new GroupedExecutionProperties(true, true); } return left; } throw new UnsupportedOperationException("Unknown distribution type: " + node.getDistributionType()); }

Target:
public GroupedExecutionProperties visitJoin(JoinNode node, Void context) { GroupedExecutionProperties left = node.getLeft().accept(this, null); GroupedExecutionProperties right = node.getRight().accept(this, null); if (!node.getDistributionType().isPresent()) { return new GroupedExecutionProperties(false, false); } switch (node.getDistributionType().get()) { case REPLICATED: checkState(!right.currentNodeCapable); return left; case PARTITIONED: if (left.currentNodeCapable && right.currentNodeCapable) { return new GroupedExecutionProperties(true, true); } return left; default: throw new UnsupportedOperationException("Unknown distribution type: " + node.getDistributionType()); } }
Source:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final ModelNode config = Resource.Tools.readModel(context.readResourceFromRoot(address)); if (definition.getName().equals(BUFFER_PER_SLICE.getName())) context.getResult().set( returnConfigIfDefinedOrDefaultValueFor(BUFFER_PER_SLICE.getName(), config, DEFAULT_BUFFERS_PER_REGION)); else if (definition.getName().equals(BUFFER_SIZE.getName())) context.getResult().set( returnConfigIfDefinedOrDefaultValueFor(BUFFER_SIZE.getName(), config, DEFAULT_BUFFER_SIZE)); else if (definition.getName().equals(DIRECT_BUFFERS.getName())) context.getResult().set( returnConfigIfDefinedOrDefaultValueFor(DIRECT_BUFFERS.getName(), config, DEFAULT_DIRECT_BUFFERS)); else throw new IllegalArgumentException("No such attributes [" + definition + " in " + ATTRIBUTES); }

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { if ( definition.getType() == ModelType.INT ) context.getResult().set(new ModelNode(definition.getDefaultValue().asInt())); else if ( definition.getType() == ModelType.BOOLEAN ) context.getResult().set(new ModelNode(definition.getDefaultValue().asBoolean())); else throw new IllegalArgumentException("Arguments type can only be INT or BOOL: " + ATTRIBUTES ); }
Source:
protected void executeQueryCommand() { List<VM> vms = DbFacade.getInstance().getVmDao().getAllForVdsGroup(getParameters().getId()); Integer activeVms = 0; for (VM vm : vms) { if (vm.getStatus() != VMStatus.Down) { ++activeVms; } } getQueryReturnValue().setReturnValue(activeVms); }

Target:
protected void executeQueryCommand() { List<VM> vms = DbFacade.getInstance().getVmDao().getAllForVdsGroup(getParameters().getId()); int activeVms = 0; for (VM vm : vms) { if (vm.getStatus() != VMStatus.Down && vm.getStatus() != VMStatus.ImageLocked) { ++activeVms; } } getQueryReturnValue().setReturnValue(activeVms); }