before
stringlengths
12
3.21M
after
stringlengths
41
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
@Override public void send(String destination, HazelcastMQMessage msg) { if (timeToLive > 0) { msg.getHeaders().put(Headers.EXPIRATION, String.valueOf(System.currentTimeMillis() + timeToLive)); } if (destination == null) { throw new HazelcastMQException("Destination is required when " + "sending a message."); } msg.setId("hazelcastmq-" + idGenerator.newId()); msg.setDestination(destination); if (log.isFinestEnabled()) { log.finest(format("Producer sending message %s", msg)); } Object msgData = config.getMessageConverter().fromMessage(msg); IQueue<Object> queue = hazelcastMQContext.resolveQueue(destination); ITopic<Object> topic = null; if (queue == null) { topic = hazelcastMQContext.resolveTopic(destination); } if (queue != null) { if (!queue.offer(msgData)) { throw new HazelcastMQException(format("Failed to send to queue destination [%s]. Queue is full.", destination)); } } else if (topic != null) { topic.publish(msgData); } else { throw new HazelcastMQException(format("Destination cannot be resolved [%s].", destination)); } }
@Override public void send(String destination, HazelcastMQMessage msg) { <DeepExtract> if (timeToLive > 0) { msg.getHeaders().put(Headers.EXPIRATION, String.valueOf(System.currentTimeMillis() + timeToLive)); } if (destination == null) { throw new HazelcastMQException("Destination is required when " + "sending a message."); } msg.setId("hazelcastmq-" + idGenerator.newId()); msg.setDestination(destination); if (log.isFinestEnabled()) { log.finest(format("Producer sending message %s", msg)); } Object msgData = config.getMessageConverter().fromMessage(msg); IQueue<Object> queue = hazelcastMQContext.resolveQueue(destination); ITopic<Object> topic = null; if (queue == null) { topic = hazelcastMQContext.resolveTopic(destination); } if (queue != null) { if (!queue.offer(msgData)) { throw new HazelcastMQException(format("Failed to send to queue destination [%s]. Queue is full.", destination)); } } else if (topic != null) { topic.publish(msgData); } else { throw new HazelcastMQException(format("Destination cannot be resolved [%s].", destination)); } </DeepExtract> }
hazelcastmq
positive
4,048
public static <T> CommonPage<T> restPage(IPage<T> pageInfo) { CommonPage<T> result = new CommonPage<T>(); this.totalPage = (int) pageInfo.getPages(); this.pageNum = (int) pageInfo.getCurrent(); this.pageSize = (int) pageInfo.getSize(); this.total = pageInfo.getTotal(); this.list = pageInfo.getRecords(); return result; }
public static <T> CommonPage<T> restPage(IPage<T> pageInfo) { CommonPage<T> result = new CommonPage<T>(); this.totalPage = (int) pageInfo.getPages(); this.pageNum = (int) pageInfo.getCurrent(); this.pageSize = (int) pageInfo.getSize(); this.total = pageInfo.getTotal(); <DeepExtract> this.list = pageInfo.getRecords(); </DeepExtract> return result; }
harry
positive
4,049
private void initView() { mLeftViewAdapterIndex = -1; mRightViewAdapterIndex = -1; mDisplayOffset = 0; mCurrentX = 0; mNextX = 0; mMaxX = Integer.MAX_VALUE; if (mCurrentScrollState != OnScrollStateChangedListener.ScrollState.SCROLL_STATE_IDLE && mOnScrollStateChangedListener != null) { mOnScrollStateChangedListener.onScrollStateChanged(OnScrollStateChangedListener.ScrollState.SCROLL_STATE_IDLE); } mCurrentScrollState = OnScrollStateChangedListener.ScrollState.SCROLL_STATE_IDLE; }
private void initView() { mLeftViewAdapterIndex = -1; mRightViewAdapterIndex = -1; mDisplayOffset = 0; mCurrentX = 0; mNextX = 0; mMaxX = Integer.MAX_VALUE; <DeepExtract> if (mCurrentScrollState != OnScrollStateChangedListener.ScrollState.SCROLL_STATE_IDLE && mOnScrollStateChangedListener != null) { mOnScrollStateChangedListener.onScrollStateChanged(OnScrollStateChangedListener.ScrollState.SCROLL_STATE_IDLE); } mCurrentScrollState = OnScrollStateChangedListener.ScrollState.SCROLL_STATE_IDLE; </DeepExtract> }
KSYMediaPlayerKit_Android
positive
4,050
@Override public void give(Give give) { System.out.println(RemoteClientBlockEngine.class.getSimpleName() + ".onMessage = " + give); }
@Override public void give(Give give) { <DeepExtract> System.out.println(RemoteClientBlockEngine.class.getSimpleName() + ".onMessage = " + give); </DeepExtract> }
Chronicle-Decentred
positive
4,051
public void exit() { currentCommand = null; textboxLabel.setVisible(false); speakerLabel.setVisible(false); choiceHighlighted = -1; choiceShowing = false; if (!false) { for (TextButton b : choiceButtons) { b.setVisible(false); } } currentBranch.clear(); }
public void exit() { currentCommand = null; textboxLabel.setVisible(false); speakerLabel.setVisible(false); <DeepExtract> choiceHighlighted = -1; choiceShowing = false; if (!false) { for (TextButton b : choiceButtons) { b.setVisible(false); } } </DeepExtract> currentBranch.clear(); }
ProjectVisualNovel
positive
4,052
public void rotate(float angle) { showWarning("rotate" + "(), or this particular variation of it, " + "is not available with this renderer."); }
public void rotate(float angle) { <DeepExtract> showWarning("rotate" + "(), or this particular variation of it, " + "is not available with this renderer."); </DeepExtract> }
rainbow
positive
4,053
public void opened(GuiSettings guiSettings) { AuthenticationMethod method = Config.getAuthMethod(); msAuthPane.setVisible(false); msAuthBackupPane.setVisible(false); manualAuthPane.setVisible(false); setStatusText(""); if (method == AuthenticationMethod.MICROSOFT) { msAuthPane.setVisible(true); MicrosoftAuthHandler handler = Config.getMicrosoftAuth(); if (handler != null && handler.hasLoggedIn()) { setStatusText("Microsoft login session present."); } else { setStatusError(method.getErrorMessage()); } return; } if (authServer != null) { authServer.stop(); authServer = null; } if (method == AuthenticationMethod.MANUAL) { manualAuthPane.setVisible(true); if (manualDetails == null) { manualDetails = new AuthDetails(""); Config.setManualAuthDetails(manualDetails); } accessToken.setText(manualDetails.getAccessToken()); } }
public void opened(GuiSettings guiSettings) { <DeepExtract> AuthenticationMethod method = Config.getAuthMethod(); msAuthPane.setVisible(false); msAuthBackupPane.setVisible(false); manualAuthPane.setVisible(false); setStatusText(""); if (method == AuthenticationMethod.MICROSOFT) { msAuthPane.setVisible(true); MicrosoftAuthHandler handler = Config.getMicrosoftAuth(); if (handler != null && handler.hasLoggedIn()) { setStatusText("Microsoft login session present."); } else { setStatusError(method.getErrorMessage()); } return; } if (authServer != null) { authServer.stop(); authServer = null; } if (method == AuthenticationMethod.MANUAL) { manualAuthPane.setVisible(true); if (manualDetails == null) { manualDetails = new AuthDetails(""); Config.setManualAuthDetails(manualDetails); } accessToken.setText(manualDetails.getAccessToken()); } </DeepExtract> }
minecraft-world-downloader
positive
4,054
public void stateChanged(ChangeEvent e) { modified = !dojoSourcesText.getText().equals(settingsService.getDojoSourcesDirectory()) || !projectSourcesText.getText().equals(settingsService.getProjectSourcesDirectory()) || preferRelativePathsWhenCheckBox.isSelected() != settingsService.isPreferRelativeImports() || dojoSourcesIsTheSame.isSelected() != settingsService.isDojoSourcesShareProjectSourcesRoot() || pluginEnabled.isSelected() != settingsService.isNeedsMoreDojoEnabled() || addModulesIfThereAreNoneDetected.isSelected() != settingsService.isAddModuleIfThereAreNoneDefined() || allowCaseInsensitiveSearch.isSelected() != settingsService.isAllowCaseInsensitiveSearch() || !supportedFileTypes.getText().equals(settingsService.getSupportedFileTypes()) || enableRefactoringSupportForCheckBox.isSelected() != settingsService.isRefactoringEnabled() || singleQuotesRadioButton.isSelected() != settingsService.isSingleQuotedModuleIDs() || displayWarningIfSourcesCheckBox.isSelected() == settingsService.isSetupWarningDisabled(); }
public void stateChanged(ChangeEvent e) { <DeepExtract> modified = !dojoSourcesText.getText().equals(settingsService.getDojoSourcesDirectory()) || !projectSourcesText.getText().equals(settingsService.getProjectSourcesDirectory()) || preferRelativePathsWhenCheckBox.isSelected() != settingsService.isPreferRelativeImports() || dojoSourcesIsTheSame.isSelected() != settingsService.isDojoSourcesShareProjectSourcesRoot() || pluginEnabled.isSelected() != settingsService.isNeedsMoreDojoEnabled() || addModulesIfThereAreNoneDetected.isSelected() != settingsService.isAddModuleIfThereAreNoneDefined() || allowCaseInsensitiveSearch.isSelected() != settingsService.isAllowCaseInsensitiveSearch() || !supportedFileTypes.getText().equals(settingsService.getSupportedFileTypes()) || enableRefactoringSupportForCheckBox.isSelected() != settingsService.isRefactoringEnabled() || singleQuotesRadioButton.isSelected() != settingsService.isSingleQuotedModuleIDs() || displayWarningIfSourcesCheckBox.isSelected() == settingsService.isSetupWarningDisabled(); </DeepExtract> }
needsmoredojo
positive
4,055
@Override public <T> T nextEmpty(final InstanceType<T> instanceType, final FixtureContract fixture) { return (T) new Error(fixture.create(String.class)); }
@Override public <T> T nextEmpty(final InstanceType<T> instanceType, final FixtureContract fixture) { <DeepExtract> return (T) new Error(fixture.create(String.class)); </DeepExtract> }
AutoFixtureGenerator
positive
4,056
private void assertSuggestion(Suggestion suggestion, String expectedLabel, String expectedGroupName) { assertThat(suggestion.getLabel()).isEqualTo(expectedLabel); assertThat(suggestion.getPayload().get(LuceneQuerySuggester.PAYLOAD_GROUPMATCH_KEY)).isEqualTo(expectedGroupName); }
private void assertSuggestion(Suggestion suggestion, String expectedLabel, String expectedGroupName) { assertThat(suggestion.getLabel()).isEqualTo(expectedLabel); <DeepExtract> assertThat(suggestion.getPayload().get(LuceneQuerySuggester.PAYLOAD_GROUPMATCH_KEY)).isEqualTo(expectedGroupName); </DeepExtract> }
open-commerce-search
positive
4,057
@Test public void multipleBuildCallsWithCustomBody() { final PayloadBuilder builder = new PayloadBuilder(); builder.alertBody("what").actionKey("Cancel"); final String expected = "{\"aps\":{\"alert\":{\"action-loc-key\":\"Cancel\",\"body\":\"what\"}}}"; final ObjectMapper mapper = new ObjectMapper(); try { @SuppressWarnings("unchecked") final Map<String, Object> exNode = mapper.readValue(expected, Map.class), acNode = mapper.readValue(builder.build(), Map.class); assertEquals(exNode, acNode); } catch (final Exception e) { throw new IllegalStateException(e); } final ObjectMapper mapper = new ObjectMapper(); try { @SuppressWarnings("unchecked") final Map<String, Object> exNode = mapper.readValue(expected, Map.class), acNode = mapper.readValue(builder.build(), Map.class); assertEquals(exNode, acNode); } catch (final Exception e) { throw new IllegalStateException(e); } }
@Test public void multipleBuildCallsWithCustomBody() { final PayloadBuilder builder = new PayloadBuilder(); builder.alertBody("what").actionKey("Cancel"); final String expected = "{\"aps\":{\"alert\":{\"action-loc-key\":\"Cancel\",\"body\":\"what\"}}}"; <DeepExtract> final ObjectMapper mapper = new ObjectMapper(); try { @SuppressWarnings("unchecked") final Map<String, Object> exNode = mapper.readValue(expected, Map.class), acNode = mapper.readValue(builder.build(), Map.class); assertEquals(exNode, acNode); } catch (final Exception e) { throw new IllegalStateException(e); } </DeepExtract> final ObjectMapper mapper = new ObjectMapper(); try { @SuppressWarnings("unchecked") final Map<String, Object> exNode = mapper.readValue(expected, Map.class), acNode = mapper.readValue(builder.build(), Map.class); assertEquals(exNode, acNode); } catch (final Exception e) { throw new IllegalStateException(e); } }
java-apns
positive
4,058
@Override public boolean visit(ChildRef childRef) { write("CHIL", null, childRef.getRef(), null, false); stack.push(childRef); writeString("_PREF", childRef, childRef.getPreferred()); return true; }
@Override public boolean visit(ChildRef childRef) { write("CHIL", null, childRef.getRef(), null, false); stack.push(childRef); <DeepExtract> writeString("_PREF", childRef, childRef.getPreferred()); </DeepExtract> return true; }
gedcom5-java
positive
4,059
public void startProgramming(ISenseOtapProgramRequest programRequest) { if (sendOtapProgramRequestsSchedule != null) { sendOtapProgramRequestsSchedule.cancel(false); } sendOtapProgramRequestsSchedule = null; programImage = null; devicesToProgram.clear(); log.info("Received programming request {}. Starting to program...", programRequest); this.programStatus = new ISenseOtapProgramResult(programRequest.getDevicesToProgram()); for (Integer deviceId : programRequest.getDevicesToProgram()) { devicesToProgram.put(deviceId, new ISenseOtapDevice(deviceId)); } programImage = new ISenseOtapImage(programRequest.getOtapProgram()); { int maxPacketsPerChunk = 0; for (int i = 0; i < programImage.getChunkCount(); ++i) { maxPacketsPerChunk = Math.max(maxPacketsPerChunk, programImage.getPacketCount(i, i)); } int magicTimeoutMillis = settingMaxReRequests * maxPacketsPerChunk * settingTimeoutMultiplier + 10000; chunkTimeout.setTimeOutMillis(magicTimeoutMillis); log.debug("Setting chunk timeout to {} ms.", magicTimeoutMillis); prepareChunk(0); } sendOtapProgramRequestsSchedule = executorService.scheduleWithFixedDelay(sendOtapProgramRequestsRunnable, 0, otapProgramInterval, otapProgramIntervalTimeUnit); }
public void startProgramming(ISenseOtapProgramRequest programRequest) { <DeepExtract> if (sendOtapProgramRequestsSchedule != null) { sendOtapProgramRequestsSchedule.cancel(false); } sendOtapProgramRequestsSchedule = null; programImage = null; devicesToProgram.clear(); </DeepExtract> log.info("Received programming request {}. Starting to program...", programRequest); this.programStatus = new ISenseOtapProgramResult(programRequest.getDevicesToProgram()); for (Integer deviceId : programRequest.getDevicesToProgram()) { devicesToProgram.put(deviceId, new ISenseOtapDevice(deviceId)); } programImage = new ISenseOtapImage(programRequest.getOtapProgram()); { int maxPacketsPerChunk = 0; for (int i = 0; i < programImage.getChunkCount(); ++i) { maxPacketsPerChunk = Math.max(maxPacketsPerChunk, programImage.getPacketCount(i, i)); } int magicTimeoutMillis = settingMaxReRequests * maxPacketsPerChunk * settingTimeoutMultiplier + 10000; chunkTimeout.setTimeOutMillis(magicTimeoutMillis); log.debug("Setting chunk timeout to {} ms.", magicTimeoutMillis); prepareChunk(0); } sendOtapProgramRequestsSchedule = executorService.scheduleWithFixedDelay(sendOtapProgramRequestsRunnable, 0, otapProgramInterval, otapProgramIntervalTimeUnit); }
netty-protocols
positive
4,060
public Criteria andPhone1GreaterThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "phone1" + " cannot be null"); } criteria.add(new Criterion("phone_1 >", value)); return (Criteria) this; }
public Criteria andPhone1GreaterThan(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "phone1" + " cannot be null"); } criteria.add(new Criterion("phone_1 >", value)); </DeepExtract> return (Criteria) this; }
health_online
positive
4,061
public void updateBigInt(BigInteger b) { updateUINT32(b.toByteArray().length); updateBytes(b.toByteArray()); }
public void updateBigInt(BigInteger b) { <DeepExtract> updateUINT32(b.toByteArray().length); updateBytes(b.toByteArray()); </DeepExtract> }
Testingbot-Tunnel
positive
4,062
public void suspendEncoding() throws java.io.IOException { if (position > 0) { if (encode) { out.write(encode3to4(b4, buffer, position, options)); position = 0; } else { throw new java.io.IOException("Base64 input not properly padded."); } } this.suspendEncoding = true; }
public void suspendEncoding() throws java.io.IOException { <DeepExtract> if (position > 0) { if (encode) { out.write(encode3to4(b4, buffer, position, options)); position = 0; } else { throw new java.io.IOException("Base64 input not properly padded."); } } </DeepExtract> this.suspendEncoding = true; }
crawl-anywhere
positive
4,063
public face_sim_result getResult(I iface, face_sim_args args) throws org.apache.thrift.TException { face_sim_result result = new face_sim_result(); send_face_sim(args.img_base64_1, args.img_base64_2); return recv_face_sim(); return result; }
public face_sim_result getResult(I iface, face_sim_args args) throws org.apache.thrift.TException { face_sim_result result = new face_sim_result(); <DeepExtract> send_face_sim(args.img_base64_1, args.img_base64_2); return recv_face_sim(); </DeepExtract> return result; }
aiop-core
positive
4,065
public void execute(ActionEvent e) { if (!saveValidate()) { return; } String config = getReleaseProcessor().toConfig(ruleEntity, dataBox); if (StringUtils.isEmpty(config)) { JBasicOptionPane.showMessageDialog(HandleManager.getFrame(AbstractReleaseTopology.this), ConsoleLocaleFactory.getString("config_not_null"), SwingLocale.getString("warning"), JBasicOptionPane.WARNING_MESSAGE); return; } int selectedValue = JBasicOptionPane.showConfirmDialog(HandleManager.getFrame(AbstractReleaseTopology.this), ConsoleLocaleFactory.getString("save_confirm") + "\n" + getKey(), SwingLocale.getString("confirm"), JBasicOptionPane.YES_NO_OPTION); if (selectedValue != JBasicOptionPane.OK_OPTION) { return; } String group = getGroup(); String serviceId = getServiceId(); save(group, serviceId, config); }
public void execute(ActionEvent e) { if (!saveValidate()) { return; } String config = getReleaseProcessor().toConfig(ruleEntity, dataBox); if (StringUtils.isEmpty(config)) { JBasicOptionPane.showMessageDialog(HandleManager.getFrame(AbstractReleaseTopology.this), ConsoleLocaleFactory.getString("config_not_null"), SwingLocale.getString("warning"), JBasicOptionPane.WARNING_MESSAGE); return; } int selectedValue = JBasicOptionPane.showConfirmDialog(HandleManager.getFrame(AbstractReleaseTopology.this), ConsoleLocaleFactory.getString("save_confirm") + "\n" + getKey(), SwingLocale.getString("confirm"), JBasicOptionPane.YES_NO_OPTION); if (selectedValue != JBasicOptionPane.OK_OPTION) { return; } <DeepExtract> String group = getGroup(); String serviceId = getServiceId(); save(group, serviceId, config); </DeepExtract> }
DiscoveryUI
positive
4,067
public ActionLink appendKey(String key) { if (new ActionGetKey(key) == null) return this; return new ActionLink().addThen(this).addThen(new ActionGetKey(key)); }
public ActionLink appendKey(String key) { <DeepExtract> if (new ActionGetKey(key) == null) return this; return new ActionLink().addThen(this).addThen(new ActionGetKey(key)); </DeepExtract> }
UntilTheEnd
positive
4,068
@Override public PersistentCollectionSerializer unwrappingSerializer(NameTransformer unwrapper) { if ((_serializer.unwrappingSerializer(unwrapper) == _serializer) || (_serializer.unwrappingSerializer(unwrapper) == null)) { return this; } return new PersistentCollectionSerializer(this, _serializer.unwrappingSerializer(unwrapper)); }
@Override public PersistentCollectionSerializer unwrappingSerializer(NameTransformer unwrapper) { <DeepExtract> if ((_serializer.unwrappingSerializer(unwrapper) == _serializer) || (_serializer.unwrappingSerializer(unwrapper) == null)) { return this; } return new PersistentCollectionSerializer(this, _serializer.unwrappingSerializer(unwrapper)); </DeepExtract> }
jackson-datatype-hibernate
positive
4,069
public Criteria andIdmypatientBetween(Integer value1, Integer value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "idmypatient" + " cannot be null"); } criteria.add(new Criterion("idmypatient between", value1, value2)); return (Criteria) this; }
public Criteria andIdmypatientBetween(Integer value1, Integer value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "idmypatient" + " cannot be null"); } criteria.add(new Criterion("idmypatient between", value1, value2)); </DeepExtract> return (Criteria) this; }
ehealth_start
positive
4,070
public Boolean isFragMask() { return receiver.getFlag(ConfigFlag.FRAG_MASK); }
public Boolean isFragMask() { <DeepExtract> return receiver.getFlag(ConfigFlag.FRAG_MASK); </DeepExtract> }
warp
positive
4,071
@Override public void containsText(String text) { fluentWait.waitFor(new ElementContainsText(element, text)); }
@Override public void containsText(String text) { <DeepExtract> fluentWait.waitFor(new ElementContainsText(element, text)); </DeepExtract> }
teasy
positive
4,073
public void onClose(WebSocketConnection conn) { if (conn != null) { conn.close(); } viewer = null; connection = null; System.out.println("Connection closed"); }
public void onClose(WebSocketConnection conn) { <DeepExtract> if (conn != null) { conn.close(); } viewer = null; connection = null; </DeepExtract> System.out.println("Connection closed"); }
OculusGoStreamer
positive
4,074
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mMonthReceiver = new MonthReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction(ADD_EVENT); filter.addAction(UPDATE_EVENT); filter.addAction(DELETE_EVENT); filter.addAction(UPDATE_UI); filter.addAction(SKIP); filter.addAction(SELECTED); filter.addAction(WEEK_SETTING); mHostActivity.registerReceiver(mMonthReceiver, filter); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); <DeepExtract> mMonthReceiver = new MonthReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction(ADD_EVENT); filter.addAction(UPDATE_EVENT); filter.addAction(DELETE_EVENT); filter.addAction(UPDATE_UI); filter.addAction(SKIP); filter.addAction(SELECTED); filter.addAction(WEEK_SETTING); mHostActivity.registerReceiver(mMonthReceiver, filter); </DeepExtract> }
CalendarII
positive
4,075
public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder().include(ConsumeMostlySuccess.class.getSimpleName()).warmupIterations(10).measurementIterations(10).threads(2).forks(1).build(); new Runner(opt).run(); }
public static void main(String[] args) throws RunnerException { <DeepExtract> Options opt = new OptionsBuilder().include(ConsumeMostlySuccess.class.getSimpleName()).warmupIterations(10).measurementIterations(10).threads(2).forks(1).build(); new Runner(opt).run(); </DeepExtract> }
bucket4j
positive
4,076
@Test public void mustIdentifyAssignabilityToArraysOfLesserDimensions() { boolean expected = Number[][].class.isAssignableFrom(Integer[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Number[][].class), Type.getType(Integer[][][].class)); assertEquals(expected, actual); boolean expected = Integer[][].class.isAssignableFrom(Number[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Integer[][].class), Type.getType(Number[][][].class)); assertEquals(expected, actual); boolean expected = Integer[][].class.isAssignableFrom(Number[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Integer[][].class), Type.getType(Number[][][].class)); assertEquals(expected, actual); boolean expected = int[][].class.isAssignableFrom(int[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(int[][].class), Type.getType(int[][][].class)); assertEquals(expected, actual); boolean expected = Object[][].class.isAssignableFrom(Integer[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Object[][].class), Type.getType(Integer[][][].class)); assertEquals(expected, actual); boolean expected = Object[][].class.isAssignableFrom(Number[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Object[][].class), Type.getType(Number[][][].class)); assertEquals(expected, actual); }
@Test public void mustIdentifyAssignabilityToArraysOfLesserDimensions() { boolean expected = Number[][].class.isAssignableFrom(Integer[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Number[][].class), Type.getType(Integer[][][].class)); assertEquals(expected, actual); boolean expected = Integer[][].class.isAssignableFrom(Number[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Integer[][].class), Type.getType(Number[][][].class)); assertEquals(expected, actual); boolean expected = Integer[][].class.isAssignableFrom(Number[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Integer[][].class), Type.getType(Number[][][].class)); assertEquals(expected, actual); boolean expected = int[][].class.isAssignableFrom(int[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(int[][].class), Type.getType(int[][][].class)); assertEquals(expected, actual); boolean expected = Object[][].class.isAssignableFrom(Integer[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Object[][].class), Type.getType(Integer[][][].class)); assertEquals(expected, actual); <DeepExtract> boolean expected = Object[][].class.isAssignableFrom(Number[][][].class); boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Object[][].class), Type.getType(Number[][][].class)); assertEquals(expected, actual); </DeepExtract> }
coroutines
positive
4,077
@Override public void run() { Animation exitAnim = AnimationUtils.loadAnimation(getOwnActivity() == null ? boxRoot.getContext() : getOwnActivity(), exitAnimResId == 0 ? R.anim.anim_dialogx_default_exit : exitAnimResId); long exitAnimDuration = getExitAnimationDuration(exitAnim); exitAnim.setDuration(exitAnimDuration); exitAnim.setFillAfter(true); boxBody.startAnimation(exitAnim); boxRoot.animate().alpha(0f).setInterpolator(new AccelerateInterpolator()).setDuration(exitAnimDuration); runOnMainDelay(new Runnable() { @Override public void run() { waitForDismiss(); } }, getExitAnimationDuration(null)); }
@Override public void run() { <DeepExtract> Animation exitAnim = AnimationUtils.loadAnimation(getOwnActivity() == null ? boxRoot.getContext() : getOwnActivity(), exitAnimResId == 0 ? R.anim.anim_dialogx_default_exit : exitAnimResId); long exitAnimDuration = getExitAnimationDuration(exitAnim); exitAnim.setDuration(exitAnimDuration); exitAnim.setFillAfter(true); boxBody.startAnimation(exitAnim); boxRoot.animate().alpha(0f).setInterpolator(new AccelerateInterpolator()).setDuration(exitAnimDuration); </DeepExtract> runOnMainDelay(new Runnable() { @Override public void run() { waitForDismiss(); } }, getExitAnimationDuration(null)); }
DialogX
positive
4,078
public static MyStringValue createMyStringValue(String string) { MyStringValue val = new MyStringValue(); this.string = string; return val; }
public static MyStringValue createMyStringValue(String string) { MyStringValue val = new MyStringValue(); <DeepExtract> this.string = string; </DeepExtract> return val; }
qson
positive
4,079
@Override public void onDestroy() { if (useEventBus()) EventBus.getDefault().unregister(this); if (mCompositeSubscription != null) { mCompositeSubscription.unsubscribe(); } this.mCompositeSubscription = null; }
@Override public void onDestroy() { if (useEventBus()) EventBus.getDefault().unregister(this); <DeepExtract> if (mCompositeSubscription != null) { mCompositeSubscription.unsubscribe(); } </DeepExtract> this.mCompositeSubscription = null; }
MVPArt
positive
4,081
public void setRange(@NonNull String key, String value, long offset) { ArgumentAssert.notEmpty(key, KEY_NOT_NULL); boolean cacheNullVal = offset.length > 0 ? offset[0] : defaultCacheNullVal; if (!cacheNullVal && value == null) { return; } valueOps.set(key, value == null ? newNullVal() : value); }
public void setRange(@NonNull String key, String value, long offset) { <DeepExtract> ArgumentAssert.notEmpty(key, KEY_NOT_NULL); boolean cacheNullVal = offset.length > 0 ? offset[0] : defaultCacheNullVal; if (!cacheNullVal && value == null) { return; } valueOps.set(key, value == null ? newNullVal() : value); </DeepExtract> }
sparkzxl-component
positive
4,082
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getSignBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, getLabelBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(4, getTitleBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, summary_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(6, getLinkBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(7, getExtendedLinkBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(10, getAuthorBytes()); } if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(11, getPublishDateBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { size += com.google.protobuf.CodedOutputStream.computeUInt64Size(12, tsUpdate_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getSignBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getLabelBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getTitleBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeMessage(5, summary_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, getLinkBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, getExtendedLinkBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeBytes(10, getAuthorBytes()); } if (((bitField0_ & 0x00000100) == 0x00000100)) { output.writeBytes(11, getPublishDateBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { output.writeUInt64(12, tsUpdate_); } getUnknownFields().writeTo(output); }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { <DeepExtract> int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getSignBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, getLabelBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(4, getTitleBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, summary_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(6, getLinkBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(7, getExtendedLinkBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(10, getAuthorBytes()); } if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(11, getPublishDateBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { size += com.google.protobuf.CodedOutputStream.computeUInt64Size(12, tsUpdate_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; </DeepExtract> if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getSignBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getLabelBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getTitleBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeMessage(5, summary_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, getLinkBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, getExtendedLinkBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeBytes(10, getAuthorBytes()); } if (((bitField0_ & 0x00000100) == 0x00000100)) { output.writeBytes(11, getPublishDateBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { output.writeUInt64(12, tsUpdate_); } getUnknownFields().writeTo(output); }
xpath_proto_builder
positive
4,083
public boolean remove(Object o) { if (o == null) return false; int mask = elements.length - 1; int i = head; E x; while ((x = elements[i]) != null) { if (o.equals(x)) { delete(i); return true; } i = (i + 1) & mask; } return false; }
public boolean remove(Object o) { <DeepExtract> if (o == null) return false; int mask = elements.length - 1; int i = head; E x; while ((x = elements[i]) != null) { if (o.equals(x)) { delete(i); return true; } i = (i + 1) & mask; } return false; </DeepExtract> }
tvframe
positive
4,084
@Override public void onNext(@NonNull Map<String, List<Double>> logs) { OpenLoopFuelingCorrectionViewModel.this.afrLogMap = logs; if (me7LogMap != null && afrLogMap != null && mlhfmMap != null) { OpenLoopMlhfmCorrectionManager openLoopMlhfmCorrectionManager = new OpenLoopMlhfmCorrectionManager(OpenLoopFuelingLogFilterPreferences.getMinThrottleAnglePreference(), OpenLoopFuelingLogFilterPreferences.getMinRpmPreference(), OpenLoopFuelingLogFilterPreferences.getMinMe7PointsPreference(), OpenLoopFuelingLogFilterPreferences.getMinAfrPointsPreference(), OpenLoopFuelingLogFilterPreferences.getMaxAfrPreference()); openLoopMlhfmCorrectionManager.correct(me7LogMap, afrLogMap, mlhfmMap); OpenLoopMlhfmCorrection openLoopMlhfmCorrection = openLoopMlhfmCorrectionManager.getOpenLoopCorrection(); if (openLoopMlhfmCorrection != null) { publishSubject.onNext(openLoopMlhfmCorrection); } } }
@Override public void onNext(@NonNull Map<String, List<Double>> logs) { OpenLoopFuelingCorrectionViewModel.this.afrLogMap = logs; <DeepExtract> if (me7LogMap != null && afrLogMap != null && mlhfmMap != null) { OpenLoopMlhfmCorrectionManager openLoopMlhfmCorrectionManager = new OpenLoopMlhfmCorrectionManager(OpenLoopFuelingLogFilterPreferences.getMinThrottleAnglePreference(), OpenLoopFuelingLogFilterPreferences.getMinRpmPreference(), OpenLoopFuelingLogFilterPreferences.getMinMe7PointsPreference(), OpenLoopFuelingLogFilterPreferences.getMinAfrPointsPreference(), OpenLoopFuelingLogFilterPreferences.getMaxAfrPreference()); openLoopMlhfmCorrectionManager.correct(me7LogMap, afrLogMap, mlhfmMap); OpenLoopMlhfmCorrection openLoopMlhfmCorrection = openLoopMlhfmCorrectionManager.getOpenLoopCorrection(); if (openLoopMlhfmCorrection != null) { publishSubject.onNext(openLoopMlhfmCorrection); } } </DeepExtract> }
ME7Tuner
positive
4,085
public void cleanData() { mData = null; super.notifyDataSetChanged(); if (mDataChangeListener != null) { mDataChangeListener.onAdapterDataChange(); } }
public void cleanData() { mData = null; <DeepExtract> super.notifyDataSetChanged(); if (mDataChangeListener != null) { mDataChangeListener.onAdapterDataChange(); } </DeepExtract> }
AZList
positive
4,086
public boolean isInfomixFamily() { return StrUtils.startsWithIgnoreCase(this.toString(), "Infomix"); }
public boolean isInfomixFamily() { <DeepExtract> return StrUtils.startsWithIgnoreCase(this.toString(), "Infomix"); </DeepExtract> }
jDialects
positive
4,087
public Criteria andUuidIsNull() { if ("uuid is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("uuid is null")); return (Criteria) this; }
public Criteria andUuidIsNull() { <DeepExtract> if ("uuid is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("uuid is null")); </DeepExtract> return (Criteria) this; }
lightconf
positive
4,088
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.getRequestDispatcher("/profile.jsp").forward(request, response); System.out.println("Redirected to profile.jsp"); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { <DeepExtract> request.getRequestDispatcher("/profile.jsp").forward(request, response); System.out.println("Redirected to profile.jsp"); </DeepExtract> }
javaee8-cookbook
positive
4,089
public void writeToRemotePath(final String content, final String path) throws SftpException, IOException, SftpUtilException { LogUtil.entering(); if (sftpChannel == null || !sftpChannel.isConnected()) { connect(); } LogUtil.exiting(); try (final InputStream is = IOUtils.toInputStream(content, StandardCharsets.UTF_8)) { sftpChannel.put(is, path); } }
public void writeToRemotePath(final String content, final String path) throws SftpException, IOException, SftpUtilException { <DeepExtract> LogUtil.entering(); if (sftpChannel == null || !sftpChannel.isConnected()) { connect(); } LogUtil.exiting(); </DeepExtract> try (final InputStream is = IOUtils.toInputStream(content, StandardCharsets.UTF_8)) { sftpChannel.put(is, path); } }
MergeProcessor
positive
4,090
@Override public String[] getHeaders(String key) { if (state >= STATE_REQUEST_HEADERS_LOADED) return; loadRequestLine(); RequestHeaderLoader loader = new RequestHeaderLoader(); feeder.feedTo(loader); requestHeaders = loader.getCompactMap(); state = STATE_REQUEST_HEADERS_LOADED; return requestHeaders.get(key.toUpperCase()); }
@Override public String[] getHeaders(String key) { <DeepExtract> if (state >= STATE_REQUEST_HEADERS_LOADED) return; loadRequestLine(); RequestHeaderLoader loader = new RequestHeaderLoader(); feeder.feedTo(loader); requestHeaders = loader.getCompactMap(); state = STATE_REQUEST_HEADERS_LOADED; </DeepExtract> return requestHeaders.get(key.toUpperCase()); }
stream-m
positive
4,091
private Object doDownload(CloseableHttpResponse response, String downloadDir, String fileName, String... ignoreContentTypes) { if (response == null || response.getEntity() == null) { return null; } if (!validateContent(response, ignoreContentTypes)) { try { return EntityUtils.toString(response.getEntity()); } catch (ParseException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } catch (IOException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } } File dir = new File(downloadDir); if (!dir.exists()) { dir.mkdirs(); } if (fileName == null) { fileName = resolveFileName(response); } if (fileName == null) { Random random = new Random(); fileName = String.format("download_%s_%s", System.currentTimeMillis(), random.nextInt(1000)); } return fileName; File file = new File(downloadDir + File.separator + fileName); InputStream is = null; FileOutputStream fos = null; try { is = response.getEntity().getContent(); fos = new FileOutputStream(file); byte[] buffer = new byte[1024]; int len = 0; while ((len = is.read(buffer, 0, 1024)) != -1) { fos.write(buffer, 0, len); } fos.flush(); } catch (FileNotFoundException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } catch (IOException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } finally { if (is != null) { try { is.close(); } catch (IOException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } } if (fos != null) { try { fos.close(); } catch (IOException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } } } return file; }
private Object doDownload(CloseableHttpResponse response, String downloadDir, String fileName, String... ignoreContentTypes) { if (response == null || response.getEntity() == null) { return null; } if (!validateContent(response, ignoreContentTypes)) { try { return EntityUtils.toString(response.getEntity()); } catch (ParseException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } catch (IOException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } } File dir = new File(downloadDir); if (!dir.exists()) { dir.mkdirs(); } <DeepExtract> if (fileName == null) { fileName = resolveFileName(response); } if (fileName == null) { Random random = new Random(); fileName = String.format("download_%s_%s", System.currentTimeMillis(), random.nextInt(1000)); } return fileName; </DeepExtract> File file = new File(downloadDir + File.separator + fileName); InputStream is = null; FileOutputStream fos = null; try { is = response.getEntity().getContent(); fos = new FileOutputStream(file); byte[] buffer = new byte[1024]; int len = 0; while ((len = is.read(buffer, 0, 1024)) != -1) { fos.write(buffer, 0, len); } fos.flush(); } catch (FileNotFoundException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } catch (IOException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } finally { if (is != null) { try { is.close(); } catch (IOException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } } if (fos != null) { try { fos.close(); } catch (IOException e) { logger.error(ExceptionUtil.getExceptionDetails(e)); } } } return file; }
wechatty-project
positive
4,092
@Test public void testCase4() { danny = new Student(); danny.setName("Danny"); danny.setAge(14); mick = new Student(); mick.setName("Mick"); mick.setAge(13); cam = new Teacher(); cam.setTeacherName("Cam"); cam.setAge(33); cam.setSex(true); cam.setTeachYears(5); jack = new Teacher(); jack.setTeacherName("Jack"); jack.setAge(36); jack.setSex(false); jack.setTeachYears(11); if (Math.random() >= 0.5) { danny.getTeachers().add(jack); danny.getTeachers().add(cam); mick.getTeachers().add(jack); mick.getTeachers().add(cam); } else { cam.getStudents().add(danny); cam.getStudents().add(mick); jack.getStudents().add(danny); jack.getStudents().add(mick); } List<LitePalSupport> modelList = getModelList(); while (!modelList.isEmpty()) { Random rand = new Random(); int index = rand.nextInt(modelList.size()); LitePalSupport model = modelList.remove(index); model.save(); } assertTrue(isDataExists(getTableName(danny), danny.getId())); assertTrue(isDataExists(getTableName(mick), mick.getId())); assertTrue(isDataExists(getTableName(cam), cam.getId())); assertTrue(isDataExists(getTableName(jack), jack.getId())); assertM2M(getTableName(danny), getTableName(cam), danny.getId(), cam.getId()); assertM2M(getTableName(danny), getTableName(jack), danny.getId(), jack.getId()); assertM2M(getTableName(mick), getTableName(cam), mick.getId(), cam.getId()); assertM2M(getTableName(mick), getTableName(jack), mick.getId(), jack.getId()); }
@Test public void testCase4() { danny = new Student(); danny.setName("Danny"); danny.setAge(14); mick = new Student(); mick.setName("Mick"); mick.setAge(13); cam = new Teacher(); cam.setTeacherName("Cam"); cam.setAge(33); cam.setSex(true); cam.setTeachYears(5); jack = new Teacher(); jack.setTeacherName("Jack"); jack.setAge(36); jack.setSex(false); jack.setTeachYears(11); if (Math.random() >= 0.5) { danny.getTeachers().add(jack); danny.getTeachers().add(cam); mick.getTeachers().add(jack); mick.getTeachers().add(cam); } else { cam.getStudents().add(danny); cam.getStudents().add(mick); jack.getStudents().add(danny); jack.getStudents().add(mick); } <DeepExtract> List<LitePalSupport> modelList = getModelList(); while (!modelList.isEmpty()) { Random rand = new Random(); int index = rand.nextInt(modelList.size()); LitePalSupport model = modelList.remove(index); model.save(); } </DeepExtract> assertTrue(isDataExists(getTableName(danny), danny.getId())); assertTrue(isDataExists(getTableName(mick), mick.getId())); assertTrue(isDataExists(getTableName(cam), cam.getId())); assertTrue(isDataExists(getTableName(jack), jack.getId())); assertM2M(getTableName(danny), getTableName(cam), danny.getId(), cam.getId()); assertM2M(getTableName(danny), getTableName(jack), danny.getId(), jack.getId()); assertM2M(getTableName(mick), getTableName(cam), mick.getId(), cam.getId()); assertM2M(getTableName(mick), getTableName(jack), mick.getId(), jack.getId()); }
LitePal
positive
4,093
@Override public int turn(final Turn turn, final int state) { return move1.turn(turn, state / stateSize2) * stateSize2 + move2.turn(turn, state % stateSize2); }
@Override public int turn(final Turn turn, final int state) { <DeepExtract> return move1.turn(turn, state / stateSize2) * stateSize2 + move2.turn(turn, state % stateSize2); </DeepExtract> }
acube
positive
4,094
public static UUID from32(byte[] data, int offset, boolean littleEndian) { if (data == null || offset < 0 || data.length <= (offset + 3) || (Integer.MAX_VALUE - 3) < offset) { return null; } if (littleEndian) { v0 = data[offset + 3] & 0xFF; v1 = data[offset + 2] & 0xFF; v2 = data[offset + 1] & 0xFF; v3 = data[offset + 0] & 0xFF; } else { v0 = data[offset + 0] & 0xFF; v1 = data[offset + 1] & 0xFF; v2 = data[offset + 2] & 0xFF; v3 = data[offset + 3] & 0xFF; } return UUID.fromString(String.format(BASE_UUID_FORMAT, v0, v1, v2, v3)); }
public static UUID from32(byte[] data, int offset, boolean littleEndian) { if (data == null || offset < 0 || data.length <= (offset + 3) || (Integer.MAX_VALUE - 3) < offset) { return null; } if (littleEndian) { v0 = data[offset + 3] & 0xFF; v1 = data[offset + 2] & 0xFF; v2 = data[offset + 1] & 0xFF; v3 = data[offset + 0] & 0xFF; } else { v0 = data[offset + 0] & 0xFF; v1 = data[offset + 1] & 0xFF; v2 = data[offset + 2] & 0xFF; v3 = data[offset + 3] & 0xFF; } <DeepExtract> return UUID.fromString(String.format(BASE_UUID_FORMAT, v0, v1, v2, v3)); </DeepExtract> }
beacon-simulator-android
positive
4,095
static int compareTo(Object tree1, Object tree2) { if (tree1 == tree2) return 0; int size1; if (tree1 == null) size1 = 0; else if (!(tree1 instanceof Node)) size1 = ((Object[]) tree1).length >> 1; else size1 = ((Node) tree1).size; int size2; if (tree2 == null) size2 = 0; else if (!(tree2 instanceof Node)) size2 = ((Object[]) tree2).length >> 1; else size2 = ((Node) tree2).size; if (size1 < size2) return -1; else if (size1 > size2) return 1; else return compareTo(tree1, 0, tree2, 0, 0, size1); }
static int compareTo(Object tree1, Object tree2) { if (tree1 == tree2) return 0; int size1; if (tree1 == null) size1 = 0; else if (!(tree1 instanceof Node)) size1 = ((Object[]) tree1).length >> 1; else size1 = ((Node) tree1).size; <DeepExtract> int size2; if (tree2 == null) size2 = 0; else if (!(tree2 instanceof Node)) size2 = ((Object[]) tree2).length >> 1; else size2 = ((Node) tree2).size; </DeepExtract> if (size1 < size2) return -1; else if (size1 > size2) return 1; else return compareTo(tree1, 0, tree2, 0, 0, size1); }
fset-java
positive
4,096
private void addAutomation(String imagePath, String type, int[] keyCodes, String trigger, String focusedProgram, long minDelay, long timeout, String midiSignature, float scanRate, boolean isMovable) { Vector<Object> rowData = new Vector<Object>(); rowData.add(getColumn(COLNAME_IMAGE).getModelIndex(), initScreenshotIcon(imagePath)); rowData.add(getColumn(COLNAME_TYPE).getModelIndex(), initType(type)); rowData.add(getColumn(COLNAME_KEYS).getModelIndex(), initKeys(keyCodes)); rowData.add(getColumn(COLNAME_TRIGGER).getModelIndex(), initTrigger(trigger)); rowData.add(getColumn(COLNAME_FOCUS).getModelIndex(), initFocusedProgram(focusedProgram)); rowData.add(getColumn(COLNAME_MIN_DELAY).getModelIndex(), minDelay); rowData.add(getColumn(COLNAME_TIMEOUT).getModelIndex(), timeout); rowData.add(getColumn(COLNAME_MIDI_SIGNATURE).getModelIndex(), initMidiMessage(midiSignature)); rowData.add(getColumn(COLNAME_SCAN_RATE).getModelIndex(), scanRate); rowData.add(getColumn(COLNAME_MOVABLE).getModelIndex(), isMovable); JTableComboBoxEditor cellEditor = (JTableComboBoxEditor) getCellEditor(tableModel.getRowCount() - 1, getColumn(COLNAME_TRIGGER).getModelIndex()); @SuppressWarnings("unchecked") JComboBox<String> triggerEditorComboBox = (JComboBox<String>) cellEditor.getComponent(); triggerEditorComboBox.setName(NAME_COMBOBOX_TRIGGER_EDITOR + "_" + (tableModel.getRowCount() - 1)); tableModel.addRow(rowData); }
private void addAutomation(String imagePath, String type, int[] keyCodes, String trigger, String focusedProgram, long minDelay, long timeout, String midiSignature, float scanRate, boolean isMovable) { Vector<Object> rowData = new Vector<Object>(); rowData.add(getColumn(COLNAME_IMAGE).getModelIndex(), initScreenshotIcon(imagePath)); rowData.add(getColumn(COLNAME_TYPE).getModelIndex(), initType(type)); rowData.add(getColumn(COLNAME_KEYS).getModelIndex(), initKeys(keyCodes)); rowData.add(getColumn(COLNAME_TRIGGER).getModelIndex(), initTrigger(trigger)); rowData.add(getColumn(COLNAME_FOCUS).getModelIndex(), initFocusedProgram(focusedProgram)); rowData.add(getColumn(COLNAME_MIN_DELAY).getModelIndex(), minDelay); rowData.add(getColumn(COLNAME_TIMEOUT).getModelIndex(), timeout); rowData.add(getColumn(COLNAME_MIDI_SIGNATURE).getModelIndex(), initMidiMessage(midiSignature)); rowData.add(getColumn(COLNAME_SCAN_RATE).getModelIndex(), scanRate); rowData.add(getColumn(COLNAME_MOVABLE).getModelIndex(), isMovable); <DeepExtract> JTableComboBoxEditor cellEditor = (JTableComboBoxEditor) getCellEditor(tableModel.getRowCount() - 1, getColumn(COLNAME_TRIGGER).getModelIndex()); @SuppressWarnings("unchecked") JComboBox<String> triggerEditorComboBox = (JComboBox<String>) cellEditor.getComponent(); triggerEditorComboBox.setName(NAME_COMBOBOX_TRIGGER_EDITOR + "_" + (tableModel.getRowCount() - 1)); </DeepExtract> tableModel.addRow(rowData); }
MIDI-Automator
positive
4,097
@Override public void run(Context context) { Message message = null; String name = this.getEventName(context); URI source = getSource(context); URI target = this.getTarget(context); String sendId; if (this.idLocation != null) { String result = UUID.randomUUID().toString(); context.updateData(this.idLocation, result); } sendId = this.getId(context); Object body = this.getBody(context); message = new BasicMessage(sendId, name, source, target, body); return message; IOProcessor ioProcessor = context.searchIOProcessor(this.getType(context)); ioProcessor.sendMessageFromFSM(message); }
@Override public void run(Context context) { <DeepExtract> Message message = null; String name = this.getEventName(context); URI source = getSource(context); URI target = this.getTarget(context); String sendId; if (this.idLocation != null) { String result = UUID.randomUUID().toString(); context.updateData(this.idLocation, result); } sendId = this.getId(context); Object body = this.getBody(context); message = new BasicMessage(sendId, name, source, target, body); return message; </DeepExtract> IOProcessor ioProcessor = context.searchIOProcessor(this.getType(context)); ioProcessor.sendMessageFromFSM(message); }
scxml-java
positive
4,098
public static JoinRobustTree LineitemOnTpch19() { Random rand = new Random(); String stringLineitem = "l_orderkey long, l_partkey int, l_suppkey int, l_linenumber int, l_quantity double, l_extendedprice double, l_discount double, l_tax double, l_returnflag string, l_linestatus string, l_shipdate date, l_commitdate date, l_receiptdate date, l_shipinstruct string, l_shipmode string"; Schema schemaLineitem = Schema.createSchema(stringLineitem); String brand_19 = "Brand#" + (rand.nextInt(5) + 1) + "" + (rand.nextInt(5) + 1); String shipInstruct_19 = "DELIVER IN PERSON"; double quantity_19 = rand.nextInt(10) + 1; Predicate p1_19 = new Predicate(schemaLineitem.getAttributeId("l_shipinstruct"), TypeUtils.TYPE.STRING, shipInstruct_19, Predicate.PREDTYPE.EQ); Predicate p4_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TypeUtils.TYPE.DOUBLE, quantity_19, Predicate.PREDTYPE.GT); quantity_19 += 10; Predicate p5_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TypeUtils.TYPE.DOUBLE, quantity_19, Predicate.PREDTYPE.LEQ); Predicate p8_19 = new Predicate(schemaLineitem.getAttributeId("l_shipmode"), TypeUtils.TYPE.STRING, "AIR", Predicate.PREDTYPE.LEQ); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_partkey"), new Predicate[] { p1_19, p4_19, p5_19, p8_19 }); MDIndex.Bucket.maxBucketId = 0; TableInfo tableInfo = Globals.getTableInfo(lineitem); JoinRobustTree rt = new JoinRobustTree(tableInfo); rt.joinAttributeDepth = 0; rt.setMaxBuckets(lineitemBuckets); rt.loadSample(lineitemSample); rt.initProbe(q_l); return rt; }
public static JoinRobustTree LineitemOnTpch19() { Random rand = new Random(); String stringLineitem = "l_orderkey long, l_partkey int, l_suppkey int, l_linenumber int, l_quantity double, l_extendedprice double, l_discount double, l_tax double, l_returnflag string, l_linestatus string, l_shipdate date, l_commitdate date, l_receiptdate date, l_shipinstruct string, l_shipmode string"; Schema schemaLineitem = Schema.createSchema(stringLineitem); String brand_19 = "Brand#" + (rand.nextInt(5) + 1) + "" + (rand.nextInt(5) + 1); String shipInstruct_19 = "DELIVER IN PERSON"; double quantity_19 = rand.nextInt(10) + 1; Predicate p1_19 = new Predicate(schemaLineitem.getAttributeId("l_shipinstruct"), TypeUtils.TYPE.STRING, shipInstruct_19, Predicate.PREDTYPE.EQ); Predicate p4_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TypeUtils.TYPE.DOUBLE, quantity_19, Predicate.PREDTYPE.GT); quantity_19 += 10; Predicate p5_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TypeUtils.TYPE.DOUBLE, quantity_19, Predicate.PREDTYPE.LEQ); Predicate p8_19 = new Predicate(schemaLineitem.getAttributeId("l_shipmode"), TypeUtils.TYPE.STRING, "AIR", Predicate.PREDTYPE.LEQ); JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_partkey"), new Predicate[] { p1_19, p4_19, p5_19, p8_19 }); <DeepExtract> MDIndex.Bucket.maxBucketId = 0; TableInfo tableInfo = Globals.getTableInfo(lineitem); JoinRobustTree rt = new JoinRobustTree(tableInfo); rt.joinAttributeDepth = 0; rt.setMaxBuckets(lineitemBuckets); rt.loadSample(lineitemSample); rt.initProbe(q_l); return rt; </DeepExtract> }
AdaptDB
positive
4,099
private void updateState(boolean enabled) { if (enabled) { ILogViewEditor editor = (ILogViewEditor) getWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(ILogViewEditor.class); if (editor != null) { Integer selectedPage = (Integer) editor.getSelectedPage(); updateWidgets(true, selectedPage.intValue(), editor.getPageCount()); } else { enabled = false; } } if (!enabled) { updateWidgets(false, 0, 0); } boolean updated = false; for (ToolItem item : toolBar.getItems()) { if ((item.getControl() != null) && item.getControl().equals(root)) { int newWidth = computeWidth(root); if (item.getWidth() != newWidth) { item.setWidth(newWidth); updated = true; } break; } } if (updated) { for (CoolItem item : coolBar.getItems()) { if ((item.getControl() != null) && item.getControl().equals(toolBar)) { Point pt = item.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT); item.setSize(item.computeSize(pt.x, pt.y)); break; } } coolBar.update(); } }
private void updateState(boolean enabled) { if (enabled) { ILogViewEditor editor = (ILogViewEditor) getWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(ILogViewEditor.class); if (editor != null) { Integer selectedPage = (Integer) editor.getSelectedPage(); updateWidgets(true, selectedPage.intValue(), editor.getPageCount()); } else { enabled = false; } } if (!enabled) { updateWidgets(false, 0, 0); } <DeepExtract> boolean updated = false; for (ToolItem item : toolBar.getItems()) { if ((item.getControl() != null) && item.getControl().equals(root)) { int newWidth = computeWidth(root); if (item.getWidth() != newWidth) { item.setWidth(newWidth); updated = true; } break; } } if (updated) { for (CoolItem item : coolBar.getItems()) { if ((item.getControl() != null) && item.getControl().equals(toolBar)) { Point pt = item.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT); item.setSize(item.computeSize(pt.x, pt.y)); break; } } coolBar.update(); } </DeepExtract> }
logsaw-app
positive
4,100
@Override public byte[] createClosingMessage(ECKey receiverECKey, Address senderAddress, BigInteger openBlockNum, BigInteger owedBalance) { byte[] closingMsgHash = createClosingMsgHashRaw(senderAddress, openBlockNum, owedBalance, channelManagerAddr); return receiverECKey.sign(closingMsgHash).toByteArray(); }
@Override public byte[] createClosingMessage(ECKey receiverECKey, Address senderAddress, BigInteger openBlockNum, BigInteger owedBalance) { <DeepExtract> byte[] closingMsgHash = createClosingMsgHashRaw(senderAddress, openBlockNum, owedBalance, channelManagerAddr); return receiverECKey.sign(closingMsgHash).toByteArray(); </DeepExtract> }
asf-sdk
positive
4,101
public List<ParsingElement> load(boolean reload) { if (isLoaded() && !reload) { return getParsingElements(); } Map<String, Object> map = configLoader.readConfiguration(); if (map.containsKey(PARAMS)) { Object value = map.get(PARAMS); boolean isInstanceOfMap = value instanceof Map<?, ?>; if (isInstanceOfMap) { getParams().putAll((Map<String, Object>) value); } } MapWrapper mainMap = new MapWrapper(map, null); if (mainMap.isExist(EXTENDS)) { if (mainMap.isList(EXTENDS)) { List<Object> list = mainMap.toList(EXTENDS); for (Object row : list) { if (row == null) { continue; } String path = row.toString().trim(); extendsToExternalConfig(mainMap, path); } } else { String value = mainMap.toString(EXTENDS, true).trim(); extendsToExternalConfig(mainMap, value); } } mainMap.getField(RESULT, true); if (map.containsKey(PARAMS)) { Object value = map.get(PARAMS); boolean isInstanceOfMap = value instanceof Map<?, ?>; if (isInstanceOfMap) { getParams().putAll((Map<String, Object>) value); } } if (map.containsKey(FUNCTIONS)) { Object value = map.get(FUNCTIONS); boolean isInstanceOfMap = value instanceof Map<?, ?>; if (isInstanceOfMap) { functionContext.merge((Map<String, String>) value); } } if (map.containsKey(FRAGMENTS)) { MapUtils.mergeMap(getDefinitions(), (Map<String, Object>) map.get(FRAGMENTS)); } if (map.containsKey(TRANSFORMATIONS)) { Object value = map.get(TRANSFORMATIONS); boolean isInstanceOfMap = value instanceof Map<?, ?>; if (isInstanceOfMap) { fillTransformations((Map<String, Object>) value); } } if (map.containsKey(RESULT)) { Object value = map.get(RESULT); if (value instanceof Map) { buildParsingElementTree(value, RESULT, null, 0); } else if (value instanceof List) { int i = 0; List<Object> list = (List<Object>) value; for (Object o : list) { buildParsingElementTree(o, RESULT, null, i++); } } } isLoaded = true; return parsingElements; }
public List<ParsingElement> load(boolean reload) { if (isLoaded() && !reload) { return getParsingElements(); } Map<String, Object> map = configLoader.readConfiguration(); if (map.containsKey(PARAMS)) { Object value = map.get(PARAMS); boolean isInstanceOfMap = value instanceof Map<?, ?>; if (isInstanceOfMap) { getParams().putAll((Map<String, Object>) value); } } MapWrapper mainMap = new MapWrapper(map, null); if (mainMap.isExist(EXTENDS)) { if (mainMap.isList(EXTENDS)) { List<Object> list = mainMap.toList(EXTENDS); for (Object row : list) { if (row == null) { continue; } String path = row.toString().trim(); extendsToExternalConfig(mainMap, path); } } else { String value = mainMap.toString(EXTENDS, true).trim(); extendsToExternalConfig(mainMap, value); } } mainMap.getField(RESULT, true); if (map.containsKey(PARAMS)) { Object value = map.get(PARAMS); boolean isInstanceOfMap = value instanceof Map<?, ?>; if (isInstanceOfMap) { getParams().putAll((Map<String, Object>) value); } } if (map.containsKey(FUNCTIONS)) { Object value = map.get(FUNCTIONS); boolean isInstanceOfMap = value instanceof Map<?, ?>; if (isInstanceOfMap) { functionContext.merge((Map<String, String>) value); } } if (map.containsKey(FRAGMENTS)) { MapUtils.mergeMap(getDefinitions(), (Map<String, Object>) map.get(FRAGMENTS)); } if (map.containsKey(TRANSFORMATIONS)) { Object value = map.get(TRANSFORMATIONS); boolean isInstanceOfMap = value instanceof Map<?, ?>; if (isInstanceOfMap) { fillTransformations((Map<String, Object>) value); } } if (map.containsKey(RESULT)) { Object value = map.get(RESULT); if (value instanceof Map) { buildParsingElementTree(value, RESULT, null, 0); } else if (value instanceof List) { int i = 0; List<Object> list = (List<Object>) value; for (Object o : list) { buildParsingElementTree(o, RESULT, null, i++); } } } isLoaded = true; <DeepExtract> return parsingElements; </DeepExtract> }
dsm
positive
4,102
@Override public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { }
@Override <DeepExtract> </DeepExtract> public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { <DeepExtract> </DeepExtract> }
WuppyMods
positive
4,103
public final void destroy() { mIsInitialized = false; GLES20.glDeleteProgram(mGLProgId); }
public final void destroy() { <DeepExtract> </DeepExtract> mIsInitialized = false; <DeepExtract> </DeepExtract> GLES20.glDeleteProgram(mGLProgId); <DeepExtract> </DeepExtract> }
PhotoEditDemo
positive
4,104
@Test public void testTextChange_onIncorrectInsertion() { textChangeListener.onTextChanged("1--3--", anyInt, anyInt, anyInt); final InOrder inOrder = inOrder(editText); inOrder.verify(editText).removeTextChangedListener(textChangeListener); inOrder.verify(editText).setText("13----"); inOrder.verify(editText).setSelection(2); inOrder.verify(editText).addTextChangedListener(textChangeListener); if (false) { verify(contentChangeCallback).whileComplete(); } else { verify(contentChangeCallback).whileIncomplete(); } }
@Test public void testTextChange_onIncorrectInsertion() { textChangeListener.onTextChanged("1--3--", anyInt, anyInt, anyInt); <DeepExtract> final InOrder inOrder = inOrder(editText); inOrder.verify(editText).removeTextChangedListener(textChangeListener); inOrder.verify(editText).setText("13----"); inOrder.verify(editText).setSelection(2); inOrder.verify(editText).addTextChangedListener(textChangeListener); if (false) { verify(contentChangeCallback).whileComplete(); } else { verify(contentChangeCallback).whileIncomplete(); } </DeepExtract> }
def-guide-to-firebase
positive
4,105
private void testInitialSetup() { System.out.println("running testInitialSetup()"); selectTab(0); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.All.getTagName())); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.All.getTagName()))); selectTab(1); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.NotGrouped.getTagName())); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.Archive.getTagName()))); selectTab(5); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.Archive.getTagName())); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.Archive.getTagName()))); selectTab(2); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test1")); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test1"))); selectTab(3); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test2")); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test2"))); selectTab(4); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test3")); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test3"))); }
private void testInitialSetup() { System.out.println("running testInitialSetup()"); selectTab(0); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.All.getTagName())); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.All.getTagName()))); selectTab(1); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.NotGrouped.getTagName())); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.Archive.getTagName()))); selectTab(5); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.Archive.getTagName())); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.Archive.getTagName()))); selectTab(2); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test1")); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test1"))); selectTab(3); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test2")); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test2"))); <DeepExtract> selectTab(4); assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test3")); assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test3"))); </DeepExtract> }
ownNoteEditor
positive
4,106
public static void varIntList(long[] values, ByteBuffer buffer) { varInt(values.length, buffer, null); for (long value : values) { varInt(value, buffer); } }
public static void varIntList(long[] values, ByteBuffer buffer) { <DeepExtract> varInt(values.length, buffer, null); </DeepExtract> for (long value : values) { varInt(value, buffer); } }
Jabit
positive
4,107
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int widthMode = MeasureSpec.getMode(widthMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int width = widthMode == MeasureSpec.EXACTLY ? widthSize : getSuggestedMinimumWidth(); if (!showLabels) return; int twoDp = getContext().getResources().getDimensionPixelSize(R.dimen.stpi_two_dp); int gridWidth = width / stepCount - twoDp; if (gridWidth <= 0) return; labelLayouts = new StaticLayout[labels.length]; maxLabelHeight = 0F; float labelSingleLineHeight = labelPaint.descent() - labelPaint.ascent(); for (int i = 0; i < labels.length; i++) { if (labels[i] == null) continue; labelLayouts[i] = new StaticLayout(labels[i], labelPaint, gridWidth, Layout.Alignment.ALIGN_NORMAL, 1, 0, false); maxLabelHeight = Math.max(maxLabelHeight, labelLayouts[i].getLineCount() * labelSingleLineHeight); } int desiredHeight = (int) Math.ceil((circleRadius * EXPAND_MARK * 2) + circlePaint.getStrokeWidth() + getBottomIndicatorHeight() + getMaxLabelHeight()); int heightMode = MeasureSpec.getMode(heightMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); int height = heightMode == MeasureSpec.EXACTLY ? heightSize : desiredHeight; setMeasuredDimension(width, height); }
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int widthMode = MeasureSpec.getMode(widthMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int width = widthMode == MeasureSpec.EXACTLY ? widthSize : getSuggestedMinimumWidth(); <DeepExtract> if (!showLabels) return; int twoDp = getContext().getResources().getDimensionPixelSize(R.dimen.stpi_two_dp); int gridWidth = width / stepCount - twoDp; if (gridWidth <= 0) return; labelLayouts = new StaticLayout[labels.length]; maxLabelHeight = 0F; float labelSingleLineHeight = labelPaint.descent() - labelPaint.ascent(); for (int i = 0; i < labels.length; i++) { if (labels[i] == null) continue; labelLayouts[i] = new StaticLayout(labels[i], labelPaint, gridWidth, Layout.Alignment.ALIGN_NORMAL, 1, 0, false); maxLabelHeight = Math.max(maxLabelHeight, labelLayouts[i].getLineCount() * labelSingleLineHeight); } </DeepExtract> int desiredHeight = (int) Math.ceil((circleRadius * EXPAND_MARK * 2) + circlePaint.getStrokeWidth() + getBottomIndicatorHeight() + getMaxLabelHeight()); int heightMode = MeasureSpec.getMode(heightMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); int height = heightMode == MeasureSpec.EXACTLY ? heightSize : desiredHeight; setMeasuredDimension(width, height); }
Android-Example
positive
4,108
static Optional<ModuleSourceLayout> lookupForJdkLayout(Path root) { Objects.requireNonNull(root); if (!exists(root) || !exists(root.resolve("src"))) { return Optional.empty(); } return Objects.requireNonNull(JDK_LAYOUT); }
static Optional<ModuleSourceLayout> lookupForJdkLayout(Path root) { Objects.requireNonNull(root); if (!exists(root) || !exists(root.resolve("src"))) { return Optional.empty(); } <DeepExtract> return Objects.requireNonNull(JDK_LAYOUT); </DeepExtract> }
pro
positive
4,109
@Override public Matrix subi(final Matrix matrix) { if (!(matrix instanceof MatrixJBLASImpl)) { throw new IllegalArgumentException("The given matrix should be JBLAS based"); } jblasMatrix.subi(((MatrixJBLASImpl) matrix).jblasMatrix); return this; }
@Override public Matrix subi(final Matrix matrix) { <DeepExtract> if (!(matrix instanceof MatrixJBLASImpl)) { throw new IllegalArgumentException("The given matrix should be JBLAS based"); } </DeepExtract> jblasMatrix.subi(((MatrixJBLASImpl) matrix).jblasMatrix); return this; }
dolphin
positive
4,110
public void goToChapter() { getReflowChapterScreen().setTask(getGoToChapterTask()); Display display = getDisplay(); if (null == null) { display.setCurrent(getReflowChapterScreen()); } else { display.setCurrent(null, getReflowChapterScreen()); } }
public void goToChapter() { getReflowChapterScreen().setTask(getGoToChapterTask()); <DeepExtract> Display display = getDisplay(); if (null == null) { display.setCurrent(getReflowChapterScreen()); } else { display.setCurrent(null, getReflowChapterScreen()); } </DeepExtract> }
AlbiteREADER
positive
4,111
public static int runPipeline(String tablename, String deviceID, String friendlyName) throws Exception { Job job = SKJobFactory.createJob(deviceID, friendlyName, JobNames.TIKA_TEXT_EXTRACTION); job.setJarByClass(FSEntryTikaTextExtractor.class); job.setMapperClass(TikaTextExtractorMapper.class); job.setNumReduceTasks(0); job.setOutputKeyClass(ImmutableHexWritable.class); job.setOutputValueClass(FsEntry.class); job.setInputFormatClass(FsEntryHBaseInputFormat.class); job.setOutputFormatClass(FsEntryHBaseOutputFormat.class); FsEntryHBaseInputFormat.setupJob(job, deviceID); System.out.println("Spinning off TextExtraction Job..."); job.waitForCompletion(true); return 0; }
public static int runPipeline(String tablename, String deviceID, String friendlyName) throws Exception { <DeepExtract> Job job = SKJobFactory.createJob(deviceID, friendlyName, JobNames.TIKA_TEXT_EXTRACTION); job.setJarByClass(FSEntryTikaTextExtractor.class); job.setMapperClass(TikaTextExtractorMapper.class); job.setNumReduceTasks(0); job.setOutputKeyClass(ImmutableHexWritable.class); job.setOutputValueClass(FsEntry.class); job.setInputFormatClass(FsEntryHBaseInputFormat.class); job.setOutputFormatClass(FsEntryHBaseOutputFormat.class); FsEntryHBaseInputFormat.setupJob(job, deviceID); System.out.println("Spinning off TextExtraction Job..."); job.waitForCompletion(true); </DeepExtract> return 0; }
sleuthkit-hadoop
positive
4,112
@Override public void onSuccess(PeriodSolution result) { solution.setKey(result.getKey()); solution.setModified(result.getModified()); solution.setModifiedPretty(result.getModifiedPretty()); PeriodSolution[] array = ctx.getState().getPeriodSolutions(); if (array != null) { if (ctx.getState().getPeriodSolution(solution.getKey()) == null) { List<PeriodSolution> list = new ArrayList<PeriodSolution>(); for (PeriodSolution s : array) list.add(s); list.add(solution); PeriodSolution[] newArray = list.toArray(new PeriodSolution[list.size()]); ctx.getState().setPeriodSolutions(newArray); } else { deleteOrUpdatePeriodSolution(solution, false); ctx.getMenu().setPeriodSolutionsCount(ctx.getState().getPeriodSolutions().length); return; } } ctx.getSolutionsTable().refresh(ctx.getState().getPeriodSolutions()); ctx.getMenu().setPeriodSolutionsCount(ctx.getState().getPeriodSolutions().length); hideAllContainers(); ctx.getPageTitlePanel().setHTML(i18n.solutions()); RootPanel.get(CONTAINER_SOLUTION_TABLE).setVisible(true); }
@Override public void onSuccess(PeriodSolution result) { solution.setKey(result.getKey()); solution.setModified(result.getModified()); solution.setModifiedPretty(result.getModifiedPretty()); PeriodSolution[] array = ctx.getState().getPeriodSolutions(); if (array != null) { if (ctx.getState().getPeriodSolution(solution.getKey()) == null) { List<PeriodSolution> list = new ArrayList<PeriodSolution>(); for (PeriodSolution s : array) list.add(s); list.add(solution); PeriodSolution[] newArray = list.toArray(new PeriodSolution[list.size()]); ctx.getState().setPeriodSolutions(newArray); } else { deleteOrUpdatePeriodSolution(solution, false); ctx.getMenu().setPeriodSolutionsCount(ctx.getState().getPeriodSolutions().length); return; } } ctx.getSolutionsTable().refresh(ctx.getState().getPeriodSolutions()); ctx.getMenu().setPeriodSolutionsCount(ctx.getState().getPeriodSolutions().length); <DeepExtract> hideAllContainers(); ctx.getPageTitlePanel().setHTML(i18n.solutions()); RootPanel.get(CONTAINER_SOLUTION_TABLE).setVisible(true); </DeepExtract> }
shifts-solver
positive
4,113
public PhaseStatistics getPhaseStatistics(TimeRange range) { if (range == null) { range = new TimeRange(getStartTime(), getEndTime()); } double start = Math.max(range.getStart(), getStartTime()); double end = Math.min(range.getEnd(), getEndTime()); return new TimeRange(start, end); List<GCEventType> parents = getParentEventTypes(); Map<String, DoubleData[]> parentData = new HashMap<>(); List<Map<String, DoubleData[]>> phaseData = new ArrayList<>(); List<Map<String, DoubleData[]>> causeData = new ArrayList<>(); for (int i = 0; i < parents.size(); i++) { phaseData.add(new HashMap<>()); causeData.add(new HashMap<>()); } int indexLow = binarySearchEventIndex(gcEvents, range.getStart(), true); int indexHigh = binarySearchEventIndex(gcEvents, range.getEnd(), false); for (int i = indexLow; i < indexHigh; i++) { event -> { int index = parents.indexOf(event.getEventType()); if (index < 0) { return; } putPhaseStatisticData(event, event.getEventType().getName(), parentData, true); if (event.getCause() != null) { putPhaseStatisticData(event, event.getCause().getName(), causeData.get(index), false); } event.phasesDoDFS(phase -> putPhaseStatisticData(phase, phase.getEventType().getName(), phaseData.get(index), true)); }.accept(gcEvents.get(i)); } List<ParentStatisticsInfo> result = new ArrayList<>(); for (int i = 0; i < parents.size(); i++) { String name = parents.get(i).getName(); if (parentData.containsKey(name)) { result.add(new ParentStatisticsInfo(makePhaseStatisticItem(parents.get(i).getName(), parentData.get(name)), phaseData.get(i).entrySet().stream().map(entry -> makePhaseStatisticItem(entry.getKey(), entry.getValue())).collect(Collectors.toList()), causeData.get(i).entrySet().stream().map(entry -> makePhaseStatisticItem(entry.getKey(), entry.getValue())).collect(Collectors.toList()))); } } return new PhaseStatistics(result); }
public PhaseStatistics getPhaseStatistics(TimeRange range) { if (range == null) { range = new TimeRange(getStartTime(), getEndTime()); } double start = Math.max(range.getStart(), getStartTime()); double end = Math.min(range.getEnd(), getEndTime()); return new TimeRange(start, end); List<GCEventType> parents = getParentEventTypes(); Map<String, DoubleData[]> parentData = new HashMap<>(); List<Map<String, DoubleData[]>> phaseData = new ArrayList<>(); List<Map<String, DoubleData[]>> causeData = new ArrayList<>(); for (int i = 0; i < parents.size(); i++) { phaseData.add(new HashMap<>()); causeData.add(new HashMap<>()); } <DeepExtract> int indexLow = binarySearchEventIndex(gcEvents, range.getStart(), true); int indexHigh = binarySearchEventIndex(gcEvents, range.getEnd(), false); for (int i = indexLow; i < indexHigh; i++) { event -> { int index = parents.indexOf(event.getEventType()); if (index < 0) { return; } putPhaseStatisticData(event, event.getEventType().getName(), parentData, true); if (event.getCause() != null) { putPhaseStatisticData(event, event.getCause().getName(), causeData.get(index), false); } event.phasesDoDFS(phase -> putPhaseStatisticData(phase, phase.getEventType().getName(), phaseData.get(index), true)); }.accept(gcEvents.get(i)); } </DeepExtract> List<ParentStatisticsInfo> result = new ArrayList<>(); for (int i = 0; i < parents.size(); i++) { String name = parents.get(i).getName(); if (parentData.containsKey(name)) { result.add(new ParentStatisticsInfo(makePhaseStatisticItem(parents.get(i).getName(), parentData.get(name)), phaseData.get(i).entrySet().stream().map(entry -> makePhaseStatisticItem(entry.getKey(), entry.getValue())).collect(Collectors.toList()), causeData.get(i).entrySet().stream().map(entry -> makePhaseStatisticItem(entry.getKey(), entry.getValue())).collect(Collectors.toList()))); } } return new PhaseStatistics(result); }
jifa
positive
4,114
public final void sendeeprom_sync_write(Short address, Byte value) { FixedSizePacket fsp = null; fsp = JArduinoProtocol.createEeprom_sync_write(address, value); if (fsp != null) { System.out.println(fsp + " --> " + fsp.getPacket()); for (JArduinoClientObserver h : handlers) { h.receiveMsg(fsp.getPacket()); } } else { System.out.println("Data is null"); } }
public final void sendeeprom_sync_write(Short address, Byte value) { FixedSizePacket fsp = null; fsp = JArduinoProtocol.createEeprom_sync_write(address, value); <DeepExtract> if (fsp != null) { System.out.println(fsp + " --> " + fsp.getPacket()); for (JArduinoClientObserver h : handlers) { h.receiveMsg(fsp.getPacket()); } } else { System.out.println("Data is null"); } </DeepExtract> }
JArduino
positive
4,115
@Test public void testCleanLockFromPrimary() throws IOException { ThemisLock from = getLock(COLUMN); writeLockAndData(COLUMN); if (false) { writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs); } else { writeData(SECONDARY_COLUMNS[0], prewriteTs); } for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) { writeLockAndData(SECONDARY_COLUMNS[i]); } lockCleaner.cleanLock(from); checkTransactionRollback(); deleteOldDataAndUpdateTs(); writePutAndData(COLUMN, prewriteTs, commitTs); if (true) { writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs); } else { writeData(SECONDARY_COLUMNS[0], prewriteTs); } for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) { writeLockAndData(SECONDARY_COLUMNS[i]); } from = getLock(COLUMN); lockCleaner.cleanLock(from); checkTransactionCommitSuccess(); deleteOldDataAndUpdateTs(); writeData(COLUMN, prewriteTs); if (false) { writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs); } else { writeData(SECONDARY_COLUMNS[0], prewriteTs); } for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) { writeLockAndData(SECONDARY_COLUMNS[i]); } from = getLock(COLUMN); lockCleaner.cleanLock(from); checkTransactionRollback(); }
@Test public void testCleanLockFromPrimary() throws IOException { ThemisLock from = getLock(COLUMN); writeLockAndData(COLUMN); <DeepExtract> if (false) { writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs); } else { writeData(SECONDARY_COLUMNS[0], prewriteTs); } for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) { writeLockAndData(SECONDARY_COLUMNS[i]); } </DeepExtract> lockCleaner.cleanLock(from); checkTransactionRollback(); deleteOldDataAndUpdateTs(); writePutAndData(COLUMN, prewriteTs, commitTs); if (true) { writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs); } else { writeData(SECONDARY_COLUMNS[0], prewriteTs); } for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) { writeLockAndData(SECONDARY_COLUMNS[i]); } from = getLock(COLUMN); lockCleaner.cleanLock(from); checkTransactionCommitSuccess(); deleteOldDataAndUpdateTs(); writeData(COLUMN, prewriteTs); <DeepExtract> if (false) { writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs); } else { writeData(SECONDARY_COLUMNS[0], prewriteTs); } for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) { writeLockAndData(SECONDARY_COLUMNS[i]); } </DeepExtract> from = getLock(COLUMN); lockCleaner.cleanLock(from); checkTransactionRollback(); }
themis
positive
4,116
public void setByPassState(boolean b) { byPass = b; if (cbNotifyList != null && cbNotifyList.size() >= 1) { for (CircuitBreakerNotificationCallback notifyObject : cbNotifyList) { notifyObject.notify(getStatus()); } } }
public void setByPassState(boolean b) { byPass = b; <DeepExtract> if (cbNotifyList != null && cbNotifyList.size() >= 1) { for (CircuitBreakerNotificationCallback notifyObject : cbNotifyList) { notifyObject.notify(getStatus()); } } </DeepExtract> }
jrugged
positive
4,117
public Criteria andUploadTimeIn(List<String> values) { if (values == null) { throw new RuntimeException("Value for " + "uploadTime" + " cannot be null"); } criteria.add(new Criterion("upload_time in", values)); return (Criteria) this; }
public Criteria andUploadTimeIn(List<String> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "uploadTime" + " cannot be null"); } criteria.add(new Criterion("upload_time in", values)); </DeepExtract> return (Criteria) this; }
einvoice
positive
4,118
public void abort() throws IOException { if (started) { if (true) { Database.getLogFile().logAbort(tid); } Database.getBufferPool().transactionComplete(tid, !true); if (!true) { Database.getLogFile().logCommit(tid); } started = false; } }
public void abort() throws IOException { <DeepExtract> if (started) { if (true) { Database.getLogFile().logAbort(tid); } Database.getBufferPool().transactionComplete(tid, !true); if (!true) { Database.getLogFile().logCommit(tid); } started = false; } </DeepExtract> }
simple-db-hw-2021
positive
4,119
public static void invokeSub(Dispatch dispatchTarget, String name, int dispid, int lcid, int wFlags, Object[] oArg, int[] uArgErr) { if (dispatchTarget == null) { throw new IllegalArgumentException("Can't pass in null Dispatch object"); } else if (dispatchTarget.isAttached()) { return; } else { throw new IllegalStateException("Dispatch not hooked to windows memory"); } throwIfUnattachedDispatch(dispatchTarget); invokev(dispatchTarget, name, dispid, lcid, wFlags, VariantUtilities.objectsToVariants(oArg), uArgErr); }
public static void invokeSub(Dispatch dispatchTarget, String name, int dispid, int lcid, int wFlags, Object[] oArg, int[] uArgErr) { if (dispatchTarget == null) { throw new IllegalArgumentException("Can't pass in null Dispatch object"); } else if (dispatchTarget.isAttached()) { return; } else { throw new IllegalStateException("Dispatch not hooked to windows memory"); } <DeepExtract> throwIfUnattachedDispatch(dispatchTarget); invokev(dispatchTarget, name, dispid, lcid, wFlags, VariantUtilities.objectsToVariants(oArg), uArgErr); </DeepExtract> }
jacob
positive
4,120
public static String getDescriptor(final Class<?> clazz) { StringBuilder stringBuilder = new StringBuilder(); Class<?> currentClass = clazz; while (currentClass.isArray()) { stringBuilder.append('['); currentClass = currentClass.getComponentType(); } if (currentClass.isPrimitive()) { char descriptor; if (currentClass == Integer.TYPE) { descriptor = 'I'; } else if (currentClass == Void.TYPE) { descriptor = 'V'; } else if (currentClass == Boolean.TYPE) { descriptor = 'Z'; } else if (currentClass == Byte.TYPE) { descriptor = 'B'; } else if (currentClass == Character.TYPE) { descriptor = 'C'; } else if (currentClass == Short.TYPE) { descriptor = 'S'; } else if (currentClass == Double.TYPE) { descriptor = 'D'; } else if (currentClass == Float.TYPE) { descriptor = 'F'; } else if (currentClass == Long.TYPE) { descriptor = 'J'; } else { throw new AssertionError(); } stringBuilder.append(descriptor); } else { stringBuilder.append('L').append(getInternalName(currentClass)).append(';'); } return getDescriptor(); }
public static String getDescriptor(final Class<?> clazz) { StringBuilder stringBuilder = new StringBuilder(); Class<?> currentClass = clazz; while (currentClass.isArray()) { stringBuilder.append('['); currentClass = currentClass.getComponentType(); } if (currentClass.isPrimitive()) { char descriptor; if (currentClass == Integer.TYPE) { descriptor = 'I'; } else if (currentClass == Void.TYPE) { descriptor = 'V'; } else if (currentClass == Boolean.TYPE) { descriptor = 'Z'; } else if (currentClass == Byte.TYPE) { descriptor = 'B'; } else if (currentClass == Character.TYPE) { descriptor = 'C'; } else if (currentClass == Short.TYPE) { descriptor = 'S'; } else if (currentClass == Double.TYPE) { descriptor = 'D'; } else if (currentClass == Float.TYPE) { descriptor = 'F'; } else if (currentClass == Long.TYPE) { descriptor = 'J'; } else { throw new AssertionError(); } stringBuilder.append(descriptor); } else { stringBuilder.append('L').append(getInternalName(currentClass)).append(';'); } <DeepExtract> return getDescriptor(); </DeepExtract> }
jvm-tail-recursion
positive
4,121
@Override public DecisionResult evaluate(final DecisionRequest individualDecisionRequest) { if (!initialized) { final String cause; if (confLocation == null) { cause = "Missing parameter: configuration file"; } else if (extSchemaLocation == null) { cause = "Missing parameter: extension schema file"; } else if (catalogLocation == null) { cause = "Missing parameter: XML catalog file"; } else { cause = "Check previous errors."; } throw new RuntimeException("PDP not initialized: " + cause); } return pdp.evaluate(individualDecisionRequest); }
@Override public DecisionResult evaluate(final DecisionRequest individualDecisionRequest) { <DeepExtract> if (!initialized) { final String cause; if (confLocation == null) { cause = "Missing parameter: configuration file"; } else if (extSchemaLocation == null) { cause = "Missing parameter: extension schema file"; } else if (catalogLocation == null) { cause = "Missing parameter: XML catalog file"; } else { cause = "Check previous errors."; } throw new RuntimeException("PDP not initialized: " + cause); } </DeepExtract> return pdp.evaluate(individualDecisionRequest); }
core
positive
4,122
public List<Favorite> getFavoriteListFileNotUploaded() { adapter.open(); List<Favorite> mainlist = new ArrayList<Favorite>(); Favorite listFavorite; if (adapter.getFavoriteDataFileNotUploaded().getCount() >= 1) { adapter.getFavoriteDataFileNotUploaded().moveToFirst(); do { listFavorite = new Favorite(); listFavorite.amount = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_AMOUNT)); listFavorite.id = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_ID)); listFavorite.description = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_TAG)); listFavorite.type = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_TYPE)); listFavorite.location = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_LOCATION)); listFavorite.myHash = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_MY_HASH)); listFavorite.updatedAt = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_UPDATED_AT)); listFavorite.deleted = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_DELETE_BIT)) > 0; listFavorite.idFromServer = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_ID_FROM_SERVER)); listFavorite.fileUploaded = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_UPLOADED)) > 0; listFavorite.fileToDownload = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_TO_DOWNLOAD)) > 0; listFavorite.syncBit = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_SYNC_BIT)); listFavorite.fileUpdatedAt = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_UPDATED_AT)); if (listFavorite.description == null || listFavorite.description.equals("")) { if (listFavorite.type.equals(context.getString(R.string.text))) { listFavorite.description = context.getString(R.string.finished_textentry); } else if (listFavorite.type.equals(context.getString(R.string.voice))) { listFavorite.description = context.getString(R.string.finished_voiceentry); } else if (listFavorite.type.equals(context.getString(R.string.camera))) { listFavorite.description = context.getString(R.string.finished_cameraentry); } } mainlist.add(listFavorite); adapter.getFavoriteDataFileNotUploaded().moveToNext(); } while (!adapter.getFavoriteDataFileNotUploaded().isAfterLast()); } adapter.getFavoriteDataFileNotUploaded().close(); adapter.close(); return mainlist; }
public List<Favorite> getFavoriteListFileNotUploaded() { adapter.open(); <DeepExtract> List<Favorite> mainlist = new ArrayList<Favorite>(); Favorite listFavorite; if (adapter.getFavoriteDataFileNotUploaded().getCount() >= 1) { adapter.getFavoriteDataFileNotUploaded().moveToFirst(); do { listFavorite = new Favorite(); listFavorite.amount = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_AMOUNT)); listFavorite.id = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_ID)); listFavorite.description = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_TAG)); listFavorite.type = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_TYPE)); listFavorite.location = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_LOCATION)); listFavorite.myHash = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_MY_HASH)); listFavorite.updatedAt = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_UPDATED_AT)); listFavorite.deleted = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_DELETE_BIT)) > 0; listFavorite.idFromServer = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_ID_FROM_SERVER)); listFavorite.fileUploaded = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_UPLOADED)) > 0; listFavorite.fileToDownload = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_TO_DOWNLOAD)) > 0; listFavorite.syncBit = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_SYNC_BIT)); listFavorite.fileUpdatedAt = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_UPDATED_AT)); if (listFavorite.description == null || listFavorite.description.equals("")) { if (listFavorite.type.equals(context.getString(R.string.text))) { listFavorite.description = context.getString(R.string.finished_textentry); } else if (listFavorite.type.equals(context.getString(R.string.voice))) { listFavorite.description = context.getString(R.string.finished_voiceentry); } else if (listFavorite.type.equals(context.getString(R.string.camera))) { listFavorite.description = context.getString(R.string.finished_cameraentry); } } mainlist.add(listFavorite); adapter.getFavoriteDataFileNotUploaded().moveToNext(); } while (!adapter.getFavoriteDataFileNotUploaded().isAfterLast()); } adapter.getFavoriteDataFileNotUploaded().close(); adapter.close(); return mainlist; </DeepExtract> }
expense-tracker
positive
4,123
public void stateChanged(javax.swing.event.ChangeEvent evt) { megacrypter_reverse_port_label.setEnabled(megacrypter_reverse_checkbox.isSelected()); megacrypter_reverse_port_spinner.setEnabled(megacrypter_reverse_checkbox.isSelected()); megacrypter_reverse_warning_label.setEnabled(megacrypter_reverse_checkbox.isSelected()); }
public void stateChanged(javax.swing.event.ChangeEvent evt) { <DeepExtract> megacrypter_reverse_port_label.setEnabled(megacrypter_reverse_checkbox.isSelected()); megacrypter_reverse_port_spinner.setEnabled(megacrypter_reverse_checkbox.isSelected()); megacrypter_reverse_warning_label.setEnabled(megacrypter_reverse_checkbox.isSelected()); </DeepExtract> }
megabasterd
positive
4,124
@Test public void commaSeparated() throws Exception { String expected = "?myParam=foo,bar,baz"; StringClient client = builder().queryParamStyle(QueryParamStyle.COMMA_SEPARATED).build(StringClient.class); String responseStr = client.multiValues(Arrays.asList("foo", "bar", "baz")); assertNotNull(responseStr, "Response entity is null"); assertTrue(responseStr.contains(expected), "Expected snippet, " + expected + ", in: " + responseStr); }
@Test public void commaSeparated() throws Exception { String expected = "?myParam=foo,bar,baz"; StringClient client = builder().queryParamStyle(QueryParamStyle.COMMA_SEPARATED).build(StringClient.class); <DeepExtract> String responseStr = client.multiValues(Arrays.asList("foo", "bar", "baz")); assertNotNull(responseStr, "Response entity is null"); assertTrue(responseStr.contains(expected), "Expected snippet, " + expected + ", in: " + responseStr); </DeepExtract> }
microprofile-rest-client
positive
4,125
@Override public boolean newSession(ICustomTabsCallback callback) { final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback, null); try { DeathRecipient deathRecipient = () -> cleanUpSession(sessionToken); synchronized (mDeathRecipientMap) { callback.asBinder().linkToDeath(deathRecipient, 0); mDeathRecipientMap.put(callback.asBinder(), deathRecipient); } return CustomTabsService.this.newSession(sessionToken); } catch (RemoteException e) { return false; } }
@Override public boolean newSession(ICustomTabsCallback callback) { <DeepExtract> final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback, null); try { DeathRecipient deathRecipient = () -> cleanUpSession(sessionToken); synchronized (mDeathRecipientMap) { callback.asBinder().linkToDeath(deathRecipient, 0); mDeathRecipientMap.put(callback.asBinder(), deathRecipient); } return CustomTabsService.this.newSession(sessionToken); } catch (RemoteException e) { return false; } </DeepExtract> }
custom-tabs-client
positive
4,126
@Test public void testValidationServiceCounter() { LOG.info("ValidationServiceTest.testValidationServiceCounter() called"); configuration.put(Applier.Configuration.TYPE, "HBASE"); configuration.put(ValidationService.Configuration.VALIDATION_BROKER, "localhost:9092"); configuration.put(ValidationService.Configuration.VALIDATION_THROTTLE_ONE_EVERY, "2"); configuration.put(ValidationService.Configuration.VALIDATION_TOPIC, "replicator_validation"); configuration.put(ValidationService.Configuration.VALIDATION_TAG, "test_hbase"); configuration.put(ValidationService.Configuration.VALIDATION_SOURCE_DATA_SOURCE, "av1msql"); configuration.put(ValidationService.Configuration.VALIDATION_TARGET_DATA_SOURCE, "avbigtable"); configuration.put(Applier.Configuration.TYPE, "HBASE"); ValidationService validationService = ValidationService.getInstance(configuration); Assert.assertNotNull(validationService); DataSource dummy = new DataSource("constant", new ConstantQueryOptions(Types.CONSTANT.getValue(), new HashMap<String, Object>() { { put("a", 1); } }, null)); for (int i = 0; i < 10; i++) { validationService.registerValidationTask("sample-id-" + i, dummy, dummy); } Assert.assertEquals(10L, validationService.getValidationTaskCounter()); }
@Test public void testValidationServiceCounter() { LOG.info("ValidationServiceTest.testValidationServiceCounter() called"); <DeepExtract> configuration.put(Applier.Configuration.TYPE, "HBASE"); configuration.put(ValidationService.Configuration.VALIDATION_BROKER, "localhost:9092"); configuration.put(ValidationService.Configuration.VALIDATION_THROTTLE_ONE_EVERY, "2"); configuration.put(ValidationService.Configuration.VALIDATION_TOPIC, "replicator_validation"); configuration.put(ValidationService.Configuration.VALIDATION_TAG, "test_hbase"); configuration.put(ValidationService.Configuration.VALIDATION_SOURCE_DATA_SOURCE, "av1msql"); configuration.put(ValidationService.Configuration.VALIDATION_TARGET_DATA_SOURCE, "avbigtable"); </DeepExtract> configuration.put(Applier.Configuration.TYPE, "HBASE"); ValidationService validationService = ValidationService.getInstance(configuration); Assert.assertNotNull(validationService); DataSource dummy = new DataSource("constant", new ConstantQueryOptions(Types.CONSTANT.getValue(), new HashMap<String, Object>() { { put("a", 1); } }, null)); for (int i = 0; i < 10; i++) { validationService.registerValidationTask("sample-id-" + i, dummy, dummy); } Assert.assertEquals(10L, validationService.getValidationTaskCounter()); }
replicator
positive
4,127
public static int countSteps(int k) { HashSet<Point> hset = new HashSet<>(); int len = 0; len += countSum(0); len += countSum(0); if (len > k) { return; } hset.add(new Point(0, 0)); for (int i = 0; i < dir.length; i++) { int xVal = 0 + dir[i][0]; int yVal = 0 + dir[i][1]; if (!hset.contains(new Point(xVal, yVal))) { dfs(hset, xVal, yVal, k); } } return hset.size(); }
public static int countSteps(int k) { HashSet<Point> hset = new HashSet<>(); <DeepExtract> int len = 0; len += countSum(0); len += countSum(0); if (len > k) { return; } hset.add(new Point(0, 0)); for (int i = 0; i < dir.length; i++) { int xVal = 0 + dir[i][0]; int yVal = 0 + dir[i][1]; if (!hset.contains(new Point(xVal, yVal))) { dfs(hset, xVal, yVal, k); } } </DeepExtract> return hset.size(); }
leetCodeInterview
positive
4,128
public FeatureFrequency increment(Feature feature) { FeatureFrequency freq = null; if (containsFeature(feature)) { freq = get(feature); freq.frequency += 1; } return freq; }
public FeatureFrequency increment(Feature feature) { <DeepExtract> FeatureFrequency freq = null; if (containsFeature(feature)) { freq = get(feature); freq.frequency += 1; } return freq; </DeepExtract> }
ensemble-clustering
positive
4,129
public void setAdapter(TvBaseAdapter adapter) { this.adapter = adapter; if (adapter != null) { adapter.registerDataSetObservable(mDataSetObservable); } itemIds.clear(); this.removeAllViews(); this.clearDisappearingChildren(); this.destroyDrawingCache(); focusIsOut = true; mScroller.setFinalY(0); parentLayout = false; currentChildCount = 0; if (isInit) { initGridView(); isInit = false; } Message msg = handler.obtainMessage(); msg.what = ACTION_INIT_ITEMS; handler.sendMessageDelayed(msg, DELAY); }
public void setAdapter(TvBaseAdapter adapter) { this.adapter = adapter; if (adapter != null) { adapter.registerDataSetObservable(mDataSetObservable); } <DeepExtract> itemIds.clear(); this.removeAllViews(); this.clearDisappearingChildren(); this.destroyDrawingCache(); focusIsOut = true; mScroller.setFinalY(0); parentLayout = false; currentChildCount = 0; </DeepExtract> if (isInit) { initGridView(); isInit = false; } Message msg = handler.obtainMessage(); msg.what = ACTION_INIT_ITEMS; handler.sendMessageDelayed(msg, DELAY); }
tvframe
positive
4,130
public void setPendingAccAmount(BigDecimal deltaAccEth, BigDecimal deltaAccErc20) { log.info("Set pending [{}, {}]", deltaAccEth, deltaAccErc20); this.pendingAccEth = deltaAccEth; this.pendingAccErc20 = deltaAccErc20; }
public void setPendingAccAmount(BigDecimal deltaAccEth, BigDecimal deltaAccErc20) { log.info("Set pending [{}, {}]", deltaAccEth, deltaAccErc20); this.pendingAccEth = deltaAccEth; <DeepExtract> this.pendingAccErc20 = deltaAccErc20; </DeepExtract> }
CoFiX-hedger
positive
4,131
@java.lang.Override public cc.vector_tile.VectorTile.Tile.GeomType getType() { cc.vector_tile.VectorTile.Tile.GeomType result; switch(type_) { case 0: result = UNKNOWN; case 1: result = POINT; case 2: result = LINESTRING; case 3: result = POLYGON; default: result = null; } return result == null ? cc.vector_tile.VectorTile.Tile.GeomType.UNKNOWN : result; }
@java.lang.Override public cc.vector_tile.VectorTile.Tile.GeomType getType() { <DeepExtract> cc.vector_tile.VectorTile.Tile.GeomType result; switch(type_) { case 0: result = UNKNOWN; case 1: result = POINT; case 2: result = LINESTRING; case 3: result = POLYGON; default: result = null; } </DeepExtract> return result == null ? cc.vector_tile.VectorTile.Tile.GeomType.UNKNOWN : result; }
carma-cloud
positive
4,132
public static boolean clear() { checkValid(); return mUtil.clear(); }
public static boolean clear() { <DeepExtract> checkValid(); return mUtil.clear(); </DeepExtract> }
PureNote
positive
4,133
public void actionPerformed(ActionEvent evt) { rotationAngle += rotAngleDelta; if (rotationAngle > 2 * Math.PI) rotationAngle -= 2 * Math.PI; diagram.setRotationAngle(rotationAngle); diagram.project2d(rotationAngle); repaint(); }
public void actionPerformed(ActionEvent evt) { <DeepExtract> rotationAngle += rotAngleDelta; if (rotationAngle > 2 * Math.PI) rotationAngle -= 2 * Math.PI; diagram.setRotationAngle(rotationAngle); diagram.project2d(rotationAngle); repaint(); </DeepExtract> }
conexp-clj
positive
4,134
@Override public void onShow(DialogInterface dialog) { super.onShow(dialog); if (numberOfActionButtons() <= 1) { return; } else if (mBuilder.forceStacking) { isStacked = true; invalidateActions(); return; } isStacked = false; int buttonsWidth = 0; positiveButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); neutralButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); negativeButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); if (mBuilder.positiveText != null) buttonsWidth += positiveButton.getMeasuredWidth(); if (mBuilder.neutralText != null) buttonsWidth += neutralButton.getMeasuredWidth(); if (mBuilder.negativeText != null) buttonsWidth += negativeButton.getMeasuredWidth(); final int buttonFrameWidth = view.findViewById(R.id.buttonDefaultFrame).getWidth(); isStacked = buttonsWidth > buttonFrameWidth; invalidateActions(); if (view.getMeasuredWidth() == 0) { return; } View contentScrollView = view.findViewById(R.id.contentScrollView); final int contentHorizontalPadding = (int) mBuilder.context.getResources().getDimension(R.dimen.md_dialog_frame_margin); content.setPadding(contentHorizontalPadding, 0, contentHorizontalPadding, 0); if (mBuilder.customView != null) { contentScrollView.setVisibility(View.GONE); customViewFrame.setVisibility(View.VISIBLE); boolean topScroll = canViewOrChildScroll(customViewFrame.getChildAt(0), false); boolean bottomScroll = canViewOrChildScroll(customViewFrame.getChildAt(0), true); setDividerVisibility(topScroll, bottomScroll); } else if ((mBuilder.items != null && mBuilder.items.length > 0) || mBuilder.adapter != null) { contentScrollView.setVisibility(View.GONE); boolean canScroll = titleFrame.getVisibility() == View.VISIBLE && canListViewScroll(); setDividerVisibility(canScroll, canScroll); } else { contentScrollView.setVisibility(View.VISIBLE); boolean canScroll = canContentScroll(); if (canScroll) { final int contentVerticalPadding = (int) mBuilder.context.getResources().getDimension(R.dimen.md_title_frame_margin_bottom); content.setPadding(contentHorizontalPadding, contentVerticalPadding, contentHorizontalPadding, contentVerticalPadding); final int titlePaddingBottom = (int) mBuilder.context.getResources().getDimension(R.dimen.md_title_frame_margin_bottom_list); titleFrame.setPadding(titleFrame.getPaddingLeft(), titleFrame.getPaddingTop(), titleFrame.getPaddingRight(), titlePaddingBottom); } setDividerVisibility(canScroll, canScroll); } }
@Override public void onShow(DialogInterface dialog) { super.onShow(dialog); if (numberOfActionButtons() <= 1) { return; } else if (mBuilder.forceStacking) { isStacked = true; invalidateActions(); return; } isStacked = false; int buttonsWidth = 0; positiveButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); neutralButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); negativeButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); if (mBuilder.positiveText != null) buttonsWidth += positiveButton.getMeasuredWidth(); if (mBuilder.neutralText != null) buttonsWidth += neutralButton.getMeasuredWidth(); if (mBuilder.negativeText != null) buttonsWidth += negativeButton.getMeasuredWidth(); final int buttonFrameWidth = view.findViewById(R.id.buttonDefaultFrame).getWidth(); isStacked = buttonsWidth > buttonFrameWidth; invalidateActions(); <DeepExtract> if (view.getMeasuredWidth() == 0) { return; } View contentScrollView = view.findViewById(R.id.contentScrollView); final int contentHorizontalPadding = (int) mBuilder.context.getResources().getDimension(R.dimen.md_dialog_frame_margin); content.setPadding(contentHorizontalPadding, 0, contentHorizontalPadding, 0); if (mBuilder.customView != null) { contentScrollView.setVisibility(View.GONE); customViewFrame.setVisibility(View.VISIBLE); boolean topScroll = canViewOrChildScroll(customViewFrame.getChildAt(0), false); boolean bottomScroll = canViewOrChildScroll(customViewFrame.getChildAt(0), true); setDividerVisibility(topScroll, bottomScroll); } else if ((mBuilder.items != null && mBuilder.items.length > 0) || mBuilder.adapter != null) { contentScrollView.setVisibility(View.GONE); boolean canScroll = titleFrame.getVisibility() == View.VISIBLE && canListViewScroll(); setDividerVisibility(canScroll, canScroll); } else { contentScrollView.setVisibility(View.VISIBLE); boolean canScroll = canContentScroll(); if (canScroll) { final int contentVerticalPadding = (int) mBuilder.context.getResources().getDimension(R.dimen.md_title_frame_margin_bottom); content.setPadding(contentHorizontalPadding, contentVerticalPadding, contentHorizontalPadding, contentVerticalPadding); final int titlePaddingBottom = (int) mBuilder.context.getResources().getDimension(R.dimen.md_title_frame_margin_bottom_list); titleFrame.setPadding(titleFrame.getPaddingLeft(), titleFrame.getPaddingTop(), titleFrame.getPaddingRight(), titlePaddingBottom); } setDividerVisibility(canScroll, canScroll); } </DeepExtract> }
File_Quest
positive
4,135
public void surfaceDestroyed(SurfaceHolder holder) { Log.d(TAG, "surfaceDestroyed"); Log.d(TAG, "stopVideoRecording"); if (mediaRecorderRecording || mediaRecorder != null) { try { videoPacketizer.stopStreaming(); if (mediaRecorderRecording && mediaRecorder != null) { try { mediaRecorder.setOnErrorListener(null); mediaRecorder.setOnInfoListener(null); mediaRecorder.stop(); } catch (RuntimeException e) { Log.e(TAG, "stop fail: " + e.getMessage()); } mediaRecorderRecording = false; } } catch (Exception e) { Log.e(TAG, "stopVideoRecording failed"); e.printStackTrace(); } finally { releaseMediaRecorder(); } } }
public void surfaceDestroyed(SurfaceHolder holder) { Log.d(TAG, "surfaceDestroyed"); <DeepExtract> Log.d(TAG, "stopVideoRecording"); if (mediaRecorderRecording || mediaRecorder != null) { try { videoPacketizer.stopStreaming(); if (mediaRecorderRecording && mediaRecorder != null) { try { mediaRecorder.setOnErrorListener(null); mediaRecorder.setOnInfoListener(null); mediaRecorder.stop(); } catch (RuntimeException e) { Log.e(TAG, "stop fail: " + e.getMessage()); } mediaRecorderRecording = false; } } catch (Exception e) { Log.e(TAG, "stopVideoRecording failed"); e.printStackTrace(); } finally { releaseMediaRecorder(); } } </DeepExtract> }
RTSP-Camera-for-Android
positive
4,136
private void parse(NetworkOperatingSystem nos) { try { JSONObject doc = (JSONObject) JSONValue.parse(new FileReader(this.filename)); JSONArray nodes = (JSONArray) doc.get("nodes"); @SuppressWarnings("unchecked") Iterator<JSONObject> iter = nodes.iterator(); while (iter.hasNext()) { JSONObject node = iter.next(); String nodeType = (String) node.get("type"); String nodeName = (String) node.get("name"); String dcName = (String) node.get("datacenter"); if (null != null && !null.equals(dcName)) { continue; } if (nodeType.equalsIgnoreCase("host")) { long pes = (Long) node.get("pes"); long mips = (Long) node.get("mips"); int ram = new BigDecimal((Long) node.get("ram")).intValueExact(); long storage = (Long) node.get("storage"); long bw = new BigDecimal((Long) node.get("bw")).intValueExact(); int num = 1; if (node.get("nums") != null) num = new BigDecimal((Long) node.get("nums")).intValueExact(); for (int n = 0; n < num; n++) { String nodeName2 = nodeName; if (num > 1) nodeName2 = nodeName + n; SDNHost sdnHost = hostFactory.createHost(ram, bw, storage, pes, mips, nodeName); nameNodeTable.put(nodeName2, sdnHost); this.sdnHosts.put(dcName, sdnHost); } } else { int MAX_PORTS = 256; long bw = new BigDecimal((Long) node.get("bw")).longValueExact(); long iops = (Long) node.get("iops"); int upports = MAX_PORTS; int downports = MAX_PORTS; if (node.get("upports") != null) upports = new BigDecimal((Long) node.get("upports")).intValueExact(); if (node.get("downports") != null) downports = new BigDecimal((Long) node.get("downports")).intValueExact(); Switch sw = null; if (nodeType.equalsIgnoreCase("core")) { sw = new CoreSwitch(nodeName, bw, iops, upports, downports); } else if (nodeType.equalsIgnoreCase("aggregate")) { sw = new AggregationSwitch(nodeName, bw, iops, upports, downports); } else if (nodeType.equalsIgnoreCase("edge")) { sw = new EdgeSwitch(nodeName, bw, iops, upports, downports); } else if (nodeType.equalsIgnoreCase("intercloud")) { sw = new IntercloudSwitch(nodeName, bw, iops, upports, downports); } else if (nodeType.equalsIgnoreCase("gateway")) { if (nameNodeTable.get(nodeName) != null) sw = (Switch) nameNodeTable.get(nodeName); else sw = new GatewaySwitch(nodeName, bw, iops, upports, downports); } else { throw new IllegalArgumentException("No switch found!"); } if (sw != null) { nameNodeTable.put(nodeName, sw); this.switches.put(dcName, sw); } } } } catch (FileNotFoundException e) { e.printStackTrace(); } try { JSONObject doc = (JSONObject) JSONValue.parse(new FileReader(this.filename)); JSONArray links = (JSONArray) doc.get("links"); @SuppressWarnings("unchecked") Iterator<JSONObject> linksIter = links.iterator(); while (linksIter.hasNext()) { JSONObject link = linksIter.next(); String src = (String) link.get("source"); String dst = (String) link.get("destination"); double lat = (Double) link.get("latency"); Node srcNode = nameNodeTable.get(src); Node dstNode = nameNodeTable.get(dst); Link l = new Link(srcNode, dstNode, lat, -1); this.links.add(l); } } catch (FileNotFoundException e) { e.printStackTrace(); } }
private void parse(NetworkOperatingSystem nos) { try { JSONObject doc = (JSONObject) JSONValue.parse(new FileReader(this.filename)); JSONArray nodes = (JSONArray) doc.get("nodes"); @SuppressWarnings("unchecked") Iterator<JSONObject> iter = nodes.iterator(); while (iter.hasNext()) { JSONObject node = iter.next(); String nodeType = (String) node.get("type"); String nodeName = (String) node.get("name"); String dcName = (String) node.get("datacenter"); if (null != null && !null.equals(dcName)) { continue; } if (nodeType.equalsIgnoreCase("host")) { long pes = (Long) node.get("pes"); long mips = (Long) node.get("mips"); int ram = new BigDecimal((Long) node.get("ram")).intValueExact(); long storage = (Long) node.get("storage"); long bw = new BigDecimal((Long) node.get("bw")).intValueExact(); int num = 1; if (node.get("nums") != null) num = new BigDecimal((Long) node.get("nums")).intValueExact(); for (int n = 0; n < num; n++) { String nodeName2 = nodeName; if (num > 1) nodeName2 = nodeName + n; SDNHost sdnHost = hostFactory.createHost(ram, bw, storage, pes, mips, nodeName); nameNodeTable.put(nodeName2, sdnHost); this.sdnHosts.put(dcName, sdnHost); } } else { int MAX_PORTS = 256; long bw = new BigDecimal((Long) node.get("bw")).longValueExact(); long iops = (Long) node.get("iops"); int upports = MAX_PORTS; int downports = MAX_PORTS; if (node.get("upports") != null) upports = new BigDecimal((Long) node.get("upports")).intValueExact(); if (node.get("downports") != null) downports = new BigDecimal((Long) node.get("downports")).intValueExact(); Switch sw = null; if (nodeType.equalsIgnoreCase("core")) { sw = new CoreSwitch(nodeName, bw, iops, upports, downports); } else if (nodeType.equalsIgnoreCase("aggregate")) { sw = new AggregationSwitch(nodeName, bw, iops, upports, downports); } else if (nodeType.equalsIgnoreCase("edge")) { sw = new EdgeSwitch(nodeName, bw, iops, upports, downports); } else if (nodeType.equalsIgnoreCase("intercloud")) { sw = new IntercloudSwitch(nodeName, bw, iops, upports, downports); } else if (nodeType.equalsIgnoreCase("gateway")) { if (nameNodeTable.get(nodeName) != null) sw = (Switch) nameNodeTable.get(nodeName); else sw = new GatewaySwitch(nodeName, bw, iops, upports, downports); } else { throw new IllegalArgumentException("No switch found!"); } if (sw != null) { nameNodeTable.put(nodeName, sw); this.switches.put(dcName, sw); } } } } catch (FileNotFoundException e) { e.printStackTrace(); } <DeepExtract> try { JSONObject doc = (JSONObject) JSONValue.parse(new FileReader(this.filename)); JSONArray links = (JSONArray) doc.get("links"); @SuppressWarnings("unchecked") Iterator<JSONObject> linksIter = links.iterator(); while (linksIter.hasNext()) { JSONObject link = linksIter.next(); String src = (String) link.get("source"); String dst = (String) link.get("destination"); double lat = (Double) link.get("latency"); Node srcNode = nameNodeTable.get(src); Node dstNode = nameNodeTable.get(dst); Link l = new Link(srcNode, dstNode, lat, -1); this.links.add(l); } } catch (FileNotFoundException e) { e.printStackTrace(); } </DeepExtract> }
cloudsimsdn
positive
4,137
@Override public boolean onError(MediaPlayer mediaPlayer, int what, int more) { Log.w(TAG, "Media player error: " + new Exception("MediaPlayer error: " + what + " (" + more + ")"), new Exception("MediaPlayer error: " + what + " (" + more + ")")); mediaPlayer.reset(); setPlayerState(IDLE); return false; }
@Override public boolean onError(MediaPlayer mediaPlayer, int what, int more) { <DeepExtract> Log.w(TAG, "Media player error: " + new Exception("MediaPlayer error: " + what + " (" + more + ")"), new Exception("MediaPlayer error: " + what + " (" + more + ")")); mediaPlayer.reset(); setPlayerState(IDLE); </DeepExtract> return false; }
Subsonic-Android
positive
4,138
public void markMerge() { setAttr(NETCONF_NAMESPACE, OPERATION, MERGE); }
public void markMerge() { <DeepExtract> setAttr(NETCONF_NAMESPACE, OPERATION, MERGE); </DeepExtract> }
JNC
positive
4,139
public void cacheAllInfo(String dir) { File file = new File(dir); File[] classes = file.listFiles(); for (File classFile : classes) { if (classFile.isDirectory()) { loadAllMetaInfo(classFile.getAbsolutePath()); } else { loadSingleMetaInfo(classFile); } } for (String name : metaInfos.keySet()) { constructSubNames(name); } }
public void cacheAllInfo(String dir) { File file = new File(dir); File[] classes = file.listFiles(); for (File classFile : classes) { if (classFile.isDirectory()) { loadAllMetaInfo(classFile.getAbsolutePath()); } else { loadSingleMetaInfo(classFile); } } <DeepExtract> for (String name : metaInfos.keySet()) { constructSubNames(name); } </DeepExtract> }
vinja
positive
4,140
public byte i2() { assert (2 <= 8); return (byte) readInt(2, true); }
public byte i2() { <DeepExtract> assert (2 <= 8); return (byte) readInt(2, true); </DeepExtract> }
testing-video
positive
4,141
public void newAgent(Vertex vertex) throws IOException { String s = keyword("agent") + "(" + vertex.getID() + optionalAttributes(vertex.getAttributes()) + ")"; buffer.write(s); if (!standaloneExpression) { buffer.newLine(); } }
public void newAgent(Vertex vertex) throws IOException { String s = keyword("agent") + "(" + vertex.getID() + optionalAttributes(vertex.getAttributes()) + ")"; <DeepExtract> buffer.write(s); if (!standaloneExpression) { buffer.newLine(); } </DeepExtract> }
prov-viewer
positive
4,142
@Test public void docToTxtOfficeTest() throws Exception { mockTransformCommand(DOC, TXT, MIMETYPE_WORD, false); this.targetMimetype = MIMETYPE_TEXT_PLAIN; System.out.println("Test " + OFFICE + " " + DOC + " to " + TXT); MockHttpServletRequestBuilder requestBuilder = null == null ? mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", this.targetExtension) : mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", this.targetExtension, INCLUDE_CONTENTS, null.toString()); MvcResult result = mockMvc.perform(requestBuilder).andExpect(status().is(OK.value())).andExpect(header().string("Content-Disposition", "attachment; filename*=UTF-8''transform." + this.targetExtension)).andReturn(); String content = result.getResponse().getContentAsString(); assertTrue(content.contains(EXPECTED_TEXT_CONTENT_CONTAINS), "The content did not include \"" + EXPECTED_TEXT_CONTENT_CONTAINS); }
@Test public void docToTxtOfficeTest() throws Exception { <DeepExtract> mockTransformCommand(DOC, TXT, MIMETYPE_WORD, false); this.targetMimetype = MIMETYPE_TEXT_PLAIN; System.out.println("Test " + OFFICE + " " + DOC + " to " + TXT); MockHttpServletRequestBuilder requestBuilder = null == null ? mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", this.targetExtension) : mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", this.targetExtension, INCLUDE_CONTENTS, null.toString()); MvcResult result = mockMvc.perform(requestBuilder).andExpect(status().is(OK.value())).andExpect(header().string("Content-Disposition", "attachment; filename*=UTF-8''transform." + this.targetExtension)).andReturn(); String content = result.getResponse().getContentAsString(); assertTrue(content.contains(EXPECTED_TEXT_CONTENT_CONTAINS), "The content did not include \"" + EXPECTED_TEXT_CONTENT_CONTAINS); </DeepExtract> }
alfresco-transform-core
positive
4,143
@Before public void init() { deFiConsumerManager = new DeFiConsumerManager(consumerIdsChangeListener, adjustQueueNumStrategy); mockChannel = mock(Channel.class); clientChannelInfo = new ClientChannelInfo(mockChannel, clientId, LanguageCode.JAVA, 100); ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; deFiConsumerManager.registerConsumer(consumerData.getGroupName(), clientChannelInfo, consumerData.getConsumeType(), consumerData.getMessageModel(), consumerData.getConsumeFromWhere(), consumerData.getSubscriptionDataSet(), false); }
@Before public void init() { deFiConsumerManager = new DeFiConsumerManager(consumerIdsChangeListener, adjustQueueNumStrategy); mockChannel = mock(Channel.class); clientChannelInfo = new ClientChannelInfo(mockChannel, clientId, LanguageCode.JAVA, 100); <DeepExtract> ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; </DeepExtract> deFiConsumerManager.registerConsumer(consumerData.getGroupName(), clientChannelInfo, consumerData.getConsumeType(), consumerData.getMessageModel(), consumerData.getConsumeFromWhere(), consumerData.getSubscriptionDataSet(), false); }
DeFiBus
positive
4,146
private void rethrow(Throwable e) { Lib.assertTrue(privileged != null && privilegeCount > 0); privilegeCount--; if (privilegeCount == 0) privileged = null; if (e instanceof RuntimeException) throw (RuntimeException) e; else if (e instanceof Error) throw (Error) e; else Lib.assertNotReached(); }
private void rethrow(Throwable e) { <DeepExtract> Lib.assertTrue(privileged != null && privilegeCount > 0); privilegeCount--; if (privilegeCount == 0) privileged = null; </DeepExtract> if (e instanceof RuntimeException) throw (RuntimeException) e; else if (e instanceof Error) throw (Error) e; else Lib.assertNotReached(); }
CS162
positive
4,147
@SuppressWarnings("UnusedDeclaration") public void setKmFrom(double distance) { Preconditions.checkArgument(limits instanceof RadialBound); this.radius = distance * 0.621371 / EARTH_RADIUS; Preconditions.checkArgument(Math.toDegrees(this.radius) < 70, "Outrageously large radius"); }
@SuppressWarnings("UnusedDeclaration") public void setKmFrom(double distance) { Preconditions.checkArgument(limits instanceof RadialBound); <DeepExtract> this.radius = distance * 0.621371 / EARTH_RADIUS; Preconditions.checkArgument(Math.toDegrees(this.radius) < 70, "Outrageously large radius"); </DeepExtract> }
log-synth
positive
4,148
@Override public View onCreateInputView() { keyboardFrame = new FrameLayout(this); keyboardFrame.removeAllViews(); if (lastLanguage != NumberKeyboard.LANGUAGE_ID) lastLanguage = lastLanguage; final Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); final Point point = new Point(); display.getSize(point); final View view = lastLanguage != KeyboardPicker.LANGUAGE_ID ? keyboard = BaldKeyboard.newInstance(lastLanguage, this, this, this::backspace, getCurrentInputEditorInfo().imeOptions) : new KeyboardPicker(this); keyboardFrame.addView(view, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, point.x > point.y ? (int) (point.y * 0.8) : ViewGroup.LayoutParams.MATCH_PARENT)); return keyboardFrame; }
@Override public View onCreateInputView() { keyboardFrame = new FrameLayout(this); <DeepExtract> keyboardFrame.removeAllViews(); if (lastLanguage != NumberKeyboard.LANGUAGE_ID) lastLanguage = lastLanguage; final Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); final Point point = new Point(); display.getSize(point); final View view = lastLanguage != KeyboardPicker.LANGUAGE_ID ? keyboard = BaldKeyboard.newInstance(lastLanguage, this, this, this::backspace, getCurrentInputEditorInfo().imeOptions) : new KeyboardPicker(this); keyboardFrame.addView(view, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, point.x > point.y ? (int) (point.y * 0.8) : ViewGroup.LayoutParams.MATCH_PARENT)); </DeepExtract> return keyboardFrame; }
BaldPhone
positive
4,149
public void reset() { mEmulator.reset(); if (mNotify != null) { mNotify.onUpdate(); } }
public void reset() { mEmulator.reset(); <DeepExtract> if (mNotify != null) { mNotify.onUpdate(); } </DeepExtract> }
TerminalEmulator-Android
positive
4,150
@Test public void addDateTag() { Instant instant = Instant.ofEpochMilli(0L); addTagByType(Date.from(instant), "1970-01-01", RecordFieldType.DATE.getDataType()); }
@Test public void addDateTag() { Instant instant = Instant.ofEpochMilli(0L); <DeepExtract> addTagByType(Date.from(instant), "1970-01-01", RecordFieldType.DATE.getDataType()); </DeepExtract> }
nifi-influxdb-bundle
positive
4,151
public Criteria andAddressGreaterThanOrEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "address" + " cannot be null"); } criteria.add(new Criterion("address >=", value)); return (Criteria) this; }
public Criteria andAddressGreaterThanOrEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "address" + " cannot be null"); } criteria.add(new Criterion("address >=", value)); </DeepExtract> return (Criteria) this; }
Ordering
positive
4,152
public void setServer(CommandSender sender, String server, Boolean auto) { if (server.contains(":")) { botServerPort = Integer.parseInt(server.split(":")[1]); botServer = server.split(":")[0]; } else { botServer = server; } botServer = botServer.replace("^.*\\/\\/", ""); botServer = botServer.replace(":\\d+$", ""); saveConfig("server", botServer); autoConnect = auto; plugin.logDebug("Saving [" + "server" + "]: " + botServer.toString()); config.set("server", botServer); saveConfig(); plugin.logDebug("Saving [" + "port" + "]: " + botServerPort.toString()); config.set("port", botServerPort); saveConfig(); plugin.logDebug("Saving [" + "autoconnect" + "]: " + autoConnect.toString()); config.set("autoconnect", autoConnect); saveConfig(); sender.sendMessage("IRC server changed to \"" + botServer + ":" + botServerPort + "\". (AutoConnect: " + autoConnect + ")"); }
public void setServer(CommandSender sender, String server, Boolean auto) { if (server.contains(":")) { botServerPort = Integer.parseInt(server.split(":")[1]); botServer = server.split(":")[0]; } else { botServer = server; } botServer = botServer.replace("^.*\\/\\/", ""); botServer = botServer.replace(":\\d+$", ""); saveConfig("server", botServer); autoConnect = auto; plugin.logDebug("Saving [" + "server" + "]: " + botServer.toString()); config.set("server", botServer); saveConfig(); plugin.logDebug("Saving [" + "port" + "]: " + botServerPort.toString()); config.set("port", botServerPort); saveConfig(); <DeepExtract> plugin.logDebug("Saving [" + "autoconnect" + "]: " + autoConnect.toString()); config.set("autoconnect", autoConnect); saveConfig(); </DeepExtract> sender.sendMessage("IRC server changed to \"" + botServer + ":" + botServerPort + "\". (AutoConnect: " + autoConnect + ")"); }
PurpleIRC
positive
4,153