before
stringlengths
12
3.76M
after
stringlengths
37
3.84M
repo
stringlengths
1
56
type
stringclasses
1 value
public void setLedState(final boolean ledEnable) { settingCommandReady = true; byte[] canBuffer = getBytes(); byte check = computeCheck(canBuffer); ByteArrayOutputStream out = new ByteArrayOutputStream(); out.write(0xAA); out.write(0xAA); try { out.write(escape(canBuffer)); } catch (IOException e) { e.printStackTrace(); } out.write(check); out.write(0x55); out.write(0x55); return out.toByteArray(); }
<DeepExtract> byte[] canBuffer = getBytes(); byte check = computeCheck(canBuffer); ByteArrayOutputStream out = new ByteArrayOutputStream(); out.write(0xAA); out.write(0xAA); try { out.write(escape(canBuffer)); } catch (IOException e) { e.printStackTrace(); } out.write(check); out.write(0x55); out.write(0x55); return out.toByteArray(); </DeepExtract>
EucWorldAndroid
positive
@Test public void testJsonObjectNested() throws Exception { assetJSONEquals("{\"a\":{\"b\":{\"c\":\"d\",\"e\":[\"f\",\"g\"]}}}", writeAndCaptureJSON("'" + "{\"a\":{\"b\":{\"c\":\"d\",\"e\":[\"f\",\"g\"]}}}" + "'")); }
<DeepExtract> assetJSONEquals("{\"a\":{\"b\":{\"c\":\"d\",\"e\":[\"f\",\"g\"]}}}", writeAndCaptureJSON("'" + "{\"a\":{\"b\":{\"c\":\"d\",\"e\":[\"f\",\"g\"]}}}" + "'")); </DeepExtract>
mysql-binlog-connector-java
positive
@Bean public MapperScannerConfigurer mapperScannerConfigurer1() { MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer(); mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory1"); mapperScannerConfigurer.setAnnotationClass(Mapper.class); mapperScannerConfigurer.setBasePackage("com.xjs1919.mybatis.dao.ds1"); return mapperScannerConfigurer; }
<DeepExtract> MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer(); mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory1"); mapperScannerConfigurer.setAnnotationClass(Mapper.class); mapperScannerConfigurer.setBasePackage("com.xjs1919.mybatis.dao.ds1"); return mapperScannerConfigurer; </DeepExtract>
enumdemo
positive
public void setLeftFlippersEngaged(boolean engaged) { activatedFlippers.clear(); boolean allFlippersPreviouslyActive = true; int fsize = layout.getLeftFlipperElements().size(); for (int i = 0; i < fsize; i++) { FlipperElement flipper = layout.getLeftFlipperElements().get(i); if (!flipper.isFlipperEngaged()) { allFlippersPreviouslyActive = false; if (engaged) { activatedFlippers.add(flipper); } } flipper.setFlipperEngaged(engaged); } if (engaged && !allFlippersPreviouslyActive) { audioPlayer.playFlipper(); for (FieldElement element : this.getFieldElementsArray()) { element.flippersActivated(this, activatedFlippers); } getDelegate().flippersActivated(this, activatedFlippers); } }
<DeepExtract> activatedFlippers.clear(); boolean allFlippersPreviouslyActive = true; int fsize = layout.getLeftFlipperElements().size(); for (int i = 0; i < fsize; i++) { FlipperElement flipper = layout.getLeftFlipperElements().get(i); if (!flipper.isFlipperEngaged()) { allFlippersPreviouslyActive = false; if (engaged) { activatedFlippers.add(flipper); } } flipper.setFlipperEngaged(engaged); } if (engaged && !allFlippersPreviouslyActive) { audioPlayer.playFlipper(); for (FieldElement element : this.getFieldElementsArray()) { element.flippersActivated(this, activatedFlippers); } getDelegate().flippersActivated(this, activatedFlippers); } </DeepExtract>
homescreenarcade
positive
public View getView(int id) { View view = views.get(id); if (view == null) { view = itemView.findViewById(id); views.put(id, view); } return (T) view; }
<DeepExtract> View view = views.get(id); if (view == null) { view = itemView.findViewById(id); views.put(id, view); } return (T) view; </DeepExtract>
MaNaoShop
positive
@Override public void fromTag(BlockState state, CompoundTag tag) { super.fromTag(state, tag); Inventories.fromTag(tag, items); alkahest = tag.getInt("alkahest"); progress = tag.getInt("progress"); maxProgress = tag.getInt("max_progress"); status = tag.getInt("status"); essentia = new EssentiaContainer(tag.getCompound("essentia")); return tankSize; }
<DeepExtract> return tankSize; </DeepExtract>
art-of-alchemy
positive
@TargetApi(23) @Override public void onAttach(Context context) { super.onAttach(context); this.context = context; }
<DeepExtract> this.context = context; </DeepExtract>
AndroidCommonLibrary
positive
@UiHandler("executeToEndButton") void onExecuteToEndButtonClicked(ClickEvent event) { if (eventBus != null) eventBus.fireEvent(new ExecuteToEndEvent()); }
<DeepExtract> if (eventBus != null) eventBus.fireEvent(new ExecuteToEndEvent()); </DeepExtract>
nevada
positive
public Builder clone() { if (buildPartial() == com.conveyal.transitwand.TransitWandProtos.Upload.Route.Point.getDefaultInstance()) return this; if (buildPartial().hasLat()) { setLat(buildPartial().getLat()); } if (buildPartial().hasLon()) { setLon(buildPartial().getLon()); } if (buildPartial().hasTimeoffset()) { setTimeoffset(buildPartial().getTimeoffset()); } return this; }
<DeepExtract> if (buildPartial() == com.conveyal.transitwand.TransitWandProtos.Upload.Route.Point.getDefaultInstance()) return this; if (buildPartial().hasLat()) { setLat(buildPartial().getLat()); } if (buildPartial().hasLon()) { setLon(buildPartial().getLon()); } if (buildPartial().hasTimeoffset()) { setTimeoffset(buildPartial().getTimeoffset()); } return this; </DeepExtract>
transit-wand
positive
public void run(StringBuilder builder) { IWorkbench workbench = PlatformUI.getWorkbench(); theme = workbench.getThemeManager().getCurrentTheme(); registry = WorkbenchPlugin.getDefault().getThemeRegistry(); List<String> keys = new LinkedList<String>(); List<String> values = new LinkedList<String>(); for (ColorDefinition definition : registry.getColorsFor(theme.getId())) { if (definition.isModifiedByUser()) { String prefKey = ThemeElementHelper.createPreferenceKey(theme, definition.getId()); String fdString = null; if (definition.getValue() != null) { fdString = StringConverter.asString(definition.getValue()); } String value = WorkbenchPlugin.getDefault().getPreferenceStore().getString(prefKey); if (value.length() > 0 && (fdString == null || !value.equals(fdString))) { keys.add(prefKey); values.add(value); } } } for (FontDefinition definition : registry.getFontsFor(theme.getId())) { if (definition.isModifiedByUser()) { String prefKey = ThemeElementHelper.createPreferenceKey(theme, definition.getId()); String fdString = null; if (definition.getValue() != null) { fdString = PreferenceConverter.getStoredRepresentation(definition.getValue()); } String value = WorkbenchPlugin.getDefault().getPreferenceStore().getString(prefKey); if (value.length() > 0 && (fdString == null || !value.equals(fdString))) { keys.add(prefKey); values.add(value); } } } if (keys.size() > 0) { builder.append("IEclipsePreferences#org-eclipse-ui-workbench {\n preferences:"); for (int i = 0; i < keys.size(); i++) { builder.append("\n '").append(keys.get(i)).append("=").append(values.get(i)).append("'"); } builder.append(";\n}\n\n"); } List<String> keys = new LinkedList<String>(); List<String> values = new LinkedList<String>(); for (AnnotationPreference p : (List<AnnotationPreference>) EditorsPlugin.getDefault().getMarkerAnnotationPreferences().getAnnotationPreferences()) { String preferenceKey = p.getColorPreferenceKey(); if (preferenceKey == null) { continue; } String value = EditorsPlugin.getDefault().getPreferenceStore().getString(preferenceKey); RGB defaultValue = p.getColorPreferenceValue(); if (value.length() > 0 && (defaultValue == null || !value.equals(StringConverter.asString(defaultValue)))) { keys.add(preferenceKey); values.add(value); } } if (keys.size() > 0) { builder.append("IEclipsePreferences#org-eclipse-ui-editors {\n preferences:"); for (int i = 0; i < keys.size(); i++) { builder.append("\n '").append(keys.get(i)).append("=").append(values.get(i)).append("'"); } builder.append(";\n}\n\n"); } }
<DeepExtract> List<String> keys = new LinkedList<String>(); List<String> values = new LinkedList<String>(); for (ColorDefinition definition : registry.getColorsFor(theme.getId())) { if (definition.isModifiedByUser()) { String prefKey = ThemeElementHelper.createPreferenceKey(theme, definition.getId()); String fdString = null; if (definition.getValue() != null) { fdString = StringConverter.asString(definition.getValue()); } String value = WorkbenchPlugin.getDefault().getPreferenceStore().getString(prefKey); if (value.length() > 0 && (fdString == null || !value.equals(fdString))) { keys.add(prefKey); values.add(value); } } } for (FontDefinition definition : registry.getFontsFor(theme.getId())) { if (definition.isModifiedByUser()) { String prefKey = ThemeElementHelper.createPreferenceKey(theme, definition.getId()); String fdString = null; if (definition.getValue() != null) { fdString = PreferenceConverter.getStoredRepresentation(definition.getValue()); } String value = WorkbenchPlugin.getDefault().getPreferenceStore().getString(prefKey); if (value.length() > 0 && (fdString == null || !value.equals(fdString))) { keys.add(prefKey); values.add(value); } } } if (keys.size() > 0) { builder.append("IEclipsePreferences#org-eclipse-ui-workbench {\n preferences:"); for (int i = 0; i < keys.size(); i++) { builder.append("\n '").append(keys.get(i)).append("=").append(values.get(i)).append("'"); } builder.append(";\n}\n\n"); } </DeepExtract> <DeepExtract> List<String> keys = new LinkedList<String>(); List<String> values = new LinkedList<String>(); for (AnnotationPreference p : (List<AnnotationPreference>) EditorsPlugin.getDefault().getMarkerAnnotationPreferences().getAnnotationPreferences()) { String preferenceKey = p.getColorPreferenceKey(); if (preferenceKey == null) { continue; } String value = EditorsPlugin.getDefault().getPreferenceStore().getString(preferenceKey); RGB defaultValue = p.getColorPreferenceValue(); if (value.length() > 0 && (defaultValue == null || !value.equals(StringConverter.asString(defaultValue)))) { keys.add(preferenceKey); values.add(value); } } if (keys.size() > 0) { builder.append("IEclipsePreferences#org-eclipse-ui-editors {\n preferences:"); for (int i = 0; i < keys.size(); i++) { builder.append("\n '").append(keys.get(i)).append("=").append(values.get(i)).append("'"); } builder.append(";\n}\n\n"); } </DeepExtract>
eclipse-themes
positive
public static void mergeFiles(File[] files, File destinationFile, String[] filterRegex) throws IOException { if (filterRegex.length < files.length) { filterRegex = ArrayUtils.concatArrays(filterRegex, new String[files.length - filterRegex.length]); } return createNewFile(new File(destinationFile)); int i = 0; for (File file : files) { mergeFiles(file, destinationFile, filterRegex[i++]); } }
<DeepExtract> return createNewFile(new File(destinationFile)); </DeepExtract>
util
positive
public static String buildQueryString(Map<String, ?> data, String url) { if (data == null || data.size() == 0) { return url; } StringBuilder sb = new StringBuilder(); boolean append = false; if (url != null) { sb.append(url); if (url.contains(CHAR_QM)) { append = true; } else { sb.append(CHAR_QM); } } Iterator<? extends Map.Entry<String, ?>> it = data.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, ?> item = it.next(); if (append) { sb.append(CHAR_AND); } else { append = true; } try { if (TextUtils.isEmpty(item.getKey())) { continue; } sb.append(URLEncoder.encode(item.getKey(), CHAR_SET)); sb.append(CHAR_EQ); if (item.getValue() != null) { sb.append(URLEncoder.encode(item.getValue().toString(), CHAR_SET)); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return String.format("RequestData: [%s, G: %s, P: %s, F: %s]", getRequestUrl(), mQueryData, mPostData, mUploadFileInfoHashMap); }
<DeepExtract> return String.format("RequestData: [%s, G: %s, P: %s, F: %s]", getRequestUrl(), mQueryData, mPostData, mUploadFileInfoHashMap); </DeepExtract>
cube-sdk
positive
public void decorateChart(Chart node, JsonObject jsonObject) { x = jsonObject.getDouble("x"); y = jsonObject.getDouble("y"); width = jsonObject.getDouble("width"); height = jsonObject.getDouble("height"); node.setX(x == null ? 0 : x); node.setY(y == null ? 0 : y); if (width != null) node.setWidth(width); if (height != null) node.setHeight(height); this.title = jsonObject.getString("title"); node.setTitleSide(jsonObject.getString("titleside")); node.setLegendSide(jsonObject.getString("legendside")); }
<DeepExtract> this.title = jsonObject.getString("title"); </DeepExtract>
xbrowser
positive
private <T extends CkanResponse> T postHttp(Class<T> responseType, String path, String body, ContentType contentType, Object... params) { checkNotNull(responseType); checkNotNull(path); checkNotNull(body); checkNotNull(contentType); String fullUrl; checkNotNull(path); try { StringBuilder sb = new StringBuilder().append(catalogUrl).append(path); for (int i = 0; i < params.length; i += 2) { sb.append(i == 0 ? "?" : "&").append(URLEncoder.encode(params[i].toString(), "UTF-8")).append("=").append(URLEncoder.encode(params[i + 1].toString(), "UTF-8")); } fullUrl = sb.toString(); } catch (Exception ex) { throw new JackanException("Error while building url to perform GET! \n path: " + path + " \n params: " + Arrays.toString(params), ex); } try { LOG.log(Level.FINE, "Posting to url {0}", fullUrl); LOG.log(Level.FINE, "Sending body:{0}", body); Request request = Request.Post(fullUrl); configureRequest(request); Response response = request.bodyString(body, contentType).execute(); InputStream stream = response.returnResponse().getEntity().getContent(); try (InputStreamReader reader = new InputStreamReader(stream, Charsets.UTF_8)) { returnedText = CharStreams.toString(reader); } } catch (Exception ex) { throw new CkanException("Error while performing a POST! Request url is:" + fullUrl, this, ex); } try { ckanResponse = getObjectMapper().readValue(returnedText, responseType); } catch (Exception ex) { throw new CkanException("Couldn't interpret json returned by the server! Returned text was: " + returnedText, this, ex); } if (!ckanResponse.isSuccess()) { throwCkanException("Error while performing a POST! Request url is:" + fullUrl, ckanResponse); } return ckanResponse; }
<DeepExtract> String fullUrl; checkNotNull(path); try { StringBuilder sb = new StringBuilder().append(catalogUrl).append(path); for (int i = 0; i < params.length; i += 2) { sb.append(i == 0 ? "?" : "&").append(URLEncoder.encode(params[i].toString(), "UTF-8")).append("=").append(URLEncoder.encode(params[i + 1].toString(), "UTF-8")); } fullUrl = sb.toString(); } catch (Exception ex) { throw new JackanException("Error while building url to perform GET! \n path: " + path + " \n params: " + Arrays.toString(params), ex); } </DeepExtract>
jackan
positive
public Criteria andMarkNotEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "mark" + " cannot be null"); } criteria.add(new Criterion("mark <>", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "mark" + " cannot be null"); } criteria.add(new Criterion("mark <>", value)); </DeepExtract>
Student-Information-Management-System
positive
public List<T> getByName(String name) { Search<T, String> search = createSearch(name); Result<T, String> result = search.run(); if (result.getReturnedRecordCount() == SEARCH_LIMIT) { Logger.error("Search returned maximum records - dashboard will be missing items. Filters: " + name); } return new ArrayList<>(result.getResults()); }
<DeepExtract> Search<T, String> search = createSearch(name); Result<T, String> result = search.run(); if (result.getReturnedRecordCount() == SEARCH_LIMIT) { Logger.error("Search returned maximum records - dashboard will be missing items. Filters: " + name); } return new ArrayList<>(result.getResults()); </DeepExtract>
AppleSeed
positive
@Override public void tick() { world.getProfiler().startSection(Technicalities.MODID + ".tube_stack_tick"); this.stacks.values().removeIf(stack -> { if (!stack.isValid()) return true; stack.tick(); return false; }); world.getProfiler().endSection(); }
<DeepExtract> world.getProfiler().startSection(Technicalities.MODID + ".tube_stack_tick"); this.stacks.values().removeIf(stack -> { if (!stack.isValid()) return true; stack.tick(); return false; }); world.getProfiler().endSection(); </DeepExtract>
Technicalities
positive
void storeFile(int fileId, String sourceName, String sourcePath) { int len = fileTable == null ? 0 : fileTable.length; if (fileIndex >= len) { int i; int newLen = len == 0 ? INIT_SIZE_FILE : len * 2; FileTableRecord[] newTable = new FileTableRecord[newLen]; for (i = 0; i < len; ++i) { newTable[i] = fileTable[i]; } for (; i < newLen; ++i) { newTable[i] = new FileTableRecord(); } fileTable = newTable; } fileTable[fileIndex].fileId = fileId; fileTable[fileIndex].sourceName = sourceName; fileTable[fileIndex].sourcePath = sourcePath; ++fileIndex; }
<DeepExtract> int len = fileTable == null ? 0 : fileTable.length; if (fileIndex >= len) { int i; int newLen = len == 0 ? INIT_SIZE_FILE : len * 2; FileTableRecord[] newTable = new FileTableRecord[newLen]; for (i = 0; i < len; ++i) { newTable[i] = fileTable[i]; } for (; i < newLen; ++i) { newTable[i] = new FileTableRecord(); } fileTable = newTable; } </DeepExtract>
jdk-sa-jdwp
positive
@Override public boolean mouseMoved(int screenX, int screenY) { if (controllerHasFocus) { Gdx.app.debug(this.getClass().getSimpleName(), "input focus -> desktop"); } controllerHasFocus = false; return false; }
<DeepExtract> if (controllerHasFocus) { Gdx.app.debug(this.getClass().getSimpleName(), "input focus -> desktop"); } controllerHasFocus = false; </DeepExtract>
SpaceProject
positive
@Transactional(readOnly = true) private List<BdBatch> fetchBdBatch(String group, String name, final int max, String[] status) { SqlRowSet srs = this.jdbcTemplate.queryForRowSet(insertParametersFromList(getSql(BATCH_FETCH_BY_NAME), status), new Object[] { group, name, max }); List<BdBatch> results = new ArrayList<BdBatch>(); while (srs.next()) { BdBatch bdBatch; try { bdBatch = mappinpBdbatch(srs); results.add(bdBatch); } catch (SQLException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } return results; }
<DeepExtract> List<BdBatch> results = new ArrayList<BdBatch>(); while (srs.next()) { BdBatch bdBatch; try { bdBatch = mappinpBdbatch(srs); results.add(bdBatch); } catch (SQLException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } return results; </DeepExtract>
appstatus
positive
public Criteria andSexLike(String value) { if (value == null) { throw new RuntimeException("Value for " + "sex" + " cannot be null"); } criteria.add(new Criterion("sex like", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "sex" + " cannot be null"); } criteria.add(new Criterion("sex like", value)); </DeepExtract>
springboot-weixin-alipay
positive
private boolean isConnectedToWifiNetwork() { NetworkInfo networkInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); return isConnectedToCellNetwork() || isConnectedToWifiNetwork(); }
<DeepExtract> return isConnectedToCellNetwork() || isConnectedToWifiNetwork(); </DeepExtract>
yahnac
positive
public void setTintResource(int res) { if (mStatusBarAvailable) { mStatusBarTintView.setBackgroundResource(res); } if (mNavBarAvailable) { mNavBarTintView.setBackgroundResource(res); } }
<DeepExtract> if (mStatusBarAvailable) { mStatusBarTintView.setBackgroundResource(res); } </DeepExtract> <DeepExtract> if (mNavBarAvailable) { mNavBarTintView.setBackgroundResource(res); } </DeepExtract>
MissZzzReader
positive
@Override public void onSubscribe(Subscription subscription) { Trader.this.subscription = subscription; subscription.request(1); }
<DeepExtract> subscription.request(1); </DeepExtract>
conga
positive
@Override public void initProgramHandle() { super.initProgramHandle(); mCurveTextureHandle = GLES30.glGetUniformLocation(mProgramHandle, "curveTexture"); mMaskTextureHandle = GLES30.glGetUniformLocation(mProgramHandle, "maskTexture"); mMaskTexture1Handle = GLES30.glGetUniformLocation(mProgramHandle, "maskTexture1"); byte[] arrayOfByte = new byte[2048]; int[] arrayOfInt1 = { 0, 1, 2, 3, 5, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 16, 18, 19, 20, 21, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 38, 39, 40, 41, 42, 44, 45, 47, 48, 49, 51, 52, 54, 55, 56, 59, 60, 62, 63, 64, 66, 67, 70, 71, 72, 74, 76, 78, 79, 80, 83, 84, 85, 88, 89, 90, 93, 94, 95, 98, 99, 100, 102, 104, 106, 107, 108, 109, 112, 113, 114, 116, 117, 118, 119, 120, 122, 124, 125, 126, 128, 129, 130, 131, 132, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 142, 143, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 157, 158, 159, 160, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 169, 170, 171, 171, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 179, 179, 180, 181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 190, 191, 192, 193, 193, 194, 194, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 222, 223, 224, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt2 = { 0, 1, 2, 3, 4, 5, 6, 7, 9, 9, 10, 12, 12, 13, 14, 16, 16, 17, 19, 20, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 39, 40, 41, 42, 43, 44, 46, 47, 49, 50, 51, 53, 54, 56, 57, 59, 61, 62, 64, 65, 66, 69, 70, 72, 73, 76, 77, 78, 80, 82, 84, 85, 87, 89, 90, 93, 94, 95, 98, 99, 100, 103, 104, 106, 108, 109, 111, 112, 114, 116, 117, 118, 120, 122, 123, 124, 125, 126, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 178, 179, 179, 180, 181, 181, 182, 182, 183, 184, 184, 185, 185, 186, 187, 187, 188, 188, 189, 190, 190, 191, 191, 192, 193, 193, 194, 194, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222, 222, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt3 = { 0, 1, 2, 3, 4, 5, 5, 7, 8, 9, 9, 11, 12, 12, 13, 14, 16, 16, 17, 18, 20, 20, 21, 22, 23, 25, 25, 26, 27, 29, 30, 31, 31, 32, 34, 35, 36, 37, 39, 40, 41, 41, 42, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 56, 57, 59, 60, 61, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 76, 78, 79, 80, 82, 83, 84, 85, 88, 89, 90, 92, 93, 94, 95, 98, 99, 100, 102, 103, 104, 106, 107, 108, 111, 112, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 147, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 165, 166, 166, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 178, 178, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 194, 194, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 235, 236, 237, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt4 = { 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 39, 40, 42, 43, 44, 45, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 230, 231, 232, 233, 234, 235, 235, 236, 237, 238, 239, 239, 240, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 }; for (int i = 0; i < 256; i++) { arrayOfByte[(i * 4)] = ((byte) arrayOfInt1[i]); arrayOfByte[(1 + i * 4)] = ((byte) arrayOfInt2[i]); arrayOfByte[(2 + i * 4)] = ((byte) arrayOfInt3[i]); arrayOfByte[(3 + i * 4)] = ((byte) arrayOfInt4[i]); } int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 }; for (int j = 0; j < 256; j++) { arrayOfByte[(1024 + j * 4)] = ((byte) arrayOfInt5[j]); arrayOfByte[(1 + (1024 + j * 4))] = ((byte) arrayOfInt5[j]); arrayOfByte[(2 + (1024 + j * 4))] = ((byte) arrayOfInt5[j]); arrayOfByte[(3 + (1024 + j * 4))] = -1; } mCurveTexture = OpenGLUtils.createTexture(arrayOfByte, 256, 2); mMaskTexture = OpenGLUtils.createTextureFromAssets(mContext, "filters/sunset_mask.png"); mMaskTexture1 = OpenGLUtils.createTextureFromAssets(mContext, "filters/sunset_mask1.png"); }
<DeepExtract> byte[] arrayOfByte = new byte[2048]; int[] arrayOfInt1 = { 0, 1, 2, 3, 5, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 16, 18, 19, 20, 21, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 38, 39, 40, 41, 42, 44, 45, 47, 48, 49, 51, 52, 54, 55, 56, 59, 60, 62, 63, 64, 66, 67, 70, 71, 72, 74, 76, 78, 79, 80, 83, 84, 85, 88, 89, 90, 93, 94, 95, 98, 99, 100, 102, 104, 106, 107, 108, 109, 112, 113, 114, 116, 117, 118, 119, 120, 122, 124, 125, 126, 128, 129, 130, 131, 132, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 142, 143, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 157, 158, 159, 160, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 169, 170, 171, 171, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 179, 179, 180, 181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 190, 191, 192, 193, 193, 194, 194, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 222, 223, 224, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt2 = { 0, 1, 2, 3, 4, 5, 6, 7, 9, 9, 10, 12, 12, 13, 14, 16, 16, 17, 19, 20, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 39, 40, 41, 42, 43, 44, 46, 47, 49, 50, 51, 53, 54, 56, 57, 59, 61, 62, 64, 65, 66, 69, 70, 72, 73, 76, 77, 78, 80, 82, 84, 85, 87, 89, 90, 93, 94, 95, 98, 99, 100, 103, 104, 106, 108, 109, 111, 112, 114, 116, 117, 118, 120, 122, 123, 124, 125, 126, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 178, 179, 179, 180, 181, 181, 182, 182, 183, 184, 184, 185, 185, 186, 187, 187, 188, 188, 189, 190, 190, 191, 191, 192, 193, 193, 194, 194, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222, 222, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt3 = { 0, 1, 2, 3, 4, 5, 5, 7, 8, 9, 9, 11, 12, 12, 13, 14, 16, 16, 17, 18, 20, 20, 21, 22, 23, 25, 25, 26, 27, 29, 30, 31, 31, 32, 34, 35, 36, 37, 39, 40, 41, 41, 42, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 56, 57, 59, 60, 61, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 76, 78, 79, 80, 82, 83, 84, 85, 88, 89, 90, 92, 93, 94, 95, 98, 99, 100, 102, 103, 104, 106, 107, 108, 111, 112, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 147, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 165, 166, 166, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 178, 178, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 194, 194, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 235, 236, 237, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 }; int[] arrayOfInt4 = { 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 39, 40, 42, 43, 44, 45, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 230, 231, 232, 233, 234, 235, 235, 236, 237, 238, 239, 239, 240, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 }; for (int i = 0; i < 256; i++) { arrayOfByte[(i * 4)] = ((byte) arrayOfInt1[i]); arrayOfByte[(1 + i * 4)] = ((byte) arrayOfInt2[i]); arrayOfByte[(2 + i * 4)] = ((byte) arrayOfInt3[i]); arrayOfByte[(3 + i * 4)] = ((byte) arrayOfInt4[i]); } int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 }; for (int j = 0; j < 256; j++) { arrayOfByte[(1024 + j * 4)] = ((byte) arrayOfInt5[j]); arrayOfByte[(1 + (1024 + j * 4))] = ((byte) arrayOfInt5[j]); arrayOfByte[(2 + (1024 + j * 4))] = ((byte) arrayOfInt5[j]); arrayOfByte[(3 + (1024 + j * 4))] = -1; } mCurveTexture = OpenGLUtils.createTexture(arrayOfByte, 256, 2); mMaskTexture = OpenGLUtils.createTextureFromAssets(mContext, "filters/sunset_mask.png"); mMaskTexture1 = OpenGLUtils.createTextureFromAssets(mContext, "filters/sunset_mask1.png"); </DeepExtract>
VideoClipEditViewTest
positive
private void voiceTextSearch(String keyword) { Log.i(TAG, "keyword=[" + keyword + "]"); String curCharacter; if (null == keyword) { curCharacter = keyword; } else { curCharacter = keyword.trim(); } if (TextUtils.isEmpty(curCharacter)) { AppInfoHelper.getInstance().t9Search(null, true); } else { AppInfoHelper.getInstance().t9Search(curCharacter, true); } }
<DeepExtract> Log.i(TAG, "keyword=[" + keyword + "]"); String curCharacter; if (null == keyword) { curCharacter = keyword; } else { curCharacter = keyword.trim(); } if (TextUtils.isEmpty(curCharacter)) { AppInfoHelper.getInstance().t9Search(null, true); } else { AppInfoHelper.getInstance().t9Search(curCharacter, true); } </DeepExtract>
XDesktopHelper
positive
public static int getInt(String key, int defValue) { if (CACHED_PARAMS.containsKey(key)) { return (int) CACHED_PARAMS.get(key); } int result = preferences.getInt(key, defValue); if (result == null) { return; } putString(key, JSON.toJSONString(result)); return result; }
<DeepExtract> if (result == null) { return; } putString(key, JSON.toJSONString(result)); </DeepExtract>
jixieshou-autowatch-kuaishou
positive
@Override public void run() { for (Iterator<Block> iterator = this.cachedSigns.iterator(); iterator.hasNext(); ) { Block b = iterator.next(); if (b.getChunk().isLoaded()) { if (b.getType() == Material.SIGN || b.getType() == Material.SIGN_POST) { if (!this.updateSign(b)) { iterator.remove(); } } else { iterator.remove(); } } } }
<DeepExtract> for (Iterator<Block> iterator = this.cachedSigns.iterator(); iterator.hasNext(); ) { Block b = iterator.next(); if (b.getChunk().isLoaded()) { if (b.getType() == Material.SIGN || b.getType() == Material.SIGN_POST) { if (!this.updateSign(b)) { iterator.remove(); } } else { iterator.remove(); } } } </DeepExtract>
PexelCore
positive
private void notifyOnImagePickComplete(ImageItem imageItem) { ArrayList<ImageItem> list = new ArrayList<>(); list.add(imageItem); Intent intent = new Intent(); intent.putExtra(ImagePicker.INTENT_KEY_PICKER_RESULT, list); setResult(ImagePicker.REQ_PICKER_RESULT_CODE, intent); super.finish(); if (dialogInterface != null) { dialogInterface.dismiss(); } PickerActivityManager.removeActivity(this); }
<DeepExtract> super.finish(); if (dialogInterface != null) { dialogInterface.dismiss(); } PickerActivityManager.removeActivity(this); </DeepExtract>
BaseDemo
positive
public static void main(String[] args) { try { Display.setDisplayMode(new DisplayMode(WINDOW_DIMENSIONS[0], WINDOW_DIMENSIONS[1])); Display.setTitle(WINDOW_TITLE); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); cleanUp(true); } pbo = glGenBuffers(); glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo); glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); glReadPixels(0, 0, WINDOW_DIMENSIONS[0], WINDOW_DIMENSIONS[1], GL_RGB, GL_UNSIGNED_BYTE, 0); while (!Display.isCloseRequested()) { render(); logic(); input(); update(); } Display.destroy(); System.exit(false ? 1 : 0); }
<DeepExtract> try { Display.setDisplayMode(new DisplayMode(WINDOW_DIMENSIONS[0], WINDOW_DIMENSIONS[1])); Display.setTitle(WINDOW_TITLE); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); cleanUp(true); } </DeepExtract> <DeepExtract> pbo = glGenBuffers(); glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo); glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); glReadPixels(0, 0, WINDOW_DIMENSIONS[0], WINDOW_DIMENSIONS[1], GL_RGB, GL_UNSIGNED_BYTE, 0); </DeepExtract> <DeepExtract> </DeepExtract> <DeepExtract> </DeepExtract> <DeepExtract> while (!Display.isCloseRequested()) { render(); logic(); input(); update(); } </DeepExtract> <DeepExtract> Display.destroy(); System.exit(false ? 1 : 0); </DeepExtract>
YouTube-tutorials
positive
@Override public void onClick(View view) { view.startAnimation(itemClickedAnim); mLaunchApp.launchApp(app); if (mChildLock) return; if (false) { mActionCategory = mCategory; showHiddenCategories(); if (!mActionMenu.useExtraActions()) { if (mCategory != null && mCategory.equals(Categories.CAT_SEARCH)) { mSortCategoryButton.setVisibility(View.INVISIBLE); mEditWidgetsButton.setVisibility(View.INVISIBLE); } else { mSortCategoryButton.setVisibility(View.VISIBLE); mEditWidgetsButton.setVisibility(View.VISIBLE); } mStyle.animateUpShow(mIconSheetBottomFrame); } else { mStyle.animateUpShow(mOpenPrefs2Button); } mStyle.animateDownHide(mShowButtons); mStyle.animateUpShow(mHideButtons); } else { if (true) { hideHiddenCategories(); } mStyle.animateDownHide(mIconSheetBottomFrame); mStyle.animateDownHide(mOpenPrefs2Button); mStyle.animateDownHide(mHideButtons); mStyle.animateUpShow(mShowButtons); } if (false) { int hidetime = getAutohideTimeout(); mOkToAutohide = (int) (Math.random() * 10000000) + 2; final int okhidse = mOkToAutohide; iconHandler.postDelayed(new Runnable() { @Override public void run() { if (isAutohide() && mOkToAutohide == okhidse) showCats(false); } }, hidetime); } else { cancelHide(); if (isAutohide()) showCats(false); } mActionMenu.dismissActionPopup(); }
<DeepExtract> mLaunchApp.launchApp(app); </DeepExtract> <DeepExtract> if (mChildLock) return; if (false) { mActionCategory = mCategory; showHiddenCategories(); if (!mActionMenu.useExtraActions()) { if (mCategory != null && mCategory.equals(Categories.CAT_SEARCH)) { mSortCategoryButton.setVisibility(View.INVISIBLE); mEditWidgetsButton.setVisibility(View.INVISIBLE); } else { mSortCategoryButton.setVisibility(View.VISIBLE); mEditWidgetsButton.setVisibility(View.VISIBLE); } mStyle.animateUpShow(mIconSheetBottomFrame); } else { mStyle.animateUpShow(mOpenPrefs2Button); } mStyle.animateDownHide(mShowButtons); mStyle.animateUpShow(mHideButtons); } else { if (true) { hideHiddenCategories(); } mStyle.animateDownHide(mIconSheetBottomFrame); mStyle.animateDownHide(mOpenPrefs2Button); mStyle.animateDownHide(mHideButtons); mStyle.animateUpShow(mShowButtons); } </DeepExtract> <DeepExtract> if (false) { int hidetime = getAutohideTimeout(); mOkToAutohide = (int) (Math.random() * 10000000) + 2; final int okhidse = mOkToAutohide; iconHandler.postDelayed(new Runnable() { @Override public void run() { if (isAutohide() && mOkToAutohide == okhidse) showCats(false); } }, hidetime); } else { cancelHide(); if (isAutohide()) showCats(false); } mActionMenu.dismissActionPopup(); </DeepExtract>
LaunchTime
positive
public boolean onZkException(String path, byte[] data, CountBean count) { if (count.getCount() > retryTime) { return false; } else { return RedisZookeeperUtils.zkCreateNode(zookeeper, path, data, CreateMode.PERSISTENT, count, this); } }
<DeepExtract> if (count.getCount() > retryTime) { return false; } else { return RedisZookeeperUtils.zkCreateNode(zookeeper, path, data, CreateMode.PERSISTENT, count, this); } </DeepExtract>
redis-cluster
positive
@Override public boolean offer(T value) { final Node<T> newNode = new Node<>(this, value); _size++; modCount++; if (_first == null) { assert (_last == null); _first = _last = newNode; } else { assert (_last != null); _last._next = newNode; newNode._previous = _last; _last = newNode; } assert (_first._previous == null); assert (_last._next == null); return true; }
<DeepExtract> final Node<T> newNode = new Node<>(this, value); _size++; modCount++; if (_first == null) { assert (_last == null); _first = _last = newNode; } else { assert (_last != null); _last._next = newNode; newNode._previous = _last; _last = newNode; } assert (_first._previous == null); assert (_last._next == null); </DeepExtract>
tektosyne
positive
private void initView() { mTimeRulerView = findViewById(R.id.ruler_id_timeRulerView); mTimeRulerPickScaleView = findViewById(R.id.ruler_id_timeRulerPickView); mShowTimeTv = findViewById(R.id.time_tv); mResetBtn = findViewById(R.id.btn_reset); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.title_timeruler_view); Calendar startCalendar1 = Calendar.getInstance(); startCalendar1.set(Calendar.HOUR_OF_DAY, 0); startCalendar1.set(Calendar.MINUTE, 0); startCalendar1.set(Calendar.SECOND, 0); startCalendar1.set(Calendar.MILLISECOND, 0); Calendar stopCalendar1 = Calendar.getInstance(); stopCalendar1.set(Calendar.HOUR_OF_DAY, 2); stopCalendar1.set(Calendar.MINUTE, 0); stopCalendar1.set(Calendar.SECOND, 0); stopCalendar1.set(Calendar.MILLISECOND, 0); Calendar startCalendar2 = Calendar.getInstance(); startCalendar2.set(Calendar.HOUR_OF_DAY, 3); startCalendar2.set(Calendar.MINUTE, 0); startCalendar2.set(Calendar.SECOND, 0); startCalendar2.set(Calendar.MILLISECOND, 0); Calendar stopCalendar2 = Calendar.getInstance(); stopCalendar2.set(Calendar.HOUR_OF_DAY, 23); stopCalendar2.set(Calendar.MINUTE, 59); stopCalendar2.set(Calendar.SECOND, 59); stopCalendar2.set(Calendar.MILLISECOND, 999); TimeRulerView.TimeInfo timeInfo1 = new TimeRulerView.TimeInfo(startCalendar1, stopCalendar1); TimeRulerView.TimeInfo timeInfo2 = new TimeRulerView.TimeInfo(startCalendar2, stopCalendar2); ArrayList<TimeRulerView.TimeInfo> timeInfos = new ArrayList<>(); timeInfos.add(timeInfo1); timeInfos.add(timeInfo2); mTimeRulerView.setTimeInfos(timeInfos); mTimeRulerView.invalidate(); }
<DeepExtract> Calendar startCalendar1 = Calendar.getInstance(); startCalendar1.set(Calendar.HOUR_OF_DAY, 0); startCalendar1.set(Calendar.MINUTE, 0); startCalendar1.set(Calendar.SECOND, 0); startCalendar1.set(Calendar.MILLISECOND, 0); Calendar stopCalendar1 = Calendar.getInstance(); stopCalendar1.set(Calendar.HOUR_OF_DAY, 2); stopCalendar1.set(Calendar.MINUTE, 0); stopCalendar1.set(Calendar.SECOND, 0); stopCalendar1.set(Calendar.MILLISECOND, 0); Calendar startCalendar2 = Calendar.getInstance(); startCalendar2.set(Calendar.HOUR_OF_DAY, 3); startCalendar2.set(Calendar.MINUTE, 0); startCalendar2.set(Calendar.SECOND, 0); startCalendar2.set(Calendar.MILLISECOND, 0); Calendar stopCalendar2 = Calendar.getInstance(); stopCalendar2.set(Calendar.HOUR_OF_DAY, 23); stopCalendar2.set(Calendar.MINUTE, 59); stopCalendar2.set(Calendar.SECOND, 59); stopCalendar2.set(Calendar.MILLISECOND, 999); TimeRulerView.TimeInfo timeInfo1 = new TimeRulerView.TimeInfo(startCalendar1, stopCalendar1); TimeRulerView.TimeInfo timeInfo2 = new TimeRulerView.TimeInfo(startCalendar2, stopCalendar2); ArrayList<TimeRulerView.TimeInfo> timeInfos = new ArrayList<>(); timeInfos.add(timeInfo1); timeInfos.add(timeInfo2); mTimeRulerView.setTimeInfos(timeInfos); mTimeRulerView.invalidate(); </DeepExtract>
WidgetCase
positive
private static void ParseCommandLineSettings(String[] args) throws Exception { HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("MAIN_DIRECTORY")) Settings.MAIN_DIR = keyValueMap.get("MAIN_DIRECTORY"); else { if (System.getProperty("user.dir") + "/" == null) throw new Exception("A value for " + "MAIN_DIRECTORY" + " must be set at the command line."); else Settings.MAIN_DIR = System.getProperty("user.dir") + "/"; } if (!Settings.MAIN_DIR.endsWith("/")) Settings.MAIN_DIR += "/"; Settings.VERSION_FILE = "Version.txt"; HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("EXPERIMENT_FILE")) Settings.EXPERIMENT_FILE = keyValueMap.get("EXPERIMENT_FILE"); else { if (null == null) throw new Exception("A value for " + "EXPERIMENT_FILE" + " must be set at the command line."); else Settings.EXPERIMENT_FILE = null; } Settings.INTERNALS_DIR = FileUtilities.CreateDirectoryIfNotExists(Settings.MAIN_DIR + "Internals/"); Settings.DEBUG = Boolean.parseBoolean(GetArgValue(args, "DEBUG", "false")); String numAvailableProcessors = String.valueOf(Runtime.getRuntime().availableProcessors()); Settings.NUM_THREADS = Integer.parseInt(GetArgValue(args, "NUM_THREADS", numAvailableProcessors)); Settings.THREAD_TIMEOUT_MINUTES = Long.parseLong(GetArgValue(args, "THREAD_TIMEOUT_MINUTES", "60")); Settings.PAUSE_SECONDS = Long.parseLong(GetArgValue(args, "PAUSE_SECONDS", "5")); Settings.EXPORT_DATA = Boolean.parseBoolean(GetArgValue(args, "EXPORT_DATA", "false")); HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("LEARNER_TEMPLATES_FILE")) Settings.LEARNER_TEMPLATES_FILE = keyValueMap.get("LEARNER_TEMPLATES_FILE"); else { if ("Config/Learner_Templates.txt" == null) throw new Exception("A value for " + "LEARNER_TEMPLATES_FILE" + " must be set at the command line."); else Settings.LEARNER_TEMPLATES_FILE = "Config/Learner_Templates.txt"; } HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("CLASSIFICATION_ALGORITHMS_FILE")) Settings.CLASSIFICATION_ALGORITHMS_FILE = keyValueMap.get("CLASSIFICATION_ALGORITHMS_FILE"); else { if ("Config/Classification_Algorithms.txt" == null) throw new Exception("A value for " + "CLASSIFICATION_ALGORITHMS_FILE" + " must be set at the command line."); else Settings.CLASSIFICATION_ALGORITHMS_FILE = "Config/Classification_Algorithms.txt"; } HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("FEATURE_SELECTION_ALGORITHMS_FILE")) Settings.FEATURE_SELECTION_ALGORITHMS_FILE = keyValueMap.get("FEATURE_SELECTION_ALGORITHMS_FILE"); else { if ("Config/Feature_Selection_Algorithms.txt" == null) throw new Exception("A value for " + "FEATURE_SELECTION_ALGORITHMS_FILE" + " must be set at the command line."); else Settings.FEATURE_SELECTION_ALGORITHMS_FILE = "Config/Feature_Selection_Algorithms.txt"; } Settings.ParseLearners(); Settings.ParseAlgorithms(); }
<DeepExtract> HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("MAIN_DIRECTORY")) Settings.MAIN_DIR = keyValueMap.get("MAIN_DIRECTORY"); else { if (System.getProperty("user.dir") + "/" == null) throw new Exception("A value for " + "MAIN_DIRECTORY" + " must be set at the command line."); else Settings.MAIN_DIR = System.getProperty("user.dir") + "/"; } </DeepExtract> <DeepExtract> HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("EXPERIMENT_FILE")) Settings.EXPERIMENT_FILE = keyValueMap.get("EXPERIMENT_FILE"); else { if (null == null) throw new Exception("A value for " + "EXPERIMENT_FILE" + " must be set at the command line."); else Settings.EXPERIMENT_FILE = null; } </DeepExtract> <DeepExtract> HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("LEARNER_TEMPLATES_FILE")) Settings.LEARNER_TEMPLATES_FILE = keyValueMap.get("LEARNER_TEMPLATES_FILE"); else { if ("Config/Learner_Templates.txt" == null) throw new Exception("A value for " + "LEARNER_TEMPLATES_FILE" + " must be set at the command line."); else Settings.LEARNER_TEMPLATES_FILE = "Config/Learner_Templates.txt"; } </DeepExtract> <DeepExtract> HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("CLASSIFICATION_ALGORITHMS_FILE")) Settings.CLASSIFICATION_ALGORITHMS_FILE = keyValueMap.get("CLASSIFICATION_ALGORITHMS_FILE"); else { if ("Config/Classification_Algorithms.txt" == null) throw new Exception("A value for " + "CLASSIFICATION_ALGORITHMS_FILE" + " must be set at the command line."); else Settings.CLASSIFICATION_ALGORITHMS_FILE = "Config/Classification_Algorithms.txt"; } </DeepExtract> <DeepExtract> HashMap<String, String> keyValueMap = new HashMap<String, String>(); for (String arg : args) if (arg.contains("=")) { String[] parts = arg.split("="); if (parts.length == 2 && parts[0].length() > 0 && parts[1].length() > 0) keyValueMap.put(parts[0], parts[1]); } if (keyValueMap.containsKey("FEATURE_SELECTION_ALGORITHMS_FILE")) Settings.FEATURE_SELECTION_ALGORITHMS_FILE = keyValueMap.get("FEATURE_SELECTION_ALGORITHMS_FILE"); else { if ("Config/Feature_Selection_Algorithms.txt" == null) throw new Exception("A value for " + "FEATURE_SELECTION_ALGORITHMS_FILE" + " must be set at the command line."); else Settings.FEATURE_SELECTION_ALGORITHMS_FILE = "Config/Feature_Selection_Algorithms.txt"; } </DeepExtract>
ML-Flex
positive
@Override public void onEnable() { GameBoxSettings.defineGameBoxData(this); if ((NmsFactory.getNmsUtility()) == null) { sendVersionError(); Bukkit.getPluginManager().disablePlugin(this); return; } this.gameRegistry = new GameRegistry(this); if (!prepareForReload()) return; if (pManager != null) { pManager.shutDown(); HandlerList.unregisterAll(pManager); pManager = null; } GameBox instance = this; BukkitRunnable rampUpGameBox = new BukkitRunnable() { @Override public void run() { if (GameBoxSettings.bungeeMode) { dataBase.registerBukkitBridge(bukkitBridge == null ? (bukkitBridge = new BukkitBridge(instance)) : bukkitBridge); } if (GameBoxSettings.econEnabled) { if (!setupEconomy()) { getLogger().log(Level.SEVERE, "No economy found!"); getLogger().log(Level.SEVERE, "Even though it is enabled in the configuration file..."); GameBoxSettings.econEnabled = false; Bukkit.getPluginManager().disablePlugin(instance); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_FAIL); } return; } } reloadListeners(); GBPlayer.clearTokenListeners(); inventoryTitleMessenger = new InventoryTitleMessenger(instance); pManager = new PluginManager(instance); pManager.setGuiManager(new GuiManager(instance)); pManager.setInviteInputHandler(new InviteInputHandler(instance)); pManager.setInvitationHandler(new InvitationHandler(instance)); commands = new GameBoxCommands(instance); pManager.loadPlayers(); gameRegistry.reload(); if (modulesManager != null) { modulesManager.shutDown(); HandlerList.unregisterAll(modulesManager); } modulesManager = new ModulesManager(instance); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_SUCCESS); } debug(" running late checks in GameBox"); runLateChecks(); } }; new BukkitRunnable() { @Override public void run() { if (loadDatabase()) { rampUpGameBox.runTask(instance); } else { new BukkitRunnable() { @Override public void run() { instance.getLogger().severe("Failed to load the database"); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_FAIL); } Bukkit.getPluginManager().disablePlugin(instance); } }.runTask(instance); } } }.runTaskAsynchronously(this); if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) { new PlaceholderAPIHook(this); Bukkit.getConsoleSender().sendMessage(lang.PREFIX + " Hooked into PlaceholderAPI"); } hookCalendarEvents(); if (GameBoxSettings.bStatsMetrics) { setupMetrics(); } else { Bukkit.getConsoleSender().sendMessage(lang.PREFIX + " You have opt out bStats... That's sad!"); } }
<DeepExtract> if (!prepareForReload()) return; if (pManager != null) { pManager.shutDown(); HandlerList.unregisterAll(pManager); pManager = null; } GameBox instance = this; BukkitRunnable rampUpGameBox = new BukkitRunnable() { @Override public void run() { if (GameBoxSettings.bungeeMode) { dataBase.registerBukkitBridge(bukkitBridge == null ? (bukkitBridge = new BukkitBridge(instance)) : bukkitBridge); } if (GameBoxSettings.econEnabled) { if (!setupEconomy()) { getLogger().log(Level.SEVERE, "No economy found!"); getLogger().log(Level.SEVERE, "Even though it is enabled in the configuration file..."); GameBoxSettings.econEnabled = false; Bukkit.getPluginManager().disablePlugin(instance); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_FAIL); } return; } } reloadListeners(); GBPlayer.clearTokenListeners(); inventoryTitleMessenger = new InventoryTitleMessenger(instance); pManager = new PluginManager(instance); pManager.setGuiManager(new GuiManager(instance)); pManager.setInviteInputHandler(new InviteInputHandler(instance)); pManager.setInvitationHandler(new InvitationHandler(instance)); commands = new GameBoxCommands(instance); pManager.loadPlayers(); gameRegistry.reload(); if (modulesManager != null) { modulesManager.shutDown(); HandlerList.unregisterAll(modulesManager); } modulesManager = new ModulesManager(instance); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_SUCCESS); } debug(" running late checks in GameBox"); runLateChecks(); } }; new BukkitRunnable() { @Override public void run() { if (loadDatabase()) { rampUpGameBox.runTask(instance); } else { new BukkitRunnable() { @Override public void run() { instance.getLogger().severe("Failed to load the database"); if (null != null && lang != null) { null.sendMessage(lang.PREFIX + lang.RELOAD_FAIL); } Bukkit.getPluginManager().disablePlugin(instance); } }.runTask(instance); } } }.runTaskAsynchronously(this); </DeepExtract> <DeepExtract> if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) { new PlaceholderAPIHook(this); Bukkit.getConsoleSender().sendMessage(lang.PREFIX + " Hooked into PlaceholderAPI"); } hookCalendarEvents(); if (GameBoxSettings.bStatsMetrics) { setupMetrics(); } else { Bukkit.getConsoleSender().sendMessage(lang.PREFIX + " You have opt out bStats... That's sad!"); } </DeepExtract>
gamebox
positive
public void preInit(FMLPreInitializationEvent event) { registry.init(); NetworkRegistry.INSTANCE.registerGuiHandler(AuraCascade.instance, new GuiHandler()); PylonRecipeRegistry.init(); ProcessorRecipeRegistry.init(); PotionManager.init(); eventHandler = new EventHandler(); MinecraftForge.EVENT_BUS.register(eventHandler); EnchantmentManager.init(); eventHandlerEnch = new EnchantEventHandler(); MinecraftForge.EVENT_BUS.register(eventHandlerEnch); EntityRegistry.registerModEntity(EntityFairy.class, "Fairy", 0, AuraCascade.instance, 50, 250, true); EntityRegistry.registerModEntity(EntityMinerExplosion.class, "ExplosionMiner", 1, AuraCascade.instance, 50, 40, true); QuestManager.init(); ModCreativeTab.INSTANCE = new ModCreativeTab(); AngelsteelToolHelper.initMaterials(); registry = new BlockRegistry(); registry.preInit(); EnchantEventHandler.init(); networkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel(ConstantMod.modId); networkWrapper.registerMessage(PacketBurst.class, PacketBurst.class, 0, Side.CLIENT); networkWrapper.registerMessage(PacketFairyUpdate.class, PacketFairyUpdate.class, 1, Side.CLIENT); networkWrapper.registerMessage(PacketFairyRequestUpdate.class, PacketFairyRequestUpdate.class, 2, Side.SERVER); networkWrapper.registerMessage(PacketAngelJump.PacketAngelJumpHandler.class, PacketAngelJump.class, 4, Side.SERVER); networkWrapper.registerMessage(PacketSyncQuestData.PacketSyncQuestDataHandler.class, PacketSyncQuestData.class, 5, Side.CLIENT); if (Config.villageGeneration) { VillagerRegistry.instance().registerVillageCreationHandler(new AuraHutHandler()); } MapGenStructureIO.registerStructureComponent(ComponentAuraHut.class, "aura:auraHut"); }
<DeepExtract> registry.init(); NetworkRegistry.INSTANCE.registerGuiHandler(AuraCascade.instance, new GuiHandler()); PylonRecipeRegistry.init(); ProcessorRecipeRegistry.init(); PotionManager.init(); eventHandler = new EventHandler(); MinecraftForge.EVENT_BUS.register(eventHandler); EnchantmentManager.init(); eventHandlerEnch = new EnchantEventHandler(); MinecraftForge.EVENT_BUS.register(eventHandlerEnch); EntityRegistry.registerModEntity(EntityFairy.class, "Fairy", 0, AuraCascade.instance, 50, 250, true); EntityRegistry.registerModEntity(EntityMinerExplosion.class, "ExplosionMiner", 1, AuraCascade.instance, 50, 40, true); QuestManager.init(); </DeepExtract>
Aura-Cascade
positive
@Override public void onClick(View view) { mEmailView.setError(null); mPasswordView.setError(null); clearErrorMessage(); String email = mEmailView.getText().toString(); String password = mPasswordView.getText().toString(); boolean cancel = false; View focusView = null; if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) { mPasswordView.setError(getString(R.string.error_invalid_password)); focusView = mPasswordView; cancel = true; } if (TextUtils.isEmpty(email)) { mEmailView.setError(getString(R.string.error_field_required)); focusView = mEmailView; cancel = true; } else if (!isEmailValid(email)) { mEmailView.setError(getString(R.string.error_invalid_email)); focusView = mEmailView; cancel = true; } if (cancel) { focusView.requestFocus(); } else { String userEmail = mEmailView.getText().toString(); String userPassword = mPasswordView.getText().toString(); String requestBodyString = "{\"username\":\"" + userEmail + "\",\"password\":\"" + userPassword + "\"}"; LoginRequest userLoginRequest = new LoginRequest(this, requestBodyString); httpRequestQueue.add(userLoginRequest); } }
<DeepExtract> mEmailView.setError(null); mPasswordView.setError(null); clearErrorMessage(); String email = mEmailView.getText().toString(); String password = mPasswordView.getText().toString(); boolean cancel = false; View focusView = null; if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) { mPasswordView.setError(getString(R.string.error_invalid_password)); focusView = mPasswordView; cancel = true; } if (TextUtils.isEmpty(email)) { mEmailView.setError(getString(R.string.error_field_required)); focusView = mEmailView; cancel = true; } else if (!isEmailValid(email)) { mEmailView.setError(getString(R.string.error_invalid_email)); focusView = mEmailView; cancel = true; } if (cancel) { focusView.requestFocus(); } else { String userEmail = mEmailView.getText().toString(); String userPassword = mPasswordView.getText().toString(); String requestBodyString = "{\"username\":\"" + userEmail + "\",\"password\":\"" + userPassword + "\"}"; LoginRequest userLoginRequest = new LoginRequest(this, requestBodyString); httpRequestQueue.add(userLoginRequest); } </DeepExtract>
grapevine
positive
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragdialogactivity); FragmentManager fm = getSupportFragmentManager(); EditNameDialogFrag editNameDialog = new EditNameDialogFrag(); editNameDialog.show(fm, "fragment_edit_name"); }
<DeepExtract> FragmentManager fm = getSupportFragmentManager(); EditNameDialogFrag editNameDialog = new EditNameDialogFrag(); editNameDialog.show(fm, "fragment_edit_name"); </DeepExtract>
Android-Examples
positive
public void handleClose(CloseEvent event) { FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Panel Closed", "Closed panel id:'" + event.getComponent().getId() + "'"); FacesContext.getCurrentInstance().addMessage(null, message); }
<DeepExtract> FacesContext.getCurrentInstance().addMessage(null, message); </DeepExtract>
primefaces-showcase
positive
@Override public StandardField getField(MSDOSHeaderKey key) { return getField(key).getValue(); }
<DeepExtract> return getField(key).getValue(); </DeepExtract>
PortEx
positive
public static void main(String[] args) throws Exception { Small s = new Small(); Window w = s.getFrame(); w.setLocation(100, 180); Thread.sleep(999); ins.scale(w); w.pack(); }
<DeepExtract> ins.scale(w); w.pack(); </DeepExtract>
SmallSimpleSafe
positive
public static void main(String[] args) { int[] arr = new int[] { 4, 5, 6, 3, 2, 1 }; int n = arr.length, i, j; for (i = n - 1; i >= 1; i--) if (arr[i - 1] < arr[i]) { i--; break; } for (j = i; j < n - 1; j++) if (arr[j] > arr[j + 1]) { break; } int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; for (int l = j, k = n - 1; l < k; l++, k--) { temp = arr[l]; arr[l] = arr[k]; arr[k] = temp; } for (int h : arr) System.out.print(h); }
<DeepExtract> int n = arr.length, i, j; for (i = n - 1; i >= 1; i--) if (arr[i - 1] < arr[i]) { i--; break; } for (j = i; j < n - 1; j++) if (arr[j] > arr[j + 1]) { break; } int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; for (int l = j, k = n - 1; l < k; l++, k--) { temp = arr[l]; arr[l] = arr[k]; arr[k] = temp; } for (int h : arr) System.out.print(h); </DeepExtract>
Cracking-The-Coding-Interview-Solutions
positive
public Builder setLottieText(String text) { if (mCircleParams.lottieParams == null) { mCircleParams.lottieParams = new LottieParams(); } mCircleParams.lottieParams.text = text; return this; }
<DeepExtract> if (mCircleParams.lottieParams == null) { mCircleParams.lottieParams = new LottieParams(); } </DeepExtract>
Android-CircleDialog
positive
public Criteria andJeNotEqualTo(BigDecimal value) { if (value == null) { throw new RuntimeException("Value for " + "je" + " cannot be null"); } criteria.add(new Criterion("je <>", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "je" + " cannot be null"); } criteria.add(new Criterion("je <>", value)); </DeepExtract>
einvoice
positive
public void mouseExited(java.awt.event.MouseEvent evt) { btn_comment_tallies.setBackground(BUTTON_BACKGROUD_COLOR__UNSELECTED_STATE); }
<DeepExtract> btn_comment_tallies.setBackground(BUTTON_BACKGROUD_COLOR__UNSELECTED_STATE); </DeepExtract>
ERSN-OpenMC
positive
@Override public void onDateChanged() { mAdapter.notifyDataSetChanged(); postSetSelectionFromTop(mController.getSelectedDay().year - mController.getMinYear(), mViewSize / 2 - mChildSize / 2); }
<DeepExtract> postSetSelectionFromTop(mController.getSelectedDay().year - mController.getMinYear(), mViewSize / 2 - mChildSize / 2); </DeepExtract>
HijriDatePicker
positive
@FXML private void deleteButtonAction(ActionEvent event) { final int idx = fullMediaList.indexOf(factory.getSelectedCell().getItem()); final MediaFile item = fullMediaList.get(idx); item.setDeleted(true); imageView.setImage(null); getTitleLabel().setVisible(false); getCameraLabel().setVisible(false); getFilenameLabel().setVisible(false); getRatingControl().setVisible(false); savingMediaFileEdits(item); }
<DeepExtract> final int idx = fullMediaList.indexOf(factory.getSelectedCell().getItem()); final MediaFile item = fullMediaList.get(idx); item.setDeleted(true); imageView.setImage(null); getTitleLabel().setVisible(false); getCameraLabel().setVisible(false); getFilenameLabel().setVisible(false); getRatingControl().setVisible(false); savingMediaFileEdits(item); </DeepExtract>
PhotoSlide
positive
@Override public void onResponse(Call<Person> call, final Response<Person> response) { if (!response.isSuccessful()) { mPersonDetailsCall = call.clone(); mPersonDetailsCall.enqueue(this); return; } if (response.body() == null) return; mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { @Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { if (appBarLayout.getTotalScrollRange() + verticalOffset == 0) { if (response.body().getName() != null) mCollapsingToolbarLayout.setTitle(response.body().getName()); else mCollapsingToolbarLayout.setTitle(""); mToolbar.setVisibility(View.VISIBLE); } else { mCollapsingToolbarLayout.setTitle(""); mToolbar.setVisibility(View.INVISIBLE); } } }); Glide.with(getApplicationContext()).load(Constants.IMAGE_LOADING_BASE_URL_1280 + response.body().getProfilePath()).asBitmap().centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).listener(new RequestListener<String, Bitmap>() { @Override public boolean onException(Exception e, String model, Target<Bitmap> target, boolean isFirstResource) { mProgressBar.setVisibility(View.GONE); return false; } @Override public boolean onResourceReady(Bitmap resource, String model, Target<Bitmap> target, boolean isFromMemoryCache, boolean isFirstResource) { mProgressBar.setVisibility(View.GONE); return false; } }).into(mCastImageView); if (response.body().getName() != null) mCastNameTextView.setText(response.body().getName()); else mCastNameTextView.setText(""); if (response.body().getDateOfBirth() != null && !response.body().getDateOfBirth().trim().isEmpty()) { SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy"); try { Date releaseDate = sdf1.parse(response.body().getDateOfBirth()); mCastAgeTextView.setText((Calendar.getInstance().get(Calendar.YEAR) - Integer.parseInt(sdf2.format(releaseDate))) + ""); } catch (ParseException e) { e.printStackTrace(); } } if (response.body().getPlaceOfBirth() != null && !response.body().getPlaceOfBirth().trim().isEmpty()) mCastBirthPlaceTextView.setText(response.body().getPlaceOfBirth()); if (response.body().getBiography() != null && !response.body().getBiography().trim().isEmpty()) { mCastBioHeaderTextView.setVisibility(View.VISIBLE); mCastReadMoreBioTextView.setVisibility(View.VISIBLE); mCastBioTextView.setText(response.body().getBiography()); mCastReadMoreBioTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mCastBioTextView.setMaxLines(Integer.MAX_VALUE); mCastReadMoreBioTextView.setVisibility(View.GONE); } }); } ApiInterface apiService = ApiClient.getClient().create(ApiInterface.class); mMovieCastsOfPersonsCall = apiService.getMovieCastsOfPerson(response.body().getId(), getResources().getString(R.string.MOVIE_DB_API_KEY)); mMovieCastsOfPersonsCall.enqueue(new Callback<MovieCastsOfPersonResponse>() { @Override public void onResponse(Call<MovieCastsOfPersonResponse> call, Response<MovieCastsOfPersonResponse> response) { if (!response.isSuccessful()) { mMovieCastsOfPersonsCall = call.clone(); mMovieCastsOfPersonsCall.enqueue(this); return; } if (response.body() == null) return; if (response.body().getCasts() == null) return; for (MovieCastOfPerson movieCastOfPerson : response.body().getCasts()) { if (movieCastOfPerson == null) return; if (movieCastOfPerson.getTitle() != null && movieCastOfPerson.getPosterPath() != null) { mMovieCastTextView.setVisibility(View.VISIBLE); mMovieCastOfPersons.add(movieCastOfPerson); } } mMovieCastsOfPersonAdapter.notifyDataSetChanged(); } @Override public void onFailure(Call<MovieCastsOfPersonResponse> call, Throwable t) { } }); ApiInterface apiService = ApiClient.getClient().create(ApiInterface.class); mTVCastsOfPersonsCall = apiService.getTVCastsOfPerson(response.body().getId(), getResources().getString(R.string.MOVIE_DB_API_KEY)); mTVCastsOfPersonsCall.enqueue(new Callback<TVCastsOfPersonResponse>() { @Override public void onResponse(Call<TVCastsOfPersonResponse> call, Response<TVCastsOfPersonResponse> response) { if (!response.isSuccessful()) { mTVCastsOfPersonsCall = call.clone(); mTVCastsOfPersonsCall.enqueue(this); return; } if (response.body() == null) return; if (response.body().getCasts() == null) return; for (TVCastOfPerson tvCastOfPerson : response.body().getCasts()) { if (tvCastOfPerson == null) return; if (tvCastOfPerson.getName() != null && tvCastOfPerson.getPosterPath() != null) { mTVCastTextView.setVisibility(View.VISIBLE); mTVCastOfPersons.add(tvCastOfPerson); } } mTVCastsOfPersonAdapter.notifyDataSetChanged(); } @Override public void onFailure(Call<TVCastsOfPersonResponse> call, Throwable t) { } }); }
<DeepExtract> if (response.body().getDateOfBirth() != null && !response.body().getDateOfBirth().trim().isEmpty()) { SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy"); try { Date releaseDate = sdf1.parse(response.body().getDateOfBirth()); mCastAgeTextView.setText((Calendar.getInstance().get(Calendar.YEAR) - Integer.parseInt(sdf2.format(releaseDate))) + ""); } catch (ParseException e) { e.printStackTrace(); } } </DeepExtract> <DeepExtract> ApiInterface apiService = ApiClient.getClient().create(ApiInterface.class); mMovieCastsOfPersonsCall = apiService.getMovieCastsOfPerson(response.body().getId(), getResources().getString(R.string.MOVIE_DB_API_KEY)); mMovieCastsOfPersonsCall.enqueue(new Callback<MovieCastsOfPersonResponse>() { @Override public void onResponse(Call<MovieCastsOfPersonResponse> call, Response<MovieCastsOfPersonResponse> response) { if (!response.isSuccessful()) { mMovieCastsOfPersonsCall = call.clone(); mMovieCastsOfPersonsCall.enqueue(this); return; } if (response.body() == null) return; if (response.body().getCasts() == null) return; for (MovieCastOfPerson movieCastOfPerson : response.body().getCasts()) { if (movieCastOfPerson == null) return; if (movieCastOfPerson.getTitle() != null && movieCastOfPerson.getPosterPath() != null) { mMovieCastTextView.setVisibility(View.VISIBLE); mMovieCastOfPersons.add(movieCastOfPerson); } } mMovieCastsOfPersonAdapter.notifyDataSetChanged(); } @Override public void onFailure(Call<MovieCastsOfPersonResponse> call, Throwable t) { } }); </DeepExtract> <DeepExtract> ApiInterface apiService = ApiClient.getClient().create(ApiInterface.class); mTVCastsOfPersonsCall = apiService.getTVCastsOfPerson(response.body().getId(), getResources().getString(R.string.MOVIE_DB_API_KEY)); mTVCastsOfPersonsCall.enqueue(new Callback<TVCastsOfPersonResponse>() { @Override public void onResponse(Call<TVCastsOfPersonResponse> call, Response<TVCastsOfPersonResponse> response) { if (!response.isSuccessful()) { mTVCastsOfPersonsCall = call.clone(); mTVCastsOfPersonsCall.enqueue(this); return; } if (response.body() == null) return; if (response.body().getCasts() == null) return; for (TVCastOfPerson tvCastOfPerson : response.body().getCasts()) { if (tvCastOfPerson == null) return; if (tvCastOfPerson.getName() != null && tvCastOfPerson.getPosterPath() != null) { mTVCastTextView.setVisibility(View.VISIBLE); mTVCastOfPersons.add(tvCastOfPerson); } } mTVCastsOfPersonAdapter.notifyDataSetChanged(); } @Override public void onFailure(Call<TVCastsOfPersonResponse> call, Throwable t) { } }); </DeepExtract>
PopCorn
positive
@Override protected Boolean process(Object input) throws Exception { if (!Validate.isPortValid(port)) { throw new IllegalArgumentException("Specified port " + port + " is not a valid port."); } ServerSocket ss = null; Socket s = null; DatagramSocket ds = null; try { ss = new ServerSocket(port); ds = new DatagramSocket(port); s = new Socket("localhost", port); return true; } catch (IOException e) { } finally { if (ds != null) { try { ds.close(); } catch (Exception ex) { } } if (ss != null) { try { ss.close(); } catch (IOException e) { } } if (s != null) { try { s.close(); } catch (IOException e) { } } } return false; }
<DeepExtract> if (!Validate.isPortValid(port)) { throw new IllegalArgumentException("Specified port " + port + " is not a valid port."); } ServerSocket ss = null; Socket s = null; DatagramSocket ds = null; try { ss = new ServerSocket(port); ds = new DatagramSocket(port); s = new Socket("localhost", port); return true; } catch (IOException e) { } finally { if (ds != null) { try { ds.close(); } catch (Exception ex) { } } if (ss != null) { try { ss.close(); } catch (IOException e) { } } if (s != null) { try { s.close(); } catch (IOException e) { } } } return false; </DeepExtract>
arquillian-droidium
positive
public JsonParser setInput(final String inpnam, final Reader inpsrc, final boolean inpcls) { if (inpClose && inpReader != null) { try { inpReader.close(); } catch (final Throwable ign) { ; } } objectStack.clear(); accumulator.setLength(0); if (false) { accumulator.trimToSize(); } inpName = null; inpReader = null; inpLine = 1; inpColumn = 0; objectData = new ObjectData(""); pushBack = -1; evtCode = 0; evtLine = 0; evtColumn = 0; mbrName = ""; mbrValue = ""; inpName = inpnam; inpReader = inpsrc; inpClose = inpcls; if (optPreloadInput) { inpReader = preloadInput(inpnam, inpReader, inpClose, 0); inpClose = true; } return this; }
<DeepExtract> if (inpClose && inpReader != null) { try { inpReader.close(); } catch (final Throwable ign) { ; } } objectStack.clear(); accumulator.setLength(0); if (false) { accumulator.trimToSize(); } inpName = null; inpReader = null; inpLine = 1; inpColumn = 0; objectData = new ObjectData(""); pushBack = -1; evtCode = 0; evtLine = 0; evtColumn = 0; mbrName = ""; mbrValue = ""; </DeepExtract>
marc4j
positive
public void download(final String url, final String saveapkpath, final long fileSize, final OnDownloadListener listener) { DownLoadCallBack downLoadCallBack = new DownLoadCallBack(); this.listener = listener; this.saveapkpath = saveapkpath; this.fileSize = fileSize; Request request = new Request.Builder().url(url).build(); okHttpClient.newCall(request).enqueue(downLoadCallBack); }
<DeepExtract> this.listener = listener; this.saveapkpath = saveapkpath; this.fileSize = fileSize; </DeepExtract>
AppServiceRestFul
positive
private void resetJPanel() { jpContent.removeAll(); int lineOunt = 0; for (Field field : Global.class.getDeclaredFields()) { Config config = field.getAnnotation(Config.class); if (config != null) { String note = config.note(); if (!note.isEmpty()) { String key = config.key(); String[] selects = config.valids(); String selected = Global.settings.get(key); JLabel name = this.createTextLabel(note, 380, LINE_HEIGHT); name.setToolTipText(key); boolean visible = note.contains(searchContent) || key.toLowerCase().contains(searchContent) || (selected != null && selected.toLowerCase().contains(searchContent)); if (selects.length > 0) { JComboBox<String> selectCBox = new JComboBox<>(selects); int totalWidth = 700, width = 80; selectCBox.setSelectedItem(selected); selectCBox.setPreferredSize(new Dimension(width, LINE_HEIGHT)); selectCBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { onContentChanged(name, e.getItem().toString(), selected); } } }); JLabel blank = this.createTextLabel(null, totalWidth - width, LINE_HEIGHT); name.setVisible(visible); selectCBox.setVisible(visible); blank.setVisible(visible); jpContent.add(name); jpContent.add(selectCBox); jpContent.add(blank); } else { JTextField value = new JTextField(selected); int totalWidth = 700, width = 340; value.setPreferredSize(new Dimension(width, LINE_HEIGHT)); new FocusAdapter() { }; value.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { onContentChanged(name, value.getText(), selected); } }); JLabel blank = this.createTextLabel(null, totalWidth - width, LINE_HEIGHT); name.setVisible(visible); value.setVisible(visible); blank.setVisible(visible); jpContent.add(name); jpContent.add(value); jpContent.add(blank); } if (visible) lineOunt++; } } } jpContent.setPreferredSize(new Dimension(1100, (LINE_HEIGHT + 4) * (lineOunt + 1) + 10)); jpContent.updateUI(); jpContent.repaint(); }
<DeepExtract> int lineOunt = 0; for (Field field : Global.class.getDeclaredFields()) { Config config = field.getAnnotation(Config.class); if (config != null) { String note = config.note(); if (!note.isEmpty()) { String key = config.key(); String[] selects = config.valids(); String selected = Global.settings.get(key); JLabel name = this.createTextLabel(note, 380, LINE_HEIGHT); name.setToolTipText(key); boolean visible = note.contains(searchContent) || key.toLowerCase().contains(searchContent) || (selected != null && selected.toLowerCase().contains(searchContent)); if (selects.length > 0) { JComboBox<String> selectCBox = new JComboBox<>(selects); int totalWidth = 700, width = 80; selectCBox.setSelectedItem(selected); selectCBox.setPreferredSize(new Dimension(width, LINE_HEIGHT)); selectCBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { onContentChanged(name, e.getItem().toString(), selected); } } }); JLabel blank = this.createTextLabel(null, totalWidth - width, LINE_HEIGHT); name.setVisible(visible); selectCBox.setVisible(visible); blank.setVisible(visible); jpContent.add(name); jpContent.add(selectCBox); jpContent.add(blank); } else { JTextField value = new JTextField(selected); int totalWidth = 700, width = 340; value.setPreferredSize(new Dimension(width, LINE_HEIGHT)); new FocusAdapter() { }; value.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { onContentChanged(name, value.getText(), selected); } }); JLabel blank = this.createTextLabel(null, totalWidth - width, LINE_HEIGHT); name.setVisible(visible); value.setVisible(visible); blank.setVisible(visible); jpContent.add(name); jpContent.add(value); jpContent.add(blank); } if (visible) lineOunt++; } } } jpContent.setPreferredSize(new Dimension(1100, (LINE_HEIGHT + 4) * (lineOunt + 1) + 10)); </DeepExtract>
BilibiliDown
positive
public void sendRedirect(String location) throws IOException { List valueList = new ArrayList(); headers.put("Location", valueList); valueList.add(location); wasRedirectSent = true; }
<DeepExtract> List valueList = new ArrayList(); headers.put("Location", valueList); valueList.add(location); </DeepExtract>
cdi-unit
positive
public void startAnimation() { if (betaUI) { controller_beta.show(); } else { show(); } WritableValue<Double> opacity = new WritableValue<Double>() { @Override public Double getValue() { if (betaUI) { return controller_beta.getOpacity(); } else { return getOpacity(); } } @Override public void setValue(Double value) { if (betaUI) { controller_beta.fade(value); } else { setOpacity(value); } } }; Timeline fadeIn = new Timeline(); Timeline delay = new Timeline(); Timeline fadeOut = new Timeline(); KeyValue kv = new KeyValue(opacity, 1d); KeyFrame kf_slideIn = new KeyFrame(Duration.millis(1000), kv); fadeIn.getKeyFrames().add(kf_slideIn); fadeIn.setOnFinished(e -> Platform.runLater(() -> delay.play())); KeyFrame kf_delay = new KeyFrame(Duration.millis(Preferences_Controller.level_slider * 1000)); delay.getKeyFrames().addAll(kf_delay); delay.setOnFinished(e -> Platform.runLater(() -> fadeOut.play())); KeyValue kv2 = new KeyValue(opacity, 0d); KeyFrame kf_slideIn2 = new KeyFrame(Duration.millis(1000), kv2); fadeOut.getKeyFrames().add(kf_slideIn2); fadeOut.setOnFinished(e -> Platform.runLater(() -> { isPlaying = false; if (betaUI) { controller_beta.hide(); controller_beta.defaultTitle(); } else { this.hide(); } })); fadeIn.play(); isPlaying = true; }
<DeepExtract> if (betaUI) { controller_beta.show(); } else { show(); } WritableValue<Double> opacity = new WritableValue<Double>() { @Override public Double getValue() { if (betaUI) { return controller_beta.getOpacity(); } else { return getOpacity(); } } @Override public void setValue(Double value) { if (betaUI) { controller_beta.fade(value); } else { setOpacity(value); } } }; Timeline fadeIn = new Timeline(); Timeline delay = new Timeline(); Timeline fadeOut = new Timeline(); KeyValue kv = new KeyValue(opacity, 1d); KeyFrame kf_slideIn = new KeyFrame(Duration.millis(1000), kv); fadeIn.getKeyFrames().add(kf_slideIn); fadeIn.setOnFinished(e -> Platform.runLater(() -> delay.play())); KeyFrame kf_delay = new KeyFrame(Duration.millis(Preferences_Controller.level_slider * 1000)); delay.getKeyFrames().addAll(kf_delay); delay.setOnFinished(e -> Platform.runLater(() -> fadeOut.play())); KeyValue kv2 = new KeyValue(opacity, 0d); KeyFrame kf_slideIn2 = new KeyFrame(Duration.millis(1000), kv2); fadeOut.getKeyFrames().add(kf_slideIn2); fadeOut.setOnFinished(e -> Platform.runLater(() -> { isPlaying = false; if (betaUI) { controller_beta.hide(); controller_beta.defaultTitle(); } else { this.hide(); } })); fadeIn.play(); isPlaying = true; </DeepExtract>
Path-of-Leveling
positive
protected void onReset() { mIsBeingDragged = false; mLayoutVisibilityChangesEnabled = true; mHeaderLayout.reset(); mFooterLayout.reset(); smoothScrollTo(0, getPullToRefreshScrollDuration()); }
<DeepExtract> smoothScrollTo(0, getPullToRefreshScrollDuration()); </DeepExtract>
GotyeSDK-Android
positive
@Test public void handle_withMessage0x312D_notifiesOnDistanceUpdatedUpdate() { return new DisplayedDistanceSubscription() { @Override protected void onDistanceUpdated(int distance) { internalSubscription.onDistanceUpdated(distance); } }; subscription.handle(new DataMemoryMessage(DISTANCE_LOW.getLocation(), 0x31, 0x2D)); internalSubscription.onDistanceUpdated(12589); }
<DeepExtract> return new DisplayedDistanceSubscription() { @Override protected void onDistanceUpdated(int distance) { internalSubscription.onDistanceUpdated(distance); } }; </DeepExtract> <DeepExtract> internalSubscription.onDistanceUpdated(12589); </DeepExtract>
waterrower-core
positive
private void obtainAttrs(AttributeSet attrs) { TypedArray ta = mContext.obtainStyledAttributes(attrs, R.styleable.TitleView); mLeftText = ta.getString(R.styleable.TitleView_leftText); mRightText = ta.getString(R.styleable.TitleView_rightText); mTitle = ta.getString(R.styleable.TitleView_title); mLeftTextColor = ta.getColor(R.styleable.TitleView_leftTextColor, DEF_TEXT_COLOR); mRightTextColor = ta.getColor(R.styleable.TitleView_rightTextColor, DEF_TEXT_COLOR); mTitleColor = ta.getColor(R.styleable.TitleView_titleColor, DEF_TEXT_COLOR); mLeftResId = ta.getResourceId(R.styleable.TitleView_leftIcon, DEF_RES); mRightResId = ta.getResourceId(R.styleable.TitleView_rightIcon, DEF_RES); mLeftVisibility = ta.getInt(R.styleable.TitleView_leftVisibility, DEF_VALUE); mLeftTextSize = ta.getDimension(R.styleable.TitleView_leftTextSize, DEF_TEXT_SIZE); mRightTextSize = ta.getDimension(R.styleable.TitleView_rightTextSize, DEF_TEXT_SIZE); mTitleSize = ta.getDimension(R.styleable.TitleView_titleSize, DEF_TEXT_SIZE); if (mLeftVisibility == 0) { mLeftVisibility = View.VISIBLE; } else if (mLeftVisibility == 1) { mLeftVisibility = View.INVISIBLE; } else { mLeftVisibility = View.GONE; } mRightVisibility = ta.getInt(R.styleable.TitleView_rightVisibility, DEF_VALUE); if (mRightVisibility == 0) { mRightVisibility = View.VISIBLE; } else if (mRightVisibility == 1) { mRightVisibility = View.INVISIBLE; } else { mRightVisibility = View.GONE; } mTitleVisibility = ta.getInt(R.styleable.TitleView_titleVisibility, DEF_VALUE); if (mTitleVisibility == 0) { mTitleVisibility = View.VISIBLE; } else if (mTitleVisibility == 1) { mTitleVisibility = View.INVISIBLE; } else { mTitleVisibility = View.GONE; } ta.recycle(); }
<DeepExtract> if (mLeftVisibility == 0) { mLeftVisibility = View.VISIBLE; } else if (mLeftVisibility == 1) { mLeftVisibility = View.INVISIBLE; } else { mLeftVisibility = View.GONE; } </DeepExtract> <DeepExtract> if (mRightVisibility == 0) { mRightVisibility = View.VISIBLE; } else if (mRightVisibility == 1) { mRightVisibility = View.INVISIBLE; } else { mRightVisibility = View.GONE; } </DeepExtract> <DeepExtract> if (mTitleVisibility == 0) { mTitleVisibility = View.VISIBLE; } else if (mTitleVisibility == 1) { mTitleVisibility = View.INVISIBLE; } else { mTitleVisibility = View.GONE; } </DeepExtract>
CommonLibrary
positive
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { getWritableDatabase().execSQL(SQL_DELETE_TABLE); Logger.e(TAG, SQL_CREATE_TABLE); db.execSQL(SQL_CREATE_TABLE); }
<DeepExtract> getWritableDatabase().execSQL(SQL_DELETE_TABLE); </DeepExtract> <DeepExtract> Logger.e(TAG, SQL_CREATE_TABLE); db.execSQL(SQL_CREATE_TABLE); </DeepExtract>
NutritionMaster
positive
@Override public void actionPerformed(ActionEvent arg0) { zoomFactor = Math.round(LatticeView.getZoomFactor() - 0.01 * 100) / 100.0; guiConf.zoomFactor = zoomFactor; if (LatticeView.getZoomFactor() < 0) { LatticeView.setZoomFactor(0); } latticeGraphView.repaint(); }
<DeepExtract> zoomFactor = Math.round(LatticeView.getZoomFactor() - 0.01 * 100) / 100.0; guiConf.zoomFactor = zoomFactor; </DeepExtract>
conexp-ng
positive
private AVLNode doubleRotateRL(AVLNode n) { AVLNode left1 = n.right.left; n.right.left = left1.right; left1.right = n.right; n.right.height = Math.max(height(n.right.left), height(n.right.right)) + 1; left1.height = Math.max(height(left1.left), n.right.height) + 1; return left1; AVLNode right1 = n.right; n.right = right1.left; right1.left = n; n.height = Math.max(height(n.left), height(n.right)) + 1; right1.height = Math.max(n.height, height(right1.right)) + 1; return right1; }
<DeepExtract> AVLNode left1 = n.right.left; n.right.left = left1.right; left1.right = n.right; n.right.height = Math.max(height(n.right.left), height(n.right.right)) + 1; left1.height = Math.max(height(left1.left), n.right.height) + 1; return left1; </DeepExtract> <DeepExtract> AVLNode right1 = n.right; n.right = right1.left; right1.left = n; n.height = Math.max(height(n.left), height(n.right)) + 1; right1.height = Math.max(n.height, height(right1.right)) + 1; return right1; </DeepExtract>
Algorithm-and-Leetcode
positive
public static <T> T httpPutforObject(String poolName, String url, Map params, Map headers, final Class<T> resultType) throws HttpProxyRequestException { HttpOption httpOption = new HttpOption(); httpOption.params = params; httpOption.headers = headers; return httpPut(poolName, (String) null, (String) null, (Map) url, (Map<String, File>) null, httpOption, new BaseURLResponseHandler<T>() { @Override public T handleResponse(HttpResponse response) throws ClientProtocolException, IOException { return ResponseUtil.handleResponse(url, response, resultType); } }); }
<DeepExtract> return httpPut(poolName, (String) null, (String) null, (Map) url, (Map<String, File>) null, httpOption, new BaseURLResponseHandler<T>() { @Override public T handleResponse(HttpResponse response) throws ClientProtocolException, IOException { return ResponseUtil.handleResponse(url, response, resultType); } }); </DeepExtract>
bboss-http
positive
public void actionPerformed(java.awt.event.ActionEvent evt) { Object source = evt.getSource(); if (source == groundToggle) { Globals.tab = Tab.ground; setCurrentTab(groundPanel); } else if (source == heightToggle) { Globals.tab = Tab.height; setCurrentTab(heightPanel); } else if (source == floorsToggle) { Globals.tab = Tab.floors; setCurrentTab(floorsPanel); } else if (source == wallsToggle) { Globals.tab = Tab.walls; setCurrentTab(wallsPanel); } else if (source == roofsToggle) { Globals.tab = Tab.roofs; setCurrentTab(roofsPanel); } else if (source == objectsToggle) { Globals.tab = Tab.objects; setCurrentTab(objectsPanel); } else if (source == animalsToggle) { Globals.tab = Tab.animals; setCurrentTab(animalsPanel); } else if (source == labelsToggle) { Globals.tab = Tab.labels; setCurrentTab(labelsPanel); } else if (source == bordersToggle) { Globals.tab = Tab.borders; setCurrentTab(bordersPanel); } else if (source == bridgesToggle) { Globals.tab = Tab.bridges; setCurrentTab(bridgesPanel); } else if (source == symmetryToggle) { Globals.tab = Tab.symmetry; setCurrentTab(symmetryPanel); } else if (source == cavesToggle) { Globals.tab = Tab.caves; setCurrentTab(cavesPanel); } Analytics.getInstance().screenView().screenName(Globals.tab.toString()).sendAsync(); }
<DeepExtract> Object source = evt.getSource(); if (source == groundToggle) { Globals.tab = Tab.ground; setCurrentTab(groundPanel); } else if (source == heightToggle) { Globals.tab = Tab.height; setCurrentTab(heightPanel); } else if (source == floorsToggle) { Globals.tab = Tab.floors; setCurrentTab(floorsPanel); } else if (source == wallsToggle) { Globals.tab = Tab.walls; setCurrentTab(wallsPanel); } else if (source == roofsToggle) { Globals.tab = Tab.roofs; setCurrentTab(roofsPanel); } else if (source == objectsToggle) { Globals.tab = Tab.objects; setCurrentTab(objectsPanel); } else if (source == animalsToggle) { Globals.tab = Tab.animals; setCurrentTab(animalsPanel); } else if (source == labelsToggle) { Globals.tab = Tab.labels; setCurrentTab(labelsPanel); } else if (source == bordersToggle) { Globals.tab = Tab.borders; setCurrentTab(bordersPanel); } else if (source == bridgesToggle) { Globals.tab = Tab.bridges; setCurrentTab(bridgesPanel); } else if (source == symmetryToggle) { Globals.tab = Tab.symmetry; setCurrentTab(symmetryPanel); } else if (source == cavesToggle) { Globals.tab = Tab.caves; setCurrentTab(cavesPanel); } Analytics.getInstance().screenView().screenName(Globals.tab.toString()).sendAsync(); </DeepExtract>
DeedPlanner-2
positive
@Override public void setImageResource(int resId) { super.setImageResource(resId); if (getDrawable() == null) { mBitmap = null; } if (getDrawable() instanceof BitmapDrawable) { mBitmap = ((BitmapDrawable) getDrawable()).getBitmap(); } try { Bitmap bitmap; if (getDrawable() instanceof ColorDrawable) { bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG); } else { bitmap = Bitmap.createBitmap(getDrawable().getIntrinsicWidth(), getDrawable().getIntrinsicHeight(), BITMAP_CONFIG); } Canvas canvas = new Canvas(bitmap); getDrawable().setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); getDrawable().draw(canvas); mBitmap = bitmap; } catch (OutOfMemoryError e) { mBitmap = null; } if (!mReady) { mSetupPending = true; return; } if (mBitmap == null) { return; } mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); mBitmapPaint.setAntiAlias(true); mBitmapPaint.setShader(mBitmapShader); mBorderPaint.setStyle(Paint.Style.STROKE); mBitmapPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mBorderPaint.setAntiAlias(true); mBorderPaint.setColor(mBorderColor); mBorderPaint.setStrokeWidth(mBorderWidth); mBitmapHeight = mBitmap.getHeight(); mBitmapWidth = mBitmap.getWidth(); mBorderRect.set(0, 0, getWidth(), getHeight()); mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2); mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth); mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2); updateShaderMatrix(); invalidate(); }
<DeepExtract> if (getDrawable() == null) { mBitmap = null; } if (getDrawable() instanceof BitmapDrawable) { mBitmap = ((BitmapDrawable) getDrawable()).getBitmap(); } try { Bitmap bitmap; if (getDrawable() instanceof ColorDrawable) { bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG); } else { bitmap = Bitmap.createBitmap(getDrawable().getIntrinsicWidth(), getDrawable().getIntrinsicHeight(), BITMAP_CONFIG); } Canvas canvas = new Canvas(bitmap); getDrawable().setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); getDrawable().draw(canvas); mBitmap = bitmap; } catch (OutOfMemoryError e) { mBitmap = null; } </DeepExtract> <DeepExtract> if (!mReady) { mSetupPending = true; return; } if (mBitmap == null) { return; } mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); mBitmapPaint.setAntiAlias(true); mBitmapPaint.setShader(mBitmapShader); mBorderPaint.setStyle(Paint.Style.STROKE); mBitmapPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mBorderPaint.setAntiAlias(true); mBorderPaint.setColor(mBorderColor); mBorderPaint.setStrokeWidth(mBorderWidth); mBitmapHeight = mBitmap.getHeight(); mBitmapWidth = mBitmap.getWidth(); mBorderRect.set(0, 0, getWidth(), getHeight()); mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2); mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth); mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2); updateShaderMatrix(); invalidate(); </DeepExtract>
nicehair
positive
private synchronized void buildEntityManagerFactory() { if (entityManagerFactory != null) { return; } if (registeredShutdownHook) { return; } registeredShutdownHook = true; Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { this.shutDown(); } }); Map<String, Object> configOverrides = new HashMap<String, Object>(); String dbPath = dbDirectory.getAbsolutePath(); configOverrides.put("hibernate.search.default.indexBase", dbPath); configOverrides.put("hibernate.connection.url", "jdbc:h2:" + dbPath + File.separator + "db" + ";LOCK_MODE=1" + ";DB_CLOSE_DELAY=-1"); entityManagerFactory = Persistence.createEntityManagerFactory("manager", configOverrides); }
<DeepExtract> if (registeredShutdownHook) { return; } registeredShutdownHook = true; Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { this.shutDown(); } }); </DeepExtract>
crushpaper
positive
@Override public boolean getAutoCommit() throws SQLException { if (isClosed) throw new SQLException("The connection is closed"); if (xaConnection == null) throw new SQLException("The connection is invalid"); return xaConnection.getConnection().getAutoCommit(); }
<DeepExtract> if (isClosed) throw new SQLException("The connection is closed"); if (xaConnection == null) throw new SQLException("The connection is invalid"); </DeepExtract>
kumuluzee
positive
@Override public void run() { if (rootView != null) { Snackbar.make(rootView, R.string.error_snackbar_message, Snackbar.LENGTH_LONG).setActionTextColor(Color.YELLOW).setAction(R.string.error_snackbar_action, new View.OnClickListener() { @Override public void onClick(View v) { ActivityCommunicator ac = ActivityCommunicator.getCommunicator(); ac.returnActivity = returnAcitivty; Intent intent = new Intent(context, ErrorActivity.class); intent.putExtra(ERROR_INFO, errorInfo); intent.putExtra(ERROR_LIST, elToSl(el)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }).show(); } else { ActivityCommunicator ac = ActivityCommunicator.getCommunicator(); ac.returnActivity = returnAcitivty; Intent intent = new Intent(context, ErrorActivity.class); intent.putExtra(ERROR_INFO, errorInfo); intent.putExtra(ERROR_LIST, elToSl(el)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }
<DeepExtract> if (rootView != null) { Snackbar.make(rootView, R.string.error_snackbar_message, Snackbar.LENGTH_LONG).setActionTextColor(Color.YELLOW).setAction(R.string.error_snackbar_action, new View.OnClickListener() { @Override public void onClick(View v) { ActivityCommunicator ac = ActivityCommunicator.getCommunicator(); ac.returnActivity = returnAcitivty; Intent intent = new Intent(context, ErrorActivity.class); intent.putExtra(ERROR_INFO, errorInfo); intent.putExtra(ERROR_LIST, elToSl(el)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }).show(); } else { ActivityCommunicator ac = ActivityCommunicator.getCommunicator(); ac.returnActivity = returnAcitivty; Intent intent = new Intent(context, ErrorActivity.class); intent.putExtra(ERROR_INFO, errorInfo); intent.putExtra(ERROR_LIST, elToSl(el)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } </DeepExtract>
Float-Tube
positive
public EventDecorator getDisconnectEvent(final QueryDisconnectEvent event, int[] colorPalette) { return new EventDecorator(event.message); }
<DeepExtract> return new EventDecorator(event.message); </DeepExtract>
HoloIRC
positive
public Criteria andMoneyIsNotNull() { if ("money is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("money is not null")); return (Criteria) this; }
<DeepExtract> if ("money is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("money is not null")); </DeepExtract>
garbage-collection
positive
void initFromCameraParameters(Camera paramCamera) { Camera.Parameters localParameters = paramCamera.getParameters(); return this.previewFormat; this.previewFormatString = localParameters.get("preview-format"); Log.d(TAG, "Default preview format: " + this.previewFormat + '/' + this.previewFormatString); Display localDisplay = ((WindowManager) this.context.getSystemService("window")).getDefaultDisplay(); this.screenResolution = new Point(localDisplay.getWidth(), localDisplay.getHeight()); Log.d(TAG, "Screen resolution: " + this.screenResolution); String str = localParameters.get("preview-size-values"); if (str == null) str = localParameters.get("preview-size-value"); Point localPoint = null; if (str != null) { Log.d(TAG, "preview-size-values parameter: " + str); localPoint = findBestPreviewSizeValue(str, this.screenResolution); } if (localPoint == null) localPoint = new Point(this.screenResolution.x >> 3 << 3, this.screenResolution.y >> 3 << 3); return localPoint; Log.d(TAG, "Camera resolution: " + this.screenResolution); }
<DeepExtract> return this.previewFormat; </DeepExtract> <DeepExtract> String str = localParameters.get("preview-size-values"); if (str == null) str = localParameters.get("preview-size-value"); Point localPoint = null; if (str != null) { Log.d(TAG, "preview-size-values parameter: " + str); localPoint = findBestPreviewSizeValue(str, this.screenResolution); } if (localPoint == null) localPoint = new Point(this.screenResolution.x >> 3 << 3, this.screenResolution.y >> 3 << 3); return localPoint; </DeepExtract>
deviceShow
positive
@Test public void shouldFindAValueTowardsTargetWithDomainAcrossZeroMarker() { assertThatFor(integers().from(-4000).upToAndIncluding(4000)).check(i -> i <= -3900); assertTrue("Expected to be greater than " + -3900 + ", but received " + smallestValueFound(), smallestValueFound() > -3900); }
<DeepExtract> assertTrue("Expected to be greater than " + -3900 + ", but received " + smallestValueFound(), smallestValueFound() > -3900); </DeepExtract>
QuickTheories
positive
public int submit(T item) { Objects.requireNonNull(item); int lag = 0; boolean complete, unowned; ReentrantLock lock = this.lock; lock.lock(); try { Thread t = Thread.currentThread(), o; BufferedSubscription<T> b = clients; if ((unowned = ((o = owner) != t)) && o != null) owner = null; if (b == null) complete = closed; else { complete = false; boolean cleanMe = false; BufferedSubscription<T> retries = null, rtail = null, next; do { next = b.next; int stat = b.offer(item, unowned); if (stat == 0) { b.nextRetry = null; if (rtail == null) retries = b; else rtail.nextRetry = b; rtail = b; } else if (stat < 0) cleanMe = true; else if (stat > lag) lag = stat; } while ((b = next) != null); if (retries != null || cleanMe) lag = retryOffer(item, Long.MAX_VALUE, null, retries, lag, cleanMe); } } finally { lock.unlock(); } if (complete) throw new IllegalStateException("Closed"); else return lag; }
<DeepExtract> Objects.requireNonNull(item); int lag = 0; boolean complete, unowned; ReentrantLock lock = this.lock; lock.lock(); try { Thread t = Thread.currentThread(), o; BufferedSubscription<T> b = clients; if ((unowned = ((o = owner) != t)) && o != null) owner = null; if (b == null) complete = closed; else { complete = false; boolean cleanMe = false; BufferedSubscription<T> retries = null, rtail = null, next; do { next = b.next; int stat = b.offer(item, unowned); if (stat == 0) { b.nextRetry = null; if (rtail == null) retries = b; else rtail.nextRetry = b; rtail = b; } else if (stat < 0) cleanMe = true; else if (stat > lag) lag = stat; } while ((b = next) != null); if (retries != null || cleanMe) lag = retryOffer(item, Long.MAX_VALUE, null, retries, lag, cleanMe); } } finally { lock.unlock(); } if (complete) throw new IllegalStateException("Closed"); else return lag; </DeepExtract>
java9-concurrent-backport
positive
public void init(Context context) { this.context = context; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { AudioAttributes attributes = new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE).setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build(); soundPool = new SoundPool.Builder().setAudioAttributes(attributes).setMaxStreams(1).build(); } else { soundPool = new SoundPool(1, AudioManager.MODE_RINGTONE, 0); } audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); EMClient.getInstance().callManager().getCallOptions().setIsSendPushIfOffline(true); EMClient.getInstance().callManager().getCallOptions().setEnableExternalVideoData(false); EMClient.getInstance().callManager().getCallOptions().enableFixedVideoResolution(true); EMClient.getInstance().callManager().getCallOptions().setMaxVideoKbps(800); EMClient.getInstance().callManager().getCallOptions().setMinVideoKbps(150); EMClient.getInstance().callManager().getCallOptions().setVideoResolution(640, 480); EMClient.getInstance().callManager().getCallOptions().setMaxVideoFrameRate(30); EMClient.getInstance().callManager().getCallOptions().setAudioSampleRate(48000); EMClient.getInstance().callManager().getVideoCallHelper().setPreferMovFormatEnable(true); }
<DeepExtract> if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { AudioAttributes attributes = new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE).setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build(); soundPool = new SoundPool.Builder().setAudioAttributes(attributes).setMaxStreams(1).build(); } else { soundPool = new SoundPool(1, AudioManager.MODE_RINGTONE, 0); } </DeepExtract>
VMChat
positive
public void onCreateRouter(ActionEvent event) { txtRouterPackage.setDisable(!chkCreateRouter.isSelected()); txtRouterName.setDisable(!chkCreateRouter.isSelected()); }
<DeepExtract> txtRouterPackage.setDisable(!chkCreateRouter.isSelected()); txtRouterName.setDisable(!chkCreateRouter.isSelected()); </DeepExtract>
vertx-generator
positive
public CVPipelineSettings getCurrentPipelineSettings() { if (currentPipelineIndex < 0) { switch(currentPipelineIndex) { case DRIVERMODE_INDEX: return driverModePipeline.getSettings(); case CAL_3D_INDEX: return calibration3dPipeline.getSettings(); } } for (var setting : userPipelineSettings) { if (setting.pipelineIndex == currentPipelineIndex) return setting; } return null; }
<DeepExtract> if (currentPipelineIndex < 0) { switch(currentPipelineIndex) { case DRIVERMODE_INDEX: return driverModePipeline.getSettings(); case CAL_3D_INDEX: return calibration3dPipeline.getSettings(); } } for (var setting : userPipelineSettings) { if (setting.pipelineIndex == currentPipelineIndex) return setting; } return null; </DeepExtract>
photonvision
positive
public static void main(String[] args) { Date date1 = new Date(18, 05, 1992); Date date2 = new Date(07, 03, 2019); int date1Days = date1.convertToDays(); int date2Days = date2.convertToDays(); int difference = Math.abs(date1Days - date2Days); System.out.println("------------------------------------------------------------"); System.out.println("There are " + difference + " days between " + date1.printDate() + " and " + date2.printDate() + "."); System.out.println("------------------------------------------------------------"); }
<DeepExtract> int date1Days = date1.convertToDays(); int date2Days = date2.convertToDays(); int difference = Math.abs(date1Days - date2Days); System.out.println("------------------------------------------------------------"); System.out.println("There are " + difference + " days between " + date1.printDate() + " and " + date2.printDate() + "."); System.out.println("------------------------------------------------------------"); </DeepExtract>
PGR-103-2020
positive
void importDocument(BlockContainer asciidocFile) { Document document = asciidoctor.loadFile(file, parameters); for (Object o : document.getBlocks()) { if (o instanceof StructuralNode) { StructuralNode block = (StructuralNode) o; if (block instanceof ListItem) continue; try { AsciidocBlockDescriptor blockDescriptor = scanOneBlock(block); asciidocFile.getAsciidocBlocks().add(blockDescriptor); scanBlocks(block.getBlocks(), blockDescriptor); } catch (Exception e) { LOGGER.warn("Error while scanning Asciidoc block " + block.getNodeName() + "; reason is: " + e, e); } } } }
<DeepExtract> for (Object o : document.getBlocks()) { if (o instanceof StructuralNode) { StructuralNode block = (StructuralNode) o; if (block instanceof ListItem) continue; try { AsciidocBlockDescriptor blockDescriptor = scanOneBlock(block); asciidocFile.getAsciidocBlocks().add(blockDescriptor); scanBlocks(block.getBlocks(), blockDescriptor); } catch (Exception e) { LOGGER.warn("Error while scanning Asciidoc block " + block.getNodeName() + "; reason is: " + e, e); } } } </DeepExtract>
jqassistant-plugins
positive
protected boolean lowLevelFastqRead(Text key, SequencedFragment value) throws IOException { long skipped = lineReader.skip(1); pos += skipped; if (skipped == 0) return false; int bytesRead = lineReader.readLine(key, MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; value.clear(); int bytesRead = lineReader.readLine(value.getSequence(), MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; int bytesRead = lineReader.readLine(buffer, MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; if (buffer.getLength() == 0 || buffer.getBytes()[0] != '+') throw new RuntimeException("unexpected fastq line separating sequence and quality at " + makePositionMessage() + ". Line: " + buffer + ". \nSequence ID: " + key); int bytesRead = lineReader.readLine(value.getQuality(), MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; lookForIlluminaIdentifier = lookForIlluminaIdentifier && scanIlluminaId(key, value); if (!lookForIlluminaIdentifier) scanNameForReadNumber(key, value); return true; }
<DeepExtract> int bytesRead = lineReader.readLine(key, MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; </DeepExtract> <DeepExtract> int bytesRead = lineReader.readLine(value.getSequence(), MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; </DeepExtract> <DeepExtract> int bytesRead = lineReader.readLine(buffer, MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; </DeepExtract> <DeepExtract> int bytesRead = lineReader.readLine(value.getQuality(), MAX_LINE_LENGTH); if (bytesRead <= 0) throw new EOFException(); pos += bytesRead; return bytesRead; </DeepExtract>
Hadoop-BAM
positive
void button_load_clicked() { FileDialog dialog = new FileDialog(new Frame(), "Load", FileDialog.LOAD); dialog.setVisible(true); String filename = dialog.getDirectory() + dialog.getFile(); if (filename == null) return; point_list.removeAllElements(); if (buffer != null) { buffer_gc.setColor(colors[0]); buffer_gc.fillRect(0, 0, XLEN, YLEN); } repaint(); try { BufferedReader fp = new BufferedReader(new FileReader(filename)); String line; while ((line = fp.readLine()) != null) { StringTokenizer st = new StringTokenizer(line, " \t\n\r\f:"); if (st.countTokens() == 5) { byte value = (byte) atoi(st.nextToken()); st.nextToken(); double x = atof(st.nextToken()); st.nextToken(); double y = atof(st.nextToken()); point_list.addElement(new point(x, y, value)); } else if (st.countTokens() == 3) { double y = atof(st.nextToken()); st.nextToken(); double x = atof(st.nextToken()); point_list.addElement(new point(x, y, current_value)); } else break; } fp.close(); } catch (IOException e) { System.err.print(e); } int n = point_list.size(); for (int i = 0; i < n; i++) draw_point(point_list.elementAt(i)); }
<DeepExtract> point_list.removeAllElements(); if (buffer != null) { buffer_gc.setColor(colors[0]); buffer_gc.fillRect(0, 0, XLEN, YLEN); } repaint(); </DeepExtract> <DeepExtract> int n = point_list.size(); for (int i = 0; i < n; i++) draw_point(point_list.elementAt(i)); </DeepExtract>
wasindoor
positive
@Test public void unpooled() throws IOException { ByteArrayPool pool = new ByteArrayPool(0); byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); }
<DeepExtract> byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); </DeepExtract> <DeepExtract> byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); </DeepExtract> <DeepExtract> byte[] data = new byte[16384]; for (int i = 0; i < data.length; i++) { data[i] = (byte) (i & 0xff); } PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool); os.write(data); assertTrue(Arrays.equals(data, os.toByteArray())); </DeepExtract>
mvp-android-framework
positive
public PageAssertion withElement(String elementId, ElementAttributeAssertion elementAttrAssertion) { HtmlElement htmlElement = ((HtmlPage) page).getElementById(elementId); assertEquals(expected, htmlElement.getTextContent()); return this; }
<DeepExtract> assertEquals(expected, htmlElement.getTextContent()); </DeepExtract>
mojave
positive
@Test public void testGetRegistries_remote() throws Exception { ZookeeperRegistryClient reader = new ZookeeperRegistryClient(client, objectMapper, config); CountDownLatch latch = new CountDownLatch(1); InetSocketAddress addr = new InetSocketAddress(1234); if (true) { reader.addListener(entry -> { if (entry.gondolaAddress.equals(addr)) { latch.countDown(); } }); } String hostId = registryClient.register(SITE_1_HOST_3_CLUSTERS, addr, URI.create("https://api1.yahoo.com:4443")); if (true) { latch.await(); } List<RegistryClient.Entry> writerEntries = registryClient.getEntries().entrySet().stream().map(Map.Entry::getValue).filter(e -> e.hostId.equals(hostId)).collect(Collectors.toList()); assertEquals(writerEntries.size(), 1); Map<String, RegistryClient.Entry> readerEntries = reader.getEntries(); assertEquals(readerEntries.size(), 1); for (RegistryClient.Entry e : writerEntries) { RegistryClient.Entry readerEntry = readerEntries.get(e.hostId); assertEquals(readerEntry.hostId, e.hostId); assertEquals(readerEntry.gondolaAddress, e.gondolaAddress); } }
<DeepExtract> CountDownLatch latch = new CountDownLatch(1); InetSocketAddress addr = new InetSocketAddress(1234); if (true) { reader.addListener(entry -> { if (entry.gondolaAddress.equals(addr)) { latch.countDown(); } }); } String hostId = registryClient.register(SITE_1_HOST_3_CLUSTERS, addr, URI.create("https://api1.yahoo.com:4443")); if (true) { latch.await(); } List<RegistryClient.Entry> writerEntries = registryClient.getEntries().entrySet().stream().map(Map.Entry::getValue).filter(e -> e.hostId.equals(hostId)).collect(Collectors.toList()); assertEquals(writerEntries.size(), 1); Map<String, RegistryClient.Entry> readerEntries = reader.getEntries(); assertEquals(readerEntries.size(), 1); for (RegistryClient.Entry e : writerEntries) { RegistryClient.Entry readerEntry = readerEntries.get(e.hostId); assertEquals(readerEntry.hostId, e.hostId); assertEquals(readerEntry.gondolaAddress, e.gondolaAddress); } </DeepExtract>
gondola
positive
public Criteria andPhoneLessThanOrEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "phone" + " cannot be null"); } criteria.add(new Criterion("phone <=", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "phone" + " cannot be null"); } criteria.add(new Criterion("phone <=", value)); </DeepExtract>
ssmBillBook
positive
private void addTextTab(final int position, String title) { TextView tab = new TextView(getContext()); tab.setText(title); tab.setGravity(Gravity.CENTER); tab.setSingleLine(); tab.setFocusable(true); tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); } }); tab.setPadding(tabPadding, 0, tabPadding, 0); tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
<DeepExtract> tab.setFocusable(true); tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); } }); tab.setPadding(tabPadding, 0, tabPadding, 0); tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); </DeepExtract>
zReader-mupdf
positive
protected OkRequest<T> writePartHeader(final String name, final String filename, final String contentType) throws IOException { final StringBuilder partBuffer = new StringBuilder(); partBuffer.append("form-data; name=\"").append(name); if (filename != null) { partBuffer.append("\"; filename=\"").append(filename); } partBuffer.append('"'); return send("Content-Disposition").send(": ").send(partBuffer.toString()).send(CRLF); if (contentType != null) { partHeader(HEADER_CONTENT_TYPE, contentType); } final InputStream stream; stream = new BufferedInputStream(new FileInputStream(CRLF)); return send(stream); }
<DeepExtract> return send("Content-Disposition").send(": ").send(partBuffer.toString()).send(CRLF); </DeepExtract> <DeepExtract> final InputStream stream; stream = new BufferedInputStream(new FileInputStream(CRLF)); return send(stream); </DeepExtract>
AppKit
positive
public Criteria andHttpInterfaceRequestMethodIsNull() { if ("http_interface_request_method is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("http_interface_request_method is null")); return (Criteria) this; }
<DeepExtract> if ("http_interface_request_method is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("http_interface_request_method is null")); </DeepExtract>
AnyMock
positive
public static boolean yidongMatch(String phone) { CommonPool<Pattern> pool = factory.build(PhoneOperatorEnum.YIDONG); Pattern pattern = null; try { pattern = pool.borrow(); return pattern.matcher(phone).matches(); } finally { pool.returnObj(pattern); } }
<DeepExtract> CommonPool<Pattern> pool = factory.build(PhoneOperatorEnum.YIDONG); Pattern pattern = null; try { pattern = pool.borrow(); return pattern.matcher(phone).matches(); } finally { pool.returnObj(pattern); } </DeepExtract>
SMS-Sender
positive
public static void polygon(double[] x, double[] y) { if (x == null) throw new IllegalArgumentException("x-coordinate array is null"); if (y == null) throw new IllegalArgumentException("y-coordinate array is null"); int n1 = x.length; int n2 = y.length; if (n1 != n2) throw new IllegalArgumentException("arrays must be of the same length"); int n = n1; if (n == 0) return; GeneralPath path = new GeneralPath(); path.moveTo((float) scaleX(x[0]), (float) scaleY(y[0])); for (int i = 0; i < n; i++) path.lineTo((float) scaleX(x[i]), (float) scaleY(y[i])); path.closePath(); offscreen.draw(path); if (!defer) show(); }
<DeepExtract> if (!defer) show(); </DeepExtract>
CS61B-Spring-2018
positive
@Test public void contextLoads1UsingSystemProperty() { System.setProperty("spring.config.class", "com.example.Config"); Context context = Mockito.mock(Context.class); LambdaLogger logger = Mockito.mock(LambdaLogger.class); when(context.getLogger()).thenReturn(logger); ApplicationLambdaEntry lambdaEntry = new ApplicationLambdaEntry(); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); }
<DeepExtract> Context context = Mockito.mock(Context.class); LambdaLogger logger = Mockito.mock(LambdaLogger.class); when(context.getLogger()).thenReturn(logger); ApplicationLambdaEntry lambdaEntry = new ApplicationLambdaEntry(); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); assertEquals("Invocation #" + testInvocationNumber++, lambdaEntry.handleRequest(null, context)); </DeepExtract>
spring-teaching-demos
positive
public boolean isEqual(Tree T2) { if (root == null && T2.root == null) return true; else if (root == null || T2.root == null) return false; else return (isEqualUtil(root.left, T2.root.left) && isEqualUtil(root.right, T2.root.right) && (root.value == T2.root.value)); }
<DeepExtract> if (root == null && T2.root == null) return true; else if (root == null || T2.root == null) return false; else return (isEqualUtil(root.left, T2.root.left) && isEqualUtil(root.right, T2.root.right) && (root.value == T2.root.value)); </DeepExtract>
Problem-Solving-in-Data-Structures-Algorithms-using-Java
positive
public synchronized Quad[] searchPage(int pageNum, String text) { if (pageNum > pageCount - 1) pageNum = pageCount - 1; else if (pageNum < 0) pageNum = 0; if (pageNum != currentPage) { currentPage = pageNum; if (page != null) page.destroy(); page = null; if (displayList != null) displayList.destroy(); displayList = null; page = doc.loadPage(pageNum); Rect b = page.getBounds(); pageWidth = b.x1 - b.x0; pageHeight = b.y1 - b.y0; } return page.search(text); }
<DeepExtract> if (pageNum > pageCount - 1) pageNum = pageCount - 1; else if (pageNum < 0) pageNum = 0; if (pageNum != currentPage) { currentPage = pageNum; if (page != null) page.destroy(); page = null; if (displayList != null) displayList.destroy(); displayList = null; page = doc.loadPage(pageNum); Rect b = page.getBounds(); pageWidth = b.x1 - b.x0; pageHeight = b.y1 - b.y0; } </DeepExtract>
MuPdfSo
positive
@Test public void testFrameNewElementsIterator() { Iterator<? extends ComputerVertex> framed = graph.frame(Arrays.asList(dev6, dev7).iterator(), ComputerVertex.class); Assert.assertNotNull(framed); Assert.assertTrue(framed.hasNext()); Assert.assertEquals(dev6Name, framed.next().getName()); Assert.assertTrue(framed.hasNext()); Assert.assertEquals(dev7Name, framed.next().getName()); Assert.assertFalse(framed.hasNext()); }
<DeepExtract> Assert.assertNotNull(framed); Assert.assertTrue(framed.hasNext()); Assert.assertEquals(dev6Name, framed.next().getName()); Assert.assertTrue(framed.hasNext()); Assert.assertEquals(dev7Name, framed.next().getName()); Assert.assertFalse(framed.hasNext()); </DeepExtract>
Ferma
positive
@Override public void init() { pelletTimer = Timing.sec(6 * 0.5f); pelletDisplay = PelletDisplay.SIMPLE; guys().forEach(Lifecycle::init); pacMan.tf.vx = -0.55f; pacMan.moveDir = Direction.LEFT; pacMan.ai.setState(PacManState.AWAKE); ghosts().forEach(ghost -> { ghost.moveDir = Direction.LEFT; ghost.tf.setVelocity(-0.55f, 0); ghost.ai.setState(GhostState.CHASING); ghost.ai.state(GhostState.CHASING).removeTimer(); }); int size = 2 * Tile.TS; int x = world.width() * Tile.TS; Ghost[] ghosts = Stream.of(blinky, inky, pinky, clyde).toArray(Ghost[]::new); for (int i = 0; i < ghosts.length; ++i) { ghosts[i].tf.setPosition(x, tf.y); x -= size; } pacMan.tf.setPosition(x, tf.y); }
<DeepExtract> int size = 2 * Tile.TS; int x = world.width() * Tile.TS; Ghost[] ghosts = Stream.of(blinky, inky, pinky, clyde).toArray(Ghost[]::new); for (int i = 0; i < ghosts.length; ++i) { ghosts[i].tf.setPosition(x, tf.y); x -= size; } pacMan.tf.setPosition(x, tf.y); </DeepExtract>
pacman
positive
public int solution(String[] lines) { int answer = 0; int[] startTimes = new int[lines.length]; int[] endTimes = new int[lines.length]; for (int i = 0; i < lines.length; i++) { String[] log = lines[i].split(" "); String[] responseTime = log[1].split(":"); int processingTime = (int) (Double.parseDouble(log[2].substring(0, log[2].length() - 1)) * 1000); int startTime = 0; int endTime = 0; endTime += Integer.parseInt(responseTime[0]) * 60 * 60 * 1000; endTime += Integer.parseInt(responseTime[1]) * 60 * 1000; endTime += (int) (Double.parseDouble(responseTime[2]) * 1000); startTime = endTime - processingTime + 1; startTimes[i] = startTime; endTimes[i] = endTime; } for (int i = 0; i < lines.length; i++) { int cnt = 0; int startOfSection = startTimes[i]; int endOfSection = startOfSection + 1000; answer = getAnswer(lines, answer, startTimes, endTimes, cnt, startOfSection, endOfSection); cnt = 0; startOfSection = endTimes[i]; endOfSection = startOfSection + 1000; answer = getAnswer(lines, answer, startTimes, endTimes, cnt, startOfSection, endOfSection); } return answer; }
<DeepExtract> for (int i = 0; i < lines.length; i++) { String[] log = lines[i].split(" "); String[] responseTime = log[1].split(":"); int processingTime = (int) (Double.parseDouble(log[2].substring(0, log[2].length() - 1)) * 1000); int startTime = 0; int endTime = 0; endTime += Integer.parseInt(responseTime[0]) * 60 * 60 * 1000; endTime += Integer.parseInt(responseTime[1]) * 60 * 1000; endTime += (int) (Double.parseDouble(responseTime[2]) * 1000); startTime = endTime - processingTime + 1; startTimes[i] = startTime; endTimes[i] = endTime; } </DeepExtract>
algorithm-study
positive
public void discoverSearch(final UploadSearchParams uploadSearchParams) { if (uploadSearchParams == null) return; SessionManager sessionManager = visenzeAnalytics.getSessionManager(); DataCollection dataCollection = visenzeAnalytics.getDataCollection(); if (uploadSearchParams.getUid() == null) { uploadSearchParams.setUid(sessionManager.getUid()); } if (uploadSearchParams.getSid() == null) { uploadSearchParams.setSid(sessionManager.getSessionId()); } if (uploadSearchParams.getAppId() == null) { uploadSearchParams.setAppId(dataCollection.getAppId()); } if (uploadSearchParams.getAppName() == null) { uploadSearchParams.setAppName(dataCollection.getAppName()); } if (uploadSearchParams.getAppVersion() == null) { uploadSearchParams.setAppVersion(dataCollection.getAppVersion()); } if (uploadSearchParams.getDeviceBrand() == null) { uploadSearchParams.setDeviceBrand(dataCollection.getDeviceBrand()); } if (uploadSearchParams.getDeviceModel() == null) { uploadSearchParams.setDeviceModel(dataCollection.getDeviceModel()); } if (uploadSearchParams.getLanguage() == null) { uploadSearchParams.setLanguage(dataCollection.getLanguage()); } if (uploadSearchParams.getOs() == null) { uploadSearchParams.setOs(dataCollection.getOs()); } if (uploadSearchParams.getOsv() == null) { uploadSearchParams.setOsv(dataCollection.getOsv()); } if (uploadSearchParams.getPlatform() == null) { uploadSearchParams.setPlatform(dataCollection.getPlatform()); } try { searchOperations.discoverSearch(uploadSearchParams, mListener); } catch (ViSearchException e) { Log.e("ViSearch SDK", e.getMessage()); } }
<DeepExtract> if (uploadSearchParams == null) return; SessionManager sessionManager = visenzeAnalytics.getSessionManager(); DataCollection dataCollection = visenzeAnalytics.getDataCollection(); if (uploadSearchParams.getUid() == null) { uploadSearchParams.setUid(sessionManager.getUid()); } if (uploadSearchParams.getSid() == null) { uploadSearchParams.setSid(sessionManager.getSessionId()); } if (uploadSearchParams.getAppId() == null) { uploadSearchParams.setAppId(dataCollection.getAppId()); } if (uploadSearchParams.getAppName() == null) { uploadSearchParams.setAppName(dataCollection.getAppName()); } if (uploadSearchParams.getAppVersion() == null) { uploadSearchParams.setAppVersion(dataCollection.getAppVersion()); } if (uploadSearchParams.getDeviceBrand() == null) { uploadSearchParams.setDeviceBrand(dataCollection.getDeviceBrand()); } if (uploadSearchParams.getDeviceModel() == null) { uploadSearchParams.setDeviceModel(dataCollection.getDeviceModel()); } if (uploadSearchParams.getLanguage() == null) { uploadSearchParams.setLanguage(dataCollection.getLanguage()); } if (uploadSearchParams.getOs() == null) { uploadSearchParams.setOs(dataCollection.getOs()); } if (uploadSearchParams.getOsv() == null) { uploadSearchParams.setOsv(dataCollection.getOsv()); } if (uploadSearchParams.getPlatform() == null) { uploadSearchParams.setPlatform(dataCollection.getPlatform()); } </DeepExtract>
visearch-sdk-android
positive
private static boolean match(Object o1, Object o2) { if (o1 == null) { return (o2 == null); } if (o2 == null || !(o2 instanceof XMLAttribute)) { return false; } XMLAttribute other = (XMLAttribute) o2; return match(_name, other._name) && match(_value, other._value) && match(_next, other._next); }
<DeepExtract> if (o2 == null || !(o2 instanceof XMLAttribute)) { return false; } XMLAttribute other = (XMLAttribute) o2; return match(_name, other._name) && match(_value, other._value) && match(_next, other._next); </DeepExtract>
webstart
positive
public void add(double label, double prediction) { if (!examples.containsKey(prediction)) { examples.put(prediction, label); } else { int[] oldVals = examples.get(prediction); oldVals[0] += label[0]; oldVals[1] += label[1]; examples.put(prediction, oldVals); } }
<DeepExtract> if (!examples.containsKey(prediction)) { examples.put(prediction, label); } else { int[] oldVals = examples.get(prediction); oldVals[0] += label[0]; oldVals[1] += label[1]; examples.put(prediction, oldVals); } </DeepExtract>
Conjecture
positive
public void read(org.apache.thrift7.protocol.TProtocol iprot) throws org.apache.thrift7.TException { iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == org.apache.thrift7.protocol.TType.STOP) { break; } switch(field.id) { case 0: if (field.type == org.apache.thrift7.protocol.TType.I64) { this.success = iprot.readI64(); set_success_isSet(true); } else { org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type); } break; default: org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); }
<DeepExtract> </DeepExtract>
storm-scribe
positive
public void registerPlayerListener(PodAdddictPlayerListener listener) { if (mIsClosed) { throw new IllegalStateException("Client instance can't be used after being closed."); } mPodAdddictPlayerListeners.add(listener); if (mState == STATE_PLAYING) { listener.onPlayerPlay(mPlayerPlaylist.getCurrentTrack(), mPlayerPlaylist.getCurrentTrackIndex()); } else if (mState == STATE_PAUSED) { listener.onPlayerPause(); } }
<DeepExtract> if (mIsClosed) { throw new IllegalStateException("Client instance can't be used after being closed."); } </DeepExtract>
pod-adddict
positive
protected ApplicationComponent getApplicationComponent() { return component; }
<DeepExtract> return component; </DeepExtract>
Flashcards
positive