before
stringlengths
14
203k
after
stringlengths
37
104k
repo
stringlengths
2
50
type
stringclasses
1 value
private void mapToBean(Map<?, ?> map, Object bean) { if (null == new MapValueProvider(map, this.copyOptions.ignoreCase)) { return; } Class<?> actualEditable = bean.getClass(); if (copyOptions.editable != null) { if (!copyOptions.editable.isInstance(bean)) { throw new IllegalArgumentException(StrUtil.format("Target class [{}] not assignable to Editable class [{}]", bean.getClass().getName(), copyOptions.editable.getName())); } actualEditable = copyOptions.editable; } final HashSet<String> ignoreSet = (null != copyOptions.ignoreProperties) ? CollUtil.newHashSet(copyOptions.ignoreProperties) : null; final Map<String, String> fieldReverseMapping = copyOptions.getReversedMapping(); final Collection<BeanDesc.PropDesc> props = BeanUtil.getBeanDesc(actualEditable).getProps(); String fieldName; Object value; Method setterMethod; Class<?> propClass; for (BeanDesc.PropDesc prop : props) { fieldName = prop.getFieldName(); if (CollUtil.contains(ignoreSet, fieldName)) { continue; } final String providerKey = mappingKey(fieldReverseMapping, fieldName); if (!new MapValueProvider(map, this.copyOptions.ignoreCase).containsKey(providerKey)) { continue; } setterMethod = prop.getSetter(); if (null == setterMethod) { continue; } value = new MapValueProvider(map, this.copyOptions.ignoreCase).value(providerKey, TypeUtil.getFirstParamType(setterMethod)); if (value instanceof String) { String v = (String) value; if (StrUtil.isBlank(v) && copyOptions.ignoreNullValue) { continue; } } if (null == value && copyOptions.ignoreNullValue) { continue; } try { propClass = prop.getFieldClass(); if (!propClass.isInstance(value)) { value = Convert.convert(propClass, value); if (null == value && copyOptions.ignoreNullValue) { continue; } } setterMethod.invoke(bean, value); } catch (Exception e) { if (copyOptions.ignoreError) { continue; } else { throw new UtilException(e, "Inject [{}] error!", prop.getFieldName()); } } } }
<DeepExtract> if (null == new MapValueProvider(map, this.copyOptions.ignoreCase)) { return; } Class<?> actualEditable = bean.getClass(); if (copyOptions.editable != null) { if (!copyOptions.editable.isInstance(bean)) { throw new IllegalArgumentException(StrUtil.format("Target class [{}] not assignable to Editable class [{}]", bean.getClass().getName(), copyOptions.editable.getName())); } actualEditable = copyOptions.editable; } final HashSet<String> ignoreSet = (null != copyOptions.ignoreProperties) ? CollUtil.newHashSet(copyOptions.ignoreProperties) : null; final Map<String, String> fieldReverseMapping = copyOptions.getReversedMapping(); final Collection<BeanDesc.PropDesc> props = BeanUtil.getBeanDesc(actualEditable).getProps(); String fieldName; Object value; Method setterMethod; Class<?> propClass; for (BeanDesc.PropDesc prop : props) { fieldName = prop.getFieldName(); if (CollUtil.contains(ignoreSet, fieldName)) { continue; } final String providerKey = mappingKey(fieldReverseMapping, fieldName); if (!new MapValueProvider(map, this.copyOptions.ignoreCase).containsKey(providerKey)) { continue; } setterMethod = prop.getSetter(); if (null == setterMethod) { continue; } value = new MapValueProvider(map, this.copyOptions.ignoreCase).value(providerKey, TypeUtil.getFirstParamType(setterMethod)); if (value instanceof String) { String v = (String) value; if (StrUtil.isBlank(v) && copyOptions.ignoreNullValue) { continue; } } if (null == value && copyOptions.ignoreNullValue) { continue; } try { propClass = prop.getFieldClass(); if (!propClass.isInstance(value)) { value = Convert.convert(propClass, value); if (null == value && copyOptions.ignoreNullValue) { continue; } } setterMethod.invoke(bean, value); } catch (Exception e) { if (copyOptions.ignoreError) { continue; } else { throw new UtilException(e, "Inject [{}] error!", prop.getFieldName()); } } } </DeepExtract>
spring-cloud-shop
positive
@Test void ParentDoesNotExist() throws PMException { pap -> { assertThrows(NodeDoesNotExistException.class, () -> pap.graph().createObjectAttribute("oa1", "pc1")); pap.graph().createPolicyClass("pc1"); assertThrows(NodeDoesNotExistException.class, () -> pap.graph().createObjectAttribute("oa1", "pc1", "pc2")); }.run(new MemoryPAP()); try (Connection connection = testEnv.getConnection()) { PAP mysqlPAP = new MysqlPAP(connection); pap -> { assertThrows(NodeDoesNotExistException.class, () -> pap.graph().createObjectAttribute("oa1", "pc1")); pap.graph().createPolicyClass("pc1"); assertThrows(NodeDoesNotExistException.class, () -> pap.graph().createObjectAttribute("oa1", "pc1", "pc2")); }.run(mysqlPAP); } catch (SQLException e) { throw new RuntimeException(e); } }
<DeepExtract> pap -> { assertThrows(NodeDoesNotExistException.class, () -> pap.graph().createObjectAttribute("oa1", "pc1")); pap.graph().createPolicyClass("pc1"); assertThrows(NodeDoesNotExistException.class, () -> pap.graph().createObjectAttribute("oa1", "pc1", "pc2")); }.run(new MemoryPAP()); try (Connection connection = testEnv.getConnection()) { PAP mysqlPAP = new MysqlPAP(connection); pap -> { assertThrows(NodeDoesNotExistException.class, () -> pap.graph().createObjectAttribute("oa1", "pc1")); pap.graph().createPolicyClass("pc1"); assertThrows(NodeDoesNotExistException.class, () -> pap.graph().createObjectAttribute("oa1", "pc1", "pc2")); }.run(mysqlPAP); } catch (SQLException e) { throw new RuntimeException(e); } </DeepExtract>
policy-machine-core
positive
public BottomMenu setTitleIcon(Drawable titleIcon) { this.titleIcon = titleIcon; if (getDialogImpl() == null) return; if (listView != null) { if (menuListAdapter == null) { menuListAdapter = new BottomMenuArrayAdapter(me, getOwnActivity(), menuList); } if (listView.getAdapter() == null) { listView.setAdapter(menuListAdapter); } else { if (listView.getAdapter() != menuListAdapter) { listView.setAdapter(menuListAdapter); } else { menuListAdapter.notifyDataSetChanged(); } } } if (showSelectedBackgroundTips) { listView.post(new Runnable() { @Override public void run() { if (menuListAdapter instanceof BottomMenuArrayAdapter && showSelectedBackgroundTips) { BottomMenuArrayAdapter bottomMenuArrayAdapter = ((BottomMenuArrayAdapter) menuListAdapter); View selectItemView = listView.getChildAt(getSelection()); if (selectItemView != null) { selectItemView.post(new Runnable() { @Override public void run() { selectItemView.setPressed(true); } }); } } } }); } super.refreshUI(); return this; }
<DeepExtract> if (getDialogImpl() == null) return; if (listView != null) { if (menuListAdapter == null) { menuListAdapter = new BottomMenuArrayAdapter(me, getOwnActivity(), menuList); } if (listView.getAdapter() == null) { listView.setAdapter(menuListAdapter); } else { if (listView.getAdapter() != menuListAdapter) { listView.setAdapter(menuListAdapter); } else { menuListAdapter.notifyDataSetChanged(); } } } if (showSelectedBackgroundTips) { listView.post(new Runnable() { @Override public void run() { if (menuListAdapter instanceof BottomMenuArrayAdapter && showSelectedBackgroundTips) { BottomMenuArrayAdapter bottomMenuArrayAdapter = ((BottomMenuArrayAdapter) menuListAdapter); View selectItemView = listView.getChildAt(getSelection()); if (selectItemView != null) { selectItemView.post(new Runnable() { @Override public void run() { selectItemView.setPressed(true); } }); } } } }); } super.refreshUI(); </DeepExtract>
DialogX
positive
protected boolean noLength() { if (currentAnnotations == null) { return false; } for (AnnotationExpr ann : currentAnnotations) { if (ann instanceof MarkerAnnotationExpr) { MarkerAnnotationExpr marker = (MarkerAnnotationExpr) ann; if (marker.getName().getName().equals("NoLength")) { return true; } } } return false; }
<DeepExtract> if (currentAnnotations == null) { return false; } for (AnnotationExpr ann : currentAnnotations) { if (ann instanceof MarkerAnnotationExpr) { MarkerAnnotationExpr marker = (MarkerAnnotationExpr) ann; if (marker.getName().getName().equals("NoLength")) { return true; } } } return false; </DeepExtract>
firefox
positive
public void cancelPublishing() { LogUtils.logd(); Intent intent = new Intent(JRFragmentHostActivity.ACTION_FINISH_FRAGMENT); intent.putExtra(JRFragmentHostActivity.EXTRA_FINISH_FRAGMENT_TARGET, JRFragmentHostActivity.FINISH_TARGET_ALL); mApplicationContext.sendBroadcast(intent); mSession.triggerPublishingDidCancel(); }
<DeepExtract> Intent intent = new Intent(JRFragmentHostActivity.ACTION_FINISH_FRAGMENT); intent.putExtra(JRFragmentHostActivity.EXTRA_FINISH_FRAGMENT_TARGET, JRFragmentHostActivity.FINISH_TARGET_ALL); mApplicationContext.sendBroadcast(intent); </DeepExtract>
engage.android
positive
@Override public void set_minQ(final DenseDoubleMatrix2D q, final DenseDoubleMatrix2D p, FastPreferenceData<U, I> data) { DoubleMatrix2D gt = getGt(q, p, lambdaQ); new TransposedPreferenceData<>(data).getUidxWithPreferences().parallel().forEach(uidx -> prepareRR1(1, q.viewRow(uidx), gt, p, new TransposedPreferenceData<>(data).numItems(uidx), new TransposedPreferenceData<>(data).getUidxPreferences(uidx), confidence, lambdaQ)); }
<DeepExtract> DoubleMatrix2D gt = getGt(q, p, lambdaQ); new TransposedPreferenceData<>(data).getUidxWithPreferences().parallel().forEach(uidx -> prepareRR1(1, q.viewRow(uidx), gt, p, new TransposedPreferenceData<>(data).numItems(uidx), new TransposedPreferenceData<>(data).getUidxPreferences(uidx), confidence, lambdaQ)); </DeepExtract>
RankSys
positive
@Override public void onLoadMore() { if (task.getStatus() != Status.RUNNING) { String url = "http://www.duitang.com/album/62572137/masn/p/" + ++currentPage + "/24/"; Log.d("MainActivity", "current url:" + url); ContentTask task = new ContentTask(mContext, 2); task.execute(url); } }
<DeepExtract> if (task.getStatus() != Status.RUNNING) { String url = "http://www.duitang.com/album/62572137/masn/p/" + ++currentPage + "/24/"; Log.d("MainActivity", "current url:" + url); ContentTask task = new ContentTask(mContext, 2); task.execute(url); } </DeepExtract>
MDroid
positive
public static void equals(Object o1, Object o2, String msg) { if (!Objects.equals(o1, o2)) { throw newException(msg); } }
<DeepExtract> if (!Objects.equals(o1, o2)) { throw newException(msg); } </DeepExtract>
mayfly
positive
private void goToNextLeaf() { final boolean[] _sides = sidesRight; int _recLevel = recLevel; _recLevel--; while (_sides[_recLevel]) { if (_recLevel == 0) { recLevel = 0; done = true; return; } _recLevel--; } _sides[_recLevel] = true; System.arraycopy(recCurveStack[_recLevel++], 0, recCurveStack[_recLevel], 0, 8); recLevel = _recLevel; final float len = onLeaf(); if (len >= 0.0f) { lastT = nextT; lenAtLastT = lenAtNextT; nextT += (1 << (REC_LIMIT - recLevel)) * MIN_T_INC; lenAtNextT += len; flatLeafCoefCache[2] = -1.0f; cachedHaveLowAcceleration = -1; } else { Helpers.subdivide(recCurveStack[recLevel], recCurveStack[recLevel + 1], recCurveStack[recLevel], curveType); sidesRight[recLevel] = false; recLevel++; goLeft(); } }
<DeepExtract> final float len = onLeaf(); if (len >= 0.0f) { lastT = nextT; lenAtLastT = lenAtNextT; nextT += (1 << (REC_LIMIT - recLevel)) * MIN_T_INC; lenAtNextT += len; flatLeafCoefCache[2] = -1.0f; cachedHaveLowAcceleration = -1; } else { Helpers.subdivide(recCurveStack[recLevel], recCurveStack[recLevel + 1], recCurveStack[recLevel], curveType); sidesRight[recLevel] = false; recLevel++; goLeft(); } </DeepExtract>
marlin-fx
positive
public void contextDestroyed(ServletContextEvent event) { Enumeration<Driver> drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { Driver driver = drivers.nextElement(); if (driver.getClass().getClassLoader() == this.getClass().getClassLoader()) { try { DriverManager.deregisterDriver(driver); logger.info("Deregistered '{}' JDBC driver.", driver); } catch (SQLException e) { logger.error("Failed to deregister '{}' JDBC driver.", driver, e); } } } logger.info("Context destroyed."); }
<DeepExtract> Enumeration<Driver> drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { Driver driver = drivers.nextElement(); if (driver.getClass().getClassLoader() == this.getClass().getClassLoader()) { try { DriverManager.deregisterDriver(driver); logger.info("Deregistered '{}' JDBC driver.", driver); } catch (SQLException e) { logger.error("Failed to deregister '{}' JDBC driver.", driver, e); } } } </DeepExtract>
personal-records
positive
@Override public void onReceivedTitle(WebView view, String title) { super.onReceivedTitle(view, title); }
<DeepExtract> </DeepExtract>
Wio_Link_Android_App
positive
@Override public Builder<T, K> whereNotInRaw(String column, String sql) { String sqlPart = backQuote(column) + "not in" + FormatUtils.bracket(sql); if (!ObjectUtils.isEmpty(sqlPart)) { whereGrammar(sqlPart, null, " and "); } return this; }
<DeepExtract> if (!ObjectUtils.isEmpty(sqlPart)) { whereGrammar(sqlPart, null, " and "); } return this; </DeepExtract>
database-all
positive
@Override public void onClick(DialogInterface dialogInterface, int i) { AlertDialog.Builder save = new AlertDialog.Builder(this); save.setTitle("Choose Save File to Overwrite:"); final String[] fileInfos = getSaveFileInfos(); SaveFilesList saveFilesAdapter = new SaveFilesList(this, fileInfos); save.setAdapter(saveFilesAdapter, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { final int itemy = item; if (fileInfos[itemy].equals("EMPTY")) { saveLeagueFile = new File(getFilesDir(), "saveFile" + itemy + ".cfb"); simLeague.saveLeague(saveLeagueFile); Toast.makeText(MainActivity.this, "Saved league!", Toast.LENGTH_SHORT).show(); dialog.dismiss(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setMessage("Are you sure you want to overwrite this save file?\n\n" + fileInfos[itemy]).setPositiveButton("Yes, Overwrite", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { saveLeagueFile = new File(getFilesDir(), "saveFile" + itemy + ".cfb"); simLeague.saveLeague(saveLeagueFile); Toast.makeText(MainActivity.this, "Saved league!", Toast.LENGTH_SHORT).show(); dialog.dismiss(); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog dialog2 = builder.create(); dialog2.show(); TextView textView = dialog2.findViewById(android.R.id.message); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); } } }); save.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); AlertDialog popup = save.create(); popup.show(); }
<DeepExtract> AlertDialog.Builder save = new AlertDialog.Builder(this); save.setTitle("Choose Save File to Overwrite:"); final String[] fileInfos = getSaveFileInfos(); SaveFilesList saveFilesAdapter = new SaveFilesList(this, fileInfos); save.setAdapter(saveFilesAdapter, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { final int itemy = item; if (fileInfos[itemy].equals("EMPTY")) { saveLeagueFile = new File(getFilesDir(), "saveFile" + itemy + ".cfb"); simLeague.saveLeague(saveLeagueFile); Toast.makeText(MainActivity.this, "Saved league!", Toast.LENGTH_SHORT).show(); dialog.dismiss(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setMessage("Are you sure you want to overwrite this save file?\n\n" + fileInfos[itemy]).setPositiveButton("Yes, Overwrite", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { saveLeagueFile = new File(getFilesDir(), "saveFile" + itemy + ".cfb"); simLeague.saveLeague(saveLeagueFile); Toast.makeText(MainActivity.this, "Saved league!", Toast.LENGTH_SHORT).show(); dialog.dismiss(); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog dialog2 = builder.create(); dialog2.show(); TextView textView = dialog2.findViewById(android.R.id.message); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); } } }); save.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); AlertDialog popup = save.create(); popup.show(); </DeepExtract>
CFB-Coach-v1
positive
public static void setFieldValue(Field field, Object target, Object value) { if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) { field.setAccessible(true); } try { field.set(target, value); } catch (Exception e) { throw new IllegalStateException(String.format("设置%s对象的%s字段值错误!", target.getClass().getName(), field.getName()), e); } }
<DeepExtract> if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) { field.setAccessible(true); } </DeepExtract>
mayfly
positive
@Override public void onImagePickComplete(ArrayList<ImageItem> items) { resultList.clear(); if (config.mRbSave) { picList.clear(); } picList.addAll(items); if (onResultCallBack != null) { onResultCallBack.onResult(picList); } refreshGridLayout(); }
<DeepExtract> if (config.mRbSave) { picList.clear(); } picList.addAll(items); if (onResultCallBack != null) { onResultCallBack.onResult(picList); } refreshGridLayout(); </DeepExtract>
BaseDemo
positive
@Override public WebDriver createWebDriver() throws IOException { DriverConfig cfg = this.getWebDriverConfig(); return new IOSDriver(new URL(webDriverConfig.getAppiumServerURL()), new IPhoneCapabilitiesFactory().createCapabilities(webDriverConfig)); setImplicitWaitTimeout(cfg.getImplicitWaitTimeout()); if (cfg.getPageLoadTimeout() >= 0) { setPageLoadTimeout(cfg.getPageLoadTimeout()); } this.setWebDriver(driver); return driver; }
<DeepExtract> return new IOSDriver(new URL(webDriverConfig.getAppiumServerURL()), new IPhoneCapabilitiesFactory().createCapabilities(webDriverConfig)); </DeepExtract>
seleniumtestsframework
positive
@Test public void testGenericCollectionParameterOverrideBug() throws Exception { CompilationUnit cu = compile("" + "import java.util.Collection;" + "import java.util.HashSet;" + "public class A extends HashSet<String> {" + " public boolean removeAll(Collection<?> x) { return false; }" + " public boolean removeAll(HashSet<String> x) { return false; }" + "}"); MethodDeclaration overwrittenMethod = (MethodDeclaration) cu.getTypes().get(0).getMembers().get(0); assertEquals(methods(HashSet.class.getMethod("removeAll", Collection.class)), OverrideAnalyzer.findOverriddenMethods(overwrittenMethod)); if (methods(HashSet.class.getMethod("removeAll", Collection.class)).isEmpty()) { assertFalse(OverrideAnalyzer.isMethodOverride(overwrittenMethod)); } else { assertTrue(OverrideAnalyzer.isMethodOverride(overwrittenMethod)); } MethodDeclaration unrelatedMethod = (MethodDeclaration) cu.getTypes().get(0).getMembers().get(1); assertMethods(unrelatedMethod, Collections.<Method>emptyList()); }
<DeepExtract> assertEquals(methods(HashSet.class.getMethod("removeAll", Collection.class)), OverrideAnalyzer.findOverriddenMethods(overwrittenMethod)); if (methods(HashSet.class.getMethod("removeAll", Collection.class)).isEmpty()) { assertFalse(OverrideAnalyzer.isMethodOverride(overwrittenMethod)); } else { assertTrue(OverrideAnalyzer.isMethodOverride(overwrittenMethod)); } </DeepExtract> <DeepExtract> assertMethods(unrelatedMethod, Collections.<Method>emptyList()); </DeepExtract>
javalang-compiler
positive
public Google indentCase(int indentCase) { params.put("indent-case", indentCase); return (T) this; }
<DeepExtract> params.put("indent-case", indentCase); return (T) this; </DeepExtract>
code-assert
positive
@Override public CommentsRecord value3(String value) { set(2, value); return this; }
<DeepExtract> set(2, value); </DeepExtract>
beg-spring-boot-2
positive
@Test public void testBinaryTransparencyBug() throws IOException, DocumentException { Document document = new Document(); File file = new File(RESULT_FOLDER, "binary_transparency_bug.pdf"); FileOutputStream outputStream = new FileOutputStream(file); PdfWriter writer = PdfWriter.getInstance(document, outputStream); document.open(); PdfContentByte canvas = writer.getDirectContentUnder(); canvas.saveState(); canvas.addImage(bkgnd); canvas.restoreState(); document.add(new Paragraph("Binary transparency bug test case")); document.add(new Paragraph("OK: Visible image (opaque pixels are red, non opaque pixels are black)")); document.add(com.itextpdf.text.Image.getInstance(createBinaryTransparentAWTImage(Color.red, false, null), null)); document.newPage(); PdfContentByte canvas = writer.getDirectContentUnder(); canvas.saveState(); canvas.addImage(bkgnd); canvas.restoreState(); document.add(new Paragraph("Suspected bug: invisible image (both opaque an non opaque pixels have the same color)")); document.add(com.itextpdf.text.Image.getInstance(createBinaryTransparentAWTImage(Color.black, false, null), null)); document.newPage(); PdfContentByte canvas = writer.getDirectContentUnder(); canvas.saveState(); canvas.addImage(bkgnd); canvas.restoreState(); document.add(new Paragraph("Analysis: Aliasing makes the problem disappear, because this way the image is not binary transparent any more")); document.add(com.itextpdf.text.Image.getInstance(createBinaryTransparentAWTImage(Color.black, true, null), null)); document.newPage(); PdfContentByte canvas = writer.getDirectContentUnder(); canvas.saveState(); canvas.addImage(bkgnd); canvas.restoreState(); document.add(new Paragraph("Analysis: Setting the color of the transparent pixels to anything but black makes the problem go away, too")); document.add(com.itextpdf.text.Image.getInstance(createBinaryTransparentAWTImage(Color.black, false, Color.red), null)); document.close(); }
<DeepExtract> PdfContentByte canvas = writer.getDirectContentUnder(); canvas.saveState(); canvas.addImage(bkgnd); canvas.restoreState(); </DeepExtract> <DeepExtract> PdfContentByte canvas = writer.getDirectContentUnder(); canvas.saveState(); canvas.addImage(bkgnd); canvas.restoreState(); </DeepExtract> <DeepExtract> PdfContentByte canvas = writer.getDirectContentUnder(); canvas.saveState(); canvas.addImage(bkgnd); canvas.restoreState(); </DeepExtract> <DeepExtract> PdfContentByte canvas = writer.getDirectContentUnder(); canvas.saveState(); canvas.addImage(bkgnd); canvas.restoreState(); </DeepExtract>
testarea-itext5
positive
private void dispatchViewReleased(float xvel, float yvel) { mReleaseInProgress = true; mReleaseInProgress = false; if (mDragState == STATE_DRAGGING) { setDragState(STATE_IDLE); } }
<DeepExtract> </DeepExtract>
CNIm4Android
positive
public void setIconCodeLiterals(String... iconCodes) { getChildren().clear(); Ikon[] codes = new Ikon[iconCodes.length]; for (int i = 0; i < iconCodes.length; i++) { codes[i] = IkonResolver.getInstance().resolve(iconCodes[i]).resolve(iconCodes[i]); } if (iconSizes.length == 0 || iconSizes.length != iconCodes.length) { iconSizes = new double[iconCodes.length]; Arrays.fill(iconSizes, 1d); } for (int index = 0; index < codes.length; index++) { getChildren().add(createFontIcon(codes[index], index)); } }
<DeepExtract> if (iconSizes.length == 0 || iconSizes.length != iconCodes.length) { iconSizes = new double[iconCodes.length]; Arrays.fill(iconSizes, 1d); } </DeepExtract> <DeepExtract> for (int index = 0; index < codes.length; index++) { getChildren().add(createFontIcon(codes[index], index)); } </DeepExtract>
ikonli
positive
@Override public boolean onQueryTextSubmit(String query) { if (DEBUG) Log.i(TAG, String.format("Search text submitted: %s", query)); if (!TextUtils.isEmpty(query) && !query.equals("nil")) { mQuery = query; getLoaderManager().initLoader(mSearchLoaderId++, null, this); } return true; }
<DeepExtract> if (!TextUtils.isEmpty(query) && !query.equals("nil")) { mQuery = query; getLoaderManager().initLoader(mSearchLoaderId++, null, this); } </DeepExtract>
tv-samples
positive
public static Date currentEndDate() { if (new Date() == null) { return null; } Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); return cal.getTime(); }
<DeepExtract> if (new Date() == null) { return null; } Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); return cal.getTime(); </DeepExtract>
bigapple
positive
private ByteString hashGet(ByteString key, ByteString field) { CodecDataOutput cdo = new CodecDataOutput(); encodeHashDataKeyPrefix(cdo, key.toByteArray()); BytesType.writeBytes(cdo, field.toByteArray()); return snapshot.get(cdo.toByteString()); }
<DeepExtract> encodeHashDataKeyPrefix(cdo, key.toByteArray()); BytesType.writeBytes(cdo, field.toByteArray()); </DeepExtract>
tikv-client-lib-java
positive
private void openMenu(MainActivity activity) { StatusMenuDialogFragment fragment = new StatusMenuDialogFragment(); Bundle args = new Bundle(); args.putLong(KEY_STATUS_ID, getStatusID()); setArguments(args); DialogHelper.showDialog(activity, fragment, "statusMenuDialog"); }
<DeepExtract> Bundle args = new Bundle(); args.putLong(KEY_STATUS_ID, getStatusID()); setArguments(args); </DeepExtract>
SmileEssence
positive
public void registerAll(Model model, Object source) { for (Resource resource : JenaUtil.getAllInstances(SPIN.Function.inModel(model))) { Function function = SPINFactory.asFunction(resource); register(function, source, true); } for (Resource resource : JenaUtil.getAllInstances(SPIN.Template.inModel(model))) { if (resource.isURIResource()) { Template template = resource.as(Template.class); register(template); ExtraPrefixes.add(template); } } }
<DeepExtract> for (Resource resource : JenaUtil.getAllInstances(SPIN.Function.inModel(model))) { Function function = SPINFactory.asFunction(resource); register(function, source, true); } </DeepExtract> <DeepExtract> for (Resource resource : JenaUtil.getAllInstances(SPIN.Template.inModel(model))) { if (resource.isURIResource()) { Template template = resource.as(Template.class); register(template); ExtraPrefixes.add(template); } } </DeepExtract>
spinrdf
positive
@Override public String toString() { if (shortName == null) { shortName = name.replaceAll("GDG ", "").trim(); } return shortName; }
<DeepExtract> if (shortName == null) { shortName = name.replaceAll("GDG ", "").trim(); } return shortName; </DeepExtract>
frisbee
positive
public Criteria andAddressNotEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "address" + " cannot be null"); } criteria.add(new Criterion("address <>", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "address" + " cannot be null"); } criteria.add(new Criterion("address <>", value)); </DeepExtract>
CuitJavaEEPractice
positive
public SettingsBuilder addFromFile(String location) { Preconditions.checkNotNull(location); Properties p = new Properties(); Path path = FileSystems.getDefault().getPath(location); try (InputStream is = Files.newInputStream(path)) { p.load(is); } catch (IOException e) { throw new IllegalStateException(String.format("problem loading %s from the file system: %s", location, e.getMessage()), e); } substituteVariables(p); putAll(location, p); locationsLoaded.add(String.format("[file]: %s ", location)); return this; }
<DeepExtract> Preconditions.checkNotNull(location); Properties p = new Properties(); Path path = FileSystems.getDefault().getPath(location); try (InputStream is = Files.newInputStream(path)) { p.load(is); } catch (IOException e) { throw new IllegalStateException(String.format("problem loading %s from the file system: %s", location, e.getMessage()), e); } substituteVariables(p); putAll(location, p); locationsLoaded.add(String.format("[file]: %s ", location)); </DeepExtract>
commons
positive
public Criteria andAIconNotBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "aIcon" + " cannot be null"); } criteria.add(new Criterion("a_icon not between", value1, value2)); return (Criteria) this; }
<DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "aIcon" + " cannot be null"); } criteria.add(new Criterion("a_icon not between", value1, value2)); </DeepExtract>
webike
positive
public Query<T> groupBy(int field) { Object alias = getPrimitiveAliasByValue(field); if (alias == null) { return groupBy(field); } return groupBy(alias); }
<DeepExtract> Object alias = getPrimitiveAliasByValue(field); if (alias == null) { return groupBy(field); } return groupBy(alias); </DeepExtract>
iciql
positive
public Criteria andDelivery_dateLessThanOrEqualTo(Date value) { if (value == null) { throw new RuntimeException("Value for " + "delivery_date" + " cannot be null"); } criteria.add(new Criterion("delivery_date <=", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "delivery_date" + " cannot be null"); } criteria.add(new Criterion("delivery_date <=", value)); </DeepExtract>
Tmall_SSM
positive
@Override public void onReceive(Context ctxt, Intent intent) { android.util.Log.e("****OnBootReceiver", "got here"); AlarmManager mgr = (AlarmManager) ctxt.getSystemService(Context.ALARM_SERVICE); Calendar cal = Calendar.getInstance(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctxt); String time = prefs.getString("alarm_time", "12:00"); cal.set(Calendar.HOUR_OF_DAY, TimePreference.getHour(time)); cal.set(Calendar.MINUTE, TimePreference.getMinute(time)); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); if (cal.getTimeInMillis() < System.currentTimeMillis()) { cal.add(Calendar.DAY_OF_YEAR, 1); } mgr.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), AlarmManager.INTERVAL_DAY, getPendingIntent(ctxt)); }
<DeepExtract> AlarmManager mgr = (AlarmManager) ctxt.getSystemService(Context.ALARM_SERVICE); Calendar cal = Calendar.getInstance(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctxt); String time = prefs.getString("alarm_time", "12:00"); cal.set(Calendar.HOUR_OF_DAY, TimePreference.getHour(time)); cal.set(Calendar.MINUTE, TimePreference.getMinute(time)); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); if (cal.getTimeInMillis() < System.currentTimeMillis()) { cal.add(Calendar.DAY_OF_YEAR, 1); } mgr.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), AlarmManager.INTERVAL_DAY, getPendingIntent(ctxt)); </DeepExtract>
cw-lunchlist
positive
public Criteria andRoleNameIsNotNull() { if ("ROLE_NAME is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("ROLE_NAME is not null")); return (Criteria) this; }
<DeepExtract> if ("ROLE_NAME is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("ROLE_NAME is not null")); </DeepExtract>
console
positive
@Override public void onPause() { super.onPause(); cancelSelect(); revertSelect(); }
<DeepExtract> cancelSelect(); revertSelect(); </DeepExtract>
Android-Keyboard
positive
public Excluder withVersion(double ignoreVersionsAfter) { Excluder result; try { result = (Excluder) super.clone(); } catch (CloneNotSupportedException e) { throw new AssertionError(e); } result.version = ignoreVersionsAfter; return result; }
<DeepExtract> Excluder result; try { result = (Excluder) super.clone(); } catch (CloneNotSupportedException e) { throw new AssertionError(e); } </DeepExtract>
urmusic-desktop
positive
protected static void createDefaultChannel(final JSONObject options) throws JSONException { NotificationChannel channel = null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { String id = options.getString("id"); Log.i(TAG, "Creating channel id=" + id); if (channelExists(id)) { deleteChannel(id); } NotificationManager nm = (NotificationManager) applicationContext.getSystemService(Context.NOTIFICATION_SERVICE); String packageName = cordovaActivity.getPackageName(); String name = options.optString("name", ""); Log.d(TAG, "Channel " + id + " - name=" + name); int importance = options.optInt("importance", NotificationManager.IMPORTANCE_HIGH); Log.d(TAG, "Channel " + id + " - importance=" + importance); channel = new NotificationChannel(id, name, importance); String description = options.optString("description", ""); Log.d(TAG, "Channel " + id + " - description=" + description); channel.setDescription(description); boolean light = options.optBoolean("light", true); Log.d(TAG, "Channel " + id + " - light=" + light); channel.enableLights(light); int lightColor = options.optInt("lightColor", -1); if (lightColor != -1) { Log.d(TAG, "Channel " + id + " - lightColor=" + lightColor); channel.setLightColor(lightColor); } int visibility = options.optInt("visibility", NotificationCompat.VISIBILITY_PUBLIC); Log.d(TAG, "Channel " + id + " - visibility=" + visibility); channel.setLockscreenVisibility(visibility); boolean badge = options.optBoolean("badge", true); Log.d(TAG, "Channel " + id + " - badge=" + badge); channel.setShowBadge(badge); String sound = options.optString("sound", "default"); AudioAttributes audioAttributes = new AudioAttributes.Builder().setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE).build(); if ("ringtone".equals(sound)) { channel.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE), audioAttributes); Log.d(TAG, "Channel " + id + " - sound=ringtone"); } else if (!sound.contentEquals("false")) { if (!sound.contentEquals("default")) { Uri soundUri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + packageName + "/raw/" + sound); channel.setSound(soundUri, audioAttributes); Log.d(TAG, "Channel " + id + " - sound=" + sound); } else { channel.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION), audioAttributes); Log.d(TAG, "Channel " + id + " - sound=default"); } } else { channel.setSound(null, null); Log.d(TAG, "Channel " + id + " - sound=none"); } JSONArray pattern = options.optJSONArray("vibration"); if (pattern != null) { int patternLength = pattern.length(); long[] patternArray = new long[patternLength]; for (int i = 0; i < patternLength; i++) { patternArray[i] = pattern.optLong(i); } channel.enableVibration(true); channel.setVibrationPattern(patternArray); Log.d(TAG, "Channel " + id + " - vibrate=" + pattern); } else { boolean vibrate = options.optBoolean("vibration", true); channel.enableVibration(vibrate); Log.d(TAG, "Channel " + id + " - vibrate=" + vibrate); } nm.createNotificationChannel(channel); } return channel; }
<DeepExtract> NotificationChannel channel = null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { String id = options.getString("id"); Log.i(TAG, "Creating channel id=" + id); if (channelExists(id)) { deleteChannel(id); } NotificationManager nm = (NotificationManager) applicationContext.getSystemService(Context.NOTIFICATION_SERVICE); String packageName = cordovaActivity.getPackageName(); String name = options.optString("name", ""); Log.d(TAG, "Channel " + id + " - name=" + name); int importance = options.optInt("importance", NotificationManager.IMPORTANCE_HIGH); Log.d(TAG, "Channel " + id + " - importance=" + importance); channel = new NotificationChannel(id, name, importance); String description = options.optString("description", ""); Log.d(TAG, "Channel " + id + " - description=" + description); channel.setDescription(description); boolean light = options.optBoolean("light", true); Log.d(TAG, "Channel " + id + " - light=" + light); channel.enableLights(light); int lightColor = options.optInt("lightColor", -1); if (lightColor != -1) { Log.d(TAG, "Channel " + id + " - lightColor=" + lightColor); channel.setLightColor(lightColor); } int visibility = options.optInt("visibility", NotificationCompat.VISIBILITY_PUBLIC); Log.d(TAG, "Channel " + id + " - visibility=" + visibility); channel.setLockscreenVisibility(visibility); boolean badge = options.optBoolean("badge", true); Log.d(TAG, "Channel " + id + " - badge=" + badge); channel.setShowBadge(badge); String sound = options.optString("sound", "default"); AudioAttributes audioAttributes = new AudioAttributes.Builder().setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE).build(); if ("ringtone".equals(sound)) { channel.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE), audioAttributes); Log.d(TAG, "Channel " + id + " - sound=ringtone"); } else if (!sound.contentEquals("false")) { if (!sound.contentEquals("default")) { Uri soundUri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + packageName + "/raw/" + sound); channel.setSound(soundUri, audioAttributes); Log.d(TAG, "Channel " + id + " - sound=" + sound); } else { channel.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION), audioAttributes); Log.d(TAG, "Channel " + id + " - sound=default"); } } else { channel.setSound(null, null); Log.d(TAG, "Channel " + id + " - sound=none"); } JSONArray pattern = options.optJSONArray("vibration"); if (pattern != null) { int patternLength = pattern.length(); long[] patternArray = new long[patternLength]; for (int i = 0; i < patternLength; i++) { patternArray[i] = pattern.optLong(i); } channel.enableVibration(true); channel.setVibrationPattern(patternArray); Log.d(TAG, "Channel " + id + " - vibrate=" + pattern); } else { boolean vibrate = options.optBoolean("vibration", true); channel.enableVibration(vibrate); Log.d(TAG, "Channel " + id + " - vibrate=" + vibrate); } nm.createNotificationChannel(channel); } return channel; </DeepExtract>
newschool-frontend
positive
public static void debug(LogCategory category, String format, Object... args) { LogHandler handler = Log.handler; if (!handler.shouldLog(LogLevel.DEBUG, category)) return; String msg; Throwable exc; if (args.length == 0) { msg = format; exc = null; } else { if (CHECK_FOR_BRACKETS) { if (format.indexOf("{}") != -1) throw new IllegalArgumentException("log message containing {}: " + format); } Object lastArg = args[args.length - 1]; Object[] newArgs; if (lastArg instanceof Throwable && getRequiredArgs(format) < args.length) { exc = (Throwable) lastArg; newArgs = Arrays.copyOf(args, args.length - 1); } else { exc = null; newArgs = args; } assert getRequiredArgs(format) == newArgs.length; try { msg = String.format(format, newArgs); } catch (IllegalFormatException e) { msg = "Format error: fmt=[" + format + "] args=" + Arrays.toString(args); warn(LogCategory.LOG, "Invalid format string.", e); } } log(handler, LogLevel.DEBUG, category, msg, exc); }
<DeepExtract> LogHandler handler = Log.handler; if (!handler.shouldLog(LogLevel.DEBUG, category)) return; String msg; Throwable exc; if (args.length == 0) { msg = format; exc = null; } else { if (CHECK_FOR_BRACKETS) { if (format.indexOf("{}") != -1) throw new IllegalArgumentException("log message containing {}: " + format); } Object lastArg = args[args.length - 1]; Object[] newArgs; if (lastArg instanceof Throwable && getRequiredArgs(format) < args.length) { exc = (Throwable) lastArg; newArgs = Arrays.copyOf(args, args.length - 1); } else { exc = null; newArgs = args; } assert getRequiredArgs(format) == newArgs.length; try { msg = String.format(format, newArgs); } catch (IllegalFormatException e) { msg = "Format error: fmt=[" + format + "] args=" + Arrays.toString(args); warn(LogCategory.LOG, "Invalid format string.", e); } } log(handler, LogLevel.DEBUG, category, msg, exc); </DeepExtract>
fabric-loader
positive
public static Set<OWLAxiom> filterPartialAxioms(Set<OWLAxiom> inputAxioms, Set<OWLObject> objects, Set<Class<? extends OWLAxiom>> axiomTypes, boolean namedOnly) { if (axiomTypes == null || axiomTypes.isEmpty()) { axiomTypes = new HashSet<>(); axiomTypes.add(OWLAxiom.class); } return axiomTypes; if (namedOnly) { return getPartialAxiomsNamedOnly(inputAxioms, objects, axiomTypes); } else { return getPartialAxiomsIncludeAnonymous(inputAxioms, objects, axiomTypes); } }
<DeepExtract> if (axiomTypes == null || axiomTypes.isEmpty()) { axiomTypes = new HashSet<>(); axiomTypes.add(OWLAxiom.class); } return axiomTypes; </DeepExtract>
robot
positive
public void saveFrame(File file) throws IOException { if (!mEglCore.isCurrent(mEGLSurface)) { throw new RuntimeException("Expected EGL context/surface is not current"); } String filename = file.toString(); int width; if (mWidth < 0) { width = mEglCore.querySurface(mEGLSurface, EGL14.EGL_WIDTH); } else { width = mWidth; } int height; if (mHeight < 0) { height = mEglCore.querySurface(mEGLSurface, EGL14.EGL_HEIGHT); } else { height = mHeight; } ByteBuffer buf = ByteBuffer.allocateDirect(width * height * 4); buf.order(ByteOrder.LITTLE_ENDIAN); GLES20.glReadPixels(0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buf); GlUtil.checkGlError("glReadPixels"); buf.rewind(); BufferedOutputStream bos = null; try { bos = new BufferedOutputStream(new FileOutputStream(filename)); Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); bmp.copyPixelsFromBuffer(buf); bmp.compress(Bitmap.CompressFormat.PNG, 90, bos); bmp.recycle(); } finally { if (bos != null) bos.close(); } Log.d(TAG, "Saved " + width + "x" + height + " frame as '" + filename + "'"); }
<DeepExtract> int width; if (mWidth < 0) { width = mEglCore.querySurface(mEGLSurface, EGL14.EGL_WIDTH); } else { width = mWidth; } </DeepExtract> <DeepExtract> int height; if (mHeight < 0) { height = mEglCore.querySurface(mEGLSurface, EGL14.EGL_HEIGHT); } else { height = mHeight; } </DeepExtract>
PhotoMovie
positive
public long getHeapSize() { Preconditions.checkNotNull(JvmFlag.HEAP_SIZE, "Command-line argument cannot be null."); return jvmFlagSet.getValue(JvmFlag.HEAP_SIZE); }
<DeepExtract> Preconditions.checkNotNull(JvmFlag.HEAP_SIZE, "Command-line argument cannot be null."); return jvmFlagSet.getValue(JvmFlag.HEAP_SIZE); </DeepExtract>
groningen
positive
private static ArrayParam getArrayParam(@NotNull Element arrayParamElement, boolean getCommandDescriptions) { List<Param> paramList = new ArrayList<>(); return arrayParamElement.getAttribute("unbounded").equalsIgnoreCase("t") || arrayParamElement.getAttribute("unbounded").equalsIgnoreCase("true"); return arrayParamElement.getAttribute("optional").equalsIgnoreCase("t") || arrayParamElement.getAttribute("optional").equalsIgnoreCase("true"); List<Element> arrayElements = XmlUtil.getChildElementsWithTagName(arrayParamElement, "array"); for (Element arrayElement : arrayElements) { int order = getOrderForParam(paramList, arrayElement); paramList.set(order, getArrayParam(arrayElement, getCommandDescriptions)); } List<Element> paramElements = XmlUtil.getChildElementsWithTagName(arrayParamElement, "param"); for (Element paramElement : paramElements) { int order = getOrderForParam(paramList, paramElement); paramList.set(order, getParam(paramElement, getCommandDescriptions)); } return new ArrayParam(unbounded, paramList, optional); }
<DeepExtract> return arrayParamElement.getAttribute("unbounded").equalsIgnoreCase("t") || arrayParamElement.getAttribute("unbounded").equalsIgnoreCase("true"); </DeepExtract> <DeepExtract> return arrayParamElement.getAttribute("optional").equalsIgnoreCase("t") || arrayParamElement.getAttribute("optional").equalsIgnoreCase("true"); </DeepExtract>
arma-intellij-plugin
positive
public Criteria andLightSleepLessThanOrEqualTo(Short value) { if (value == null) { throw new RuntimeException("Value for " + "lightSleep" + " cannot be null"); } criteria.add(new Criterion("light_sleep <=", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "lightSleep" + " cannot be null"); } criteria.add(new Criterion("light_sleep <=", value)); </DeepExtract>
health_online
positive
public void setTabPaddingLeftRight(int paddingPx) { this.tabPadding = paddingPx; for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_SP, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } }
<DeepExtract> for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_SP, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } </DeepExtract>
MDroid
positive
@Test public void jsp_should_use_content_type_page_directive() throws Exception { HtmlPage page = webClient.getPage(baseURL + "resources/encoding/jsp/iso-8859-15"); Optional<NameValuePair> contentTypeHeader = page.getWebResponse().getResponseHeaders().stream().filter(header -> "Content-Type".equals(header.getName())).findFirst(); if (contentTypeHeader.isEmpty()) { fail("No Content-Type header found"); } assertEquals("text/html; charset=ISO-8859-15".replaceAll("\\s", "").toLowerCase(), contentTypeHeader.get().getValue().replaceAll("\\s", "").toLowerCase()); String umlauts = page.getElementById("umlauts").asNormalizedText(); assertEquals("äöü", umlauts); }
<DeepExtract> Optional<NameValuePair> contentTypeHeader = page.getWebResponse().getResponseHeaders().stream().filter(header -> "Content-Type".equals(header.getName())).findFirst(); if (contentTypeHeader.isEmpty()) { fail("No Content-Type header found"); } assertEquals("text/html; charset=ISO-8859-15".replaceAll("\\s", "").toLowerCase(), contentTypeHeader.get().getValue().replaceAll("\\s", "").toLowerCase()); </DeepExtract> <DeepExtract> String umlauts = page.getElementById("umlauts").asNormalizedText(); assertEquals("äöü", umlauts); </DeepExtract>
krazo
positive
@Override public void run() { if (task != null) { task.cancel(); } }
<DeepExtract> if (task != null) { task.cancel(); } </DeepExtract>
ChatGameFontificator
positive
public static String encodeFragment(String fragment) { if (fragment == null) { return null; } byte[] bytes; try { bytes = encodeBytes(fragment.getBytes(Opslab.UTF_8), URIPart.FRAGMENT); } catch (UnsupportedEncodingException ignore) { return null; } char[] chars = new char[bytes.length]; for (int i = 0; i < bytes.length; i++) { chars[i] = (char) bytes[i]; } return new String(chars); }
<DeepExtract> if (fragment == null) { return null; } byte[] bytes; try { bytes = encodeBytes(fragment.getBytes(Opslab.UTF_8), URIPart.FRAGMENT); } catch (UnsupportedEncodingException ignore) { return null; } char[] chars = new char[bytes.length]; for (int i = 0; i < bytes.length; i++) { chars[i] = (char) bytes[i]; } return new String(chars); </DeepExtract>
opslabJutil
positive
private void createJettyOptionsEditor(Composite parent) { Font font = parent.getFont(); Group group = new Group(parent, SWT.NONE); group.setText("Web Application"); group.setLayoutData(createHFillGridData()); { GridLayout layout = new GridLayout(); layout.numColumns = 6; group.setLayout(layout); } group.setFont(font); new Label(group, SWT.LEFT).setText("Port"); fPortText = new Text(group, SWT.SINGLE | SWT.BORDER); fPortText.addModifyListener(_updatedListener); fPortText.setLayoutData(createHFillGridData()); fPortText.setFont(font); fPortText.setTextLimit(5); fPortText.setLayoutData(createHFillGridData(5, -1)); GC gc = new GC(fPortText); try { Point sampleSize = gc.textExtent(" 65535 "); Point currentSize = fPortText.getSize(); sampleSize.y = currentSize.y; fPortText.setSize(sampleSize); return; } finally { gc.dispose(); } new Label(group, SWT.LEFT).setText("Context"); fContextText = new Text(group, SWT.SINGLE | SWT.BORDER); fContextText.addModifyListener(_updatedListener); fContextText.setLayoutData(createHFillGridData(5, -1)); fContextText.setFont(font); new Label(group, SWT.LEFT).setText("WebApp dir"); fWebAppDirText = new Text(group, SWT.SINGLE | SWT.BORDER); fWebAppDirText.addModifyListener(_updatedListener); fWebAppDirText.setLayoutData(createHFillGridData(3, -1)); fWebAppDirText.setFont(font); fWebappDirButton = createPushButton(group, "&Browse...", null); fWebappDirButton.addSelectionListener(new ButtonListener() { public void widgetSelected(SelectionEvent e) { chooseWebappDir(); } }); fWebappDirButton.setEnabled(false); fWebappDirButton.setLayoutData(new GridData()); fWebappScanButton = createPushButton(group, "&Scan...", null); fWebappScanButton.addSelectionListener(new ButtonListener() { public void widgetSelected(SelectionEvent e) { fWebAppDirText.setText(scanWebAppDir(fProjText.getText())); } }); fWebappScanButton.setEnabled(false); fWebappScanButton.setLayoutData(new GridData()); return; }
<DeepExtract> GC gc = new GC(fPortText); try { Point sampleSize = gc.textExtent(" 65535 "); Point currentSize = fPortText.getSize(); sampleSize.y = currentSize.y; fPortText.setSize(sampleSize); return; } finally { gc.dispose(); } </DeepExtract>
run-jetty-run
positive
@Test public void testOverrideWithDynamicArgs() throws Exception { String fooCode = "import java.util.List; public class Foo extends Bar<List>{ " + "public void doSomething(List... l){}" + " }"; String barCode = "import java.util.Collection; public class Bar<T extends Collection>{ " + "public void doSomething(T... c){}" + " }"; CompilationUnit cu = compile(fooCode, barCode); final TypeDeclaration type = cu.getTypes().get(0); final MethodDeclaration method = (MethodDeclaration) type.getMembers().get(0); Class<?> extended = ((ClassOrInterfaceDeclaration) type).getExtends().get(0).getSymbolData().getClazz(); assertEquals(methods(extended.getMethod("doSomething", Collection[].class)), OverrideAnalyzer.findOverriddenMethods(method)); if (methods(extended.getMethod("doSomething", Collection[].class)).isEmpty()) { assertFalse(OverrideAnalyzer.isMethodOverride(method)); } else { assertTrue(OverrideAnalyzer.isMethodOverride(method)); } }
<DeepExtract> assertEquals(methods(extended.getMethod("doSomething", Collection[].class)), OverrideAnalyzer.findOverriddenMethods(method)); if (methods(extended.getMethod("doSomething", Collection[].class)).isEmpty()) { assertFalse(OverrideAnalyzer.isMethodOverride(method)); } else { assertTrue(OverrideAnalyzer.isMethodOverride(method)); } </DeepExtract>
javalang-compiler
positive
@Override public void failure(RetrofitError error) { mProgressBar.setVisibility(View.GONE); Snackbar.make(mRecyclerView, R.string.network_problem_message, Snackbar.LENGTH_LONG).show(); }
<DeepExtract> mProgressBar.setVisibility(View.GONE); </DeepExtract>
sthlmtraveling
positive
@Override public void changedUpdate(DocumentEvent e) { try { int columns = Integer.parseInt(columnsTextField.getText()); signalButton.setValueColumns(columns); } catch (NumberFormatException e) { } }
<DeepExtract> try { int columns = Integer.parseInt(columnsTextField.getText()); signalButton.setValueColumns(columns); } catch (NumberFormatException e) { } </DeepExtract>
Ardulink-1
positive
public Edge addEdge(int n1, int n2, int o) { this.edges.add(new Edge(n1, n2, o)); _bondMap.resetCache(); _nodeMap.resetCache(); _ring.resetCache(); _averageBondLength.resetCache(); return this.edges.get(this.edges.size() - 1); }
<DeepExtract> _bondMap.resetCache(); _nodeMap.resetCache(); _ring.resetCache(); _averageBondLength.resetCache(); </DeepExtract>
molvec
positive
@Before public void setUp() { Date from = Date.from(Instant.EPOCH); Date to = new Date(); BigInteger tomics = monitorService.convertTokensToTomics(new BigDecimal(1000L)).toBigInteger(); saleTierService.saveRequireTransaction(new SaleTier(4, "4", from, to, new BigDecimal("0.0"), BigInteger.ZERO, tomics, true, false)); }
<DeepExtract> Date from = Date.from(Instant.EPOCH); Date to = new Date(); BigInteger tomics = monitorService.convertTokensToTomics(new BigDecimal(1000L)).toBigInteger(); saleTierService.saveRequireTransaction(new SaleTier(4, "4", from, to, new BigDecimal("0.0"), BigInteger.ZERO, tomics, true, false)); </DeepExtract>
ICOnator-backend
positive
public void actionPerformed(java.awt.event.ActionEvent evt) { }
<DeepExtract> </DeepExtract>
HBase-Manager
positive
public BundleBuilder addShort(@NonNull String key, @NonNull Short value) { if (value == null || key == null) { return this; } extras.put(key, value); return this; }
<DeepExtract> if (value == null || key == null) { return this; } extras.put(key, value); return this; </DeepExtract>
ndileber
positive
public boolean delete(Long id) { Integer result = taskInfoMapper.deleteById(id); dbLogService.dbLog("delete task by id:" + id); return result > 0; }
<DeepExtract> return result > 0; </DeepExtract>
KafkaCenter
positive
@Override public void updatePose() { double deltaLeftEncoder = m_left.getAsDouble() - prevLeftEncoder; double deltaRightEncoder = m_right.getAsDouble() - prevRightEncoder; double deltaHorizontalEncoder = m_horizontal.getAsDouble() - prevHorizontalEncoder; Rotation2d angle = previousAngle.plus(new Rotation2d((deltaLeftEncoder - deltaRightEncoder) / trackWidth)); prevLeftEncoder = m_left.getAsDouble(); prevRightEncoder = m_right.getAsDouble(); prevHorizontalEncoder = m_horizontal.getAsDouble(); double dw = (angle.minus(previousAngle).getRadians()); double dx = (deltaLeftEncoder + deltaRightEncoder) / 2; double dy = deltaHorizontalEncoder - (centerWheelOffset * dw); Twist2d twist2d = new Twist2d(dx, dy, dw); Pose2d newPose = robotPose.exp(twist2d); previousAngle = angle; robotPose = new Pose2d(newPose.getTranslation(), angle); }
<DeepExtract> double deltaLeftEncoder = m_left.getAsDouble() - prevLeftEncoder; double deltaRightEncoder = m_right.getAsDouble() - prevRightEncoder; double deltaHorizontalEncoder = m_horizontal.getAsDouble() - prevHorizontalEncoder; Rotation2d angle = previousAngle.plus(new Rotation2d((deltaLeftEncoder - deltaRightEncoder) / trackWidth)); prevLeftEncoder = m_left.getAsDouble(); prevRightEncoder = m_right.getAsDouble(); prevHorizontalEncoder = m_horizontal.getAsDouble(); double dw = (angle.minus(previousAngle).getRadians()); double dx = (deltaLeftEncoder + deltaRightEncoder) / 2; double dy = deltaHorizontalEncoder - (centerWheelOffset * dw); Twist2d twist2d = new Twist2d(dx, dy, dw); Pose2d newPose = robotPose.exp(twist2d); previousAngle = angle; robotPose = new Pose2d(newPose.getTranslation(), angle); </DeepExtract>
FTCLib
positive
public Builder clearMetadata() { super.clear(); size_ = 0L; inProcess_ = 0; internalGetMutableCounts().clear(); numberOfQueues_ = 0L; crawlID_ = ""; return this; return this; }
<DeepExtract> super.clear(); size_ = 0L; inProcess_ = 0; internalGetMutableCounts().clear(); numberOfQueues_ = 0L; crawlID_ = ""; return this; </DeepExtract>
url-frontier
positive
public void createPartControl(Composite parent, IFile file, String targetName) { toolkit = new FormToolkit(parent.getDisplay()); Form form = toolkit.createForm(parent); toolkit.decorateFormHeading(form); form.setText(Messages.IDFSizeOverviewComposite_ApplicatoinMemoryUsage); form.getBody().setLayout(new GridLayout()); Section ec2 = toolkit.createSection(form.getBody(), Section.TITLE_BAR); ec2.setText(Messages.IDFSizeOverviewComposite_Overview); ec2.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); overviewComp = new Composite(ec2, SWT.NONE); overviewComp.setLayout(new GridLayout(2, false)); overviewComp.setBackground(form.getBody().getBackground()); overviewComp.setForeground(form.getBody().getForeground()); ec2.setClient(overviewComp); JSONObject idfSizeOverview = null; try { idfSizeOverview = new IDFSizeDataManager().getIDFSizeOverview(file, targetName); } catch (Exception e) { Logger.log(e); } return idfSizeOverview; long dram_data = (long) overviewJson.get(IDFSizeConstants.AVAILABLE_DIRAM); long dram_bss = (long) overviewJson.get(IDFSizeConstants.DRAM_BSS); long flash_code = (long) overviewJson.get(IDFSizeConstants.FLASH_CODE); long flash_rodata = (long) overviewJson.get(IDFSizeConstants.FLASH_RODATA_OVERVIEW); long total_size = (long) overviewJson.get(IDFSizeConstants.TOTAL_SIZE); Label sizeLbl = toolkit.createLabel(overviewComp, Messages.IDFSizeOverviewComposite_TotalSize); Label sizeVal = toolkit.createLabel(overviewComp, convertToKB(total_size)); FontDescriptor boldDescriptor = FontDescriptor.createFrom(sizeLbl.getFont()).setStyle(SWT.BOLD); boldFont = boldDescriptor.createFont(sizeLbl.getDisplay()); sizeVal.setFont(boldFont); toolkit.createLabel(overviewComp, Messages.IDFSizeOverviewComposite_DramDataSize); Label b1Val = toolkit.createLabel(overviewComp, convertToKB(dram_data)); b1Val.setFont(boldFont); toolkit.createLabel(overviewComp, Messages.IDFSizeOverviewComposite_DramBssSize); Label b2Val = toolkit.createLabel(overviewComp, convertToKB(dram_bss)); b2Val.setFont(boldFont); toolkit.createLabel(overviewComp, Messages.IDFSizeOverviewComposite_FlashCodeSize); Label b3Val = toolkit.createLabel(overviewComp, convertToKB(flash_code)); b3Val.setFont(boldFont); toolkit.createLabel(overviewComp, Messages.IDFSizeOverviewComposite_FlashRoDataSize); Label b4Val = toolkit.createLabel(overviewComp, convertToKB(flash_rodata)); b4Val.setFont(boldFont); Section ec = toolkit.createSection(form.getBody(), Section.TITLE_BAR); ec.setText(Messages.IDFSizeOverviewComposite_MemoryAllocation); ec.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); chartComp = new Composite(ec, SWT.NONE); chartComp.setLayout(new GridLayout(2, false)); chartComp.setBackground(form.getBody().getBackground()); chartComp.setForeground(form.getBody().getForeground()); ec.setClient(chartComp); long available_diram = overviewJson.get(IDFSizeConstants.AVAILABLE_DIRAM) != null ? (long) overviewJson.get(IDFSizeConstants.AVAILABLE_DIRAM) : 0; if (available_diram == 0) { plotDoubleBar(); } else { plotSingleBar(); } }
<DeepExtract> JSONObject idfSizeOverview = null; try { idfSizeOverview = new IDFSizeDataManager().getIDFSizeOverview(file, targetName); } catch (Exception e) { Logger.log(e); } return idfSizeOverview; </DeepExtract>
idf-eclipse-plugin
positive
public Object deserialize(final Map<String, String> attributes) { final Map<String, Map<String, String>> nestedFields = AttributesKeySplitter.splitNestedAttributeKeys(attributes); for (final Entry<String, Map<String, String>> nestedField : nestedFields.entrySet()) { final String fieldName = nestedField.getKey(); final Map<String, String> fieldAttributes = nestedField.getValue(); AbstractFieldWrapper<T, ID> fieldWrapper = getWrapper(fieldName); Object convertedValue = fieldWrapper.deserialize(fieldAttributes); fieldWrapper.setFieldValue(convertedValue); } final Map<String, String> simpleFields = AttributesKeySplitter.splitSimpleAttributesKeys(attributes); for (final Entry<String, String> simpleField : simpleFields.entrySet()) { final String fieldName = simpleField.getKey(); AbstractFieldWrapper<T, ID> fieldWrapper = getWrapper(fieldName); Map<String, String> fieldAttributes = new LinkedHashMap<String, String>(); fieldAttributes.put(fieldName, simpleField.getValue()); Object convertedValue = fieldWrapper.deserialize(fieldAttributes); fieldWrapper.setFieldValue(convertedValue); } return item; }
<DeepExtract> return item; </DeepExtract>
spring-data-simpledb
positive
public Criteria andContentEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "content" + " cannot be null"); } criteria.add(new Criterion("content =", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "content" + " cannot be null"); } criteria.add(new Criterion("content =", value)); </DeepExtract>
Tmall_SSM-master
positive
public void saveTranslationResult(USDocument document, USTranslationResult result) { ArrayList<USTranslationResult> al = new ArrayList<USTranslationResult>(1); al.add(result); org.hibernate.Session session = usHibernateUtil.getSessionWithActiveTransaction(); document.saveToDatabaseJustDocument(session); for (USTranslationResult tr : al) { document.addOrReplaceTranslationResult(tr); tr.saveToDatabase(session); } usHibernateUtil.closeAndCommitSession(session); }
<DeepExtract> org.hibernate.Session session = usHibernateUtil.getSessionWithActiveTransaction(); document.saveToDatabaseJustDocument(session); for (USTranslationResult tr : al) { document.addOrReplaceTranslationResult(tr); tr.saveToDatabase(session); } usHibernateUtil.closeAndCommitSession(session); </DeepExtract>
FilmTit
positive
@Override protected void onResume() { super.onResume(); Services.location.locationUpdates.subscribeMain(this); final MLocation loc = Services.location.lastLoc; if (loc != null) { binding.satelliteLabel.setText("Satellites: " + loc.satellitesUsed + " used in fix, " + loc.satellitesInView + " visible"); if (Numbers.isReal(loc.latitude)) { binding.latitudeLabel.setText(String.format(Locale.getDefault(), "Lat: %.6f", loc.latitude)); } else { binding.latitudeLabel.setText("Lat: "); } if (Numbers.isReal(loc.latitude)) { binding.longitudeLabel.setText(String.format(Locale.getDefault(), "Long: %.6f", loc.longitude)); } else { binding.longitudeLabel.setText("Long: "); } binding.gpsAltitudeLabel.setText("GPS altitude: " + Convert.distance(loc.altitude_gps, 2, true)); binding.gpsFallrateLabel.setText("GPS fallrate: " + Convert.speed(-loc.climb, 2, true)); binding.hAccLabel.setText("hAcc: " + Convert.distance(loc.hAcc)); binding.pdopLabel.setText(String.format(Locale.getDefault(), "pdop: %.1f", loc.pdop)); binding.hdopLabel.setText(String.format(Locale.getDefault(), "hdop: %.1f", loc.hdop)); binding.vdopLabel.setText(String.format(Locale.getDefault(), "vdop: %.1f", loc.vdop)); binding.groundSpeedLabel.setText("Ground speed: " + Convert.speed(loc.groundSpeed(), 2, true)); binding.totalSpeedLabel.setText("Total speed: " + Convert.speed(loc.totalSpeed(), 2, true)); binding.glideRatioLabel.setText("Glide ratio: " + Convert.glide(loc.groundSpeed(), loc.climb, 2, true)); binding.glideAngleLabel.setText("Glide angle: " + Convert.angle(loc.glideAngle())); binding.bearingLabel.setText("Bearing: " + Convert.bearing2(loc.bearing())); binding.flightModeLabel.setText("Flight mode: " + Services.flightComputer.getModeString()); binding.placeLabel.setText("Location: " + Services.places.nearestPlace.getString(loc)); } EventBus.getDefault().register(this); binding.altiSourceLabel.setText("Data source: " + altimeterSource()); binding.altitudeLabel.setText("Altitude MSL: " + Convert.distance(Services.alti.altitude, 2, true)); binding.altitudeAglLabel.setText("Altitude AGL: " + Convert.distance(Services.alti.altitudeAGL(), 2, true) + " AGL"); binding.pressureLabel.setText(String.format(Locale.getDefault(), "Pressure: %s (%.2fHz)", Convert.pressure(Services.alti.baro.pressure), Services.alti.baro.refreshRate.refreshRate)); binding.pressureAltitudeLabel.setText("Pressure altitude raw: " + Convert.distance(Services.alti.baro.pressure_altitude_raw, 2, true)); if (Double.isNaN(Services.alti.baro.pressure_altitude_filtered)) { binding.pressureAltitudeFilteredLabel.setText("Pressure altitude filtered: "); } else { binding.pressureAltitudeFilteredLabel.setText("Pressure altitude filtered: " + Convert.distance(Services.alti.baro.pressure_altitude_filtered, 2, true) + " +/- " + Convert.distance(Math.sqrt(Services.alti.baro.model_error.var()), 2, true)); } binding.fallrateLabel.setText("Fallrate: " + Convert.speed(-Services.alti.climb, 2, true)); updateRunnable = new Runnable() { public void run() { update(); handler.postDelayed(this, updateInterval); } }; handler.post(updateRunnable); if (Services.bluetooth.preferences.preferenceEnabled) { binding.gpsSourceLabel.setText("Data source: Bluetooth GPS"); if (Services.bluetooth.preferences.preferenceDeviceName == null) { binding.bluetoothStatusLabel.setText("Bluetooth: (not selected)"); } else { String status = "Bluetooth: " + Services.bluetooth.preferences.preferenceDeviceName; if (Services.bluetooth.charging) { status += " charging"; } else if (!Float.isNaN(Services.bluetooth.powerLevel)) { final int powerLevel = (int) (Services.bluetooth.powerLevel * 100); status += " " + powerLevel + "%"; } binding.bluetoothStatusLabel.setText(status); binding.bluetoothStatusLabel.setVisibility(View.VISIBLE); } } else { binding.gpsSourceLabel.setText("Data source: " + Build.MANUFACTURER + " " + Build.MODEL); binding.bluetoothStatusLabel.setVisibility(View.GONE); } final long lastFixDuration = Services.location.lastFixDuration(); if (lastFixDuration >= 0) { if (lastFixDuration > 2000) { float frac = (5000f - lastFixDuration) / (3000f); frac = Math.max(0, Math.min(frac, 1)); final int b = (int) (0xb0 * frac); final int gb = b + 0x100 * b; binding.lastFixLabel.setTextColor(0xffb00000 + gb); } else { binding.lastFixLabel.setTextColor(0xffb0b0b0); } String lastFix = (lastFixDuration / 1000) + "s"; final float refreshRate = Services.location.refreshRate.refreshRate; if (refreshRate > 0) { lastFix += String.format(Locale.getDefault(), " (%.2fHz)", refreshRate); } binding.lastFixLabel.setText("Last fix: " + lastFix); } else { binding.lastFixLabel.setTextColor(0xffb0b0b0); binding.lastFixLabel.setText("Last fix: "); } binding.pressureLabel.setText(String.format(Locale.getDefault(), "Pressure: %s (%.2fHz)", Convert.pressure(Services.alti.baro.pressure), Services.alti.baro.refreshRate.refreshRate)); }
<DeepExtract> final MLocation loc = Services.location.lastLoc; if (loc != null) { binding.satelliteLabel.setText("Satellites: " + loc.satellitesUsed + " used in fix, " + loc.satellitesInView + " visible"); if (Numbers.isReal(loc.latitude)) { binding.latitudeLabel.setText(String.format(Locale.getDefault(), "Lat: %.6f", loc.latitude)); } else { binding.latitudeLabel.setText("Lat: "); } if (Numbers.isReal(loc.latitude)) { binding.longitudeLabel.setText(String.format(Locale.getDefault(), "Long: %.6f", loc.longitude)); } else { binding.longitudeLabel.setText("Long: "); } binding.gpsAltitudeLabel.setText("GPS altitude: " + Convert.distance(loc.altitude_gps, 2, true)); binding.gpsFallrateLabel.setText("GPS fallrate: " + Convert.speed(-loc.climb, 2, true)); binding.hAccLabel.setText("hAcc: " + Convert.distance(loc.hAcc)); binding.pdopLabel.setText(String.format(Locale.getDefault(), "pdop: %.1f", loc.pdop)); binding.hdopLabel.setText(String.format(Locale.getDefault(), "hdop: %.1f", loc.hdop)); binding.vdopLabel.setText(String.format(Locale.getDefault(), "vdop: %.1f", loc.vdop)); binding.groundSpeedLabel.setText("Ground speed: " + Convert.speed(loc.groundSpeed(), 2, true)); binding.totalSpeedLabel.setText("Total speed: " + Convert.speed(loc.totalSpeed(), 2, true)); binding.glideRatioLabel.setText("Glide ratio: " + Convert.glide(loc.groundSpeed(), loc.climb, 2, true)); binding.glideAngleLabel.setText("Glide angle: " + Convert.angle(loc.glideAngle())); binding.bearingLabel.setText("Bearing: " + Convert.bearing2(loc.bearing())); binding.flightModeLabel.setText("Flight mode: " + Services.flightComputer.getModeString()); binding.placeLabel.setText("Location: " + Services.places.nearestPlace.getString(loc)); } </DeepExtract> <DeepExtract> binding.altiSourceLabel.setText("Data source: " + altimeterSource()); binding.altitudeLabel.setText("Altitude MSL: " + Convert.distance(Services.alti.altitude, 2, true)); binding.altitudeAglLabel.setText("Altitude AGL: " + Convert.distance(Services.alti.altitudeAGL(), 2, true) + " AGL"); binding.pressureLabel.setText(String.format(Locale.getDefault(), "Pressure: %s (%.2fHz)", Convert.pressure(Services.alti.baro.pressure), Services.alti.baro.refreshRate.refreshRate)); binding.pressureAltitudeLabel.setText("Pressure altitude raw: " + Convert.distance(Services.alti.baro.pressure_altitude_raw, 2, true)); if (Double.isNaN(Services.alti.baro.pressure_altitude_filtered)) { binding.pressureAltitudeFilteredLabel.setText("Pressure altitude filtered: "); } else { binding.pressureAltitudeFilteredLabel.setText("Pressure altitude filtered: " + Convert.distance(Services.alti.baro.pressure_altitude_filtered, 2, true) + " +/- " + Convert.distance(Math.sqrt(Services.alti.baro.model_error.var()), 2, true)); } binding.fallrateLabel.setText("Fallrate: " + Convert.speed(-Services.alti.climb, 2, true)); </DeepExtract> <DeepExtract> if (Services.bluetooth.preferences.preferenceEnabled) { binding.gpsSourceLabel.setText("Data source: Bluetooth GPS"); if (Services.bluetooth.preferences.preferenceDeviceName == null) { binding.bluetoothStatusLabel.setText("Bluetooth: (not selected)"); } else { String status = "Bluetooth: " + Services.bluetooth.preferences.preferenceDeviceName; if (Services.bluetooth.charging) { status += " charging"; } else if (!Float.isNaN(Services.bluetooth.powerLevel)) { final int powerLevel = (int) (Services.bluetooth.powerLevel * 100); status += " " + powerLevel + "%"; } binding.bluetoothStatusLabel.setText(status); binding.bluetoothStatusLabel.setVisibility(View.VISIBLE); } } else { binding.gpsSourceLabel.setText("Data source: " + Build.MANUFACTURER + " " + Build.MODEL); binding.bluetoothStatusLabel.setVisibility(View.GONE); } final long lastFixDuration = Services.location.lastFixDuration(); if (lastFixDuration >= 0) { if (lastFixDuration > 2000) { float frac = (5000f - lastFixDuration) / (3000f); frac = Math.max(0, Math.min(frac, 1)); final int b = (int) (0xb0 * frac); final int gb = b + 0x100 * b; binding.lastFixLabel.setTextColor(0xffb00000 + gb); } else { binding.lastFixLabel.setTextColor(0xffb0b0b0); } String lastFix = (lastFixDuration / 1000) + "s"; final float refreshRate = Services.location.refreshRate.refreshRate; if (refreshRate > 0) { lastFix += String.format(Locale.getDefault(), " (%.2fHz)", refreshRate); } binding.lastFixLabel.setText("Last fix: " + lastFix); } else { binding.lastFixLabel.setTextColor(0xffb0b0b0); binding.lastFixLabel.setText("Last fix: "); } binding.pressureLabel.setText(String.format(Locale.getDefault(), "Pressure: %s (%.2fHz)", Convert.pressure(Services.alti.baro.pressure), Services.alti.baro.refreshRate.refreshRate)); </DeepExtract>
BASElineFlightComputer
positive
@Override public void onResume() { super.onResume(); LogUtils.logd(TAG, "[onResume]"); if (mSession == null || getView() == null) { Log.e(TAG, "Bailing out of maybeShowHideTaglines: mSession: " + mSession + " getView(): " + getView()); return; } boolean hideTagline = mSession.getHidePoweredBy(); int visibility = hideTagline ? View.GONE : View.VISIBLE; View tagline = getView().findViewById(R.id.jr_tagline); if (tagline != null) tagline.setVisibility(visibility); View bonusTagline = getView().findViewById(R.id.jr_email_sms_powered_by_text); if (bonusTagline != null) bonusTagline.setVisibility(visibility); if (mCustomInterfaceConfiguration != null) mCustomInterfaceConfiguration.onResume(); }
<DeepExtract> if (mSession == null || getView() == null) { Log.e(TAG, "Bailing out of maybeShowHideTaglines: mSession: " + mSession + " getView(): " + getView()); return; } boolean hideTagline = mSession.getHidePoweredBy(); int visibility = hideTagline ? View.GONE : View.VISIBLE; View tagline = getView().findViewById(R.id.jr_tagline); if (tagline != null) tagline.setVisibility(visibility); View bonusTagline = getView().findViewById(R.id.jr_email_sms_powered_by_text); if (bonusTagline != null) bonusTagline.setVisibility(visibility); </DeepExtract>
engage.android
positive
public Criteria andItemNoGreaterThanOrEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "itemNo" + " cannot be null"); } criteria.add(new Criterion("ITEM_NO >=", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "itemNo" + " cannot be null"); } criteria.add(new Criterion("ITEM_NO >=", value)); </DeepExtract>
ECPS
positive
public void show() { final int offset = getSelectionStart(); if (offset < 0) { Log.w(TAG, "Update cursor controller position called with no cursor"); hide(); return; } mHandle.positionAtCursor(offset, true); mHandle.show(); removeCallbacks(mHider); postDelayed(mHider, DELAY_BEFORE_FADE_OUT); }
<DeepExtract> final int offset = getSelectionStart(); if (offset < 0) { Log.w(TAG, "Update cursor controller position called with no cursor"); hide(); return; } mHandle.positionAtCursor(offset, true); </DeepExtract> <DeepExtract> removeCallbacks(mHider); postDelayed(mHider, DELAY_BEFORE_FADE_OUT); </DeepExtract>
Jota-Text-Editor-old
positive
public void addFace(Point3d p1, Point3d p2, Point3d p3) { Face f = new Face(); f.verts[0][X] = p1.x; f.verts[0][Y] = p1.y; f.verts[0][Z] = p1.z; f.verts[1][X] = p2.x; f.verts[1][Y] = p2.y; f.verts[1][Z] = p2.z; f.verts[2][X] = p3.x; f.verts[2][Y] = p3.y; f.verts[2][Z] = p3.z; double dx1 = f.verts[1][X] - f.verts[0][X]; double dy1 = f.verts[1][Y] - f.verts[0][Y]; double dz1 = f.verts[1][Z] - f.verts[0][Z]; double dx2 = f.verts[2][X] - f.verts[1][X]; double dy2 = f.verts[2][Y] - f.verts[1][Y]; double dz2 = f.verts[2][Z] - f.verts[1][Z]; double nx = dy1 * dz2 - dy2 * dz1; double ny = dz1 * dx2 - dz2 * dx1; double nz = dx1 * dy2 - dx2 * dy1; double len = Math.sqrt(nx * nx + ny * ny + nz * nz); if (len == 0) { numDegenerateTriangles++; return; } f.norm[X] = nx / len; f.norm[Y] = ny / len; f.norm[Z] = nz / len; f.w = -f.norm[X] * f.verts[0][X] - f.norm[Y] * f.verts[0][Y] - f.norm[Z] * f.verts[0][Z]; faces.add(f); }
<DeepExtract> double dx1 = f.verts[1][X] - f.verts[0][X]; double dy1 = f.verts[1][Y] - f.verts[0][Y]; double dz1 = f.verts[1][Z] - f.verts[0][Z]; double dx2 = f.verts[2][X] - f.verts[1][X]; double dy2 = f.verts[2][Y] - f.verts[1][Y]; double dz2 = f.verts[2][Z] - f.verts[1][Z]; double nx = dy1 * dz2 - dy2 * dz1; double ny = dz1 * dx2 - dz2 * dx1; double nz = dx1 * dy2 - dx2 * dy1; double len = Math.sqrt(nx * nx + ny * ny + nz * nz); if (len == 0) { numDegenerateTriangles++; return; } f.norm[X] = nx / len; f.norm[Y] = ny / len; f.norm[Z] = nz / len; f.w = -f.norm[X] * f.verts[0][X] - f.norm[Y] * f.verts[0][Y] - f.norm[Z] * f.verts[0][Z]; faces.add(f); </DeepExtract>
AdaptiveMerging
positive
public static byte[] getBytesUtf8(String string) { if (string == null) { return null; } try { return string.getBytes(CharEncoding.UTF_8); } catch (UnsupportedEncodingException e) { throw StringUtils.newIllegalStateException(CharEncoding.UTF_8, e); } }
<DeepExtract> if (string == null) { return null; } try { return string.getBytes(CharEncoding.UTF_8); } catch (UnsupportedEncodingException e) { throw StringUtils.newIllegalStateException(CharEncoding.UTF_8, e); } </DeepExtract>
qpysl4a
positive
public Object nextValue() throws JSONException { char c; for (; ; ) { char c = this.next(); if (c == 0 || c > ' ') { c = c; } } switch(c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); case '[': this.back(); return new JSONArray(this); } StringBuilder sb = new StringBuilder(); while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) { sb.append(c); c = this.next(); } if (this.usePrevious || this.index <= 0) { throw new JSONException("Stepping back two steps is not supported"); } this.decrementIndexes(); this.usePrevious = true; this.eof = false; string = sb.toString().trim(); if ("".equals(string)) { throw this.syntaxError("Missing value"); } return JSONObject.stringToValue(string); }
<DeepExtract> char c; for (; ; ) { char c = this.next(); if (c == 0 || c > ' ') { c = c; } } </DeepExtract> <DeepExtract> if (this.usePrevious || this.index <= 0) { throw new JSONException("Stepping back two steps is not supported"); } this.decrementIndexes(); this.usePrevious = true; this.eof = false; </DeepExtract>
latke
positive
public void clickIndentButton() { pushButton("//div[@title='" + TOOLBAR_BUTTON_INDENT_TITLE + "']"); }
<DeepExtract> pushButton("//div[@title='" + TOOLBAR_BUTTON_INDENT_TITLE + "']"); </DeepExtract>
xwiki-enterprise
positive
public String dumpCode(Library lib) { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, Node> entry : nodes.entrySet()) { sb.append("Node \n" + entry.getKey() + ":"); int instruction_count = 0; ArrayList<Instruction> instructions = entry.getValue().instructions; for (int i = 0; i < instructions.size(); i++) { Instruction instruction = instructions.get(i); String instruction_text = null; if (instruction.operation == ByteCode.Label) { instruction_text = instruction.toString(this, lib); } else { instruction_text = " " + instruction.toString(this, lib); } String preface; if (instruction_count % 5 == 0 || instruction_count == entry.getValue().instructions.size() - 1) { preface = String.format("%1$6s", instruction_count + ""); } else { preface = String.format("%1$6s ", " "); } sb.append(preface + instruction_text + "\n"); instruction_count++; } sb.append("\n\n"); } Json json = new Json(); return json.prettyPrint(this); }
<DeepExtract> Json json = new Json(); return json.prettyPrint(this); </DeepExtract>
YarnGdx
positive
private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) { return new fuzzy_reduction_argsStandardScheme(); }
<DeepExtract> return new fuzzy_reduction_argsStandardScheme(); </DeepExtract>
aiop-core
positive
public String toString() { return "LFXSiteID: " + LFXByteUtils.byteArrayToHexString(data); }
<DeepExtract> return "LFXSiteID: " + LFXByteUtils.byteArrayToHexString(data); </DeepExtract>
lifx-sdk-android
positive
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userName = "Jack"; request.getSession().setAttribute("userName", userName); RequestDispatcher rd = getServletContext().getRequestDispatcher("/showGreetingInfo"); rd.forward(request, response); }
<DeepExtract> String userName = "Jack"; request.getSession().setAttribute("userName", userName); RequestDispatcher rd = getServletContext().getRequestDispatcher("/showGreetingInfo"); rd.forward(request, response); </DeepExtract>
Java_Course
positive
@Test public void mustReturnBucketsFromRepository2() throws IOException { assertNotNull(bucketRepository, "Must have a repository"); List<Document> actualResults = bucketRepository.getBucketResults2().collectList().block(); assertNotNull(actualResults); assertEquals(actualResults.size(), 3); ObjectMapper mapper = new ObjectMapper(); TypeReference<List<Map<String, Object>>> expectedResultType = new TypeReference<List<Map<String, Object>>>() { }; List<Map<String, Object>> expectedResultList = mapper.readValue(expectedResults, expectedResultType); assertEquals(expectedResultList.size(), 3); for (int i = 0; i < expectedResultList.size(); i++) { assertEquals(actualResults.get(0).get("_id"), expectedResultList.get(0).get("id")); assertEquals(actualResults.get(0).get("count"), expectedResultList.get(0).get("count")); List<String> titles = (List<String>) actualResults.get(0).get("titles"); List<String> expectedTitles = (List<String>) expectedResultList.get(0).get("titles"); assertEquals(titles.size(), ((List<String>) expectedResultList.get(0).get("titles")).size()); Collections.sort(titles); Collections.sort(expectedTitles); for (int j = 0; j < titles.size(); j++) { assertEquals(titles.get(j), expectedTitles.get(j)); } } }
<DeepExtract> assertEquals(expectedResultList.size(), 3); for (int i = 0; i < expectedResultList.size(); i++) { assertEquals(actualResults.get(0).get("_id"), expectedResultList.get(0).get("id")); assertEquals(actualResults.get(0).get("count"), expectedResultList.get(0).get("count")); List<String> titles = (List<String>) actualResults.get(0).get("titles"); List<String> expectedTitles = (List<String>) expectedResultList.get(0).get("titles"); assertEquals(titles.size(), ((List<String>) expectedResultList.get(0).get("titles")).size()); Collections.sort(titles); Collections.sort(expectedTitles); for (int j = 0; j < titles.size(); j++) { assertEquals(titles.get(j), expectedTitles.get(j)); } } </DeepExtract>
mongodb-aggregate-query-support
positive
private void updateUi() { if (instruction != null && instruction.isBreakpoint()) { breakpointImage.setResource(res.breakpoint()); } else { breakpointImage.setResource(res.noBreakpoint()); } if (instruction.getInstruction() instanceof ErrorInstruction) { this.addStyleName(res.style().invalidInstruction()); } else { this.removeStyleName(res.style().invalidInstruction()); } }
<DeepExtract> if (instruction != null && instruction.isBreakpoint()) { breakpointImage.setResource(res.breakpoint()); } else { breakpointImage.setResource(res.noBreakpoint()); } </DeepExtract> <DeepExtract> if (instruction.getInstruction() instanceof ErrorInstruction) { this.addStyleName(res.style().invalidInstruction()); } else { this.removeStyleName(res.style().invalidInstruction()); } </DeepExtract>
nevada
positive
public String patch_toText(List<Patch> patches) { StringBuilder text = new StringBuilder(); for (Patch aPatch : patches) { text.append(aPatch); } String prettyText = this.text.replace('\n', '\u00b6'); return "Diff(" + this.operation + ",\"" + prettyText + "\")"; }
<DeepExtract> String prettyText = this.text.replace('\n', '\u00b6'); return "Diff(" + this.operation + ",\"" + prettyText + "\")"; </DeepExtract>
startup-os
positive
public static Automaton trim(Automaton a, String set, char c) { a = a.cloneExpandedIfRequired(); State f = new State(); for (int n = 0; n < set.length(); n++) f.transitions.add(new Transition(set.charAt(n), f)); f.accept = true; for (State s : a.getStates()) { State r = s.step(c); if (r != null) { State q = new State(); addSetTransitions(q, set, q); addSetTransitions(s, set, q); q.addEpsilon(r); } if (s.accept) s.addEpsilon(f); } State p = new State(); for (int n = 0; n < set.length(); n++) p.transitions.add(new Transition(set.charAt(n), p)); p.addEpsilon(a.initial); a.initial = p; a.deterministic = false; a.removeDeadTransitions(); a.checkMinimizeAlways(); return a; }
<DeepExtract> for (int n = 0; n < set.length(); n++) f.transitions.add(new Transition(set.charAt(n), f)); </DeepExtract> <DeepExtract> for (int n = 0; n < set.length(); n++) p.transitions.add(new Transition(set.charAt(n), p)); </DeepExtract>
schemely
positive
public static void main(String[] args) { Trace log = new SystemTrace(); this.debug = true; if (debug) { pw.println("DEBUG: " + "entering log"); pw.flush(); } }
<DeepExtract> this.debug = true; </DeepExtract> <DeepExtract> if (debug) { pw.println("DEBUG: " + "entering log"); pw.flush(); } </DeepExtract>
javase
positive
public Criteria andAccountIdIsNotNull() { if ("ACCOUNTID is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("ACCOUNTID is not null")); return (Criteria) this; }
<DeepExtract> if ("ACCOUNTID is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("ACCOUNTID is not null")); </DeepExtract>
compass
positive
protected void backgroundImpl() { if (styleStackDepth == styleStack.length) { styleStack = (RainbowStyle[]) RainbowMath.expand(styleStack); } if (styleStack[styleStackDepth] == null) { styleStack[styleStackDepth] = new RainbowStyle(); } RainbowStyle s = styleStack[styleStackDepth++]; getStyle(s); showMethodWarning("pushMatrix"); showMethodWarning("resetMatrix"); colorCalc(backgroundColor); fillFromCalc(); float hradius, vradius; switch(rectMode) { case CORNERS: break; case CORNER: width += 0; height += 0; break; case RADIUS: hradius = width; vradius = height; width = 0 + hradius; height = 0 + vradius; 0 -= hradius; 0 -= vradius; break; case CENTER: hradius = width / 2.0f; vradius = height / 2.0f; width = 0 + hradius; height = 0 + vradius; 0 -= hradius; 0 -= vradius; } if (0 > width) { float temp = 0; 0 = width; width = temp; } if (0 > height) { float temp = 0; 0 = height; height = temp; } rectImpl(0, 0, width, height); showMethodWarning("popMatrix"); if (styleStackDepth == 0) { throw new RuntimeException("Too many popStyle() without enough pushStyle()"); } styleStackDepth--; style(styleStack[styleStackDepth]); }
<DeepExtract> if (styleStackDepth == styleStack.length) { styleStack = (RainbowStyle[]) RainbowMath.expand(styleStack); } if (styleStack[styleStackDepth] == null) { styleStack[styleStackDepth] = new RainbowStyle(); } RainbowStyle s = styleStack[styleStackDepth++]; getStyle(s); </DeepExtract> <DeepExtract> showMethodWarning("pushMatrix"); </DeepExtract> <DeepExtract> showMethodWarning("resetMatrix"); </DeepExtract> <DeepExtract> colorCalc(backgroundColor); fillFromCalc(); </DeepExtract> <DeepExtract> float hradius, vradius; switch(rectMode) { case CORNERS: break; case CORNER: width += 0; height += 0; break; case RADIUS: hradius = width; vradius = height; width = 0 + hradius; height = 0 + vradius; 0 -= hradius; 0 -= vradius; break; case CENTER: hradius = width / 2.0f; vradius = height / 2.0f; width = 0 + hradius; height = 0 + vradius; 0 -= hradius; 0 -= vradius; } if (0 > width) { float temp = 0; 0 = width; width = temp; } if (0 > height) { float temp = 0; 0 = height; height = temp; } rectImpl(0, 0, width, height); </DeepExtract> <DeepExtract> showMethodWarning("popMatrix"); </DeepExtract> <DeepExtract> if (styleStackDepth == 0) { throw new RuntimeException("Too many popStyle() without enough pushStyle()"); } styleStackDepth--; style(styleStack[styleStackDepth]); </DeepExtract>
rainbow
positive
public static double[] readDoubles(String filename) { String[] fields = readAllStrings(); double[] vals = new double[fields.length]; for (int i = 0; i < fields.length; i++) vals[i] = Double.parseDouble(fields[i]); return vals; }
<DeepExtract> String[] fields = readAllStrings(); double[] vals = new double[fields.length]; for (int i = 0; i < fields.length; i++) vals[i] = Double.parseDouble(fields[i]); return vals; </DeepExtract>
skeleton-sp19
positive
public Criteria andAsyncDelayIn(List<Integer> values) { if (values == null) { throw new RuntimeException("Value for " + "asyncDelay" + " cannot be null"); } criteria.add(new Criterion("async_delay in", values)); return (Criteria) this; }
<DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "asyncDelay" + " cannot be null"); } criteria.add(new Criterion("async_delay in", values)); </DeepExtract>
AnyMock
positive
@Override public void startActivity(Intent intent) { super.startActivity(intent); overridePendingTransition(R.anim.agile_activity_open_enter, R.anim.agile_activity_open_exit); }
<DeepExtract> overridePendingTransition(R.anim.agile_activity_open_enter, R.anim.agile_activity_open_exit); </DeepExtract>
DZAgile
positive
@Override public void clearGui() { super.clearGui(); for (AbstractXMPPAction action : actions.values()) { action.clearGui(); } if (actionsGroup.getButtonCount() > 0) { actionsGroup.getElements().nextElement().doClick(); } }
<DeepExtract> for (AbstractXMPPAction action : actions.values()) { action.clearGui(); } if (actionsGroup.getButtonCount() > 0) { actionsGroup.getElements().nextElement().doClick(); } </DeepExtract>
jmeter-bzm-plugins
positive
public ByteArrayManager getByteArrayManager() { Session session = sessions.get(ByteArrayManager.class); if (session == null) { SessionFactory sessionFactory = sessionFactories.get(ByteArrayManager.class); if (sessionFactory == null) { throw new ActivitiException("no session factory configured for " + ByteArrayManager.class.getName()); } session = sessionFactory.openSession(); sessions.put(ByteArrayManager.class, session); } return (T) session; }
<DeepExtract> Session session = sessions.get(ByteArrayManager.class); if (session == null) { SessionFactory sessionFactory = sessionFactories.get(ByteArrayManager.class); if (sessionFactory == null) { throw new ActivitiException("no session factory configured for " + ByteArrayManager.class.getName()); } session = sessionFactory.openSession(); sessions.put(ByteArrayManager.class, session); } return (T) session; </DeepExtract>
activiti-crystalball
positive
public Criteria andSexGreaterThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "sex" + " cannot be null"); } criteria.add(new Criterion("sex >", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "sex" + " cannot be null"); } criteria.add(new Criterion("sex >", value)); </DeepExtract>
health_online
positive
@Override public void onClick(View v) { sBlockchain.getHardwareWalletManager().connect(HardwareWalletType.SAMSUNG, true).setCallback(new ListenableFutureTask.Callback<HardwareWallet>() { @Override public void onSuccess(HardwareWallet hardwareWallet) { wallet = hardwareWallet; } @Override public void onCancelled(@NotNull InterruptedException e) { } @Override public void onFailure(@NotNull ExecutionException e) { } }); }
<DeepExtract> sBlockchain.getHardwareWalletManager().connect(HardwareWalletType.SAMSUNG, true).setCallback(new ListenableFutureTask.Callback<HardwareWallet>() { @Override public void onSuccess(HardwareWallet hardwareWallet) { wallet = hardwareWallet; } @Override public void onCancelled(@NotNull InterruptedException e) { } @Override public void onFailure(@NotNull ExecutionException e) { } }); </DeepExtract>
FOUNDERS_3rd
positive
public void initFromFloatSampleBuffer(FloatSampleBuffer source) { init(source.getChannelCount(), source.getSampleCount(), source.getSampleRate(), LAZY_DEFAULT); for (int ch = 0; ch < getChannelCount(); ch++) { System.arraycopy(source.getChannel(ch), 0, getChannel(ch), 0, sampleCount); } }
<DeepExtract> init(source.getChannelCount(), source.getSampleCount(), source.getSampleRate(), LAZY_DEFAULT); </DeepExtract>
Minim-Android
positive
public void addNewMessage(SentinelHttpMessageOrig myHttpMessage) { SettingsManager.storeSplitLocation(jSplitPane1, this); panelTopUi.storeUiPrefs(); if (panelBotUiList.size() != 0) { panelBotUiList.get(panelBotUiList.size() - 1).storeUiPrefs(); } else { } BurpCallbacks.getInstance().print("addMessage: " + myHttpMessage.getMessageNr()); panelTopUi.addMessage(myHttpMessage); PanelBotUi newPanelBot = new PanelBotUi(myHttpMessage); newPanelBot.setName(Integer.toString(myHttpMessage.getMessageNr())); panelBotUiList.add(newPanelBot); panelCard.add(newPanelBot, Integer.toString(myHttpMessage.getMessageNr())); if (myHttpMessage == null) { return; } panelTopUi.setSelected(myHttpMessage); CardLayout cl = (CardLayout) panelCard.getLayout(); cl.show(panelCard, Integer.toString(myHttpMessage.getMessageNr())); }
<DeepExtract> SettingsManager.storeSplitLocation(jSplitPane1, this); panelTopUi.storeUiPrefs(); if (panelBotUiList.size() != 0) { panelBotUiList.get(panelBotUiList.size() - 1).storeUiPrefs(); } else { } </DeepExtract> <DeepExtract> if (myHttpMessage == null) { return; } panelTopUi.setSelected(myHttpMessage); CardLayout cl = (CardLayout) panelCard.getLayout(); cl.show(panelCard, Integer.toString(myHttpMessage.getMessageNr())); </DeepExtract>
BurpSentinel
positive
public static void v(String tag, Object msg) { if (MYLOG_SWITCH) { if ('e' == 'v' && ('e' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) { Log.e(tag, msg.toString()); } else if ('w' == 'v' && ('w' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) { Log.w(tag, msg.toString()); } else if ('d' == 'v' && ('d' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) { Log.d(tag, msg.toString()); } else if ('i' == 'v' && ('d' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) { Log.i(tag, msg.toString()); } else { Log.v(tag, msg.toString()); } if (MYLOG_WRITE_TO_FILE) { writeLogtoFile(String.valueOf('v'), tag, msg.toString()); } } }
<DeepExtract> if (MYLOG_SWITCH) { if ('e' == 'v' && ('e' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) { Log.e(tag, msg.toString()); } else if ('w' == 'v' && ('w' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) { Log.w(tag, msg.toString()); } else if ('d' == 'v' && ('d' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) { Log.d(tag, msg.toString()); } else if ('i' == 'v' && ('d' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) { Log.i(tag, msg.toString()); } else { Log.v(tag, msg.toString()); } if (MYLOG_WRITE_TO_FILE) { writeLogtoFile(String.valueOf('v'), tag, msg.toString()); } } </DeepExtract>
Car-eye-pusher-android
positive
public Graphics2D createGraphics2D() { Graphics2D g2 = null; if (bimg == null || bimg.getWidth() != getWidth() || bimg.getHeight() != getHeight()) { bimg = (BufferedImage) createImage(getWidth(), getHeight()); } g2 = bimg.createGraphics(); g2.setBackground(Color.WHITE); g2.clearRect(0, 0, getWidth(), getHeight()); if (!true) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); } else { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); } return g2; }
<DeepExtract> if (!true) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); } else { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); } </DeepExtract>
SWFTools-Core
positive
public static TestSuperObjectMock create() { TestSuperObjectMock supermock = new TestSuperObjectMock(); this.param1 = "test1"; this.param2 = 2; this.param3 = 3; this.param4 = true; List<String> param5Tests = new ArrayList<>(); param5Tests.add("param5Test1"); param5Tests.add("param5Test2"); param5Tests.add("param5Test3"); param5Tests.add("param5Test4"); this.param5 = param5Tests; TestChildObjectMock childMock = new TestChildObjectMock(); this.param1 = "test1"; this.param2 = 2; this.param3 = new TestChildObjectMock("test2", 3); this.param6 = childMock; List<TestChildObjectMock> childMocks = new ArrayList<>(); childMocks.add(childMock); childMocks.add(new TestChildObjectMock("test4", 10)); this.param7 = childMocks; return supermock; }
<DeepExtract> this.param1 = "test1"; </DeepExtract> <DeepExtract> this.param2 = 2; </DeepExtract> <DeepExtract> this.param3 = 3; </DeepExtract> <DeepExtract> this.param4 = true; </DeepExtract> <DeepExtract> this.param5 = param5Tests; </DeepExtract> <DeepExtract> this.param1 = "test1"; </DeepExtract> <DeepExtract> this.param2 = 2; </DeepExtract> <DeepExtract> this.param3 = new TestChildObjectMock("test2", 3); </DeepExtract> <DeepExtract> this.param6 = childMock; </DeepExtract> <DeepExtract> this.param7 = childMocks; </DeepExtract>
audit4j-core
positive
@Test public void testBooleanType() { Schema avroSchema = createSchema(String.format("\"%s\"", "boolean")); StdType stdType = AvroWrapper.createStdType(avroSchema); assertTrue(AvroBooleanType.class.isAssignableFrom(stdType.getClass())); assertEquals(avroSchema, stdType.underlyingType()); StdData stdData = AvroWrapper.createStdData(true, avroSchema); assertNotNull(stdData); assertTrue(AvroBoolean.class.isAssignableFrom(stdData.getClass())); if ("string".equals("boolean")) { assertEquals(true.toString(), ((PlatformData) stdData).getUnderlyingData().toString()); } else { assertEquals(true, ((PlatformData) stdData).getUnderlyingData()); } }
<DeepExtract> Schema avroSchema = createSchema(String.format("\"%s\"", "boolean")); StdType stdType = AvroWrapper.createStdType(avroSchema); assertTrue(AvroBooleanType.class.isAssignableFrom(stdType.getClass())); assertEquals(avroSchema, stdType.underlyingType()); StdData stdData = AvroWrapper.createStdData(true, avroSchema); assertNotNull(stdData); assertTrue(AvroBoolean.class.isAssignableFrom(stdData.getClass())); if ("string".equals("boolean")) { assertEquals(true.toString(), ((PlatformData) stdData).getUnderlyingData().toString()); } else { assertEquals(true, ((PlatformData) stdData).getUnderlyingData()); } </DeepExtract>
transport
positive
@Override protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException { super.doXContentBody(builder, includeDefaults, params); if (!languageToFields.isEmpty()) { builder.startObject("language_to"); for (Map.Entry<String, Object> field : languageToFields.entrySet()) { builder.field(field.getKey(), field.getValue()); } builder.endObject(); } return builder; if (!languageToFields.isEmpty()) { builder.startObject("language_to"); for (Map.Entry<String, Object> field : languageToFields.entrySet()) { builder.field(field.getKey(), field.getValue()); } builder.endObject(); } return builder; }
<DeepExtract> if (!languageToFields.isEmpty()) { builder.startObject("language_to"); for (Map.Entry<String, Object> field : languageToFields.entrySet()) { builder.field(field.getKey(), field.getValue()); } builder.endObject(); } return builder; </DeepExtract> <DeepExtract> if (!languageToFields.isEmpty()) { builder.startObject("language_to"); for (Map.Entry<String, Object> field : languageToFields.entrySet()) { builder.field(field.getKey(), field.getValue()); } builder.endObject(); } return builder; </DeepExtract>
elasticsearch-plugin-bundle
positive
public void cacheAll() { List<SysResource> resources = sysResourceMapper.selectList(null); List<SysAuthority> authorities = sysAuthorityMapper.selectList(null); List<SysRole> roles = sysRoleMapper.selectList(null); Map<Long, List<SysAuthority>> resourceAuthorityMap = new HashMap<>(resources.size()); for (SysAuthority sysAuthority : authorities) { List<SysAuthority> resourceAuthorities = resourceAuthorityMap.computeIfAbsent(sysAuthority.getSysResourceId(), k -> new ArrayList<>()); resourceAuthorities.add(sysAuthority); } Map<Long, SysResource> resourceMap = new HashMap<>(resources.size()); for (SysResource resource : resources) { resourceMap.put(resource.getId(), resource); } Map<Long, SysRole> roleMap = new HashMap<>(resources.size()); for (SysRole role : roles) { roleMap.put(role.getId(), role); } Map<String, Map<String, Set<String>>> urlRoleMappingMap = new HashMap<>(); Map<String, HashSet<String>> roleResourceMappingMap = new HashMap<>(); Map<Long, List<SysResource>> resourceHierarchyMap = Maps.newHashMap(); Cache resourceCodeMappingCache = cacheManager.getCache(ResourceCacheConstant.RESOURCE_CODE_MAPPING_CACHE); for (Map.Entry<Long, SysResource> entry : resourceMap.entrySet()) { SysResource resource = entry.getValue(); resourceCodeMappingCache.put(resource.getCode(), resource); List<SysAuthority> authorities = resourceAuthorityMap.get(resource.getId()); if (authorities != null) { Set<String> urlMappedRoles = new HashSet<>(); for (SysAuthority authority : authorities) { SysRole role = roleMap.get(authority.getSysRoleId()); if (role == null) { continue; } urlMappedRoles.add(role.getCode()); HashSet<String> roleMappedResources = roleResourceMappingMap.computeIfAbsent(role.getCode(), k -> new HashSet<>()); roleMappedResources.add(resource.getCode()); } if (StringUtils.isNotEmpty(resource.getUrl())) { Map<String, Set<String>> urlRoleMapping = urlRoleMappingMap.computeIfAbsent(resource.getServiceId(), k -> new HashMap<>()); urlRoleMapping.put(resource.getUrl(), urlMappedRoles); } } Long pid = resource.getParent() != null ? resource.getParent() : -1L; List<SysResource> children = resourceHierarchyMap.computeIfAbsent(pid, k -> new ArrayList<>()); children.add(resource); } Cache resourceHierarchyCache = cacheManager.getCache(ResourceCacheConstant.RESOURCE_HIERARCHY_CACHE); for (Map.Entry<Long, List<SysResource>> entry : resourceHierarchyMap.entrySet()) { resourceHierarchyCache.put(entry.getKey(), entry.getValue()); } Cache urlRoleMappingCache = cacheManager.getCache(ResourceCacheConstant.URL_ROLE_MAPPING_CACHE); for (Map.Entry<String, Map<String, Set<String>>> entry : urlRoleMappingMap.entrySet()) { urlRoleMappingCache.put(entry.getKey(), entry.getValue()); } Cache roleResourceMappingCahche = cacheManager.getCache(ResourceCacheConstant.ROLE_RESOURCE_MAPPING_CACHE); for (Map.Entry<String, HashSet<String>> entry : roleResourceMappingMap.entrySet()) { roleResourceMappingCahche.put(entry.getKey(), entry.getValue()); } }
<DeepExtract> Map<String, Map<String, Set<String>>> urlRoleMappingMap = new HashMap<>(); Map<String, HashSet<String>> roleResourceMappingMap = new HashMap<>(); Map<Long, List<SysResource>> resourceHierarchyMap = Maps.newHashMap(); Cache resourceCodeMappingCache = cacheManager.getCache(ResourceCacheConstant.RESOURCE_CODE_MAPPING_CACHE); for (Map.Entry<Long, SysResource> entry : resourceMap.entrySet()) { SysResource resource = entry.getValue(); resourceCodeMappingCache.put(resource.getCode(), resource); List<SysAuthority> authorities = resourceAuthorityMap.get(resource.getId()); if (authorities != null) { Set<String> urlMappedRoles = new HashSet<>(); for (SysAuthority authority : authorities) { SysRole role = roleMap.get(authority.getSysRoleId()); if (role == null) { continue; } urlMappedRoles.add(role.getCode()); HashSet<String> roleMappedResources = roleResourceMappingMap.computeIfAbsent(role.getCode(), k -> new HashSet<>()); roleMappedResources.add(resource.getCode()); } if (StringUtils.isNotEmpty(resource.getUrl())) { Map<String, Set<String>> urlRoleMapping = urlRoleMappingMap.computeIfAbsent(resource.getServiceId(), k -> new HashMap<>()); urlRoleMapping.put(resource.getUrl(), urlMappedRoles); } } Long pid = resource.getParent() != null ? resource.getParent() : -1L; List<SysResource> children = resourceHierarchyMap.computeIfAbsent(pid, k -> new ArrayList<>()); children.add(resource); } Cache resourceHierarchyCache = cacheManager.getCache(ResourceCacheConstant.RESOURCE_HIERARCHY_CACHE); for (Map.Entry<Long, List<SysResource>> entry : resourceHierarchyMap.entrySet()) { resourceHierarchyCache.put(entry.getKey(), entry.getValue()); } Cache urlRoleMappingCache = cacheManager.getCache(ResourceCacheConstant.URL_ROLE_MAPPING_CACHE); for (Map.Entry<String, Map<String, Set<String>>> entry : urlRoleMappingMap.entrySet()) { urlRoleMappingCache.put(entry.getKey(), entry.getValue()); } Cache roleResourceMappingCahche = cacheManager.getCache(ResourceCacheConstant.ROLE_RESOURCE_MAPPING_CACHE); for (Map.Entry<String, HashSet<String>> entry : roleResourceMappingMap.entrySet()) { roleResourceMappingCahche.put(entry.getKey(), entry.getValue()); } </DeepExtract>
cola-cloud
positive
public static InputStream getResourceAsStream(String resourceName, ClassLoader classLoader) { URL url; if (resourceName == null) { url = null; } else { ClassLoader classLoader = getReferrerClassLoader(classLoader); url = classLoader == null ? ClassLoaderUtil.class.getClassLoader().getResource(resourceName) : classLoader.getResource(resourceName); } try { if (url != null) { return url.openStream(); } } catch (IOException var4) { throw new RuntimeException(var4); } return null; }
<DeepExtract> URL url; if (resourceName == null) { url = null; } else { ClassLoader classLoader = getReferrerClassLoader(classLoader); url = classLoader == null ? ClassLoaderUtil.class.getClassLoader().getResource(resourceName) : classLoader.getResource(resourceName); } </DeepExtract>
sofa-common-tools
positive
protected final void aggressiveLazyLoading(boolean aggressiveLazyLoading) { bindListener(KeyMatcher.create(Key.get(ConfigurationSettingListener.class)), ConfigurationProviderProvisionListener.create(new AggressiveLazyLoadingConfigurationSetting(aggressiveLazyLoading))); }
<DeepExtract> bindListener(KeyMatcher.create(Key.get(ConfigurationSettingListener.class)), ConfigurationProviderProvisionListener.create(new AggressiveLazyLoadingConfigurationSetting(aggressiveLazyLoading))); </DeepExtract>
guice
positive
@Override public void setLastUpdatedLabel(CharSequence label) { if (null != mSubHeaderText) { if (TextUtils.isEmpty(label)) { mSubHeaderText.setVisibility(View.GONE); } else { mSubHeaderText.setText(label); if (View.GONE == mSubHeaderText.getVisibility()) { mSubHeaderText.setVisibility(View.VISIBLE); } } } }
<DeepExtract> if (null != mSubHeaderText) { if (TextUtils.isEmpty(label)) { mSubHeaderText.setVisibility(View.GONE); } else { mSubHeaderText.setText(label); if (View.GONE == mSubHeaderText.getVisibility()) { mSubHeaderText.setVisibility(View.VISIBLE); } } } </DeepExtract>
CoolShopping
positive