before
stringlengths
14
203k
after
stringlengths
37
104k
repo
stringlengths
2
50
type
stringclasses
1 value
@Override public void run() { GBMLRCoreData gbmlrCoreData = (GBMLRCoreData) threadTrainCoreDatas[tidx]; double[] wx = new double[2 * K - 1]; int stride = 2 * K - 1; int vstride = K - 1; for (int k = 0; k < gbmlrCoreData.cursor2d; k++) { int lsNumInt = gbmlrCoreData.realNum[k]; for (int i = 0; i < lsNumInt; i++) { for (int p = 0; p < stride; p++) { wx[p] = 0.0; } for (int j = gbmlrCoreData.xidx[k][i]; j < gbmlrCoreData.xidx[k][i + 1]; j += 2) { double fval = Float.intBitsToFloat(gbmlrCoreData.x[k][j + 1]); int idx = gbmlrCoreData.x[k][j] * stride; int pstart = (!false || gbmlrCoreData.featureMask.get(gbmlrCoreData.x[k][j])) ? 0 : vstride; for (int p = pstart; p < stride; p++) { wx[p] += w[tidx][idx + p] * fval; } } double maxXv = wx[0]; for (int j = 1; j < vstride; j++) { if (wx[j] > maxXv) { maxXv = wx[j]; } } double esum = 0.0; for (int j = 0; j < vstride; j++) { wx[j] = Math.exp(wx[j] - maxXv); esum += wx[j]; } double gk_1 = 1.0; double fx = 0.0; double inv = 1.0 / (Math.exp(-maxXv) + esum); for (int j = 0; j < vstride; j++) { wx[j] = wx[j] * inv; gk_1 -= wx[j]; fx += wx[j] * wx[vstride + j]; } fx += gk_1 * wx[stride - 1]; gbmlrCoreData.z[k][i] += learningRate * fx; } } BitSet featureMask = ((GBMLRCoreData) threadTrainCoreDatas[0]).featureMask; if (needTest) { GBMLRCoreData gbmlrCoreDataTest = (GBMLRCoreData) threadTestCoreDatas[tidx]; accumulate(gbmlrCoreDataTest, featureMask, false, w[tidx], learningRate, K); } }
<DeepExtract> double[] wx = new double[2 * K - 1]; int stride = 2 * K - 1; int vstride = K - 1; for (int k = 0; k < gbmlrCoreData.cursor2d; k++) { int lsNumInt = gbmlrCoreData.realNum[k]; for (int i = 0; i < lsNumInt; i++) { for (int p = 0; p < stride; p++) { wx[p] = 0.0; } for (int j = gbmlrCoreData.xidx[k][i]; j < gbmlrCoreData.xidx[k][i + 1]; j += 2) { double fval = Float.intBitsToFloat(gbmlrCoreData.x[k][j + 1]); int idx = gbmlrCoreData.x[k][j] * stride; int pstart = (!false || gbmlrCoreData.featureMask.get(gbmlrCoreData.x[k][j])) ? 0 : vstride; for (int p = pstart; p < stride; p++) { wx[p] += w[tidx][idx + p] * fval; } } double maxXv = wx[0]; for (int j = 1; j < vstride; j++) { if (wx[j] > maxXv) { maxXv = wx[j]; } } double esum = 0.0; for (int j = 0; j < vstride; j++) { wx[j] = Math.exp(wx[j] - maxXv); esum += wx[j]; } double gk_1 = 1.0; double fx = 0.0; double inv = 1.0 / (Math.exp(-maxXv) + esum); for (int j = 0; j < vstride; j++) { wx[j] = wx[j] * inv; gk_1 -= wx[j]; fx += wx[j] * wx[vstride + j]; } fx += gk_1 * wx[stride - 1]; gbmlrCoreData.z[k][i] += learningRate * fx; } } </DeepExtract>
ytk-learn
positive
@Test public void getLyricsReturnsV2TagsLyrics() { ID3v1 id3v1Tag = new ID3v1TagForTesting(); ID3v2 id3v2Tag = new ID3v2TagForTesting(); this.lyrics = "V2 Lyrics"; ID3Wrapper wrapper = new ID3Wrapper(id3v1Tag, id3v2Tag); assertEquals("V2 Lyrics", wrapper.getLyrics()); }
<DeepExtract> this.lyrics = "V2 Lyrics"; </DeepExtract>
mp3agic
positive
public void put(S key1, T key2, V value) { TVMap<T, V> map; if (key1 == lastKey) map = lastMap; TVMap<T, V> map = maps.get(key1); if (map != null) map = map; if (true) { if (locked) throw new RuntimeException("Cannot make new entry for " + key1 + ", because map is locked"); maps.put(key1, map = new TVMap<T, V>(keyFunc, valueFunc)); lastKey = key1; lastMap = map; map = map; } else map = null; map.put(key2, value); }
<DeepExtract> TVMap<T, V> map; if (key1 == lastKey) map = lastMap; TVMap<T, V> map = maps.get(key1); if (map != null) map = map; if (true) { if (locked) throw new RuntimeException("Cannot make new entry for " + key1 + ", because map is locked"); maps.put(key1, map = new TVMap<T, V>(keyFunc, valueFunc)); lastKey = key1; lastMap = map; map = map; } else map = null; </DeepExtract>
fast
positive
public Criteria andGarbagetypeidNotIn(List<Integer> values) { if (values == null) { throw new RuntimeException("Value for " + "garbagetypeid" + " cannot be null"); } criteria.add(new Criterion("garbageTypeId not in", values)); return (Criteria) this; }
<DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "garbagetypeid" + " cannot be null"); } criteria.add(new Criterion("garbageTypeId not in", values)); </DeepExtract>
garbage-collection
positive
@Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); if (beamFrequency != tag.getInteger("beamFrequency") && (tag.getInteger("beamFrequency") <= BEAM_FREQUENCY_MAX) && (tag.getInteger("beamFrequency") > 0)) { if (WarpDriveConfig.LOGGING_VIDEO_CHANNEL) { WarpDrive.logger.info(this + " Beam frequency set from " + beamFrequency + " to " + tag.getInteger("beamFrequency")); } beamFrequency = tag.getInteger("beamFrequency"); } updateColor(); if (videoChannel != tag.getInteger("cameraFrequency") + tag.getInteger("videoChannel")) { if (WarpDriveConfig.LOGGING_VIDEO_CHANNEL) { WarpDrive.logger.info(this + " Video channel updated from " + videoChannel + " to " + tag.getInteger("cameraFrequency") + tag.getInteger("videoChannel")); } videoChannel = tag.getInteger("cameraFrequency") + tag.getInteger("videoChannel"); packetSendTicks = 0; registryUpdateTicks = 0; } }
<DeepExtract> if (beamFrequency != tag.getInteger("beamFrequency") && (tag.getInteger("beamFrequency") <= BEAM_FREQUENCY_MAX) && (tag.getInteger("beamFrequency") > 0)) { if (WarpDriveConfig.LOGGING_VIDEO_CHANNEL) { WarpDrive.logger.info(this + " Beam frequency set from " + beamFrequency + " to " + tag.getInteger("beamFrequency")); } beamFrequency = tag.getInteger("beamFrequency"); } updateColor(); </DeepExtract> <DeepExtract> if (videoChannel != tag.getInteger("cameraFrequency") + tag.getInteger("videoChannel")) { if (WarpDriveConfig.LOGGING_VIDEO_CHANNEL) { WarpDrive.logger.info(this + " Video channel updated from " + videoChannel + " to " + tag.getInteger("cameraFrequency") + tag.getInteger("videoChannel")); } videoChannel = tag.getInteger("cameraFrequency") + tag.getInteger("videoChannel"); packetSendTicks = 0; registryUpdateTicks = 0; } </DeepExtract>
WarpDrive
positive
public String getDescription() { return this.feed.getUrl(); }
<DeepExtract> return this.feed.getUrl(); </DeepExtract>
openalexis
positive
public void actionPerformed(java.awt.event.ActionEvent evt) { setTargetList("LONG"); }
<DeepExtract> setTargetList("LONG"); </DeepExtract>
HBase-Manager
positive
public <A extends Annotation> Stream<A> streamAnnotationsForSpan(Annotation.Source source, Class<A> type, Span s) { if (false) return streamAnnotations(source, type).filter(a -> a.getBegin() >= s.getBegin() && a.getEnd() <= s.getEnd()); else return streamAnnotations(source, type).filter(a -> (s.getBegin() <= a.getBegin() && s.getEnd() > a.getBegin()) || (s.getBegin() >= a.getBegin() && s.getEnd() <= a.getEnd() && s.getBegin() != s.getEnd()) || (s.getBegin() < a.getEnd() && s.getEnd() >= a.getEnd())); }
<DeepExtract> if (false) return streamAnnotations(source, type).filter(a -> a.getBegin() >= s.getBegin() && a.getEnd() <= s.getEnd()); else return streamAnnotations(source, type).filter(a -> (s.getBegin() <= a.getBegin() && s.getEnd() > a.getBegin()) || (s.getBegin() >= a.getBegin() && s.getEnd() <= a.getEnd() && s.getBegin() != s.getEnd()) || (s.getBegin() < a.getEnd() && s.getEnd() >= a.getEnd())); </DeepExtract>
SECTOR
positive
@Override @Before public void setUp() throws Exception { PlatformDefaults.setLogicalPixelBase(PlatformDefaults.BASE_SCALE_FACTOR); PlatformDefaults.setHorizontalScaleFactor(null); PlatformDefaults.setVerticalScaleFactor(null); }
<DeepExtract> PlatformDefaults.setLogicalPixelBase(PlatformDefaults.BASE_SCALE_FACTOR); PlatformDefaults.setHorizontalScaleFactor(null); PlatformDefaults.setVerticalScaleFactor(null); </DeepExtract>
miglayout
positive
public static GaarasonDatabaseProperties buildFromSystemProperties() { String symbol = ","; GaarasonDatabaseProperties gaarasonDatabaseProperties = new GaarasonDatabaseProperties(); this.dataId = Integer.parseInt(System.getProperty(GaarasonDatabaseProperties.PREFIX + ".snow-flake.worker-id", "0")); this.dataId = Integer.parseInt(System.getProperty(GaarasonDatabaseProperties.PREFIX + ".snow-flake.data-id", "0")); String packages = System.getProperty(GaarasonDatabaseProperties.PREFIX + ".scan.packages"); if (packages != null) { gaarasonDatabaseProperties.scan.getPackages().addAll(Arrays.asList(packages.split(symbol))); } String filterExcludePackages = System.getProperty(GaarasonDatabaseProperties.PREFIX + ".scan.filter-exclude-packages"); if (filterExcludePackages != null) { gaarasonDatabaseProperties.scan.getFilterExcludePackages().addAll(Arrays.asList(filterExcludePackages.split(symbol))); } String filterIncludePatterns = System.getProperty(GaarasonDatabaseProperties.PREFIX + ".scan.filter-include-patterns"); if (filterIncludePatterns != null) { gaarasonDatabaseProperties.scan.getFilterIncludePatterns().addAll(Arrays.asList(filterIncludePatterns.split(symbol))); } String filterExcludePatterns = System.getProperty(GaarasonDatabaseProperties.PREFIX + ".scan.filter-exclude-patterns"); if (filterExcludePatterns != null) { gaarasonDatabaseProperties.scan.getFilterExcludePatterns().addAll(Arrays.asList(filterExcludePatterns.split(symbol))); } return gaarasonDatabaseProperties; }
<DeepExtract> this.dataId = Integer.parseInt(System.getProperty(GaarasonDatabaseProperties.PREFIX + ".snow-flake.worker-id", "0")); </DeepExtract> <DeepExtract> this.dataId = Integer.parseInt(System.getProperty(GaarasonDatabaseProperties.PREFIX + ".snow-flake.data-id", "0")); </DeepExtract>
database-all
positive
@Override public long[] shrink(PseudoRandom r, Precursor precursor) { long[] toShrink = precursor.current(); int index = pickIndex(r, toShrink); long current = toShrink[index]; long inclusiveTarget = pickShrinkTarget(r, precursor, index); final long upperSearchBound; final long lowerSearchBound; if (current > inclusiveTarget) { upperSearchBound = current; lowerSearchBound = inclusiveTarget; } else { upperSearchBound = inclusiveTarget; lowerSearchBound = current; } if (current != inclusiveTarget) { long shrunkValue = r.nextLong(lowerSearchBound, upperSearchBound); toShrink[index] = shrunkValue; } if (Arrays.equals(toShrink, precursor.current())) { twoStepShrink(toShrink, r, precursor); } return toShrink; }
<DeepExtract> int index = pickIndex(r, toShrink); long current = toShrink[index]; long inclusiveTarget = pickShrinkTarget(r, precursor, index); final long upperSearchBound; final long lowerSearchBound; if (current > inclusiveTarget) { upperSearchBound = current; lowerSearchBound = inclusiveTarget; } else { upperSearchBound = inclusiveTarget; lowerSearchBound = current; } if (current != inclusiveTarget) { long shrunkValue = r.nextLong(lowerSearchBound, upperSearchBound); toShrink[index] = shrunkValue; } </DeepExtract>
QuickTheories
positive
@Override public boolean isValidUse(AnnotatedPrimitiveType type, Tree tree) { atypeFactory.getFlowAnalizer().addTypeFlow(type, atypeFactory.getTypeHierarchy(), getCurrentPath()); final FlowPolicy flowPolicy = atypeFactory.getFlowPolicy(); if (flowPolicy != null) { return flowPolicy.areFlowsAllowed(type); } return true; }
<DeepExtract> atypeFactory.getFlowAnalizer().addTypeFlow(type, atypeFactory.getTypeHierarchy(), getCurrentPath()); final FlowPolicy flowPolicy = atypeFactory.getFlowPolicy(); if (flowPolicy != null) { return flowPolicy.areFlowsAllowed(type); } return true; </DeepExtract>
sparta
positive
private void invStat_resetFocus(boolean focused) { focusedStat = focused ? FOCUSED_DMG : FOCUSED_NONE; for (int i = 0; i < 4; i++) { invStatPanels.get(i).setBorder(focused ? FOCUSED_DMG : FOCUSED_NONE == i ? onBorder : offBorder); } statInputBuffer.clear(); }
<DeepExtract> focusedStat = focused ? FOCUSED_DMG : FOCUSED_NONE; for (int i = 0; i < 4; i++) { invStatPanels.get(i).setBorder(focused ? FOCUSED_DMG : FOCUSED_NONE == i ? onBorder : offBorder); } statInputBuffer.clear(); </DeepExtract>
GFChipCalc
positive
public void addNewProviderRole(ProviderRole providerRole) throws BadConfigException { Map<Integer, RoleStatus> roleStats = new HashMap<Integer, RoleStatus>(); for (ProviderRole role : providerRoles) { roleStats.put(role.id, new RoleStatus(role)); } int index = providerRole.id; if (index < 0) { throw new BadConfigException("Provider " + providerRole + " id is out of range"); } if (roleStats.get(index) != null) { throw new BadConfigException(providerRole.toString() + " id duplicates that of " + roleStats.get(index)); } roleStats.put(index, new RoleStatus(providerRole)); }
<DeepExtract> int index = providerRole.id; if (index < 0) { throw new BadConfigException("Provider " + providerRole + " id is out of range"); } if (roleStats.get(index) != null) { throw new BadConfigException(providerRole.toString() + " id duplicates that of " + roleStats.get(index)); } roleStats.put(index, new RoleStatus(providerRole)); </DeepExtract>
hoya
positive
@Override public void start(Stage stage) throws Exception { this.stage = stage; main = new RodaInApplication(); main.start(stage); sleep(6000); schemaPane = RodaInApplication.getSchemePane(); fileExplorer = RodaInApplication.getFileExplorer(); inspectionPane = RodaInApplication.getInspectionPane(); Path path = Paths.get("src/test/resources/plan_with_errors.json"); InputStream stream = new FileInputStream(path.toFile()); try { schemaPane.getRootNode().getChildren().clear(); ObjectMapper objectMapper = new ObjectMapper(); ClassificationSchema scheme = objectMapper.readValue(stream, ClassificationSchema.class); schemaPane.updateClassificationSchema(scheme); } catch (IOException e) { LOGGER.error("Error reading classification scheme from stream", e); } }
<DeepExtract> try { schemaPane.getRootNode().getChildren().clear(); ObjectMapper objectMapper = new ObjectMapper(); ClassificationSchema scheme = objectMapper.readValue(stream, ClassificationSchema.class); schemaPane.updateClassificationSchema(scheme); } catch (IOException e) { LOGGER.error("Error reading classification scheme from stream", e); } </DeepExtract>
roda-in
positive
public void setTextViewHTML(String html, Html.ImageGetter imgGetter) { SpannableStringBuilder strBuilder = new SpannableStringBuilder(Html.fromHtml(html, imgGetter, null)); for (URLSpan span : strBuilder.getSpans(0, strBuilder.length(), URLSpan.class)) { int start = strBuilder.getSpanStart(span); int end = strBuilder.getSpanEnd(span); strBuilder.removeSpan(span); strBuilder.setSpan(new URLSpanNoUnderline(span.getURL()), start, end, 0); } return strBuilder; setText(strBuilder); }
<DeepExtract> for (URLSpan span : strBuilder.getSpans(0, strBuilder.length(), URLSpan.class)) { int start = strBuilder.getSpanStart(span); int end = strBuilder.getSpanEnd(span); strBuilder.removeSpan(span); strBuilder.setSpan(new URLSpanNoUnderline(span.getURL()), start, end, 0); } return strBuilder; </DeepExtract>
JianshuApp
positive
public boolean startActivityForResult(Context context, String tag, Intent intent, int requestCode, Class<? extends ProxyActivity> proxyActivity) { Log.i(TAG, "startActivity::arguments tag=" + tag + ",context=" + context + ",intent=" + intent); if (context == null || intent == null) { Log.e(TAG, "startActivity::arguments error"); return false; } Plugin plugin = null; if (!TextUtils.isEmpty(tag)) { plugin = getPlugin(tag); if (plugin == null) { PluginInfo info = getInstalledPluginInfo(tag); if (info == null) { Log.e(TAG, "startActivity:: Plugin is not installed,please call to install () for installation. tag=" + tag); return false; } } } Log.i(TAG, "startActivity::proxyActivity=" + proxyActivity); Intent newIntent = makeActivityIntent(context, tag, intent, proxyActivity); if (newIntent == null) return false; if (true) { if (context instanceof Activity) { ((Activity) context).startActivityForResult(newIntent, requestCode); } else { Log.e(TAG, "startActivity::startActivityForResult fail,context=" + context); } } else { context.startActivity(newIntent); } return true; }
<DeepExtract> Log.i(TAG, "startActivity::arguments tag=" + tag + ",context=" + context + ",intent=" + intent); if (context == null || intent == null) { Log.e(TAG, "startActivity::arguments error"); return false; } Plugin plugin = null; if (!TextUtils.isEmpty(tag)) { plugin = getPlugin(tag); if (plugin == null) { PluginInfo info = getInstalledPluginInfo(tag); if (info == null) { Log.e(TAG, "startActivity:: Plugin is not installed,please call to install () for installation. tag=" + tag); return false; } } } Log.i(TAG, "startActivity::proxyActivity=" + proxyActivity); Intent newIntent = makeActivityIntent(context, tag, intent, proxyActivity); if (newIntent == null) return false; if (true) { if (context instanceof Activity) { ((Activity) context).startActivityForResult(newIntent, requestCode); } else { Log.e(TAG, "startActivity::startActivityForResult fail,context=" + context); } } else { context.startActivity(newIntent); } return true; </DeepExtract>
Lipland
positive
public String getHostname() { if (this.cmd != null && this.cmd.getOptionValue("host") != null) { return this.cmd.getOptionValue("host"); } else if (this.internalCmd != null && this.internalCmd.getOptionValue("host") != null) { return this.internalCmd.getOptionValue("host"); } else if (this.envProperties != null && this.envProperties.containsKey("host")) { return this.envProperties.get("host"); } else if (this.manualParams != null && this.manualParams.containsKey("host")) { return this.manualParams.get("host"); } else { return null; } }
<DeepExtract> if (this.cmd != null && this.cmd.getOptionValue("host") != null) { return this.cmd.getOptionValue("host"); } else if (this.internalCmd != null && this.internalCmd.getOptionValue("host") != null) { return this.internalCmd.getOptionValue("host"); } else if (this.envProperties != null && this.envProperties.containsKey("host")) { return this.envProperties.get("host"); } else if (this.manualParams != null && this.manualParams.containsKey("host")) { return this.manualParams.get("host"); } else { return null; } </DeepExtract>
apimanager-swagger-promote
positive
private PageBean<SmProductEntity> baseSearch(ProductCriteriaBo criteria, Long adzoneId, Long materialId) throws ApiException { TbkDgMaterialOptionalRequest request = new TbkDgMaterialOptionalRequest(); request.setMaterialId(materialId); request.setAdzoneId(adzoneId); request.setPageNo(criteria.getPageNum().longValue()); request.setPageSize(criteria.getPageSize().longValue()); request.setCat(criteria.getOptionId()); request.setQ(criteria.getKeyword()); request.setSort(criteria.getOrderBy(PlatformTypeConstant.TB) == null ? null : criteria.getOrderBy(PlatformTypeConstant.TB).toString()); request.setStartPrice(criteria.getMinPrice() == null ? null : criteria.getMinPrice().longValue()); request.setEndPrice(criteria.getMaxPrice() == null ? null : criteria.getMaxPrice().longValue()); request.setHasCoupon(criteria.getHasCoupon()); request.setNeedFreeShipment(criteria.getParcels()); request.setIsTmall(criteria.getIsTmall()); request.setItemloc(criteria.getLocation()); request.setIp(criteria.getIp()); request.setDeviceType("IMEI"); request.setDeviceEncrypt("MD5"); request.setDeviceValue(MD5.md5(criteria.getUserId().toString(), "")); TbkDgMaterialOptionalResponse response = myTaobaoClient.execute(request); List<SmProductEntity> smProductEntities = response.getResultList().stream().map(o -> convertGoodsList(o)).collect(Collectors.toList()); smProductEntities = CollUtil.removeNull(smProductEntities); PageBean<SmProductEntity> pageBean = new PageBean<>(smProductEntities); pageBean.setTotal(response.getTotalResults().intValue()); pageBean.setPageNum(criteria.getPageNum()); pageBean.setPageSize(criteria.getPageSize()); return pageBean; }
<DeepExtract> smProductEntities = CollUtil.removeNull(smProductEntities); PageBean<SmProductEntity> pageBean = new PageBean<>(smProductEntities); pageBean.setTotal(response.getTotalResults().intValue()); pageBean.setPageNum(criteria.getPageNum()); pageBean.setPageSize(criteria.getPageSize()); return pageBean; </DeepExtract>
cps-mall
positive
public synchronized void onDestroy() { if (mService != null) { try { mContext.unbindService(this); } catch (IllegalArgumentException e) { Log.e(TAG, "Unable to unbind from licensing service (already unbound)"); } mService = null; } mHandler.getLooper().quit(); }
<DeepExtract> if (mService != null) { try { mContext.unbindService(this); } catch (IllegalArgumentException e) { Log.e(TAG, "Unable to unbind from licensing service (already unbound)"); } mService = null; } </DeepExtract>
UniversalPhotoStudio
positive
private void handleFunction(String functionName, List<ExpressionContext> list) { for (ExpressionContext parameter : list) { visit(parameter); } emit(this.currentNode, ByteCode.PushNumber, new Operand(list.size())); emit(this.currentNode, ByteCode.CallFunc, new Operand(functionName)); }
<DeepExtract> emit(this.currentNode, ByteCode.PushNumber, new Operand(list.size())); </DeepExtract> <DeepExtract> emit(this.currentNode, ByteCode.CallFunc, new Operand(functionName)); </DeepExtract>
YarnGdx
positive
@Override protected void init() { viewHeader = LayoutInflater.from(getActivity()).inflate(R.layout.header_fragment_home, (ViewGroup) mRecyclerView.getParent(), false); mBanner = viewHeader.findViewById(R.id.banner); mToolBar.setOnClickListener(this); mBanner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE); mBanner.setImageLoader(new GlideImageLoader()); OkHttpUtils.get().url(HttpContants.HOME_BANNER_URL).addParams("type", "1").build().execute(new StringCallback() { @Override public void onError(Call call, Exception e, int id) { } @Override public void onResponse(String response, int id) { Type collectionType = new TypeToken<Collection<BannerBean>>() { }.getType(); Collection<BannerBean> enums = gson.fromJson(response, collectionType); Iterator<BannerBean> iterator = enums.iterator(); while (iterator.hasNext()) { BannerBean bean = iterator.next(); titles.add(bean.getName()); images.add(bean.getImgUrl()); } setBannerData(); } }); OkHttpUtils.get().url(HttpContants.HOME_CAMPAIGN_URL).addParams("type", "1").build().execute(new StringCallback() { @Override public void onError(Call call, Exception e, int id) { } @Override public void onResponse(String response, int id) { Type collectionType = new TypeToken<Collection<HomeCampaignBean>>() { }.getType(); Collection<HomeCampaignBean> enums = gson.fromJson(response, collectionType); Iterator<HomeCampaignBean> iterator = enums.iterator(); while (iterator.hasNext()) { HomeCampaignBean bean = iterator.next(); datas.add(bean); } setRecyclerViewData(); } }); }
<DeepExtract> mToolBar.setOnClickListener(this); mBanner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE); mBanner.setImageLoader(new GlideImageLoader()); </DeepExtract> <DeepExtract> OkHttpUtils.get().url(HttpContants.HOME_BANNER_URL).addParams("type", "1").build().execute(new StringCallback() { @Override public void onError(Call call, Exception e, int id) { } @Override public void onResponse(String response, int id) { Type collectionType = new TypeToken<Collection<BannerBean>>() { }.getType(); Collection<BannerBean> enums = gson.fromJson(response, collectionType); Iterator<BannerBean> iterator = enums.iterator(); while (iterator.hasNext()) { BannerBean bean = iterator.next(); titles.add(bean.getName()); images.add(bean.getImgUrl()); } setBannerData(); } }); </DeepExtract> <DeepExtract> OkHttpUtils.get().url(HttpContants.HOME_CAMPAIGN_URL).addParams("type", "1").build().execute(new StringCallback() { @Override public void onError(Call call, Exception e, int id) { } @Override public void onResponse(String response, int id) { Type collectionType = new TypeToken<Collection<HomeCampaignBean>>() { }.getType(); Collection<HomeCampaignBean> enums = gson.fromJson(response, collectionType); Iterator<HomeCampaignBean> iterator = enums.iterator(); while (iterator.hasNext()) { HomeCampaignBean bean = iterator.next(); datas.add(bean); } setRecyclerViewData(); } }); </DeepExtract>
ShopSystem_2_App
positive
public Criteria andBuyCountLessThan(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "buyCount" + " cannot be null"); } criteria.add(new Criterion("buy_count <", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "buyCount" + " cannot be null"); } criteria.add(new Criterion("buy_count <", value)); </DeepExtract>
ssmxiaomi
positive
@Override public void visitINVOKESPECIAL(InstructionHandle handle) { InstructionHandle nextHandle = handle.getNext(); sb.append(String.format("%d[label=\"%s\"];\n", handle.getPosition(), handle.toString())); if (nextHandle != null) { sb.append(String.format("%d -> %d[label=\"next\", color=\"#839096\"];\n", handle.getPosition(), nextHandle.getPosition())); } else { System.out.println("next == null"); } }
<DeepExtract> InstructionHandle nextHandle = handle.getNext(); sb.append(String.format("%d[label=\"%s\"];\n", handle.getPosition(), handle.toString())); if (nextHandle != null) { sb.append(String.format("%d -> %d[label=\"next\", color=\"#839096\"];\n", handle.getPosition(), nextHandle.getPosition())); } else { System.out.println("next == null"); } </DeepExtract>
Java-Bytecode-Editor
positive
@Override public void write(GyroUI ui) { List<Defer> flattenedErrors = new ArrayList<>(); for (Defer error : errors) { if (error instanceof ExecuteDefer) { flattenErrors(((ExecuteDefer) error).errors, flattenedErrors); } else { flattenedErrors.add(error); } } Map<String, CreateDefer> createErrors = new LinkedHashMap<>(); List<Defer> otherErrors = new ArrayList<>(); Map<String, List<Defer>> causedByFindErrors = new LinkedHashMap<>(); for (Defer error : flattenedErrors) { if (error instanceof CreateDefer) { CreateDefer c = (CreateDefer) error; createErrors.put(c.getKey(), c); } else { otherErrors.add(error); } Defer cause = error; for (Defer c; (c = cause.getCause()) != null; ) { cause = c; } if (cause instanceof FindDefer) { causedByFindErrors.computeIfAbsent(((FindDefer) cause).getKey(), k -> new ArrayList<>()).add(error); } } Map<String, DependentDefer> dependentErrorById = new LinkedHashMap<>(); for (Map.Entry<String, List<Defer>> entry : causedByFindErrors.entrySet()) { String k = entry.getKey(); CreateDefer c = createErrors.get(k); if (c != null) { dependentErrorById.put(k, new DependentDefer(c, entry.getValue())); } } List<Defer> displayErrors = new ArrayList<>(); displayErrors.addAll(createErrors.values()); displayErrors.addAll(otherErrors); Collection<DependentDefer> dependentErrors = dependentErrorById.values(); displayErrors.addAll(dependentErrors); dependentErrors.forEach(e -> { displayErrors.remove(e.getCause()); e.getRelated().forEach(displayErrors::remove); }); while (!dependentErrorById.isEmpty()) { Iterator<DependentDefer> i = dependentErrors.iterator(); DependentDefer d = i.next(); Set<CreateDefer> seen = new LinkedHashSet<>(); if (findCircularDependency(dependentErrorById, d, seen)) { List<Defer> related = new ArrayList<>(); for (Iterator<Defer> j = displayErrors.iterator(); j.hasNext(); ) { Defer je = j.next(); if (je instanceof DependentDefer) { DependentDefer jd = (DependentDefer) je; if (seen.contains(jd.getCause())) { j.remove(); related.addAll(jd.getRelated()); } } } related.removeAll(seen); displayErrors.add(new CircularDefer(seen, related)); } i.remove(); } int displayErrorsSize = displayErrors.size(); if (displayErrorsSize == 0) { return; } displayErrors.get(0).write(ui); displayErrors.subList(1, displayErrorsSize).forEach(e -> { ui.write("\n@|red ---|@\n\n"); e.write(ui); }); }
<DeepExtract> for (Defer error : errors) { if (error instanceof ExecuteDefer) { flattenErrors(((ExecuteDefer) error).errors, flattenedErrors); } else { flattenedErrors.add(error); } } </DeepExtract>
gyro
positive
public void mouseExited(java.awt.event.MouseEvent evt) { xpanel.setBackground(new Color(255, 255, 255)); }
<DeepExtract> xpanel.setBackground(new Color(255, 255, 255)); </DeepExtract>
vehler
positive
public void run() { IabResult result = new IabResult(BILLING_RESPONSE_RESULT_OK, "Inventory refresh successful."); Inventory inv = null; try { inv = queryInventory(querySkuDetails, moreSkus); } catch (IabException ex) { result = ex.getResult(); } logDebug("Ending async operation: " + mAsyncOperation); mAsyncOperation = ""; mAsyncInProgress = false; final IabResult result_f = result; final Inventory inv_f = inv; if (!mDisposed && listener != null) { handler.post(new Runnable() { public void run() { listener.onQueryInventoryFinished(result_f, inv_f); } }); } }
<DeepExtract> logDebug("Ending async operation: " + mAsyncOperation); mAsyncOperation = ""; mAsyncInProgress = false; </DeepExtract>
HelloRuby
positive
public Envelope boundary() { final Function2 combOp = new Function2<StatCalculator, StatCalculator, StatCalculator>() { @Override public StatCalculator call(StatCalculator agg1, StatCalculator agg2) throws Exception { return StatCalculator.combine(agg1, agg2); } }; final Function2 seqOp = new Function2<StatCalculator, Geometry, StatCalculator>() { @Override public StatCalculator call(StatCalculator agg, Geometry object) throws Exception { return StatCalculator.add(agg, object); } }; StatCalculator agg = (StatCalculator) this.rawSpatialRDD.aggregate(null, seqOp, combOp); if (agg != null) { this.boundaryEnvelope = agg.getBoundary(); this.approximateTotalCount = agg.getCount(); } else { this.boundaryEnvelope = null; this.approximateTotalCount = 0; } return true; return this.boundaryEnvelope; }
<DeepExtract> final Function2 combOp = new Function2<StatCalculator, StatCalculator, StatCalculator>() { @Override public StatCalculator call(StatCalculator agg1, StatCalculator agg2) throws Exception { return StatCalculator.combine(agg1, agg2); } }; final Function2 seqOp = new Function2<StatCalculator, Geometry, StatCalculator>() { @Override public StatCalculator call(StatCalculator agg, Geometry object) throws Exception { return StatCalculator.add(agg, object); } }; StatCalculator agg = (StatCalculator) this.rawSpatialRDD.aggregate(null, seqOp, combOp); if (agg != null) { this.boundaryEnvelope = agg.getBoundary(); this.approximateTotalCount = agg.getCount(); } else { this.boundaryEnvelope = null; this.approximateTotalCount = 0; } return true; </DeepExtract>
incubator-sedona
positive
@Test public void testDocType1() throws Exception { QuickTestConfiguration.setXsdLocation("./data/general/docType.xsd"); QuickTestConfiguration.setXmlLocation("./data/general/docType1.xml"); QuickTestConfiguration.setExiLocation("./out/general/docType1.xml.exi"); _test(); }
<DeepExtract> QuickTestConfiguration.setXsdLocation("./data/general/docType.xsd"); QuickTestConfiguration.setXmlLocation("./data/general/docType1.xml"); QuickTestConfiguration.setExiLocation("./out/general/docType1.xml.exi"); </DeepExtract>
exificient
positive
@Override protected HTMLDivElement init() { element = div().element(); element.appendChild(LinkToSourceCode.create("flexlayout", this.getClass()).element()); element.appendChild(BlockHeader.create("FLEX LAYOUT").element()); element.appendChild(p().textContent("You can find a complete guide for Flex layout ").style("color: #666;").add(a().attr("href", "https://css-tricks.com/snippets/css/a-guide-to-flexbox/").textContent("here.")).add(TextNode.of(" Or flex documentation on ")).add(a().attr("href", "https://developer.mozilla.org/en-US/docs/Web/CSS/flex").textContent("MDN.")).element()); layoutPlaygroundCard = Card.create("LAYOUT PLAYGROUND"); flexItemsCard = Card.create("FLEX ITEMS"); RadioGroup<String> alignItemsRadioGroup = RadioGroup.<String>create("align-items").hide(); CheckBox fillHeightCheckBox = CheckBox.create("Fill height"); RadioGroup<String> directionsRadioGroup = RadioGroup.create("direction"); RadioGroup<String> justifyContentRadioGroup = RadioGroup.create("justify-content"); Button addBlockButton = Button.create("ADD BLOCK"); Button resetButton = Button.create("RESET"); RadioGroup<String> wrapRadioGroup = RadioGroup.create("wrap", "Wrap"); layoutPlaygroundCard.setBodyPaddingTop("40px").appendChild(Row.create().appendChild(Column.span6().appendChild(directionsRadioGroup.setHelperText("Containers inside Flex Layout can have different directions").setLabel("Directions").appendChild(Radio.create(FlexDirection.LEFT_TO_RIGHT.name(), "Left to right").check()).appendChild(Radio.create(FlexDirection.RIGHT_TO_LEFT.name(), "Right to left")).appendChild(Radio.create(FlexDirection.TOP_TO_BOTTOM.name(), "Top to bottom")).appendChild(Radio.create(FlexDirection.BOTTOM_TO_TOP.name(), "Bottom to top")).horizontal())).appendChild(Column.span2().appendChild(fillHeightCheckBox)).appendChild(Column.span4().appendChild(wrapRadioGroup.appendChild(Radio.create(FlexWrap.NO_WRAP.name(), "No wrap").check()).appendChild(Radio.create(FlexWrap.WRAP_TOP_TO_BOTTOM.name(), "Wrap top to bottom")).appendChild(Radio.create(FlexWrap.WRAP_BOTTOM_TO_TOP.name(), "Wrap bottom to top")).horizontal()))).appendChild(Row.create().appendChild(Column.span6().appendChild(justifyContentRadioGroup.setHelperText("Containers inside Flex Layout can be placed in different ways").setLabel("Justify Content").appendChild(Radio.create(FlexJustifyContent.START.name(), "Start").check()).appendChild(Radio.create(FlexJustifyContent.END.name(), "End")).appendChild(Radio.create(FlexJustifyContent.CENTER.name(), "Center")).appendChild(Radio.create(FlexJustifyContent.SPACE_BETWEEN.name(), "Space between")).appendChild(Radio.create(FlexJustifyContent.SPACE_AROUND.name(), "Space around")).appendChild(Radio.create(FlexJustifyContent.SPACE_EVENLY.name(), "Space evenly")).horizontal())).appendChild(Column.span6().appendChild(alignItemsRadioGroup.setHelperText("Containers inside Flex Layout can be aligned in different ways").setLabel("Align items").appendChild(Radio.create(FlexAlign.START.name(), "Start")).appendChild(Radio.create(FlexAlign.END.name(), "End")).appendChild(Radio.create(FlexAlign.CENTER.name(), "Center")).appendChild(Radio.create(FlexAlign.STRETCH.name(), "Stretch").check()).appendChild(Radio.create(FlexAlign.BASE_LINE.name(), "Base line")).horizontal()))).appendChild(Row.create().fullSpan(column -> column.appendChild(resetButton.linkify().style().addCss(Styles.pull_right)).appendChild(addBlockButton.linkify().style().addCss(Styles.pull_right)))); FlexLayout flexLayout = FlexLayout.create().style().addCss("demo-flex-layout-container").get().appendChild(FlexItem.create().style().addCss("demo-flex-layout-block").get().appendChild(h(4))).appendChild(FlexItem.create().style().addCss("demo-flex-layout-block").get().appendChild(h(4))).appendChild(FlexItem.create().style().addCss("demo-flex-layout-block").get().appendChild(h(4))).setDirection(FlexDirection.LEFT_TO_RIGHT); layoutPlaygroundCard.appendChild(div().css("demo-flex-layout-result-container").add(flexLayout).element()); directionsRadioGroup.addChangeHandler(direction -> { FlexDirection flexDirection = FlexDirection.valueOf(direction); if (fillHeightCheckBox.isChecked() || isVerticalDirection(flexDirection)) { flexLayout.style().addCss("fill-height"); } else { flexLayout.style().removeCss("fill-height"); } flexLayout.setDirection(flexDirection); }); fillHeightCheckBox.addChangeHandler(value -> { if (value) { alignItemsRadioGroup.show(); flexLayout.style().addCss("fill-height"); } else { alignItemsRadioGroup.hide(); flexLayout.style().removeCss("fill-height"); } }); justifyContentRadioGroup.addChangeHandler(direction -> flexLayout.setJustifyContent(FlexJustifyContent.valueOf(direction))); alignItemsRadioGroup.addChangeHandler(direction -> flexLayout.setAlignItems(FlexAlign.valueOf(direction))); wrapRadioGroup.addChangeHandler(value -> flexLayout.setWrap(FlexWrap.valueOf(value))); List<FlexItem<HTMLDivElement>> dynamicAddedItems = new ArrayList<>(); addBlockButton.addClickListener(evt -> { FlexItem<HTMLDivElement> item = FlexItem.create().style().addCss("demo-flex-layout-block").get().appendChild(h(4)); flexLayout.appendChild(item); dynamicAddedItems.add(item); }); resetButton.addClickListener(evt -> { for (FlexItem<HTMLDivElement> dynamicAddedItem : dynamicAddedItems) { dynamicAddedItem.remove(); } dynamicAddedItems.clear(); }); Slider orderSlider = Slider.create(6); Slider flexGrowSlider = Slider.create(10); Slider flexShrinkSlider = Slider.create(10); TextBox flexBasisTextBox = TextBox.create("Flex Basis").setHelperText("Default size of an element before the remaining space is distributed"); RadioGroup<String> targetBlockRadioGroup = RadioGroup.create("target-block", "Target block # to play with"); RadioGroup<String> alignSelfRadioGroup = RadioGroup.create("align-self", "Align self"); flexItemsCard.setBodyPaddingTop("40px").appendChild(Row.create().appendChild(Column.span4().appendChild(targetBlockRadioGroup.appendChild(Radio.create("0", "1")).appendChild(Radio.create("1", "2")).appendChild(Radio.create("2", "3")).appendChild(Radio.create("3", "4")).appendChild(Radio.create("4", "5")).horizontal()))).appendChild(Row.create().appendChild(Column.span4().appendChild(orderSlider.withThumb()).appendChild(h(5).textContent("Order"))).appendChild(Column.span4().appendChild(flexGrowSlider.withThumb()).appendChild(h(5).textContent("Flex Grow"))).appendChild(Column.span4().appendChild(flexShrinkSlider.withThumb()).appendChild(h(5).textContent("Flex Shrink")))).appendChild(Row.create().appendChild(Column.span6().appendChild(flexBasisTextBox)).appendChild(Column.span6().appendChild(alignSelfRadioGroup.appendChild(Radio.create(FlexAlign.START.name(), "Start")).appendChild(Radio.create(FlexAlign.END.name(), "End")).appendChild(Radio.create(FlexAlign.CENTER.name(), "Center")).appendChild(Radio.create(FlexAlign.STRETCH.name(), "Stretch")).appendChild(Radio.create(FlexAlign.BASE_LINE.name(), "Base line")).horizontal()))); FlexLayout flexLayout = FlexLayout.create().style().addCss("demo-flex-layout-container").addCss("fill-height").get().setDirection(FlexDirection.LEFT_TO_RIGHT); Map<String, FlexItem<HTMLDivElement>> items = new HashMap<>(); for (int i = 0; i < 5; i++) { FlexItem<HTMLDivElement> item = FlexItem.create().style().addCss("demo-flex-layout-block").addCss(colorOf(i + 1).getBackground()).get().setAlignSelf(FlexAlign.START).setOrder(i + 1).appendChild(h(4)); items.put(i + "", item); flexLayout.appendChild(item); } flexItemsCard.appendChild(div().css("demo-flex-layout-result-container").add(flexLayout).element()); orderSlider.addSlideHandler(value -> items.get(targetBlockRadioGroup.getValue()).setOrder((int) value)); flexGrowSlider.addSlideHandler(value -> items.get(targetBlockRadioGroup.getValue()).setFlexGrow((int) value)); flexShrinkSlider.addSlideHandler(value -> items.get(targetBlockRadioGroup.getValue()).setFlexShrink((int) value)); alignSelfRadioGroup.addChangeHandler(value -> items.get(targetBlockRadioGroup.getValue()).setAlignSelf(FlexAlign.valueOf(value))); flexBasisTextBox.addChangeHandler(value -> items.get(targetBlockRadioGroup.getValue()).setFlexBasis(value)); targetBlockRadioGroup.addChangeHandler(value -> { FlexItem flexItem = items.get(targetBlockRadioGroup.getValue()); flexGrowSlider.setValue(flexItem.getFlexGrow()); orderSlider.setValue(flexItem.getOrder()); flexShrinkSlider.setValue(flexItem.getFlexShrink()); flexBasisTextBox.setValue(isNull(flexItem.getFlexBasis()) ? "" : flexItem.getFlexBasis()); alignSelfRadioGroup.setValue(flexItem.getAlignSelf().name()); }); targetBlockRadioGroup.setValue("2"); element.appendChild(layoutPlaygroundCard.element()); element.appendChild(CodeCard.createCodeCard(CodeResource.INSTANCE.initLayoutPlayground()).element()); element.appendChild(flexItemsCard.element()); element.appendChild(CodeCard.createCodeCard(CodeResource.INSTANCE.initFlexItems()).element()); return element; }
<DeepExtract> RadioGroup<String> alignItemsRadioGroup = RadioGroup.<String>create("align-items").hide(); CheckBox fillHeightCheckBox = CheckBox.create("Fill height"); RadioGroup<String> directionsRadioGroup = RadioGroup.create("direction"); RadioGroup<String> justifyContentRadioGroup = RadioGroup.create("justify-content"); Button addBlockButton = Button.create("ADD BLOCK"); Button resetButton = Button.create("RESET"); RadioGroup<String> wrapRadioGroup = RadioGroup.create("wrap", "Wrap"); layoutPlaygroundCard.setBodyPaddingTop("40px").appendChild(Row.create().appendChild(Column.span6().appendChild(directionsRadioGroup.setHelperText("Containers inside Flex Layout can have different directions").setLabel("Directions").appendChild(Radio.create(FlexDirection.LEFT_TO_RIGHT.name(), "Left to right").check()).appendChild(Radio.create(FlexDirection.RIGHT_TO_LEFT.name(), "Right to left")).appendChild(Radio.create(FlexDirection.TOP_TO_BOTTOM.name(), "Top to bottom")).appendChild(Radio.create(FlexDirection.BOTTOM_TO_TOP.name(), "Bottom to top")).horizontal())).appendChild(Column.span2().appendChild(fillHeightCheckBox)).appendChild(Column.span4().appendChild(wrapRadioGroup.appendChild(Radio.create(FlexWrap.NO_WRAP.name(), "No wrap").check()).appendChild(Radio.create(FlexWrap.WRAP_TOP_TO_BOTTOM.name(), "Wrap top to bottom")).appendChild(Radio.create(FlexWrap.WRAP_BOTTOM_TO_TOP.name(), "Wrap bottom to top")).horizontal()))).appendChild(Row.create().appendChild(Column.span6().appendChild(justifyContentRadioGroup.setHelperText("Containers inside Flex Layout can be placed in different ways").setLabel("Justify Content").appendChild(Radio.create(FlexJustifyContent.START.name(), "Start").check()).appendChild(Radio.create(FlexJustifyContent.END.name(), "End")).appendChild(Radio.create(FlexJustifyContent.CENTER.name(), "Center")).appendChild(Radio.create(FlexJustifyContent.SPACE_BETWEEN.name(), "Space between")).appendChild(Radio.create(FlexJustifyContent.SPACE_AROUND.name(), "Space around")).appendChild(Radio.create(FlexJustifyContent.SPACE_EVENLY.name(), "Space evenly")).horizontal())).appendChild(Column.span6().appendChild(alignItemsRadioGroup.setHelperText("Containers inside Flex Layout can be aligned in different ways").setLabel("Align items").appendChild(Radio.create(FlexAlign.START.name(), "Start")).appendChild(Radio.create(FlexAlign.END.name(), "End")).appendChild(Radio.create(FlexAlign.CENTER.name(), "Center")).appendChild(Radio.create(FlexAlign.STRETCH.name(), "Stretch").check()).appendChild(Radio.create(FlexAlign.BASE_LINE.name(), "Base line")).horizontal()))).appendChild(Row.create().fullSpan(column -> column.appendChild(resetButton.linkify().style().addCss(Styles.pull_right)).appendChild(addBlockButton.linkify().style().addCss(Styles.pull_right)))); FlexLayout flexLayout = FlexLayout.create().style().addCss("demo-flex-layout-container").get().appendChild(FlexItem.create().style().addCss("demo-flex-layout-block").get().appendChild(h(4))).appendChild(FlexItem.create().style().addCss("demo-flex-layout-block").get().appendChild(h(4))).appendChild(FlexItem.create().style().addCss("demo-flex-layout-block").get().appendChild(h(4))).setDirection(FlexDirection.LEFT_TO_RIGHT); layoutPlaygroundCard.appendChild(div().css("demo-flex-layout-result-container").add(flexLayout).element()); directionsRadioGroup.addChangeHandler(direction -> { FlexDirection flexDirection = FlexDirection.valueOf(direction); if (fillHeightCheckBox.isChecked() || isVerticalDirection(flexDirection)) { flexLayout.style().addCss("fill-height"); } else { flexLayout.style().removeCss("fill-height"); } flexLayout.setDirection(flexDirection); }); fillHeightCheckBox.addChangeHandler(value -> { if (value) { alignItemsRadioGroup.show(); flexLayout.style().addCss("fill-height"); } else { alignItemsRadioGroup.hide(); flexLayout.style().removeCss("fill-height"); } }); justifyContentRadioGroup.addChangeHandler(direction -> flexLayout.setJustifyContent(FlexJustifyContent.valueOf(direction))); alignItemsRadioGroup.addChangeHandler(direction -> flexLayout.setAlignItems(FlexAlign.valueOf(direction))); wrapRadioGroup.addChangeHandler(value -> flexLayout.setWrap(FlexWrap.valueOf(value))); List<FlexItem<HTMLDivElement>> dynamicAddedItems = new ArrayList<>(); addBlockButton.addClickListener(evt -> { FlexItem<HTMLDivElement> item = FlexItem.create().style().addCss("demo-flex-layout-block").get().appendChild(h(4)); flexLayout.appendChild(item); dynamicAddedItems.add(item); }); resetButton.addClickListener(evt -> { for (FlexItem<HTMLDivElement> dynamicAddedItem : dynamicAddedItems) { dynamicAddedItem.remove(); } dynamicAddedItems.clear(); }); </DeepExtract> <DeepExtract> Slider orderSlider = Slider.create(6); Slider flexGrowSlider = Slider.create(10); Slider flexShrinkSlider = Slider.create(10); TextBox flexBasisTextBox = TextBox.create("Flex Basis").setHelperText("Default size of an element before the remaining space is distributed"); RadioGroup<String> targetBlockRadioGroup = RadioGroup.create("target-block", "Target block # to play with"); RadioGroup<String> alignSelfRadioGroup = RadioGroup.create("align-self", "Align self"); flexItemsCard.setBodyPaddingTop("40px").appendChild(Row.create().appendChild(Column.span4().appendChild(targetBlockRadioGroup.appendChild(Radio.create("0", "1")).appendChild(Radio.create("1", "2")).appendChild(Radio.create("2", "3")).appendChild(Radio.create("3", "4")).appendChild(Radio.create("4", "5")).horizontal()))).appendChild(Row.create().appendChild(Column.span4().appendChild(orderSlider.withThumb()).appendChild(h(5).textContent("Order"))).appendChild(Column.span4().appendChild(flexGrowSlider.withThumb()).appendChild(h(5).textContent("Flex Grow"))).appendChild(Column.span4().appendChild(flexShrinkSlider.withThumb()).appendChild(h(5).textContent("Flex Shrink")))).appendChild(Row.create().appendChild(Column.span6().appendChild(flexBasisTextBox)).appendChild(Column.span6().appendChild(alignSelfRadioGroup.appendChild(Radio.create(FlexAlign.START.name(), "Start")).appendChild(Radio.create(FlexAlign.END.name(), "End")).appendChild(Radio.create(FlexAlign.CENTER.name(), "Center")).appendChild(Radio.create(FlexAlign.STRETCH.name(), "Stretch")).appendChild(Radio.create(FlexAlign.BASE_LINE.name(), "Base line")).horizontal()))); FlexLayout flexLayout = FlexLayout.create().style().addCss("demo-flex-layout-container").addCss("fill-height").get().setDirection(FlexDirection.LEFT_TO_RIGHT); Map<String, FlexItem<HTMLDivElement>> items = new HashMap<>(); for (int i = 0; i < 5; i++) { FlexItem<HTMLDivElement> item = FlexItem.create().style().addCss("demo-flex-layout-block").addCss(colorOf(i + 1).getBackground()).get().setAlignSelf(FlexAlign.START).setOrder(i + 1).appendChild(h(4)); items.put(i + "", item); flexLayout.appendChild(item); } flexItemsCard.appendChild(div().css("demo-flex-layout-result-container").add(flexLayout).element()); orderSlider.addSlideHandler(value -> items.get(targetBlockRadioGroup.getValue()).setOrder((int) value)); flexGrowSlider.addSlideHandler(value -> items.get(targetBlockRadioGroup.getValue()).setFlexGrow((int) value)); flexShrinkSlider.addSlideHandler(value -> items.get(targetBlockRadioGroup.getValue()).setFlexShrink((int) value)); alignSelfRadioGroup.addChangeHandler(value -> items.get(targetBlockRadioGroup.getValue()).setAlignSelf(FlexAlign.valueOf(value))); flexBasisTextBox.addChangeHandler(value -> items.get(targetBlockRadioGroup.getValue()).setFlexBasis(value)); targetBlockRadioGroup.addChangeHandler(value -> { FlexItem flexItem = items.get(targetBlockRadioGroup.getValue()); flexGrowSlider.setValue(flexItem.getFlexGrow()); orderSlider.setValue(flexItem.getOrder()); flexShrinkSlider.setValue(flexItem.getFlexShrink()); flexBasisTextBox.setValue(isNull(flexItem.getFlexBasis()) ? "" : flexItem.getFlexBasis()); alignSelfRadioGroup.setValue(flexItem.getAlignSelf().name()); }); targetBlockRadioGroup.setValue("2"); </DeepExtract>
domino-ui-demo
positive
@Override public TopicPublisher createPublisher(Topic topic) throws JMSException { checkClosed(); checkIsTopic(topic); return super.createProducer(topic); }
<DeepExtract> checkIsTopic(topic); return super.createProducer(topic); </DeepExtract>
nevado
positive
public void disconnectAndForgetCredentials() { setUsername(""); setPassword(""); if (session == null) { log.append("Not connected. Credentials forgotten.\n"); } else { session = null; log.append("Disconnected and credentials forgotten.\n"); } }
<DeepExtract> setUsername(""); setPassword(""); </DeepExtract>
HypnosMusicPlayer
positive
@Override protected InstructionParsed parse(final int curPos, final PosDataInputStream pdis) throws IOException { InstructionParsed parsed = new InstructionParsed(curPos, this.code); parsed.lvIndex = pdis.readUnsignedByte(); parsed.opCodeText = String.format(FORMAT_OPCODE_NUMBER, this.name(), parsed.lvIndex); return parsed; }
<DeepExtract> InstructionParsed parsed = new InstructionParsed(curPos, this.code); parsed.lvIndex = pdis.readUnsignedByte(); parsed.opCodeText = String.format(FORMAT_OPCODE_NUMBER, this.name(), parsed.lvIndex); return parsed; </DeepExtract>
freeinternals
positive
public void releaseFinger(DoublyLinkedList<?> dll, boolean keep) { for (int i = 0; i < this.getNumberOfUsedFingers(); i++) { Finger f = this.getList().elementAt(i); if (f != null && f.getList() == dll) { if (keep) { this.releaseFingerAt(i); } else { this.getList().remove(i); this.setNumberOfUsedFingers(this.getNumberOfUsedFingers() - 1); } break; } } }
<DeepExtract> </DeepExtract>
sinalgo
positive
public Criteria andALoginTimeGreaterThanOrEqualTo(Date value) { if (value == null) { throw new RuntimeException("Value for " + "aLoginTime" + " cannot be null"); } criteria.add(new Criterion("a_login_time >=", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "aLoginTime" + " cannot be null"); } criteria.add(new Criterion("a_login_time >=", value)); </DeepExtract>
webike
positive
@Override protected void afterHookedMethod(final MethodHookParam param) throws Throwable { mKeyguardHostView = param.thisObject; Object slidingChallenge = XposedHelpers.getObjectField(param.thisObject, "mSlidingChallengeLayout"); if (slidingChallenge == null) return; mPrefs.reload(); if (mPrefs.getBoolean(GravityBoxSettings.PREF_KEY_LOCKSCREEN_MAXIMIZE_WIDGETS, false)) { if (DEBUG) log("minimizeChallengeIfDesired: challenge minimized"); XposedHelpers.callMethod(slidingChallenge, "showChallenge", false); } if (slidingChallenge != null) { try { final ViewGroup vg = (ViewGroup) slidingChallenge; final int childCount = vg.getChildCount(); for (int i = 0; i < childCount; i++) { View v = vg.getChildAt(i); if (v instanceof ImageButton) { v.setOnLongClickListener(mLockButtonLongClickListener); break; } } } catch (Throwable t) { XposedBridge.log(t); } } }
<DeepExtract> if (slidingChallenge == null) return; mPrefs.reload(); if (mPrefs.getBoolean(GravityBoxSettings.PREF_KEY_LOCKSCREEN_MAXIMIZE_WIDGETS, false)) { if (DEBUG) log("minimizeChallengeIfDesired: challenge minimized"); XposedHelpers.callMethod(slidingChallenge, "showChallenge", false); } </DeepExtract>
GravityBox
positive
public void propertyChange(PropertyChangeEvent evt) { this.refresh = true; }
<DeepExtract> this.refresh = true; </DeepExtract>
egdownloader
positive
public void actionPerformed(java.awt.event.ActionEvent evt) { timeSource.pause(); if (timeSource.getMode() == TimeSource.Mode.PAUSE) { jPanel6.setBackground(Color.YELLOW); jLabel1.setForeground(Color.BLACK); jLabel1.setText("PAUSE"); } }
<DeepExtract> timeSource.pause(); if (timeSource.getMode() == TimeSource.Mode.PAUSE) { jPanel6.setBackground(Color.YELLOW); jLabel1.setForeground(Color.BLACK); jLabel1.setText("PAUSE"); } </DeepExtract>
Kayak
positive
private boolean fillFields(boolean editable, String channelJid) { JSONObject metadata = ChannelMetadataModel.getInstance().getFromCache(this, channelJid); if (metadata == null) { return false; } EditText titleTxt = (EditText) findViewById(R.id.titleTxt); titleTxt.setText(metadata.optString("title")); if (!editable) { titleTxt.setKeyListener(null); } EditText descriptionTxt = (EditText) findViewById(R.id.descriptionTxt); descriptionTxt.setText(metadata.optString("description")); if (!editable) { descriptionTxt.setKeyListener(null); } Spinner accessModelTxt = (Spinner) findViewById(R.id.accessModelTxt); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, R.layout.spinner_item_layout); for (int pos = 0; pos < ACCESS_MODELS_DETAILS.length; pos++) { adapter.add(getString(ACCESS_MODELS_DETAILS[pos])); } adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); accessModelTxt.setAdapter(adapter); accessModelTxt.setSelection(ACCESS_MODELS.indexOf(metadata.optString("accessModel"))); this.selectedAccessModel = ACCESS_MODELS.indexOf(metadata.optString("accessModel")); accessModelTxt.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { setSelectedAccessModel(position); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); if (!editable) { accessModelTxt.setKeyListener(null); } TextView creationDateTxt = (TextView) findViewById(R.id.creationDateTxt); try { if (metadata != null && !TextUtils.isEmpty(metadata.optString("creationDate"))) { long creationDateTime = TimeUtils.fromISOToDate(metadata.optString("creationDate")).getTime(); creationDateTxt.setText(DateUtils.getRelativeTimeSpanString(creationDateTime, new Date().getTime(), DateUtils.MINUTE_IN_MILLIS)); } } catch (ParseException e) { e.printStackTrace(); } TextView channelTypeTxt = (TextView) findViewById(R.id.channelTypeTxt); channelTypeTxt.setText(metadata.optString("channelType")); Spinner defaultAffiliationTxt = (Spinner) findViewById(R.id.defaultAffiliationTxt); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, R.layout.spinner_item_layout); for (int pos = 0; pos < ROLE_DETAILS.length; pos++) { adapter.add(getString(ROLE_DETAILS[pos])); } adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); defaultAffiliationTxt.setAdapter(adapter); defaultAffiliationTxt.setSelection(ROLES.indexOf(metadata.optString("defaultAffiliation"))); this.selectedRole = ROLES.indexOf(metadata.optString("defaultAffiliation")); defaultAffiliationTxt.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { setSelectedRole(position); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); if (!editable) { defaultAffiliationTxt.setKeyListener(null); } return true; }
<DeepExtract> if (!editable) { titleTxt.setKeyListener(null); } </DeepExtract> <DeepExtract> if (!editable) { descriptionTxt.setKeyListener(null); } </DeepExtract> <DeepExtract> ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, R.layout.spinner_item_layout); for (int pos = 0; pos < ACCESS_MODELS_DETAILS.length; pos++) { adapter.add(getString(ACCESS_MODELS_DETAILS[pos])); } adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); accessModelTxt.setAdapter(adapter); accessModelTxt.setSelection(ACCESS_MODELS.indexOf(metadata.optString("accessModel"))); </DeepExtract> <DeepExtract> this.selectedAccessModel = ACCESS_MODELS.indexOf(metadata.optString("accessModel")); </DeepExtract> <DeepExtract> if (!editable) { accessModelTxt.setKeyListener(null); } </DeepExtract> <DeepExtract> ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, R.layout.spinner_item_layout); for (int pos = 0; pos < ROLE_DETAILS.length; pos++) { adapter.add(getString(ROLE_DETAILS[pos])); } adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); defaultAffiliationTxt.setAdapter(adapter); defaultAffiliationTxt.setSelection(ROLES.indexOf(metadata.optString("defaultAffiliation"))); </DeepExtract> <DeepExtract> this.selectedRole = ROLES.indexOf(metadata.optString("defaultAffiliation")); </DeepExtract> <DeepExtract> if (!editable) { defaultAffiliationTxt.setKeyListener(null); } </DeepExtract>
buddycloud-android
positive
@Test public void testThrift2Pojo() { QueryRequest req = new QueryRequest(); req.setId(123); req.setName("haha"); req.setQuiet(false); req.setOptList(Lists.newArrayList("jack", "neo")); PojoQueryRequest pojoQueryRequest; PojoQueryRequest.class.setLastName(req.lastName.toUpperCase()); assertThat(pojoQueryRequest.getId(), Matchers.is(req.getId())); assertThat(pojoQueryRequest.getName(), Matchers.is(req.getName())); assertThat(pojoQueryRequest.isQuiet(), Matchers.is(req.isQuiet())); assertThat(pojoQueryRequest.getOptList(), Matchers.is(req.getOptList())); }
<DeepExtract> PojoQueryRequest pojoQueryRequest; PojoQueryRequest.class.setLastName(req.lastName.toUpperCase()); </DeepExtract>
easy-mapper
positive
public int compareSerializedKeys(OakScopedReadBuffer serializedKey1, OakScopedReadBuffer serializedKey2) { int cap1 = serializedKey1.getInt(0); int cap2 = serializedKey2.getInt(0); return compareBuffers(serializedKey1, Integer.BYTES, cap1, serializedKey2, Integer.BYTES, cap2); }
<DeepExtract> int cap1 = serializedKey1.getInt(0); int cap2 = serializedKey2.getInt(0); return compareBuffers(serializedKey1, Integer.BYTES, cap1, serializedKey2, Integer.BYTES, cap2); </DeepExtract>
Oak
positive
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.place_search_layout); registerScreen("Place Search"); Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.containsKey(ARG_ONLY_STOPS)) { mSearchOnlyStops = extras.getBoolean(ARG_ONLY_STOPS); } } initGoogleApiClient(false); mHandler = new Handler(Looper.getMainLooper(), msg -> { if (msg.what == MESSAGE_TEXT_CHANGED) { if (mSearchResultAdapter.getFilter() != null) { mSearchResultAdapter.getFilter().filter((String) msg.obj); } return true; } return false; }); if (savedInstanceState != null) { if (savedInstanceState.containsKey(STATE_SEARCH_FILTER)) { mCurrentSearchFilterType = savedInstanceState.getInt(STATE_SEARCH_FILTER); } } mHistoryDbAdapter = new HistoryDbAdapter(this).open(); View searchBar = findViewById(R.id.search_bar); ElevationOverlayProvider elevationOverlayProvider = new ElevationOverlayProvider(this); if (elevationOverlayProvider.isThemeElevationOverlayEnabled()) { searchBar.setBackgroundColor(elevationOverlayProvider.compositeOverlayWithThemeSurfaceColorIfNeeded(4)); } ImageButton backButton = findViewById(R.id.search_back); ViewHelper.flipIfRtl(backButton); backButton.setOnClickListener(v -> onBackPressed()); mSearchEdit = findViewById(R.id.search_edit); mSearchEdit.setOnEditorActionListener((v, actionId, event) -> { if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) { mSearchResultAdapter.getFilter().filter(mSearchEdit.getText()); } return false; }); mSearchEdit.requestFocus(); mClearButton = findViewById(R.id.search_clear); mClearButton.setOnClickListener(v -> { mSearchEdit.setText(""); mSearchResultAdapter.clear(); }); mSearchFailed = findViewById(R.id.search_result_error); mProgressBar = findViewById(R.id.search_progress_bar); mHistoryRecyclerView = findViewById(R.id.search_history_list); mHistoryRecyclerView.setHasFixedSize(true); LinearLayoutManager layoutManager = new LinearLayoutManager(this); mHistoryRecyclerView.setLayoutManager(layoutManager); mHistoryRecyclerView.addOnScrollListener(new HideKeyboardOnScroll(this, mSearchEdit)); if (mSearchOnlyStops) { return; } mDefaultListAdapter = new DefaultListAdapter(this); List<SimpleItemBinder.Item> options = new ArrayList<>(); options.add(new SimpleItemBinder.Item(R.drawable.ic_my_location_24dp, getText(R.string.my_location))); options.add(new SimpleItemBinder.Item(R.drawable.ic_map_24dp, getText(R.string.point_on_map))); mDefaultListAdapter.setOptions(options); mHistoryRecyclerView.setAdapter(mDefaultListAdapter); ItemClickSupport.addTo(mHistoryRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() { @Override public void onItemClicked(RecyclerView recyclerView, int position, View v) { int viewType = mDefaultListAdapter.getItemViewType(position); DataBinder binder = mDefaultListAdapter.getDataBinder(viewType); int binderPosition = mDefaultListAdapter.getBinderPosition(position); if (binder instanceof HistoryBinder) { Site site = ((HistoryBinder) binder).getItem(binderPosition); deliverResult(site); } else if (binder instanceof SimpleItemBinder) { switch(binderPosition) { case 0: Site currentLocation = new Site(); currentLocation.setName(Site.TYPE_MY_LOCATION); deliverResult(currentLocation); break; case 1: Intent i = new Intent(PlaceSearchActivity.this, PointOnMapActivity.class); i.putExtra(PointOnMapActivity.EXTRA_STOP, new Site()); i.putExtra(PointOnMapActivity.EXTRA_HELP_TEXT, getString(R.string.tap_your_start_point_on_map)); startActivityForResult(i, REQUEST_CODE_POINT_ON_MAP); break; } } } }); if (!mSearchOnlyStops) { LoaderManager.getInstance(this).initLoader(LOADER_HISTORY, null, this); } mSearchResultRecyclerView = findViewById(R.id.search_results); mSearchResultRecyclerView.setHasFixedSize(true); LinearLayoutManager layoutManager = new LinearLayoutManager(this); mSearchResultRecyclerView.setLayoutManager(layoutManager); mSearchResultRecyclerView.addOnScrollListener(new HideKeyboardOnScroll(this, mSearchEdit)); mSearchResultAdapter = new PlaceSearchResultAdapter(this); mSearchResultAdapter.setOnEditItemClickListener(position -> { if (position >= 0 && position < mSearchResultAdapter.getContentItemCount()) { PlaceItem item = mSearchResultAdapter.getItem(position); String title = item.getTitle() + " "; mSearchEdit.setText(title); mSearchEdit.setSelection(title.length()); mSearchEdit.requestFocus(); mSearchResultRecyclerView.smoothScrollToPosition(0); } }); mSearchResultRecyclerView.setAdapter(mSearchResultAdapter); AutocompleteResultCallbackPlace autocompleteResultCallback = new AutocompleteResultCallbackPlace(); mSthlmTravelingSearchFilter = new SiteFilter(mSearchResultAdapter, this, mSearchOnlyStops); mSthlmTravelingSearchFilter.setFilterResultCallback(autocompleteResultCallback); ItemClickSupport.addTo(mSearchResultRecyclerView).setOnItemClickListener((recyclerView, position, v) -> { if (position >= mSearchResultAdapter.getContentItemCount()) { } else { if (position >= 0 && position < mSearchResultAdapter.getContentItemCount()) { PlaceItem item = mSearchResultAdapter.getItem(position); mSearchResultAdapter.getFilter().setResultCallback(item, new PlaceItemResultCallback() { @Override public void onResult(Site site) { deliverResult(site); } @Override public void onError() { Toast.makeText(PlaceSearchActivity.this, R.string.planner_error_title, Toast.LENGTH_SHORT).show(); } }); } } }); mSearchResultAdapter.setFilter(mSthlmTravelingSearchFilter); mCurrentSearchFilterType = FILTER_TYPE_STHLM_TRAVELING; if (!TextUtils.isEmpty(mSearchEdit.getText())) { mSearchResultAdapter.getFilter().filter(mSearchEdit.getText()); } mMyLocationManager = new LocationManager(this, getGoogleApiClient()); mMyLocationManager.setLocationListener(this); mMyLocationManager.setAccuracy(false); registerPlayService(mMyLocationManager); if (!mSearchOnlyStops) { verifyLocationPermission(); mMyLocationManager.requestLocation(); } }
<DeepExtract> mHandler = new Handler(Looper.getMainLooper(), msg -> { if (msg.what == MESSAGE_TEXT_CHANGED) { if (mSearchResultAdapter.getFilter() != null) { mSearchResultAdapter.getFilter().filter((String) msg.obj); } return true; } return false; }); </DeepExtract> <DeepExtract> mHistoryRecyclerView = findViewById(R.id.search_history_list); mHistoryRecyclerView.setHasFixedSize(true); LinearLayoutManager layoutManager = new LinearLayoutManager(this); mHistoryRecyclerView.setLayoutManager(layoutManager); mHistoryRecyclerView.addOnScrollListener(new HideKeyboardOnScroll(this, mSearchEdit)); if (mSearchOnlyStops) { return; } mDefaultListAdapter = new DefaultListAdapter(this); List<SimpleItemBinder.Item> options = new ArrayList<>(); options.add(new SimpleItemBinder.Item(R.drawable.ic_my_location_24dp, getText(R.string.my_location))); options.add(new SimpleItemBinder.Item(R.drawable.ic_map_24dp, getText(R.string.point_on_map))); mDefaultListAdapter.setOptions(options); mHistoryRecyclerView.setAdapter(mDefaultListAdapter); ItemClickSupport.addTo(mHistoryRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() { @Override public void onItemClicked(RecyclerView recyclerView, int position, View v) { int viewType = mDefaultListAdapter.getItemViewType(position); DataBinder binder = mDefaultListAdapter.getDataBinder(viewType); int binderPosition = mDefaultListAdapter.getBinderPosition(position); if (binder instanceof HistoryBinder) { Site site = ((HistoryBinder) binder).getItem(binderPosition); deliverResult(site); } else if (binder instanceof SimpleItemBinder) { switch(binderPosition) { case 0: Site currentLocation = new Site(); currentLocation.setName(Site.TYPE_MY_LOCATION); deliverResult(currentLocation); break; case 1: Intent i = new Intent(PlaceSearchActivity.this, PointOnMapActivity.class); i.putExtra(PointOnMapActivity.EXTRA_STOP, new Site()); i.putExtra(PointOnMapActivity.EXTRA_HELP_TEXT, getString(R.string.tap_your_start_point_on_map)); startActivityForResult(i, REQUEST_CODE_POINT_ON_MAP); break; } } } }); </DeepExtract> <DeepExtract> mSearchResultRecyclerView = findViewById(R.id.search_results); mSearchResultRecyclerView.setHasFixedSize(true); LinearLayoutManager layoutManager = new LinearLayoutManager(this); mSearchResultRecyclerView.setLayoutManager(layoutManager); mSearchResultRecyclerView.addOnScrollListener(new HideKeyboardOnScroll(this, mSearchEdit)); mSearchResultAdapter = new PlaceSearchResultAdapter(this); mSearchResultAdapter.setOnEditItemClickListener(position -> { if (position >= 0 && position < mSearchResultAdapter.getContentItemCount()) { PlaceItem item = mSearchResultAdapter.getItem(position); String title = item.getTitle() + " "; mSearchEdit.setText(title); mSearchEdit.setSelection(title.length()); mSearchEdit.requestFocus(); mSearchResultRecyclerView.smoothScrollToPosition(0); } }); mSearchResultRecyclerView.setAdapter(mSearchResultAdapter); AutocompleteResultCallbackPlace autocompleteResultCallback = new AutocompleteResultCallbackPlace(); mSthlmTravelingSearchFilter = new SiteFilter(mSearchResultAdapter, this, mSearchOnlyStops); mSthlmTravelingSearchFilter.setFilterResultCallback(autocompleteResultCallback); ItemClickSupport.addTo(mSearchResultRecyclerView).setOnItemClickListener((recyclerView, position, v) -> { if (position >= mSearchResultAdapter.getContentItemCount()) { } else { if (position >= 0 && position < mSearchResultAdapter.getContentItemCount()) { PlaceItem item = mSearchResultAdapter.getItem(position); mSearchResultAdapter.getFilter().setResultCallback(item, new PlaceItemResultCallback() { @Override public void onResult(Site site) { deliverResult(site); } @Override public void onError() { Toast.makeText(PlaceSearchActivity.this, R.string.planner_error_title, Toast.LENGTH_SHORT).show(); } }); } } }); </DeepExtract> <DeepExtract> mSearchResultAdapter.setFilter(mSthlmTravelingSearchFilter); mCurrentSearchFilterType = FILTER_TYPE_STHLM_TRAVELING; if (!TextUtils.isEmpty(mSearchEdit.getText())) { mSearchResultAdapter.getFilter().filter(mSearchEdit.getText()); } </DeepExtract>
sthlmtraveling
positive
private void addAtom(ByteBuffer atom) { while (nextAtomToMerge != null) { int comparison = Lexicographic.compare(nextAtomToMerge, atom); if (comparison > 0) { doAddAtom(atom); return; } else if (comparison == 0) { doAddAtom(atom); nextAtomToMerge = atomsToMerge.hasNext() ? atomsToMerge.next() : null; return; } else { doAddAtom(nextAtomToMerge); nextAtomToMerge = atomsToMerge.hasNext() ? atomsToMerge.next() : null; } } if (wroteOverflow && BaggageProtocol.OVERFLOW_MARKER.equals(atom)) { return; } atoms.add(atom); }
<DeepExtract> if (wroteOverflow && BaggageProtocol.OVERFLOW_MARKER.equals(atom)) { return; } atoms.add(atom); </DeepExtract>
tracingplane-java
positive
@Override public void onInitialized() { super.onInitialized(); mRadius = mRadius; setFloat(mRadiusLocation, mRadius); mCenter = mCenter; setPoint(mCenterLocation, mCenter); mRefractiveIndex = mRefractiveIndex; setFloat(mRefractiveIndexLocation, mRefractiveIndex); }
<DeepExtract> mRadius = mRadius; setFloat(mRadiusLocation, mRadius); </DeepExtract> <DeepExtract> mCenter = mCenter; setPoint(mCenterLocation, mCenter); </DeepExtract> <DeepExtract> mRefractiveIndex = mRefractiveIndex; setFloat(mRefractiveIndexLocation, mRefractiveIndex); </DeepExtract>
SimpleVideoEditor
positive
private void initFragment() { if (mWeekUpdates != null && mWeekUpdates.size() != 0) { for (int i = 0; i < mWeekUpdates.size(); i++) { mFragments.add(WeekDetailFragment.newInstance(i, mWeekUpdates.get(i))); } } getChildFragmentManager().beginTransaction().add(R.id.fl_week, mFragments.get(0)).show(mFragments.get(0)).commit(); mSlidingTabs.setTabData(TDevice.getStringArray(R.array.week_arrays)); initWeekData(); mSlidingTabs.setCurrentTab(mCurrentTab); getChildFragmentManager().beginTransaction().add(R.id.fl_week, mFragments.get(mCurrentTab)).show(mFragments.get(mCurrentTab)).commit(); mSlidingTabs.setOnTabSelectListener(new OnTabSelectListener() { @Override public void onTabSelect(int position) { FragmentTransaction bt = getChildFragmentManager().beginTransaction(); bt.hide(mFragments.get(mCurrentTab)); if (!mFragments.get(position).isAdded()) { bt.add(R.id.fl_week, mFragments.get(position)); } bt.show(mFragments.get(position)).commit(); mCurrentTab = position; } @Override public void onTabReselect(int position) { } }); }
<DeepExtract> mSlidingTabs.setTabData(TDevice.getStringArray(R.array.week_arrays)); initWeekData(); mSlidingTabs.setCurrentTab(mCurrentTab); getChildFragmentManager().beginTransaction().add(R.id.fl_week, mFragments.get(mCurrentTab)).show(mFragments.get(mCurrentTab)).commit(); mSlidingTabs.setOnTabSelectListener(new OnTabSelectListener() { @Override public void onTabSelect(int position) { FragmentTransaction bt = getChildFragmentManager().beginTransaction(); bt.hide(mFragments.get(mCurrentTab)); if (!mFragments.get(position).isAdded()) { bt.add(R.id.fl_week, mFragments.get(position)); } bt.show(mFragments.get(position)).commit(); mCurrentTab = position; } @Override public void onTabReselect(int position) { } }); </DeepExtract>
honglv-no
positive
public static void tick() throws Exception { StringBuilder sb = new StringBuilder(); for (Iterator<Snake> iterator = SnakeTimer.getSnakes().iterator(); iterator.hasNext(); ) { Snake snake = iterator.next(); snake.update(SnakeTimer.getSnakes()); sb.append(snake.getLocationsJson()); if (iterator.hasNext()) { sb.append(','); } } Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes()); for (Snake snake : snakes) { try { snake.sendMessage(String.format("{'type': 'update', 'data' : [%s]}", sb.toString())); } catch (Throwable ex) { removeSnake(snake); } } }
<DeepExtract> Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes()); for (Snake snake : snakes) { try { snake.sendMessage(String.format("{'type': 'update', 'data' : [%s]}", sb.toString())); } catch (Throwable ex) { removeSnake(snake); } } </DeepExtract>
spring-tutorial
positive
public static String trimAndReleaseBuilder(ElasticCharAppender sb) { String out = sb.getTrimmedStringAndReset(); synchronized (builders) { builders.push(sb); while (builders.size() > MaxIdleBuilders) { builders.pop(); } } return out; }
<DeepExtract> synchronized (builders) { builders.push(sb); while (builders.size() > MaxIdleBuilders) { builders.pop(); } } </DeepExtract>
shopify
positive
@Test(expectedExceptions = IllegalArgumentException.class) public void mustThrowExceptionIfMultipleCollectionNameAnnotationsPresentOnMethod2() { String collName = RandomStringUtils.randomAlphabetic(10); List<Score> scores = getScoresDocuments(); reactiveMongoOperations.insert(scores, collName).collectList().block(); assertNotNull(countRepository, "Must have a repository"); Flux<Score> scores = reactiveMongoOperations.findAll(Score.class, collName); assertNotNull(scores); assertEquals(scores.collectList().block().size(), COUNT_TEST_DOCS.length); countRepository.invalidGetPassingScores2FromSpecifiedCollection2(collName, new Object(), collName).block(); }
<DeepExtract> assertNotNull(countRepository, "Must have a repository"); Flux<Score> scores = reactiveMongoOperations.findAll(Score.class, collName); assertNotNull(scores); assertEquals(scores.collectList().block().size(), COUNT_TEST_DOCS.length); </DeepExtract>
mongodb-aggregate-query-support
positive
protected void setup(Context context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); if (conf.getBoolean("debug.on", false)) { LOG.setLevel(Level.DEBUG); } fieldDelimRegex = conf.get("field.delim.regex", ","); maxCatAttrSplitGroups = conf.getInt("cpg.max.cat.attr.split.groups", 3); InputStream fs = Utility.getFileStream(context.getConfiguration(), "cpg.feature.schema.file.path"); ObjectMapper mapper = new ObjectMapper(); schema = mapper.readValue(fs, FeatureSchema.class); String attrSelectStrategy = conf.get("cpg.split.attribute.selection.strategy", "userSpecified"); atRoot = conf.getBoolean("cpg.at.root", false); if (atRoot) { LOG.debug("processing at root"); } else if (attrSelectStrategy.equals("userSpecified")) { String attrs = conf.get("cpg.split.attributes"); splitAttrs = Utility.intArrayFromString(attrs, ","); } else if (attrSelectStrategy.equals("all")) { splitAttrs = schema.getFeatureFieldOrdinals(); } else if (attrSelectStrategy.equals("notUsedYet")) { int[] allSplitAttrs = schema.getFeatureFieldOrdinals(); int[] usedSplitAppributes = null; splitAttrs = Utility.removeItems(allSplitAttrs, usedSplitAppributes); } else if (attrSelectStrategy.equals("random")) { int randomSplitSetSize = conf.getInt("cpg.random.split.set.size", 3); int[] allSplitAttrs = schema.getFeatureFieldOrdinals(); Set<Integer> splitSet = new HashSet<Integer>(); while (splitSet.size() != randomSplitSetSize) { int splitIndex = (int) (Math.random() * allSplitAttrs.length); splitSet.add(allSplitAttrs[splitIndex]); } splitAttrs = new int[randomSplitSetSize]; int i = 0; for (int spAttr : splitSet) { splitAttrs[i++] = spAttr; } } else { throw new IllegalArgumentException("invalid splitting attribute selection strategy"); } if (!atRoot) { createPartitions(); LOG.debug("created split partitions"); } classField = schema.findClassAttrField(); }
<DeepExtract> atRoot = conf.getBoolean("cpg.at.root", false); if (atRoot) { LOG.debug("processing at root"); } else if (attrSelectStrategy.equals("userSpecified")) { String attrs = conf.get("cpg.split.attributes"); splitAttrs = Utility.intArrayFromString(attrs, ","); } else if (attrSelectStrategy.equals("all")) { splitAttrs = schema.getFeatureFieldOrdinals(); } else if (attrSelectStrategy.equals("notUsedYet")) { int[] allSplitAttrs = schema.getFeatureFieldOrdinals(); int[] usedSplitAppributes = null; splitAttrs = Utility.removeItems(allSplitAttrs, usedSplitAppributes); } else if (attrSelectStrategy.equals("random")) { int randomSplitSetSize = conf.getInt("cpg.random.split.set.size", 3); int[] allSplitAttrs = schema.getFeatureFieldOrdinals(); Set<Integer> splitSet = new HashSet<Integer>(); while (splitSet.size() != randomSplitSetSize) { int splitIndex = (int) (Math.random() * allSplitAttrs.length); splitSet.add(allSplitAttrs[splitIndex]); } splitAttrs = new int[randomSplitSetSize]; int i = 0; for (int spAttr : splitSet) { splitAttrs[i++] = spAttr; } } else { throw new IllegalArgumentException("invalid splitting attribute selection strategy"); } </DeepExtract>
avenir
positive
public static void loadMessageDataWithPayloadAtOffset(byte[] messageData, int offset, UInt16 red, UInt16 green, UInt16 blue, UInt16 white) { int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = hue.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = saturation.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = brightness.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = kelvin.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = hue.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = saturation.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = brightness.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = kelvin.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = hue.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = saturation.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = brightness.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = kelvin.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = hue.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = saturation.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = brightness.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = kelvin.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; }
<DeepExtract> int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = hue.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = saturation.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = brightness.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = kelvin.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; </DeepExtract> <DeepExtract> int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = hue.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = saturation.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = brightness.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = kelvin.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; </DeepExtract> <DeepExtract> int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = hue.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = saturation.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = brightness.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = kelvin.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; </DeepExtract> <DeepExtract> int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = hue.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = saturation.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = brightness.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = kelvin.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; </DeepExtract>
lifx-sdk-android
positive
@Override public Object nextElement() throws NoSuchElementException { if (!hasMoreTokens() || _token == null) throw new NoSuchElementException(); String t = _token.toString(); _token.setLength(0); _hasToken = false; return t; }
<DeepExtract> if (!hasMoreTokens() || _token == null) throw new NoSuchElementException(); String t = _token.toString(); _token.setLength(0); _hasToken = false; return t; </DeepExtract>
Argo
positive
public Criteria andStarttimeLessThan(Date value) { if (value == null) { throw new RuntimeException("Value for " + "starttime" + " cannot be null"); } criteria.add(new Criterion("startTime <", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "starttime" + " cannot be null"); } criteria.add(new Criterion("startTime <", value)); </DeepExtract>
garbage-collection
positive
public <T extends V> T compute(@Nonnull final Key<? extends K, T> key, @Nonnull final BiFunction<? super Key<? extends K, ? extends V>, ? super V, ? extends V> fn) { return valueType.cast(map.compute(key, fn)); }
<DeepExtract> return valueType.cast(map.compute(key, fn)); </DeepExtract>
binkley
positive
public void postTweet(int userId, int tweetId) { if (!userMap.containsKey(userId)) { User u = new User(userId); userMap.put(userId, u); } Tweet t = new Tweet(tweetId); t.next = tweet_head; tweet_head = t; }
<DeepExtract> Tweet t = new Tweet(tweetId); t.next = tweet_head; tweet_head = t; </DeepExtract>
myleetcode
positive
@Test public void testFunction() { try { ModuleDeclaration module = SourceParserUtil.parseSourceModule("{{ post.published_at | date(\"m/d/Y\") }}"); assertNotNull(module); assertEquals(1, module.getStatements().size()); } catch (Exception e) { e.printStackTrace(); fail(); } }
<DeepExtract> try { ModuleDeclaration module = SourceParserUtil.parseSourceModule("{{ post.published_at | date(\"m/d/Y\") }}"); assertNotNull(module); assertEquals(1, module.getStatements().size()); } catch (Exception e) { e.printStackTrace(); fail(); } </DeepExtract>
Twig-Eclipse-Plugin
positive
public void setSUGGESTED_TILE_SIZE(final String val) { final Iterator<Element> it = ElementUtils.search(getRoot(), SUGGESTED_TILE_SIZEFilter).iterator(); if (it.hasNext()) { final Element el = it.next(); return ElementUtils.remove(el, el); } return false; final List<Element> list = new ArrayList<Element>(2); list.add(new Element(STRING).setText(SUGGESTED_TILE_SIZE)); list.add(new Element(STRING).setText(val)); parameters.add(null, list); }
<DeepExtract> final Iterator<Element> it = ElementUtils.search(getRoot(), SUGGESTED_TILE_SIZEFilter).iterator(); if (it.hasNext()) { final Element el = it.next(); return ElementUtils.remove(el, el); } return false; </DeepExtract> <DeepExtract> final List<Element> list = new ArrayList<Element>(2); list.add(new Element(STRING).setText(SUGGESTED_TILE_SIZE)); list.add(new Element(STRING).setText(val)); parameters.add(null, list); </DeepExtract>
geoserver-manager
positive
public PageBean<SmProductEntity> getProductByCriteria(ProductCriteriaBo criteria) throws Exception { UnionGoodsServiceHelper.UnionGoodsServiceClient client = new UnionGoodsServiceHelper.UnionGoodsServiceClient(); client.setClientInvocationContext(clientInvocationContext); QueryGoodsRequest request = new QueryGoodsRequest(); request.setKeyword(criteria.getKeyword()); Object orderBy = criteria.getOrderBy(PlatformTypeConstant.WPH); System.out.println(JSON.toJSONString(criteria, SerializerFeature.PrettyFormat)); if (orderBy != null) { String[] orderByInfo = orderBy.toString().split(" "); request.setFieldName(orderByInfo[0]); request.setOrder(Integer.valueOf(orderByInfo[1])); } request.setPage(criteria.getPageNum()); request.setPageSize(criteria.getPageSize()); request.setRequestId(UUID.randomUUID().toString()); request.setPriceStart(criteria.getMinPrice() != null ? (criteria.getMinPrice() / 100 + "") : null); request.setPriceEnd(criteria.getMaxPrice() != null ? (criteria.getMaxPrice() / 100 + "") : null); request.setQueryReputation(true); request.setQueryStock(true); request.setQueryActivity(true); request.setCommonParams(createCommonParams(criteria)); GoodsInfoResponse response = client.query(request); PageBean<SmProductEntity> pageBean = null; if (response.getGoodsInfoList() == null || response.getGoodsInfoList().isEmpty()) { pageBean = new PageBean<>(new ArrayList<>()); } else { pageBean = new PageBean<SmProductEntity>(response.getGoodsInfoList().stream().map(o -> convertGoodsList(o)).filter(o -> o != null).collect(Collectors.toList())); } pageBean.setTotal(response.getTotal()); pageBean.setPageNum(criteria.getPageNum()); pageBean.setPageSize(criteria.getPageSize()); return pageBean; }
<DeepExtract> PageBean<SmProductEntity> pageBean = null; if (response.getGoodsInfoList() == null || response.getGoodsInfoList().isEmpty()) { pageBean = new PageBean<>(new ArrayList<>()); } else { pageBean = new PageBean<SmProductEntity>(response.getGoodsInfoList().stream().map(o -> convertGoodsList(o)).filter(o -> o != null).collect(Collectors.toList())); } pageBean.setTotal(response.getTotal()); pageBean.setPageNum(criteria.getPageNum()); pageBean.setPageSize(criteria.getPageSize()); return pageBean; </DeepExtract>
cps-mall-cloud
positive
private void returnJson200(RequestAndResponse requestAndResponse) throws ServletException, IOException { response.setContentType("application/json;charset=utf-8"); response.getWriter().print("{\"success\":true}"); }
<DeepExtract> response.setContentType("application/json;charset=utf-8"); </DeepExtract> <DeepExtract> response.getWriter().print("{\"success\":true}"); </DeepExtract>
crushpaper
positive
@Override public void onClick(DialogInterface dialog, int which) { finput.setSelection(fCursor, fSelEnd); int start = (EditText) findViewById(R.id.input).getSelectionStart(); int end = (EditText) findViewById(R.id.input).getSelectionEnd(); extra[which] = removeStatusChar(extra[which]); if (start == 0) { extra[which] += ":"; } extra[which] += " "; (EditText) findViewById(R.id.input).getText().replace(start, end, extra[which], 0, extra[which].length()); (EditText) findViewById(R.id.input).setSelection(start + extra[which].length()); (EditText) findViewById(R.id.input).clearComposingText(); (EditText) findViewById(R.id.input).post(new Runnable() { @Override public void run() { EditText input = (EditText) findViewById(R.id.input); openSoftKeyboard((EditText) findViewById(R.id.input)); } }); (EditText) findViewById(R.id.input).requestFocus(); }
<DeepExtract> int start = (EditText) findViewById(R.id.input).getSelectionStart(); int end = (EditText) findViewById(R.id.input).getSelectionEnd(); extra[which] = removeStatusChar(extra[which]); if (start == 0) { extra[which] += ":"; } extra[which] += " "; (EditText) findViewById(R.id.input).getText().replace(start, end, extra[which], 0, extra[which].length()); (EditText) findViewById(R.id.input).setSelection(start + extra[which].length()); (EditText) findViewById(R.id.input).clearComposingText(); (EditText) findViewById(R.id.input).post(new Runnable() { @Override public void run() { EditText input = (EditText) findViewById(R.id.input); openSoftKeyboard((EditText) findViewById(R.id.input)); } }); (EditText) findViewById(R.id.input).requestFocus(); </DeepExtract>
simpleirc
positive
public void paste() { performGesture(new Gesture() { public void describeTo(Description description) { description.appendText("paste-from-clipboard"); } public void performGesture(Automaton automaton) { MappedKeyStrokeProbe keyStrokeProbe = new MappedKeyStrokeProbe(component(), appropriateInputMapId(), "paste-from-clipboard"); check(keyStrokeProbe); automaton.perform(interpretKeyStroke(keyStrokeProbe.mappedKeyStroke)); } }); }
<DeepExtract> performGesture(new Gesture() { public void describeTo(Description description) { description.appendText("paste-from-clipboard"); } public void performGesture(Automaton automaton) { MappedKeyStrokeProbe keyStrokeProbe = new MappedKeyStrokeProbe(component(), appropriateInputMapId(), "paste-from-clipboard"); check(keyStrokeProbe); automaton.perform(interpretKeyStroke(keyStrokeProbe.mappedKeyStroke)); } }); </DeepExtract>
windowlicker
positive
@Override public void update(Graphics g) { g.drawImage(ip.createImage(), 0, 0, null); }
<DeepExtract> g.drawImage(ip.createImage(), 0, 0, null); </DeepExtract>
3Dscript
positive
@DataTypeHint(value = "RAW", bridgedTo = org.locationtech.jts.geom.Geometry.class) public Geometry eval(@DataTypeHint("String") String lineString, @DataTypeHint("String") String inputDelimiter) throws ParseException { FileDataSplitter delimiter = inputDelimiter == null ? FileDataSplitter.CSV : FileDataSplitter.getFileDataSplitter(inputDelimiter); FormatUtils<Geometry> formatUtils = new FormatUtils<>(delimiter, false, GeometryType.LINESTRING); return formatUtils.readGeometry(lineString); }
<DeepExtract> FileDataSplitter delimiter = inputDelimiter == null ? FileDataSplitter.CSV : FileDataSplitter.getFileDataSplitter(inputDelimiter); FormatUtils<Geometry> formatUtils = new FormatUtils<>(delimiter, false, GeometryType.LINESTRING); return formatUtils.readGeometry(lineString); </DeepExtract>
incubator-sedona
positive
private void updateConfigurationFileTlvBuilder(TlvBuilder tb) { boolean localDebug = Boolean.FALSE; if (debug | localDebug) logger.debug("ConfigurationFile.add(tb): - Hex: " + tb.toStringSeperation(":")); addTlvBuilder(tb); }
<DeepExtract> boolean localDebug = Boolean.FALSE; if (debug | localDebug) logger.debug("ConfigurationFile.add(tb): - Hex: " + tb.toStringSeperation(":")); addTlvBuilder(tb); </DeepExtract>
Oscar
positive
public void actionPerformed(ActionEvent e) { yaxis.setSelected(false); zaxis.setSelected(false); for (ParameterRow r : rows) if (!r._paramName.equals(_paramName)) r.xaxis.setSelected(false); dataUpdated = false; System.out.println("fireSelectedDataChanged from " + _paramName + " xaxis"); Object[][] sel = getSelectedFullData(); System.out.println("selected full data :"); System.out.println(Array.cat(_parametersNames)); if (sel.length > 0) System.out.println(Array.cat(getSelectedFullData())); sel = getSelectedProjectedData(); System.out.println("selected projected data :"); switch(_dimension) { case 1: System.out.println(Array.cat(new String[] { getSelectedXAxis() })); break; case 2: System.out.println(Array.cat(new String[] { getSelectedXAxis(), getSelectedYAxis() })); break; case 3: System.out.println(Array.cat(new String[] { getSelectedXAxis(), getSelectedYAxis(), getSelectedZAxis() })); break; } if (sel.length > 0) System.out.println(Array.cat(getSelectedProjectedData())); }
<DeepExtract> System.out.println("fireSelectedDataChanged from " + _paramName + " xaxis"); Object[][] sel = getSelectedFullData(); System.out.println("selected full data :"); System.out.println(Array.cat(_parametersNames)); if (sel.length > 0) System.out.println(Array.cat(getSelectedFullData())); sel = getSelectedProjectedData(); System.out.println("selected projected data :"); switch(_dimension) { case 1: System.out.println(Array.cat(new String[] { getSelectedXAxis() })); break; case 2: System.out.println(Array.cat(new String[] { getSelectedXAxis(), getSelectedYAxis() })); break; case 3: System.out.println(Array.cat(new String[] { getSelectedXAxis(), getSelectedYAxis(), getSelectedZAxis() })); break; } if (sel.length > 0) System.out.println(Array.cat(getSelectedProjectedData())); </DeepExtract>
jmathplot
positive
@Override public void onInitialized() { super.onInitialized(); mSaturation = mSaturation; setFloat(mSaturationLocation, mSaturation); }
<DeepExtract> mSaturation = mSaturation; setFloat(mSaturationLocation, mSaturation); </DeepExtract>
MagicCamera
positive
public boolean purgePort(int flags) throws SerialPortException { if (!portOpened) { throw new SerialPortException(portName, "purgePort()", SerialPortException.TYPE_PORT_NOT_OPENED); } return serialInterface.purgePort(portHandle, flags); }
<DeepExtract> if (!portOpened) { throw new SerialPortException(portName, "purgePort()", SerialPortException.TYPE_PORT_NOT_OPENED); } </DeepExtract>
Androidmodbusrtu
positive
public void stop() { if (!mIsCompleted && !mCurPlayVideoAccount.isEmpty() && !mCurPlayVideoId.isEmpty()) { SpUtils.put(mContext, PREFIX_VIDEO_PLAY_POSITION + mCurPlayVideoAccount, mCurPlayVideoId, String.valueOf(getCurPlayTime())); } mVideoView.onStop(); CoreUtil.disposeSubscribe(mUpdateVideoTimeDis, mControllerDis); }
<DeepExtract> if (!mIsCompleted && !mCurPlayVideoAccount.isEmpty() && !mCurPlayVideoId.isEmpty()) { SpUtils.put(mContext, PREFIX_VIDEO_PLAY_POSITION + mCurPlayVideoAccount, mCurPlayVideoId, String.valueOf(getCurPlayTime())); } </DeepExtract>
VlcVideoView
positive
public void read(org.apache.thrift.protocol.TProtocol iprot, get_result struct) throws org.apache.thrift.TException { iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch(schemeField.id) { case 0: if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.success = new UserInfo(); struct.success.read(iprot); struct.setSuccessIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); }
<DeepExtract> </DeepExtract>
thrift-rpc
positive
private void init(Context context, AttributeSet attrs) { LayoutInflater.from(context).inflate(R.layout.ease_widget_title_bar, this); leftLayout = (RelativeLayout) findViewById(R.id.left_layout); leftImage = (ImageView) findViewById(R.id.left_image); rightLayout = (RelativeLayout) findViewById(R.id.right_layout); rightImage = (ImageView) findViewById(R.id.right_image); titleView = (TextView) findViewById(R.id.title); titleLayout = (RelativeLayout) findViewById(R.id.root); if (attrs != null) { TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.EaseTitleBar); String title = ta.getString(R.styleable.EaseTitleBar_titleBarTitle); titleView.setText(title); Drawable leftDrawable = ta.getDrawable(R.styleable.EaseTitleBar_titleBarLeftImage); if (null != leftDrawable) { leftImage.setImageDrawable(leftDrawable); } Drawable rightDrawable = ta.getDrawable(R.styleable.EaseTitleBar_titleBarRightImage); if (null != rightDrawable) { rightImage.setImageDrawable(rightDrawable); } Drawable background = ta.getDrawable(R.styleable.EaseTitleBar_titleBarBackground); if (null != background) { titleLayout.setBackgroundDrawable(background); } ta.recycle(); } }
<DeepExtract> if (attrs != null) { TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.EaseTitleBar); String title = ta.getString(R.styleable.EaseTitleBar_titleBarTitle); titleView.setText(title); Drawable leftDrawable = ta.getDrawable(R.styleable.EaseTitleBar_titleBarLeftImage); if (null != leftDrawable) { leftImage.setImageDrawable(leftDrawable); } Drawable rightDrawable = ta.getDrawable(R.styleable.EaseTitleBar_titleBarRightImage); if (null != rightDrawable) { rightImage.setImageDrawable(rightDrawable); } Drawable background = ta.getDrawable(R.styleable.EaseTitleBar_titleBarBackground); if (null != background) { titleLayout.setBackgroundDrawable(background); } ta.recycle(); } </DeepExtract>
KTalk
positive
@Override public void send(TokensAllocatedEmailMessage tokensAllocatedEmailMessage) { LOG.info("Message to <{}> exchange. Message content: {}", TRANSACTION_TOKENS_ALLOCATED_ROUTING_KEY, toJsonOrReferenceString(tokensAllocatedEmailMessage)); this.amqpMessageService.send(TRANSACTION_TOKENS_ALLOCATED_ROUTING_KEY, tokensAllocatedEmailMessage); }
<DeepExtract> LOG.info("Message to <{}> exchange. Message content: {}", TRANSACTION_TOKENS_ALLOCATED_ROUTING_KEY, toJsonOrReferenceString(tokensAllocatedEmailMessage)); this.amqpMessageService.send(TRANSACTION_TOKENS_ALLOCATED_ROUTING_KEY, tokensAllocatedEmailMessage); </DeepExtract>
ICOnator-backend
positive
public static byte[] readAllLimited(InputStream inStr, int limit) throws IOException { ByteArrayOutputStream buf = new ByteArrayOutputStream(); long total = 0; byte[] bs = new byte[BUFFER_SIZE]; int numRead; while ((numRead = inStr.read(bs, 0, bs.length)) >= 0) { total += numRead; if (total > limit) { throw new RuntimeException("Data Overflow"); } buf.write(bs, 0, numRead); } return total; return buf.toByteArray(); }
<DeepExtract> long total = 0; byte[] bs = new byte[BUFFER_SIZE]; int numRead; while ((numRead = inStr.read(bs, 0, bs.length)) >= 0) { total += numRead; if (total > limit) { throw new RuntimeException("Data Overflow"); } buf.write(bs, 0, numRead); } return total; </DeepExtract>
ESign
positive
@Test void negatedClasses() { EscapedCharacterClassTree escapedClass = assertType(EscapedCharacterClassTree.class, assertSuccessfulParse("\\\\W")); assertThat(escapedClass.isProperty()).isFalse(); assertThat(escapedClass.property()).isNull(); assertThat(escapedClass.getType()).isEqualTo('W'); assertThat(escapedClass.isNegation()).isEqualTo(true); assertThat(escapedClass.characterClassElementKind()).isEqualTo(CharacterClassElementTree.Kind.ESCAPED_CHARACTER_CLASS); assertThat(escapedClass.incomingTransitionType()).isEqualTo(AutomatonState.TransitionType.CHARACTER); EscapedCharacterClassTree escapedClass = assertType(EscapedCharacterClassTree.class, assertSuccessfulParse("\\\\D")); assertThat(escapedClass.isProperty()).isFalse(); assertThat(escapedClass.property()).isNull(); assertThat(escapedClass.getType()).isEqualTo('D'); assertThat(escapedClass.isNegation()).isEqualTo(true); assertThat(escapedClass.characterClassElementKind()).isEqualTo(CharacterClassElementTree.Kind.ESCAPED_CHARACTER_CLASS); assertThat(escapedClass.incomingTransitionType()).isEqualTo(AutomatonState.TransitionType.CHARACTER); EscapedCharacterClassTree escapedClass = assertType(EscapedCharacterClassTree.class, assertSuccessfulParse("\\\\S")); assertThat(escapedClass.isProperty()).isFalse(); assertThat(escapedClass.property()).isNull(); assertThat(escapedClass.getType()).isEqualTo('S'); assertThat(escapedClass.isNegation()).isEqualTo(true); assertThat(escapedClass.characterClassElementKind()).isEqualTo(CharacterClassElementTree.Kind.ESCAPED_CHARACTER_CLASS); assertThat(escapedClass.incomingTransitionType()).isEqualTo(AutomatonState.TransitionType.CHARACTER); EscapedCharacterClassTree escapedClass = assertType(EscapedCharacterClassTree.class, assertSuccessfulParse("\\\\H")); assertThat(escapedClass.isProperty()).isFalse(); assertThat(escapedClass.property()).isNull(); assertThat(escapedClass.getType()).isEqualTo('H'); assertThat(escapedClass.isNegation()).isEqualTo(true); assertThat(escapedClass.characterClassElementKind()).isEqualTo(CharacterClassElementTree.Kind.ESCAPED_CHARACTER_CLASS); assertThat(escapedClass.incomingTransitionType()).isEqualTo(AutomatonState.TransitionType.CHARACTER); EscapedCharacterClassTree escapedClass = assertType(EscapedCharacterClassTree.class, assertSuccessfulParse("\\\\V")); assertThat(escapedClass.isProperty()).isFalse(); assertThat(escapedClass.property()).isNull(); assertThat(escapedClass.getType()).isEqualTo('V'); assertThat(escapedClass.isNegation()).isEqualTo(true); assertThat(escapedClass.characterClassElementKind()).isEqualTo(CharacterClassElementTree.Kind.ESCAPED_CHARACTER_CLASS); assertThat(escapedClass.incomingTransitionType()).isEqualTo(AutomatonState.TransitionType.CHARACTER); }
<DeepExtract> EscapedCharacterClassTree escapedClass = assertType(EscapedCharacterClassTree.class, assertSuccessfulParse("\\\\W")); assertThat(escapedClass.isProperty()).isFalse(); assertThat(escapedClass.property()).isNull(); assertThat(escapedClass.getType()).isEqualTo('W'); assertThat(escapedClass.isNegation()).isEqualTo(true); assertThat(escapedClass.characterClassElementKind()).isEqualTo(CharacterClassElementTree.Kind.ESCAPED_CHARACTER_CLASS); assertThat(escapedClass.incomingTransitionType()).isEqualTo(AutomatonState.TransitionType.CHARACTER); </DeepExtract> <DeepExtract> EscapedCharacterClassTree escapedClass = assertType(EscapedCharacterClassTree.class, assertSuccessfulParse("\\\\D")); assertThat(escapedClass.isProperty()).isFalse(); assertThat(escapedClass.property()).isNull(); assertThat(escapedClass.getType()).isEqualTo('D'); assertThat(escapedClass.isNegation()).isEqualTo(true); assertThat(escapedClass.characterClassElementKind()).isEqualTo(CharacterClassElementTree.Kind.ESCAPED_CHARACTER_CLASS); assertThat(escapedClass.incomingTransitionType()).isEqualTo(AutomatonState.TransitionType.CHARACTER); </DeepExtract> <DeepExtract> EscapedCharacterClassTree escapedClass = assertType(EscapedCharacterClassTree.class, assertSuccessfulParse("\\\\S")); assertThat(escapedClass.isProperty()).isFalse(); assertThat(escapedClass.property()).isNull(); assertThat(escapedClass.getType()).isEqualTo('S'); assertThat(escapedClass.isNegation()).isEqualTo(true); assertThat(escapedClass.characterClassElementKind()).isEqualTo(CharacterClassElementTree.Kind.ESCAPED_CHARACTER_CLASS); assertThat(escapedClass.incomingTransitionType()).isEqualTo(AutomatonState.TransitionType.CHARACTER); </DeepExtract> <DeepExtract> EscapedCharacterClassTree escapedClass = assertType(EscapedCharacterClassTree.class, assertSuccessfulParse("\\\\H")); assertThat(escapedClass.isProperty()).isFalse(); assertThat(escapedClass.property()).isNull(); assertThat(escapedClass.getType()).isEqualTo('H'); assertThat(escapedClass.isNegation()).isEqualTo(true); assertThat(escapedClass.characterClassElementKind()).isEqualTo(CharacterClassElementTree.Kind.ESCAPED_CHARACTER_CLASS); assertThat(escapedClass.incomingTransitionType()).isEqualTo(AutomatonState.TransitionType.CHARACTER); </DeepExtract> <DeepExtract> EscapedCharacterClassTree escapedClass = assertType(EscapedCharacterClassTree.class, assertSuccessfulParse("\\\\V")); assertThat(escapedClass.isProperty()).isFalse(); assertThat(escapedClass.property()).isNull(); assertThat(escapedClass.getType()).isEqualTo('V'); assertThat(escapedClass.isNegation()).isEqualTo(true); assertThat(escapedClass.characterClassElementKind()).isEqualTo(CharacterClassElementTree.Kind.ESCAPED_CHARACTER_CLASS); assertThat(escapedClass.incomingTransitionType()).isEqualTo(AutomatonState.TransitionType.CHARACTER); </DeepExtract>
sonar-analyzer-commons
positive
@Override public void set(byte[] value) { this.addressBytes = value; }
<DeepExtract> this.addressBytes = value; </DeepExtract>
DbQuery
positive
@Test public void handle_withOtherMessage_doesntNotifyOnClockCountDownUpdated() { return new TotalWorkoutTimeSubscription() { @Override protected void onTimeUpdated(Duration time) { internalSubscription.onTimeUpdated(time); } }; subscription.handle(new StartCommunicationMessage()); internalSubscription.onTimeUpdated(any(Duration.class)); }
<DeepExtract> return new TotalWorkoutTimeSubscription() { @Override protected void onTimeUpdated(Duration time) { internalSubscription.onTimeUpdated(time); } }; </DeepExtract> <DeepExtract> internalSubscription.onTimeUpdated(any(Duration.class)); </DeepExtract>
waterrower-core
positive
@Override CMAArray<CMASnapshot> method() { assertNotNull(entry, "entry"); final String entryId = getResourceIdOrThrow(entry, "entry"); final String spaceId = getSpaceIdOrThrow(entry, "entry"); final String environmentId = entry.getEnvironmentId(); return service.fetchAllSnapshots(spaceId, environmentId, entryId).blockingFirst(); }
<DeepExtract> assertNotNull(entry, "entry"); final String entryId = getResourceIdOrThrow(entry, "entry"); final String spaceId = getSpaceIdOrThrow(entry, "entry"); final String environmentId = entry.getEnvironmentId(); return service.fetchAllSnapshots(spaceId, environmentId, entryId).blockingFirst(); </DeepExtract>
contentful-management.java
positive
public static void main(String[] args) { PackTools.Printer.print("----args[0]=" + args[0]); PackTools.Printer.print("----args[1]=" + args[1]); PackTools.Error_Msg = null; QBUILD_OUT = args[0]; QBUILD_PATH = args[1]; PackTools.Printer.print("----java package start----"); start_time = System.currentTimeMillis(); PackTools.Printer.print("----pkgBefore----"); if (QBUILD_OUT.equals("game-overseas-sdk_output") && QBUILD_PATH.equals("game-overseas-sdk")) { isLocalPkg = true; } if (isLocalPkg) { String sh_dir = new File("").getAbsolutePath(); String master_src_dir = new File(sh_dir).getParentFile().getParent(); QBUILD_OUT = new File(master_src_dir).getParent() + "/" + QBUILD_OUT; PackTools.Printer.print("deleting " + QBUILD_OUT); File file_qbuild_out = new File(QBUILD_OUT); FileUtils.delete(file_qbuild_out.getAbsolutePath()); file_qbuild_out.mkdirs(); QBUILD_PATH = master_src_dir; PackTools.Printer.print("local_package_sdk.sh--args[0]=" + QBUILD_OUT); PackTools.Printer.print("local_package_sdk.sh--args[1]=" + QBUILD_PATH); } zip_count = 0; for (int i = 0; i < BUILD_TYPES.length; i++) { final int index = i; new Thread() { public void run() { if (PackTools.Error_Msg != null) { System.exit(0); return; } try { final String SRC_PATH = new File(QBUILD_PATH).getParent() + "/game-overseas-sdk_" + BUILD_TYPES[index]; final String SDK_OUT = QBUILD_OUT + "/" + BUILD_TYPES[index]; if (isLocalPkg) { PackTools.Printer.print("deleting SRC_PATH = " + SRC_PATH); FileUtils.delete(SRC_PATH); FileUtils.delete(SDK_OUT); } new File(SDK_OUT + "/proj-input/libs").mkdirs(); new File(SDK_OUT + "/demo").mkdirs(); new File(SDK_OUT + "/demo-src").mkdirs(); FileUtils.copyDirectory(QBUILD_PATH, SRC_PATH); PackTools.modifyEnvConstants(SRC_PATH); FileUtils.delete(SRC_PATH + "/.git"); PackTools.Printer.print("----1111 first package sdk start for " + BUILD_TYPES[index] + "----"); PackTools.modifyBuildGradleForFirst(SRC_PATH); exe_build_demo_apk_sh(SRC_PATH, BUILD_TYPES[index]); if (BUILD_TYPES[index].equals("release")) { copyMappingToOutput(SRC_PATH, SDK_OUT); } PackTools.modifyBuildGradleForSecond(SRC_PATH); copySdkAarToDemoForBuild(SRC_PATH, BUILD_TYPES[index]); PackTools.Printer.print("----2222 second package sdk start for " + BUILD_TYPES[index] + "----"); exe_build_demo_apk_sh(SRC_PATH, BUILD_TYPES[index]); copySdkAarsToOutput(SRC_PATH, SDK_OUT); copyDemoApkToOutput(SRC_PATH, SDK_OUT, BUILD_TYPES[index]); copyDemoSrc(SRC_PATH, SDK_OUT); String sdkCode = PackTools.getSdkVersionCode(SRC_PATH); String zipName = ("hayio-game-overseas-sdk-v111-222.zip").replace("111", sdkCode).replace("222", BUILD_TYPES[index]); zipName = SDK_OUT.replace(BUILD_TYPES[index], zipName); ZipUtils.zip(SDK_OUT, zipName); FileUtils.delete(SRC_PATH); FileUtils.delete(SDK_OUT); zip_count++; } catch (Exception e) { PackTools.Error_Msg = e.toString(); PackTools.Printer.print("打包失败:" + e.toString()); System.exit(0); } } }.start(); } while (true) { try { Thread.sleep(15 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } if (PackTools.Error_Msg != null) { PackTools.Printer.print("----\n\njava package failed:" + PackTools.Error_Msg + "\n\n----"); System.exit(0); } if (zip_count == BUILD_TYPES.length) { PackTools.Printer.print("package sdk length is [" + zip_count + "] finished"); System.exit(0); break; } } float minutes = (System.currentTimeMillis() - start_time) / 1000f / 60f; minutes = PackTools.formatFloat(minutes, 2); PackTools.Printer.print("----java package finished,it takes " + minutes + " minutes----"); }
<DeepExtract> PackTools.Printer.print("----pkgBefore----"); if (QBUILD_OUT.equals("game-overseas-sdk_output") && QBUILD_PATH.equals("game-overseas-sdk")) { isLocalPkg = true; } if (isLocalPkg) { String sh_dir = new File("").getAbsolutePath(); String master_src_dir = new File(sh_dir).getParentFile().getParent(); QBUILD_OUT = new File(master_src_dir).getParent() + "/" + QBUILD_OUT; PackTools.Printer.print("deleting " + QBUILD_OUT); File file_qbuild_out = new File(QBUILD_OUT); FileUtils.delete(file_qbuild_out.getAbsolutePath()); file_qbuild_out.mkdirs(); QBUILD_PATH = master_src_dir; PackTools.Printer.print("local_package_sdk.sh--args[0]=" + QBUILD_OUT); PackTools.Printer.print("local_package_sdk.sh--args[1]=" + QBUILD_PATH); } </DeepExtract> <DeepExtract> zip_count = 0; for (int i = 0; i < BUILD_TYPES.length; i++) { final int index = i; new Thread() { public void run() { if (PackTools.Error_Msg != null) { System.exit(0); return; } try { final String SRC_PATH = new File(QBUILD_PATH).getParent() + "/game-overseas-sdk_" + BUILD_TYPES[index]; final String SDK_OUT = QBUILD_OUT + "/" + BUILD_TYPES[index]; if (isLocalPkg) { PackTools.Printer.print("deleting SRC_PATH = " + SRC_PATH); FileUtils.delete(SRC_PATH); FileUtils.delete(SDK_OUT); } new File(SDK_OUT + "/proj-input/libs").mkdirs(); new File(SDK_OUT + "/demo").mkdirs(); new File(SDK_OUT + "/demo-src").mkdirs(); FileUtils.copyDirectory(QBUILD_PATH, SRC_PATH); PackTools.modifyEnvConstants(SRC_PATH); FileUtils.delete(SRC_PATH + "/.git"); PackTools.Printer.print("----1111 first package sdk start for " + BUILD_TYPES[index] + "----"); PackTools.modifyBuildGradleForFirst(SRC_PATH); exe_build_demo_apk_sh(SRC_PATH, BUILD_TYPES[index]); if (BUILD_TYPES[index].equals("release")) { copyMappingToOutput(SRC_PATH, SDK_OUT); } PackTools.modifyBuildGradleForSecond(SRC_PATH); copySdkAarToDemoForBuild(SRC_PATH, BUILD_TYPES[index]); PackTools.Printer.print("----2222 second package sdk start for " + BUILD_TYPES[index] + "----"); exe_build_demo_apk_sh(SRC_PATH, BUILD_TYPES[index]); copySdkAarsToOutput(SRC_PATH, SDK_OUT); copyDemoApkToOutput(SRC_PATH, SDK_OUT, BUILD_TYPES[index]); copyDemoSrc(SRC_PATH, SDK_OUT); String sdkCode = PackTools.getSdkVersionCode(SRC_PATH); String zipName = ("hayio-game-overseas-sdk-v111-222.zip").replace("111", sdkCode).replace("222", BUILD_TYPES[index]); zipName = SDK_OUT.replace(BUILD_TYPES[index], zipName); ZipUtils.zip(SDK_OUT, zipName); FileUtils.delete(SRC_PATH); FileUtils.delete(SDK_OUT); zip_count++; } catch (Exception e) { PackTools.Error_Msg = e.toString(); PackTools.Printer.print("打包失败:" + e.toString()); System.exit(0); } } }.start(); } </DeepExtract> <DeepExtract> while (true) { try { Thread.sleep(15 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } if (PackTools.Error_Msg != null) { PackTools.Printer.print("----\n\njava package failed:" + PackTools.Error_Msg + "\n\n----"); System.exit(0); } if (zip_count == BUILD_TYPES.length) { PackTools.Printer.print("package sdk length is [" + zip_count + "] finished"); System.exit(0); break; } } </DeepExtract>
BaseMyProject
positive
public int decode(String data, OutputStream out) throws IOException { int length = 0; int end = data.length(); while (end > 0) { if (!ignore(data.charAt(end - 1))) { break; } end--; } int i = 0; int finish = end - 4; while ((i < finish) && ignore((char) data[i])) { i++; } return i; while (i < finish) { b1 = decodingTable[data.charAt(i++)]; i = nextI(data, i, finish); b2 = decodingTable[data.charAt(i++)]; i = nextI(data, i, finish); b3 = decodingTable[data.charAt(i++)]; i = nextI(data, i, finish); b4 = decodingTable[data.charAt(i++)]; out.write((b1 << 2) | (b2 >> 4)); out.write((b2 << 4) | (b3 >> 2)); out.write((b3 << 6) | b4); length += 3; i = nextI(data, i, finish); } byte b1, b2, b3, b4; if (data.charAt(end - 2) == padding) { b1 = decodingTable[data.charAt(end - 4)]; b2 = decodingTable[data.charAt(end - 3)]; out.write((b1 << 2) | (b2 >> 4)); length = 1; } else if (data.charAt(end - 1) == padding) { b1 = decodingTable[data.charAt(end - 4)]; b2 = decodingTable[data.charAt(end - 3)]; b3 = decodingTable[data.charAt(end - 2)]; out.write((b1 << 2) | (b2 >> 4)); out.write((b2 << 4) | (b3 >> 2)); length = 2; } else { b1 = decodingTable[data.charAt(end - 4)]; b2 = decodingTable[data.charAt(end - 3)]; b3 = decodingTable[data.charAt(end - 2)]; b4 = decodingTable[data.charAt(end - 1)]; out.write((b1 << 2) | (b2 >> 4)); out.write((b2 << 4) | (b3 >> 2)); out.write((b3 << 6) | b4); length = 3; } return length; }
<DeepExtract> while ((i < finish) && ignore((char) data[i])) { i++; } return i; </DeepExtract> <DeepExtract> byte b1, b2, b3, b4; if (data.charAt(end - 2) == padding) { b1 = decodingTable[data.charAt(end - 4)]; b2 = decodingTable[data.charAt(end - 3)]; out.write((b1 << 2) | (b2 >> 4)); length = 1; } else if (data.charAt(end - 1) == padding) { b1 = decodingTable[data.charAt(end - 4)]; b2 = decodingTable[data.charAt(end - 3)]; b3 = decodingTable[data.charAt(end - 2)]; out.write((b1 << 2) | (b2 >> 4)); out.write((b2 << 4) | (b3 >> 2)); length = 2; } else { b1 = decodingTable[data.charAt(end - 4)]; b2 = decodingTable[data.charAt(end - 3)]; b3 = decodingTable[data.charAt(end - 2)]; b4 = decodingTable[data.charAt(end - 1)]; out.write((b1 << 2) | (b2 >> 4)); out.write((b2 << 4) | (b3 >> 2)); out.write((b3 << 6) | b4); length = 3; } </DeepExtract>
goldenkey-android
positive
@Override public String toString() { return x + ";" + z; }
<DeepExtract> return x + ";" + z; </DeepExtract>
PlotMe-Core
positive
@Override public void savePiece(int pieceIndex, byte[] pieceData) throws IOException { if (pieceIndex < 0 || pieceIndex >= piecesCount) { throw new IllegalArgumentException("Incorrect piece index " + pieceIndex + ". Piece index must be positive less than" + piecesCount); } try { readWriteLock.writeLock().lock(); if (closedFully) throw new IOException("Storage is closed"); BitSet availablePieces = this.availablePieces; boolean isFullyDownloaded = availablePieces == null; if (isFullyDownloaded) return; if (availablePieces.get(pieceIndex)) return; openStorageIsNecessary(false); long pos = pieceIndex; pos = pos * pieceSize; ByteBuffer buffer = ByteBuffer.wrap(pieceData); fileCollectionStorage.write(buffer, pos); availablePieces.set(pieceIndex); boolean isFullyNow = availablePieces.cardinality() == piecesCount; if (isFullyNow) { this.availablePieces = null; fileCollectionStorage.finish(); fileCollectionStorage.close(); fileCollectionStorage.open(true); } } finally { readWriteLock.writeLock().unlock(); } }
<DeepExtract> if (pieceIndex < 0 || pieceIndex >= piecesCount) { throw new IllegalArgumentException("Incorrect piece index " + pieceIndex + ". Piece index must be positive less than" + piecesCount); } </DeepExtract>
ttorrent
positive
public final V put(K key, V value) { if (key == null || value == null) { throw new NullPointerException("key == null || value == null"); } synchronized (this) { putCount++; size += safeSizeOf(key, value); previous = map.put(key, value); if (previous != null) { size -= safeSizeOf(key, previous); } } if (previous != null) { entryRemoved(false, key, previous, value); } while (true) { K key; V value; synchronized (this) { if (size < 0 || (map.isEmpty() && size != 0)) { throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!"); } if (size <= maxSize || map.isEmpty()) { break; } Map.Entry<K, V> toEvict = map.entrySet().iterator().next(); key = toEvict.getKey(); value = toEvict.getValue(); map.remove(key); size -= safeSizeOf(key, value); evictionCount++; } entryRemoved(true, key, value, null); } return previous; }
<DeepExtract> while (true) { K key; V value; synchronized (this) { if (size < 0 || (map.isEmpty() && size != 0)) { throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!"); } if (size <= maxSize || map.isEmpty()) { break; } Map.Entry<K, V> toEvict = map.entrySet().iterator().next(); key = toEvict.getKey(); value = toEvict.getValue(); map.remove(key); size -= safeSizeOf(key, value); evictionCount++; } entryRemoved(true, key, value, null); } </DeepExtract>
eduOnline_android
positive
private void setView(int id, SurfaceView view) { if (mSurfacesState.get() != SURFACE_STATE_INIT) throw new IllegalStateException("Can't set view when already attached. " + "Current state: " + mSurfacesState.get() + ", " + "mSurfaces[ID_VIDEO]: " + mSurfaceHelpers[ID_VIDEO] + " / " + mSurfaces[ID_VIDEO] + ", " + "mSurfaces[ID_SUBTITLES]: " + mSurfaceHelpers[ID_SUBTITLES] + " / " + mSurfaces[ID_SUBTITLES]); if (view == null) throw new NullPointerException("view is null"); final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.release(); mSurfaceHelpers[id] = new SurfaceHelper(id, view); }
<DeepExtract> if (mSurfacesState.get() != SURFACE_STATE_INIT) throw new IllegalStateException("Can't set view when already attached. " + "Current state: " + mSurfacesState.get() + ", " + "mSurfaces[ID_VIDEO]: " + mSurfaceHelpers[ID_VIDEO] + " / " + mSurfaces[ID_VIDEO] + ", " + "mSurfaces[ID_SUBTITLES]: " + mSurfaceHelpers[ID_SUBTITLES] + " / " + mSurfaces[ID_SUBTITLES]); </DeepExtract>
LunVlc
positive
public boolean checkAndReportDependencyProbes() throws ProbeInterruptedException { ProbeStatus status = null; for (Probe dependency : dependencyProbes) { status = ping(dependency, true); if (!status.isSuccess()) { break; } reportProbeStatus(status); } return status; if (status != null && !status.isSuccess()) { status.markAsSuccessful(); reportProbeStatus(status); return false; } return true; }
<DeepExtract> ProbeStatus status = null; for (Probe dependency : dependencyProbes) { status = ping(dependency, true); if (!status.isSuccess()) { break; } reportProbeStatus(status); } return status; </DeepExtract>
hoya
positive
@Test(timeout = 30_000) public void testNullBulk(TestContext should) { final Async test = should.async(); final RESPParser parser = new RESPParser(new ParserHandler() { @Override public void handle(Response response) { should.assertTrue(response == null); test.complete(); } @Override public void fail(Throwable t) { should.fail(t); } }, 16); should.assertEquals(0, Buffer.buffer("$-1\r\n").size()); should.assertTrue(Buffer.buffer("$-1\r\n") == MultiType.EMPTY_MULTI); test.complete(); }
<DeepExtract> should.assertEquals(0, Buffer.buffer("$-1\r\n").size()); should.assertTrue(Buffer.buffer("$-1\r\n") == MultiType.EMPTY_MULTI); test.complete(); </DeepExtract>
vertx-redis-client
positive
public static Object newServiceInstance(String className, String serviceId, ClassLoader classLoader) throws ClassNotFoundException { return newInstance(loadClass(loadServiceClass(className, serviceId, classLoader))); }
<DeepExtract> return newInstance(loadClass(loadServiceClass(className, serviceId, classLoader))); </DeepExtract>
sofa-common-tools
positive
public static Message destroy(Long id, HashMap<String, Object> parameters, HashMap<String, Object> options) throws IOException { parameters = parameters != null ? parameters : new HashMap<String, Object>(); options = options != null ? options : new HashMap<String, Object>(); if (id == null && parameters.containsKey("id") && parameters.get("id") != null) { id = ((Long) parameters.get("id")); } if (!(id instanceof Long)) { throw new IllegalArgumentException("Bad parameter: id must be of type Long parameters[\"id\"]"); } if (id == null) { throw new NullPointerException("Argument or Parameter missing: id parameters[\"id\"]"); } String[] urlParts = { FilesConfig.getInstance().getApiRoot(), FilesConfig.getInstance().getApiBase(), String.valueOf(id) }; for (int i = 2; i < urlParts.length; i++) { try { urlParts[i] = new URI(null, null, urlParts[i], null).getRawPath(); } catch (URISyntaxException ex) { } } String url = String.format("%s%s/messages/%s", urlParts); TypeReference<Message> typeReference = new TypeReference<Message>() { }; return FilesClient.requestItem(url, RequestMethods.DELETE, typeReference, parameters, options); }
<DeepExtract> parameters = parameters != null ? parameters : new HashMap<String, Object>(); options = options != null ? options : new HashMap<String, Object>(); if (id == null && parameters.containsKey("id") && parameters.get("id") != null) { id = ((Long) parameters.get("id")); } if (!(id instanceof Long)) { throw new IllegalArgumentException("Bad parameter: id must be of type Long parameters[\"id\"]"); } if (id == null) { throw new NullPointerException("Argument or Parameter missing: id parameters[\"id\"]"); } String[] urlParts = { FilesConfig.getInstance().getApiRoot(), FilesConfig.getInstance().getApiBase(), String.valueOf(id) }; for (int i = 2; i < urlParts.length; i++) { try { urlParts[i] = new URI(null, null, urlParts[i], null).getRawPath(); } catch (URISyntaxException ex) { } } String url = String.format("%s%s/messages/%s", urlParts); TypeReference<Message> typeReference = new TypeReference<Message>() { }; return FilesClient.requestItem(url, RequestMethods.DELETE, typeReference, parameters, options); </DeepExtract>
files-sdk-java
positive
@Override public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception { final String remoteAddress = RemotingHelper.parseChannelRemoteAddr(ctx.channel()); log.info("NETTY CLIENT PIPELINE: CLOSE {}", remoteAddress); if (null == ctx.channel()) return; try { if (this.lockChannelTables.tryLock(LockTimeoutMillis, TimeUnit.MILLISECONDS)) { try { boolean removeItemFromTable = true; ChannelWrapper prevCW = null; String addrRemote = null; for (String key : channelTables.keySet()) { ChannelWrapper prev = this.channelTables.get(key); if (prev.getChannel() != null) { if (prev.getChannel() == ctx.channel()) { prevCW = prev; addrRemote = key; break; } } } if (null == prevCW) { log.info("eventCloseChannel: the channel[{}] has been removed from the channel table before", addrRemote); removeItemFromTable = false; } if (removeItemFromTable) { this.channelTables.remove(addrRemote); log.info("closeChannel: the channel[{}] was removed from channel table", addrRemote); RemotingUtil.closeChannel(ctx.channel()); } } catch (Exception e) { log.error("closeChannel: close the channel exception", e); } finally { this.lockChannelTables.unlock(); } } else { log.warn("closeChannel: try to lock channel table, but timeout, {}ms", LockTimeoutMillis); } } catch (InterruptedException e) { log.error("closeChannel exception", e); } super.close(ctx, promise); if (NettyRemotingClient.this.channelEventListener != null) { NettyRemotingClient.this.putNettyEvent(new NettyEvent(NettyEventType.CLOSE, remoteAddress.toString(), ctx.channel())); } }
<DeepExtract> if (null == ctx.channel()) return; try { if (this.lockChannelTables.tryLock(LockTimeoutMillis, TimeUnit.MILLISECONDS)) { try { boolean removeItemFromTable = true; ChannelWrapper prevCW = null; String addrRemote = null; for (String key : channelTables.keySet()) { ChannelWrapper prev = this.channelTables.get(key); if (prev.getChannel() != null) { if (prev.getChannel() == ctx.channel()) { prevCW = prev; addrRemote = key; break; } } } if (null == prevCW) { log.info("eventCloseChannel: the channel[{}] has been removed from the channel table before", addrRemote); removeItemFromTable = false; } if (removeItemFromTable) { this.channelTables.remove(addrRemote); log.info("closeChannel: the channel[{}] was removed from channel table", addrRemote); RemotingUtil.closeChannel(ctx.channel()); } } catch (Exception e) { log.error("closeChannel: close the channel exception", e); } finally { this.lockChannelTables.unlock(); } } else { log.warn("closeChannel: try to lock channel table, but timeout, {}ms", LockTimeoutMillis); } } catch (InterruptedException e) { log.error("closeChannel exception", e); } </DeepExtract>
dts
positive
@AfterMethod protected void tearDown() throws Exception { this.tracker.stop(); }
<DeepExtract> this.tracker.stop(); </DeepExtract>
ttorrent
positive
@Override public Object[] getElements(Object inputElement) { if (inputElement instanceof KConfigMenuItem) { KConfigMenuItem element = (KConfigMenuItem) inputElement; List<KConfigMenuItem> children = element.getChildren(); try { return getMenuItems(children).toArray(); } catch (IOException e) { Logger.log(e); } } return EMPTY_ARRAY; }
<DeepExtract> if (inputElement instanceof KConfigMenuItem) { KConfigMenuItem element = (KConfigMenuItem) inputElement; List<KConfigMenuItem> children = element.getChildren(); try { return getMenuItems(children).toArray(); } catch (IOException e) { Logger.log(e); } } return EMPTY_ARRAY; </DeepExtract>
idf-eclipse-plugin
positive
public Criteria andSongsheetidsBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "songsheetids" + " cannot be null"); } criteria.add(new Criterion("songSheetIds between", value1, value2)); return (Criteria) this; }
<DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "songsheetids" + " cannot be null"); } criteria.add(new Criterion("songSheetIds between", value1, value2)); </DeepExtract>
music
positive
public Criteria andTrafficGreaterThanOrEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "traffic" + " cannot be null"); } criteria.add(new Criterion("traffic >=", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "traffic" + " cannot be null"); } criteria.add(new Criterion("traffic >=", value)); </DeepExtract>
MyBlog
positive
@Override protected void setBounds(float left, float top, float right, float bottom) { super.setBounds(left, top, right, bottom); this.text = text; if (wrapText) { wrapText(); return; } float width = _paint.measureText(text); if (width > _width && shouldAutoresizeText) { text_size = _width / width * text_size; _paint.setTextSize(text_size); if (!lineHeightSet) line_height = text_size; } }
<DeepExtract> this.text = text; if (wrapText) { wrapText(); return; } float width = _paint.measureText(text); if (width > _width && shouldAutoresizeText) { text_size = _width / width * text_size; _paint.setTextSize(text_size); if (!lineHeightSet) line_height = text_size; } </DeepExtract>
BBTH
positive
@Benchmark public RTree<Object, Rectangle> defaultRTreeInsertOneEntryInto1000EntriesMaxChildren010() { return smallDefaultTreeM10.add(new Object(), RTreeTest.random(precision)); }
<DeepExtract> return smallDefaultTreeM10.add(new Object(), RTreeTest.random(precision)); </DeepExtract>
rtree
positive
public boolean hasAttachment(String fileName) { return this.driver.hasElementWithoutWaiting(By.xpath(getSuggestionSelector(fileName, "attachment"))); }
<DeepExtract> return this.driver.hasElementWithoutWaiting(By.xpath(getSuggestionSelector(fileName, "attachment"))); </DeepExtract>
xwiki-enterprise
positive
@Deprecated public Set<Rel> getPermittedRelations(MPerm perm) { return FactionColl.get().get(perm); }
<DeepExtract> return FactionColl.get().get(perm); </DeepExtract>
Factions
positive
@Export static int ifAnd_0() { int result; if (0 > 0 && 0 < 5) { result = 42; } else { result = 76; } return result; }
<DeepExtract> int result; if (0 > 0 && 0 < 5) { result = 42; } else { result = 76; } return result; </DeepExtract>
JWebAssembly
positive
private void setNumRecs(int n) { int pos = fldpos(currentblk, INT_SIZE); tx.setInt(currentblk, pos, n); }
<DeepExtract> int pos = fldpos(currentblk, INT_SIZE); tx.setInt(currentblk, pos, n); </DeepExtract>
simpledb
positive
public Criteria andIdGreaterThan(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "id" + " cannot be null"); } criteria.add(new Criterion("id >", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "id" + " cannot be null"); } criteria.add(new Criterion("id >", value)); </DeepExtract>
Tmall_SSM
positive
@Test public void yieldTest() { new YieldThread1().start(); new YieldThread2().start(); try { Thread.sleep(20 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } }
<DeepExtract> try { Thread.sleep(20 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } </DeepExtract>
OdyAndroidStore
positive
public static Long asRequiredLong(JsonNode parentNode, String path) { JsonNode childNode = asRequiredNode(parentNode, path); if (!JsonNode::isIntegralNumber.apply(childNode)) { throw new IncompatibleJsonNodeMappingException(parentNode, path, Long.class); } return JsonNode::longValue.apply(childNode); }
<DeepExtract> JsonNode childNode = asRequiredNode(parentNode, path); if (!JsonNode::isIntegralNumber.apply(childNode)) { throw new IncompatibleJsonNodeMappingException(parentNode, path, Long.class); } return JsonNode::longValue.apply(childNode); </DeepExtract>
shimmer
positive
public int sumNumbers(TreeNode root) { if (root == null) return 0; if (root.left == null && root.right == null) sum = sum + root.val; if (root.left != null) helper(root.left, root.val * 10 + root.left.val); if (root.right != null) helper(root.right, root.val * 10 + root.right.val); return sum; }
<DeepExtract> if (root.left == null && root.right == null) sum = sum + root.val; if (root.left != null) helper(root.left, root.val * 10 + root.left.val); if (root.right != null) helper(root.right, root.val * 10 + root.right.val); </DeepExtract>
Leetcode-for-Fun
positive