auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testSaveSettings() throws BundleException { SettingsDto dto = new SettingsDto(); dto.setTaskPossibleErrors(TASK_POSSIBLE_ERRORS_VALUE); dto.setTaskLogActivities(TASK_LOG_ACTIVITIES_VALUE); controller.saveSettings(dto); verify(settingsFacade, times(1)).setProperty(eq(TASK_LOG_ACTIVITIES_KEY), anyString()); verify(settingsFacade, times(1)).setProperty(eq(TASK_POSSIBLE_ERRORS_KEY), anyString()); }

Target:
public void testSaveSettings() throws BundleException { SettingsDto dto = new SettingsDto(); dto.setTaskPossibleErrors(TASK_POSSIBLE_ERRORS_VALUE); dto.setTaskLogActivities(TASK_LOG_ACTIVITIES_VALUE); controller.saveSettings(dto); verify(settingsFacade, times(1)).setProperty(eq(TASK_LOG_ACTIVITIES_KEY), eq(TASK_LOG_ACTIVITIES_VALUE)); verify(settingsFacade, times(1)).setProperty(eq(TASK_POSSIBLE_ERRORS_KEY), eq(TASK_POSSIBLE_ERRORS_VALUE)); }
Source:
private MenuCell<GlusterTaskSupport> getRebalanceActivityMenu(ApplicationConstants constants) { MenuCell<GlusterTaskSupport> menuCell = new MenuCell<GlusterTaskSupport>() { @Override protected boolean isVisible(GlusterTaskSupport value) { return value.getAsyncTask().getType() == GlusterTaskType.REBALANCE; } }; menuCell.addMenuItem(constants.statusRebalance(), getMainModel().getStatusRebalanceCommand()); menuCell.addMenuItem(constants.stopRebalance(), getMainModel().getStopRebalanceCommand()); return menuCell; }

Target:
private MenuCell<GlusterTaskSupport> getRebalanceActivityMenu(ApplicationConstants constants) { MenuCell<GlusterTaskSupport> menuCell = new MenuCell<GlusterTaskSupport>() { @Override protected boolean isVisible(GlusterTaskSupport value) { return value.getAsyncTask() != null && value.getAsyncTask().getType() == GlusterTaskType.REBALANCE; } }; menuCell.addMenuItem(constants.statusRebalance(), getMainModel().getStatusRebalanceCommand()); menuCell.addMenuItem(constants.stopRebalance(), getMainModel().getStopRebalanceCommand()); return menuCell; }
Source:
public static void main(String[] args) { final Logger logger = LoggerFactory.getLogger(App.class); var guard = new Guard(); var thief = new Thief(); if (guard instanceof Permission) { guard.enter(); } else { logger.info("You have no permission to enter, please leave this area"); } if (thief instanceof Permission) { thief.doNothing(); } else { thief.doNothing(); } }

Target:
public static void main(String[] args) { final var logger = LoggerFactory.getLogger(App.class); var guard = new Guard(); var thief = new Thief(); if (guard instanceof Permission) { guard.enter(); } else { logger.info("You have no permission to enter, please leave this area"); } if (thief instanceof Permission) { thief.steal(); } else { thief.doNothing(); } }
Source:
public void testThreadInterruptedDuringLocking() throws Throwable { final Cache<String, String> cache = cache(0, "timestamps"); cache.put("k", "v"); TransactionManager tm = cache.getAdvancedCache().getTransactionManager(); tm.begin(); cache.put("k", "v2"); Transaction tx = tm.suspend(); final List<Throwable> throwables = new LinkedList<Throwable>(); Thread th = new Thread() { public void run() { try { cache.put("k", "v3"); } catch (Throwable th) { throwables.add(th); } } }; th.start(); th.interrupt(); th.join(); tm.resume(tx); tm.rollback(); assert throwables.size() == 1; assert throwables.get(0) instanceof CacheException; assert throwables.get(0).getCause() instanceof InterruptedException; }

Target:
public void testThreadInterruptedDuringLocking() throws Throwable { final Cache<String, String> cache = cache(0, "timestamps"); cache.put("k", "v"); TransactionManager tm = cache.getAdvancedCache().getTransactionManager(); tm.begin(); cache.put("k", "v2"); Transaction tx = tm.suspend(); final List<Throwable> throwables = new LinkedList<Throwable>(); Thread th = new Thread() { public void run() { try { cache.put("k", "v3"); } catch (Throwable th) { throwables.add(th); } } }; th.start(); th.interrupt(); th.join(); tm.resume(tx); tm.rollback(); assertEquals(1, throwables.size()); assertTrue(throwables.get(0) instanceof CacheException); assertTrue(throwables.get(0).getCause() instanceof InterruptedException); }
Source:
public void onApiChange(SyncthingService.State currentState) { if (getActivity() == null || getActivity().isFinishing()) { return; } else if (currentState != SyncthingService.State.ACTIVE) { getActivity().finish(); } if (mIsCreate) { getActivity().setTitle(R.string.add_device); } else { getActivity().setTitle(R.string.edit_device); List<RestApi.Device> devices = mSyncthingService.getApi().getDevices(false); for (int i = 0; i < devices.size(); i++) { if (devices.get(i).DeviceID.equals( getActivity().getIntent().getStringExtra(EXTRA_NODE_ID))) { mDevice = devices.get(i); break; } } mDeviceId.setOnPreferenceClickListener(this); } if (mDevice == null) { Log.d(TAG, "Empty mDevice"); getActivity().finish(); return; } mSyncthingService.getApi().getConnections(DeviceSettingsFragment.this); mDeviceId.setSummary(mDevice.DeviceID); mName.setText((mDevice.Name)); mName.setSummary(mDevice.Name); mAddresses.setText(mDevice.Addresses); mAddresses.setSummary(mDevice.Addresses); mCompression.setValue(mDevice.Compression); mCompression.setSummary(mDevice.Compression); }

Target:
public void onApiChange(SyncthingService.State currentState) { if (getActivity() == null || getActivity().isFinishing()) { return; } else if (currentState != SyncthingService.State.ACTIVE) { getActivity().finish(); } if (mIsCreate) { getActivity().setTitle(R.string.add_device); } else { RestApi.Device device = null; getActivity().setTitle(R.string.edit_device); List<RestApi.Device> devices = mSyncthingService.getApi().getDevices(false); for (int i = 0; i < devices.size(); i++) { if (devices.get(i).DeviceID.equals( getActivity().getIntent().getStringExtra(EXTRA_NODE_ID))) { device = devices.get(i); break; } } if (device == null) { Log.w(TAG, "Device not found in API update"); getActivity().finish(); return; } mDevice = device; mDeviceId.setOnPreferenceClickListener(this); } mSyncthingService.getApi().getConnections(DeviceSettingsFragment.this); mDeviceId.setSummary(mDevice.DeviceID); mName.setText((mDevice.Name)); mName.setSummary(mDevice.Name); mAddresses.setText(mDevice.Addresses); mAddresses.setSummary(mDevice.Addresses); mCompression.setValue(mDevice.Compression); mCompression.setSummary(mDevice.Compression); }
Source:
public ActionsCategory handleSingleNode(ActionsCategory category, ActionsManager manager, Element element) { if (element == null) { return null; } if (element instanceof Package) { copyAction = new CopyAction(element); } if (element instanceof Classifier) { final Classifier classifier = (Classifier) element; validateAction = new ValidateAction(classifier); ontoBehaviorAction = new CreateOntoBehaviorBlocks(classifier, false); specializeStructureAction = new SpecializeStructuresAction(classifier, false, ID_NONRECURSIVE, false, false); specializeStructureRecursiveAction = new SpecializeStructuresAction(classifier, false, ID_RECURSIVE, true, false); createBSTAction = new SpecializeStructuresAction(classifier, false, ID_RECURSIVE_INDIVIDUALLY, true, true); createInstanceMenuAction = new CreateInstanceMenuAction(classifier); aspectAction = new AspectAction(classifier); copyAction = new CopyAction(element); if (classifier instanceof Behavior) { } } else if (element instanceof InstanceSpecification) { final InstanceSpecification instance = (InstanceSpecification) element; validateAction = new ValidateAction(instance); ArrayList<InstanceSpecification> insts = new ArrayList(); insts.add(instance); instance2BSTAction = new Instance2BSTAction(insts); } else { return null; } return category; }

Target:
public ActionsCategory handleSingleNode(ActionsCategory category, ActionsManager manager, Element element) { if (element == null) { return null; } if (element instanceof Package) { copyAction = new CopyAction(element); } if (element instanceof Classifier) { final Classifier classifier = (Classifier) element; validateAction = new ValidateAction(classifier); ontoBehaviorAction = new CreateOntoBehaviorBlocks(classifier, false); specializeStructureAction = new SpecializeStructureAction(classifier, false, ID, false, false); specializeStructureRecursiveAction = new SpecializeStructureAction(classifier, false, ID_RECURSIVE, true, false); createBSTAction = new SpecializeStructureAction(classifier, false, ID_RECURSIVE_INDIVIDUAL, true, true); createInstanceMenuAction = new CreateInstanceMenuAction(classifier); aspectAction = new AspectAction(classifier); copyAction = new CopyAction(element); if (classifier instanceof Behavior) { } } else if (element instanceof InstanceSpecification) { final InstanceSpecification instance = (InstanceSpecification) element; validateAction = new ValidateAction(instance); ArrayList<InstanceSpecification> insts = new ArrayList(); insts.add(instance); instance2BSTAction = new Instance2BSTAction(insts); } else { return null; } return category; }
Source:
private void validateEntry(Element element) throws Exception { FileEntry entry = new FileEntry(); NodeList nl = element.getElementsByTagName("td"); int len = nl.getLength(); if (len < 5) { return; } assertEquals(5, len); entry.name = getFilename(nl.item(1)); entry.href = getHref(nl.item(1)); entry.lastModified = getLastModified(nl.item(3)); try { entry.size = getSize(nl.item(4)); } catch (NumberFormatException e) { entry.size = "invalid size"; } for (int ii = 0; ii < entries.length; ++ii) { if (entries[ii] != null && entries[ii].compareTo(entry) == 0) { entries[ii] = null; return; } } fail("Could not find a match for: " + entry.name); }

Target:
private void validateEntry(Element element) throws Exception { FileEntry entry = new FileEntry(); NodeList nl = element.getElementsByTagName("td"); int len = nl.getLength(); if (len < 5) { return; } assertEquals(5, len); entry.name = getFilename(nl.item(1)); entry.href = getHref(nl.item(1)); entry.lastModified = getLastModified(nl.item(3)); entry.size = getSize(nl.item(4)); for (int ii = 0; ii < entries.length; ++ii) { if (entries[ii] != null && entries[ii].compareTo(entry) == 0) { entries[ii] = null; return; } } fail("Could not find a match for: " + entry.name); }
Source:
public void testSubstitution() { RuntimeMacro runtimeMacro = new RuntimeMacro(); MacroContext macroContext = new DefaultMacroContext(0, TimeZone.getTimeZone("UTC")); Assert.assertEquals("1970-01-01", runtimeMacro.getValue("yyyy-MM-dd", macroContext)); Assert.assertEquals("1970-01-02", runtimeMacro.getValue("yyyy-MM-dd,-1d", macroContext)); macroContext = new DefaultMacroContext(1451606400000L, TimeZone.getTimeZone("UTC")); Assert.assertEquals("2016-01-01", runtimeMacro.getValue("yyyy-MM-dd", macroContext)); Assert.assertEquals("2015-12-31", runtimeMacro.getValue("yyyy-MM-dd,1d", macroContext)); Assert.assertEquals("2015-12-31T00:00:00", runtimeMacro.getValue("yyyy-MM-dd'T'HH:mm:ss,1d", macroContext)); Assert.assertEquals("2015-12-31T12:00:00", runtimeMacro.getValue("yyyy-MM-dd'T'HH:mm:ss,1d-12h", macroContext)); Assert.assertEquals("2015-12-31T11:29:45", runtimeMacro.getValue("yyyy-MM-dd'T'HH:mm:ss,1d-12h+30m+15s", macroContext)); }

Target:
public void testSubstitution() { RuntimeMacro runtimeMacro = new RuntimeMacro(); MacroContext macroContext = new DefaultMacroContext(0, TimeZone.getTimeZone("UTC")); Assert.assertEquals("1970-01-01", runtimeMacro.getValue("yyyy-MM-dd", macroContext)); Assert.assertEquals("1969-12-31", runtimeMacro.getValue("yyyy-MM-dd,1d", macroContext)); Assert.assertEquals("1969-12-31", runtimeMacro.getValue("yyyy-MM-dd,+1d", macroContext)); Assert.assertEquals("1970-01-02", runtimeMacro.getValue("yyyy-MM-dd,-1d", macroContext)); macroContext = new DefaultMacroContext(1451606400000L, TimeZone.getTimeZone("UTC")); Assert.assertEquals("2016-01-01", runtimeMacro.getValue("yyyy-MM-dd", macroContext)); Assert.assertEquals("2015-12-31", runtimeMacro.getValue("yyyy-MM-dd,1d", macroContext)); Assert.assertEquals("2015-12-31T00:00:00", runtimeMacro.getValue("yyyy-MM-dd'T'HH:mm:ss,1d", macroContext)); Assert.assertEquals("2015-12-31T12:00:00", runtimeMacro.getValue("yyyy-MM-dd'T'HH:mm:ss,1d-12h", macroContext)); Assert.assertEquals("2015-12-31T11:29:45", runtimeMacro.getValue("yyyy-MM-dd'T'HH:mm:ss,1d-12h+30m+15s", macroContext)); }
Source:
public MapReduceTask<KIn, VIn, KOut, VOut> usingSharedIntermediateCache(String cacheName, String cacheConfigurationName) { if (cacheConfigurationName == null || cacheConfigurationName.isEmpty()) { throw new IllegalArgumentException("cacheConfigurationName can not be " + cacheConfigurationName + " Make sure to define a valid cache configuration on all nodes where this task will be executed"); } this.customIntermediateCacheName = cacheName; this.intermediateCacheConfigurationName = cacheConfigurationName; this.useIntermediateSharedCache = true; return this; }

Target:
public MapReduceTask<KIn, VIn, KOut, VOut> usingSharedIntermediateCache(String cacheName, String cacheConfigurationName) { if (cacheConfigurationName == null || cacheConfigurationName.isEmpty()) { throw new IllegalArgumentException("Invalid configuration name " + cacheConfigurationName + ", cacheConfigurationName cannot be null or empty"); } if (cacheName == null || cacheName.isEmpty()) { throw new IllegalArgumentException("Invalid cache name" + cacheName + ", cache name cannot be null or empty"); } this.customIntermediateCacheName = cacheName; this.intermediateCacheConfigurationName = cacheConfigurationName; this.useIntermediateSharedCache = true; return this; }
Source:
public BatchingLeaderElectionService(LeaderElectionService delegate) { this.delegate = delegate; this.batcher = DisruptorAutobatcher.create(batch -> { try { LeaderElectionService.LeadershipToken leadershipToken = delegate.blockOnBecomingLeader(); batch.forEach(e -> e.result().set(leadershipToken)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } }); }

Target:
public BatchingLeaderElectionService(LeaderElectionService delegate) { this.delegate = delegate; this.batcher = DisruptorAutobatcher.create(this::processBatch); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof NetworkStatistics) return false; NetworkStatistics other = (NetworkStatistics) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (receiveDropRate == null) { if (other.receiveDropRate != null) return false; } else if (!receiveDropRate.equals(other.receiveDropRate)) return false; if (receiveRate == null) { if (other.receiveRate != null) return false; } else if (!receiveRate.equals(other.receiveRate)) return false; if (status != other.status) return false; if (transmitDropRate == null) { if (other.transmitDropRate != null) return false; } else if (!transmitDropRate.equals(other.transmitDropRate)) return false; if (transmitRate == null) { if (other.transmitRate != null) return false; } else if (!transmitRate.equals(other.transmitRate)) return false; return true; }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof NetworkStatistics)) return false; NetworkStatistics other = (NetworkStatistics) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (receiveDropRate == null) { if (other.receiveDropRate != null) return false; } else if (!receiveDropRate.equals(other.receiveDropRate)) return false; if (receiveRate == null) { if (other.receiveRate != null) return false; } else if (!receiveRate.equals(other.receiveRate)) return false; if (status != other.status) return false; if (transmitDropRate == null) { if (other.transmitDropRate != null) return false; } else if (!transmitDropRate.equals(other.transmitDropRate)) return false; if (transmitRate == null) { if (other.transmitRate != null) return false; } else if (!transmitRate.equals(other.transmitRate)) return false; return true; }
Source:
public void returnsMethod() throws IOException { MatcherAssert.assertThat( new RqMethod.Base(new RqFake(RqMethod.Base.POST)).method(), Matchers.equalTo(RqMethod.Base.POST) ); }

Target:
public void returnsMethod() throws IOException { MatcherAssert.assertThat( new RqMethod.Base(new RqFake(RqMethod.POST)).method(), Matchers.equalTo(RqMethod.POST) ); }
Source:
public String pipeCommand() { sc.addFile(scriptsDir, true); sc.addFile(projectDbFile); return "bash scripts/run_tara_referenceextraction.sh"; }

Target:
public String pipeCommand() { return "bash scripts/run_tara_referenceextraction.sh"; }
Source:
default List<@Nullable Object> queryOngoing() { List<@Nullable Object> retVal = new ArrayList<>(); for (int attr = 0; attr < getNbAttributes(); attr++) { retVal.add(queryOngoingState(attr).unboxValue()); } return retVal; }

Target:
default List<@Nullable Object> queryOngoing() { List<@Nullable Object> retVal = new ArrayList<>(); for (int attr = 0; attr < getNbAttributes(); attr++) { retVal.add(queryOngoing(attr)); } return retVal; }
Source:
public Result<K, T> execute(Query<K, T> query) throws GoraException { Collection<String> range = runQuery(query); RedisResult<K, T> redisResult = new RedisResult<>(this, query, range); return redisResult; }

Target:
public Result<K, T> execute(Query<K, T> query) throws GoraException { return new RedisResult<>(this, query, runQuery(query)); }
Source:
public List<Connection> getTransitivelyConnectedElements(EObject element, EObject traceModel, int maximumDepth) { ArrayList<Object> accumulator = new ArrayList<>(); return getTransitivelyConnectedElements(element, traceModel, accumulator, -2, maximumDepth); }

Target:
public List<Connection> getTransitivelyConnectedElements(EObject element, EObject traceModel, int maximumDepth) { ArrayList<Object> accumulator = new ArrayList<>(); return getTransitivelyConnectedElements(element, traceModel, accumulator, DEFAULT_INITIAL_TRANSITIVITY_DEPTH, maximumDepth); }
Source:
public static void transferStreams(InputStream source, OutputStream destination, String path, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor); try { byte[] buffer = new byte[8192]; while (true) { int bytesRead = -1; try { bytesRead = source.read(buffer); } catch (IOException e) { fail("Failed to read during transferStreams", e); } if (bytesRead == -1) break; try { destination.write(buffer, 0, bytesRead); } catch (IOException e) { fail("Failed to write during transferStreams", e); } subMonitor.split(1); } } finally { try { source.close(); } catch (IOException e) { } finally { try { destination.close(); } catch (IOException e) { } } } }

Target:
public static void transferStreams(InputStream source, OutputStream destination, String path, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor); try { byte[] buffer = new byte[8192]; while (true) { int bytesRead = -1; try { bytesRead = source.read(buffer); } catch (IOException e) { fail("Failed to read during transferStreams", e); } if (bytesRead == -1) break; try { destination.write(buffer, 0, bytesRead); } catch (IOException e) { fail("Failed to write during transferStreams", e); } subMonitor.setWorkRemaining(100).split(1); } } finally { try { source.close(); } catch (IOException e) { } finally { try { destination.close(); } catch (IOException e) { } } } }
Source:
public void bindExtensions(String[] theExtensions, boolean isRoot) { if (theExtensions == null) { return; } for (String theExtension : theExtensions) { programmaticVisibilityBindings.add(theExtension); if (isRoot) { programmaticRootBindings.add(theExtension); } } notifyClients(); }

Target:
public void bindExtensions(String[] theExtensions, boolean isRoot) { if (theExtensions == null) { return; } for (String extension : theExtensions) { programmaticVisibilityBindings.add(extension); if (isRoot) { programmaticRootBindings.add(extension); } } notifyClients(); }
Source:
public void query(Writer out) throws OrmException, QueryParseException, IOException { if (imp.isDisabled()) { throw new QueryParseException("query disabled"); } if (queries == null) { queries = Collections.singletonList("status:open"); } List<List<ChangeInfo>> res = Lists.newArrayListWithCapacity(queries.size()); for (String query : queries) { List<ChangeData> changes = imp.queryChanges(query, defaultField); boolean moreChanges = imp.getLimit() > 0 && changes.size() > imp.getLimit(); if (moreChanges) { if (reverse) { changes = changes.subList(1, changes.size()); } else { changes = changes.subList(0, imp.getLimit()); } } List<ChangeInfo> info = Lists.newArrayListWithCapacity(changes.size()); for (ChangeData cd : changes) { info.add(toChangeInfo(cd)); } if (moreChanges && !info.isEmpty()) { if (reverse) { info.get(0)._moreChanges = true; } else { info.get(info.size() - 1)._moreChanges = true; } } res.add(info); } if (format.isJson()) { format.newGson().toJson( res.size() == 1 ? res.get(0) : res, new TypeToken<List<ChangeInfo>>() {}.getType(), out); out.write('\n'); } else { for (List<ChangeInfo> info : res) { for (ChangeInfo c : info) { String id = new Change.Key(c.id).abbreviate(); String subject = c.subject; if (subject.length() + id.length() > 80) { subject = subject.substring(0, 80 - id.length()); } out.write(id); out.write(' '); out.write(subject.replace('\n', ' ')); out.write('\n'); } } } }

Target:
public void query(Writer out) throws OrmException, QueryParseException, IOException { if (imp.isDisabled()) { throw new QueryParseException("query disabled"); } if (queries == null || queries.isEmpty()) { queries = Collections.singletonList("status:open"); } else if (queries.size() > 10) { throw new QueryParseException("limit of 10 queries"); } List<List<ChangeInfo>> res = Lists.newArrayListWithCapacity(queries.size()); for (String query : queries) { List<ChangeData> changes = imp.queryChanges(query); boolean moreChanges = imp.getLimit() > 0 && changes.size() > imp.getLimit(); if (moreChanges) { if (reverse) { changes = changes.subList(1, changes.size()); } else { changes = changes.subList(0, imp.getLimit()); } } List<ChangeInfo> info = Lists.newArrayListWithCapacity(changes.size()); for (ChangeData cd : changes) { info.add(toChangeInfo(cd)); } if (moreChanges && !info.isEmpty()) { if (reverse) { info.get(0)._moreChanges = true; } else { info.get(info.size() - 1)._moreChanges = true; } } res.add(info); } if (format.isJson()) { format.newGson().toJson( res.size() == 1 ? res.get(0) : res, new TypeToken<List<ChangeInfo>>() {}.getType(), out); out.write('\n'); } else { boolean firstQuery = true; for (List<ChangeInfo> info : res) { if (firstQuery) { firstQuery = false; } else { out.write('\n'); } for (ChangeInfo c : info) { String id = new Change.Key(c.id).abbreviate(); String subject = c.subject; if (subject.length() + id.length() > 80) { subject = subject.substring(0, 80 - id.length()); } out.write(id); out.write(' '); out.write(subject.replace('\n', ' ')); out.write('\n'); } } } }
Source:
public static FunctionDefinition createFunctionDefinition( String name, String className, FunctionLanguage functionLanguage, ReadableConfig config) { switch (functionLanguage) { case PYTHON: return createPythonFunctionDefinition(name, className, config); default: return createJavaFunctionDefinition(name, className); } }

Target:
public static FunctionDefinition createFunctionDefinition( String name, String className, FunctionLanguage functionLanguage, ReadableConfig config) { if (functionLanguage == FunctionLanguage.PYTHON) { return createPythonFunctionDefinition(name, className, config); } else { return createJavaFunctionDefinition(name, className); } }
Source:
private void doBulkFileRepositoryLookup(List<AbstractFile> files) throws TskCoreException { try { BulkExistenceResult results = FileRepository.exists(files); for (AbstractFile file : files) { BulkExistenceEnum result = results.getResult(file); if (result != null && result.equals(BulkExistenceEnum.TRUE)) { fileRepositoryLookupCache.put(file.getId(), FileRepoState.EXISTS); } else if (result != null && result.equals(BulkExistenceEnum.FALSE)) { fileRepositoryLookupCache.put(file.getId(), FileRepoState.DOES_NOT_EXIST); } } } catch (IOException | FileRepositoryException ex) { throw new TskCoreException("Error looking up file in file repository"); } }

Target:
private void doBulkFileRepositoryLookup(List<AbstractFile> files) throws TskCoreException { try { BulkExistenceResult results = FileRepository.exists(files); for (AbstractFile file : files) { BulkExistenceEnum result = results.getResult(file); if (result != null && result.equals(BulkExistenceEnum.TRUE)) { fileRepositoryLookupCache.put(file.getId(), FileRepoState.EXISTS); } else if (result != null && result.equals(BulkExistenceEnum.FALSE)) { fileRepositoryLookupCache.put(file.getId(), FileRepoState.DOES_NOT_EXIST); } } } catch (IOException | FileRepositoryException ex) { throw new TskCoreException("Error looking up file in file repository", ex); } }
Source:
private static String splitCamelCase(@NotNull String string) { StringBuilder sb = new StringBuilder(2 * string.length()); int n = string.length(); boolean lastWasUpperCase = Character.isUpperCase(string.charAt(0)); boolean capitalizeNext = true; for (int i = 0; i < n; i++) { char c = string.charAt(i); boolean isUpperCase = Character.isUpperCase(c); if (isUpperCase && !lastWasUpperCase) { sb.append(' '); capitalizeNext = true; } lastWasUpperCase = isUpperCase; if (capitalizeNext) { c = Character.toUpperCase(c); capitalizeNext = false; } else { c = Character.toLowerCase(c); } sb.append(c); } return sb.toString(); }

Target:
static String splitCamelCase(@NotNull String string) { StringBuilder sb = new StringBuilder(2 * string.length()); int n = string.length(); boolean lastWasUpperCase = Character.isUpperCase(string.charAt(0)); boolean capitalizeNext = true; for (int i = 0; i < n; i++) { char c = string.charAt(i); boolean isUpperCase = Character.isUpperCase(c); if (isUpperCase && !lastWasUpperCase) { sb.append(' '); capitalizeNext = true; } lastWasUpperCase = isUpperCase; if (capitalizeNext) { c = Character.toUpperCase(c); capitalizeNext = false; } else { c = Character.toLowerCase(c); } sb.append(c); } return sb.toString(); }
Source:
public ExtendDeclaration(String name, String fqname, String documentation, List<MessageType.Field> fields) { this.name = name; this.fqname = fqname; this.documentation = documentation; this.fields = fields; }

Target:
public ExtendDeclaration(String name, String fqname, String documentation, List<MessageType.Field> fields) { this.name = name; this.fqname = fqname; this.documentation = documentation; this.fields = Collections.unmodifiableList(new ArrayList<MessageType.Field>(fields)); }
Source:
private static String convertParamType(final String type) { if (type.startsWith("com.spectralogic.s3.common.dao.domain")) { final String[] packageParts = type.split("\\."); return MODELS_PACKAGE + packageParts[packageParts.length - 1]; } return type; }

Target:
private static String convertParamType(final String type) { if (type.startsWith(CONTRACT_PACKAGE)) { final String[] packageParts = type.split("\\."); return MODELS_PACKAGE + packageParts[packageParts.length - 1]; } return type; }
Source:
public void testSetupLayout() { testInputProperties.setupProperties(); testInputProperties.connection.init(); testInputProperties.datasetProperties.init(); testInputProperties.datasetProperties.main.init(); testInputProperties.inputSchema.init(); testInputProperties.setupLayout(); Form main = testInputProperties.getForm(Form.MAIN); assertNotNull(main.getWidget(testInputProperties.connection)); assertNotNull(main.getWidget(testInputProperties.criteria)); assertNull(main.getWidget(testInputProperties.maxRetrieve)); assertNull(main.getWidget(testInputProperties.pageSize)); assertNull(main.getWidget(testInputProperties.useQueryOption)); assertNull(main.getWidget(testInputProperties.queryLiteralType)); assertNull(main.getWidget(testInputProperties.queryOptionName)); assertNull(main.getWidget(testInputProperties.queryOptionLiterals)); Form advanced = testInputProperties.getForm(Form.ADVANCED); assertNotNull(advanced.getWidget(testInputProperties.maxRetrieve)); assertNotNull(advanced.getWidget(testInputProperties.pageSize)); assertNotNull(advanced.getWidget(testInputProperties.useQueryOption)); assertNotNull(advanced.getWidget(testInputProperties.queryLiteralType)); assertNotNull(advanced.getWidget(testInputProperties.queryOptionName)); assertNotNull(advanced.getWidget(testInputProperties.queryOptionLiterals)); }

Target:
public void testSetupLayout() { testInputProperties.setupProperties(); testInputProperties.connection.init(); testInputProperties.datasetProperties.init(); testInputProperties.datasetProperties.main.init(); testInputProperties.inputSchema.init(); testInputProperties.init(); Form main = testInputProperties.getForm(Form.MAIN); assertNotNull(main.getWidget(testInputProperties.connection)); assertNotNull(((Form)main.getWidget("datasetProperties").getContent()).getWidget(testInputProperties.datasetProperties.criteria)); assertNull(main.getWidget(testInputProperties.maxRetrieve)); assertNull(main.getWidget(testInputProperties.datasetProperties.pageSize)); assertNull(main.getWidget(testInputProperties.datasetProperties.useQueryOption)); assertNull(main.getWidget(testInputProperties.datasetProperties.queryLiteralType)); assertNull(main.getWidget(testInputProperties.datasetProperties.queryOptionName)); assertNull(main.getWidget(testInputProperties.datasetProperties.queryOptionLiterals)); Form advanced = testInputProperties.getForm(Form.ADVANCED); assertNotNull(advanced.getWidget(testInputProperties.maxRetrieve)); Form mainDataset = advanced.getChildForm("datasetProperties"); assertNotNull(mainDataset.getWidget(testInputProperties.datasetProperties.pageSize)); assertNotNull(mainDataset.getWidget(testInputProperties.datasetProperties.useQueryOption)); assertNotNull(mainDataset.getWidget(testInputProperties.datasetProperties.queryLiteralType)); assertNotNull(mainDataset.getWidget(testInputProperties.datasetProperties.queryOptionName)); assertNotNull(mainDataset.getWidget(testInputProperties.datasetProperties.queryOptionLiterals)); }
Source:
public void resetUserPassword(String username) { User user = userRepository.findUser(username); if (user != null) { PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); String newPassword = RandomStringUtils.randomAlphanumeric(16); user.setPassword(passwordEncoder.encode(newPassword)); user.setPasswordReset(true); userRepository.updateUser(user, true); SimpleMailMessage message = new SimpleMailMessage(); message.setTo(user.getEmailId()); message.setSubject(passwordResetSubject); message.setText(String.format(passwordResetMessage, newPassword)); mailSender.send(message); } else { throw new NoResultException(); } }

Target:
public void resetUserPassword(String username) { User user = userRepository.findUser(username); if (user == null) { throw new NoResultException(); } PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); String newPassword = RandomStringUtils.randomAlphanumeric(16); user.setPassword(passwordEncoder.encode(newPassword)); user.setPasswordReset(true); userRepository.updateUser(user, true); SimpleMailMessage message = new SimpleMailMessage(); message.setTo(user.getEmailId()); message.setSubject(passwordResetSubject); message.setText(String.format(passwordResetMessage, newPassword)); mailSender.send(message); }
Source:
public AmbryStateModelFactoryTest(String stateModelDef) throws Exception { List<com.github.ambry.utils.TestUtils.ZkInfo> zkInfoList = new ArrayList<>(); zkInfoList.add(new TestUtils.ZkInfo(null, "DC0", (byte) 0, 2299, false)); JSONObject zkJson = constructZkLayoutJSON(zkInfoList); Properties props = new Properties(); props.setProperty("clustermap.host.name", "localhost"); props.setProperty("clustermap.cluster.name", "AmbryTest"); props.setProperty("clustermap.datacenter.name", "DC0"); props.setProperty("clustermap.state.model.definition", stateModelDef); props.setProperty("clustermap.dcs.zk.connect.strings", zkJson.toString(2)); config = new ClusterMapConfig(new VerifiableProperties(props)); this.stateModelDef = stateModelDef; }

Target:
public AmbryStateModelFactoryTest(String stateModelDef) throws Exception { List<TestUtils.ZkInfo> zkInfoList = new ArrayList<>(); zkInfoList.add(new TestUtils.ZkInfo(null, "DC0", (byte) 0, 2299, false)); JSONObject zkJson = constructZkLayoutJSON(zkInfoList); Properties props = new Properties(); props.setProperty("clustermap.host.name", "localhost"); props.setProperty("clustermap.cluster.name", "AmbryTest"); props.setProperty("clustermap.datacenter.name", "DC0"); props.setProperty("clustermap.state.model.definition", stateModelDef); props.setProperty("clustermap.dcs.zk.connect.strings", zkJson.toString(2)); config = new ClusterMapConfig(new VerifiableProperties(props)); this.stateModelDef = stateModelDef; }
Source:
public void deletesTempFile() throws IOException { final File file = File.createTempFile("tempfile", ".tmp"); final BufferedWriter out = new BufferedWriter(new FileWriter(file)); out.write("Temp file deletion test"); out.close(); final InputStream body = new TempInputStream( new FileInputStream(file), file ); body.close(); MatcherAssert.assertThat( "File exists after stream closure", file.exists(), Matchers.is(false) ); }

Target:
public void deletesTempFile() throws IOException { final File file = File.createTempFile("tempfile", ".tmp"); final BufferedWriter out = new BufferedWriter(new FileWriter(file)); try { out.write("Temp file deletion test"); } finally { out.close(); } final InputStream body = new TempInputStream( new FileInputStream(file), file ); try { MatcherAssert.assertThat( "File is not created!", file.exists(), Matchers.is(true) ); } finally { body.close(); } MatcherAssert.assertThat( "File exists after stream closure", file.exists(), Matchers.is(false) ); }
Source:
private SwiftApi api(String authUrl, Properties overrides) throws IOException { if (overrides == null){ overrides = new Properties(); } overrides.setProperty(CREDENTIAL_TYPE, "tempAuthCredentials"); return ContextBuilder.newBuilder(new SwiftApiMetadata()) .credentials("user", "password") .endpoint(authUrl) .overrides(overrides) .modules(ImmutableSet.of(new ExecutorServiceModule(sameThreadExecutor()))) .buildApi(SwiftApi.class); }

Target:
private SwiftApi api(String authUrl, Properties overrides) throws IOException { overrides.setProperty(CREDENTIAL_TYPE, "tempAuthCredentials"); return ContextBuilder.newBuilder(new SwiftApiMetadata()) .credentials("user", "password") .endpoint(authUrl) .overrides(overrides) .modules(ImmutableSet.of(new ExecutorServiceModule(sameThreadExecutor()))) .buildApi(SwiftApi.class); }
Source:
public final ASTAnyTypeDeclaration getEnclosingTypeDeclaration() { if (!isNested()) { return null; } return (ASTAnyTypeDeclaration) getNthParent(3); }

Target:
public final ASTAnyTypeDeclaration getEnclosingTypeDeclaration() { if (!isNested()) { return null; } Node parent = getNthParent(3); return parent instanceof ASTAnyTypeDeclaration ? (ASTAnyTypeDeclaration) parent : null; }
Source:
public void setPostReceiveHook(PostReceiveHook hook) { this.postReceiveHook = hook; }

Target:
public void setPostReceiveHook(PostReceiveHook hook) { this.postReceiveHook = hook != null ? hook : PostReceiveHook.NULL; }
Source:
private Object handleRemotePutMapCommand(InvocationContext ctx, PutMapCommand command) { LocalizedCacheTopology cacheTopology = checkTopologyId(command); final ConsistentHash ch = cacheTopology.getWriteConsistentHash(); final VisitableCommand.LoadType loadType = command.loadType(); if (command.isForwarded()) { return asyncInvokeNext(ctx, command, checkRemoteGetIfNeeded(ctx, command, command.getMap().keySet(), cacheTopology, loadType == OWNER)); } sendToBackups(command, command.getMap(), cacheTopology); return asyncInvokeNext(ctx, command, checkRemoteGetIfNeeded(ctx, command, command.getMap().keySet(), cacheTopology, loadType == OWNER)); }

Target:
private Object handleRemotePutMapCommand(InvocationContext ctx, PutMapCommand command) { LocalizedCacheTopology cacheTopology = checkTopologyId(command); final VisitableCommand.LoadType loadType = command.loadType(); if (command.isForwarded()) { return asyncInvokeNext(ctx, command, checkRemoteGetIfNeeded(ctx, command, command.getMap().keySet(), cacheTopology, loadType == OWNER)); } sendToBackups(command, command.getMap(), cacheTopology); return asyncInvokeNext(ctx, command, checkRemoteGetIfNeeded(ctx, command, command.getMap().keySet(), cacheTopology, loadType == OWNER)); }
Source:
public void shouldReturnChargeWithNoMetadataField_whenCreatedWithEmptyMetadata() { String reference = UUID.randomUUID().toString(); String postBody = toJson(ImmutableMap.builder() .put(JSON_AMOUNT_KEY, AMOUNT) .put(JSON_REFERENCE_KEY, reference) .put(JSON_DESCRIPTION_KEY, "Test description") .put(JSON_RETURN_URL_KEY, RETURN_URL) .put(JSON_EMAIL_KEY, EMAIL) .put(JSON_METADATA_KEY, Map.of()) .build()); ValidatableResponse response = connectorRestApiClient .postCreateCharge(postBody) .statusCode(Status.CREATED.getStatusCode()) .contentType(JSON) .body("$", not(hasKey("metadata"))); connectorRestApiClient .withChargeId(response.extract().path(JSON_CHARGE_KEY)) .getCharge() .body("$", not(hasKey("metadata"))); connectorRestApiClient .withQueryParam("reference", reference) .getChargesV1() .body("results[0]", not(hasKey("metadata"))); }

Target:
public void shouldReturnChargeWithNoMetadataField_whenCreatedWithEmptyMetadata() { String reference = "no metadata reference"; String postBody = toJson(ImmutableMap.builder() .put(JSON_AMOUNT_KEY, AMOUNT) .put(JSON_REFERENCE_KEY, reference) .put(JSON_DESCRIPTION_KEY, "Test description") .put(JSON_RETURN_URL_KEY, RETURN_URL) .put(JSON_EMAIL_KEY, EMAIL) .put(JSON_METADATA_KEY, Map.of()) .build()); ValidatableResponse response = connectorRestApiClient .postCreateCharge(postBody) .statusCode(Status.CREATED.getStatusCode()) .contentType(JSON) .body("$", not(hasKey("metadata"))); String chargeExternalId = response.extract().path(JSON_CHARGE_KEY); connectorRestApiClient .withChargeId(chargeExternalId) .getCharge() .body("$", not(hasKey("metadata"))); connectorRestApiClient .withQueryParam("reference", reference) .getChargesV1() .body("results[0]", not(hasKey("metadata"))); assertNull(databaseTestHelper.getChargeByExternalId(chargeExternalId).get("metadata")); }
Source:
protected String getLanguageKey(Element element) { Package rootPackage = PackageUtil.getRootPackage(element); String key = NoDefautLanguage.INSTANCE.getId(); if (rootPackage != null) { EAnnotation annotation = element.getEAnnotation(LANGUAGE_ANNOTATION_SOURCE); if (annotation != null) { String value = annotation.getDetails().get(LANGUAGE_ANNOTATION_VALUE); if (value != null) { key = value; } } } else { Activator.log.error("impossible to find root element for: " + element, null); } return key; }

Target:
protected String getLanguageKey(Element element) { Package rootPackage = PackageUtil.getRootPackage(element); String key = NoDefautLanguage.INSTANCE.getId(); if (rootPackage != null) { EAnnotation annotation = rootPackage.getEAnnotation(LANGUAGE_ANNOTATION_SOURCE); if (annotation != null) { String value = annotation.getDetails().get(LANGUAGE_ANNOTATION_VALUE); if (value != null) { key = value; } } } else { Activator.log.error("impossible to find root element for: " + element, null); } return key; }
Source:
public void trustedRootCA_syncShouldFailWithoutTrustedCA() throws InterruptedException { String username = UUID.randomUUID().toString(); String password = "password"; SyncUser user = SyncUser.login(SyncCredentials.usernamePassword(username, password, true), Constants.AUTH_URL); final SyncConfiguration configOld = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM) .schema(StringOnly.class) .build(); Realm realm = Realm.getInstance(configOld); realm.beginTransaction(); realm.createObject(StringOnly.class).setChars("Foo"); realm.commitTransaction(); SystemClock.sleep(TimeUnit.SECONDS.toMillis(2)); realm.close(); user.logout(); Realm.deleteRealm(configOld); user = SyncUser.login(SyncCredentials.usernamePassword(username, password), Constants.AUTH_URL); SyncConfiguration config = new SyncConfiguration.Builder(user, Constants.USER_REALM_SECURE) .schema(StringOnly.class) .build(); realm = Realm.getInstance(config); try { assertTrue(realm.isEmpty()); } finally { realm.close(); } }

Target:
public void trustedRootCA_syncShouldFailWithoutTrustedCA() throws InterruptedException { String username = UUID.randomUUID().toString(); String password = "password"; SyncUser user = SyncUser.login(SyncCredentials.usernamePassword(username, password, true), Constants.AUTH_URL); final SyncConfiguration configOld = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM) .schema(StringOnly.class) .build(); Realm realm = Realm.getInstance(configOld); realm.beginTransaction(); realm.createObject(StringOnly.class).setChars("Foo"); realm.commitTransaction(); SystemClock.sleep(TimeUnit.SECONDS.toMillis(2)); realm.close(); user.logout(); Realm.deleteRealm(configOld); user = SyncUser.login(SyncCredentials.usernamePassword(username, password), Constants.AUTH_URL); SyncConfiguration config = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM_SECURE) .schema(StringOnly.class) .build(); realm = Realm.getInstance(config); try { assertTrue(realm.isEmpty()); } finally { realm.close(); } }
Source:
public boolean isAvailable(SourceMonitor callback) { solr.isAvailable( (c, a) -> { if (a) { callback.setAvailable(); } else { callback.setUnavailable(); } }); return isAvailable(); }

Target:
public boolean isAvailable(SourceMonitor callback) { solr.isAvailable(new SolrClientListenerAdapter(callback)); return isAvailable(); }
Source:
private void preRenderUpdate(RenderingStage renderingStage) { resetStats(); currentRenderingStage = renderingStage; isFirstRenderingStageForCurrentFrame = currentRenderingStage == RenderingStage.MONO || currentRenderingStage == RenderingStage.LEFT_EYE; if (isFirstRenderingStageForCurrentFrame) { timeSmoothedMainLightIntensity = TeraMath.lerp(timeSmoothedMainLightIntensity, getMainLightIntensityAt(playerCamera.getPosition()), secondsSinceLastFrame); playerCamera.update(secondsSinceLastFrame); shadowMap.preRender(secondsSinceLastFrame); renderableWorld.update(); renderableWorld.generateVBOs(); secondsSinceLastFrame = 0; buffersManager.preRenderUpdate(); millisecondsSinceRenderingStart += secondsSinceLastFrame * 1000; } if (currentRenderingStage != RenderingStage.MONO) { playerCamera.updateFrustum(); } renderableWorld.queueVisibleChunks(isFirstRenderingStageForCurrentFrame); }

Target:
private void preRenderUpdate(RenderingStage renderingStage) { resetStats(); currentRenderingStage = renderingStage; if ((currentRenderingStage == RenderingStage.MONO) || (currentRenderingStage == RenderingStage.LEFT_EYE)) { isFirstRenderingStageForCurrentFrame = true; } else { isFirstRenderingStageForCurrentFrame = false; } if (isFirstRenderingStageForCurrentFrame) { timeSmoothedMainLightIntensity = TeraMath.lerp(timeSmoothedMainLightIntensity, getMainLightIntensityAt(playerCamera.getPosition()), secondsSinceLastFrame); playerCamera.update(secondsSinceLastFrame); renderableWorld.update(); renderableWorld.generateVBOs(); secondsSinceLastFrame = 0; buffersManager.preRenderUpdate(); millisecondsSinceRenderingStart += secondsSinceLastFrame * 1000; } if (currentRenderingStage != RenderingStage.MONO) { playerCamera.updateFrustum(); } renderableWorld.queueVisibleChunks(isFirstRenderingStageForCurrentFrame); }
Source:
public ComputedAttributesHandler() { engine = new JexlEngine(); engine.setStrict(true); if (Context.getConfig() != null) { mapDeviceAttributes = Context.getConfig().getBoolean( "processing.computedAttributes.mapDeviceAttributes.enable"); } }

Target:
public ComputedAttributesHandler() { engine = new JexlEngine(); engine.setStrict(true); if (Context.getConfig() != null) { mapDeviceAttributes = Context.getConfig().getBoolean("processing.computedAttributes.deviceAttributes"); } }
Source:
private void handleFrame(int streamId, FrameType type, ByteBuf frame) { Subscriber<Payload> receiver = receivers.get(streamId); switch (type) { case NEXT: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onNext(payloadDecoder.apply(frame)); break; case NEXT_COMPLETE: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onNext(payloadDecoder.apply(frame)); receiver.onComplete(); break; case COMPLETE: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onComplete(); receivers.remove(streamId); break; case ERROR: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onError(Exceptions.from(streamId, frame)); receivers.remove(streamId); break; case CANCEL: { Subscription sender = senders.remove(streamId); if (sender != null) { sender.cancel(); } break; } case REQUEST_N: { Subscription sender = senders.get(streamId); if (sender != null) { long n = RequestNFrameFlyweight.requestN(frame); sender.request(n); } break; } default: throw new IllegalStateException( "Client received supported frame on stream " + streamId + ": " + frame.toString()); } }

Target:
private void handleFrame(int streamId, FrameType type, ByteBuf frame) { Subscriber<Payload> receiver = receivers.get(streamId); switch (type) { case NEXT: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onNext(payloadDecoder.apply(frame)); break; case NEXT_COMPLETE: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onNext(payloadDecoder.apply(frame)); receiver.onComplete(); break; case COMPLETE: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onComplete(); receivers.remove(streamId); break; case ERROR: if (receiver == null) { handleMissingResponseProcessor(streamId, type, frame); return; } receiver.onError(Exceptions.from(streamId, frame)); receivers.remove(streamId); break; case CANCEL: { Subscription sender = senders.remove(streamId); if (sender != null) { sender.cancel(); } break; } case REQUEST_N: { Subscription sender = senders.get(streamId); if (sender != null) { int n = RequestNFrameFlyweight.requestN(frame); sender.request(n >= Integer.MAX_VALUE ? Long.MAX_VALUE : n); } break; } default: throw new IllegalStateException( "Client received supported frame on stream " + streamId + ": " + frame.toString()); } }
Source:
public String getId() { String id = fId; if (id == null) { return UNDEFINED_ID; } return id; }

Target:
public String getId() { String id = fId; if (id == null) { Activator.logError("Analysis module getId(): the id should not be null in class " + this.getClass().getSimpleName()); return UNDEFINED_ID; } return id; }
Source:
public static void setup() { raising.setFalseWhen(EventMixing.filterEvent(topLimitSwitch, true, Igneous.globalPeriodic)); lowering.setFalseWhen(EventMixing.filterEvent(bottomLimitSwitch, true, Igneous.globalPeriodic)); raising.toggleWhen(raisingInput); raising.setFalseWhen(loweringInput); lowering.toggleWhen(loweringInput); lowering.setFalseWhen(raisingInput); FloatMixing.pumpWhen(QuasarHelios.globalControl, Mixing.quadSelect(raising, lowering, 0.0f, -winchSpeed.get(), winchSpeed.get(), 0.0f), winch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Motor Speed", winch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Top", topLimitSwitch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Bottom", bottomLimitSwitch); }

Target:
public static void setup() { raising.setFalseWhen(EventMixing.filterEvent(topLimitSwitch, true, Igneous.globalPeriodic)); lowering.setFalseWhen(EventMixing.filterEvent(bottomLimitSwitch, true, Igneous.globalPeriodic)); raising.toggleWhen(raisingInput); raising.setFalseWhen(loweringInput); lowering.toggleWhen(loweringInput); lowering.setFalseWhen(raisingInput); FloatMixing.pumpWhen(QuasarHelios.globalControl, Mixing.select(raising, Mixing.select(lowering, FloatMixing.always(0.0f), winchSpeed), Mixing.select(lowering, FloatMixing.always(0.0f), FloatMixing.negate(winchSpeed))), winch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Motor Speed", winch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Top", topLimitSwitch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Bottom", bottomLimitSwitch); }