auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void downweighChannelBroadcastIsNotFirst() throws Exception { <START> Broadcast downweighedBroadcast1 = new Broadcast(Id.valueOf(333L), DateTime.now().plusHours(1), DateTime.now().plusHours(2)); <END> Broadcast normalBroadcast1 = new Broadcast(Id.valueOf(111L), DateTime.now().plusHours(1), DateTime.now().plusHours(2)); Broadcast normalBroadcast2 = new Broadcast(Id.valueOf(222L), DateTime.now().plusHours(1), DateTime.now().plusHours(2)); Collection<ResolvedBroadcast> resolvedBroadcasts = ImmutableSet.of( ResolvedBroadcast.create(downweighedBroadcast1, ResolvedChannel.builder(getMockChannel(333L)).build()), ResolvedBroadcast.create(normalBroadcast1, ResolvedChannel.builder(getMockChannel(111L)).build()), ResolvedBroadcast.create(normalBroadcast2, ResolvedChannel.builder(getMockChannel(222L)).build()) ); assertThat(resolvedBroadcasts.iterator().next().getBroadcast(), is(downweighedBroadcast1)); Set<ResolvedBroadcast> sortedBroadcasts = broadcastAggregator.sortByDownweighChannelIds( ImmutableList.of(Id.valueOf(333L)), resolvedBroadcasts ); assertFalse(sortedBroadcasts.iterator().next().getBroadcast().equals(downweighedBroadcast1)); assertTrue(sortedBroadcasts.stream() .map(ResolvedBroadcast::getBroadcast) .anyMatch(broadcast -> broadcast.equals(downweighedBroadcast1)) ); }</code><technical_language>existing code nice do a bit of cleaning of it. This, assignments method getFutureBroadcast(333L, 1, 2) _(me)_ missed writing it</technical_language>

Target:
public void downweighChannelBroadcastIsNotFirst() throws Exception { Broadcast downweighedBroadcast1 = getFutureBroadcast(333L,1, 2); Broadcast normalBroadcast1 = getFutureBroadcast(111L,1,2); Broadcast normalBroadcast2 = getFutureBroadcast(222L,1,2); Collection<ResolvedBroadcast> resolvedBroadcasts = ImmutableSet.of( ResolvedBroadcast.create(downweighedBroadcast1, ResolvedChannel.builder(getMockChannel(333L)).build()), ResolvedBroadcast.create(normalBroadcast1, ResolvedChannel.builder(getMockChannel(111L)).build()), ResolvedBroadcast.create(normalBroadcast2, ResolvedChannel.builder(getMockChannel(222L)).build()) ); assertThat(resolvedBroadcasts.iterator().next().getBroadcast(), is(downweighedBroadcast1)); Set<ResolvedBroadcast> sortedBroadcasts = broadcastAggregator.sortByDownweighChannelIds( ImmutableList.of(Id.valueOf(333L)), resolvedBroadcasts ); assertFalse(sortedBroadcasts.iterator().next().getBroadcast().equals(downweighedBroadcast1)); assertTrue(sortedBroadcasts.stream() .map(ResolvedBroadcast::getBroadcast) .anyMatch(broadcast -> broadcast.equals(downweighedBroadcast1)) ); }
Source:
<code>public void testVcfToAdpc() throws IOException { final File output = File.createTempFile("testIlluminaAdpcFileWriter.", ".adpc.bin"); output.deleteOnExit(); <START> VcfToAdpc vcfToAdpc = new VcfToAdpc(); <END> vcfToAdpc.VCF = TEST_VCF; vcfToAdpc.OUTPUT = output; Assert.assertEquals(vcfToAdpc.instanceMain(new String[0]), 0); IOUtil.assertFilesEqual(TEST_EXPECTED_ADPC_BIN_FILE, output); }</code><technical_language>final</technical_language>

Target:
public void testVcfToAdpc() throws IOException { final File output = File.createTempFile("testIlluminaAdpcFileWriter.", ".adpc.bin"); output.deleteOnExit(); final VcfToAdpc vcfToAdpc = new VcfToAdpc(); vcfToAdpc.VCF = TEST_VCF; vcfToAdpc.OUTPUT = output; Assert.assertEquals(vcfToAdpc.instanceMain(new String[0]), 0); IOUtil.assertFilesEqual(TEST_EXPECTED_ADPC_BIN_FILE, output); }
Source:
<code>public void test_update_returning_clause() { printStatement("update foo set foo='a' returning id"); printStatement("update foo set foo='a' where x=false returning id"); printStatement("update foo set foo='a' returning id AS foo"); printStatement("update foo set foo='a' returning id + 1 AS foo, id -1 as bar"); <START> printStatement("update foo set foo='a' returning id + 1 AS foo, id -1 as bar"); <END> printStatement("update foo set foo='a' returning \"column['nested']\" AS bar"); printStatement("update foo set foo='a' returning foo.bar - 1 AS foo"); }</code><technical_language>This assertion is duplicated. remove assertion is relevant tests for * relation.* missing</technical_language>

Target:
public void test_update_returning_clause() { printStatement("update foo set foo='a' returning id"); printStatement("update foo set foo='a' where x=false returning id"); printStatement("update foo set foo='a' returning id AS foo"); printStatement("update foo set foo='a' returning id + 1 AS foo, id -1 as bar"); printStatement("update foo set foo='a' returning \"column['nested']\" AS bar"); printStatement("update foo set foo='a' returning foo.bar - 1 AS foo"); printStatement("update foo set foo='a' returning *"); printStatement("update foo set foo='a' returning foo.*"); }
Source:
<code>public void testCamera() { PackageManager packageManager = mContext.getPackageManager(); <START> if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) { <END> Intent intent = new Intent(); intent.setAction(android.provider.MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA); assertCanBeHandled(intent); } }</code><technical_language>Some devices FEATURE_CAMERA_FRONT, FEATURE_CAMERA. Change this packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA) || packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)</technical_language>

Target:
public void testCamera() { PackageManager packageManager = mContext.getPackageManager(); if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA) || packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)){ Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); assertCanBeHandled(intent); intent.setAction(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); assertCanBeHandled(intent); intent.setAction(android.provider.MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA); assertCanBeHandled(intent); intent.setAction(android.provider.MediaStore.INTENT_ACTION_VIDEO_CAMERA); assertCanBeHandled(intent); } }
Source:
<code>public void onEntry(LogReplicationState from) { try { if (from != this) { snapshotSender.reset(); fsm.getAckReader().markSnapshotSyncInfoOngoing(forcedSnapshotSync, transitionEventId); snapshotSyncTimerSample = MeterRegistryProvider.getInstance().map(Timer::start); } Runnable snapShotSendTask = () -> snapshotSender.transmit(transitionEventId); if (senderTimer.isPresent()) { <START> snapShotSendTask = senderTimer.get().wrap(snapShotSendTask); <END> } transmitFuture = fsm.getLogReplicationFSMWorkers().submit(snapShotSendTask); } catch (Throwable t) { log.error("Error on entry of InSnapshotSyncState.", t); } }</code><technical_language>I issue InLogEntrySyncState here.. transmit reflect accurately time for sending a snapshot message send all..</technical_language>

Target:
public void onEntry(LogReplicationState from) { try { if (from != this) { snapshotSender.reset(); fsm.getAckReader().markSnapshotSyncInfoOngoing(forcedSnapshotSync, transitionEventId); snapshotSyncTimerSample = MeterRegistryProvider.getInstance().map(Timer::start); } transmitFuture = fsm.getLogReplicationFSMWorkers() .submit(() -> snapshotSender.transmit(transitionEventId)); } catch (Throwable t) { log.error("Error on entry of InSnapshotSyncState.", t); } }
Source:
<code>public int <START> setNcmTethering(boolean <END> enable) { Log.i(TAG, "setNcmTethering(" + enable + ")"); UsbManager usbManager = (UsbManager) mContext.getSystemService(Context.USB_SERVICE); if (usbManager == null) { mLog.e("setNcmTethering: failed to get UsbManager!"); return TETHER_ERROR_SERVICE_UNAVAIL; } synchronized (mPublicSync) { usbManager.setCurrentFunction(enable ? STRING_NCM : null, false); } return TETHER_ERROR_NO_ERROR; }</code><technical_language>setNcmTethering setUsbTethering is similar UsbManager. combine tem function ex: private int setNcmTethering(boolean enable, int type)</technical_language>

Target:
private int setNcmTethering(boolean enable) { if (VDBG) Log.d(TAG, "setNcmTethering(" + enable + ")"); UsbManager usbManager = (UsbManager) mContext.getSystemService(Context.USB_SERVICE); synchronized (mPublicSync) { usbManager.setCurrentFunctions(enable ? UsbManager.FUNCTION_NCM : UsbManager.FUNCTION_NONE); } return TETHER_ERROR_NO_ERROR; }
Source:
<code>public void testSuggestLabelsToChangeWithLabels() throws Exception { final List<ChangeLabel> all = new ArrayList<ChangeLabel>(); all.add(new ChangeLabel(new Change.Id(1), "a")); all.add(new ChangeLabel(new Change.Id(1), "b")); all.add(new ChangeLabel(new Change.Id(2), "b")); all.add(new ChangeLabel(new Change.Id(3), "c")); all.add(new ChangeLabel(new Change.Id(4), "d")); final List<LabelKey> expected = new ArrayList<LabelKey>(); <START> expected.add(new LabelKey("b")); <END> expected.add(new LabelKey("c")); expected.add(new LabelKey("d")); doLabelsSuggestion(new Change.Id(1), all, expected); }</code><technical_language>is b in this list if is change</technical_language>

Target:
public void testSuggestLabelsToChangeWithLabels() throws Exception { final List<ChangeLabel> allExcludingOneChange = new ArrayList<ChangeLabel>(); allExcludingOneChange.add(new ChangeLabel(new Change.Id(2), "b")); allExcludingOneChange.add(new ChangeLabel(new Change.Id(3), "c")); allExcludingOneChange.add(new ChangeLabel(new Change.Id(4), "d")); final Set<LabelKey> expected = new HashSet<LabelKey>(); expected.add(new LabelKey("b")); expected.add(new LabelKey("c")); expected.add(new LabelKey("d")); doLabelsSuggestion(new Change.Id(1), allExcludingOneChange, expected); }
Source:
<code>public Collection<RepeatableContentProducer> data() { return tableDefinitionDescriptor.getDataFile() <START> .map(dataFile -> singleton(asRepeatableContentProvider(dataFile))) <END> .orElse(ImmutableSet.of()); }</code><technical_language>Instead of singleton i ImmutableSet.of(). singleton confusing for me. leave is though</technical_language>

Target:
public Collection<RepeatableContentProducer> data() { return tableDefinitionDescriptor.getDataFile() .map(this::asRepeatableContentProducer) .map(ImmutableSet::of) .orElse(ImmutableSet.of()); }
Source:
<code>public void onDeleteLinkClick(final ClickEvent clickEvent) { <START> locker.fire(new LockRequiredEvent()); <END> if (!Objects.isNull(getOnDeleted())) { getOnDeleted().accept(externalLink); } }</code><technical_language>this is acquire _lock_ icon Editor Title Project Explorer? Personally, prefer this _behaviour_ Presenter this (dumb) View. "on delete consumer" fire this event is close get (although IIRC _consumer_ is a View too.. physical delete firing of event in place. WDYT</technical_language>

Target:
public void onDeleteLinkClick(final ClickEvent clickEvent) { if (!Objects.isNull(getOnDeleted())) { getOnDeleted().accept(externalLink); } }
Source:
<code>public SocketChannel requestForConnection(InetSocketAddress hostAddr) throws Exception { SocketChannel socket = connectToHost(hostAddr); ByteBuffer currentTimeBuf = ByteBuffer.allocate(8); while (currentTimeBuf.hasRemaining()) { socket.read(currentTimeBuf); } currentTimeBuf.flip(); <START> long skew = System.currentTimeMillis() - currentTimeBuf.getLong(); <END> assert(currentTimeBuf.remaining() == 0); JSONObject jsObj = new JSONObject(); jsObj.put(TYPE, ConnectionType.REQUEST_CONNECTION.toString()); jsObj.put(VERSION_STRING, m_acceptor.getVersionChecker().getVersionString()); jsObj.put(HOST_ID, m_localHostId); jsObj.put(PORT, m_internalPort); jsObj.put(ADDRESS, m_internalInterface.isEmpty() ? m_reportedInternalInterface : m_internalInterface); byte[] jsBytes = jsObj.toString(4).getBytes(StandardCharsets.UTF_8); ByteBuffer addConnection = ByteBuffer.allocate(4 + jsBytes.length); addConnection.putInt(jsBytes.length); addConnection.put(jsBytes).flip(); while (addConnection.hasRemaining()) { socket.write(addConnection); } final String remoteAddress = socket.socket().getRemoteSocketAddress().toString(); processJSONResponse(socket, remoteAddress, Sets.newHashSet()); return socket; }</code><technical_language>@luyangco "skew" used</technical_language>

Target:
public SocketChannel requestForConnection(InetSocketAddress hostAddr) throws Exception { SocketChannel socket = connectToHost(hostAddr); ByteBuffer currentTimeBuf = ByteBuffer.allocate(8); while (currentTimeBuf.hasRemaining()) { socket.read(currentTimeBuf); } currentTimeBuf.flip(); currentTimeBuf.getLong(); assert(currentTimeBuf.remaining() == 0); JSONObject jsObj = new JSONObject(); jsObj.put(TYPE, ConnectionType.REQUEST_CONNECTION.toString()); jsObj.put(VERSION_STRING, m_acceptor.getVersionChecker().getVersionString()); jsObj.put(HOST_ID, m_localHostId); jsObj.put(PORT, m_internalPort); jsObj.put(ADDRESS, m_internalInterface.isEmpty() ? m_reportedInternalInterface : m_internalInterface); byte[] jsBytes = jsObj.toString(4).getBytes(StandardCharsets.UTF_8); ByteBuffer addConnection = ByteBuffer.allocate(4 + jsBytes.length); addConnection.putInt(jsBytes.length); addConnection.put(jsBytes).flip(); while (addConnection.hasRemaining()) { socket.write(addConnection); } final String remoteAddress = socket.socket().getRemoteSocketAddress().toString(); processJSONResponse(socket, remoteAddress, Sets.newHashSet()); return socket; }
Source:
<code>private GroupMembers getRegisteredUsers() throws OrmException { final AccountGroup registeredUsersGroup = groupCache.get(AccountGroup.REGISTERED_USERS); final TreeSet<Account> allAccounts = new TreeSet<Account>(new AccountComparator()); <START> allAccounts.addAll(reviewDb.accounts().all().toList()); <END> return new GroupMembers(registeredUsersGroup, allAccounts, new TreeSet<GroupMembers>()); }</code><technical_language>This needs filtered. A user able of other users server. restrict a site administrator feature</technical_language>

Target:
private GroupMembers getRegisteredUsers() throws OrmException, NoSuchGroupException { final GroupControl groupControl = groupControlFactory.controlFor(AccountGroup.REGISTERED_USERS); final AccountGroup registeredUsersGroup = groupControl.getAccountGroup(); final TreeSet<Account> allAccounts = new TreeSet<Account>(new AccountComparator()); final GroupMembers groupMembers = new GroupMembers(registeredUsersGroup, allAccounts, new TreeSet<GroupMembers>()); if (groupControl.isOwner() || registeredUsersGroup.isVisibleToAll()) { allAccounts.addAll(reviewDb.accounts().all().toList()); } else { groupMembers.setGroupVisible(false); } return groupMembers; }
Source:
<code>public void getConceptStateConversion_shouldTestGetConceptStateConversion() { ConceptStateConversion conceptStateConversion1 = pws.getAllConceptStateConversions().get(0); <START> int id = conceptStateConversion1.getId(); <END> ConceptStateConversion conceptStateConversion2 = pws.getConceptStateConversion(id); assertEquals(conceptStateConversion1, conceptStateConversion2); }</code><technical_language>id is a good name</technical_language>

Target:
public void getConceptStateConversion_shouldTestGetConceptStateConversion() { ConceptStateConversion conceptStateConversion1 = pws.getAllConceptStateConversions().get(0); int conceptStateConversion1Id = conceptStateConversion1.getId(); ConceptStateConversion conceptStateConversion2 = pws.getConceptStateConversion(conceptStateConversion1Id); assertEquals(conceptStateConversion1, conceptStateConversion2); }
Source:
<code>private String getLocal(String name, final int colon) { <START> return name != null && colon > 0 ? (colon + 1 < name.length() ? name.substring(colon + 1) : "") : name; <END> }</code><technical_language>Nested ternary operators is super confusing. this split multiple statements</technical_language>

Target:
private String getLocal(String name, final int colon) { if (name != null && colon > 0) { return colon + 1 < name.length() ? name.substring(colon + 1) : ""; } else { return name; } }
Source:
<code>public void testLineGapWidth() throws IOException, ParseException { JSONObject jsonObject = parseTestStyle("lineStyleGapTest.json"); MBStyle mbStyle = new MBStyle(jsonObject); StyledLayerDescriptor sld = mbStyle.transform(); SLDTransformer styleTransform = new SLDTransformer(); String xml; try { xml = styleTransform.transform(sld); System.out.print(xml); } catch (TransformerException e) { e.printStackTrace(); <START> } <END> List<MBLayer> layers = mbStyle.layers("test-source"); assertEquals(1, layers.size()); assertTrue(layers.get(0) instanceof LineMBLayer); LineMBLayer mbLine = (LineMBLayer) layers.get(0); List<FeatureTypeStyle> fts = mbLine.transform(mbStyle); assertEquals(1, fts.get(0).rules().size()); Rule r = fts.get(0).rules().get(0); assertEquals(2, r.symbolizers().size()); Symbolizer symbolizer = r.symbolizers().get(0); assertTrue(symbolizer instanceof LineSymbolizer); LineSymbolizer lsym = (LineSymbolizer) symbolizer; assertEquals(new Color(0, 153, 255), lsym.getStroke().getColor().evaluate(null, Color.class)); assertEquals("square", lsym.getStroke().getLineCap().evaluate(null, String.class)); assertEquals("round", lsym.getStroke().getLineJoin().evaluate(null, String.class)); assertEquals(.5d, lsym.getStroke().getOpacity().evaluate(null, Double.class), .0001); assertEquals(Integer.valueOf(10), lsym.getStroke().getWidth().evaluate(null, Integer.class)); assertEquals(Integer.valueOf(-5), lsym.getPerpendicularOffset().evaluate(null, Integer.class)); }</code><technical_language>tabs - spaces</technical_language>

Target:
public void testLineGapWidth() throws IOException, ParseException { JSONObject jsonObject = parseTestStyle("lineStyleGapTest.json"); MBStyle mbStyle = new MBStyle(jsonObject); List<MBLayer> layers = mbStyle.layers("test-source"); assertEquals(1, layers.size()); assertTrue(layers.get(0) instanceof LineMBLayer); LineMBLayer mbLine = (LineMBLayer) layers.get(0); List<FeatureTypeStyle> fts = mbLine.transform(mbStyle); assertEquals(1, fts.get(0).rules().size()); Rule r = fts.get(0).rules().get(0); assertEquals(2, r.symbolizers().size()); Symbolizer symbolizer = r.symbolizers().get(0); assertTrue(symbolizer instanceof LineSymbolizer); LineSymbolizer lsym = (LineSymbolizer) symbolizer; assertEquals(new Color(0, 153, 255), lsym.getStroke().getColor().evaluate(null, Color.class)); assertEquals("square", lsym.getStroke().getLineCap().evaluate(null, String.class)); assertEquals("round", lsym.getStroke().getLineJoin().evaluate(null, String.class)); assertEquals(.5d, lsym.getStroke().getOpacity().evaluate(null, Double.class), .0001); assertEquals(Integer.valueOf(10), lsym.getStroke().getWidth().evaluate(null, Integer.class)); assertEquals(Integer.valueOf(-5), lsym.getPerpendicularOffset().evaluate(null, Integer.class)); }
Source:
<code><START> public void copyAdditionalPropertiesFrom(BaseResourceMessage theMsg) { <END> if (theMsg.myAdditionalProperties != null) { if (myAdditionalProperties == null) { myAdditionalProperties = new HashMap<>(); } myAdditionalProperties.putAll(theMsg.myAdditionalProperties); } }</code><technical_language>I recommend write a test for this</technical_language>

Target:
public void copyAdditionalPropertiesFrom(BaseResourceMessage theMsg) { if (theMsg.myAttributes != null) { if (myAttributes == null) { myAttributes = new HashMap<>(); } myAttributes.putAll(theMsg.myAttributes); } }
Source:
<code>public void testDecoratorWithWhitelist() { ListFilteredDimensionSpec spec = new ListFilteredDimensionSpec( new DefaultDimensionSpec("foo", "bar"), ImmutableSet.of("c", "g"), true ); <START> DimensionSelector selector = spec.decorate(TestDimensionSelector.INSTACE); <END> Assert.assertEquals(2, selector.getValueCardinality()); IndexedInts row = selector.getRow(); Assert.assertEquals(2, row.size()); Assert.assertEquals(0, row.get(0)); Assert.assertEquals(1, row.get(1)); Assert.assertEquals("c", selector.lookupName(0)); Assert.assertEquals("g", selector.lookupName(1)); Assert.assertEquals(0, selector.idLookup().lookupId("c")); Assert.assertEquals(1, selector.idLookup().lookupId("g")); }</code><technical_language>Typo: INSTANCE</technical_language>

Target:
public void testDecoratorWithWhitelist() { ListFilteredDimensionSpec spec = new ListFilteredDimensionSpec( new DefaultDimensionSpec("foo", "bar"), ImmutableSet.of("c", "g"), true ); DimensionSelector selector = spec.decorate(TestDimensionSelector.INSTANCE); Assert.assertEquals(2, selector.getValueCardinality()); IndexedInts row = selector.getRow(); Assert.assertEquals(2, row.size()); Assert.assertEquals(0, row.get(0)); Assert.assertEquals(1, row.get(1)); Assert.assertEquals("c", selector.lookupName(0)); Assert.assertEquals("g", selector.lookupName(1)); Assert.assertEquals(0, selector.idLookup().lookupId("c")); Assert.assertEquals(1, selector.idLookup().lookupId("g")); }
Source:
<code>public boolean hasNext() { <START> return replicaIterator.hasNext() && (inflightCount < parallelism || isMostRecentRequestPastDue()); <END> }</code><technical_language>minor: inflighCount == replicaRequestSendTime.size() always</technical_language>

Target:
public boolean hasNext() { return replicaIterator.hasNext() && (inflightCount < parallelism || isOldestRequestPastDue()); }
Source:
<code>private OperationTimer createTimer() { return new OperationTimer( driverContext.isCpuTimerEnabled(), <START> driverContext.isCpuTimerEnabled() && driverContext.isVerboseStats()); <END> }</code><technical_language>do guys renaming verboseStats-related methods/configs (task.verbose-stats)? This flag enables operation CPU time tracking more. However, name sounds more that</technical_language>

Target:
private OperationTimer createTimer() { return new OperationTimer( driverContext.isCpuTimerEnabled(), driverContext.isCpuTimerEnabled() && driverContext.isPerOperatorCpuTimerEnabled()); }
Source:
<code>public void shouldNotBeAbleToChangeClusterMembersDatabaseName() throws Exception { CoreClusterMember member = cluster.coreMembers().stream().findFirst().orElseThrow( IllegalArgumentException::new ); <START> cluster.shutdownCoreMembers( member ); <END> member.updateDbNameConfig( "new_name" ); try { cluster.startCoreMembers( member ); fail( "Cluster member should fail to restart after database name change." ); } catch ( ExecutionException e ) { } }</code><technical_language>Is Cluster#removeCoreMember sufficient</technical_language>

Target:
public void shouldNotBeAbleToChangeClusterMembersDatabaseName() throws Exception { CoreClusterMember member = cluster.coreMembers().stream().findFirst().orElseThrow( IllegalArgumentException::new ); cluster.shutdownCoreMember( member ); member.updateConfig( CausalClusteringSettings.database, "new_name" ); try { cluster.startCoreMember( member ); fail( "Cluster member should fail to restart after database name change." ); } catch ( ExecutionException e ) { } }
Source:
<code>private void setEventOrAlarm(Position position, String trigger, Integer reportType) { <START> if (trigger.equals("9")) { <END> position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); } else if (trigger.equals("1")) { position.set(Position.KEY_ALARM, Position.ALARM_POWER_ON); } else if (trigger.equals("i")) { position.set(Position.KEY_IGNITION, true); } else if (trigger.equals("I")) { position.set(Position.KEY_IGNITION, false); } else if (trigger.equals("E")) { position.set(Position.KEY_ALARM, Position.ALARM_POWER_RESTORED); } else if (trigger.equals("e")) { position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT); } else if (trigger.equals("!")) { position.set(Position.KEY_ALARM, Position.ALARM_TOW); } else if (trigger.equals("s")) { position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED); } else if (trigger.equals("h")) { switch (reportType) { case 0: case 3: position.set(Position.KEY_ALARM, Position.ALARM_BRAKING); break; case 1: case 4: position.set(Position.KEY_ALARM, Position.ALARM_ACCELERATION); break; case 2: case 5: default: position.set(Position.KEY_ALARM, Position.ALARM_CORNERING); break; } } }</code><technical_language>I this changed switch</technical_language>

Target:
private void setEventOrAlarm(Position position, String trigger, Integer reportType) { switch (trigger) { case "9": position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); break; case "1": position.set(Position.KEY_ALARM, Position.ALARM_POWER_ON); break; case "i": position.set(Position.KEY_IGNITION, true); break; case "I": position.set(Position.KEY_IGNITION, false); break; case "E": position.set(Position.KEY_ALARM, Position.ALARM_POWER_RESTORED); break; case "e": position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT); break; case "!": position.set(Position.KEY_ALARM, Position.ALARM_TOW); break; case "s": position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED); break; case "h": switch (reportType) { case 0: case 3: position.set(Position.KEY_ALARM, Position.ALARM_BRAKING); break; case 1: case 4: position.set(Position.KEY_ALARM, Position.ALARM_ACCELERATION); break; case 2: case 5: default: position.set(Position.KEY_ALARM, Position.ALARM_CORNERING); break; } break; default: break; } }
Source:
<code>protected Boolean doInBackground(Void... params) { Hashtable<String, String> device_ping = new Hashtable<>(); device_ping.put(Aware_Preferences.DEVICE_ID, Aware.getSetting(awareContext, Aware_Preferences.DEVICE_ID)); device_ping.put("ping", String.valueOf(System.currentTimeMillis())); device_ping.put("platform", "android"); try { <START> PackageInfo package_info = awareContext.getPackageManager().getPackageInfo(awareContext.getPackageName(), 0); <END> device_ping.put("package_name", package_info.packageName); device_ping.put("package_version_code", String.valueOf(package_info.versionCode)); device_ping.put("package_version_name", String.valueOf(package_info.versionName)); } catch (PackageManager.NameNotFoundException e) { } try { new Https(awareContext, SSLManager.getHTTPS(getApplicationContext(), "<LINK_0>")).dataPOST("<LINK_0>/awaredev/alive", device_ping, true); } catch (FileNotFoundException e) { e.printStackTrace(); } return true; }</code><technical_language>context get package name this application, if AWARE is a library. Also, this happen for AWARE client, plugins. do a check for "com.aware.phone" package</technical_language>

Target:
protected Boolean doInBackground(Void... params) { Hashtable<String, String> device_ping = new Hashtable<>(); device_ping.put(Aware_Preferences.DEVICE_ID, Aware.getSetting(awareContext, Aware_Preferences.DEVICE_ID)); device_ping.put("ping", String.valueOf(System.currentTimeMillis())); device_ping.put("platform", "android"); try { PackageInfo package_info = awareContext.getPackageManager().getPackageInfo(awareContext.getPackageName(), 0); device_ping.put("package_name", package_info.packageName); if (package_info.packageName.equals("com.aware.phone")) { device_ping.put("package_version_code", String.valueOf(package_info.versionCode)); device_ping.put("package_version_name", String.valueOf(package_info.versionName)); } } catch (PackageManager.NameNotFoundException e) { } try { new Https(awareContext, SSLManager.getHTTPS(getApplicationContext(), "<LINK_0>")).dataPOST("<LINK_0>/awaredev/alive", device_ping, true); } catch (FileNotFoundException e) { e.printStackTrace(); } return true; }
Source:
<code>public static boolean isInside(Message message) { <START> return message.getError().getExtension(ELEMENT, NAMESPACE) != null; <END> }</code><technical_language>above: check for null</technical_language>

Target:
public static boolean isInside(Message message) { return from(message) != null; }
Source:
<code><START> public byte[] serialize(Object record) throws ZkMarshallingError { <END> if (!(record instanceof ZNRecord)) { LOG.error( "Input object must be of type ZNRecord but it is " + record + ". Will not write to zk"); throw new HelixException("Input object is not of type ZNRecord (was " + record + ")"); } ZNRecord znRecord = (ZNRecord) record; try { return OBJECT_MAPPER.writeValueAsBytes(znRecord); } catch (Exception e) { throw new HelixException( String.format("Exception during serialization. ZNRecord id: %s", znRecord.getId()), e); } }</code><technical_language>I convert exceptions HelixException, do need claim ZkMarshallingError here</technical_language>

Target:
public byte[] serialize(Object record) throws ZkMarshallingError { if (!(record instanceof ZNRecord)) { throw new HelixException("Input object is not of type ZNRecord (was " + record + ")"); } ZNRecord znRecord = (ZNRecord) record; try { return OBJECT_MAPPER.writeValueAsBytes(znRecord); } catch (IOException e) { throw new HelixException( String.format("Exception during serialization. ZNRecord id: %s", znRecord.getId()), e); } }
Source:
<code>private static SSAInstruction[] getMethodArrayStatements( MethodReference ref, Collection<IMethod> returnValues, Context context, Map<Integer, ConstantValue> constants) { ArrayList<SSAInstruction> statements = new ArrayList<>(); int nextLocal = ref.getNumberOfParameters() + 2; int retValue = nextLocal++; IClass cls = ((TypeAbstraction) context.get(ContextKey.RECEIVER)).getType(); SSAInstructionFactory insts = ((TypeAbstraction) context.get(ContextKey.RECEIVER)) .getType() .getClassLoader() .getInstructionFactory(); if (cls != null) { TypeReference arrType = ref.getReturnType(); NewSiteReference site = new NewSiteReference(retValue, arrType); int sizeVn = nextLocal++; constants.put(sizeVn, new ConstantValue(returnValues.size())); SSANewInstruction allocArr = insts.NewInstruction(statements.size(), retValue, site, new int[] {sizeVn}); statements.add(allocArr); int i = 0; for (IMethod m : returnValues) { int c = nextLocal++; constants.put(c, new ConstantValue(m)); int index = i++; int indexVn = nextLocal++; constants.put(indexVn, new ConstantValue(index)); SSAArrayStoreInstruction store = insts.ArrayStoreInstruction( statements.size(), retValue, indexVn, c, TypeReference.JavaLangReflectConstructor); statements.add(store); } SSAReturnInstruction R = insts.ReturnInstruction(statements.size(), retValue, false); statements.add(R); } else { } SSAInstruction[] result = new SSAInstruction[statements.size()]; Iterator<SSAInstruction> it = statements.iterator(); <START> Arrays.setAll(result, i -> it.next()); <END> return result; }</code><technical_language>This SSAInstruction[] result = statements.toArray(new SSAInstruction[0]);</technical_language>

Target:
private static SSAInstruction[] getMethodArrayStatements( MethodReference ref, Collection<IMethod> returnValues, Context context, Map<Integer, ConstantValue> constants) { ArrayList<SSAInstruction> statements = new ArrayList<>(); int nextLocal = ref.getNumberOfParameters() + 2; int retValue = nextLocal++; IClass cls = ((TypeAbstraction) context.get(ContextKey.RECEIVER)).getType(); SSAInstructionFactory insts = ((TypeAbstraction) context.get(ContextKey.RECEIVER)) .getType() .getClassLoader() .getInstructionFactory(); if (cls != null) { TypeReference arrType = ref.getReturnType(); NewSiteReference site = new NewSiteReference(retValue, arrType); int sizeVn = nextLocal++; constants.put(sizeVn, new ConstantValue(returnValues.size())); SSANewInstruction allocArr = insts.NewInstruction(statements.size(), retValue, site, new int[] {sizeVn}); statements.add(allocArr); int i = 0; for (IMethod m : returnValues) { int c = nextLocal++; constants.put(c, new ConstantValue(m)); int index = i++; int indexVn = nextLocal++; constants.put(indexVn, new ConstantValue(index)); SSAArrayStoreInstruction store = insts.ArrayStoreInstruction( statements.size(), retValue, indexVn, c, TypeReference.JavaLangReflectConstructor); statements.add(store); } SSAReturnInstruction R = insts.ReturnInstruction(statements.size(), retValue, false); statements.add(R); } else { } return statements.toArray(new SSAInstruction[0]); }
Source:
<code>private void stopServer(final String serverName) { ModelNode op = new ModelNode(); op.get(OP_ADDR).add(HOST, MASTER); op.get(OP_ADDR).add(SERVER_CONFIG, FIRST_SERVER_NAME); op.get(OP).set(STOP); op.get(TIMEOUT).set(0); <START> op.get(ADMIN_ONLY).set(false); <END> domainMasterLifecycleUtil.executeForResult(op); try { waitUntilState(FIRST_SERVER_NAME, "STOPPED"); } catch (TimeoutException e) { fail("After \"stop(timeout=0)\" was called sever never reached the desired STOPPED state."); } }</code><technical_language>operation is executed, this is a valid param, it, /host=master/server-config=server-one:read-operation-description(name=stop)</technical_language>

Target:
private void stopServer(final String serverName) { ModelNode op = new ModelNode(); op.get(OP_ADDR).add(HOST, MASTER); op.get(OP_ADDR).add(SERVER_CONFIG, FIRST_SERVER_NAME); op.get(OP).set(STOP); op.get(TIMEOUT).set(0); domainMasterLifecycleUtil.executeForResult(op); try { waitUntilState(FIRST_SERVER_NAME, "STOPPED"); } catch (TimeoutException e) { fail("After \"stop(timeout=0)\" was called sever never reached the desired STOPPED state."); } }
Source:
<code>public boolean onBlockDestroyed(ItemStack stack, World worldIn, BlockState state, BlockPos pos, LivingEntity entityLiving) { if(state == harvestedBlock.get().getDefaultState()) { int harvestCounter = 0; <START> for(Float i = entityLiving.getRNG().nextFloat(); i <= percentage || harvestCounter >= maxBonusItems; i = entityLiving.getRNG().nextFloat()) <END> { ItemEntity item = new ItemEntity(worldIn, pos.getX(), pos.getY(), pos.getZ(), itemDropped.get().getDefaultInstance()); worldIn.addEntity(item); harvestCounter++; } if(melonOverload && harvestCounter >= 9 && entityLiving instanceof PlayerEntity) { ITextComponent message = new TranslationTextComponent(getTranslationKey() + ".message"); message.getStyle().setColor(TextFormatting.GREEN); message.getStyle().setBold(true); if(!worldIn.isRemote) { entityLiving.sendMessage(message); entityLiving.addPotionEffect(new EffectInstance(Effects.STRENGTH, 1800, 3)); entityLiving.addPotionEffect(new EffectInstance(Effects.RESISTANCE, 1800, 3)); entityLiving.addPotionEffect(new EffectInstance(Effects.HASTE, 1800, 3)); } MSCriteriaTriggers.MELON_OVERLOAD.trigger((ServerPlayerEntity) entityLiving); } } return super.onBlockDestroyed(stack, worldIn, state, pos, entityLiving); }</code><technical_language>condition is incorrect. i <= percentage && harvestCounter < maxBonusItems;</technical_language>

Target:
public boolean onBlockDestroyed(ItemStack stack, World worldIn, BlockState state, BlockPos pos, LivingEntity entityLiving) { if(state == harvestedBlock.get().getDefaultState() && !worldIn.isRemote) { int harvestCounter = 0; for(Float i = entityLiving.getRNG().nextFloat(); i <= percentage && harvestCounter < maxBonusItems; i = entityLiving.getRNG().nextFloat()) { ItemEntity item = new ItemEntity(worldIn, pos.getX(), pos.getY(), pos.getZ(), itemDropped.get().getDefaultInstance()); worldIn.addEntity(item); harvestCounter++; } if(melonOverload && harvestCounter >= 9 && entityLiving instanceof PlayerEntity) { ITextComponent message = new TranslationTextComponent(getTranslationKey() + ".message"); message.getStyle().setColor(TextFormatting.GREEN); message.getStyle().setBold(true); entityLiving.sendMessage(message); entityLiving.addPotionEffect(new EffectInstance(Effects.STRENGTH, 1800, 3)); entityLiving.addPotionEffect(new EffectInstance(Effects.RESISTANCE, 1800, 3)); entityLiving.addPotionEffect(new EffectInstance(Effects.HASTE, 1800, 3)); MSCriteriaTriggers.MELON_OVERLOAD.trigger((ServerPlayerEntity) entityLiving); } } return super.onBlockDestroyed(stack, worldIn, state, pos, entityLiving); }
Source:
<code>public void run() { try { <START> Threads.setDaemonThreadRunning(new Thread() { @Override public void run() { <END> for (;;) { try { if (!Strings.isNullOrEmpty(ZKClusterId.readClusterIdZNode(zooKeeper))) { setupClusterConnection(); break; } } catch (Throwable t) { LOG.warn("failed to initialize cluster connection, retrying..."); } Threads.sleep(1000); } } }, getName() + ":initClusterConnection"); if (!conf.getBoolean("hbase.testing.nocluster", false)) { Threads.setDaemonThreadRunning(new Thread(() -> { try { int infoPort = putUpJettyServer(); startActiveMasterManager(infoPort); } catch (Throwable t) { String error = "Failed to become Active Master"; LOG.error(error, t); if (!isAborted()) { abort(error, t); } } }), getName() + ":becomeActiveMaster"); } super.run(); } finally { if (this.clusterSchemaService != null) { this.clusterSchemaService.stopAsync(); try { this.clusterSchemaService.awaitTerminated( getConfiguration().getInt(HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS, DEFAULT_HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS), TimeUnit.SECONDS); } catch (TimeoutException te) { LOG.warn("Failed shutdown of clusterSchemaService", te); } } this.activeMaster = false; } }</code><technical_language>nit: replace lambda</technical_language>

Target:
public void run() { try { Threads.setDaemonThreadRunning(new Thread(() -> { for (;;) { try { if (!Strings.isNullOrEmpty(ZKClusterId.readClusterIdZNode(zooKeeper))) { setupClusterConnection(); break; } else { LOG.trace("cluster id is still null, waiting..."); } } catch (Throwable t) { LOG.warn("failed to initialize cluster connection, retrying..."); } Threads.sleep(1000); } }), getName() + ":initClusterConnection"); if (!conf.getBoolean("hbase.testing.nocluster", false)) { Threads.setDaemonThreadRunning(new Thread(() -> { try { int infoPort = putUpJettyServer(); startActiveMasterManager(infoPort); } catch (Throwable t) { String error = "Failed to become Active Master"; LOG.error(error, t); if (!isAborted()) { abort(error, t); } } }), getName() + ":becomeActiveMaster"); } super.run(); } finally { if (this.clusterSchemaService != null) { this.clusterSchemaService.stopAsync(); try { this.clusterSchemaService.awaitTerminated( getConfiguration().getInt(HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS, DEFAULT_HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS), TimeUnit.SECONDS); } catch (TimeoutException te) { LOG.warn("Failed shutdown of clusterSchemaService", te); } } this.activeMaster = false; } }
Source:
<code><START> public void testExecutorFilter() throws Exception { <END> MockFlowObject dispatchingObj = new MockFlowObject("flow1",3096, 1500,4200,2); MockFilter mFilter = new MockFilter(); mFilter.registerFilterforRemainingMemory(); boolean result = mFilter.check(this.getExecutorByName("Executor1"), dispatchingObj); Assert.assertTrue(result); result = mFilter.check(this.getExecutorByName("Executor3"), dispatchingObj); Assert.assertTrue(result); mFilter.registerFilterforPriority(); result = mFilter.check(this.getExecutorByName("Executor3"), dispatchingObj); Assert.assertFalse(result); mFilter.registerFilterforRemainingTmpSpace(); result = mFilter.check(this.getExecutorByName("Executor2"), dispatchingObj); Assert.assertTrue(result); result = mFilter.check(this.getExecutorByName("Executor8"), dispatchingObj); Assert.assertFalse(result); }</code><technical_language>easier understand maintain if tests broken self-contained separate test methods</technical_language>

Target:
public void testExecutorFilter() throws Exception { MockFlowObject dispatchingObj = new MockFlowObject("flow1",3096, 1500,4200,2); MockFilter mFilter = new MockFilter(); mFilter.registerFilterforRemainingMemory(); boolean result = mFilter.filterTarget(this.getExecutorByName("Executor1"), dispatchingObj); Assert.assertTrue(result); result = mFilter.filterTarget(this.getExecutorByName("Executor3"), dispatchingObj); Assert.assertTrue(result); mFilter.registerFilterforPriority(); result = mFilter.filterTarget(this.getExecutorByName("Executor3"), dispatchingObj); Assert.assertFalse(result); mFilter.registerFilterforRemainingTmpSpace(); result = mFilter.filterTarget(this.getExecutorByName("Executor2"), dispatchingObj); Assert.assertTrue(result); result = mFilter.filterTarget(this.getExecutorByName("Executor8"), dispatchingObj); Assert.assertFalse(result); }
Source:
<code><START> public CellTrait trait(){ <END> return new CellTrait() { @Override public Object get(Cell cell, CellTraitPropertySpec<?> spec) { if (spec == PROPERTY) { return SelectionController.this; } else { return super.get(cell, spec); } } @Override public void onAdd(Cell cell) { SelectionSupport<?> selectionSupport = cell.get(SelectionSupport.SELECTION_SUPPORT); if (selectionSupport != null) { selectionSupport.setSelectionController(SelectionController.this); } } }; }</code><technical_language>is this trait intended public</technical_language>

Target:
private CellTrait trait(){ return new CellTrait() { @Override public Object get(Cell cell, CellTraitPropertySpec<?> spec) { if (spec == PROPERTY) { return SelectionController.this; } else { return super.get(cell, spec); } } @Override public void onAdd(Cell cell) { SelectionSupport<?> selectionSupport = cell.get(SelectionSupport.SELECTION_SUPPORT); if (selectionSupport != null) { selectionSupport.setSelectionController(SelectionController.this); } } }; }
Source:
<code>protected String stringify(Collection<?> value) { Method saveAsString = null; if (paramConverter == null && headerDelegate == null) { try { Object o = value.iterator().next(); <START> saveAsString = o.getClass().getMethod("saveAsString"); <END> } catch (Exception e) { } } char separatorChar = getSeparatorChar(); StringBuilder sb = new StringBuilder(); boolean first = true; for (Object v : value) { if (first) { first = false; } else { sb.append(separatorChar); } if (v instanceof String) { sb.append(v); } else if (paramConverter != null) { sb.append(paramConverter.toString(v)); } else if (headerDelegate != null) { sb.append(headerDelegate.toString(v)); } else if (saveAsString != null) { try { sb.append(saveAsString.invoke(v)); } catch (Exception e) { throw new RuntimeException(Messages.MESSAGES.errorCallingSaveAsString(v)); } } else { sb.append(v.toString()); } } return sb.toString(); }</code><technical_language>add description of saveAsString method docs? (StringConverter.xml)</technical_language>

Target:
protected String stringify(Collection<?> value) { char separatorChar = getSeparatorChar(); StringBuilder sb = new StringBuilder(); boolean first = true; for (Object v : value) { if (first) { first = false; } else { sb.append(separatorChar); } if (v instanceof String) { sb.append(v); } else if (paramConverter != null) { sb.append(paramConverter.toString(v)); } else if (headerDelegate != null) { sb.append(headerDelegate.toString(v)); } else { sb.append(v.toString()); } } return sb.toString(); }
Source:
<code>private void createDeleteTool(ToolSection toolSection, DiagramElementMapping... mappings) { if (!globalDeleteTool) { DeleteElementDescription deleteElement = ToolFactory.eINSTANCE.createDeleteElementDescription(); deleteElement.setName(BASE_ID + "global.delete"); deleteElement.setLabel("Delete Tool"); toolSection.getOwnedTools().add(deleteElement); for (DiagramElementMapping dem : mappings) { deleteElement.getMappings().add(dem); } } else { for (DiagramElementMapping dem : mappings) { DeleteElementDescription deleteElement = ToolFactory.eINSTANCE.createDeleteElementDescription(); <START> deleteElement.setName(BASE_ID + "global.delete" + "." + dem.getLabel()); <END> deleteElement.setLabel("Delete Tool" + " " + dem.getLabel()); toolSection.getOwnedTools().add(deleteElement); deleteElement.getMappings().add(dem); } } }</code><technical_language>getName corresponds id. I remove base id dem.getName() concatenation: String minimizedId = play substring indexOf id. setName(BASE_ID+".global.delete." + minimizedId);</technical_language>

Target:
private void createDeleteTool(ToolSection toolSection, DiagramElementMapping... mappings) { if (!globalDeleteTool) { DeleteElementDescription deleteElement = ToolFactory.eINSTANCE.createDeleteElementDescription(); deleteElement.setName(baseId + "global.delete"); deleteElement.setLabel("Delete Tool"); toolSection.getOwnedTools().add(deleteElement); for (DiagramElementMapping dem : mappings) { deleteElement.getMappings().add(dem); } } else { for (DiagramElementMapping dem : mappings) { DeleteElementDescription deleteElement = ToolFactory.eINSTANCE.createDeleteElementDescription(); deleteElement.setName("global.delete" + "." + dem.getLabel()); deleteElement.setLabel("Delete Tool" + " " + dem.getLabel()); toolSection.getOwnedTools().add(deleteElement); deleteElement.getMappings().add(dem); } } }
Source:
<code>protected void writeTupleGenerator( String function, TupleGenerator generator) { Long seed = generator.getRandomSeed(); writer_.writeElement( TUPLEGENERATOR_TAG, <START> MapBuilder <END> .of( FUNCTION_ATR, function) .putIf( SEED_ATR, Optional.ofNullable( seed != null? String.valueOf( seed) : null)) .put( TUPLES_ATR, String.valueOf( generator.getDefaultTupleSize())) .build(), () -> { for( TupleCombiner combiner : generator.getCombiners()) { writeCombiner( combiner); } }); }</code><technical_language>actually, if builder Pattern for this consistently it, a Builder for XML tag</technical_language>

Target:
protected void writeTupleGenerator( String function, TupleGenerator generator) { Long seed = generator.getRandomSeed(); writer_ .element( TUPLEGENERATOR_TAG) .attribute( FUNCTION_ATR, function) .attributeIf( seed != null, SEED_ATR, String.valueOf( seed)) .attribute( TUPLES_ATR, String.valueOf( generator.getDefaultTupleSize())) .content( () -> { for( TupleCombiner combiner : generator.getCombiners()) { writeCombiner( combiner); } }) .write(); }
Source:
<code>protected boolean isInpatientCqmsValid() { int cqmCount = 0; for (String cqm : INPATIENT_CQMS) { if (this.cqmsMet.containsKey(cqm)) { ++cqmCount; } } <START> if(!(this.counts.get("cqmsInpatientRequiredMet") >= this.counts.get("cqmsInpatientRequired"))){ <END> String needed = String.valueOf((this.counts.get("cqmsInpatientRequired") - cqmCount)); TreeMap<String,ArrayList<String>> missingInpatient = new TreeMap<String,ArrayList<String>>(); missingInpatient.put(needed, (ArrayList<String>)INPATIENT_CQMS); missingX.add(missingInpatient); } this.counts.put("cqmsInpatientRequiredMet", cqmCount); return (this.counts.get("cqmsInpatientRequiredMet") >= this.counts.get("cqmsInpatientRequired")); }</code><technical_language>I checkstyle if( prefers if (</technical_language>

Target:
protected boolean isInpatientCqmsValid() { int cqmCount = 0; for (String cqm : INPATIENT_CQMS) { if (this.cqmsMet.containsKey(cqm)) { ++cqmCount; } } if (this.counts.get("cqmsInpatientRequiredMet") < this.counts.get("cqmsInpatientRequired")) { String needed = String.valueOf((this.counts.get("cqmsInpatientRequired") - cqmCount)); TreeMap<String, ArrayList<String>> missingInpatient = new TreeMap<String, ArrayList<String>>(); missingInpatient.put(needed, (ArrayList<String>) INPATIENT_CQMS); missingX.add(missingInpatient); } this.counts.put("cqmsInpatientRequiredMet", cqmCount); return (this.counts.get("cqmsInpatientRequiredMet") >= this.counts.get("cqmsInpatientRequired")); }
Source:
<code>public File get(String bsn, Version version, Map<String, String> properties, DownloadListener... listeners) throws Exception { <START> prepare(); <END> if (!isOk()) { return null; } Archive archive; ResourceInfo resource = bridge.getInfo(bsn, version); if (resource == null) { archive = trySources(bsn, version); if (archive == null) return null; } else { String name = resource.getInfo() .name(); archive = Archive.valueOf(name); } Promise<File> p = repoImpl.getMavenRepository() .get(archive); if (listeners.length == 0) return p.getValue(); new DownloadListenerPromise(reporter, name + ": get " + bsn + ";" + version, p, listeners); return repoImpl.getMavenRepository() .toLocalFile(archive); }</code><technical_language>prepare. init() prepare catch errors & is called once</technical_language>

Target:
public File get(String bsn, Version version, Map<String, String> properties, DownloadListener... listeners) throws Exception { if (!init()) { return null; } Archive archive; ResourceInfo resource = bridge.getInfo(bsn, version); if (resource == null) { archive = trySources(bsn, version); if (archive == null) return null; } else { String name = resource.getInfo() .name(); archive = Archive.valueOf(name); } Promise<File> p = repoImpl.getMavenRepository() .get(archive); if (listeners.length == 0) return p.getValue(); new DownloadListenerPromise(reporter, name + ": get " + bsn + ";" + version, p, listeners); return repoImpl.getMavenRepository() .toLocalFile(archive); }