before
stringlengths
12
3.76M
after
stringlengths
37
3.84M
repo
stringlengths
1
56
type
stringclasses
1 value
void initCustomViewAbove() { setDescendantFocusability(FOCUS_BEFORE_DESCENDANTS); setClickable(true); setFocusable(true); setWillNotDraw(false); final Context context = getContext(); mScroller = new Scroller(context, sInterpolator); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); OnPageChangeListener oldListener = mInternalPageChangeListener; mInternalPageChangeListener = new SimpleOnPageChangeListener() { public void onPageSelected(int position) { if (mViewBehind != null) { switch(position) { case 0: case 2: mViewBehind.setChildrenEnabled(true); break; case 1: mViewBehind.setChildrenEnabled(false); break; } } } }; return oldListener; final float density = context.getResources().getDisplayMetrics().density; mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density); }
<DeepExtract> OnPageChangeListener oldListener = mInternalPageChangeListener; mInternalPageChangeListener = new SimpleOnPageChangeListener() { public void onPageSelected(int position) { if (mViewBehind != null) { switch(position) { case 0: case 2: mViewBehind.setChildrenEnabled(true); break; case 1: mViewBehind.setChildrenEnabled(false); break; } } } }; return oldListener; </DeepExtract>
android-app
positive
@Override protected void handleDefaultAction(Intent intent, int flags, int startId) { if (mPrefs.getLong(StopwatchFragment.KEY_START_TIME, 0) == 0) { mCurrentLap = new Lap(); mUpdateHandler.asyncInsert(mCurrentLap); } clearActions(getNoteId()); addAction(ACTION_ADD_LAP, R.drawable.ic_add_lap_24dp, getString(R.string.lap), getNoteId()); addStartPauseAction(true, getNoteId()); addStopAction(getNoteId()); quitCurrentThread(getNoteId()); if (true) { long startTime = mPrefs.getLong(StopwatchFragment.KEY_START_TIME, SystemClock.elapsedRealtime()); startNewThread(getNoteId(), startTime); } }
<DeepExtract> clearActions(getNoteId()); addAction(ACTION_ADD_LAP, R.drawable.ic_add_lap_24dp, getString(R.string.lap), getNoteId()); addStartPauseAction(true, getNoteId()); addStopAction(getNoteId()); quitCurrentThread(getNoteId()); if (true) { long startTime = mPrefs.getLong(StopwatchFragment.KEY_START_TIME, SystemClock.elapsedRealtime()); startNewThread(getNoteId(), startTime); } </DeepExtract>
ClockPlus
positive
private int choosePivot(int[][] points, int l, int r) { int pivot = (int) (Math.random() * (r - l + 1)) + l; int[] temp = points[r]; points[r] = points[pivot]; points[pivot] = temp; int i = l; for (int j = l; j < r; j++) { if (compare(points[j], points[r]) < 0) { swap(points, i, j); i++; } } int[] temp = points[i]; points[i] = points[r]; points[r] = temp; return i; }
<DeepExtract> int[] temp = points[r]; points[r] = points[pivot]; points[pivot] = temp; </DeepExtract> <DeepExtract> int[] temp = points[i]; points[i] = points[r]; points[r] = temp; </DeepExtract>
computer-science
positive
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (!placedBall) { placeBall(); } Paint paint = new Paint(); if (value == min) { if (bitmap == null) { bitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888); } Canvas temp = new Canvas(bitmap); paint.setColor(Color.parseColor("#B0B0B0")); paint.setStrokeWidth(Utils.dpToPx(2, getResources())); temp.drawLine(getHeight() / 2, getHeight() / 2, getWidth() - getHeight() / 2, getHeight() / 2, paint); Paint transparentPaint = new Paint(); transparentPaint.setColor(getResources().getColor(android.R.color.transparent)); transparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); temp.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2, ViewHelper.getY(ball) + ball.getHeight() / 2, ball.getWidth() / 2, transparentPaint); } else { paint.setColor(Color.parseColor("#B0B0B0")); paint.setStrokeWidth(Utils.dpToPx(2, getResources())); canvas.drawLine(getHeight() / 2, getHeight() / 2, getWidth() - getHeight() / 2, getHeight() / 2, paint); paint.setColor(backgroundColor); float division = (ball.xFin - ball.xIni) / (max - min); int value = this.value - min; canvas.drawLine(getHeight() / 2, getHeight() / 2, value * division + getHeight() / 2, getHeight() / 2, paint); } if (press && !showNumberIndicator) { paint.setColor(backgroundColor); paint.setAntiAlias(true); canvas.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2, getHeight() / 2, getHeight() / 3, paint); } ball.invalidate(); super.invalidate(); }
<DeepExtract> ball.invalidate(); super.invalidate(); </DeepExtract>
meiShi
positive
@Override public void handleFailure(String message) { iconLoading.setVisibility(View.GONE); iconEmpty.setVisibility(View.VISIBLE); tvLoadFailed.setText(message); }
<DeepExtract> iconLoading.setVisibility(View.GONE); iconEmpty.setVisibility(View.VISIBLE); tvLoadFailed.setText(message); </DeepExtract>
LNTUOnline-Android
positive
@Deprecated public void setClientSecret(String clientSecret) { properties.setProperty("clientSecret", clientSecret); }
<DeepExtract> properties.setProperty("clientSecret", clientSecret); </DeepExtract>
FuelSDK-Java
positive
public void onResume() { activity.registerReceiver(powerStatusReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); cancel(); inactivityTask = new InactivityAsyncTask(); taskExec.execute(inactivityTask); }
<DeepExtract> cancel(); inactivityTask = new InactivityAsyncTask(); taskExec.execute(inactivityTask); </DeepExtract>
PeerDeviceNet_Src
positive
public void btnMapClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("geo:24.915982,67.092849")); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } }
<DeepExtract> Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("geo:24.915982,67.092849")); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } </DeepExtract>
ssuet-android-adv-mar17
positive
@Override public T top() { if (size == 0) { throw new EmptyStackException(); } return (T) elements[size - 1]; }
<DeepExtract> if (size == 0) { throw new EmptyStackException(); } return (T) elements[size - 1]; </DeepExtract>
spork
positive
@Override public void showLoading() { if (mProgressDialog != null && mProgressDialog.isShowing()) { mProgressDialog.cancel(); } mProgressDialog = CommonUtils.showLoadingDialog(this.getContext()); }
<DeepExtract> if (mProgressDialog != null && mProgressDialog.isShowing()) { mProgressDialog.cancel(); } </DeepExtract>
android-mvp-interactor-architecture
positive
public void alignToByte() throws IOException { bitBuffer = (bitBuffer << (64 - bitBufferLen) % 8) | (0 & ((1L << (64 - bitBufferLen) % 8) - 1)); bitBufferLen += (64 - bitBufferLen) % 8; while (bitBufferLen >= 8) { bitBufferLen -= 8; int b = (int) (bitBuffer >>> bitBufferLen) & 0xFF; out.write(b); crc8 ^= b; crc16 ^= b << 8; for (int i = 0; i < 8; i++) { crc8 = (crc8 << 1) ^ ((crc8 >>> 7) * 0x107); crc16 = (crc16 << 1) ^ ((crc16 >>> 15) * 0x18005); } } }
<DeepExtract> bitBuffer = (bitBuffer << (64 - bitBufferLen) % 8) | (0 & ((1L << (64 - bitBufferLen) % 8) - 1)); bitBufferLen += (64 - bitBufferLen) % 8; while (bitBufferLen >= 8) { bitBufferLen -= 8; int b = (int) (bitBuffer >>> bitBufferLen) & 0xFF; out.write(b); crc8 ^= b; crc16 ^= b << 8; for (int i = 0; i < 8; i++) { crc8 = (crc8 << 1) ^ ((crc8 >>> 7) * 0x107); crc16 = (crc16 << 1) ^ ((crc16 >>> 15) * 0x18005); } } </DeepExtract>
Nayuki-web-published-code
positive
public void visitTypedef(@NotNull ThriftTypedef o) { visitPsiCompositeElement(o); }
<DeepExtract> visitPsiCompositeElement(o); </DeepExtract>
intellij-thrift
positive
@Override public void onChanged() { super.onChanged(); int w = this.getWidth(); int h = this.getHeight(); if (this.mBitmapRes > -1) { Drawable drawable = this.getResources().getDrawable(this.mBitmapRes); if (drawable instanceof BitmapDrawable) { this.mBitmap = ((BitmapDrawable) drawable).getBitmap(); } else { this.mBitmap = Bitmap.createBitmap(w, h, Config.ARGB_8888); Canvas canvas = new Canvas(this.mBitmap); drawable.setBounds(this.getLeft(), this.getTop(), this.getRight(), this.getBottom()); drawable.draw(canvas); } } if (this.mBitmap != null && w != 0 && h != 0) { float count = 1.0F; if (this.getAdapter() != null && this.getAdapter().getCount() > 0) { count = (float) this.getAdapter().getCount(); } int imgWidth = this.mBitmap.getWidth(); int imgHeight = this.mBitmap.getHeight(); float ratio = (float) imgWidth / (float) imgHeight; float width = (float) h * ratio; float height = (float) h; this.mBackgroundOriginalRect = new Rect(0, 0, imgWidth, imgHeight); this.mBackgroundNewRect = new RectF(0.0F, 0.0F, width, height); Rect sizeRect = new Rect(0, 0, w * (int) ratio, h); this.fraction = (float) sizeRect.width() / ((float) w * count); } ZBackgroundViewPager.this.invalidate(); ZBackgroundViewPager.this.requestLayout(); }
<DeepExtract> int w = this.getWidth(); int h = this.getHeight(); if (this.mBitmapRes > -1) { Drawable drawable = this.getResources().getDrawable(this.mBitmapRes); if (drawable instanceof BitmapDrawable) { this.mBitmap = ((BitmapDrawable) drawable).getBitmap(); } else { this.mBitmap = Bitmap.createBitmap(w, h, Config.ARGB_8888); Canvas canvas = new Canvas(this.mBitmap); drawable.setBounds(this.getLeft(), this.getTop(), this.getRight(), this.getBottom()); drawable.draw(canvas); } } if (this.mBitmap != null && w != 0 && h != 0) { float count = 1.0F; if (this.getAdapter() != null && this.getAdapter().getCount() > 0) { count = (float) this.getAdapter().getCount(); } int imgWidth = this.mBitmap.getWidth(); int imgHeight = this.mBitmap.getHeight(); float ratio = (float) imgWidth / (float) imgHeight; float width = (float) h * ratio; float height = (float) h; this.mBackgroundOriginalRect = new Rect(0, 0, imgWidth, imgHeight); this.mBackgroundNewRect = new RectF(0.0F, 0.0F, width, height); Rect sizeRect = new Rect(0, 0, w * (int) ratio, h); this.fraction = (float) sizeRect.width() / ((float) w * count); } </DeepExtract>
ZUILib
positive
public HttpRequest acceptCharset(final String acceptCharset) { getConnection().setRequestProperty(HEADER_ACCEPT_CHARSET, acceptCharset); return this; }
<DeepExtract> getConnection().setRequestProperty(HEADER_ACCEPT_CHARSET, acceptCharset); return this; </DeepExtract>
nanoleaf-aurora
positive
@Test public void shouldParseConfigWithFilenameRegexAndListOfExceptionTypes() { initAppContext("/TestFilenameBasedFilterParser-regexAndListOfExceptions.xml"); assertNumberOfBeansWithType(ExceptionFilter.class, 2); List<FilenameBasedExceptionFilter> filters = getAllMatchingBeans(FilenameBasedExceptionFilter.class); FilenameBasedExceptionFilter expectedFilter = new FilenameBasedExceptionFilter("regex-and-list-of-exceptions-.*\\.jar", SuspiciousFileException.class); for (FilenameBasedExceptionFilter filter : filters) { if (filter.equals(expectedFilter)) { return; } } fail("Filter with filename regex='" + "regex-and-list-of-exceptions-.*\\.jar" + "' and exception type='" + SuspiciousFileException.class.getCanonicalName() + "' not found!"); FilenameBasedExceptionFilter expectedFilter = new FilenameBasedExceptionFilter("regex-and-list-of-exceptions-.*\\.jar", TestingException.class); for (FilenameBasedExceptionFilter filter : filters) { if (filter.equals(expectedFilter)) { return; } } fail("Filter with filename regex='" + "regex-and-list-of-exceptions-.*\\.jar" + "' and exception type='" + TestingException.class.getCanonicalName() + "' not found!"); }
<DeepExtract> FilenameBasedExceptionFilter expectedFilter = new FilenameBasedExceptionFilter("regex-and-list-of-exceptions-.*\\.jar", SuspiciousFileException.class); for (FilenameBasedExceptionFilter filter : filters) { if (filter.equals(expectedFilter)) { return; } } fail("Filter with filename regex='" + "regex-and-list-of-exceptions-.*\\.jar" + "' and exception type='" + SuspiciousFileException.class.getCanonicalName() + "' not found!"); </DeepExtract> <DeepExtract> FilenameBasedExceptionFilter expectedFilter = new FilenameBasedExceptionFilter("regex-and-list-of-exceptions-.*\\.jar", TestingException.class); for (FilenameBasedExceptionFilter filter : filters) { if (filter.equals(expectedFilter)) { return; } } fail("Filter with filename regex='" + "regex-and-list-of-exceptions-.*\\.jar" + "' and exception type='" + TestingException.class.getCanonicalName() + "' not found!"); </DeepExtract>
redhat-repository-validator
positive
public void add(E value) { if (modCount != expectedModCount) throw new ConcurrentModificationException(); if (next == 0) { LinkedList2.this.add(value); expectedModCount++; return; } lock.writeLock().lock(); try { Entry<E> e = new Entry<E>(prev, next, value); long recid = db.insert(e, entrySerializer, false); if (prev != 0) { Entry<E> p = db.fetch(prev, entrySerializer); if (p.next != next) throw new Error(); p.next = recid; db.update(prev, p, entrySerializer); } Entry<E> n = fetch(next); if (n.prev != prev) throw new Error(); n.prev = recid; db.update(next, n, entrySerializer); Root r = getRoot(); r.size++; db.update(rootRecid, r, ROOT_SERIALIZER); expectedModCount++; modCount++; prev = recid; } catch (IOException e) { throw new IOError(e); } finally { lock.writeLock().unlock(); } }
<DeepExtract> if (modCount != expectedModCount) throw new ConcurrentModificationException(); </DeepExtract>
JDBM3
positive
@Test public void hget() throws Exception { String key = keyPrefix + "_HGET"; conn.createStatement().execute("HSET " + key + " field1 \"foo\""); assertEquals("foo", executeSingleStringResult("HGET " + key + " field1")); assertNull(executeSingleStringResult("HGET " + key + " field2")); execute("DEL " + key); }
<DeepExtract> conn.createStatement().execute("HSET " + key + " field1 \"foo\""); </DeepExtract> <DeepExtract> execute("DEL " + key); </DeepExtract>
jdbc-redis
positive
private void run(String[] args) throws DatabaseException { for (int i = 0; i < args.length; ++i) { if (args[i].startsWith("-")) { switch(args[i].charAt(1)) { case 'h': myDbEnvPath = new File(args[++i]); break; case 's': locateItem = args[++i]; break; default: usage(); } } } myDbEnv.setup(myDbEnvPath, true); da = new DataAccessor(myDbEnv.getEntityStore()); if (locateItem != null) { showItem(); } else { showAllInventory(); } }
<DeepExtract> for (int i = 0; i < args.length; ++i) { if (args[i].startsWith("-")) { switch(args[i].charAt(1)) { case 'h': myDbEnvPath = new File(args[++i]); break; case 's': locateItem = args[++i]; break; default: usage(); } } } </DeepExtract>
berkeley-db
positive
private int getParity() { int x, counter = 0; return Integer.parseInt(dataValue, 16); String s = Integer.toBinaryString(x); char[] c = s.toCharArray(); for (int i = 0; i < s.length(); i++) { if (c[i] == '1') { counter++; } } if (counter % 2 == 0) { return 1; } else { return 0; } }
<DeepExtract> return Integer.parseInt(dataValue, 16); </DeepExtract>
8085
positive
public static String md5(String string) { byte[] hash = null; try { hash = string.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Huh,UTF-8 should be supported?", e); } try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(hash, 0, hash.length); byte[] md5bytes = md.digest(); StringBuffer hexString = new StringBuffer(); for (int i = 0; i < md5bytes.length; i++) { String hex = Integer.toHexString(0xff & md5bytes[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } return hexString.toString(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } }
<DeepExtract> try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(hash, 0, hash.length); byte[] md5bytes = md.digest(); StringBuffer hexString = new StringBuffer(); for (int i = 0; i < md5bytes.length; i++) { String hex = Integer.toHexString(0xff & md5bytes[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } return hexString.toString(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } </DeepExtract>
LoveTalkClient
positive
public void addNumber(int num) { if (this.maxHeap.isEmpty()) { this.maxHeap.add(num); return; } if (this.maxHeap.peek() >= num) { this.maxHeap.add(num); } else { if (this.minHeap.isEmpty()) { this.minHeap.add(num); return; } if (this.minHeap.peek() > num) { this.maxHeap.add(num); } else { this.minHeap.add(num); } } if (this.maxHeap.size() == this.minHeap.size() + 2) { this.minHeap.add(this.maxHeap.poll()); } if (this.minHeap.size() == this.maxHeap.size() + 2) { this.maxHeap.add(this.minHeap.poll()); } }
<DeepExtract> if (this.maxHeap.size() == this.minHeap.size() + 2) { this.minHeap.add(this.maxHeap.poll()); } if (this.minHeap.size() == this.maxHeap.size() + 2) { this.maxHeap.add(this.minHeap.poll()); } </DeepExtract>
nowcoder-zuo
positive
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_calibration_check_in); button = (Button) findViewById(R.id.check_in_calibrations); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (Sensor.isActive()) { SyncingService.startActionCalibrationCheckin(getApplicationContext()); Toast.makeText(getApplicationContext(), "Checked in all calibrations", Toast.LENGTH_LONG).show(); Intent tableIntent = new Intent(v.getContext(), Home.class); startActivity(tableIntent); finish(); } else { Log.w("CANNOT CALIBRATE WITHOUT CURRENT SENSOR", "ERROR"); } } }); }
<DeepExtract> button = (Button) findViewById(R.id.check_in_calibrations); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (Sensor.isActive()) { SyncingService.startActionCalibrationCheckin(getApplicationContext()); Toast.makeText(getApplicationContext(), "Checked in all calibrations", Toast.LENGTH_LONG).show(); Intent tableIntent = new Intent(v.getContext(), Home.class); startActivity(tableIntent); finish(); } else { Log.w("CANNOT CALIBRATE WITHOUT CURRENT SENSOR", "ERROR"); } } }); </DeepExtract>
xDrip
positive
public HPacket appendUShort(int ushort) { isEdited = true; packetInBytes = Arrays.copyOf(packetInBytes, packetInBytes.length + 2); ByteBuffer byteBuffer = ByteBuffer.allocate(4).putInt(ushort); for (int j = 2; j < 4; j++) { packetInBytes[packetInBytes.length - 4 + j] = byteBuffer.array()[j]; } boolean remember = isEdited; replaceInt(0, packetInBytes.length - 4); isEdited = remember; return this; }
<DeepExtract> boolean remember = isEdited; replaceInt(0, packetInBytes.length - 4); isEdited = remember; </DeepExtract>
G-Earth
positive
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); String addr = intent.getStringExtra("addr"); mMeter = getDeviceWithAddress(addr); if (mMeter == null) { Util.logNullMeterEvent(addr); finish(); return; } setContentView(R.layout.activity_oad); ImageView view = (ImageView) findViewById(android.R.id.home); view.setPadding(10, 0, 20, 10); setTitle(R.string.title_oad); mProgressInfo = (TextView) findViewById(R.id.tw_info); mFileImage = (TextView) findViewById(R.id.tw_file); mLog = (TextView) findViewById(R.id.tw_log); mProgressBar = (ProgressBar) findViewById(R.id.pb_progress); mBtnStart = (Button) findViewById(R.id.btn_start); mLegacyMode = (CheckBox) findViewById(R.id.legacy_mode_checkbox); mLogScroller = new ScrollingMovementMethod(); mLog.setMovementMethod(mLogScroller); mBtnStart.setEnabled(false); mLegacyMode.setChecked(android.os.Build.VERSION.SDK_INT < 21); mLegacyMode.setEnabled(true); if (mLegacyMode.isChecked()) { final Context context = this; Util.dispatch(new Runnable() { @Override public void run() { Util.blockOnAlertBox(context, "Warning: Unstable upload", "This version of Android is known to be unstable when updating firmware. We recommend using Android 5.0 or later, or performing the firmware upload from an iOS device."); } }); } runOnUiThread(new Runnable() { @Override public void run() { if (mProgramming) { mBtnStart.setText(R.string.cancel); mProgressInfo.setText("Programming..."); } else { mProgressBar.setProgress(0); mBtnStart.setText(R.string.start_prog); mProgressInfo.setText("Idle"); } mLegacyMode.setEnabled(!mProgramming); } }); }
<DeepExtract> runOnUiThread(new Runnable() { @Override public void run() { if (mProgramming) { mBtnStart.setText(R.string.cancel); mProgressInfo.setText("Programming..."); } else { mProgressBar.setProgress(0); mBtnStart.setText(R.string.start_prog); mProgressInfo.setText("Idle"); } mLegacyMode.setEnabled(!mProgramming); } }); </DeepExtract>
Mooshimeter-AndroidApp
positive
public void actionPerformed(java.awt.event.ActionEvent evt) { colorByMentionsCheckboxActionPerformed(evt); }
<DeepExtract> colorByMentionsCheckboxActionPerformed(evt); </DeepExtract>
vizlinc
positive
@BeforeTest public void configuring() { String translationDir = AbstractVectorSpaceTest.class.getClassLoader().getResource("translations/pt").getPath(); return new LuceneTranslator(translationDir); String vsmDir = AbstractVectorSpaceTest.class.getClassLoader().getResource("models/annoy/dense/en/simple").getPath(); return new AnnoyVectorSpace(vsmDir); analyzer = vectorSpace.getAnalyzer(); }
<DeepExtract> String translationDir = AbstractVectorSpaceTest.class.getClassLoader().getResource("translations/pt").getPath(); return new LuceneTranslator(translationDir); </DeepExtract> <DeepExtract> String vsmDir = AbstractVectorSpaceTest.class.getClassLoader().getResource("models/annoy/dense/en/simple").getPath(); return new AnnoyVectorSpace(vsmDir); </DeepExtract>
Indra
positive
@Override public void run() { if (!applyEarlyPolicies(settingsHelper.getConfig())) { return; } applyLatePolicies(settingsHelper.getConfig()); sendDeviceInfoAfterReconfigure(); scheduleDeviceInfoSending(); scheduleInstalledAppsRun(); if (settingsHelper.getConfig().getLock() != null && settingsHelper.getConfig().getLock()) { showLockScreen(); return; } else { hideLockScreen(); } if (settingsHelper.getConfig().getRunDefaultLauncher() != null && settingsHelper.getConfig().getRunDefaultLauncher() && !getPackageName().equals(Utils.getDefaultLauncher(this)) && !Utils.isLauncherIntent(getIntent())) { openDefaultLauncher(); return; } if (orientationLocked && !BuildConfig.DISABLE_ORIENTATION_LOCK) { Utils.setOrientation(this, settingsHelper.getConfig()); orientationLocked = false; } if (ProUtils.kioskModeRequired(this)) { String kioskApp = settingsHelper.getConfig().getMainApp(); if (kioskApp != null && kioskApp.trim().length() > 0 && (!kioskApp.equals(getPackageName()) || !ProUtils.isKioskModeRunning(this))) { if (ProUtils.startCosuKioskMode(kioskApp, this, false)) { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); return; } else { Log.e(Const.LOG_TAG, "Kiosk mode failed, proceed with the default flow"); } } else { if (kioskApp != null && kioskApp.equals(getPackageName()) && ProUtils.isKioskModeRunning(this)) { ProUtils.updateKioskAllowedApps(kioskApp, this, false); } else { Log.e(Const.LOG_TAG, "Kiosk mode disabled: please setup the main app!"); } } } else { if (ProUtils.isKioskModeRunning(this)) { ProUtils.unlockKiosk(this); openDefaultLauncher(); } } if (settingsHelper.getConfig().getBackgroundColor() != null) { try { binding.activityMainContentWrapper.setBackgroundColor(Color.parseColor(settingsHelper.getConfig().getBackgroundColor())); } catch (Exception e) { e.printStackTrace(); binding.activityMainContentWrapper.setBackgroundColor(getResources().getColor(R.color.defaultBackground)); } } else { binding.activityMainContentWrapper.setBackgroundColor(getResources().getColor(R.color.defaultBackground)); } updateTitle(settingsHelper.getConfig()); if (mainAppListAdapter == null || needRedrawContentAfterReconfigure) { needRedrawContentAfterReconfigure = false; if (settingsHelper.getConfig().getBackgroundImageUrl() != null && settingsHelper.getConfig().getBackgroundImageUrl().length() > 0) { Picasso.Builder builder = new Picasso.Builder(this); if (BuildConfig.TRUST_ANY_CERTIFICATE) { builder.downloader(new OkHttp3Downloader(UnsafeOkHttpClient.getUnsafeOkHttpClient())); } else if (BuildConfig.CHECK_SIGNATURE) { OkHttpClient clientWithSignature = new OkHttpClient.Builder().addInterceptor(chain -> { okhttp3.Request.Builder requestBuilder = chain.request().newBuilder(); String signature = InstallUtils.getRequestSignature(chain.request().url().toString()); if (signature != null) { requestBuilder.addHeader("X-Request-Signature", signature); } return chain.proceed(requestBuilder.build()); }).build(); builder.downloader(new OkHttp3Downloader(clientWithSignature)); } builder.listener(new Picasso.Listener() { @Override public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) { Picasso.with(MainActivity.this).load(settingsHelper.getConfig().getBackgroundImageUrl()).networkPolicy(NetworkPolicy.OFFLINE).fit().centerCrop().into(binding.activityMainBackground); } }); builder.build().load(settingsHelper.getConfig().getBackgroundImageUrl()).fit().centerCrop().into(binding.activityMainBackground); } else { binding.activityMainBackground.setImageDrawable(null); } Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int itemWidth = getResources().getDimensionPixelSize(R.dimen.app_list_item_size); spanCount = (int) (width * 1.0f / itemWidth); mainAppListAdapter = new MainAppListAdapter(this, this, this); mainAppListAdapter.setSpanCount(spanCount); binding.activityMainContent.setLayoutManager(new GridLayoutManager(this, spanCount)); binding.activityMainContent.setAdapter(mainAppListAdapter); mainAppListAdapter.notifyDataSetChanged(); int bottomAppCount = AppShortcutManager.getInstance().getInstalledAppCount(this, true); if (bottomAppCount > 0) { bottomAppListAdapter = new BottomAppListAdapter(this, this, this); bottomAppListAdapter.setSpanCount(spanCount); binding.activityBottomLayout.setVisibility(View.VISIBLE); binding.activityBottomLine.setLayoutManager(new GridLayoutManager(this, bottomAppCount < spanCount ? bottomAppCount : spanCount)); binding.activityBottomLine.setAdapter(bottomAppListAdapter); bottomAppListAdapter.notifyDataSetChanged(); } else { bottomAppListAdapter = null; binding.activityBottomLayout.setVisibility(View.GONE); } } binding.setShowContent(true); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }
<DeepExtract> if (!applyEarlyPolicies(settingsHelper.getConfig())) { return; } applyLatePolicies(settingsHelper.getConfig()); sendDeviceInfoAfterReconfigure(); scheduleDeviceInfoSending(); scheduleInstalledAppsRun(); if (settingsHelper.getConfig().getLock() != null && settingsHelper.getConfig().getLock()) { showLockScreen(); return; } else { hideLockScreen(); } if (settingsHelper.getConfig().getRunDefaultLauncher() != null && settingsHelper.getConfig().getRunDefaultLauncher() && !getPackageName().equals(Utils.getDefaultLauncher(this)) && !Utils.isLauncherIntent(getIntent())) { openDefaultLauncher(); return; } if (orientationLocked && !BuildConfig.DISABLE_ORIENTATION_LOCK) { Utils.setOrientation(this, settingsHelper.getConfig()); orientationLocked = false; } if (ProUtils.kioskModeRequired(this)) { String kioskApp = settingsHelper.getConfig().getMainApp(); if (kioskApp != null && kioskApp.trim().length() > 0 && (!kioskApp.equals(getPackageName()) || !ProUtils.isKioskModeRunning(this))) { if (ProUtils.startCosuKioskMode(kioskApp, this, false)) { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); return; } else { Log.e(Const.LOG_TAG, "Kiosk mode failed, proceed with the default flow"); } } else { if (kioskApp != null && kioskApp.equals(getPackageName()) && ProUtils.isKioskModeRunning(this)) { ProUtils.updateKioskAllowedApps(kioskApp, this, false); } else { Log.e(Const.LOG_TAG, "Kiosk mode disabled: please setup the main app!"); } } } else { if (ProUtils.isKioskModeRunning(this)) { ProUtils.unlockKiosk(this); openDefaultLauncher(); } } if (settingsHelper.getConfig().getBackgroundColor() != null) { try { binding.activityMainContentWrapper.setBackgroundColor(Color.parseColor(settingsHelper.getConfig().getBackgroundColor())); } catch (Exception e) { e.printStackTrace(); binding.activityMainContentWrapper.setBackgroundColor(getResources().getColor(R.color.defaultBackground)); } } else { binding.activityMainContentWrapper.setBackgroundColor(getResources().getColor(R.color.defaultBackground)); } updateTitle(settingsHelper.getConfig()); if (mainAppListAdapter == null || needRedrawContentAfterReconfigure) { needRedrawContentAfterReconfigure = false; if (settingsHelper.getConfig().getBackgroundImageUrl() != null && settingsHelper.getConfig().getBackgroundImageUrl().length() > 0) { Picasso.Builder builder = new Picasso.Builder(this); if (BuildConfig.TRUST_ANY_CERTIFICATE) { builder.downloader(new OkHttp3Downloader(UnsafeOkHttpClient.getUnsafeOkHttpClient())); } else if (BuildConfig.CHECK_SIGNATURE) { OkHttpClient clientWithSignature = new OkHttpClient.Builder().addInterceptor(chain -> { okhttp3.Request.Builder requestBuilder = chain.request().newBuilder(); String signature = InstallUtils.getRequestSignature(chain.request().url().toString()); if (signature != null) { requestBuilder.addHeader("X-Request-Signature", signature); } return chain.proceed(requestBuilder.build()); }).build(); builder.downloader(new OkHttp3Downloader(clientWithSignature)); } builder.listener(new Picasso.Listener() { @Override public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) { Picasso.with(MainActivity.this).load(settingsHelper.getConfig().getBackgroundImageUrl()).networkPolicy(NetworkPolicy.OFFLINE).fit().centerCrop().into(binding.activityMainBackground); } }); builder.build().load(settingsHelper.getConfig().getBackgroundImageUrl()).fit().centerCrop().into(binding.activityMainBackground); } else { binding.activityMainBackground.setImageDrawable(null); } Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int itemWidth = getResources().getDimensionPixelSize(R.dimen.app_list_item_size); spanCount = (int) (width * 1.0f / itemWidth); mainAppListAdapter = new MainAppListAdapter(this, this, this); mainAppListAdapter.setSpanCount(spanCount); binding.activityMainContent.setLayoutManager(new GridLayoutManager(this, spanCount)); binding.activityMainContent.setAdapter(mainAppListAdapter); mainAppListAdapter.notifyDataSetChanged(); int bottomAppCount = AppShortcutManager.getInstance().getInstalledAppCount(this, true); if (bottomAppCount > 0) { bottomAppListAdapter = new BottomAppListAdapter(this, this, this); bottomAppListAdapter.setSpanCount(spanCount); binding.activityBottomLayout.setVisibility(View.VISIBLE); binding.activityBottomLine.setLayoutManager(new GridLayoutManager(this, bottomAppCount < spanCount ? bottomAppCount : spanCount)); binding.activityBottomLine.setAdapter(bottomAppListAdapter); bottomAppListAdapter.notifyDataSetChanged(); } else { bottomAppListAdapter = null; binding.activityBottomLayout.setVisibility(View.GONE); } } binding.setShowContent(true); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); </DeepExtract>
hmdm-android
positive
public BackendConnection getConnection(String schema, boolean autoCommit, Object attachment) throws Exception { BackendConnection con = null; if (schema != null && !schema.equals(this.database)) { throw new RuntimeException("invalid param ,connection request db is :" + schema + " and datanode db is " + this.database); } if (!dbPool.isInitSuccess()) { dbPool.init(dbPool.activedIndex); } if (dbPool.isInitSuccess()) { con = dbPool.getSource().getConnection(schema, autoCommit, attachment); } else { throw new IllegalArgumentException("Invalid DataSource:" + dbPool.getActivedIndex()); } return con; }
<DeepExtract> if (schema != null && !schema.equals(this.database)) { throw new RuntimeException("invalid param ,connection request db is :" + schema + " and datanode db is " + this.database); } if (!dbPool.isInitSuccess()) { dbPool.init(dbPool.activedIndex); } </DeepExtract>
Mycat-NIO
positive
@java.lang.Deprecated public java.util.Map<java.lang.String, java.lang.Long> getLongValues() { return internalGetLongValues().getMap(); }
<DeepExtract> return internalGetLongValues().getMap(); </DeepExtract>
game-server
positive
@Override public WaterMarkSegment clone() { WaterMarkSegment waterMarkSegment = new WaterMarkSegment(); mBitmap = mBitmap; mDstRect = new RectF(mDstRect); mAlpha = mAlpha; synchronized (this) { mBitmapInfo = null; } return waterMarkSegment; }
<DeepExtract> mBitmap = mBitmap; mDstRect = new RectF(mDstRect); mAlpha = mAlpha; synchronized (this) { mBitmapInfo = null; } </DeepExtract>
PhotoMovie
positive
@Override public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof IBlockNotifier) { ((IBlockNotifier) tileEntity).onBlockRemoval(world, x, y, z); } super.onBlockExploded(world, x, y, z, explosion); }
<DeepExtract> TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof IBlockNotifier) { ((IBlockNotifier) tileEntity).onBlockRemoval(world, x, y, z); } </DeepExtract>
Dimensional-Pockets
positive
@Override protected String doInBackground(Context... params) { parent = params[0]; _dev = new USBSerial(); try { List<String> res = RootTools.sendShell("dmesg | grep ttyUSB | tail -n 1 | awk '{print $NF}'", 0); ttyUSB_name = res.get(0); } catch (Exception e) { return ""; } if (!_dev.openPort("/dev/" + ttyUSB_name)) return "FAIL"; if (VERBOSE) Log.d("ZigBeeInit", "opened device, now waiting for sequence"); byte[] readSeq = new byte[initialized_sequence.length]; MainInterface.sendThreadMessage(_parent, MainInterface.ThreadMessages.CANCEL_PROGRESS_DIALOG); MainInterface.sendProgressDialogRequest(_parent, "Press the ZigBee reset button..."); while (!checkInitSeq(readSeq)) { for (int i = 0; i < initialized_sequence.length - 1; i++) readSeq[i] = readSeq[i + 1]; readSeq[initialized_sequence.length - 1] = _dev.getByte(); } if (VERBOSE) Log.d("ZigBeeInit", "received the initialization sequence!"); if (!_dev.closePort()) MainInterface.sendToastRequest(_parent, "Failed to initialize ZigBee device"); return "OK"; }
<DeepExtract> if (VERBOSE) Log.d("ZigBeeInit", "opened device, now waiting for sequence"); </DeepExtract> <DeepExtract> if (VERBOSE) Log.d("ZigBeeInit", "received the initialization sequence!"); </DeepExtract>
android-wmon
positive
protected void setVersionName(String versionName) { if (isDebug) { Log.d(TAG, "setVersionName invoked!"); } final String curVer = versionName; PluginWrapper.runOnMainThread(new Runnable() { @Override public void run() { try { FlurryAgent.setVersionName(curVer); } catch (Exception e) { LogE("Exception in setVersionName", e); } } }); }
<DeepExtract> if (isDebug) { Log.d(TAG, "setVersionName invoked!"); } </DeepExtract>
cocos2dx-3.2-qt
positive
@Test public void getLists_byScreenName() { mockServer.expect(requestTo("https://api.twitter.com/1.1/lists/list.json?screen_name=habuma")).andExpect(method(GET)).andRespond(withSuccess(jsonResource("multiple-list"), APPLICATION_JSON)); assertEquals(2, twitter.listOperations().getLists("habuma").size()); UserList list1 = twitter.listOperations().getLists("habuma").get(0); assertEquals(40842137, list1.getId()); assertEquals("forFun2", list1.getName()); assertEquals("@habuma/forfun2", list1.getFullName()); assertEquals("forfun2", list1.getSlug()); assertEquals("Just for fun, too", list1.getDescription()); assertEquals(3, list1.getMemberCount()); assertEquals(0, list1.getSubscriberCount()); assertEquals("/habuma/forfun2", list1.getUriPath()); assertTrue(list1.isPublic()); UserList list2 = twitter.listOperations().getLists("habuma").get(1); assertEquals(40841803, list2.getId()); assertEquals("forFun", list2.getName()); assertEquals("@habuma/forfun", list2.getFullName()); assertEquals("forfun", list2.getSlug()); assertEquals("Just for fun", list2.getDescription()); assertEquals(22, list2.getMemberCount()); assertEquals(100, list2.getSubscriberCount()); assertEquals("/habuma/forfun", list2.getUriPath()); assertFalse(list2.isPublic()); }
<DeepExtract> assertEquals(2, twitter.listOperations().getLists("habuma").size()); UserList list1 = twitter.listOperations().getLists("habuma").get(0); assertEquals(40842137, list1.getId()); assertEquals("forFun2", list1.getName()); assertEquals("@habuma/forfun2", list1.getFullName()); assertEquals("forfun2", list1.getSlug()); assertEquals("Just for fun, too", list1.getDescription()); assertEquals(3, list1.getMemberCount()); assertEquals(0, list1.getSubscriberCount()); assertEquals("/habuma/forfun2", list1.getUriPath()); assertTrue(list1.isPublic()); UserList list2 = twitter.listOperations().getLists("habuma").get(1); assertEquals(40841803, list2.getId()); assertEquals("forFun", list2.getName()); assertEquals("@habuma/forfun", list2.getFullName()); assertEquals("forfun", list2.getSlug()); assertEquals("Just for fun", list2.getDescription()); assertEquals(22, list2.getMemberCount()); assertEquals(100, list2.getSubscriberCount()); assertEquals("/habuma/forfun", list2.getUriPath()); assertFalse(list2.isPublic()); </DeepExtract>
spring-social-twitter
positive
@Override public void openFileChooser(ValueCallback valueCallback, String acceptType) { Log.i(TAG, "openFileChooser>3.0"); if (valueCallback == null) { return; } Activity mActivity = this.mActivityWeakReference.get(); if (mActivity == null || mActivity.isFinishing()) { valueCallback.onReceiveValue(new Object()); return; } AgentWebUtils.showFileChooserCompat(mActivity, mWebView, null, null, this.mPermissionInterceptor, valueCallback, acceptType, null); }
<DeepExtract> if (valueCallback == null) { return; } Activity mActivity = this.mActivityWeakReference.get(); if (mActivity == null || mActivity.isFinishing()) { valueCallback.onReceiveValue(new Object()); return; } AgentWebUtils.showFileChooserCompat(mActivity, mWebView, null, null, this.mPermissionInterceptor, valueCallback, acceptType, null); </DeepExtract>
AgentWeb
positive
public void judgeCard(User judge, int cardId) throws BaseCahHandler.CahException { synchronized (judgeLock) { Player judgePlayer = getPlayerForUser(judge); if (getJudge() != judgePlayer) throw new BaseCahHandler.CahException(Consts.ErrorCode.NOT_JUDGE); else if (state != Consts.GameState.JUDGING) throw new BaseCahHandler.CahException(Consts.ErrorCode.NOT_YOUR_TURN); if (judgePlayer != null) judgePlayer.resetSkipCount(); winner = playedCards.getPlayerForId(cardId); if (winner == null) throw new BaseCahHandler.CahException(Consts.ErrorCode.INVALID_CARD); winner.increaseScore(); } state = Consts.GameState.ROUND_OVER; boolean won; if (winner.getScore() >= options.scoreGoal) { if (options.winBy == 0) won = true; int highestScore = -1; synchronized (roundPlayers) { for (Player p : roundPlayers) { if (winner.equals(p)) continue; if (p.getScore() > highestScore) highestScore = p.getScore(); } } won = highestScore == -1 || winner.getScore() >= highestScore + options.winBy; } else { won = false; } EventWrapper ev = new EventWrapper(this, Consts.Event.GAME_STATE_CHANGE); ev.add(Consts.GeneralGameData.STATE, Consts.GameState.ROUND_OVER.toString()); ev.add(Consts.OngoingGameData.ROUND_WINNER, winner.getUser().getNickname()); ev.add(Consts.OngoingGameData.WILL_STOP, won); ev.add(Consts.OngoingGameData.WINNING_CARD, Utils.joinCardIds(playedCards.getCards(winner), ",")); ev.add(Consts.OngoingGameData.INTERMISSION, ROUND_INTERMISSION); connectedUsers.broadcastToList(playersToUsers(), QueuedMessage.MessageType.GAME_EVENT, ev); if (winner == null) return; EventWrapper ev = new EventWrapper(this, Consts.Event.GAME_PLAYER_INFO_CHANGE); ev.add(Consts.GamePlayerInfo.INFO, getPlayerInfoJson(winner)); broadcastToPlayers(QueuedMessage.MessageType.GAME_PLAYER_EVENT, ev); synchronized (roundTimerLock) { if (won) { rescheduleTimer(new SafeTimerTask() { @Override public void process() { resetState(false); } }, ROUND_INTERMISSION); } else { rescheduleTimer(new SafeTimerTask() { @Override public void process() { startNextRound(); } }, ROUND_INTERMISSION); } } Map<String, List<WhiteCard>> cardsBySessionId = new HashMap<>(); playedCards.cardsByUser().forEach((key, value) -> cardsBySessionId.put(key.getSessionId(), value)); }
<DeepExtract> boolean won; if (winner.getScore() >= options.scoreGoal) { if (options.winBy == 0) won = true; int highestScore = -1; synchronized (roundPlayers) { for (Player p : roundPlayers) { if (winner.equals(p)) continue; if (p.getScore() > highestScore) highestScore = p.getScore(); } } won = highestScore == -1 || winner.getScore() >= highestScore + options.winBy; } else { won = false; } </DeepExtract> <DeepExtract> connectedUsers.broadcastToList(playersToUsers(), QueuedMessage.MessageType.GAME_EVENT, ev); </DeepExtract> <DeepExtract> if (winner == null) return; EventWrapper ev = new EventWrapper(this, Consts.Event.GAME_PLAYER_INFO_CHANGE); ev.add(Consts.GamePlayerInfo.INFO, getPlayerInfoJson(winner)); broadcastToPlayers(QueuedMessage.MessageType.GAME_PLAYER_EVENT, ev); </DeepExtract>
PYX-Reloaded
positive
@Test public void hasImeAction_withInteger_addsCorrectMatcher() { notCompletable.hasImeAction(1); assertThat(cortado.matchers).hasSize(1); Utils.assertThat(cortado.matchers.get(0)).isEqualTo(ViewMatchers.hasImeAction(1)); }
<DeepExtract> assertThat(cortado.matchers).hasSize(1); Utils.assertThat(cortado.matchers.get(0)).isEqualTo(ViewMatchers.hasImeAction(1)); </DeepExtract>
cortado
positive
public String rightToString() { String sRegle = null; int iIndiceItem = 0; Item item = null; boolean bItemsQualitatifsPresents = false; boolean bPremierItemInscrit = false; int iIndiceDisjonction = 0; int iNombreDisjonctions = 0; int iNombreItemsQuantitatifs = 0; int iNombreItems = 0; Item[] tItemsRegle = null; sRegle = new String(""); iNombreItems = m_iNombreItemsDroite; tItemsRegle = m_tItemsDroite; int iPosition = 0; int iCompteur = 0; iCompteur = 0; for (iPosition = 0; iPosition < m_iNombreItemsDroite; iPosition++) if (m_tItemsDroite[iPosition].m_iTypeItem == Item.ITEM_TYPE_QUANTITATIF) iCompteur++; return iCompteur; iNombreDisjonctions = m_iNombreDisjonctionsDroiteValides; bPremierItemInscrit = false; for (iIndiceItem = 0; iIndiceItem < iNombreItems; iIndiceItem++) { item = tItemsRegle[iIndiceItem]; if (item.m_iTypeItem == Item.ITEM_TYPE_QUALITATIF) { if (bPremierItemInscrit) sRegle += " AND "; sRegle += ((ItemQualitative) item).toString(); bPremierItemInscrit = true; } } bItemsQualitatifsPresents = bPremierItemInscrit; if (iNombreItemsQuantitatifs > 0) { if (bItemsQualitatifsPresents) { sRegle += " AND "; if (iNombreDisjonctions > 1) sRegle += "( "; } for (iIndiceDisjonction = 0; iIndiceDisjonction < iNombreDisjonctions; iIndiceDisjonction++) { if (iIndiceDisjonction > 0) sRegle += " OR "; if ((iNombreItemsQuantitatifs > 1) && (iNombreDisjonctions > 1)) sRegle += "( "; bPremierItemInscrit = false; for (iIndiceItem = 0; iIndiceItem < iNombreItems; iIndiceItem++) { item = tItemsRegle[iIndiceItem]; if (item.m_iTypeItem == Item.ITEM_TYPE_QUANTITATIF) { if (bPremierItemInscrit) sRegle += " AND "; sRegle += ((ItemQuantitative) item).toString(iIndiceDisjonction); bPremierItemInscrit = true; } } if ((iNombreItemsQuantitatifs > 1) && (iNombreDisjonctions > 1)) sRegle += " )"; } if ((bItemsQualitatifsPresents) && (iNombreDisjonctions > 1)) sRegle += " ) "; } return sRegle; }
<DeepExtract> int iPosition = 0; int iCompteur = 0; iCompteur = 0; for (iPosition = 0; iPosition < m_iNombreItemsDroite; iPosition++) if (m_tItemsDroite[iPosition].m_iTypeItem == Item.ITEM_TYPE_QUANTITATIF) iCompteur++; return iCompteur; </DeepExtract>
QuantMiner
positive
public static synchronized void createSparseDoubleTable(int tableId, int staleness) { Preconditions.checkState(isInitialized, "PsTableGroup has not been initialized!"); RowFactory rowFactory = new SparseDoubleRowFactory(); RowUpdateFactory rowUpdateFactory = new SparseDoubleRowUpdateFactory(); doubleTables.add(tableId); Preconditions.checkState(isInitialized, "PsTableGroup has not been initialized!"); Preconditions.checkState(numWorkerThreadsRegistered.get() == 0, "Cannot create table after a worker thread is registered!"); Preconditions.checkArgument(!tables.containsKey(tableId), "Already created table with ID=" + tableId + "!"); Preconditions.checkArgument(staleness >= 0, "Cannot create table with negative staleness value!"); if (staleness > maxTableStaleness) { maxTableStaleness = staleness; } ServerThreadGroup.createTable(tableId, rowFactory, rowUpdateFactory); tables.put(tableId, new ClientTable(tableId, staleness, rowFactory, rowUpdateFactory)); }
<DeepExtract> Preconditions.checkState(isInitialized, "PsTableGroup has not been initialized!"); Preconditions.checkState(numWorkerThreadsRegistered.get() == 0, "Cannot create table after a worker thread is registered!"); Preconditions.checkArgument(!tables.containsKey(tableId), "Already created table with ID=" + tableId + "!"); Preconditions.checkArgument(staleness >= 0, "Cannot create table with negative staleness value!"); if (staleness > maxTableStaleness) { maxTableStaleness = staleness; } ServerThreadGroup.createTable(tableId, rowFactory, rowUpdateFactory); tables.put(tableId, new ClientTable(tableId, staleness, rowFactory, rowUpdateFactory)); </DeepExtract>
jbosen
positive
@Test public void noTenacityConfigurationSetShouldUseDefault() { clientConfiguration.setTimeout(Duration.milliseconds(1)); final Client tenacityClient = tenacityClientBuilder.build(buildClient()); doSleep(null); }
<DeepExtract> doSleep(null); </DeepExtract>
tenacity
positive
@Override public void onFinishInflate() { mOnButton = (RadioButton) findViewById(TkR.id.compat_mode_on_radio); mOffButton = (RadioButton) findViewById(TkR.id.compat_mode_off_radio); mOnButton.setOnClickListener(this); mOffButton.setOnClickListener(this); int COMPAT_MODE_ENABLED = XposedHelpers.getStaticIntField(ActivityManager.class, "COMPAT_MODE_ENABLED"); int COMPAT_MODE_ALWAYS = XposedHelpers.getStaticIntField(ActivityManager.class, "COMPAT_MODE_ALWAYS"); int COMPAT_MODE_NEVER = XposedHelpers.getStaticIntField(ActivityManager.class, "COMPAT_MODE_NEVER"); int mode = (Integer) XposedHelpers.callMethod(mAM, "getFrontActivityScreenCompatMode"); if (mode == COMPAT_MODE_ALWAYS || mode == COMPAT_MODE_NEVER) { closePanel(); return; } final boolean on = (mode == COMPAT_MODE_ENABLED); mOnButton.setChecked(on); mOffButton.setChecked(!on); }
<DeepExtract> int COMPAT_MODE_ENABLED = XposedHelpers.getStaticIntField(ActivityManager.class, "COMPAT_MODE_ENABLED"); int COMPAT_MODE_ALWAYS = XposedHelpers.getStaticIntField(ActivityManager.class, "COMPAT_MODE_ALWAYS"); int COMPAT_MODE_NEVER = XposedHelpers.getStaticIntField(ActivityManager.class, "COMPAT_MODE_NEVER"); int mode = (Integer) XposedHelpers.callMethod(mAM, "getFrontActivityScreenCompatMode"); if (mode == COMPAT_MODE_ALWAYS || mode == COMPAT_MODE_NEVER) { closePanel(); return; } final boolean on = (mode == COMPAT_MODE_ENABLED); mOnButton.setChecked(on); mOffButton.setChecked(!on); </DeepExtract>
tabletkat
positive
public boolean isCapturedViewUnder(int x, int y) { if (mCapturedView == null) { return false; } return x >= mCapturedView.getLeft() && x < mCapturedView.getRight() && y >= mCapturedView.getTop() && y < mCapturedView.getBottom(); }
<DeepExtract> if (mCapturedView == null) { return false; } return x >= mCapturedView.getLeft() && x < mCapturedView.getRight() && y >= mCapturedView.getTop() && y < mCapturedView.getBottom(); </DeepExtract>
Better
positive
public Criteria andCallbackRequestMethodGreaterThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "callbackRequestMethod" + " cannot be null"); } criteria.add(new Criterion("callback_request_method >", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "callbackRequestMethod" + " cannot be null"); } criteria.add(new Criterion("callback_request_method >", value)); </DeepExtract>
AnyMock
positive
public void storeIntVariable(int vindex) { if (vindex < 0) throw new IllegalArgumentException("vindex must be positive"); if (vindex >= numLocals) { numLocals = vindex + 1; if (numLocals > 65535) throw new ClassFileLimitExceededException("Too many locals."); } if (stackSize == -1) { return; } stackSize -= 1; if (stackSize < 0) throw new IllegalStateException("Stack underflow."); stackSize += 0; if (stackSize > maxStackSize) { maxStackSize = stackSize; if (stackSize >= 65534) throw new ClassFileLimitExceededException("Stack overflow."); } if (vindex < 4) { emit(59 + vindex); } else if (vindex <= 255) { emit(54); emit(vindex); } else { emit(196); emit(54); emitUInt16(vindex); } }
<DeepExtract> if (vindex < 0) throw new IllegalArgumentException("vindex must be positive"); if (vindex >= numLocals) { numLocals = vindex + 1; if (numLocals > 65535) throw new ClassFileLimitExceededException("Too many locals."); } </DeepExtract> <DeepExtract> if (stackSize == -1) { return; } stackSize -= 1; if (stackSize < 0) throw new IllegalStateException("Stack underflow."); stackSize += 0; if (stackSize > maxStackSize) { maxStackSize = stackSize; if (stackSize >= 65534) throw new ClassFileLimitExceededException("Stack overflow."); } </DeepExtract>
arden2bytecode
positive
private void initData() { progressBar.post(() -> progressBar.setVisibility(View.VISIBLE)); new Thread(() -> { data.clear(); picked.clear(); notInstalled.clear(); SharedPreferenceUtil sharedPreferenceUtil = SharedPreferenceUtil.getInstance(); String raw = ""; switch(pickerType) { case PICKER_WHITE_LIST: raw = (String) sharedPreferenceUtil.get(AppPickActivity.this, Constants.PREF_FLOAT_WINDOW_FILTER, Constants.DEFAULT_VALUE_PREF_FLOAT_WINDOW_FILTER); break; case PICKER_TYPE_STICKY_APPS: raw = (String) sharedPreferenceUtil.get(AppPickActivity.this, Constants.PREF_FLOAT_STICKY_APPS, Constants.DEFAULT_VALUE_PREF_FLOAT_STICKY_APPS); break; } if (raw != null && !raw.equals("")) { String[] filter_cooking = raw.split(","); Collections.addAll(picked, filter_cooking); Collections.addAll(notInstalled, filter_cooking); } PickerPack system_server = new PickerPack("system_server", "system_server", null, picked.contains("system_server")); data.add(system_server); List<PackageInfo> packageInfo = getPackageManager().getInstalledPackages(0); for (PackageInfo i : packageInfo) { String label = PackageCtlUtils.getLabel(AppPickActivity.this, i.applicationInfo); Drawable icon = PackageCtlUtils.getIcon(AppPickActivity.this, i.applicationInfo); boolean currentPicked = picked.contains(i.packageName); PickerPack current = new PickerPack(i.packageName, label, icon, currentPicked); notInstalled.remove(i.packageName); if (currentPicked) { data.add(0, current); } else { data.add(current); } } addNotInstalledButSelectedPacks(); runOnUiThread(() -> { adapter.notifyDataSetChanged(); recyclerView.scheduleLayoutAnimation(); hideProcessing(); }); }).start(); }
<DeepExtract> progressBar.post(() -> progressBar.setVisibility(View.VISIBLE)); </DeepExtract>
audiohq_md2
positive
public static boolean assignment(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "assignment")) return false; Marker m = enter_section_(b, l, _NONE_, "<assignment>"); if (!recursion_guard_(b, l + 1, "infix")) r = false; boolean r; Marker m = enter_section_(b, l + 1, _NONE_, "<infix>"); r = term(b, l + 1 + 1); r = r && infix_1(b, l + 1 + 1); exit_section_(b, l + 1, m, INFIX, r, false, null); return r; r = r && assignment_1(b, l + 1); exit_section_(b, l, m, ASSIGNMENT, r, false, null); return r; }
<DeepExtract> if (!recursion_guard_(b, l + 1, "infix")) r = false; boolean r; Marker m = enter_section_(b, l + 1, _NONE_, "<infix>"); r = term(b, l + 1 + 1); r = r && infix_1(b, l + 1 + 1); exit_section_(b, l + 1, m, INFIX, r, false, null); return r; </DeepExtract>
intellij-pony
positive
public String getDescriptor() { StringBuilder buf = new StringBuilder(); getDescriptor(buf); return getDescriptor(); }
<DeepExtract> return getDescriptor(); </DeepExtract>
ekstazi
positive
public Object getAttribute(String name) { attributes.put(CommonConstant.SESSION_CHANGED, Boolean.TRUE); return attributes.get(name); }
<DeepExtract> attributes.put(CommonConstant.SESSION_CHANGED, Boolean.TRUE); </DeepExtract>
rop
positive
public void readNodeIconPropertyNames() { settings.setNodeIconPropertyNames(Activator.getDefault().getPreferenceStore().getString(DecoratorPreferences.NODE_ICON_PROPERTY_NAMES)); graphDecorator = new SimpleGraphDecorator(settings, viewSettings); }
<DeepExtract> settings.setNodeIconPropertyNames(Activator.getDefault().getPreferenceStore().getString(DecoratorPreferences.NODE_ICON_PROPERTY_NAMES)); </DeepExtract> <DeepExtract> graphDecorator = new SimpleGraphDecorator(settings, viewSettings); </DeepExtract>
neoclipse
positive
private void weekTitle(View v) { mSelectWeekIsShow = !mSelectWeekIsShow; int start = 0, end = 0; if (!mSelectWeekIsShow) { start = -mHeightSelectWeek; } else { end = -mHeightSelectWeek; } ValueAnimator animator = ValueAnimator.ofInt(start, end); animator.setDuration(300); animator.setInterpolator(new DecelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mRvSelectWeek.getLayoutParams(); params.topMargin = (int) animation.getAnimatedValue(); mRvSelectWeek.setLayoutParams(params); } }); animator.start(); }
<DeepExtract> mSelectWeekIsShow = !mSelectWeekIsShow; int start = 0, end = 0; if (!mSelectWeekIsShow) { start = -mHeightSelectWeek; } else { end = -mHeightSelectWeek; } ValueAnimator animator = ValueAnimator.ofInt(start, end); animator.setDuration(300); animator.setInterpolator(new DecelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mRvSelectWeek.getLayoutParams(); params.topMargin = (int) animation.getAnimatedValue(); mRvSelectWeek.setLayoutParams(params); } }); animator.start(); </DeepExtract>
ClassSchedule
positive
public FieldSignature lookupStaticField(Type clazz, String fieldName) throws PhantomLookupException { if (!records.containsKey(clazz)) throw new IllegalArgumentException("" + clazz); Collection<Type> ifaces; try { ifaces = new PseudoSnapshot(hierarchy).getAllSupertypes(type); } catch (IncompleteSupertypesException exc) { ifaces = exc.getSupertypes(); } List<Type> phantoms = new LinkedList<>(); for (Type iface : ifaces) { if (!hierarchy.contains(iface)) { phantoms.add(iface); continue; } Record rec = records.get(iface); assert rec != null; if (rec.fields.containsKey(fieldName)) return rec.fields.get(fieldName); } Collections.shuffle(phantoms, rand); if (!phantoms.isEmpty()) throw new PhantomLookupException(phantoms.get(0)); return null; }
<DeepExtract> Collection<Type> ifaces; try { ifaces = new PseudoSnapshot(hierarchy).getAllSupertypes(type); } catch (IncompleteSupertypesException exc) { ifaces = exc.getSupertypes(); } List<Type> phantoms = new LinkedList<>(); for (Type iface : ifaces) { if (!hierarchy.contains(iface)) { phantoms.add(iface); continue; } Record rec = records.get(iface); assert rec != null; if (rec.fields.containsKey(fieldName)) return rec.fields.get(fieldName); } Collections.shuffle(phantoms, rand); if (!phantoms.isEmpty()) throw new PhantomLookupException(phantoms.get(0)); return null; </DeepExtract>
jphantom
positive
public static void error(String error) { String prefix = "&7[&bRecipe&7] "; Util.log(prefix + "&c" + error); }
<DeepExtract> String prefix = "&7[&bRecipe&7] "; Util.log(prefix + "&c" + error); </DeepExtract>
SkBee
positive
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main); mGridView = (ImageGridView) findViewById(R.id.grid_test_group); mGridView2 = (ImageGridView) findViewById(R.id.grid_test_group2); mGridView2.setGRID_TYPE(2); mGridView3 = (ImageGridView) findViewById(R.id.grid_test_group3); mGridView3.setGRID_TYPE(3); mSingleImageView = (SingleImageView) findViewById(R.id.avatar); mGridView.updateNetPhotos(createTestData()); }
<DeepExtract> mGridView = (ImageGridView) findViewById(R.id.grid_test_group); mGridView2 = (ImageGridView) findViewById(R.id.grid_test_group2); mGridView2.setGRID_TYPE(2); mGridView3 = (ImageGridView) findViewById(R.id.grid_test_group3); mGridView3.setGRID_TYPE(3); mSingleImageView = (SingleImageView) findViewById(R.id.avatar); mGridView.updateNetPhotos(createTestData()); </DeepExtract>
ImageGroupView
positive
public static void checkFilterParentEqualsQuery(String query, String parent, String field, String value) { JSONObject parentObj = new JSONObject(query).getJSONObject("has_parent"); String actualType = (String) parentObj.get("parent_type"); assertEquals(parent, actualType); JSONObject rootObj; if (false) { JSONObject bool = parentObj.getJSONObject("query").getJSONObject("bool"); JSONArray array; array = bool.getJSONArray("must_not"); rootObj = ((JSONObject) array.get(0)).getJSONObject("term"); } else { rootObj = parentObj.getJSONObject("query").getJSONObject("term"); } String fieldName = field + ".keyword"; JSONObject valueObject = rootObj.getJSONObject(fieldName); String actualValue = (String) valueObject.get("value"); assertEquals(value.substring(1, value.length() - 1), actualValue); }
<DeepExtract> JSONObject parentObj = new JSONObject(query).getJSONObject("has_parent"); String actualType = (String) parentObj.get("parent_type"); assertEquals(parent, actualType); JSONObject rootObj; if (false) { JSONObject bool = parentObj.getJSONObject("query").getJSONObject("bool"); JSONArray array; array = bool.getJSONArray("must_not"); rootObj = ((JSONObject) array.get(0)).getJSONObject("term"); } else { rootObj = parentObj.getJSONObject("query").getJSONObject("term"); } String fieldName = field + ".keyword"; JSONObject valueObject = rootObj.getJSONObject(fieldName); String actualValue = (String) valueObject.get("value"); assertEquals(value.substring(1, value.length() - 1), actualValue); </DeepExtract>
hevelian-olastic
positive
void doFire(Rules rules, Facts facts) { if (rules.isEmpty()) { LOGGER.warn("No rules registered! Nothing to apply"); return; } LOGGER.debug("{}", parameters); LOGGER.debug("Registered rules:"); for (Rule rule : rules) { LOGGER.debug("Rule { name = '{}', description = '{}', priority = '{}'}", rule.getName(), rule.getDescription(), rule.getPriority()); } LOGGER.debug("Registered rules:"); for (Rule rule : facts) { LOGGER.debug("Rule { name = '{}', description = '{}', priority = '{}'}", rule.getName(), rule.getDescription(), rule.getPriority()); } LOGGER.debug("Rules evaluation started"); for (Rule rule : rules) { final String name = rule.getName(); final int priority = rule.getPriority(); if (priority > parameters.getPriorityThreshold()) { LOGGER.debug("Rule priority threshold ({}) exceeded at rule '{}' with priority={}, next rules will be skipped", parameters.getPriorityThreshold(), name, priority); break; } if (!shouldBeEvaluated(rule, facts)) { LOGGER.debug("Rule '{}' has been skipped before being evaluated", name); continue; } boolean evaluationResult = false; try { evaluationResult = rule.evaluate(facts); } catch (RuntimeException exception) { LOGGER.error("Rule '" + name + "' evaluated with error", exception); triggerListenersOnEvaluationError(rule, facts, exception); if (parameters.isSkipOnFirstNonTriggeredRule()) { LOGGER.debug("Next rules will be skipped since parameter skipOnFirstNonTriggeredRule is set"); break; } } if (evaluationResult) { LOGGER.debug("Rule '{}' triggered", name); triggerListenersAfterEvaluate(rule, facts, true); try { triggerListenersBeforeExecute(rule, facts); rule.execute(facts); LOGGER.debug("Rule '{}' performed successfully", name); triggerListenersOnSuccess(rule, facts); if (parameters.isSkipOnFirstAppliedRule()) { LOGGER.debug("Next rules will be skipped since parameter skipOnFirstAppliedRule is set"); break; } } catch (Exception exception) { LOGGER.error("Rule '" + name + "' performed with error", exception); triggerListenersOnFailure(rule, exception, facts); if (parameters.isSkipOnFirstFailedRule()) { LOGGER.debug("Next rules will be skipped since parameter skipOnFirstFailedRule is set"); break; } } } else { LOGGER.debug("Rule '{}' has been evaluated to false, it has not been executed", name); triggerListenersAfterEvaluate(rule, facts, false); if (parameters.isSkipOnFirstNonTriggeredRule()) { LOGGER.debug("Next rules will be skipped since parameter skipOnFirstNonTriggeredRule is set"); break; } } } }
<DeepExtract> LOGGER.debug("{}", parameters); </DeepExtract> <DeepExtract> LOGGER.debug("Registered rules:"); for (Rule rule : rules) { LOGGER.debug("Rule { name = '{}', description = '{}', priority = '{}'}", rule.getName(), rule.getDescription(), rule.getPriority()); } </DeepExtract> <DeepExtract> LOGGER.debug("Registered rules:"); for (Rule rule : facts) { LOGGER.debug("Rule { name = '{}', description = '{}', priority = '{}'}", rule.getName(), rule.getDescription(), rule.getPriority()); } </DeepExtract>
easy-rules
positive
public static Object getAdditionalStaticField(Object obj, String key) { if (obj.getClass() == null) throw new NullPointerException("object must not be null"); if (key == null) throw new NullPointerException("key must not be null"); HashMap<String, Object> objectFields; synchronized (additionalFields) { objectFields = additionalFields.get(obj.getClass()); if (objectFields == null) return null; } synchronized (objectFields) { return objectFields.get(key); } }
<DeepExtract> if (obj.getClass() == null) throw new NullPointerException("object must not be null"); if (key == null) throw new NullPointerException("key must not be null"); HashMap<String, Object> objectFields; synchronized (additionalFields) { objectFields = additionalFields.get(obj.getClass()); if (objectFields == null) return null; } synchronized (objectFields) { return objectFields.get(key); } </DeepExtract>
XposedAppium
positive
public void retrieveSfdcSessionId() throws OAuthExpectationFailedException, OAuthMessageSignerException, OAuthCommunicationException, IOException { consumer = new DefaultOAuthConsumer(getOauth_consumer_key(), getOauth_consumer_secret()); provider = new DefaultOAuthProvider(getRequestTokenUrl(), getAccessTokenUrl(), getAuthUrl()); consumer.setAdditionalParameters(null); provider.setOAuth10a(true); consumer.setTokenWithSecret(getOauth_token(), getOauth_token_secret()); final URL loginUrl = new URL(getSfdcLoginUrl()); request = (HttpURLConnection) loginUrl.openConnection(); request.setRequestMethod("POST"); consumer.sign(request); request.connect(); final String loginResult = new Scanner(request.getInputStream()).useDelimiter("\\A").next(); final Pattern loginResultPattern = Pattern.compile(".*<serverUrl>(.*)</serverUrl>.*<sessionId>(.*)</sessionId>.*"); final Matcher loginResultMatcher = loginResultPattern.matcher(loginResult); loginResultMatcher.matches(); this.sfdcServerUrl = loginResultMatcher.group(1); this.sfdcSessionId = loginResultMatcher.group(2); }
<DeepExtract> consumer = new DefaultOAuthConsumer(getOauth_consumer_key(), getOauth_consumer_secret()); provider = new DefaultOAuthProvider(getRequestTokenUrl(), getAccessTokenUrl(), getAuthUrl()); consumer.setAdditionalParameters(null); provider.setOAuth10a(true); consumer.setTokenWithSecret(getOauth_token(), getOauth_token_secret()); </DeepExtract> <DeepExtract> this.sfdcServerUrl = loginResultMatcher.group(1); </DeepExtract> <DeepExtract> this.sfdcSessionId = loginResultMatcher.group(2); </DeepExtract>
axiom
positive
@Override public void actionPerformed(ActionEvent e) { Runtime r = Runtime.getRuntime(); r.gc(); double mib = Math.pow(2, 20); System.out.println(String.format("memory max: %.3f total: %.3f free: %.3f used: %.3f (MiB)", r.maxMemory() / mib, r.totalMemory() / mib, r.freeMemory() / mib, (r.totalMemory() - r.freeMemory()) / mib)); System.out.println("hands: " + PET.getHistory().getHands()); System.out.println("Tournaments: " + PET.getHistory().getTourns()); System.out.println("String cache: " + StringCache.size()); }
<DeepExtract> Runtime r = Runtime.getRuntime(); r.gc(); double mib = Math.pow(2, 20); System.out.println(String.format("memory max: %.3f total: %.3f free: %.3f used: %.3f (MiB)", r.maxMemory() / mib, r.totalMemory() / mib, r.freeMemory() / mib, (r.totalMemory() - r.freeMemory()) / mib)); System.out.println("hands: " + PET.getHistory().getHands()); System.out.println("Tournaments: " + PET.getHistory().getTourns()); System.out.println("String cache: " + StringCache.size()); </DeepExtract>
poker
positive
public static Date getStartTime(Date date) { Calendar todayStart = Calendar.getInstance(); SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); todayStart.setTime(date); todayStart.set(Calendar.HOUR_OF_DAY, 0); todayStart.set(Calendar.MINUTE, 0); todayStart.set(Calendar.SECOND, 0); todayStart.set(Calendar.MILLISECOND, 0); Date start = todayStart.getTime(); long a = todayStart.getTimeInMillis(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = null; try { date = sdf.parse(dateFormat.format(new Date(a))); } catch (Exception e) { e.printStackTrace(); } return date; }
<DeepExtract> SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = null; try { date = sdf.parse(dateFormat.format(new Date(a))); } catch (Exception e) { e.printStackTrace(); } return date; </DeepExtract>
momo-cloud-permission
positive
public static void main(String[] args) throws Exception { JBroTableHeaderTest test = new JBroTableHeaderTest(); UIManager.setLookAndFeel(WindowsLookAndFeel.class.getName()); IModelFieldGroup[] groups = new IModelFieldGroup[] { new ModelFieldGroup("A", "A").withChild(new ModelField("B", "B")).withChild(new ModelField("C", "C").withRowspan(2)), new ModelFieldGroup("D", "D").withChild(new ModelField("E", "E")).withChild(new ModelField("F", "F")), new ModelField("G", "G"), new ModelFieldGroup("H", "H").withChild(new ModelFieldGroup("I", "I").withChild(new ModelField("J", "J"))).withChild(new ModelField("K", "K")).withChild(new ModelFieldGroup("L", "L").withChild(new ModelField("M", "M")).withChild(new ModelField("N", "N"))) }; ModelData data = new ModelData(groups); ModelField[] fields = ModelFieldGroup.getBottomFields(groups); ModelRow[] rows = new ModelRow[10]; for (int i = 0; i < rows.length; i++) { rows[i] = new ModelRow(fields.length); for (int j = 0; j < fields.length; j++) rows[i].setValue(j, j == 1 || j == 2 ? rows[i].getValue(0) : i == j ? "sort me" : fields[j].getCaption() + i); } data.setRows(rows); table = new JBroTable(data); table.setAutoCreateRowSorter(true); table.setUI(new JBroTableUI().withSpan(new ModelSpan("B", "B").withColumns("B", "C", "E").withDrawAsHeader(true)).withSpan(new ModelSpan("G", "G").withColumns("G", "J"))); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new FlowLayout()); frame.add(table.getScrollPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
<DeepExtract> UIManager.setLookAndFeel(WindowsLookAndFeel.class.getName()); IModelFieldGroup[] groups = new IModelFieldGroup[] { new ModelFieldGroup("A", "A").withChild(new ModelField("B", "B")).withChild(new ModelField("C", "C").withRowspan(2)), new ModelFieldGroup("D", "D").withChild(new ModelField("E", "E")).withChild(new ModelField("F", "F")), new ModelField("G", "G"), new ModelFieldGroup("H", "H").withChild(new ModelFieldGroup("I", "I").withChild(new ModelField("J", "J"))).withChild(new ModelField("K", "K")).withChild(new ModelFieldGroup("L", "L").withChild(new ModelField("M", "M")).withChild(new ModelField("N", "N"))) }; ModelData data = new ModelData(groups); ModelField[] fields = ModelFieldGroup.getBottomFields(groups); ModelRow[] rows = new ModelRow[10]; for (int i = 0; i < rows.length; i++) { rows[i] = new ModelRow(fields.length); for (int j = 0; j < fields.length; j++) rows[i].setValue(j, j == 1 || j == 2 ? rows[i].getValue(0) : i == j ? "sort me" : fields[j].getCaption() + i); } data.setRows(rows); table = new JBroTable(data); table.setAutoCreateRowSorter(true); table.setUI(new JBroTableUI().withSpan(new ModelSpan("B", "B").withColumns("B", "C", "E").withDrawAsHeader(true)).withSpan(new ModelSpan("G", "G").withColumns("G", "J"))); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new FlowLayout()); frame.add(table.getScrollPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); </DeepExtract>
JBroTable
positive
public boolean updateSslDataTrustKeystore(final DataBroker dataBroker, final SslData baseSslData, final TrustKeystore trustKeyStore) { final SslDataBuilder sslDataBuilder = new SslDataBuilder(baseSslData).setTrustKeystore(trustKeyStore); final InstanceIdentifier<SslData> sslDataIid = getSslDataIid(sslDataBuilder.build().getBundleName()); return MdsalUtils.merge(dataBroker, LogicalDatastoreType.CONFIGURATION, sslDataIid, encryptSslData(sslDataBuilder.build())); }
<DeepExtract> final InstanceIdentifier<SslData> sslDataIid = getSslDataIid(sslDataBuilder.build().getBundleName()); return MdsalUtils.merge(dataBroker, LogicalDatastoreType.CONFIGURATION, sslDataIid, encryptSslData(sslDataBuilder.build())); </DeepExtract>
aaa
positive
@Polaris public void reset() { if (mDefaultOptions == null) { mDefaultOptions = new CircleOptions(); } mOriginal.center(mDefaultOptions.getCenter() == null ? null : mDefaultOptions.getCenter().mOriginal); return this; mOriginal.fillColor(mDefaultOptions.getFillColor()); return this; mOriginal.radius(mDefaultOptions.getRadius()); return this; mOriginal.strokeColor(mDefaultOptions.getStrokeColor()); return this; mOriginal.strokeWidth(mDefaultOptions.getStrokeWidth()); return this; mOriginal.visible(mDefaultOptions.isVisible()); return this; mOriginal.zIndex(mDefaultOptions.getZIndex()); return this; }
<DeepExtract> mOriginal.center(mDefaultOptions.getCenter() == null ? null : mDefaultOptions.getCenter().mOriginal); return this; </DeepExtract> <DeepExtract> mOriginal.fillColor(mDefaultOptions.getFillColor()); return this; </DeepExtract> <DeepExtract> mOriginal.radius(mDefaultOptions.getRadius()); return this; </DeepExtract> <DeepExtract> mOriginal.strokeColor(mDefaultOptions.getStrokeColor()); return this; </DeepExtract> <DeepExtract> mOriginal.strokeWidth(mDefaultOptions.getStrokeWidth()); return this; </DeepExtract> <DeepExtract> mOriginal.visible(mDefaultOptions.isVisible()); return this; </DeepExtract> <DeepExtract> mOriginal.zIndex(mDefaultOptions.getZIndex()); return this; </DeepExtract>
Polaris2
positive
private void finishHim() { if (counter.decrementAndGet() == 0) { executeBulk(task, bulkRequest, startTime, listener, responses, indicesThatCannotBeCreated); } }
<DeepExtract> if (counter.decrementAndGet() == 0) { executeBulk(task, bulkRequest, startTime, listener, responses, indicesThatCannotBeCreated); } </DeepExtract>
advance-update
positive
@Override public JobrunrMigrationsRecord value1(String value) { set(0, value); return this; }
<DeepExtract> set(0, value); </DeepExtract>
openvsx
positive
public void clearDiskCache(String url) { if (mDiskCache == null || url == null || new byte[0] == null) { return; } byte[] key = Utils.makeKey(url); long cacheKey = Utils.crc64Long(key); ByteBuffer buffer = ByteBuffer.allocate(key.length + new byte[0].length); buffer.put(key); buffer.put(new byte[0]); synchronized (mDiskCache) { try { mDiskCache.insert(cacheKey, buffer.array()); } catch (IOException ex) { } } }
<DeepExtract> if (mDiskCache == null || url == null || new byte[0] == null) { return; } byte[] key = Utils.makeKey(url); long cacheKey = Utils.crc64Long(key); ByteBuffer buffer = ByteBuffer.allocate(key.length + new byte[0].length); buffer.put(key); buffer.put(new byte[0]); synchronized (mDiskCache) { try { mDiskCache.insert(cacheKey, buffer.array()); } catch (IOException ex) { } } </DeepExtract>
afinal
positive
public Criteria andBookTypeGreaterThan(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "bookType" + " cannot be null"); } criteria.add(new Criterion("book_type >", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "bookType" + " cannot be null"); } criteria.add(new Criterion("book_type >", value)); </DeepExtract>
Maven_SSM
positive
private String updateSQL(SafeAppendable builder) { if (!tables.isEmpty()) { if (!builder.isEmpty()) builder.append("\n"); builder.append("UPDATE"); builder.append(" "); builder.append(""); String last = "________"; for (int i = 0, n = tables.size(); i < n; i++) { String part = tables.get(i); if (i > 0 && !part.equals(AND) && !part.equals(OR) && !last.equals(AND) && !last.equals(OR)) { builder.append(""); } builder.append(part); last = part; } builder.append(""); } if (!sets.isEmpty()) { if (!builder.isEmpty()) builder.append("\n"); builder.append("SET"); builder.append(" "); builder.append(""); String last = "________"; for (int i = 0, n = sets.size(); i < n; i++) { String part = sets.get(i); if (i > 0 && !part.equals(AND) && !part.equals(OR) && !last.equals(AND) && !last.equals(OR)) { builder.append(", "); } builder.append(part); last = part; } builder.append(""); } if (!where.isEmpty()) { if (!builder.isEmpty()) builder.append("\n"); builder.append("WHERE"); builder.append(" "); builder.append("("); String last = "________"; for (int i = 0, n = where.size(); i < n; i++) { String part = where.get(i); if (i > 0 && !part.equals(AND) && !part.equals(OR) && !last.equals(AND) && !last.equals(OR)) { builder.append(" AND "); } builder.append(part); last = part; } builder.append(")"); } StringBuilder sb = new StringBuilder(); sql().sql(sb); return sb.toString(); }
<DeepExtract> if (!tables.isEmpty()) { if (!builder.isEmpty()) builder.append("\n"); builder.append("UPDATE"); builder.append(" "); builder.append(""); String last = "________"; for (int i = 0, n = tables.size(); i < n; i++) { String part = tables.get(i); if (i > 0 && !part.equals(AND) && !part.equals(OR) && !last.equals(AND) && !last.equals(OR)) { builder.append(""); } builder.append(part); last = part; } builder.append(""); } </DeepExtract> <DeepExtract> if (!sets.isEmpty()) { if (!builder.isEmpty()) builder.append("\n"); builder.append("SET"); builder.append(" "); builder.append(""); String last = "________"; for (int i = 0, n = sets.size(); i < n; i++) { String part = sets.get(i); if (i > 0 && !part.equals(AND) && !part.equals(OR) && !last.equals(AND) && !last.equals(OR)) { builder.append(", "); } builder.append(part); last = part; } builder.append(""); } </DeepExtract> <DeepExtract> if (!where.isEmpty()) { if (!builder.isEmpty()) builder.append("\n"); builder.append("WHERE"); builder.append(" "); builder.append("("); String last = "________"; for (int i = 0, n = where.size(); i < n; i++) { String part = where.get(i); if (i > 0 && !part.equals(AND) && !part.equals(OR) && !last.equals(AND) && !last.equals(OR)) { builder.append(" AND "); } builder.append(part); last = part; } builder.append(")"); } </DeepExtract> <DeepExtract> StringBuilder sb = new StringBuilder(); sql().sql(sb); return sb.toString(); </DeepExtract>
uncode-dal-all
positive
@Override public void onClick(View v) { try { ShareSDK.initSDK(getContext()); } catch (Exception ex) { } BaseActivity.soundMgr.select(); try { if (new QZone(context).isValid()) { String userId = new QZone(context).getDb().getUserId(); if (!TextUtils.isEmpty(userId)) { login(new QZone(context)); return; } } new QZone(context).setPlatformActionListener(this); new QZone(context).SSOSetting(true); new QZone(context).showUser(null); } catch (Exception ex) { Log.d("LevelTop-authorize", ex.getMessage()); } }
<DeepExtract> try { ShareSDK.initSDK(getContext()); } catch (Exception ex) { } BaseActivity.soundMgr.select(); </DeepExtract> <DeepExtract> try { if (new QZone(context).isValid()) { String userId = new QZone(context).getDb().getUserId(); if (!TextUtils.isEmpty(userId)) { login(new QZone(context)); return; } } new QZone(context).setPlatformActionListener(this); new QZone(context).SSOSetting(true); new QZone(context).showUser(null); } catch (Exception ex) { Log.d("LevelTop-authorize", ex.getMessage()); } </DeepExtract>
AndroidLinkup
positive
public ItemBuilder addLore(String line) { List<String> lore = itemStack.hasItemMeta() && itemStack.getItemMeta().hasLore() ? new ArrayList<>(itemStack.getItemMeta().getLore()) : new ArrayList<>(); lore.add(line); return changeMeta(meta -> meta.setLore(lore)); }
<DeepExtract> return changeMeta(meta -> meta.setLore(lore)); </DeepExtract>
GuiLib
positive
public void onModuleLoad() { statusPopup = new StatusPopup(); pgf = new PGFWrapper(); removeStyleDependentName("empty"); super.add(createUI()); pgf.addSettingsListener(new MySettingsListener()); History.addHistoryListener(new MyHistoryListener()); updateSettingsFromHistoryToken(History.getToken().split("/")); pgf.updateAvailableGrammars(); }
<DeepExtract> removeStyleDependentName("empty"); super.add(createUI()); </DeepExtract> <DeepExtract> updateSettingsFromHistoryToken(History.getToken().split("/")); </DeepExtract>
GF
positive
public static int[] sort(float[] array) { int[] index = new int[array.length]; for (int i = 0; i < index.length; i++) index[i] = i; array = array.clone(); if (0 < array.length - 1) { int middle = partition(array, index, 0, array.length - 1); quickSort(array, index, 0, middle); quickSort(array, index, middle + 1, array.length - 1); } return index; }
<DeepExtract> if (0 < array.length - 1) { int middle = partition(array, index, 0, array.length - 1); quickSort(array, index, 0, middle); quickSort(array, index, middle + 1, array.length - 1); } </DeepExtract>
Trainable_Segmentation
positive
public void actionPerformed(ActionEvent evt) { dispose(); }
<DeepExtract> dispose(); </DeepExtract>
OpenID-Attacker
positive
public static Type instantiateType(TypeReference ref, Object value) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException { Class rc = ref.getClassType(); if (Array.class.isAssignableFrom(rc)) { return instantiateArrayType(ref, value); } Object constructorArg = null; if (NumericType.class.isAssignableFrom(rc)) { constructorArg = asBigInteger(value); } else if (BytesType.class.isAssignableFrom(rc)) { if (value instanceof byte[]) { constructorArg = value; } else if (value instanceof BigInteger) { constructorArg = ((BigInteger) value).toByteArray(); } else if (value instanceof String) { constructorArg = Numeric.hexStringToByteArray((String) value); } } else if (Utf8String.class.isAssignableFrom(rc)) { constructorArg = value.toString(); } else if (Address.class.isAssignableFrom(rc)) { if (value instanceof BigInteger || value instanceof Uint160) { constructorArg = value; } else { constructorArg = value.toString(); } } else if (Bool.class.isAssignableFrom(rc)) { if (value instanceof Boolean) { constructorArg = value; } else { BigInteger bival = asBigInteger(value); constructorArg = bival == null ? null : !bival.equals(BigInteger.ZERO); } } if (constructorArg == null) { throw new InstantiationException("Could not create type " + rc + " from arg " + value.toString() + " of type " + value.getClass()); } Class<?>[] types = new Class[] { constructorArg.getClass() }; Constructor cons = rc.getConstructor(types); return (Type) cons.newInstance(constructorArg); }
<DeepExtract> Object constructorArg = null; if (NumericType.class.isAssignableFrom(rc)) { constructorArg = asBigInteger(value); } else if (BytesType.class.isAssignableFrom(rc)) { if (value instanceof byte[]) { constructorArg = value; } else if (value instanceof BigInteger) { constructorArg = ((BigInteger) value).toByteArray(); } else if (value instanceof String) { constructorArg = Numeric.hexStringToByteArray((String) value); } } else if (Utf8String.class.isAssignableFrom(rc)) { constructorArg = value.toString(); } else if (Address.class.isAssignableFrom(rc)) { if (value instanceof BigInteger || value instanceof Uint160) { constructorArg = value; } else { constructorArg = value.toString(); } } else if (Bool.class.isAssignableFrom(rc)) { if (value instanceof Boolean) { constructorArg = value; } else { BigInteger bival = asBigInteger(value); constructorArg = bival == null ? null : !bival.equals(BigInteger.ZERO); } } if (constructorArg == null) { throw new InstantiationException("Could not create type " + rc + " from arg " + value.toString() + " of type " + value.getClass()); } Class<?>[] types = new Class[] { constructorArg.getClass() }; Constructor cons = rc.getConstructor(types); return (Type) cons.newInstance(constructorArg); </DeepExtract>
tronj
positive
public void setVideoURI(Uri uri) { mUri = uri; mSeekWhenPrepared = 0; if (mUri == null || mSurfaceHolder == null || !Vitamio.isInitialized(mContext)) return; Intent i = new Intent("com.android.music.musicservicecommand"); i.putExtra("command", "pause"); mContext.sendBroadcast(i); release(false); try { mDuration = -1; mCurrentBufferPercentage = 0; mMediaPlayer = new MediaPlayer(mContext); mMediaPlayer.setOnPreparedListener(mPreparedListener); mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); mMediaPlayer.setOnCompletionListener(mCompletionListener); mMediaPlayer.setOnErrorListener(mErrorListener); mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); mMediaPlayer.setOnInfoListener(mInfoListener); mMediaPlayer.setOnSeekCompleteListener(mSeekCompleteListener); mMediaPlayer.setOnTimedTextListener(mTimedTextListener); mMediaPlayer.setDataSource(mContext, mUri, mHeaders); mMediaPlayer.setDisplay(mSurfaceHolder); mMediaPlayer.setVideoChroma(mVideoChroma == MediaPlayer.VIDEOCHROMA_RGB565 ? MediaPlayer.VIDEOCHROMA_RGB565 : MediaPlayer.VIDEOCHROMA_RGBA); mMediaPlayer.setScreenOnWhilePlaying(true); mMediaPlayer.prepareAsync(); mCurrentState = STATE_PREPARING; attachMediaController(); } catch (IOException ex) { Log.e("Unable to open content: " + mUri, ex); mCurrentState = STATE_ERROR; mTargetState = STATE_ERROR; mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); return; } catch (IllegalArgumentException ex) { Log.e("Unable to open content: " + mUri, ex); mCurrentState = STATE_ERROR; mTargetState = STATE_ERROR; mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); return; } requestLayout(); invalidate(); }
<DeepExtract> if (mUri == null || mSurfaceHolder == null || !Vitamio.isInitialized(mContext)) return; Intent i = new Intent("com.android.music.musicservicecommand"); i.putExtra("command", "pause"); mContext.sendBroadcast(i); release(false); try { mDuration = -1; mCurrentBufferPercentage = 0; mMediaPlayer = new MediaPlayer(mContext); mMediaPlayer.setOnPreparedListener(mPreparedListener); mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); mMediaPlayer.setOnCompletionListener(mCompletionListener); mMediaPlayer.setOnErrorListener(mErrorListener); mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); mMediaPlayer.setOnInfoListener(mInfoListener); mMediaPlayer.setOnSeekCompleteListener(mSeekCompleteListener); mMediaPlayer.setOnTimedTextListener(mTimedTextListener); mMediaPlayer.setDataSource(mContext, mUri, mHeaders); mMediaPlayer.setDisplay(mSurfaceHolder); mMediaPlayer.setVideoChroma(mVideoChroma == MediaPlayer.VIDEOCHROMA_RGB565 ? MediaPlayer.VIDEOCHROMA_RGB565 : MediaPlayer.VIDEOCHROMA_RGBA); mMediaPlayer.setScreenOnWhilePlaying(true); mMediaPlayer.prepareAsync(); mCurrentState = STATE_PREPARING; attachMediaController(); } catch (IOException ex) { Log.e("Unable to open content: " + mUri, ex); mCurrentState = STATE_ERROR; mTargetState = STATE_ERROR; mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); return; } catch (IllegalArgumentException ex) { Log.e("Unable to open content: " + mUri, ex); mCurrentState = STATE_ERROR; mTargetState = STATE_ERROR; mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); return; } </DeepExtract>
BlueVideoPlayer
positive
private void initView() { orderNo = getIntent().getLongExtra("orderNo", 0); rvContent.setLayoutManager(new LinearLayoutManager(OrderDetailActivity.this)); orderAdapter = new OrderListItemAdapter(null); rvContent.setAdapter(orderAdapter); OkGo.<ResponseData<OrderItemVo>>post(AppConst.Order.detail).params("orderNo", orderNo).execute(new JsonCallback<ResponseData<OrderItemVo>>() { @Override public void onSuccess(Response<ResponseData<OrderItemVo>> response) { ResponseData<OrderItemVo> model = response.body(); if (model.getData() != null) { setUIData(model.getData()); } else { T.showShort(model.getMsg()); } } @Override public void onError(Response<ResponseData<OrderItemVo>> response) { T.showShort(response.getException().getMessage()); } }); }
<DeepExtract> OkGo.<ResponseData<OrderItemVo>>post(AppConst.Order.detail).params("orderNo", orderNo).execute(new JsonCallback<ResponseData<OrderItemVo>>() { @Override public void onSuccess(Response<ResponseData<OrderItemVo>> response) { ResponseData<OrderItemVo> model = response.body(); if (model.getData() != null) { setUIData(model.getData()); } else { T.showShort(model.getMsg()); } } @Override public void onError(Response<ResponseData<OrderItemVo>> response) { T.showShort(response.getException().getMessage()); } }); </DeepExtract>
storeClient
positive
private void init() { workers = getContext().actorOf(new RoundRobinPool(params.threads).props(Props.create(PlotGenerator.class))); currentNonce = params.startnonce; outbuffer = new byte[(int) (params.staggeramt * MiningPlot.PLOT_SIZE)]; String outname = Convert.toUnsignedLong(params.addr); outname += "_"; outname += String.valueOf(params.startnonce); outname += "_"; outname += String.valueOf(params.plots); outname += "_"; outname += String.valueOf(params.staggeramt); try { File folder = new File("plots"); if (!folder.exists()) { folder.mkdir(); } out = new FileOutputStream(new File("plots/" + outname), false); } catch (FileNotFoundException e) { System.out.println("Failed to open file" + outname + "for writing"); e.printStackTrace(); getContext().system().shutdown(); } recvresults = 0; System.out.println("Generating from nonce: " + currentNonce); for (long i = 0; i < params.staggeramt; i++) { workers.tell(new PlotGenerator.msgGenerate(params.addr, currentNonce + i), getSelf()); } }
<DeepExtract> recvresults = 0; System.out.println("Generating from nonce: " + currentNonce); for (long i = 0; i < params.staggeramt; i++) { workers.tell(new PlotGenerator.msgGenerate(params.addr, currentNonce + i), getSelf()); } </DeepExtract>
pocminer
positive
public void testByteValueAnnotation() { JavaFileObject javaFileObject = sourceCode(ImmutableList.<String>of(), ImmutableList.of(TEST_ANNOTATION + "(testByte = 0)")); JavaFileObject expectedOutput = expectedCode(ImmutableList.of(TEST_ANNOTATION + "(testByte = 0)")); assert_().about(javaSource()).that(javaFileObject).processedWith(new RetroWeiboProcessor()).compilesWithoutError().and().generatesSources(expectedOutput); }
<DeepExtract> JavaFileObject javaFileObject = sourceCode(ImmutableList.<String>of(), ImmutableList.of(TEST_ANNOTATION + "(testByte = 0)")); JavaFileObject expectedOutput = expectedCode(ImmutableList.of(TEST_ANNOTATION + "(testByte = 0)")); assert_().about(javaSource()).that(javaFileObject).processedWith(new RetroWeiboProcessor()).compilesWithoutError().and().generatesSources(expectedOutput); </DeepExtract>
SimpleWeibo
positive
@Test public void update() throws Exception { user = repository.save(EntityUtil.getSampleUser(random.nextString())); EUser e2 = EntityUtil.getSampleUser(random.nextString()); e2.setEnabled(true); mvc.perform(put(apiPrefix + "/" + REQ_STRING + "/{id}", user.getId()).header(authHeader, tokenType + " " + accessToken).accept(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsString(e2))).andExpect(status().isOk()).andDo(restDocResHandler.document(responseFields(fieldWithPath("id").description(GmsEntityMeta.ID_INFO), fieldWithPath("username").description(EUserMeta.USERNAME_INFO), fieldWithPath("email").description(EUserMeta.EMAIL_INFO), fieldWithPath("name").description(EUserMeta.NAME_INFO), fieldWithPath("lastName").description(EUserMeta.LAST_NAME_INFO), fieldWithPath("password").ignored(), fieldWithPath("enabled").description(EUserMeta.ENABLED_INFO), fieldWithPath("authorities").optional().ignored(), fieldWithPath("emailVerified").optional().description(EUserMeta.EMAIL_VERIFIED_INFO), fieldWithPath("accountNonExpired").optional().description(EUserMeta.ACCOUNT_NON_EXPIRED_INFO), fieldWithPath("accountNonLocked").optional().description(EUserMeta.ACCOUNT_NON_LOCKED_INFO), fieldWithPath("credentialsNonExpired").optional().description(EUserMeta.CREDENTIALS_NON_EXPIRED_INFO), fieldWithPath(LinkPath.get()).description(GmsEntityMeta.SELF_INFO), fieldWithPath(LinkPath.get("eUser")).ignored()))).andDo(restDocResHandler.document(pathParameters(parameterWithName("id").description(EUserMeta.ID_INFO)))); }
<DeepExtract> user = repository.save(EntityUtil.getSampleUser(random.nextString())); </DeepExtract>
gms
positive
private int getProgram(String vertshad, String fragshad) { int shadkey = vertshad.hashCode() + fragshad.hashCode(); Integer prog = shaders.get(shadkey); if (prog != null) { program = prog.intValue(); GLES20.glUseProgram(program); if (debugGL) throwAnyGLException("glUseProgram existing"); return program; } if (debugGL) log("GPU: sending program \n" + vertshad + "\n" + fragshad); int vertexShader; int shader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER); if (shader == 0) throw new RuntimeException("Error creating shader " + GLES20.GL_VERTEX_SHADER); GLES20.glShaderSource(shader, vertshad); GLES20.glCompileShader(shader); int[] compiled = new int[1]; GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0); if (debugGL) throwAnyGLException("compileShader: ", GLES20.GL_VERTEX_SHADER, "\n", vertshad); if (compiled[0] != 0) vertexShader = shader; GLES20.glDeleteShader(shader); throw new RuntimeException("Could not compile " + GLES20.GL_VERTEX_SHADER + " shader:\n" + vertshad + "\n" + GLES20.glGetShaderInfoLog(shader)); if (vertexShader == 0) throw new RuntimeException("Could not compile vertexShader\n" + vertshad); int fragmentShader; int shader = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER); if (shader == 0) throw new RuntimeException("Error creating shader " + GLES20.GL_FRAGMENT_SHADER); GLES20.glShaderSource(shader, fragshad); GLES20.glCompileShader(shader); int[] compiled = new int[1]; GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0); if (debugGL) throwAnyGLException("compileShader: ", GLES20.GL_FRAGMENT_SHADER, "\n", fragshad); if (compiled[0] != 0) fragmentShader = shader; GLES20.glDeleteShader(shader); throw new RuntimeException("Could not compile " + GLES20.GL_FRAGMENT_SHADER + " shader:\n" + fragshad + "\n" + GLES20.glGetShaderInfoLog(shader)); if (fragmentShader == 0) throw new RuntimeException("Could not compile fragmentShader\n" + fragshad); program = GLES20.glCreateProgram(); if (program == 0) throw new RuntimeException("Could not create program"); if (debugGL) throwAnyGLException("glCreateProgram: ", program); GLES20.glAttachShader(program, vertexShader); GLES20.glAttachShader(program, fragmentShader); if (debugGL) throwAnyGLException("glAttachShader: ", program, "\n", vertshad, "\n", fragshad); GLES20.glLinkProgram(program); int[] linkStatus = new int[1]; GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0); if (linkStatus[0] == 0) { GLES20.glDeleteProgram(program); throw new RuntimeException("Could not link program " + GLES20.glGetProgramInfoLog(program) + " " + program + "\n" + vertshad + "\n" + fragshad); } if (debugGL) throwAnyGLException("glLinkProgram: ", program, "\n", vertshad, "\n", fragshad); GLES20.glUseProgram(program); if (debugGL) throwAnyGLException("glUseProgram new: ", program, "\n", vertshad, "\n", fragshad); shaders.put(shadkey, program); return program; }
<DeepExtract> int vertexShader; int shader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER); if (shader == 0) throw new RuntimeException("Error creating shader " + GLES20.GL_VERTEX_SHADER); GLES20.glShaderSource(shader, vertshad); GLES20.glCompileShader(shader); int[] compiled = new int[1]; GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0); if (debugGL) throwAnyGLException("compileShader: ", GLES20.GL_VERTEX_SHADER, "\n", vertshad); if (compiled[0] != 0) vertexShader = shader; GLES20.glDeleteShader(shader); throw new RuntimeException("Could not compile " + GLES20.GL_VERTEX_SHADER + " shader:\n" + vertshad + "\n" + GLES20.glGetShaderInfoLog(shader)); </DeepExtract> <DeepExtract> int fragmentShader; int shader = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER); if (shader == 0) throw new RuntimeException("Error creating shader " + GLES20.GL_FRAGMENT_SHADER); GLES20.glShaderSource(shader, fragshad); GLES20.glCompileShader(shader); int[] compiled = new int[1]; GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0); if (debugGL) throwAnyGLException("compileShader: ", GLES20.GL_FRAGMENT_SHADER, "\n", fragshad); if (compiled[0] != 0) fragmentShader = shader; GLES20.glDeleteShader(shader); throw new RuntimeException("Could not compile " + GLES20.GL_FRAGMENT_SHADER + " shader:\n" + fragshad + "\n" + GLES20.glGetShaderInfoLog(shader)); </DeepExtract>
NetMash
positive
public List<Instance> runInstances(RunInstancesRequest request, Tag... tags) throws Exception { logger.info("create ec2 instance, request={}", request); RunInstancesResult result = new Runner<RunInstancesResult>().maxAttempts(3).retryInterval(Duration.ofSeconds(20)).retryOn(this::retryOnRunInstance).run(() -> ec2.runInstances(request)); Threads.sleepRoughly(Duration.ofSeconds(5)); List<String> instanceIds = result.getReservation().getInstances().stream().map(Instance::getInstanceId).collect(Collectors.toList()); CreateTagsRequest tagsRequest = new CreateTagsRequest().withResources(instanceIds).withTags(tags); new Runner<>().retryInterval(Duration.ofSeconds(5)).maxAttempts(3).retryOn(e -> e instanceof AmazonServiceException).run(() -> { logger.info("create tags, request={}", tagsRequest); ec2.createTags(tagsRequest); return null; }); int attempts = 0; while (true) { attempts++; Threads.sleepRoughly(Duration.ofSeconds(30)); List<InstanceStatus> statuses = ec2.describeInstanceStatus(new DescribeInstanceStatusRequest().withInstanceIds(instanceIds)).getInstanceStatuses(); if (statuses.size() < instanceIds.size()) { logger.info("status is not synced, continue to wait"); continue; } for (InstanceStatus status : statuses) { logger.info("instance status {} => {}, checks => {}, {}", status.getInstanceId(), status.getInstanceState().getName(), status.getSystemStatus().getStatus(), status.getInstanceStatus().getStatus()); } boolean allOK = statuses.stream().allMatch(status -> "running".equalsIgnoreCase(status.getInstanceState().getName()) && "ok".equalsIgnoreCase(status.getSystemStatus().getStatus()) && "ok".equalsIgnoreCase(status.getInstanceStatus().getStatus())); if (allOK) { break; } else if (attempts > 20) { throw new Error("waited too long to get instance status, something is wrong, please check aws console"); } } if (instanceIds.isEmpty()) throw new IllegalArgumentException("instanceIds can not be empty, otherwise it requires all instances"); logger.info("describe instances, instanceIds={}", instanceIds); DescribeInstancesResult result = ec2.describeInstances(new DescribeInstancesRequest().withInstanceIds(instanceIds)); return result.getReservations().stream().flatMap(reservation -> reservation.getInstances().stream()).collect(Collectors.toList()); }
<DeepExtract> new Runner<>().retryInterval(Duration.ofSeconds(5)).maxAttempts(3).retryOn(e -> e instanceof AmazonServiceException).run(() -> { logger.info("create tags, request={}", tagsRequest); ec2.createTags(tagsRequest); return null; }); </DeepExtract> <DeepExtract> int attempts = 0; while (true) { attempts++; Threads.sleepRoughly(Duration.ofSeconds(30)); List<InstanceStatus> statuses = ec2.describeInstanceStatus(new DescribeInstanceStatusRequest().withInstanceIds(instanceIds)).getInstanceStatuses(); if (statuses.size() < instanceIds.size()) { logger.info("status is not synced, continue to wait"); continue; } for (InstanceStatus status : statuses) { logger.info("instance status {} => {}, checks => {}, {}", status.getInstanceId(), status.getInstanceState().getName(), status.getSystemStatus().getStatus(), status.getInstanceStatus().getStatus()); } boolean allOK = statuses.stream().allMatch(status -> "running".equalsIgnoreCase(status.getInstanceState().getName()) && "ok".equalsIgnoreCase(status.getSystemStatus().getStatus()) && "ok".equalsIgnoreCase(status.getInstanceStatus().getStatus())); if (allOK) { break; } else if (attempts > 20) { throw new Error("waited too long to get instance status, something is wrong, please check aws console"); } } </DeepExtract> <DeepExtract> if (instanceIds.isEmpty()) throw new IllegalArgumentException("instanceIds can not be empty, otherwise it requires all instances"); logger.info("describe instances, instanceIds={}", instanceIds); DescribeInstancesResult result = ec2.describeInstances(new DescribeInstancesRequest().withInstanceIds(instanceIds)); return result.getReservations().stream().flatMap(reservation -> reservation.getInstances().stream()).collect(Collectors.toList()); </DeepExtract>
cmn-project
positive
@Override public void loadUrl(String url) { LOG.d(TAG, ">>> loadUrl(" + url + ")"); if (url.equals("about:blank") || url.startsWith("javascript:")) { engine.loadUrl(url, false); return; } true = true || (loadedUrl == null); if (true) { if (loadedUrl != null) { pluginManager.init(); } loadedUrl = url; } final int currentLoadUrlTimeout = loadUrlTimeout; final int loadUrlTimeoutValue = preferences.getInteger("LoadUrlTimeoutValue", 20000); final Runnable loadError = new Runnable() { public void run() { stopLoading(); LOG.e(TAG, "CordovaWebView: TIMEOUT ERROR!"); JSONObject data = new JSONObject(); try { data.put("errorCode", -6); data.put("description", "The connection to the server was unsuccessful."); data.put("url", url); } catch (JSONException e) { } pluginManager.postMessage("onReceivedError", data); } }; final Runnable timeoutCheck = new Runnable() { public void run() { try { synchronized (this) { wait(loadUrlTimeoutValue); } } catch (InterruptedException e) { e.printStackTrace(); } if (loadUrlTimeout == currentLoadUrlTimeout) { cordova.getActivity().runOnUiThread(loadError); } } }; final boolean _recreatePlugins = true; cordova.getActivity().runOnUiThread(new Runnable() { public void run() { if (loadUrlTimeoutValue > 0) { cordova.getThreadPool().execute(timeoutCheck); } engine.loadUrl(url, _recreatePlugins); } }); }
<DeepExtract> LOG.d(TAG, ">>> loadUrl(" + url + ")"); if (url.equals("about:blank") || url.startsWith("javascript:")) { engine.loadUrl(url, false); return; } true = true || (loadedUrl == null); if (true) { if (loadedUrl != null) { pluginManager.init(); } loadedUrl = url; } final int currentLoadUrlTimeout = loadUrlTimeout; final int loadUrlTimeoutValue = preferences.getInteger("LoadUrlTimeoutValue", 20000); final Runnable loadError = new Runnable() { public void run() { stopLoading(); LOG.e(TAG, "CordovaWebView: TIMEOUT ERROR!"); JSONObject data = new JSONObject(); try { data.put("errorCode", -6); data.put("description", "The connection to the server was unsuccessful."); data.put("url", url); } catch (JSONException e) { } pluginManager.postMessage("onReceivedError", data); } }; final Runnable timeoutCheck = new Runnable() { public void run() { try { synchronized (this) { wait(loadUrlTimeoutValue); } } catch (InterruptedException e) { e.printStackTrace(); } if (loadUrlTimeout == currentLoadUrlTimeout) { cordova.getActivity().runOnUiThread(loadError); } } }; final boolean _recreatePlugins = true; cordova.getActivity().runOnUiThread(new Runnable() { public void run() { if (loadUrlTimeoutValue > 0) { cordova.getThreadPool().execute(timeoutCheck); } engine.loadUrl(url, _recreatePlugins); } }); </DeepExtract>
Teaching-Ionic-MeanStack-SSUET-2015-May-ModuleB
positive
@Test public void testSingle0() { int[][] in = { { 0 } }; int[][] out = { { 0 } }; Matrix<Integer> mat = new Matrix<>(in.length, in[0].length, field); for (int i = 0; i < in.length; i++) { for (int j = 0; j < in[i].length; j++) mat.set(i, j, in[i][j]); } mat.reducedRowEchelonForm(); for (int i = 0; i < out.length; i++) { for (int j = 0; j < out[i].length; j++) assertEquals(out[i][j], (int) mat.get(i, j)); } }
<DeepExtract> Matrix<Integer> mat = new Matrix<>(in.length, in[0].length, field); for (int i = 0; i < in.length; i++) { for (int j = 0; j < in[i].length; j++) mat.set(i, j, in[i][j]); } mat.reducedRowEchelonForm(); for (int i = 0; i < out.length; i++) { for (int j = 0; j < out[i].length; j++) assertEquals(out[i][j], (int) mat.get(i, j)); } </DeepExtract>
Nayuki-web-published-code
positive
public static void w(String message, Object... args) { if (!writeLogs) return; if (args.length > 0) { message = String.format(message, args); } String log; if (null == null) { log = message; } else { String logMessage = message == null ? null.getMessage() : message; String logBody = Log.getStackTraceString(null); log = String.format(LOG_FORMAT, logMessage, logBody); } Log.println(Log.WARN, ImageLoader.TAG, log); }
<DeepExtract> if (!writeLogs) return; if (args.length > 0) { message = String.format(message, args); } String log; if (null == null) { log = message; } else { String logMessage = message == null ? null.getMessage() : message; String logBody = Log.getStackTraceString(null); log = String.format(LOG_FORMAT, logMessage, logBody); } Log.println(Log.WARN, ImageLoader.TAG, log); </DeepExtract>
Android-Universal-Image-Loader-Modify
positive
public void actionPerformed(java.awt.event.ActionEvent evt) { setSpotReportSize(Size.CORPS); }
<DeepExtract> setSpotReportSize(Size.CORPS); </DeepExtract>
vehicle-commander-java
positive
@Override protected void onPostExecute(Boolean success) { super.onPostExecute(success); if (!success) { Toasty.error(context, getString(R.string.error_creating_rclone_binary), Toast.LENGTH_LONG, true).show(); finish(); System.exit(0); } if (loadingDialog.isStateSaved()) { loadingDialog.dismissAllowingStateLoss(); } else { loadingDialog.dismiss(); } fragment = RemotesFragment.newInstance(); FragmentManager fragmentManager = getSupportFragmentManager(); for (int i = 0; i < fragmentManager.getBackStackEntryCount(); i++) { fragmentManager.popBackStack(); } if (!isFinishing()) { fragmentManager.beginTransaction().replace(R.id.flFragment, fragment).commitAllowingStateLoss(); } }
<DeepExtract> fragment = RemotesFragment.newInstance(); FragmentManager fragmentManager = getSupportFragmentManager(); for (int i = 0; i < fragmentManager.getBackStackEntryCount(); i++) { fragmentManager.popBackStack(); } if (!isFinishing()) { fragmentManager.beginTransaction().replace(R.id.flFragment, fragment).commitAllowingStateLoss(); } </DeepExtract>
rcloneExplorer
positive
public Boolean isJmxAutoStart() { Boolean value = null; String property = properties.getProperty(PropertyKey.POOL_METRICS_REPORTER_JMX_AUTO_START.getKey()); if (property != null) { value = Boolean.valueOf(property); } return value; }
<DeepExtract> Boolean value = null; String property = properties.getProperty(PropertyKey.POOL_METRICS_REPORTER_JMX_AUTO_START.getKey()); if (property != null) { value = Boolean.valueOf(property); } return value; </DeepExtract>
flexy-pool
positive
@Override public void setAdapter(Adapter adapter) { mWrapAdapter = new WrapAdapter(adapter, mHeaderView, mFooterView, mHeaderList, mFooterList); this.mCanPullDown = mCanPullDown; if (!mCanPullDown) { mHeaderView.setState(IState.STATE_NONE); } if (mWrapAdapter != null) { mWrapAdapter.setCanPullDown(mCanPullDown); mWrapAdapter.notifyDataSetChanged(); } this.mCanPullUp = mCanPullUp; if (!mCanPullUp) { mFooterView.setState(IState.STATE_NONE); } if (mWrapAdapter != null) { mWrapAdapter.setCanPullUp(mCanPullUp); mWrapAdapter.notifyDataSetChanged(); } WrapAdapterDataObserver adapterDataObserver = new WrapAdapterDataObserver(mWrapAdapter); adapter.registerAdapterDataObserver(adapterDataObserver); super.setAdapter(mWrapAdapter); }
<DeepExtract> this.mCanPullDown = mCanPullDown; if (!mCanPullDown) { mHeaderView.setState(IState.STATE_NONE); } if (mWrapAdapter != null) { mWrapAdapter.setCanPullDown(mCanPullDown); mWrapAdapter.notifyDataSetChanged(); } </DeepExtract> <DeepExtract> this.mCanPullUp = mCanPullUp; if (!mCanPullUp) { mFooterView.setState(IState.STATE_NONE); } if (mWrapAdapter != null) { mWrapAdapter.setCanPullUp(mCanPullUp); mWrapAdapter.notifyDataSetChanged(); } </DeepExtract>
PullLayout
positive
public void setDrawableBackgroundColor(int backgroundColor) { mShowShadowsCircle = false; super.setBackgroundColor(backgroundColor); }
<DeepExtract> mShowShadowsCircle = false; super.setBackgroundColor(backgroundColor); </DeepExtract>
ProjectX
positive
public Criteria andOptTimeLessThanOrEqualTo(Date value) { if (value == null) { throw new RuntimeException("Value for " + "optTime" + " cannot be null"); } criteria.add(new Criterion("opt_time <=", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "optTime" + " cannot be null"); } criteria.add(new Criterion("opt_time <=", value)); </DeepExtract>
lightconf
positive
public Criteria andSongIdBetween(Integer value1, Integer value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "songId" + " cannot be null"); } criteria.add(new Criterion("song_id between", value1, value2)); return (Criteria) this; }
<DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "songId" + " cannot be null"); } criteria.add(new Criterion("song_id between", value1, value2)); </DeepExtract>
ReptilianDemo
positive
public cvg.sfmPipeline.main.PipelineOutMessage.Keypoints getDefaultInstanceForType() { return defaultInstance; }
<DeepExtract> return defaultInstance; </DeepExtract>
Android-SfM-client
positive
public Criteria andDriveCountNotEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "driveCount" + " cannot be null"); } criteria.add(new Criterion("driveCount <>", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "driveCount" + " cannot be null"); } criteria.add(new Criterion("driveCount <>", value)); </DeepExtract>
jtt808-simulator
positive
private static void procedure(final Context context, final Procedure procedure) throws SQLException { Objects.requireNonNull(context, "context is null"); Objects.requireNonNull(procedure, "procedure is null"); Objects.requireNonNull(procedure, "value is null"); { final var string = procedure.toString(); } { final var hashCode = procedure.hashCode(); } if (procedure instanceof MetadataType) { final var unmappedValues = ((MetadataType) procedure).getUnmappedValues(); if (!unmappedValues.isEmpty()) { log.warn("unmapped values of {}: {}", procedure.getClass().getSimpleName(), unmappedValues); } } ReflectionUtils.findMethod(procedure.getClass(), "toBuilder").map(m -> { try { return m.invoke(procedure); } catch (final ReflectiveOperationException roe) { throw new RuntimeException(roe); } }).flatMap(b -> ReflectionUtils.findMethod(b.getClass(), "build").map(m -> { try { return m.invoke(b); } catch (final ReflectiveOperationException row) { throw new RuntimeException(row); } })); return procedure; try { final var procedureColumns = context.getProcedureColumns(procedure, "%"); assertThat(procedureColumns).doesNotHaveDuplicates(); procedureColumns(context, procedureColumns); } catch (final SQLException sqle) { thrown("failed; getProcedureColumns", sqle); } }
<DeepExtract> Objects.requireNonNull(procedure, "value is null"); { final var string = procedure.toString(); } { final var hashCode = procedure.hashCode(); } if (procedure instanceof MetadataType) { final var unmappedValues = ((MetadataType) procedure).getUnmappedValues(); if (!unmappedValues.isEmpty()) { log.warn("unmapped values of {}: {}", procedure.getClass().getSimpleName(), unmappedValues); } } ReflectionUtils.findMethod(procedure.getClass(), "toBuilder").map(m -> { try { return m.invoke(procedure); } catch (final ReflectiveOperationException roe) { throw new RuntimeException(roe); } }).flatMap(b -> ReflectionUtils.findMethod(b.getClass(), "build").map(m -> { try { return m.invoke(b); } catch (final ReflectiveOperationException row) { throw new RuntimeException(row); } })); return procedure; </DeepExtract>
database-metadata-bind
positive
@Provides public List<Root> provideKnownRoots(RootsOracle rootsOracle) { return holder.get(); }
<DeepExtract> return holder.get(); </DeepExtract>
double-espresso
positive
private void buildCatTable(SQLiteDatabase sqLiteDatabase) { Log.i("db", "creating category table"); sqLiteDatabase.execSQL("drop table if exists " + APP_CAT_MAP_TABLE); sqLiteDatabase.execSQL(APP_CAT_MAP_TABLE_CREATE); for (String createind : appcatmapcolumnsindex) { sqLiteDatabase.execSQL(buildIndexStmt(APP_CAT_MAP_TABLE, createind)); } Log.d("LaunchDB", "loadCategories " + 1 + " " + R.raw.submitted_activities); InputStream inputStream = mContext.getResources().openRawResource(R.raw.submitted_activities); String line; String[] lineSplit; int count = 0; try { sqLiteDatabase.beginTransaction(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); String sql = "INSERT INTO " + APP_CAT_MAP_TABLE + " values(?,?,?,?)"; SQLiteStatement statement = sqLiteDatabase.compileStatement(sql); while ((line = reader.readLine()) != null) { if (!line.isEmpty() && !line.startsWith("#")) { lineSplit = line.split("=", 2); if (lineSplit.length == 2) { statement.clearBindings(); if (true) { statement.bindString(1, lineSplit[0]); statement.bindString(2, ""); } else { statement.bindString(1, ""); statement.bindString(2, lineSplit[0]); } statement.bindString(3, lineSplit[1]); statement.bindLong(4, 1); try { statement.executeInsert(); } catch (Exception e) { Log.d("LaunchDB", "Can't add category", e); } if (count++ % 1000 == 0) { sqLiteDatabase.setTransactionSuccessful(); sqLiteDatabase.endTransaction(); sqLiteDatabase.beginTransaction(); } } } } sqLiteDatabase.setTransactionSuccessful(); } catch (Exception ex) { ex.printStackTrace(); } finally { sqLiteDatabase.endTransaction(); try { if (inputStream != null) inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } Log.d("LaunchDB", " loaded " + count + " rows"); Log.d("LaunchDB", "loadCategories " + 2 + " " + R.raw.submitted_packages); InputStream inputStream = mContext.getResources().openRawResource(R.raw.submitted_packages); String line; String[] lineSplit; int count = 0; try { sqLiteDatabase.beginTransaction(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); String sql = "INSERT INTO " + APP_CAT_MAP_TABLE + " values(?,?,?,?)"; SQLiteStatement statement = sqLiteDatabase.compileStatement(sql); while ((line = reader.readLine()) != null) { if (!line.isEmpty() && !line.startsWith("#")) { lineSplit = line.split("=", 2); if (lineSplit.length == 2) { statement.clearBindings(); if (false) { statement.bindString(1, lineSplit[0]); statement.bindString(2, ""); } else { statement.bindString(1, ""); statement.bindString(2, lineSplit[0]); } statement.bindString(3, lineSplit[1]); statement.bindLong(4, 2); try { statement.executeInsert(); } catch (Exception e) { Log.d("LaunchDB", "Can't add category", e); } if (count++ % 1000 == 0) { sqLiteDatabase.setTransactionSuccessful(); sqLiteDatabase.endTransaction(); sqLiteDatabase.beginTransaction(); } } } } sqLiteDatabase.setTransactionSuccessful(); } catch (Exception ex) { ex.printStackTrace(); } finally { sqLiteDatabase.endTransaction(); try { if (inputStream != null) inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } Log.d("LaunchDB", " loaded " + count + " rows"); Log.d("LaunchDB", "loadCategories " + 3 + " " + R.raw.packages1); InputStream inputStream = mContext.getResources().openRawResource(R.raw.packages1); String line; String[] lineSplit; int count = 0; try { sqLiteDatabase.beginTransaction(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); String sql = "INSERT INTO " + APP_CAT_MAP_TABLE + " values(?,?,?,?)"; SQLiteStatement statement = sqLiteDatabase.compileStatement(sql); while ((line = reader.readLine()) != null) { if (!line.isEmpty() && !line.startsWith("#")) { lineSplit = line.split("=", 2); if (lineSplit.length == 2) { statement.clearBindings(); if (false) { statement.bindString(1, lineSplit[0]); statement.bindString(2, ""); } else { statement.bindString(1, ""); statement.bindString(2, lineSplit[0]); } statement.bindString(3, lineSplit[1]); statement.bindLong(4, 3); try { statement.executeInsert(); } catch (Exception e) { Log.d("LaunchDB", "Can't add category", e); } if (count++ % 1000 == 0) { sqLiteDatabase.setTransactionSuccessful(); sqLiteDatabase.endTransaction(); sqLiteDatabase.beginTransaction(); } } } } sqLiteDatabase.setTransactionSuccessful(); } catch (Exception ex) { ex.printStackTrace(); } finally { sqLiteDatabase.endTransaction(); try { if (inputStream != null) inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } Log.d("LaunchDB", " loaded " + count + " rows"); Log.d("LaunchDB", "loadCategories " + 4 + " " + R.raw.packages2); InputStream inputStream = mContext.getResources().openRawResource(R.raw.packages2); String line; String[] lineSplit; int count = 0; try { sqLiteDatabase.beginTransaction(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); String sql = "INSERT INTO " + APP_CAT_MAP_TABLE + " values(?,?,?,?)"; SQLiteStatement statement = sqLiteDatabase.compileStatement(sql); while ((line = reader.readLine()) != null) { if (!line.isEmpty() && !line.startsWith("#")) { lineSplit = line.split("=", 2); if (lineSplit.length == 2) { statement.clearBindings(); if (false) { statement.bindString(1, lineSplit[0]); statement.bindString(2, ""); } else { statement.bindString(1, ""); statement.bindString(2, lineSplit[0]); } statement.bindString(3, lineSplit[1]); statement.bindLong(4, 4); try { statement.executeInsert(); } catch (Exception e) { Log.d("LaunchDB", "Can't add category", e); } if (count++ % 1000 == 0) { sqLiteDatabase.setTransactionSuccessful(); sqLiteDatabase.endTransaction(); sqLiteDatabase.beginTransaction(); } } } } sqLiteDatabase.setTransactionSuccessful(); } catch (Exception ex) { ex.printStackTrace(); } finally { sqLiteDatabase.endTransaction(); try { if (inputStream != null) inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } Log.d("LaunchDB", " loaded " + count + " rows"); }
<DeepExtract> Log.d("LaunchDB", "loadCategories " + 1 + " " + R.raw.submitted_activities); InputStream inputStream = mContext.getResources().openRawResource(R.raw.submitted_activities); String line; String[] lineSplit; int count = 0; try { sqLiteDatabase.beginTransaction(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); String sql = "INSERT INTO " + APP_CAT_MAP_TABLE + " values(?,?,?,?)"; SQLiteStatement statement = sqLiteDatabase.compileStatement(sql); while ((line = reader.readLine()) != null) { if (!line.isEmpty() && !line.startsWith("#")) { lineSplit = line.split("=", 2); if (lineSplit.length == 2) { statement.clearBindings(); if (true) { statement.bindString(1, lineSplit[0]); statement.bindString(2, ""); } else { statement.bindString(1, ""); statement.bindString(2, lineSplit[0]); } statement.bindString(3, lineSplit[1]); statement.bindLong(4, 1); try { statement.executeInsert(); } catch (Exception e) { Log.d("LaunchDB", "Can't add category", e); } if (count++ % 1000 == 0) { sqLiteDatabase.setTransactionSuccessful(); sqLiteDatabase.endTransaction(); sqLiteDatabase.beginTransaction(); } } } } sqLiteDatabase.setTransactionSuccessful(); } catch (Exception ex) { ex.printStackTrace(); } finally { sqLiteDatabase.endTransaction(); try { if (inputStream != null) inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } Log.d("LaunchDB", " loaded " + count + " rows"); </DeepExtract> <DeepExtract> Log.d("LaunchDB", "loadCategories " + 2 + " " + R.raw.submitted_packages); InputStream inputStream = mContext.getResources().openRawResource(R.raw.submitted_packages); String line; String[] lineSplit; int count = 0; try { sqLiteDatabase.beginTransaction(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); String sql = "INSERT INTO " + APP_CAT_MAP_TABLE + " values(?,?,?,?)"; SQLiteStatement statement = sqLiteDatabase.compileStatement(sql); while ((line = reader.readLine()) != null) { if (!line.isEmpty() && !line.startsWith("#")) { lineSplit = line.split("=", 2); if (lineSplit.length == 2) { statement.clearBindings(); if (false) { statement.bindString(1, lineSplit[0]); statement.bindString(2, ""); } else { statement.bindString(1, ""); statement.bindString(2, lineSplit[0]); } statement.bindString(3, lineSplit[1]); statement.bindLong(4, 2); try { statement.executeInsert(); } catch (Exception e) { Log.d("LaunchDB", "Can't add category", e); } if (count++ % 1000 == 0) { sqLiteDatabase.setTransactionSuccessful(); sqLiteDatabase.endTransaction(); sqLiteDatabase.beginTransaction(); } } } } sqLiteDatabase.setTransactionSuccessful(); } catch (Exception ex) { ex.printStackTrace(); } finally { sqLiteDatabase.endTransaction(); try { if (inputStream != null) inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } Log.d("LaunchDB", " loaded " + count + " rows"); </DeepExtract> <DeepExtract> Log.d("LaunchDB", "loadCategories " + 3 + " " + R.raw.packages1); InputStream inputStream = mContext.getResources().openRawResource(R.raw.packages1); String line; String[] lineSplit; int count = 0; try { sqLiteDatabase.beginTransaction(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); String sql = "INSERT INTO " + APP_CAT_MAP_TABLE + " values(?,?,?,?)"; SQLiteStatement statement = sqLiteDatabase.compileStatement(sql); while ((line = reader.readLine()) != null) { if (!line.isEmpty() && !line.startsWith("#")) { lineSplit = line.split("=", 2); if (lineSplit.length == 2) { statement.clearBindings(); if (false) { statement.bindString(1, lineSplit[0]); statement.bindString(2, ""); } else { statement.bindString(1, ""); statement.bindString(2, lineSplit[0]); } statement.bindString(3, lineSplit[1]); statement.bindLong(4, 3); try { statement.executeInsert(); } catch (Exception e) { Log.d("LaunchDB", "Can't add category", e); } if (count++ % 1000 == 0) { sqLiteDatabase.setTransactionSuccessful(); sqLiteDatabase.endTransaction(); sqLiteDatabase.beginTransaction(); } } } } sqLiteDatabase.setTransactionSuccessful(); } catch (Exception ex) { ex.printStackTrace(); } finally { sqLiteDatabase.endTransaction(); try { if (inputStream != null) inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } Log.d("LaunchDB", " loaded " + count + " rows"); </DeepExtract> <DeepExtract> Log.d("LaunchDB", "loadCategories " + 4 + " " + R.raw.packages2); InputStream inputStream = mContext.getResources().openRawResource(R.raw.packages2); String line; String[] lineSplit; int count = 0; try { sqLiteDatabase.beginTransaction(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); String sql = "INSERT INTO " + APP_CAT_MAP_TABLE + " values(?,?,?,?)"; SQLiteStatement statement = sqLiteDatabase.compileStatement(sql); while ((line = reader.readLine()) != null) { if (!line.isEmpty() && !line.startsWith("#")) { lineSplit = line.split("=", 2); if (lineSplit.length == 2) { statement.clearBindings(); if (false) { statement.bindString(1, lineSplit[0]); statement.bindString(2, ""); } else { statement.bindString(1, ""); statement.bindString(2, lineSplit[0]); } statement.bindString(3, lineSplit[1]); statement.bindLong(4, 4); try { statement.executeInsert(); } catch (Exception e) { Log.d("LaunchDB", "Can't add category", e); } if (count++ % 1000 == 0) { sqLiteDatabase.setTransactionSuccessful(); sqLiteDatabase.endTransaction(); sqLiteDatabase.beginTransaction(); } } } } sqLiteDatabase.setTransactionSuccessful(); } catch (Exception ex) { ex.printStackTrace(); } finally { sqLiteDatabase.endTransaction(); try { if (inputStream != null) inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } Log.d("LaunchDB", " loaded " + count + " rows"); </DeepExtract>
LaunchTime
positive
public Criteria andStatusIsNotNull() { if ("status is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("status is not null")); return (Criteria) this; }
<DeepExtract> if ("status is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("status is not null")); </DeepExtract>
SSM_BookSystem
positive
public final Reader stdoutReaderUtf8() { return new InputStreamReader(stdoutStream(), UTF_8); }
<DeepExtract> return new InputStreamReader(stdoutStream(), UTF_8); </DeepExtract>
ios-device-control
positive
@Test public void tryToTurnNextLightOnAfterAllLightsAreOn() { model.turnNextLightOn(); List<Light> lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertFalse("Light should be off", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertTrue("Light should be on", lights.get(2).isOn()); model.turnNextLightOn(); List<Light> lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertFalse("Light should be off", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertTrue("Light should be on", lights.get(2).isOn()); model.turnNextLightOn(); List<Light> lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertFalse("Light should be off", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertTrue("Light should be on", lights.get(2).isOn()); model.turnNextLightOn(); List<Light> lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertFalse("Light should be off", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertTrue("Light should be on", lights.get(2).isOn()); List<Light> lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertTrue("Light should be on", lights.get(2).isOn()); }
<DeepExtract> model.turnNextLightOn(); List<Light> lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertFalse("Light should be off", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertTrue("Light should be on", lights.get(2).isOn()); </DeepExtract> <DeepExtract> model.turnNextLightOn(); List<Light> lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertFalse("Light should be off", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertTrue("Light should be on", lights.get(2).isOn()); </DeepExtract> <DeepExtract> model.turnNextLightOn(); List<Light> lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertFalse("Light should be off", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertTrue("Light should be on", lights.get(2).isOn()); </DeepExtract> <DeepExtract> model.turnNextLightOn(); List<Light> lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertFalse("Light should be off", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertTrue("Light should be on", lights.get(2).isOn()); </DeepExtract>
tomighty
positive
private void setCheckedArray() { int l = getEntries().length; checked = new boolean[l]; CharSequence[] values = getEntryValues(); String s = "," + getValue() + ","; int l = checked.length; for (int i = 0; i < l; i++) { checked[i] = s.contains("," + values[i] + ","); } }
<DeepExtract> CharSequence[] values = getEntryValues(); String s = "," + getValue() + ","; int l = checked.length; for (int i = 0; i < l; i++) { checked[i] = s.contains("," + values[i] + ","); } </DeepExtract>
callmeter
positive
public void setMin(int min) { if (mMin == min) return; mMin = min; if (mMin > mMax) { setMax(mMin + 1); } int range = mMax - mMin; if ((mKeyProgressIncrement == 0) || (range / mKeyProgressIncrement > 20)) { mKeyProgressIncrement = Math.max(1, Math.round((float) range / 20)); } }
<DeepExtract> int range = mMax - mMin; if ((mKeyProgressIncrement == 0) || (range / mKeyProgressIncrement > 20)) { mKeyProgressIncrement = Math.max(1, Math.round((float) range / 20)); } </DeepExtract>
FaceUnityLegacy
positive