before
stringlengths
33
3.21M
after
stringlengths
63
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
public PageBean<SmProductEntity> getProductByCriteria(ProductCriteriaBo criteria) throws Exception { TbkDgMaterialOptionalRequest request = new TbkDgMaterialOptionalRequest(); request.setMaterialId(6707L); request.setAdzoneId(110173550272L); request.setPageNo(criteria.getPageNum().longValue()); request.setPageSize(criteria.getPageSize().longValue()); request.setCat(criteria.getOptionId()); request.setQ(criteria.getKeyword()); request.setSort(criteria.getOrderBy(PlatformTypeConstant.TB) == null ? null : criteria.getOrderBy(PlatformTypeConstant.TB).toString()); request.setStartPrice(criteria.getMinPrice() == null ? null : criteria.getMinPrice().longValue()); request.setEndPrice(criteria.getMaxPrice() == null ? null : criteria.getMaxPrice().longValue()); request.setHasCoupon(criteria.getHasCoupon()); request.setNeedFreeShipment(criteria.getParcels()); request.setIsTmall(criteria.getIsTmall()); request.setItemloc(criteria.getLocation()); request.setIp(criteria.getIp()); request.setDeviceType("IMEI"); request.setDeviceEncrypt("MD5"); request.setDeviceValue(MD5.md5(criteria.getUserId().toString(), "")); TbkDgMaterialOptionalResponse response = myTaobaoClient.execute(request); List<SmProductEntity> smProductEntities = response.getResultList().stream().map(o -> convertGoodsList(o)).collect(Collectors.toList()); return packageToPageBean(smProductEntities, response.getTotalResults().intValue(), criteria.getPageNum(), criteria.getPageSize()); }
public PageBean<SmProductEntity> getProductByCriteria(ProductCriteriaBo criteria) throws Exception { <DeepExtract> TbkDgMaterialOptionalRequest request = new TbkDgMaterialOptionalRequest(); request.setMaterialId(6707L); request.setAdzoneId(110173550272L); request.setPageNo(criteria.getPageNum().longValue()); request.setPageSize(criteria.getPageSize().longValue()); request.setCat(criteria.getOptionId()); request.setQ(criteria.getKeyword()); request.setSort(criteria.getOrderBy(PlatformTypeConstant.TB) == null ? null : criteria.getOrderBy(PlatformTypeConstant.TB).toString()); request.setStartPrice(criteria.getMinPrice() == null ? null : criteria.getMinPrice().longValue()); request.setEndPrice(criteria.getMaxPrice() == null ? null : criteria.getMaxPrice().longValue()); request.setHasCoupon(criteria.getHasCoupon()); request.setNeedFreeShipment(criteria.getParcels()); request.setIsTmall(criteria.getIsTmall()); request.setItemloc(criteria.getLocation()); request.setIp(criteria.getIp()); request.setDeviceType("IMEI"); request.setDeviceEncrypt("MD5"); request.setDeviceValue(MD5.md5(criteria.getUserId().toString(), "")); TbkDgMaterialOptionalResponse response = myTaobaoClient.execute(request); List<SmProductEntity> smProductEntities = response.getResultList().stream().map(o -> convertGoodsList(o)).collect(Collectors.toList()); return packageToPageBean(smProductEntities, response.getTotalResults().intValue(), criteria.getPageNum(), criteria.getPageSize()); </DeepExtract> }
cps-mall
positive
1,854
@Override public void showBrightnessDialog(int brightnessPercent) { super.showBrightnessDialog(brightnessPercent); if (mBrightnessDialog == null) { View localView = LayoutInflater.from(jzvdContext).inflate(R.layout.jz_dialog_brightness, null); mDialogBrightnessTextView = localView.findViewById(R.id.tv_brightness); mDialogBrightnessProgressBar = localView.findViewById(R.id.brightness_progressbar); mBrightnessDialog = createDialogWithView(localView); } if (!mBrightnessDialog.isShowing()) { mBrightnessDialog.show(); } if (brightnessPercent > 100) { brightnessPercent = 100; } else if (brightnessPercent < 0) { brightnessPercent = 0; } mDialogBrightnessTextView.setText(brightnessPercent + "%"); mDialogBrightnessProgressBar.setProgress(brightnessPercent); if (state == STATE_PREPARING) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPreparing(); } else { } } else if (state == STATE_PLAYING) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPlayingClear(); } else { } } else if (state == STATE_PAUSE) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPauseClear(); } else { } } else if (state == STATE_AUTO_COMPLETE) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToComplete(); } else { } } }
@Override public void showBrightnessDialog(int brightnessPercent) { super.showBrightnessDialog(brightnessPercent); if (mBrightnessDialog == null) { View localView = LayoutInflater.from(jzvdContext).inflate(R.layout.jz_dialog_brightness, null); mDialogBrightnessTextView = localView.findViewById(R.id.tv_brightness); mDialogBrightnessProgressBar = localView.findViewById(R.id.brightness_progressbar); mBrightnessDialog = createDialogWithView(localView); } if (!mBrightnessDialog.isShowing()) { mBrightnessDialog.show(); } if (brightnessPercent > 100) { brightnessPercent = 100; } else if (brightnessPercent < 0) { brightnessPercent = 0; } mDialogBrightnessTextView.setText(brightnessPercent + "%"); mDialogBrightnessProgressBar.setProgress(brightnessPercent); <DeepExtract> if (state == STATE_PREPARING) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPreparing(); } else { } } else if (state == STATE_PLAYING) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPlayingClear(); } else { } } else if (state == STATE_PAUSE) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPauseClear(); } else { } } else if (state == STATE_AUTO_COMPLETE) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToComplete(); } else { } } </DeepExtract> }
JZVideo
positive
1,855
public static void main(String[] args) throws Exception { for (int i = 0; i < args.length; i++) { THE_LOGGER.info("***debug*** args[" + i + "]=" + args[i]); } final String outputPath = args[0]; final String numOfStudiesAsString = args[1]; final int K = Integer.parseInt(numOfStudiesAsString); List<String> inputPathMultipleStudies = new ArrayList<String>(); for (int i = 1; i <= K; i++) { String singleStudyInputPath = args[1 + i]; inputPathMultipleStudies.add(singleStudyInputPath); } boolean useYARN = true; JavaSparkContext context = Util.createJavaSparkContext(useYARN); int index = 0; JavaPairRDD<String, Double>[] means = new JavaPairRDD[inputPathMultipleStudies.size()]; for (String inputPathSingleStudy : inputPathMultipleStudies) { means[index] = computeMeanByGroupByKey(context, inputPathSingleStudy); index++; } JavaPairRDD<String, Long>[] ranks = new JavaPairRDD[means.length]; for (int i = 0; i < means.length; i++) { ranks[i] = assignRank(means[i]); } JavaPairRDD<String, Tuple2<Double, Integer>> rankedProducts = computeRankedProducts(context, ranks); deleteDirectoryAndIgnoreException(outputPath); rankedProducts.coalesce(1, true).saveAsTextFile(outputPath); context.close(); System.exit(0); }
public static void main(String[] args) throws Exception { for (int i = 0; i < args.length; i++) { THE_LOGGER.info("***debug*** args[" + i + "]=" + args[i]); } final String outputPath = args[0]; final String numOfStudiesAsString = args[1]; final int K = Integer.parseInt(numOfStudiesAsString); List<String> inputPathMultipleStudies = new ArrayList<String>(); for (int i = 1; i <= K; i++) { String singleStudyInputPath = args[1 + i]; inputPathMultipleStudies.add(singleStudyInputPath); } boolean useYARN = true; <DeepExtract> JavaSparkContext context = Util.createJavaSparkContext(useYARN); int index = 0; JavaPairRDD<String, Double>[] means = new JavaPairRDD[inputPathMultipleStudies.size()]; for (String inputPathSingleStudy : inputPathMultipleStudies) { means[index] = computeMeanByGroupByKey(context, inputPathSingleStudy); index++; } JavaPairRDD<String, Long>[] ranks = new JavaPairRDD[means.length]; for (int i = 0; i < means.length; i++) { ranks[i] = assignRank(means[i]); } JavaPairRDD<String, Tuple2<Double, Integer>> rankedProducts = computeRankedProducts(context, ranks); deleteDirectoryAndIgnoreException(outputPath); rankedProducts.coalesce(1, true).saveAsTextFile(outputPath); context.close(); </DeepExtract> System.exit(0); }
data-algorithms-book
positive
1,856
@Override public void onMarkerDragStart(Marker marker) { if (marker.equals(centerMarker)) { circle.setCenter(marker.getPosition()); radiusMarker.setPosition(toRadiusLatLng(marker.getPosition(), radiusMeters)); return true; } if (marker.equals(radiusMarker)) { radiusMeters = toRadiusMeters(centerMarker.getPosition(), radiusMarker.getPosition()); circle.setRadius(radiusMeters); return true; } return false; }
@Override public void onMarkerDragStart(Marker marker) { <DeepExtract> if (marker.equals(centerMarker)) { circle.setCenter(marker.getPosition()); radiusMarker.setPosition(toRadiusLatLng(marker.getPosition(), radiusMeters)); return true; } if (marker.equals(radiusMarker)) { radiusMeters = toRadiusMeters(centerMarker.getPosition(), radiusMarker.getPosition()); circle.setRadius(radiusMeters); return true; } return false; </DeepExtract> }
android-samples
positive
1,857
public void update() { _mouseWorldX = FlxG.mouse.x / B2FlxB.RATIO; _mouseWorldY = FlxG.mouse.y / B2FlxB.RATIO; if (_mouseJoint == null && FlxG.mouse.justPressed()) { _hitBody = null; _testPoint.set(_mouseWorldX, _mouseWorldY); B2FlxB.world.QueryAABB(getBodyCallback, _testPoint.x - 0.0001f, _testPoint.y - 0.0001f, _testPoint.x + 0.0001f, _testPoint.y + 0.0001f); if (_hitBody == _groundBody || _hitBody == null) return false; ObjectMap<String, Object> userData = (ObjectMap<String, Object>) _hitBody.getUserData(); if (userData == null) return false; if (_hitBody != null && _hitBody.getType() == BodyType.KinematicBody || !(Boolean) userData.get("draggable")) return false; if (_hitBody != null) { _mouseJointDef.bodyA = _groundBody; _mouseJointDef.bodyB = _hitBody; _mouseJointDef.collideConnected = true; _mouseJointDef.target.set(_testPoint.x, _testPoint.y); _mouseJointDef.maxForce = maxForce * _hitBody.getMass(); if (_mouseJoint == null) _mouseJoint = (MouseJoint) B2FlxB.world.createJoint(_mouseJointDef); _hitBody.setAwake(true); userData.put("mouseJoint", this); _removeBySchedule = false; return true; } } return false; if (_mouseJoint != null && FlxG.mouse.pressed()) { _mouseJoint.setTarget(_mouseTarget.set(_mouseWorldX, _mouseWorldY)); return true; } return false; if (FlxG.mouse.justReleased()) { kill(); } }
public void update() { _mouseWorldX = FlxG.mouse.x / B2FlxB.RATIO; _mouseWorldY = FlxG.mouse.y / B2FlxB.RATIO; if (_mouseJoint == null && FlxG.mouse.justPressed()) { _hitBody = null; _testPoint.set(_mouseWorldX, _mouseWorldY); B2FlxB.world.QueryAABB(getBodyCallback, _testPoint.x - 0.0001f, _testPoint.y - 0.0001f, _testPoint.x + 0.0001f, _testPoint.y + 0.0001f); if (_hitBody == _groundBody || _hitBody == null) return false; ObjectMap<String, Object> userData = (ObjectMap<String, Object>) _hitBody.getUserData(); if (userData == null) return false; if (_hitBody != null && _hitBody.getType() == BodyType.KinematicBody || !(Boolean) userData.get("draggable")) return false; if (_hitBody != null) { _mouseJointDef.bodyA = _groundBody; _mouseJointDef.bodyB = _hitBody; _mouseJointDef.collideConnected = true; _mouseJointDef.target.set(_testPoint.x, _testPoint.y); _mouseJointDef.maxForce = maxForce * _hitBody.getMass(); if (_mouseJoint == null) _mouseJoint = (MouseJoint) B2FlxB.world.createJoint(_mouseJointDef); _hitBody.setAwake(true); userData.put("mouseJoint", this); _removeBySchedule = false; return true; } } return false; if (_mouseJoint != null && FlxG.mouse.pressed()) { _mouseJoint.setTarget(_mouseTarget.set(_mouseWorldX, _mouseWorldY)); return true; } return false; <DeepExtract> if (FlxG.mouse.justReleased()) { kill(); } </DeepExtract> }
flixel-gdx-box2d
positive
1,858
@Override public synchronized void synchronize() { try { fileOutputStream.flush(); fileOutputStream.close(); } catch (ClosedChannelException e) { } catch (IOException ioe) { throw new RuntimeException(ioe); } try { if (!this.pagesCache.isEmpty()) { for (CachePage p : this.pagesCache.values()) { p.flush(); } this.pagesCache.clear(); } if (this.indexRandomAccessFile != null) { this.indexRandomAccessFile.close(); this.indexRandomAccessFile = null; } } catch (IOException e) { throw new RuntimeException(e); } }
@Override public synchronized void synchronize() { try { fileOutputStream.flush(); fileOutputStream.close(); } catch (ClosedChannelException e) { } catch (IOException ioe) { throw new RuntimeException(ioe); } <DeepExtract> try { if (!this.pagesCache.isEmpty()) { for (CachePage p : this.pagesCache.values()) { p.flush(); } this.pagesCache.clear(); } if (this.indexRandomAccessFile != null) { this.indexRandomAccessFile.close(); this.indexRandomAccessFile = null; } } catch (IOException e) { throw new RuntimeException(e); } </DeepExtract> }
gazetteer
positive
1,859
@Test public void acquireWriteLocksOnTwoPages() throws Exception { bp.getPage(tid1, p0, Permissions.READ_WRITE); grabLock(tid2, p1, Permissions.READ_WRITE, true); }
@Test public void acquireWriteLocksOnTwoPages() throws Exception { <DeepExtract> bp.getPage(tid1, p0, Permissions.READ_WRITE); grabLock(tid2, p1, Permissions.READ_WRITE, true); </DeepExtract> }
simple-db-hw-2021
positive
1,860
protected void initiateTaskGang(int inputSize) { System.out.println("@@@ starting cycle " + currentCycle() + " with " + inputSize + " tasks@@@"); mExitBarrier = new CountDownLatch(inputSize); if (getExecutor() == null) setExecutor(Executors.newFixedThreadPool(MAX_THREADS)); List<Callable<Object>> workerCollection = new ArrayList<>(inputSize); IntStream.range(1, inputSize).forEach(i -> workerCollection.add(Executors.callable(makeTask(i)))); try { ExecutorService executorService = (ExecutorService) getExecutor(); executorService.invokeAll(workerCollection); } catch (InterruptedException e) { System.out.println("invokeAll() interrupted"); } }
protected void initiateTaskGang(int inputSize) { <DeepExtract> System.out.println("@@@ starting cycle " + currentCycle() + " with " + inputSize + " tasks@@@"); mExitBarrier = new CountDownLatch(inputSize); if (getExecutor() == null) setExecutor(Executors.newFixedThreadPool(MAX_THREADS)); </DeepExtract> List<Callable<Object>> workerCollection = new ArrayList<>(inputSize); IntStream.range(1, inputSize).forEach(i -> workerCollection.add(Executors.callable(makeTask(i)))); try { ExecutorService executorService = (ExecutorService) getExecutor(); executorService.invokeAll(workerCollection); } catch (InterruptedException e) { System.out.println("invokeAll() interrupted"); } }
CS892
positive
1,862
@Override public void onSessionClosed(Object session) { ClientSession clientSession = (ClientSession) session; sessions.remove(clientSession); if (clientSession.isWorking() || clientSession.isFreeze()) { serverSurrogate.clientSessionClosed(clientSession.getId()); } }
@Override public void onSessionClosed(Object session) { ClientSession clientSession = (ClientSession) session; <DeepExtract> sessions.remove(clientSession); </DeepExtract> if (clientSession.isWorking() || clientSession.isFreeze()) { serverSurrogate.clientSessionClosed(clientSession.getId()); } }
anima
positive
1,863
public static void writeDataToFile(Context context, String filename, String data) throws Exception { String cacheDir = context.getCacheDir().getAbsolutePath(); File cacheFile = new File(cacheDir + "/" + FilenameUtils.getName(filename)); FileOutputStream os = new FileOutputStream(cacheFile); os.write(data.getBytes()); os.close(); final CommandEx command = new CommandEx(0, false, "busybox cat \"" + cacheFile.getAbsolutePath() + "\" > \"" + filename + "\""); Shell shell = RootTools.getShell(true); shell.add(command); commandWait(shell, command); command.checkReturnCode(); cacheFile.delete(); }
public static void writeDataToFile(Context context, String filename, String data) throws Exception { String cacheDir = context.getCacheDir().getAbsolutePath(); File cacheFile = new File(cacheDir + "/" + FilenameUtils.getName(filename)); FileOutputStream os = new FileOutputStream(cacheFile); os.write(data.getBytes()); os.close(); <DeepExtract> final CommandEx command = new CommandEx(0, false, "busybox cat \"" + cacheFile.getAbsolutePath() + "\" > \"" + filename + "\""); Shell shell = RootTools.getShell(true); shell.add(command); commandWait(shell, command); command.checkReturnCode(); </DeepExtract> cacheFile.delete(); }
android_app_efidroidmanager
positive
1,864
@SuppressWarnings("unused") private void opCheckSig(Transaction context) throws ScriptException { byte[] pubkey = stack.pop(); byte[] sigAndHashType = stack.pop(); byte hashType = sigAndHashType[sigAndHashType.length - 1]; boolean anyoneCanPay = hashType < 0; hashType &= (byte) -1 >>> 1; switch(hashType) { case 1: sigHash = SigHash.ALL; break; case 2: sigHash = SigHash.NONE; break; case 3: sigHash = SigHash.SINGLE; break; default: throw new ScriptException("Unknown sighash byte: " + sigAndHashType[sigAndHashType.length - 1]); } byte[] sig = new byte[sigAndHashType.length - 1]; System.arraycopy(sigAndHashType, 0, sig, 0, sig.length); log.debug("CHECKSIG: hashtype={} anyoneCanPay={}", sigHash, anyoneCanPay); if (context == null) { pushBool(true); return; } stack.push(new byte[] { true ? (byte) 1 : (byte) 0 }); }
@SuppressWarnings("unused") private void opCheckSig(Transaction context) throws ScriptException { byte[] pubkey = stack.pop(); byte[] sigAndHashType = stack.pop(); byte hashType = sigAndHashType[sigAndHashType.length - 1]; boolean anyoneCanPay = hashType < 0; hashType &= (byte) -1 >>> 1; switch(hashType) { case 1: sigHash = SigHash.ALL; break; case 2: sigHash = SigHash.NONE; break; case 3: sigHash = SigHash.SINGLE; break; default: throw new ScriptException("Unknown sighash byte: " + sigAndHashType[sigAndHashType.length - 1]); } byte[] sig = new byte[sigAndHashType.length - 1]; System.arraycopy(sigAndHashType, 0, sig, 0, sig.length); log.debug("CHECKSIG: hashtype={} anyoneCanPay={}", sigHash, anyoneCanPay); if (context == null) { pushBool(true); return; } <DeepExtract> stack.push(new byte[] { true ? (byte) 1 : (byte) 0 }); </DeepExtract> }
bitcoinj-minimal
positive
1,865
public static void checkRequest(@Nonnull final Dhcp6Message msg, @Nonnull final DuidOption.Duid duid) throws InvalidMsgException { if (!isMsgType(msg, Dhcp6MessageType.DHCP_REQUEST)) { throw new InvalidMsgException(String.format("Incorrect type, expected: %s, but was: %s", Dhcp6MessageType.DHCP_REQUEST, msg.getMessageType())); } if (noOption(msg, ServerIdOption.class)) { throw new InvalidMsgException(String.format("Missing option: %s", ServerIdOption.class)); } if (!isOptionValue(msg, ServerIdOption.class, duid.getData())) { throw new InvalidMsgException(String.format("Unexpected option value: %s, should be: %s", ServerIdOption.class, Arrays.toString(duid.getData()))); } if (noOption(msg, ClientIdOption.class)) { throw new InvalidMsgException(String.format("Missing option: %s", ClientIdOption.class)); } }
public static void checkRequest(@Nonnull final Dhcp6Message msg, @Nonnull final DuidOption.Duid duid) throws InvalidMsgException { if (!isMsgType(msg, Dhcp6MessageType.DHCP_REQUEST)) { throw new InvalidMsgException(String.format("Incorrect type, expected: %s, but was: %s", Dhcp6MessageType.DHCP_REQUEST, msg.getMessageType())); } if (noOption(msg, ServerIdOption.class)) { throw new InvalidMsgException(String.format("Missing option: %s", ServerIdOption.class)); } if (!isOptionValue(msg, ServerIdOption.class, duid.getData())) { throw new InvalidMsgException(String.format("Unexpected option value: %s, should be: %s", ServerIdOption.class, Arrays.toString(duid.getData()))); } <DeepExtract> if (noOption(msg, ClientIdOption.class)) { throw new InvalidMsgException(String.format("Missing option: %s", ClientIdOption.class)); } </DeepExtract> }
dhcp4j
positive
1,866
@Override public void onClick(View view) { mEmailView.setError(null); mPasswordView.setError(null); mUrlView.setError(null); String email = mEmailView.getText().toString(); String password = mPasswordView.getText().toString(); String url = mUrlView.getText().toString(); boolean cancel = false; View focusView = null; if (TextUtils.isEmpty(email)) { mEmailView.setError(getString(R.string.error_field_required)); focusView = mEmailView; cancel = true; return; } if (TextUtils.isEmpty(password)) { mPasswordView.setError(getString(R.string.error_field_required)); focusView = mPasswordView; cancel = true; return; } if (TextUtils.isEmpty(url)) { mUrlView.setError(getString(R.string.error_field_required)); focusView = mUrlView; cancel = true; return; } try { System.setProperty("log4j2.disable.jmx", "true"); NuxeoClient nuxeoClient = new NuxeoClient(url, email, password); nuxeoClient.fetchCurrentUser(); } catch (Exception reason) { Toast.makeText(getApplicationContext(), "Wrong information. Please change your credentials or url.", Toast.LENGTH_SHORT).show(); return; } SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString("login", email); editor.putString("pwd", password); editor.putString("url", url); boolean success = editor.commit(); if (success) { Toast.makeText(getApplicationContext(), "Data Stored. You can now use the application when sharing documents.", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "An error occured", Toast.LENGTH_SHORT).show(); } }
@Override public void onClick(View view) { <DeepExtract> mEmailView.setError(null); mPasswordView.setError(null); mUrlView.setError(null); String email = mEmailView.getText().toString(); String password = mPasswordView.getText().toString(); String url = mUrlView.getText().toString(); boolean cancel = false; View focusView = null; if (TextUtils.isEmpty(email)) { mEmailView.setError(getString(R.string.error_field_required)); focusView = mEmailView; cancel = true; return; } if (TextUtils.isEmpty(password)) { mPasswordView.setError(getString(R.string.error_field_required)); focusView = mPasswordView; cancel = true; return; } if (TextUtils.isEmpty(url)) { mUrlView.setError(getString(R.string.error_field_required)); focusView = mUrlView; cancel = true; return; } try { System.setProperty("log4j2.disable.jmx", "true"); NuxeoClient nuxeoClient = new NuxeoClient(url, email, password); nuxeoClient.fetchCurrentUser(); } catch (Exception reason) { Toast.makeText(getApplicationContext(), "Wrong information. Please change your credentials or url.", Toast.LENGTH_SHORT).show(); return; } SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString("login", email); editor.putString("pwd", password); editor.putString("url", url); boolean success = editor.commit(); if (success) { Toast.makeText(getApplicationContext(), "Data Stored. You can now use the application when sharing documents.", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "An error occured", Toast.LENGTH_SHORT).show(); } </DeepExtract> }
nuxeo-java-client
positive
1,867
public void addGroup(String sessionId, String categoryId, String columnId, Position position) { final SaikuMasterModel model = sessionHolder.getModel(sessionId); final List<SaikuColumn> columns = model.getColumns(); SaikuColumn saikuColumn = null; for (Iterator<SaikuColumn> iterator = columns.iterator(); iterator.hasNext(); ) { SaikuColumn col = (SaikuColumn) iterator.next(); if (col.getUid().equals(position.getUid())) { saikuColumn = col; break; } } if (saikuColumn != null) { columns.remove(saikuColumn); return saikuColumn; } final List<SaikuGroup> groups = model.getGroups(); SaikuGroup saikuGroup = null; for (Iterator<SaikuGroup> iterator2 = groups.iterator(); iterator2.hasNext(); ) { SaikuGroup group = (SaikuGroup) iterator2.next(); if (group.getUid().equals(position.getUid())) { saikuGroup = group; break; } } if (saikuGroup != null) { groups.remove(saikuGroup); } final List<SaikuParameter> params = model.getParameters(); SaikuParameter saikuParam = null; for (Iterator<SaikuParameter> iterator3 = params.iterator(); iterator3.hasNext(); ) { SaikuParameter param = (SaikuParameter) iterator3.next(); if (param.getUid().equals(position.getUid())) { saikuParam = param; break; } } if (saikuParam != null) { params.remove(saikuParam); } return null; String name = null; List<SaikuGroup> groups = model.getGroups(); final LogicalModel logicalModel = metadataProvider.getLogicalModel(model.getDomainId(), model.getLogicalModelId()); LogicalColumn logicalColumn = logicalModel.findLogicalColumn(columnId); if (logicalColumn != null) { String locale = "en_En"; name = logicalColumn.getName(locale); } else { final SaikuColumn column = ModelHelper.findColumnByUid(model, position.getUid()); name = column.getName(); } SaikuGroup group = null; for (SaikuGroup saikuGroup : groups) { if (saikuGroup.getUid().equals(position.getUid())) { group = saikuGroup; } } if (group != null) { groups.remove(group); } else { group = new SaikuGroup(); group.setColumnId(columnId); group.setCategory(categoryId); group.setColumnName(name); group.setDisplayName(name); group.setUid(position.getUid()); group.setGroupTotalsLabel("Total " + name); } groups.add(position.getPosition(), group); model.setCdaDirty(true); if (log.isDebugEnabled()) { log.debug("SERVICE:EditorService " + sessionId + " addGroup\n" + sessionHolder.logModel(sessionId)); } }
public void addGroup(String sessionId, String categoryId, String columnId, Position position) { final SaikuMasterModel model = sessionHolder.getModel(sessionId); <DeepExtract> final List<SaikuColumn> columns = model.getColumns(); SaikuColumn saikuColumn = null; for (Iterator<SaikuColumn> iterator = columns.iterator(); iterator.hasNext(); ) { SaikuColumn col = (SaikuColumn) iterator.next(); if (col.getUid().equals(position.getUid())) { saikuColumn = col; break; } } if (saikuColumn != null) { columns.remove(saikuColumn); return saikuColumn; } final List<SaikuGroup> groups = model.getGroups(); SaikuGroup saikuGroup = null; for (Iterator<SaikuGroup> iterator2 = groups.iterator(); iterator2.hasNext(); ) { SaikuGroup group = (SaikuGroup) iterator2.next(); if (group.getUid().equals(position.getUid())) { saikuGroup = group; break; } } if (saikuGroup != null) { groups.remove(saikuGroup); } final List<SaikuParameter> params = model.getParameters(); SaikuParameter saikuParam = null; for (Iterator<SaikuParameter> iterator3 = params.iterator(); iterator3.hasNext(); ) { SaikuParameter param = (SaikuParameter) iterator3.next(); if (param.getUid().equals(position.getUid())) { saikuParam = param; break; } } if (saikuParam != null) { params.remove(saikuParam); } return null; </DeepExtract> String name = null; List<SaikuGroup> groups = model.getGroups(); final LogicalModel logicalModel = metadataProvider.getLogicalModel(model.getDomainId(), model.getLogicalModelId()); LogicalColumn logicalColumn = logicalModel.findLogicalColumn(columnId); if (logicalColumn != null) { String locale = "en_En"; name = logicalColumn.getName(locale); } else { final SaikuColumn column = ModelHelper.findColumnByUid(model, position.getUid()); name = column.getName(); } SaikuGroup group = null; for (SaikuGroup saikuGroup : groups) { if (saikuGroup.getUid().equals(position.getUid())) { group = saikuGroup; } } if (group != null) { groups.remove(group); } else { group = new SaikuGroup(); group.setColumnId(columnId); group.setCategory(categoryId); group.setColumnName(name); group.setDisplayName(name); group.setUid(position.getUid()); group.setGroupTotalsLabel("Total " + name); } groups.add(position.getPosition(), group); model.setCdaDirty(true); if (log.isDebugEnabled()) { log.debug("SERVICE:EditorService " + sessionId + " addGroup\n" + sessionHolder.logModel(sessionId)); } }
saiku-adhoc
positive
1,868
@Override public void onSourceSelected(long sourceId) { mDrawerLayout.closeDrawer(GravityCompat.START); ItemListFragment fragment = (ItemListFragment) getFragmentManager().findFragmentById(R.id.details_frame); if (fragment == null || fragment.getShownSourceId() != sourceId) { fragment = ItemListFragment.newInstance(sourceId); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.details_frame, fragment); ft.commit(); } }
@Override public void onSourceSelected(long sourceId) { mDrawerLayout.closeDrawer(GravityCompat.START); <DeepExtract> ItemListFragment fragment = (ItemListFragment) getFragmentManager().findFragmentById(R.id.details_frame); if (fragment == null || fragment.getShownSourceId() != sourceId) { fragment = ItemListFragment.newInstance(sourceId); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.details_frame, fragment); ft.commit(); } </DeepExtract> }
Feeder
positive
1,869
public static TMCPoint getPoint(int cid, int tabcd, int lcd) { int ret = tabcd; Integer tabcd = LTN_ALIASES.get(cid + ";" + tabcd); if (tabcd != null) ret = tabcd; else { LocationDataset lds = getLocationDataset(cid, tabcd); if (lds != null) putLtnAlias(cid, tabcd, lds.tabcd); else try { PreparedStatement stmt = dbConnection.prepareStatement("select * from TabcdAliases where CID = ? AND ALIAS = ?"); stmt.setInt(1, cid); stmt.setInt(2, tabcd); ResultSet rset = stmt.executeQuery(); if (rset.next()) { ret = rset.getInt("TABCD"); putLtnAlias(cid, tabcd, ret); } } catch (SQLException e) { e.printStackTrace(System.err); } } return ret; TMCPoint ret = POINTS.get(cid + ";" + tabcd + ";" + lcd); if (ret == null) try { PreparedStatement stmt = dbConnection.prepareStatement("select * from Points where CID = ? AND TABCD = ? AND LCD = ?"); stmt.setInt(1, cid); stmt.setInt(2, tabcd); stmt.setInt(3, lcd); ResultSet rset = stmt.executeQuery(); TMCPoint point; if (rset.next()) { stmt = dbConnection.prepareStatement("select * from Poffsets where CID = ? AND TABCD = ? AND LCD = ?"); stmt.setInt(1, cid); stmt.setInt(2, tabcd); stmt.setInt(3, lcd); ResultSet offsets = stmt.executeQuery(); if (offsets.next()) point = new TMCPoint(rset, offsets); else point = new TMCPoint(rset, null); putPoint(cid, tabcd, lcd, point); putLocation(cid, tabcd, lcd, point); return point; } else return null; } catch (SQLException e) { e.printStackTrace(System.err); return null; } return ret; }
public static TMCPoint getPoint(int cid, int tabcd, int lcd) { <DeepExtract> int ret = tabcd; Integer tabcd = LTN_ALIASES.get(cid + ";" + tabcd); if (tabcd != null) ret = tabcd; else { LocationDataset lds = getLocationDataset(cid, tabcd); if (lds != null) putLtnAlias(cid, tabcd, lds.tabcd); else try { PreparedStatement stmt = dbConnection.prepareStatement("select * from TabcdAliases where CID = ? AND ALIAS = ?"); stmt.setInt(1, cid); stmt.setInt(2, tabcd); ResultSet rset = stmt.executeQuery(); if (rset.next()) { ret = rset.getInt("TABCD"); putLtnAlias(cid, tabcd, ret); } } catch (SQLException e) { e.printStackTrace(System.err); } } return ret; </DeepExtract> TMCPoint ret = POINTS.get(cid + ";" + tabcd + ";" + lcd); if (ret == null) try { PreparedStatement stmt = dbConnection.prepareStatement("select * from Points where CID = ? AND TABCD = ? AND LCD = ?"); stmt.setInt(1, cid); stmt.setInt(2, tabcd); stmt.setInt(3, lcd); ResultSet rset = stmt.executeQuery(); TMCPoint point; if (rset.next()) { stmt = dbConnection.prepareStatement("select * from Poffsets where CID = ? AND TABCD = ? AND LCD = ?"); stmt.setInt(1, cid); stmt.setInt(2, tabcd); stmt.setInt(3, lcd); ResultSet offsets = stmt.executeQuery(); if (offsets.next()) point = new TMCPoint(rset, offsets); else point = new TMCPoint(rset, null); putPoint(cid, tabcd, lcd, point); putLocation(cid, tabcd, lcd, point); return point; } else return null; } catch (SQLException e) { e.printStackTrace(System.err); return null; } return ret; }
RdsSurveyor
positive
1,870
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); pref_bitminterKey = prefs.getString("bitminterKey", ""); pref_widgetMiningPayoutUnit = Integer.parseInt(prefs.getString("widgetMiningPayoutUnitPref", "0")); View view = inflater.inflate(R.layout.fragment_table, container, false); if (minerProgressDialog != null && minerProgressDialog.isShowing()) return; Context context = view.getContext(); if (context != null) minerProgressDialog = ProgressDialog.show(context, getString(R.string.working), getString(R.string.retreivingMinerStats), true, false); MinerStatsThread gt = new MinerStatsThread(); gt.start(); return view; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); pref_bitminterKey = prefs.getString("bitminterKey", ""); pref_widgetMiningPayoutUnit = Integer.parseInt(prefs.getString("widgetMiningPayoutUnitPref", "0")); View view = inflater.inflate(R.layout.fragment_table, container, false); <DeepExtract> if (minerProgressDialog != null && minerProgressDialog.isShowing()) return; Context context = view.getContext(); if (context != null) minerProgressDialog = ProgressDialog.show(context, getString(R.string.working), getString(R.string.retreivingMinerStats), true, false); MinerStatsThread gt = new MinerStatsThread(); gt.start(); </DeepExtract> return view; }
bitcoinium
positive
1,871
public Criteria andConsumerIdIsNull() { if ("consumer_id is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("consumer_id is null")); return (Criteria) this; }
public Criteria andConsumerIdIsNull() { <DeepExtract> if ("consumer_id is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("consumer_id is null")); </DeepExtract> return (Criteria) this; }
ssmxiaomi
positive
1,872
@Override public void onNext(String s) { hud.dismiss(); ArrayList<Map<String, Object>> List = new ArrayList<>(); try { JSONObject jsonObject = new JSONObject(s); JSONObject jsonArray = jsonObject.getJSONObject("data"); JSONArray listjsonarrya = jsonArray.getJSONArray("list"); for (int i = 0; i < listjsonarrya.length(); i++) { JSONObject jsonObject1 = listjsonarrya.getJSONObject(i); Map<String, Object> map = new HashMap<>(); map.put("goods_id", jsonObject1.getString("goods_id")); map.put("goods_pic", jsonObject1.getString("goods_pic")); map.put("goods_title", jsonObject1.getString("goods_title")); map.put("goods_short_title", jsonObject1.getString("goods_short_title")); map.put("goods_cat", jsonObject1.getString("goods_cat")); map.put("goods_price", jsonObject1.getDouble("goods_price")); map.put("goods_sales", jsonObject1.getString("goods_sales")); map.put("goods_introduce", jsonObject1.getString("goods_introduce")); map.put("seller_id", jsonObject1.getString("seller_id")); map.put("coupon_id", jsonObject1.getString("coupon_id")); map.put("coupon_price", jsonObject1.getDouble("coupon_price")); List.add(map); } } catch (JSONException e) { e.printStackTrace(); } return List; if (mapArrayList.size() == 0) { buju2.setVisibility(View.VISIBLE); mGridView.setVisibility(View.GONE); } else { mGridView.setVisibility(View.VISIBLE); buju2.setVisibility(View.GONE); latesAdapter = new YouPinAdapter(mapArrayList, SearchActivity.this); mGridView.setAdapter(latesAdapter); } }
@Override public void onNext(String s) { hud.dismiss(); <DeepExtract> ArrayList<Map<String, Object>> List = new ArrayList<>(); try { JSONObject jsonObject = new JSONObject(s); JSONObject jsonArray = jsonObject.getJSONObject("data"); JSONArray listjsonarrya = jsonArray.getJSONArray("list"); for (int i = 0; i < listjsonarrya.length(); i++) { JSONObject jsonObject1 = listjsonarrya.getJSONObject(i); Map<String, Object> map = new HashMap<>(); map.put("goods_id", jsonObject1.getString("goods_id")); map.put("goods_pic", jsonObject1.getString("goods_pic")); map.put("goods_title", jsonObject1.getString("goods_title")); map.put("goods_short_title", jsonObject1.getString("goods_short_title")); map.put("goods_cat", jsonObject1.getString("goods_cat")); map.put("goods_price", jsonObject1.getDouble("goods_price")); map.put("goods_sales", jsonObject1.getString("goods_sales")); map.put("goods_introduce", jsonObject1.getString("goods_introduce")); map.put("seller_id", jsonObject1.getString("seller_id")); map.put("coupon_id", jsonObject1.getString("coupon_id")); map.put("coupon_price", jsonObject1.getDouble("coupon_price")); List.add(map); } } catch (JSONException e) { e.printStackTrace(); } return List; </DeepExtract> if (mapArrayList.size() == 0) { buju2.setVisibility(View.VISIBLE); mGridView.setVisibility(View.GONE); } else { mGridView.setVisibility(View.VISIBLE); buju2.setVisibility(View.GONE); latesAdapter = new YouPinAdapter(mapArrayList, SearchActivity.this); mGridView.setAdapter(latesAdapter); } }
lingJuan
positive
1,873
public static QualifiedName forFieldDeclaration(ValaFieldDeclaration fieldDeclaration) { ValaDeclaration container = getParentOfType(fieldDeclaration.getParent(), ValaDeclaration.class, false); if (container == null) { qName = new QualifiedNameBuilder(); } else { qName = container.getQName(); } QualifiedNameBuilder newName = new QualifiedNameBuilder(); newName.parts.addAll(this.parts); newName.parts.add(fieldDeclaration.getName()); return newName; }
public static QualifiedName forFieldDeclaration(ValaFieldDeclaration fieldDeclaration) { ValaDeclaration container = getParentOfType(fieldDeclaration.getParent(), ValaDeclaration.class, false); if (container == null) { qName = new QualifiedNameBuilder(); } else { qName = container.getQName(); } <DeepExtract> QualifiedNameBuilder newName = new QualifiedNameBuilder(); newName.parts.addAll(this.parts); newName.parts.add(fieldDeclaration.getName()); return newName; </DeepExtract> }
vala-intellij-plugin
positive
1,874
public Criteria andCreatorNotBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "creator" + " cannot be null"); } criteria.add(new Criterion("creator not between", value1, value2)); return (Criteria) this; }
public Criteria andCreatorNotBetween(String value1, String value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "creator" + " cannot be null"); } criteria.add(new Criterion("creator not between", value1, value2)); </DeepExtract> return (Criteria) this; }
dtsopensource
positive
1,875
private void onLayout2(boolean changed, int left, int top, int right, int bottom) { if (isInEditMode()) return; View cv = mChildViews.get(mCurrent); if (!mResetLayout) { if (cv != null) { boolean move; cvOffset = subScreenSizeOffset(cv); if (HORIZONTAL_SCROLLING) move = cv.getLeft() + cv.getMeasuredWidth() + cvOffset.x + GAP / 2 + mXScroll < getWidth() / 2; else move = cv.getTop() + cv.getMeasuredHeight() + cvOffset.y + GAP / 2 + mYScroll < getHeight() / 2; if (move && mCurrent + 1 < mAdapter.getCount()) { postUnsettle(cv); mStepper.prod(); onMoveOffChild(mCurrent); mCurrent++; onMoveToChild(mCurrent); } if (HORIZONTAL_SCROLLING) move = cv.getLeft() - cvOffset.x - GAP / 2 + mXScroll >= getWidth() / 2; else move = cv.getTop() - cvOffset.y - GAP / 2 + mYScroll >= getHeight() / 2; if (move && mCurrent > 0) { postUnsettle(cv); mStepper.prod(); onMoveOffChild(mCurrent); mCurrent--; onMoveToChild(mCurrent); } } int numChildren = mChildViews.size(); int[] childIndices = new int[numChildren]; for (int i = 0; i < numChildren; i++) childIndices[i] = mChildViews.keyAt(i); for (int i = 0; i < numChildren; i++) { int ai = childIndices[i]; if (ai < mCurrent - 1 || ai > mCurrent + 1) { View v = mChildViews.get(ai); onNotInUse(v); mViewCache.add(v); removeViewInLayout(v); mChildViews.remove(ai); } } } else { mResetLayout = false; mXScroll = mYScroll = 0; int numChildren = mChildViews.size(); for (int i = 0; i < numChildren; i++) { View v = mChildViews.valueAt(i); onNotInUse(v); mViewCache.add(v); removeViewInLayout(v); } mChildViews.clear(); mStepper.prod(); } boolean notPresent = (mChildViews.get(mCurrent) == null); View v = mChildViews.get(mCurrent); if (v == null) { v = mAdapter.getView(mCurrent, getCached(), this); addAndMeasureChild(mCurrent, v); onChildSetup(mCurrent, v); } return v; return new Point(Math.max((getWidth() - cv.getMeasuredWidth()) / 2, 0), Math.max((getHeight() - cv.getMeasuredHeight()) / 2, 0)); if (notPresent) { cvLeft = cvOffset.x; cvTop = cvOffset.y; } else { cvLeft = cv.getLeft() + mXScroll; cvTop = cv.getTop() + mYScroll; } mXScroll = mYScroll = 0; cvRight = cvLeft + cv.getMeasuredWidth(); cvBottom = cvTop + cv.getMeasuredHeight(); if (!mUserInteracting && mScroller.isFinished()) { Point corr = getCorrection(getScrollBounds(cvLeft, cvTop, cvRight, cvBottom)); cvRight += corr.x; cvLeft += corr.x; cvTop += corr.y; cvBottom += corr.y; } else if (HORIZONTAL_SCROLLING && cv.getMeasuredHeight() <= getHeight()) { Point corr = getCorrection(getScrollBounds(cvLeft, cvTop, cvRight, cvBottom)); cvTop += corr.y; cvBottom += corr.y; } else if (!HORIZONTAL_SCROLLING && cv.getMeasuredWidth() <= getWidth()) { Point corr = getCorrection(getScrollBounds(cvLeft, cvTop, cvRight, cvBottom)); cvRight += corr.x; cvLeft += corr.x; } cv.layout(cvLeft, cvTop, cvRight, cvBottom); if (mCurrent > 0) { View lv = getOrCreateChild(mCurrent - 1); Point leftOffset = subScreenSizeOffset(lv); if (HORIZONTAL_SCROLLING) { int gap = leftOffset.x + GAP + cvOffset.x; lv.layout(cvLeft - lv.getMeasuredWidth() - gap, (cvBottom + cvTop - lv.getMeasuredHeight()) / 2, cvLeft - gap, (cvBottom + cvTop + lv.getMeasuredHeight()) / 2); } else { int gap = leftOffset.y + GAP + cvOffset.y; lv.layout((cvLeft + cvRight - lv.getMeasuredWidth()) / 2, cvTop - lv.getMeasuredHeight() - gap, (cvLeft + cvRight + lv.getMeasuredWidth()) / 2, cvTop - gap); } } if (mCurrent + 1 < mAdapter.getCount()) { View rv = getOrCreateChild(mCurrent + 1); Point rightOffset = subScreenSizeOffset(rv); if (HORIZONTAL_SCROLLING) { int gap = cvOffset.x + GAP + rightOffset.x; rv.layout(cvRight + gap, (cvBottom + cvTop - rv.getMeasuredHeight()) / 2, cvRight + rv.getMeasuredWidth() + gap, (cvBottom + cvTop + rv.getMeasuredHeight()) / 2); } else { int gap = cvOffset.y + GAP + rightOffset.y; rv.layout((cvLeft + cvRight - rv.getMeasuredWidth()) / 2, cvBottom + gap, (cvLeft + cvRight + rv.getMeasuredWidth()) / 2, cvBottom + gap + rv.getMeasuredHeight()); } } invalidate(); }
private void onLayout2(boolean changed, int left, int top, int right, int bottom) { if (isInEditMode()) return; View cv = mChildViews.get(mCurrent); if (!mResetLayout) { if (cv != null) { boolean move; cvOffset = subScreenSizeOffset(cv); if (HORIZONTAL_SCROLLING) move = cv.getLeft() + cv.getMeasuredWidth() + cvOffset.x + GAP / 2 + mXScroll < getWidth() / 2; else move = cv.getTop() + cv.getMeasuredHeight() + cvOffset.y + GAP / 2 + mYScroll < getHeight() / 2; if (move && mCurrent + 1 < mAdapter.getCount()) { postUnsettle(cv); mStepper.prod(); onMoveOffChild(mCurrent); mCurrent++; onMoveToChild(mCurrent); } if (HORIZONTAL_SCROLLING) move = cv.getLeft() - cvOffset.x - GAP / 2 + mXScroll >= getWidth() / 2; else move = cv.getTop() - cvOffset.y - GAP / 2 + mYScroll >= getHeight() / 2; if (move && mCurrent > 0) { postUnsettle(cv); mStepper.prod(); onMoveOffChild(mCurrent); mCurrent--; onMoveToChild(mCurrent); } } int numChildren = mChildViews.size(); int[] childIndices = new int[numChildren]; for (int i = 0; i < numChildren; i++) childIndices[i] = mChildViews.keyAt(i); for (int i = 0; i < numChildren; i++) { int ai = childIndices[i]; if (ai < mCurrent - 1 || ai > mCurrent + 1) { View v = mChildViews.get(ai); onNotInUse(v); mViewCache.add(v); removeViewInLayout(v); mChildViews.remove(ai); } } } else { mResetLayout = false; mXScroll = mYScroll = 0; int numChildren = mChildViews.size(); for (int i = 0; i < numChildren; i++) { View v = mChildViews.valueAt(i); onNotInUse(v); mViewCache.add(v); removeViewInLayout(v); } mChildViews.clear(); mStepper.prod(); } boolean notPresent = (mChildViews.get(mCurrent) == null); View v = mChildViews.get(mCurrent); if (v == null) { v = mAdapter.getView(mCurrent, getCached(), this); addAndMeasureChild(mCurrent, v); onChildSetup(mCurrent, v); } return v; <DeepExtract> return new Point(Math.max((getWidth() - cv.getMeasuredWidth()) / 2, 0), Math.max((getHeight() - cv.getMeasuredHeight()) / 2, 0)); </DeepExtract> if (notPresent) { cvLeft = cvOffset.x; cvTop = cvOffset.y; } else { cvLeft = cv.getLeft() + mXScroll; cvTop = cv.getTop() + mYScroll; } mXScroll = mYScroll = 0; cvRight = cvLeft + cv.getMeasuredWidth(); cvBottom = cvTop + cv.getMeasuredHeight(); if (!mUserInteracting && mScroller.isFinished()) { Point corr = getCorrection(getScrollBounds(cvLeft, cvTop, cvRight, cvBottom)); cvRight += corr.x; cvLeft += corr.x; cvTop += corr.y; cvBottom += corr.y; } else if (HORIZONTAL_SCROLLING && cv.getMeasuredHeight() <= getHeight()) { Point corr = getCorrection(getScrollBounds(cvLeft, cvTop, cvRight, cvBottom)); cvTop += corr.y; cvBottom += corr.y; } else if (!HORIZONTAL_SCROLLING && cv.getMeasuredWidth() <= getWidth()) { Point corr = getCorrection(getScrollBounds(cvLeft, cvTop, cvRight, cvBottom)); cvRight += corr.x; cvLeft += corr.x; } cv.layout(cvLeft, cvTop, cvRight, cvBottom); if (mCurrent > 0) { View lv = getOrCreateChild(mCurrent - 1); Point leftOffset = subScreenSizeOffset(lv); if (HORIZONTAL_SCROLLING) { int gap = leftOffset.x + GAP + cvOffset.x; lv.layout(cvLeft - lv.getMeasuredWidth() - gap, (cvBottom + cvTop - lv.getMeasuredHeight()) / 2, cvLeft - gap, (cvBottom + cvTop + lv.getMeasuredHeight()) / 2); } else { int gap = leftOffset.y + GAP + cvOffset.y; lv.layout((cvLeft + cvRight - lv.getMeasuredWidth()) / 2, cvTop - lv.getMeasuredHeight() - gap, (cvLeft + cvRight + lv.getMeasuredWidth()) / 2, cvTop - gap); } } if (mCurrent + 1 < mAdapter.getCount()) { View rv = getOrCreateChild(mCurrent + 1); Point rightOffset = subScreenSizeOffset(rv); if (HORIZONTAL_SCROLLING) { int gap = cvOffset.x + GAP + rightOffset.x; rv.layout(cvRight + gap, (cvBottom + cvTop - rv.getMeasuredHeight()) / 2, cvRight + rv.getMeasuredWidth() + gap, (cvBottom + cvTop + rv.getMeasuredHeight()) / 2); } else { int gap = cvOffset.y + GAP + rightOffset.y; rv.layout((cvLeft + cvRight - rv.getMeasuredWidth()) / 2, cvBottom + gap, (cvLeft + cvRight + rv.getMeasuredWidth()) / 2, cvBottom + gap + rv.getMeasuredHeight()); } } invalidate(); }
AndroidMuPDF
positive
1,876
public void showFailView() { for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); child.setVisibility(failView == child ? View.VISIBLE : View.GONE); } }
public void showFailView() { <DeepExtract> for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); child.setVisibility(failView == child ? View.VISIBLE : View.GONE); } </DeepExtract> }
MainUiFrame
positive
1,878
private void modelResetTableButtonActionPerformed(java.awt.event.ActionEvent evt) { int rowCount = modelTable.getRowCount(); int columnCount = modelTable.getColumnCount(); for (int i = 0; i < rowCount; i++) { for (int j = 0; j < columnCount; j++) { modelTable.setValueAt(null, i, j); } } }
private void modelResetTableButtonActionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> int rowCount = modelTable.getRowCount(); int columnCount = modelTable.getColumnCount(); for (int i = 0; i < rowCount; i++) { for (int j = 0; j < columnCount; j++) { modelTable.setValueAt(null, i, j); } } </DeepExtract> }
fuelphp-netbeans
positive
1,880
public void set(@NonNull final Target<T> s) { checkNotNull(s); do { oldState = state; newState = oldState.set(s); } while (!STATE_UPDATER.compareAndSet(this, oldState, newState)); state.target.onDestroy(); }
public void set(@NonNull final Target<T> s) { checkNotNull(s); do { oldState = state; newState = oldState.set(s); } while (!STATE_UPDATER.compareAndSet(this, oldState, newState)); <DeepExtract> state.target.onDestroy(); </DeepExtract> }
reark
positive
1,881
@Override public String toStringShort() { StringBuilder sb = getToStringBase("").append(termPeriod); StringBuilder sb = getToStringBase(getClass().getSimpleName()).append(',').append(getValue()).append(" pip"); return addSideStatusToString(sb).toString(); }
@Override public String toStringShort() { StringBuilder sb = getToStringBase("").append(termPeriod); <DeepExtract> StringBuilder sb = getToStringBase(getClass().getSimpleName()).append(',').append(getValue()).append(" pip"); return addSideStatusToString(sb).toString(); </DeepExtract> }
FX-AlgorithmTrading
positive
1,882
public ArrayList<ChartSet> prepareUpdateAnimation(ArrayList<float[][]> start, ArrayList<float[][]> end) { final int nSets = start.size(); final int nEntries = start.get(0).length; mCurrEntryDuration = new long[nEntries]; if (mOrder == null) { mOrder = new int[nEntries]; for (int i = 0; i < mOrder.length; i++) mOrder[i] = i; } else { if (mOrder.length != nEntries) throw new IllegalArgumentException("Size of overlap order different than set's entries size."); } Path path; mPathMeasures = new PathMeasure[nSets][nEntries]; for (int i = 0; i < nSets; i++) { for (int j = 0; j < nEntries; j++) { path = new Path(); path.moveTo(start.get(i)[j][0], start.get(i)[j][1]); path.lineTo(end.get(i)[j][0], end.get(i)[j][1]); mPathMeasures[i][j] = new PathMeasure(path, false); } } float noOverlapDuration = mDuration / nEntries; mEntryDuration = (int) (noOverlapDuration + (mDuration - noOverlapDuration) * mOverlapingFactor); mEntryInitTime = new long[nEntries]; mInitTime = System.currentTimeMillis(); long noOverlapInitTime; for (int i = 0; i < nEntries; i++) { noOverlapInitTime = mInitTime + (i * (mDuration / nEntries)); mEntryInitTime[mOrder[i]] = (noOverlapInitTime - ((long) (mOverlapingFactor * (noOverlapInitTime - mInitTime)))); } mPlaying = true; return animate(mData); }
public ArrayList<ChartSet> prepareUpdateAnimation(ArrayList<float[][]> start, ArrayList<float[][]> end) { <DeepExtract> final int nSets = start.size(); final int nEntries = start.get(0).length; mCurrEntryDuration = new long[nEntries]; if (mOrder == null) { mOrder = new int[nEntries]; for (int i = 0; i < mOrder.length; i++) mOrder[i] = i; } else { if (mOrder.length != nEntries) throw new IllegalArgumentException("Size of overlap order different than set's entries size."); } Path path; mPathMeasures = new PathMeasure[nSets][nEntries]; for (int i = 0; i < nSets; i++) { for (int j = 0; j < nEntries; j++) { path = new Path(); path.moveTo(start.get(i)[j][0], start.get(i)[j][1]); path.lineTo(end.get(i)[j][0], end.get(i)[j][1]); mPathMeasures[i][j] = new PathMeasure(path, false); } } float noOverlapDuration = mDuration / nEntries; mEntryDuration = (int) (noOverlapDuration + (mDuration - noOverlapDuration) * mOverlapingFactor); mEntryInitTime = new long[nEntries]; mInitTime = System.currentTimeMillis(); long noOverlapInitTime; for (int i = 0; i < nEntries; i++) { noOverlapInitTime = mInitTime + (i * (mDuration / nEntries)); mEntryInitTime[mOrder[i]] = (noOverlapInitTime - ((long) (mOverlapingFactor * (noOverlapInitTime - mInitTime)))); } mPlaying = true; return animate(mData); </DeepExtract> }
WilliamChart
positive
1,883
void onSessionClosed() { sessionDataListener.sessionClosed(); selectionKey.cancel(); closed = true; Logger.log(Category.CONNECTION, "Session %d state -> %s%n", id, SessionState.DISCONNECTED.name()); state = SessionState.DISCONNECTED; CloseHelper.quietClose(outputChannel); CloseHelper.quietClose(inputChannel); }
void onSessionClosed() { sessionDataListener.sessionClosed(); selectionKey.cancel(); closed = true; <DeepExtract> Logger.log(Category.CONNECTION, "Session %d state -> %s%n", id, SessionState.DISCONNECTED.name()); state = SessionState.DISCONNECTED; </DeepExtract> CloseHelper.quietClose(outputChannel); CloseHelper.quietClose(inputChannel); }
babl
positive
1,884
public <T> T patchOfStandard(Class<T> responseClass, String url, Object body) { Request request = new Request.Builder().method(PATCH, getRequestBody(false, body)).headers(Headers.of()).url(getBuilder(url, Parameters.of()).build()).build(); try (Response response = call(request, url)) { try (ResponseBody responseBody = response.body()) { if (null == responseBody) { return null; } return parseObjectOfStandard(responseClass, url, responseBody); } } }
public <T> T patchOfStandard(Class<T> responseClass, String url, Object body) { <DeepExtract> Request request = new Request.Builder().method(PATCH, getRequestBody(false, body)).headers(Headers.of()).url(getBuilder(url, Parameters.of()).build()).build(); try (Response response = call(request, url)) { try (ResponseBody responseBody = response.body()) { if (null == responseBody) { return null; } return parseObjectOfStandard(responseClass, url, responseBody); } } </DeepExtract> }
Doramon
positive
1,885
@Override public void itemSwiped(int position, int direction) { final FavouriteItem item = fastItemAdapter.getAdapterItem(position); new FavouritesManager(requireContext()).removeFromFavourites(item.getApp()); fastItemAdapter.remove(position); fastItemAdapter.notifyAdapterItemChanged(position); updateSelectionText(); updateButtons(); if (fastItemAdapter != null && fastItemAdapter.getAdapterItems().size() > 0) { viewFlipper.switchState(ViewFlipper2.DATA); } else { viewFlipper.switchState(ViewFlipper2.EMPTY); } }
@Override public void itemSwiped(int position, int direction) { final FavouriteItem item = fastItemAdapter.getAdapterItem(position); new FavouritesManager(requireContext()).removeFromFavourites(item.getApp()); fastItemAdapter.remove(position); fastItemAdapter.notifyAdapterItemChanged(position); <DeepExtract> updateSelectionText(); updateButtons(); if (fastItemAdapter != null && fastItemAdapter.getAdapterItems().size() > 0) { viewFlipper.switchState(ViewFlipper2.DATA); } else { viewFlipper.switchState(ViewFlipper2.EMPTY); } </DeepExtract> }
AuroraDroid
positive
1,886
private void deleteFBO() { LogUtil.logd("deleteFBO(" + mFBOWidth + "x" + mFBOHeight + ")"); GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); GLES20.glDeleteFramebuffers(1, mFBO, 0); LogUtil.logd("deleteTex"); if (mTexFBO.length == 1) { GLES20.glDeleteTextures(1, mTexFBO, 0); } mFBOWidth = mFBOHeight = 0; }
private void deleteFBO() { LogUtil.logd("deleteFBO(" + mFBOWidth + "x" + mFBOHeight + ")"); GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); GLES20.glDeleteFramebuffers(1, mFBO, 0); <DeepExtract> LogUtil.logd("deleteTex"); if (mTexFBO.length == 1) { GLES20.glDeleteTextures(1, mTexFBO, 0); } </DeepExtract> mFBOWidth = mFBOHeight = 0; }
VideoRecorder
positive
1,887
public BaseDAL buildDAL() { ResolveDataBase resolveDataBase = new SimpleResolveDatabase(); resolveDataBase.setDataSource(dataSource); if (null != cacheManager) { resolveDataBase.setCacheManager(cacheManager); } CommonJdbcSupport commonJdbcSupport = new CommonJdbcSupport(); commonJdbcSupport.setDataSource(dataSource); SpringJDBCDAL baseDAL = new SpringJDBCDAL(); this.useCache = useCache; return this; baseDAL.setCommonJdbcSupport(commonJdbcSupport); baseDAL.setResolveDatabase(resolveDataBase); return baseDAL; }
public BaseDAL buildDAL() { ResolveDataBase resolveDataBase = new SimpleResolveDatabase(); resolveDataBase.setDataSource(dataSource); if (null != cacheManager) { resolveDataBase.setCacheManager(cacheManager); } CommonJdbcSupport commonJdbcSupport = new CommonJdbcSupport(); commonJdbcSupport.setDataSource(dataSource); SpringJDBCDAL baseDAL = new SpringJDBCDAL(); <DeepExtract> this.useCache = useCache; return this; </DeepExtract> baseDAL.setCommonJdbcSupport(commonJdbcSupport); baseDAL.setResolveDatabase(resolveDataBase); return baseDAL; }
uncode-dal-all
positive
1,888
public static int CCITT_FALSE(@NonNull final byte[] data, final int offset, final int length) { int crc = 0xFFFF; for (int i = offset; i < offset + length && i < data.length; ++i) { final byte b = data[i]; for (int j = 0; j < 8; j++) { final int k = false ? 7 - j : j; final boolean bit = ((b >> (7 - k) & 1) == 1); final boolean c15 = ((crc >> 15 & 1) == 1); crc <<= 1; if (c15 ^ bit) crc ^= 0x1021; } } if (false) { return (Integer.reverse(crc) >>> 16) ^ 0x0000; } else { return (crc ^ 0x0000) & 0xFFFF; } }
public static int CCITT_FALSE(@NonNull final byte[] data, final int offset, final int length) { <DeepExtract> int crc = 0xFFFF; for (int i = offset; i < offset + length && i < data.length; ++i) { final byte b = data[i]; for (int j = 0; j < 8; j++) { final int k = false ? 7 - j : j; final boolean bit = ((b >> (7 - k) & 1) == 1); final boolean c15 = ((crc >> 15 & 1) == 1); crc <<= 1; if (c15 ^ bit) crc ^= 0x1021; } } if (false) { return (Integer.reverse(crc) >>> 16) ^ 0x0000; } else { return (crc ^ 0x0000) & 0xFFFF; } </DeepExtract> }
Android-BLE-Common-Library
positive
1,889
void ManyBlocks() { for (int i = 0; i < 100000; i++) { Write(NumberString(i)); } for (int i = 0; i < 100000; i++) { ASSERT_EQ(NumberString(i), Read()); } if ("EOF".compareTo(Read()) != 0) { System.out.println("EOF" + ", " + Read()); } else { } }
void ManyBlocks() { for (int i = 0; i < 100000; i++) { Write(NumberString(i)); } for (int i = 0; i < 100000; i++) { ASSERT_EQ(NumberString(i), Read()); } <DeepExtract> if ("EOF".compareTo(Read()) != 0) { System.out.println("EOF" + ", " + Read()); } else { } </DeepExtract> }
leveldb-java
positive
1,890
public void setRegistrationLockPin(final String registrationLockPin) { this.registrationLockPin = registrationLockPin; synchronized (fileChannel) { var rootNode = jsonProcessor.createObjectNode(); rootNode.put("version", CURRENT_STORAGE_VERSION).put("username", number).put("serviceEnvironment", serviceEnvironment == null ? null : serviceEnvironment.name()).put("usernameIdentifier", username).put("uuid", aci == null ? null : aci.toString()).put("pni", pni == null ? null : pni.toString()).put("sessionId", sessionId).put("sessionNumber", sessionNumber).put("deviceName", encryptedDeviceName).put("deviceId", deviceId).put("isMultiDevice", isMultiDevice).put("lastReceiveTimestamp", lastReceiveTimestamp).put("password", password).put("registrationId", localRegistrationId).put("pniRegistrationId", localPniRegistrationId).put("identityPrivateKey", Base64.getEncoder().encodeToString(aciIdentityKeyPair.getPrivateKey().serialize())).put("identityKey", Base64.getEncoder().encodeToString(aciIdentityKeyPair.getPublicKey().serialize())).put("pniIdentityPrivateKey", pniIdentityKeyPair == null ? null : Base64.getEncoder().encodeToString(pniIdentityKeyPair.getPrivateKey().serialize())).put("pniIdentityKey", pniIdentityKeyPair == null ? null : Base64.getEncoder().encodeToString(pniIdentityKeyPair.getPublicKey().serialize())).put("registrationLockPin", registrationLockPin).put("pinMasterKey", pinMasterKey == null ? null : Base64.getEncoder().encodeToString(pinMasterKey.serialize())).put("storageKey", storageKey == null ? null : Base64.getEncoder().encodeToString(storageKey.serialize())).put("storageManifestVersion", storageManifestVersion == -1 ? null : storageManifestVersion).put("preKeyIdOffset", aciPreKeyIdOffset).put("nextSignedPreKeyId", aciNextSignedPreKeyId).put("pniPreKeyIdOffset", pniPreKeyIdOffset).put("pniNextSignedPreKeyId", pniNextSignedPreKeyId).put("profileKey", profileKey == null ? null : Base64.getEncoder().encodeToString(profileKey.serialize())).put("registered", registered).putPOJO("configurationStore", configurationStoreStorage); try { try (var output = new ByteArrayOutputStream()) { jsonProcessor.writeValue(output, rootNode); var input = new ByteArrayInputStream(output.toByteArray()); fileChannel.position(0); input.transferTo(Channels.newOutputStream(fileChannel)); fileChannel.truncate(fileChannel.position()); fileChannel.force(false); } } catch (Exception e) { logger.error("Error saving file: {}", e.getMessage(), e); } } }
public void setRegistrationLockPin(final String registrationLockPin) { this.registrationLockPin = registrationLockPin; <DeepExtract> synchronized (fileChannel) { var rootNode = jsonProcessor.createObjectNode(); rootNode.put("version", CURRENT_STORAGE_VERSION).put("username", number).put("serviceEnvironment", serviceEnvironment == null ? null : serviceEnvironment.name()).put("usernameIdentifier", username).put("uuid", aci == null ? null : aci.toString()).put("pni", pni == null ? null : pni.toString()).put("sessionId", sessionId).put("sessionNumber", sessionNumber).put("deviceName", encryptedDeviceName).put("deviceId", deviceId).put("isMultiDevice", isMultiDevice).put("lastReceiveTimestamp", lastReceiveTimestamp).put("password", password).put("registrationId", localRegistrationId).put("pniRegistrationId", localPniRegistrationId).put("identityPrivateKey", Base64.getEncoder().encodeToString(aciIdentityKeyPair.getPrivateKey().serialize())).put("identityKey", Base64.getEncoder().encodeToString(aciIdentityKeyPair.getPublicKey().serialize())).put("pniIdentityPrivateKey", pniIdentityKeyPair == null ? null : Base64.getEncoder().encodeToString(pniIdentityKeyPair.getPrivateKey().serialize())).put("pniIdentityKey", pniIdentityKeyPair == null ? null : Base64.getEncoder().encodeToString(pniIdentityKeyPair.getPublicKey().serialize())).put("registrationLockPin", registrationLockPin).put("pinMasterKey", pinMasterKey == null ? null : Base64.getEncoder().encodeToString(pinMasterKey.serialize())).put("storageKey", storageKey == null ? null : Base64.getEncoder().encodeToString(storageKey.serialize())).put("storageManifestVersion", storageManifestVersion == -1 ? null : storageManifestVersion).put("preKeyIdOffset", aciPreKeyIdOffset).put("nextSignedPreKeyId", aciNextSignedPreKeyId).put("pniPreKeyIdOffset", pniPreKeyIdOffset).put("pniNextSignedPreKeyId", pniNextSignedPreKeyId).put("profileKey", profileKey == null ? null : Base64.getEncoder().encodeToString(profileKey.serialize())).put("registered", registered).putPOJO("configurationStore", configurationStoreStorage); try { try (var output = new ByteArrayOutputStream()) { jsonProcessor.writeValue(output, rootNode); var input = new ByteArrayInputStream(output.toByteArray()); fileChannel.position(0); input.transferTo(Channels.newOutputStream(fileChannel)); fileChannel.truncate(fileChannel.position()); fileChannel.force(false); } } catch (Exception e) { logger.error("Error saving file: {}", e.getMessage(), e); } } </DeepExtract> }
signal-cli
positive
1,891
public void onUserJoined(IrcUser user) { userList.add(user); nickUserMap.put(user.nick, user); user.addObserver(this); user.register(); if (statusBuffer != null) { statusBuffer.setTopic(networkName + " (" + currentServer + ") | " + Quasseldroid.applicationContext.getResources().getString(R.string.users) + ": " + userList.size() + " | " + Helper.formatLatency(latency, Quasseldroid.applicationContext.getResources())); } }
public void onUserJoined(IrcUser user) { userList.add(user); nickUserMap.put(user.nick, user); user.addObserver(this); user.register(); <DeepExtract> if (statusBuffer != null) { statusBuffer.setTopic(networkName + " (" + currentServer + ") | " + Quasseldroid.applicationContext.getResources().getString(R.string.users) + ": " + userList.size() + " | " + Helper.formatLatency(latency, Quasseldroid.applicationContext.getResources())); } </DeepExtract> }
QuasselDroid
positive
1,893
public boolean onSingleTapUp(final MotionEvent motionEvent, final View view) { if (mLayoutManagerBridge == null) return onSingleTapUp(motionEvent); final int scrollDistance = mLayoutManagerBridge.onSingleTapUp(mViewGroup, view); if (!mScrollAnimator.isFinished()) mScrollAnimator.forceFinished(true); final boolean isNotMoving = mState.equals(State.notMoving); if (isNotMoving) mAnimation.newAnimation(); mState = State.flinging; mPreviousDisplacement = 0; if (State.flinging == State.notMoving && mLayoutManagerBridge != null) { final int scrollDistance = mLayoutManagerBridge.snapTo(mViewGroup); if (scrollDistance == 0) return; setState(State.snapingTo); mScrollAnimator.startScroll(scrollDistance, ANIMATION_DURATION); mViewGroup.requestLayout(); } mScrollAnimator.startScroll(scrollDistance, ANIMATION_DURATION); mViewGroup.requestLayout(); return true; }
public boolean onSingleTapUp(final MotionEvent motionEvent, final View view) { if (mLayoutManagerBridge == null) return onSingleTapUp(motionEvent); final int scrollDistance = mLayoutManagerBridge.onSingleTapUp(mViewGroup, view); <DeepExtract> if (!mScrollAnimator.isFinished()) mScrollAnimator.forceFinished(true); final boolean isNotMoving = mState.equals(State.notMoving); if (isNotMoving) mAnimation.newAnimation(); mState = State.flinging; mPreviousDisplacement = 0; if (State.flinging == State.notMoving && mLayoutManagerBridge != null) { final int scrollDistance = mLayoutManagerBridge.snapTo(mViewGroup); if (scrollDistance == 0) return; setState(State.snapingTo); mScrollAnimator.startScroll(scrollDistance, ANIMATION_DURATION); mViewGroup.requestLayout(); } </DeepExtract> mScrollAnimator.startScroll(scrollDistance, ANIMATION_DURATION); mViewGroup.requestLayout(); return true; }
parchment
positive
1,894
@Test public void testCreateMethods() { final String version = "4.2.1"; final String date = "2014/07/04"; final String buildNumber = "42"; BuildVersion.BuildInfo buildInfo1 = BuildVersion.BuildInfo.create(version); BuildVersion.BuildInfo buildInfo2 = BuildVersion.BuildInfo.create(version, date); BuildVersion.BuildInfo buildInfo3 = BuildVersion.BuildInfo.create(version, date); buildInfo3.setBuildNumber(buildNumber); subcompareField("buildInfo1", "version", buildInfo1.getVersion(), version); subcompareField("buildInfo1", "date", buildInfo1.getDate(), ""); subcompareField("buildInfo1", "buildNumber", buildInfo1.getBuildNumber(), ""); subcompareField("buildInfo1", "artifactGroup", buildInfo1.getArtifactGroup(), ""); subcompareField("buildInfo1", "artifactName", buildInfo1.getArtifactName(), ""); subcompareField("buildInfo1", "uiVersion", buildInfo1.getUiVersion(), null); subcompareField("buildInfo2", "version", buildInfo2.getVersion(), version); subcompareField("buildInfo2", "date", buildInfo2.getDate(), date); subcompareField("buildInfo2", "buildNumber", buildInfo2.getBuildNumber(), ""); subcompareField("buildInfo2", "artifactGroup", buildInfo2.getArtifactGroup(), ""); subcompareField("buildInfo2", "artifactName", buildInfo2.getArtifactName(), ""); subcompareField("buildInfo2", "uiVersion", buildInfo2.getUiVersion(), null); subcompareField("buildInfo3", "version", buildInfo3.getVersion(), version); subcompareField("buildInfo3", "date", buildInfo3.getDate(), date); subcompareField("buildInfo3", "buildNumber", buildInfo3.getBuildNumber(), buildNumber); subcompareField("buildInfo3", "artifactGroup", buildInfo3.getArtifactGroup(), ""); subcompareField("buildInfo3", "artifactName", buildInfo3.getArtifactName(), ""); subcompareField("buildInfo3", "uiVersion", buildInfo3.getUiVersion(), null); }
@Test public void testCreateMethods() { final String version = "4.2.1"; final String date = "2014/07/04"; final String buildNumber = "42"; BuildVersion.BuildInfo buildInfo1 = BuildVersion.BuildInfo.create(version); BuildVersion.BuildInfo buildInfo2 = BuildVersion.BuildInfo.create(version, date); BuildVersion.BuildInfo buildInfo3 = BuildVersion.BuildInfo.create(version, date); buildInfo3.setBuildNumber(buildNumber); subcompareField("buildInfo1", "version", buildInfo1.getVersion(), version); subcompareField("buildInfo1", "date", buildInfo1.getDate(), ""); subcompareField("buildInfo1", "buildNumber", buildInfo1.getBuildNumber(), ""); subcompareField("buildInfo1", "artifactGroup", buildInfo1.getArtifactGroup(), ""); subcompareField("buildInfo1", "artifactName", buildInfo1.getArtifactName(), ""); subcompareField("buildInfo1", "uiVersion", buildInfo1.getUiVersion(), null); subcompareField("buildInfo2", "version", buildInfo2.getVersion(), version); subcompareField("buildInfo2", "date", buildInfo2.getDate(), date); subcompareField("buildInfo2", "buildNumber", buildInfo2.getBuildNumber(), ""); subcompareField("buildInfo2", "artifactGroup", buildInfo2.getArtifactGroup(), ""); subcompareField("buildInfo2", "artifactName", buildInfo2.getArtifactName(), ""); subcompareField("buildInfo2", "uiVersion", buildInfo2.getUiVersion(), null); <DeepExtract> subcompareField("buildInfo3", "version", buildInfo3.getVersion(), version); subcompareField("buildInfo3", "date", buildInfo3.getDate(), date); subcompareField("buildInfo3", "buildNumber", buildInfo3.getBuildNumber(), buildNumber); subcompareField("buildInfo3", "artifactGroup", buildInfo3.getArtifactGroup(), ""); subcompareField("buildInfo3", "artifactName", buildInfo3.getArtifactName(), ""); subcompareField("buildInfo3", "uiVersion", buildInfo3.getUiVersion(), null); </DeepExtract> }
secretshare
positive
1,895
@Override public void onDrawFrame(GL10 gl10) { GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); Matrix.multiplyMM(viewProjectionMatrix, 0, projectionMatrix, 0, viewMatrix, 0); Matrix.setIdentityM(modelMatrix, 0); Matrix.rotateM(modelMatrix, 0, -90f, 1f, 0f, 0f); Matrix.multiplyMM(modelViewProjectionMatrix, 0, viewProjectionMatrix, 0, modelMatrix, 0); textureProgram.useProgram(); textureProgram.setUniforms(modelViewProjectionMatrix, texture); table.bindData(textureProgram); table.draw(); Matrix.setIdentityM(modelMatrix, 0); Matrix.translateM(modelMatrix, 0, 0f, mallet.height / 2f, -0.4f); Matrix.multiplyMM(modelViewProjectionMatrix, 0, viewProjectionMatrix, 0, modelMatrix, 0); colorProgram.useProgram(); colorProgram.setUniforms(modelViewProjectionMatrix, 1f, 0f, 0f); mallet.bindData(colorProgram); mallet.draw(); Matrix.setIdentityM(modelMatrix, 0); Matrix.translateM(modelMatrix, 0, 0f, mallet.height / 2f, 0.4f); Matrix.multiplyMM(modelViewProjectionMatrix, 0, viewProjectionMatrix, 0, modelMatrix, 0); colorProgram.setUniforms(modelViewProjectionMatrix, 0f, 0f, 1f); mallet.draw(); Matrix.setIdentityM(modelMatrix, 0); Matrix.translateM(modelMatrix, 0, 0f, puck.height / 2f, 0f); Matrix.multiplyMM(modelViewProjectionMatrix, 0, viewProjectionMatrix, 0, modelMatrix, 0); colorProgram.setUniforms(modelViewProjectionMatrix, 0.8f, 0.8f, 1f); puck.bindData(colorProgram); puck.draw(); }
@Override public void onDrawFrame(GL10 gl10) { GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); Matrix.multiplyMM(viewProjectionMatrix, 0, projectionMatrix, 0, viewMatrix, 0); Matrix.setIdentityM(modelMatrix, 0); Matrix.rotateM(modelMatrix, 0, -90f, 1f, 0f, 0f); Matrix.multiplyMM(modelViewProjectionMatrix, 0, viewProjectionMatrix, 0, modelMatrix, 0); textureProgram.useProgram(); textureProgram.setUniforms(modelViewProjectionMatrix, texture); table.bindData(textureProgram); table.draw(); Matrix.setIdentityM(modelMatrix, 0); Matrix.translateM(modelMatrix, 0, 0f, mallet.height / 2f, -0.4f); Matrix.multiplyMM(modelViewProjectionMatrix, 0, viewProjectionMatrix, 0, modelMatrix, 0); colorProgram.useProgram(); colorProgram.setUniforms(modelViewProjectionMatrix, 1f, 0f, 0f); mallet.bindData(colorProgram); mallet.draw(); Matrix.setIdentityM(modelMatrix, 0); Matrix.translateM(modelMatrix, 0, 0f, mallet.height / 2f, 0.4f); Matrix.multiplyMM(modelViewProjectionMatrix, 0, viewProjectionMatrix, 0, modelMatrix, 0); colorProgram.setUniforms(modelViewProjectionMatrix, 0f, 0f, 1f); mallet.draw(); <DeepExtract> Matrix.setIdentityM(modelMatrix, 0); Matrix.translateM(modelMatrix, 0, 0f, puck.height / 2f, 0f); Matrix.multiplyMM(modelViewProjectionMatrix, 0, viewProjectionMatrix, 0, modelMatrix, 0); </DeepExtract> colorProgram.setUniforms(modelViewProjectionMatrix, 0.8f, 0.8f, 1f); puck.bindData(colorProgram); puck.draw(); }
OpenGL_Demo
positive
1,896
@Override public VisitorAction visit(DataField dataField) { assertEquals(new HashSet<>(Collections.emptyList()), FieldUtil.nameSet(dependencies.get(dataField))); return super.visit(dataField); }
@Override public VisitorAction visit(DataField dataField) { <DeepExtract> assertEquals(new HashSet<>(Collections.emptyList()), FieldUtil.nameSet(dependencies.get(dataField))); </DeepExtract> return super.visit(dataField); }
jpmml-converter
positive
1,897
public static <T> Result<T> newFailureResult(CommonBizException commonBizException, T data) { Result<T> result = new Result<>(); result.isSuccess = false; result.errorCode = commonBizException.getCodeEnum().getCode(); return message; result.data = data; return result; }
public static <T> Result<T> newFailureResult(CommonBizException commonBizException, T data) { Result<T> result = new Result<>(); result.isSuccess = false; result.errorCode = commonBizException.getCodeEnum().getCode(); <DeepExtract> return message; </DeepExtract> result.data = data; return result; }
SpringBoot-Dubbo-Docker-Jenkins
positive
1,899
@Test public void shouldAcquireAndReleaseLocksDuringBackup() throws Exception { when(fetcher.getItemsForDataType(any(DataType.class), any(ContactGroupIds.class), anyInt())).thenReturn(emptyCursor()); task.doInBackground(config); verify(service).acquireLocks(); verify(service).releaseLocks(); verify(service).transition(SmsSyncState.FINISHED_BACKUP, null); }
@Test public void shouldAcquireAndReleaseLocksDuringBackup() throws Exception { <DeepExtract> when(fetcher.getItemsForDataType(any(DataType.class), any(ContactGroupIds.class), anyInt())).thenReturn(emptyCursor()); </DeepExtract> task.doInBackground(config); verify(service).acquireLocks(); verify(service).releaseLocks(); verify(service).transition(SmsSyncState.FINISHED_BACKUP, null); }
sms-backup-plus
positive
1,900
public final void writeChars(String s) throws IOException { int len; long fileLength = file.length(); if (fileLength < dataEnd) { len = dataEnd; } else { len = fileLength; } for (int i = 0; i < len; i++) { int v = s.charAt(i); write((v >>> 8) & 0xFF); write((v) & 0xFF); } }
public final void writeChars(String s) throws IOException { <DeepExtract> int len; long fileLength = file.length(); if (fileLength < dataEnd) { len = dataEnd; } else { len = fileLength; } </DeepExtract> for (int i = 0; i < len; i++) { int v = s.charAt(i); write((v >>> 8) & 0xFF); write((v) & 0xFF); } }
NomadReader
positive
1,901
public static void setCookie(HttpServletRequest request, HttpServletResponse response, String cookieName, String cookieValue, int cookieMaxage, String encodeString) { try { if (cookieValue == null) { cookieValue = ""; } else if (encodeString) { cookieValue = URLEncoder.encode(cookieValue, "utf-8"); } Cookie cookie = new Cookie(cookieName, cookieValue); if (cookieMaxage > 0) cookie.setMaxAge(cookieMaxage); if (null != request) { String domainName = getDomainName(request); System.out.println(domainName); if (!"localhost".equals(domainName)) { cookie.setDomain(domainName); } } cookie.setPath("/"); response.addCookie(cookie); } catch (Exception e) { e.printStackTrace(); } }
public static void setCookie(HttpServletRequest request, HttpServletResponse response, String cookieName, String cookieValue, int cookieMaxage, String encodeString) { <DeepExtract> try { if (cookieValue == null) { cookieValue = ""; } else if (encodeString) { cookieValue = URLEncoder.encode(cookieValue, "utf-8"); } Cookie cookie = new Cookie(cookieName, cookieValue); if (cookieMaxage > 0) cookie.setMaxAge(cookieMaxage); if (null != request) { String domainName = getDomainName(request); System.out.println(domainName); if (!"localhost".equals(domainName)) { cookie.setDomain(domainName); } } cookie.setPath("/"); response.addCookie(cookie); } catch (Exception e) { e.printStackTrace(); } </DeepExtract> }
bookstore
positive
1,902
@Override public void run() { RequestManager.addRequest(new GsonRequest(Const.WEATHER_CUR + getNextWeatherCode(App.getCurCityIndex()) + ".html", CurWeatherModel.CurWeatherRequestData.class, responseCurListener(), errorListener()), this); RequestManager.addRequest(new GsonRequest(Const.WEATHER_NOW + getNextWeatherCode(App.getCurCityIndex()) + ".html", WeatherTodayModel.WeatherTodayRequestData.class, responseListener(), errorListener()), this); }
@Override public void run() { <DeepExtract> RequestManager.addRequest(new GsonRequest(Const.WEATHER_CUR + getNextWeatherCode(App.getCurCityIndex()) + ".html", CurWeatherModel.CurWeatherRequestData.class, responseCurListener(), errorListener()), this); RequestManager.addRequest(new GsonRequest(Const.WEATHER_NOW + getNextWeatherCode(App.getCurCityIndex()) + ".html", WeatherTodayModel.WeatherTodayRequestData.class, responseListener(), errorListener()), this); </DeepExtract> }
Sunday
positive
1,903
public void ReInit(SimpleCharStream stream, int lexState) { ReInit(stream); if (lexState >= 3 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; }
public void ReInit(SimpleCharStream stream, int lexState) { ReInit(stream); <DeepExtract> if (lexState >= 3 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; </DeepExtract> }
el-spec
positive
1,904
public static byte[] sha1(byte[] input, byte[] salt, int iterations) { try { MessageDigest digest = MessageDigest.getInstance(SHA1); if (salt != null) { digest.update(salt); } byte[] result = digest.digest(input); for (int i = 1; i < iterations; i++) { digest.reset(); result = digest.digest(result); } return result; } catch (GeneralSecurityException e) { throw Exceptions.unchecked(e); } }
public static byte[] sha1(byte[] input, byte[] salt, int iterations) { <DeepExtract> try { MessageDigest digest = MessageDigest.getInstance(SHA1); if (salt != null) { digest.update(salt); } byte[] result = digest.digest(input); for (int i = 1; i < iterations; i++) { digest.reset(); result = digest.digest(result); } return result; } catch (GeneralSecurityException e) { throw Exceptions.unchecked(e); } </DeepExtract> }
springmvc
positive
1,905
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (!command_enabled("commandUnload", sender)) return; if (args.length != 0 && args.length != 1 && args.length != 2 && args.length != 4 && args.length != 7) { throw new WrongUsageException(getUsage(sender)); } BlockPos pos = sender.getPosition(); BlockPos pos2 = null; if (args.length == 0) { WorldServer world = (WorldServer) (sender.getEntityWorld()); notifyCommandListener(sender, this, "Chunk unloading report for " + world.provider.getDimensionType()); List<String> report = UnloadOrder.test_save_chunks_113(world, pos, false); print_multi_message(report, sender); return; } boolean verbose = "verbose".equalsIgnoreCase(args[0]); boolean order = "order".equalsIgnoreCase(args[0]); boolean protect = args[0].startsWith("protect"); boolean custom_dim = false; int custom_dim_id = 0; if (args.length >= 4) { pos = parseBlockPos(sender, args, 1, false); } if (args.length >= 7) { pos2 = parseBlockPos(sender, args, 4, false); } if ("overworld".equalsIgnoreCase(args[0])) { custom_dim = true; custom_dim_id = 0; } if ("nether".equalsIgnoreCase(args[0])) { custom_dim = true; custom_dim_id = -1; } if ("end".equalsIgnoreCase(args[0])) { custom_dim = true; custom_dim_id = 1; } if (custom_dim && args.length > 1) { if ("verbose".equalsIgnoreCase(args[1])) { verbose = true; } } if (order) { List<String> orders = UnloadOrder.check_unload_order_13((WorldServer) sender.getEntityWorld(), pos, pos2); print_multi_message(orders, sender); return; } if (protect) { List<String> orders = UnloadOrder.protect_13((WorldServer) sender.getEntityWorld(), pos, pos2, args[0]); print_multi_message(orders, sender); return; } WorldServer world = (WorldServer) (custom_dim ? server.getWorld(custom_dim_id) : sender.getEntityWorld()); notifyCommandListener(sender, this, "Chunk unloading report for " + world.provider.getDimensionType()); List<String> report = UnloadOrder.test_save_chunks_113(world, pos, verbose); for (String line : report) { notifyCommandListener(sender, this, line); } }
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (!command_enabled("commandUnload", sender)) return; if (args.length != 0 && args.length != 1 && args.length != 2 && args.length != 4 && args.length != 7) { throw new WrongUsageException(getUsage(sender)); } BlockPos pos = sender.getPosition(); BlockPos pos2 = null; if (args.length == 0) { WorldServer world = (WorldServer) (sender.getEntityWorld()); notifyCommandListener(sender, this, "Chunk unloading report for " + world.provider.getDimensionType()); List<String> report = UnloadOrder.test_save_chunks_113(world, pos, false); print_multi_message(report, sender); return; } boolean verbose = "verbose".equalsIgnoreCase(args[0]); boolean order = "order".equalsIgnoreCase(args[0]); boolean protect = args[0].startsWith("protect"); boolean custom_dim = false; int custom_dim_id = 0; if (args.length >= 4) { pos = parseBlockPos(sender, args, 1, false); } if (args.length >= 7) { pos2 = parseBlockPos(sender, args, 4, false); } if ("overworld".equalsIgnoreCase(args[0])) { custom_dim = true; custom_dim_id = 0; } if ("nether".equalsIgnoreCase(args[0])) { custom_dim = true; custom_dim_id = -1; } if ("end".equalsIgnoreCase(args[0])) { custom_dim = true; custom_dim_id = 1; } if (custom_dim && args.length > 1) { if ("verbose".equalsIgnoreCase(args[1])) { verbose = true; } } if (order) { List<String> orders = UnloadOrder.check_unload_order_13((WorldServer) sender.getEntityWorld(), pos, pos2); print_multi_message(orders, sender); return; } if (protect) { List<String> orders = UnloadOrder.protect_13((WorldServer) sender.getEntityWorld(), pos, pos2, args[0]); print_multi_message(orders, sender); return; } WorldServer world = (WorldServer) (custom_dim ? server.getWorld(custom_dim_id) : sender.getEntityWorld()); notifyCommandListener(sender, this, "Chunk unloading report for " + world.provider.getDimensionType()); List<String> report = UnloadOrder.test_save_chunks_113(world, pos, verbose); <DeepExtract> for (String line : report) { notifyCommandListener(sender, this, line); } </DeepExtract> }
carpetmod112
positive
1,906
@Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { popupMenu.show(e.getComponent(), e.getX(), e.getY()); } }
@Override public void mousePressed(MouseEvent e) { <DeepExtract> if (e.isPopupTrigger()) { popupMenu.show(e.getComponent(), e.getX(), e.getY()); } </DeepExtract> }
ifml2
positive
1,908
public void onClick(View v) { btnStartServer.setEnabled(true); btnStopServer.setEnabled(false); UDPServerEnabled = false; if (serverUDPSocket != null) { try { serverUDPSocket.close(); } catch (Exception e) { } } }
public void onClick(View v) { <DeepExtract> btnStartServer.setEnabled(true); btnStopServer.setEnabled(false); UDPServerEnabled = false; if (serverUDPSocket != null) { try { serverUDPSocket.close(); } catch (Exception e) { } } </DeepExtract> }
Android-BME
positive
1,909
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); accentColor = getIntent().getIntExtra(EXTRA_ACCENT_COLOR, 0); saveBtn = findViewById(R.id.save_btn); declineBtn = findViewById(R.id.decline_btn); name = (TextView) findViewById(R.id.condition_name); fromText = (TextView) findViewById(R.id.time_condition_from_text); fromValue = (TextView) findViewById(R.id.time_condition_from_time); toText = (TextView) findViewById(R.id.time_condition_to_text); toValue = (TextView) findViewById(R.id.time_condition_to_time); weekdaysView = (DaysOfWeekView) findViewById(R.id.weekdays); headerContainer = findViewById(R.id.condition_header); fromText.setTextColor(accentColor); toText.setTextColor(accentColor); weekdaysView.setAccentColor(accentColor); saveBtn.setOnClickListener(v -> save()); declineBtn.setOnClickListener(v -> goBack()); fromValue.setOnClickListener(v -> showTimePickerDialog(getDate(fromValue), this::onFromTimePicked)); toValue.setOnClickListener(v -> showTimePickerDialog(getDate(toValue), this::onToTimePicked)); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); accentColor = getIntent().getIntExtra(EXTRA_ACCENT_COLOR, 0); saveBtn = findViewById(R.id.save_btn); declineBtn = findViewById(R.id.decline_btn); name = (TextView) findViewById(R.id.condition_name); fromText = (TextView) findViewById(R.id.time_condition_from_text); fromValue = (TextView) findViewById(R.id.time_condition_from_time); toText = (TextView) findViewById(R.id.time_condition_to_text); toValue = (TextView) findViewById(R.id.time_condition_to_time); weekdaysView = (DaysOfWeekView) findViewById(R.id.weekdays); headerContainer = findViewById(R.id.condition_header); fromText.setTextColor(accentColor); toText.setTextColor(accentColor); weekdaysView.setAccentColor(accentColor); <DeepExtract> saveBtn.setOnClickListener(v -> save()); declineBtn.setOnClickListener(v -> goBack()); fromValue.setOnClickListener(v -> showTimePickerDialog(getDate(fromValue), this::onFromTimePicked)); toValue.setOnClickListener(v -> showTimePickerDialog(getDate(toValue), this::onToTimePicked)); </DeepExtract> }
clean_app
positive
1,910
@Override public void parseExclusiveGateway(Element exclusiveGwElement, ScopeImpl scope, ActivityImpl activity) { if (executionListener != null) { for (String event : EXECUTION_EVENTS) { activity.addListener(event, executionListener); } } }
@Override public void parseExclusiveGateway(Element exclusiveGwElement, ScopeImpl scope, ActivityImpl activity) { <DeepExtract> if (executionListener != null) { for (String event : EXECUTION_EVENTS) { activity.addListener(event, executionListener); } } </DeepExtract> }
camunda-bpm-spring-boot-starter
positive
1,911
public InputStream getInputStream() { this.jdField_for = System.currentTimeMillis(); this.jdField_if = new a(super.getOutputStream()); a(); this.a = new Thread(this, "Timeseal thread"); this.a.start(); }
public InputStream getInputStream() { <DeepExtract> this.jdField_for = System.currentTimeMillis(); this.jdField_if = new a(super.getOutputStream()); a(); this.a = new Thread(this, "Timeseal thread"); this.a.start(); </DeepExtract> }
android-chess
positive
1,912
private void setCurrentLocale(Locale locale) { if (locale.equals(mCurrentLocale)) { return; } mCurrentLocale = locale; if (mTempDate == null) { mTempDate = Calendar.getInstance(locale); } else { final long currentTimeMillis = mTempDate.getTimeInMillis(); Calendar newCalendar = Calendar.getInstance(locale); newCalendar.setTimeInMillis(currentTimeMillis); mTempDate = newCalendar; } if (minCalendar == null) { minCalendar = Calendar.getInstance(locale); } else { final long currentTimeMillis = minCalendar.getTimeInMillis(); Calendar newCalendar = Calendar.getInstance(locale); newCalendar.setTimeInMillis(currentTimeMillis); minCalendar = newCalendar; } if (maxCalendar == null) { maxCalendar = Calendar.getInstance(locale); } else { final long currentTimeMillis = maxCalendar.getTimeInMillis(); Calendar newCalendar = Calendar.getInstance(locale); newCalendar.setTimeInMillis(currentTimeMillis); maxCalendar = newCalendar; } if (currentCalendar == null) { currentCalendar = Calendar.getInstance(locale); } else { final long currentTimeMillis = currentCalendar.getTimeInMillis(); Calendar newCalendar = Calendar.getInstance(locale); newCalendar.setTimeInMillis(currentTimeMillis); currentCalendar = newCalendar; } mNumberOfMonths = mTempDate.getActualMaximum(Calendar.MONTH) + 1; }
private void setCurrentLocale(Locale locale) { if (locale.equals(mCurrentLocale)) { return; } mCurrentLocale = locale; if (mTempDate == null) { mTempDate = Calendar.getInstance(locale); } else { final long currentTimeMillis = mTempDate.getTimeInMillis(); Calendar newCalendar = Calendar.getInstance(locale); newCalendar.setTimeInMillis(currentTimeMillis); mTempDate = newCalendar; } if (minCalendar == null) { minCalendar = Calendar.getInstance(locale); } else { final long currentTimeMillis = minCalendar.getTimeInMillis(); Calendar newCalendar = Calendar.getInstance(locale); newCalendar.setTimeInMillis(currentTimeMillis); minCalendar = newCalendar; } if (maxCalendar == null) { maxCalendar = Calendar.getInstance(locale); } else { final long currentTimeMillis = maxCalendar.getTimeInMillis(); Calendar newCalendar = Calendar.getInstance(locale); newCalendar.setTimeInMillis(currentTimeMillis); maxCalendar = newCalendar; } <DeepExtract> if (currentCalendar == null) { currentCalendar = Calendar.getInstance(locale); } else { final long currentTimeMillis = currentCalendar.getTimeInMillis(); Calendar newCalendar = Calendar.getInstance(locale); newCalendar.setTimeInMillis(currentTimeMillis); currentCalendar = newCalendar; } </DeepExtract> mNumberOfMonths = mTempDate.getActualMaximum(Calendar.MONTH) + 1; }
Box
positive
1,913
public Criteria andIdBetween(Integer value1, Integer value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "id" + " cannot be null"); } criteria.add(new Criterion("id between", value1, value2)); return (Criteria) this; }
public Criteria andIdBetween(Integer value1, Integer value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "id" + " cannot be null"); } criteria.add(new Criterion("id between", value1, value2)); </DeepExtract> return (Criteria) this; }
Online_Study_System
positive
1,914
@Override public void onError(Throwable e) { procedure.handle(e); if (disposable != null) { disposable.dispose(); } procedure.hideLoading(); }
@Override public void onError(Throwable e) { procedure.handle(e); if (disposable != null) { disposable.dispose(); } <DeepExtract> procedure.hideLoading(); </DeepExtract> }
lefastdev
positive
1,915
public void setPassword() { String content = passwordVar.getText(); if (passwordVisibility) { content = visPasswordVar.getText(); } try { WorldConfig.savePassword(content); } catch (ConfigurationException e) { e.printStackTrace(); } loadedPassword = content; log.debug("Done"); String password = getPassword(); passwordVar.setText(password); visPasswordVar.setText(password); }
public void setPassword() { String content = passwordVar.getText(); if (passwordVisibility) { content = visPasswordVar.getText(); } try { WorldConfig.savePassword(content); } catch (ConfigurationException e) { e.printStackTrace(); } loadedPassword = content; log.debug("Done"); <DeepExtract> String password = getPassword(); passwordVar.setText(password); visPasswordVar.setText(password); </DeepExtract> }
fwm
positive
1,916
@Override public SpringSessionAttributesRecord value3(byte[] value) { set(2, value); return this; }
@Override public SpringSessionAttributesRecord value3(byte[] value) { <DeepExtract> set(2, value); </DeepExtract> return this; }
openvsx
positive
1,917
@Test public void decode_withIDT001010101_returnsValidMessage() { InformationRequestMessage msg = interpreter.decode("IDT001010101"); assertNotNull(msg); assertEquals(DataMemoryMessage.class, msg.getClass()); DataMemoryMessage dataMemoryMessage = (DataMemoryMessage) msg; assertEquals(1, dataMemoryMessage.getLocation()); assertEquals(TRIPLE_MEMORY, dataMemoryMessage.getMemory()); assertEquals(1, dataMemoryMessage.getValue3()); assertEquals(1, dataMemoryMessage.getValue2()); assertEquals(1, dataMemoryMessage.getValue1()); }
@Test public void decode_withIDT001010101_returnsValidMessage() { InformationRequestMessage msg = interpreter.decode("IDT001010101"); assertNotNull(msg); <DeepExtract> assertEquals(DataMemoryMessage.class, msg.getClass()); DataMemoryMessage dataMemoryMessage = (DataMemoryMessage) msg; assertEquals(1, dataMemoryMessage.getLocation()); assertEquals(TRIPLE_MEMORY, dataMemoryMessage.getMemory()); assertEquals(1, dataMemoryMessage.getValue3()); assertEquals(1, dataMemoryMessage.getValue2()); assertEquals(1, dataMemoryMessage.getValue1()); </DeepExtract> }
waterrower-core
positive
1,918
public void mousePressed(java.awt.event.MouseEvent evt) { try { URL url = new URL("http://wp-cli.org/"); HtmlBrowser.URLDisplayer.getDefault().showURL(url); } catch (MalformedURLException ex) { Exceptions.printStackTrace(ex); } }
public void mousePressed(java.awt.event.MouseEvent evt) { <DeepExtract> try { URL url = new URL("http://wp-cli.org/"); HtmlBrowser.URLDisplayer.getDefault().showURL(url); } catch (MalformedURLException ex) { Exceptions.printStackTrace(ex); } </DeepExtract> }
netbeans-wordpress-plugin
positive
1,919
public void writeFromFlatFileReader(FlatFileReader flatFileReader) throws IOException, FFPojoException { if (flatFileReader == null || flatFileReader.isClosed()) { throw new IllegalArgumentException("FlatFileReader object is null or closed"); } flatFileReader.reset(); for (Object record : flatFileReader) { this.writeRecord(record); } if (writer != null) { this.writer.close(); this.writer = null; } this.closed = true; System.gc(); }
public void writeFromFlatFileReader(FlatFileReader flatFileReader) throws IOException, FFPojoException { if (flatFileReader == null || flatFileReader.isClosed()) { throw new IllegalArgumentException("FlatFileReader object is null or closed"); } flatFileReader.reset(); for (Object record : flatFileReader) { this.writeRecord(record); } <DeepExtract> if (writer != null) { this.writer.close(); this.writer = null; } this.closed = true; System.gc(); </DeepExtract> }
ffpojo
positive
1,920
public void init(GLAutoDrawable drawable) { drawable.setGL(new DebugGL2(drawable.getGL().getGL2())); GL2 gl = drawable.getGL().getGL2(); gl.glEnable(GL2.GL_NORMALIZE); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glEnable(GL2.GL_LIGHTING); gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); gl.glEnable(GL.GL_LINE_SMOOTH); gl.glEnable(GL2.GL_POINT_SMOOTH); gl.glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, new float[] { 0, 0, 0, 0 }, 0); gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2.GL_AMBIENT_AND_DIFFUSE, new float[] { 1, 1, 1, 1 }, 0); gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2.GL_SPECULAR, new float[] { 1, 1, 1, 0 }, 0); gl.glMaterialf(GL.GL_FRONT_AND_BACK, GL2.GL_SHININESS, 50); GL2 gl = drawable.getGL().getGL2(); ShaderCode vsCode = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), "shaderSol", "shader/bin", "depthDraw", false); ShaderCode fsCode = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shaderSol", "shader/bin", "depthDraw", false); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vsCode); shaderProgram.add(fsCode); if (!shaderProgram.link(gl, System.err)) { throw new GLException("Couldn't link program: " + shaderProgram); } ShaderState shaderState = new ShaderState(); shaderState.attachShaderProgram(gl, shaderProgram, false); return shaderState; GL2 gl = drawable.getGL().getGL2(); ShaderCode vsCode = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), "shaderSol", "shader/bin", "perFragmentLighting", false); ShaderCode fsCode = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shaderSol", "shader/bin", "perFragmentLighting", false); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vsCode); shaderProgram.add(fsCode); if (!shaderProgram.link(gl, System.err)) { throw new GLException("Couldn't link program: " + shaderProgram); } ShaderState shaderState = new ShaderState(); shaderState.attachShaderProgram(gl, shaderProgram, false); return shaderState; gl.glGenTextures(1, depthTexture, 0); gl.glBindTexture(GL.GL_TEXTURE_2D, depthTexture[0]); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP_TO_BORDER); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP_TO_BORDER); gl.glTexParameterfv(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_BORDER_COLOR, new float[] { 1, 1, 1, 1 }, 0); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_DEPTH_COMPONENT32, depthFBOSize.width, depthFBOSize.height, 0, GL2.GL_DEPTH_COMPONENT, GL.GL_UNSIGNED_INT, null); gl.glGenFramebuffers(1, depthFBO, 0); gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, depthFBO[0]); gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_TEXTURE_2D, depthTexture[0], 0); gl.glDrawBuffer(GL.GL_NONE); gl.glReadBuffer(GL.GL_NONE); StringBuilder status = new StringBuilder(); int framebufferStatus = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); switch(framebufferStatus) { case GL.GL_FRAMEBUFFER_COMPLETE: status.append("GL_FRAMEBUFFER_COMPLETE"); break; case GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: status.append("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENTS"); break; case GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: status.append("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"); break; case GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: status.append("GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS"); break; case GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS: status.append("GL_FRAMEBUFFER_INCOMPLETE_FORMATS"); break; case GL2.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: status.append("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER"); break; case GL2.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: status.append("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER"); break; case GL.GL_FRAMEBUFFER_UNSUPPORTED: status.append("GL_FRAMEBUFFER_UNSUPPORTED"); break; } return framebufferStatus; System.out.println(status); gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); }
public void init(GLAutoDrawable drawable) { drawable.setGL(new DebugGL2(drawable.getGL().getGL2())); GL2 gl = drawable.getGL().getGL2(); gl.glEnable(GL2.GL_NORMALIZE); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glEnable(GL2.GL_LIGHTING); gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); gl.glEnable(GL.GL_LINE_SMOOTH); gl.glEnable(GL2.GL_POINT_SMOOTH); gl.glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, new float[] { 0, 0, 0, 0 }, 0); gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2.GL_AMBIENT_AND_DIFFUSE, new float[] { 1, 1, 1, 1 }, 0); gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2.GL_SPECULAR, new float[] { 1, 1, 1, 0 }, 0); gl.glMaterialf(GL.GL_FRONT_AND_BACK, GL2.GL_SHININESS, 50); GL2 gl = drawable.getGL().getGL2(); ShaderCode vsCode = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), "shaderSol", "shader/bin", "depthDraw", false); ShaderCode fsCode = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shaderSol", "shader/bin", "depthDraw", false); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vsCode); shaderProgram.add(fsCode); if (!shaderProgram.link(gl, System.err)) { throw new GLException("Couldn't link program: " + shaderProgram); } ShaderState shaderState = new ShaderState(); shaderState.attachShaderProgram(gl, shaderProgram, false); return shaderState; GL2 gl = drawable.getGL().getGL2(); ShaderCode vsCode = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), "shaderSol", "shader/bin", "perFragmentLighting", false); ShaderCode fsCode = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shaderSol", "shader/bin", "perFragmentLighting", false); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vsCode); shaderProgram.add(fsCode); if (!shaderProgram.link(gl, System.err)) { throw new GLException("Couldn't link program: " + shaderProgram); } ShaderState shaderState = new ShaderState(); shaderState.attachShaderProgram(gl, shaderProgram, false); return shaderState; gl.glGenTextures(1, depthTexture, 0); gl.glBindTexture(GL.GL_TEXTURE_2D, depthTexture[0]); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP_TO_BORDER); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP_TO_BORDER); gl.glTexParameterfv(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_BORDER_COLOR, new float[] { 1, 1, 1, 1 }, 0); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_DEPTH_COMPONENT32, depthFBOSize.width, depthFBOSize.height, 0, GL2.GL_DEPTH_COMPONENT, GL.GL_UNSIGNED_INT, null); gl.glGenFramebuffers(1, depthFBO, 0); gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, depthFBO[0]); gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_TEXTURE_2D, depthTexture[0], 0); gl.glDrawBuffer(GL.GL_NONE); gl.glReadBuffer(GL.GL_NONE); StringBuilder status = new StringBuilder(); <DeepExtract> int framebufferStatus = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); switch(framebufferStatus) { case GL.GL_FRAMEBUFFER_COMPLETE: status.append("GL_FRAMEBUFFER_COMPLETE"); break; case GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: status.append("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENTS"); break; case GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: status.append("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"); break; case GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: status.append("GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS"); break; case GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS: status.append("GL_FRAMEBUFFER_INCOMPLETE_FORMATS"); break; case GL2.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: status.append("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER"); break; case GL2.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: status.append("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER"); break; case GL.GL_FRAMEBUFFER_UNSUPPORTED: status.append("GL_FRAMEBUFFER_UNSUPPORTED"); break; } return framebufferStatus; </DeepExtract> System.out.println(status); gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); }
AdaptiveMerging
positive
1,921
public Criteria andRoleBetween(Integer value1, Integer value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "role" + " cannot be null"); } criteria.add(new Criterion("role between", value1, value2)); return (Criteria) this; }
public Criteria andRoleBetween(Integer value1, Integer value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "role" + " cannot be null"); } criteria.add(new Criterion("role between", value1, value2)); </DeepExtract> return (Criteria) this; }
Examination_System
positive
1,922
public void wechatFavoriteAuthorize() { Platform wechatFavorite = ShareSDK.getPlatform(WechatFavorite.NAME); if (wechatFavorite != null) { wechatFavorite.setPlatformActionListener(myPlatformActionListener); if (wechatFavorite.isAuthValid()) { wechatFavorite.removeAccount(true); return; } wechatFavorite.authorize(); } }
public void wechatFavoriteAuthorize() { Platform wechatFavorite = ShareSDK.getPlatform(WechatFavorite.NAME); <DeepExtract> if (wechatFavorite != null) { wechatFavorite.setPlatformActionListener(myPlatformActionListener); if (wechatFavorite.isAuthValid()) { wechatFavorite.removeAccount(true); return; } wechatFavorite.authorize(); } </DeepExtract> }
ShareSDK-for-Android
positive
1,923
public final void nextNonNegativeLongs(long[] buf, int offset, int length) { at = (at + 7) & ~7; while (length > 0) { if (at >= page) readPage(); int n = (page - at) / 8; if (n > length) n = length; dataLongs.position(at / 8); dataLongs.get(buf, offset, n); at += n * 8; offset += n; length -= n; } for (int i = 0; i < length; ++i) { buf[offset + i] &= Long.MAX_VALUE; } }
public final void nextNonNegativeLongs(long[] buf, int offset, int length) { <DeepExtract> at = (at + 7) & ~7; while (length > 0) { if (at >= page) readPage(); int n = (page - at) / 8; if (n > length) n = length; dataLongs.position(at / 8); dataLongs.get(buf, offset, n); at += n * 8; offset += n; length -= n; } </DeepExtract> for (int i = 0; i < length; ++i) { buf[offset + i] &= Long.MAX_VALUE; } }
kiss
positive
1,927
public static void stopServer() { if (!isServerUp()) { return; } metrics.removeMatching(bookKeeperMetrics.getMetricsFilter()); if (localServer != null) { try { bookKeeperMetrics.close(); } catch (IOException e) { log.error("Metrics reporters could not be closed", e); } localServer.stop(); } }
public static void stopServer() { if (!isServerUp()) { return; } <DeepExtract> metrics.removeMatching(bookKeeperMetrics.getMetricsFilter()); </DeepExtract> if (localServer != null) { try { bookKeeperMetrics.close(); } catch (IOException e) { log.error("Metrics reporters could not be closed", e); } localServer.stop(); } }
rubix
positive
1,928
private stmtType astForFlowStmt(Node n) { try { assert (n.dfaType == DFAType.flow_stmt); } catch (PyExceptions e) { throw new PyExceptions(ErrorType.AST_ERROR, "AST Error", n); } Node ch = n.getChild(0); switch(ch.dfaType) { case break_stmt: return new Break(n.lineNo, n.colOffset); case continue_stmt: return new Continue(n.lineNo, n.colOffset); case yield_stmt: { exprType exp = astForExpr(ch.getChild(0)); return new Expr(exp, n.lineNo, n.colOffset); } case return_stmt: if (ch.nChild() == 1) { return new Return(null, n.lineNo, n.colOffset); } else { exprType exp = astForTestlist(ch.getChild(1)); return new Return(exp, n.lineNo, n.colOffset); } case raise_stmt: if (ch.nChild() == 1) { return new Raise(null, null, n.lineNo, n.colOffset); } else if (ch.nChild() >= 2) { exprType cause = null; exprType exp = astForExpr(ch.getChild(1)); if (ch.nChild() == 4) { cause = astForExpr(ch.getChild(3)); } return new Raise(exp, cause, n.lineNo, n.colOffset); } default: throw new PyExceptions(ErrorType.AST_ERROR, "unexpected flow_stmt: " + ch.dfaType, n); } }
private stmtType astForFlowStmt(Node n) { <DeepExtract> try { assert (n.dfaType == DFAType.flow_stmt); } catch (PyExceptions e) { throw new PyExceptions(ErrorType.AST_ERROR, "AST Error", n); } </DeepExtract> Node ch = n.getChild(0); switch(ch.dfaType) { case break_stmt: return new Break(n.lineNo, n.colOffset); case continue_stmt: return new Continue(n.lineNo, n.colOffset); case yield_stmt: { exprType exp = astForExpr(ch.getChild(0)); return new Expr(exp, n.lineNo, n.colOffset); } case return_stmt: if (ch.nChild() == 1) { return new Return(null, n.lineNo, n.colOffset); } else { exprType exp = astForTestlist(ch.getChild(1)); return new Return(exp, n.lineNo, n.colOffset); } case raise_stmt: if (ch.nChild() == 1) { return new Raise(null, null, n.lineNo, n.colOffset); } else if (ch.nChild() >= 2) { exprType cause = null; exprType exp = astForExpr(ch.getChild(1)); if (ch.nChild() == 4) { cause = astForExpr(ch.getChild(3)); } return new Raise(exp, cause, n.lineNo, n.colOffset); } default: throw new PyExceptions(ErrorType.AST_ERROR, "unexpected flow_stmt: " + ch.dfaType, n); } }
JPython
positive
1,929
public ImmersionBar navigationBarColor(String navigationBarColor, @FloatRange(from = 0f, to = 1f) float navigationAlpha) { mBarParams.navigationBarColor = Color.parseColor(navigationBarColor); mBarParams.navigationBarAlpha = navigationAlpha; return this; }
public ImmersionBar navigationBarColor(String navigationBarColor, @FloatRange(from = 0f, to = 1f) float navigationAlpha) { <DeepExtract> mBarParams.navigationBarColor = Color.parseColor(navigationBarColor); mBarParams.navigationBarAlpha = navigationAlpha; return this; </DeepExtract> }
MNImageBrowser
positive
1,930
@Override protected void onNightTurnTimeout(LGPlayer player) { inMenu = false; player.getPlayer().closeInventory(); player.hideView(); player.sendActionBarMessage("§6Tu rejoins le §a§lVillage."); player.sendMessage("§6Tu rejoins le §a§lVillage."); }
@Override protected void onNightTurnTimeout(LGPlayer player) { <DeepExtract> inMenu = false; player.getPlayer().closeInventory(); </DeepExtract> player.hideView(); player.sendActionBarMessage("§6Tu rejoins le §a§lVillage."); player.sendMessage("§6Tu rejoins le §a§lVillage."); }
LoupGarou
positive
1,931
public void setGIFResource(int resId) { this.gifId = resId; setLayerType(View.LAYER_TYPE_SOFTWARE, null); InputStream is = getContext().getResources().openRawResource(gifId); mMovie = Movie.decodeStream(is); }
public void setGIFResource(int resId) { this.gifId = resId; <DeepExtract> setLayerType(View.LAYER_TYPE_SOFTWARE, null); InputStream is = getContext().getResources().openRawResource(gifId); mMovie = Movie.decodeStream(is); </DeepExtract> }
Trycorder5
positive
1,932
public void notHome() { if (VERBOSE) Log.d(TAG, "The phone is not in the home"); if (_homeState == HomeState.HOME) { Intent i = new Intent(); i.setAction(LOCATION_UPDATE); i.putExtra("state", StateChange.LEAVING_HOME); _backgroundService.sendBroadcast(i); } _homeState = HomeState.NOT_HOME; _settings.setPhoneIsInHome(false); }
public void notHome() { <DeepExtract> if (VERBOSE) Log.d(TAG, "The phone is not in the home"); </DeepExtract> if (_homeState == HomeState.HOME) { Intent i = new Intent(); i.setAction(LOCATION_UPDATE); i.putExtra("state", StateChange.LEAVING_HOME); _backgroundService.sendBroadcast(i); } _homeState = HomeState.NOT_HOME; _settings.setPhoneIsInHome(false); }
android-wmon
positive
1,933
@Override public List<String> getRolesForUser(String name) { try { READ_WRITE_LOCK.readLock().lock(); return () -> super.getRolesForUser(name).get(); } finally { READ_WRITE_LOCK.readLock().unlock(); } }
@Override public List<String> getRolesForUser(String name) { <DeepExtract> try { READ_WRITE_LOCK.readLock().lock(); return () -> super.getRolesForUser(name).get(); } finally { READ_WRITE_LOCK.readLock().unlock(); } </DeepExtract> }
jcasbin
positive
1,934
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); setCanScrollX(); int widthMiddle = getMeasuredWidth() / 2; scrollTo(-widthMiddle, 0); }
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); <DeepExtract> setCanScrollX(); int widthMiddle = getMeasuredWidth() / 2; scrollTo(-widthMiddle, 0); </DeepExtract> }
AduioRecordUI
positive
1,935
@Override public void onError() { if (mContentView == null) { throw new NullPointerException("The content view not set.."); } if (!mErrorAdded) { initAddedLayout(); if (mErrorView != null) { rlAddedView.addView(mErrorView, mLayoutParams); mErrorAdded = true; } } dtvLoading.hideAndStop(); showViewWithStatus(LayoutStatus.Error); }
@Override public void onError() { <DeepExtract> if (mContentView == null) { throw new NullPointerException("The content view not set.."); } </DeepExtract> if (!mErrorAdded) { initAddedLayout(); if (mErrorView != null) { rlAddedView.addView(mErrorView, mLayoutParams); mErrorAdded = true; } } dtvLoading.hideAndStop(); showViewWithStatus(LayoutStatus.Error); }
InterviewQA
positive
1,936
@Override public PendingResult<Status> requestLocationUpdates(LostApiClient client, LocationRequest request, PendingIntent callbackIntent) { throwIfNotConnected(client); requestManager.requestLocationUpdates(client, request, callbackIntent); clientManager.addPendingIntent(client, request, callbackIntent); try { service.requestLocationUpdates(request); } catch (RemoteException e) { Log.e(TAG, "Error occurred trying to request location updates", e); } return new SimplePendingResult(true); }
@Override public PendingResult<Status> requestLocationUpdates(LostApiClient client, LocationRequest request, PendingIntent callbackIntent) { throwIfNotConnected(client); requestManager.requestLocationUpdates(client, request, callbackIntent); clientManager.addPendingIntent(client, request, callbackIntent); <DeepExtract> try { service.requestLocationUpdates(request); } catch (RemoteException e) { Log.e(TAG, "Error occurred trying to request location updates", e); } </DeepExtract> return new SimplePendingResult(true); }
lost
positive
1,937
public static String getExternalFileDir(Context context, String customPath) { String path = context.getExternalFilesDir("") + formatPath(customPath); File file = new File(path); if (!(file.exists() && file.isDirectory())) { file.mkdirs(); } return path; }
public static String getExternalFileDir(Context context, String customPath) { String path = context.getExternalFilesDir("") + formatPath(customPath); <DeepExtract> File file = new File(path); if (!(file.exists() && file.isDirectory())) { file.mkdirs(); } </DeepExtract> return path; }
Better
positive
1,938
public byte[] getName() { if (name != null) return getBytes(name); byte[] argument; if (objects[0] == null) { argument = EMPTY_BYTES; } else if (objects[0] instanceof byte[]) { argument = (byte[]) objects[0]; } else if (objects[0] instanceof ByteBuf) { argument = ((ByteBuf) objects[0]).array(); } else if (objects[0] instanceof String) { argument = ((String) objects[0]).getBytes(Charsets.UTF_8); } else { argument = objects[0].toString().getBytes(Charsets.UTF_8); } return argument; }
public byte[] getName() { if (name != null) return getBytes(name); <DeepExtract> byte[] argument; if (objects[0] == null) { argument = EMPTY_BYTES; } else if (objects[0] instanceof byte[]) { argument = (byte[]) objects[0]; } else if (objects[0] instanceof ByteBuf) { argument = ((ByteBuf) objects[0]).array(); } else if (objects[0] instanceof String) { argument = ((String) objects[0]).getBytes(Charsets.UTF_8); } else { argument = objects[0].toString().getBytes(Charsets.UTF_8); } return argument; </DeepExtract> }
hanbo-db
positive
1,939
@Override protected void onSetInitialValue(Object defaultValue) { if (defaultValue == null) { defaultValue = 0; } setValueInternal(getPersistedInt((Integer) defaultValue), true); }
@Override protected void onSetInitialValue(Object defaultValue) { if (defaultValue == null) { defaultValue = 0; } <DeepExtract> setValueInternal(getPersistedInt((Integer) defaultValue), true); </DeepExtract> }
SamsungOneUi
positive
1,940
@Override public void run() { mID = new Random().randomBytes(16); mKey = new Random().randomBytes(SodiumConstants.XSALSA20_POLY1305_SECRETBOX_KEYBYTES); mBox = new SecretBox(mKey); Map<String, Object> data = new HashMap<>(); data.put("key", mKey); data.put("box", mBox); mArchive.put(Numeric.toHexString(mID), data); mOnRotateCallback.accept(this); }
@Override public void run() { <DeepExtract> mID = new Random().randomBytes(16); mKey = new Random().randomBytes(SodiumConstants.XSALSA20_POLY1305_SECRETBOX_KEYBYTES); mBox = new SecretBox(mKey); Map<String, Object> data = new HashMap<>(); data.put("key", mKey); data.put("box", mBox); mArchive.put(Numeric.toHexString(mID), data); mOnRotateCallback.accept(this); </DeepExtract> }
autobahn-java
positive
1,941
public static Object sendPacket(SkungeePacket packet) throws IllegalAccessException { if (isBungeecord()) throw new IllegalAccessException("A SkungeePacket may only be sent on a Spigot implementation, try BungeePacket."); SkungeeAPI.sendPacket(build(), packet); }
public static Object sendPacket(SkungeePacket packet) throws IllegalAccessException { if (isBungeecord()) throw new IllegalAccessException("A SkungeePacket may only be sent on a Spigot implementation, try BungeePacket."); <DeepExtract> SkungeeAPI.sendPacket(build(), packet); </DeepExtract> }
Skungee
positive
1,942
@Override public void onClick(View view) { if (mAuthTask != null) { return; } mUsernameView.setError(null); mPasswordView.setError(null); String username = mUsernameView.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(username)) { mUsernameView.setError(getString(R.string.error_field_required)); focusView = mUsernameView; cancel = true; } else if (!isUsernameValid(username)) { mUsernameView.setError(getString(R.string.error_invalid_username)); focusView = mUsernameView; cancel = true; } ; if (cancel) { focusView.requestFocus(); } else { showProgress(true); mAuthTask = new UserLoginTask(username, password); mAuthTask.execute((Void) null); } }
@Override public void onClick(View view) { <DeepExtract> if (mAuthTask != null) { return; } mUsernameView.setError(null); mPasswordView.setError(null); String username = mUsernameView.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(username)) { mUsernameView.setError(getString(R.string.error_field_required)); focusView = mUsernameView; cancel = true; } else if (!isUsernameValid(username)) { mUsernameView.setError(getString(R.string.error_invalid_username)); focusView = mUsernameView; cancel = true; } ; if (cancel) { focusView.requestFocus(); } else { showProgress(true); mAuthTask = new UserLoginTask(username, password); mAuthTask.execute((Void) null); } </DeepExtract> }
pivaa
positive
1,943
@Test public void noChangesWhenDriverNameNotFound() { final Builder<RuleSetBuilder, DecisionTreeRuleSet> ruleSetBuilder = RuleSetBuilder.creator("commissions", Arrays.asList("EXMETHOD", "EXCHANGE", "PRODUCT", "REGION", "ASSET")); if (CollectionUtils.isNotEmpty(null)) { ruleSetBuilder.with(RuleSetBuilder::groups, null); } ruleSetBuilder.with(RuleSetBuilder::rule, RuleBuilder.creator().with(RuleBuilder::setId, new UUID(0, 1)).with(RuleBuilder::setCode, RULE_CODE).with(RuleBuilder::input, Arrays.asList("VOICE", "CME", "ED", "US", "INDEX")).with(RuleBuilder::output, Collections.singletonMap("Rate1", "1.1 ")).with(RuleBuilder::start, NOW.plus(Period.ofWeeks(2))).with(RuleBuilder::end, NOW.plus(Period.ofWeeks(4)))); ruleSetBuilder.with(RuleSetBuilder::rule, RuleBuilder.creator().with(RuleBuilder::setId, new UUID(0, 2)).with(RuleBuilder::setCode, RULE_CODE).with(RuleBuilder::input, Arrays.asList("EMAIL", "CME", "ED", "US", "INDEX")).with(RuleBuilder::output, Collections.singletonMap("Rate1", "1.2")).with(RuleBuilder::start, NOW.plus(Period.ofWeeks(4))).with(RuleBuilder::end, NOW.plus(Period.ofWeeks(6)))); ruleSetBuilder.with(RuleSetBuilder::rule, RuleBuilder.creator().with(RuleBuilder::setId, new UUID(0, 3)).with(RuleBuilder::setCode, RULE_CODE).with(RuleBuilder::input, Arrays.asList("ELECTRONIC", "CME", "ED", "US", "INDEX")).with(RuleBuilder::output, Collections.singletonMap("Rate1", "1.3")).with(RuleBuilder::start, NOW.plus(Period.ofWeeks(6))).with(RuleBuilder::end, NOW.plus(Period.ofWeeks(8)))); this.ruleSet = ruleSetBuilder.build(); final List<ValueGroupChange> changes = ValueGroupChangeBuilder.creator("CMEGroup").with(ValueGroupChangeBuilder::ruleSet, this.ruleSet).with(ValueGroupChangeBuilder::changeRange, ValueGroup.DEFAULT_DATE_RANGE).with(ValueGroupChangeBuilder::drivers, Arrays.asList("CME", "CBOT", "NYMEX")).build(); assertEquals(1, changes.size()); assertEquals(Type.NEW, changes.get(0).getType()); this.builder = RuleGroupChangeBuilder.creator(changes, this.ruleSet); this.builder.with(RuleGroupChangeBuilder::ruleCodes, singleton(RULE_CODE)); this.builder.with(RuleGroupChangeBuilder::driver, "DRIVER_NOT_FOUND"); final List<RuleChange> ruleChanges = this.builder.build(); assertTrue(ruleChanges.isEmpty()); }
@Test public void noChangesWhenDriverNameNotFound() { <DeepExtract> final Builder<RuleSetBuilder, DecisionTreeRuleSet> ruleSetBuilder = RuleSetBuilder.creator("commissions", Arrays.asList("EXMETHOD", "EXCHANGE", "PRODUCT", "REGION", "ASSET")); if (CollectionUtils.isNotEmpty(null)) { ruleSetBuilder.with(RuleSetBuilder::groups, null); } ruleSetBuilder.with(RuleSetBuilder::rule, RuleBuilder.creator().with(RuleBuilder::setId, new UUID(0, 1)).with(RuleBuilder::setCode, RULE_CODE).with(RuleBuilder::input, Arrays.asList("VOICE", "CME", "ED", "US", "INDEX")).with(RuleBuilder::output, Collections.singletonMap("Rate1", "1.1 ")).with(RuleBuilder::start, NOW.plus(Period.ofWeeks(2))).with(RuleBuilder::end, NOW.plus(Period.ofWeeks(4)))); ruleSetBuilder.with(RuleSetBuilder::rule, RuleBuilder.creator().with(RuleBuilder::setId, new UUID(0, 2)).with(RuleBuilder::setCode, RULE_CODE).with(RuleBuilder::input, Arrays.asList("EMAIL", "CME", "ED", "US", "INDEX")).with(RuleBuilder::output, Collections.singletonMap("Rate1", "1.2")).with(RuleBuilder::start, NOW.plus(Period.ofWeeks(4))).with(RuleBuilder::end, NOW.plus(Period.ofWeeks(6)))); ruleSetBuilder.with(RuleSetBuilder::rule, RuleBuilder.creator().with(RuleBuilder::setId, new UUID(0, 3)).with(RuleBuilder::setCode, RULE_CODE).with(RuleBuilder::input, Arrays.asList("ELECTRONIC", "CME", "ED", "US", "INDEX")).with(RuleBuilder::output, Collections.singletonMap("Rate1", "1.3")).with(RuleBuilder::start, NOW.plus(Period.ofWeeks(6))).with(RuleBuilder::end, NOW.plus(Period.ofWeeks(8)))); this.ruleSet = ruleSetBuilder.build(); </DeepExtract> final List<ValueGroupChange> changes = ValueGroupChangeBuilder.creator("CMEGroup").with(ValueGroupChangeBuilder::ruleSet, this.ruleSet).with(ValueGroupChangeBuilder::changeRange, ValueGroup.DEFAULT_DATE_RANGE).with(ValueGroupChangeBuilder::drivers, Arrays.asList("CME", "CBOT", "NYMEX")).build(); assertEquals(1, changes.size()); assertEquals(Type.NEW, changes.get(0).getType()); this.builder = RuleGroupChangeBuilder.creator(changes, this.ruleSet); this.builder.with(RuleGroupChangeBuilder::ruleCodes, singleton(RULE_CODE)); this.builder.with(RuleGroupChangeBuilder::driver, "DRIVER_NOT_FOUND"); final List<RuleChange> ruleChanges = this.builder.build(); assertTrue(ruleChanges.isEmpty()); }
swblocks-decisiontree
positive
1,944
public void insertData(int offset, String arg) throws DOMException { if (offset < adaptee.start || adaptee.start + offset >= adaptee.end) { throw new DOMException(DOMException.INDEX_SIZE_ERR, "Invalid offset"); } StringBuilder sb = new StringBuilder(getNodeValue()); sb.insert(offset, arg); setNodeValue(sb.toString()); }
public void insertData(int offset, String arg) throws DOMException { if (offset < adaptee.start || adaptee.start + offset >= adaptee.end) { throw new DOMException(DOMException.INDEX_SIZE_ERR, "Invalid offset"); } StringBuilder sb = new StringBuilder(getNodeValue()); sb.insert(offset, arg); <DeepExtract> setNodeValue(sb.toString()); </DeepExtract> }
jtidy
positive
1,948
@Test public void deleteNode1() { expected = LinkedListUtil.createLinkedList(1, 2, 3, 4, 5); input = LinkedListUtil.createLinkedList(1, 2, 3, 4, 5); k = 1; input.get(input.length() - k + 1).insertAfter(new ListNode<>(10)); DeleteKthLastNode.deleteNode(input, k); LinkedListUtil.assertSameList(expected, input); }
@Test public void deleteNode1() { expected = LinkedListUtil.createLinkedList(1, 2, 3, 4, 5); input = LinkedListUtil.createLinkedList(1, 2, 3, 4, 5); k = 1; <DeepExtract> input.get(input.length() - k + 1).insertAfter(new ListNode<>(10)); DeleteKthLastNode.deleteNode(input, k); LinkedListUtil.assertSameList(expected, input); </DeepExtract> }
Elements-of-programming-interviews
positive
1,949
public void actionPerformed(java.awt.event.ActionEvent evt) { if (_h5py_.isSelected() == true) { if (_PIP_REPO_.isSelected() == true) { str_python_h5py = " h5py "; } else { str_python_h5py = " python-h5py "; } } else { str_python_h5py = " "; } }
public void actionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> if (_h5py_.isSelected() == true) { if (_PIP_REPO_.isSelected() == true) { str_python_h5py = " h5py "; } else { str_python_h5py = " python-h5py "; } } else { str_python_h5py = " "; } </DeepExtract> }
ERSN-OpenMC
positive
1,950
@Override protected void finalize() throws Throwable { final File imageFile = new File(getContext().getCacheDir() + File.separator + IMAGE_FILE_NAME); imageFile.delete(); super.finalize(); }
@Override protected void finalize() throws Throwable { <DeepExtract> final File imageFile = new File(getContext().getCacheDir() + File.separator + IMAGE_FILE_NAME); imageFile.delete(); </DeepExtract> super.finalize(); }
xl-image_utils_lib-android
positive
1,951
@Test public void reportsErrorOnMoreThanOneReturnStatement() throws Exception { MatcherAssert.assertThat(this.runValidation("ReturnCount.java", false), Matchers.hasItem(new ViolationMatcher("Return count is 2 (max allowed for non-void methods/lambdas is 1)", "ReturnCount.java"))); }
@Test public void reportsErrorOnMoreThanOneReturnStatement() throws Exception { <DeepExtract> MatcherAssert.assertThat(this.runValidation("ReturnCount.java", false), Matchers.hasItem(new ViolationMatcher("Return count is 2 (max allowed for non-void methods/lambdas is 1)", "ReturnCount.java"))); </DeepExtract> }
qulice
positive
1,952
public void setValue(int y) { if (Looper.myLooper() != Looper.getMainLooper()) { throw new RuntimeException(); } if (y > mConfig.rangeEnd || y < mConfig.rangeStart) { throw new IllegalArgumentException(String.format("y = %d, not in [%d, %d]", y, mConfig.rangeStart, mConfig.rangeEnd)); } float ratio = 1.0f * Math.abs(mConfig.rangeStart - mConfig.rangeEnd) / mHeight; mList.add((int) (mHeight / 2 + y / ratio)); if (mList.size() > mConfig.sliceCount) { mList.remove(0); } mCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); mCanvas.drawColor(mConfig.backgroundColor); int preX = 0, preY = mList.get(0), curX, curY; int preX = 0, preY = mList.get(0), curX, curY; mPaint.setStyle(Paint.Style.STROKE); config.strokeWidth = mConfig.strokeWidth; return this; mPaint.setColor(mConfig.foregroundColor); for (int i = 0; i < mList.size(); i++) { curX = i * (mWidth / mConfig.sliceCount); curY = mList.get(i); mCanvas.drawLine(preX, preY, curX, curY, mPaint); preX = curX; preY = curY; } invalidate(); }
public void setValue(int y) { if (Looper.myLooper() != Looper.getMainLooper()) { throw new RuntimeException(); } if (y > mConfig.rangeEnd || y < mConfig.rangeStart) { throw new IllegalArgumentException(String.format("y = %d, not in [%d, %d]", y, mConfig.rangeStart, mConfig.rangeEnd)); } float ratio = 1.0f * Math.abs(mConfig.rangeStart - mConfig.rangeEnd) / mHeight; mList.add((int) (mHeight / 2 + y / ratio)); if (mList.size() > mConfig.sliceCount) { mList.remove(0); } mCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); mCanvas.drawColor(mConfig.backgroundColor); int preX = 0, preY = mList.get(0), curX, curY; int preX = 0, preY = mList.get(0), curX, curY; mPaint.setStyle(Paint.Style.STROKE); <DeepExtract> config.strokeWidth = mConfig.strokeWidth; return this; </DeepExtract> mPaint.setColor(mConfig.foregroundColor); for (int i = 0; i < mList.size(); i++) { curX = i * (mWidth / mConfig.sliceCount); curY = mList.get(i); mCanvas.drawLine(preX, preY, curX, curY, mPaint); preX = curX; preY = curY; } invalidate(); }
Android-BluetoothKit
positive
1,953
private static void registerCakes() { final String carrotcakeName = "carrotcake"; final String cheesecakeName = "cheesecake"; final String cherrycheesecakeName = "cherrycheesecake"; final String chocolatesprinklecakeName = "chocolatesprinklecake"; final String holidaycakeName = "holidaycake"; final String lamingtoncakeName = "lamingtoncake"; final String pavlovacakeName = "pavlovacake"; final String pineappleupsidedowncakeName = "pineappleupsidedowncake"; final String pumpkincheesecakeName = "pumpkincheesecake"; final String redvelvetcakeName = "redvelvetcake"; carrotcake = new BlockPamCake(4); carrotcakeItemBlock = new ItemBlock(carrotcake); ItemRegistry.items.put(carrotcakeName, carrotcakeItemBlock); carrotcake.setRegistryName(carrotcakeName); carrotcake.setUnlocalizedName(carrotcakeName); carrotcake.setCreativeTab(HarvestCraft.modTab); blocks.add(carrotcake); if (carrotcakeItemBlock != null) { carrotcakeItemBlock.setRegistryName(carrotcakeName); carrotcakeItemBlock.setUnlocalizedName(carrotcakeName); ItemRegistry.itemlist.add(carrotcakeItemBlock); } return; cheesecake = new BlockPamCake(5); cheesecakeItemBlock = new ItemBlock(cheesecake); ItemRegistry.items.put(cheesecakeName, cheesecakeItemBlock); cheesecake.setRegistryName(cheesecakeName); cheesecake.setUnlocalizedName(cheesecakeName); cheesecake.setCreativeTab(HarvestCraft.modTab); blocks.add(cheesecake); if (cheesecakeItemBlock != null) { cheesecakeItemBlock.setRegistryName(cheesecakeName); cheesecakeItemBlock.setUnlocalizedName(cheesecakeName); ItemRegistry.itemlist.add(cheesecakeItemBlock); } return; cherrycheesecake = new BlockPamCake(6); cherrycheesecakeItemBlock = new ItemBlock(cherrycheesecake); ItemRegistry.items.put(cherrycheesecakeName, cherrycheesecakeItemBlock); cherrycheesecake.setRegistryName(cherrycheesecakeName); cherrycheesecake.setUnlocalizedName(cherrycheesecakeName); cherrycheesecake.setCreativeTab(HarvestCraft.modTab); blocks.add(cherrycheesecake); if (cherrycheesecakeItemBlock != null) { cherrycheesecakeItemBlock.setRegistryName(cherrycheesecakeName); cherrycheesecakeItemBlock.setUnlocalizedName(cherrycheesecakeName); ItemRegistry.itemlist.add(cherrycheesecakeItemBlock); } return; chocolatesprinklecake = new BlockPamCake(4); chocolatesprinklecakeItemBlock = new ItemBlock(chocolatesprinklecake); ItemRegistry.items.put(chocolatesprinklecakeName, chocolatesprinklecakeItemBlock); chocolatesprinklecake.setRegistryName(chocolatesprinklecakeName); chocolatesprinklecake.setUnlocalizedName(chocolatesprinklecakeName); chocolatesprinklecake.setCreativeTab(HarvestCraft.modTab); blocks.add(chocolatesprinklecake); if (chocolatesprinklecakeItemBlock != null) { chocolatesprinklecakeItemBlock.setRegistryName(chocolatesprinklecakeName); chocolatesprinklecakeItemBlock.setUnlocalizedName(chocolatesprinklecakeName); ItemRegistry.itemlist.add(chocolatesprinklecakeItemBlock); } return; holidaycake = new BlockPamCake(5); holidaycakeItemBlock = new ItemBlock(holidaycake); ItemRegistry.items.put(holidaycakeName, holidaycakeItemBlock); holidaycake.setRegistryName(holidaycakeName); holidaycake.setUnlocalizedName(holidaycakeName); holidaycake.setCreativeTab(HarvestCraft.modTab); blocks.add(holidaycake); if (holidaycakeItemBlock != null) { holidaycakeItemBlock.setRegistryName(holidaycakeName); holidaycakeItemBlock.setUnlocalizedName(holidaycakeName); ItemRegistry.itemlist.add(holidaycakeItemBlock); } return; lamingtoncake = new BlockPamCake(3); lamingtoncakeItemBlock = new ItemBlock(lamingtoncake); ItemRegistry.items.put(lamingtoncakeName, lamingtoncakeItemBlock); lamingtoncake.setRegistryName(lamingtoncakeName); lamingtoncake.setUnlocalizedName(lamingtoncakeName); lamingtoncake.setCreativeTab(HarvestCraft.modTab); blocks.add(lamingtoncake); if (lamingtoncakeItemBlock != null) { lamingtoncakeItemBlock.setRegistryName(lamingtoncakeName); lamingtoncakeItemBlock.setUnlocalizedName(lamingtoncakeName); ItemRegistry.itemlist.add(lamingtoncakeItemBlock); } return; pavlovacake = new BlockPamCake(5); pavlovacakeItemBlock = new ItemBlock(pavlovacake); ItemRegistry.items.put(pavlovacakeName, pavlovacakeItemBlock); pavlovacake.setRegistryName(pavlovacakeName); pavlovacake.setUnlocalizedName(pavlovacakeName); pavlovacake.setCreativeTab(HarvestCraft.modTab); blocks.add(pavlovacake); if (pavlovacakeItemBlock != null) { pavlovacakeItemBlock.setRegistryName(pavlovacakeName); pavlovacakeItemBlock.setUnlocalizedName(pavlovacakeName); ItemRegistry.itemlist.add(pavlovacakeItemBlock); } return; pineappleupsidedowncake = new BlockPamCake(5); pineappleupsidedowncakeItemBlock = new ItemBlock(pineappleupsidedowncake); ItemRegistry.items.put(pineappleupsidedowncakeName, pineappleupsidedowncakeItemBlock); pineappleupsidedowncake.setRegistryName(pineappleupsidedowncakeName); pineappleupsidedowncake.setUnlocalizedName(pineappleupsidedowncakeName); pineappleupsidedowncake.setCreativeTab(HarvestCraft.modTab); blocks.add(pineappleupsidedowncake); if (pineappleupsidedowncakeItemBlock != null) { pineappleupsidedowncakeItemBlock.setRegistryName(pineappleupsidedowncakeName); pineappleupsidedowncakeItemBlock.setUnlocalizedName(pineappleupsidedowncakeName); ItemRegistry.itemlist.add(pineappleupsidedowncakeItemBlock); } return; pumpkincheesecake = new BlockPamCake(4); pumpkincheesecakeItemBlock = new ItemBlock(pumpkincheesecake); ItemRegistry.items.put(pumpkincheesecakeName, pumpkincheesecakeItemBlock); pumpkincheesecake.setRegistryName(pumpkincheesecakeName); pumpkincheesecake.setUnlocalizedName(pumpkincheesecakeName); pumpkincheesecake.setCreativeTab(HarvestCraft.modTab); blocks.add(pumpkincheesecake); if (pumpkincheesecakeItemBlock != null) { pumpkincheesecakeItemBlock.setRegistryName(pumpkincheesecakeName); pumpkincheesecakeItemBlock.setUnlocalizedName(pumpkincheesecakeName); ItemRegistry.itemlist.add(pumpkincheesecakeItemBlock); } return; redvelvetcake = new BlockPamCake(6); redvelvetcakeItemBlock = new ItemBlock(redvelvetcake); ItemRegistry.items.put(redvelvetcakeName, redvelvetcakeItemBlock); redvelvetcake.setRegistryName(redvelvetcakeName); redvelvetcake.setUnlocalizedName(redvelvetcakeName); redvelvetcake.setCreativeTab(HarvestCraft.modTab); blocks.add(redvelvetcake); if (redvelvetcakeItemBlock != null) { redvelvetcakeItemBlock.setRegistryName(redvelvetcakeName); redvelvetcakeItemBlock.setUnlocalizedName(redvelvetcakeName); ItemRegistry.itemlist.add(redvelvetcakeItemBlock); } return; }
private static void registerCakes() { final String carrotcakeName = "carrotcake"; final String cheesecakeName = "cheesecake"; final String cherrycheesecakeName = "cherrycheesecake"; final String chocolatesprinklecakeName = "chocolatesprinklecake"; final String holidaycakeName = "holidaycake"; final String lamingtoncakeName = "lamingtoncake"; final String pavlovacakeName = "pavlovacake"; final String pineappleupsidedowncakeName = "pineappleupsidedowncake"; final String pumpkincheesecakeName = "pumpkincheesecake"; final String redvelvetcakeName = "redvelvetcake"; carrotcake = new BlockPamCake(4); carrotcakeItemBlock = new ItemBlock(carrotcake); ItemRegistry.items.put(carrotcakeName, carrotcakeItemBlock); carrotcake.setRegistryName(carrotcakeName); carrotcake.setUnlocalizedName(carrotcakeName); carrotcake.setCreativeTab(HarvestCraft.modTab); blocks.add(carrotcake); if (carrotcakeItemBlock != null) { carrotcakeItemBlock.setRegistryName(carrotcakeName); carrotcakeItemBlock.setUnlocalizedName(carrotcakeName); ItemRegistry.itemlist.add(carrotcakeItemBlock); } return; cheesecake = new BlockPamCake(5); cheesecakeItemBlock = new ItemBlock(cheesecake); ItemRegistry.items.put(cheesecakeName, cheesecakeItemBlock); cheesecake.setRegistryName(cheesecakeName); cheesecake.setUnlocalizedName(cheesecakeName); cheesecake.setCreativeTab(HarvestCraft.modTab); blocks.add(cheesecake); if (cheesecakeItemBlock != null) { cheesecakeItemBlock.setRegistryName(cheesecakeName); cheesecakeItemBlock.setUnlocalizedName(cheesecakeName); ItemRegistry.itemlist.add(cheesecakeItemBlock); } return; cherrycheesecake = new BlockPamCake(6); cherrycheesecakeItemBlock = new ItemBlock(cherrycheesecake); ItemRegistry.items.put(cherrycheesecakeName, cherrycheesecakeItemBlock); cherrycheesecake.setRegistryName(cherrycheesecakeName); cherrycheesecake.setUnlocalizedName(cherrycheesecakeName); cherrycheesecake.setCreativeTab(HarvestCraft.modTab); blocks.add(cherrycheesecake); if (cherrycheesecakeItemBlock != null) { cherrycheesecakeItemBlock.setRegistryName(cherrycheesecakeName); cherrycheesecakeItemBlock.setUnlocalizedName(cherrycheesecakeName); ItemRegistry.itemlist.add(cherrycheesecakeItemBlock); } return; chocolatesprinklecake = new BlockPamCake(4); chocolatesprinklecakeItemBlock = new ItemBlock(chocolatesprinklecake); ItemRegistry.items.put(chocolatesprinklecakeName, chocolatesprinklecakeItemBlock); chocolatesprinklecake.setRegistryName(chocolatesprinklecakeName); chocolatesprinklecake.setUnlocalizedName(chocolatesprinklecakeName); chocolatesprinklecake.setCreativeTab(HarvestCraft.modTab); blocks.add(chocolatesprinklecake); if (chocolatesprinklecakeItemBlock != null) { chocolatesprinklecakeItemBlock.setRegistryName(chocolatesprinklecakeName); chocolatesprinklecakeItemBlock.setUnlocalizedName(chocolatesprinklecakeName); ItemRegistry.itemlist.add(chocolatesprinklecakeItemBlock); } return; holidaycake = new BlockPamCake(5); holidaycakeItemBlock = new ItemBlock(holidaycake); ItemRegistry.items.put(holidaycakeName, holidaycakeItemBlock); holidaycake.setRegistryName(holidaycakeName); holidaycake.setUnlocalizedName(holidaycakeName); holidaycake.setCreativeTab(HarvestCraft.modTab); blocks.add(holidaycake); if (holidaycakeItemBlock != null) { holidaycakeItemBlock.setRegistryName(holidaycakeName); holidaycakeItemBlock.setUnlocalizedName(holidaycakeName); ItemRegistry.itemlist.add(holidaycakeItemBlock); } return; lamingtoncake = new BlockPamCake(3); lamingtoncakeItemBlock = new ItemBlock(lamingtoncake); ItemRegistry.items.put(lamingtoncakeName, lamingtoncakeItemBlock); lamingtoncake.setRegistryName(lamingtoncakeName); lamingtoncake.setUnlocalizedName(lamingtoncakeName); lamingtoncake.setCreativeTab(HarvestCraft.modTab); blocks.add(lamingtoncake); if (lamingtoncakeItemBlock != null) { lamingtoncakeItemBlock.setRegistryName(lamingtoncakeName); lamingtoncakeItemBlock.setUnlocalizedName(lamingtoncakeName); ItemRegistry.itemlist.add(lamingtoncakeItemBlock); } return; pavlovacake = new BlockPamCake(5); pavlovacakeItemBlock = new ItemBlock(pavlovacake); ItemRegistry.items.put(pavlovacakeName, pavlovacakeItemBlock); pavlovacake.setRegistryName(pavlovacakeName); pavlovacake.setUnlocalizedName(pavlovacakeName); pavlovacake.setCreativeTab(HarvestCraft.modTab); blocks.add(pavlovacake); if (pavlovacakeItemBlock != null) { pavlovacakeItemBlock.setRegistryName(pavlovacakeName); pavlovacakeItemBlock.setUnlocalizedName(pavlovacakeName); ItemRegistry.itemlist.add(pavlovacakeItemBlock); } return; pineappleupsidedowncake = new BlockPamCake(5); pineappleupsidedowncakeItemBlock = new ItemBlock(pineappleupsidedowncake); ItemRegistry.items.put(pineappleupsidedowncakeName, pineappleupsidedowncakeItemBlock); pineappleupsidedowncake.setRegistryName(pineappleupsidedowncakeName); pineappleupsidedowncake.setUnlocalizedName(pineappleupsidedowncakeName); pineappleupsidedowncake.setCreativeTab(HarvestCraft.modTab); blocks.add(pineappleupsidedowncake); if (pineappleupsidedowncakeItemBlock != null) { pineappleupsidedowncakeItemBlock.setRegistryName(pineappleupsidedowncakeName); pineappleupsidedowncakeItemBlock.setUnlocalizedName(pineappleupsidedowncakeName); ItemRegistry.itemlist.add(pineappleupsidedowncakeItemBlock); } return; pumpkincheesecake = new BlockPamCake(4); pumpkincheesecakeItemBlock = new ItemBlock(pumpkincheesecake); ItemRegistry.items.put(pumpkincheesecakeName, pumpkincheesecakeItemBlock); pumpkincheesecake.setRegistryName(pumpkincheesecakeName); pumpkincheesecake.setUnlocalizedName(pumpkincheesecakeName); pumpkincheesecake.setCreativeTab(HarvestCraft.modTab); blocks.add(pumpkincheesecake); if (pumpkincheesecakeItemBlock != null) { pumpkincheesecakeItemBlock.setRegistryName(pumpkincheesecakeName); pumpkincheesecakeItemBlock.setUnlocalizedName(pumpkincheesecakeName); ItemRegistry.itemlist.add(pumpkincheesecakeItemBlock); } return; redvelvetcake = new BlockPamCake(6); redvelvetcakeItemBlock = new ItemBlock(redvelvetcake); ItemRegistry.items.put(redvelvetcakeName, redvelvetcakeItemBlock); <DeepExtract> redvelvetcake.setRegistryName(redvelvetcakeName); redvelvetcake.setUnlocalizedName(redvelvetcakeName); redvelvetcake.setCreativeTab(HarvestCraft.modTab); blocks.add(redvelvetcake); if (redvelvetcakeItemBlock != null) { redvelvetcakeItemBlock.setRegistryName(redvelvetcakeName); redvelvetcakeItemBlock.setUnlocalizedName(redvelvetcakeName); ItemRegistry.itemlist.add(redvelvetcakeItemBlock); } return; </DeepExtract> }
harvestcraft
positive
1,954
public boolean isPositionVisible(final int col, final int row, final HexRect2D rect, final boolean accurately) { float cellX; switch(this.orientation) { case ORIENTATION_HORIZONTAL: { cellX = col * (this.scaledCellWidth - this.scaledOffsetForEdgeSide); } case ORIENTATION_VERTICAL: { cellX = (col * this.scaledCellWidth) + ((row & 1) == 0 ? 0 : this.scaledHalfOfSide); } default: { throw new Error("Unsupported orientation"); } } float cellY; switch(this.orientation) { case ORIENTATION_HORIZONTAL: { cellY = (row * this.scaledCellHeight) + ((col & 1) == 0 ? 0 : this.scaledHalfOfSide); } case ORIENTATION_VERTICAL: { cellY = row * (this.scaledCellHeight - this.scaledOffsetForEdgeSide); } default: { throw new Error("Unsupported orientation"); } } float cx0 = cellX; float cy0 = cellY; float cx1 = cx0 + this.scaledCellWidth; float cy1 = cy0 + this.scaledCellHeight; final float rw = rect.getWidth(); final float rh = rect.getHeight(); if (rw <= 0.0f || rh <= 0.0f) { return false; } final float rx0 = rect.getLeft(); final float rx1 = rect.getRight(); final float ry0 = rect.getTop(); final float ry1 = rect.getBottom(); if (cx0 >= rx1 || cx1 < rx0 || cy0 >= ry1 || cy1 < ry0) { return false; } if (accurately) { switch(this.orientation) { case ORIENTATION_VERTICAL: { cy0 += scaledOffsetForEdgeSide; cy1 -= scaledOffsetForEdgeSide; if (cx0 >= rx1 || cx1 < rx0 || cy0 >= ry1 || cy1 < ry0) { if (this.scaledPoints[5].intersectsRectangle(this.scaledPoints[0], rect, cellX, cellY)) { return true; } if (this.scaledPoints[0].intersectsRectangle(this.scaledPoints[1], rect, cellX, cellY)) { return true; } if (this.scaledPoints[2].intersectsRectangle(this.scaledPoints[3], rect, cellX, cellY)) { return true; } if (this.scaledPoints[3].intersectsRectangle(this.scaledPoints[4], rect, cellX, cellY)) { return true; } return false; } } break; case ORIENTATION_HORIZONTAL: { cx0 += this.scaledOffsetForEdgeSide; cx1 -= this.scaledOffsetForEdgeSide; if (cx0 >= rx1 || cx1 < rx0 || cy0 >= ry1 || cy1 < ry0) { if (this.scaledPoints[0].intersectsRectangle(this.scaledPoints[1], rect, cellX, cellY)) { return true; } if (this.scaledPoints[1].intersectsRectangle(this.scaledPoints[2], rect, cellX, cellY)) { return true; } if (this.scaledPoints[3].intersectsRectangle(this.scaledPoints[4], rect, cellX, cellY)) { return true; } return this.scaledPoints[4].intersectsRectangle(this.scaledPoints[5], rect, cellX, cellY); } } break; default: throw new Error("Unsupported orientation"); } } return true; }
public boolean isPositionVisible(final int col, final int row, final HexRect2D rect, final boolean accurately) { float cellX; switch(this.orientation) { case ORIENTATION_HORIZONTAL: { cellX = col * (this.scaledCellWidth - this.scaledOffsetForEdgeSide); } case ORIENTATION_VERTICAL: { cellX = (col * this.scaledCellWidth) + ((row & 1) == 0 ? 0 : this.scaledHalfOfSide); } default: { throw new Error("Unsupported orientation"); } } <DeepExtract> float cellY; switch(this.orientation) { case ORIENTATION_HORIZONTAL: { cellY = (row * this.scaledCellHeight) + ((col & 1) == 0 ? 0 : this.scaledHalfOfSide); } case ORIENTATION_VERTICAL: { cellY = row * (this.scaledCellHeight - this.scaledOffsetForEdgeSide); } default: { throw new Error("Unsupported orientation"); } } </DeepExtract> float cx0 = cellX; float cy0 = cellY; float cx1 = cx0 + this.scaledCellWidth; float cy1 = cy0 + this.scaledCellHeight; final float rw = rect.getWidth(); final float rh = rect.getHeight(); if (rw <= 0.0f || rh <= 0.0f) { return false; } final float rx0 = rect.getLeft(); final float rx1 = rect.getRight(); final float ry0 = rect.getTop(); final float ry1 = rect.getBottom(); if (cx0 >= rx1 || cx1 < rx0 || cy0 >= ry1 || cy1 < ry0) { return false; } if (accurately) { switch(this.orientation) { case ORIENTATION_VERTICAL: { cy0 += scaledOffsetForEdgeSide; cy1 -= scaledOffsetForEdgeSide; if (cx0 >= rx1 || cx1 < rx0 || cy0 >= ry1 || cy1 < ry0) { if (this.scaledPoints[5].intersectsRectangle(this.scaledPoints[0], rect, cellX, cellY)) { return true; } if (this.scaledPoints[0].intersectsRectangle(this.scaledPoints[1], rect, cellX, cellY)) { return true; } if (this.scaledPoints[2].intersectsRectangle(this.scaledPoints[3], rect, cellX, cellY)) { return true; } if (this.scaledPoints[3].intersectsRectangle(this.scaledPoints[4], rect, cellX, cellY)) { return true; } return false; } } break; case ORIENTATION_HORIZONTAL: { cx0 += this.scaledOffsetForEdgeSide; cx1 -= this.scaledOffsetForEdgeSide; if (cx0 >= rx1 || cx1 < rx0 || cy0 >= ry1 || cy1 < ry0) { if (this.scaledPoints[0].intersectsRectangle(this.scaledPoints[1], rect, cellX, cellY)) { return true; } if (this.scaledPoints[1].intersectsRectangle(this.scaledPoints[2], rect, cellX, cellY)) { return true; } if (this.scaledPoints[3].intersectsRectangle(this.scaledPoints[4], rect, cellX, cellY)) { return true; } return this.scaledPoints[4].intersectsRectangle(this.scaledPoints[5], rect, cellX, cellY); } } break; default: throw new Error("Unsupported orientation"); } } return true; }
jhexed
positive
1,955
@Test public void testMulipleAttributeKeys() throws Exception { final Map<Serializable, Set<IPersonAttributes>> cacheMap = new HashMap<>(); final Set<String> keyAttrs = new HashSet<>(); keyAttrs.add("name.first"); keyAttrs.add("name.last"); var dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); var cacheKeyGenerator = new AttributeBasedCacheKeyGenerator(); cacheKeyGenerator.setCacheKeyAttributes(keyAttrs); dao.setCacheKeyGenerator(cacheKeyGenerator); dao.setUserInfoCache(cacheMap); dao.afterPropertiesSet(); assertEquals(0, cacheMap.size()); var result = dao.getPerson("edalquist"); assertNull(result); assertEquals(0, cacheMap.size()); result = dao.getPerson("nobody"); assertNull(result); assertEquals(0, cacheMap.size()); result = dao.getPerson("edalquist"); assertNull(result); assertEquals(0, cacheMap.size()); final Map<String, List<Object>> queryMap1 = new HashMap<>(); queryMap1.put(defaultAttr, Util.list("edalquist")); queryMap1.put("name.first", Util.list("Eric")); queryMap1.put("name.last", Util.list("Dalquist")); var resultSet = dao.getPeopleWithMultivaluedAttributes(queryMap1); assertEquals(1, resultSet.size()); assertNotNull(resultSet.iterator().next().getAttributes()); assertEquals(Util.list("777-7777"), resultSet.iterator().next().getAttributes().get("phone")); assertEquals(Util.list("Display Name"), resultSet.iterator().next().getAttributes().get("displayName")); assertEquals(1, cacheMap.size()); final Map<String, Object> queryMap2 = new HashMap<>(); queryMap2.put("name.first", Util.list("John")); queryMap2.put("name.last", Util.list("Doe")); resultSet = dao.getPeople(queryMap2); assertNull(resultSet); assertEquals(1, cacheMap.size()); resultSet = dao.getPeopleWithMultivaluedAttributes(queryMap1); assertEquals(1, resultSet.size()); assertNotNull(resultSet.iterator().next().getAttributes()); assertEquals(Util.list("777-7777"), resultSet.iterator().next().getAttributes().get("phone")); assertEquals(Util.list("Display Name"), resultSet.iterator().next().getAttributes().get("displayName")); assertEquals(1, cacheMap.size()); }
@Test public void testMulipleAttributeKeys() throws Exception { final Map<Serializable, Set<IPersonAttributes>> cacheMap = new HashMap<>(); final Set<String> keyAttrs = new HashSet<>(); keyAttrs.add("name.first"); keyAttrs.add("name.last"); var dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); var cacheKeyGenerator = new AttributeBasedCacheKeyGenerator(); cacheKeyGenerator.setCacheKeyAttributes(keyAttrs); dao.setCacheKeyGenerator(cacheKeyGenerator); dao.setUserInfoCache(cacheMap); dao.afterPropertiesSet(); assertEquals(0, cacheMap.size()); var result = dao.getPerson("edalquist"); assertNull(result); assertEquals(0, cacheMap.size()); result = dao.getPerson("nobody"); assertNull(result); assertEquals(0, cacheMap.size()); result = dao.getPerson("edalquist"); assertNull(result); assertEquals(0, cacheMap.size()); final Map<String, List<Object>> queryMap1 = new HashMap<>(); queryMap1.put(defaultAttr, Util.list("edalquist")); queryMap1.put("name.first", Util.list("Eric")); queryMap1.put("name.last", Util.list("Dalquist")); var resultSet = dao.getPeopleWithMultivaluedAttributes(queryMap1); assertEquals(1, resultSet.size()); <DeepExtract> assertNotNull(resultSet.iterator().next().getAttributes()); assertEquals(Util.list("777-7777"), resultSet.iterator().next().getAttributes().get("phone")); assertEquals(Util.list("Display Name"), resultSet.iterator().next().getAttributes().get("displayName")); </DeepExtract> assertEquals(1, cacheMap.size()); final Map<String, Object> queryMap2 = new HashMap<>(); queryMap2.put("name.first", Util.list("John")); queryMap2.put("name.last", Util.list("Doe")); resultSet = dao.getPeople(queryMap2); assertNull(resultSet); assertEquals(1, cacheMap.size()); resultSet = dao.getPeopleWithMultivaluedAttributes(queryMap1); assertEquals(1, resultSet.size()); <DeepExtract> assertNotNull(resultSet.iterator().next().getAttributes()); assertEquals(Util.list("777-7777"), resultSet.iterator().next().getAttributes().get("phone")); assertEquals(Util.list("Display Name"), resultSet.iterator().next().getAttributes().get("displayName")); </DeepExtract> assertEquals(1, cacheMap.size()); }
person-directory
positive
1,956
@Override public void unset(Collection<Key<?>> keys) { return current.without(keys); return current.without(keys); removed.addAll(keys); }
@Override public void unset(Collection<Key<?>> keys) { <DeepExtract> return current.without(keys); </DeepExtract> return current.without(keys); removed.addAll(keys); }
octarine
positive
1,957
public String toDelimitedString(String delimiter) { StringBuilder sb = new StringBuilder(columns * size()); if (header != null) { accumulateRow(sb, delimiter, header); sb.append('\n'); } for (Row row : this) { accumulateRow(sb, delimiter, row); sb.append('\n'); } sb.deleteCharAt(sb.length() - 1); return toFormattedString(false, false); }
public String toDelimitedString(String delimiter) { StringBuilder sb = new StringBuilder(columns * size()); if (header != null) { accumulateRow(sb, delimiter, header); sb.append('\n'); } for (Row row : this) { accumulateRow(sb, delimiter, row); sb.append('\n'); } sb.deleteCharAt(sb.length() - 1); <DeepExtract> return toFormattedString(false, false); </DeepExtract> }
Azzet
positive
1,958
@Override public Printer<?> getPrinter(DateFormat annotation, Class<?> fieldType) { DateFormatter formatter = new DateFormatter(); formatter.setFormat(annotation.format()); return formatter; }
@Override public Printer<?> getPrinter(DateFormat annotation, Class<?> fieldType) { <DeepExtract> DateFormatter formatter = new DateFormatter(); formatter.setFormat(annotation.format()); return formatter; </DeepExtract> }
spring-mvc-examples
positive
1,959
public Long word_id(String word) { float[] ret = new float[vectorSize]; get(word, ret, 0); return ret; }
public Long word_id(String word) { <DeepExtract> float[] ret = new float[vectorSize]; get(word, ret, 0); return ret; </DeepExtract> }
SalIE
positive
1,960
public static Bitmap getBitmap(final String filePath, final int maxWidth, final int maxHeight) { if (isSpace(filePath)) { return null; } BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(filePath, options); int height = options.outHeight; int width = options.outWidth; int inSampleSize = 1; while (height > maxHeight || width > maxWidth) { height >>= 1; width >>= 1; inSampleSize <<= 1; } return inSampleSize; options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(filePath, options); }
public static Bitmap getBitmap(final String filePath, final int maxWidth, final int maxHeight) { if (isSpace(filePath)) { return null; } BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(filePath, options); <DeepExtract> int height = options.outHeight; int width = options.outWidth; int inSampleSize = 1; while (height > maxHeight || width > maxWidth) { height >>= 1; width >>= 1; inSampleSize <<= 1; } return inSampleSize; </DeepExtract> options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(filePath, options); }
Jetpack-From-Java-To-Kotlin
positive
1,961
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (mGrid != null) { return; } View root = getView(); if (root == null) { throw new IllegalStateException("Content view not yet created"); } if (root instanceof GridView) { mGrid = (GridView) root; } else { mStandardEmptyView = (TextView) root.findViewById(INTERNAL_EMPTY_ID); if (mStandardEmptyView == null) { mEmptyView = root.findViewById(android.R.id.empty); } else { mStandardEmptyView.setVisibility(View.GONE); } mProgressContainer = root.findViewById(INTERNAL_PROGRESS_CONTAINER_ID); mGridContainer = root.findViewById(INTERNAL_LIST_CONTAINER_ID); View rawGridView = root.findViewById(android.R.id.list); if (!(rawGridView instanceof GridView)) { if (rawGridView == null) { throw new RuntimeException("Your content must have a GridView whose id attribute is " + "'android.R.id.list'"); } throw new RuntimeException("Content has view with id attribute 'android.R.id.list' " + "that is not a GridView class"); } mGrid = (GridView) rawGridView; if (mEmptyView != null) { mGrid.setEmptyView(mEmptyView); } else if (mEmptyText != null) { mStandardEmptyView.setText(mEmptyText); mGrid.setEmptyView(mStandardEmptyView); } } mGridShown = true; mGrid.setOnItemClickListener(mOnClickListener); if (mAdapter != null) { ListAdapter adapter = mAdapter; mAdapter = null; setGridAdapter(adapter); } else { if (mProgressContainer != null) { setGridShown(false, false); } } mHandler.post(mRequestFocus); }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); <DeepExtract> if (mGrid != null) { return; } View root = getView(); if (root == null) { throw new IllegalStateException("Content view not yet created"); } if (root instanceof GridView) { mGrid = (GridView) root; } else { mStandardEmptyView = (TextView) root.findViewById(INTERNAL_EMPTY_ID); if (mStandardEmptyView == null) { mEmptyView = root.findViewById(android.R.id.empty); } else { mStandardEmptyView.setVisibility(View.GONE); } mProgressContainer = root.findViewById(INTERNAL_PROGRESS_CONTAINER_ID); mGridContainer = root.findViewById(INTERNAL_LIST_CONTAINER_ID); View rawGridView = root.findViewById(android.R.id.list); if (!(rawGridView instanceof GridView)) { if (rawGridView == null) { throw new RuntimeException("Your content must have a GridView whose id attribute is " + "'android.R.id.list'"); } throw new RuntimeException("Content has view with id attribute 'android.R.id.list' " + "that is not a GridView class"); } mGrid = (GridView) rawGridView; if (mEmptyView != null) { mGrid.setEmptyView(mEmptyView); } else if (mEmptyText != null) { mStandardEmptyView.setText(mEmptyText); mGrid.setEmptyView(mStandardEmptyView); } } mGridShown = true; mGrid.setOnItemClickListener(mOnClickListener); if (mAdapter != null) { ListAdapter adapter = mAdapter; mAdapter = null; setGridAdapter(adapter); } else { if (mProgressContainer != null) { setGridShown(false, false); } } mHandler.post(mRequestFocus); </DeepExtract> }
android-xbmcremote-sandbox
positive
1,962
@Override public void onViewCreated(View view, Bundle savedInstanceState) { if (getActivity() instanceof AppCompatActivity) { getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); } listView = (ListView) view.findViewById(R.id.listview); View header = getLayoutInflater(savedInstanceState).inflate(R.layout.fragment_programoverview_header, listView, false); mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(org.hisp.dhis.android.sdk.R.id.swipe_to_refresh_layout); mSwipeRefreshLayout.setColorSchemeResources(org.hisp.dhis.android.sdk.R.color.Green, org.hisp.dhis.android.sdk.R.color.Blue, org.hisp.dhis.android.sdk.R.color.orange); mSwipeRefreshLayout.setOnRefreshListener(this); relationshipsLinearLayout = (LinearLayout) header.findViewById(R.id.relationships_linearlayout); refreshRelationshipButton = (Button) header.findViewById(R.id.pullrelationshipbutton); refreshRelationshipButton.setOnClickListener(this); newRelationshipButton = (Button) header.findViewById(R.id.addrelationshipbutton); newRelationshipButton.setOnClickListener(this); mProgressBar = (ProgressBar) header.findViewById(R.id.progress_bar); mProgressBar.setVisibility(View.GONE); adapter = new ProgramStageAdapter(getLayoutInflater(savedInstanceState)); listView.addHeaderView(header, CLASS_TAG, false); listView.setAdapter(adapter); listView.setOnItemClickListener(this); registerForContextMenu(listView); enrollmentServerStatus = (ImageView) header.findViewById(R.id.enrollmentstatus); enrollmentServerStatusText = (TextView) header.findViewById(R.id.enrollmentstatus_text); enrollmentLayout = (LinearLayout) header.findViewById(R.id.enrollmentLayout); enrollmentDateLabel = (TextView) header.findViewById(R.id.dateOfEnrollmentLabel); enrollmentDateValue = (TextView) header.findViewById(R.id.dateOfEnrollmentValue); incidentDateLabel = (TextView) header.findViewById(R.id.dateOfIncidentLabel); incidentDateValue = (TextView) header.findViewById(R.id.dateOfIncidentValue); profileCardView = (CardView) header.findViewById(R.id.profile_cardview); enrollmentCardview = (CardView) header.findViewById(R.id.enrollment_cardview); noActiveEnrollment = (TextView) header.findViewById(R.id.noactiveenrollment); programIndicatorCardView = (CardView) header.findViewById(R.id.programindicators_cardview); eventsCardView = (CardView) header.findViewById(R.id.events_cardview); completeButton = (Button) header.findViewById(R.id.complete); reOpenButton = (Button) header.findViewById(R.id.re_open); terminateButton = (Button) header.findViewById(R.id.terminate); followupButton = (ImageButton) header.findViewById(R.id.followupButton); profileButton = (ImageButton) header.findViewById(R.id.profile_button); completeButton.setOnClickListener(this); reOpenButton.setOnClickListener(this); terminateButton.setOnClickListener(this); followupButton.setOnClickListener(this); followupButton.setVisibility(View.GONE); profileButton.setOnClickListener(this); profileCardView.setOnClickListener(this); enrollmentServerStatus.setOnClickListener(this); enrollmentLayout.setOnClickListener(this); missingEnrollmentLayout = (LinearLayout) header.findViewById(R.id.missingenrollmentlayout); newEnrollmentButton = (FloatingActionButton) header.findViewById(R.id.newenrollmentbutton); newEnrollmentButton.setOnClickListener(this); attribute1Label = (TextView) header.findViewById(R.id.headerItem1label); attribute1Value = (TextView) header.findViewById(R.id.headerItem1value); attribute2Label = (TextView) header.findViewById(R.id.headerItem2label); attribute2Value = (TextView) header.findViewById(R.id.headerItem2value); Bundle fragmentArguments = getArguments(); if (savedInstanceState != null && savedInstanceState.getParcelable(STATE) != null) { mState = savedInstanceState.getParcelable(STATE); } if (mState == null) { mState = new ProgramOverviewFragmentState(); OrganisationUnit ou = MetaDataController.getOrganisationUnit(fragmentArguments.getString(ORG_UNIT_ID)); Program program = MetaDataController.getProgram(fragmentArguments.getString(PROGRAM_ID)); mState.setOrgUnit(ou.getId(), ou.getLabel()); mState.setProgram(program.getUid(), program.getName()); mState.setTrackedEntityInstance(fragmentArguments.getLong(TRACKEDENTITYINSTANCE_ID, -1)); } if (!isSpinnerAttached()) { Toolbar toolbar = getActionBarToolbar(); LayoutInflater inflater = LayoutInflater.from(getActivity()); mSpinnerContainer = inflater.inflate(org.hisp.dhis.android.sdk.R.layout.toolbar_spinner_simple, toolbar, false); ActionBar.LayoutParams lp = new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); toolbar.addView(mSpinnerContainer, lp); mSpinnerAdapter = new ProgramAdapter(inflater); mSpinner = (Spinner) mSpinnerContainer.findViewById(org.hisp.dhis.android.sdk.R.id.toolbar_spinner); mSpinner.setAdapter(mSpinnerAdapter); mSpinner.post(new Runnable() { public void run() { if (mSpinner != null) { mSpinner.setOnItemSelectedListener(ProgramOverviewFragment.this); } } }); } mSpinnerAdapter.swapData(MetaDataController.getProgramsForOrganisationUnit(fragmentArguments.getString(ORG_UNIT_ID), ProgramType.WITH_REGISTRATION)); ProgramOverviewFragmentState backedUpState = new ProgramOverviewFragmentState(mState); if (!backedUpState.isProgramEmpty()) { onProgramSelected(backedUpState.getProgramId(), backedUpState.getProgramName()); } else { } }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { if (getActivity() instanceof AppCompatActivity) { getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); } listView = (ListView) view.findViewById(R.id.listview); View header = getLayoutInflater(savedInstanceState).inflate(R.layout.fragment_programoverview_header, listView, false); mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(org.hisp.dhis.android.sdk.R.id.swipe_to_refresh_layout); mSwipeRefreshLayout.setColorSchemeResources(org.hisp.dhis.android.sdk.R.color.Green, org.hisp.dhis.android.sdk.R.color.Blue, org.hisp.dhis.android.sdk.R.color.orange); mSwipeRefreshLayout.setOnRefreshListener(this); relationshipsLinearLayout = (LinearLayout) header.findViewById(R.id.relationships_linearlayout); refreshRelationshipButton = (Button) header.findViewById(R.id.pullrelationshipbutton); refreshRelationshipButton.setOnClickListener(this); newRelationshipButton = (Button) header.findViewById(R.id.addrelationshipbutton); newRelationshipButton.setOnClickListener(this); mProgressBar = (ProgressBar) header.findViewById(R.id.progress_bar); mProgressBar.setVisibility(View.GONE); adapter = new ProgramStageAdapter(getLayoutInflater(savedInstanceState)); listView.addHeaderView(header, CLASS_TAG, false); listView.setAdapter(adapter); listView.setOnItemClickListener(this); registerForContextMenu(listView); enrollmentServerStatus = (ImageView) header.findViewById(R.id.enrollmentstatus); enrollmentServerStatusText = (TextView) header.findViewById(R.id.enrollmentstatus_text); enrollmentLayout = (LinearLayout) header.findViewById(R.id.enrollmentLayout); enrollmentDateLabel = (TextView) header.findViewById(R.id.dateOfEnrollmentLabel); enrollmentDateValue = (TextView) header.findViewById(R.id.dateOfEnrollmentValue); incidentDateLabel = (TextView) header.findViewById(R.id.dateOfIncidentLabel); incidentDateValue = (TextView) header.findViewById(R.id.dateOfIncidentValue); profileCardView = (CardView) header.findViewById(R.id.profile_cardview); enrollmentCardview = (CardView) header.findViewById(R.id.enrollment_cardview); noActiveEnrollment = (TextView) header.findViewById(R.id.noactiveenrollment); programIndicatorCardView = (CardView) header.findViewById(R.id.programindicators_cardview); eventsCardView = (CardView) header.findViewById(R.id.events_cardview); completeButton = (Button) header.findViewById(R.id.complete); reOpenButton = (Button) header.findViewById(R.id.re_open); terminateButton = (Button) header.findViewById(R.id.terminate); followupButton = (ImageButton) header.findViewById(R.id.followupButton); profileButton = (ImageButton) header.findViewById(R.id.profile_button); completeButton.setOnClickListener(this); reOpenButton.setOnClickListener(this); terminateButton.setOnClickListener(this); followupButton.setOnClickListener(this); followupButton.setVisibility(View.GONE); profileButton.setOnClickListener(this); profileCardView.setOnClickListener(this); enrollmentServerStatus.setOnClickListener(this); enrollmentLayout.setOnClickListener(this); missingEnrollmentLayout = (LinearLayout) header.findViewById(R.id.missingenrollmentlayout); newEnrollmentButton = (FloatingActionButton) header.findViewById(R.id.newenrollmentbutton); newEnrollmentButton.setOnClickListener(this); attribute1Label = (TextView) header.findViewById(R.id.headerItem1label); attribute1Value = (TextView) header.findViewById(R.id.headerItem1value); attribute2Label = (TextView) header.findViewById(R.id.headerItem2label); attribute2Value = (TextView) header.findViewById(R.id.headerItem2value); Bundle fragmentArguments = getArguments(); if (savedInstanceState != null && savedInstanceState.getParcelable(STATE) != null) { mState = savedInstanceState.getParcelable(STATE); } if (mState == null) { mState = new ProgramOverviewFragmentState(); OrganisationUnit ou = MetaDataController.getOrganisationUnit(fragmentArguments.getString(ORG_UNIT_ID)); Program program = MetaDataController.getProgram(fragmentArguments.getString(PROGRAM_ID)); mState.setOrgUnit(ou.getId(), ou.getLabel()); mState.setProgram(program.getUid(), program.getName()); mState.setTrackedEntityInstance(fragmentArguments.getLong(TRACKEDENTITYINSTANCE_ID, -1)); } if (!isSpinnerAttached()) { Toolbar toolbar = getActionBarToolbar(); LayoutInflater inflater = LayoutInflater.from(getActivity()); mSpinnerContainer = inflater.inflate(org.hisp.dhis.android.sdk.R.layout.toolbar_spinner_simple, toolbar, false); ActionBar.LayoutParams lp = new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); toolbar.addView(mSpinnerContainer, lp); mSpinnerAdapter = new ProgramAdapter(inflater); mSpinner = (Spinner) mSpinnerContainer.findViewById(org.hisp.dhis.android.sdk.R.id.toolbar_spinner); mSpinner.setAdapter(mSpinnerAdapter); mSpinner.post(new Runnable() { public void run() { if (mSpinner != null) { mSpinner.setOnItemSelectedListener(ProgramOverviewFragment.this); } } }); } mSpinnerAdapter.swapData(MetaDataController.getProgramsForOrganisationUnit(fragmentArguments.getString(ORG_UNIT_ID), ProgramType.WITH_REGISTRATION)); <DeepExtract> ProgramOverviewFragmentState backedUpState = new ProgramOverviewFragmentState(mState); if (!backedUpState.isProgramEmpty()) { onProgramSelected(backedUpState.getProgramId(), backedUpState.getProgramName()); } else { } </DeepExtract> }
dhis2-android-trackercapture
positive
1,963
@PostConstruct protected void afterCreated() { return FOLDER_TYPES.contains(getProperty(resource, JcrConstants.JCR_PRIMARYTYPE)); this.scriptName = defaultIfEmpty(getProperty(resource, JcrConstants.JCR_TITLE), resource.getName()); if (!isFolder) { Optional.ofNullable(resource.adaptTo(ScriptModel.class)).ifPresent(script -> { ScriptHistory scriptHistory = history.findScriptHistory(resource.getResourceResolver(), script); this.author = script.getAuthor(); this.isValid = script.isValid(); this.lastModified = CalendarUtils.asCalendar(script.getLastModified()); this.runs.add(createScriptRun("dryRun", script, scriptHistory.getLastLocalDryRun())); this.runs.add(createScriptRun("runOnAuthor", script, scriptHistory.getLastLocalRun())); this.launchMode = LabelUtils.capitalize(script.getLaunchMode()); this.launchEnvironment = Stream.concat(Stream.of(script.getLaunchEnvironment().getRunMode()), CollectionUtils.emptyIfNull(script.getLaunchRunModes()).stream()).filter(StringUtils::isNotBlank).distinct().collect(Collectors.joining(", ")); this.isLaunchEnabled = script.isLaunchEnabled(); }); } }
@PostConstruct protected void afterCreated() { <DeepExtract> return FOLDER_TYPES.contains(getProperty(resource, JcrConstants.JCR_PRIMARYTYPE)); </DeepExtract> this.scriptName = defaultIfEmpty(getProperty(resource, JcrConstants.JCR_TITLE), resource.getName()); if (!isFolder) { Optional.ofNullable(resource.adaptTo(ScriptModel.class)).ifPresent(script -> { ScriptHistory scriptHistory = history.findScriptHistory(resource.getResourceResolver(), script); this.author = script.getAuthor(); this.isValid = script.isValid(); this.lastModified = CalendarUtils.asCalendar(script.getLastModified()); this.runs.add(createScriptRun("dryRun", script, scriptHistory.getLastLocalDryRun())); this.runs.add(createScriptRun("runOnAuthor", script, scriptHistory.getLastLocalRun())); this.launchMode = LabelUtils.capitalize(script.getLaunchMode()); this.launchEnvironment = Stream.concat(Stream.of(script.getLaunchEnvironment().getRunMode()), CollectionUtils.emptyIfNull(script.getLaunchRunModes()).stream()).filter(StringUtils::isNotBlank).distinct().collect(Collectors.joining(", ")); this.isLaunchEnabled = script.isLaunchEnabled(); }); } }
APM
positive
1,964
@Override public PacketData translate(ServerSession session, PacketData data) { int entityId = data.read(Type.INT, 0); int x = data.read(Type.BYTE, 1); int y = data.read(Type.BYTE, 2); int z = data.read(Type.BYTE, 3); EntityTracker tracker = session.getStorage().get(EntityTracker.class); AbstractEntity e = tracker.getEntity(entityId); if (e != null) { Location oldLoc = e.getLocation(); double xPos = x / 32.0D; double yPos = y / 32.0D; double zPos = z / 32.0D; Location newLoc; if (true) { newLoc = new Location(oldLoc.getX() + xPos, oldLoc.getY() + yPos, oldLoc.getZ() + zPos); } else { newLoc = new Location(xPos, yPos, zPos); } e.setLocation(newLoc); } return data; }
@Override public PacketData translate(ServerSession session, PacketData data) { int entityId = data.read(Type.INT, 0); int x = data.read(Type.BYTE, 1); int y = data.read(Type.BYTE, 2); int z = data.read(Type.BYTE, 3); <DeepExtract> EntityTracker tracker = session.getStorage().get(EntityTracker.class); AbstractEntity e = tracker.getEntity(entityId); if (e != null) { Location oldLoc = e.getLocation(); double xPos = x / 32.0D; double yPos = y / 32.0D; double zPos = z / 32.0D; Location newLoc; if (true) { newLoc = new Location(oldLoc.getX() + xPos, oldLoc.getY() + yPos, oldLoc.getZ() + zPos); } else { newLoc = new Location(xPos, yPos, zPos); } e.setLocation(newLoc); } </DeepExtract> return data; }
DirtMultiversion
positive
1,965