auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testChronologizeWithStartTimestampGreaterThanEndTimestampInKeyInRecord() { long record = Variables.register("record", client.create()); String key = Variables.register("key", TestData.getString()); int testSize = Variables.register("testSize", 5); Set<Object> initValues = Variables.register("initValues", Sets.newHashSet()); List<Timestamp> timestamps = new ArrayList<Timestamp>(); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); timestamps.add(Timestamp.now()); for (int j = 0; j < 10000000; j++); } Map<Timestamp, Set<Object>> result = client.chronologize( key, record, timestamps.get(3), timestamps.get(2)); assertTrue(result.isEmpty()); }

Target:
public void testChronologizeWithStartTimestampGreaterThanEndTimestampInKeyInRecord() { long record = Variables.register("record", client.create()); String key = Variables.register("key", TestData.getString()); int testSize = Variables.register("testSize", 5); Set<Object> initValues = Variables.register("initValues", Sets.newHashSet()); List<Timestamp> timestamps = new ArrayList<Timestamp>(); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); timestamps.add(Timestamp.now()); StandardActions.wait(200, TimeUnit.MILLISECONDS); } client.chronologize(key, record, timestamps.get(3), timestamps.get(2)); }
Source:
void testAborted() { assumeFalse( true ); throw new IllegalStateException( "his exception should never happen" ); }

Target:
void testAborted() { assumeFalse( true ); throw new IllegalStateException( "this exception should never happen" ); }
Source:
private void createLanguageDialog() { FormController formController = getFormController(); final String[] languages = formController.getLanguages(); int selected = -1; if (languages != null) { String language = formController.getLanguage(); for (int i = 0; i < languages.length; i++) { if (language.equals(languages[i])) { selected = i; } } } alertDialog = new AlertDialog.Builder(this) .setSingleChoiceItems(languages, selected, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { ContentValues values = new ContentValues(); values.put(FormsColumns.LANGUAGE, languages[whichButton]); String selection = FormsColumns.FORM_FILE_PATH + "=?"; String[] selectArgs = {StorageManager.getFormFilePath(StorageManager.getRelativeFormFilePath(formPath))}; int updated = new FormsDao().updateForm(values, selection, selectArgs); Timber.i("Updated language to: %s in %d rows", languages[whichButton], updated); FormController formController = getFormController(); formController.setLanguage(languages[whichButton]); dialog.dismiss(); if (formController.currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } refreshCurrentView(); } }) .setTitle(getString(R.string.change_language)) .setNegativeButton(getString(R.string.do_not_change), null).create(); alertDialog.show(); }

Target:
private void createLanguageDialog() { FormController formController = getFormController(); final String[] languages = formController.getLanguages(); int selected = -1; if (languages != null) { String language = formController.getLanguage(); for (int i = 0; i < languages.length; i++) { if (language.equals(languages[i])) { selected = i; } } } alertDialog = new AlertDialog.Builder(this) .setSingleChoiceItems(languages, selected, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { ContentValues values = new ContentValues(); values.put(FormsColumns.LANGUAGE, languages[whichButton]); String selection = FormsColumns.FORM_FILE_PATH + "=?"; String[] selectArgs = {new StoragePathProvider().getFormDbPath(formPath)}; int updated = new FormsDao().updateForm(values, selection, selectArgs); Timber.i("Updated language to: %s in %d rows", languages[whichButton], updated); FormController formController = getFormController(); formController.setLanguage(languages[whichButton]); dialog.dismiss(); if (formController.currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } refreshCurrentView(); } }) .setTitle(getString(R.string.change_language)) .setNegativeButton(getString(R.string.do_not_change), null).create(); alertDialog.show(); }
Source:
public void serializesPayloadFieldstoJsonString() { assertThat(actual, hasJsonPath("$.event_details.amount", equalTo(100))); assertThat(actual, hasJsonPath("$.event_details.description", equalTo("new passport"))); assertThat(actual, hasJsonPath("$.event_details.reference", equalTo("myref"))); assertThat(actual, hasJsonPath("$.event_details.return_url", equalTo("<LINK_0>"))); assertThat(actual, hasJsonPath("$.event_details.gateway_account_id", equalTo(chargeEntity.getGatewayAccount().getId().toString()))); assertThat(actual, hasJsonPath("$.event_details.payment_provider", equalTo(chargeEntity.getGatewayAccount().getGatewayName()))); assertThat(actual, hasJsonPath("$.event_details.language", equalTo(chargeEntity.getLanguage().toString()))); assertThat(actual, hasJsonPath("$.event_details.delayed_capture", equalTo(chargeEntity.isDelayedCapture()))); assertThat(actual, hasJsonPath("$.event_details.external_metadata", equalTo("{\"key1\":\"value1\",\"key2\":\"value2\"}"))); }

Target:
public void serializesPayloadFieldstoJsonString() { assertThat(actual, hasJsonPath("$.event_details.amount", equalTo(100))); assertThat(actual, hasJsonPath("$.event_details.description", equalTo("new passport"))); assertThat(actual, hasJsonPath("$.event_details.reference", equalTo("myref"))); assertThat(actual, hasJsonPath("$.event_details.return_url", equalTo("<LINK_0>"))); assertThat(actual, hasJsonPath("$.event_details.gateway_account_id", equalTo(chargeEntity.getGatewayAccount().getId().toString()))); assertThat(actual, hasJsonPath("$.event_details.payment_provider", equalTo(chargeEntity.getGatewayAccount().getGatewayName()))); assertThat(actual, hasJsonPath("$.event_details.language", equalTo(chargeEntity.getLanguage().toString()))); assertThat(actual, hasJsonPath("$.event_details.delayed_capture", equalTo(chargeEntity.isDelayedCapture()))); assertThat(actual, hasJsonPath("$.event_details.external_metadata.key1", equalTo("value1"))); assertThat(actual, hasJsonPath("$.event_details.external_metadata.key2", equalTo("value2"))); }
Source:
public Object[] factory() { return new Object[] { new DenyReadWriteRemoveAllTest().init(REPL_SYNC, "PD-5N", new int[]{0,1,2}, new int[]{3,4}), new DenyReadWriteRemoveAllTest().init(REPL_SYNC, "AD-4N", DEGRADED_MODE, new int[]{0,1}, new int[]{2,3}), new DenyReadWriteRemoveAllTest().init(REPL_SYNC, "PD-4N", new int[]{0,1,2}, new int[]{3}), new DenyReadWriteRemoveAllTest().init(REPL_SYNC, "PD-3N", new int[]{0,1}, new int[]{2}), new DenyReadWriteRemoveAllTest().init(REPL_SYNC, "AD-2N", DEGRADED_MODE, new int[]{0}, new int[]{1}), new DenyReadWriteRemoveAllTest().init("AD-5N", DEGRADED_MODE, new int[]{0,1,2}, new int[]{3,4}), new DenyReadWriteRemoveAllTest().init("AD-4N", DEGRADED_MODE, new int[]{0,1}, new int[]{2,3}), new DenyReadWriteRemoveAllTest().init("PD-4N", new int[]{0,1,2}, new int[]{3}), new DenyReadWriteRemoveAllTest().init("PD-3N", new int[]{0,1}, new int[]{2}), new DenyReadWriteRemoveAllTest().init("AD-2N", DEGRADED_MODE, new int[]{0}, new int[]{1}), }; }

Target:
public Object[] factory() { return new Object[] { new DenyReadWriteRemoveAllTest(REPL_SYNC, "PD-5N", new int[]{0,1,2}, new int[]{3,4}), new DenyReadWriteRemoveAllTest(REPL_SYNC, "AD-4N", DEGRADED_MODE, new int[]{0,1}, new int[]{2,3}), new DenyReadWriteRemoveAllTest(REPL_SYNC, "PD-4N", new int[]{0,1,2}, new int[]{3}), new DenyReadWriteRemoveAllTest(REPL_SYNC, "PD-3N", new int[]{0,1}, new int[]{2}), new DenyReadWriteRemoveAllTest(REPL_SYNC, "AD-2N", DEGRADED_MODE, new int[]{0}, new int[]{1}), new DenyReadWriteRemoveAllTest(DIST_SYNC, "AD-5N", DEGRADED_MODE, new int[]{0,1,2}, new int[]{3,4}), new DenyReadWriteRemoveAllTest(DIST_SYNC, "AD-4N", DEGRADED_MODE, new int[]{0,1}, new int[]{2,3}), new DenyReadWriteRemoveAllTest(DIST_SYNC, "PD-4N", new int[]{0,1,2}, new int[]{3}), new DenyReadWriteRemoveAllTest(DIST_SYNC, "PD-3N", new int[]{0,1}, new int[]{2}), new DenyReadWriteRemoveAllTest(DIST_SYNC, "AD-2N", DEGRADED_MODE, new int[]{0}, new int[]{1}), }; }
Source:
void writeUTF(OutputStream out) throws IOException { DataOutputStream dos = new DataOutputStream(out); for (int i = 0; i < 25000; i++) { dos.writeUTF("abcdefghilmnopqrstuvzABCDEFGHILMNOPQRSTUVZabcdefghilmnopqrstuvzABCDEFGHILMNOPQRSTUVZ"); } dos.flush(); dos.close(); }

Target:
void writeUTF(OutputStream out) throws IOException { DataOutputStream dos = new DataOutputStream(out); for (int i = 0; i < 50000; i++) { dos.writeUTF("abcdefghilmnopqrstuvzABCDEFGHILMNOPQRSTUVZ"); } dos.flush(); dos.close(); }
Source:
public static boolean testPermission(CommandSource source, String commandName) { if (commandName.equals(CommandPermissions.SELECTOR_COMMAND)) { return source.hasPermission(CommandPermissions.SELECTOR_PERMISSION); } if (commandName.equals(CommandPermissions.COMMAND_BLOCK_COMMAND)) { return source.hasPermission(CommandPermissions.COMMAND_BLOCK_PERMISSION); } final List<? extends CommandMapping> nativeMappings = SpongeImpl.getGame().getCommandManager().getAll(commandName).stream() .filter(m -> m.getCallable() instanceof MinecraftCommandWrapper) .collect(Collectors.toList()); if(nativeMappings.size() > 1) throw new IllegalStateException("Only one native mapping expected for "+commandName); final CommandMapping mapping = nativeMappings.isEmpty() ? null : nativeMappings.get(0); if (mapping != null) { MinecraftCommandWrapper callable = (MinecraftCommandWrapper) mapping.getCallable(); return source.hasPermission(callable.getCommandPermission()); } return source.hasPermission(commandName); }

Target:
public static boolean testPermission(CommandSource source, String commandName) { if (commandName.equals(CommandPermissions.SELECTOR_COMMAND)) { return source.hasPermission(CommandPermissions.SELECTOR_PERMISSION); } if (commandName.equals(CommandPermissions.COMMAND_BLOCK_COMMAND)) { return source.hasPermission(CommandPermissions.COMMAND_BLOCK_PERMISSION); } final List<? extends CommandMapping> nativeMappings = SpongeImpl.getGame().getCommandManager().getAll(commandName).stream() .filter(m -> m.getCallable() instanceof MinecraftCommandWrapper) .collect(Collectors.toList()); if (nativeMappings.size() > 1) { final int size = nativeMappings.size(); final StringJoiner commaSeparated = new StringJoiner(", "); nativeMappings.stream() .map(m -> ((MinecraftCommandWrapper) m).getOwner().getName() + ':' + m.getPrimaryAlias()) .forEach(commaSeparated::add); throw new IllegalStateException("Only one native mapping expected for /" + commandName + "found " + size + "(" + commaSeparated + ")"); } final CommandMapping mapping = nativeMappings.isEmpty() ? null : nativeMappings.get(0); if (mapping != null) { MinecraftCommandWrapper callable = (MinecraftCommandWrapper) mapping.getCallable(); return source.hasPermission(callable.getCommandPermission()); } return source.hasPermission(commandName); }
Source:
public BreakpointContainer[] getRoots(IBreakpoint breakpoint) { if (isShowingGroups()) { List<BreakpointContainer> list = new ArrayList<>(); for (Object fElement : fElements) { BreakpointContainer container = (BreakpointContainer) fElement; if (container.contains(breakpoint)) { list.add(container); } } return list.toArray(new BreakpointContainer[list.size()]); } return null; }

Target:
public BreakpointContainer[] getRoots(IBreakpoint breakpoint) { if (isShowingGroups()) { List<BreakpointContainer> list = new ArrayList<>(); for (Object element : fElements) { BreakpointContainer container = (BreakpointContainer) element; if (container.contains(breakpoint)) { list.add(container); } } return list.toArray(new BreakpointContainer[list.size()]); } return null; }
Source:
public static Properties getDatasourceProperties() { String propertiesNotFoundMessage = "Unable to load datasource properties [" + DATASOURCE_PROPERTIES + "]"; boolean propertiesNotFound = false; System.setProperty("h2.lobInDatabase", "true"); InputStream propsInputStream = PersistenceUtil.class.getResourceAsStream(DATASOURCE_PROPERTIES); assertNotNull(propertiesNotFoundMessage, propsInputStream); Properties props = new Properties(); if (propsInputStream != null) { try { props.load(propsInputStream); propsInputStream.close(); } catch (IOException ioe) { propertiesNotFound = true; logger.warn("Unable to find properties, using default H2 properties: {}", ioe.getMessage()); logger.warn("Stacktrace:", ioe); } } else { propertiesNotFound = true; } String password = props.getProperty("password"); if ("${maven.jdbc.password}".equals(password) || propertiesNotFound) { props = getDefaultProperties(); } return props; }

Target:
public static Properties getDatasourceProperties() { String propertiesNotFoundMessage = "Unable to load datasource properties [" + DATASOURCE_PROPERTIES + "]"; boolean propertiesNotFound = false; System.setProperty("h2.lobInDatabase", "true"); Properties props = new Properties(); try (InputStream propsInputStream = PersistenceUtil.class.getResourceAsStream(DATASOURCE_PROPERTIES)){ assertNotNull(propertiesNotFoundMessage, propsInputStream); props.load(propsInputStream); } catch (IOException ioe) { propertiesNotFound = true; logger.warn("Unable to find properties, using default H2 properties: {}", ioe.getMessage()); logger.warn("Stacktrace:", ioe); } String password = props.getProperty("password"); if ("${maven.jdbc.password}".equals(password) || propertiesNotFound) { props = getDefaultProperties(); } return props; }
Source:
private void executeScriptWithCommandShellEmulation(String script) { List<HiveSqlStatement> statements = statementFactory.newInstanceForScript(script); executeStatementsWithCommandShellEmulation(statements); }

Target:
private void executeScriptWithCommandShellEmulation(String script) { List<String> statements = lexer.applyToScript(script); executeStatementsWithCommandShellEmulation(statements); }
Source:
private void disposeUnspilledLookupSourceIfRequested() { if (!spilledLookupSourceHandle.getDisposeRequested().isDone()) { return; } index.clear(); operatorContext.setMemoryReservation(index.getEstimatedSize().toBytes()); state = State.DISPOSED; }

Target:
private void disposeUnspilledLookupSourceIfRequested() { checkState(state == State.INPUT_UNSPILLED_AND_BUILT); if (!spilledLookupSourceHandle.getDisposeRequested().isDone()) { return; } index.clear(); operatorContext.setMemoryReservation(index.getEstimatedSize().toBytes()); state = State.DISPOSED; }
Source:
public DecimalWidget(Context context, FormEntryPrompt prompt, boolean secret, boolean compact) { super(context, prompt, secret, compact); mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontSize); mAnswer.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_NEXT); mAnswer.setHorizontallyScrolling(isInCompactMode() ? true : false); mAnswer.setKeyListener(new DigitsKeyListener(true, true)); InputFilter[] fa = new InputFilter[1]; fa[0] = new InputFilter.LengthFilter(15); mAnswer.setFilters(fa); Double d = null; if (getCurrentAnswer() != null) { d = (Double)getCurrentAnswer().getValue(); } NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMaximumFractionDigits(15); nf.setMaximumIntegerDigits(15); nf.setGroupingUsed(false); if (d != null) { Double dAnswer = (Double)getCurrentAnswer().getValue(); String dString = nf.format(dAnswer); d = Double.parseDouble(dString.replace(',', '.')); mAnswer.setText(d.toString()); } if (prompt.isReadOnly()) { setBackgroundDrawable(null); setFocusable(false); setClickable(false); } }

Target:
public DecimalWidget(Context context, FormEntryPrompt prompt, boolean secret, boolean compact) { super(context, prompt, secret, compact); mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontSize); mAnswer.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_NEXT); mAnswer.setHorizontallyScrolling(isInCompactMode()); mAnswer.setKeyListener(new DigitsKeyListener(true, true)); InputFilter[] fa = new InputFilter[1]; fa[0] = new InputFilter.LengthFilter(15); mAnswer.setFilters(fa); Double d = null; if (getCurrentAnswer() != null) { d = (Double)getCurrentAnswer().getValue(); } NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMaximumFractionDigits(15); nf.setMaximumIntegerDigits(15); nf.setGroupingUsed(false); if (d != null) { Double dAnswer = (Double)getCurrentAnswer().getValue(); String dString = nf.format(dAnswer); d = Double.parseDouble(dString.replace(',', '.')); mAnswer.setText(d.toString()); } if (prompt.isReadOnly()) { setBackgroundDrawable(null); setFocusable(false); setClickable(false); } }
Source:
protected void activate(ComponentContext componentContext) { this.m_ctx = componentContext; this.m_pppState = PppState.NOT_CONNECTED; this.m_resetTimerStart = 0L; Dictionary<String, String[]> d = new Hashtable<String, String[]>(); d.put(EventConstants.EVENT_TOPIC, EVENT_TOPICS); this.m_ctx.getBundleContext().registerService(EventHandler.class.getName(), this, d); this.m_modems = new HashMap<String, CellularModem>(); this.m_interfaceStatuses = new HashMap<String, InterfaceState>(); this.m_listeners = new ArrayList<ModemMonitorListener>(); stopThread = new AtomicBoolean(); this.m_executor = Executors.newSingleThreadExecutor(); try { this.m_networkConfig = this.m_netConfigService.getNetworkConfiguration(); for (NetInterface<? extends NetInterfaceAddress> netInterface : this.m_networkService .getNetworkInterfaces()) { if (netInterface instanceof ModemInterface) { ModemDevice modemDevice = ((ModemInterface<?>) netInterface).getModemDevice(); trackModem(modemDevice); } } } catch (Exception e) { s_logger.error("Error getting installed modems", e); } submitMonitorTask(); this.m_serviceActivated = true; s_logger.debug("ModemMonitor activated and ready to receive events"); }

Target:
protected void activate(ComponentContext componentContext) { this.pppState = PppState.NOT_CONNECTED; this.resetTimerStart = 0L; Dictionary<String, String[]> d = new Hashtable<>(); d.put(EventConstants.EVENT_TOPIC, EVENT_TOPICS); componentContext.getBundleContext().registerService(EventHandler.class.getName(), this, d); this.modems = new HashMap<>(); this.interfaceStatuses = new HashMap<>(); this.listeners = new ArrayList<>(); stopThread = new AtomicBoolean(); this.executor = Executors.newSingleThreadExecutor(); try { this.networkConfig = this.netConfigService.getNetworkConfiguration(); for (NetInterface<? extends NetInterfaceAddress> netInterface : this.networkService .getNetworkInterfaces()) { if (netInterface instanceof ModemInterface) { ModemDevice modemDevice = ((ModemInterface<?>) netInterface).getModemDevice(); trackModem(modemDevice); } } } catch (Exception e) { logger.error("Error getting installed modems", e); } submitMonitorTask(); this.serviceActivated = true; logger.debug("ModemMonitor activated and ready to receive events"); }
Source:
public void testCreateTableWithInvalidTableUpdateCacheFreqShouldThrow() throws Exception { String tableName = generateUniqueName(); Properties props = PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES); ArrayList<String> invalidUCF = new ArrayList<>(); invalidUCF.add("GIBBERISH"); invalidUCF.add("10000.6"); for (String tableLevelUCF : invalidUCF) { String createTableString = "CREATE TABLE " + tableName + " (k VARCHAR PRIMARY KEY," + "v1 VARCHAR, v2 VARCHAR) UPDATE_CACHE_FREQUENCY = " + tableLevelUCF; try { verifyUCFValueInSysCat(tableName, createTableString, props, -1L); fail(); } catch (IllegalArgumentException e) { assertEquals("Table's UPDATE_CACHE_FREQUENCY can only be set to 'ALWAYS', 'NEVER' or a millisecond numeric value.", e.getMessage()); } } }

Target:
public void testCreateTableWithInvalidTableUpdateCacheFreqShouldThrow() throws Exception { String tableName = generateUniqueName(); Properties props = PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES); ArrayList<String> invalidUCF = new ArrayList<>(); invalidUCF.add("GIBBERISH"); invalidUCF.add("10000.6"); for (String tableLevelUCF : invalidUCF) { String createTableString = "CREATE TABLE " + tableName + " (k VARCHAR PRIMARY KEY," + "v1 VARCHAR, v2 VARCHAR) UPDATE_CACHE_FREQUENCY = " + tableLevelUCF; try { verifyUCFValueInSysCat(tableName, createTableString, props, -1L); fail(); } catch (IllegalArgumentException e) { assertTrue(e.getMessage().contains("Table's " + PhoenixDatabaseMetaData.UPDATE_CACHE_FREQUENCY)); } } }
Source:
public static com.azure.search.documents.indexes.implementation.models.SearchIndexerSkillset map(SearchIndexerSkillset obj) { if (obj == null) { return null; } Objects.requireNonNull(obj.getName(), "The SearchIndexerSkillset name cannot be null"); List<com.azure.search.documents.indexes.implementation.models.SearchIndexerSkill> skills = obj.getSkills() == null ? null : obj.getSkills().stream().map(SearchIndexerSkillConverter::map).collect(Collectors.toList()); com.azure.search.documents.indexes.implementation.models.SearchIndexerSkillset searchIndexerSkillset = new com.azure.search.documents.indexes.implementation.models.SearchIndexerSkillset() .setName(obj.getName()) .setSkills(skills); if (obj.getCognitiveServicesAccount() != null) { com.azure.search.documents.indexes.implementation.models.CognitiveServicesAccount cognitiveServicesAccount = CognitiveServicesAccountConverter.map(obj.getCognitiveServicesAccount()); searchIndexerSkillset.setCognitiveServicesAccount(cognitiveServicesAccount); } String description = obj.getDescription(); searchIndexerSkillset.setDescription(description); searchIndexerSkillset.setDescription(obj.getDescription()); searchIndexerSkillset.setETag(obj.getETag()); if (obj.getEncryptionKey() != null) { searchIndexerSkillset.setEncryptionKey(SearchResourceEncryptionKeyConverter.map(obj.getEncryptionKey())); } return searchIndexerSkillset; }

Target:
public static com.azure.search.documents.indexes.implementation.models.SearchIndexerSkillset map(SearchIndexerSkillset obj) { if (obj == null) { return null; } Objects.requireNonNull(obj.getName(), "The SearchIndexerSkillset name cannot be null"); List<com.azure.search.documents.indexes.implementation.models.SearchIndexerSkill> skills = obj.getSkills() == null ? null : obj.getSkills().stream().map(SearchIndexerSkillConverter::map).collect(Collectors.toList()); com.azure.search.documents.indexes.implementation.models.SearchIndexerSkillset searchIndexerSkillset = new com.azure.search.documents.indexes.implementation.models.SearchIndexerSkillset() .setName(obj.getName()) .setSkills(skills); if (obj.getCognitiveServicesAccount() != null) { com.azure.search.documents.indexes.implementation.models.CognitiveServicesAccount cognitiveServicesAccount = CognitiveServicesAccountConverter.map(obj.getCognitiveServicesAccount()); searchIndexerSkillset.setCognitiveServicesAccount(cognitiveServicesAccount); } searchIndexerSkillset.setDescription(obj.getDescription()); searchIndexerSkillset.setETag(obj.getETag()); if (obj.getEncryptionKey() != null) { searchIndexerSkillset.setEncryptionKey(SearchResourceEncryptionKeyConverter.map(obj.getEncryptionKey())); } return searchIndexerSkillset; }
Source:
@Override public void completed(final Exchange exchange) { if (exchange.getOrigin() == Origin.LOCAL) { KeyMID idByMID = new KeyMID(exchange.getCurrentRequest().getMID()); KeyToken idByToken = new KeyToken(exchange.getCurrentRequest().getToken()); if (!exchange.getRequest().isMulticast() || isMulticastTimedOut(exchange)) { exchangesByToken.remove(idByToken); exchangesByMID.remove(idByMID); } } else { Response response = exchange.getCurrentResponse(); if (response != null && response.getType() != Type.ACK) { KeyMID midKey = new KeyMID(response.getMID(), null, 0); exchangesByMID.remove(midKey); } Request request = exchange.getCurrentRequest(); if (request != null && (request.getOptions().hasBlock1() || response.getOptions().hasBlock2())) { KeyUri uriKey = new KeyUri(request.getURI(), request.getSource().getAddress(), request.getSourcePort()); LOGGER.log(Level.FINE, "Remote ongoing completed, cleaning up ", uriKey); ongoingExchanges.remove(uriKey); } ObserveRelation relation = exchange.getRelation(); if (relation != null) { removeNotificationsOf(relation); } } }

Target:
@Override public void completed(final Exchange exchange) { if (exchange.getOrigin() == Origin.LOCAL) { KeyMID idByMID = new KeyMID(exchange.getCurrentRequest().getMID()); KeyToken idByToken = new KeyToken(exchange.getCurrentRequest().getToken()); exchangesByToken.remove(idByToken); exchangesByMID.remove(idByMID); } else { Response response = exchange.getCurrentResponse(); if (response != null && response.getType() != Type.ACK) { KeyMID midKey = new KeyMID(response.getMID(), null, 0); exchangesByMID.remove(midKey); } Request request = exchange.getCurrentRequest(); if (request != null && (request.getOptions().hasBlock1() || response.getOptions().hasBlock2())) { KeyUri uriKey = new KeyUri(request.getURI(), request.getSource().getAddress(), request.getSourcePort()); LOGGER.log(Level.FINE, "Remote ongoing completed, cleaning up ", uriKey); ongoingExchanges.remove(uriKey); } ObserveRelation relation = exchange.getRelation(); if (relation != null) { removeNotificationsOf(relation); } } }
Source:
public static List<ExtMap> fetchPrincipalsByIdsRecursively( final ExtensionProxy extension, final String namespace, final List<String> ids) { Map<String, ExtMap> groupsCache = new HashMap<>(); Set<String> idsToFetch = new HashSet<>(); List<ExtMap> principals = findPrincipalsByIds(extension, namespace, ids, true, false); for (ExtMap principal : principals) { for (ExtMap memberOf : principal.get(PrincipalRecord.GROUPS, Collections.<ExtMap> emptyList())) { idsToFetch.add(memberOf.<String> get(GroupRecord.ID)); } } while (!idsToFetch.isEmpty()) { List<ExtMap> groups = findGroupRecordsByIds(extension, namespace, new ArrayList<String>(idsToFetch), true, false); idsToFetch.clear(); for (ExtMap group : groups) { groupsCache.put(group.<String> get(GroupRecord.ID), group); for (ExtMap memberOf : group.get(GroupRecord.GROUPS, Collections.<ExtMap> emptyList())) { if (!groupsCache.containsKey(memberOf.get(GroupRecord.ID))) { idsToFetch.add(memberOf.<String> get(GroupRecord.ID)); } } } } for (ExtMap principal : principals) { constructGroupsMembershipTree(principal, PrincipalRecord.GROUPS, groupsCache); } return principals; }

Target:
public static List<ExtMap> fetchPrincipalsByIdsRecursively( final ExtensionProxy extension, final String namespace, final List<String> ids) { Map<String, ExtMap> groupsCache = new HashMap<>(); Map<String, Set<String>> idsToFetchPerNamespace = new HashMap<String, Set<String>>(); List<ExtMap> principals = findPrincipalsByIds(extension, namespace, ids, true, false); for (ExtMap principal : principals) { for (ExtMap memberOf : principal.get(PrincipalRecord.GROUPS, Collections.<ExtMap> emptyList())) { addIdToFetch(idsToFetchPerNamespace, memberOf); } } while (!idsToFetchPerNamespace.isEmpty()) { List<ExtMap> groups = new ArrayList<>(); for (String namespaceOfIdsToFetch: idsToFetchPerNamespace.keySet()) { groups.addAll(findGroupRecordsByIds(extension, namespace, new ArrayList<String>(idsToFetchPerNamespace.get(namespaceOfIdsToFetch)), true, false)); } idsToFetchPerNamespace.clear(); for (ExtMap group : groups) { groupsCache.put(group.<String> get(GroupRecord.ID), group); for (ExtMap memberOf : group.get(GroupRecord.GROUPS, Collections.<ExtMap> emptyList())) { if (!groupsCache.containsKey(memberOf.get(GroupRecord.ID))) { addIdToFetch(idsToFetchPerNamespace, memberOf); } } } } for (ExtMap principal : principals) { constructGroupsMembershipTree(principal, PrincipalRecord.GROUPS, groupsCache); } return principals; }
Source:
private ReferencedEnvelope getBoundsForGranuleCRS(GranuleDescriptor templateDescriptor, ReferencedEnvelope requestBounds) throws IOException { String crsAttribute = configuration.getCRSAttribute(); if (crsAttribute == null) { crsAttribute = CRSExtractor.DEFAULT_ATTRIBUTE_NAME; } GranuleSource granuleSource = getGranuleSource(true, null); if(granuleSource.getSchema().getDescriptor(crsAttribute) == null) { throw new IllegalStateException("Invalid heterogeneous mosaic configuration, " + "the crs property is missing collector must be configured"); } String granuleCRSCode = (String) templateDescriptor.getOriginator() .getAttribute(crsAttribute); FilterFactory2 ff = FeatureUtilities.DEFAULT_FILTER_FACTORY; PropertyIsEqualTo crsFilter = ff.equal(ff.property(crsAttribute), ff.literal(granuleCRSCode), false); BBOX bbox = ff.bbox(ff.property(""), requestBounds); Filter filter = ff.and(crsFilter, bbox); Query q = new Query(granuleSource.getSchema().getTypeName(), filter); SimpleFeatureCollection granules = granuleSource.getGranules(q); ReferencedEnvelope bounds = granules.getBounds(); return bounds; }

Target:
private ReferencedEnvelope getBoundsForGranuleCRS(GranuleDescriptor templateDescriptor, ReferencedEnvelope requestBounds) throws IOException { String crsAttribute = configuration.getCRSAttribute(); if (crsAttribute == null) { crsAttribute = CRSExtractor.DEFAULT_ATTRIBUTE_NAME; } GranuleSource granuleSource = getGranuleSource(true, null); if(granuleSource.getSchema().getDescriptor(crsAttribute) == null) { throw new IllegalStateException("Invalid heterogeneous mosaic configuration, " + "the 'crs' property is missing from the index schema"); } String granuleCRSCode = (String) templateDescriptor.getOriginator() .getAttribute(crsAttribute); FilterFactory2 ff = FeatureUtilities.DEFAULT_FILTER_FACTORY; PropertyIsEqualTo crsFilter = ff.equal(ff.property(crsAttribute), ff.literal(granuleCRSCode), false); BBOX bbox = ff.bbox(ff.property(""), requestBounds); Filter filter = ff.and(crsFilter, bbox); Query q = new Query(granuleSource.getSchema().getTypeName(), filter); SimpleFeatureCollection granules = granuleSource.getGranules(q); ReferencedEnvelope bounds = granules.getBounds(); return bounds; }
Source:
private void putElement(final String elemName, final Attributes atts, final boolean removeConref) throws SAXException { final Set<String> namespaces = new HashSet<>(32); try { pushcontentWriter.writeStartElement(elemName); for (int index = 0; index < atts.getLength(); index++) { final String name = atts.getQName(index); if (!removeConref || !ATTRIBUTE_NAME_CONREF.equals(name) && !ATTRIBUTE_NAME_CONACTION.equals(name)) { String value = atts.getValue(index); if (ATTRIBUTE_NAME_HREF.equals(name) || ATTRIBUTE_NAME_CONREF.equals(name)) { value = replaceURL(value); } final int offset = atts.getQName(index).indexOf(":"); final String prefix = offset != -1 ? atts.getQName(index).substring(0, offset) : ""; if (!namespaces.contains(prefix)) { namespaces.add(prefix); if (!(prefix.equals(""))) { pushcontentWriter.writeNamespace(prefix, atts.getURI(index)); } } pushcontentWriter.writeAttribute(prefix, atts.getURI(index), atts.getLocalName(index), value); } } if (ATTR_CONACTION_VALUE_PUSHREPLACE.equals(pushType) && atts.getValue(ATTRIBUTE_NAME_ID) == null && level == 1) { final String fragment = target.getFragment(); if (fragment == null) { logger.error(MessageUtils.getMessage("DOTJ041E", target.toString()).toString()); } else { String id; if (fragment.contains(SLASH)) { id = fragment.substring(fragment.lastIndexOf(SLASH) + 1); } else { id = fragment; } pushcontentWriter.writeAttribute(ATTRIBUTE_NAME_ID, id); } } } catch (final XMLStreamException e) { throw new SAXException(e); } }

Target:
private void putElement(final String elemName, final Attributes atts, final boolean removeConref) throws SAXException { final Set<String> namespaces = new HashSet<>(); try { pushcontentWriter.writeStartElement(elemName); for (int index = 0; index < atts.getLength(); index++) { final String name = atts.getQName(index); if (!removeConref || !ATTRIBUTE_NAME_CONREF.equals(name) && !ATTRIBUTE_NAME_CONACTION.equals(name)) { String value = atts.getValue(index); if (ATTRIBUTE_NAME_HREF.equals(name) || ATTRIBUTE_NAME_CONREF.equals(name)) { value = replaceURL(value); } final int offset = atts.getQName(index).indexOf(":"); final String prefix = offset != -1 ? atts.getQName(index).substring(0, offset) : ""; if (!namespaces.contains(prefix)) { namespaces.add(prefix); if (!prefix.isEmpty()) { pushcontentWriter.writeNamespace(prefix, atts.getURI(index)); } } pushcontentWriter.writeAttribute(prefix, atts.getURI(index), atts.getLocalName(index), value); } } if (ATTR_CONACTION_VALUE_PUSHREPLACE.equals(pushType) && atts.getValue(ATTRIBUTE_NAME_ID) == null && level == 1) { final String fragment = target.getFragment(); if (fragment == null) { logger.error(MessageUtils.getMessage("DOTJ041E", target.toString()).toString()); } else { String id; if (fragment.contains(SLASH)) { id = fragment.substring(fragment.lastIndexOf(SLASH) + 1); } else { id = fragment; } pushcontentWriter.writeAttribute(ATTRIBUTE_NAME_ID, id); } } } catch (final XMLStreamException e) { throw new SAXException(e); } }
Source:
public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { double total = price * volume; if (orderType == OrderType.BUY && total > cashInHand) { throw new StockMarketExpection(this.name + " cannot afford to buy this stock"); } Order order = null; if (orderType == OrderType.BUY) { order = new BuyOrder(symbol, volume, price, this); } else { order = new SellOrder(symbol, volume, price, this); } if (OrderUtility.isAlreadyPresent(ordersPlaced, order)) { throw new StockMarketExpection("There is already an order for this stock"); } if (orderType == OrderType.SELL && volume > OrderUtility.ownedQuantity(this.position, symbol)) { throw new StockMarketExpection("Sell order volume is larger than amount of stock owned"); } if (orderType == OrderType.SELL && !OrderUtility.owns(position, symbol)) { throw new StockMarketExpection(this.name + " cannot place a sell order for a stock not owned"); } m.addOrder(order); this.ordersPlaced.add(order); }

Target:
public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { double total = price * volume; Order order = null; if (orderType == OrderType.BUY) { order = new BuyOrder(symbol, volume, price, this); } else { order = new SellOrder(symbol, volume, price, this); } if (orderType == OrderType.BUY && total > cashInHand) { throw new StockMarketExpection(this.name + " cannot afford to buy this stock"); } if (OrderUtility.isAlreadyPresent(ordersPlaced, order)) { throw new StockMarketExpection("There is already an order for this stock"); } if (orderType == OrderType.SELL && volume > OrderUtility.ownedQuantity(this.position, symbol)) { throw new StockMarketExpection("Sell order volume is larger than amount of stock owned"); } if (orderType == OrderType.SELL && !OrderUtility.owns(position, symbol)) { throw new StockMarketExpection(this.name + " cannot place a sell order for a stock not owned"); } m.addOrder(order); this.ordersPlaced.add(order); }
Source:
public Set<String> getListOfRemoteIds(SyncManager syncManager, Set<String> localIds) { if (localIds == null) { return null; } final String idFieldName = getIdFieldName(); final Set<String> remoteIds = new HashSet<String>(); final StringBuilder soql = new StringBuilder("SELECT "); soql.append(idFieldName); soql.append(" FROM"); final String[] fromClause = query.toLowerCase().split("from"); soql.append(fromClause[1]); try { JSONArray records = startFetch(syncManager, 0, soql.toString()); remoteIds.addAll(parseIdsFromResponse(records)); while (records != null) { records = continueFetch(syncManager); remoteIds.addAll(parseIdsFromResponse(records)); } } catch (IOException e) { Log.e(TAG, "IOException thrown while fetching records", e); } catch (JSONException e) { Log.e(TAG, "JSONException thrown while fetching records", e); } return remoteIds; }

Target:
public Set<String> getListOfRemoteIds(SyncManager syncManager, Set<String> localIds) { if (localIds == null) { return null; } final String idFieldName = getIdFieldName(); final Set<String> remoteIds = new HashSet<String>(); final StringBuilder soql = new StringBuilder("SELECT "); soql.append(idFieldName); soql.append(" FROM"); final String[] fromClause = query.split("([fF][rR][oO][mM])"); soql.append(fromClause[1]); try { JSONArray records = startFetch(syncManager, 0, soql.toString()); remoteIds.addAll(parseIdsFromResponse(records)); while (records != null) { records = continueFetch(syncManager); remoteIds.addAll(parseIdsFromResponse(records)); } } catch (IOException e) { Log.e(TAG, "IOException thrown while fetching records", e); } catch (JSONException e) { Log.e(TAG, "JSONException thrown while fetching records", e); } return remoteIds; }
Source:
public RuleEvaluationWorker(Map<String, Set<String>> docsToCheckAndEvents) { this.docsToCheckAndEvents = docsToCheckAndEvents; List<String> docs = new ArrayList<String>(); docs.addAll(docsToCheckAndEvents.keySet()); setDocuments(Framework.getService(RepositoryManager.class).getDefaultRepositoryName(), docs); }

Target:
public RuleEvaluationWorker(Map<String, Set<String>> docsToCheckAndEvents) { this.docsToCheckAndEvents = docsToCheckAndEvents; List<String> docs = new ArrayList<>(); docs.addAll(docsToCheckAndEvents.keySet()); setDocuments(Framework.getService(RepositoryManager.class).getDefaultRepositoryName(), docs); }
Source:
private void validateCascadedValues(Object value, ValidationContext<?> context, ValueContext<?, ?> valueContext, Cascadable cascadable, ValidationOrder validationOrder) { for ( TypeVariable<?> cascadingTypeParameter : cascadable.getCascadingTypeParameters() ) { List<TypeVariable<?>> cascadingOrConstrainedTypeParametersOfValueType = getCorrespondingTypeParametersInSubType( value.getClass(), TypeHelper.getErasedReferenceType( cascadable.getCascadableType() ), cascadingTypeParameter ); for ( TypeVariable<?> cascadingOrConstrainedTypeParameterOfValueType : cascadingOrConstrainedTypeParametersOfValueType ) { ValueExtractor<?> extractor = valueExtractors.getCascadedValueExtractor( value.getClass(), cascadingOrConstrainedTypeParameterOfValueType ); valueContext.setCurrentTypeParameter( cascadingOrConstrainedTypeParameterOfValueType ); if ( extractor == null ) { continue; } CascadingValueReceiver receiver = new CascadingValueReceiver( context, valueContext, validationOrder ); ( (ValueExtractor) extractor ).extractValues( value, receiver ); } } }

Target:
private void validateCascadedValues(Object value, ValidationContext<?> context, ValueContext<?, ?> valueContext, Cascadable cascadable, ValidationOrder validationOrder) { for ( TypeVariable<?> cascadingTypeParameter : cascadable.getCascadingTypeParameters() ) { List<TypeVariable<?>> cascadingTypeParametersOfValueType = getCorrespondingTypeParametersInSubType( value.getClass(), TypeHelper.getErasedReferenceType( cascadable.getCascadableType() ), cascadingTypeParameter ); for ( TypeVariable<?> cascadingTypeParameterOfValueType : cascadingTypeParametersOfValueType ) { ValueExtractorDescriptor extractor = valueExtractors.getCascadedValueExtractor( value.getClass(), cascadingTypeParameterOfValueType ); if ( extractor == null ) { continue; } CascadingValueReceiver receiver = new CascadingValueReceiver( context, valueContext, validationOrder ); ( (ValueExtractor) extractor.getValueExtractor() ).extractValues( value, receiver ); } } }
Source:
private void initializeListLayout() { mList = (ListView) mParentActivity.findViewById(R.id.profile_options); ArrayList<String> options = new ArrayList <String>(); options.add("Field-Reports " + mUser.getFieldReportsCount()); options.add("Tasks " + mUser.getFieldReportsCount()); options.add("Sites " + mUser.getSitesCount()); if (mUser.isEmployee() || mUser.isManager()){ } mAdapter = new ProfileOptionsAdapter(getActivity(), R.layout.option_item, options); mList.setAdapter(mAdapter); mList.setOnItemClickListener(this); }

Target:
private void initializeListLayout() { mList = (ListView) mParentActivity.findViewById(R.id.profile_options); ArrayList<String> options = new ArrayList <String>(); options.add("Field-Reports " + mUser.getFieldReportsCount()); if (mUser.isEmployee() || mUser.isManager()){ } mAdapter = new ProfileOptionsAdapter(getActivity(), R.layout.option_item, options); mList.setAdapter(mAdapter); mList.setOnItemClickListener(this); }
Source:
public String getIdentityStream() { if(identityStream == null) { Map beatsData = (HashMap<String, String>) this.getData().get("beat"); if(beatsData != null) { String id = (String) beatsData.get("id"); String resourceId = (String) beatsData.get("resource_id"); if(id != null && resourceId != null) { identityStream = id + "-" + resourceId; } else { identityStream = (String) beatsData.get("name") + "-" + (String) beatsData.get("source"); } } } return identityStream; }

Target:
public String getIdentityStream() { return identityStream; }
Source:
public void should_fail_if_actual_contains_value_at_index() { AssertionInfo info = someInfo(); Index index = atIndex(0); Throwable error = catchThrowable(() -> arrays.assertDoesNotContain(info, actual, new int[] {0, 2, 4}, index)); assertThat(error).isInstanceOf(AssertionError.class); verify(failures).failure(info, shouldNotContainAtIndex(actual, new int[] {0, 2, 4}, index)); }

Target:
public void should_fail_if_actual_contains_value_at_index() { Index index = atIndex(0); int[] expectedElement = {0, 2, 4}; AssertionError assertionError = expectAssertionError(() -> arrays.assertDoesNotContain(someInfo(), actual, expectedElement, index)); then(assertionError).hasMessage(shouldNotContainAtIndex(actual, new int[] {0, 2, 4}, index).create()); }
Source:
private void onMouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (dbpath == SELECT_OPTION) { File dir = selectDirectory(); if (dir == null) { return; } dbload.setDatabase(dir.getAbsolutePath()); items.add(dir.getAbsolutePath()); list.getSelectionModel().select(getDBPath()); } else { progressDialog = new ProgressDialog(list.getParent()); dbload.restart(); } } }

Target:
private void onMouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { loadDB(); } }
Source:
public QuotaBalanceResponse createQuotaLastBalanceResponse(List<QuotaBalanceVO> quotaBalance, Date startDate) { if (quotaBalance.size() == 0) { new InvalidParameterValueException("There are no balance entries on or before the requested date."); } if (startDate == null) { startDate = new Date(); } QuotaBalanceResponse resp = new QuotaBalanceResponse(); BigDecimal lastCredits = new BigDecimal(0); for (Iterator<QuotaBalanceVO> it = quotaBalance.iterator(); it.hasNext();) { QuotaBalanceVO entry = it.next(); s_logger.info("createQuotaLastBalanceResponse Date=" + entry.getUpdatedOn() + " balance=" + entry.getCreditBalance() + " credit=" + entry.getCreditsId()); lastCredits = lastCredits.add(entry.getCreditBalance()); } resp.setStartQuota(lastCredits); resp.setStartDate(_quotaService.computeAdjustedTime(startDate)); resp.setCurrency(QuotaConfig.QuotaCurrencySymbol.value()); resp.setObjectName("balance"); return resp; }

Target:
public QuotaBalanceResponse createQuotaLastBalanceResponse(List<QuotaBalanceVO> quotaBalance, Date startDate) { if (quotaBalance == null || quotaBalance.size() == 0) { new InvalidParameterValueException("There are no balance entries on or before the requested date."); } if (startDate == null) { startDate = new Date(); } QuotaBalanceResponse resp = new QuotaBalanceResponse(); BigDecimal lastCredits = new BigDecimal(0); for (Iterator<QuotaBalanceVO> it = quotaBalance.iterator(); it.hasNext();) { QuotaBalanceVO entry = it.next(); if (s_logger.isDebugEnabled()){ s_logger.info("createQuotaLastBalanceResponse Date=" + entry.getUpdatedOn() + " balance=" + entry.getCreditBalance() + " credit=" + entry.getCreditsId()); } lastCredits = lastCredits.add(entry.getCreditBalance()); } resp.setStartQuota(lastCredits); resp.setStartDate(_quotaService.computeAdjustedTime(startDate)); resp.setCurrency(QuotaConfig.QuotaCurrencySymbol.value()); resp.setObjectName("balance"); return resp; }
Source:
protected void updateMemoryBalloon() { if (getModel().getSelectedCluster() != null) { VDSGroup cluster = getModel().getSelectedCluster(); boolean hasMemoryBalloon = (cluster.getcompatibility_version() .compareTo(VmListModel.BALLOON_DEVICE_MIN_VERSION) >= 0 && cluster.getArchitecture() .compareTo(VmListModel.BALLOON_DEVICE_BLACKLISTED_ARCH) != 0); getModel().getMemoryBalloonDeviceEnabled().setIsAvailable(hasMemoryBalloon); } }

Target:
protected void updateMemoryBalloon() { if (getModel().getSelectedCluster() != null) { VDSGroup cluster = getModel().getSelectedCluster(); boolean hasMemoryBalloon = (cluster.getcompatibility_version() .compareTo(VmListModel.BALLOON_DEVICE_MIN_VERSION) >= 0 && cluster.getArchitecture() .equals(VmListModel.BALLOON_DEVICE_BLACKLISTED_ARCH)); getModel().getMemoryBalloonDeviceEnabled().setIsAvailable(hasMemoryBalloon); } }
Source:
public int[] convertFromState(State value, ComfoAirCommandType commandType) { int[] template = commandType.getChangeDataTemplate(); int[] possibleValues = commandType.getPossibleValues(); int intValue = ((DecimalType) value).intValue(); if (possibleValues == null) { template[commandType.getChangeDataPos()] = intValue; } else { for (int i = 0; i < possibleValues.length; i++) { if (possibleValues[i] == intValue) { template[commandType.getChangeDataPos()] = intValue; break; } } } System.out.println(template); return template; }

Target:
public int[] convertFromState(State value, ComfoAirCommandType commandType) { if (value == null || commandType == null) { logger.trace("\"DataTypeNumber\" class \"convertFromState\" method parameter: null"); return null; } else { int[] template = commandType.getChangeDataTemplate(); int[] possibleValues = commandType.getPossibleValues(); int position = commandType.getChangeDataPos(); int intValue = ((DecimalType) value).intValue(); if (possibleValues == null) { template[position] = intValue; } else { for (int i = 0; i < possibleValues.length; i++) { if (possibleValues[i] == intValue) { template[position] = intValue; break; } } } return template; } }
Source:
synchronized void sendMessageToListeners(LIRCResponse message) { try { for (LIRCEventListener listener : listeners) { listener.messageReceived(message); } } catch (Exception e) { logger.error("Error invoking event listener", e); } }

Target:
public synchronized void sendMessageToListeners(LIRCResponse message) { try { for (LIRCEventListener listener : listeners) { listener.messageReceived(message); } } catch (Exception e) { logger.error("Error invoking event listener", e); } }
Source:
public boolean tick() { profiler.startSection("providerTick(" + cubeMap.getSize() + ")"); long i = System.currentTimeMillis(); int randomTickSpeed = this.world.getGameRules().getInt("randomTickSpeed"); Random rand = this.world.rand; for (Cube cube : cubeMap) { cube.tickCubeServer(() -> System.currentTimeMillis() - i > 40, rand); if (cube.isEmpty()) continue; int randomTickCounter = randomTickSpeed; while (--randomTickCounter > 0) cube.randomTick(this.world, rand); } profiler.endSection(); return false; }

Target:
public boolean tick() { profiler.startSection("providerTick("+cubeMap.getSize()+")"); long i = System.currentTimeMillis(); int randomTickSpeed = this.world.getGameRules().getInt("randomTickSpeed"); Random rand = this.world.rand; for (Cube cube : cubeMap) { cube.tickCubeServer(() -> System.currentTimeMillis() - i > 40, rand); if (cube.isEmpty() || !doRandomBlockTicksHere) continue; int randomTickCounter = randomTickSpeed; while (randomTickCounter-- > 0) cube.randomTick(this.world, rand); } profiler.endSection(); return false; }
Source:
private FieldValue convert(Map.Entry<String, JsonNode> entry) { return fieldsConfiguration.getField(entry.getKey()).getRegister().isPresent() ? new LinkValue(entry.getKey(), entry.getValue().textValue()) : new StringValue(entry.getValue().textValue()); }

Target:
private FieldValue convert(Map.Entry<String, JsonNode> entry) { Optional<String> register = fieldsConfiguration.getField(entry.getKey()).getRegister(); return register.isPresent() ? new LinkValue(register.get(), entry.getValue().textValue()) : new StringValue(entry.getValue().textValue()); }