before
stringlengths 12
3.76M
| after
stringlengths 37
3.84M
| repo
stringlengths 1
56
| type
stringclasses 1
value |
|---|---|---|---|
@Override
public void onCreate(final Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.prefs_screen_preferences);
final Resources res = getResources();
final Context context = getActivity();
RichInputMethodManager.init(context);
if (!AudioAndHapticFeedbackManager.getInstance().hasVibrator()) {
removePreference(Settings.PREF_VIBRATE_ON);
}
if (!Settings.readFromBuildConfigIfToShowKeyPreviewPopupOption(res)) {
removePreference(Settings.PREF_POPUP_ON);
}
final SharedPreferences prefs = getSharedPreferences();
final Resources res = getResources();
setPreferenceEnabled(Settings.PREF_VIBRATION_DURATION_SETTINGS, Settings.readVibrationEnabled(prefs, res));
setPreferenceEnabled(Settings.PREF_KEYPRESS_SOUND_VOLUME, Settings.readKeypressSoundEnabled(prefs, res));
}
|
<DeepExtract>
final SharedPreferences prefs = getSharedPreferences();
final Resources res = getResources();
setPreferenceEnabled(Settings.PREF_VIBRATION_DURATION_SETTINGS, Settings.readVibrationEnabled(prefs, res));
setPreferenceEnabled(Settings.PREF_KEYPRESS_SOUND_VOLUME, Settings.readKeypressSoundEnabled(prefs, res));
</DeepExtract>
|
shotdroid
|
positive
|
public static boolean arg(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "arg"))
return false;
if (!nextTokenIs(b, "<arg>", ARG_START, DYNAMIC_ARG_START))
return false;
Marker m = enter_section_(b, l, _NONE_, ARG, "<arg>");
if (!recursion_guard_(b, l + 1, "dynamicArg"))
r = false;
if (!nextTokenIs(b, DYNAMIC_ARG_START))
r = false;
boolean r;
Marker m = enter_section_(b);
r = consumeTokens(b, 0, DYNAMIC_ARG_START, DYNAMIC_ARG, DYNAMIC_ARG_END);
exit_section_(b, m, DYNAMIC_ARG, r);
return r;
if (!r)
r = staticArg(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
|
<DeepExtract>
if (!recursion_guard_(b, l + 1, "dynamicArg"))
r = false;
if (!nextTokenIs(b, DYNAMIC_ARG_START))
r = false;
boolean r;
Marker m = enter_section_(b);
r = consumeTokens(b, 0, DYNAMIC_ARG_START, DYNAMIC_ARG, DYNAMIC_ARG_END);
exit_section_(b, m, DYNAMIC_ARG, r);
return r;
</DeepExtract>
|
Intellij-Plugin
|
positive
|
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (geo == null) {
geo = app.startGeo(activity, geoUpdate, base, settings, warning, 0, 0);
}
EditText latitudeEdit = (EditText) findViewById(R.id.latitude);
latitudeEdit.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int i, KeyEvent k) {
changed = true;
return false;
}
});
EditText longitudeEdit = (EditText) findViewById(R.id.longitude);
longitudeEdit.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int i, KeyEvent k) {
changed = true;
return false;
}
});
if (prefs.contains("anylatitude") == true && prefs.contains("anylongitude") == true) {
latitudeEdit.setText(base.formatCoordinate(new Double(prefs.getFloat("anylatitude", 0f)), "lat", true));
longitudeEdit.setText(base.formatCoordinate(new Double(prefs.getFloat("anylongitude", 0f)), "lon", true));
}
Button buttonCurrent = (Button) findViewById(R.id.current);
buttonCurrent.setOnClickListener(new currentListener());
}
|
<DeepExtract>
if (geo == null) {
geo = app.startGeo(activity, geoUpdate, base, settings, warning, 0, 0);
}
EditText latitudeEdit = (EditText) findViewById(R.id.latitude);
latitudeEdit.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int i, KeyEvent k) {
changed = true;
return false;
}
});
EditText longitudeEdit = (EditText) findViewById(R.id.longitude);
longitudeEdit.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int i, KeyEvent k) {
changed = true;
return false;
}
});
if (prefs.contains("anylatitude") == true && prefs.contains("anylongitude") == true) {
latitudeEdit.setText(base.formatCoordinate(new Double(prefs.getFloat("anylatitude", 0f)), "lat", true));
longitudeEdit.setText(base.formatCoordinate(new Double(prefs.getFloat("anylongitude", 0f)), "lon", true));
}
Button buttonCurrent = (Button) findViewById(R.id.current);
buttonCurrent.setOnClickListener(new currentListener());
</DeepExtract>
|
c-geo
|
positive
|
public void appendAndSkip(Song song) {
mSongs.add(mSongs.size(), song);
mPlayheadPosition = mSongs.size();
if (mSongs.size() > 0) {
if (getPlayheadPosition() == -1) {
setPlayheadPosition(1);
}
if (mCurrentSongWas == null || mCurrentSongWas != getNowPlaying()) {
currentSongChanged(false);
}
if (mSongs.size() > 1) {
if (mNextSongWas == null || mNextSongWas != getNextSong()) {
nextSongChanged(true);
}
} else if (mNextSongWas != null) {
nextSongChanged(true);
}
} else {
if (mCurrentSongWas != null) {
currentSongChanged(false);
}
if (mNextSongWas != null) {
nextSongChanged(true);
}
}
}
|
<DeepExtract>
mPlayheadPosition = mSongs.size();
</DeepExtract>
<DeepExtract>
if (mSongs.size() > 0) {
if (getPlayheadPosition() == -1) {
setPlayheadPosition(1);
}
if (mCurrentSongWas == null || mCurrentSongWas != getNowPlaying()) {
currentSongChanged(false);
}
if (mSongs.size() > 1) {
if (mNextSongWas == null || mNextSongWas != getNextSong()) {
nextSongChanged(true);
}
} else if (mNextSongWas != null) {
nextSongChanged(true);
}
} else {
if (mCurrentSongWas != null) {
currentSongChanged(false);
}
if (mNextSongWas != null) {
nextSongChanged(true);
}
}
</DeepExtract>
|
cordova-plugin-playerhater
|
positive
|
@Override
public void refreshParameterValue() {
String paramValue = System.getProperty(this.paramName);
paramValue = isSystemParameterEmpty(paramValue) ? this.defaultValue : paramValue.toLowerCase();
;
switch(this.name()) {
case "BROWSER":
if (paramValue.equals("ie")) {
paramValue = "internet explorer";
}
break;
case "BROWSER_VERSION":
break;
case "SELENIUM_GRID":
break;
case "OS":
break;
default:
BFLogger.logError("Unknown RuntimeParameter = " + this.name());
break;
}
this.paramValue = paramValue;
}
|
<DeepExtract>
String paramValue = System.getProperty(this.paramName);
paramValue = isSystemParameterEmpty(paramValue) ? this.defaultValue : paramValue.toLowerCase();
;
switch(this.name()) {
case "BROWSER":
if (paramValue.equals("ie")) {
paramValue = "internet explorer";
}
break;
case "BROWSER_VERSION":
break;
case "SELENIUM_GRID":
break;
case "OS":
break;
default:
BFLogger.logError("Unknown RuntimeParameter = " + this.name());
break;
}
this.paramValue = paramValue;
</DeepExtract>
|
mrchecker
|
positive
|
@Override
public void onCreateAfter(Bundle savedInstanceState) {
ViewCompat.setTransitionName(mViewPager, SHARED_ELEMENT_NAME);
Intent intent = this.getIntent();
int flags = intent.getFlags();
if ((flags & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {
if (intent.getAction() != null && Intent.ACTION_VIEW.equals(intent.getAction())) {
if (SCHEME_FILE.equals(intent.getScheme())) {
String type = getIntent().getType();
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri uri = intent.getData();
if (uri != null && SCHEME_FILE.equalsIgnoreCase(uri.getScheme())) {
currentFilePath = FileUtils.uri2FilePath(getBaseContext(), uri);
}
}
}
}
mEditorFragment = EditorFragment.getInstance(currentFilePath);
mEditorMarkdownFragment = EditorMarkdownFragment.getInstance();
mViewPager.setAdapter(new EditFragmentAdapter(getSupportFragmentManager()));
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
if (position == 0)
getToolbar().setTitle("");
else if (mName != null)
getToolbar().setTitle(mName);
if (position == 1) {
RxEventBus.getInstance().send(new RxEvent(RxEvent.TYPE_REFRESH_NOTIFY));
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
mTabIconView = (TabIconView) findViewById(R.id.tabIconView);
mTabIconView.addTab(R.drawable.ic_shortcut_format_list_bulleted, R.id.id_shortcut_list_bulleted, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_list_numbers, R.id.id_shortcut_format_numbers, this);
mTabIconView.addTab(R.drawable.ic_shortcut_insert_link, R.id.id_shortcut_insert_link, this);
mTabIconView.addTab(R.drawable.ic_shortcut_insert_photo, R.id.id_shortcut_insert_photo, this);
mTabIconView.addTab(R.drawable.ic_shortcut_console, R.id.id_shortcut_console, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_bold, R.id.id_shortcut_format_bold, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_italic, R.id.id_shortcut_format_italic, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_1, R.id.id_shortcut_format_header_1, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_2, R.id.id_shortcut_format_header_2, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_3, R.id.id_shortcut_format_header_3, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_quote, R.id.id_shortcut_format_quote, this);
mTabIconView.addTab(R.drawable.ic_shortcut_xml, R.id.id_shortcut_xml, this);
mTabIconView.addTab(R.drawable.ic_shortcut_minus, R.id.id_shortcut_minus, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_strikethrough, R.id.id_shortcut_format_strikethrough, this);
mTabIconView.addTab(R.drawable.ic_shortcut_grid, R.id.id_shortcut_grid, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_4, R.id.id_shortcut_format_header_4, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_5, R.id.id_shortcut_format_header_5, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_6, R.id.id_shortcut_format_header_6, this);
}
|
<DeepExtract>
Intent intent = this.getIntent();
int flags = intent.getFlags();
if ((flags & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {
if (intent.getAction() != null && Intent.ACTION_VIEW.equals(intent.getAction())) {
if (SCHEME_FILE.equals(intent.getScheme())) {
String type = getIntent().getType();
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri uri = intent.getData();
if (uri != null && SCHEME_FILE.equalsIgnoreCase(uri.getScheme())) {
currentFilePath = FileUtils.uri2FilePath(getBaseContext(), uri);
}
}
}
}
</DeepExtract>
<DeepExtract>
mViewPager.setAdapter(new EditFragmentAdapter(getSupportFragmentManager()));
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
if (position == 0)
getToolbar().setTitle("");
else if (mName != null)
getToolbar().setTitle(mName);
if (position == 1) {
RxEventBus.getInstance().send(new RxEvent(RxEvent.TYPE_REFRESH_NOTIFY));
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
</DeepExtract>
<DeepExtract>
mTabIconView = (TabIconView) findViewById(R.id.tabIconView);
mTabIconView.addTab(R.drawable.ic_shortcut_format_list_bulleted, R.id.id_shortcut_list_bulleted, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_list_numbers, R.id.id_shortcut_format_numbers, this);
mTabIconView.addTab(R.drawable.ic_shortcut_insert_link, R.id.id_shortcut_insert_link, this);
mTabIconView.addTab(R.drawable.ic_shortcut_insert_photo, R.id.id_shortcut_insert_photo, this);
mTabIconView.addTab(R.drawable.ic_shortcut_console, R.id.id_shortcut_console, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_bold, R.id.id_shortcut_format_bold, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_italic, R.id.id_shortcut_format_italic, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_1, R.id.id_shortcut_format_header_1, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_2, R.id.id_shortcut_format_header_2, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_3, R.id.id_shortcut_format_header_3, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_quote, R.id.id_shortcut_format_quote, this);
mTabIconView.addTab(R.drawable.ic_shortcut_xml, R.id.id_shortcut_xml, this);
mTabIconView.addTab(R.drawable.ic_shortcut_minus, R.id.id_shortcut_minus, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_strikethrough, R.id.id_shortcut_format_strikethrough, this);
mTabIconView.addTab(R.drawable.ic_shortcut_grid, R.id.id_shortcut_grid, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_4, R.id.id_shortcut_format_header_4, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_5, R.id.id_shortcut_format_header_5, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_6, R.id.id_shortcut_format_header_6, this);
</DeepExtract>
|
MarkdownEditors
|
positive
|
@NotNull
public String readUtf(int size) throws IOException {
byte[] b = new byte[size];
for (int i = 0; i < b.length; i++) {
b[i] = data[offset + position + i];
}
position += b.length;
return new String(b);
}
|
<DeepExtract>
for (int i = 0; i < b.length; i++) {
b[i] = data[offset + position + i];
}
position += b.length;
</DeepExtract>
|
PE
|
positive
|
public void testKey_CTRL_C() throws UnsupportedEncodingException, IOException {
keyHelperToggle(KeyEvent.KEYCODE_C, KeyEvent.META_CTRL_ON | KeyEvent.META_SHIFT_ON, new byte[] { 0x03 }, false);
}
|
<DeepExtract>
keyHelperToggle(KeyEvent.KEYCODE_C, KeyEvent.META_CTRL_ON | KeyEvent.META_SHIFT_ON, new byte[] { 0x03 }, false);
</DeepExtract>
|
Android-Terminal-Emulator
|
positive
|
public FriendsFeature getFriendsFeature() {
RegionFeature result = features.get(FriendsFeature.class);
if (result == null) {
result = plugin.getFeatureManager().getRegionFeature(this, FriendsFeature.class);
features.put(FriendsFeature.class, result);
}
return FriendsFeature.class.cast(result);
}
|
<DeepExtract>
RegionFeature result = features.get(FriendsFeature.class);
if (result == null) {
result = plugin.getFeatureManager().getRegionFeature(this, FriendsFeature.class);
features.put(FriendsFeature.class, result);
}
return FriendsFeature.class.cast(result);
</DeepExtract>
|
AreaShop
|
positive
|
@Override
public void onEventFired() {
if (PageHistory.Instance.from() == null) {
String showed = Storage.LocalStorage.getItem("ShowRatingDialog");
if (showed == null) {
Notification.confirm("If you think GWT Mobile PhoneGap is useful, " + "do you want to give it a good rating and comment?", new ConfirmCallback() {
@Override
public void onComplete(int selection) {
switch(selection) {
case 1:
App.loadUrl("market://details?id=com.gwtmobile.phonegap", LoadUrlOptions.newInstance().openExternal(true));
case 2:
Storage.LocalStorage.setItem("ShowRatingDialog", new Date().toString());
Storage.LocalStorage.setItem("ShowRatingSelection", selection + "");
break;
case 3:
}
App.exitApp();
}
}, "Rate the app", "Sure!,Nope,Later");
} else {
App.exitApp();
}
} else {
if (!PageHistory.Instance.current().getClass().toString().endsWith(".EventUi")) {
emulateClickOnBackButton();
}
}
}
|
<DeepExtract>
if (PageHistory.Instance.from() == null) {
String showed = Storage.LocalStorage.getItem("ShowRatingDialog");
if (showed == null) {
Notification.confirm("If you think GWT Mobile PhoneGap is useful, " + "do you want to give it a good rating and comment?", new ConfirmCallback() {
@Override
public void onComplete(int selection) {
switch(selection) {
case 1:
App.loadUrl("market://details?id=com.gwtmobile.phonegap", LoadUrlOptions.newInstance().openExternal(true));
case 2:
Storage.LocalStorage.setItem("ShowRatingDialog", new Date().toString());
Storage.LocalStorage.setItem("ShowRatingSelection", selection + "");
break;
case 3:
}
App.exitApp();
}
}, "Rate the app", "Sure!,Nope,Later");
} else {
App.exitApp();
}
} else {
if (!PageHistory.Instance.current().getClass().toString().endsWith(".EventUi")) {
emulateClickOnBackButton();
}
}
</DeepExtract>
|
GwtMobile-PhoneGap
|
positive
|
private void updateCameraSize() {
CameraSetting profile = SettingManager.getCameraProfile(getApplicationContext());
int factor;
switch(profile.getSize()) {
case CameraSetting.SIZE_BIG:
factor = 3;
break;
case CameraSetting.SIZE_MEDIUM:
factor = 4;
break;
default:
factor = 5;
break;
}
if (mScreenWidth > mScreenHeight) {
mCameraWidth = mScreenWidth / factor;
mCameraHeight = mScreenHeight / factor;
} else {
mCameraWidth = mScreenHeight / factor;
mCameraHeight = mScreenWidth / factor;
}
if (DEBUG)
Log.i(TAG, "calculateCameraSize: " + mScreenWidth + "x" + mScreenHeight);
Log.d(TAG, "onConfigurationChanged: DETECTED" + getResources().getConfiguration().orientation);
int width = mCameraWidth, height = mCameraHeight;
ViewGroup.LayoutParams params = cameraPreview.getLayoutParams();
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
params.height = width;
params.width = height;
} else {
params.height = height;
params.width = width;
}
cameraPreview.setLayoutParams(params);
}
|
<DeepExtract>
int factor;
switch(profile.getSize()) {
case CameraSetting.SIZE_BIG:
factor = 3;
break;
case CameraSetting.SIZE_MEDIUM:
factor = 4;
break;
default:
factor = 5;
break;
}
if (mScreenWidth > mScreenHeight) {
mCameraWidth = mScreenWidth / factor;
mCameraHeight = mScreenHeight / factor;
} else {
mCameraWidth = mScreenHeight / factor;
mCameraHeight = mScreenWidth / factor;
}
if (DEBUG)
Log.i(TAG, "calculateCameraSize: " + mScreenWidth + "x" + mScreenHeight);
</DeepExtract>
<DeepExtract>
Log.d(TAG, "onConfigurationChanged: DETECTED" + getResources().getConfiguration().orientation);
int width = mCameraWidth, height = mCameraHeight;
ViewGroup.LayoutParams params = cameraPreview.getLayoutParams();
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
params.height = width;
params.width = height;
} else {
params.height = height;
params.width = width;
}
cameraPreview.setLayoutParams(params);
</DeepExtract>
|
Zecorder
|
positive
|
@Override
public void changed(ChangeEvent event, Actor actor) {
sceneManager.environment.remove(PBRCubemapAttribute.DiffuseEnv);
sceneManager.environment.remove(PBRCubemapAttribute.SpecularEnv);
sceneManager.environment.remove(PBRTextureAttribute.BRDFLUTTexture);
if (ui.IBLEnabled.isOn()) {
sceneManager.environment.set(PBRCubemapAttribute.createDiffuseEnv(diffuseCubemap));
if (ui.IBLSpecular.isOn()) {
sceneManager.environment.set(PBRCubemapAttribute.createSpecularEnv(specularCubemap));
}
if (ui.IBLLookup.isOn()) {
sceneManager.environment.set(new PBRTextureAttribute(PBRTextureAttribute.BRDFLUTTexture, brdfLUT));
}
}
invalidateShaders();
}
|
<DeepExtract>
sceneManager.environment.remove(PBRCubemapAttribute.DiffuseEnv);
sceneManager.environment.remove(PBRCubemapAttribute.SpecularEnv);
sceneManager.environment.remove(PBRTextureAttribute.BRDFLUTTexture);
if (ui.IBLEnabled.isOn()) {
sceneManager.environment.set(PBRCubemapAttribute.createDiffuseEnv(diffuseCubemap));
if (ui.IBLSpecular.isOn()) {
sceneManager.environment.set(PBRCubemapAttribute.createSpecularEnv(specularCubemap));
}
if (ui.IBLLookup.isOn()) {
sceneManager.environment.set(new PBRTextureAttribute(PBRTextureAttribute.BRDFLUTTexture, brdfLUT));
}
}
invalidateShaders();
</DeepExtract>
|
gdx-gltf
|
positive
|
@Scheduled("30s")
public void saveRoundVoteSnapshot() {
if (!this.config.isVoteJobEnabled()) {
return;
}
Timestamp lastEndDate = this.dslContext.select(DSL.max(VOTING_ROUND.END_DATE)).from(VOTING_ROUND).fetchOneInto(Timestamp.class);
Instant instant = Instant.ofEpochMilli(this.fullNodeCli.getNextMaintenanceTime());
LocalDateTime maintenanceTime = instant.atZone(ZoneOffset.UTC).toLocalDateTime();
List<VotingRoundRecord> records = new ArrayList<>();
Timestamp firstBlockTS = this.dslContext.select(DSL.max(VOTING_ROUND.START_DATE)).from(VOTING_ROUND).fetchOneInto(Timestamp.class);
if (lastEndDate == null) {
firstBlockTS = this.dslContext.select(BLOCK.TIMESTAMP).from(BLOCK).where(BLOCK.NUM.eq(ULong.valueOf(1))).fetchOneInto(Timestamp.class);
}
if (lastEndDate != null && lastEndDate.equals(Timestamp.valueOf(maintenanceTime))) {
return;
}
LocalDateTime firstBlockLdt = firstBlockTS.toLocalDateTime();
while (maintenanceTime.isAfter(firstBlockLdt)) {
LocalDateTime startTime = maintenanceTime.minusHours(6);
VotingRoundRecord vr = new VotingRoundRecord();
vr.setMonth(UInteger.valueOf(startTime.getMonthValue()));
vr.setDay(UInteger.valueOf(startTime.getDayOfMonth()));
vr.setYear(UInteger.valueOf(startTime.getYear()));
vr.setEndDate(Timestamp.valueOf(maintenanceTime));
vr.setStartDate(Timestamp.valueOf(startTime));
maintenanceTime = startTime;
if (Timestamp.valueOf(startTime).equals(firstBlockTS)) {
continue;
} else {
records.add(vr);
}
}
this.dslContext.batchInsert(records).execute();
VotingRound vr = VOTING_ROUND.as("vr");
Table<Record2<Object, UInteger>> tmp = DSL.select(DSL.field("@rownum := @rownum+1").as("round"), VOTING_ROUND.ID).from(VOTING_ROUND).crossJoin("(select @rownum:=0) tmp").orderBy(VOTING_ROUND.END_DATE.asc()).asTable("tmp");
this.dslContext.update(vr).set(vr.ROUND, DSL.select(DSL.field("round", UInteger.class)).from(tmp).where(vr.ID.eq(tmp.field("id", UInteger.class)))).execute();
io.trxplorer.model.tables.pojos.VotingRound round = this.dslContext.select(VOTING_ROUND.fields()).from(VOTING_ROUND).where(VOTING_ROUND.SYNC_END.isNull()).orderBy(VOTING_ROUND.ROUND.desc()).limit(1).offset(1).fetchOneInto(io.trxplorer.model.tables.pojos.VotingRound.class);
Timestamp lastBlockTs = this.dslContext.select(DSL.max(BLOCK.TIMESTAMP)).from(BLOCK).fetchOneInto(Timestamp.class);
if (round.getSyncEnd() != null || round.getEndDate().after(lastBlockTs)) {
return;
}
this.dslContext.update(VOTING_ROUND).set(VOTING_ROUND.SYNC_START, Timestamp.valueOf(LocalDateTime.now())).where(VOTING_ROUND.ID.eq(round.getId())).execute();
List<String> addresses = this.dslContext.select(WITNESS.ADDRESS).from(WITNESS, ACCOUNT).where(WITNESS.ADDRESS.eq(ACCOUNT.ADDRESS).and(ACCOUNT.CREATE_TIME.lt(round.getEndDate()))).fetchInto(String.class);
this.dslContext.deleteFrom(VOTING_ROUND_VOTE).where(VOTING_ROUND_VOTE.VOTING_ROUND_ID.eq(round.getId())).execute();
this.dslContext.deleteFrom(VOTING_ROUND_VOTE_LOST).where(VOTING_ROUND_VOTE_LOST.VOTING_ROUND_ID.eq(round.getId())).execute();
this.dslContext.deleteFrom(VOTING_ROUND_STATS).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).execute();
this.dslContext.insertInto(VOTING_ROUND_VOTE).columns(VOTING_ROUND_VOTE.VOTING_ROUND_ID, VOTING_ROUND_VOTE.OWNER_ADDRESS, VOTING_ROUND_VOTE.VOTE_ADDRESS, VOTING_ROUND_VOTE.VOTE_COUNT, VOTING_ROUND_VOTE.TIMESTAMP).select(DSL.select(DSL.value(round.getId()), ACCOUNT.ADDRESS, ACCOUNT_VOTE.VOTE_ADDRESS, ACCOUNT_VOTE.VOTE_COUNT.cast(Long.class), ACCOUNT_VOTE.TIMESTAMP).from(ACCOUNT, ACCOUNT_VOTE).where(ACCOUNT.ID.eq(ACCOUNT_VOTE.ACCOUNT_ID))).execute();
for (String witnessAddress : addresses) {
this.dslContext.insertInto(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.ADDRESS, witnessAddress).set(VOTING_ROUND_STATS.VOTING_ROUND_ID, round.getId()).set(VOTING_ROUND_STATS.VOTE_COUNT, DSL.select(DSL.sum(VOTING_ROUND_VOTE.VOTE_COUNT).cast(ULong.class)).from(VOTING_ROUND_VOTE).where(VOTING_ROUND_VOTE.VOTING_ROUND_ID.eq(round.getId())).and(VOTING_ROUND_VOTE.VOTE_ADDRESS.eq(witnessAddress))).set(VOTING_ROUND_STATS.VOTE_LOST_COUNT, DSL.select(DSL.sum(VOTING_ROUND_VOTE_LOST.VOTE_COUNT).cast(ULong.class)).from(VOTING_ROUND_VOTE_LOST).where(VOTING_ROUND_VOTE_LOST.VOTING_ROUND_ID.eq(round.getId())).and(VOTING_ROUND_VOTE_LOST.VOTE_ADDRESS.eq(witnessAddress))).execute();
}
SelectConditionStep<Record1<ULong>> totalRoundVoteCount = DSL.select(DSL.sum(VOTING_ROUND_STATS.VOTE_COUNT).cast(ULong.class)).from(VOTING_ROUND_STATS).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId()));
this.dslContext.update(VOTING_ROUND).set(VOTING_ROUND.VOTE_COUNT, totalRoundVoteCount).where(VOTING_ROUND.ID.eq(round.getId())).execute();
for (String address : genesisVotes.keySet()) {
ULong addressVoteCount = this.dslContext.select(VOTING_ROUND_STATS.VOTE_COUNT).from(VOTING_ROUND_STATS).where(VOTING_ROUND_STATS.ADDRESS.eq(address)).and(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).fetchOneInto(ULong.class);
if (addressVoteCount == null) {
this.dslContext.update(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.VOTE_COUNT, ULong.valueOf(0)).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).and(VOTING_ROUND_STATS.ADDRESS.eq(address)).execute();
}
this.dslContext.update(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.VOTE_COUNT, VOTING_ROUND_STATS.VOTE_COUNT.plus(genesisVotes.get(address))).where(VOTING_ROUND_STATS.ADDRESS.eq(address)).and(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).execute();
}
VotingRoundStats vrs = VOTING_ROUND_STATS.as("vrs");
Table<Record2<Object, UInteger>> tmp = DSL.select(DSL.field("@rownum := @rownum+1").as("position"), VOTING_ROUND_STATS.ID).from(VOTING_ROUND_STATS).crossJoin("(select @rownum:=0) tmp").where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).orderBy(VOTING_ROUND_STATS.VOTE_COUNT.desc()).asTable("tmp");
this.dslContext.update(vrs).set(vrs.POSITION, DSL.select(DSL.field("position", UInteger.class)).from(tmp).where(vrs.ID.eq(tmp.field("id", UInteger.class)))).where(vrs.VOTING_ROUND_ID.eq(round.getId())).execute();
int previousRound = round.getRound().intValue() - 1;
if (previousRound > 0) {
VotingRoundStats vrs1 = VOTING_ROUND_STATS.as("vrs1");
VotingRoundStats vrs2 = VOTING_ROUND_STATS.as("vrs2");
Table<Record3<Integer, Long, String>> vrsChangeTable = DSL.select(vrs1.POSITION.cast(Integer.class).minus(vrs2.POSITION.cast(Integer.class)).as("position"), vrs2.VOTE_COUNT.cast(Long.class).minus(vrs1.VOTE_COUNT.cast(Long.class)).as("votes"), vrs1.ADDRESS).from(vrs1, vrs2).where(vrs1.VOTING_ROUND_ID.eq(DSL.select(VOTING_ROUND.ID).from(VOTING_ROUND).where(VOTING_ROUND.ROUND.eq(UInteger.valueOf(previousRound)))).and(vrs1.ADDRESS.eq(vrs2.ADDRESS)).and(vrs2.VOTING_ROUND_ID.eq(round.getId()))).asTable("tmp");
this.dslContext.update(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.POSITION_CHANGE, DSL.select(vrsChangeTable.field("position", Integer.class)).from(vrsChangeTable).where(vrsChangeTable.field("address", String.class).eq(VOTING_ROUND_STATS.ADDRESS))).set(VOTING_ROUND_STATS.VOTES_CHANGE, DSL.select(vrsChangeTable.field("votes", Long.class)).from(vrsChangeTable).where(vrsChangeTable.field("address", String.class).eq(VOTING_ROUND_STATS.ADDRESS))).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).execute();
;
}
this.dslContext.update(VOTING_ROUND).set(VOTING_ROUND.SYNC_END, Timestamp.valueOf(LocalDateTime.now())).where(VOTING_ROUND.ID.eq(round.getId())).execute();
}
|
<DeepExtract>
Timestamp lastEndDate = this.dslContext.select(DSL.max(VOTING_ROUND.END_DATE)).from(VOTING_ROUND).fetchOneInto(Timestamp.class);
Instant instant = Instant.ofEpochMilli(this.fullNodeCli.getNextMaintenanceTime());
LocalDateTime maintenanceTime = instant.atZone(ZoneOffset.UTC).toLocalDateTime();
List<VotingRoundRecord> records = new ArrayList<>();
Timestamp firstBlockTS = this.dslContext.select(DSL.max(VOTING_ROUND.START_DATE)).from(VOTING_ROUND).fetchOneInto(Timestamp.class);
if (lastEndDate == null) {
firstBlockTS = this.dslContext.select(BLOCK.TIMESTAMP).from(BLOCK).where(BLOCK.NUM.eq(ULong.valueOf(1))).fetchOneInto(Timestamp.class);
}
if (lastEndDate != null && lastEndDate.equals(Timestamp.valueOf(maintenanceTime))) {
return;
}
LocalDateTime firstBlockLdt = firstBlockTS.toLocalDateTime();
while (maintenanceTime.isAfter(firstBlockLdt)) {
LocalDateTime startTime = maintenanceTime.minusHours(6);
VotingRoundRecord vr = new VotingRoundRecord();
vr.setMonth(UInteger.valueOf(startTime.getMonthValue()));
vr.setDay(UInteger.valueOf(startTime.getDayOfMonth()));
vr.setYear(UInteger.valueOf(startTime.getYear()));
vr.setEndDate(Timestamp.valueOf(maintenanceTime));
vr.setStartDate(Timestamp.valueOf(startTime));
maintenanceTime = startTime;
if (Timestamp.valueOf(startTime).equals(firstBlockTS)) {
continue;
} else {
records.add(vr);
}
}
this.dslContext.batchInsert(records).execute();
VotingRound vr = VOTING_ROUND.as("vr");
Table<Record2<Object, UInteger>> tmp = DSL.select(DSL.field("@rownum := @rownum+1").as("round"), VOTING_ROUND.ID).from(VOTING_ROUND).crossJoin("(select @rownum:=0) tmp").orderBy(VOTING_ROUND.END_DATE.asc()).asTable("tmp");
this.dslContext.update(vr).set(vr.ROUND, DSL.select(DSL.field("round", UInteger.class)).from(tmp).where(vr.ID.eq(tmp.field("id", UInteger.class)))).execute();
</DeepExtract>
|
explorer
|
positive
|
@Override
public void checkBoxStatusChanged(int index, boolean status) {
JCheckBox cbx = (JCheckBox) lbLayersList.getModel().getElementAt(index);
int layer = cbx.getText().equals("Common") ? 1 : (2 << (cbx.getText().charAt(5) - 'A'));
if (status)
zoneModeLayerBitmask |= layer;
else
zoneModeLayerBitmask &= ~layer;
rerenderTasks.add("allobjects:");
glCanvas.repaint();
}
|
<DeepExtract>
JCheckBox cbx = (JCheckBox) lbLayersList.getModel().getElementAt(index);
int layer = cbx.getText().equals("Common") ? 1 : (2 << (cbx.getText().charAt(5) - 'A'));
if (status)
zoneModeLayerBitmask |= layer;
else
zoneModeLayerBitmask &= ~layer;
rerenderTasks.add("allobjects:");
glCanvas.repaint();
</DeepExtract>
|
Whitehole
|
positive
|
public void start() throws ServletException {
log.info("Loading Tomcat");
final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
String serverRoot = System.getProperty("red5.root");
log.info("Server root: {}", serverRoot);
String confRoot = System.getProperty("red5.config_root");
log.info("Config root: {}", confRoot);
Boolean useNaming = Boolean.valueOf(System.getProperty("catalina.useNaming"));
if (embedded == null) {
embedded = new EmbeddedTomcat();
}
File serverRootF = new File(serverRoot);
embedded.getServer().setCatalinaBase(serverRootF);
embedded.getServer().setCatalinaHome(serverRootF);
log.debug("setHost");
this.host = host;
embedded.setSilent(false);
return engine;
engine.setName(serviceEngineName);
engine.setDefaultHost(host.getName());
if (webappFolder == null) {
webappFolder = FileUtil.formatPath(serverRoot, "/webapps");
}
System.setProperty("red5.webapp.root", webappFolder);
log.info("Application root: {}", webappFolder);
File appDirBase = new File(webappFolder);
File[] dirs = appDirBase.listFiles(new DirectoryFilter());
for (File dir : dirs) {
String dirName = '/' + dir.getName();
if (null == host.findChild(dirName)) {
String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), dirName);
log.debug("Webapp context directory (full path): {}", webappContextDir);
Context ctx = null;
if ("/root".equalsIgnoreCase(dirName)) {
log.trace("Adding ROOT context");
ctx = addContext("", webappContextDir);
} else {
log.trace("Adding context from directory scan: {}", dirName);
ctx = addContext(dirName, webappContextDir);
}
log.trace("Context: {}", ctx);
webappContextDir = null;
}
}
appDirBase = null;
dirs = null;
if (log.isDebugEnabled()) {
for (Container cont : host.findChildren()) {
log.debug("Context child name: {}", cont.getName());
}
}
if (realm != null) {
embedded.getEngine().setRealm(realm);
} else {
realm = new NullRealm();
embedded.getEngine().setRealm(realm);
}
if (Boolean.TRUE.equals(useNaming)) {
embedded.enableNaming();
}
for (Valve valve : valves) {
log.debug("Adding host valve: {}", valve);
((StandardHost) host).addValve(valve);
}
if (hosts != null && !hosts.isEmpty()) {
Container[] currentContexts = host.findChildren();
log.info("Adding {} additional hosts", hosts.size());
for (Host h : hosts) {
log.debug("Host - name: {} appBase: {} info: {}", new Object[] { h.getName(), h.getAppBase(), h });
for (Container cont : currentContexts) {
Context c = (Context) cont;
addContext(c.getPath(), c.getDocBase(), h);
}
engine.addChild(h);
}
}
try {
boolean added = false;
for (TomcatConnector tomcatConnector : connectors) {
Connector connector = tomcatConnector.getConnector();
if (!added) {
embedded.setConnector(connector);
added = true;
} else {
embedded.getService().addConnector(connector);
}
log.trace("Connector oName: {}", connector.getObjectName());
}
} catch (Exception ex) {
log.warn("An exception occurred during network configuration", ex);
}
ExecutorService executor = Executors.newSingleThreadExecutor();
try {
log.info("Starting Tomcat servlet engine");
embedded.start();
LoaderBase.setApplicationLoader(new TomcatApplicationLoader(embedded, host, applicationContext));
for (final Container cont : host.findChildren()) {
if (cont instanceof StandardContext) {
if (log.isDebugEnabled()) {
ContainerBase cb = (ContainerBase) cont;
log.debug("Oname - domain: {}", cb.getDomain());
}
final StandardContext ctx = (StandardContext) cont;
final ServletContext servletContext = ctx.getServletContext();
servletContext.setAttribute("red5.host.id", getHostId());
final String prefix = servletContext.getRealPath("/");
log.info("Context initialized: {} path: {}", servletContext.getContextPath(), prefix);
try {
ctx.resourcesStart();
log.debug("Context - privileged: {}, start time: {}, reloadable: {}", new Object[] { ctx.getPrivileged(), ctx.getStartTime(), ctx.getReloadable() });
Loader cldr = ctx.getLoader();
log.debug("Loader delegate: {} type: {}", cldr.getDelegate(), cldr.getClass().getName());
if (log.isTraceEnabled()) {
if (cldr instanceof WebappLoader) {
log.trace("WebappLoader class path: {}", ((WebappLoader) cldr).getClasspath());
}
}
final ClassLoader webClassLoader = cldr.getClassLoader();
log.debug("Webapp classloader: {}", webClassLoader);
final String contextConfigLocation = servletContext.getInitParameter(CONFIG_LOCATION_PARAM) == null ? defaultSpringConfigLocation : servletContext.getInitParameter(CONFIG_LOCATION_PARAM);
log.debug("Spring context config location: {}", contextConfigLocation);
final String parentContextKey = servletContext.getInitParameter(LOCATOR_FACTORY_KEY_PARAM) == null ? defaultParentContextKey : servletContext.getInitParameter(LOCATOR_FACTORY_KEY_PARAM);
log.debug("Spring parent context key: {}", parentContextKey);
Thread.currentThread().setContextClassLoader(webClassLoader);
Future<?> appStartTask = executor.submit(new Runnable() {
public void run() {
Thread.currentThread().setContextClassLoader(webClassLoader);
Thread.currentThread().setName("Loader:" + servletContext.getContextPath());
ApplicationContext parentContext = null;
if (applicationContext.containsBean(parentContextKey)) {
parentContext = (ApplicationContext) applicationContext.getBean(parentContextKey);
} else {
log.warn("Parent context was not found: {}", parentContextKey);
}
final String contextClass = servletContext.getInitParameter(CONTEXT_CLASS_PARAM) == null ? XmlWebApplicationContext.class.getName() : servletContext.getInitParameter(CONTEXT_CLASS_PARAM);
ConfigurableWebApplicationContext appctx = null;
try {
Class<?> clazz = Class.forName(contextClass, true, webClassLoader);
appctx = (ConfigurableWebApplicationContext) clazz.getDeclaredConstructor().newInstance();
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appctx);
appctx.setConfigLocations(new String[] { contextConfigLocation });
appctx.setServletContext(servletContext);
if (parentContext != null) {
appctx.setParent(parentContext);
} else {
appctx.setParent(applicationContext);
}
log.trace("Classloader prior to refresh: {}", appctx.getClassLoader());
appctx.refresh();
if (log.isDebugEnabled()) {
log.debug("Red5 app is active: {} running: {}", appctx.isActive(), appctx.isRunning());
}
if (appctx.containsBean("realm")) {
log.debug("Realm specified in context configuration");
Realm contextRealm = (Realm) appctx.getBean("realm");
if (contextRealm != null) {
log.debug("Realm class: {}", contextRealm.getClass().getName());
contextRealm.setContainer(cont);
ctx.setRealm(contextRealm);
if (contextRealm instanceof IRed5Realm) {
((IRed5Realm) contextRealm).setApplicationContext(appctx);
((IRed5Realm) contextRealm).setServletContext(servletContext);
}
if (contextRealm instanceof JAASRealm) {
log.debug("Realm is JAAS type");
System.setProperty("java.security.auth.login.config", prefix + "WEB-INF/jaas.config");
}
log.debug("Realm info: {} path: {}", contextRealm, ((RealmBase) contextRealm).getRealmPath());
}
}
appctx.start();
} catch (Throwable e) {
throw new RuntimeException("Failed to load webapplication context class", e);
}
}
});
log.debug("Context: {} done: {}", servletContext.getContextPath(), appStartTask.isDone());
} catch (Throwable t) {
log.error("Error setting up context: {} due to: {}", servletContext.getContextPath(), t.getMessage());
t.printStackTrace();
} finally {
Thread.currentThread().setContextClassLoader(originalClassLoader);
}
}
}
if (applicationContext.containsBean("rtmpt.server")) {
log.debug("Initializing RTMPT");
applicationContext.getBean("rtmpt.server");
log.debug("Finished initializing RTMPT");
} else {
log.info("Dedicated RTMPT server configuration was not specified");
}
if (applicationContext.containsBean("rtmps.server")) {
log.debug("Initializing RTMPS");
applicationContext.getBean("rtmps.server");
log.debug("Finished initializing RTMPS");
} else {
log.debug("Dedicated RTMPS server configuration was not specified");
}
} catch (Exception e) {
if (e instanceof BindException || e.getMessage().indexOf("BindException") != -1) {
log.error("Error loading tomcat, unable to bind connector. You may not have permission to use the selected port", e);
} else {
log.error("Error loading tomcat", e);
}
} finally {
executor.shutdown();
registerJMX();
}
log.debug("Tomcat load completed");
}
|
<DeepExtract>
log.debug("setHost");
this.host = host;
</DeepExtract>
<DeepExtract>
return engine;
</DeepExtract>
|
red5-server
|
positive
|
public void cancelFindMatch() {
try {
String encrypted = aes.encrypt(StreamData.Type.CANCEL_FIND_MATCH.name());
dos.writeUTF(encrypted);
} catch (IOException ex) {
Logger.getLogger(SocketHandler.class.getName()).log(Level.SEVERE, null, ex);
}
}
|
<DeepExtract>
try {
String encrypted = aes.encrypt(StreamData.Type.CANCEL_FIND_MATCH.name());
dos.writeUTF(encrypted);
} catch (IOException ex) {
Logger.getLogger(SocketHandler.class.getName()).log(Level.SEVERE, null, ex);
}
</DeepExtract>
|
CaroOnline_SocketJava
|
positive
|
public void loadFirst() {
page = 1;
if (NetWorkUtil.isNetWorkConnected(mActivity)) {
loadDate();
} else {
loadFromCache();
}
}
|
<DeepExtract>
if (NetWorkUtil.isNetWorkConnected(mActivity)) {
loadDate();
} else {
loadFromCache();
}
</DeepExtract>
|
JianDanRxJava
|
positive
|
public void openDBwrite() {
try {
EnvironmentConfig envConfig = new EnvironmentConfig();
StoreConfig storeConfig = new StoreConfig();
envConfig.setReadOnly(false);
storeConfig.setReadOnly(false);
envConfig.setAllowCreate(!false);
storeConfig.setAllowCreate(!false);
myEnv = new Environment(new File(this.base), envConfig);
store = new EntityStore(myEnv, "EntityStore", storeConfig);
phraseById = store.getPrimaryIndex(Integer.class, PhraseNumEntry.class);
phraseByRef = store.getSecondaryIndex(phraseById, String.class, "refwds");
wordById = store.getPrimaryIndex(Integer.class, WordInfo.class);
wordByStr = store.getSecondaryIndex(wordById, String.class, "word");
} catch (DatabaseException dbe) {
System.err.println("Error opening db env (base=" + this.base + "): " + dbe.toString());
System.exit(-1);
}
this.readonly = false;
}
|
<DeepExtract>
try {
EnvironmentConfig envConfig = new EnvironmentConfig();
StoreConfig storeConfig = new StoreConfig();
envConfig.setReadOnly(false);
storeConfig.setReadOnly(false);
envConfig.setAllowCreate(!false);
storeConfig.setAllowCreate(!false);
myEnv = new Environment(new File(this.base), envConfig);
store = new EntityStore(myEnv, "EntityStore", storeConfig);
phraseById = store.getPrimaryIndex(Integer.class, PhraseNumEntry.class);
phraseByRef = store.getSecondaryIndex(phraseById, String.class, "refwds");
wordById = store.getPrimaryIndex(Integer.class, WordInfo.class);
wordByStr = store.getSecondaryIndex(wordById, String.class, "word");
} catch (DatabaseException dbe) {
System.err.println("Error opening db env (base=" + this.base + "): " + dbe.toString());
System.exit(-1);
}
this.readonly = false;
</DeepExtract>
|
terp
|
positive
|
static void delPort(Session session, String address, int lport) throws JSchException {
PortWatcher pw;
InetAddress addr;
try {
addr = InetAddress.getByName(address);
} catch (UnknownHostException uhe) {
throw new JSchException("PortForwardingL: invalid address " + address + " specified.", uhe);
}
synchronized (pool) {
for (int i = 0; i < pool.size(); i++) {
PortWatcher p = (PortWatcher) (pool.elementAt(i));
if (p.session == session && p.lport == lport) {
if ((anyLocalAddress != null && p.boundaddress.equals(anyLocalAddress)) || p.boundaddress.equals(addr))
pw = p;
}
}
pw = null;
}
if (pw == null) {
throw new JSchException("PortForwardingL: local port " + address + ":" + lport + " is not registered.");
}
thread = null;
try {
if (ss != null)
ss.close();
ss = null;
} catch (Exception e) {
}
pool.removeElement(pw);
}
|
<DeepExtract>
PortWatcher pw;
InetAddress addr;
try {
addr = InetAddress.getByName(address);
} catch (UnknownHostException uhe) {
throw new JSchException("PortForwardingL: invalid address " + address + " specified.", uhe);
}
synchronized (pool) {
for (int i = 0; i < pool.size(); i++) {
PortWatcher p = (PortWatcher) (pool.elementAt(i));
if (p.session == session && p.lport == lport) {
if ((anyLocalAddress != null && p.boundaddress.equals(anyLocalAddress)) || p.boundaddress.equals(addr))
pw = p;
}
}
pw = null;
}
</DeepExtract>
<DeepExtract>
thread = null;
try {
if (ss != null)
ss.close();
ss = null;
} catch (Exception e) {
}
</DeepExtract>
|
sshxcute
|
positive
|
private void addWrapper(List<AudioTagWrapper> wrappers, Thread thread) {
tname = thread.getName();
if (!tname.startsWith("Timer-"))
return;
try {
tcount = Integer.parseInt(tname.substring(6));
} catch (NumberFormatException e) {
return;
}
r = (Runnable) getField(thread, "target", Runnable.class);
if (r == null)
r = thread;
Class pclass;
Field field;
Object obj;
pclass = r.getClass();
try {
field = pclass.getDeclaredField("tasks");
if (field == null)
obj = null;
field.setAccessible(true);
obj = field.get(r);
if (obj == null)
obj = null;
if (!Object.class.isInstance(obj))
obj = null;
obj = obj;
} catch (Throwable t) {
obj = null;
}
if (obj == null)
return;
tasks = (TimerTask[]) getField(obj, "timers", TimerTask[].class);
if (tasks == null)
return;
Class pclass;
Field field;
Object obj;
pclass = obj.getClass();
try {
field = pclass.getDeclaredField("size");
if (field == null)
obj = null;
field.setAccessible(true);
obj = field.get(obj);
if (obj == null)
obj = null;
if (!Integer.class.isInstance(obj))
obj = null;
obj = obj;
} catch (Throwable t) {
obj = null;
}
if (obj == null)
return;
size = (Integer) obj;
for (i = 0; i < size; i++) {
try {
task = tasks[i];
if (task == null)
continue;
} catch (Throwable t) {
continue;
}
if (task.getClass().getCanonicalName().equals("android.webkit.HTML5Audio.TimeupdateTask")) {
obj = getField(task, "this$0", Object.class);
if (obj != null)
wrappers.add(new AudioTagWrapper(tcount, obj));
}
}
}
|
<DeepExtract>
Class pclass;
Field field;
Object obj;
pclass = r.getClass();
try {
field = pclass.getDeclaredField("tasks");
if (field == null)
obj = null;
field.setAccessible(true);
obj = field.get(r);
if (obj == null)
obj = null;
if (!Object.class.isInstance(obj))
obj = null;
obj = obj;
} catch (Throwable t) {
obj = null;
}
</DeepExtract>
<DeepExtract>
Class pclass;
Field field;
Object obj;
pclass = obj.getClass();
try {
field = pclass.getDeclaredField("size");
if (field == null)
obj = null;
field.setAccessible(true);
obj = field.get(obj);
if (obj == null)
obj = null;
if (!Integer.class.isInstance(obj))
obj = null;
obj = obj;
} catch (Throwable t) {
obj = null;
}
</DeepExtract>
|
WaniKani-for-Android
|
positive
|
@Override
public String apply(JedisClient client) {
return this.doAction(ClientType.MASTER, new ClientFunction<String>() {
@Override
public String apply(JedisClient client) {
return client.setex(key, seconds, value);
}
});
}
|
<DeepExtract>
return this.doAction(ClientType.MASTER, new ClientFunction<String>() {
@Override
public String apply(JedisClient client) {
return client.setex(key, seconds, value);
}
});
</DeepExtract>
|
jedis_failover
|
positive
|
@Override
public void onContinue() {
final IRouterInterceptor interceptor = interceptors.poll();
if (interceptor == null) {
RouterLogger.getCoreLogger().d("<< Pass request \"%s\" interceptors", request.getNumber());
callback.onContinue();
return;
}
RouterMeta interceptorMeta = RouterStore.getInterceptors().get(interceptor.getClass());
assert interceptorMeta != null;
RouterLogger.getCoreLogger().d("interceptor \"%s\" execute, for request \"%s\", global:%s, priority:%s", interceptor.getClass().getSimpleName(), request.getNumber(), interceptorMeta.isGlobal(), interceptorMeta.getPriority());
request.interceptor = new IRouterInterceptor.IInterceptor() {
@Override
public void onContinue() {
handleNext(interceptors, request, callback);
}
@Override
public void onInterrupt() {
RouterLogger.getCoreLogger().w("request \"%s\" interrupt by \"%s\"", request.getNumber(), interceptor.getClass().getSimpleName());
callback.onInterrupt();
}
};
interceptor.handle(request);
}
|
<DeepExtract>
final IRouterInterceptor interceptor = interceptors.poll();
if (interceptor == null) {
RouterLogger.getCoreLogger().d("<< Pass request \"%s\" interceptors", request.getNumber());
callback.onContinue();
return;
}
RouterMeta interceptorMeta = RouterStore.getInterceptors().get(interceptor.getClass());
assert interceptorMeta != null;
RouterLogger.getCoreLogger().d("interceptor \"%s\" execute, for request \"%s\", global:%s, priority:%s", interceptor.getClass().getSimpleName(), request.getNumber(), interceptorMeta.isGlobal(), interceptorMeta.getPriority());
request.interceptor = new IRouterInterceptor.IInterceptor() {
@Override
public void onContinue() {
handleNext(interceptors, request, callback);
}
@Override
public void onInterrupt() {
RouterLogger.getCoreLogger().w("request \"%s\" interrupt by \"%s\"", request.getNumber(), interceptor.getClass().getSimpleName());
callback.onInterrupt();
}
};
interceptor.handle(request);
</DeepExtract>
|
DRouter
|
positive
|
@Override
public void onActivityStopped(Activity activity) {
stop(activity);
activity.getApplication().unregisterActivityLifecycleCallbacks(this);
}
|
<DeepExtract>
stop(activity);
activity.getApplication().unregisterActivityLifecycleCallbacks(this);
</DeepExtract>
|
android-sdk
|
positive
|
@Test
public void search_pageAndResultsPerPage() {
mockServer.expect(requestTo("https://api.twitter.com/1.1/search/tweets.json?q=%23spring&count=10")).andExpect(method(GET)).andRespond(withSuccess(jsonResource("search"), APPLICATION_JSON));
SearchResults searchResults = twitter.searchOperations().search("#spring", 10);
assertEquals(10, searchResults.getSearchMetadata().getSinceId());
assertEquals(999, searchResults.getSearchMetadata().getMaxId());
List<Tweet> tweets = searchResults.getTweets();
assertTimelineTweets(tweets, true);
assertEquals("en", tweets.get(0).getLanguageCode());
assertEquals("de", tweets.get(1).getLanguageCode());
}
|
<DeepExtract>
assertTimelineTweets(tweets, true);
assertEquals("en", tweets.get(0).getLanguageCode());
assertEquals("de", tweets.get(1).getLanguageCode());
</DeepExtract>
|
spring-social-twitter
|
positive
|
@Deprecated
public java.util.Map<String, String> getMetricTags() {
return internalGetMetricTags().getMap();
}
|
<DeepExtract>
return internalGetMetricTags().getMap();
</DeepExtract>
|
dl_inference
|
positive
|
@Test
public void testIteratorRemoveCorners() {
int numOfItems = 200;
int valueToRemove1 = 50;
int valueToRemove2 = 100;
for (Integer i = 0; i < numOfItems; i++) {
oak.zc().put(i, i);
}
Iterator<Integer> valIter = oak.values().iterator();
while (valIter.hasNext()) {
Integer expectedVal = valIter.next();
if (expectedVal.equals(valueToRemove1)) {
oak.remove(expectedVal);
valIter.remove();
}
}
valIter = oak.values().iterator();
boolean[] valuesMet = new boolean[numOfItems];
while (valIter.hasNext()) {
valuesMet[valIter.next()] = true;
}
for (int idx = 0; idx < valuesMet.length; idx++) {
if (idx != valueToRemove1) {
Assert.assertTrue(valuesMet[idx]);
} else {
Assert.assertFalse(valuesMet[idx]);
}
}
Iterator<Integer> valIter1 = oak.values().iterator();
Iterator<Integer> valIter2 = oak.values().iterator();
valuesMet = new boolean[numOfItems];
while (valIter1.hasNext()) {
Integer expectedVal = valIter1.next();
if (expectedVal.equals(valueToRemove2)) {
valIter1.remove();
}
if (valIter1.hasNext()) {
valuesMet[valIter2.next()] = true;
}
}
for (int idx = 0; idx < valuesMet.length; idx++) {
if (idx != valueToRemove1 && idx != valueToRemove2) {
Assert.assertTrue(valuesMet[idx]);
} else {
Assert.assertFalse(valuesMet[idx]);
}
}
}
|
<DeepExtract>
for (Integer i = 0; i < numOfItems; i++) {
oak.zc().put(i, i);
}
</DeepExtract>
|
Oak
|
positive
|
public static ButtonInputDriver createButtonCInputDriver(int keycode) throws IOException {
return new ButtonInputDriver(BOARD.getButtonC(), BUTTON_LOGIC_STATE, keycode);
}
|
<DeepExtract>
return new ButtonInputDriver(BOARD.getButtonC(), BUTTON_LOGIC_STATE, keycode);
</DeepExtract>
|
contrib-drivers
|
positive
|
@Override
public void visitFADD(InstructionHandle instructionHandle) {
result = Const.getOpcodeName(instructionHandle.getInstruction().getOpcode()) + " // [" + instructionHandle.getPosition() + "]";
}
|
<DeepExtract>
result = Const.getOpcodeName(instructionHandle.getInstruction().getOpcode()) + " // [" + instructionHandle.getPosition() + "]";
</DeepExtract>
|
Java-Bytecode-Editor
|
positive
|
@Override
public void run() {
try {
long size = 0;
for (int i = 0; i < myArray.size(); i++) {
char[] buf = block(i);
String bufStr = new String(buf);
String[] paragraphs = bufStr.split("\r\n");
for (String str : paragraphs) {
if (str.length() <= 30 && (str.matches(".*第.{1,8}ç« .*") || str.matches(".*第.{1,8}节.*"))) {
BookCatalogue bookCatalogue = new BookCatalogue();
bookCatalogue.setBookCatalogueStartPos(size);
bookCatalogue.setBookCatalogue(str);
bookCatalogue.setBookpath(bookPath);
directoryList.add(bookCatalogue);
}
if (str.contains("\u3000\u3000")) {
size += str.length() + 2;
} else if (str.contains("\u3000")) {
size += str.length() + 1;
} else {
size += str.length();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
|
<DeepExtract>
try {
long size = 0;
for (int i = 0; i < myArray.size(); i++) {
char[] buf = block(i);
String bufStr = new String(buf);
String[] paragraphs = bufStr.split("\r\n");
for (String str : paragraphs) {
if (str.length() <= 30 && (str.matches(".*第.{1,8}ç« .*") || str.matches(".*第.{1,8}节.*"))) {
BookCatalogue bookCatalogue = new BookCatalogue();
bookCatalogue.setBookCatalogueStartPos(size);
bookCatalogue.setBookCatalogue(str);
bookCatalogue.setBookpath(bookPath);
directoryList.add(bookCatalogue);
}
if (str.contains("\u3000\u3000")) {
size += str.length() + 2;
} else if (str.contains("\u3000")) {
size += str.length() + 1;
} else {
size += str.length();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
</DeepExtract>
|
book
|
positive
|
public Criteria andUpdateTimeNotIn(List<Date> values) {
if (values == null) {
throw new RuntimeException("Value for " + "updateTime" + " cannot be null");
}
criteria.add(new Criterion("update_time not in", values));
return (Criteria) this;
}
|
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "updateTime" + " cannot be null");
}
criteria.add(new Criterion("update_time not in", values));
</DeepExtract>
|
springcloud-e-book
|
positive
|
public void inboundAuthenticate(boolean success) {
if (!this.isInboundConnected()) {
return;
}
if (!success) {
this.disconnect("Error: Authentication to Minecraft.net Failed");
return;
}
if (this.sessionMapper.hasAuthenticatedByUsername(this.username)) {
this.disconnect(MinecraftPacketConstants.colorize(this.config.proxy_getLocaleLoggedIn()));
return;
}
if (this.config.proxy_getPlayerMaximum() > 1 && this.sessionMapper.getAuthenticatedSize() >= this.config.proxy_getPlayerMaximum()) {
this.disconnect(MinecraftPacketConstants.colorize(this.config.proxy_getLocaleFull()));
return;
}
String serverName = this.config.proxy_getDomains().get(this.serverAddress.toLowerCase());
if (serverName == null && (serverName = this.config.proxy_getDomains().get("*")) == null) {
this.disconnect(MinecraftPacketConstants.colorize(this.config.proxy_getLocaleOffline()));
return;
}
IServer server = this.config.proxy_getServerSource().getServerByName(serverName);
if (server == null) {
this.disconnect(MinecraftPacketConstants.colorize(this.config.proxy_getLocaleOffline()));
return;
}
IPlayerCallback playerCallback = this.config.proxy_getPlayerCallback();
if (playerCallback != null) {
int result = playerCallback.notifyPlayerJoin(this.username);
if (result == 0) {
this.disconnect(MinecraftPacketConstants.colorize(this.config.proxy_getLocaleLoggedIn()));
return;
} else if (result == -1) {
this.disconnect(MinecraftPacketConstants.colorize(this.config.proxy_getLocaleOffline()));
return;
}
}
this.state = ProxyState.INIT;
this.inboundChannel.writeAndFlush(new LoginSuccessPacket(UUID.randomUUID().toString(), this.username));
this.state = PlayStateCodecProvider.instance;
this.sessionMapper.markAuthenticated(this);
if (this.server == server) {
return;
}
new Bootstrap().group(this.inboundChannel.eventLoop()).channel(NioSocketChannel.class).localAddress(this.config.proxy_getOutboundAddress()).remoteAddress(server.getInboundAddress()).option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000).handler(new ChannelInitializer<SocketChannel>() {
public void initChannel(SocketChannel channel) throws Exception {
StatefulPacketCodecProviderPair packetCodecProvider = new StatefulPacketCodecProviderPair(HandshakeStateCodecProvider.instance);
channel.attr(StatefulPacketCodecProviderPair.attributeKey).set(packetCodecProvider);
channel.config().setAllocator(ProxySession.this.inboundChannel.alloc());
channel.pipeline().addLast(new ReadTimeoutHandler(30));
channel.pipeline().addLast(new VarIntFrameCodec());
channel.pipeline().addLast(new PacketEncoder(packetCodecProvider.getServerBound()));
channel.pipeline().addLast(new PacketDecoder(packetCodecProvider.getClientBound()));
channel.pipeline().addLast(new ProxyOutboundHandler(server, ProxySession.this));
}
}).connect().addListener(new ChannelFutureListener() {
public void operationComplete(ChannelFuture future) throws Exception {
if (future.isSuccess()) {
return;
}
disconnectIfInitializing("Error: Internal Mismatch (0x02)");
}
});
}
|
<DeepExtract>
this.state = PlayStateCodecProvider.instance;
</DeepExtract>
<DeepExtract>
if (this.server == server) {
return;
}
new Bootstrap().group(this.inboundChannel.eventLoop()).channel(NioSocketChannel.class).localAddress(this.config.proxy_getOutboundAddress()).remoteAddress(server.getInboundAddress()).option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000).handler(new ChannelInitializer<SocketChannel>() {
public void initChannel(SocketChannel channel) throws Exception {
StatefulPacketCodecProviderPair packetCodecProvider = new StatefulPacketCodecProviderPair(HandshakeStateCodecProvider.instance);
channel.attr(StatefulPacketCodecProviderPair.attributeKey).set(packetCodecProvider);
channel.config().setAllocator(ProxySession.this.inboundChannel.alloc());
channel.pipeline().addLast(new ReadTimeoutHandler(30));
channel.pipeline().addLast(new VarIntFrameCodec());
channel.pipeline().addLast(new PacketEncoder(packetCodecProvider.getServerBound()));
channel.pipeline().addLast(new PacketDecoder(packetCodecProvider.getClientBound()));
channel.pipeline().addLast(new ProxyOutboundHandler(server, ProxySession.this));
}
}).connect().addListener(new ChannelFutureListener() {
public void operationComplete(ChannelFuture future) throws Exception {
if (future.isSuccess()) {
return;
}
disconnectIfInitializing("Error: Internal Mismatch (0x02)");
}
});
</DeepExtract>
|
JLilyPad
|
positive
|
@Override
public void run() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
updateScannerList(devt.getDiscoveredScanners());
}
});
discoveryJob.removeDiscoveryListener(discoveryListener);
components.getDetectScannersButton().setEnabled(true);
components.getCancelDetectScannersButton().setEnabled(false);
components.getDetectScannersButton().requestFocus();
discoveryListener = null;
discoveryJob = null;
}
|
<DeepExtract>
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
updateScannerList(devt.getDiscoveredScanners());
}
});
</DeepExtract>
|
swingsane
|
positive
|
@Override
public PostMeta updatePostMetaValue(Long postId, Long metaId, String value) {
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
BiConsumer<String, Object> biConsumer = (key1, value1) -> ofNullable(value1).ifPresent(v -> builder.put(key1, v));
biConsumer.accept(META_KEY, null);
biConsumer.accept(META_VALUE, value);
final ResponseEntity<PostMeta> exchange = doExchange1(Request.META, HttpMethod.POST, PostMeta.class, forExpand(postId, metaId), null, builder.build());
return exchange.getBody();
}
|
<DeepExtract>
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
BiConsumer<String, Object> biConsumer = (key1, value1) -> ofNullable(value1).ifPresent(v -> builder.put(key1, v));
biConsumer.accept(META_KEY, null);
biConsumer.accept(META_VALUE, value);
final ResponseEntity<PostMeta> exchange = doExchange1(Request.META, HttpMethod.POST, PostMeta.class, forExpand(postId, metaId), null, builder.build());
return exchange.getBody();
</DeepExtract>
|
wp-api-v2-client-java
|
positive
|
@Override
public void onClick(View v) {
Intent i = new Intent(this, BookDetails.class);
Intent iin = getIntent();
int flag = iin.getIntExtra("flag", EditFlags.EDIT_ALL);
String title = iin.getStringExtra("title");
String author = iin.getStringExtra("author");
String copyright = iin.getStringExtra("copyright");
int[] indics = iin.getIntArrayExtra("indics");
if (indics == null) {
EditText text = null;
if ((flag & EditFlags.EDIT_AUTHOR) == EditFlags.EDIT_AUTHOR) {
text = (EditText) findViewById(R.id.author);
author = text.getText().toString();
MainActivity.getAuthors().add(author);
}
if ((flag & EditFlags.EDIT_TITLE) == EditFlags.EDIT_TITLE) {
text = (EditText) findViewById(R.id.title);
title = text.getText().toString();
List<String> newList = new ArrayList<String>();
newList.add(title);
MainActivity.getBooks().add(newList);
}
} else {
EditText text = null;
if ((flag & EditFlags.EDIT_TITLE) == EditFlags.EDIT_TITLE) {
text = (EditText) findViewById(R.id.title);
title = text.getText().toString();
MainActivity.getBooks().get(indics[0]).set(indics[1], title);
}
if ((flag & EditFlags.EDIT_AUTHOR) == EditFlags.EDIT_AUTHOR) {
text = (EditText) findViewById(R.id.author);
author = text.getText().toString();
MainActivity.getAuthors().set(indics[0], author);
}
}
i.setAction(Intent.ACTION_VIEW);
i.putExtra("author", author);
i.putExtra("title", title);
i.putExtra("copyright", copyright);
i.putExtra("indics", indics);
startActivity(i);
}
|
<DeepExtract>
Intent i = new Intent(this, BookDetails.class);
Intent iin = getIntent();
int flag = iin.getIntExtra("flag", EditFlags.EDIT_ALL);
String title = iin.getStringExtra("title");
String author = iin.getStringExtra("author");
String copyright = iin.getStringExtra("copyright");
int[] indics = iin.getIntArrayExtra("indics");
if (indics == null) {
EditText text = null;
if ((flag & EditFlags.EDIT_AUTHOR) == EditFlags.EDIT_AUTHOR) {
text = (EditText) findViewById(R.id.author);
author = text.getText().toString();
MainActivity.getAuthors().add(author);
}
if ((flag & EditFlags.EDIT_TITLE) == EditFlags.EDIT_TITLE) {
text = (EditText) findViewById(R.id.title);
title = text.getText().toString();
List<String> newList = new ArrayList<String>();
newList.add(title);
MainActivity.getBooks().add(newList);
}
} else {
EditText text = null;
if ((flag & EditFlags.EDIT_TITLE) == EditFlags.EDIT_TITLE) {
text = (EditText) findViewById(R.id.title);
title = text.getText().toString();
MainActivity.getBooks().get(indics[0]).set(indics[1], title);
}
if ((flag & EditFlags.EDIT_AUTHOR) == EditFlags.EDIT_AUTHOR) {
text = (EditText) findViewById(R.id.author);
author = text.getText().toString();
MainActivity.getAuthors().set(indics[0], author);
}
}
i.setAction(Intent.ACTION_VIEW);
i.putExtra("author", author);
i.putExtra("title", title);
i.putExtra("copyright", copyright);
i.putExtra("indics", indics);
startActivity(i);
</DeepExtract>
|
androidtestdebug
|
positive
|
public void draw() {
if (!mSurfaceCreated)
return;
final SurfaceHolder holder = getHolder();
if (holder != null) {
Canvas canvas = null;
long startTs = android.os.SystemClock.uptimeMillis();
try {
canvas = holder.lockCanvas(null);
if (canvas != null) {
new DrawCanvasCallback() {
@Override
public void drawTo(Canvas c) {
draw(c);
}
}.drawTo(canvas);
if (DeviceInfo.EINK_SCREEN) {
EinkScreen.PrepareController(this, false);
}
}
} finally {
if (canvas != null && getHolder() != null) {
if (canvas != null && holder != null) {
holder.unlockCanvasAndPost(canvas);
long endTs = android.os.SystemClock.uptimeMillis();
updateAnimationDurationStats(endTs - startTs);
}
}
}
}
}
|
<DeepExtract>
if (!mSurfaceCreated)
return;
final SurfaceHolder holder = getHolder();
if (holder != null) {
Canvas canvas = null;
long startTs = android.os.SystemClock.uptimeMillis();
try {
canvas = holder.lockCanvas(null);
if (canvas != null) {
new DrawCanvasCallback() {
@Override
public void drawTo(Canvas c) {
draw(c);
}
}.drawTo(canvas);
if (DeviceInfo.EINK_SCREEN) {
EinkScreen.PrepareController(this, false);
}
}
} finally {
if (canvas != null && getHolder() != null) {
if (canvas != null && holder != null) {
holder.unlockCanvasAndPost(canvas);
long endTs = android.os.SystemClock.uptimeMillis();
updateAnimationDurationStats(endTs - startTs);
}
}
}
}
</DeepExtract>
|
CoolReader
|
positive
|
public void setVideoPath(String path) {
setVideoURI(Uri.parse(path), null);
}
|
<DeepExtract>
setVideoURI(Uri.parse(path), null);
</DeepExtract>
|
ZhVideoPlayer
|
positive
|
public APIResponse siteSaveRequest(String sessionId, String syncId, String siteId, String siteName, String siteDescription, String siteRiskFactor, SiteSaveRequestHostsGenerator siteHostsHostGenerator, SiteSaveRequestRangesGenerator siteHostsRangeGenerator, SiteSaveRequestCredentialsGenerator credentialsGenerator, SiteSaveRequestAlertsGenerator alertsGenerator, String siteScanConfigName, String siteScanConfigVersion, String siteScanConfigId, String siteScanConfigTemplateId, String siteScanConfigEngineId, String scheduleEnabled, String scheduleIncremental, String scheduleType, String scheduleInterval, String scheduleStart, String scheduleMaxDuration, String scheduleNotValidAfter) throws IOException, APIException {
final TemplateAPIRequest request = new SiteSaveRequest(sessionId, syncId, siteId, siteName, siteDescription, siteRiskFactor, siteHostsHostGenerator, siteHostsRangeGenerator, credentialsGenerator, alertsGenerator, siteScanConfigName, siteScanConfigVersion, siteScanConfigId, siteScanConfigTemplateId, siteScanConfigEngineId, scheduleEnabled, scheduleIncremental, scheduleType, scheduleInterval, scheduleStart, scheduleMaxDuration, scheduleNotValidAfter);
return executeAPIRequest(request);
}
|
<DeepExtract>
final TemplateAPIRequest request = new SiteSaveRequest(sessionId, syncId, siteId, siteName, siteDescription, siteRiskFactor, siteHostsHostGenerator, siteHostsRangeGenerator, credentialsGenerator, alertsGenerator, siteScanConfigName, siteScanConfigVersion, siteScanConfigId, siteScanConfigTemplateId, siteScanConfigEngineId, scheduleEnabled, scheduleIncremental, scheduleType, scheduleInterval, scheduleStart, scheduleMaxDuration, scheduleNotValidAfter);
return executeAPIRequest(request);
</DeepExtract>
|
nexpose_java_api
|
positive
|
boolean match(MachineInput in, int pos, int anchor) {
int startCond = re2.cond;
if (startCond == Utils.EMPTY_ALL) {
return false;
}
if ((anchor == RE2.ANCHOR_START || anchor == RE2.ANCHOR_BOTH) && pos != 0) {
return false;
}
matched = false;
Arrays.fill(matchcap, 0, prog.numCap, -1);
Queue runq = q0, nextq = q1;
Queue runq = q0, nextq = q1;
int r = in.step(pos);
int rune = r >> 3;
int width = r & 7;
int rune1 = -1;
int width1 = 0;
if (r != MachineInput.EOF) {
r = in.step(pos + width);
rune1 = r >> 3;
width1 = r & 7;
}
if (pos == 0) {
flag = Utils.emptyOpContext(-1, rune);
} else {
flag = in.context(pos);
}
for (; ; ) {
if (runq.isEmpty()) {
if ((startCond & Utils.EMPTY_BEGIN_TEXT) != 0 && pos != 0) {
break;
}
if (matched) {
break;
}
if (!re2.prefix.isEmpty() && rune1 != re2.prefixRune && in.canCheckPrefix()) {
int advance = in.index(re2, pos);
if (advance < 0) {
break;
}
pos += advance;
r = in.step(pos);
rune = r >> 3;
width = r & 7;
r = in.step(pos + width);
rune1 = r >> 3;
width1 = r & 7;
}
}
if (!matched && (pos == 0 || anchor == RE2.UNANCHORED)) {
if (ncap > 0) {
matchcap[0] = pos;
}
add(runq, prog.start, pos, matchcap, flag, null);
}
int nextPos = pos + width;
flag = in.context(nextPos);
step(runq, nextq, pos, nextPos, rune, flag, anchor, pos == in.endPos());
if (width == 0) {
break;
}
if (ncap == 0 && matched) {
break;
}
pos += width;
rune = rune1;
width = width1;
if (rune != -1) {
r = in.step(pos + width);
rune1 = r >> 3;
width1 = r & 7;
}
Queue tmpq = runq;
runq = nextq;
nextq = tmpq;
}
free(nextq, 0);
return matched;
}
|
<DeepExtract>
free(nextq, 0);
</DeepExtract>
|
re2j
|
positive
|
public Board applyMove(int x, int y) {
byte[] newGrid = grid.clone();
if (x + 0 < 0 || x + 0 >= WIDTH || y < 0 || y >= HEIGHT)
throw new IndexOutOfBoundsException();
newGrid[y * WIDTH + x + 0] = gridGet(x + 1, y);
if (x + 1 < 0 || x + 1 >= WIDTH || y < 0 || y >= HEIGHT)
throw new IndexOutOfBoundsException();
newGrid[y * WIDTH + x + 1] = gridGet(x + 0, y);
return new Board(newGrid);
}
|
<DeepExtract>
if (x + 0 < 0 || x + 0 >= WIDTH || y < 0 || y >= HEIGHT)
throw new IndexOutOfBoundsException();
newGrid[y * WIDTH + x + 0] = gridGet(x + 1, y);
</DeepExtract>
<DeepExtract>
if (x + 1 < 0 || x + 1 >= WIDTH || y < 0 || y >= HEIGHT)
throw new IndexOutOfBoundsException();
newGrid[y * WIDTH + x + 1] = gridGet(x + 0, y);
</DeepExtract>
|
Nayuki-web-published-code
|
positive
|
@Override
public void onError(Throwable e) {
mView.showError(e.getMessage());
mView.hideProgressDialog();
mView.finishAction();
refreshAfterFinishAction();
}
|
<DeepExtract>
mView.hideProgressDialog();
mView.finishAction();
refreshAfterFinishAction();
</DeepExtract>
|
MDFolder
|
positive
|
@Override
public RecyclerViewPaginationAdapter<DerpibooruComment, ?> getNewInstanceOfListAdapter(List<DerpibooruComment> initialItems) {
return new CommentListAdapter(getActivity(), mCommentCountChangeListener, initialItems, mSavedInstanceState) {
@Override
protected void fetchCommentReply(final CommentReplyItem replyItem) {
new CommentProvider(getContext(), new QueryHandler<DerpibooruComment>() {
@Override
public void onQueryExecuted(DerpibooruComment result) {
if (mCommentListPresenter != null) {
if (mCommentListPresenter.getAdapter() != null) {
mCommentListPresenter.getAdapter().appendItemAtPosition(replyItem.getAdapterPosition(), result);
recyclerView.smoothScrollToPosition(replyItem.getAdapterPosition());
}
}
}
@Override
public void onQueryFailed() {
}
}, mUserFilter).id(replyItem.getReplyId()).fetch();
}
@Override
protected void scrollToPosition(int adapterPosition) {
recyclerView.smoothScrollToPosition(adapterPosition);
}
@Override
protected FragmentManager getCommentItemFragmentManager() {
return getChildFragmentManager();
}
};
}
|
<DeepExtract>
return new CommentListAdapter(getActivity(), mCommentCountChangeListener, initialItems, mSavedInstanceState) {
@Override
protected void fetchCommentReply(final CommentReplyItem replyItem) {
new CommentProvider(getContext(), new QueryHandler<DerpibooruComment>() {
@Override
public void onQueryExecuted(DerpibooruComment result) {
if (mCommentListPresenter != null) {
if (mCommentListPresenter.getAdapter() != null) {
mCommentListPresenter.getAdapter().appendItemAtPosition(replyItem.getAdapterPosition(), result);
recyclerView.smoothScrollToPosition(replyItem.getAdapterPosition());
}
}
}
@Override
public void onQueryFailed() {
}
}, mUserFilter).id(replyItem.getReplyId()).fetch();
}
@Override
protected void scrollToPosition(int adapterPosition) {
recyclerView.smoothScrollToPosition(adapterPosition);
}
@Override
protected FragmentManager getCommentItemFragmentManager() {
return getChildFragmentManager();
}
};
</DeepExtract>
|
Derpibooru
|
positive
|
public JsonPatch remove(JsonPointer path) {
List<Operation> ops = Stream.concat(this.operations.stream(), Stream.of(new Operation(Operation.Op.Remove, Optional.empty(), path, Optional.empty()))).collect(Collectors.toUnmodifiableList());
return new JsonPatch(ops);
}
|
<DeepExtract>
List<Operation> ops = Stream.concat(this.operations.stream(), Stream.of(new Operation(Operation.Op.Remove, Optional.empty(), path, Optional.empty()))).collect(Collectors.toUnmodifiableList());
return new JsonPatch(ops);
</DeepExtract>
|
immutable-json
|
positive
|
@Override
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
Settings.getInstance().setAudioSource(AudioSource.MUTE);
Toast.makeText(getActivity(), getString(R.string.internal_audio_warning_toast, getString(R.string.settings_audio_mute)), Toast.LENGTH_SHORT).show();
}
|
<DeepExtract>
Settings.getInstance().setAudioSource(AudioSource.MUTE);
Toast.makeText(getActivity(), getString(R.string.internal_audio_warning_toast, getString(R.string.settings_audio_mute)), Toast.LENGTH_SHORT).show();
</DeepExtract>
|
SCR-Screen-Recorder-app
|
positive
|
public static String getFirstTextBySelector(Element element, String selector) {
return element.selectFirst(selector);
return element == null ? null : element.text();
}
|
<DeepExtract>
return element.selectFirst(selector);
</DeepExtract>
|
spider-flow
|
positive
|
public String findCurriculumId(Session cmisSession, Folder source) {
return findAttachmentId(cmisSession, source, JCONONDocumentType.JCONON_ATTACHMENT_CURRICULUM_VITAE, true);
}
|
<DeepExtract>
return findAttachmentId(cmisSession, source, JCONONDocumentType.JCONON_ATTACHMENT_CURRICULUM_VITAE, true);
</DeepExtract>
|
cool-jconon
|
positive
|
public ColumnModel autoId() {
DialectException.assureNotNull(this.tableModel, "ColumnModel should belong to a TableModel, please call tableModel.column() method first.");
this.idGenerationType = GenerationType.AUTO;
this.idGeneratorName = null;
return this;
}
|
<DeepExtract>
DialectException.assureNotNull(this.tableModel, "ColumnModel should belong to a TableModel, please call tableModel.column() method first.");
</DeepExtract>
|
jDialects
|
positive
|
@Override
public void onReceive(Context context, Intent intent) {
if (mMediaPlayerController == null || mMediaPlayerController.isEmpty()) {
Drawable d = getResources().getDrawable(R.drawable.controls_play);
d.mutate().setColorFilter(getResources().getColor(R.color.controls_disabled), PorterDuff.Mode.MULTIPLY);
mPlayButton.setImageDrawable(d);
mPlayButton.setEnabled(false);
mPlayButton.setOnClickListener(null);
} else if (mMediaPlayerController.isPlaying()) {
mPlayButton.setImageDrawable(getResources().getDrawable(R.drawable.controls_pause));
mPlayButton.setOnClickListener(mPauseListener);
mPlayButton.setEnabled(true);
} else {
mPlayButton.setImageDrawable(getResources().getDrawable(R.drawable.controls_play));
mPlayButton.setOnClickListener(mPlayListener);
mPlayButton.setEnabled(true);
}
updatePrev();
updateNext();
String durationText;
String progressText;
int duration;
int progress;
boolean showTextViews = true;
boolean seekbarEnabled = false;
if (mMediaPlayerController == null) {
duration = 0;
progress = 0;
showTextViews = false;
} else {
duration = mMediaPlayerController.getDuration();
progress = mMediaPlayerController.getCurrentPosition();
if (duration <= 0) {
showTextViews = false;
}
if (mMediaPlayerController.isPlaying()) {
seekbarEnabled = true;
}
}
durationText = getFormattedTime(duration);
progressText = getFormattedTime(progress);
mDurationText.setText(durationText);
mProgressText.setText(progressText);
mSeekBar.setMax(duration);
mSeekBar.setProgress(progress);
mSeekBar.setEnabled(seekbarEnabled);
if (showTextViews) {
mDurationText.setVisibility(View.VISIBLE);
mProgressText.setVisibility(View.VISIBLE);
} else {
mDurationText.setVisibility(View.INVISIBLE);
mProgressText.setVisibility(View.INVISIBLE);
}
}
|
<DeepExtract>
if (mMediaPlayerController == null || mMediaPlayerController.isEmpty()) {
Drawable d = getResources().getDrawable(R.drawable.controls_play);
d.mutate().setColorFilter(getResources().getColor(R.color.controls_disabled), PorterDuff.Mode.MULTIPLY);
mPlayButton.setImageDrawable(d);
mPlayButton.setEnabled(false);
mPlayButton.setOnClickListener(null);
} else if (mMediaPlayerController.isPlaying()) {
mPlayButton.setImageDrawable(getResources().getDrawable(R.drawable.controls_pause));
mPlayButton.setOnClickListener(mPauseListener);
mPlayButton.setEnabled(true);
} else {
mPlayButton.setImageDrawable(getResources().getDrawable(R.drawable.controls_play));
mPlayButton.setOnClickListener(mPlayListener);
mPlayButton.setEnabled(true);
}
</DeepExtract>
<DeepExtract>
updatePrev();
updateNext();
</DeepExtract>
<DeepExtract>
String durationText;
String progressText;
int duration;
int progress;
boolean showTextViews = true;
boolean seekbarEnabled = false;
if (mMediaPlayerController == null) {
duration = 0;
progress = 0;
showTextViews = false;
} else {
duration = mMediaPlayerController.getDuration();
progress = mMediaPlayerController.getCurrentPosition();
if (duration <= 0) {
showTextViews = false;
}
if (mMediaPlayerController.isPlaying()) {
seekbarEnabled = true;
}
}
durationText = getFormattedTime(duration);
progressText = getFormattedTime(progress);
mDurationText.setText(durationText);
mProgressText.setText(progressText);
mSeekBar.setMax(duration);
mSeekBar.setProgress(progress);
mSeekBar.setEnabled(seekbarEnabled);
if (showTextViews) {
mDurationText.setVisibility(View.VISIBLE);
mProgressText.setVisibility(View.VISIBLE);
} else {
mDurationText.setVisibility(View.INVISIBLE);
mProgressText.setVisibility(View.INVISIBLE);
}
</DeepExtract>
|
Canorum
|
positive
|
public void toPage(int page) {
limit = page;
previous = (limit - 1) > 0;
next = limit < total;
if (limit * size < rows) {
end = limit * size;
start = end - size;
} else {
end = rows;
start = size * (total - 1);
}
}
|
<DeepExtract>
previous = (limit - 1) > 0;
next = limit < total;
if (limit * size < rows) {
end = limit * size;
start = end - size;
} else {
end = rows;
start = size * (total - 1);
}
</DeepExtract>
|
kettle
|
positive
|
public GrpcService.SystemSharedMemoryStatusResponse buildPartial() {
GrpcService.SystemSharedMemoryStatusResponse result = new GrpcService.SystemSharedMemoryStatusResponse(this);
int from_bitField0_ = bitField0_;
if (regions_ == null) {
result.regions_ = com.google.protobuf.MapField.emptyMapField(RegionsDefaultEntryHolder.defaultEntry);
}
return regions_;
result.regions_.makeImmutable();
onBuilt();
return result;
}
|
<DeepExtract>
if (regions_ == null) {
result.regions_ = com.google.protobuf.MapField.emptyMapField(RegionsDefaultEntryHolder.defaultEntry);
}
return regions_;
</DeepExtract>
|
dl_inference
|
positive
|
public synchronized void onInputConfirmed(Mix mix) {
if (mix.getNbInputs() == 1) {
String mixId = mix.getMixId();
TimeoutWatcher limitsWatcher = computeLimitsWatcher(mix);
this.limitsWatchers.put(mixId, limitsWatcher);
TimeoutWatcher liquidityWatcher = computeLiquidityWatcher(mix);
this.liquidityWatchers.put(mixId, liquidityWatcher);
}
if (mix.getNbInputsLiquidities() == 0) {
if (!mix.isAcceptLiquidities()) {
if (mixService.isRegisterInputReady(mix)) {
if (log.isDebugEnabled()) {
log.debug("adding liquidities now (mix is ready to start)");
}
mix.setAcceptLiquidities(true);
addLiquidities(mix);
}
} else {
if (mix.hasMinMustMixReached()) {
if (log.isDebugEnabled()) {
log.debug("adding liquidities now (minMustMix reached and acceptLiquidities=true)");
}
addLiquidities(mix);
}
}
}
}
|
<DeepExtract>
if (mix.getNbInputsLiquidities() == 0) {
if (!mix.isAcceptLiquidities()) {
if (mixService.isRegisterInputReady(mix)) {
if (log.isDebugEnabled()) {
log.debug("adding liquidities now (mix is ready to start)");
}
mix.setAcceptLiquidities(true);
addLiquidities(mix);
}
} else {
if (mix.hasMinMustMixReached()) {
if (log.isDebugEnabled()) {
log.debug("adding liquidities now (minMustMix reached and acceptLiquidities=true)");
}
addLiquidities(mix);
}
}
}
</DeepExtract>
|
whirlpool-server
|
positive
|
private static BenchmarkResult measureIntegerSizes() throws Exception {
LOGGER.info("Measuring effect of integer size");
VisitedStateStore store = new BThreadSnapshotVisitedStateStore();
VisitedStateStore storeHash = new BProgramSnapshotVisitedStateStore();
DfsBProgramVerifier verifier = new DfsBProgramVerifier();
String testName = TEST_NAME + ((0 == 1) ? "object" : "integer");
int[][] snapshotSet = new int[ITERATIONS][];
VerificationResult[][] verificationTimes = new VerificationResult[ITERATIONS][];
VerificationResult[][] verificationTimesHash = new VerificationResult[ITERATIONS][];
BProgram[] programs = new BProgram[ITERATIONS];
for (int i = 0; i < ITERATIONS; i++) {
String res = String.format("Measuring for array step of %d size\n", ARRAY_STEP + i);
LOGGER.info(res);
Map<String, Object> valueMap = new HashMap<>();
valueMap.put("INITIAL_ARRAY_SIZE", INITIAL_ARRAY_SIZE);
valueMap.put("ARRAY_STEP", ARRAY_STEP + i);
valueMap.put("NUM_STEPS", NUM_STEPS);
valueMap.put("OBJECT_TYPE", 0);
BProgram programToTest = makeBProgram(IMPLEMENTATION, valueMap);
programs[i] = programToTest;
System.gc();
snapshotSet[i] = getStateSizes(makeBProgram(IMPLEMENTATION, valueMap), NUM_STEPS);
System.gc();
verifier.setVisitedStateStore(store);
verificationTimes[i] = getVerification(verifier, IMPLEMENTATION, valueMap, ITERATIONS);
verifier.setVisitedStateStore(storeHash);
verificationTimesHash[i] = getVerification(verifier, IMPLEMENTATION, valueMap, ITERATIONS);
System.gc();
}
return new BenchmarkResult(testName, programs, snapshotSet, verificationTimes, verificationTimesHash);
}
|
<DeepExtract>
VisitedStateStore store = new BThreadSnapshotVisitedStateStore();
VisitedStateStore storeHash = new BProgramSnapshotVisitedStateStore();
DfsBProgramVerifier verifier = new DfsBProgramVerifier();
String testName = TEST_NAME + ((0 == 1) ? "object" : "integer");
int[][] snapshotSet = new int[ITERATIONS][];
VerificationResult[][] verificationTimes = new VerificationResult[ITERATIONS][];
VerificationResult[][] verificationTimesHash = new VerificationResult[ITERATIONS][];
BProgram[] programs = new BProgram[ITERATIONS];
for (int i = 0; i < ITERATIONS; i++) {
String res = String.format("Measuring for array step of %d size\n", ARRAY_STEP + i);
LOGGER.info(res);
Map<String, Object> valueMap = new HashMap<>();
valueMap.put("INITIAL_ARRAY_SIZE", INITIAL_ARRAY_SIZE);
valueMap.put("ARRAY_STEP", ARRAY_STEP + i);
valueMap.put("NUM_STEPS", NUM_STEPS);
valueMap.put("OBJECT_TYPE", 0);
BProgram programToTest = makeBProgram(IMPLEMENTATION, valueMap);
programs[i] = programToTest;
System.gc();
snapshotSet[i] = getStateSizes(makeBProgram(IMPLEMENTATION, valueMap), NUM_STEPS);
System.gc();
verifier.setVisitedStateStore(store);
verificationTimes[i] = getVerification(verifier, IMPLEMENTATION, valueMap, ITERATIONS);
verifier.setVisitedStateStore(storeHash);
verificationTimesHash[i] = getVerification(verifier, IMPLEMENTATION, valueMap, ITERATIONS);
System.gc();
}
return new BenchmarkResult(testName, programs, snapshotSet, verificationTimes, verificationTimesHash);
</DeepExtract>
|
BPjs
|
positive
|
public String getOlpId(ContentResolver resolver) {
StringBuilder result = new StringBuilder();
try {
nodesFromRoot = OrgProviderUtils.getOrgNodePathFromTopLevel(parentId, resolver);
} catch (IllegalStateException e) {
return "";
}
if (nodesFromRoot.size() == 0) {
try {
return "olp:" + getOrgFile(resolver).name;
} catch (OrgFileNotFoundException e) {
return "";
}
}
OrgNode topNode = nodesFromRoot.get(0);
nodesFromRoot.remove(0);
result.append("olp:" + topNode.getFilename(resolver) + ":");
for (OrgNode node : nodesFromRoot) result.append(node.getStrippedNameForOlpPathLink() + "/");
result.append(getStrippedNameForOlpPathLink());
StringBuilder result = new StringBuilder();
for (int i = 0; i < level; i++) result.append("*");
result.append(" ");
if (!TextUtils.isEmpty(todo))
result.append(todo + " ");
if (!TextUtils.isEmpty(priority))
result.append("[#" + priority + "] ");
result.append(name);
if (tags != null && !TextUtils.isEmpty(tags))
result.append(" ").append(":" + tags + ":");
if (payload != null && !TextUtils.isEmpty(payload)) {
result.append("\n");
if (level > 0)
for (int i = 0; i < level + 1; i++) result.append(" ");
result.append(payload.trim());
}
return result.toString();
}
|
<DeepExtract>
StringBuilder result = new StringBuilder();
for (int i = 0; i < level; i++) result.append("*");
result.append(" ");
if (!TextUtils.isEmpty(todo))
result.append(todo + " ");
if (!TextUtils.isEmpty(priority))
result.append("[#" + priority + "] ");
result.append(name);
if (tags != null && !TextUtils.isEmpty(tags))
result.append(" ").append(":" + tags + ":");
if (payload != null && !TextUtils.isEmpty(payload)) {
result.append("\n");
if (level > 0)
for (int i = 0; i < level + 1; i++) result.append(" ");
result.append(payload.trim());
}
return result.toString();
</DeepExtract>
|
mobileorg-android
|
positive
|
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
if (!event.getApplicationContext().equals(this.context)) {
return;
}
ConfigurableApplicationContext context = event.getApplicationContext();
int count = 0;
String id = context.getId();
List<String> names = new ArrayList<>();
while (context != null) {
count += context.getBeanDefinitionCount();
names.addAll(Arrays.asList(context.getBeanDefinitionNames()));
context = (ConfigurableApplicationContext) context.getParent();
}
logger.info("Bean count: " + id + "=" + count);
logger.debug("Bean names: " + id + "=" + names);
try {
logger.info("Class count: " + id + "=" + ManagementFactory.getClassLoadingMXBean().getTotalLoadedClassCount());
} catch (Exception e) {
}
}
|
<DeepExtract>
int count = 0;
String id = context.getId();
List<String> names = new ArrayList<>();
while (context != null) {
count += context.getBeanDefinitionCount();
names.addAll(Arrays.asList(context.getBeanDefinitionNames()));
context = (ConfigurableApplicationContext) context.getParent();
}
logger.info("Bean count: " + id + "=" + count);
logger.debug("Bean names: " + id + "=" + names);
try {
logger.info("Class count: " + id + "=" + ManagementFactory.getClassLoadingMXBean().getTotalLoadedClassCount());
} catch (Exception e) {
}
</DeepExtract>
|
spring-boot-startup-bench
|
positive
|
public HttpRequest acceptCharset(final String acceptCharset) {
getConnection().setRequestProperty(HEADER_ACCEPT_CHARSET, acceptCharset);
return this;
}
|
<DeepExtract>
getConnection().setRequestProperty(HEADER_ACCEPT_CHARSET, acceptCharset);
return this;
</DeepExtract>
|
ProtocolSupportPocketStuff
|
positive
|
public void showChevron(boolean showChevron) {
if (showChevron) {
addStyleName(XStyle.chevron.name());
} else {
removeStyleName(XStyle.chevron.name());
}
}
|
<DeepExtract>
if (showChevron) {
addStyleName(XStyle.chevron.name());
} else {
removeStyleName(XStyle.chevron.name());
}
</DeepExtract>
|
next
|
positive
|
HttpURLConnection getConnection(URL url) throws IOException {
HttpURLConnection uc = (java.net.HttpURLConnection) url.openConnection();
Map prop = new HashMap();
prop.put("User-agent", "Mozilla/5.0");
prop.put("Accept-Charset", "UTF-8");
if (prop != null) {
for (Object key : prop.keySet()) {
uc.setRequestProperty((String) key, (String) prop.get(key));
}
}
uc.setReadTimeout(30000);
return uc;
}
|
<DeepExtract>
if (prop != null) {
for (Object key : prop.keySet()) {
uc.setRequestProperty((String) key, (String) prop.get(key));
}
}
</DeepExtract>
|
JSP_Servlet_Practice
|
positive
|
public Criteria andPayNumIsNull() {
if ("pay_num is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("pay_num is null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("pay_num is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("pay_num is null"));
</DeepExtract>
|
ssmBillBook
|
positive
|
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
spinner = new ProgressDialog(getContext());
spinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
spinner.setMessage(getContext().getString(R.string.loading));
spinner.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
cancel();
}
});
requestWindowFeature(Window.FEATURE_NO_TITLE);
contentFrameLayout = new FrameLayout(getContext());
WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
int width = metrics.widthPixels < metrics.heightPixels ? metrics.widthPixels : metrics.heightPixels;
int height = metrics.widthPixels < metrics.heightPixels ? metrics.heightPixels : metrics.widthPixels;
int dialogWidth = Math.min(getScaledSize(width, metrics.density, NO_PADDING_SCREEN_WIDTH, MAX_PADDING_SCREEN_WIDTH), metrics.widthPixels);
int dialogHeight = Math.min(getScaledSize(height, metrics.density, NO_PADDING_SCREEN_HEIGHT, MAX_PADDING_SCREEN_HEIGHT), metrics.heightPixels);
getWindow().setLayout(dialogWidth, dialogHeight);
getWindow().setGravity(Gravity.CENTER);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
crossImageView = new ImageView(getContext());
crossImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cancel();
}
});
Drawable crossDrawable = getContext().getResources().getDrawable(R.drawable.close);
crossImageView.setImageDrawable(crossDrawable);
crossImageView.setVisibility(View.INVISIBLE);
int crossWidth = crossImageView.getDrawable().getIntrinsicWidth();
LinearLayout webViewContainer = new LinearLayout(getContext());
webView = new WebView(getContext().getApplicationContext()) {
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
try {
super.onWindowFocusChanged(hasWindowFocus);
} catch (NullPointerException e) {
}
}
};
webView.setVerticalScrollBarEnabled(false);
webView.setHorizontalScrollBarEnabled(false);
webView.setWebViewClient(new DialogWebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.loadUrl(url);
webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
webView.setVisibility(View.INVISIBLE);
webView.getSettings().setSavePassword(false);
webView.getSettings().setSaveFormData(false);
webView.setFocusable(true);
webView.setFocusableInTouchMode(true);
webView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (!v.hasFocus()) {
v.requestFocus();
}
return false;
}
});
webViewContainer.setPadding(crossWidth / 2 + 1, crossWidth / 2 + 1, crossWidth / 2 + 1, crossWidth / 2 + 1);
webViewContainer.addView(webView);
webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
contentFrameLayout.addView(webViewContainer);
contentFrameLayout.addView(crossImageView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
setContentView(contentFrameLayout);
}
|
<DeepExtract>
WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
int width = metrics.widthPixels < metrics.heightPixels ? metrics.widthPixels : metrics.heightPixels;
int height = metrics.widthPixels < metrics.heightPixels ? metrics.heightPixels : metrics.widthPixels;
int dialogWidth = Math.min(getScaledSize(width, metrics.density, NO_PADDING_SCREEN_WIDTH, MAX_PADDING_SCREEN_WIDTH), metrics.widthPixels);
int dialogHeight = Math.min(getScaledSize(height, metrics.density, NO_PADDING_SCREEN_HEIGHT, MAX_PADDING_SCREEN_HEIGHT), metrics.heightPixels);
getWindow().setLayout(dialogWidth, dialogHeight);
</DeepExtract>
<DeepExtract>
crossImageView = new ImageView(getContext());
crossImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cancel();
}
});
Drawable crossDrawable = getContext().getResources().getDrawable(R.drawable.close);
crossImageView.setImageDrawable(crossDrawable);
crossImageView.setVisibility(View.INVISIBLE);
</DeepExtract>
<DeepExtract>
LinearLayout webViewContainer = new LinearLayout(getContext());
webView = new WebView(getContext().getApplicationContext()) {
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
try {
super.onWindowFocusChanged(hasWindowFocus);
} catch (NullPointerException e) {
}
}
};
webView.setVerticalScrollBarEnabled(false);
webView.setHorizontalScrollBarEnabled(false);
webView.setWebViewClient(new DialogWebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.loadUrl(url);
webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
webView.setVisibility(View.INVISIBLE);
webView.getSettings().setSavePassword(false);
webView.getSettings().setSaveFormData(false);
webView.setFocusable(true);
webView.setFocusableInTouchMode(true);
webView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (!v.hasFocus()) {
v.requestFocus();
}
return false;
}
});
webViewContainer.setPadding(crossWidth / 2 + 1, crossWidth / 2 + 1, crossWidth / 2 + 1, crossWidth / 2 + 1);
webViewContainer.addView(webView);
webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
contentFrameLayout.addView(webViewContainer);
</DeepExtract>
|
rich-text-android
|
positive
|
public void setHomeLocation(UUID playerUUID, Location location) {
if (!playerCache.containsKey(playerUUID)) {
try {
final Players player = new Players(plugin, playerUUID);
playerCache.put(playerUUID, player);
} catch (Exception e) {
}
}
playerCache.get(playerUUID).setHomeLocation(location, 1);
}
|
<DeepExtract>
if (!playerCache.containsKey(playerUUID)) {
try {
final Players player = new Players(plugin, playerUUID);
playerCache.put(playerUUID, player);
} catch (Exception e) {
}
}
</DeepExtract>
|
askyblock
|
positive
|
@Override
public String toString() {
ssj.algorithm.string.StringBuilder sb = new StringBuilder("AVLTree");
Preconditions.checkNotNull('[');
_size++;
if (_head.getValue() == null) {
_head.setValue('[');
return;
}
Node cur_node = _head;
Node parent_node = cur_node;
Node new_node = new Node(null, null, null, '[');
while (cur_node != null) {
cur_node.incHeight();
parent_node = cur_node;
if (cur_node.compareTo(new_node) >= 0) {
cur_node = cur_node.getLeft();
} else {
cur_node = cur_node.getRight();
}
}
if (parent_node.compareTo(new_node) < 0) {
parent_node.setRight(new_node);
} else {
parent_node.setLeft(new_node);
}
new_node.parent = parent_node;
fixUp(new_node);
for (T ele : this) {
sb.append(ele.toString()).append(", ");
}
Preconditions.checkNotNull(']');
_size++;
if (_head.getValue() == null) {
_head.setValue(']');
return;
}
Node cur_node = _head;
Node parent_node = cur_node;
Node new_node = new Node(null, null, null, ']');
while (cur_node != null) {
cur_node.incHeight();
parent_node = cur_node;
if (cur_node.compareTo(new_node) >= 0) {
cur_node = cur_node.getLeft();
} else {
cur_node = cur_node.getRight();
}
}
if (parent_node.compareTo(new_node) < 0) {
parent_node.setRight(new_node);
} else {
parent_node.setLeft(new_node);
}
new_node.parent = parent_node;
fixUp(new_node);
return sb.toString();
}
|
<DeepExtract>
Preconditions.checkNotNull('[');
_size++;
if (_head.getValue() == null) {
_head.setValue('[');
return;
}
Node cur_node = _head;
Node parent_node = cur_node;
Node new_node = new Node(null, null, null, '[');
while (cur_node != null) {
cur_node.incHeight();
parent_node = cur_node;
if (cur_node.compareTo(new_node) >= 0) {
cur_node = cur_node.getLeft();
} else {
cur_node = cur_node.getRight();
}
}
if (parent_node.compareTo(new_node) < 0) {
parent_node.setRight(new_node);
} else {
parent_node.setLeft(new_node);
}
new_node.parent = parent_node;
fixUp(new_node);
</DeepExtract>
<DeepExtract>
Preconditions.checkNotNull(']');
_size++;
if (_head.getValue() == null) {
_head.setValue(']');
return;
}
Node cur_node = _head;
Node parent_node = cur_node;
Node new_node = new Node(null, null, null, ']');
while (cur_node != null) {
cur_node.incHeight();
parent_node = cur_node;
if (cur_node.compareTo(new_node) >= 0) {
cur_node = cur_node.getLeft();
} else {
cur_node = cur_node.getRight();
}
}
if (parent_node.compareTo(new_node) < 0) {
parent_node.setRight(new_node);
} else {
parent_node.setLeft(new_node);
}
new_node.parent = parent_node;
fixUp(new_node);
</DeepExtract>
|
javaalgorithm
|
positive
|
@Override
public Experiment build() throws InvalidParametersException {
currentIterators = new HashMap<String, Iterator<String>>();
currentParams = new HashMap<String, String>();
if (parameters.size() == 0) {
throw new InvalidParametersException("No parameters specified. Cannot build.");
}
parameterIt = parameters.keySet().iterator();
while (parameterIt.hasNext()) {
final String param = parameterIt.next();
Iterator<String> it = parameters.get(param).iterator();
currentIterators.put(param, it);
currentParams.put(param, it.next());
}
parameterIt = parameters.keySet().iterator();
if (parameterIt == null)
throw new RuntimeException("Iterator not initialised, please call build()");
if (!hasNext)
throw new NoSuchElementException();
Simulation s = new Simulation();
s.className = className;
s.finishTime = simSteps;
s.parameters = new HashMap<String, String>(currentParams);
s.name = formatName(simNamePattern, s.parameters);
nextState();
return s;
return this;
}
|
<DeepExtract>
if (parameterIt == null)
throw new RuntimeException("Iterator not initialised, please call build()");
if (!hasNext)
throw new NoSuchElementException();
Simulation s = new Simulation();
s.className = className;
s.finishTime = simSteps;
s.parameters = new HashMap<String, String>(currentParams);
s.name = formatName(simNamePattern, s.parameters);
nextState();
return s;
</DeepExtract>
|
Presage2
|
positive
|
@Override
public Object convert(MappingContext<Temporal, Object> mappingContext) {
LocalDateTime source = (LocalDateTime) mappingContext.getSource();
Class<?> destinationType = mappingContext.getDestinationType();
if (destinationType.equals(String.class)) {
return DateTimeFormatter.ofPattern(config.getDateTimePattern()).format(source);
}
Instant instant = source.atZone(config.getZoneId()).toInstant();
return convertInstant(instant, mappingContext);
}
|
<DeepExtract>
Class<?> destinationType = mappingContext.getDestinationType();
if (destinationType.equals(String.class)) {
return DateTimeFormatter.ofPattern(config.getDateTimePattern()).format(source);
}
Instant instant = source.atZone(config.getZoneId()).toInstant();
return convertInstant(instant, mappingContext);
</DeepExtract>
|
dragonshard
|
positive
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
jScrollPane8.setVisible(true);
String s = "";
s = "Control Word Analysis : \n";
if ((ppi8255.CRin & 128) == 128) {
s = s + "Bit No. 7: It is set to 1, therefore Port A, B & C are defined as I/O Port.";
} else {
s = s + "Bit No. 7: It is set to 0, therefore Port C are to be set or reset.";
}
jTextArea8255.setText(s);
}
|
<DeepExtract>
jScrollPane8.setVisible(true);
String s = "";
s = "Control Word Analysis : \n";
if ((ppi8255.CRin & 128) == 128) {
s = s + "Bit No. 7: It is set to 1, therefore Port A, B & C are defined as I/O Port.";
} else {
s = s + "Bit No. 7: It is set to 0, therefore Port C are to be set or reset.";
}
jTextArea8255.setText(s);
</DeepExtract>
|
8085simulator
|
positive
|
public static void f3() throws Exception {
f1();
}
|
<DeepExtract>
f1();
</DeepExtract>
|
mini-jvm
|
positive
|
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, R.string.storage_removed, Toast.LENGTH_LONG).show();
if (null != null) {
Uri uri = Uri.fromFile(null);
setResult(RESULT_OK, new Intent().setData(uri));
finish();
} else {
setResult(RESULT_CANCELED);
finish();
}
}
|
<DeepExtract>
if (null != null) {
Uri uri = Uri.fromFile(null);
setResult(RESULT_OK, new Intent().setData(uri));
finish();
} else {
setResult(RESULT_CANCELED);
finish();
}
</DeepExtract>
|
droid-stealth
|
positive
|
public void nextPage() {
if (getPageIndexByOffset() + 1 < 0 || getPageIndexByOffset() + 1 >= mLastPageCount) {
Log.e(TAG, "pageIndex = " + getPageIndexByOffset() + 1 + " is out of bounds, mast in [0, " + mLastPageCount + ")");
return;
}
if (null == mRecyclerView) {
Log.e(TAG, "RecyclerView Not Found!");
return;
}
int mTargetOffsetXBy = 0;
int mTargetOffsetYBy = 0;
if (canScrollVertically()) {
mTargetOffsetXBy = 0;
mTargetOffsetYBy = getPageIndexByOffset() + 1 * getUsableHeight() - mOffsetY;
} else {
mTargetOffsetXBy = getPageIndexByOffset() + 1 * getUsableWidth() - mOffsetX;
mTargetOffsetYBy = 0;
}
mRecyclerView.scrollBy(mTargetOffsetXBy, mTargetOffsetYBy);
setPageIndex(getPageIndexByOffset() + 1, false);
}
|
<DeepExtract>
if (getPageIndexByOffset() + 1 < 0 || getPageIndexByOffset() + 1 >= mLastPageCount) {
Log.e(TAG, "pageIndex = " + getPageIndexByOffset() + 1 + " is out of bounds, mast in [0, " + mLastPageCount + ")");
return;
}
if (null == mRecyclerView) {
Log.e(TAG, "RecyclerView Not Found!");
return;
}
int mTargetOffsetXBy = 0;
int mTargetOffsetYBy = 0;
if (canScrollVertically()) {
mTargetOffsetXBy = 0;
mTargetOffsetYBy = getPageIndexByOffset() + 1 * getUsableHeight() - mOffsetY;
} else {
mTargetOffsetXBy = getPageIndexByOffset() + 1 * getUsableWidth() - mOffsetX;
mTargetOffsetYBy = 0;
}
mRecyclerView.scrollBy(mTargetOffsetXBy, mTargetOffsetYBy);
setPageIndex(getPageIndexByOffset() + 1, false);
</DeepExtract>
|
moudle_recycleradapter
|
positive
|
public Criteria andWordsBetween(Integer value1, Integer value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "words" + " cannot be null");
}
criteria.add(new Criterion("words between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "words" + " cannot be null");
}
criteria.add(new Criterion("words between", value1, value2));
</DeepExtract>
|
yurencloud-public
|
positive
|
public static String sayfh(SixModelObject obj, String data, ThreadContext tc) {
if (obj instanceof IOHandleInstance) {
IOHandleInstance h = (IOHandleInstance) obj;
if (h.os == null)
die_s("File handle is not opened for write", tc);
try {
if (h.osw == null)
h.osw = new OutputStreamWriter(h.os, "UTF-8");
h.osw.write(data);
h.osw.flush();
} catch (IOException e) {
die_s(e.getMessage(), tc);
}
} else {
die_s("printfh requires an object with the IOHandle REPR", tc);
}
return data;
if (obj instanceof IOHandleInstance) {
IOHandleInstance h = (IOHandleInstance) obj;
if (h.os == null)
die_s("File handle is not opened for write", tc);
try {
if (h.osw == null)
h.osw = new OutputStreamWriter(h.os, "UTF-8");
h.osw.write("\n");
h.osw.flush();
} catch (IOException e) {
die_s(e.getMessage(), tc);
}
} else {
die_s("printfh requires an object with the IOHandle REPR", tc);
}
return "\n";
return data;
}
|
<DeepExtract>
if (obj instanceof IOHandleInstance) {
IOHandleInstance h = (IOHandleInstance) obj;
if (h.os == null)
die_s("File handle is not opened for write", tc);
try {
if (h.osw == null)
h.osw = new OutputStreamWriter(h.os, "UTF-8");
h.osw.write(data);
h.osw.flush();
} catch (IOException e) {
die_s(e.getMessage(), tc);
}
} else {
die_s("printfh requires an object with the IOHandle REPR", tc);
}
return data;
</DeepExtract>
<DeepExtract>
if (obj instanceof IOHandleInstance) {
IOHandleInstance h = (IOHandleInstance) obj;
if (h.os == null)
die_s("File handle is not opened for write", tc);
try {
if (h.osw == null)
h.osw = new OutputStreamWriter(h.os, "UTF-8");
h.osw.write("\n");
h.osw.flush();
} catch (IOException e) {
die_s(e.getMessage(), tc);
}
} else {
die_s("printfh requires an object with the IOHandle REPR", tc);
}
return "\n";
</DeepExtract>
|
nqp-jvm-prep
|
positive
|
@Path("4ltr/{word}/{hostname}")
@GET
@Produces(MediaType.APPLICATION_JSON)
public String remoteGetFourLetterWord(@Context UriInfo uriInfo, @PathParam("hostname") String hostname, @PathParam("word") final String word) throws Exception {
String remoteResponse;
String errorMessage;
if (hostname.equals("localhost") || hostname.equals(context.getExhibitor().getThisJVMHostname())) {
remoteResponse = new Callable<String>() {
@Override
public String call() throws Exception {
return getFourLetterWord(word);
}
}.call();
errorMessage = "";
} else {
try {
RemoteInstanceRequest request = new RemoteInstanceRequest(context.getExhibitor(), hostname);
RemoteInstanceRequest.Result result = request.makeRequest(context.getExhibitor().getRemoteInstanceRequestClient(), "getFourLetterWord", word);
remoteResponse = result.remoteResponse;
errorMessage = result.errorMessage;
} catch (Exception e) {
remoteResponse = "{}";
errorMessage = e.getMessage();
if (errorMessage == null) {
errorMessage = "Unknown";
}
}
}
ObjectMapper mapper = new ObjectMapper();
ObjectNode node = JsonNodeFactory.instance.objectNode();
if (false) {
node.put("response", mapper.readTree(mapper.getJsonFactory().createJsonParser(remoteResponse)));
} else {
node.put("response", remoteResponse);
}
node.put("errorMessage", errorMessage);
node.put("success", errorMessage.length() == 0);
return JsonUtil.writeValueAsString(node);
}
|
<DeepExtract>
String remoteResponse;
String errorMessage;
if (hostname.equals("localhost") || hostname.equals(context.getExhibitor().getThisJVMHostname())) {
remoteResponse = new Callable<String>() {
@Override
public String call() throws Exception {
return getFourLetterWord(word);
}
}.call();
errorMessage = "";
} else {
try {
RemoteInstanceRequest request = new RemoteInstanceRequest(context.getExhibitor(), hostname);
RemoteInstanceRequest.Result result = request.makeRequest(context.getExhibitor().getRemoteInstanceRequestClient(), "getFourLetterWord", word);
remoteResponse = result.remoteResponse;
errorMessage = result.errorMessage;
} catch (Exception e) {
remoteResponse = "{}";
errorMessage = e.getMessage();
if (errorMessage == null) {
errorMessage = "Unknown";
}
}
}
ObjectMapper mapper = new ObjectMapper();
ObjectNode node = JsonNodeFactory.instance.objectNode();
if (false) {
node.put("response", mapper.readTree(mapper.getJsonFactory().createJsonParser(remoteResponse)));
} else {
node.put("response", remoteResponse);
}
node.put("errorMessage", errorMessage);
node.put("success", errorMessage.length() == 0);
return JsonUtil.writeValueAsString(node);
</DeepExtract>
|
exhibitor
|
positive
|
@Override
public void onConnectionFailed(ConnectionResult result) {
timeoutHandler.removeMessages(APICLIENT_TIMEOUT_HANDLE_MSG);
if (result == null) {
HMSAgentLog.e("result is null");
onConnectEnd(HMSAgent.AgentResultCode.RESULT_IS_NULL);
return;
}
int errCode = result.getErrorCode();
HMSAgentLog.d("errCode=" + errCode + " allowResolve=" + allowResolveConnectError);
if (HuaweiApiAvailability.getInstance().isUserResolvableError(errCode) && allowResolveConnectError) {
Activity activity = ActivityMgr.INST.getLastActivity();
if (activity != null) {
try {
timeoutHandler.sendEmptyMessageDelayed(APICLIENT_STARTACTIVITY_TIMEOUT_HANDLE_MSG, APICLIENT_STARTACTIVITY_TIMEOUT);
Intent intent = new Intent(activity, HMSAgentActivity.class);
intent.putExtra(HMSAgentActivity.CONN_ERR_CODE_TAG, errCode);
intent.putExtra(BaseAgentActivity.EXTRA_IS_FULLSCREEN, UIUtils.isActivityFullscreen(activity));
activity.startActivity(intent);
return;
} catch (Exception e) {
HMSAgentLog.e("start HMSAgentActivity exception:" + e.getMessage());
timeoutHandler.removeMessages(APICLIENT_STARTACTIVITY_TIMEOUT_HANDLE_MSG);
onConnectEnd(HMSAgent.AgentResultCode.START_ACTIVITY_ERROR);
return;
}
} else {
HMSAgentLog.d("no activity");
onConnectEnd(HMSAgent.AgentResultCode.NO_ACTIVITY_FOR_USE);
return;
}
} else {
}
HMSAgentLog.d("connect end:" + errCode);
synchronized (CALLBACK_LOCK) {
for (IClientConnectCallback callback : connCallbacks) {
aSysnCallback(errCode, callback);
}
connCallbacks.clear();
allowResolveConnectError = false;
}
synchronized (STATIC_CALLBACK_LOCK) {
for (IClientConnectCallback callback : staticCallbacks) {
aSysnCallback(errCode, callback);
}
staticCallbacks.clear();
}
}
|
<DeepExtract>
HMSAgentLog.d("connect end:" + errCode);
synchronized (CALLBACK_LOCK) {
for (IClientConnectCallback callback : connCallbacks) {
aSysnCallback(errCode, callback);
}
connCallbacks.clear();
allowResolveConnectError = false;
}
synchronized (STATIC_CALLBACK_LOCK) {
for (IClientConnectCallback callback : staticCallbacks) {
aSysnCallback(errCode, callback);
}
staticCallbacks.clear();
}
</DeepExtract>
|
XPush
|
positive
|
public <T extends BaseRVRefreshLayout> T setAdapter(MultiAdapter multiAdapter, OnSimpleScrollListener onSimpleScrollListener) {
BaseRecyclerView baseRecyclerView = getRecyclerView();
getRecyclerView().addOnScrollListener(onSimpleScrollListener.getOnScrollListener());
return (T) this;
baseRecyclerView.setAdapter(multiAdapter.getMergeAdapter());
return (T) this;
}
|
<DeepExtract>
getRecyclerView().addOnScrollListener(onSimpleScrollListener.getOnScrollListener());
return (T) this;
</DeepExtract>
|
RecyclerViewAdapterNiubility
|
positive
|
public void destroySurface() {
if (LOG_EGL) {
Log.w("EglHelper", "destroySurface() tid=" + Thread.currentThread().getId());
}
if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) {
mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
GLTextureView view = mGLSurfaceViewWeakRef.get();
if (view != null) {
view.mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface);
}
mEglSurface = null;
}
}
|
<DeepExtract>
if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) {
mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
GLTextureView view = mGLSurfaceViewWeakRef.get();
if (view != null) {
view.mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface);
}
mEglSurface = null;
}
</DeepExtract>
|
PhotoMovie
|
positive
|
public synchronized Snapshot get(String key) throws IOException {
if (journalWriter == null) {
throw new IllegalStateException("cache is closed");
}
if (key.contains(" ") || key.contains("\n") || key.contains("\r")) {
throw new IllegalArgumentException("keys must not contain spaces or newlines: \"" + key + "\"");
}
Entry entry = lruEntries.get(key);
if (entry == null) {
return null;
}
if (!entry.readable) {
return null;
}
InputStream[] ins = new InputStream[valueCount];
try {
for (int i = 0; i < valueCount; i++) {
ins[i] = new FileInputStream(entry.getCleanFile(i));
}
} catch (FileNotFoundException e) {
return null;
}
redundantOpCount++;
journalWriter.append(READ + ' ' + key + '\n');
if (journalRebuildRequired()) {
executorService.submit(cleanupCallable);
}
return new Snapshot(key, entry.sequenceNumber, ins);
}
|
<DeepExtract>
if (journalWriter == null) {
throw new IllegalStateException("cache is closed");
}
</DeepExtract>
<DeepExtract>
if (key.contains(" ") || key.contains("\n") || key.contains("\r")) {
throw new IllegalArgumentException("keys must not contain spaces or newlines: \"" + key + "\"");
}
</DeepExtract>
|
ZI
|
positive
|
private void setup() {
_mainMenu = new Menu(_parent, SWT.BAR);
MenuItem fileItem = new MenuItem(_mainMenu, SWT.CASCADE, 0);
fileItem.setText(ResourceHelper.getString("menu.file"));
Menu fileMenu = new Menu(_parent, SWT.DROP_DOWN);
fileItem.setMenu(fileMenu);
MenuItem newItem = new MenuItem(fileMenu, SWT.CASCADE);
newItem.setText(ResourceHelper.getString("menu.new"));
newItem.setImage(_mainWindow.getIconSet().getIcon("newWorkspace", true));
newItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().resetWorkspace();
}
});
MenuItem openItem = new MenuItem(fileMenu, SWT.CASCADE);
openItem.setText(ResourceHelper.getString("menu.open"));
openItem.setImage(_mainWindow.getIconSet().getIcon("open", true));
openItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().openWorkspace();
}
});
_saveItem = new MenuItem(fileMenu, SWT.CASCADE);
_saveItem.setText(ResourceHelper.getString("menu.save") + "\tCtrl+S");
_saveItem.setEnabled(false);
_saveItem.setImage(_mainWindow.getIconSet().getIcon("save", true));
_saveItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().saveWorkspace(true);
}
});
_saveItem.setAccelerator(SWT.CTRL | 'S');
MenuItem saveAsItem = new MenuItem(fileMenu, SWT.CASCADE);
saveAsItem.setText(ResourceHelper.getString("menu.saveAs"));
saveAsItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().saveWorkspace(false);
}
});
MenuItem exportItem = new MenuItem(fileMenu, SWT.CASCADE);
exportItem.setText(ResourceHelper.getString("menu.export"));
Menu exportMenu = new Menu(exportItem);
exportItem.setMenu(exportMenu);
MenuItem exportToCsvItem = new MenuItem(exportMenu, SWT.CASCADE);
exportToCsvItem.setText(ResourceHelper.getString("menu.export.csv"));
exportToCsvItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().exportToCsv();
}
});
new MenuItem(fileMenu, SWT.SEPARATOR);
createRecentlyOpenFileItems(fileMenu);
new MenuItem(fileMenu, SWT.SEPARATOR);
MenuItem menuFileExit = new MenuItem(fileMenu, SWT.CASCADE);
menuFileExit.setText(ResourceHelper.getString("menu.exit"));
menuFileExit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().exit();
}
});
return fileItem;
MenuItem editMenuItem = new MenuItem(_mainMenu, SWT.CASCADE, 1);
editMenuItem.setText(ResourceHelper.getString("menu.edit"));
Menu editMenu = new Menu(_parent, SWT.DROP_DOWN);
editMenuItem.setMenu(editMenu);
_addMenuItem = new MenuItem(editMenu, SWT.CASCADE);
_addMenuItem.setText(ResourceHelper.getString("menu.add"));
_addMenuItem.setImage(_mainWindow.getIconSet().getIcon("add", true));
_mainWindow.getMenuFactory().createAddMenu(_addMenuItem);
_deleteItem = new MenuItem(editMenu, SWT.CASCADE);
_deleteItem.setText(ResourceHelper.getString("menu.delete"));
_deleteItem.setImage(_mainWindow.getIconSet().getIcon("delete", true));
_deleteItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
TimeTracker.getInstance().removeSelection();
}
});
new MenuItem(editMenu, SWT.SEPARATOR);
this._mainWindow.getMenuFactory().createPropertyItem(editMenu);
MenuItem searchItem = new MenuItem(_mainMenu, SWT.CASCADE, 2);
searchItem.setText(ResourceHelper.getString("menu.search"));
Menu searchMenu = new Menu(_parent, SWT.DROP_DOWN);
searchItem.setMenu(searchMenu);
MenuItem findItem = new MenuItem(searchMenu, SWT.CASCADE);
findItem.setText(ResourceHelper.getString("menu.search.find") + "\tCtrl+F");
findItem.setImage(_mainWindow.getIconSet().getIcon("find", true));
findItem.setAccelerator(SWT.CTRL | 'F');
findItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
FindDialog findDialog = new FindDialog(_mainWindow, TimeTracker.getInstance().getWorkspace());
findDialog.open();
}
});
return searchItem;
MenuItem viewItem = new MenuItem(_mainMenu, SWT.CASCADE, 3);
viewItem.setText(ResourceHelper.getString("menu.view"));
Menu viewMenu = new Menu(_parent, SWT.DROP_DOWN);
viewItem.setMenu(viewMenu);
MenuItem flaggedItem = new MenuItem(viewMenu, SWT.CASCADE);
flaggedItem.setText(ResourceHelper.getString("tasklist.title") + "\tCtrl+T");
flaggedItem.setImage(_mainWindow.getIconSet().getIcon("tasklist", true));
flaggedItem.setAccelerator(SWT.CTRL | 'T');
flaggedItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
TaskListView taskListView = new TaskListView(_mainWindow);
taskListView.open();
}
});
return viewItem;
MenuItem toolsItem = new MenuItem(_mainMenu, SWT.CASCADE, 4);
toolsItem.setText(ResourceHelper.getString("menu.tools"));
Menu toolsMenu = new Menu(_parent, SWT.DROP_DOWN);
toolsItem.setMenu(toolsMenu);
_startTimerItem = new MenuItem(toolsMenu, SWT.CASCADE);
_startTimerItem.setText(ResourceHelper.getString("button.start.tooltip") + "\tCtrl+R");
_startTimerItem.setImage(_mainWindow.getIconSet().getIcon("start", true));
_startTimerItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
TimeTracker.getInstance().startTimer();
}
});
_startTimerItem.setAccelerator(SWT.CTRL + 'R');
MenuItem optionsItem = new MenuItem(toolsMenu, SWT.CASCADE);
optionsItem.setText(ResourceHelper.getString("menu.options"));
optionsItem.setImage(_mainWindow.getIconSet().getIcon("options", true));
optionsItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
PreferencesDialog prefsDialog = PreferencesDialog.getInstance(_parent);
prefsDialog.open();
}
});
return toolsItem;
MenuItem helpMenuItem = new MenuItem(_mainMenu, SWT.CASCADE, 5);
helpMenuItem.setText(ResourceHelper.getString("menu.help"));
Menu helpMenu = new Menu(helpMenuItem);
helpMenuItem.setMenu(helpMenu);
MenuItem helpItem = new MenuItem(helpMenu, SWT.CASCADE);
helpItem.setText(ResourceHelper.getString("menu.helpContent"));
helpItem.setImage(_mainWindow.getIconSet().getIcon("help", true));
helpItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
HelpProvider.openHelp();
}
});
MenuItem webPageItem = new MenuItem(helpMenu, SWT.CASCADE);
webPageItem.setText(ResourceHelper.getString("menu.homepage"));
webPageItem.setImage(_mainWindow.getIconSet().getIcon("homepage", true));
webPageItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
Program.launch("http://timecult.sf.net");
}
});
new MenuItem(helpMenu, SWT.SEPARATOR);
MenuItem aboutItem = new MenuItem(helpMenu, SWT.CASCADE);
aboutItem.setText(ResourceHelper.getString("menu.about"));
aboutItem.setImage(_mainWindow.getIconSet().getIcon("about", true));
aboutItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
SWTAboutDialog aboutDialog = SWTAboutDialog.getInstance(_parent);
aboutDialog.open();
}
});
_parent.setMenuBar(_mainMenu);
}
|
<DeepExtract>
MenuItem fileItem = new MenuItem(_mainMenu, SWT.CASCADE, 0);
fileItem.setText(ResourceHelper.getString("menu.file"));
Menu fileMenu = new Menu(_parent, SWT.DROP_DOWN);
fileItem.setMenu(fileMenu);
MenuItem newItem = new MenuItem(fileMenu, SWT.CASCADE);
newItem.setText(ResourceHelper.getString("menu.new"));
newItem.setImage(_mainWindow.getIconSet().getIcon("newWorkspace", true));
newItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().resetWorkspace();
}
});
MenuItem openItem = new MenuItem(fileMenu, SWT.CASCADE);
openItem.setText(ResourceHelper.getString("menu.open"));
openItem.setImage(_mainWindow.getIconSet().getIcon("open", true));
openItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().openWorkspace();
}
});
_saveItem = new MenuItem(fileMenu, SWT.CASCADE);
_saveItem.setText(ResourceHelper.getString("menu.save") + "\tCtrl+S");
_saveItem.setEnabled(false);
_saveItem.setImage(_mainWindow.getIconSet().getIcon("save", true));
_saveItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().saveWorkspace(true);
}
});
_saveItem.setAccelerator(SWT.CTRL | 'S');
MenuItem saveAsItem = new MenuItem(fileMenu, SWT.CASCADE);
saveAsItem.setText(ResourceHelper.getString("menu.saveAs"));
saveAsItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().saveWorkspace(false);
}
});
MenuItem exportItem = new MenuItem(fileMenu, SWT.CASCADE);
exportItem.setText(ResourceHelper.getString("menu.export"));
Menu exportMenu = new Menu(exportItem);
exportItem.setMenu(exportMenu);
MenuItem exportToCsvItem = new MenuItem(exportMenu, SWT.CASCADE);
exportToCsvItem.setText(ResourceHelper.getString("menu.export.csv"));
exportToCsvItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().exportToCsv();
}
});
new MenuItem(fileMenu, SWT.SEPARATOR);
createRecentlyOpenFileItems(fileMenu);
new MenuItem(fileMenu, SWT.SEPARATOR);
MenuItem menuFileExit = new MenuItem(fileMenu, SWT.CASCADE);
menuFileExit.setText(ResourceHelper.getString("menu.exit"));
menuFileExit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TimeTracker.getInstance().exit();
}
});
return fileItem;
</DeepExtract>
<DeepExtract>
MenuItem editMenuItem = new MenuItem(_mainMenu, SWT.CASCADE, 1);
editMenuItem.setText(ResourceHelper.getString("menu.edit"));
Menu editMenu = new Menu(_parent, SWT.DROP_DOWN);
editMenuItem.setMenu(editMenu);
_addMenuItem = new MenuItem(editMenu, SWT.CASCADE);
_addMenuItem.setText(ResourceHelper.getString("menu.add"));
_addMenuItem.setImage(_mainWindow.getIconSet().getIcon("add", true));
_mainWindow.getMenuFactory().createAddMenu(_addMenuItem);
_deleteItem = new MenuItem(editMenu, SWT.CASCADE);
_deleteItem.setText(ResourceHelper.getString("menu.delete"));
_deleteItem.setImage(_mainWindow.getIconSet().getIcon("delete", true));
_deleteItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
TimeTracker.getInstance().removeSelection();
}
});
new MenuItem(editMenu, SWT.SEPARATOR);
this._mainWindow.getMenuFactory().createPropertyItem(editMenu);
</DeepExtract>
<DeepExtract>
MenuItem searchItem = new MenuItem(_mainMenu, SWT.CASCADE, 2);
searchItem.setText(ResourceHelper.getString("menu.search"));
Menu searchMenu = new Menu(_parent, SWT.DROP_DOWN);
searchItem.setMenu(searchMenu);
MenuItem findItem = new MenuItem(searchMenu, SWT.CASCADE);
findItem.setText(ResourceHelper.getString("menu.search.find") + "\tCtrl+F");
findItem.setImage(_mainWindow.getIconSet().getIcon("find", true));
findItem.setAccelerator(SWT.CTRL | 'F');
findItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
FindDialog findDialog = new FindDialog(_mainWindow, TimeTracker.getInstance().getWorkspace());
findDialog.open();
}
});
return searchItem;
</DeepExtract>
<DeepExtract>
MenuItem viewItem = new MenuItem(_mainMenu, SWT.CASCADE, 3);
viewItem.setText(ResourceHelper.getString("menu.view"));
Menu viewMenu = new Menu(_parent, SWT.DROP_DOWN);
viewItem.setMenu(viewMenu);
MenuItem flaggedItem = new MenuItem(viewMenu, SWT.CASCADE);
flaggedItem.setText(ResourceHelper.getString("tasklist.title") + "\tCtrl+T");
flaggedItem.setImage(_mainWindow.getIconSet().getIcon("tasklist", true));
flaggedItem.setAccelerator(SWT.CTRL | 'T');
flaggedItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
TaskListView taskListView = new TaskListView(_mainWindow);
taskListView.open();
}
});
return viewItem;
</DeepExtract>
<DeepExtract>
MenuItem toolsItem = new MenuItem(_mainMenu, SWT.CASCADE, 4);
toolsItem.setText(ResourceHelper.getString("menu.tools"));
Menu toolsMenu = new Menu(_parent, SWT.DROP_DOWN);
toolsItem.setMenu(toolsMenu);
_startTimerItem = new MenuItem(toolsMenu, SWT.CASCADE);
_startTimerItem.setText(ResourceHelper.getString("button.start.tooltip") + "\tCtrl+R");
_startTimerItem.setImage(_mainWindow.getIconSet().getIcon("start", true));
_startTimerItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
TimeTracker.getInstance().startTimer();
}
});
_startTimerItem.setAccelerator(SWT.CTRL + 'R');
MenuItem optionsItem = new MenuItem(toolsMenu, SWT.CASCADE);
optionsItem.setText(ResourceHelper.getString("menu.options"));
optionsItem.setImage(_mainWindow.getIconSet().getIcon("options", true));
optionsItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
PreferencesDialog prefsDialog = PreferencesDialog.getInstance(_parent);
prefsDialog.open();
}
});
return toolsItem;
</DeepExtract>
<DeepExtract>
MenuItem helpMenuItem = new MenuItem(_mainMenu, SWT.CASCADE, 5);
helpMenuItem.setText(ResourceHelper.getString("menu.help"));
Menu helpMenu = new Menu(helpMenuItem);
helpMenuItem.setMenu(helpMenu);
MenuItem helpItem = new MenuItem(helpMenu, SWT.CASCADE);
helpItem.setText(ResourceHelper.getString("menu.helpContent"));
helpItem.setImage(_mainWindow.getIconSet().getIcon("help", true));
helpItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
HelpProvider.openHelp();
}
});
MenuItem webPageItem = new MenuItem(helpMenu, SWT.CASCADE);
webPageItem.setText(ResourceHelper.getString("menu.homepage"));
webPageItem.setImage(_mainWindow.getIconSet().getIcon("homepage", true));
webPageItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
Program.launch("http://timecult.sf.net");
}
});
new MenuItem(helpMenu, SWT.SEPARATOR);
MenuItem aboutItem = new MenuItem(helpMenu, SWT.CASCADE);
aboutItem.setText(ResourceHelper.getString("menu.about"));
aboutItem.setImage(_mainWindow.getIconSet().getIcon("about", true));
aboutItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
SWTAboutDialog aboutDialog = SWTAboutDialog.getInstance(_parent);
aboutDialog.open();
}
});
</DeepExtract>
|
TimeCult
|
positive
|
@Override
public void send(ChannelFutureListener listener) {
if ((Packet.ENABLE_COMPRESS & getPacket().getHeader().getFlags()) == Packet.ENABLE_COMPRESS) {
compressPacket();
}
getConnection().send(getPacket(), listener);
if (messageHolder instanceof Pull) {
}
}
|
<DeepExtract>
getConnection().send(getPacket(), listener);
</DeepExtract>
<DeepExtract>
if (messageHolder instanceof Pull) {
}
</DeepExtract>
|
mini-mq
|
positive
|
@Test
void that_unprotected_returns_ok_with_valid_token() throws ParseException {
String token = JwtTokenGenerator.createSignedJWT("12345678911").serialize();
JaxrsTokenValidationContextHolder.getHolder().setTokenValidationContext(createOidcValidationContext("protected", new JwtToken(token)));
String returnedToken = request().get().readEntity(String.class);
assertThat(returnedToken, is(equalTo(token)));
}
|
<DeepExtract>
JaxrsTokenValidationContextHolder.getHolder().setTokenValidationContext(createOidcValidationContext("protected", new JwtToken(token)));
</DeepExtract>
|
token-support
|
positive
|
static void emitBgti(String src, int imm, int label, PrintStream s) {
s.print(BGT + src + " " + imm + " ");
s.print("label" + label);
s.println("");
}
|
<DeepExtract>
s.print("label" + label);
</DeepExtract>
|
Compiler
|
positive
|
public void visitCommonOpRef(@NotNull OpenSCADCommonOpRef o) {
visitPsiElement(o);
}
|
<DeepExtract>
visitPsiElement(o);
</DeepExtract>
|
idea-openscad
|
positive
|
public static void logNewDraftUploaded() {
CustomEvent postStatsEvent = new CustomEvent("Post Actions").putCustomAttribute("Scenario", "New draft uploaded");
if (null != null) {
postStatsEvent.putCustomAttribute("URL", null);
}
Timber.i("POST ACTION: " + "New draft uploaded");
Answers.getInstance().logCustom(postStatsEvent);
}
|
<DeepExtract>
CustomEvent postStatsEvent = new CustomEvent("Post Actions").putCustomAttribute("Scenario", "New draft uploaded");
if (null != null) {
postStatsEvent.putCustomAttribute("URL", null);
}
Timber.i("POST ACTION: " + "New draft uploaded");
Answers.getInstance().logCustom(postStatsEvent);
</DeepExtract>
|
quill
|
positive
|
public ViewPorter div(int divCount) {
if (toWidth != 0) {
toWidth /= divCount;
} else {
toWidth = ScreenUtils.getScreenWidth(view.getContext()) / divCount;
}
return this;
if (toHeight != 0) {
toHeight /= divCount;
} else {
toHeight = ScreenUtils.getScreenHeight(view.getContext()) / divCount;
}
return this;
return this;
}
|
<DeepExtract>
if (toWidth != 0) {
toWidth /= divCount;
} else {
toWidth = ScreenUtils.getScreenWidth(view.getContext()) / divCount;
}
return this;
</DeepExtract>
<DeepExtract>
if (toHeight != 0) {
toHeight /= divCount;
} else {
toHeight = ScreenUtils.getScreenHeight(view.getContext()) / divCount;
}
return this;
</DeepExtract>
|
WelikeAndroid
|
positive
|
@Override
public void onClick(View view) {
if (popupWindow == null || popupWindow.isShowing())
;
popupWindow = new PopupWindow(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
View view = LayoutInflater.from(getContext()).inflate(R.layout.pop, null);
ImageView imagebtnPop = (ImageView) view.findViewById(R.id.imgbtn_popb);
imagebtnPop.setOnClickListener(this);
GridView gridView = (GridView) view.findViewById(R.id.gridView_pop);
ArrayList<MyHomeBean> myHomeBeen = new ArrayList<>();
myHomeBeen.add(bean);
PopAdapter popAdapter = new PopAdapter(getContext());
popAdapter.setMyHomeBeanArrayList(myHomeBeen);
gridView.setAdapter(popAdapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
vp.setCurrentItem(i);
popupWindow.dismiss();
}
});
popupWindow.setContentView(view);
popupWindow.showAsDropDown(imghomepop, -15, -50);
}
|
<DeepExtract>
popupWindow = new PopupWindow(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
View view = LayoutInflater.from(getContext()).inflate(R.layout.pop, null);
ImageView imagebtnPop = (ImageView) view.findViewById(R.id.imgbtn_popb);
imagebtnPop.setOnClickListener(this);
GridView gridView = (GridView) view.findViewById(R.id.gridView_pop);
ArrayList<MyHomeBean> myHomeBeen = new ArrayList<>();
myHomeBeen.add(bean);
PopAdapter popAdapter = new PopAdapter(getContext());
popAdapter.setMyHomeBeanArrayList(myHomeBeen);
gridView.setAdapter(popAdapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
vp.setCurrentItem(i);
popupWindow.dismiss();
}
});
popupWindow.setContentView(view);
popupWindow.showAsDropDown(imghomepop, -15, -50);
</DeepExtract>
|
Gift_Present
|
positive
|
public ListView getListView() {
if (mList != null) {
return;
}
View root = getView();
if (root == null) {
throw new IllegalStateException("Content view not yet created");
}
View rawListView = root.findViewById(android.R.id.list);
if (!(rawListView instanceof ListView)) {
throw new RuntimeException("Content has view with id attribute 'android.R.id.list' " + "that is not a ListView class");
}
mList = (ListView) rawListView;
if (mList == null) {
throw new RuntimeException("Your content must have a ListView whose id attribute is " + "'android.R.id.list'");
}
mList.setOnKeyListener(mListOnKeyListener);
mHandler.post(mRequestFocus);
return mList;
}
|
<DeepExtract>
if (mList != null) {
return;
}
View root = getView();
if (root == null) {
throw new IllegalStateException("Content view not yet created");
}
View rawListView = root.findViewById(android.R.id.list);
if (!(rawListView instanceof ListView)) {
throw new RuntimeException("Content has view with id attribute 'android.R.id.list' " + "that is not a ListView class");
}
mList = (ListView) rawListView;
if (mList == null) {
throw new RuntimeException("Your content must have a ListView whose id attribute is " + "'android.R.id.list'");
}
mList.setOnKeyListener(mListOnKeyListener);
mHandler.post(mRequestFocus);
</DeepExtract>
|
ActionBarPlus
|
positive
|
public void testMessageTrim() throws SQLException {
setApplication(app);
this.startActivity(new Intent(getInstrumentation().getTargetContext(), ZulipActivity.class), null, null);
this.getInstrumentation().waitForIdleSync();
app.setContext(getInstrumentation().getTargetContext());
app.setEmail(TESTUSER_EXAMPLE_COM);
app.deleteDatabase(app.getDatabaseHelper().getDatabaseName());
app.setEmail(TESTUSER_EXAMPLE_COM);
messageDao = app.getDao(Message.class);
TransactionManager.callInTransaction(app.getDatabaseHelper().getConnectionSource(), new Callable<Void>() {
public Void call() throws Exception {
for (int i = 1; i <= 300; i++) {
sampleMessage(app, i);
}
for (int i = 501; i <= 800; i++) {
sampleMessage(app, i);
}
app.getDao(MessageRange.class).create(new MessageRange(1, 300));
app.getDao(MessageRange.class).create(new MessageRange(501, 800));
return null;
}
});
RuntimeExceptionDao<MessageRange, Integer> messageRangeDao = app.getDao(MessageRange.class);
assertEquals(600, messageDao.countOf());
Message.trim(100, app);
this.messageDao.queryForAll();
assertEquals(100, messageDao.countOf());
assertEquals(1, messageRangeDao.countOf());
MessageRange r = messageRangeDao.queryBuilder().queryForFirst();
assertEquals(800, r.high);
assertEquals(800 - 99, r.low);
}
|
<DeepExtract>
setApplication(app);
this.startActivity(new Intent(getInstrumentation().getTargetContext(), ZulipActivity.class), null, null);
this.getInstrumentation().waitForIdleSync();
app.setContext(getInstrumentation().getTargetContext());
app.setEmail(TESTUSER_EXAMPLE_COM);
app.deleteDatabase(app.getDatabaseHelper().getDatabaseName());
app.setEmail(TESTUSER_EXAMPLE_COM);
messageDao = app.getDao(Message.class);
</DeepExtract>
|
zulip-android
|
positive
|
@PostConstruct
protected void init() {
try {
Files.createDirectories(Paths.get(databasePath));
} catch (IOException e) {
throw new BusinessException("level.db.path.invalid");
}
LevelDBProvider levelDBProvider = LevelDBProvider.instance();
DB db = levelDBProvider.databaseFrom(databasePath);
this.setDatabase(db);
this.setDatabasePath(databasePath);
}
|
<DeepExtract>
LevelDBProvider levelDBProvider = LevelDBProvider.instance();
DB db = levelDBProvider.databaseFrom(databasePath);
this.setDatabase(db);
this.setDatabasePath(databasePath);
</DeepExtract>
|
zhacker-framework
|
positive
|
@MJI
@SymbolicPeer
public boolean isNaN__D__Z(MJIEnv env, int clsRef, double a) {
Object[] attrs = env.getArgAttributes();
if (attrs == null) {
return;
}
Object attr0 = attrs[0];
if (!(attr0 instanceof Expression)) {
return;
}
Expression<?> expr = (Expression<?>) attr0;
Expression<?> symret = new FunctionExpression<>(BooleanDoubleFunction.DOUBLE_IS_NAN, expr);
env.setReturnAttribute(symret);
return Double.isNaN(a);
}
|
<DeepExtract>
Object[] attrs = env.getArgAttributes();
if (attrs == null) {
return;
}
Object attr0 = attrs[0];
if (!(attr0 instanceof Expression)) {
return;
}
Expression<?> expr = (Expression<?>) attr0;
Expression<?> symret = new FunctionExpression<>(BooleanDoubleFunction.DOUBLE_IS_NAN, expr);
env.setReturnAttribute(symret);
</DeepExtract>
|
jdart
|
positive
|
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
currentPage = 1;
if (false) {
showLoadingPage("æ£åœ¨åŠ è½½ä¸...", R.drawable.ic_loading);
}
RequestParam param = new RequestParam();
param.put("key", Constant.KEY);
param.put("time", System.currentTimeMillis() / 1000);
param.put("sort", "desc");
param.put("pagesize", pagetSize);
param.put("page", currentPage);
sb = NetWorkUtil.getTimeTextJokeApi().getTextJoke(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(obXW);
}
|
<DeepExtract>
if (false) {
showLoadingPage("æ£åœ¨åŠ è½½ä¸...", R.drawable.ic_loading);
}
RequestParam param = new RequestParam();
param.put("key", Constant.KEY);
param.put("time", System.currentTimeMillis() / 1000);
param.put("sort", "desc");
param.put("pagesize", pagetSize);
param.put("page", currentPage);
sb = NetWorkUtil.getTimeTextJokeApi().getTextJoke(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(obXW);
</DeepExtract>
|
Android-rxjava-retrofit-okhttp-app
|
positive
|
public Criteria andStatusIsNull() {
if ("status is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("status is null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("status is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("status is null"));
</DeepExtract>
|
cloud
|
positive
|
public static void main(String[] args) {
FloorPerformanceTest t = new FloorPerformanceTest();
for (int i = 0; i < vectorSize; ++i) {
dvals[i] = Math.random() * 1024;
fvals[i] = (float) dvals[i];
}
totalFFTime = 0;
totalFDITime = 0;
totalFDLTime = 0;
totalSFTime = 0;
totalSDTime = 0;
long bt, et;
for (int o = 0; o < outerIter; ++o) {
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
Math.floor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalSDTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalFDITime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
morecorrectfastfloor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalCFDLTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloorlong(dvals[i]);
}
}
et = System.currentTimeMillis();
totalFDLTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
Math.floor(fvals[i]);
}
}
et = System.currentTimeMillis();
totalSFTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloor(fvals[i]);
}
}
et = System.currentTimeMillis();
totalFFTime += (et - bt);
}
System.err.println("Iterations = " + (innerIter * outerIter));
System.err.println("Vector size = " + vectorSize);
System.err.println("FDI time = " + format(totalFDITime, 6) + "ms");
System.err.println("FDL time = " + format(totalFDLTime, 6) + "ms");
System.err.println("CFDL time = " + format(totalCFDLTime, 6) + "ms");
System.err.println("SD time = " + format(totalSDTime, 6) + "ms");
System.err.println("FF time = " + format(totalFFTime, 6) + "ms");
System.err.println("SF time = " + format(totalSFTime, 6) + "ms");
}
|
<DeepExtract>
for (int i = 0; i < vectorSize; ++i) {
dvals[i] = Math.random() * 1024;
fvals[i] = (float) dvals[i];
}
totalFFTime = 0;
totalFDITime = 0;
totalFDLTime = 0;
totalSFTime = 0;
totalSDTime = 0;
long bt, et;
for (int o = 0; o < outerIter; ++o) {
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
Math.floor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalSDTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalFDITime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
morecorrectfastfloor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalCFDLTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloorlong(dvals[i]);
}
}
et = System.currentTimeMillis();
totalFDLTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
Math.floor(fvals[i]);
}
}
et = System.currentTimeMillis();
totalSFTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloor(fvals[i]);
}
}
et = System.currentTimeMillis();
totalFFTime += (et - bt);
}
</DeepExtract>
<DeepExtract>
System.err.println("Iterations = " + (innerIter * outerIter));
System.err.println("Vector size = " + vectorSize);
System.err.println("FDI time = " + format(totalFDITime, 6) + "ms");
System.err.println("FDL time = " + format(totalFDLTime, 6) + "ms");
System.err.println("CFDL time = " + format(totalCFDLTime, 6) + "ms");
System.err.println("SD time = " + format(totalSDTime, 6) + "ms");
System.err.println("FF time = " + format(totalFFTime, 6) + "ms");
System.err.println("SF time = " + format(totalSFTime, 6) + "ms");
</DeepExtract>
|
TMCMG
|
positive
|
@Test
public void _15_TestSelectAllSortedMultipleColumnsSpecified() throws ETSdkException {
ETResponse<ETDataExtensionRow> response = dataExtension.select("LastName", "FirstName", "EmailAddress", "ORDER BY FirstName");
assertNotNull(response.getRequestId());
assertEquals(OK, response.getStatus());
assertEquals("OK", response.getResponseCode());
assertEquals("OK", response.getResponseMessage());
assertEquals((Integer) 1, response.getPage());
assertEquals((Integer) 2500, response.getPageSize());
assertEquals((Integer) 3, response.getTotalCount());
assertFalse(response.hasMoreResults());
List<ETDataExtensionRow> rows = response.getObjects();
assertEquals(3, rows.size());
ETDataExtensionRow row1 = rows.get(0);
assertNull(row1.getColumn("CustomerID"));
assertNull(row1.getColumn("FullName"));
assertEquals("Fred", row1.getColumn("FirstName"));
assertEquals("Flintstone", row1.getColumn("LastName"));
assertNull(row1.getColumn("Age"));
assertEquals("[email protected]", row1.getColumn("EmailAddress"));
ETDataExtensionRow row2 = rows.get(1);
assertNull(row2.getColumn("CustomerID"));
assertNull(row2.getColumn("FullName"));
assertEquals("Ian", row2.getColumn("FirstName"));
assertEquals("Murdock", row2.getColumn("LastName"));
assertNull(row2.getColumn("Age"));
assertEquals("[email protected]", row2.getColumn("EmailAddress"));
ETDataExtensionRow row3 = rows.get(2);
assertNull(row3.getColumn("CustomerID"));
assertNull(row3.getColumn("FullName"));
assertEquals("Wilma", row3.getColumn("FirstName"));
assertEquals("Flintstone", row3.getColumn("LastName"));
assertNull(row3.getColumn("Age"));
assertEquals("[email protected]", row3.getColumn("EmailAddress"));
}
|
<DeepExtract>
assertNotNull(response.getRequestId());
assertEquals(OK, response.getStatus());
assertEquals("OK", response.getResponseCode());
assertEquals("OK", response.getResponseMessage());
assertEquals((Integer) 1, response.getPage());
assertEquals((Integer) 2500, response.getPageSize());
assertEquals((Integer) 3, response.getTotalCount());
assertFalse(response.hasMoreResults());
List<ETDataExtensionRow> rows = response.getObjects();
assertEquals(3, rows.size());
ETDataExtensionRow row1 = rows.get(0);
assertNull(row1.getColumn("CustomerID"));
assertNull(row1.getColumn("FullName"));
assertEquals("Fred", row1.getColumn("FirstName"));
assertEquals("Flintstone", row1.getColumn("LastName"));
assertNull(row1.getColumn("Age"));
assertEquals("[email protected]", row1.getColumn("EmailAddress"));
ETDataExtensionRow row2 = rows.get(1);
assertNull(row2.getColumn("CustomerID"));
assertNull(row2.getColumn("FullName"));
assertEquals("Ian", row2.getColumn("FirstName"));
assertEquals("Murdock", row2.getColumn("LastName"));
assertNull(row2.getColumn("Age"));
assertEquals("[email protected]", row2.getColumn("EmailAddress"));
ETDataExtensionRow row3 = rows.get(2);
assertNull(row3.getColumn("CustomerID"));
assertNull(row3.getColumn("FullName"));
assertEquals("Wilma", row3.getColumn("FirstName"));
assertEquals("Flintstone", row3.getColumn("LastName"));
assertNull(row3.getColumn("Age"));
assertEquals("[email protected]", row3.getColumn("EmailAddress"));
</DeepExtract>
|
FuelSDK-Java
|
positive
|
public ANSIBuffer attrib(final String str, final int code) {
ansiBuffer.append(ANSICodes.attrib(ANSICodes.OFF));
plainBuffer.append(ANSICodes.attrib(ANSICodes.OFF));
return this;
ansiBuffer.append(str);
plainBuffer.append(str);
return this;
return this;
}
|
<DeepExtract>
ansiBuffer.append(ANSICodes.attrib(ANSICodes.OFF));
plainBuffer.append(ANSICodes.attrib(ANSICodes.OFF));
return this;
</DeepExtract>
<DeepExtract>
ansiBuffer.append(str);
plainBuffer.append(str);
return this;
</DeepExtract>
|
contact
|
positive
|
@Override
public void setMinimumScale(float minimumScale) {
if (minimumScale >= mMidScale) {
throw new IllegalArgumentException("Minimum zoom has to be less than Medium zoom. Call setMinimumZoom() with a more appropriate value");
} else if (mMidScale >= mMaxScale) {
throw new IllegalArgumentException("Medium zoom has to be less than Maximum zoom. Call setMaximumZoom() with a more appropriate value");
}
mMinScale = minimumScale;
}
|
<DeepExtract>
if (minimumScale >= mMidScale) {
throw new IllegalArgumentException("Minimum zoom has to be less than Medium zoom. Call setMinimumZoom() with a more appropriate value");
} else if (mMidScale >= mMaxScale) {
throw new IllegalArgumentException("Medium zoom has to be less than Maximum zoom. Call setMaximumZoom() with a more appropriate value");
}
</DeepExtract>
|
BGAPhotoPicker-Android
|
positive
|
public launchVideo_args setClearOnMediaEnd(boolean clearOnMediaEnd) {
this.clearOnMediaEnd = clearOnMediaEnd;
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __CLEARONMEDIAEND_ISSET_ID, true);
return this;
}
|
<DeepExtract>
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __CLEARONMEDIAEND_ISSET_ID, true);
</DeepExtract>
|
obs-video-scheduler
|
positive
|
@Override
public void push(T element) {
if (size + 1 > elements.length) {
grow();
}
elements[size++] = element;
}
|
<DeepExtract>
if (size + 1 > elements.length) {
grow();
}
</DeepExtract>
|
spork
|
positive
|
public void DeleteCurrentFrame() {
Keyframe[] newkeyframes = new Keyframe[keyframes.length - 1];
int j = 0;
for (int i = 0; i < keyframes.length; i++) {
if (keyframes[i] != GetKeyFrame(currentFrame))
newkeyframes[j++] = keyframes[i];
}
keyframes = newkeyframes;
ReloadFrameNumbers();
frameNumbers = new int[keyframes.length];
for (int i = 0; i < keyframes.length; i++) {
frameNumbers[i] = keyframes[i].getFrameNumber();
}
ModelCreator.DidModify();
ModelCreator.updateValues(null);
}
|
<DeepExtract>
Keyframe[] newkeyframes = new Keyframe[keyframes.length - 1];
int j = 0;
for (int i = 0; i < keyframes.length; i++) {
if (keyframes[i] != GetKeyFrame(currentFrame))
newkeyframes[j++] = keyframes[i];
}
keyframes = newkeyframes;
ReloadFrameNumbers();
</DeepExtract>
<DeepExtract>
frameNumbers = new int[keyframes.length];
for (int i = 0; i < keyframes.length; i++) {
frameNumbers[i] = keyframes[i].getFrameNumber();
}
</DeepExtract>
|
vsmodelcreator
|
positive
|
public Criteria andAvatarIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "avatar" + " cannot be null");
}
criteria.add(new Criterion("avatar in", values));
return (Criteria) this;
}
|
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "avatar" + " cannot be null");
}
criteria.add(new Criterion("avatar in", values));
</DeepExtract>
|
yurencloud-public
|
positive
|
protected void load8kVromBank(int bank4kStart, int address) {
if (rom.getVromBankCount() == 0) {
return;
}
ppu.triggerRendering();
if (rom.getVromBankCount() == 0) {
return;
}
ppu.triggerRendering();
System.arraycopy(rom.getVromBank((bank4kStart) % rom.getVromBankCount() % rom.getVromBankCount()), 0, nes.ppuMem.mem, address, 4096);
Tile[] vromTile = rom.getVromBankTiles((bank4kStart) % rom.getVromBankCount() % rom.getVromBankCount());
System.arraycopy(vromTile, 0, ppu.ptTile, address >> 4, 256);
if (rom.getVromBankCount() == 0) {
return;
}
ppu.triggerRendering();
System.arraycopy(rom.getVromBank((bank4kStart + 1) % rom.getVromBankCount() % rom.getVromBankCount()), 0, nes.ppuMem.mem, address + 4096, 4096);
Tile[] vromTile = rom.getVromBankTiles((bank4kStart + 1) % rom.getVromBankCount() % rom.getVromBankCount());
System.arraycopy(vromTile, 0, ppu.ptTile, address + 4096 >> 4, 256);
}
|
<DeepExtract>
if (rom.getVromBankCount() == 0) {
return;
}
ppu.triggerRendering();
System.arraycopy(rom.getVromBank((bank4kStart) % rom.getVromBankCount() % rom.getVromBankCount()), 0, nes.ppuMem.mem, address, 4096);
Tile[] vromTile = rom.getVromBankTiles((bank4kStart) % rom.getVromBankCount() % rom.getVromBankCount());
System.arraycopy(vromTile, 0, ppu.ptTile, address >> 4, 256);
</DeepExtract>
<DeepExtract>
if (rom.getVromBankCount() == 0) {
return;
}
ppu.triggerRendering();
System.arraycopy(rom.getVromBank((bank4kStart + 1) % rom.getVromBankCount() % rom.getVromBankCount()), 0, nes.ppuMem.mem, address + 4096, 4096);
Tile[] vromTile = rom.getVromBankTiles((bank4kStart + 1) % rom.getVromBankCount() % rom.getVromBankCount());
System.arraycopy(vromTile, 0, ppu.ptTile, address + 4096 >> 4, 256);
</DeepExtract>
|
vNES
|
positive
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.