before
stringlengths
12
3.21M
after
stringlengths
41
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
public boolean beginFakeDrag() { if (mIsBeingDragged) { return false; } mFakeDragging = true; if (mScrollState == SCROLL_STATE_DRAGGING) { return; } mScrollState = SCROLL_STATE_DRAGGING; if (mOnPageChangeListener != null) { mOnPageChangeListener.onPageScrollStateChanged(SCROLL_STATE_DRAGGING); } mInitialMotionY = mLastMotionY = 0; if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } else { mVelocityTracker.clear(); } final long time = SystemClock.uptimeMillis(); final MotionEvent ev = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0); mVelocityTracker.addMovement(ev); ev.recycle(); mFakeDragBeginTime = time; return true; }
public boolean beginFakeDrag() { if (mIsBeingDragged) { return false; } mFakeDragging = true; <DeepExtract> if (mScrollState == SCROLL_STATE_DRAGGING) { return; } mScrollState = SCROLL_STATE_DRAGGING; if (mOnPageChangeListener != null) { mOnPageChangeListener.onPageScrollStateChanged(SCROLL_STATE_DRAGGING); } </DeepExtract> mInitialMotionY = mLastMotionY = 0; if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } else { mVelocityTracker.clear(); } final long time = SystemClock.uptimeMillis(); final MotionEvent ev = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0); mVelocityTracker.addMovement(ev); ev.recycle(); mFakeDragBeginTime = time; return true; }
OkCalendar
positive
538
@Override public MafRecord next() { MafRecord ret = nextRecord_; try { String buffer = lastLine_ != null ? lastLine_ : brMaf_.readLine(); lastLine_ = null; for (; buffer != null; buffer = brMaf_.readLine()) { buffer = buffer.trim(); if (buffer.length() > 0 && buffer.charAt(0) != '#') break; } if (buffer == null) nextRecord_ = null; if (buffer.charAt(0) != 'a') throw new RuntimeException("unexpected MAF line: " + buffer); String header = buffer; ArrayList<String> entries = new ArrayList<String>(2); for (buffer = brMaf_.readLine(); buffer != null; buffer = brMaf_.readLine()) { buffer = buffer.trim(); if (buffer.length() > 0) { if (buffer.charAt(0) == 's') { entries.add(buffer); } else if (buffer.charAt(0) == 'a') { break; } else if (buffer.charAt(0) != '#') { throw new RuntimeException("unexpected MAF line: " + buffer); } } } lastLine_ = buffer; nextRecord_ = new MafRecord(header, entries); } catch (IOException e) { e.printStackTrace(); nextRecord_ = null; } return ret; }
@Override public MafRecord next() { MafRecord ret = nextRecord_; <DeepExtract> try { String buffer = lastLine_ != null ? lastLine_ : brMaf_.readLine(); lastLine_ = null; for (; buffer != null; buffer = brMaf_.readLine()) { buffer = buffer.trim(); if (buffer.length() > 0 && buffer.charAt(0) != '#') break; } if (buffer == null) nextRecord_ = null; if (buffer.charAt(0) != 'a') throw new RuntimeException("unexpected MAF line: " + buffer); String header = buffer; ArrayList<String> entries = new ArrayList<String>(2); for (buffer = brMaf_.readLine(); buffer != null; buffer = brMaf_.readLine()) { buffer = buffer.trim(); if (buffer.length() > 0) { if (buffer.charAt(0) == 's') { entries.add(buffer); } else if (buffer.charAt(0) == 'a') { break; } else if (buffer.charAt(0) != '#') { throw new RuntimeException("unexpected MAF line: " + buffer); } } } lastLine_ = buffer; nextRecord_ = new MafRecord(header, entries); } catch (IOException e) { e.printStackTrace(); nextRecord_ = null; } </DeepExtract> return ret; }
varsim
positive
539
public Criteria andClassroomNotLike(String value) { if (value == null) { throw new RuntimeException("Value for " + "classroom" + " cannot be null"); } criteria.add(new Criterion("classRoom not like", value)); return (Criteria) this; }
public Criteria andClassroomNotLike(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "classroom" + " cannot be null"); } criteria.add(new Criterion("classRoom not like", value)); </DeepExtract> return (Criteria) this; }
Examination_System
positive
540
public static void putIntPreference(ContentResolver resolver, Uri uri, String key, int value) { ContentValues contentValues = new ContentValues(1); (v, contentValues) -> contentValues.put(key, v).onPutValue(value, contentValues); resolver.update(uri, contentValues, null, null); }
public static void putIntPreference(ContentResolver resolver, Uri uri, String key, int value) { <DeepExtract> ContentValues contentValues = new ContentValues(1); (v, contentValues) -> contentValues.put(key, v).onPutValue(value, contentValues); resolver.update(uri, contentValues, null, null); </DeepExtract> }
igniter
positive
541
public void apkToolDecode(String apkPath) throws TNotFoundEx { String args = " d -o " + TicklerVars.extractedDir + " " + apkPath; FileUtil fileT = new FileUtil(); File apkPathFile = new File(apkPath); try { File file = new File("/dev/null"); PrintStream ps = new PrintStream(new FileOutputStream(file)); System.setErr(ps); this.executeApktoolCommand(args); System.setErr(System.err); } catch (Exception e) { e.printStackTrace(); } try { fileT.copyOnHost(TicklerVars.extractedDir + "AndroidManifest.xml", TicklerVars.tickManifestFile, true); } catch (Exception e) { OutBut.printError("Decompilation failed and Manifest cannot be obtained"); TNotFoundEx eNotFound = new TNotFoundEx("Decompilation failed and Manifest cannot be obtained"); throw eNotFound; } }
public void apkToolDecode(String apkPath) throws TNotFoundEx { String args = " d -o " + TicklerVars.extractedDir + " " + apkPath; <DeepExtract> FileUtil fileT = new FileUtil(); File apkPathFile = new File(apkPath); try { File file = new File("/dev/null"); PrintStream ps = new PrintStream(new FileOutputStream(file)); System.setErr(ps); this.executeApktoolCommand(args); System.setErr(System.err); } catch (Exception e) { e.printStackTrace(); } try { fileT.copyOnHost(TicklerVars.extractedDir + "AndroidManifest.xml", TicklerVars.tickManifestFile, true); } catch (Exception e) { OutBut.printError("Decompilation failed and Manifest cannot be obtained"); TNotFoundEx eNotFound = new TNotFoundEx("Decompilation failed and Manifest cannot be obtained"); throw eNotFound; } </DeepExtract> }
AndroTickler
positive
542
public Criteria andField_not_having_default_valueGreaterThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "field_not_having_default_value" + " cannot be null"); } criteria.add(new Criterion("field_not_having_default_value >", value)); return (Criteria) this; }
public Criteria andField_not_having_default_valueGreaterThan(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "field_not_having_default_value" + " cannot be null"); } criteria.add(new Criterion("field_not_having_default_value >", value)); </DeepExtract> return (Criteria) this; }
mybatis-generator-gui-extension
positive
543
@Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (mTarget == null) { for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); if (!child.equals(mCircleView)) { mTarget = child; break; } } } final int action = MotionEventCompat.getActionMasked(ev); if (mReturningToStart && action == MotionEvent.ACTION_DOWN) { mReturningToStart = false; } switch(mDirection) { case BOTTOM: if (!isEnabled() || mReturningToStart || (!mBothDirection && canChildScrollDown()) || mRefreshing || mNestedScrollInProgress) { return false; } break; case TOP: default: if (!isEnabled() || mReturningToStart || (!mBothDirection && canChildScrollUp()) || mRefreshing || mNestedScrollInProgress) { return false; } break; } switch(action) { case MotionEvent.ACTION_DOWN: setTargetOffsetTopAndBottom(mOriginalOffsetTop - mCircleView.getTop(), true); mActivePointerId = MotionEventCompat.getPointerId(ev, 0); mIsBeingDragged = false; final float initialDownY = getMotionEventY(ev, mActivePointerId); if (initialDownY == -1) { return false; } mInitialDownY = initialDownY; break; case MotionEvent.ACTION_MOVE: if (mActivePointerId == INVALID_POINTER) { Log.e(LOG_TAG, "Got ACTION_MOVE event but don't have an active pointer id."); return false; } final float y = getMotionEventY(ev, mActivePointerId); if (y == -1) { return false; } if (mBothDirection) { if (y > mInitialDownY) { setRawDirection(Direction.TOP); } else if (y < mInitialDownY) { setRawDirection(Direction.BOTTOM); } if ((mDirection == Direction.BOTTOM && canChildScrollDown()) || (mDirection == Direction.TOP && canChildScrollUp())) { mInitialDownY = y; return false; } } float yDiff; switch(mDirection) { case BOTTOM: yDiff = mInitialDownY - y; break; case TOP: default: yDiff = y - mInitialDownY; break; } if (yDiff > mTouchSlop && !mIsBeingDragged) { switch(mDirection) { case BOTTOM: mInitialMotionY = mInitialDownY - mTouchSlop; break; case TOP: default: mInitialMotionY = mInitialDownY + mTouchSlop; break; } mIsBeingDragged = true; mProgress.setAlpha(STARTING_PROGRESS_ALPHA); } break; case MotionEventCompat.ACTION_POINTER_UP: onSecondaryPointerUp(ev); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mIsBeingDragged = false; mActivePointerId = INVALID_POINTER; break; } return mIsBeingDragged; }
@Override public boolean onInterceptTouchEvent(MotionEvent ev) { <DeepExtract> if (mTarget == null) { for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); if (!child.equals(mCircleView)) { mTarget = child; break; } } } </DeepExtract> final int action = MotionEventCompat.getActionMasked(ev); if (mReturningToStart && action == MotionEvent.ACTION_DOWN) { mReturningToStart = false; } switch(mDirection) { case BOTTOM: if (!isEnabled() || mReturningToStart || (!mBothDirection && canChildScrollDown()) || mRefreshing || mNestedScrollInProgress) { return false; } break; case TOP: default: if (!isEnabled() || mReturningToStart || (!mBothDirection && canChildScrollUp()) || mRefreshing || mNestedScrollInProgress) { return false; } break; } switch(action) { case MotionEvent.ACTION_DOWN: setTargetOffsetTopAndBottom(mOriginalOffsetTop - mCircleView.getTop(), true); mActivePointerId = MotionEventCompat.getPointerId(ev, 0); mIsBeingDragged = false; final float initialDownY = getMotionEventY(ev, mActivePointerId); if (initialDownY == -1) { return false; } mInitialDownY = initialDownY; break; case MotionEvent.ACTION_MOVE: if (mActivePointerId == INVALID_POINTER) { Log.e(LOG_TAG, "Got ACTION_MOVE event but don't have an active pointer id."); return false; } final float y = getMotionEventY(ev, mActivePointerId); if (y == -1) { return false; } if (mBothDirection) { if (y > mInitialDownY) { setRawDirection(Direction.TOP); } else if (y < mInitialDownY) { setRawDirection(Direction.BOTTOM); } if ((mDirection == Direction.BOTTOM && canChildScrollDown()) || (mDirection == Direction.TOP && canChildScrollUp())) { mInitialDownY = y; return false; } } float yDiff; switch(mDirection) { case BOTTOM: yDiff = mInitialDownY - y; break; case TOP: default: yDiff = y - mInitialDownY; break; } if (yDiff > mTouchSlop && !mIsBeingDragged) { switch(mDirection) { case BOTTOM: mInitialMotionY = mInitialDownY - mTouchSlop; break; case TOP: default: mInitialMotionY = mInitialDownY + mTouchSlop; break; } mIsBeingDragged = true; mProgress.setAlpha(STARTING_PROGRESS_ALPHA); } break; case MotionEventCompat.ACTION_POINTER_UP: onSecondaryPointerUp(ev); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mIsBeingDragged = false; mActivePointerId = INVALID_POINTER; break; } return mIsBeingDragged; }
android-starter-kit
positive
544
public String getDependencies() throws MojoExecutionException { String dependencies = null; DependencyInputType dependencyType; if (projectCP != null) { getLog().info("Reading dependencies from folder"); dependencyType = DependencyInputType.FOLDER; } else if (groupId != null && artifactId != null) { getLog().info("Reading dependencies from artifact"); dependencyType = DependencyInputType.ARTIFACT; } else { getLog().info("Reading dependencies from pom"); dependencyType = DependencyInputType.POM; } if (dependencyType == DependencyInputType.FOLDER) { dependencies = getDependenciesFromFolder(projectCP); } else { dependencies = getDependenciesWithMaven(dependencyType); } getLog().info("Collected dependencies: " + dependencies); return dependencies; }
public String getDependencies() throws MojoExecutionException { String dependencies = null; <DeepExtract> DependencyInputType dependencyType; if (projectCP != null) { getLog().info("Reading dependencies from folder"); dependencyType = DependencyInputType.FOLDER; } else if (groupId != null && artifactId != null) { getLog().info("Reading dependencies from artifact"); dependencyType = DependencyInputType.ARTIFACT; } else { getLog().info("Reading dependencies from pom"); dependencyType = DependencyInputType.POM; } </DeepExtract> if (dependencyType == DependencyInputType.FOLDER) { dependencies = getDependenciesFromFolder(projectCP); } else { dependencies = getDependenciesWithMaven(dependencyType); } getLog().info("Collected dependencies: " + dependencies); return dependencies; }
botsing
positive
545
public String convertToDatabaseForm() { StringBuilder latStringBuilder = new StringBuilder(); latStringBuilder.append(baseVertex.getLat()); for (TorVertex pillarPoint : pillarVertexes) { latStringBuilder.append(",").append(pillarPoint.getLat()); } latStringBuilder.append(",").append(adjVertex.getLat()); return String.valueOf(id); StringBuilder lonStringBuilder = new StringBuilder(); lonStringBuilder.append(baseVertex.getLng()); for (TorVertex pillarPoint : pillarVertexes) { lonStringBuilder.append(",").append(pillarPoint.getLat()); } lonStringBuilder.append(",").append(adjVertex.getLng()); return String.valueOf(id); if (length == Double.MIN_VALUE) { TorVertex pre = baseVertex; length = 0.0; for (TorVertex pillarPoint : pillarVertexes) { length += GeoUtil.distance(pre, pillarPoint); pre = pillarPoint; } length += GeoUtil.distance(pre, adjVertex); } return length; StringBuilder res = new StringBuilder(); return String.valueOf(id); }
public String convertToDatabaseForm() { StringBuilder latStringBuilder = new StringBuilder(); latStringBuilder.append(baseVertex.getLat()); for (TorVertex pillarPoint : pillarVertexes) { latStringBuilder.append(",").append(pillarPoint.getLat()); } latStringBuilder.append(",").append(adjVertex.getLat()); <DeepExtract> return String.valueOf(id); </DeepExtract> StringBuilder lonStringBuilder = new StringBuilder(); lonStringBuilder.append(baseVertex.getLng()); for (TorVertex pillarPoint : pillarVertexes) { lonStringBuilder.append(",").append(pillarPoint.getLat()); } lonStringBuilder.append(",").append(adjVertex.getLng()); <DeepExtract> return String.valueOf(id); </DeepExtract> if (length == Double.MIN_VALUE) { TorVertex pre = baseVertex; length = 0.0; for (TorVertex pillarPoint : pillarVertexes) { length += GeoUtil.distance(pre, pillarPoint); pre = pillarPoint; } length += GeoUtil.distance(pre, adjVertex); } return length; StringBuilder res = new StringBuilder(); <DeepExtract> return String.valueOf(id); </DeepExtract> }
torchtrajectory
positive
546
@Override public void setConfigParams(ConfigParams config) { super.setConfigParams(config); icsAlarm = config.getIcsAlarm(); return icsAlarmMinutes; icsAllDay = config.getIcsAllDay(); extractIcsAttributes(note); org.psidnell.omnifocus.expr.Date date = null; if ("due".equals(icsStart)) { date = new org.psidnell.omnifocus.expr.Date(getPreferred(dueDate, deferDate), config); } else if ("defer".equals(icsStart)) { date = new org.psidnell.omnifocus.expr.Date(getPreferred(deferDate, dueDate), config); } else { date = new org.psidnell.omnifocus.expr.Date(adjustTime(getPreferred(deferDate, dueDate), icsStart), config); } return icsAllDay ? date.getIcsAllDayStart() : date.getIcs(); extractIcsAttributes(note); org.psidnell.omnifocus.expr.Date date = null; if ("due".equals(icsEnd)) { date = new org.psidnell.omnifocus.expr.Date(getPreferred(dueDate, deferDate), config); } else if ("defer".equals(icsEnd)) { date = new org.psidnell.omnifocus.expr.Date(getPreferred(deferDate, dueDate), config); } else { date = new org.psidnell.omnifocus.expr.Date(adjustTime(getPreferred(dueDate, deferDate), icsEnd), config); } return icsAllDay ? date.getIcsAllDayStart() : date.getIcs(); }
@Override public void setConfigParams(ConfigParams config) { super.setConfigParams(config); icsAlarm = config.getIcsAlarm(); return icsAlarmMinutes; icsAllDay = config.getIcsAllDay(); extractIcsAttributes(note); org.psidnell.omnifocus.expr.Date date = null; if ("due".equals(icsStart)) { date = new org.psidnell.omnifocus.expr.Date(getPreferred(dueDate, deferDate), config); } else if ("defer".equals(icsStart)) { date = new org.psidnell.omnifocus.expr.Date(getPreferred(deferDate, dueDate), config); } else { date = new org.psidnell.omnifocus.expr.Date(adjustTime(getPreferred(deferDate, dueDate), icsStart), config); } return icsAllDay ? date.getIcsAllDayStart() : date.getIcs(); <DeepExtract> extractIcsAttributes(note); org.psidnell.omnifocus.expr.Date date = null; if ("due".equals(icsEnd)) { date = new org.psidnell.omnifocus.expr.Date(getPreferred(dueDate, deferDate), config); } else if ("defer".equals(icsEnd)) { date = new org.psidnell.omnifocus.expr.Date(getPreferred(deferDate, dueDate), config); } else { date = new org.psidnell.omnifocus.expr.Date(adjustTime(getPreferred(dueDate, deferDate), icsEnd), config); } return icsAllDay ? date.getIcsAllDayStart() : date.getIcs(); </DeepExtract> }
ofexport2
positive
547
private void writeTestMetric(AbstractOutputWriter writer) { if (value < 10) { value += 1; } else { value = 1; } try { writer.writeQueryResult("jmxtransagentinputtest", null, value); writer.writeQueryResult("second", null, value + 20); tcpByteServer.readResponse = "ZBXA100000000{\"result\":\"success\"}".getBytes(StandardCharsets.UTF_8); writer.postCollect(); } catch (Exception e) { e.printStackTrace(); } }
private void writeTestMetric(AbstractOutputWriter writer) { <DeepExtract> if (value < 10) { value += 1; } else { value = 1; } </DeepExtract> try { writer.writeQueryResult("jmxtransagentinputtest", null, value); writer.writeQueryResult("second", null, value + 20); tcpByteServer.readResponse = "ZBXA100000000{\"result\":\"success\"}".getBytes(StandardCharsets.UTF_8); writer.postCollect(); } catch (Exception e) { e.printStackTrace(); } }
jmxtrans-agent
positive
548
@Override @Deprecated public void setMaxScale(float maxScale) { mAttacher.setMaximumScale(maxScale); }
@Override @Deprecated public void setMaxScale(float maxScale) { <DeepExtract> mAttacher.setMaximumScale(maxScale); </DeepExtract> }
AppleFramework
positive
549
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false); if (savedInstanceState != null) { mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); mFromSavedInstanceState = true; } mCurrentSelectedPosition = mCurrentSelectedPosition; if (mDrawerListView != null) { mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); } if (mDrawerLayout != null) { mDrawerLayout.closeDrawer(mFragmentContainerView); } if (mCallbacks != null) { mCallbacks.onNavigationDrawerItemSelected(mCurrentSelectedPosition); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false); if (savedInstanceState != null) { mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); mFromSavedInstanceState = true; } <DeepExtract> mCurrentSelectedPosition = mCurrentSelectedPosition; if (mDrawerListView != null) { mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); } if (mDrawerLayout != null) { mDrawerLayout.closeDrawer(mFragmentContainerView); } if (mCallbacks != null) { mCallbacks.onNavigationDrawerItemSelected(mCurrentSelectedPosition); } </DeepExtract> }
MonitoraBrasil
positive
550
@Test public void testEventResponse_createSharesRequested_requiredShareCountSetToEmptyAndAllOtherInputsAreValid() { presenter.startPresenting().blockingGet(); requiredShareCountObservable.onNext(Optional.empty()); totalShareCountObservable.onNext(Optional.of(3)); secretFilePathObservable.onNext(Optional.of(secretFile.getAbsolutePath())); outputDirectoryPathObservable.onNext(Optional.of(outputDirectory.getAbsolutePath())); createSharesRequests.onNext(None.getInstance()); verifyZeroInteractions(mockPersistenceOperations); verifyZeroInteractions(mockRxFiles); }
@Test public void testEventResponse_createSharesRequested_requiredShareCountSetToEmptyAndAllOtherInputsAreValid() { presenter.startPresenting().blockingGet(); requiredShareCountObservable.onNext(Optional.empty()); totalShareCountObservable.onNext(Optional.of(3)); secretFilePathObservable.onNext(Optional.of(secretFile.getAbsolutePath())); outputDirectoryPathObservable.onNext(Optional.of(outputDirectory.getAbsolutePath())); createSharesRequests.onNext(None.getInstance()); <DeepExtract> verifyZeroInteractions(mockPersistenceOperations); verifyZeroInteractions(mockRxFiles); </DeepExtract> }
Shamir
positive
551
private void printNpc() { if (!deps.needsNpc()) { return; } out.print(FileUtil.readResource(NPC_HPP)); }
private void printNpc() { if (!deps.needsNpc()) { return; } <DeepExtract> out.print(FileUtil.readResource(NPC_HPP)); </DeepExtract> }
j2c
positive
552
@Override public void restoreMemento(Memento memento) { this.valor = memento.getValor(); this.cadena = memento.getCadena(); }
@Override public void restoreMemento(Memento memento) { this.valor = memento.getValor(); <DeepExtract> this.cadena = memento.getCadena(); </DeepExtract> }
apaw
positive
553
@Override public void onClick(View view) { startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().setTheme(getSelectedTheme()).setLogo(getSelectedLogo()).setProviders(getSelectedProviders()).setTosUrl(getSelectedTosUrl()).setIsSmartLockEnabled(true).build(), RC_SIGN_IN); }
@Override public void onClick(View view) { <DeepExtract> startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().setTheme(getSelectedTheme()).setLogo(getSelectedLogo()).setProviders(getSelectedProviders()).setTosUrl(getSelectedTosUrl()).setIsSmartLockEnabled(true).build(), RC_SIGN_IN); </DeepExtract> }
UPES-SPE-Fest
positive
554
@Override public void run() { if (!mGoToTopFadeInAnimator.isRunning()) { if (mGoToTopFadeOutAnimator.isRunning()) { mGoToTopFadeOutAnimator.cancel(); } mGoToTopFadeInAnimator.setFloatValues(mGoToTopView.getAlpha(), 1.0f); mGoToTopFadeInAnimator.start(); } }
@Override public void run() { <DeepExtract> if (!mGoToTopFadeInAnimator.isRunning()) { if (mGoToTopFadeOutAnimator.isRunning()) { mGoToTopFadeOutAnimator.cancel(); } mGoToTopFadeInAnimator.setFloatValues(mGoToTopView.getAlpha(), 1.0f); mGoToTopFadeInAnimator.start(); } </DeepExtract> }
SamsungOneUi
positive
555
public void assertEqual(long constant, BitVector a) { if (a == Lit.True || a == Lit.False) return; if (a == null) { throw new NullPointerException("Literal is null"); } else if (a.l < 0) { throw new IllegalArgumentException("Literal " + a.toString() + " is not a valid literal."); } else if (a.solver != this) { throw new IllegalArgumentException("Cannot pass literal belonging to solver " + (a.solver == null ? "null" : a.solver.toString()) + " to solver " + toString()); } else if (a.toVar() >= nVars()) { throw new IllegalArgumentException("Literal is undefined in solver (too large)"); } validate(a.eq(constant)); MonosatJNI.Assert(this.getSolverPtr(), a.eq(constant).l); }
public void assertEqual(long constant, BitVector a) { if (a == Lit.True || a == Lit.False) return; if (a == null) { throw new NullPointerException("Literal is null"); } else if (a.l < 0) { throw new IllegalArgumentException("Literal " + a.toString() + " is not a valid literal."); } else if (a.solver != this) { throw new IllegalArgumentException("Cannot pass literal belonging to solver " + (a.solver == null ? "null" : a.solver.toString()) + " to solver " + toString()); } else if (a.toVar() >= nVars()) { throw new IllegalArgumentException("Literal is undefined in solver (too large)"); } <DeepExtract> validate(a.eq(constant)); MonosatJNI.Assert(this.getSolverPtr(), a.eq(constant).l); </DeepExtract> }
monosat
positive
556
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_recycler_view, container, false); mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); mRecyclerView.addItemDecoration(new BallotRecyclerViewDecorator(getActivity())); Context context; try { context = super.getContext(); } catch (NoSuchMethodError error) { context = getActivity(); } mRecyclerView.setLayoutManager(new GridLayoutManager(context, 1)); if (mAdapter != null) { mRecyclerView.setAdapter(mAdapter); } return view; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_recycler_view, container, false); mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); mRecyclerView.addItemDecoration(new BallotRecyclerViewDecorator(getActivity())); <DeepExtract> Context context; try { context = super.getContext(); } catch (NoSuchMethodError error) { context = getActivity(); } </DeepExtract> mRecyclerView.setLayoutManager(new GridLayoutManager(context, 1)); if (mAdapter != null) { mRecyclerView.setAdapter(mAdapter); } return view; }
android-white-label-app
positive
557
public synchronized void onResume() { if (registered) { Log.w(TAG, "PowerStatusReceiver was already registered?"); } else { activity.registerReceiver(powerStatusReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); registered = true; } cancel(); inactivityTask = new InactivityAsyncTask(); if (Build.VERSION.SDK_INT >= 11) { inactivityTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { inactivityTask.execute(); } }
public synchronized void onResume() { if (registered) { Log.w(TAG, "PowerStatusReceiver was already registered?"); } else { activity.registerReceiver(powerStatusReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); registered = true; } <DeepExtract> cancel(); inactivityTask = new InactivityAsyncTask(); if (Build.VERSION.SDK_INT >= 11) { inactivityTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { inactivityTask.execute(); } </DeepExtract> }
RetrofitAndRxjavaforRecyclerview
positive
558
@LargeTest public void testWithInvalidPassword() throws Exception { solo.assertCurrentActivity("Expected Login Activity", LoginActivity.class); solo.enterText(0, Account.USERNAME); solo.enterText(1, "blah"); solo.clickOnButton("Log In"); solo.waitForDialogToClose(DIALOG_TIMEOUT); solo.assertCurrentActivity("Expected Login Activity", LoginActivity.class); }
@LargeTest public void testWithInvalidPassword() throws Exception { solo.assertCurrentActivity("Expected Login Activity", LoginActivity.class); <DeepExtract> solo.enterText(0, Account.USERNAME); solo.enterText(1, "blah"); solo.clickOnButton("Log In"); </DeepExtract> solo.waitForDialogToClose(DIALOG_TIMEOUT); solo.assertCurrentActivity("Expected Login Activity", LoginActivity.class); }
musicbrainz-android
positive
560
@Override public synchronized int read() { bitOffset = 0; return (streamPos < count) ? (buf[(int) (streamPos++)] & 0xff) : -1; }
@Override public synchronized int read() { <DeepExtract> bitOffset = 0; </DeepExtract> return (streamPos < count) ? (buf[(int) (streamPos++)] & 0xff) : -1; }
monte-screen-recorder
positive
561
@Override public void onCancel(DialogInterface dialogInterface) { activityToFinish.finish(); }
@Override public void onCancel(DialogInterface dialogInterface) { <DeepExtract> activityToFinish.finish(); </DeepExtract> }
MVPLibrary
positive
562
@Override protected Control createDialogArea(Composite parent) { this.parentContainer = parent; Composite container = (Composite) super.createDialogArea(parent); final int layoutMargin = 10; GridLayout layout = new GridLayout(1, false); layout.marginTop = layoutMargin; layout.marginLeft = layoutMargin; layout.marginBottom = layoutMargin; layout.marginRight = layoutMargin; container.setLayout(layout); Composite logoContainer = UIUtils.createFullGridedComposite(container, 1); logoContainer.setData(new GridData(SWT.CENTER, SWT.NONE, true, false)); Label watchdogLogo = UIUtils.createWatchDogLogo(logoContainer); watchdogLogo.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, true, false)); UIUtils.createLabel(" ", logoContainer); Composite container = UIUtils.createZeroMarginGridedComposite(container, 2); colorRed = new Color(getShell().getDisplay(), 255, 0, 0); colorGreen = new Color(getShell().getDisplay(), 0, 150, 0); UIUtils.createLabel("WatchDog Status: ", container); if (WatchDogGlobals.isActive) { UIUtils.createLabel(WatchDogGlobals.ACTIVE_WATCHDOG_TEXT, container, colorGreen); } else { Composite localGrid = UIUtils.createZeroMarginGridedComposite(container, 2); UIUtils.createLabel(WatchDogGlobals.INACTIVE_WATCHDOG_TEXT, localGrid, colorRed); createFixThisProblemLink(localGrid, new PreferenceListener()); } createDataInfoLabels(container); UIUtils.refreshCommand(UIUtils.COMMAND_SHOW_INFO); UIUtils.createLabel("", container); Composite container = UIUtils.createFullGridedComposite(container, 3); container.setData(new GridData(SWT.CENTER, SWT.NONE, true, false)); UIUtils.createLinkedLabel(container, new WatchDogViewListener(), "Open View.", "").setLayoutData(UIUtils.createFullGridUsageData()); UIUtils.createOpenReportLink(container); UIUtils.createLabel("", container); UIUtils.createLinkedLabel(container, new BrowserOpenerSelection(), "Open logs.", "file://" + WatchDogLogger.getInstance().getLogDirectoryPath()).setLayoutData(UIUtils.createFullGridUsageData()); UIUtils.createLinkedLabel(container, new PreferenceListener(), "Open Prefs.", "").setLayoutData(UIUtils.createFullGridUsageData()); UIUtils.createLinkedLabel(container, new BrowserOpenerSelection(), "Report bug.", "https://github.com/TestRoots/watchdog/issues").setLayoutData(UIUtils.createFullGridUsageData()); return container; }
@Override protected Control createDialogArea(Composite parent) { this.parentContainer = parent; Composite container = (Composite) super.createDialogArea(parent); final int layoutMargin = 10; GridLayout layout = new GridLayout(1, false); layout.marginTop = layoutMargin; layout.marginLeft = layoutMargin; layout.marginBottom = layoutMargin; layout.marginRight = layoutMargin; container.setLayout(layout); Composite logoContainer = UIUtils.createFullGridedComposite(container, 1); logoContainer.setData(new GridData(SWT.CENTER, SWT.NONE, true, false)); Label watchdogLogo = UIUtils.createWatchDogLogo(logoContainer); watchdogLogo.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, true, false)); UIUtils.createLabel(" ", logoContainer); Composite container = UIUtils.createZeroMarginGridedComposite(container, 2); colorRed = new Color(getShell().getDisplay(), 255, 0, 0); colorGreen = new Color(getShell().getDisplay(), 0, 150, 0); UIUtils.createLabel("WatchDog Status: ", container); if (WatchDogGlobals.isActive) { UIUtils.createLabel(WatchDogGlobals.ACTIVE_WATCHDOG_TEXT, container, colorGreen); } else { Composite localGrid = UIUtils.createZeroMarginGridedComposite(container, 2); UIUtils.createLabel(WatchDogGlobals.INACTIVE_WATCHDOG_TEXT, localGrid, colorRed); createFixThisProblemLink(localGrid, new PreferenceListener()); } createDataInfoLabels(container); UIUtils.refreshCommand(UIUtils.COMMAND_SHOW_INFO); <DeepExtract> UIUtils.createLabel("", container); Composite container = UIUtils.createFullGridedComposite(container, 3); container.setData(new GridData(SWT.CENTER, SWT.NONE, true, false)); UIUtils.createLinkedLabel(container, new WatchDogViewListener(), "Open View.", "").setLayoutData(UIUtils.createFullGridUsageData()); UIUtils.createOpenReportLink(container); UIUtils.createLabel("", container); UIUtils.createLinkedLabel(container, new BrowserOpenerSelection(), "Open logs.", "file://" + WatchDogLogger.getInstance().getLogDirectoryPath()).setLayoutData(UIUtils.createFullGridUsageData()); UIUtils.createLinkedLabel(container, new PreferenceListener(), "Open Prefs.", "").setLayoutData(UIUtils.createFullGridUsageData()); UIUtils.createLinkedLabel(container, new BrowserOpenerSelection(), "Report bug.", "https://github.com/TestRoots/watchdog/issues").setLayoutData(UIUtils.createFullGridUsageData()); </DeepExtract> return container; }
watchdog
positive
563
@Override public void deleteCustomCredentials() { logger.debug("Deleting custom credentials file {}", customCredentialsPath); asUnchecked(() -> deleteIfExists(customCredentialsPath)); hashOfConfiguredCredentials = configuredToUseCustomCredentials() ? crc32(getAsUnchecked(() -> customCredentialsPath.toUri().toURL())) : STANDARD_CREDENTIALS_URL_HASH; }
@Override public void deleteCustomCredentials() { logger.debug("Deleting custom credentials file {}", customCredentialsPath); asUnchecked(() -> deleteIfExists(customCredentialsPath)); <DeepExtract> hashOfConfiguredCredentials = configuredToUseCustomCredentials() ? crc32(getAsUnchecked(() -> customCredentialsPath.toUri().toURL())) : STANDARD_CREDENTIALS_URL_HASH; </DeepExtract> }
jiotty-photos-uploader
positive
564
public static boolean hasBusyBox() { for (String path : SU_BINARY_PATH) { File file = new File(path, BUSYBOX); if (file.exists()) { return true; } } return false; }
public static boolean hasBusyBox() { <DeepExtract> for (String path : SU_BINARY_PATH) { File file = new File(path, BUSYBOX); if (file.exists()) { return true; } } return false; </DeepExtract> }
apptoolkit
positive
566
@Override public boolean isMultipart() { if (destroyed) { throw new IllegalStateException(HttpPostMultipartRequestDecoder.class.getSimpleName() + " was destroyed already"); } return true; }
@Override public boolean isMultipart() { <DeepExtract> if (destroyed) { throw new IllegalStateException(HttpPostMultipartRequestDecoder.class.getSimpleName() + " was destroyed already"); } </DeepExtract> return true; }
dorado
positive
567
private DotElement handleDotRow(int y, DotRowHandler h) { Map<Integer, DotElement> row = foods.get(Integer.valueOf(y)); if (row == null) { return null; } return row.get(Integer.valueOf(x)); }
private DotElement handleDotRow(int y, DotRowHandler h) { Map<Integer, DotElement> row = foods.get(Integer.valueOf(y)); if (row == null) { return null; } <DeepExtract> return row.get(Integer.valueOf(x)); </DeepExtract> }
google-pacman
positive
568
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Bundle args = getArguments(); pickerId = args.getInt(ARG_PICKER_ID); title = args.getString(ARG_TITLE); positiveButtonText = args.getString(ARG_POSITIVE_BUTTON_TEXT); negativeButtonText = args.getString(ARG_NEGATIVE_BUTTON_TEXT); enableMultipleSelection = args.getBoolean(ARG_ENABLE_MULTIPLE_SELECTION); setSelectedItems(args.getIntArray(ARG_SELECTED_ITEMS_INDICES)); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setPositiveButton(positiveButtonText, dialogButtonClickListener).setNegativeButton(negativeButtonText, dialogButtonClickListener); if (title != null) builder.setTitle(title); if (enableMultipleSelection) { setupMultiChoiceDialog(builder); } else { setupSingleChoiceDialog(builder); } return builder.create(); }
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { <DeepExtract> final Bundle args = getArguments(); pickerId = args.getInt(ARG_PICKER_ID); title = args.getString(ARG_TITLE); positiveButtonText = args.getString(ARG_POSITIVE_BUTTON_TEXT); negativeButtonText = args.getString(ARG_NEGATIVE_BUTTON_TEXT); enableMultipleSelection = args.getBoolean(ARG_ENABLE_MULTIPLE_SELECTION); setSelectedItems(args.getIntArray(ARG_SELECTED_ITEMS_INDICES)); </DeepExtract> AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setPositiveButton(positiveButtonText, dialogButtonClickListener).setNegativeButton(negativeButtonText, dialogButtonClickListener); if (title != null) builder.setTitle(title); if (enableMultipleSelection) { setupMultiChoiceDialog(builder); } else { setupSingleChoiceDialog(builder); } return builder.create(); }
MVPAndroidBootstrap
positive
569
@Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required"); Objects.requireNonNull(rate, "Rate required"); return amount.divide(rate.get()); }
@Override public MonetaryAmount apply(MonetaryAmount amount) { <DeepExtract> Objects.requireNonNull(amount, "Amount required"); Objects.requireNonNull(rate, "Rate required"); return amount.divide(rate.get()); </DeepExtract> }
javamoney-lib
positive
570
static int sizeMetricDefinitions() { return metricDefs.size(); }
static int sizeMetricDefinitions() { <DeepExtract> return metricDefs.size(); </DeepExtract> }
monasca-thresh
positive
571
public void mouseExited(java.awt.event.MouseEvent evt) { banDriverButton.setBackground(new Color(51, 0, 102)); }
public void mouseExited(java.awt.event.MouseEvent evt) { <DeepExtract> banDriverButton.setBackground(new Color(51, 0, 102)); </DeepExtract> }
vehler
positive
572
@Test public void iteratorDirectory() throws IOException { AmazonS3ClientMock client = AmazonS3MockFactory.getAmazonClientMock(); client.bucket("bucketA").dir("dir").file("dir/file1"); S3FileSystem s3FileSystem = (S3FileSystem) FileSystems.getFileSystem(endpoint); S3Path path = s3FileSystem.getPath("/bucketA", "dir"); S3Iterator iterator = new S3Iterator(path); assertNotNull(iterator); assertTrue(iterator.hasNext()); List<String> filesNamesExpected = Arrays.asList("file1"); List<String> filesNamesActual = new ArrayList<>(); while (iterator.hasNext()) { Path path = iterator.next(); String fileName = path.getFileName().toString(); filesNamesActual.add(fileName); } assertEquals(filesNamesExpected, filesNamesActual); }
@Test public void iteratorDirectory() throws IOException { AmazonS3ClientMock client = AmazonS3MockFactory.getAmazonClientMock(); client.bucket("bucketA").dir("dir").file("dir/file1"); S3FileSystem s3FileSystem = (S3FileSystem) FileSystems.getFileSystem(endpoint); S3Path path = s3FileSystem.getPath("/bucketA", "dir"); S3Iterator iterator = new S3Iterator(path); <DeepExtract> assertNotNull(iterator); assertTrue(iterator.hasNext()); List<String> filesNamesExpected = Arrays.asList("file1"); List<String> filesNamesActual = new ArrayList<>(); while (iterator.hasNext()) { Path path = iterator.next(); String fileName = path.getFileName().toString(); filesNamesActual.add(fileName); } assertEquals(filesNamesExpected, filesNamesActual); </DeepExtract> }
nifi-minio
positive
573
public void run() { dbHelper.DeleteImagePreview(); dbHelper.CreateImagePreview(mContext); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences.Editor editor = sharedPref.edit(); editor.putBoolean(Constants.REFRESH, true); editor.apply(); if (pDialog.isShowing()) pDialog.dismiss(); Toasty.success(mContext, "Cache Rebuilt", Toast.LENGTH_SHORT).show(); }
public void run() { dbHelper.DeleteImagePreview(); dbHelper.CreateImagePreview(mContext); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences.Editor editor = sharedPref.edit(); editor.putBoolean(Constants.REFRESH, true); editor.apply(); <DeepExtract> if (pDialog.isShowing()) pDialog.dismiss(); </DeepExtract> Toasty.success(mContext, "Cache Rebuilt", Toast.LENGTH_SHORT).show(); }
Rocket-Notes
positive
574
@Test public void testTransactions() throws Exception { try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "85db49cb288f3a92168fae9f4bf155279f7d5418636c9ef04e9fdc1b7f5fa024"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("85db49cb288f3a92168fae9f4bf155279f7d5418636c9ef04e9fdc1b7f5fa024")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "8bedbd27fc8b8cc4f1771b95b878d8a2279ad88cb1ef52e15a2b8f69778a9ccb"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("8bedbd27fc8b8cc4f1771b95b878d8a2279ad88cb1ef52e15a2b8f69778a9ccb")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "8afaf20659ac2762b2c10c74f0a26bdecc78f82c011a89db8a006f6827a80390"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("8afaf20659ac2762b2c10c74f0a26bdecc78f82c011a89db8a006f6827a80390")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "f6f89da0b22ca49233197e072a39554147b55755be0c7cdf139ad33cc973ec46"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("f6f89da0b22ca49233197e072a39554147b55755be0c7cdf139ad33cc973ec46")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "92a8b6d40b58d802ab2e8488af204742b0db3e6d2651a55b0e4456425cb5497c"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("92a8b6d40b58d802ab2e8488af204742b0db3e6d2651a55b0e4456425cb5497c")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "0d94f4d0ea3c092a8bce7afe27edb84a4167cda55871b12b0bd0d6e2b4ef4e81"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("0d94f4d0ea3c092a8bce7afe27edb84a4167cda55871b12b0bd0d6e2b4ef4e81")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "bc26380619a36e0ecbb5bae4eebf78d8fdef24ba5ed5fd040e7bff37311e180d"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("bc26380619a36e0ecbb5bae4eebf78d8fdef24ba5ed5fd040e7bff37311e180d")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } }
@Test public void testTransactions() throws Exception { try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "85db49cb288f3a92168fae9f4bf155279f7d5418636c9ef04e9fdc1b7f5fa024"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("85db49cb288f3a92168fae9f4bf155279f7d5418636c9ef04e9fdc1b7f5fa024")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "8bedbd27fc8b8cc4f1771b95b878d8a2279ad88cb1ef52e15a2b8f69778a9ccb"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("8bedbd27fc8b8cc4f1771b95b878d8a2279ad88cb1ef52e15a2b8f69778a9ccb")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "8afaf20659ac2762b2c10c74f0a26bdecc78f82c011a89db8a006f6827a80390"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("8afaf20659ac2762b2c10c74f0a26bdecc78f82c011a89db8a006f6827a80390")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "f6f89da0b22ca49233197e072a39554147b55755be0c7cdf139ad33cc973ec46"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("f6f89da0b22ca49233197e072a39554147b55755be0c7cdf139ad33cc973ec46")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "92a8b6d40b58d802ab2e8488af204742b0db3e6d2651a55b0e4456425cb5497c"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("92a8b6d40b58d802ab2e8488af204742b0db3e6d2651a55b0e4456425cb5497c")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "0d94f4d0ea3c092a8bce7afe27edb84a4167cda55871b12b0bd0d6e2b4ef4e81"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("0d94f4d0ea3c092a8bce7afe27edb84a4167cda55871b12b0bd0d6e2b4ef4e81")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } <DeepExtract> try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) { System.out.println("Test tx: " + "bc26380619a36e0ecbb5bae4eebf78d8fdef24ba5ed5fd040e7bff37311e180d"); Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("bc26380619a36e0ecbb5bae4eebf78d8fdef24ba5ed5fd040e7bff37311e180d")).getTx(jelly.getNetworkParameters()); for (TransactionInput in : tx.getInputs()) { ByteString in_parse = tx_util.getScriptHashForInput(in, true, null); Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters()); TransactionOutput out = src.getOutput(in.getOutpoint().getIndex()); ByteString out_parse = tx_util.getScriptHashForOutput(out); Assert.assertEquals(getHexString(out_parse), getHexString(in_parse)); } } </DeepExtract> }
jelectrum
positive
575
@Override public void onShowMessage(@NonNull String msg) { if (getProgressDialog().isShowing()) getProgressDialog().dismiss(); Toast.makeText(this, msg, Toast.LENGTH_LONG).show(); }
@Override public void onShowMessage(@NonNull String msg) { <DeepExtract> if (getProgressDialog().isShowing()) getProgressDialog().dismiss(); </DeepExtract> Toast.makeText(this, msg, Toast.LENGTH_LONG).show(); }
FastAccess
positive
576
public TreeNode deserialize(String data) { Queue<String> qu = new LinkedList<>(); qu.addAll(Arrays.asList(data.split(","))); if (qu.isEmpty()) return null; String cur = qu.remove(); if (cur.equals("N")) { return null; } else { TreeNode root = new TreeNode(Integer.valueOf(cur)); root.left = buildTree(qu); root.right = buildTree(qu); return root; } }
public TreeNode deserialize(String data) { Queue<String> qu = new LinkedList<>(); qu.addAll(Arrays.asList(data.split(","))); <DeepExtract> if (qu.isEmpty()) return null; String cur = qu.remove(); if (cur.equals("N")) { return null; } else { TreeNode root = new TreeNode(Integer.valueOf(cur)); root.left = buildTree(qu); root.right = buildTree(qu); return root; } </DeepExtract> }
Leetcode-for-Fun
positive
577
@Override public OUTER set(OUTER newValue) { return converter.pushIn(ref.set(converter.pushIn(newValue))); }
@Override public OUTER set(OUTER newValue) { <DeepExtract> return converter.pushIn(ref.set(converter.pushIn(newValue))); </DeepExtract> }
karg
positive
578
private void assignLayers(Set<Vertex> comp) { LinkedList<Vertex> queue = new LinkedList<Vertex>(); HashSet<Vertex> processed = new HashSet<Vertex>(); int ctr = 0; for (Vertex v : comp) { if (network.isOrphan(v)) { queue.add(v); } } while (!queue.isEmpty()) { Vertex v = queue.removeFirst(); processed.add(v); ctr++; int layer = (v instanceof Fam) ? 1 : 0; for (Vertex p : network.getAscendants(v)) { layer = Math.max(layer, p.getLayer() + 1); } v.setLayer(layer); for (Vertex d : network.getDescendants(v)) { if (processed.containsAll(network.getAscendants(d))) { queue.addLast(d); } } } assert (ctr == comp.size()); if (comp.size() <= 1) return; while (tightTree(comp) < comp.size()) { Edge e = null; for (Vertex v : comp) { for (Edge f : network.getInEdges(v)) { if (!treeEdge.contains(f) && incident(f) != null && ((e == null) || (slack(f) < slack(e)))) { e = f; } } } if (e != null) { int delta = slack(e); if (delta != 0) { if (incident(e) == network.getDescendant(e)) delta = -delta; network.offsetLayer(delta, treeNode); } else LOG.error("Unexpected tight node"); } } int min = comp.size(); for (Vertex v : comp) { min = Math.min(min, v.getLayer()); } if ((min % 2) == 1) min--; network.offsetLayer(-min, comp); }
private void assignLayers(Set<Vertex> comp) { LinkedList<Vertex> queue = new LinkedList<Vertex>(); HashSet<Vertex> processed = new HashSet<Vertex>(); int ctr = 0; for (Vertex v : comp) { if (network.isOrphan(v)) { queue.add(v); } } while (!queue.isEmpty()) { Vertex v = queue.removeFirst(); processed.add(v); ctr++; int layer = (v instanceof Fam) ? 1 : 0; for (Vertex p : network.getAscendants(v)) { layer = Math.max(layer, p.getLayer() + 1); } v.setLayer(layer); for (Vertex d : network.getDescendants(v)) { if (processed.containsAll(network.getAscendants(d))) { queue.addLast(d); } } } assert (ctr == comp.size()); <DeepExtract> if (comp.size() <= 1) return; while (tightTree(comp) < comp.size()) { Edge e = null; for (Vertex v : comp) { for (Edge f : network.getInEdges(v)) { if (!treeEdge.contains(f) && incident(f) != null && ((e == null) || (slack(f) < slack(e)))) { e = f; } } } if (e != null) { int delta = slack(e); if (delta != 0) { if (incident(e) == network.getDescendant(e)) delta = -delta; network.offsetLayer(delta, treeNode); } else LOG.error("Unexpected tight node"); } } </DeepExtract> int min = comp.size(); for (Vertex v : comp) { min = Math.min(min, v.getLayer()); } if ((min % 2) == 1) min--; network.offsetLayer(-min, comp); }
geneaquilt
positive
579
public Criteria andIsDeletedGreaterThanOrEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "isDeleted" + " cannot be null"); } criteria.add(new Criterion("is_deleted >=", value)); return (Criteria) this; }
public Criteria andIsDeletedGreaterThanOrEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "isDeleted" + " cannot be null"); } criteria.add(new Criterion("is_deleted >=", value)); </DeepExtract> return (Criteria) this; }
MarketServer
positive
580
public static String getNewFormatDateString(Date date) { DateFormat dateFormat = new SimpleDateFormat(simple); if (date == null || dateFormat == null) { return null; } return dateFormat.format(date); }
public static String getNewFormatDateString(Date date) { DateFormat dateFormat = new SimpleDateFormat(simple); <DeepExtract> if (date == null || dateFormat == null) { return null; } return dateFormat.format(date); </DeepExtract> }
classchecks
positive
581
public Criteria andSongidNotBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "songid" + " cannot be null"); } criteria.add(new Criterion("songId not between", value1, value2)); return (Criteria) this; }
public Criteria andSongidNotBetween(String value1, String value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "songid" + " cannot be null"); } criteria.add(new Criterion("songId not between", value1, value2)); </DeepExtract> return (Criteria) this; }
music
positive
582
public void newMap(int width, int height) { String uuid = UUID.randomUUID().toString(); this.scene = new Scene(null, uuid, width, height); this.scene.setCamera(camera); this.scene.setDebug(true); this.terrain = this.scene.getTerrain(); terrain.setDebugListener(this); terrain.fillEmptyTilesWithDebugTile(); terrain.buildSectors(); camera.position.set(width / 2, 17, height / 2); camera.lookAt(width / 2, 0, height / 2); this.scene.initialize(); terrainBrush = new TerrainBrush(terrain); autoTileBrush = new AutoTileBrush(terrain); passableTileBrush = new PassableBrush(terrain); eventBrush = new EventBrush(terrain); liquidBrush = new LiquidBrush(terrain); foliageBrush = new FoliageBrush(terrain); }
public void newMap(int width, int height) { String uuid = UUID.randomUUID().toString(); this.scene = new Scene(null, uuid, width, height); this.scene.setCamera(camera); this.scene.setDebug(true); this.terrain = this.scene.getTerrain(); terrain.setDebugListener(this); terrain.fillEmptyTilesWithDebugTile(); terrain.buildSectors(); camera.position.set(width / 2, 17, height / 2); camera.lookAt(width / 2, 0, height / 2); this.scene.initialize(); <DeepExtract> terrainBrush = new TerrainBrush(terrain); autoTileBrush = new AutoTileBrush(terrain); passableTileBrush = new PassableBrush(terrain); eventBrush = new EventBrush(terrain); liquidBrush = new LiquidBrush(terrain); foliageBrush = new FoliageBrush(terrain); </DeepExtract> }
FabulaEngine
positive
583
@Override public IntIterator getUidxIidxs(int uidx) { return d.getUidxIidxs(uidx); }
@Override public IntIterator getUidxIidxs(int uidx) { <DeepExtract> return d.getUidxIidxs(uidx); </DeepExtract> }
kNNBandit
positive
584
void start() throws Exception { if (mSession == null || !mSession.isRunning()) { try { mSession = createSession(); } catch (Exception e) { e.printStackTrace(); } if (mSession == null) { startServer(); mSession = createSession(); } } return mSession; }
void start() throws Exception { <DeepExtract> if (mSession == null || !mSession.isRunning()) { try { mSession = createSession(); } catch (Exception e) { e.printStackTrace(); } if (mSession == null) { startServer(); mSession = createSession(); } } return mSession; </DeepExtract> }
AppOpsX
positive
585
@Deprecated public void closeSubPath() throws IOException { if (inTextMode) { throw new IllegalStateException("Error: closePath is not allowed within a text block."); } writeOperator("h"); }
@Deprecated public void closeSubPath() throws IOException { <DeepExtract> if (inTextMode) { throw new IllegalStateException("Error: closePath is not allowed within a text block."); } writeOperator("h"); </DeepExtract> }
pint-publisher
positive
586
@Override public Completable sendDeliveryReceipt(String userId, DeliveryReceiptType type, String messageId, @Nullable Consumer<String> newId) { return send(Paths.messagesPath(userId), new DeliveryReceipt(type, messageId), newId); }
@Override public Completable sendDeliveryReceipt(String userId, DeliveryReceiptType type, String messageId, @Nullable Consumer<String> newId) { <DeepExtract> return send(Paths.messagesPath(userId), new DeliveryReceipt(type, messageId), newId); </DeepExtract> }
firestream-android
positive
587
@Override public Number getNumberValue() throws IOException { Object n = currentNode(); if (n instanceof Number) { return (Number) n; } else { throw _constructError(n + " is not a number"); } }
@Override public Number getNumberValue() throws IOException { <DeepExtract> Object n = currentNode(); if (n instanceof Number) { return (Number) n; } else { throw _constructError(n + " is not a number"); } </DeepExtract> }
mongojack
positive
588
public void onClick(DialogInterface dialog, int id) { isGameStarted = false; isUserTurn = false; WarpController.getInstance().stopApp(); super.onBackPressed(); }
public void onClick(DialogInterface dialog, int id) { <DeepExtract> isGameStarted = false; isUserTurn = false; WarpController.getInstance().stopApp(); super.onBackPressed(); </DeepExtract> }
AppWarpAndroidSamples
positive
589
public long incrementAndGet() { long currentValue; long newValue; do { currentValue = get(); newValue = currentValue + 1L; } while (!compareAndSet(currentValue, newValue)); return newValue; }
public long incrementAndGet() { <DeepExtract> long currentValue; long newValue; do { currentValue = get(); newValue = currentValue + 1L; } while (!compareAndSet(currentValue, newValue)); return newValue; </DeepExtract> }
disruptor-translation
positive
590
public static FinalDb create(DaoConfig daoConfig) { FinalDb dao = daoMap.get(daoConfig.getDbName()); if (dao == null) { dao = new FinalDb(daoConfig); daoMap.put(daoConfig.getDbName(), dao); } return dao; }
public static FinalDb create(DaoConfig daoConfig) { <DeepExtract> FinalDb dao = daoMap.get(daoConfig.getDbName()); if (dao == null) { dao = new FinalDb(daoConfig); daoMap.put(daoConfig.getDbName(), dao); } return dao; </DeepExtract> }
afinal
positive
591
@Override public Void call() { putAll(updateSpec.getNonTransactionalGroup().getBarriers()); putAll(updateSpec.getNonTransactionalGroup().getJobs()); putAll(updateSpec.getNonTransactionalGroup().getSlots()); putAll(updateSpec.getNonTransactionalGroup().getJobInstanceRecords()); putAll(updateSpec.getNonTransactionalGroup().getFailureRecords()); return null; }
@Override public Void call() { <DeepExtract> putAll(updateSpec.getNonTransactionalGroup().getBarriers()); putAll(updateSpec.getNonTransactionalGroup().getJobs()); putAll(updateSpec.getNonTransactionalGroup().getSlots()); putAll(updateSpec.getNonTransactionalGroup().getJobInstanceRecords()); putAll(updateSpec.getNonTransactionalGroup().getFailureRecords()); </DeepExtract> return null; }
appengine-pipelines
positive
595
void onStop(Task onCompleted) { if (onCompleted != null) { runnables.add(onCompleted); } dispose = true; }
void onStop(Task onCompleted) { <DeepExtract> if (onCompleted != null) { runnables.add(onCompleted); } </DeepExtract> dispose = true; }
hawtdispatch
positive
596
public void show(Context context) { ShareSDK.initSDK(context); this.context = context; ShareSDK.logDemoEvent(1, null); if (shareParamsMap.containsKey("platform")) { String name = String.valueOf(shareParamsMap.get("platform")); Platform platform = ShareSDK.getPlatform(name); if (silent || ShareCore.isUseClientToShare(name) || platform instanceof CustomPlatform) { HashMap<Platform, HashMap<String, Object>> shareData = new HashMap<Platform, HashMap<String, Object>>(); shareData.put(ShareSDK.getPlatform(name), shareParamsMap); share(shareData); return; } } try { if (OnekeyShareTheme.SKYBLUE == theme) { platformListFakeActivity = (PlatformListFakeActivity) Class.forName("cn.sharesdk.onekeyshare.theme.skyblue.PlatformListPage").newInstance(); } else { platformListFakeActivity = (PlatformListFakeActivity) Class.forName("cn.sharesdk.onekeyshare.theme.classic.PlatformListPage").newInstance(); } } catch (Exception e) { e.printStackTrace(); return; } platformListFakeActivity.setDialogMode(dialogMode); platformListFakeActivity.setShareParamsMap(shareParamsMap); this.silent = silent; platformListFakeActivity.setCustomerLogos(customers); platformListFakeActivity.setBackgroundView(bgView); platformListFakeActivity.setHiddenPlatforms(hiddenPlatforms); this.onShareButtonClickListener = onShareButtonClickListener; platformListFakeActivity.setThemeShareCallback(new ThemeShareCallback() { public void doShare(HashMap<Platform, HashMap<String, Object>> shareData) { share(shareData); } }); if (shareParamsMap.containsKey("platform")) { String name = String.valueOf(shareParamsMap.get("platform")); Platform platform = ShareSDK.getPlatform(name); platformListFakeActivity.showEditPage(context, platform); return; } platformListFakeActivity.show(context, null); }
public void show(Context context) { ShareSDK.initSDK(context); this.context = context; ShareSDK.logDemoEvent(1, null); if (shareParamsMap.containsKey("platform")) { String name = String.valueOf(shareParamsMap.get("platform")); Platform platform = ShareSDK.getPlatform(name); if (silent || ShareCore.isUseClientToShare(name) || platform instanceof CustomPlatform) { HashMap<Platform, HashMap<String, Object>> shareData = new HashMap<Platform, HashMap<String, Object>>(); shareData.put(ShareSDK.getPlatform(name), shareParamsMap); share(shareData); return; } } try { if (OnekeyShareTheme.SKYBLUE == theme) { platformListFakeActivity = (PlatformListFakeActivity) Class.forName("cn.sharesdk.onekeyshare.theme.skyblue.PlatformListPage").newInstance(); } else { platformListFakeActivity = (PlatformListFakeActivity) Class.forName("cn.sharesdk.onekeyshare.theme.classic.PlatformListPage").newInstance(); } } catch (Exception e) { e.printStackTrace(); return; } platformListFakeActivity.setDialogMode(dialogMode); platformListFakeActivity.setShareParamsMap(shareParamsMap); this.silent = silent; platformListFakeActivity.setCustomerLogos(customers); platformListFakeActivity.setBackgroundView(bgView); platformListFakeActivity.setHiddenPlatforms(hiddenPlatforms); <DeepExtract> this.onShareButtonClickListener = onShareButtonClickListener; </DeepExtract> platformListFakeActivity.setThemeShareCallback(new ThemeShareCallback() { public void doShare(HashMap<Platform, HashMap<String, Object>> shareData) { share(shareData); } }); if (shareParamsMap.containsKey("platform")) { String name = String.valueOf(shareParamsMap.get("platform")); Platform platform = ShareSDK.getPlatform(name); platformListFakeActivity.showEditPage(context, platform); return; } platformListFakeActivity.show(context, null); }
Feeder
positive
597
public static void removeCookie(HttpServletResponse response, String name) { Cookie cookie = new Cookie(name, null); cookie.setMaxAge(0); response.addCookie(cookie); }
public static void removeCookie(HttpServletResponse response, String name) { <DeepExtract> Cookie cookie = new Cookie(name, null); cookie.setMaxAge(0); response.addCookie(cookie); </DeepExtract> }
zkfiddle
positive
598
public int get(int key) { if (!records.containsKey(key)) { return -1; } Node node = records.get(key); node.times++; NodeList curNodeList = heads.get(node); curNodeList.deleteNode(node); NodeList preList = modifyHeadList(curNodeList) ? curNodeList.last : curNodeList; NodeList nextList = curNodeList.next; if (nextList == null) { NodeList newList = new NodeList(node); if (preList != null) { preList.next = newList; } newList.last = preList; if (headList == null) { headList = newList; } heads.put(node, newList); } else { if (nextList.head.times.equals(node.times)) { nextList.addNodeFromHead(node); heads.put(node, nextList); } else { NodeList newList = new NodeList(node); if (preList != null) { preList.next = newList; } newList.last = preList; newList.next = nextList; nextList.last = newList; if (headList == nextList) { headList = newList; } heads.put(node, newList); } } return node.value; }
public int get(int key) { if (!records.containsKey(key)) { return -1; } Node node = records.get(key); node.times++; NodeList curNodeList = heads.get(node); <DeepExtract> curNodeList.deleteNode(node); NodeList preList = modifyHeadList(curNodeList) ? curNodeList.last : curNodeList; NodeList nextList = curNodeList.next; if (nextList == null) { NodeList newList = new NodeList(node); if (preList != null) { preList.next = newList; } newList.last = preList; if (headList == null) { headList = newList; } heads.put(node, newList); } else { if (nextList.head.times.equals(node.times)) { nextList.addNodeFromHead(node); heads.put(node, nextList); } else { NodeList newList = new NodeList(node); if (preList != null) { preList.next = newList; } newList.last = preList; newList.next = nextList; nextList.last = newList; if (headList == nextList) { headList = newList; } heads.put(node, newList); } } </DeepExtract> return node.value; }
fanrui-learning
positive
599
public JTextField addTextField(String label, String value) { JTextField field = new JTextField(); field.setText(value); add(label, field); return field; }
public JTextField addTextField(String label, String value) { JTextField field = new JTextField(); <DeepExtract> field.setText(value); add(label, field); </DeepExtract> return field; }
SBOLDesigner
positive
600
@SuppressWarnings("unused") private Surface getVideoSurface() { synchronized (mNativeLock) { return mSurfaces[ID_VIDEO]; } }
@SuppressWarnings("unused") private Surface getVideoSurface() { <DeepExtract> synchronized (mNativeLock) { return mSurfaces[ID_VIDEO]; } </DeepExtract> }
RtspServerAndVlcPlay
positive
601
public Criteria andKeywordsBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "keywords" + " cannot be null"); } criteria.add(new Criterion("KEYWORDS between", value1, value2)); return (Criteria) this; }
public Criteria andKeywordsBetween(String value1, String value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "keywords" + " cannot be null"); } criteria.add(new Criterion("KEYWORDS between", value1, value2)); </DeepExtract> return (Criteria) this; }
ECPS
positive
603
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false); if (savedInstanceState != null) { mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); mFromSavedInstanceState = true; } mCurrentSelectedPosition = mCurrentSelectedPosition; if (mLvMenu != null) { mLvMenu.setItemChecked(mCurrentSelectedPosition, true); MenuAdapter adapter = (MenuAdapter) mLvMenu.getAdapter(); adapter.setActive(mCurrentSelectedPosition); } if (mDrawerLayout != null) { mDrawerLayout.closeDrawer(mFragmentContainerView); } if (mCallbacks != null) { mCallbacks.onNavigationDrawerItemSelected(mCurrentSelectedPosition); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false); if (savedInstanceState != null) { mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); mFromSavedInstanceState = true; } <DeepExtract> mCurrentSelectedPosition = mCurrentSelectedPosition; if (mLvMenu != null) { mLvMenu.setItemChecked(mCurrentSelectedPosition, true); MenuAdapter adapter = (MenuAdapter) mLvMenu.getAdapter(); adapter.setActive(mCurrentSelectedPosition); } if (mDrawerLayout != null) { mDrawerLayout.closeDrawer(mFragmentContainerView); } if (mCallbacks != null) { mCallbacks.onNavigationDrawerItemSelected(mCurrentSelectedPosition); } </DeepExtract> }
androidlx_2014
positive
604
@Override public void captureStartValues(TransitionValues transitionValues) { transitionValues.values.put(PROPNAME_SCROLL_X, transitionValues.view.getScrollX()); transitionValues.values.put(PROPNAME_SCROLL_Y, transitionValues.view.getScrollY()); }
@Override public void captureStartValues(TransitionValues transitionValues) { <DeepExtract> transitionValues.values.put(PROPNAME_SCROLL_X, transitionValues.view.getScrollX()); transitionValues.values.put(PROPNAME_SCROLL_Y, transitionValues.view.getScrollY()); </DeepExtract> }
TransitionsDemo
positive
605
public void search(int direction) { InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) imm.hideSoftInputFromWindow(mSearchText.getWindowToken(), 0); int displayPage = mDocView.getDisplayedViewIndex(); SearchTaskResult r = SearchTaskResult.get(); int searchPage = r != null ? r.pageNumber : -1; mSearchTask.go(mSearchText.getText().toString(), direction, displayPage, searchPage); }
public void search(int direction) { <DeepExtract> InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) imm.hideSoftInputFromWindow(mSearchText.getWindowToken(), 0); </DeepExtract> int displayPage = mDocView.getDisplayedViewIndex(); SearchTaskResult r = SearchTaskResult.get(); int searchPage = r != null ? r.pageNumber : -1; mSearchTask.go(mSearchText.getText().toString(), direction, displayPage, searchPage); }
mupdf-android
positive
606
public Criteria andAddressIsNotNull() { if ("address is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("address is not null")); return (Criteria) this; }
public Criteria andAddressIsNotNull() { <DeepExtract> if ("address is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("address is not null")); </DeepExtract> return (Criteria) this; }
Ordering
positive
607
@Test public void test500(TestContext context) { Async async = context.async(); getJSON("/json/fail/" + 500, response -> { context.assertEquals(500, response.statusCode()); response.bodyHandler(buff -> { JsonObject json = new JsonObject(buff.toString()); JsonObject error = json.getJsonObject("error"); context.assertEquals(500, error.getInteger("code")); context.assertEquals("Internal server error", error.getString("message")); async.complete(); }); }); }
@Test public void test500(TestContext context) { <DeepExtract> Async async = context.async(); getJSON("/json/fail/" + 500, response -> { context.assertEquals(500, response.statusCode()); response.bodyHandler(buff -> { JsonObject json = new JsonObject(buff.toString()); JsonObject error = json.getJsonObject("error"); context.assertEquals(500, error.getInteger("code")); context.assertEquals("Internal server error", error.getString("message")); async.complete(); }); }); </DeepExtract> }
nubes
positive
608
void testStream(String name, String query, String[] expected) { System.out.println("=== Testing " + name + " ==="); System.out.println(query); Object ret = elp.eval(query); System.out.println(" = returns ="); if (ret.getClass().isArray()) { int size = Array.getLength(ret); assertTrue(size == expected.length); for (int i = 0; i < size; i++) { Object item = Array.get(ret, i); p(" " + item.toString()); assertEquals(item.toString(), expected[i]); } return; } if (ret instanceof List) { List<Object> list = (List<Object>) ret; int i = 0; for (Object item : list) { p(" " + item.toString()); assertEquals(item.toString(), expected[i++]); } assertTrue(i == expected.length); return; } if (ret instanceof Iterator) { int i = 0; Iterator<Object> iter = (Iterator<Object>) ret; while (iter.hasNext()) { Object item = iter.next(); p(" " + item.toString()); assertEquals(item.toString(), expected[i++]); } assertTrue(i == expected.length); return; } assertTrue(false); }
void testStream(String name, String query, String[] expected) { System.out.println("=== Testing " + name + " ==="); System.out.println(query); Object ret = elp.eval(query); <DeepExtract> System.out.println(" = returns ="); </DeepExtract> if (ret.getClass().isArray()) { int size = Array.getLength(ret); assertTrue(size == expected.length); for (int i = 0; i < size; i++) { Object item = Array.get(ret, i); p(" " + item.toString()); assertEquals(item.toString(), expected[i]); } return; } if (ret instanceof List) { List<Object> list = (List<Object>) ret; int i = 0; for (Object item : list) { p(" " + item.toString()); assertEquals(item.toString(), expected[i++]); } assertTrue(i == expected.length); return; } if (ret instanceof Iterator) { int i = 0; Iterator<Object> iter = (Iterator<Object>) ret; while (iter.hasNext()) { Object item = iter.next(); p(" " + item.toString()); assertEquals(item.toString(), expected[i++]); } assertTrue(i == expected.length); return; } assertTrue(false); }
el-spec
positive
609
@Override public void update() { if (!initialized) { updatePreviewLabels(); initialized = true; } currentView().ifPresent(view -> { PacManGameView gameView = (PacManGameView) view; if (!comboSelectTheme.getSelectedItem().equals(gameController.themes.current().name())) { comboSelectTheme.setSelectedItem(gameView.getTheme().name().toUpperCase()); updatePreviewLabels(); } }); }
@Override public void update() { if (!initialized) { updatePreviewLabels(); initialized = true; } <DeepExtract> currentView().ifPresent(view -> { PacManGameView gameView = (PacManGameView) view; if (!comboSelectTheme.getSelectedItem().equals(gameController.themes.current().name())) { comboSelectTheme.setSelectedItem(gameView.getTheme().name().toUpperCase()); updatePreviewLabels(); } }); </DeepExtract> }
pacman
positive
612
@Override @Nullable public AssetFileDescriptor openAssetFile(@NonNull final Uri uri, @NonNull final String mode, @Nullable final CancellationSignal signal) throws FileNotFoundException { final long caller = Binder.clearCallingIdentity(); try { return () -> mResolver.openAssetFileDescriptor(toTargetUri(uri), mode, signal).execute(); } finally { Binder.restoreCallingIdentity(caller); } }
@Override @Nullable public AssetFileDescriptor openAssetFile(@NonNull final Uri uri, @NonNull final String mode, @Nullable final CancellationSignal signal) throws FileNotFoundException { <DeepExtract> final long caller = Binder.clearCallingIdentity(); try { return () -> mResolver.openAssetFileDescriptor(toTargetUri(uri), mode, signal).execute(); } finally { Binder.restoreCallingIdentity(caller); } </DeepExtract> }
island
positive
613
public void add_operand__add_op(Token addOp) { boolean printYear = false; if (verbose) { System.out.print("R"); if (705 < 1000) { System.out.print(" "); } else if (705 > 2000) { 705 = 705 / 1000; printYear = true; } } System.out.print(705); if (printYear) System.out.print("-F2008"); if (verbose) { System.out.print(":" + "add-operand__add-op" + ":"); } else { if ("add-op".length() > 0) System.out.print(":" + "add-op"); } System.out.print(" "); if (verbose) System.out.print("addOp" + "="); System.out.print(addOp); System.out.println(); }
public void add_operand__add_op(Token addOp) { boolean printYear = false; if (verbose) { System.out.print("R"); if (705 < 1000) { System.out.print(" "); } else if (705 > 2000) { 705 = 705 / 1000; printYear = true; } } System.out.print(705); if (printYear) System.out.print("-F2008"); if (verbose) { System.out.print(":" + "add-operand__add-op" + ":"); } else { if ("add-op".length() > 0) System.out.print(":" + "add-op"); } System.out.print(" "); if (verbose) System.out.print("addOp" + "="); System.out.print(addOp); <DeepExtract> System.out.println(); </DeepExtract> }
open-fortran-parser
positive
614
public void getList(String url, Parameters parameters) { Request request = new Request.Builder().method(GET, getRequestBody(true, null)).headers(Headers.of()).url(getBuilder(url, parameters).build()).build(); try (Response response = call(request, url)) { try (ResponseBody responseBody = response.body()) { if (null == responseBody) { return null; } return parseList(null, url, responseBody); } } }
public void getList(String url, Parameters parameters) { <DeepExtract> Request request = new Request.Builder().method(GET, getRequestBody(true, null)).headers(Headers.of()).url(getBuilder(url, parameters).build()).build(); try (Response response = call(request, url)) { try (ResponseBody responseBody = response.body()) { if (null == responseBody) { return null; } return parseList(null, url, responseBody); } } </DeepExtract> }
Doramon
positive
615
@Override protected boolean matchesSafely(Iterable<? extends E> iterable, Description mismatchDescription) { final MatchSeries<E> matchSeries = new MatchSeries<>(matchers, mismatchDescription); for (E item : iterable) { if (!matchSeries.matches(item)) { return false; } } if (nextMatchIx < matchers.size()) { mismatchDescription.appendText("no item was ").appendDescriptionOf(matchers.get(nextMatchIx)); return false; } return true; }
@Override protected boolean matchesSafely(Iterable<? extends E> iterable, Description mismatchDescription) { final MatchSeries<E> matchSeries = new MatchSeries<>(matchers, mismatchDescription); for (E item : iterable) { if (!matchSeries.matches(item)) { return false; } } <DeepExtract> if (nextMatchIx < matchers.size()) { mismatchDescription.appendText("no item was ").appendDescriptionOf(matchers.get(nextMatchIx)); return false; } return true; </DeepExtract> }
JavaHamcrest
positive
616
public boolean sameAs(final String name) { if (name == null || name.getClass() != Host.class) { return false; } return this.name.equals(((Host) name).name); }
public boolean sameAs(final String name) { <DeepExtract> if (name == null || name.getClass() != Host.class) { return false; } return this.name.equals(((Host) name).name); </DeepExtract> }
xoom-wire
positive
617
public void launch(String[] args) throws Exception { CmdLineCommon cmdLine = new CmdLineCommon("VerbsClient"); try { cmdLine.parse(args); } catch (ParseException e) { cmdLine.printHelp(); System.exit(-1); } ipAddress = cmdLine.getIp(); port = cmdLine.getPort(); System.out.println("VerbsClient::starting..."); RdmaEventChannel cmChannel = RdmaEventChannel.createEventChannel(); if (cmChannel == null) { System.out.println("VerbsClient::cmChannel null"); return; } RdmaCmId idPriv = cmChannel.createId(RdmaCm.RDMA_PS_TCP); if (idPriv == null) { System.out.println("VerbsClient::id null"); return; } InetAddress _dst = InetAddress.getByName(ipAddress); InetSocketAddress dst = new InetSocketAddress(_dst, port); idPriv.resolveAddr(null, dst, 2000); RdmaCmEvent cmEvent = cmChannel.getCmEvent(-1); if (cmEvent == null) { System.out.println("VerbsClient::cmEvent null"); return; } else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ADDR_RESOLVED.ordinal()) { System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent()); return; } cmEvent.ackEvent(); idPriv.resolveRoute(2000); cmEvent = cmChannel.getCmEvent(-1); if (cmEvent == null) { System.out.println("VerbsClient::cmEvent null"); return; } else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ROUTE_RESOLVED.ordinal()) { System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent()); return; } cmEvent.ackEvent(); IbvContext context = idPriv.getVerbs(); IbvPd pd = context.allocPd(); if (pd == null) { System.out.println("VerbsClient::pd null"); return; } IbvCompChannel compChannel = context.createCompChannel(); if (compChannel == null) { System.out.println("VerbsClient::compChannel null"); return; } IbvCQ cq = context.createCQ(compChannel, 50, 0); if (cq == null) { System.out.println("VerbsClient::cq null"); return; } cq.reqNotification(false).execute().free(); IbvQPInitAttr attr = new IbvQPInitAttr(); attr.cap().setMax_recv_sge(1); attr.cap().setMax_recv_wr(10); attr.cap().setMax_send_sge(1); attr.cap().setMax_send_wr(10); attr.setQp_type(IbvQP.IBV_QPT_RC); attr.setRecv_cq(cq); attr.setSend_cq(cq); IbvQP qp = idPriv.createQP(pd, attr); if (qp == null) { System.out.println("VerbsClient::qp null"); return; } int buffercount = 3; int buffersize = 100; ByteBuffer[] buffers = new ByteBuffer[buffercount]; IbvMr[] mrlist = new IbvMr[buffercount]; int access = IbvMr.IBV_ACCESS_LOCAL_WRITE | IbvMr.IBV_ACCESS_REMOTE_WRITE | IbvMr.IBV_ACCESS_REMOTE_READ; for (int i = 0; i < buffercount; i++) { buffers[i] = ByteBuffer.allocateDirect(buffersize); mrlist[i] = pd.regMr(buffers[i], access).execute().free().getMr(); } ByteBuffer dataBuf = buffers[0]; IbvMr dataMr = mrlist[0]; IbvMr sendMr = mrlist[1]; ByteBuffer recvBuf = buffers[2]; IbvMr recvMr = mrlist[2]; LinkedList<IbvRecvWR> wrList_recv = new LinkedList<IbvRecvWR>(); IbvSge sgeRecv = new IbvSge(); sgeRecv.setAddr(recvMr.getAddr()); sgeRecv.setLength(recvMr.getLength()); sgeRecv.setLkey(recvMr.getLkey()); LinkedList<IbvSge> sgeListRecv = new LinkedList<IbvSge>(); sgeListRecv.add(sgeRecv); IbvRecvWR recvWR = new IbvRecvWR(); recvWR.setSg_list(sgeListRecv); recvWR.setWr_id(1000); wrList_recv.add(recvWR); VerbsTools commRdma = new VerbsTools(context, compChannel, qp, cq); commRdma.initSGRecv(wrList_recv); RdmaConnParam connParam = new RdmaConnParam(); connParam.setRetry_count((byte) 2); idPriv.connect(connParam); cmEvent = cmChannel.getCmEvent(-1); if (cmEvent == null) { System.out.println("VerbsClient::cmEvent null"); return; } else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ESTABLISHED.ordinal()) { System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent()); return; } cmEvent.ackEvent(); commRdma.completeSGRecv(wrList_recv, false); recvBuf.clear(); long addr = recvBuf.getLong(); int length = recvBuf.getInt(); int lkey = recvBuf.getInt(); recvBuf.clear(); System.out.println("VerbsClient::receiving rdma information, addr " + addr + ", length " + length + ", key " + lkey); System.out.println("VerbsClient::preparing read operation..."); LinkedList<IbvSendWR> wrList_send = new LinkedList<IbvSendWR>(); IbvSge sgeSend = new IbvSge(); sgeSend.setAddr(dataMr.getAddr()); sgeSend.setLength(dataMr.getLength()); sgeSend.setLkey(dataMr.getLkey()); LinkedList<IbvSge> sgeList = new LinkedList<IbvSge>(); sgeList.add(sgeSend); IbvSendWR sendWR = new IbvSendWR(); sendWR.setWr_id(1001); sendWR.setSg_list(sgeList); sendWR.setOpcode(IbvSendWR.IBV_WR_RDMA_READ); sendWR.setSend_flags(IbvSendWR.IBV_SEND_SIGNALED); sendWR.getRdma().setRemote_addr(addr); sendWR.getRdma().setRkey(lkey); wrList_send.add(sendWR); commRdma.send(buffers, wrList_send, true, false); dataBuf.clear(); System.out.println("VerbsClient::read memory from server: " + dataBuf.asCharBuffer().toString()); sgeSend = new IbvSge(); sgeSend.setAddr(sendMr.getAddr()); sgeSend.setLength(sendMr.getLength()); sgeSend.setLkey(sendMr.getLkey()); sgeList.clear(); sgeList.add(sgeSend); sendWR = new IbvSendWR(); sendWR.setWr_id(1002); sendWR.setSg_list(sgeList); sendWR.setOpcode(IbvSendWR.IBV_WR_SEND); sendWR.setSend_flags(IbvSendWR.IBV_SEND_SIGNALED); wrList_send.clear(); wrList_send.add(sendWR); commRdma.send(buffers, wrList_send, true, false); }
public void launch(String[] args) throws Exception { CmdLineCommon cmdLine = new CmdLineCommon("VerbsClient"); try { cmdLine.parse(args); } catch (ParseException e) { cmdLine.printHelp(); System.exit(-1); } ipAddress = cmdLine.getIp(); port = cmdLine.getPort(); <DeepExtract> System.out.println("VerbsClient::starting..."); RdmaEventChannel cmChannel = RdmaEventChannel.createEventChannel(); if (cmChannel == null) { System.out.println("VerbsClient::cmChannel null"); return; } RdmaCmId idPriv = cmChannel.createId(RdmaCm.RDMA_PS_TCP); if (idPriv == null) { System.out.println("VerbsClient::id null"); return; } InetAddress _dst = InetAddress.getByName(ipAddress); InetSocketAddress dst = new InetSocketAddress(_dst, port); idPriv.resolveAddr(null, dst, 2000); RdmaCmEvent cmEvent = cmChannel.getCmEvent(-1); if (cmEvent == null) { System.out.println("VerbsClient::cmEvent null"); return; } else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ADDR_RESOLVED.ordinal()) { System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent()); return; } cmEvent.ackEvent(); idPriv.resolveRoute(2000); cmEvent = cmChannel.getCmEvent(-1); if (cmEvent == null) { System.out.println("VerbsClient::cmEvent null"); return; } else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ROUTE_RESOLVED.ordinal()) { System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent()); return; } cmEvent.ackEvent(); IbvContext context = idPriv.getVerbs(); IbvPd pd = context.allocPd(); if (pd == null) { System.out.println("VerbsClient::pd null"); return; } IbvCompChannel compChannel = context.createCompChannel(); if (compChannel == null) { System.out.println("VerbsClient::compChannel null"); return; } IbvCQ cq = context.createCQ(compChannel, 50, 0); if (cq == null) { System.out.println("VerbsClient::cq null"); return; } cq.reqNotification(false).execute().free(); IbvQPInitAttr attr = new IbvQPInitAttr(); attr.cap().setMax_recv_sge(1); attr.cap().setMax_recv_wr(10); attr.cap().setMax_send_sge(1); attr.cap().setMax_send_wr(10); attr.setQp_type(IbvQP.IBV_QPT_RC); attr.setRecv_cq(cq); attr.setSend_cq(cq); IbvQP qp = idPriv.createQP(pd, attr); if (qp == null) { System.out.println("VerbsClient::qp null"); return; } int buffercount = 3; int buffersize = 100; ByteBuffer[] buffers = new ByteBuffer[buffercount]; IbvMr[] mrlist = new IbvMr[buffercount]; int access = IbvMr.IBV_ACCESS_LOCAL_WRITE | IbvMr.IBV_ACCESS_REMOTE_WRITE | IbvMr.IBV_ACCESS_REMOTE_READ; for (int i = 0; i < buffercount; i++) { buffers[i] = ByteBuffer.allocateDirect(buffersize); mrlist[i] = pd.regMr(buffers[i], access).execute().free().getMr(); } ByteBuffer dataBuf = buffers[0]; IbvMr dataMr = mrlist[0]; IbvMr sendMr = mrlist[1]; ByteBuffer recvBuf = buffers[2]; IbvMr recvMr = mrlist[2]; LinkedList<IbvRecvWR> wrList_recv = new LinkedList<IbvRecvWR>(); IbvSge sgeRecv = new IbvSge(); sgeRecv.setAddr(recvMr.getAddr()); sgeRecv.setLength(recvMr.getLength()); sgeRecv.setLkey(recvMr.getLkey()); LinkedList<IbvSge> sgeListRecv = new LinkedList<IbvSge>(); sgeListRecv.add(sgeRecv); IbvRecvWR recvWR = new IbvRecvWR(); recvWR.setSg_list(sgeListRecv); recvWR.setWr_id(1000); wrList_recv.add(recvWR); VerbsTools commRdma = new VerbsTools(context, compChannel, qp, cq); commRdma.initSGRecv(wrList_recv); RdmaConnParam connParam = new RdmaConnParam(); connParam.setRetry_count((byte) 2); idPriv.connect(connParam); cmEvent = cmChannel.getCmEvent(-1); if (cmEvent == null) { System.out.println("VerbsClient::cmEvent null"); return; } else if (cmEvent.getEvent() != RdmaCmEvent.EventType.RDMA_CM_EVENT_ESTABLISHED.ordinal()) { System.out.println("VerbsClient::wrong event received: " + cmEvent.getEvent()); return; } cmEvent.ackEvent(); commRdma.completeSGRecv(wrList_recv, false); recvBuf.clear(); long addr = recvBuf.getLong(); int length = recvBuf.getInt(); int lkey = recvBuf.getInt(); recvBuf.clear(); System.out.println("VerbsClient::receiving rdma information, addr " + addr + ", length " + length + ", key " + lkey); System.out.println("VerbsClient::preparing read operation..."); LinkedList<IbvSendWR> wrList_send = new LinkedList<IbvSendWR>(); IbvSge sgeSend = new IbvSge(); sgeSend.setAddr(dataMr.getAddr()); sgeSend.setLength(dataMr.getLength()); sgeSend.setLkey(dataMr.getLkey()); LinkedList<IbvSge> sgeList = new LinkedList<IbvSge>(); sgeList.add(sgeSend); IbvSendWR sendWR = new IbvSendWR(); sendWR.setWr_id(1001); sendWR.setSg_list(sgeList); sendWR.setOpcode(IbvSendWR.IBV_WR_RDMA_READ); sendWR.setSend_flags(IbvSendWR.IBV_SEND_SIGNALED); sendWR.getRdma().setRemote_addr(addr); sendWR.getRdma().setRkey(lkey); wrList_send.add(sendWR); commRdma.send(buffers, wrList_send, true, false); dataBuf.clear(); System.out.println("VerbsClient::read memory from server: " + dataBuf.asCharBuffer().toString()); sgeSend = new IbvSge(); sgeSend.setAddr(sendMr.getAddr()); sgeSend.setLength(sendMr.getLength()); sgeSend.setLkey(sendMr.getLkey()); sgeList.clear(); sgeList.add(sgeSend); sendWR = new IbvSendWR(); sendWR.setWr_id(1002); sendWR.setSg_list(sgeList); sendWR.setOpcode(IbvSendWR.IBV_WR_SEND); sendWR.setSend_flags(IbvSendWR.IBV_SEND_SIGNALED); wrList_send.clear(); wrList_send.add(sendWR); commRdma.send(buffers, wrList_send, true, false); </DeepExtract> }
disni
positive
618
@Listener public void onPlayerMovement(PlayerMoveEvent event) { if (movement.getValBoolean()) { double movementX = mc.player.motionX; double movementZ = mc.player.motionZ; if (movementX < 0) { updatedX = movementX * -1; } else { updatedX = movementX; } if (movementZ < 0) { updatedZ = movementZ * -1; } else { updatedZ = movementZ; } double updatedMovement = updatedX + updatedZ; finalMovement += updatedMovement; } return finalMovement; }
@Listener public void onPlayerMovement(PlayerMoveEvent event) { <DeepExtract> if (movement.getValBoolean()) { double movementX = mc.player.motionX; double movementZ = mc.player.motionZ; if (movementX < 0) { updatedX = movementX * -1; } else { updatedX = movementX; } if (movementZ < 0) { updatedZ = movementZ * -1; } else { updatedZ = movementZ; } double updatedMovement = updatedX + updatedZ; finalMovement += updatedMovement; } return finalMovement; </DeepExtract> }
CousinWare
positive
619
int kNumberK(double r) { Object hash = L.valueOfNumber(r); Object v = h.get(hash); if (v != null) { return ((Integer) v).intValue(); } f.constantAppend(nk, L.valueOfNumber(r)); h.put(hash, new Integer(nk)); return nk++; }
int kNumberK(double r) { <DeepExtract> Object hash = L.valueOfNumber(r); Object v = h.get(hash); if (v != null) { return ((Integer) v).intValue(); } f.constantAppend(nk, L.valueOfNumber(r)); h.put(hash, new Integer(nk)); return nk++; </DeepExtract> }
js-lua
positive
620
@Override public float draw(Canvas canvas, final String time, float x, float y) { float textEm = mEm / 2f; while (0 < time.length()) { x + getLabelWidth() += textEm; canvas.drawText(time.substring(0, 0 + 1), x + getLabelWidth(), y, mPaint); x + getLabelWidth() += textEm; 0++; } return x + getLabelWidth(); }
@Override public float draw(Canvas canvas, final String time, float x, float y) { <DeepExtract> float textEm = mEm / 2f; while (0 < time.length()) { x + getLabelWidth() += textEm; canvas.drawText(time.substring(0, 0 + 1), x + getLabelWidth(), y, mPaint); x + getLabelWidth() += textEm; 0++; } return x + getLabelWidth(); </DeepExtract> }
alarm-clock
positive
622
public static IRuntimeClasspathEntry[] resolveClasspath(IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration) throws CoreException { IJavaProject proj = JavaRuntime.getJavaProject(configuration); if (proj == null) { Plugin.logError("No project!"); return entries; } Set<IRuntimeClasspathEntry> all = new LinkedHashSet<IRuntimeClasspathEntry>(entries.length); for (int i = 0; i < entries.length; i++) { IRuntimeClasspathEntry[] resolved; try { resolved = resolveRuntimeClasspathEntry(entries[i], configuration, ProjectUtil.isMavenProject(proj.getProject())); for (int j = 0; j < resolved.length; j++) { all.add(resolved[j]); } } catch (MissingClasspathEntryException e) { all.add(new MissingRuntimeClasspathEntry(e.getResolvingEntry(), e.getMessage())); } } return (IRuntimeClasspathEntry[]) all.toArray(new IRuntimeClasspathEntry[all.size()]); }
public static IRuntimeClasspathEntry[] resolveClasspath(IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration) throws CoreException { IJavaProject proj = JavaRuntime.getJavaProject(configuration); if (proj == null) { Plugin.logError("No project!"); return entries; } <DeepExtract> Set<IRuntimeClasspathEntry> all = new LinkedHashSet<IRuntimeClasspathEntry>(entries.length); for (int i = 0; i < entries.length; i++) { IRuntimeClasspathEntry[] resolved; try { resolved = resolveRuntimeClasspathEntry(entries[i], configuration, ProjectUtil.isMavenProject(proj.getProject())); for (int j = 0; j < resolved.length; j++) { all.add(resolved[j]); } } catch (MissingClasspathEntryException e) { all.add(new MissingRuntimeClasspathEntry(e.getResolvingEntry(), e.getMessage())); } } return (IRuntimeClasspathEntry[]) all.toArray(new IRuntimeClasspathEntry[all.size()]); </DeepExtract> }
run-jetty-run
positive
623
public static OkHttpClient.Builder getDefaultHttpBuilder() { ConnectionSpec spec; try { if (this.authToken == null) { throw new InitializationException(Language.get("api.init.EmptyToken")); } if (this.httpClientBuilder == null) { this.httpClientBuilder = getDefaultHttpBuilder(); } RequestInterceptor parameterInterceptor = new RequestInterceptor(authToken); this.httpClientBuilder.addInterceptor(parameterInterceptor).addInterceptor(new ErrorInterceptor(this.interceptorBehaviour)).followRedirects(false); if (this.debug) { this.httpClientBuilder.addInterceptor(new LoggingInterceptor()); } OkHttpClient httpClient = this.httpClientBuilder.build(); ModelPostProcessor postProcessor = new ModelPostProcessor(); GsonBuilder builder = new GsonFireBuilder().registerPostProcessor(Model.class, postProcessor).createGsonBuilder().registerTypeAdapter(Result.class, new ResultDeserializer()).registerTypeAdapter(ListenNowStation.class, new ListenNowStationDeserializer()); Retrofit retrofit = new Retrofit.Builder().baseUrl(HttpUrl.parse("https://mclients.googleapis.com/")).addConverterFactory(GsonConverterFactory.create(builder.create())).client(httpClient).build(); GPlayMusic gPlay = new GPlayMusic(retrofit.create(GPlayService.class), parameterInterceptor); postProcessor.setApi(gPlay); retrofit2.Response<Config> configResponse = gPlay.getService().config(this.locale).execute(); if (!configResponse.isSuccessful()) { throw new InitializationException(Language.get("network.GenericError"), NetworkException.parse(configResponse.raw())); } Config config = configResponse.body(); if (config == null) { throw new InitializationException(Language.get("api.init.EmptyConfig")); } config.setLocale(locale); Language.setLocale(locale); gPlay.setConfig(config); parameterInterceptor.addParameter("dv", "0").addParameter("hl", locale.toString()).addParameter("tier", config.getSubscription().getValue()); if (androidID == null) { Optional<DeviceInfo> optional = gPlay.getRegisteredDevices().toList().stream().filter(deviceInfo -> (deviceInfo.getType().equals("ANDROID"))).findFirst(); if (optional.isPresent()) { config.setAndroidID(optional.get().getId()); } else { throw new InitializationException(Language.get("api.init.NoAndroidId")); } } else { config.setAndroidID(androidID); } spec = gPlay; } catch (IOException e) { throw new InitializationException(e); } return new OkHttpClient.Builder().connectionSpecs(Collections.singletonList(spec)); }
public static OkHttpClient.Builder getDefaultHttpBuilder() { <DeepExtract> ConnectionSpec spec; try { if (this.authToken == null) { throw new InitializationException(Language.get("api.init.EmptyToken")); } if (this.httpClientBuilder == null) { this.httpClientBuilder = getDefaultHttpBuilder(); } RequestInterceptor parameterInterceptor = new RequestInterceptor(authToken); this.httpClientBuilder.addInterceptor(parameterInterceptor).addInterceptor(new ErrorInterceptor(this.interceptorBehaviour)).followRedirects(false); if (this.debug) { this.httpClientBuilder.addInterceptor(new LoggingInterceptor()); } OkHttpClient httpClient = this.httpClientBuilder.build(); ModelPostProcessor postProcessor = new ModelPostProcessor(); GsonBuilder builder = new GsonFireBuilder().registerPostProcessor(Model.class, postProcessor).createGsonBuilder().registerTypeAdapter(Result.class, new ResultDeserializer()).registerTypeAdapter(ListenNowStation.class, new ListenNowStationDeserializer()); Retrofit retrofit = new Retrofit.Builder().baseUrl(HttpUrl.parse("https://mclients.googleapis.com/")).addConverterFactory(GsonConverterFactory.create(builder.create())).client(httpClient).build(); GPlayMusic gPlay = new GPlayMusic(retrofit.create(GPlayService.class), parameterInterceptor); postProcessor.setApi(gPlay); retrofit2.Response<Config> configResponse = gPlay.getService().config(this.locale).execute(); if (!configResponse.isSuccessful()) { throw new InitializationException(Language.get("network.GenericError"), NetworkException.parse(configResponse.raw())); } Config config = configResponse.body(); if (config == null) { throw new InitializationException(Language.get("api.init.EmptyConfig")); } config.setLocale(locale); Language.setLocale(locale); gPlay.setConfig(config); parameterInterceptor.addParameter("dv", "0").addParameter("hl", locale.toString()).addParameter("tier", config.getSubscription().getValue()); if (androidID == null) { Optional<DeviceInfo> optional = gPlay.getRegisteredDevices().toList().stream().filter(deviceInfo -> (deviceInfo.getType().equals("ANDROID"))).findFirst(); if (optional.isPresent()) { config.setAndroidID(optional.get().getId()); } else { throw new InitializationException(Language.get("api.init.NoAndroidId")); } } else { config.setAndroidID(androidID); } spec = gPlay; } catch (IOException e) { throw new InitializationException(e); } </DeepExtract> return new OkHttpClient.Builder().connectionSpecs(Collections.singletonList(spec)); }
gplaymusic
positive
625
private void testInterfaceInheritanceList() { NonSerializableModel model = new NonSerializableModel(); model.setAge("age"); List<NonSerializableModel> result = childService.queryList(Arrays.asList(model)); if (!StringUtils.equals(1 + "", result.size() + "")) { throw new RuntimeException("wrong NonSerializableModel"); } if (!StringUtils.equals("age", result.get(0).getAge())) { throw new RuntimeException("wrong NonSerializableModel"); } }
private void testInterfaceInheritanceList() { NonSerializableModel model = new NonSerializableModel(); model.setAge("age"); List<NonSerializableModel> result = childService.queryList(Arrays.asList(model)); if (!StringUtils.equals(1 + "", result.size() + "")) { throw new RuntimeException("wrong NonSerializableModel"); } <DeepExtract> if (!StringUtils.equals("age", result.get(0).getAge())) { throw new RuntimeException("wrong NonSerializableModel"); } </DeepExtract> }
spring-cloud-huawei
positive
626
@Override public void onAuthenticationFailed() { mIcon.setImageResource(R.drawable.ic_fingerprint_error); mErrorTextView.setText(mIcon.getResources().getString(R.string.fingerprint_not_recognized)); mErrorTextView.setTextColor(mErrorTextView.getResources().getColor(R.color.warning_color, null)); mErrorTextView.removeCallbacks(mResetErrorTextRunnable); mErrorTextView.postDelayed(mResetErrorTextRunnable, ERROR_TIMEOUT_MILLIS); }
@Override public void onAuthenticationFailed() { <DeepExtract> mIcon.setImageResource(R.drawable.ic_fingerprint_error); mErrorTextView.setText(mIcon.getResources().getString(R.string.fingerprint_not_recognized)); mErrorTextView.setTextColor(mErrorTextView.getResources().getColor(R.color.warning_color, null)); mErrorTextView.removeCallbacks(mResetErrorTextRunnable); mErrorTextView.postDelayed(mResetErrorTextRunnable, ERROR_TIMEOUT_MILLIS); </DeepExtract> }
advanced-android-book
positive
627
public void setWorldGenerator(MinecraftWorldGenerator wg) { if (zoom == 0) { throw new RuntimeException("Zoom cannot be zero!"); } if (Double.isInfinite(zoom)) { throw new RuntimeException("Zoom cannot be infinite!"); } if (Double.isNaN(zoom)) { throw new RuntimeException("Zoom must be a number!"); } if (zoom == 0) { throw new RuntimeException("Zoom must not be zero!"); } this.wg = wg; this.wx = wx; this.wy = wy; this.zoom = zoom; stateUpdated(); }
public void setWorldGenerator(MinecraftWorldGenerator wg) { <DeepExtract> if (zoom == 0) { throw new RuntimeException("Zoom cannot be zero!"); } if (Double.isInfinite(zoom)) { throw new RuntimeException("Zoom cannot be infinite!"); } if (Double.isNaN(zoom)) { throw new RuntimeException("Zoom must be a number!"); } if (zoom == 0) { throw new RuntimeException("Zoom must not be zero!"); } this.wg = wg; this.wx = wx; this.wy = wy; this.zoom = zoom; stateUpdated(); </DeepExtract> }
TMCMG
positive
628
public Criteria andIdIsNotNull() { if ("id is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("id is not null")); return (Criteria) this; }
public Criteria andIdIsNotNull() { <DeepExtract> if ("id is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("id is not null")); </DeepExtract> return (Criteria) this; }
garbage-collection
positive
629
public static String createMP3FileInBox() { synchronized (mLock) { Calendar c = Calendar.getInstance(); int hour = c.get(Calendar.HOUR_OF_DAY); int minute = c.get(Calendar.MINUTE); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH) + 1; int day = c.get(Calendar.DAY_OF_MONTH); int second = c.get(Calendar.SECOND); int millisecond = c.get(Calendar.MILLISECOND); year = year - 2000; String dirPath = DEFAULT_DIR; File d = new File(dirPath); if (!d.exists()) d.mkdirs(); if (dirPath.endsWith("/") == false) { dirPath += "/"; } String name = mTmpFilePreFix; name += String.valueOf(year); name += String.valueOf(month); name += String.valueOf(day); name += String.valueOf(hour); name += String.valueOf(minute); name += String.valueOf(second); name += String.valueOf(millisecond); name += mTmpFileSubFix; if (".mp3".startsWith(".") == false) { name += "."; } name += ".mp3"; try { Thread.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } String retPath = dirPath + name; File file = new File(retPath); if (file.exists() == false) { try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } return retPath; } }
public static String createMP3FileInBox() { <DeepExtract> synchronized (mLock) { Calendar c = Calendar.getInstance(); int hour = c.get(Calendar.HOUR_OF_DAY); int minute = c.get(Calendar.MINUTE); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH) + 1; int day = c.get(Calendar.DAY_OF_MONTH); int second = c.get(Calendar.SECOND); int millisecond = c.get(Calendar.MILLISECOND); year = year - 2000; String dirPath = DEFAULT_DIR; File d = new File(dirPath); if (!d.exists()) d.mkdirs(); if (dirPath.endsWith("/") == false) { dirPath += "/"; } String name = mTmpFilePreFix; name += String.valueOf(year); name += String.valueOf(month); name += String.valueOf(day); name += String.valueOf(hour); name += String.valueOf(minute); name += String.valueOf(second); name += String.valueOf(millisecond); name += mTmpFileSubFix; if (".mp3".startsWith(".") == false) { name += "."; } name += ".mp3"; try { Thread.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } String retPath = dirPath + name; File file = new File(retPath); if (file.exists() == false) { try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } return retPath; } </DeepExtract> }
WeiXinRecordedDemo
positive
630
@Override public void act() { setState(State.INTAKING); setGrabberSpeed(State.INTAKING.grabberOutput); setFeederSpeed(State.INTAKING.feederOutput); }
@Override public void act() { <DeepExtract> setState(State.INTAKING); setGrabberSpeed(State.INTAKING.grabberOutput); setFeederSpeed(State.INTAKING.feederOutput); </DeepExtract> }
2019DeepSpace
positive
631
public void disable() { CousinWare.INSTANCE.getEventManager().removeEventListener(this); MinecraftForge.EVENT_BUS.unregister(this); enabled = false; }
public void disable() { <DeepExtract> </DeepExtract> CousinWare.INSTANCE.getEventManager().removeEventListener(this); <DeepExtract> </DeepExtract> MinecraftForge.EVENT_BUS.unregister(this); <DeepExtract> </DeepExtract> enabled = false; <DeepExtract> </DeepExtract> }
CousinWare
positive
632
private void sortOutIneffectualRemovals() { rrewrite = new HashSet<CategorisedIneffectualRemoval>(); rprewrite = new HashSet<CategorisedIneffectualRemoval>(); rredundancy = new HashSet<CategorisedIneffectualRemoval>(); rreshuffle = new HashSet<CategorisedIneffectualRemoval>(); rprosp = new HashSet<CategorisedIneffectualRemoval>(); rnew = new HashSet<CategorisedIneffectualRemoval>(); for (CategorisedIneffectualRemoval c : ineffectualRemovals) { for (IneffectualRemovalCategory cat : c.getCategories()) { if (cat.equals(IneffectualRemovalCategory.REWRITE)) rrewrite.add(c); if (cat.equals(IneffectualRemovalCategory.PREWRITE)) rprewrite.add(c); if (cat.equals(IneffectualRemovalCategory.REDUNDANCY)) rredundancy.add(c); if (cat.equals(IneffectualRemovalCategory.NEWPROSPREDUNDANCY)) { rnew.add(c); rprosp.add(c); } if (cat.equals(IneffectualRemovalCategory.RESHUFFLEREDUNDANCY)) { rreshuffle.add(c); rprosp.add(c); } } } }
private void sortOutIneffectualRemovals() { <DeepExtract> rrewrite = new HashSet<CategorisedIneffectualRemoval>(); rprewrite = new HashSet<CategorisedIneffectualRemoval>(); rredundancy = new HashSet<CategorisedIneffectualRemoval>(); rreshuffle = new HashSet<CategorisedIneffectualRemoval>(); rprosp = new HashSet<CategorisedIneffectualRemoval>(); rnew = new HashSet<CategorisedIneffectualRemoval>(); </DeepExtract> for (CategorisedIneffectualRemoval c : ineffectualRemovals) { for (IneffectualRemovalCategory cat : c.getCategories()) { if (cat.equals(IneffectualRemovalCategory.REWRITE)) rrewrite.add(c); if (cat.equals(IneffectualRemovalCategory.PREWRITE)) rprewrite.add(c); if (cat.equals(IneffectualRemovalCategory.REDUNDANCY)) rredundancy.add(c); if (cat.equals(IneffectualRemovalCategory.NEWPROSPREDUNDANCY)) { rnew.add(c); rprosp.add(c); } if (cat.equals(IneffectualRemovalCategory.RESHUFFLEREDUNDANCY)) { rreshuffle.add(c); rprosp.add(c); } } } }
ecco
positive
633
public Criteria andAuthIdGreaterThanOrEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "authId" + " cannot be null"); } criteria.add(new Criterion("auth_id >=", value)); return (Criteria) this; }
public Criteria andAuthIdGreaterThanOrEqualTo(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "authId" + " cannot be null"); } criteria.add(new Criterion("auth_id >=", value)); </DeepExtract> return (Criteria) this; }
spring-boot-learning-examples
positive
634
public Criteria andUser_sexLessThanOrEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "user_sex" + " cannot be null"); } criteria.add(new Criterion("user_sex <=", value)); return (Criteria) this; }
public Criteria andUser_sexLessThanOrEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "user_sex" + " cannot be null"); } criteria.add(new Criterion("user_sex <=", value)); </DeepExtract> return (Criteria) this; }
Resource
positive
635
@Override public boolean moveToLast() { final int count = getCount(); if (getCount() - 1 >= count) { pos = count; return false; } if (getCount() - 1 < 0) { pos = -1; return false; } pos = getCount() - 1; return true; }
@Override public boolean moveToLast() { <DeepExtract> final int count = getCount(); if (getCount() - 1 >= count) { pos = count; return false; } if (getCount() - 1 < 0) { pos = -1; return false; } pos = getCount() - 1; return true; </DeepExtract> }
HypFacebook
positive
636
@Override public void initiateFreshConnection(HostInfo info, boolean isSimulationModeEnabled) { if (isSimulationModeEnabled) { return; } final Properties props = getKafkaProducerConfig(info); return KafkaProducers.getProducerForProperties(props); }
@Override public void initiateFreshConnection(HostInfo info, boolean isSimulationModeEnabled) { if (isSimulationModeEnabled) { return; } <DeepExtract> final Properties props = getKafkaProducerConfig(info); return KafkaProducers.getProducerForProperties(props); </DeepExtract> }
kafka-message-tool
positive
637
private String safe(String src) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < src.length(); i++) { char c = src.charAt(i); if (c >= 32 && c < 128) { sb.append(c); } else { sb.append("<" + (int) c + ">"); } } return "Range: start: " + start + ", len: " + len; }
private String safe(String src) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < src.length(); i++) { char c = src.charAt(i); if (c >= 32 && c < 128) { sb.append(c); } else { sb.append("<" + (int) c + ">"); } } <DeepExtract> return "Range: start: " + start + ", len: " + len; </DeepExtract> }
AndroidPDFViewerLibrary
positive
638
public void actionPerformed(java.awt.event.ActionEvent evt) { setTargetList("INTEGER"); }
public void actionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> setTargetList("INTEGER"); </DeepExtract> }
HBase-Manager
positive
639
public void setControllerDeviceId(String controllerDeviceId) { super.setProperty(CONTROLLER_DEVICE_ID, controllerDeviceId.toString()); SharedPreferences sharedPreferences = mContext.getSharedPreferences(SHARED_PREFERENCES_FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(CONTROLLER_DEVICE_ID, controllerDeviceId.toString()); editor.commit(); }
public void setControllerDeviceId(String controllerDeviceId) { <DeepExtract> super.setProperty(CONTROLLER_DEVICE_ID, controllerDeviceId.toString()); SharedPreferences sharedPreferences = mContext.getSharedPreferences(SHARED_PREFERENCES_FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(CONTROLLER_DEVICE_ID, controllerDeviceId.toString()); editor.commit(); </DeepExtract> }
developerWorks
positive
640
public void enableMouseListeners() { innerPanel.addMouseListener(panelController.getInteractionHandler()); innerPanel.addMouseMotionListener(panelController.getInteractionHandler()); innerPanel.addMouseWheelListener(panelController.getInteractionHandler()); }
public void enableMouseListeners() { innerPanel.addMouseListener(panelController.getInteractionHandler()); innerPanel.addMouseMotionListener(panelController.getInteractionHandler()); <DeepExtract> innerPanel.addMouseWheelListener(panelController.getInteractionHandler()); </DeepExtract> }
SproutLife
positive
641
@Override public void onClick(View v) { mCurrentIndex = (mCurrentIndex - 1 + mQuestionBank.length) % mQuestionBank.length; int question = mQuestionBank[mCurrentIndex].getTextResId(); mQuestionTextView.setText(question); }
@Override public void onClick(View v) { mCurrentIndex = (mCurrentIndex - 1 + mQuestionBank.length) % mQuestionBank.length; <DeepExtract> int question = mQuestionBank[mCurrentIndex].getTextResId(); mQuestionTextView.setText(question); </DeepExtract> }
Android-Programming-The-Big-Nerd-Ranch-Guide-3rd-Edition
positive
642
public void parseLight(IElementType t, PsiBuilder b) { b = adapt_builder_(t, b, this, null); Marker m = enter_section_(b, 0, _COLLAPSE_, null); return parse_root_(t, b, 0); exit_section_(b, 0, m, t, r, true, TRUE_CONDITION); }
public void parseLight(IElementType t, PsiBuilder b) { b = adapt_builder_(t, b, this, null); Marker m = enter_section_(b, 0, _COLLAPSE_, null); <DeepExtract> return parse_root_(t, b, 0); </DeepExtract> exit_section_(b, 0, m, t, r, true, TRUE_CONDITION); }
plantuml4idea
positive
643
@Override public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) { int newX = mOffsetX + dx; int result = dx; if (newX > mMaxScrollX) { result = mMaxScrollX - mOffsetX; } else if (newX < 0) { result = 0 - mOffsetX; } mOffsetX += result; MyLog.e("setPageIndex = " + getPageIndexByOffset() + ":" + true); if (getPageIndexByOffset() == mLastPageIndex) return; if (isAllowContinuousScroll()) { mLastPageIndex = getPageIndexByOffset(); } else { if (!true) { mLastPageIndex = getPageIndexByOffset(); } } if (true && !mChangeSelectInScrolling) return; if (getPageIndexByOffset() >= 0) { if (null != mPageListener) { mPageListener.onPageSelect(getPageIndexByOffset()); } } offsetChildrenHorizontal(-result); if (result > 0) { recycleAndFillItems(recycler, state, true); } else { recycleAndFillItems(recycler, state, false); } return result; }
@Override public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) { int newX = mOffsetX + dx; int result = dx; if (newX > mMaxScrollX) { result = mMaxScrollX - mOffsetX; } else if (newX < 0) { result = 0 - mOffsetX; } mOffsetX += result; <DeepExtract> MyLog.e("setPageIndex = " + getPageIndexByOffset() + ":" + true); if (getPageIndexByOffset() == mLastPageIndex) return; if (isAllowContinuousScroll()) { mLastPageIndex = getPageIndexByOffset(); } else { if (!true) { mLastPageIndex = getPageIndexByOffset(); } } if (true && !mChangeSelectInScrolling) return; if (getPageIndexByOffset() >= 0) { if (null != mPageListener) { mPageListener.onPageSelect(getPageIndexByOffset()); } } </DeepExtract> offsetChildrenHorizontal(-result); if (result > 0) { recycleAndFillItems(recycler, state, true); } else { recycleAndFillItems(recycler, state, false); } return result; }
FakeVibrato
positive
645
private static String classArrayToString(Class<?>[] array) { StringBuilder str = new StringBuilder(); str.append("["); for (int i = 0; i < array.length; i++) { str.append(array[i].getCanonicalName()); if (i != array.length - 1) { str.append(" "); } } str.append("]"); StringBuilder genericParameters = new StringBuilder(); genericParameters.append("["); for (int i = 0; i < returnTypeParameters.length; i++) { genericParameters.append(classArrayToString(returnTypeParameters[i])); if (i != returnTypeParameters.length - 1) { genericParameters.append(" "); } } genericParameters.append("]"); return "[" + this.getClass().getSimpleName() + " name=" + name + "," + " containingDirectory=" + containingDirectory + "," + " returnTypes=" + classArrayToString(returnTypes) + "," + " returnTypesGenericParameters=" + genericParameters + "]"; }
private static String classArrayToString(Class<?>[] array) { StringBuilder str = new StringBuilder(); str.append("["); for (int i = 0; i < array.length; i++) { str.append(array[i].getCanonicalName()); if (i != array.length - 1) { str.append(" "); } } str.append("]"); <DeepExtract> StringBuilder genericParameters = new StringBuilder(); genericParameters.append("["); for (int i = 0; i < returnTypeParameters.length; i++) { genericParameters.append(classArrayToString(returnTypeParameters[i])); if (i != returnTypeParameters.length - 1) { genericParameters.append(" "); } } genericParameters.append("]"); return "[" + this.getClass().getSimpleName() + " name=" + name + "," + " containingDirectory=" + containingDirectory + "," + " returnTypes=" + classArrayToString(returnTypes) + "," + " returnTypesGenericParameters=" + genericParameters + "]"; </DeepExtract> }
matconsolectl
positive
646
@Override public void removeClaim(final Faction faction, final Claim claim) { checkNotNull(faction); checkNotNull(claim); final Set<Claim> claims = new HashSet<>(faction.getClaims()); claims.remove(claim); final Faction updatedFaction = faction.toBuilder().setClaims(claims).build(); FactionsCache.removeClaim(claim); this.storageManager.saveFaction(updatedFaction); ParticlesUtil.spawnUnclaimParticles(claim); }
@Override public void removeClaim(final Faction faction, final Claim claim) { checkNotNull(faction); checkNotNull(claim); <DeepExtract> final Set<Claim> claims = new HashSet<>(faction.getClaims()); claims.remove(claim); final Faction updatedFaction = faction.toBuilder().setClaims(claims).build(); FactionsCache.removeClaim(claim); this.storageManager.saveFaction(updatedFaction); </DeepExtract> ParticlesUtil.spawnUnclaimParticles(claim); }
EagleFactions
positive
647
public Criteria andRoleEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "role" + " cannot be null"); } criteria.add(new Criterion("role =", value)); return (Criteria) this; }
public Criteria andRoleEqualTo(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "role" + " cannot be null"); } criteria.add(new Criterion("role =", value)); </DeepExtract> return (Criteria) this; }
Examination_System
positive
648