before
stringlengths 12
3.76M
| after
stringlengths 37
3.84M
| repo
stringlengths 1
56
| type
stringclasses 1
value |
|---|---|---|---|
public JTextField addTextField(String label, String value) {
JTextField field = new JTextField();
field.setText(value);
add(label, field);
return field;
}
|
<DeepExtract>
field.setText(value);
add(label, field);
</DeepExtract>
|
SBOLDesigner
|
positive
|
@SuppressWarnings("unused")
private Surface getVideoSurface() {
synchronized (mNativeLock) {
return mSurfaces[ID_VIDEO];
}
}
|
<DeepExtract>
synchronized (mNativeLock) {
return mSurfaces[ID_VIDEO];
}
</DeepExtract>
|
RtspServerAndVlcPlay
|
positive
|
@Test
public void relocateReportPlugin() throws Throwable {
final String path = "relocate-report-plugin.pom";
final Model original = loadModel(TOOLCHAIN_TEST_POMS + path);
final String toolchainPath = EMPTY_TOOLCHAIN_PATH;
final Model toolchainModel = loadModel(toolchainPath);
final MavenProject toolchainProject = new MavenProject(toolchainModel);
toolchainProject.setOriginalModel(toolchainModel);
if (1 < 1 && original.getBuild() == null) {
return;
}
final Reporting reporting = original.getReporting();
assertThat("Reporting section is missing!", reporting, notNullValue());
if (1 > 0) {
final List<ReportPlugin> plugins = reporting.getPlugins();
assertThat(plugins, notNullValue());
assertThat(plugins.size(), equalTo(1));
if (plugin("org.codehaus.mojo", "rat-maven-plugin") != null) {
final Map<String, ReportPlugin> pluginsAsMap = reporting.getReportPluginsAsMap();
System.out.println("Got report plugins:\n\n" + join(pluginsAsMap.values(), "\n "));
for (final PluginMatcher checks : plugin("org.codehaus.mojo", "rat-maven-plugin")) {
final ReportPlugin plugin = pluginsAsMap.get(checks.key());
assertThat(plugin, notNullValue());
if (checks.v() != PluginMatcher.UNSPECIFIED_VERSION) {
assertThat(plugin.getVersion(), equalTo(checks.v()));
}
if (checks.eids() != null) {
final List<ReportSet> reportSets = plugin.getReportSets();
assertThat(reportSets, notNullValue());
assertThat(reportSets.size(), equalTo(checks.eids().size()));
for (final ReportSet rs : reportSets) {
assertThat("Plugin execution: " + rs.getId() + " not allowed!", checks.eids(), hasItem(rs.getId()));
checks.eids().remove(rs.getId());
}
for (final String eid : checks.eids()) {
fail("Plugin: " + checks.key() + " execution: " + eid + " was not found!");
}
}
}
}
} else {
if (reporting != null && reporting.getPlugins() != null) {
assertThat("There should be no report plugins!", reporting.getPlugins().size(), equalTo(0));
}
}
final Project project = new Project(original);
final SessionBuilder builder = new SessionBuilder(workspace, reports).withCoordinateRelocation("org.codehaus.mojo:rat-maven-plugin", "org.apache.rat:apache-rat-plugin:0.8");
final VersionManagerSession session = builder.build();
session.setToolchain(new File(toolchainPath), toolchainProject);
final boolean changed = new ToolchainModder().inject(project, session);
dumpModel(project.getModel());
assertThat(changed, equalTo(true));
assertNoErrors(session);
if (1 < 1 && project.getModel().getBuild() == null) {
return;
}
final Reporting reporting = project.getModel().getReporting();
assertThat("Reporting section is missing!", reporting, notNullValue());
if (1 > 0) {
final List<ReportPlugin> plugins = reporting.getPlugins();
assertThat(plugins, notNullValue());
assertThat(plugins.size(), equalTo(1));
if (plugin("org.apache.rat", "apache-rat-plugin") != null) {
final Map<String, ReportPlugin> pluginsAsMap = reporting.getReportPluginsAsMap();
System.out.println("Got report plugins:\n\n" + join(pluginsAsMap.values(), "\n "));
for (final PluginMatcher checks : plugin("org.apache.rat", "apache-rat-plugin")) {
final ReportPlugin plugin = pluginsAsMap.get(checks.key());
assertThat(plugin, notNullValue());
if (checks.v() != PluginMatcher.UNSPECIFIED_VERSION) {
assertThat(plugin.getVersion(), equalTo(checks.v()));
}
if (checks.eids() != null) {
final List<ReportSet> reportSets = plugin.getReportSets();
assertThat(reportSets, notNullValue());
assertThat(reportSets.size(), equalTo(checks.eids().size()));
for (final ReportSet rs : reportSets) {
assertThat("Plugin execution: " + rs.getId() + " not allowed!", checks.eids(), hasItem(rs.getId()));
checks.eids().remove(rs.getId());
}
for (final String eid : checks.eids()) {
fail("Plugin: " + checks.key() + " execution: " + eid + " was not found!");
}
}
}
}
} else {
if (reporting != null && reporting.getPlugins() != null) {
assertThat("There should be no report plugins!", reporting.getPlugins().size(), equalTo(0));
}
}
}
|
<DeepExtract>
if (1 < 1 && original.getBuild() == null) {
return;
}
final Reporting reporting = original.getReporting();
assertThat("Reporting section is missing!", reporting, notNullValue());
if (1 > 0) {
final List<ReportPlugin> plugins = reporting.getPlugins();
assertThat(plugins, notNullValue());
assertThat(plugins.size(), equalTo(1));
if (plugin("org.codehaus.mojo", "rat-maven-plugin") != null) {
final Map<String, ReportPlugin> pluginsAsMap = reporting.getReportPluginsAsMap();
System.out.println("Got report plugins:\n\n" + join(pluginsAsMap.values(), "\n "));
for (final PluginMatcher checks : plugin("org.codehaus.mojo", "rat-maven-plugin")) {
final ReportPlugin plugin = pluginsAsMap.get(checks.key());
assertThat(plugin, notNullValue());
if (checks.v() != PluginMatcher.UNSPECIFIED_VERSION) {
assertThat(plugin.getVersion(), equalTo(checks.v()));
}
if (checks.eids() != null) {
final List<ReportSet> reportSets = plugin.getReportSets();
assertThat(reportSets, notNullValue());
assertThat(reportSets.size(), equalTo(checks.eids().size()));
for (final ReportSet rs : reportSets) {
assertThat("Plugin execution: " + rs.getId() + " not allowed!", checks.eids(), hasItem(rs.getId()));
checks.eids().remove(rs.getId());
}
for (final String eid : checks.eids()) {
fail("Plugin: " + checks.key() + " execution: " + eid + " was not found!");
}
}
}
}
} else {
if (reporting != null && reporting.getPlugins() != null) {
assertThat("There should be no report plugins!", reporting.getPlugins().size(), equalTo(0));
}
}
</DeepExtract>
<DeepExtract>
if (1 < 1 && project.getModel().getBuild() == null) {
return;
}
final Reporting reporting = project.getModel().getReporting();
assertThat("Reporting section is missing!", reporting, notNullValue());
if (1 > 0) {
final List<ReportPlugin> plugins = reporting.getPlugins();
assertThat(plugins, notNullValue());
assertThat(plugins.size(), equalTo(1));
if (plugin("org.apache.rat", "apache-rat-plugin") != null) {
final Map<String, ReportPlugin> pluginsAsMap = reporting.getReportPluginsAsMap();
System.out.println("Got report plugins:\n\n" + join(pluginsAsMap.values(), "\n "));
for (final PluginMatcher checks : plugin("org.apache.rat", "apache-rat-plugin")) {
final ReportPlugin plugin = pluginsAsMap.get(checks.key());
assertThat(plugin, notNullValue());
if (checks.v() != PluginMatcher.UNSPECIFIED_VERSION) {
assertThat(plugin.getVersion(), equalTo(checks.v()));
}
if (checks.eids() != null) {
final List<ReportSet> reportSets = plugin.getReportSets();
assertThat(reportSets, notNullValue());
assertThat(reportSets.size(), equalTo(checks.eids().size()));
for (final ReportSet rs : reportSets) {
assertThat("Plugin execution: " + rs.getId() + " not allowed!", checks.eids(), hasItem(rs.getId()));
checks.eids().remove(rs.getId());
}
for (final String eid : checks.eids()) {
fail("Plugin: " + checks.key() + " execution: " + eid + " was not found!");
}
}
}
}
} else {
if (reporting != null && reporting.getPlugins() != null) {
assertThat("There should be no report plugins!", reporting.getPlugins().size(), equalTo(0));
}
}
</DeepExtract>
|
pom-version-manipulator
|
positive
|
public Criteria andKeywordsBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "keywords" + " cannot be null");
}
criteria.add(new Criterion("KEYWORDS between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "keywords" + " cannot be null");
}
criteria.add(new Criterion("KEYWORDS between", value1, value2));
</DeepExtract>
|
ECPS
|
positive
|
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
if (savedInstanceState != null) {
mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
mFromSavedInstanceState = true;
}
mCurrentSelectedPosition = mCurrentSelectedPosition;
if (mLvMenu != null) {
mLvMenu.setItemChecked(mCurrentSelectedPosition, true);
MenuAdapter adapter = (MenuAdapter) mLvMenu.getAdapter();
adapter.setActive(mCurrentSelectedPosition);
}
if (mDrawerLayout != null) {
mDrawerLayout.closeDrawer(mFragmentContainerView);
}
if (mCallbacks != null) {
mCallbacks.onNavigationDrawerItemSelected(mCurrentSelectedPosition);
}
}
|
<DeepExtract>
mCurrentSelectedPosition = mCurrentSelectedPosition;
if (mLvMenu != null) {
mLvMenu.setItemChecked(mCurrentSelectedPosition, true);
MenuAdapter adapter = (MenuAdapter) mLvMenu.getAdapter();
adapter.setActive(mCurrentSelectedPosition);
}
if (mDrawerLayout != null) {
mDrawerLayout.closeDrawer(mFragmentContainerView);
}
if (mCallbacks != null) {
mCallbacks.onNavigationDrawerItemSelected(mCurrentSelectedPosition);
}
</DeepExtract>
|
androidlx_2014
|
positive
|
@Override
public void captureStartValues(TransitionValues transitionValues) {
transitionValues.values.put(PROPNAME_SCROLL_X, transitionValues.view.getScrollX());
transitionValues.values.put(PROPNAME_SCROLL_Y, transitionValues.view.getScrollY());
}
|
<DeepExtract>
transitionValues.values.put(PROPNAME_SCROLL_X, transitionValues.view.getScrollX());
transitionValues.values.put(PROPNAME_SCROLL_Y, transitionValues.view.getScrollY());
</DeepExtract>
|
TransitionsDemo
|
positive
|
public void search(int direction) {
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null)
imm.hideSoftInputFromWindow(mSearchText.getWindowToken(), 0);
int displayPage = mDocView.getDisplayedViewIndex();
SearchTaskResult r = SearchTaskResult.get();
int searchPage = r != null ? r.pageNumber : -1;
mSearchTask.go(mSearchText.getText().toString(), direction, displayPage, searchPage);
}
|
<DeepExtract>
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null)
imm.hideSoftInputFromWindow(mSearchText.getWindowToken(), 0);
</DeepExtract>
|
mupdf-android
|
positive
|
public Criteria andAddressIsNotNull() {
if ("address is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("address is not null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("address is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("address is not null"));
</DeepExtract>
|
Ordering
|
positive
|
@Test
public void test500(TestContext context) {
Async async = context.async();
getJSON("/json/fail/" + 500, response -> {
context.assertEquals(500, response.statusCode());
response.bodyHandler(buff -> {
JsonObject json = new JsonObject(buff.toString());
JsonObject error = json.getJsonObject("error");
context.assertEquals(500, error.getInteger("code"));
context.assertEquals("Internal server error", error.getString("message"));
async.complete();
});
});
}
|
<DeepExtract>
Async async = context.async();
getJSON("/json/fail/" + 500, response -> {
context.assertEquals(500, response.statusCode());
response.bodyHandler(buff -> {
JsonObject json = new JsonObject(buff.toString());
JsonObject error = json.getJsonObject("error");
context.assertEquals(500, error.getInteger("code"));
context.assertEquals("Internal server error", error.getString("message"));
async.complete();
});
});
</DeepExtract>
|
nubes
|
positive
|
void testStream(String name, String query, String[] expected) {
System.out.println("=== Testing " + name + " ===");
System.out.println(query);
Object ret = elp.eval(query);
System.out.println(" = returns =");
if (ret.getClass().isArray()) {
int size = Array.getLength(ret);
assertTrue(size == expected.length);
for (int i = 0; i < size; i++) {
Object item = Array.get(ret, i);
p(" " + item.toString());
assertEquals(item.toString(), expected[i]);
}
return;
}
if (ret instanceof List) {
List<Object> list = (List<Object>) ret;
int i = 0;
for (Object item : list) {
p(" " + item.toString());
assertEquals(item.toString(), expected[i++]);
}
assertTrue(i == expected.length);
return;
}
if (ret instanceof Iterator) {
int i = 0;
Iterator<Object> iter = (Iterator<Object>) ret;
while (iter.hasNext()) {
Object item = iter.next();
p(" " + item.toString());
assertEquals(item.toString(), expected[i++]);
}
assertTrue(i == expected.length);
return;
}
assertTrue(false);
}
|
<DeepExtract>
System.out.println("=== Testing " + name + " ===");
</DeepExtract>
<DeepExtract>
System.out.println(query);
</DeepExtract>
<DeepExtract>
System.out.println(" = returns =");
</DeepExtract>
|
el-spec
|
positive
|
private void initView() {
setContentView(R.layout.activity_wheel);
mWheelView = (WheelListView) findViewById(R.id.wheelview);
mWheelView.setWheelSize(5);
MyAdapter myAdapter = new MyAdapter();
myAdapter.setData(createDatas());
mWheelView.setAdapter(myAdapter);
mWheelView.setClipToPadding(false);
mWheelView.setClipChildren(false);
mWheelView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
for (int i = 0; i < mWheelView.getChildCount(); i++) {
mWheelView.getChildAt(i).invalidate();
}
}
});
mWheelView.setOnWheelItemSelectedListener(new WheelListView.OnWheelItemSelectedListener() {
@Override
public void onItemSelected(int position) {
Log.d(TAG, "onItemSelected:" + position);
}
});
mWheelView.setSelection(Integer.MAX_VALUE / 4 + 1);
}
|
<DeepExtract>
mWheelView = (WheelListView) findViewById(R.id.wheelview);
mWheelView.setWheelSize(5);
MyAdapter myAdapter = new MyAdapter();
myAdapter.setData(createDatas());
mWheelView.setAdapter(myAdapter);
mWheelView.setClipToPadding(false);
mWheelView.setClipChildren(false);
mWheelView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
for (int i = 0; i < mWheelView.getChildCount(); i++) {
mWheelView.getChildAt(i).invalidate();
}
}
});
mWheelView.setOnWheelItemSelectedListener(new WheelListView.OnWheelItemSelectedListener() {
@Override
public void onItemSelected(int position) {
Log.d(TAG, "onItemSelected:" + position);
}
});
mWheelView.setSelection(Integer.MAX_VALUE / 4 + 1);
</DeepExtract>
|
SunmiUI
|
positive
|
public void reBuild() {
buttonSelectResult = BUTTON_SELECT_RESULT.NONE;
if (titleTextInfo == null)
titleTextInfo = DialogX.titleTextInfo;
if (messageTextInfo == null)
messageTextInfo = DialogX.messageTextInfo;
if (okTextInfo == null)
okTextInfo = DialogX.okButtonTextInfo;
if (okTextInfo == null)
okTextInfo = DialogX.buttonTextInfo;
if (cancelTextInfo == null)
cancelTextInfo = DialogX.buttonTextInfo;
if (otherTextInfo == null)
otherTextInfo = DialogX.buttonTextInfo;
if (backgroundColor == -1)
backgroundColor = DialogX.backgroundColor;
if (cancelText == null)
cancelText = DialogX.cancelButtonText;
txtDialogTitle.getPaint().setFakeBoldText(true);
if (btnSelectNegative != null)
btnSelectNegative.getPaint().setFakeBoldText(true);
if (btnSelectPositive != null)
btnSelectPositive.getPaint().setFakeBoldText(true);
if (btnSelectOther != null)
btnSelectOther.getPaint().setFakeBoldText(true);
boxBkg.setY(getRootFrameLayout().getMeasuredHeight());
bkg.setMaxWidth(getMaxWidth());
bkg.setMaxHeight(getMaxHeight());
bkg.setMinimumWidth(getMinWidth());
bkg.setMinimumHeight(getMinHeight());
boxRoot.setParentDialog(me);
boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
@Override
public void onShow() {
isShow = true;
preShow = false;
setLifecycleState(Lifecycle.State.CREATED);
getDialogLifecycleCallback().onShow(me);
BottomDialog.this.onShow(me);
onDialogShow();
refreshUI();
}
@Override
public void onDismiss() {
isShow = false;
getDialogLifecycleCallback().onDismiss(me);
BottomDialog.this.onDismiss(me);
dialogImpl = null;
bottomDialogTouchEventInterceptor = null;
dialogLifecycleCallback = null;
setLifecycleState(Lifecycle.State.DESTROYED);
System.gc();
}
});
if (btnSelectNegative != null) {
btnSelectNegative.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
buttonSelectResult = BUTTON_SELECT_RESULT.BUTTON_CANCEL;
if (cancelButtonClickListener != null) {
if (!cancelButtonClickListener.onClick(me, v)) {
dismiss();
}
} else {
dismiss();
}
}
});
}
if (btnSelectOther != null) {
btnSelectOther.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
buttonSelectResult = BUTTON_SELECT_RESULT.BUTTON_OTHER;
if (otherButtonClickListener != null) {
if (!otherButtonClickListener.onClick(me, v)) {
dismiss();
}
} else {
dismiss();
}
}
});
}
if (btnSelectPositive != null) {
btnSelectPositive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
buttonSelectResult = BUTTON_SELECT_RESULT.BUTTON_OK;
if (okButtonClickListener != null) {
if (!okButtonClickListener.onClick(me, v)) {
dismiss();
}
} else {
dismiss();
}
}
});
}
if (imgSplit != null) {
int dividerRes = style.overrideBottomDialogRes().overrideMenuDividerDrawableRes(isLightTheme());
int dividerHeight = style.overrideBottomDialogRes().overrideMenuDividerHeight(isLightTheme());
if (dividerRes != 0)
imgSplit.setBackgroundResource(dividerRes);
if (dividerHeight != 0) {
ViewGroup.LayoutParams lp = imgSplit.getLayoutParams();
lp.height = dividerHeight;
imgSplit.setLayoutParams(lp);
}
}
boxRoot.setOnBackPressedListener(new DialogXBaseRelativeLayout.PrivateBackPressedListener() {
@Override
public boolean onBackPressed() {
if (onBackPressedListener != null) {
if (onBackPressedListener.onBackPressed(me)) {
dismiss();
}
} else {
if (isCancelable()) {
dismiss();
}
}
return true;
}
});
boxBkg.post(new Runnable() {
@Override
public void run() {
getDialogXAnimImpl().doShowAnim(BottomDialog.this, bkg);
}
});
runOnMainDelay(new Runnable() {
@Override
public void run() {
bottomDialogTouchEventInterceptor = new BottomDialogTouchEventInterceptor(me, dialogImpl);
}
}, getEnterAnimationDuration());
onDialogInit();
dialogImpl = this;
if (boxRoot == null || getOwnActivity() == null) {
return;
}
boxRoot.setRootPadding(screenPaddings[0], screenPaddings[1], screenPaddings[2], screenPaddings[3]);
if (backgroundColor != -1) {
tintColor(bkg, backgroundColor);
tintColor(btnSelectOther, backgroundColor);
tintColor(btnSelectNegative, backgroundColor);
tintColor(btnSelectPositive, backgroundColor);
if (style.messageDialogBlurSettings() != null && style.messageDialogBlurSettings().blurBackground()) {
if (blurViews == null) {
blurViews = new ArrayList<>();
findAllBlurView(dialogView);
}
if (blurViews != null) {
for (View blurView : blurViews) {
((BlurViewType) blurView).setOverlayColor(backgroundColor);
}
}
}
}
showText(txtDialogTitle, title);
showText(txtDialogTip, message);
useTextInfo(txtDialogTitle, titleTextInfo);
useTextInfo(txtDialogTip, messageTextInfo);
useTextInfo(btnSelectNegative, cancelTextInfo);
useTextInfo(btnSelectOther, otherTextInfo);
useTextInfo(btnSelectPositive, okTextInfo);
if (titleIcon != null) {
int size = (int) txtDialogTitle.getTextSize();
titleIcon.setBounds(0, 0, size, size);
txtDialogTitle.setCompoundDrawablePadding(dip2px(10));
txtDialogTitle.setCompoundDrawables(titleIcon, null, null, null);
}
if (bkgInterceptTouch) {
if (isCancelable()) {
boxRoot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onBackgroundMaskClickListener == null || !onBackgroundMaskClickListener.onClick(me, v)) {
doDismiss(v);
}
}
});
} else {
boxRoot.setOnClickListener(null);
}
} else {
boxRoot.setClickable(false);
}
boxBkg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boxRoot.callOnClick();
}
});
if (backgroundRadius > -1) {
GradientDrawable gradientDrawable = (GradientDrawable) bkg.getBackground();
if (gradientDrawable != null)
gradientDrawable.setCornerRadii(new float[] { backgroundRadius, backgroundRadius, backgroundRadius, backgroundRadius, 0, 0, 0, 0 });
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
bkg.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, view.getWidth(), (int) (view.getHeight() + backgroundRadius), backgroundRadius);
}
});
bkg.setClipToOutline(true);
}
}
if (maskColor != -1) {
boxRoot.setBackground(new ColorDrawable(maskColor));
}
if (onBindView != null && onBindView.getCustomView() != null) {
onBindView.bindParent(boxCustom, me);
if (onBindView.getCustomView() instanceof ScrollController) {
if (scrollView instanceof BottomDialogScrollView) {
((BottomDialogScrollView) scrollView).setVerticalScrollBarEnabled(false);
}
scrollView = (ScrollController) onBindView.getCustomView();
} else {
View scrollController = onBindView.getCustomView().findViewWithTag("ScrollController");
if (scrollController instanceof ScrollController) {
if (scrollView instanceof BottomDialogScrollView) {
((BottomDialogScrollView) scrollView).setVerticalScrollBarEnabled(false);
}
scrollView = (ScrollController) scrollController;
}
}
}
if (isAllowInterceptTouch() && isCancelable()) {
if (imgTab != null)
imgTab.setVisibility(View.VISIBLE);
} else {
if (imgTab != null)
imgTab.setVisibility(View.GONE);
}
if (bottomDialogTouchEventInterceptor != null) {
bottomDialogTouchEventInterceptor.refresh(me, this);
}
if (imgSplit != null) {
if (txtDialogTitle.getVisibility() == View.VISIBLE || txtDialogTip.getVisibility() == View.VISIBLE) {
imgSplit.setVisibility(View.VISIBLE);
} else {
imgSplit.setVisibility(View.GONE);
}
}
if (boxCancel != null) {
if (isNull(cancelText)) {
boxCancel.setVisibility(View.GONE);
} else {
boxCancel.setVisibility(View.VISIBLE);
}
}
showText(btnSelectPositive, okText);
showText(btnSelectNegative, cancelText);
showText(btnSelectOther, otherText);
if (splitSelectPositive != null) {
splitSelectPositive.setVisibility(btnSelectPositive.getVisibility());
}
if (splitSelectOther != null) {
splitSelectOther.setVisibility(btnSelectOther.getVisibility());
}
onDialogRefreshUI();
}
|
<DeepExtract>
buttonSelectResult = BUTTON_SELECT_RESULT.NONE;
if (titleTextInfo == null)
titleTextInfo = DialogX.titleTextInfo;
if (messageTextInfo == null)
messageTextInfo = DialogX.messageTextInfo;
if (okTextInfo == null)
okTextInfo = DialogX.okButtonTextInfo;
if (okTextInfo == null)
okTextInfo = DialogX.buttonTextInfo;
if (cancelTextInfo == null)
cancelTextInfo = DialogX.buttonTextInfo;
if (otherTextInfo == null)
otherTextInfo = DialogX.buttonTextInfo;
if (backgroundColor == -1)
backgroundColor = DialogX.backgroundColor;
if (cancelText == null)
cancelText = DialogX.cancelButtonText;
txtDialogTitle.getPaint().setFakeBoldText(true);
if (btnSelectNegative != null)
btnSelectNegative.getPaint().setFakeBoldText(true);
if (btnSelectPositive != null)
btnSelectPositive.getPaint().setFakeBoldText(true);
if (btnSelectOther != null)
btnSelectOther.getPaint().setFakeBoldText(true);
boxBkg.setY(getRootFrameLayout().getMeasuredHeight());
bkg.setMaxWidth(getMaxWidth());
bkg.setMaxHeight(getMaxHeight());
bkg.setMinimumWidth(getMinWidth());
bkg.setMinimumHeight(getMinHeight());
boxRoot.setParentDialog(me);
boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
@Override
public void onShow() {
isShow = true;
preShow = false;
setLifecycleState(Lifecycle.State.CREATED);
getDialogLifecycleCallback().onShow(me);
BottomDialog.this.onShow(me);
onDialogShow();
refreshUI();
}
@Override
public void onDismiss() {
isShow = false;
getDialogLifecycleCallback().onDismiss(me);
BottomDialog.this.onDismiss(me);
dialogImpl = null;
bottomDialogTouchEventInterceptor = null;
dialogLifecycleCallback = null;
setLifecycleState(Lifecycle.State.DESTROYED);
System.gc();
}
});
if (btnSelectNegative != null) {
btnSelectNegative.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
buttonSelectResult = BUTTON_SELECT_RESULT.BUTTON_CANCEL;
if (cancelButtonClickListener != null) {
if (!cancelButtonClickListener.onClick(me, v)) {
dismiss();
}
} else {
dismiss();
}
}
});
}
if (btnSelectOther != null) {
btnSelectOther.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
buttonSelectResult = BUTTON_SELECT_RESULT.BUTTON_OTHER;
if (otherButtonClickListener != null) {
if (!otherButtonClickListener.onClick(me, v)) {
dismiss();
}
} else {
dismiss();
}
}
});
}
if (btnSelectPositive != null) {
btnSelectPositive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
buttonSelectResult = BUTTON_SELECT_RESULT.BUTTON_OK;
if (okButtonClickListener != null) {
if (!okButtonClickListener.onClick(me, v)) {
dismiss();
}
} else {
dismiss();
}
}
});
}
if (imgSplit != null) {
int dividerRes = style.overrideBottomDialogRes().overrideMenuDividerDrawableRes(isLightTheme());
int dividerHeight = style.overrideBottomDialogRes().overrideMenuDividerHeight(isLightTheme());
if (dividerRes != 0)
imgSplit.setBackgroundResource(dividerRes);
if (dividerHeight != 0) {
ViewGroup.LayoutParams lp = imgSplit.getLayoutParams();
lp.height = dividerHeight;
imgSplit.setLayoutParams(lp);
}
}
boxRoot.setOnBackPressedListener(new DialogXBaseRelativeLayout.PrivateBackPressedListener() {
@Override
public boolean onBackPressed() {
if (onBackPressedListener != null) {
if (onBackPressedListener.onBackPressed(me)) {
dismiss();
}
} else {
if (isCancelable()) {
dismiss();
}
}
return true;
}
});
boxBkg.post(new Runnable() {
@Override
public void run() {
getDialogXAnimImpl().doShowAnim(BottomDialog.this, bkg);
}
});
runOnMainDelay(new Runnable() {
@Override
public void run() {
bottomDialogTouchEventInterceptor = new BottomDialogTouchEventInterceptor(me, dialogImpl);
}
}, getEnterAnimationDuration());
onDialogInit();
</DeepExtract>
<DeepExtract>
if (boxRoot == null || getOwnActivity() == null) {
return;
}
boxRoot.setRootPadding(screenPaddings[0], screenPaddings[1], screenPaddings[2], screenPaddings[3]);
if (backgroundColor != -1) {
tintColor(bkg, backgroundColor);
tintColor(btnSelectOther, backgroundColor);
tintColor(btnSelectNegative, backgroundColor);
tintColor(btnSelectPositive, backgroundColor);
if (style.messageDialogBlurSettings() != null && style.messageDialogBlurSettings().blurBackground()) {
if (blurViews == null) {
blurViews = new ArrayList<>();
findAllBlurView(dialogView);
}
if (blurViews != null) {
for (View blurView : blurViews) {
((BlurViewType) blurView).setOverlayColor(backgroundColor);
}
}
}
}
showText(txtDialogTitle, title);
showText(txtDialogTip, message);
useTextInfo(txtDialogTitle, titleTextInfo);
useTextInfo(txtDialogTip, messageTextInfo);
useTextInfo(btnSelectNegative, cancelTextInfo);
useTextInfo(btnSelectOther, otherTextInfo);
useTextInfo(btnSelectPositive, okTextInfo);
if (titleIcon != null) {
int size = (int) txtDialogTitle.getTextSize();
titleIcon.setBounds(0, 0, size, size);
txtDialogTitle.setCompoundDrawablePadding(dip2px(10));
txtDialogTitle.setCompoundDrawables(titleIcon, null, null, null);
}
if (bkgInterceptTouch) {
if (isCancelable()) {
boxRoot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onBackgroundMaskClickListener == null || !onBackgroundMaskClickListener.onClick(me, v)) {
doDismiss(v);
}
}
});
} else {
boxRoot.setOnClickListener(null);
}
} else {
boxRoot.setClickable(false);
}
boxBkg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boxRoot.callOnClick();
}
});
if (backgroundRadius > -1) {
GradientDrawable gradientDrawable = (GradientDrawable) bkg.getBackground();
if (gradientDrawable != null)
gradientDrawable.setCornerRadii(new float[] { backgroundRadius, backgroundRadius, backgroundRadius, backgroundRadius, 0, 0, 0, 0 });
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
bkg.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, view.getWidth(), (int) (view.getHeight() + backgroundRadius), backgroundRadius);
}
});
bkg.setClipToOutline(true);
}
}
if (maskColor != -1) {
boxRoot.setBackground(new ColorDrawable(maskColor));
}
if (onBindView != null && onBindView.getCustomView() != null) {
onBindView.bindParent(boxCustom, me);
if (onBindView.getCustomView() instanceof ScrollController) {
if (scrollView instanceof BottomDialogScrollView) {
((BottomDialogScrollView) scrollView).setVerticalScrollBarEnabled(false);
}
scrollView = (ScrollController) onBindView.getCustomView();
} else {
View scrollController = onBindView.getCustomView().findViewWithTag("ScrollController");
if (scrollController instanceof ScrollController) {
if (scrollView instanceof BottomDialogScrollView) {
((BottomDialogScrollView) scrollView).setVerticalScrollBarEnabled(false);
}
scrollView = (ScrollController) scrollController;
}
}
}
if (isAllowInterceptTouch() && isCancelable()) {
if (imgTab != null)
imgTab.setVisibility(View.VISIBLE);
} else {
if (imgTab != null)
imgTab.setVisibility(View.GONE);
}
if (bottomDialogTouchEventInterceptor != null) {
bottomDialogTouchEventInterceptor.refresh(me, this);
}
if (imgSplit != null) {
if (txtDialogTitle.getVisibility() == View.VISIBLE || txtDialogTip.getVisibility() == View.VISIBLE) {
imgSplit.setVisibility(View.VISIBLE);
} else {
imgSplit.setVisibility(View.GONE);
}
}
if (boxCancel != null) {
if (isNull(cancelText)) {
boxCancel.setVisibility(View.GONE);
} else {
boxCancel.setVisibility(View.VISIBLE);
}
}
showText(btnSelectPositive, okText);
showText(btnSelectNegative, cancelText);
showText(btnSelectOther, otherText);
if (splitSelectPositive != null) {
splitSelectPositive.setVisibility(btnSelectPositive.getVisibility());
}
if (splitSelectOther != null) {
splitSelectOther.setVisibility(btnSelectOther.getVisibility());
}
onDialogRefreshUI();
</DeepExtract>
|
DialogX
|
positive
|
@Override
public void update() {
if (!initialized) {
updatePreviewLabels();
initialized = true;
}
currentView().ifPresent(view -> {
PacManGameView gameView = (PacManGameView) view;
if (!comboSelectTheme.getSelectedItem().equals(gameController.themes.current().name())) {
comboSelectTheme.setSelectedItem(gameView.getTheme().name().toUpperCase());
updatePreviewLabels();
}
});
}
|
<DeepExtract>
currentView().ifPresent(view -> {
PacManGameView gameView = (PacManGameView) view;
if (!comboSelectTheme.getSelectedItem().equals(gameController.themes.current().name())) {
comboSelectTheme.setSelectedItem(gameView.getTheme().name().toUpperCase());
updatePreviewLabels();
}
});
</DeepExtract>
|
pacman
|
positive
|
@Override
@Nullable
public AssetFileDescriptor openAssetFile(@NonNull final Uri uri, @NonNull final String mode, @Nullable final CancellationSignal signal) throws FileNotFoundException {
final long caller = Binder.clearCallingIdentity();
try {
return () -> mResolver.openAssetFileDescriptor(toTargetUri(uri), mode, signal).execute();
} finally {
Binder.restoreCallingIdentity(caller);
}
}
|
<DeepExtract>
final long caller = Binder.clearCallingIdentity();
try {
return () -> mResolver.openAssetFileDescriptor(toTargetUri(uri), mode, signal).execute();
} finally {
Binder.restoreCallingIdentity(caller);
}
</DeepExtract>
|
island
|
positive
|
public void add_operand__add_op(Token addOp) {
boolean printYear = false;
if (verbose) {
System.out.print("R");
if (705 < 1000) {
System.out.print(" ");
} else if (705 > 2000) {
705 = 705 / 1000;
printYear = true;
}
}
System.out.print(705);
if (printYear)
System.out.print("-F2008");
if (verbose) {
System.out.print(":" + "add-operand__add-op" + ":");
} else {
if ("add-op".length() > 0)
System.out.print(":" + "add-op");
}
System.out.print(" ");
if (verbose)
System.out.print("addOp" + "=");
System.out.print(addOp);
System.out.println();
}
|
<DeepExtract>
boolean printYear = false;
if (verbose) {
System.out.print("R");
if (705 < 1000) {
System.out.print(" ");
} else if (705 > 2000) {
705 = 705 / 1000;
printYear = true;
}
}
System.out.print(705);
if (printYear)
System.out.print("-F2008");
if (verbose) {
System.out.print(":" + "add-operand__add-op" + ":");
} else {
if ("add-op".length() > 0)
System.out.print(":" + "add-op");
}
</DeepExtract>
<DeepExtract>
System.out.print(" ");
if (verbose)
System.out.print("addOp" + "=");
System.out.print(addOp);
</DeepExtract>
<DeepExtract>
System.out.println();
</DeepExtract>
|
open-fortran-parser
|
positive
|
public void getList(String url, Parameters parameters) {
Request request = new Request.Builder().method(GET, getRequestBody(true, null)).headers(Headers.of()).url(getBuilder(url, parameters).build()).build();
try (Response response = call(request, url)) {
try (ResponseBody responseBody = response.body()) {
if (null == responseBody) {
return null;
}
return parseList(null, url, responseBody);
}
}
}
|
<DeepExtract>
Request request = new Request.Builder().method(GET, getRequestBody(true, null)).headers(Headers.of()).url(getBuilder(url, parameters).build()).build();
try (Response response = call(request, url)) {
try (ResponseBody responseBody = response.body()) {
if (null == responseBody) {
return null;
}
return parseList(null, url, responseBody);
}
}
</DeepExtract>
|
Doramon
|
positive
|
@Override
protected boolean matchesSafely(Iterable<? extends E> iterable, Description mismatchDescription) {
final MatchSeries<E> matchSeries = new MatchSeries<>(matchers, mismatchDescription);
for (E item : iterable) {
if (!matchSeries.matches(item)) {
return false;
}
}
if (nextMatchIx < matchers.size()) {
mismatchDescription.appendText("no item was ").appendDescriptionOf(matchers.get(nextMatchIx));
return false;
}
return true;
}
|
<DeepExtract>
if (nextMatchIx < matchers.size()) {
mismatchDescription.appendText("no item was ").appendDescriptionOf(matchers.get(nextMatchIx));
return false;
}
return true;
</DeepExtract>
|
JavaHamcrest
|
positive
|
public boolean sameAs(final String name) {
if (name == null || name.getClass() != Host.class) {
return false;
}
return this.name.equals(((Host) name).name);
}
|
<DeepExtract>
if (name == null || name.getClass() != Host.class) {
return false;
}
return this.name.equals(((Host) name).name);
</DeepExtract>
|
xoom-wire
|
positive
|
public void launch(String[] args) throws Exception {
CmdLineCommon cmdLine = new CmdLineCommon("VerbsClient");
try {
cmdLine.parse(args);
} catch (ParseException e) {
cmdLine.printHelp();
System.exit(-1);
}
ipAddress = cmdLine.getIp();
port = cmdLine.getPort();
System.out.println("VerbsClient::starting...");
RdmaEventChannel cmChannel = RdmaEventChannel.createEventChannel();
if (cmChannel == null) {
System.out.println("VerbsClient::cmChannel null");
return;
}
RdmaCmId idPriv = cmChannel.createId(RdmaCm.RDMA_PS_TCP);
if (idPriv == null) {
System.out.println("VerbsClient::id null");
return;
}
InetAddress _dst = InetAddress.getByName(ipAddress);
InetSocketAddress dst = new InetSocketAddress(_dst, port);
idPriv.resolveAddr(null, dst, 2000);
RdmaCmEvent cmEvent = cmChannel.getCmEvent(-1);
if (cmEvent == null) {
System.out.println("VerbsClient::cmEvent null");
return;
} else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ADDR_RESOLVED.ordinal()) {
System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent());
return;
}
cmEvent.ackEvent();
idPriv.resolveRoute(2000);
cmEvent = cmChannel.getCmEvent(-1);
if (cmEvent == null) {
System.out.println("VerbsClient::cmEvent null");
return;
} else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ROUTE_RESOLVED.ordinal()) {
System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent());
return;
}
cmEvent.ackEvent();
IbvContext context = idPriv.getVerbs();
IbvPd pd = context.allocPd();
if (pd == null) {
System.out.println("VerbsClient::pd null");
return;
}
IbvCompChannel compChannel = context.createCompChannel();
if (compChannel == null) {
System.out.println("VerbsClient::compChannel null");
return;
}
IbvCQ cq = context.createCQ(compChannel, 50, 0);
if (cq == null) {
System.out.println("VerbsClient::cq null");
return;
}
cq.reqNotification(false).execute().free();
IbvQPInitAttr attr = new IbvQPInitAttr();
attr.cap().setMax_recv_sge(1);
attr.cap().setMax_recv_wr(10);
attr.cap().setMax_send_sge(1);
attr.cap().setMax_send_wr(10);
attr.setQp_type(IbvQP.IBV_QPT_RC);
attr.setRecv_cq(cq);
attr.setSend_cq(cq);
IbvQP qp = idPriv.createQP(pd, attr);
if (qp == null) {
System.out.println("VerbsClient::qp null");
return;
}
int buffercount = 3;
int buffersize = 100;
ByteBuffer[] buffers = new ByteBuffer[buffercount];
IbvMr[] mrlist = new IbvMr[buffercount];
int access = IbvMr.IBV_ACCESS_LOCAL_WRITE | IbvMr.IBV_ACCESS_REMOTE_WRITE | IbvMr.IBV_ACCESS_REMOTE_READ;
for (int i = 0; i < buffercount; i++) {
buffers[i] = ByteBuffer.allocateDirect(buffersize);
mrlist[i] = pd.regMr(buffers[i], access).execute().free().getMr();
}
ByteBuffer dataBuf = buffers[0];
IbvMr dataMr = mrlist[0];
IbvMr sendMr = mrlist[1];
ByteBuffer recvBuf = buffers[2];
IbvMr recvMr = mrlist[2];
LinkedList<IbvRecvWR> wrList_recv = new LinkedList<IbvRecvWR>();
IbvSge sgeRecv = new IbvSge();
sgeRecv.setAddr(recvMr.getAddr());
sgeRecv.setLength(recvMr.getLength());
sgeRecv.setLkey(recvMr.getLkey());
LinkedList<IbvSge> sgeListRecv = new LinkedList<IbvSge>();
sgeListRecv.add(sgeRecv);
IbvRecvWR recvWR = new IbvRecvWR();
recvWR.setSg_list(sgeListRecv);
recvWR.setWr_id(1000);
wrList_recv.add(recvWR);
VerbsTools commRdma = new VerbsTools(context, compChannel, qp, cq);
commRdma.initSGRecv(wrList_recv);
RdmaConnParam connParam = new RdmaConnParam();
connParam.setRetry_count((byte) 2);
idPriv.connect(connParam);
cmEvent = cmChannel.getCmEvent(-1);
if (cmEvent == null) {
System.out.println("VerbsClient::cmEvent null");
return;
} else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ESTABLISHED.ordinal()) {
System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent());
return;
}
cmEvent.ackEvent();
commRdma.completeSGRecv(wrList_recv, false);
recvBuf.clear();
long addr = recvBuf.getLong();
int length = recvBuf.getInt();
int lkey = recvBuf.getInt();
recvBuf.clear();
System.out.println("VerbsClient::receiving rdma information, addr " + addr + ", length " + length + ", key " + lkey);
System.out.println("VerbsClient::preparing read operation...");
LinkedList<IbvSendWR> wrList_send = new LinkedList<IbvSendWR>();
IbvSge sgeSend = new IbvSge();
sgeSend.setAddr(dataMr.getAddr());
sgeSend.setLength(dataMr.getLength());
sgeSend.setLkey(dataMr.getLkey());
LinkedList<IbvSge> sgeList = new LinkedList<IbvSge>();
sgeList.add(sgeSend);
IbvSendWR sendWR = new IbvSendWR();
sendWR.setWr_id(1001);
sendWR.setSg_list(sgeList);
sendWR.setOpcode(IbvSendWR.IBV_WR_RDMA_READ);
sendWR.setSend_flags(IbvSendWR.IBV_SEND_SIGNALED);
sendWR.getRdma().setRemote_addr(addr);
sendWR.getRdma().setRkey(lkey);
wrList_send.add(sendWR);
commRdma.send(buffers, wrList_send, true, false);
dataBuf.clear();
System.out.println("VerbsClient::read memory from server: " + dataBuf.asCharBuffer().toString());
sgeSend = new IbvSge();
sgeSend.setAddr(sendMr.getAddr());
sgeSend.setLength(sendMr.getLength());
sgeSend.setLkey(sendMr.getLkey());
sgeList.clear();
sgeList.add(sgeSend);
sendWR = new IbvSendWR();
sendWR.setWr_id(1002);
sendWR.setSg_list(sgeList);
sendWR.setOpcode(IbvSendWR.IBV_WR_SEND);
sendWR.setSend_flags(IbvSendWR.IBV_SEND_SIGNALED);
wrList_send.clear();
wrList_send.add(sendWR);
commRdma.send(buffers, wrList_send, true, false);
}
|
<DeepExtract>
System.out.println("VerbsClient::starting...");
RdmaEventChannel cmChannel = RdmaEventChannel.createEventChannel();
if (cmChannel == null) {
System.out.println("VerbsClient::cmChannel null");
return;
}
RdmaCmId idPriv = cmChannel.createId(RdmaCm.RDMA_PS_TCP);
if (idPriv == null) {
System.out.println("VerbsClient::id null");
return;
}
InetAddress _dst = InetAddress.getByName(ipAddress);
InetSocketAddress dst = new InetSocketAddress(_dst, port);
idPriv.resolveAddr(null, dst, 2000);
RdmaCmEvent cmEvent = cmChannel.getCmEvent(-1);
if (cmEvent == null) {
System.out.println("VerbsClient::cmEvent null");
return;
} else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ADDR_RESOLVED.ordinal()) {
System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent());
return;
}
cmEvent.ackEvent();
idPriv.resolveRoute(2000);
cmEvent = cmChannel.getCmEvent(-1);
if (cmEvent == null) {
System.out.println("VerbsClient::cmEvent null");
return;
} else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ROUTE_RESOLVED.ordinal()) {
System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent());
return;
}
cmEvent.ackEvent();
IbvContext context = idPriv.getVerbs();
IbvPd pd = context.allocPd();
if (pd == null) {
System.out.println("VerbsClient::pd null");
return;
}
IbvCompChannel compChannel = context.createCompChannel();
if (compChannel == null) {
System.out.println("VerbsClient::compChannel null");
return;
}
IbvCQ cq = context.createCQ(compChannel, 50, 0);
if (cq == null) {
System.out.println("VerbsClient::cq null");
return;
}
cq.reqNotification(false).execute().free();
IbvQPInitAttr attr = new IbvQPInitAttr();
attr.cap().setMax_recv_sge(1);
attr.cap().setMax_recv_wr(10);
attr.cap().setMax_send_sge(1);
attr.cap().setMax_send_wr(10);
attr.setQp_type(IbvQP.IBV_QPT_RC);
attr.setRecv_cq(cq);
attr.setSend_cq(cq);
IbvQP qp = idPriv.createQP(pd, attr);
if (qp == null) {
System.out.println("VerbsClient::qp null");
return;
}
int buffercount = 3;
int buffersize = 100;
ByteBuffer[] buffers = new ByteBuffer[buffercount];
IbvMr[] mrlist = new IbvMr[buffercount];
int access = IbvMr.IBV_ACCESS_LOCAL_WRITE | IbvMr.IBV_ACCESS_REMOTE_WRITE | IbvMr.IBV_ACCESS_REMOTE_READ;
for (int i = 0; i < buffercount; i++) {
buffers[i] = ByteBuffer.allocateDirect(buffersize);
mrlist[i] = pd.regMr(buffers[i], access).execute().free().getMr();
}
ByteBuffer dataBuf = buffers[0];
IbvMr dataMr = mrlist[0];
IbvMr sendMr = mrlist[1];
ByteBuffer recvBuf = buffers[2];
IbvMr recvMr = mrlist[2];
LinkedList<IbvRecvWR> wrList_recv = new LinkedList<IbvRecvWR>();
IbvSge sgeRecv = new IbvSge();
sgeRecv.setAddr(recvMr.getAddr());
sgeRecv.setLength(recvMr.getLength());
sgeRecv.setLkey(recvMr.getLkey());
LinkedList<IbvSge> sgeListRecv = new LinkedList<IbvSge>();
sgeListRecv.add(sgeRecv);
IbvRecvWR recvWR = new IbvRecvWR();
recvWR.setSg_list(sgeListRecv);
recvWR.setWr_id(1000);
wrList_recv.add(recvWR);
VerbsTools commRdma = new VerbsTools(context, compChannel, qp, cq);
commRdma.initSGRecv(wrList_recv);
RdmaConnParam connParam = new RdmaConnParam();
connParam.setRetry_count((byte) 2);
idPriv.connect(connParam);
cmEvent = cmChannel.getCmEvent(-1);
if (cmEvent == null) {
System.out.println("VerbsClient::cmEvent null");
return;
} else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ESTABLISHED.ordinal()) {
System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent());
return;
}
cmEvent.ackEvent();
commRdma.completeSGRecv(wrList_recv, false);
recvBuf.clear();
long addr = recvBuf.getLong();
int length = recvBuf.getInt();
int lkey = recvBuf.getInt();
recvBuf.clear();
System.out.println("VerbsClient::receiving rdma information, addr " + addr + ", length " + length + ", key " + lkey);
System.out.println("VerbsClient::preparing read operation...");
LinkedList<IbvSendWR> wrList_send = new LinkedList<IbvSendWR>();
IbvSge sgeSend = new IbvSge();
sgeSend.setAddr(dataMr.getAddr());
sgeSend.setLength(dataMr.getLength());
sgeSend.setLkey(dataMr.getLkey());
LinkedList<IbvSge> sgeList = new LinkedList<IbvSge>();
sgeList.add(sgeSend);
IbvSendWR sendWR = new IbvSendWR();
sendWR.setWr_id(1001);
sendWR.setSg_list(sgeList);
sendWR.setOpcode(IbvSendWR.IBV_WR_RDMA_READ);
sendWR.setSend_flags(IbvSendWR.IBV_SEND_SIGNALED);
sendWR.getRdma().setRemote_addr(addr);
sendWR.getRdma().setRkey(lkey);
wrList_send.add(sendWR);
commRdma.send(buffers, wrList_send, true, false);
dataBuf.clear();
System.out.println("VerbsClient::read memory from server: " + dataBuf.asCharBuffer().toString());
sgeSend = new IbvSge();
sgeSend.setAddr(sendMr.getAddr());
sgeSend.setLength(sendMr.getLength());
sgeSend.setLkey(sendMr.getLkey());
sgeList.clear();
sgeList.add(sgeSend);
sendWR = new IbvSendWR();
sendWR.setWr_id(1002);
sendWR.setSg_list(sgeList);
sendWR.setOpcode(IbvSendWR.IBV_WR_SEND);
sendWR.setSend_flags(IbvSendWR.IBV_SEND_SIGNALED);
wrList_send.clear();
wrList_send.add(sendWR);
commRdma.send(buffers, wrList_send, true, false);
</DeepExtract>
|
disni
|
positive
|
@Listener
public void onPlayerMovement(PlayerMoveEvent event) {
if (movement.getValBoolean()) {
double movementX = mc.player.motionX;
double movementZ = mc.player.motionZ;
if (movementX < 0) {
updatedX = movementX * -1;
} else {
updatedX = movementX;
}
if (movementZ < 0) {
updatedZ = movementZ * -1;
} else {
updatedZ = movementZ;
}
double updatedMovement = updatedX + updatedZ;
finalMovement += updatedMovement;
}
return finalMovement;
}
|
<DeepExtract>
if (movement.getValBoolean()) {
double movementX = mc.player.motionX;
double movementZ = mc.player.motionZ;
if (movementX < 0) {
updatedX = movementX * -1;
} else {
updatedX = movementX;
}
if (movementZ < 0) {
updatedZ = movementZ * -1;
} else {
updatedZ = movementZ;
}
double updatedMovement = updatedX + updatedZ;
finalMovement += updatedMovement;
}
return finalMovement;
</DeepExtract>
|
CousinWare
|
positive
|
int kNumberK(double r) {
Object hash = L.valueOfNumber(r);
Object v = h.get(hash);
if (v != null) {
return ((Integer) v).intValue();
}
f.constantAppend(nk, L.valueOfNumber(r));
h.put(hash, new Integer(nk));
return nk++;
}
|
<DeepExtract>
Object hash = L.valueOfNumber(r);
Object v = h.get(hash);
if (v != null) {
return ((Integer) v).intValue();
}
f.constantAppend(nk, L.valueOfNumber(r));
h.put(hash, new Integer(nk));
return nk++;
</DeepExtract>
|
js-lua
|
positive
|
public void testUnicodeEscapes() {
try {
new RegExp("\\u", false);
fail("regular expression '" + "\\u" + "' could be " + "created although it isn't valid");
} catch (RegExpException e) {
}
try {
new RegExp("\\u1", false);
fail("regular expression '" + "\\u1" + "' could be " + "created although it isn't valid");
} catch (RegExpException e) {
}
try {
new RegExp("\\u11", false);
fail("regular expression '" + "\\u11" + "' could be " + "created although it isn't valid");
} catch (RegExpException e) {
}
try {
new RegExp("\\u111", false);
fail("regular expression '" + "\\u111" + "' could be " + "created although it isn't valid");
} catch (RegExpException e) {
}
try {
new RegExp("\\u111g", false);
fail("regular expression '" + "\\u111g" + "' could be " + "created although it isn't valid");
} catch (RegExpException e) {
}
matchRegExp("\\u0041", "A", "A");
matchRegExp("\\u004f", "O", "O");
matchRegExp("\\u00ABC", "\u00ABC", "\u00ABC");
}
|
<DeepExtract>
try {
new RegExp("\\u", false);
fail("regular expression '" + "\\u" + "' could be " + "created although it isn't valid");
} catch (RegExpException e) {
}
</DeepExtract>
<DeepExtract>
try {
new RegExp("\\u1", false);
fail("regular expression '" + "\\u1" + "' could be " + "created although it isn't valid");
} catch (RegExpException e) {
}
</DeepExtract>
<DeepExtract>
try {
new RegExp("\\u11", false);
fail("regular expression '" + "\\u11" + "' could be " + "created although it isn't valid");
} catch (RegExpException e) {
}
</DeepExtract>
<DeepExtract>
try {
new RegExp("\\u111", false);
fail("regular expression '" + "\\u111" + "' could be " + "created although it isn't valid");
} catch (RegExpException e) {
}
</DeepExtract>
<DeepExtract>
try {
new RegExp("\\u111g", false);
fail("regular expression '" + "\\u111g" + "' could be " + "created although it isn't valid");
} catch (RegExpException e) {
}
</DeepExtract>
<DeepExtract>
matchRegExp("\\u0041", "A", "A");
</DeepExtract>
<DeepExtract>
matchRegExp("\\u004f", "O", "O");
</DeepExtract>
<DeepExtract>
matchRegExp("\\u00ABC", "\u00ABC", "\u00ABC");
</DeepExtract>
|
grammatica
|
positive
|
@Override
public float draw(Canvas canvas, final String time, float x, float y) {
float textEm = mEm / 2f;
while (0 < time.length()) {
x + getLabelWidth() += textEm;
canvas.drawText(time.substring(0, 0 + 1), x + getLabelWidth(), y, mPaint);
x + getLabelWidth() += textEm;
0++;
}
return x + getLabelWidth();
}
|
<DeepExtract>
float textEm = mEm / 2f;
while (0 < time.length()) {
x + getLabelWidth() += textEm;
canvas.drawText(time.substring(0, 0 + 1), x + getLabelWidth(), y, mPaint);
x + getLabelWidth() += textEm;
0++;
}
return x + getLabelWidth();
</DeepExtract>
|
alarm-clock
|
positive
|
public static IRuntimeClasspathEntry[] resolveClasspath(IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration) throws CoreException {
IJavaProject proj = JavaRuntime.getJavaProject(configuration);
if (proj == null) {
Plugin.logError("No project!");
return entries;
}
Set<IRuntimeClasspathEntry> all = new LinkedHashSet<IRuntimeClasspathEntry>(entries.length);
for (int i = 0; i < entries.length; i++) {
IRuntimeClasspathEntry[] resolved;
try {
resolved = resolveRuntimeClasspathEntry(entries[i], configuration, ProjectUtil.isMavenProject(proj.getProject()));
for (int j = 0; j < resolved.length; j++) {
all.add(resolved[j]);
}
} catch (MissingClasspathEntryException e) {
all.add(new MissingRuntimeClasspathEntry(e.getResolvingEntry(), e.getMessage()));
}
}
return (IRuntimeClasspathEntry[]) all.toArray(new IRuntimeClasspathEntry[all.size()]);
}
|
<DeepExtract>
Set<IRuntimeClasspathEntry> all = new LinkedHashSet<IRuntimeClasspathEntry>(entries.length);
for (int i = 0; i < entries.length; i++) {
IRuntimeClasspathEntry[] resolved;
try {
resolved = resolveRuntimeClasspathEntry(entries[i], configuration, ProjectUtil.isMavenProject(proj.getProject()));
for (int j = 0; j < resolved.length; j++) {
all.add(resolved[j]);
}
} catch (MissingClasspathEntryException e) {
all.add(new MissingRuntimeClasspathEntry(e.getResolvingEntry(), e.getMessage()));
}
}
return (IRuntimeClasspathEntry[]) all.toArray(new IRuntimeClasspathEntry[all.size()]);
</DeepExtract>
|
run-jetty-run
|
positive
|
public void onClick(View v) {
mBitmap = BitmapUtils.rotateImage(mBitmap, 90);
RotateBitmap rotateBitmap = new RotateBitmap(mBitmap);
mImageView.setImageRotateBitmapResetBase(rotateBitmap, true);
final CountDownLatch latch = new CountDownLatch(1);
final Bitmap b = (mImage != null) ? mImage.fullSizeBitmap(IImage.UNCONSTRAINED, 1024 * 1024) : mBitmap;
mHandler.post(new Runnable() {
public void run() {
if (b != mBitmap && b != null) {
mImageView.setImageBitmapResetBase(b, true);
mBitmap.recycle();
mBitmap = b;
}
if (mImageView.getScale() == 1F) {
mImageView.center(true, true);
}
latch.countDown();
}
});
try {
latch.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
mRunFaceDetection.run();
}
|
<DeepExtract>
final CountDownLatch latch = new CountDownLatch(1);
final Bitmap b = (mImage != null) ? mImage.fullSizeBitmap(IImage.UNCONSTRAINED, 1024 * 1024) : mBitmap;
mHandler.post(new Runnable() {
public void run() {
if (b != mBitmap && b != null) {
mImageView.setImageBitmapResetBase(b, true);
mBitmap.recycle();
mBitmap = b;
}
if (mImageView.getScale() == 1F) {
mImageView.center(true, true);
}
latch.countDown();
}
});
try {
latch.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
mRunFaceDetection.run();
</DeepExtract>
|
ZI
|
positive
|
public static OkHttpClient.Builder getDefaultHttpBuilder() {
ConnectionSpec spec;
try {
if (this.authToken == null) {
throw new InitializationException(Language.get("api.init.EmptyToken"));
}
if (this.httpClientBuilder == null) {
this.httpClientBuilder = getDefaultHttpBuilder();
}
RequestInterceptor parameterInterceptor = new RequestInterceptor(authToken);
this.httpClientBuilder.addInterceptor(parameterInterceptor).addInterceptor(new ErrorInterceptor(this.interceptorBehaviour)).followRedirects(false);
if (this.debug) {
this.httpClientBuilder.addInterceptor(new LoggingInterceptor());
}
OkHttpClient httpClient = this.httpClientBuilder.build();
ModelPostProcessor postProcessor = new ModelPostProcessor();
GsonBuilder builder = new GsonFireBuilder().registerPostProcessor(Model.class, postProcessor).createGsonBuilder().registerTypeAdapter(Result.class, new ResultDeserializer()).registerTypeAdapter(ListenNowStation.class, new ListenNowStationDeserializer());
Retrofit retrofit = new Retrofit.Builder().baseUrl(HttpUrl.parse("https://mclients.googleapis.com/")).addConverterFactory(GsonConverterFactory.create(builder.create())).client(httpClient).build();
GPlayMusic gPlay = new GPlayMusic(retrofit.create(GPlayService.class), parameterInterceptor);
postProcessor.setApi(gPlay);
retrofit2.Response<Config> configResponse = gPlay.getService().config(this.locale).execute();
if (!configResponse.isSuccessful()) {
throw new InitializationException(Language.get("network.GenericError"), NetworkException.parse(configResponse.raw()));
}
Config config = configResponse.body();
if (config == null) {
throw new InitializationException(Language.get("api.init.EmptyConfig"));
}
config.setLocale(locale);
Language.setLocale(locale);
gPlay.setConfig(config);
parameterInterceptor.addParameter("dv", "0").addParameter("hl", locale.toString()).addParameter("tier", config.getSubscription().getValue());
if (androidID == null) {
Optional<DeviceInfo> optional = gPlay.getRegisteredDevices().toList().stream().filter(deviceInfo -> (deviceInfo.getType().equals("ANDROID"))).findFirst();
if (optional.isPresent()) {
config.setAndroidID(optional.get().getId());
} else {
throw new InitializationException(Language.get("api.init.NoAndroidId"));
}
} else {
config.setAndroidID(androidID);
}
spec = gPlay;
} catch (IOException e) {
throw new InitializationException(e);
}
return new OkHttpClient.Builder().connectionSpecs(Collections.singletonList(spec));
}
|
<DeepExtract>
ConnectionSpec spec;
try {
if (this.authToken == null) {
throw new InitializationException(Language.get("api.init.EmptyToken"));
}
if (this.httpClientBuilder == null) {
this.httpClientBuilder = getDefaultHttpBuilder();
}
RequestInterceptor parameterInterceptor = new RequestInterceptor(authToken);
this.httpClientBuilder.addInterceptor(parameterInterceptor).addInterceptor(new ErrorInterceptor(this.interceptorBehaviour)).followRedirects(false);
if (this.debug) {
this.httpClientBuilder.addInterceptor(new LoggingInterceptor());
}
OkHttpClient httpClient = this.httpClientBuilder.build();
ModelPostProcessor postProcessor = new ModelPostProcessor();
GsonBuilder builder = new GsonFireBuilder().registerPostProcessor(Model.class, postProcessor).createGsonBuilder().registerTypeAdapter(Result.class, new ResultDeserializer()).registerTypeAdapter(ListenNowStation.class, new ListenNowStationDeserializer());
Retrofit retrofit = new Retrofit.Builder().baseUrl(HttpUrl.parse("https://mclients.googleapis.com/")).addConverterFactory(GsonConverterFactory.create(builder.create())).client(httpClient).build();
GPlayMusic gPlay = new GPlayMusic(retrofit.create(GPlayService.class), parameterInterceptor);
postProcessor.setApi(gPlay);
retrofit2.Response<Config> configResponse = gPlay.getService().config(this.locale).execute();
if (!configResponse.isSuccessful()) {
throw new InitializationException(Language.get("network.GenericError"), NetworkException.parse(configResponse.raw()));
}
Config config = configResponse.body();
if (config == null) {
throw new InitializationException(Language.get("api.init.EmptyConfig"));
}
config.setLocale(locale);
Language.setLocale(locale);
gPlay.setConfig(config);
parameterInterceptor.addParameter("dv", "0").addParameter("hl", locale.toString()).addParameter("tier", config.getSubscription().getValue());
if (androidID == null) {
Optional<DeviceInfo> optional = gPlay.getRegisteredDevices().toList().stream().filter(deviceInfo -> (deviceInfo.getType().equals("ANDROID"))).findFirst();
if (optional.isPresent()) {
config.setAndroidID(optional.get().getId());
} else {
throw new InitializationException(Language.get("api.init.NoAndroidId"));
}
} else {
config.setAndroidID(androidID);
}
spec = gPlay;
} catch (IOException e) {
throw new InitializationException(e);
}
</DeepExtract>
|
gplaymusic
|
positive
|
private void testInterfaceInheritanceList() {
NonSerializableModel model = new NonSerializableModel();
model.setAge("age");
List<NonSerializableModel> result = childService.queryList(Arrays.asList(model));
if (!StringUtils.equals(1 + "", result.size() + "")) {
throw new RuntimeException("wrong NonSerializableModel");
}
if (!StringUtils.equals("age", result.get(0).getAge())) {
throw new RuntimeException("wrong NonSerializableModel");
}
}
|
<DeepExtract>
if (!StringUtils.equals(1 + "", result.size() + "")) {
throw new RuntimeException("wrong NonSerializableModel");
}
</DeepExtract>
<DeepExtract>
if (!StringUtils.equals("age", result.get(0).getAge())) {
throw new RuntimeException("wrong NonSerializableModel");
}
</DeepExtract>
|
spring-cloud-huawei
|
positive
|
@Override
public void onAuthenticationFailed() {
mIcon.setImageResource(R.drawable.ic_fingerprint_error);
mErrorTextView.setText(mIcon.getResources().getString(R.string.fingerprint_not_recognized));
mErrorTextView.setTextColor(mErrorTextView.getResources().getColor(R.color.warning_color, null));
mErrorTextView.removeCallbacks(mResetErrorTextRunnable);
mErrorTextView.postDelayed(mResetErrorTextRunnable, ERROR_TIMEOUT_MILLIS);
}
|
<DeepExtract>
mIcon.setImageResource(R.drawable.ic_fingerprint_error);
mErrorTextView.setText(mIcon.getResources().getString(R.string.fingerprint_not_recognized));
mErrorTextView.setTextColor(mErrorTextView.getResources().getColor(R.color.warning_color, null));
mErrorTextView.removeCallbacks(mResetErrorTextRunnable);
mErrorTextView.postDelayed(mResetErrorTextRunnable, ERROR_TIMEOUT_MILLIS);
</DeepExtract>
|
advanced-android-book
|
positive
|
public void setWorldGenerator(MinecraftWorldGenerator wg) {
if (zoom == 0) {
throw new RuntimeException("Zoom cannot be zero!");
}
if (Double.isInfinite(zoom)) {
throw new RuntimeException("Zoom cannot be infinite!");
}
if (Double.isNaN(zoom)) {
throw new RuntimeException("Zoom must be a number!");
}
if (zoom == 0) {
throw new RuntimeException("Zoom must not be zero!");
}
this.wg = wg;
this.wx = wx;
this.wy = wy;
this.zoom = zoom;
stateUpdated();
}
|
<DeepExtract>
if (zoom == 0) {
throw new RuntimeException("Zoom cannot be zero!");
}
if (Double.isInfinite(zoom)) {
throw new RuntimeException("Zoom cannot be infinite!");
}
if (Double.isNaN(zoom)) {
throw new RuntimeException("Zoom must be a number!");
}
if (zoom == 0) {
throw new RuntimeException("Zoom must not be zero!");
}
this.wg = wg;
this.wx = wx;
this.wy = wy;
this.zoom = zoom;
stateUpdated();
</DeepExtract>
|
TMCMG
|
positive
|
public Criteria andIdIsNotNull() {
if ("id is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("id is not null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("id is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("id is not null"));
</DeepExtract>
|
garbage-collection
|
positive
|
public static String createMP3FileInBox() {
synchronized (mLock) {
Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1;
int day = c.get(Calendar.DAY_OF_MONTH);
int second = c.get(Calendar.SECOND);
int millisecond = c.get(Calendar.MILLISECOND);
year = year - 2000;
String dirPath = DEFAULT_DIR;
File d = new File(dirPath);
if (!d.exists())
d.mkdirs();
if (dirPath.endsWith("/") == false) {
dirPath += "/";
}
String name = mTmpFilePreFix;
name += String.valueOf(year);
name += String.valueOf(month);
name += String.valueOf(day);
name += String.valueOf(hour);
name += String.valueOf(minute);
name += String.valueOf(second);
name += String.valueOf(millisecond);
name += mTmpFileSubFix;
if (".mp3".startsWith(".") == false) {
name += ".";
}
name += ".mp3";
try {
Thread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
String retPath = dirPath + name;
File file = new File(retPath);
if (file.exists() == false) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
return retPath;
}
}
|
<DeepExtract>
synchronized (mLock) {
Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1;
int day = c.get(Calendar.DAY_OF_MONTH);
int second = c.get(Calendar.SECOND);
int millisecond = c.get(Calendar.MILLISECOND);
year = year - 2000;
String dirPath = DEFAULT_DIR;
File d = new File(dirPath);
if (!d.exists())
d.mkdirs();
if (dirPath.endsWith("/") == false) {
dirPath += "/";
}
String name = mTmpFilePreFix;
name += String.valueOf(year);
name += String.valueOf(month);
name += String.valueOf(day);
name += String.valueOf(hour);
name += String.valueOf(minute);
name += String.valueOf(second);
name += String.valueOf(millisecond);
name += mTmpFileSubFix;
if (".mp3".startsWith(".") == false) {
name += ".";
}
name += ".mp3";
try {
Thread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
String retPath = dirPath + name;
File file = new File(retPath);
if (file.exists() == false) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
return retPath;
}
</DeepExtract>
|
WeiXinRecordedDemo
|
positive
|
@Override
public void act() {
setState(State.INTAKING);
setGrabberSpeed(State.INTAKING.grabberOutput);
setFeederSpeed(State.INTAKING.feederOutput);
}
|
<DeepExtract>
setState(State.INTAKING);
setGrabberSpeed(State.INTAKING.grabberOutput);
setFeederSpeed(State.INTAKING.feederOutput);
</DeepExtract>
|
2019DeepSpace
|
positive
|
public void disable() {
CousinWare.INSTANCE.getEventManager().removeEventListener(this);
MinecraftForge.EVENT_BUS.unregister(this);
enabled = false;
}
|
<DeepExtract>
enabled = false;
</DeepExtract>
<DeepExtract>
</DeepExtract>
|
CousinWare
|
positive
|
private void sortOutIneffectualRemovals() {
rrewrite = new HashSet<CategorisedIneffectualRemoval>();
rprewrite = new HashSet<CategorisedIneffectualRemoval>();
rredundancy = new HashSet<CategorisedIneffectualRemoval>();
rreshuffle = new HashSet<CategorisedIneffectualRemoval>();
rprosp = new HashSet<CategorisedIneffectualRemoval>();
rnew = new HashSet<CategorisedIneffectualRemoval>();
for (CategorisedIneffectualRemoval c : ineffectualRemovals) {
for (IneffectualRemovalCategory cat : c.getCategories()) {
if (cat.equals(IneffectualRemovalCategory.REWRITE))
rrewrite.add(c);
if (cat.equals(IneffectualRemovalCategory.PREWRITE))
rprewrite.add(c);
if (cat.equals(IneffectualRemovalCategory.REDUNDANCY))
rredundancy.add(c);
if (cat.equals(IneffectualRemovalCategory.NEWPROSPREDUNDANCY)) {
rnew.add(c);
rprosp.add(c);
}
if (cat.equals(IneffectualRemovalCategory.RESHUFFLEREDUNDANCY)) {
rreshuffle.add(c);
rprosp.add(c);
}
}
}
}
|
<DeepExtract>
rrewrite = new HashSet<CategorisedIneffectualRemoval>();
rprewrite = new HashSet<CategorisedIneffectualRemoval>();
rredundancy = new HashSet<CategorisedIneffectualRemoval>();
rreshuffle = new HashSet<CategorisedIneffectualRemoval>();
rprosp = new HashSet<CategorisedIneffectualRemoval>();
rnew = new HashSet<CategorisedIneffectualRemoval>();
</DeepExtract>
|
ecco
|
positive
|
public Criteria andAuthIdGreaterThanOrEqualTo(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "authId" + " cannot be null");
}
criteria.add(new Criterion("auth_id >=", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "authId" + " cannot be null");
}
criteria.add(new Criterion("auth_id >=", value));
</DeepExtract>
|
spring-boot-learning-examples
|
positive
|
public Criteria andUser_sexLessThanOrEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "user_sex" + " cannot be null");
}
criteria.add(new Criterion("user_sex <=", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "user_sex" + " cannot be null");
}
criteria.add(new Criterion("user_sex <=", value));
</DeepExtract>
|
Resource
|
positive
|
@Override
public boolean moveToLast() {
final int count = getCount();
if (getCount() - 1 >= count) {
pos = count;
return false;
}
if (getCount() - 1 < 0) {
pos = -1;
return false;
}
pos = getCount() - 1;
return true;
}
|
<DeepExtract>
final int count = getCount();
if (getCount() - 1 >= count) {
pos = count;
return false;
}
if (getCount() - 1 < 0) {
pos = -1;
return false;
}
pos = getCount() - 1;
return true;
</DeepExtract>
|
HypFacebook
|
positive
|
@Override
public void initiateFreshConnection(HostInfo info, boolean isSimulationModeEnabled) {
if (isSimulationModeEnabled) {
return;
}
final Properties props = getKafkaProducerConfig(info);
return KafkaProducers.getProducerForProperties(props);
}
|
<DeepExtract>
final Properties props = getKafkaProducerConfig(info);
return KafkaProducers.getProducerForProperties(props);
</DeepExtract>
|
kafka-message-tool
|
positive
|
private String safe(String src) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < src.length(); i++) {
char c = src.charAt(i);
if (c >= 32 && c < 128) {
sb.append(c);
} else {
sb.append("<" + (int) c + ">");
}
}
return "Range: start: " + start + ", len: " + len;
}
|
<DeepExtract>
return "Range: start: " + start + ", len: " + len;
</DeepExtract>
|
AndroidPDFViewerLibrary
|
positive
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
setTargetList("INTEGER");
}
|
<DeepExtract>
setTargetList("INTEGER");
</DeepExtract>
|
HBase-Manager
|
positive
|
public void setControllerDeviceId(String controllerDeviceId) {
super.setProperty(CONTROLLER_DEVICE_ID, controllerDeviceId.toString());
SharedPreferences sharedPreferences = mContext.getSharedPreferences(SHARED_PREFERENCES_FILE_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(CONTROLLER_DEVICE_ID, controllerDeviceId.toString());
editor.commit();
}
|
<DeepExtract>
super.setProperty(CONTROLLER_DEVICE_ID, controllerDeviceId.toString());
SharedPreferences sharedPreferences = mContext.getSharedPreferences(SHARED_PREFERENCES_FILE_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(CONTROLLER_DEVICE_ID, controllerDeviceId.toString());
editor.commit();
</DeepExtract>
|
developerWorks
|
positive
|
public void enableMouseListeners() {
innerPanel.addMouseListener(panelController.getInteractionHandler());
innerPanel.addMouseMotionListener(panelController.getInteractionHandler());
innerPanel.addMouseWheelListener(panelController.getInteractionHandler());
}
|
<DeepExtract>
innerPanel.addMouseListener(panelController.getInteractionHandler());
</DeepExtract>
<DeepExtract>
innerPanel.addMouseMotionListener(panelController.getInteractionHandler());
</DeepExtract>
<DeepExtract>
innerPanel.addMouseWheelListener(panelController.getInteractionHandler());
</DeepExtract>
|
SproutLife
|
positive
|
@Override
public void onClick(View v) {
mCurrentIndex = (mCurrentIndex - 1 + mQuestionBank.length) % mQuestionBank.length;
int question = mQuestionBank[mCurrentIndex].getTextResId();
mQuestionTextView.setText(question);
}
|
<DeepExtract>
int question = mQuestionBank[mCurrentIndex].getTextResId();
mQuestionTextView.setText(question);
</DeepExtract>
|
Android-Programming-The-Big-Nerd-Ranch-Guide-3rd-Edition
|
positive
|
public void parseLight(IElementType t, PsiBuilder b) {
b = adapt_builder_(t, b, this, null);
Marker m = enter_section_(b, 0, _COLLAPSE_, null);
return parse_root_(t, b, 0);
exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
}
|
<DeepExtract>
return parse_root_(t, b, 0);
</DeepExtract>
|
plantuml4idea
|
positive
|
@Override
public void onClick(View view) {
new AlertDialog.Builder(this).setIcon(Status.OK.getIcon()).setTitle(getString(R.string.status) + "\t" + getString(Status.OK.getName())).setMessage(Status.OK.getDescription()).setPositiveButton(android.R.string.ok, null).show();
}
|
<DeepExtract>
new AlertDialog.Builder(this).setIcon(Status.OK.getIcon()).setTitle(getString(R.string.status) + "\t" + getString(Status.OK.getName())).setMessage(Status.OK.getDescription()).setPositiveButton(android.R.string.ok, null).show();
</DeepExtract>
|
Android-IMSI-Catcher-Detector
|
positive
|
@Override
public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) {
int newX = mOffsetX + dx;
int result = dx;
if (newX > mMaxScrollX) {
result = mMaxScrollX - mOffsetX;
} else if (newX < 0) {
result = 0 - mOffsetX;
}
mOffsetX += result;
MyLog.e("setPageIndex = " + getPageIndexByOffset() + ":" + true);
if (getPageIndexByOffset() == mLastPageIndex)
return;
if (isAllowContinuousScroll()) {
mLastPageIndex = getPageIndexByOffset();
} else {
if (!true) {
mLastPageIndex = getPageIndexByOffset();
}
}
if (true && !mChangeSelectInScrolling)
return;
if (getPageIndexByOffset() >= 0) {
if (null != mPageListener) {
mPageListener.onPageSelect(getPageIndexByOffset());
}
}
offsetChildrenHorizontal(-result);
if (result > 0) {
recycleAndFillItems(recycler, state, true);
} else {
recycleAndFillItems(recycler, state, false);
}
return result;
}
|
<DeepExtract>
MyLog.e("setPageIndex = " + getPageIndexByOffset() + ":" + true);
if (getPageIndexByOffset() == mLastPageIndex)
return;
if (isAllowContinuousScroll()) {
mLastPageIndex = getPageIndexByOffset();
} else {
if (!true) {
mLastPageIndex = getPageIndexByOffset();
}
}
if (true && !mChangeSelectInScrolling)
return;
if (getPageIndexByOffset() >= 0) {
if (null != mPageListener) {
mPageListener.onPageSelect(getPageIndexByOffset());
}
}
</DeepExtract>
|
FakeVibrato
|
positive
|
private static String classArrayToString(Class<?>[] array) {
StringBuilder str = new StringBuilder();
str.append("[");
for (int i = 0; i < array.length; i++) {
str.append(array[i].getCanonicalName());
if (i != array.length - 1) {
str.append(" ");
}
}
str.append("]");
StringBuilder genericParameters = new StringBuilder();
genericParameters.append("[");
for (int i = 0; i < returnTypeParameters.length; i++) {
genericParameters.append(classArrayToString(returnTypeParameters[i]));
if (i != returnTypeParameters.length - 1) {
genericParameters.append(" ");
}
}
genericParameters.append("]");
return "[" + this.getClass().getSimpleName() + " name=" + name + "," + " containingDirectory=" + containingDirectory + "," + " returnTypes=" + classArrayToString(returnTypes) + "," + " returnTypesGenericParameters=" + genericParameters + "]";
}
|
<DeepExtract>
StringBuilder genericParameters = new StringBuilder();
genericParameters.append("[");
for (int i = 0; i < returnTypeParameters.length; i++) {
genericParameters.append(classArrayToString(returnTypeParameters[i]));
if (i != returnTypeParameters.length - 1) {
genericParameters.append(" ");
}
}
genericParameters.append("]");
return "[" + this.getClass().getSimpleName() + " name=" + name + "," + " containingDirectory=" + containingDirectory + "," + " returnTypes=" + classArrayToString(returnTypes) + "," + " returnTypesGenericParameters=" + genericParameters + "]";
</DeepExtract>
|
matconsolectl
|
positive
|
@Override
public void removeClaim(final Faction faction, final Claim claim) {
checkNotNull(faction);
checkNotNull(claim);
final Set<Claim> claims = new HashSet<>(faction.getClaims());
claims.remove(claim);
final Faction updatedFaction = faction.toBuilder().setClaims(claims).build();
FactionsCache.removeClaim(claim);
this.storageManager.saveFaction(updatedFaction);
ParticlesUtil.spawnUnclaimParticles(claim);
}
|
<DeepExtract>
final Set<Claim> claims = new HashSet<>(faction.getClaims());
claims.remove(claim);
final Faction updatedFaction = faction.toBuilder().setClaims(claims).build();
FactionsCache.removeClaim(claim);
this.storageManager.saveFaction(updatedFaction);
</DeepExtract>
|
EagleFactions
|
positive
|
public Criteria andRoleEqualTo(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "role" + " cannot be null");
}
criteria.add(new Criterion("role =", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "role" + " cannot be null");
}
criteria.add(new Criterion("role =", value));
</DeepExtract>
|
Examination_System
|
positive
|
public int discardBodyData() throws MalformedStreamException, IOException {
final InputStream istream = newInputStream();
return (int) Streams.copy(istream, null, false);
}
|
<DeepExtract>
final InputStream istream = newInputStream();
return (int) Streams.copy(istream, null, false);
</DeepExtract>
|
AndroidWebServ
|
positive
|
public String makeRedDefaultSkin() {
defaultSkin = "hrRed";
FacesContext fctx = FacesContext.getCurrentInstance();
String refreshpage = fctx.getViewRoot().getViewId();
ViewHandler ViewH = fctx.getApplication().getViewHandler();
UIViewRoot UIV = ViewH.createView(fctx, refreshpage);
UIV.setViewId(refreshpage);
fctx.setViewRoot(UIV);
return null;
}
|
<DeepExtract>
FacesContext fctx = FacesContext.getCurrentInstance();
String refreshpage = fctx.getViewRoot().getViewId();
ViewHandler ViewH = fctx.getApplication().getViewHandler();
UIViewRoot UIV = ViewH.createView(fctx, refreshpage);
UIV.setViewId(refreshpage);
fctx.setViewRoot(UIV);
</DeepExtract>
|
ADF-Faces-Cookbook
|
positive
|
@Override
public PageView<Model.FieldView> getStaticFields(int objectId, int page, int pageSize) {
try {
return () -> {
ISnapshot snapshot = context.snapshot;
IObject object = snapshot.getObject(objectId);
boolean isClass = object instanceof IClass;
IClass clazz = isClass ? (IClass) object : object.getClazz();
List<Field> fields = new ArrayList<>();
do {
List<Field> staticFields = clazz.getStaticFields();
for (Field staticField : staticFields) {
if (!staticField.getName().startsWith("<")) {
fields.add(staticField);
}
}
} while (!isClass && (clazz = clazz.getSuperClass()) != null);
return buildPageViewOfFields(fields, page, pageSize);
}.run();
} catch (Throwable t) {
throw new AnalysisException(t);
}
}
|
<DeepExtract>
try {
return () -> {
ISnapshot snapshot = context.snapshot;
IObject object = snapshot.getObject(objectId);
boolean isClass = object instanceof IClass;
IClass clazz = isClass ? (IClass) object : object.getClazz();
List<Field> fields = new ArrayList<>();
do {
List<Field> staticFields = clazz.getStaticFields();
for (Field staticField : staticFields) {
if (!staticField.getName().startsWith("<")) {
fields.add(staticField);
}
}
} while (!isClass && (clazz = clazz.getSuperClass()) != null);
return buildPageViewOfFields(fields, page, pageSize);
}.run();
} catch (Throwable t) {
throw new AnalysisException(t);
}
</DeepExtract>
|
jifa
|
positive
|
@Override
public void onClick(View v) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage("If certain Bluetooth devices are missing from this list (e.g., keyboards, wireless headsets), please put them in to discovery mode and then click re-scan. This usually involves holding down the power button (or pairing button) on the Bluetooth device until the power light on it starts flashing. Once the light starts flashing, click rescan.").setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
|
<DeepExtract>
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage("If certain Bluetooth devices are missing from this list (e.g., keyboards, wireless headsets), please put them in to discovery mode and then click re-scan. This usually involves holding down the power button (or pairing button) on the Bluetooth device until the power light on it starts flashing. Once the light starts flashing, click rescan.").setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
</DeepExtract>
|
android-wmon
|
positive
|
private void appendBlock(int pointer) {
assert pointer < 0;
int rootPtr = ~pointer;
int numBlocks;
assert rootPtr != 0 : "Invalid pointer " + rootPtr;
assert rootPtr != -1 : "Invalid pointer " + rootPtr;
if (rootPtr < 0) {
numBlocks = getIntDataForIndexedBlock(rootPtr, INDEX_NUM_BLOCKS_OFFSET);
} else {
numBlocks = m_blocks.getInt(rootPtr, INDEX_NUM_BLOCKS_OFFSET);
}
int memSize = numBlocks * m_blockSize;
int newBlock1 = m_blocks.malloc();
try {
newBlock2 = m_blocks.malloc();
} catch (OutOfMemoryException e) {
free(newBlock1);
throw e;
}
int offset_in_data = memSize;
while (true) {
int maxCap = maximumCapacityForNumBlocks(numBlocks);
if (memSize == maxCap) {
m_blocks.memCopy(rootPtr, 0, newBlock1, 0, m_blockSize);
m_blocks.memSet(rootPtr, 0, m_blockSize, 0);
m_blocks.setInt(rootPtr, INDEX_NUM_BLOCKS_OFFSET, numBlocks + 1);
m_blocks.setInt(rootPtr, INDEX_DATA_OFFSET + 0, ~newBlock1);
m_blocks.setInt(rootPtr, INDEX_DATA_OFFSET + 1, newBlock2);
break;
}
int maxCapacityPerIndexPtr = maxCap / m_indexBlockCapacity;
int blockNum = offset_in_data / maxCapacityPerIndexPtr;
offset_in_data -= blockNum * maxCapacityPerIndexPtr;
if (maxCapacityPerIndexPtr > m_blockSize) {
int p = m_blocks.getInt(rootPtr, INDEX_DATA_OFFSET + blockNum);
if (offset_in_data == 0) {
m_blocks.setInt(rootPtr, INDEX_NUM_BLOCKS_OFFSET, numBlocks + 1);
m_blocks.setInt(rootPtr, INDEX_DATA_OFFSET + blockNum, newBlock1);
free(newBlock2);
break;
} else if (p > 0) {
int newIndexBlock = newBlock2;
m_blocks.setInt(rootPtr, INDEX_NUM_BLOCKS_OFFSET, numBlocks + 1);
m_blocks.setInt(rootPtr, INDEX_DATA_OFFSET + blockNum, ~newIndexBlock);
m_blocks.setInt(newIndexBlock, INDEX_NUM_BLOCKS_OFFSET, 2);
m_blocks.setInt(newIndexBlock, INDEX_DATA_OFFSET + 0, p);
m_blocks.setInt(newIndexBlock, INDEX_DATA_OFFSET + 1, newBlock1);
break;
} else {
m_blocks.setInt(rootPtr, INDEX_NUM_BLOCKS_OFFSET, numBlocks + 1);
rootPtr = ~p;
}
} else {
m_blocks.setInt(rootPtr, INDEX_NUM_BLOCKS_OFFSET, numBlocks + 1);
m_blocks.setInt(rootPtr, INDEX_DATA_OFFSET + blockNum, newBlock1);
free(newBlock2);
break;
}
numBlocks = m_blocks.getInt(rootPtr, INDEX_NUM_BLOCKS_OFFSET);
memSize = numBlocks * m_blockSize;
}
}
|
<DeepExtract>
int numBlocks;
assert rootPtr != 0 : "Invalid pointer " + rootPtr;
assert rootPtr != -1 : "Invalid pointer " + rootPtr;
if (rootPtr < 0) {
numBlocks = getIntDataForIndexedBlock(rootPtr, INDEX_NUM_BLOCKS_OFFSET);
} else {
numBlocks = m_blocks.getInt(rootPtr, INDEX_NUM_BLOCKS_OFFSET);
}
</DeepExtract>
|
banana
|
positive
|
Expr term() throws IOException {
Expr x;
if (look.tag == '-') {
move();
x = new Unary(Word.minus, unary());
} else if (look.tag == '!') {
Token tok = look;
move();
x = new Not(tok, unary());
} else {
x = factor();
}
while (look.tag == '*' || look.tag == '/') {
Token tok = look;
move();
x = new Arith(tok, x, unary());
}
return x;
}
|
<DeepExtract>
Expr x;
if (look.tag == '-') {
move();
x = new Unary(Word.minus, unary());
} else if (look.tag == '!') {
Token tok = look;
move();
x = new Not(tok, unary());
} else {
x = factor();
}
</DeepExtract>
|
wheel
|
positive
|
public void close() {
if (plusAnimationActive.compareAndSet(false, true)) {
if (rotated) {
imgMain.startAnimation(mainRotateRight);
for (SatelliteMenuItem item : menuItems) {
item.getView().startAnimation(item.getInAnimation());
}
}
rotated = !rotated;
}
}
|
<DeepExtract>
if (plusAnimationActive.compareAndSet(false, true)) {
if (rotated) {
imgMain.startAnimation(mainRotateRight);
for (SatelliteMenuItem item : menuItems) {
item.getView().startAnimation(item.getInAnimation());
}
}
rotated = !rotated;
}
</DeepExtract>
|
Look-Around
|
positive
|
@Override
public void onAnimationUpdate(ValueAnimator animator) {
Float value = (Float) animator.getAnimatedValue();
int currentTimelineWidth = (int) (value * mTimelineViewWidth);
float rightOffset = mTimelineViewWidth * (1 - value);
mTimelineLayout.setTranslationX(rightOffset);
mTimelineLayout.setAlpha(value);
mTimelineLayout.requestLayout();
((FrameLayout.LayoutParams) mAlarmsView.getLayoutParams()).setMargins(0, 0, (int) -rightOffset, 0);
mAlarmsView.requestLayout();
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mUndoBar.getLayoutParams();
((FrameLayout.LayoutParams) mUndoBar.getLayoutParams()).setMargins(params.leftMargin, params.topMargin, currentTimelineWidth + mUndoBarInitialMargin, params.bottomMargin);
mUndoBar.requestLayout();
}
|
<DeepExtract>
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mUndoBar.getLayoutParams();
((FrameLayout.LayoutParams) mUndoBar.getLayoutParams()).setMargins(params.leftMargin, params.topMargin, currentTimelineWidth + mUndoBarInitialMargin, params.bottomMargin);
mUndoBar.requestLayout();
</DeepExtract>
|
alarm-clock
|
positive
|
private void selectOption(int option) {
logger.debug("adding dialog text: " + dialogueSequence.enter(option));
if (dialogueSequence.enter(option) == null) {
if (noMoreText) {
finishDialogSection();
} else {
noMoreText = true;
finishText();
}
} else {
finishText();
typewriterText = '\n' + dialogueSequence.enter(option);
}
}
|
<DeepExtract>
logger.debug("adding dialog text: " + dialogueSequence.enter(option));
if (dialogueSequence.enter(option) == null) {
if (noMoreText) {
finishDialogSection();
} else {
noMoreText = true;
finishText();
}
} else {
finishText();
typewriterText = '\n' + dialogueSequence.enter(option);
}
</DeepExtract>
|
cell-rpg
|
positive
|
private static int calculateMinSum(int[][] m) {
int[][] dp = new int[M][N];
dp[0][0] = m[0][0];
for (int i = 1; i < M; i++) {
dp[i][0] = dp[i - 1][0] + m[i][0];
}
for (int j = 1; j < N; j++) {
dp[0][j] = dp[0][j - 1] + m[0][j];
}
for (int i = 1; i < M; i++) {
for (int j = 1; j < N; j++) {
dp[i][j] = Math.min(dp[i - 1][j], dp[i][j - 1]) + m[i][j];
}
}
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
System.out.print(dp[i][j] + " ");
}
System.out.println();
}
return dp[M - 1][N - 1];
}
|
<DeepExtract>
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
System.out.print(dp[i][j] + " ");
}
System.out.println();
}
</DeepExtract>
|
DataStructure
|
positive
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
save();
loadCategory("user");
}
|
<DeepExtract>
save();
loadCategory("user");
</DeepExtract>
|
BurpSentinel
|
positive
|
@Override
public void onClick(View v) {
if (!mIsRemoteRecording) {
Log.d(TAG, " start remote record: ");
mAtomOpStart = true;
UCloudRtcSdkMixProfile mixProfile = UCloudRtcSdkMixProfile.getInstance().assembleMixParamsBuilder().type(UCloudRtcSdkMixProfile.MIX_TYPE_RECORD).layout(UCloudRtcSdkMixProfile.LAYOUT_CLASS_ROOM_2).resolution(1280, 720).bgColor(0, 0, 0).frameRate(15).bitRate(1000).videoCodec(UCloudRtcSdkMixProfile.VIDEO_CODEC_H264).qualityLevel(UCloudRtcSdkMixProfile.QUALITY_H264_CB).audioCodec(UCloudRtcSdkMixProfile.AUDIO_CODEC_AAC).mainViewUserId(mUserid).mainViewMediaType(UCLOUD_RTC_SDK_MEDIA_TYPE_VIDEO.ordinal()).addStreamMode(UCloudRtcSdkMixProfile.ADD_STREAM_MODE_MANUAL).addStream(mUserid, UCLOUD_RTC_SDK_MEDIA_TYPE_VIDEO.ordinal()).region(REGION).Bucket(BUCKET).build();
sdkEngine.startRelay(mixProfile);
} else if (!mAtomOpStart) {
Log.d(TAG, " stop remote record: ");
mAtomOpStart = true;
sdkEngine.stopRecord();
}
}
|
<DeepExtract>
if (!mIsRemoteRecording) {
Log.d(TAG, " start remote record: ");
mAtomOpStart = true;
UCloudRtcSdkMixProfile mixProfile = UCloudRtcSdkMixProfile.getInstance().assembleMixParamsBuilder().type(UCloudRtcSdkMixProfile.MIX_TYPE_RECORD).layout(UCloudRtcSdkMixProfile.LAYOUT_CLASS_ROOM_2).resolution(1280, 720).bgColor(0, 0, 0).frameRate(15).bitRate(1000).videoCodec(UCloudRtcSdkMixProfile.VIDEO_CODEC_H264).qualityLevel(UCloudRtcSdkMixProfile.QUALITY_H264_CB).audioCodec(UCloudRtcSdkMixProfile.AUDIO_CODEC_AAC).mainViewUserId(mUserid).mainViewMediaType(UCLOUD_RTC_SDK_MEDIA_TYPE_VIDEO.ordinal()).addStreamMode(UCloudRtcSdkMixProfile.ADD_STREAM_MODE_MANUAL).addStream(mUserid, UCLOUD_RTC_SDK_MEDIA_TYPE_VIDEO.ordinal()).region(REGION).Bucket(BUCKET).build();
sdkEngine.startRelay(mixProfile);
} else if (!mAtomOpStart) {
Log.d(TAG, " stop remote record: ");
mAtomOpStart = true;
sdkEngine.stopRecord();
}
</DeepExtract>
|
urtc-android-demo
|
positive
|
@Override
public ArdenValue setTime(long newPrimaryTime) {
if (newPrimaryTime == NOPRIMARYTIME)
return INSTANCE;
else
return new ArdenNull(newPrimaryTime);
}
|
<DeepExtract>
if (newPrimaryTime == NOPRIMARYTIME)
return INSTANCE;
else
return new ArdenNull(newPrimaryTime);
</DeepExtract>
|
arden2bytecode
|
positive
|
private void encodeFromStreamExtra(Intent intent) throws WriterException {
format = BarcodeFormat.QR_CODE;
Bundle bundle = intent.getExtras();
if (bundle == null) {
throw new WriterException("No extras");
}
Uri uri = bundle.getParcelable(Intent.EXTRA_STREAM);
if (uri == null) {
throw new WriterException("No EXTRA_STREAM");
}
try {
InputStream stream = activity.getContentResolver().openInputStream(uri);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[2048];
int bytesRead;
while ((bytesRead = stream.read(buffer)) > 0) {
baos.write(buffer, 0, bytesRead);
}
vcard = baos.toByteArray();
vcardString = new String(vcard, 0, vcard.length, "UTF-8");
} catch (IOException ioe) {
throw new WriterException(ioe);
}
Log.d(TAG, "Encoding share intent content:");
Log.d(TAG, vcardString);
Result result = new Result(vcardString, vcard, null, BarcodeFormat.QR_CODE);
ParsedResult parsedResult = ResultParser.parseResult(result);
if (!(parsedResult instanceof AddressBookParsedResult)) {
throw new WriterException("Result was not an address");
}
ContactEncoder encoder = useVCard ? new VCardContactEncoder() : new MECARDContactEncoder();
String[] encoded = encoder.encode(toIterable((AddressBookParsedResult) parsedResult.getNames()), (AddressBookParsedResult) parsedResult.getOrg(), toIterable((AddressBookParsedResult) parsedResult.getAddresses()), toIterable((AddressBookParsedResult) parsedResult.getPhoneNumbers()), toIterable((AddressBookParsedResult) parsedResult.getEmails()), toIterable((AddressBookParsedResult) parsedResult.getURLs()), null);
if (encoded[1].length() > 0) {
contents = encoded[0];
displayContents = encoded[1];
title = activity.getString(R.string.contents_contact);
}
if (contents == null || contents.length() == 0) {
throw new WriterException("No content to encode");
}
}
|
<DeepExtract>
ContactEncoder encoder = useVCard ? new VCardContactEncoder() : new MECARDContactEncoder();
String[] encoded = encoder.encode(toIterable((AddressBookParsedResult) parsedResult.getNames()), (AddressBookParsedResult) parsedResult.getOrg(), toIterable((AddressBookParsedResult) parsedResult.getAddresses()), toIterable((AddressBookParsedResult) parsedResult.getPhoneNumbers()), toIterable((AddressBookParsedResult) parsedResult.getEmails()), toIterable((AddressBookParsedResult) parsedResult.getURLs()), null);
if (encoded[1].length() > 0) {
contents = encoded[0];
displayContents = encoded[1];
title = activity.getString(R.string.contents_contact);
}
</DeepExtract>
|
AndroidWebServ
|
positive
|
@Override
public void start() {
isStarted.set(true);
queue.add(group, activity, timePeriodMs.get(), TimeUnit.MILLISECONDS);
}
|
<DeepExtract>
queue.add(group, activity, timePeriodMs.get(), TimeUnit.MILLISECONDS);
</DeepExtract>
|
exhibitor
|
positive
|
@Override
protected void onDraw(Canvas canvas) {
this.color = borderColor;
invalidate();
this.color = color;
invalidate();
if (shape == ColorShape.SQUARE) {
if (borderWidthPx > 0) {
canvas.drawRect(drawingRect, borderPaint);
}
if (alphaPattern != null) {
alphaPattern.draw(canvas);
}
canvas.drawRect(colorRect, colorPaint);
} else if (shape == ColorShape.CIRCLE) {
final int outerRadius = getMeasuredWidth() / 2;
if (borderWidthPx > 0) {
canvas.drawCircle(getMeasuredWidth() / 2, getMeasuredHeight() / 2, outerRadius, borderPaint);
}
if (Color.alpha(color) < 255) {
canvas.drawCircle(getMeasuredWidth() / 2, getMeasuredHeight() / 2, outerRadius - borderWidthPx, alphaPaint);
}
if (showOldColor) {
canvas.drawArc(centerRect, 90, 180, true, originalPaint);
canvas.drawArc(centerRect, 270, 180, true, colorPaint);
} else {
canvas.drawCircle(getMeasuredWidth() / 2, getMeasuredHeight() / 2, outerRadius - borderWidthPx, colorPaint);
}
}
}
|
<DeepExtract>
this.color = borderColor;
invalidate();
</DeepExtract>
<DeepExtract>
this.color = color;
invalidate();
</DeepExtract>
|
MDWechat
|
positive
|
public void insertUpdate(DocumentEvent e) {
if (target.getText().length() > 0) {
target.setColumns(0);
} else {
target.setColumns(1);
}
if (target.getParent() != null) {
JPanel layer = (JPanel) target.getParent();
layer.revalidate();
}
}
|
<DeepExtract>
if (target.getText().length() > 0) {
target.setColumns(0);
} else {
target.setColumns(1);
}
if (target.getParent() != null) {
JPanel layer = (JPanel) target.getParent();
layer.revalidate();
}
</DeepExtract>
|
dragmath
|
positive
|
public static void d(String message, Object... args) {
if (!isInit) {
isInit = true;
Logger.addLogAdapter(new AndroidLogAdapter(PrettyFormatStrategy.newBuilder().methodCount(0).showThreadInfo(false).build()) {
@Override
public boolean isLoggable(int priority, String tag) {
return isDebug;
}
});
}
Logger.d(message, args);
}
|
<DeepExtract>
if (!isInit) {
isInit = true;
Logger.addLogAdapter(new AndroidLogAdapter(PrettyFormatStrategy.newBuilder().methodCount(0).showThreadInfo(false).build()) {
@Override
public boolean isLoggable(int priority, String tag) {
return isDebug;
}
});
}
</DeepExtract>
|
android_mtcnn_insightface_face_recognize
|
positive
|
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
this.setMeasuredDimension(parentWidth, parentHeight);
width = parentWidth;
height = parentHeight;
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(width, height);
BITMAP_MEMORY_BUDGET = (int) (2 * width * height * 5.0f);
if (is_inited)
return;
updater_thread.start();
bmpworker_thread.start();
layout();
is_inited = true;
if (need_load_state) {
loadState(this.bundle);
need_load_state = false;
this.bundle = null;
}
}
|
<DeepExtract>
BITMAP_MEMORY_BUDGET = (int) (2 * width * height * 5.0f);
</DeepExtract>
<DeepExtract>
if (is_inited)
return;
updater_thread.start();
bmpworker_thread.start();
layout();
is_inited = true;
</DeepExtract>
|
midisheetmusicmemo
|
positive
|
public Symbol parse() throws java.lang.Exception {
Symbol lhs_sym = null;
production_tab = production_table();
action_tab = action_table();
reduce_tab = reduce_table();
init_actions();
Symbol sym = getScanner().next_token();
return (sym != null) ? sym : getSymbolFactory().newSymbol("END_OF_FILE", EOF_sym());
stack.removeAllElements();
stack.push(getSymbolFactory().startSymbol("START", 0, start_state()));
tos = 0;
for (_done_parsing = false; !_done_parsing; ) {
if (cur_token.used_by_parser)
throw new Error("Symbol recycling detected (fix your scanner).");
act = get_action(((Symbol) stack.peek()).parse_state, cur_token.sym);
if (act > 0) {
cur_token.parse_state = act - 1;
cur_token.used_by_parser = true;
stack.push(cur_token);
tos++;
cur_token = scan();
} else if (act < 0) {
lhs_sym = do_action((-act) - 1, this, stack, tos);
lhs_sym_num = production_tab[(-act) - 1][0];
handle_size = production_tab[(-act) - 1][1];
for (int i = 0; i < handle_size; i++) {
stack.pop();
tos--;
}
act = get_reduce(((Symbol) stack.peek()).parse_state, lhs_sym_num);
lhs_sym.parse_state = act;
lhs_sym.used_by_parser = true;
stack.push(lhs_sym);
tos++;
} else if (act == 0) {
syntax_error(cur_token);
if (!error_recovery(false)) {
unrecovered_syntax_error(cur_token);
done_parsing();
} else {
lhs_sym = (Symbol) stack.peek();
}
}
}
return lhs_sym;
}
|
<DeepExtract>
</DeepExtract>
<DeepExtract>
Symbol sym = getScanner().next_token();
return (sym != null) ? sym : getSymbolFactory().newSymbol("END_OF_FILE", EOF_sym());
</DeepExtract>
|
phantm
|
positive
|
public void testSkipAnalyzeReport() throws Exception {
doConfigTest("analyze-report", "plugin-" + "analyze-report" + "-config.xml");
}
|
<DeepExtract>
doConfigTest("analyze-report", "plugin-" + "analyze-report" + "-config.xml");
</DeepExtract>
|
maven-dependency-plugin
|
positive
|
protected boolean joinRoomInternal(String roomKey, String uid, PartnerListener partnerListener, PartnerDetectionListener partnerDetectionListener) {
if (app == null) {
return false;
}
roomRef = roomsListRef.child(roomKey);
partnersRef = roomRef.child(KEY_PARTICIPANTS);
Participant participant = new Participant(false, isPairing);
partnersRef.child(uid).setValue(participant);
onDisconnectRef = partnersRef.child(uid).onDisconnect();
onDisconnectRef.removeValue();
this.partnersListener = new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
Log.d(TAG, "PARTICIPANTS onChildAdded: " + dataSnapshot.getKey() + " " + dataSnapshot.getValue().toString());
String uid = dataSnapshot.getKey();
Participant partner = dataSnapshot.getValue(Participant.class);
if (!uid.equals(uid) && !partners.contains(uid)) {
partners.add(uid);
boolean partnerIsPairing = partner.getPairing() && pairingPartnerUid == null;
if (partnerIsPairing) {
isHost = uid.compareTo(uid) < 0;
pairingPartnerUid = uid;
}
if (partnerListener != null) {
partnerListener.onPartnerJoined(partnerIsPairing, isHost, partners.size() + 1);
}
}
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
Log.d(TAG, "PARTICIPANTS onChildChanged: " + dataSnapshot.getValue().toString());
String partnerUid = dataSnapshot.getKey();
if (partnerUid.equals(pairingPartnerUid)) {
Participant participant = dataSnapshot.getValue(Participant.class);
if (participant.getReadyToSetAnchor() && partnerListener != null) {
partnerListener.onPartnerReadyToSetAnchor(isHost);
} else if (participant.getAnchorResolved() && partnerListener != null && isHost) {
partnerListener.onPartnerAnchorResolved(isHost);
isHost = false;
isPairing = false;
pairingPartnerUid = null;
Participant toUpdate = new Participant(true, isPairing);
partnersRef.child(uid).setValue(toUpdate);
} else if (!participant.getPairing() && partnerListener != null) {
pairingPartnerUid = null;
partnerListener.onPartnerLeft(true, partners.size() + 1);
}
} else if (partnerUid.equals(uid) && !isHost) {
Participant participant = dataSnapshot.getValue(Participant.class);
if (participant.getAnchorResolved() && partnerListener != null) {
pairingPartnerUid = null;
partnerListener.onMyAnchorResolutionAcknowledged();
}
}
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
Log.d(TAG, "PARTICIPANTS onChildRemoved: " + dataSnapshot.getKey());
String uid = dataSnapshot.getKey();
for (String partnerUid : partners) {
if (uid.equals(partnerUid)) {
partners.remove(partnerUid);
break;
}
}
boolean wasPairingPartner = uid.equals(pairingPartnerUid);
if (wasPairingPartner) {
pairingPartnerUid = null;
}
if (partnerListener != null) {
partnerListener.onPartnerLeft(wasPairingPartner, partners.size() + 1);
}
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
Log.d(TAG, "PARTICIPANTS onChildMoved: " + dataSnapshot.getValue().toString());
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.d(TAG, "PARTICIPANTS onCancelled: ");
}
};
partnersRef.addChildEventListener(partnersListener);
if (uid == null || partnerDetectionListener == null) {
return;
}
if (partnersRef != null) {
partnersRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Iterator<DataSnapshot> it = dataSnapshot.getChildren().iterator();
while (it.hasNext()) {
DataSnapshot data = it.next();
String partnerUid = data.getKey();
if (!uid.equals(partnerUid)) {
partnerDetectionListener.onPartnersDetected();
return;
}
}
partnerDetectionListener.onNoPartnersDetected();
}
@Override
public void onCancelled(DatabaseError databaseError) {
partnerDetectionListener.onNoPartnersDetected();
}
});
} else {
partnerDetectionListener.onNoPartnersDetected();
}
return true;
}
|
<DeepExtract>
this.partnersListener = new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
Log.d(TAG, "PARTICIPANTS onChildAdded: " + dataSnapshot.getKey() + " " + dataSnapshot.getValue().toString());
String uid = dataSnapshot.getKey();
Participant partner = dataSnapshot.getValue(Participant.class);
if (!uid.equals(uid) && !partners.contains(uid)) {
partners.add(uid);
boolean partnerIsPairing = partner.getPairing() && pairingPartnerUid == null;
if (partnerIsPairing) {
isHost = uid.compareTo(uid) < 0;
pairingPartnerUid = uid;
}
if (partnerListener != null) {
partnerListener.onPartnerJoined(partnerIsPairing, isHost, partners.size() + 1);
}
}
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
Log.d(TAG, "PARTICIPANTS onChildChanged: " + dataSnapshot.getValue().toString());
String partnerUid = dataSnapshot.getKey();
if (partnerUid.equals(pairingPartnerUid)) {
Participant participant = dataSnapshot.getValue(Participant.class);
if (participant.getReadyToSetAnchor() && partnerListener != null) {
partnerListener.onPartnerReadyToSetAnchor(isHost);
} else if (participant.getAnchorResolved() && partnerListener != null && isHost) {
partnerListener.onPartnerAnchorResolved(isHost);
isHost = false;
isPairing = false;
pairingPartnerUid = null;
Participant toUpdate = new Participant(true, isPairing);
partnersRef.child(uid).setValue(toUpdate);
} else if (!participant.getPairing() && partnerListener != null) {
pairingPartnerUid = null;
partnerListener.onPartnerLeft(true, partners.size() + 1);
}
} else if (partnerUid.equals(uid) && !isHost) {
Participant participant = dataSnapshot.getValue(Participant.class);
if (participant.getAnchorResolved() && partnerListener != null) {
pairingPartnerUid = null;
partnerListener.onMyAnchorResolutionAcknowledged();
}
}
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
Log.d(TAG, "PARTICIPANTS onChildRemoved: " + dataSnapshot.getKey());
String uid = dataSnapshot.getKey();
for (String partnerUid : partners) {
if (uid.equals(partnerUid)) {
partners.remove(partnerUid);
break;
}
}
boolean wasPairingPartner = uid.equals(pairingPartnerUid);
if (wasPairingPartner) {
pairingPartnerUid = null;
}
if (partnerListener != null) {
partnerListener.onPartnerLeft(wasPairingPartner, partners.size() + 1);
}
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
Log.d(TAG, "PARTICIPANTS onChildMoved: " + dataSnapshot.getValue().toString());
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.d(TAG, "PARTICIPANTS onCancelled: ");
}
};
partnersRef.addChildEventListener(partnersListener);
</DeepExtract>
<DeepExtract>
if (uid == null || partnerDetectionListener == null) {
return;
}
if (partnersRef != null) {
partnersRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Iterator<DataSnapshot> it = dataSnapshot.getChildren().iterator();
while (it.hasNext()) {
DataSnapshot data = it.next();
String partnerUid = data.getKey();
if (!uid.equals(partnerUid)) {
partnerDetectionListener.onPartnersDetected();
return;
}
}
partnerDetectionListener.onNoPartnersDetected();
}
@Override
public void onCancelled(DatabaseError databaseError) {
partnerDetectionListener.onNoPartnersDetected();
}
});
} else {
partnerDetectionListener.onNoPartnersDetected();
}
</DeepExtract>
|
justaline-android
|
positive
|
public final HttpBody getHttpBody() {
return null;
}
|
<DeepExtract>
return null;
</DeepExtract>
|
android-lite-http
|
positive
|
@Override
public void onClick(DialogInterface dialog, int which) {
StringBuilder startup, shutdown;
boolean isStartup;
BufferedReader reader;
if (DBG)
Log.v(TAG, "download file " + ASSETS_PATH_COMMANDS + "/" + mFiles[which]);
startup = new StringBuilder();
shutdown = new StringBuilder();
isStartup = true;
reader = null;
try {
String s;
reader = new BufferedReader(new InputStreamReader(getAssets().open(ASSETS_PATH_COMMANDS + "/" + mFiles[which])));
while ((s = reader.readLine()) != null) {
if (s.equals("@")) {
isStartup = false;
continue;
}
if (isStartup) {
startup.append(s).append('\n');
} else {
shutdown.append(s).append('\n');
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (reader != null)
reader.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
mSendCommandsAtStartupView.setChecked(startup.length() > 0);
mCommandsAtStartupView.setEnabled(mSendCommandsAtStartupView.isChecked());
mCommandsAtStartupView.setText(startup);
mSendCommandsAtShutdownView.setChecked(shutdown.length() > 0);
mCommandsAtShutdownView.setEnabled(mSendCommandsAtShutdownView.isChecked());
mCommandsAtShutdownView.setText(shutdown);
dismiss();
}
|
<DeepExtract>
StringBuilder startup, shutdown;
boolean isStartup;
BufferedReader reader;
if (DBG)
Log.v(TAG, "download file " + ASSETS_PATH_COMMANDS + "/" + mFiles[which]);
startup = new StringBuilder();
shutdown = new StringBuilder();
isStartup = true;
reader = null;
try {
String s;
reader = new BufferedReader(new InputStreamReader(getAssets().open(ASSETS_PATH_COMMANDS + "/" + mFiles[which])));
while ((s = reader.readLine()) != null) {
if (s.equals("@")) {
isStartup = false;
continue;
}
if (isStartup) {
startup.append(s).append('\n');
} else {
shutdown.append(s).append('\n');
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (reader != null)
reader.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
mSendCommandsAtStartupView.setChecked(startup.length() > 0);
mCommandsAtStartupView.setEnabled(mSendCommandsAtStartupView.isChecked());
mCommandsAtStartupView.setText(startup);
mSendCommandsAtShutdownView.setChecked(shutdown.length() > 0);
mCommandsAtShutdownView.setEnabled(mSendCommandsAtShutdownView.isChecked());
mCommandsAtShutdownView.setText(shutdown);
</DeepExtract>
|
RtkGps
|
positive
|
@Override
public CompletableFuture<Subscription> subscribe(String topic, BiConsumer<List<Object>, EventDetails> handler) {
throwIfNotConnected();
CompletableFuture<Subscription> future = new CompletableFuture<>();
long requestID = mIDGenerator.next();
mSubscribeRequests.put(requestID, new SubscribeRequest(requestID, topic, future, null, null, handler));
send(new Subscribe(requestID, null, topic));
return future;
}
|
<DeepExtract>
throwIfNotConnected();
CompletableFuture<Subscription> future = new CompletableFuture<>();
long requestID = mIDGenerator.next();
mSubscribeRequests.put(requestID, new SubscribeRequest(requestID, topic, future, null, null, handler));
send(new Subscribe(requestID, null, topic));
return future;
</DeepExtract>
|
autobahn-java
|
positive
|
@Test
@SmallTest
public void testSetLocalOfferMakesVideoFlowLocally() throws InterruptedException {
Log.d(TAG, "testSetLocalOfferMakesVideoFlowLocally");
MockSink localRenderer = new MockSink(EXPECTED_VIDEO_FRAMES, LOCAL_RENDERER_NAME);
List<PeerConnection.IceServer> iceServers = new ArrayList<>();
SignalingParameters signalingParameters = new SignalingParameters(iceServers, true, null, null, null, null, null);
final EglBase eglBase = EglBase.create();
PeerConnectionClient client = new PeerConnectionClient(InstrumentationRegistry.getTargetContext(), eglBase, createParametersForVideoCall(VIDEO_CODEC_VP8), this);
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
options.networkIgnoreMask = 0;
options.disableNetworkMonitor = true;
client.createPeerConnectionFactory(options);
client.createPeerConnection(localRenderer, new MockRenderer(0, null), createCameraCapturer(false), signalingParameters);
client.createOffer();
return client;
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
assertTrue("ICE candidates were not generated.", waitForIceCandidates(WAIT_TIMEOUT));
assertTrue("Local video frames were not rendered.", localRenderer.waitForFramesRendered(WAIT_TIMEOUT));
pcClient.close();
assertTrue("PeerConnection close event was not received.", waitForPeerConnectionClosed(WAIT_TIMEOUT));
Log.d(TAG, "testSetLocalOfferMakesVideoFlowLocally Done.");
}
|
<DeepExtract>
List<PeerConnection.IceServer> iceServers = new ArrayList<>();
SignalingParameters signalingParameters = new SignalingParameters(iceServers, true, null, null, null, null, null);
final EglBase eglBase = EglBase.create();
PeerConnectionClient client = new PeerConnectionClient(InstrumentationRegistry.getTargetContext(), eglBase, createParametersForVideoCall(VIDEO_CODEC_VP8), this);
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
options.networkIgnoreMask = 0;
options.disableNetworkMonitor = true;
client.createPeerConnectionFactory(options);
client.createPeerConnection(localRenderer, new MockRenderer(0, null), createCameraCapturer(false), signalingParameters);
client.createOffer();
return client;
</DeepExtract>
|
glass-enterprise-samples
|
positive
|
public void mouseClicked(java.awt.event.MouseEvent evt) {
if (curPetDetail != null) {
String u1 = curPetDetail.u_name + " (Fire)";
String p2 = SwManager.petFamily.get(u1);
if (p2 != null) {
LoadPetDetail(p2);
}
}
}
|
<DeepExtract>
if (curPetDetail != null) {
String u1 = curPetDetail.u_name + " (Fire)";
String p2 = SwManager.petFamily.get(u1);
if (p2 != null) {
LoadPetDetail(p2);
}
}
</DeepExtract>
|
sw_optimize
|
positive
|
@Override
protected final void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
onSetContentView();
mToolBar = onFindToolBarView();
setSupportActionBar(mToolBar);
mActionBar = getSupportActionBar();
onFindViews();
onBindContent();
}
|
<DeepExtract>
</DeepExtract>
<DeepExtract>
</DeepExtract>
|
LightUtils
|
positive
|
@Test
public void selection() throws Exception {
Iterable<Integer> it = () -> new Iterator<Integer>() {
private int[] a = new int[] { 1, 2, 3 };
private int index = 0;
@Override
public boolean hasNext() {
return index < a.length;
}
@Override
public Integer next() {
return a[index++];
}
};
Tmp tmp = new Tmp();
o = it;
StandardEvaluationContext context = new StandardEvaluationContext(tmp);
ArrayList<Integer> list = parser.parseExpression("o.?[true]").getValue(context, ArrayList.class);
Assert.assertEquals(list, Lists.newArrayList(1, 2, 3));
}
|
<DeepExtract>
o = it;
</DeepExtract>
|
syncer
|
positive
|
public void errorSave(Order newOrder) throws HibernateException {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.save(newOrder);
session.flush();
return newOrder;
session.flush();
throw new HibernateException("error save");
}
|
<DeepExtract>
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.save(newOrder);
session.flush();
return newOrder;
</DeepExtract>
|
zkbooks
|
positive
|
public void print(char c, int width, int fill) {
int oldw = width;
width = width;
return oldw;
int oldf = fill;
fill = fill;
return oldf;
print(c);
width = 0;
precision = 4;
fill = ' ';
jstyle = Format.STANDARD;
}
|
<DeepExtract>
int oldw = width;
width = width;
return oldw;
</DeepExtract>
<DeepExtract>
int oldf = fill;
fill = fill;
return oldf;
</DeepExtract>
<DeepExtract>
width = 0;
precision = 4;
fill = ' ';
jstyle = Format.STANDARD;
</DeepExtract>
|
programmingIT
|
positive
|
@Override
public ZSetEntry next() {
return map.get(min++);
}
|
<DeepExtract>
return map.get(min++);
</DeepExtract>
|
redis-protocol
|
positive
|
public Criteria andAddressBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "address" + " cannot be null");
}
criteria.add(new Criterion("address between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "address" + " cannot be null");
}
criteria.add(new Criterion("address between", value1, value2));
</DeepExtract>
|
Whome
|
positive
|
public void methodAA() {
}
|
<DeepExtract>
</DeepExtract>
<DeepExtract>
</DeepExtract>
<DeepExtract>
</DeepExtract>
|
WS18Computer
|
positive
|
public static final String toShortDateGBKString(Date aDate) {
if (aDate == null) {
return "";
} else {
Assert.hasText("yyyy\u5E74MM\u6708dd\u65E5");
return (new SimpleDateFormat("yyyy\u5E74MM\u6708dd\u65E5")).format(aDate);
}
}
|
<DeepExtract>
if (aDate == null) {
return "";
} else {
Assert.hasText("yyyy\u5E74MM\u6708dd\u65E5");
return (new SimpleDateFormat("yyyy\u5E74MM\u6708dd\u65E5")).format(aDate);
}
</DeepExtract>
|
pc5s
|
positive
|
@Override
public View getView(int arg0, View convertView, ViewGroup arg2) {
if (convertView == null) {
convertView = (RelativeLayout) MainActivity.inflater.inflate(R.layout.bookmark_item, null);
holder = new ViewHolder();
holder.title = ((TextView) (convertView.findViewById(R.id.bookmark_title)));
holder.url = ((TextView) (convertView.findViewById(R.id.bookmark_url_title)));
holder.icon = ((ImageView) convertView.findViewById(R.id.bookmark_icon));
holder.url.setTag(holder);
} else {
holder = (ViewHolder) ((TextView) (convertView.findViewById(R.id.bookmark_url_title))).getTag();
if (((Boolean) holder.icon.getTag()) != null && holder.url.getText() != null && ((Boolean) holder.icon.getTag()) == true && holder.url.getText().equals(bookmarks.get(arg0).getUrl()) && holder.title.getText().toString().equals(bookmarks.get(arg0).getDisplayName())) {
return convertView;
}
}
if (Properties.appProp.darkTheme) {
holder.title.setTextColor(Color.WHITE);
holder.url.setTextColor(Color.WHITE);
} else {
}
Bookmark bookmark = bookmarks.get(arg0);
String bookmarkTitle = bookmark.getDisplayName();
String bookmarkURL = bookmark.getUrl();
boolean hasFavicon;
if (bookmark.getPathToFavicon() == null) {
hasFavicon = false;
} else {
hasFavicon = true;
}
holder.title.setText(bookmarkTitle);
if (bookmarkURL.equals(Properties.webpageProp.assetHomePage)) {
holder.title.setText("about:home");
if (!Properties.appProp.darkTheme)
holder.icon.setColorFilter(Color.BLACK);
holder.icon.setImageResource(R.drawable.ic_collections_view_as_list);
} else {
((TextView) convertView.findViewById(R.id.bookmark_url_title)).setText(bookmarkURL);
if (hasFavicon) {
try {
holder.icon.setColorFilter(null);
holder.icon.setTag(true);
holder.icon.setImageBitmap(bookmark.getIconBitmap());
} catch (Exception e) {
}
} else {
if (!Properties.appProp.darkTheme)
holder.icon.setColorFilter(Color.BLACK);
holder.icon.setTag(false);
holder.icon.setImageResource(R.drawable.ic_collections_view_as_list);
}
}
convertView.setTag(bookmark);
return convertView;
}
|
<DeepExtract>
boolean hasFavicon;
if (bookmark.getPathToFavicon() == null) {
hasFavicon = false;
} else {
hasFavicon = true;
}
</DeepExtract>
|
Lucid-Browser
|
positive
|
public void onPageVisible() {
callFunction("Rexxar.Lifecycle.onPageVisible", null);
}
|
<DeepExtract>
callFunction("Rexxar.Lifecycle.onPageVisible", null);
</DeepExtract>
|
rexxar-android
|
positive
|
public void restoreState() {
if (false)
setup_progress_bar_limit.setVisibility(View.VISIBLE);
else
setup_progress_bar_limit.setVisibility(View.GONE);
getBtnForward().setEnabled(true);
Utils.setImageWithTint(getBtnForward(), R.drawable.ic_chevron_left_black_24dp, Color.DKGRAY);
getBtnNext().setEnabled(true);
getBtnNext().setTextColor(Color.DKGRAY);
getBtnNext().setCompoundDrawablesRelative(null, null, Utils.getTintedDrawable(this, R.drawable.ic_chevron_right_black_24dp, Color.DKGRAY), null);
}
|
<DeepExtract>
if (false)
setup_progress_bar_limit.setVisibility(View.VISIBLE);
else
setup_progress_bar_limit.setVisibility(View.GONE);
</DeepExtract>
|
audiohq_md2
|
positive
|
@Override
public void done(Object response) {
callback.done(response);
if (RpcResult.class.isInstance(response)) {
RpcResult rpcResult = (RpcResult) response;
Map<String, String> ns = rpcResult.getNotifications();
if (ns != null && ns.size() > 0) {
Notifications.set(ns);
}
if (CompileConfig.isDebug) {
if (ns != null) {
StringBuilder sb = new StringBuilder("got async notifications ----> ");
for (Map.Entry<String, String> entry : ns.entrySet()) {
sb.append(entry.getKey()).append(":").append(entry.getValue()).append("; ");
}
logger.info(sb.toString());
} else {
logger.info("got async notificaion: null");
}
}
}
}
|
<DeepExtract>
if (RpcResult.class.isInstance(response)) {
RpcResult rpcResult = (RpcResult) response;
Map<String, String> ns = rpcResult.getNotifications();
if (ns != null && ns.size() > 0) {
Notifications.set(ns);
}
if (CompileConfig.isDebug) {
if (ns != null) {
StringBuilder sb = new StringBuilder("got async notifications ----> ");
for (Map.Entry<String, String> entry : ns.entrySet()) {
sb.append(entry.getKey()).append(":").append(entry.getValue()).append("; ");
}
logger.info(sb.toString());
} else {
logger.info("got async notificaion: null");
}
}
}
</DeepExtract>
|
net.pocrd.core
|
positive
|
private static int[] parseIds(String url) throws Exception {
int[] ids = new int[2];
String dest = "";
if (url.split(new String("&image="))[0] != null) {
dest = url.split(new String("&image="))[0].replaceAll("[^0-9]", "");
}
return Integer.valueOf(dest);
String dest = "";
if (url.split(new String("&image="))[1] != null) {
dest = url.split(new String("&image="))[1].replaceAll("[^0-9]", "");
}
return Integer.valueOf(dest);
return ids;
}
|
<DeepExtract>
String dest = "";
if (url.split(new String("&image="))[0] != null) {
dest = url.split(new String("&image="))[0].replaceAll("[^0-9]", "");
}
return Integer.valueOf(dest);
</DeepExtract>
<DeepExtract>
String dest = "";
if (url.split(new String("&image="))[1] != null) {
dest = url.split(new String("&image="))[1].replaceAll("[^0-9]", "");
}
return Integer.valueOf(dest);
</DeepExtract>
|
FingerColoring-Android
|
positive
|
@Override
public List<SysRelation> getRelationListByObjectId(String objectId) {
LambdaQueryWrapper<SysRelation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SysRelation::getObjectId, objectId);
if (ObjectUtil.isNotEmpty(null)) {
lambdaQueryWrapper.eq(SysRelation::getCategory, null);
}
return this.list(lambdaQueryWrapper);
}
|
<DeepExtract>
LambdaQueryWrapper<SysRelation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SysRelation::getObjectId, objectId);
if (ObjectUtil.isNotEmpty(null)) {
lambdaQueryWrapper.eq(SysRelation::getCategory, null);
}
return this.list(lambdaQueryWrapper);
</DeepExtract>
|
xiaonuo-vue
|
positive
|
public double Frechet(List<T> t1, List<T> t2) {
double[][] ca = new double[t2.size()][t1.size()];
for (int i = 0; i < t2.size(); ++i) {
for (int j = 0; j < t1.size(); ++j) {
ca[i][j] = -1.0D;
}
}
if (ca[t2.size() - 1][t1.size() - 1] > -1.0D)
return ca[t2.size() - 1][t1.size() - 1];
if (t2.size() - 1 == 0 && t1.size() - 1 == 0) {
ca[t2.size() - 1][t1.size() - 1] = distFunc.apply(t1.get(0), t2.get(0));
} else if (t1.size() - 1 == 0) {
ca[t2.size() - 1][t1.size() - 1] = Math.max(c(t2.size() - 1 - 1, 0, ca, t1, t2), distFunc.apply(t2.get(t2.size() - 1), t1.get(0)));
} else if (t2.size() - 1 == 0) {
ca[t2.size() - 1][t1.size() - 1] = Math.max(c(0, t1.size() - 1 - 1, ca, t1, t2), distFunc.apply(t2.get(0), t1.get(t1.size() - 1)));
} else {
ca[t2.size() - 1][t1.size() - 1] = Math.max(Math.min(Math.min(c(t2.size() - 1 - 1, t1.size() - 1, ca, t1, t2), c(t2.size() - 1 - 1, t1.size() - 1 - 1, ca, t1, t2)), c(t2.size() - 1, t1.size() - 1 - 1, ca, t1, t2)), distFunc.apply(t2.get(t2.size() - 1), t1.get(t1.size() - 1)));
}
return ca[t2.size() - 1][t1.size() - 1];
}
|
<DeepExtract>
if (ca[t2.size() - 1][t1.size() - 1] > -1.0D)
return ca[t2.size() - 1][t1.size() - 1];
if (t2.size() - 1 == 0 && t1.size() - 1 == 0) {
ca[t2.size() - 1][t1.size() - 1] = distFunc.apply(t1.get(0), t2.get(0));
} else if (t1.size() - 1 == 0) {
ca[t2.size() - 1][t1.size() - 1] = Math.max(c(t2.size() - 1 - 1, 0, ca, t1, t2), distFunc.apply(t2.get(t2.size() - 1), t1.get(0)));
} else if (t2.size() - 1 == 0) {
ca[t2.size() - 1][t1.size() - 1] = Math.max(c(0, t1.size() - 1 - 1, ca, t1, t2), distFunc.apply(t2.get(0), t1.get(t1.size() - 1)));
} else {
ca[t2.size() - 1][t1.size() - 1] = Math.max(Math.min(Math.min(c(t2.size() - 1 - 1, t1.size() - 1, ca, t1, t2), c(t2.size() - 1 - 1, t1.size() - 1 - 1, ca, t1, t2)), c(t2.size() - 1, t1.size() - 1 - 1, ca, t1, t2)), distFunc.apply(t2.get(t2.size() - 1), t1.get(t1.size() - 1)));
}
return ca[t2.size() - 1][t1.size() - 1];
</DeepExtract>
|
torchtrajectory
|
positive
|
private void init() {
CharSequence t = getTitle();
if (t == null || t.length() <= 0)
setTitle(R.string.filter_cat);
sum = getSummary();
if (sum == null || sum.length() <= 0)
sum = A.s(R.string.filter_sum);
setSummary(sum + " (" + A.s(A.is(filterKey()) ? R.string.active : R.string.inactive) + ')');
setPersistent(false);
setWidgetLayoutResource(R.layout.img_call);
setOnPreferenceClickListener(this);
}
|
<DeepExtract>
setSummary(sum + " (" + A.s(A.is(filterKey()) ? R.string.active : R.string.inactive) + ')');
</DeepExtract>
|
sanity
|
positive
|
public void setPositionAndScaleMatrix(Matrix matrix) {
final float[] values = new float[9];
matrix.getValues(values);
float scale = values[Matrix.MSCALE_X];
horizontalScrollRange = (int) (mapScheme.getWidth() * scale);
verticalScrollRange = (int) (mapScheme.getHeight() * scale);
horizontalScrollOffset = (int) -values[Matrix.MTRANS_X];
verticalScrollOffset = (int) -values[Matrix.MTRANS_Y];
awakeScrollBars();
renderer.setMatrix(matrix);
viewportChangedListener.onViewportChanged(matrix);
}
|
<DeepExtract>
final float[] values = new float[9];
matrix.getValues(values);
float scale = values[Matrix.MSCALE_X];
horizontalScrollRange = (int) (mapScheme.getWidth() * scale);
verticalScrollRange = (int) (mapScheme.getHeight() * scale);
horizontalScrollOffset = (int) -values[Matrix.MTRANS_X];
verticalScrollOffset = (int) -values[Matrix.MTRANS_Y];
awakeScrollBars();
</DeepExtract>
|
ametro
|
positive
|
@Override
protected void writeMonkeyRunnerCommand() {
int oldVal = target.getValue();
int max = target.getMax();
if (targetVal == -1 || targetVal >= max || targetVal < 0) {
targetVal = ACInstrumentation.getSelf().random.nextInt(max);
}
if (touchX == -1) {
GetLocationRunnable glr = new GetLocationRunnable(target);
instrumenter.runOnMainSync(glr);
if (glr.visible) {
touchX = glr.pos_x + glr.paddingLeft + (glr.width - glr.paddingLeft - glr.paddingRight) * targetVal / target.getMax();
touchY = glr.pos_y;
}
}
GetLocationRunnable glr = new GetLocationRunnable(target);
instrumenter.runOnMainSync(glr);
if (glr.visible) {
int step = (android.os.Build.VERSION.SDK_INT <= 15) ? 1 : -1;
for (int i = oldVal; (i - targetVal) * step < 0; i += step) {
monkeyRunnerGenerator.touch(glr.pos_x, glr.pos_y, monkeyRunnerGenerator.DOWN_AND_UP, 1);
}
for (int i = oldVal; (i - targetVal) * step > 0; i -= step) {
monkeyRunnerGenerator.touch(glr.pos_x, glr.pos_y + glr.height - 2, monkeyRunnerGenerator.DOWN_AND_UP, 1);
}
} else {
monkeyRunnerGenerator.prompt(String.format("Please set the number picker to %d, and then press Enter to continue...", targetVal));
}
}
|
<DeepExtract>
int max = target.getMax();
if (targetVal == -1 || targetVal >= max || targetVal < 0) {
targetVal = ACInstrumentation.getSelf().random.nextInt(max);
}
if (touchX == -1) {
GetLocationRunnable glr = new GetLocationRunnable(target);
instrumenter.runOnMainSync(glr);
if (glr.visible) {
touchX = glr.pos_x + glr.paddingLeft + (glr.width - glr.paddingLeft - glr.paddingRight) * targetVal / target.getMax();
touchY = glr.pos_y;
}
}
</DeepExtract>
|
appdoctor
|
positive
|
public String flushQiniuToken(String spaceName) throws Exception {
String currentToken = null;
if (ValidationUtil.isEmpty(currentToken)) {
currentToken = this.getAuth().uploadToken(spaceName);
}
return currentToken;
}
|
<DeepExtract>
String currentToken = null;
if (ValidationUtil.isEmpty(currentToken)) {
currentToken = this.getAuth().uploadToken(spaceName);
}
return currentToken;
</DeepExtract>
|
tyboot
|
positive
|
public Jar addEntry(String path, byte[] content) throws IOException {
verifyNotSealed();
if (jos != null)
return;
if (os == null)
this.os = new ByteArrayOutputStream();
writePrefix(os);
if (getAttribute(ATTR_MANIFEST_VERSION) == null)
setAttribute(ATTR_MANIFEST_VERSION, "1.0");
jos = new JarOutputStream(os, manifest);
if (jis != null)
addEntries(null, jis);
addEntry(jos, path, content);
return this;
}
|
<DeepExtract>
verifyNotSealed();
if (jos != null)
return;
if (os == null)
this.os = new ByteArrayOutputStream();
writePrefix(os);
if (getAttribute(ATTR_MANIFEST_VERSION) == null)
setAttribute(ATTR_MANIFEST_VERSION, "1.0");
jos = new JarOutputStream(os, manifest);
if (jis != null)
addEntries(null, jis);
</DeepExtract>
|
capsule
|
positive
|
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
setBackView();
setTitle("新用户注册");
username = (EditText) findViewById(R.id.username);
password = (EditText) findViewById(R.id.password);
passwordConfirm = (EditText) findViewById(R.id.passwordConfirm);
imageView = (ImageView) findViewById(R.id.image);
imageView.setOnClickListener(this);
findViewById(R.id.register).setOnClickListener(this);
dialog = new LoadingDialog(this);
dialog.setCanceledOnTouchOutside(false);
setRightImage(R.drawable.icon_select, new View.OnClickListener() {
@Override
public void onClick(View view) {
register();
}
});
viewPart = findViewById(R.id.view_part);
password.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Rect r = new Rect();
RegestActivity.this.getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
int screenHeight = RegestActivity.this.getWindow().getDecorView().getRootView().getHeight();
int heightDifference = screenHeight - r.bottom;
if (heightDifference > 0) {
viewPart.setTranslationY(-60);
} else {
viewPart.setTranslationY(60);
}
}
});
}
|
<DeepExtract>
username = (EditText) findViewById(R.id.username);
password = (EditText) findViewById(R.id.password);
passwordConfirm = (EditText) findViewById(R.id.passwordConfirm);
imageView = (ImageView) findViewById(R.id.image);
imageView.setOnClickListener(this);
findViewById(R.id.register).setOnClickListener(this);
dialog = new LoadingDialog(this);
dialog.setCanceledOnTouchOutside(false);
setRightImage(R.drawable.icon_select, new View.OnClickListener() {
@Override
public void onClick(View view) {
register();
}
});
viewPart = findViewById(R.id.view_part);
password.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Rect r = new Rect();
RegestActivity.this.getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
int screenHeight = RegestActivity.this.getWindow().getDecorView().getRootView().getHeight();
int heightDifference = screenHeight - r.bottom;
if (heightDifference > 0) {
viewPart.setTranslationY(-60);
} else {
viewPart.setTranslationY(60);
}
}
});
</DeepExtract>
|
Android-rxjava-retrofit-okhttp-app
|
positive
|
private void initializeStreamIfNeeded() {
if (null != parser) {
return;
}
time = min.minusHours(1);
Path file;
do {
time = time.plusHours(1);
if (time.compareTo(max) > 0) {
throw new NoSuchElementException();
}
file = Paths.get(historyFolder, fileName(client, pair, time));
} while (!file.toFile().exists());
parser = new CSVParser(new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(file.toFile())))), CSVFormat.MYSQL.withFirstRecordAsHeader());
recordIterator = parser.iterator();
}
|
<DeepExtract>
Path file;
do {
time = time.plusHours(1);
if (time.compareTo(max) > 0) {
throw new NoSuchElementException();
}
file = Paths.get(historyFolder, fileName(client, pair, time));
} while (!file.toFile().exists());
parser = new CSVParser(new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(file.toFile())))), CSVFormat.MYSQL.withFirstRecordAsHeader());
recordIterator = parser.iterator();
</DeepExtract>
|
GTC-all-repo
|
positive
|
public void dropTable(Class<?> clazz) {
if (!tableIsExist(TableInfo.get(clazz))) {
String sql = SqlBuilder.getCreatTableSQL(clazz);
debugSql(sql);
db.execSQL(sql);
}
TableInfo table = TableInfo.get(clazz);
String sql = "DROP TABLE " + table.getTableName();
if (config != null && config.isDebug())
Log.d("Debug SQL", ">>>>>> " + sql);
db.execSQL(sql);
table.setCheckDatabese(false);
}
|
<DeepExtract>
if (!tableIsExist(TableInfo.get(clazz))) {
String sql = SqlBuilder.getCreatTableSQL(clazz);
debugSql(sql);
db.execSQL(sql);
}
</DeepExtract>
<DeepExtract>
if (config != null && config.isDebug())
Log.d("Debug SQL", ">>>>>> " + sql);
</DeepExtract>
|
JJEvent
|
positive
|
private void readZrlePalette(int[] palette, int palSize) throws Exception {
if (bytesPerPixel == 1) {
if (palSize > readPixelsBuffer.length) {
readPixelsBuffer = new byte[palSize];
}
zrleInStream.readBytes(readPixelsBuffer, 0, palSize);
for (int i = 0; i < palSize; i++) {
palette[i] = (int) readPixelsBuffer[i] & 0xFF;
}
} else {
final int l = palSize * 3;
if (l > readPixelsBuffer.length) {
readPixelsBuffer = new byte[l];
}
zrleInStream.readBytes(readPixelsBuffer, 0, l);
for (int i = 0; i < palSize; i++) {
final int idx = i * 3;
palette[i] = ((readPixelsBuffer[idx + 2] & 0xFF) << 16 | (readPixelsBuffer[idx + 1] & 0xFF) << 8 | (readPixelsBuffer[idx] & 0xFF));
}
}
}
|
<DeepExtract>
if (bytesPerPixel == 1) {
if (palSize > readPixelsBuffer.length) {
readPixelsBuffer = new byte[palSize];
}
zrleInStream.readBytes(readPixelsBuffer, 0, palSize);
for (int i = 0; i < palSize; i++) {
palette[i] = (int) readPixelsBuffer[i] & 0xFF;
}
} else {
final int l = palSize * 3;
if (l > readPixelsBuffer.length) {
readPixelsBuffer = new byte[l];
}
zrleInStream.readBytes(readPixelsBuffer, 0, l);
for (int i = 0; i < palSize; i++) {
final int idx = i * 3;
palette[i] = ((readPixelsBuffer[idx + 2] & 0xFF) << 16 | (readPixelsBuffer[idx + 1] & 0xFF) << 8 | (readPixelsBuffer[idx] & 0xFF));
}
}
</DeepExtract>
|
androidVNC
|
positive
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.