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 static Request parse(BufferedReader reader) throws IOException { while (reader.ready()) { final String headerLine; headerLine = reader.readLine(); if (CRLF.equals(headerLine) || "".equals(headerLine)) { break; } } return new Request(readBody(reader)); }
public static Request parse(BufferedReader reader) throws IOException { <DeepExtract> while (reader.ready()) { final String headerLine; headerLine = reader.readLine(); if (CRLF.equals(headerLine) || "".equals(headerLine)) { break; } } </DeepExtract> return new Request(readBody(reader)); }
selenium-grid
positive
1,500
public void release() { if (mWakeLock != null) { if (false && !mWakeLock.isHeld()) { mWakeLock.acquire(); } else if (!false && mWakeLock.isHeld()) { mWakeLock.release(); } } mStayAwake = false; updateSurfaceScreenOn(); if (mSurfaceHolder != null) mSurfaceHolder.setKeepScreenOn(mScreenOnWhilePlaying && mStayAwake); native_stop(); native_release(); if (mFD != null) { try { mFD.close(); } catch (IOException e) { e.printStackTrace(); } mFD = null; } mOnPreparedListener = null; mOnFreshVideo = null; mOnBufferingUpdateListener = null; mOnCompletionListener = null; mOnSeekCompleteListener = null; mOnErrorListener = null; mOnInfoListener = null; mOnVideoSizeChangedListener = null; mOnHWRenderFailedListener = null; mEventHandler = null; }
public void release() { if (mWakeLock != null) { if (false && !mWakeLock.isHeld()) { mWakeLock.acquire(); } else if (!false && mWakeLock.isHeld()) { mWakeLock.release(); } } mStayAwake = false; updateSurfaceScreenOn(); if (mSurfaceHolder != null) mSurfaceHolder.setKeepScreenOn(mScreenOnWhilePlaying && mStayAwake); native_stop(); native_release(); if (mFD != null) { try { mFD.close(); } catch (IOException e) { e.printStackTrace(); } mFD = null; } <DeepExtract> mOnPreparedListener = null; mOnFreshVideo = null; mOnBufferingUpdateListener = null; mOnCompletionListener = null; mOnSeekCompleteListener = null; mOnErrorListener = null; mOnInfoListener = null; mOnVideoSizeChangedListener = null; mOnHWRenderFailedListener = null; </DeepExtract> mEventHandler = null; }
dttv-android
positive
1,501
public void showRefreshAnimation(MenuItem item) { if (refreshItem != null) { View view = refreshItem.getActionView(); if (view != null) { view.clearAnimation(); refreshItem.setActionView(null); } } refreshItem = item; View refreshActionView = getLayoutInflater().inflate(R.layout.item_refresh_menu, null); item.setActionView(refreshActionView); Animation rotateAnimation = AnimationUtils.loadAnimation(this, R.anim.rotate); refreshActionView.setAnimation(rotateAnimation); refreshActionView.startAnimation(rotateAnimation); }
public void showRefreshAnimation(MenuItem item) { <DeepExtract> if (refreshItem != null) { View view = refreshItem.getActionView(); if (view != null) { view.clearAnimation(); refreshItem.setActionView(null); } } </DeepExtract> refreshItem = item; View refreshActionView = getLayoutInflater().inflate(R.layout.item_refresh_menu, null); item.setActionView(refreshActionView); Animation rotateAnimation = AnimationUtils.loadAnimation(this, R.anim.rotate); refreshActionView.setAnimation(rotateAnimation); refreshActionView.startAnimation(rotateAnimation); }
Android_Expression_Package
positive
1,503
public String getPathNatives() { if (natives == null) return null; if (_artifact == null) { _artifact = new Artifact(name); } String ret = String.format("%s/%s/%s/%s-%s", domain.replace('.', '/'), name, version, name, version); if (natives.get(OS.CURRENT) != null && natives.get(OS.CURRENT).indexOf('$') > -1) { natives.get(OS.CURRENT) = natives.get(OS.CURRENT).replace("${arch}", Constants.SYSTEM_ARCH.toString()); } if (natives.get(OS.CURRENT) != null) ret += "-" + natives.get(OS.CURRENT); return ret + "." + ext; }
public String getPathNatives() { if (natives == null) return null; if (_artifact == null) { _artifact = new Artifact(name); } <DeepExtract> String ret = String.format("%s/%s/%s/%s-%s", domain.replace('.', '/'), name, version, name, version); if (natives.get(OS.CURRENT) != null && natives.get(OS.CURRENT).indexOf('$') > -1) { natives.get(OS.CURRENT) = natives.get(OS.CURRENT).replace("${arch}", Constants.SYSTEM_ARCH.toString()); } if (natives.get(OS.CURRENT) != null) ret += "-" + natives.get(OS.CURRENT); return ret + "." + ext; </DeepExtract> }
ForgeGradle
positive
1,504
public SpannableText setBackgroundColor(int color) { setSpan(new BackgroundColorSpan(color), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE); return this; return this; }
public SpannableText setBackgroundColor(int color) { <DeepExtract> setSpan(new BackgroundColorSpan(color), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE); return this; </DeepExtract> return this; }
Utils-Everywhere
positive
1,505
public static void setSearchCriteria(@Nullable Context context, SearchCriteria searchCriteria) { if (null == context) { return; } if (null == context) { return; } Editor edit = PreferenceManager.getDefaultSharedPreferences(context).edit(); edit.putString(context.getString(R.string.key_SearchCriteria), searchCriteria.toJson()); edit.apply(); }
public static void setSearchCriteria(@Nullable Context context, SearchCriteria searchCriteria) { if (null == context) { return; } <DeepExtract> if (null == context) { return; } Editor edit = PreferenceManager.getDefaultSharedPreferences(context).edit(); edit.putString(context.getString(R.string.key_SearchCriteria), searchCriteria.toJson()); edit.apply(); </DeepExtract> }
mtg-familiar
positive
1,506
@Override public void startSession(String appKey) { if (isDebug) { Log.d(TAG, "startSession invoked!"); } MobclickAgent.onResume(mContext); }
@Override public void startSession(String appKey) { <DeepExtract> if (isDebug) { Log.d(TAG, "startSession invoked!"); } </DeepExtract> MobclickAgent.onResume(mContext); }
HelloRuby
positive
1,507
private static void getAttestationRecord(JSONObject jsonObject, X509Certificate certificate) throws Exception { ParsedAttestationRecord parsedAttestationRecord = ParsedAttestationRecord.createParsedAttestationRecord(certificate); jsonObject.put("attestationVersion", parsedAttestationRecord.attestationVersion); jsonObject.put("attestationSecurityLevel", parsedAttestationRecord.attestationSecurityLevel.name()); jsonObject.put("keymasterVersion", parsedAttestationRecord.keymasterVersion); jsonObject.put("keymasterSecurityLevel", parsedAttestationRecord.keymasterSecurityLevel.name()); jsonObject.put("attestationChallenge", new String(parsedAttestationRecord.attestationChallenge, UTF_8)); jsonObject.put("uniqueId", Arrays.toString(parsedAttestationRecord.uniqueId)); JSONObject softwareEnforced = new JSONObject(); getOptional(parsedAttestationRecord.softwareEnforced.purpose, "purpose", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.algorithm, "algorithm", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.keySize, "keySize", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.digest, "digest", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.padding, "padding", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.ecCurve, "ecCurve", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.rsaPublicExponent, "rsaPublicExponent", softwareEnforced); softwareEnforced.put("rollbackResistance", parsedAttestationRecord.softwareEnforced.rollbackResistance); getOptional(parsedAttestationRecord.softwareEnforced.activeDateTime, "activeDateTime", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.originationExpireDateTime, "originationExpireDateTime", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.usageExpireDateTime, "usageExpireDateTime", softwareEnforced); softwareEnforced.put("noAuthRequired", parsedAttestationRecord.softwareEnforced.noAuthRequired); getOptional(parsedAttestationRecord.softwareEnforced.userAuthType, "userAuthType", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.authTimeout, "authTimeout", softwareEnforced); softwareEnforced.put("allowWhileOnBody", parsedAttestationRecord.softwareEnforced.allowWhileOnBody); softwareEnforced.put("trustedUserPresenceRequired", parsedAttestationRecord.softwareEnforced.trustedUserPresenceRequired); softwareEnforced.put("trustedConfirmationRequired", parsedAttestationRecord.softwareEnforced.trustedConfirmationRequired); softwareEnforced.put("unlockedDeviceRequired", parsedAttestationRecord.softwareEnforced.unlockedDeviceRequired); softwareEnforced.put("allApplications", parsedAttestationRecord.softwareEnforced.allApplications); getOptional(parsedAttestationRecord.softwareEnforced.applicationId, "applicationId", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.creationDateTime, "creationDateTime", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.origin, "origin", softwareEnforced); softwareEnforced.put("rollbackResistant", parsedAttestationRecord.softwareEnforced.rollbackResistant); JSONObject rootOfTrust = new JSONObject(); getRootOfTrust(parsedAttestationRecord.softwareEnforced.rootOfTrust, rootOfTrust); softwareEnforced.put("rootOfTrust", rootOfTrust); getOptional(parsedAttestationRecord.softwareEnforced.osVersion, "osVersion", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.osPatchLevel, "osPatchLevel", softwareEnforced); JSONObject applicationId = new JSONObject(); getAttestationApplicationId(parsedAttestationRecord.softwareEnforced.attestationApplicationId, applicationId); softwareEnforced.put("attestationApplicationId", applicationId); getOptional(parsedAttestationRecord.softwareEnforced.attestationApplicationIdBytes, "attestationApplicationIdBytes", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdBrand, "attestationIdBrand", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdDevice, "attestationIdDevice", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdProduct, "attestationIdProduct", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdSerial, "attestationIdSerial", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdImei, "attestationIdImei", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdMeid, "attestationIdMeid", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdManufacturer, "attestationIdManufacturer", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdModel, "attestationIdModel", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.vendorPatchLevel, "vendorPatchLevel", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.bootPatchLevel, "bootPatchLevel", softwareEnforced); jsonObject.put("softwareEnforced", softwareEnforced); JSONObject teeEnforced = new JSONObject(); getOptional(parsedAttestationRecord.teeEnforced.purpose, "purpose", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.algorithm, "algorithm", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.keySize, "keySize", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.digest, "digest", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.padding, "padding", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.ecCurve, "ecCurve", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.rsaPublicExponent, "rsaPublicExponent", teeEnforced); teeEnforced.put("rollbackResistance", parsedAttestationRecord.teeEnforced.rollbackResistance); getOptional(parsedAttestationRecord.teeEnforced.activeDateTime, "activeDateTime", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.originationExpireDateTime, "originationExpireDateTime", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.usageExpireDateTime, "usageExpireDateTime", teeEnforced); teeEnforced.put("noAuthRequired", parsedAttestationRecord.teeEnforced.noAuthRequired); getOptional(parsedAttestationRecord.teeEnforced.userAuthType, "userAuthType", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.authTimeout, "authTimeout", teeEnforced); teeEnforced.put("allowWhileOnBody", parsedAttestationRecord.teeEnforced.allowWhileOnBody); teeEnforced.put("trustedUserPresenceRequired", parsedAttestationRecord.teeEnforced.trustedUserPresenceRequired); teeEnforced.put("trustedConfirmationRequired", parsedAttestationRecord.teeEnforced.trustedConfirmationRequired); teeEnforced.put("unlockedDeviceRequired", parsedAttestationRecord.teeEnforced.unlockedDeviceRequired); teeEnforced.put("allApplications", parsedAttestationRecord.teeEnforced.allApplications); getOptional(parsedAttestationRecord.teeEnforced.applicationId, "applicationId", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.creationDateTime, "creationDateTime", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.origin, "origin", teeEnforced); teeEnforced.put("rollbackResistant", parsedAttestationRecord.teeEnforced.rollbackResistant); JSONObject rootOfTrust = new JSONObject(); getRootOfTrust(parsedAttestationRecord.teeEnforced.rootOfTrust, rootOfTrust); teeEnforced.put("rootOfTrust", rootOfTrust); getOptional(parsedAttestationRecord.teeEnforced.osVersion, "osVersion", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.osPatchLevel, "osPatchLevel", teeEnforced); JSONObject applicationId = new JSONObject(); getAttestationApplicationId(parsedAttestationRecord.teeEnforced.attestationApplicationId, applicationId); teeEnforced.put("attestationApplicationId", applicationId); getOptional(parsedAttestationRecord.teeEnforced.attestationApplicationIdBytes, "attestationApplicationIdBytes", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdBrand, "attestationIdBrand", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdDevice, "attestationIdDevice", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdProduct, "attestationIdProduct", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdSerial, "attestationIdSerial", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdImei, "attestationIdImei", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdMeid, "attestationIdMeid", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdManufacturer, "attestationIdManufacturer", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdModel, "attestationIdModel", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.vendorPatchLevel, "vendorPatchLevel", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.bootPatchLevel, "bootPatchLevel", teeEnforced); jsonObject.put("teeEnforced", teeEnforced); }
private static void getAttestationRecord(JSONObject jsonObject, X509Certificate certificate) throws Exception { ParsedAttestationRecord parsedAttestationRecord = ParsedAttestationRecord.createParsedAttestationRecord(certificate); jsonObject.put("attestationVersion", parsedAttestationRecord.attestationVersion); jsonObject.put("attestationSecurityLevel", parsedAttestationRecord.attestationSecurityLevel.name()); jsonObject.put("keymasterVersion", parsedAttestationRecord.keymasterVersion); jsonObject.put("keymasterSecurityLevel", parsedAttestationRecord.keymasterSecurityLevel.name()); jsonObject.put("attestationChallenge", new String(parsedAttestationRecord.attestationChallenge, UTF_8)); jsonObject.put("uniqueId", Arrays.toString(parsedAttestationRecord.uniqueId)); JSONObject softwareEnforced = new JSONObject(); getOptional(parsedAttestationRecord.softwareEnforced.purpose, "purpose", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.algorithm, "algorithm", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.keySize, "keySize", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.digest, "digest", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.padding, "padding", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.ecCurve, "ecCurve", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.rsaPublicExponent, "rsaPublicExponent", softwareEnforced); softwareEnforced.put("rollbackResistance", parsedAttestationRecord.softwareEnforced.rollbackResistance); getOptional(parsedAttestationRecord.softwareEnforced.activeDateTime, "activeDateTime", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.originationExpireDateTime, "originationExpireDateTime", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.usageExpireDateTime, "usageExpireDateTime", softwareEnforced); softwareEnforced.put("noAuthRequired", parsedAttestationRecord.softwareEnforced.noAuthRequired); getOptional(parsedAttestationRecord.softwareEnforced.userAuthType, "userAuthType", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.authTimeout, "authTimeout", softwareEnforced); softwareEnforced.put("allowWhileOnBody", parsedAttestationRecord.softwareEnforced.allowWhileOnBody); softwareEnforced.put("trustedUserPresenceRequired", parsedAttestationRecord.softwareEnforced.trustedUserPresenceRequired); softwareEnforced.put("trustedConfirmationRequired", parsedAttestationRecord.softwareEnforced.trustedConfirmationRequired); softwareEnforced.put("unlockedDeviceRequired", parsedAttestationRecord.softwareEnforced.unlockedDeviceRequired); softwareEnforced.put("allApplications", parsedAttestationRecord.softwareEnforced.allApplications); getOptional(parsedAttestationRecord.softwareEnforced.applicationId, "applicationId", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.creationDateTime, "creationDateTime", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.origin, "origin", softwareEnforced); softwareEnforced.put("rollbackResistant", parsedAttestationRecord.softwareEnforced.rollbackResistant); JSONObject rootOfTrust = new JSONObject(); getRootOfTrust(parsedAttestationRecord.softwareEnforced.rootOfTrust, rootOfTrust); softwareEnforced.put("rootOfTrust", rootOfTrust); getOptional(parsedAttestationRecord.softwareEnforced.osVersion, "osVersion", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.osPatchLevel, "osPatchLevel", softwareEnforced); JSONObject applicationId = new JSONObject(); getAttestationApplicationId(parsedAttestationRecord.softwareEnforced.attestationApplicationId, applicationId); softwareEnforced.put("attestationApplicationId", applicationId); getOptional(parsedAttestationRecord.softwareEnforced.attestationApplicationIdBytes, "attestationApplicationIdBytes", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdBrand, "attestationIdBrand", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdDevice, "attestationIdDevice", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdProduct, "attestationIdProduct", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdSerial, "attestationIdSerial", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdImei, "attestationIdImei", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdMeid, "attestationIdMeid", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdManufacturer, "attestationIdManufacturer", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.attestationIdModel, "attestationIdModel", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.vendorPatchLevel, "vendorPatchLevel", softwareEnforced); getOptional(parsedAttestationRecord.softwareEnforced.bootPatchLevel, "bootPatchLevel", softwareEnforced); jsonObject.put("softwareEnforced", softwareEnforced); JSONObject teeEnforced = new JSONObject(); <DeepExtract> getOptional(parsedAttestationRecord.teeEnforced.purpose, "purpose", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.algorithm, "algorithm", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.keySize, "keySize", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.digest, "digest", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.padding, "padding", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.ecCurve, "ecCurve", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.rsaPublicExponent, "rsaPublicExponent", teeEnforced); teeEnforced.put("rollbackResistance", parsedAttestationRecord.teeEnforced.rollbackResistance); getOptional(parsedAttestationRecord.teeEnforced.activeDateTime, "activeDateTime", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.originationExpireDateTime, "originationExpireDateTime", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.usageExpireDateTime, "usageExpireDateTime", teeEnforced); teeEnforced.put("noAuthRequired", parsedAttestationRecord.teeEnforced.noAuthRequired); getOptional(parsedAttestationRecord.teeEnforced.userAuthType, "userAuthType", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.authTimeout, "authTimeout", teeEnforced); teeEnforced.put("allowWhileOnBody", parsedAttestationRecord.teeEnforced.allowWhileOnBody); teeEnforced.put("trustedUserPresenceRequired", parsedAttestationRecord.teeEnforced.trustedUserPresenceRequired); teeEnforced.put("trustedConfirmationRequired", parsedAttestationRecord.teeEnforced.trustedConfirmationRequired); teeEnforced.put("unlockedDeviceRequired", parsedAttestationRecord.teeEnforced.unlockedDeviceRequired); teeEnforced.put("allApplications", parsedAttestationRecord.teeEnforced.allApplications); getOptional(parsedAttestationRecord.teeEnforced.applicationId, "applicationId", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.creationDateTime, "creationDateTime", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.origin, "origin", teeEnforced); teeEnforced.put("rollbackResistant", parsedAttestationRecord.teeEnforced.rollbackResistant); JSONObject rootOfTrust = new JSONObject(); getRootOfTrust(parsedAttestationRecord.teeEnforced.rootOfTrust, rootOfTrust); teeEnforced.put("rootOfTrust", rootOfTrust); getOptional(parsedAttestationRecord.teeEnforced.osVersion, "osVersion", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.osPatchLevel, "osPatchLevel", teeEnforced); JSONObject applicationId = new JSONObject(); getAttestationApplicationId(parsedAttestationRecord.teeEnforced.attestationApplicationId, applicationId); teeEnforced.put("attestationApplicationId", applicationId); getOptional(parsedAttestationRecord.teeEnforced.attestationApplicationIdBytes, "attestationApplicationIdBytes", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdBrand, "attestationIdBrand", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdDevice, "attestationIdDevice", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdProduct, "attestationIdProduct", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdSerial, "attestationIdSerial", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdImei, "attestationIdImei", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdMeid, "attestationIdMeid", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdManufacturer, "attestationIdManufacturer", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.attestationIdModel, "attestationIdModel", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.vendorPatchLevel, "vendorPatchLevel", teeEnforced); getOptional(parsedAttestationRecord.teeEnforced.bootPatchLevel, "bootPatchLevel", teeEnforced); </DeepExtract> jsonObject.put("teeEnforced", teeEnforced); }
MobileInfo
positive
1,508
public void driveRobotCentric(double strafeSpeed, double forwardSpeed, double turnSpeed) { strafeSpeed = clipRange(strafeSpeed); forwardSpeed = clipRange(forwardSpeed); turnSpeed = clipRange(turnSpeed); Vector2d input = new Vector2d(strafeSpeed, forwardSpeed); input = input.rotateBy(-0.0); double theta = input.angle(); double[] wheelSpeeds = new double[4]; wheelSpeeds[MotorType.kFrontLeft.value] = Math.sin(theta + Math.PI / 4); wheelSpeeds[MotorType.kFrontRight.value] = Math.sin(theta - Math.PI / 4); wheelSpeeds[MotorType.kBackLeft.value] = Math.sin(theta - Math.PI / 4); wheelSpeeds[MotorType.kBackRight.value] = Math.sin(theta + Math.PI / 4); normalize(wheelSpeeds, input.magnitude()); wheelSpeeds[MotorType.kFrontLeft.value] += turnSpeed; wheelSpeeds[MotorType.kFrontRight.value] -= turnSpeed; wheelSpeeds[MotorType.kBackLeft.value] += turnSpeed; wheelSpeeds[MotorType.kBackRight.value] -= turnSpeed; normalize(wheelSpeeds); driveWithMotorPowers(wheelSpeeds[MotorType.kFrontLeft.value], wheelSpeeds[MotorType.kFrontRight.value], wheelSpeeds[MotorType.kBackLeft.value], wheelSpeeds[MotorType.kBackRight.value]); }
public void driveRobotCentric(double strafeSpeed, double forwardSpeed, double turnSpeed) { <DeepExtract> strafeSpeed = clipRange(strafeSpeed); forwardSpeed = clipRange(forwardSpeed); turnSpeed = clipRange(turnSpeed); Vector2d input = new Vector2d(strafeSpeed, forwardSpeed); input = input.rotateBy(-0.0); double theta = input.angle(); double[] wheelSpeeds = new double[4]; wheelSpeeds[MotorType.kFrontLeft.value] = Math.sin(theta + Math.PI / 4); wheelSpeeds[MotorType.kFrontRight.value] = Math.sin(theta - Math.PI / 4); wheelSpeeds[MotorType.kBackLeft.value] = Math.sin(theta - Math.PI / 4); wheelSpeeds[MotorType.kBackRight.value] = Math.sin(theta + Math.PI / 4); normalize(wheelSpeeds, input.magnitude()); wheelSpeeds[MotorType.kFrontLeft.value] += turnSpeed; wheelSpeeds[MotorType.kFrontRight.value] -= turnSpeed; wheelSpeeds[MotorType.kBackLeft.value] += turnSpeed; wheelSpeeds[MotorType.kBackRight.value] -= turnSpeed; normalize(wheelSpeeds); driveWithMotorPowers(wheelSpeeds[MotorType.kFrontLeft.value], wheelSpeeds[MotorType.kFrontRight.value], wheelSpeeds[MotorType.kBackLeft.value], wheelSpeeds[MotorType.kBackRight.value]); </DeepExtract> }
FTCLib
positive
1,509
@Test public void insertPartialBatchTest() throws DBException { teardown(); setupWithBatch(10); try { String insertKey = "user0"; HashMap<String, ByteIterator> insertMap = insertRow(insertKey); ResultSet resultSet = jdbcConnection.prepareStatement(String.format("SELECT * FROM %s", TABLE_NAME)).executeQuery(); assertFalse(resultSet.next()); for (int i = 1; i < 19; i++) { insertMap = insertRow("user" + i); } assertNumRows(10 * (19 / 10)); jdbcDBClient.cleanup(); assertNumRows(19); } catch (SQLException e) { e.printStackTrace(); fail("Failed insertBatchTest"); } finally { teardown(); setup(); } }
@Test public void insertPartialBatchTest() throws DBException { <DeepExtract> teardown(); setupWithBatch(10); try { String insertKey = "user0"; HashMap<String, ByteIterator> insertMap = insertRow(insertKey); ResultSet resultSet = jdbcConnection.prepareStatement(String.format("SELECT * FROM %s", TABLE_NAME)).executeQuery(); assertFalse(resultSet.next()); for (int i = 1; i < 19; i++) { insertMap = insertRow("user" + i); } assertNumRows(10 * (19 / 10)); jdbcDBClient.cleanup(); assertNumRows(19); } catch (SQLException e) { e.printStackTrace(); fail("Failed insertBatchTest"); } finally { teardown(); setup(); } </DeepExtract> }
anna
positive
1,510
@Override public CampaignResponse method() { return executeSyncApiCall(api.updateLoyaltyCampaign(id, updateCampaign)); }
@Override public CampaignResponse method() { <DeepExtract> return executeSyncApiCall(api.updateLoyaltyCampaign(id, updateCampaign)); </DeepExtract> }
voucherify-java-sdk
positive
1,511
public void addHollowCylinder(AxisAlignedBB genBox) { if (!isWorking) throw new IllegalStateException("Can't worlgen if not generating!"); if (worldObj.isRemote) throw new IllegalArgumentException("Worldgen on CLIENT side is not allowed!"); return isWorking; double minX = genBox.minX; double minY = genBox.minY; double minZ = genBox.minZ; double maxX = genBox.maxX; double maxY = genBox.maxY; double maxZ = genBox.maxZ; return AxisAlignedBB.getBoundingBox(maxX < minX ? genBox.maxX : genBox.minX, maxY < minY ? genBox.maxY : genBox.minY, maxZ < minZ ? genBox.maxZ : genBox.minZ, maxX < minX ? genBox.minX : genBox.maxX, maxY < minY ? genBox.minY : genBox.maxY, maxZ < minZ ? genBox.minZ : genBox.maxZ); gen(); if (hasOffset) { genBox.minX += offset.x; genBox.minY += offset.y; genBox.minZ += offset.z; genBox.maxX += offset.x; genBox.maxY += offset.y; genBox.maxZ += offset.z; } double radiusX = (genBox.maxX - genBox.minX) / 2; double height = genBox.maxY - genBox.minY; double radiusZ = (genBox.maxZ - genBox.minZ) / 2; int dx = MathHelper.floor_double(genBox.minX + radiusX); int dy = MathHelper.floor_double(genBox.minY); int dz = MathHelper.floor_double(genBox.minZ + radiusZ); boolean filled = false; radiusX += 0.5D; radiusZ += 0.5D; if (height == 0) return; if (height < 0) { height = -height; dy = MathHelper.floor_double(-height); } if (dy < 0) dy = 0; else if ((dy + height) - 1 > worldObj.getActualHeight()) height = (int) ((worldObj.getActualHeight() - dy) + 1); double invRadiusX = 1.0D / radiusX; double invRadiusZ = 1.0D / radiusZ; int ceilRadiusX = (int) Math.ceil(radiusX); int ceilRadiusZ = (int) Math.ceil(radiusZ); double nextXn = 0.0D; D: for (int x = 0; x <= ceilRadiusX; x++) { double xn = nextXn; nextXn = (double) (x + 1) * invRadiusX; double nextZn = 0.0D; for (int z = 0; z <= ceilRadiusZ; z++) { double zn = nextZn; nextZn = (double) (z + 1) * invRadiusZ; double distanceSq = lengthSq(xn, zn); if (distanceSq > 1.0D) if (z == 0) break D; else break; if (!filled && lengthSq(nextXn, zn) <= 1.0D && lengthSq(xn, nextZn) <= 1.0D) continue; for (int y = 0; y < height; y++) { block(MathHelper.floor_float(dx + x), MathHelper.floor_float(dy + y), MathHelper.floor_float(dz + z)); block(MathHelper.floor_float(dx - x), MathHelper.floor_float(dy + y), MathHelper.floor_float(dz + z)); block(MathHelper.floor_float(dx + x), MathHelper.floor_float(dy + y), MathHelper.floor_float(dz - z)); block(MathHelper.floor_float(dx - x), MathHelper.floor_float(dy + y), MathHelper.floor_float(dz - z)); } } } gen(); if (hasOffset) { genBox.minX -= offset.x; genBox.minY -= offset.y; genBox.minZ -= offset.z; genBox.maxX -= offset.x; genBox.maxY -= offset.y; genBox.maxZ -= offset.z; } }
public void addHollowCylinder(AxisAlignedBB genBox) { if (!isWorking) throw new IllegalStateException("Can't worlgen if not generating!"); if (worldObj.isRemote) throw new IllegalArgumentException("Worldgen on CLIENT side is not allowed!"); return isWorking; double minX = genBox.minX; double minY = genBox.minY; double minZ = genBox.minZ; double maxX = genBox.maxX; double maxY = genBox.maxY; double maxZ = genBox.maxZ; return AxisAlignedBB.getBoundingBox(maxX < minX ? genBox.maxX : genBox.minX, maxY < minY ? genBox.maxY : genBox.minY, maxZ < minZ ? genBox.maxZ : genBox.minZ, maxX < minX ? genBox.minX : genBox.maxX, maxY < minY ? genBox.minY : genBox.maxY, maxZ < minZ ? genBox.minZ : genBox.maxZ); gen(); if (hasOffset) { genBox.minX += offset.x; genBox.minY += offset.y; genBox.minZ += offset.z; genBox.maxX += offset.x; genBox.maxY += offset.y; genBox.maxZ += offset.z; } double radiusX = (genBox.maxX - genBox.minX) / 2; double height = genBox.maxY - genBox.minY; double radiusZ = (genBox.maxZ - genBox.minZ) / 2; int dx = MathHelper.floor_double(genBox.minX + radiusX); int dy = MathHelper.floor_double(genBox.minY); int dz = MathHelper.floor_double(genBox.minZ + radiusZ); boolean filled = false; radiusX += 0.5D; radiusZ += 0.5D; if (height == 0) return; if (height < 0) { height = -height; dy = MathHelper.floor_double(-height); } if (dy < 0) dy = 0; else if ((dy + height) - 1 > worldObj.getActualHeight()) height = (int) ((worldObj.getActualHeight() - dy) + 1); double invRadiusX = 1.0D / radiusX; double invRadiusZ = 1.0D / radiusZ; int ceilRadiusX = (int) Math.ceil(radiusX); int ceilRadiusZ = (int) Math.ceil(radiusZ); double nextXn = 0.0D; D: for (int x = 0; x <= ceilRadiusX; x++) { double xn = nextXn; nextXn = (double) (x + 1) * invRadiusX; double nextZn = 0.0D; for (int z = 0; z <= ceilRadiusZ; z++) { double zn = nextZn; nextZn = (double) (z + 1) * invRadiusZ; double distanceSq = lengthSq(xn, zn); if (distanceSq > 1.0D) if (z == 0) break D; else break; if (!filled && lengthSq(nextXn, zn) <= 1.0D && lengthSq(xn, nextZn) <= 1.0D) continue; for (int y = 0; y < height; y++) { block(MathHelper.floor_float(dx + x), MathHelper.floor_float(dy + y), MathHelper.floor_float(dz + z)); block(MathHelper.floor_float(dx - x), MathHelper.floor_float(dy + y), MathHelper.floor_float(dz + z)); block(MathHelper.floor_float(dx + x), MathHelper.floor_float(dy + y), MathHelper.floor_float(dz - z)); block(MathHelper.floor_float(dx - x), MathHelper.floor_float(dy + y), MathHelper.floor_float(dz - z)); } } } <DeepExtract> gen(); if (hasOffset) { genBox.minX -= offset.x; genBox.minY -= offset.y; genBox.minZ -= offset.z; genBox.maxX -= offset.x; genBox.maxY -= offset.y; genBox.maxZ -= offset.z; } </DeepExtract> }
DummyCore
positive
1,512
@Test public void parsePointsQuotesInTags() { Assert.assertNotNull("t159,label=hey\\ \"ya a=1i,value=0i"); Stream.of("t159,label=hey\\ \"ya a=1i,value=0i").forEach(lineProtocol -> { InfluxLineProtocolParser parse; try { parse = InfluxLineProtocolParser.parse(lineProtocol).report(); } catch (NotParsableInlineProtocolData notParsableInlineProtocolData) { if (!error) { LOG.error("StackTrace: ", notParsableInlineProtocolData); Assert.fail("Not expected error: " + notParsableInlineProtocolData); } return; } Assert.assertFalse("Expected fail for: " + lineProtocol, error); Assert.assertEquals(measurement, parse.getMeasurement()); MapDifference<String, Object> tagsDif = Maps.difference(tags, parse.getTags()); Assert.assertTrue("Tags has incorrect values: " + tagsDif.toString(), tagsDif.areEqual()); MapDifference<String, Object> fieldsDif = Maps.difference(fields, parse.getFields()); Assert.assertTrue("Fields has incorrect values: " + fieldsDif.toString(), fieldsDif.areEqual()); Assert.assertEquals(timestamp, parse.getTimestamp()); }); Assert.assertNotNull("t159,label=another a=2i,value=1i 1"); Stream.of("t159,label=another a=2i,value=1i 1").forEach(lineProtocol -> { InfluxLineProtocolParser parse; try { parse = InfluxLineProtocolParser.parse(lineProtocol).report(); } catch (NotParsableInlineProtocolData notParsableInlineProtocolData) { if (!error) { LOG.error("StackTrace: ", notParsableInlineProtocolData); Assert.fail("Not expected error: " + notParsableInlineProtocolData); } return; } Assert.assertFalse("Expected fail for: " + lineProtocol, error); Assert.assertEquals(measurement, parse.getMeasurement()); MapDifference<String, Object> tagsDif = Maps.difference(tags, parse.getTags()); Assert.assertTrue("Tags has incorrect values: " + tagsDif.toString(), tagsDif.areEqual()); MapDifference<String, Object> fieldsDif = Maps.difference(fields, parse.getFields()); Assert.assertTrue("Fields has incorrect values: " + fieldsDif.toString(), fieldsDif.areEqual()); Assert.assertEquals(timestamp, parse.getTimestamp()); }); }
@Test public void parsePointsQuotesInTags() { Assert.assertNotNull("t159,label=hey\\ \"ya a=1i,value=0i"); Stream.of("t159,label=hey\\ \"ya a=1i,value=0i").forEach(lineProtocol -> { InfluxLineProtocolParser parse; try { parse = InfluxLineProtocolParser.parse(lineProtocol).report(); } catch (NotParsableInlineProtocolData notParsableInlineProtocolData) { if (!error) { LOG.error("StackTrace: ", notParsableInlineProtocolData); Assert.fail("Not expected error: " + notParsableInlineProtocolData); } return; } Assert.assertFalse("Expected fail for: " + lineProtocol, error); Assert.assertEquals(measurement, parse.getMeasurement()); MapDifference<String, Object> tagsDif = Maps.difference(tags, parse.getTags()); Assert.assertTrue("Tags has incorrect values: " + tagsDif.toString(), tagsDif.areEqual()); MapDifference<String, Object> fieldsDif = Maps.difference(fields, parse.getFields()); Assert.assertTrue("Fields has incorrect values: " + fieldsDif.toString(), fieldsDif.areEqual()); Assert.assertEquals(timestamp, parse.getTimestamp()); }); <DeepExtract> Assert.assertNotNull("t159,label=another a=2i,value=1i 1"); Stream.of("t159,label=another a=2i,value=1i 1").forEach(lineProtocol -> { InfluxLineProtocolParser parse; try { parse = InfluxLineProtocolParser.parse(lineProtocol).report(); } catch (NotParsableInlineProtocolData notParsableInlineProtocolData) { if (!error) { LOG.error("StackTrace: ", notParsableInlineProtocolData); Assert.fail("Not expected error: " + notParsableInlineProtocolData); } return; } Assert.assertFalse("Expected fail for: " + lineProtocol, error); Assert.assertEquals(measurement, parse.getMeasurement()); MapDifference<String, Object> tagsDif = Maps.difference(tags, parse.getTags()); Assert.assertTrue("Tags has incorrect values: " + tagsDif.toString(), tagsDif.areEqual()); MapDifference<String, Object> fieldsDif = Maps.difference(fields, parse.getFields()); Assert.assertTrue("Fields has incorrect values: " + fieldsDif.toString(), fieldsDif.areEqual()); Assert.assertEquals(timestamp, parse.getTimestamp()); }); </DeepExtract> }
nifi-influxdb-bundle
positive
1,513
public Criteria andAppNameNotBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "appName" + " cannot be null"); } criteria.add(new Criterion("app_name not between", value1, value2)); return (Criteria) this; }
public Criteria andAppNameNotBetween(String value1, String value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "appName" + " cannot be null"); } criteria.add(new Criterion("app_name not between", value1, value2)); </DeepExtract> return (Criteria) this; }
oauth4j
positive
1,514
public Criteria andUserNameGreaterThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "userName" + " cannot be null"); } criteria.add(new Criterion("user_name >", value)); return (Criteria) this; }
public Criteria andUserNameGreaterThan(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "userName" + " cannot be null"); } criteria.add(new Criterion("user_name >", value)); </DeepExtract> return (Criteria) this; }
SSM_BookSystem
positive
1,516
public void pred16x16(int[] src, int src_offset, int stride) { int i; for (i = 0; i < 16; i++) { src[src_offset + i * stride + 0] = src[src_offset + i * stride + 1] = src[src_offset + i * stride + 2] = src[src_offset + i * stride + 3] = src[src_offset + i * stride + 4] = src[src_offset + i * stride + 5] = src[src_offset + i * stride + 6] = src[src_offset + i * stride + 7] = src[src_offset + i * stride + 8] = src[src_offset + i * stride + 9] = src[src_offset + i * stride + 10] = src[src_offset + i * stride + 11] = src[src_offset + i * stride + 12] = src[src_offset + i * stride + 13] = src[src_offset + i * stride + 14] = src[src_offset + i * stride + 15] = 129; } }
public void pred16x16(int[] src, int src_offset, int stride) { <DeepExtract> int i; for (i = 0; i < 16; i++) { src[src_offset + i * stride + 0] = src[src_offset + i * stride + 1] = src[src_offset + i * stride + 2] = src[src_offset + i * stride + 3] = src[src_offset + i * stride + 4] = src[src_offset + i * stride + 5] = src[src_offset + i * stride + 6] = src[src_offset + i * stride + 7] = src[src_offset + i * stride + 8] = src[src_offset + i * stride + 9] = src[src_offset + i * stride + 10] = src[src_offset + i * stride + 11] = src[src_offset + i * stride + 12] = src[src_offset + i * stride + 13] = src[src_offset + i * stride + 14] = src[src_offset + i * stride + 15] = 129; } </DeepExtract> }
h264j
positive
1,518
public boolean downloadExpenseFile(String id, String idFromServer, boolean isAudio) throws IOException { if (isAudio) { extension = ".amr"; file = fileHelper.getAudioFileEntry(id); } else { extension = ".jpg"; file = fileHelper.getCameraFileLargeEntry(id); } Log.d("******************** Downloading File *********************" + file.toString()); HttpURLConnection connection = null; try { URL url = new URL(baseUrl + userId + "/" + expenses + "/" + download + "/" + idFromServer + extension + verification); Log.d("download begining"); Log.d("download url:" + url); Log.d("downloaded file name:" + file.toString()); connection = (HttpURLConnection) url.openConnection(); InputStream is = connection.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new ByteArrayBuffer(50); int current = 0; while ((current = bis.read()) != -1) { baf.append((byte) current); } responseCode = connection.getResponseCode(); if (responseCode == 200) { FileOutputStream fos = new FileOutputStream(file); fos.write(baf.toByteArray()); fos.close(); return true; } } catch (MalformedURLException e) { Log.d("Error: "); e.printStackTrace(); } finally { connection.disconnect(); } return false; }
public boolean downloadExpenseFile(String id, String idFromServer, boolean isAudio) throws IOException { if (isAudio) { extension = ".amr"; file = fileHelper.getAudioFileEntry(id); } else { extension = ".jpg"; file = fileHelper.getCameraFileLargeEntry(id); } <DeepExtract> Log.d("******************** Downloading File *********************" + file.toString()); HttpURLConnection connection = null; try { URL url = new URL(baseUrl + userId + "/" + expenses + "/" + download + "/" + idFromServer + extension + verification); Log.d("download begining"); Log.d("download url:" + url); Log.d("downloaded file name:" + file.toString()); connection = (HttpURLConnection) url.openConnection(); InputStream is = connection.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new ByteArrayBuffer(50); int current = 0; while ((current = bis.read()) != -1) { baf.append((byte) current); } responseCode = connection.getResponseCode(); if (responseCode == 200) { FileOutputStream fos = new FileOutputStream(file); fos.write(baf.toByteArray()); fos.close(); return true; } } catch (MalformedURLException e) { Log.d("Error: "); e.printStackTrace(); } finally { connection.disconnect(); } return false; </DeepExtract> }
expense-tracker
positive
1,519
public Criteria andUserIdEqualTo(Long value) { if (value == null) { throw new RuntimeException("Value for " + "userId" + " cannot be null"); } criteria.add(new Criterion("user_id =", value)); return (Criteria) this; }
public Criteria andUserIdEqualTo(Long value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "userId" + " cannot be null"); } criteria.add(new Criterion("user_id =", value)); </DeepExtract> return (Criteria) this; }
webim
positive
1,520
@Override public void refreshSuccess() { mHeaderView.stopNestedAnim(); mFooterView.stopNestedAnim(); return super.stopNestedAnim(); mHeaderView.setState(IState.STATE_SUCCESS); mFooterView.setState(IState.STATE_NONE); }
@Override public void refreshSuccess() { <DeepExtract> mHeaderView.stopNestedAnim(); mFooterView.stopNestedAnim(); return super.stopNestedAnim(); </DeepExtract> mHeaderView.setState(IState.STATE_SUCCESS); mFooterView.setState(IState.STATE_NONE); }
PullLayout
positive
1,521
@Override public void storeFile(String path, InputStream is, long size) throws IOException { if (path.charAt(0) == '/') { path = path.substring(1); } return path; S3Object fileObject = new S3Object(path); fileObject.setDataInputStream(is); if (size != -1) { fileObject.setContentLength(size); } try { service.putObject(bucketName, fileObject); } catch (S3ServiceException e) { throw new IOException(e); } }
@Override public void storeFile(String path, InputStream is, long size) throws IOException { <DeepExtract> if (path.charAt(0) == '/') { path = path.substring(1); } return path; </DeepExtract> S3Object fileObject = new S3Object(path); fileObject.setDataInputStream(is); if (size != -1) { fileObject.setContentLength(size); } try { service.putObject(bucketName, fileObject); } catch (S3ServiceException e) { throw new IOException(e); } }
computoser
positive
1,522
public boolean init(final Context context, final PreferenceScreen prefScreen) { mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); final List<InputMethodInfo> imis = mImm.getInputMethodList(); for (int i = 0; i < imis.size(); ++i) { final InputMethodInfo imi = imis.get(i); if (imis.get(i).getPackageName().equals(context.getPackageName())) { mImi = imi; } } return null; if (mImi == null || mImi.getSubtypeCount() <= 1) { return false; } final Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS); intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, mImi.getId()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); mSubtypeEnablerPreference = new Preference(context); mSubtypeEnablerPreference.setIntent(intent); prefScreen.addPreference(mSubtypeEnablerPreference); final Preference pref = mSubtypeEnablerPreference; if (pref == null) { return; } final Context context = pref.getContext(); final CharSequence title; if (mSubtypeEnablerTitleRes != 0) { title = context.getString(mSubtypeEnablerTitleRes); } else { title = mSubtypeEnablerTitle; } pref.setTitle(title); final Intent intent = pref.getIntent(); if (intent != null) { intent.putExtra(Intent.EXTRA_TITLE, title); } final String summary = getEnabledSubtypesLabel(context, mImm, mImi); if (!TextUtils.isEmpty(summary)) { pref.setSummary(summary); } if (mSubtypeEnablerIconRes != 0) { pref.setIcon(mSubtypeEnablerIconRes); } else { pref.setIcon(mSubtypeEnablerIcon); } return true; }
public boolean init(final Context context, final PreferenceScreen prefScreen) { mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); final List<InputMethodInfo> imis = mImm.getInputMethodList(); for (int i = 0; i < imis.size(); ++i) { final InputMethodInfo imi = imis.get(i); if (imis.get(i).getPackageName().equals(context.getPackageName())) { mImi = imi; } } return null; if (mImi == null || mImi.getSubtypeCount() <= 1) { return false; } final Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS); intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, mImi.getId()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); mSubtypeEnablerPreference = new Preference(context); mSubtypeEnablerPreference.setIntent(intent); prefScreen.addPreference(mSubtypeEnablerPreference); <DeepExtract> final Preference pref = mSubtypeEnablerPreference; if (pref == null) { return; } final Context context = pref.getContext(); final CharSequence title; if (mSubtypeEnablerTitleRes != 0) { title = context.getString(mSubtypeEnablerTitleRes); } else { title = mSubtypeEnablerTitle; } pref.setTitle(title); final Intent intent = pref.getIntent(); if (intent != null) { intent.putExtra(Intent.EXTRA_TITLE, title); } final String summary = getEnabledSubtypesLabel(context, mImm, mImi); if (!TextUtils.isEmpty(summary)) { pref.setSummary(summary); } if (mSubtypeEnablerIconRes != 0) { pref.setIcon(mSubtypeEnablerIconRes); } else { pref.setIcon(mSubtypeEnablerIcon); } </DeepExtract> return true; }
Android-Keyboard
positive
1,523
public static void main(String[] args) { E.checkArgument(args.length == 1, "args: file"); String input = args[0]; LOG.info("Prepare to convert mapping file {}", input); File file = FileUtils.getFile(input); if (!file.exists() || !file.isFile()) { LOG.error("The file '{}' doesn't exists or not a file", input); throw new IllegalArgumentException(String.format("The file '%s' doesn't exists or " + "not a file", input)); } LoadMapping mapping = LoadMapping.of(input); String outputPath; String fileName = file.getName(); String prefix = fileName.substring(0, fileName.lastIndexOf(".")); String suffix = fileName.substring(fileName.lastIndexOf(".")); String newFileName = prefix + "-v2" + suffix; if (file.getParent() != null) { outputPath = Paths.get(file.getParent(), newFileName).toString(); } else { outputPath = newFileName; } MappingUtil.write(mapping, outputPath); LOG.info("Convert mapping file successfully, stored at {}", outputPath); }
public static void main(String[] args) { E.checkArgument(args.length == 1, "args: file"); String input = args[0]; LOG.info("Prepare to convert mapping file {}", input); File file = FileUtils.getFile(input); if (!file.exists() || !file.isFile()) { LOG.error("The file '{}' doesn't exists or not a file", input); throw new IllegalArgumentException(String.format("The file '%s' doesn't exists or " + "not a file", input)); } LoadMapping mapping = LoadMapping.of(input); <DeepExtract> String outputPath; String fileName = file.getName(); String prefix = fileName.substring(0, fileName.lastIndexOf(".")); String suffix = fileName.substring(fileName.lastIndexOf(".")); String newFileName = prefix + "-v2" + suffix; if (file.getParent() != null) { outputPath = Paths.get(file.getParent(), newFileName).toString(); } else { outputPath = newFileName; } </DeepExtract> MappingUtil.write(mapping, outputPath); LOG.info("Convert mapping file successfully, stored at {}", outputPath); }
hugegraph-loader
positive
1,524
void validateDirectionTo(DirectionPoint point) { to = point; fragment.showSelectedDirectionTo(point, venueLanguage); if (from != null && to != null) { startDirection(); } }
void validateDirectionTo(DirectionPoint point) { to = point; fragment.showSelectedDirectionTo(point, venueLanguage); <DeepExtract> if (from != null && to != null) { startDirection(); } </DeepExtract> }
mapwize-ui-android
positive
1,526
public void listCleared() { currentAlbums.clear(); mode = Mode.EMPTY; CurrentListState state = getState(); for (CurrentListListener listener : listeners) { listener.stateChanged(state); } allowAlbumReload = true; }
public void listCleared() { currentAlbums.clear(); mode = Mode.EMPTY; <DeepExtract> CurrentListState state = getState(); for (CurrentListListener listener : listeners) { listener.stateChanged(state); } allowAlbumReload = true; </DeepExtract> }
HypnosMusicPlayer
positive
1,528
public Book getBook() { if (book != null) { return book; } try { URL bookUrl = FacesContext.getCurrentInstance().getExternalContext().getResource("/WEB-INF/books/application_for_leave.xlsx"); book = Importers.getImporter().imports(bookUrl, "app4leave"); } catch (Exception e) { e.printStackTrace(); return null; } Sheet sheet = book.getSheetAt(0); fromCell = Ranges.rangeByName(sheet, "From"); toCell = Ranges.rangeByName(sheet, "To"); reasonCell = Ranges.rangeByName(sheet, "Reason"); applicantCell = Ranges.rangeByName(sheet, "Applicant"); requestDateCell = Ranges.rangeByName(sheet, "RequestDate"); totalCell = Ranges.rangeByName(sheet, "Total"); fromCell.getCellData().setValue(getDate(LocalDate.now().plusDays(1))); toCell.getCellData().setValue(getDate(LocalDate.now().plusDays(1))); reasonCell.setCellEditText(""); applicantCell.setCellEditText(""); requestDateCell.getCellData().setValue(getDate(LocalDate.now())); return book; }
public Book getBook() { if (book != null) { return book; } try { URL bookUrl = FacesContext.getCurrentInstance().getExternalContext().getResource("/WEB-INF/books/application_for_leave.xlsx"); book = Importers.getImporter().imports(bookUrl, "app4leave"); } catch (Exception e) { e.printStackTrace(); return null; } Sheet sheet = book.getSheetAt(0); fromCell = Ranges.rangeByName(sheet, "From"); toCell = Ranges.rangeByName(sheet, "To"); reasonCell = Ranges.rangeByName(sheet, "Reason"); applicantCell = Ranges.rangeByName(sheet, "Applicant"); requestDateCell = Ranges.rangeByName(sheet, "RequestDate"); totalCell = Ranges.rangeByName(sheet, "Total"); <DeepExtract> fromCell.getCellData().setValue(getDate(LocalDate.now().plusDays(1))); toCell.getCellData().setValue(getDate(LocalDate.now().plusDays(1))); reasonCell.setCellEditText(""); applicantCell.setCellEditText(""); requestDateCell.getCellData().setValue(getDate(LocalDate.now())); </DeepExtract> return book; }
dev-ref
positive
1,529
public final void setDoubleTapZoomDpi(int dpi) { DisplayMetrics metrics = getResources().getDisplayMetrics(); float averageDpi = (metrics.xdpi + metrics.ydpi) / 2; this.doubleTapZoomScale = averageDpi / dpi; }
public final void setDoubleTapZoomDpi(int dpi) { DisplayMetrics metrics = getResources().getDisplayMetrics(); float averageDpi = (metrics.xdpi + metrics.ydpi) / 2; <DeepExtract> this.doubleTapZoomScale = averageDpi / dpi; </DeepExtract> }
SurveyOnUCMap
positive
1,530
public Invitation toInvitation() { try { T instance = clazz.newInstance(); this.copyTo(instance); return instance; } catch (Exception e) { return null; } }
public Invitation toInvitation() { <DeepExtract> try { T instance = clazz.newInstance(); this.copyTo(instance); return instance; } catch (Exception e) { return null; } </DeepExtract> }
firestream-android
positive
1,531
public static <T> T post(String server, Object requestParams, ParameterizedTypeReference<T> responseType) { String paramJson = null; if (requestParams != null) { paramJson = JsonUtils.toJsonString(requestParams); } HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<String> entity = new HttpEntity<>(paramJson, headers); ResponseEntity<T> responseEntity = REST_TEMPLATE.exchange(server, HttpMethod.POST, entity, responseType); return responseEntity.getBody(); }
public static <T> T post(String server, Object requestParams, ParameterizedTypeReference<T> responseType) { <DeepExtract> String paramJson = null; if (requestParams != null) { paramJson = JsonUtils.toJsonString(requestParams); } HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<String> entity = new HttpEntity<>(paramJson, headers); ResponseEntity<T> responseEntity = REST_TEMPLATE.exchange(server, HttpMethod.POST, entity, responseType); return responseEntity.getBody(); </DeepExtract> }
cloud-learning-lite
positive
1,533
@Override public void pushMenu(Player player, SMSMenu newActive) { menus.add(new MenuPos(newActive, 1)); ItemMeta meta = stack.getItemMeta(); SMSValidate.notNull(meta, "There was a problem getting item metadata for your " + stack.getType()); SMSMenuItem menuItem = getActiveMenuItemAt(null, getSelectedItem()); List<String> lore = new ArrayList<String>(); if (menuItem != null) { meta.setDisplayName(Substitutions.viewVariableSubs(null, getActiveMenuTitle(null)) + SEPARATOR + Substitutions.viewVariableSubs(null, menuItem.getLabel())); Collections.addAll(lore, menuItem.getLore()); } else { meta.setDisplayName(getActiveMenuTitle(null) + SEPARATOR + NO_ITEMS); } List<String> names = new ArrayList<String>(menus.size()); for (MenuPos menu : menus) { names.add(menu.menu.getName() + ':' + menu.pos); } lore.add(MENU_MARKER + Joiner.on(SUBMENU_SEPARATOR).join(names)); meta.setLore(lore); stack.setItemMeta(meta); if (ScrollingMenuSign.getInstance().isProtocolLibEnabled()) { ItemGlow.setGlowing(stack, true); } }
@Override public void pushMenu(Player player, SMSMenu newActive) { menus.add(new MenuPos(newActive, 1)); <DeepExtract> ItemMeta meta = stack.getItemMeta(); SMSValidate.notNull(meta, "There was a problem getting item metadata for your " + stack.getType()); SMSMenuItem menuItem = getActiveMenuItemAt(null, getSelectedItem()); List<String> lore = new ArrayList<String>(); if (menuItem != null) { meta.setDisplayName(Substitutions.viewVariableSubs(null, getActiveMenuTitle(null)) + SEPARATOR + Substitutions.viewVariableSubs(null, menuItem.getLabel())); Collections.addAll(lore, menuItem.getLore()); } else { meta.setDisplayName(getActiveMenuTitle(null) + SEPARATOR + NO_ITEMS); } List<String> names = new ArrayList<String>(menus.size()); for (MenuPos menu : menus) { names.add(menu.menu.getName() + ':' + menu.pos); } lore.add(MENU_MARKER + Joiner.on(SUBMENU_SEPARATOR).join(names)); meta.setLore(lore); stack.setItemMeta(meta); if (ScrollingMenuSign.getInstance().isProtocolLibEnabled()) { ItemGlow.setGlowing(stack, true); } </DeepExtract> }
ScrollingMenuSign
positive
1,534
@Override public void onClick(DialogInterface dialogInterface, int i) { if (vibrateType == i) return; vibrateType = i; stAdapter.setText(position, itemStr[10][i]); SharedPreferences.Editor edit = sp.edit(); edit.putInt("vibra", i); edit.apply(); dialogInterface.dismiss(); }
@Override public void onClick(DialogInterface dialogInterface, int i) { if (vibrateType == i) return; vibrateType = i; stAdapter.setText(position, itemStr[10][i]); <DeepExtract> SharedPreferences.Editor edit = sp.edit(); edit.putInt("vibra", i); edit.apply(); </DeepExtract> dialogInterface.dismiss(); }
DCTimer-Android
positive
1,535
@Override public void caseVirtualInvokeExpr(VirtualInvokeExpr v) { SootMethod method = v.getMethod(); SootMethodRef methodRef = v.getMethodRef(); if (methodRef.getSignature().equals("<android.telephony.SmsMessage: " + "android.telephony.SmsMessage createFromPdu(byte[])>")) { ExpressionSet op1 = resolveValue(v.getArg(0), _in); if (op1 != null) { _data = ExpressionSet.transform(op1, e -> { if (e.isVariable()) { return new VariableExpression(new MethodCallVariable(v, e.getVariable())); } else { return new VariableExpression(new MethodCallVariable(v)); } }); return; } } else if (methodRef.getSignature().startsWith("<android.os.Bundle: java.lang.Object get(java.lang.String")) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; ExpressionSet base = resolveValue(instanceExpr.getBase(), _in); ExpressionSet op1 = resolveValue(instanceExpr.getArg(0), _in); if (base != null && op1 != null) { List<ExpressionSet> results = new ArrayList<ExpressionSet>(); for (Expression baseExpr : base.getExpressions()) { if (!baseExpr.isVariable()) { results.add(new ExpressionSet(new VariableExpression(new KeyValueAccessVariable(null, null, KeyValueAccessVariable.DatabaseType.BUNDLE, v.getMethod().getReturnType())))); continue; } ExpressionSet partialResult = ExpressionSet.transform(op1, e -> { if (e.isVariable()) { return new VariableExpression(new KeyValueAccessVariable(baseExpr.getVariable(), e.getVariable(), KeyValueAccessVariable.DatabaseType.BUNDLE, v.getMethod().getReturnType())); } else { return new VariableExpression(new KeyValueAccessVariable(baseExpr.getVariable(), null, KeyValueAccessVariable.DatabaseType.BUNDLE, v.getMethod().getReturnType())); } }); results.add(partialResult); } _data = ExpressionSet.merge(results); return; } } else if (methodRef.getSignature().startsWith("<android.content.Context: java.lang.String getString(int") || methodRef.getSignature().equals("<android.content.Context: java.lang.CharSequence getText(int)>")) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; ExpressionSet op1 = resolveValue(instanceExpr.getArg(0), _in); if (op1 != null) { _data = ExpressionSet.transform(op1, e -> { Variable opVariable = e.isVariable() ? e.getVariable() : null; return new VariableExpression(new KeyValueAccessVariable(new PlaceholderVariable("Context", RefType.v("android.content.Context")), opVariable, KeyValueAccessVariable.DatabaseType.STRING_TABLE, RefType.v("java.lang.String"))); }); return; } } else if (methodRef.getSignature().startsWith("<java.lang.StringBuilder: java.lang.StringBuilder append(")) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; ExpressionSet op1 = resolveValue(instanceExpr.getBase(), _in); ExpressionSet op2 = resolveValue(instanceExpr.getArg(0), _in); if (op1 != null && op2 != null) { _data = ExpressionSet.combine(Expression.Operator.APPEND, op1, op2); return; } } else if (methodRef.getSignature().endsWith("java.lang.String toString()>") || methodRef.getSignature().endsWith("char[] toCharArray()>")) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; _data = resolveValue(instanceExpr.getBase(), _in); return; } else if (methodRef.getSignature().equals("<java.lang.String: boolean equals(java.lang.Object)>") || methodRef.getSignature().equals("<java.lang.String: boolean contains(java.lang.CharSequence)>")) { String returnString = "Return<" + methodRef.declaringClass().getShortName() + "." + methodRef.name() + "(){" + v.hashCode() + "}>"; VariableExpression returnExpr = new VariableExpression(new PlaceholderVariable(returnString, BooleanType.v())); _data = new ExpressionSet(returnExpr); return; } else if (methodRef.getSignature().endsWith("boolean equals(java.lang.Object)>")) { String returnString = "Return<" + methodRef.declaringClass().getShortName() + "." + methodRef.name() + "(){" + v.hashCode() + "}>"; VariableExpression returnExpr = new VariableExpression(new PlaceholderVariable(returnString, BooleanType.v())); _data = new ExpressionSet(returnExpr); return; } else if (method.getDeclaringClass().isApplicationClass() && !_excludeMethods.contains(method) && _auxDepth == 0) { String returnString = "Return<" + methodRef.declaringClass().getShortName() + "." + methodRef.name() + "(){" + v.hashCode() + "}>"; if (v instanceof InstanceInvokeExpr) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; ExpressionSet base = resolveValue(instanceExpr.getBase(), _in); if (base != null) { for (Expression baseExpr : base.getExpressions()) { if (baseExpr.isVariable()) { returnString = "Return<" + baseExpr.getVariable() + "." + v.getMethodRef().name() + "(){" + v.hashCode() + "}>"; break; } } } } VariableExpression returnIdentifier = new VariableExpression(new PlaceholderVariable(returnString, v.getMethod().getReturnType())); _data = new ExpressionSet(returnIdentifier); return; } if (v instanceof InstanceInvokeExpr) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; ExpressionSet base = resolveValue(instanceExpr.getBase(), _in); if (base != null) { _data = ExpressionSet.transform(base, e -> { if (e.isVariable()) { return new VariableExpression(new MethodCallVariable(v, e.getVariable())); } else { return new VariableExpression(new MethodCallVariable(v)); } }); } } }
@Override public void caseVirtualInvokeExpr(VirtualInvokeExpr v) { <DeepExtract> SootMethod method = v.getMethod(); SootMethodRef methodRef = v.getMethodRef(); if (methodRef.getSignature().equals("<android.telephony.SmsMessage: " + "android.telephony.SmsMessage createFromPdu(byte[])>")) { ExpressionSet op1 = resolveValue(v.getArg(0), _in); if (op1 != null) { _data = ExpressionSet.transform(op1, e -> { if (e.isVariable()) { return new VariableExpression(new MethodCallVariable(v, e.getVariable())); } else { return new VariableExpression(new MethodCallVariable(v)); } }); return; } } else if (methodRef.getSignature().startsWith("<android.os.Bundle: java.lang.Object get(java.lang.String")) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; ExpressionSet base = resolveValue(instanceExpr.getBase(), _in); ExpressionSet op1 = resolveValue(instanceExpr.getArg(0), _in); if (base != null && op1 != null) { List<ExpressionSet> results = new ArrayList<ExpressionSet>(); for (Expression baseExpr : base.getExpressions()) { if (!baseExpr.isVariable()) { results.add(new ExpressionSet(new VariableExpression(new KeyValueAccessVariable(null, null, KeyValueAccessVariable.DatabaseType.BUNDLE, v.getMethod().getReturnType())))); continue; } ExpressionSet partialResult = ExpressionSet.transform(op1, e -> { if (e.isVariable()) { return new VariableExpression(new KeyValueAccessVariable(baseExpr.getVariable(), e.getVariable(), KeyValueAccessVariable.DatabaseType.BUNDLE, v.getMethod().getReturnType())); } else { return new VariableExpression(new KeyValueAccessVariable(baseExpr.getVariable(), null, KeyValueAccessVariable.DatabaseType.BUNDLE, v.getMethod().getReturnType())); } }); results.add(partialResult); } _data = ExpressionSet.merge(results); return; } } else if (methodRef.getSignature().startsWith("<android.content.Context: java.lang.String getString(int") || methodRef.getSignature().equals("<android.content.Context: java.lang.CharSequence getText(int)>")) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; ExpressionSet op1 = resolveValue(instanceExpr.getArg(0), _in); if (op1 != null) { _data = ExpressionSet.transform(op1, e -> { Variable opVariable = e.isVariable() ? e.getVariable() : null; return new VariableExpression(new KeyValueAccessVariable(new PlaceholderVariable("Context", RefType.v("android.content.Context")), opVariable, KeyValueAccessVariable.DatabaseType.STRING_TABLE, RefType.v("java.lang.String"))); }); return; } } else if (methodRef.getSignature().startsWith("<java.lang.StringBuilder: java.lang.StringBuilder append(")) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; ExpressionSet op1 = resolveValue(instanceExpr.getBase(), _in); ExpressionSet op2 = resolveValue(instanceExpr.getArg(0), _in); if (op1 != null && op2 != null) { _data = ExpressionSet.combine(Expression.Operator.APPEND, op1, op2); return; } } else if (methodRef.getSignature().endsWith("java.lang.String toString()>") || methodRef.getSignature().endsWith("char[] toCharArray()>")) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; _data = resolveValue(instanceExpr.getBase(), _in); return; } else if (methodRef.getSignature().equals("<java.lang.String: boolean equals(java.lang.Object)>") || methodRef.getSignature().equals("<java.lang.String: boolean contains(java.lang.CharSequence)>")) { String returnString = "Return<" + methodRef.declaringClass().getShortName() + "." + methodRef.name() + "(){" + v.hashCode() + "}>"; VariableExpression returnExpr = new VariableExpression(new PlaceholderVariable(returnString, BooleanType.v())); _data = new ExpressionSet(returnExpr); return; } else if (methodRef.getSignature().endsWith("boolean equals(java.lang.Object)>")) { String returnString = "Return<" + methodRef.declaringClass().getShortName() + "." + methodRef.name() + "(){" + v.hashCode() + "}>"; VariableExpression returnExpr = new VariableExpression(new PlaceholderVariable(returnString, BooleanType.v())); _data = new ExpressionSet(returnExpr); return; } else if (method.getDeclaringClass().isApplicationClass() && !_excludeMethods.contains(method) && _auxDepth == 0) { String returnString = "Return<" + methodRef.declaringClass().getShortName() + "." + methodRef.name() + "(){" + v.hashCode() + "}>"; if (v instanceof InstanceInvokeExpr) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; ExpressionSet base = resolveValue(instanceExpr.getBase(), _in); if (base != null) { for (Expression baseExpr : base.getExpressions()) { if (baseExpr.isVariable()) { returnString = "Return<" + baseExpr.getVariable() + "." + v.getMethodRef().name() + "(){" + v.hashCode() + "}>"; break; } } } } VariableExpression returnIdentifier = new VariableExpression(new PlaceholderVariable(returnString, v.getMethod().getReturnType())); _data = new ExpressionSet(returnIdentifier); return; } if (v instanceof InstanceInvokeExpr) { InstanceInvokeExpr instanceExpr = (InstanceInvokeExpr) v; ExpressionSet base = resolveValue(instanceExpr.getBase(), _in); if (base != null) { _data = ExpressionSet.transform(base, e -> { if (e.isVariable()) { return new VariableExpression(new MethodCallVariable(v, e.getVariable())); } else { return new VariableExpression(new MethodCallVariable(v)); } }); } } </DeepExtract> }
tiro
positive
1,536
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Payment createdPayment = null; APIContext apiContext = new APIContext(clientID, clientSecret, mode); if (req.getParameter("PayerID") != null) { Payment payment = new Payment(); if (req.getParameter("guid") != null) { payment.setId(map.get(req.getParameter("guid"))); } PaymentExecution paymentExecution = new PaymentExecution(); paymentExecution.setPayerId(req.getParameter("PayerID")); try { createdPayment = payment.execute(apiContext, paymentExecution); ResultPrinter.addResult(req, resp, "Executed The Payment", Payment.getLastRequest(), Payment.getLastResponse(), null); } catch (PayPalRESTException e) { ResultPrinter.addResult(req, resp, "Executed The Payment", Payment.getLastRequest(), null, e.getMessage()); } } else { Details details = new Details(); details.setShipping("1"); details.setSubtotal("5"); details.setTax("1"); Amount amount = new Amount(); amount.setCurrency("USD"); amount.setTotal("7"); amount.setDetails(details); Transaction transaction = new Transaction(); transaction.setAmount(amount); transaction.setDescription("This is the payment transaction description."); Item item = new Item(); item.setName("Ground Coffee 40 oz").setQuantity("1").setCurrency("USD").setPrice("5"); ItemList itemList = new ItemList(); List<Item> items = new ArrayList<Item>(); items.add(item); itemList.setItems(items); transaction.setItemList(itemList); List<Transaction> transactions = new ArrayList<Transaction>(); transactions.add(transaction); Payer payer = new Payer(); payer.setPaymentMethod("paypal"); Payment payment = new Payment(); payment.setIntent("sale"); payment.setPayer(payer); payment.setTransactions(transactions); RedirectUrls redirectUrls = new RedirectUrls(); String guid = UUID.randomUUID().toString().replaceAll("-", ""); redirectUrls.setCancelUrl(req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + req.getContextPath() + "/paymentwithpaypal?guid=" + guid); redirectUrls.setReturnUrl(req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + req.getContextPath() + "/paymentwithpaypal?guid=" + guid); payment.setRedirectUrls(redirectUrls); try { createdPayment = payment.create(apiContext); LOGGER.info("Created payment with id = " + createdPayment.getId() + " and status = " + createdPayment.getState()); Iterator<Links> links = createdPayment.getLinks().iterator(); while (links.hasNext()) { Links link = links.next(); if (link.getRel().equalsIgnoreCase("approval_url")) { req.setAttribute("redirectURL", link.getHref()); } } ResultPrinter.addResult(req, resp, "Payment with PayPal", Payment.getLastRequest(), Payment.getLastResponse(), null); map.put(guid, createdPayment.getId()); } catch (PayPalRESTException e) { ResultPrinter.addResult(req, resp, "Payment with PayPal", Payment.getLastRequest(), null, e.getMessage()); } } return createdPayment; req.getRequestDispatcher("response.jsp").forward(req, resp); }
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { <DeepExtract> Payment createdPayment = null; APIContext apiContext = new APIContext(clientID, clientSecret, mode); if (req.getParameter("PayerID") != null) { Payment payment = new Payment(); if (req.getParameter("guid") != null) { payment.setId(map.get(req.getParameter("guid"))); } PaymentExecution paymentExecution = new PaymentExecution(); paymentExecution.setPayerId(req.getParameter("PayerID")); try { createdPayment = payment.execute(apiContext, paymentExecution); ResultPrinter.addResult(req, resp, "Executed The Payment", Payment.getLastRequest(), Payment.getLastResponse(), null); } catch (PayPalRESTException e) { ResultPrinter.addResult(req, resp, "Executed The Payment", Payment.getLastRequest(), null, e.getMessage()); } } else { Details details = new Details(); details.setShipping("1"); details.setSubtotal("5"); details.setTax("1"); Amount amount = new Amount(); amount.setCurrency("USD"); amount.setTotal("7"); amount.setDetails(details); Transaction transaction = new Transaction(); transaction.setAmount(amount); transaction.setDescription("This is the payment transaction description."); Item item = new Item(); item.setName("Ground Coffee 40 oz").setQuantity("1").setCurrency("USD").setPrice("5"); ItemList itemList = new ItemList(); List<Item> items = new ArrayList<Item>(); items.add(item); itemList.setItems(items); transaction.setItemList(itemList); List<Transaction> transactions = new ArrayList<Transaction>(); transactions.add(transaction); Payer payer = new Payer(); payer.setPaymentMethod("paypal"); Payment payment = new Payment(); payment.setIntent("sale"); payment.setPayer(payer); payment.setTransactions(transactions); RedirectUrls redirectUrls = new RedirectUrls(); String guid = UUID.randomUUID().toString().replaceAll("-", ""); redirectUrls.setCancelUrl(req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + req.getContextPath() + "/paymentwithpaypal?guid=" + guid); redirectUrls.setReturnUrl(req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + req.getContextPath() + "/paymentwithpaypal?guid=" + guid); payment.setRedirectUrls(redirectUrls); try { createdPayment = payment.create(apiContext); LOGGER.info("Created payment with id = " + createdPayment.getId() + " and status = " + createdPayment.getState()); Iterator<Links> links = createdPayment.getLinks().iterator(); while (links.hasNext()) { Links link = links.next(); if (link.getRel().equalsIgnoreCase("approval_url")) { req.setAttribute("redirectURL", link.getHref()); } } ResultPrinter.addResult(req, resp, "Payment with PayPal", Payment.getLastRequest(), Payment.getLastResponse(), null); map.put(guid, createdPayment.getId()); } catch (PayPalRESTException e) { ResultPrinter.addResult(req, resp, "Payment with PayPal", Payment.getLastRequest(), null, e.getMessage()); } } return createdPayment; </DeepExtract> req.getRequestDispatcher("response.jsp").forward(req, resp); }
PayPal-Java-SDK
positive
1,537
public void ResumeGame() { super.ResumeGame(); if (_timer != null) { _timer.cancel(); _timer = null; } if (_updateRate != 0 && !_suspended) { _timer = new GameTimer(_updateRate); } }
public void ResumeGame() { super.ResumeGame(); <DeepExtract> if (_timer != null) { _timer.cancel(); _timer = null; } if (_updateRate != 0 && !_suspended) { _timer = new GameTimer(_updateRate); } </DeepExtract> }
monkey
positive
1,538
@Override public void initialize(URL url, ResourceBundle rb) { Botao.prepararBotaoModal(this, botaoController); idiomas.setItems(idioma.getListaIdiomas()); idiomas.getSelectionModel().select(idioma.getIdiomaSistema()); login.getItems().clear(); if (idiomas.getSelectionModel().getSelectedItem().equals("English")) { moeda.setText("$"); formulario.setText("Settings"); labelIdioma.setText("Language:"); labelMoeda.setText("Currency:"); labelLogin.setText("Login screen:"); login.getItems().add("No"); login.getItems().add("Yes"); if (primeiroAcesso) { botaoController.setTextBotaoFinalizar("Next"); botaoController.setTextBotaoCancelar("Exit"); } else { botaoController.setTextBotaoFinalizar("Edit"); botaoController.setTextBotaoCancelar("Cancel"); } } else { moeda.setText("R$"); formulario.setText("Configurações"); labelIdioma.setText("Idioma:"); labelMoeda.setText("Moeda:"); labelLogin.setText("Tela de login:"); login.getItems().add("Não"); login.getItems().add("Sim"); if (primeiroAcesso) { botaoController.setTextBotaoFinalizar("Próximo"); botaoController.setTextBotaoCancelar("Sair"); } else { botaoController.setTextBotaoFinalizar("Alterar"); botaoController.setTextBotaoCancelar("Cancelar"); } } login.getSelectionModel().select(Integer.parseInt(Configuracao.getPropriedade("login"))); }
@Override public void initialize(URL url, ResourceBundle rb) { Botao.prepararBotaoModal(this, botaoController); idiomas.setItems(idioma.getListaIdiomas()); idiomas.getSelectionModel().select(idioma.getIdiomaSistema()); <DeepExtract> login.getItems().clear(); if (idiomas.getSelectionModel().getSelectedItem().equals("English")) { moeda.setText("$"); formulario.setText("Settings"); labelIdioma.setText("Language:"); labelMoeda.setText("Currency:"); labelLogin.setText("Login screen:"); login.getItems().add("No"); login.getItems().add("Yes"); if (primeiroAcesso) { botaoController.setTextBotaoFinalizar("Next"); botaoController.setTextBotaoCancelar("Exit"); } else { botaoController.setTextBotaoFinalizar("Edit"); botaoController.setTextBotaoCancelar("Cancel"); } } else { moeda.setText("R$"); formulario.setText("Configurações"); labelIdioma.setText("Idioma:"); labelMoeda.setText("Moeda:"); labelLogin.setText("Tela de login:"); login.getItems().add("Não"); login.getItems().add("Sim"); if (primeiroAcesso) { botaoController.setTextBotaoFinalizar("Próximo"); botaoController.setTextBotaoCancelar("Sair"); } else { botaoController.setTextBotaoFinalizar("Alterar"); botaoController.setTextBotaoCancelar("Cancelar"); } } login.getSelectionModel().select(Integer.parseInt(Configuracao.getPropriedade("login"))); </DeepExtract> }
bgfinancas
positive
1,539
public Criteria andDzdh1NotEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "dzdh1" + " cannot be null"); } criteria.add(new Criterion("dzdh1 <>", value)); return (Criteria) this; }
public Criteria andDzdh1NotEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "dzdh1" + " cannot be null"); } criteria.add(new Criterion("dzdh1 <>", value)); </DeepExtract> return (Criteria) this; }
einvoice
positive
1,540
public boolean isSymmetricTreeRecursive(TreeNode root) { if (root == null) { return true; } if (root.left != null && root.right != null) { return root.left.val == root.right.val && isSymmetric(root.left.left, root.right.right) && isSymmetric(root.left.right, root.right.left); } return root.left == null && root.right == null; }
public boolean isSymmetricTreeRecursive(TreeNode root) { if (root == null) { return true; } <DeepExtract> if (root.left != null && root.right != null) { return root.left.val == root.right.val && isSymmetric(root.left.left, root.right.right) && isSymmetric(root.left.right, root.right.left); } return root.left == null && root.right == null; </DeepExtract> }
algorithm
positive
1,541
public Criteria andTypeEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "type" + " cannot be null"); } criteria.add(new Criterion("type =", value)); return (Criteria) this; }
public Criteria andTypeEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "type" + " cannot be null"); } criteria.add(new Criterion("type =", value)); </DeepExtract> return (Criteria) this; }
community
positive
1,543
public static void main(String[] args) { PairManager manager1 = new PairManager1(); PairManager manager2 = new PairManager2(); testPair(manager1, manager2); }
public static void main(String[] args) { <DeepExtract> PairManager manager1 = new PairManager1(); PairManager manager2 = new PairManager2(); testPair(manager1, manager2); </DeepExtract> }
ExerciseJava
positive
1,544
public boolean isOnSecondaryHomeScreen(Context context) { boolean checkSecondary = true; if (U.getExternalDisplayID(context) == Display.DEFAULT_DISPLAY) checkSecondary = false; if (false && checkSecondary) return onPrimaryHomeScreen || onSecondaryHomeScreen; if (!false && checkSecondary) return onSecondaryHomeScreen; if (false) return onPrimaryHomeScreen; return false; }
public boolean isOnSecondaryHomeScreen(Context context) { <DeepExtract> boolean checkSecondary = true; if (U.getExternalDisplayID(context) == Display.DEFAULT_DISPLAY) checkSecondary = false; if (false && checkSecondary) return onPrimaryHomeScreen || onSecondaryHomeScreen; if (!false && checkSecondary) return onSecondaryHomeScreen; if (false) return onPrimaryHomeScreen; return false; </DeepExtract> }
Taskbar
positive
1,545
public static Request formPost(URL theURL, ParameterList theParams) { Request aRequest = new Request(Method.POST, theURL); if (mHeaders.containsKey(new Header(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType()).getName())) { new Header(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType()).addValues(mHeaders.get(new Header(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType()).getName()).getValues()); } mHeaders.put(new Header(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType()).getName(), new Header(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType())); return this; mBody = new ByteArrayInputStream(theParams.toString().getBytes(Charsets.UTF_8)); return this; return aRequest; }
public static Request formPost(URL theURL, ParameterList theParams) { Request aRequest = new Request(Method.POST, theURL); if (mHeaders.containsKey(new Header(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType()).getName())) { new Header(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType()).addValues(mHeaders.get(new Header(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType()).getName()).getValues()); } mHeaders.put(new Header(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType()).getName(), new Header(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType())); return this; <DeepExtract> mBody = new ByteArrayInputStream(theParams.toString().getBytes(Charsets.UTF_8)); return this; </DeepExtract> return aRequest; }
Empire
positive
1,546
public void setRenderingSettings(double[][] rs) { dontFire = true; this.renderingSettings = rs; this.channel = channel; gammaATF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.ALPHA_GAMMA], 1)); gammaCTF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.INTENSITY_GAMMA], 1)); koTF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.LIGHT_K_OBJECT], 1)); kdTF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.LIGHT_K_DIFFUSE], 1)); ksTF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.LIGHT_K_SPECULAR], 1)); shininessTF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.LIGHT_SHININESS], 1)); boolean useLight = renderingSettings[channel][ExtendedRenderingState.USE_LIGHT] > 0; lightPanel.setVisible(useLight); useLightCB.setSelected(useLight); slider.set(histogram[channel], min[channel], max[channel], renderingSettings[channel]); updateTextfieldsFromSliders(); slider.repaint(); repaint(); for (int i = 0; i < renderingSettings.length; i++) { Color color = Color.BLACK; final int ch = i; boolean useImageLUT = rs[ch][ExtendedRenderingState.USE_LUT] > 0; if (!useImageLUT) { int red = (int) rs[ch][ExtendedRenderingState.CHANNEL_COLOR_RED]; int green = (int) rs[ch][ExtendedRenderingState.CHANNEL_COLOR_GREEN]; int blue = (int) rs[ch][ExtendedRenderingState.CHANNEL_COLOR_BLUE]; color = new Color(red, green, blue); if (red >= 100 && green >= 100 && blue >= 100) color = Color.black; } double weight = rs[ch][ExtendedRenderingState.WEIGHT]; SingleSlider wslider = weightSliders[i]; wslider.set(100, (int) Math.round(100 * weight), color); } koTF.setText(CustomDecimalFormat.format(rs[channel][ExtendedRenderingState.LIGHT_K_OBJECT], 1)); kdTF.setText(CustomDecimalFormat.format(rs[channel][ExtendedRenderingState.LIGHT_K_DIFFUSE], 1)); ksTF.setText(CustomDecimalFormat.format(rs[channel][ExtendedRenderingState.LIGHT_K_SPECULAR], 1)); shininessTF.setText(CustomDecimalFormat.format(rs[channel][ExtendedRenderingState.LIGHT_SHININESS], 1)); boolean useLight = rs[channel][ExtendedRenderingState.USE_LIGHT] > 0; lightPanel.setVisible(useLight); useLightCB.setSelected(useLight); dontFire = false; }
public void setRenderingSettings(double[][] rs) { dontFire = true; this.renderingSettings = rs; <DeepExtract> this.channel = channel; gammaATF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.ALPHA_GAMMA], 1)); gammaCTF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.INTENSITY_GAMMA], 1)); koTF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.LIGHT_K_OBJECT], 1)); kdTF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.LIGHT_K_DIFFUSE], 1)); ksTF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.LIGHT_K_SPECULAR], 1)); shininessTF.setText(CustomDecimalFormat.format(renderingSettings[channel][ExtendedRenderingState.LIGHT_SHININESS], 1)); boolean useLight = renderingSettings[channel][ExtendedRenderingState.USE_LIGHT] > 0; lightPanel.setVisible(useLight); useLightCB.setSelected(useLight); slider.set(histogram[channel], min[channel], max[channel], renderingSettings[channel]); updateTextfieldsFromSliders(); slider.repaint(); repaint(); </DeepExtract> for (int i = 0; i < renderingSettings.length; i++) { Color color = Color.BLACK; final int ch = i; boolean useImageLUT = rs[ch][ExtendedRenderingState.USE_LUT] > 0; if (!useImageLUT) { int red = (int) rs[ch][ExtendedRenderingState.CHANNEL_COLOR_RED]; int green = (int) rs[ch][ExtendedRenderingState.CHANNEL_COLOR_GREEN]; int blue = (int) rs[ch][ExtendedRenderingState.CHANNEL_COLOR_BLUE]; color = new Color(red, green, blue); if (red >= 100 && green >= 100 && blue >= 100) color = Color.black; } double weight = rs[ch][ExtendedRenderingState.WEIGHT]; SingleSlider wslider = weightSliders[i]; wslider.set(100, (int) Math.round(100 * weight), color); } koTF.setText(CustomDecimalFormat.format(rs[channel][ExtendedRenderingState.LIGHT_K_OBJECT], 1)); kdTF.setText(CustomDecimalFormat.format(rs[channel][ExtendedRenderingState.LIGHT_K_DIFFUSE], 1)); ksTF.setText(CustomDecimalFormat.format(rs[channel][ExtendedRenderingState.LIGHT_K_SPECULAR], 1)); shininessTF.setText(CustomDecimalFormat.format(rs[channel][ExtendedRenderingState.LIGHT_SHININESS], 1)); boolean useLight = rs[channel][ExtendedRenderingState.USE_LIGHT] > 0; lightPanel.setVisible(useLight); useLightCB.setSelected(useLight); dontFire = false; }
3Dscript
positive
1,548
public static void runRubyExample(String scriptName) { File file = new File(scriptName); String dirPart = file.getParent(); String scriptDir = METRICS_EXAMPLES_RUBY_DIR + dirPart; runExample(scriptDir, scriptDir + "/" + file.getName(), DROPWIZARD_OPTIONS, null); }
public static void runRubyExample(String scriptName) { <DeepExtract> File file = new File(scriptName); String dirPart = file.getParent(); String scriptDir = METRICS_EXAMPLES_RUBY_DIR + dirPart; runExample(scriptDir, scriptDir + "/" + file.getName(), DROPWIZARD_OPTIONS, null); </DeepExtract> }
vertx-examples
positive
1,549
public String requestExternalNetworks() throws NotAuthorizedException, NotFoundException, ServerException, ServiceUnAvailableOrInternalError, IOException, MalformedURLException, ProtocolException, ParseException, CertificateException { String gapiver = U.getGlanceEndpointAPIVER(); String napiver = U.getNeutronEndpointAPIVER(); if (U.getVerifyServerCert()) { X509Certificate cert = null; cert = (X509Certificate) (CertificateFactory.getInstance("X.509")).generateCertificate(new FileInputStream(U.getCAFile())); if (RESTClient.checkServerCert(U.getIdentityEndpoint(), cert.getIssuerX500Principal().getName()) == false) throw new CertificateException("Couldn't verify server's certificate. Please verify the correct CA selected."); } long exp_time = U.getTokenExpireTime(); if (exp_time <= Utils.now() + 5) { String payload = null; if (U.useV3()) payload = "{ \"auth\": { \"identity\": { \"methods\": [\"password\"],\"password\": { \"user\": { \"name\": \"" + U.getUserName() + "\",\"domain\": { \"id\": \"default\" }, \"password\": \"" + U.getPassword() + "\" } } }, \"scope\": { \"project\": { \"name\": \"" + U.getTenantName() + "\", \"domain\": { \"id\": \"default\" } }}}}"; else payload = "{\"auth\": {\"tenantName\": \"" + U.getTenantName() + "\", \"passwordCredentials\": {\"username\": \"" + U.getUserName() + "\", \"password\": \"" + U.getPassword() + "\"}}}"; String identityEP = U.getIdentityEndpoint(); if (U.useV3()) identityEP += "/auth"; identityEP += "/tokens"; Pair<String, String> jsonBuffer_Token = RESTClient.requestToken(U.useSSL(), identityEP, payload); String pwd = U.getPassword(); String edp = U.getIdentityEndpoint(); boolean ssl = U.useSSL(); boolean verifyServerCert = U.getVerifyServerCert(); String CAFile = U.getCAFile(); U = User.parse(jsonBuffer_Token.first, U.useV3(), jsonBuffer_Token.second); U.setPassword(pwd); U.setSSL(ssl); U.setCAFile(CAFile); U.setGlanceEndpointAPIVER(gapiver); U.setNeutronEndpointAPIVER(napiver); U.toFile(Configuration.getInstance().getValue("FILESDIR", Defaults.DEFAULTFILESDIR)); } Pair<String, String> p = new Pair<String, String>("X-Auth-Project-Id", U.getTenantName()); Vector<Pair<String, String>> v = new Vector<Pair<String, String>>(); v.add(p); return RESTClient.sendGETRequest(U.useSSL(), U.getNeutronEndpoint() + "/" + U.getNeutronEndpointAPIVER() + "/networks.json?router%3Aexternal=True", U.getToken(), v); }
public String requestExternalNetworks() throws NotAuthorizedException, NotFoundException, ServerException, ServiceUnAvailableOrInternalError, IOException, MalformedURLException, ProtocolException, ParseException, CertificateException { <DeepExtract> String gapiver = U.getGlanceEndpointAPIVER(); String napiver = U.getNeutronEndpointAPIVER(); if (U.getVerifyServerCert()) { X509Certificate cert = null; cert = (X509Certificate) (CertificateFactory.getInstance("X.509")).generateCertificate(new FileInputStream(U.getCAFile())); if (RESTClient.checkServerCert(U.getIdentityEndpoint(), cert.getIssuerX500Principal().getName()) == false) throw new CertificateException("Couldn't verify server's certificate. Please verify the correct CA selected."); } long exp_time = U.getTokenExpireTime(); if (exp_time <= Utils.now() + 5) { String payload = null; if (U.useV3()) payload = "{ \"auth\": { \"identity\": { \"methods\": [\"password\"],\"password\": { \"user\": { \"name\": \"" + U.getUserName() + "\",\"domain\": { \"id\": \"default\" }, \"password\": \"" + U.getPassword() + "\" } } }, \"scope\": { \"project\": { \"name\": \"" + U.getTenantName() + "\", \"domain\": { \"id\": \"default\" } }}}}"; else payload = "{\"auth\": {\"tenantName\": \"" + U.getTenantName() + "\", \"passwordCredentials\": {\"username\": \"" + U.getUserName() + "\", \"password\": \"" + U.getPassword() + "\"}}}"; String identityEP = U.getIdentityEndpoint(); if (U.useV3()) identityEP += "/auth"; identityEP += "/tokens"; Pair<String, String> jsonBuffer_Token = RESTClient.requestToken(U.useSSL(), identityEP, payload); String pwd = U.getPassword(); String edp = U.getIdentityEndpoint(); boolean ssl = U.useSSL(); boolean verifyServerCert = U.getVerifyServerCert(); String CAFile = U.getCAFile(); U = User.parse(jsonBuffer_Token.first, U.useV3(), jsonBuffer_Token.second); U.setPassword(pwd); U.setSSL(ssl); U.setCAFile(CAFile); U.setGlanceEndpointAPIVER(gapiver); U.setNeutronEndpointAPIVER(napiver); U.toFile(Configuration.getInstance().getValue("FILESDIR", Defaults.DEFAULTFILESDIR)); } </DeepExtract> Pair<String, String> p = new Pair<String, String>("X-Auth-Project-Id", U.getTenantName()); Vector<Pair<String, String>> v = new Vector<Pair<String, String>>(); v.add(p); return RESTClient.sendGETRequest(U.useSSL(), U.getNeutronEndpoint() + "/" + U.getNeutronEndpointAPIVER() + "/networks.json?router%3Aexternal=True", U.getToken(), v); }
DroidStack
positive
1,550
public Collection<UUID> asCollection(final int batchSize) throws JIException { JICallBuilder callObject = new JICallBuilder(true); callObject.setOpnum(2); getCOMObject().call(callObject); List<UUID> data = new ArrayList<UUID>(); int i = 0; do { i = next(data, batchSize); } while (i == batchSize); return data; }
public Collection<UUID> asCollection(final int batchSize) throws JIException { <DeepExtract> JICallBuilder callObject = new JICallBuilder(true); callObject.setOpnum(2); getCOMObject().call(callObject); </DeepExtract> List<UUID> data = new ArrayList<UUID>(); int i = 0; do { i = next(data, batchSize); } while (i == batchSize); return data; }
OPC_Client
positive
1,551
public static byte[] decodeLines(String s) { char[] buf = new char[s.length()]; int p = 0; for (int ip = 0; ip < s.length(); ip++) { char c = s.charAt(ip); if (c != ' ' && c != '\r' && c != '\n' && c != '\t') buf[p++] = c; } if (p % 4 != 0) throw new IllegalArgumentException("Length of Base64 encoded input string is not a multiple of 4."); while (p > 0 && buf[0 + p - 1] == '=') p--; int oLen = (p * 3) / 4; byte[] out = new byte[oLen]; int ip = 0; int iEnd = 0 + p; int op = 0; while (ip < iEnd) { int i0 = buf[ip++]; int i1 = buf[ip++]; int i2 = ip < iEnd ? buf[ip++] : 'A'; int i3 = ip < iEnd ? buf[ip++] : 'A'; if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127) throw new IllegalArgumentException("Illegal character in Base64 encoded data."); int b0 = map2[i0]; int b1 = map2[i1]; int b2 = map2[i2]; int b3 = map2[i3]; if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0) throw new IllegalArgumentException("Illegal character in Base64 encoded data."); int o0 = (b0 << 2) | (b1 >>> 4); int o1 = ((b1 & 0xf) << 4) | (b2 >>> 2); int o2 = ((b2 & 3) << 6) | b3; out[op++] = (byte) o0; if (op < oLen) out[op++] = (byte) o1; if (op < oLen) out[op++] = (byte) o2; } return out; }
public static byte[] decodeLines(String s) { char[] buf = new char[s.length()]; int p = 0; for (int ip = 0; ip < s.length(); ip++) { char c = s.charAt(ip); if (c != ' ' && c != '\r' && c != '\n' && c != '\t') buf[p++] = c; } <DeepExtract> if (p % 4 != 0) throw new IllegalArgumentException("Length of Base64 encoded input string is not a multiple of 4."); while (p > 0 && buf[0 + p - 1] == '=') p--; int oLen = (p * 3) / 4; byte[] out = new byte[oLen]; int ip = 0; int iEnd = 0 + p; int op = 0; while (ip < iEnd) { int i0 = buf[ip++]; int i1 = buf[ip++]; int i2 = ip < iEnd ? buf[ip++] : 'A'; int i3 = ip < iEnd ? buf[ip++] : 'A'; if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127) throw new IllegalArgumentException("Illegal character in Base64 encoded data."); int b0 = map2[i0]; int b1 = map2[i1]; int b2 = map2[i2]; int b3 = map2[i3]; if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0) throw new IllegalArgumentException("Illegal character in Base64 encoded data."); int o0 = (b0 << 2) | (b1 >>> 4); int o1 = ((b1 & 0xf) << 4) | (b2 >>> 2); int o2 = ((b2 & 3) << 6) | b3; out[op++] = (byte) o0; if (op < oLen) out[op++] = (byte) o1; if (op < oLen) out[op++] = (byte) o2; } return out; </DeepExtract> }
NASDAQ-ITCH-5.0-Parser
positive
1,552
public void hideWIFI() { this.mNetworkTextView.setVisibility(View.VISIBLE); this.mBatteryView.setStatus(UIWIFIView.STATUS_NONE); }
public void hideWIFI() { this.mNetworkTextView.setVisibility(View.VISIBLE); <DeepExtract> this.mBatteryView.setStatus(UIWIFIView.STATUS_NONE); </DeepExtract> }
Auie
positive
1,553
public Criteria andRolenameIsNull() { if ("roleName is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("roleName is null")); return (Criteria) this; }
public Criteria andRolenameIsNull() { <DeepExtract> if ("roleName is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("roleName is null")); </DeepExtract> return (Criteria) this; }
examination_system-
positive
1,554
public static void main(String[] args) { int[] arr = { 12, 11, 13, 5, 6, 7 }; int n = arr.length; HeapSort ob = new HeapSort(); int n = arr.length; for (int i = n / 2 - 1; i >= 0; i--) heapify(arr, n, i); for (int i = n - 1; i >= 0; i--) { int temp = arr[0]; arr[0] = arr[i]; arr[i] = temp; heapify(arr, i, 0); } System.out.println("Sorted array is"); int n = arr.length; for (int i = 0; i < n; ++i) System.out.print(arr[i] + " "); System.out.println(); }
public static void main(String[] args) { int[] arr = { 12, 11, 13, 5, 6, 7 }; int n = arr.length; HeapSort ob = new HeapSort(); int n = arr.length; for (int i = n / 2 - 1; i >= 0; i--) heapify(arr, n, i); for (int i = n - 1; i >= 0; i--) { int temp = arr[0]; arr[0] = arr[i]; arr[i] = temp; heapify(arr, i, 0); } System.out.println("Sorted array is"); <DeepExtract> int n = arr.length; for (int i = 0; i < n; ++i) System.out.print(arr[i] + " "); System.out.println(); </DeepExtract> }
Important-Java-Concepts
positive
1,555
public void itemStateChanged(java.awt.event.ItemEvent evt) { if (initialized && evt.getStateChange() == ItemEvent.SELECTED) { String portName = String.valueOf(evt.getItem()); SerialPort newPort; try { newPort = (SerialPort) CommPortIdentifier.getPortIdentifier(portName).open(portName, 1000); } catch (Exception e) { newPort = null; Logger.getLogger(getClass()).warn(e.getMessage()); } setPort(newPort); } }
public void itemStateChanged(java.awt.event.ItemEvent evt) { <DeepExtract> if (initialized && evt.getStateChange() == ItemEvent.SELECTED) { String portName = String.valueOf(evt.getItem()); SerialPort newPort; try { newPort = (SerialPort) CommPortIdentifier.getPortIdentifier(portName).open(portName, 1000); } catch (Exception e) { newPort = null; Logger.getLogger(getClass()).warn(e.getMessage()); } setPort(newPort); } </DeepExtract> }
AndrOBD
positive
1,556
public void settingsWarningDialogShown() { mHasLoggingInfo = true; mContext.sendBroadcast(newLoggingBroadcast(LoggingEvents.VoiceIme.SETTINGS_WARNING_DIALOG_SHOWN)); }
public void settingsWarningDialogShown() { <DeepExtract> mHasLoggingInfo = true; </DeepExtract> mContext.sendBroadcast(newLoggingBroadcast(LoggingEvents.VoiceIme.SETTINGS_WARNING_DIALOG_SHOWN)); }
Gingerbread-Keyboard
positive
1,557
private static void initializeTokenSet() { atomicSet.add(SimpleToken.of("C", "C", "C", "c")); atomicSet.add(SimpleToken.of("O", "O", "O", "()", "0", "o")); atomicSet.add(SimpleToken.of("N", "N", "N", "1O")); atomicSet.add(SimpleToken.of("H", "H", "H", "tt", "1t", "t1", "I1", "t4", "11")); atomicSet.add(SimpleToken.of("S", "S", "S", "s")); atomicSet.add(SimpleToken.of("P", "P", "P", "p")); atomicSet.add(SimpleToken.of("Pt", "Pt", "Pt", "pt")); atomicSet.add(SimpleToken.of("K", "K", "K", "k")); atomicSet.add(SimpleToken.of("As", "As", "As", "AS", "A8")); atomicSet.add(SimpleToken.of("Au", "Au", "Au", "AU")); atomicSet.add(SimpleToken.of("Al", "Al", "Al", "A1", "At", "AI")); atomicSet.add(SimpleToken.of("F", "F", "F", "f")); atomicSet.add(SimpleToken.of("Cl", "Cl", "Cl", "CT", "Ct", "C)", "CI", "C1", "cl", "cT", "ct", "c)", "cI", "c1")); atomicSet.add(SimpleToken.of("Br", "Br", "Br", "8t", "Sr", "sr", "8r", "BT")); atomicSet.add(SimpleToken.of("Na", "Na", "Na")); atomicSet.add(SimpleToken.of("I", "I", "t", "1")); atomicSet.add(SimpleToken.of("B", "B", "B", "8")); atomicSet.add(SimpleToken.of("Si", "Si", "Si", "SI", "Sl", "S1", "St", "si", "sI", "sl", "s1", "st", "8i", "8I", "8l", "81")); atomicSet.add(SimpleToken.of("Hg", "Hg", "Hg", "ttg", "1tg", "t1g", "I1g", "t4g", "11g")); atomicSet.add(SimpleToken.of("D", "D", "D")); atomicSet.forEach(tt -> registerToken(tt, false)); if (true) { masterTokenList.put(Token.groupedToken("Atomic", atomicSet).getTokenName(), Token.groupedToken("Atomic", atomicSet)); } tokenList.put(Token.groupedToken("Atomic", atomicSet).getTokenName(), Token.groupedToken("Atomic", atomicSet)); numericSet.add(SimpleToken.of("1", "1", "1", "t")); numericSet.add(SimpleToken.of("2", "2", "2")); numericSet.add(SimpleToken.of("3", "3", "3")); numericSet.add(SimpleToken.of("4", "4", "4")); numericSet.add(SimpleToken.of("5")); numericSet.add(SimpleToken.of("6")); numericSet.add(SimpleToken.of("7")); numericSet.add(SimpleToken.of("8")); numericSet.add(SimpleToken.of("9")); numericSet.forEach(tt -> registerToken(tt, false)); if (true) { masterTokenList.put(Token.groupedToken("Numeric", numericSet).getTokenName(), Token.groupedToken("Numeric", numericSet)); } tokenList.put(Token.groupedToken("Numeric", numericSet).getTokenName(), Token.groupedToken("Numeric", numericSet)); if (false) { saturatedAtomicSet.add(getCombinedToken("C", "H", "3")); saturatedAtomicSet.add(getCombinedToken("C", "H", "2")); saturatedAtomicSet.add(getCombinedToken("C")); saturatedAtomicSet.add(getCombinedToken("N", "H", "2")); saturatedAtomicSet.add(getCombinedToken("N", "H")); saturatedAtomicSet.add(getCombinedToken("O", "H")); saturatedAtomicSet.add(getCombinedToken("S", "H")); saturatedAtomicSet.add(getCombinedToken("H", "3", "C")); saturatedAtomicSet.add(getCombinedToken("H", "2", "C")); saturatedAtomicSet.add(getCombinedToken("H", "C")); saturatedAtomicSet.add(getCombinedToken("H", "O")); saturatedAtomicSet.add(getCombinedToken("H", "2", "N")); saturatedAtomicSet.add(getCombinedToken("H", "N")); saturatedAtomicSet.add(getCombinedToken("H", "S")); saturatedAtomicSet.forEach(tt -> registerToken(tt, false)); } List<Token> specialSet = new ArrayList<>(); specialSet.add(SimpleToken.of("Me", "Me", "Me", "Mc", "MC")); specialSet.add(SimpleToken.of("Et")); specialSet.add(SimpleToken.of("Pr")); specialSet.add(SimpleToken.of("Ms", "Ms", "Ms", "MS", "M8")); specialSet.add(SimpleToken.of("Ac", "Ac", "Ac", "AC")); specialSet.add(SimpleToken.of("Bn", "Bn", "Bn", "Bt1")); specialSet.add(SimpleToken.of("Cbz", "Cbz", "CbZ", "Cbz", "cbZ", "cbz", "C6Z", "c6Z", "C6z", "c6z")); specialSet.add(SimpleToken.of("tBu", "tBu", "t-Bu", "tbu", "t-Bo", "tBo")); specialSet.add(SimpleToken.of("nBu", "nBu", "n-Bu", "nbu", "n-Bo", "nBo")); specialSet.add(SimpleToken.of("Cys", "Cys", "CyS", "Cys", "cyS", "cys", "Cy8", "cy8")); specialSet.add(SimpleToken.of("Ph", "Ph", "Ph", "ph", "Pb", "pb")); specialSet.add(SimpleToken.of("pTol", "p-tol", "p-tol", "ptol", "pTol")); specialSet.add(SimpleToken.of("Ts", "Ts", "Ts", "TS")); specialSet.add(SimpleToken.of("Tf", "Tf", "Tf", "Tr")); specialSet.add(SimpleToken.of("PMBN", "PMBN", "PMBN", "pMBN")); specialSet.add(SimpleToken.of("PLUS", "+", "+")); specialSet.add(SimpleToken.of("OPEN", "(", "(")); specialSet.add(SimpleToken.of("CLOSE", ")", ")")); specialSet.add(SimpleToken.of("TMS", "TMS", "TMS", "TMs", "tMs")); specialSet.forEach(tt -> registerToken(tt, false)); if (true) { masterTokenList.put(Token.groupedToken("Special", specialSet).getTokenName(), Token.groupedToken("Special", specialSet)); } tokenList.put(Token.groupedToken("Special", specialSet).getTokenName(), Token.groupedToken("Special", specialSet)); }
private static void initializeTokenSet() { atomicSet.add(SimpleToken.of("C", "C", "C", "c")); atomicSet.add(SimpleToken.of("O", "O", "O", "()", "0", "o")); atomicSet.add(SimpleToken.of("N", "N", "N", "1O")); atomicSet.add(SimpleToken.of("H", "H", "H", "tt", "1t", "t1", "I1", "t4", "11")); atomicSet.add(SimpleToken.of("S", "S", "S", "s")); atomicSet.add(SimpleToken.of("P", "P", "P", "p")); atomicSet.add(SimpleToken.of("Pt", "Pt", "Pt", "pt")); atomicSet.add(SimpleToken.of("K", "K", "K", "k")); atomicSet.add(SimpleToken.of("As", "As", "As", "AS", "A8")); atomicSet.add(SimpleToken.of("Au", "Au", "Au", "AU")); atomicSet.add(SimpleToken.of("Al", "Al", "Al", "A1", "At", "AI")); atomicSet.add(SimpleToken.of("F", "F", "F", "f")); atomicSet.add(SimpleToken.of("Cl", "Cl", "Cl", "CT", "Ct", "C)", "CI", "C1", "cl", "cT", "ct", "c)", "cI", "c1")); atomicSet.add(SimpleToken.of("Br", "Br", "Br", "8t", "Sr", "sr", "8r", "BT")); atomicSet.add(SimpleToken.of("Na", "Na", "Na")); atomicSet.add(SimpleToken.of("I", "I", "t", "1")); atomicSet.add(SimpleToken.of("B", "B", "B", "8")); atomicSet.add(SimpleToken.of("Si", "Si", "Si", "SI", "Sl", "S1", "St", "si", "sI", "sl", "s1", "st", "8i", "8I", "8l", "81")); atomicSet.add(SimpleToken.of("Hg", "Hg", "Hg", "ttg", "1tg", "t1g", "I1g", "t4g", "11g")); atomicSet.add(SimpleToken.of("D", "D", "D")); atomicSet.forEach(tt -> registerToken(tt, false)); if (true) { masterTokenList.put(Token.groupedToken("Atomic", atomicSet).getTokenName(), Token.groupedToken("Atomic", atomicSet)); } tokenList.put(Token.groupedToken("Atomic", atomicSet).getTokenName(), Token.groupedToken("Atomic", atomicSet)); numericSet.add(SimpleToken.of("1", "1", "1", "t")); numericSet.add(SimpleToken.of("2", "2", "2")); numericSet.add(SimpleToken.of("3", "3", "3")); numericSet.add(SimpleToken.of("4", "4", "4")); numericSet.add(SimpleToken.of("5")); numericSet.add(SimpleToken.of("6")); numericSet.add(SimpleToken.of("7")); numericSet.add(SimpleToken.of("8")); numericSet.add(SimpleToken.of("9")); numericSet.forEach(tt -> registerToken(tt, false)); if (true) { masterTokenList.put(Token.groupedToken("Numeric", numericSet).getTokenName(), Token.groupedToken("Numeric", numericSet)); } tokenList.put(Token.groupedToken("Numeric", numericSet).getTokenName(), Token.groupedToken("Numeric", numericSet)); if (false) { saturatedAtomicSet.add(getCombinedToken("C", "H", "3")); saturatedAtomicSet.add(getCombinedToken("C", "H", "2")); saturatedAtomicSet.add(getCombinedToken("C")); saturatedAtomicSet.add(getCombinedToken("N", "H", "2")); saturatedAtomicSet.add(getCombinedToken("N", "H")); saturatedAtomicSet.add(getCombinedToken("O", "H")); saturatedAtomicSet.add(getCombinedToken("S", "H")); saturatedAtomicSet.add(getCombinedToken("H", "3", "C")); saturatedAtomicSet.add(getCombinedToken("H", "2", "C")); saturatedAtomicSet.add(getCombinedToken("H", "C")); saturatedAtomicSet.add(getCombinedToken("H", "O")); saturatedAtomicSet.add(getCombinedToken("H", "2", "N")); saturatedAtomicSet.add(getCombinedToken("H", "N")); saturatedAtomicSet.add(getCombinedToken("H", "S")); saturatedAtomicSet.forEach(tt -> registerToken(tt, false)); } List<Token> specialSet = new ArrayList<>(); specialSet.add(SimpleToken.of("Me", "Me", "Me", "Mc", "MC")); specialSet.add(SimpleToken.of("Et")); specialSet.add(SimpleToken.of("Pr")); specialSet.add(SimpleToken.of("Ms", "Ms", "Ms", "MS", "M8")); specialSet.add(SimpleToken.of("Ac", "Ac", "Ac", "AC")); specialSet.add(SimpleToken.of("Bn", "Bn", "Bn", "Bt1")); specialSet.add(SimpleToken.of("Cbz", "Cbz", "CbZ", "Cbz", "cbZ", "cbz", "C6Z", "c6Z", "C6z", "c6z")); specialSet.add(SimpleToken.of("tBu", "tBu", "t-Bu", "tbu", "t-Bo", "tBo")); specialSet.add(SimpleToken.of("nBu", "nBu", "n-Bu", "nbu", "n-Bo", "nBo")); specialSet.add(SimpleToken.of("Cys", "Cys", "CyS", "Cys", "cyS", "cys", "Cy8", "cy8")); specialSet.add(SimpleToken.of("Ph", "Ph", "Ph", "ph", "Pb", "pb")); specialSet.add(SimpleToken.of("pTol", "p-tol", "p-tol", "ptol", "pTol")); specialSet.add(SimpleToken.of("Ts", "Ts", "Ts", "TS")); specialSet.add(SimpleToken.of("Tf", "Tf", "Tf", "Tr")); specialSet.add(SimpleToken.of("PMBN", "PMBN", "PMBN", "pMBN")); specialSet.add(SimpleToken.of("PLUS", "+", "+")); specialSet.add(SimpleToken.of("OPEN", "(", "(")); specialSet.add(SimpleToken.of("CLOSE", ")", ")")); specialSet.add(SimpleToken.of("TMS", "TMS", "TMS", "TMs", "tMs")); specialSet.forEach(tt -> registerToken(tt, false)); <DeepExtract> if (true) { masterTokenList.put(Token.groupedToken("Special", specialSet).getTokenName(), Token.groupedToken("Special", specialSet)); } tokenList.put(Token.groupedToken("Special", specialSet).getTokenName(), Token.groupedToken("Special", specialSet)); </DeepExtract> }
molvec
positive
1,558
public Builder mergeFrom(protoc.MessageProto.GrpcCharacterData other) { if (other == protoc.MessageProto.GrpcCharacterData.getDefaultInstance()) return this; if (other.getPlayerNumber() != false) { setPlayerNumber(other.getPlayerNumber()); } if (other.getHp() != 0) { setHp(other.getHp()); } if (other.getEnergy() != 0) { setEnergy(other.getEnergy()); } if (other.getX() != 0) { setX(other.getX()); } if (other.getY() != 0) { setY(other.getY()); } if (other.getLeft() != 0) { setLeft(other.getLeft()); } if (other.getRight() != 0) { setRight(other.getRight()); } if (other.getTop() != 0) { setTop(other.getTop()); } if (other.getBottom() != 0) { setBottom(other.getBottom()); } if (other.getSpeedX() != 0) { setSpeedX(other.getSpeedX()); } if (other.getSpeedY() != 0) { setSpeedY(other.getSpeedY()); } if (other.state_ != 0) { setStateValue(other.getStateValue()); } if (other.action_ != 0) { setActionValue(other.getActionValue()); } if (other.getFront() != false) { setFront(other.getFront()); } if (other.getControl() != false) { setControl(other.getControl()); } if (other.hasAttackData()) { mergeAttackData(other.getAttackData()); } if (other.getRemainingFrame() != 0) { setRemainingFrame(other.getRemainingFrame()); } if (other.getHitConfirm() != false) { setHitConfirm(other.getHitConfirm()); } if (other.getGraphicSizeX() != 0) { setGraphicSizeX(other.getGraphicSizeX()); } if (other.getGraphicSizeY() != 0) { setGraphicSizeY(other.getGraphicSizeY()); } if (other.getGraphicAdjustX() != 0) { setGraphicAdjustX(other.getGraphicAdjustX()); } if (other.getHitCount() != 0) { setHitCount(other.getHitCount()); } if (other.getLastHitFrame() != 0) { setLastHitFrame(other.getLastHitFrame()); } return super.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; }
public Builder mergeFrom(protoc.MessageProto.GrpcCharacterData other) { if (other == protoc.MessageProto.GrpcCharacterData.getDefaultInstance()) return this; if (other.getPlayerNumber() != false) { setPlayerNumber(other.getPlayerNumber()); } if (other.getHp() != 0) { setHp(other.getHp()); } if (other.getEnergy() != 0) { setEnergy(other.getEnergy()); } if (other.getX() != 0) { setX(other.getX()); } if (other.getY() != 0) { setY(other.getY()); } if (other.getLeft() != 0) { setLeft(other.getLeft()); } if (other.getRight() != 0) { setRight(other.getRight()); } if (other.getTop() != 0) { setTop(other.getTop()); } if (other.getBottom() != 0) { setBottom(other.getBottom()); } if (other.getSpeedX() != 0) { setSpeedX(other.getSpeedX()); } if (other.getSpeedY() != 0) { setSpeedY(other.getSpeedY()); } if (other.state_ != 0) { setStateValue(other.getStateValue()); } if (other.action_ != 0) { setActionValue(other.getActionValue()); } if (other.getFront() != false) { setFront(other.getFront()); } if (other.getControl() != false) { setControl(other.getControl()); } if (other.hasAttackData()) { mergeAttackData(other.getAttackData()); } if (other.getRemainingFrame() != 0) { setRemainingFrame(other.getRemainingFrame()); } if (other.getHitConfirm() != false) { setHitConfirm(other.getHitConfirm()); } if (other.getGraphicSizeX() != 0) { setGraphicSizeX(other.getGraphicSizeX()); } if (other.getGraphicSizeY() != 0) { setGraphicSizeY(other.getGraphicSizeY()); } if (other.getGraphicAdjustX() != 0) { setGraphicAdjustX(other.getGraphicAdjustX()); } if (other.getHitCount() != 0) { setHitCount(other.getHitCount()); } if (other.getLastHitFrame() != 0) { setLastHitFrame(other.getLastHitFrame()); } <DeepExtract> return super.mergeUnknownFields(other.getUnknownFields()); </DeepExtract> onChanged(); return this; }
FightingICE
positive
1,560
public T get(T element) { List<T> list = data[hashFunction(element)]; if (list != null) { for (T temp : list) { if (temp.equals(element)) { return temp; } } } return null; }
public T get(T element) { <DeepExtract> List<T> list = data[hashFunction(element)]; if (list != null) { for (T temp : list) { if (temp.equals(element)) { return temp; } } } return null; </DeepExtract> }
data-structures-in-java
positive
1,561
@Override public DefaultMethodsCollection<Size, A> tail() { return new DefaultMethodsCollection<>(delegate.tail()); }
@Override public DefaultMethodsCollection<Size, A> tail() { <DeepExtract> return new DefaultMethodsCollection<>(delegate.tail()); </DeepExtract> }
shoki
positive
1,562
@Deprecated public java.util.Map<String, GrpcService.InferParameter> getParameters() { return internalGetParameters().getMap(); }
@Deprecated public java.util.Map<String, GrpcService.InferParameter> getParameters() { <DeepExtract> return internalGetParameters().getMap(); </DeepExtract> }
dl_inference
positive
1,564
public Actor commonParse(CocoCreatorUIEditor editor, ObjectData widget, Group parent, Actor actor) { this.editor = editor; actor.setName(widget.getName()); actor.setSize(widget.getSize().getWidth(), widget.getSize().getHeight()); actor.setOrigin(widget.getAnchorPoint().getScaleX() * actor.getWidth(), widget.getAnchorPoint().getScaleY() * actor.getHeight()); actor.setPosition(widget.getPosition().getWidth() - actor.getOriginX(), widget.getPosition().getHeight() - actor.getOriginY()); actor.setScale(widget.getScale().getScaleX(), widget.getScale().getScaleY()); if (widget.getRotation() != 0) { actor.setRotation(360 - widget.getRotation() % 360); } actor.setVisible(widget.isVisibleForFrame()); Color color = editor.getColor(widget.getCColor(), widget.getAlpha()); actor.setColor(color); actor.setTouchable(widget.isTouchEnable() ? Touchable.enabled : Touchable.disabled); if (widget.getCallBackType() == null || widget.getCallBackType().isEmpty()) { return; } if ("Click".equals(widget.getCallBackType())) { actor.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { invoke(actor, widget.getCallBackName()); super.clicked(event, x, y); } }); } else if ("Touch".equals(widget.getCallBackType())) { actor.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { invoke(actor, widget.getCallBackName()); return super.touchDown(event, x, y, pointer, button); } }); } Array<Actor> arrayActors = editor.getActors().get(actor.getName()); if (arrayActors == null) { arrayActors = new Array<Actor>(); } arrayActors.add(actor); editor.getActors().put(actor.getName(), arrayActors); editor.getActionActors().put(widget.getActionTag(), actor); if (widget.getChildren() == null || widget.getChildren().size() == 0) { return actor; } return null; }
public Actor commonParse(CocoCreatorUIEditor editor, ObjectData widget, Group parent, Actor actor) { this.editor = editor; actor.setName(widget.getName()); actor.setSize(widget.getSize().getWidth(), widget.getSize().getHeight()); actor.setOrigin(widget.getAnchorPoint().getScaleX() * actor.getWidth(), widget.getAnchorPoint().getScaleY() * actor.getHeight()); actor.setPosition(widget.getPosition().getWidth() - actor.getOriginX(), widget.getPosition().getHeight() - actor.getOriginY()); actor.setScale(widget.getScale().getScaleX(), widget.getScale().getScaleY()); if (widget.getRotation() != 0) { actor.setRotation(360 - widget.getRotation() % 360); } actor.setVisible(widget.isVisibleForFrame()); Color color = editor.getColor(widget.getCColor(), widget.getAlpha()); actor.setColor(color); actor.setTouchable(widget.isTouchEnable() ? Touchable.enabled : Touchable.disabled); if (widget.getCallBackType() == null || widget.getCallBackType().isEmpty()) { return; } if ("Click".equals(widget.getCallBackType())) { actor.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { invoke(actor, widget.getCallBackName()); super.clicked(event, x, y); } }); } else if ("Touch".equals(widget.getCallBackType())) { actor.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { invoke(actor, widget.getCallBackName()); return super.touchDown(event, x, y, pointer, button); } }); } <DeepExtract> Array<Actor> arrayActors = editor.getActors().get(actor.getName()); if (arrayActors == null) { arrayActors = new Array<Actor>(); } arrayActors.add(actor); editor.getActors().put(actor.getName(), arrayActors); editor.getActionActors().put(widget.getActionTag(), actor); </DeepExtract> if (widget.getChildren() == null || widget.getChildren().size() == 0) { return actor; } return null; }
cocostudio-ui-libgdx
positive
1,565
public String dumpQueue() { StringBuffer sb = new StringBuffer(); if (queue.length == 0) sb.append("[]"); else { sb.append('['); sb.append(queue[0]); for (int i = 1; i < queue.length; i++) { sb.append(", "); sb.append(queue[i]); } sb.append("]"); } sb.append(", h=").append(head).append(", t=").append(tail).append(", s=").append(size); if (size == 0) return "[]"; StringBuffer sb = new StringBuffer(); sb.append('['); sb.append(Integer.toHexString(peek(0) & 0xff)); for (int i = 1; i < size; i++) sb.append(',').append(Integer.toHexString(peek(i) & 0xff)); sb.append("]"); return sb.toString(); }
public String dumpQueue() { StringBuffer sb = new StringBuffer(); if (queue.length == 0) sb.append("[]"); else { sb.append('['); sb.append(queue[0]); for (int i = 1; i < queue.length; i++) { sb.append(", "); sb.append(queue[i]); } sb.append("]"); } sb.append(", h=").append(head).append(", t=").append(tail).append(", s=").append(size); <DeepExtract> if (size == 0) return "[]"; StringBuffer sb = new StringBuffer(); sb.append('['); sb.append(Integer.toHexString(peek(0) & 0xff)); for (int i = 1; i < size; i++) sb.append(',').append(Integer.toHexString(peek(i) & 0xff)); sb.append("]"); return sb.toString(); </DeepExtract> }
Modbus4Android
positive
1,566
public void removeSchedules(Schedule[] schedules) throws UnprocessableEntityException, StatusCodeException { int[] ids = new int[schedules.length]; for (int i = 0; i < schedules.length; i++) { ids[i] = schedules[i].getId(); } String schedulesStr = "\"schedules\":["; for (int i = 0; i < ids.length; i++) { schedulesStr += String.format("{\"id\":%d}", ids[i]); if (i < ids.length - 1) { schedulesStr += ","; } else { schedulesStr += "]"; } } String body = String.format("{\"write\":{\"command\":" + "\"removeSchedules\",%s}}", schedulesStr); HttpRequest req = HttpRequest.put(getURL("effects")); req.send(body); checkStatusCode(req.code()); }
public void removeSchedules(Schedule[] schedules) throws UnprocessableEntityException, StatusCodeException { int[] ids = new int[schedules.length]; for (int i = 0; i < schedules.length; i++) { ids[i] = schedules[i].getId(); } <DeepExtract> String schedulesStr = "\"schedules\":["; for (int i = 0; i < ids.length; i++) { schedulesStr += String.format("{\"id\":%d}", ids[i]); if (i < ids.length - 1) { schedulesStr += ","; } else { schedulesStr += "]"; } } String body = String.format("{\"write\":{\"command\":" + "\"removeSchedules\",%s}}", schedulesStr); HttpRequest req = HttpRequest.put(getURL("effects")); req.send(body); checkStatusCode(req.code()); </DeepExtract> }
nanoleaf-aurora
positive
1,567
public Criteria andTotalpriceLessThanOrEqualTo(BigDecimal value) { if (value == null) { throw new RuntimeException("Value for " + "totalprice" + " cannot be null"); } criteria.add(new Criterion("totalprice <=", value)); return (Criteria) this; }
public Criteria andTotalpriceLessThanOrEqualTo(BigDecimal value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "totalprice" + " cannot be null"); } criteria.add(new Criterion("totalprice <=", value)); </DeepExtract> return (Criteria) this; }
PetStore
positive
1,568
private synchronized void onTaskCompleted(DownloadTask task) { if (task.state != FILE_COMPLETED) { Logger.d(TAG, "File #" + task.taskId + "| Completed in " + (System.nanoTime() - task.queueTime) / (1000 * 1000L) + " ms"); task.state = FILE_COMPLETED; try { if (task.file != null) { task.file.close(); task.file = null; } } catch (IOException e) { Logger.e(TAG, e); } } DownloadTask[] activeTasks = getActiveTasks(); outer: for (DownloadTask task : activeTasks) { for (DownloadBlock block : task.blocks) { if (block.state != BLOCK_COMPLETED) { continue outer; } } onTaskCompleted(task); } activeTasks = getActiveTasks(); int count = activeTasks.length; while (count < PARALLEL_DOWNLOAD_COUNT) { long mintime = Long.MAX_VALUE; DownloadTask minTask = null; for (DownloadTask task : tasks) { if (task.state == FILE_QUEUED && task.queueTime < mintime) { minTask = task; } } if (minTask == null) { break; } minTask.state = FILE_DOWNLOADING; Logger.d(TAG, "File #" + minTask.taskId + "| Downloading"); } synchronized (threadLocker) { threadLocker.notifyAll(); } }
private synchronized void onTaskCompleted(DownloadTask task) { if (task.state != FILE_COMPLETED) { Logger.d(TAG, "File #" + task.taskId + "| Completed in " + (System.nanoTime() - task.queueTime) / (1000 * 1000L) + " ms"); task.state = FILE_COMPLETED; try { if (task.file != null) { task.file.close(); task.file = null; } } catch (IOException e) { Logger.e(TAG, e); } } <DeepExtract> DownloadTask[] activeTasks = getActiveTasks(); outer: for (DownloadTask task : activeTasks) { for (DownloadBlock block : task.blocks) { if (block.state != BLOCK_COMPLETED) { continue outer; } } onTaskCompleted(task); } activeTasks = getActiveTasks(); int count = activeTasks.length; while (count < PARALLEL_DOWNLOAD_COUNT) { long mintime = Long.MAX_VALUE; DownloadTask minTask = null; for (DownloadTask task : tasks) { if (task.state == FILE_QUEUED && task.queueTime < mintime) { minTask = task; } } if (minTask == null) { break; } minTask.state = FILE_DOWNLOADING; Logger.d(TAG, "File #" + minTask.taskId + "| Downloading"); } synchronized (threadLocker) { threadLocker.notifyAll(); } </DeepExtract> }
telegram-trivia-bot
positive
1,569
private int daysRemaining(String area) { Long get = leaseExpireTime.get(area); if (get <= System.currentTimeMillis()) return 0; return (int) Math.ceil(((((double) (int) (get - System.currentTimeMillis()) / 1000D) / 60D) / 60D) / 24D); }
private int daysRemaining(String area) { Long get = leaseExpireTime.get(area); if (get <= System.currentTimeMillis()) return 0; <DeepExtract> return (int) Math.ceil(((((double) (int) (get - System.currentTimeMillis()) / 1000D) / 60D) / 60D) / 24D); </DeepExtract> }
Residence
positive
1,570
@Override public EnumInstantiateStatus queryInstantiateStatus(String appInstanceId, MepHost mepHost, LcmLog lcmLog) { int waitingTime = 0; PodStatusInfos status = null; PodEventsRes events = null; while (waitingTime < TIMEOUT) { String basePath = getUrlPrefix(mepHost.getLcmProtocol(), mepHost.getLcmIp(), mepHost.getLcmPort()); String workStatus = HttpClientUtil.getWorkloadStatus(basePath, appInstanceId, getContext().getUserId(), getContext().getToken(), lcmLog); LOGGER.info("Container app instantiate workStatus: {}", workStatus); String workEvents = HttpClientUtil.getWorkloadEvents(basePath, appInstanceId, getContext().getUserId(), getContext().getToken(), lcmLog); LOGGER.info("Container app instantiate workEvents: {}", workEvents); if (null != workStatus && null != workEvents) { status = gson.fromJson(workStatus, new TypeToken<PodStatusInfos>() { }.getType()); events = gson.fromJson(workEvents, new TypeToken<PodEventsRes>() { }.getType()); boolean podStatus = queryPodStatus(status.getPods()); if (podStatus) { saveWorkloadToInstantiateInfo(status, events); return EnumInstantiateStatus.INSTANTIATE_STATUS_SUCCESS; } } try { Thread.sleep(INTERVAL); waitingTime += INTERVAL; } catch (InterruptedException e) { LOGGER.error("Distribute package sleep failed."); Thread.currentThread().interrupt(); } } String applicationId = (String) getContext().getParameter(IContextParameter.PARAM_APPLICATION_ID); ContainerAppInstantiateInfo instantiateInfo = containerAppOperationService.getInstantiateInfo(applicationId); if (!CollectionUtils.isEmpty(status.getPods())) { List<PodStatusInfo> statusInfoLst = status.getPods(); for (PodStatusInfo podStatusInfo : statusInfoLst) { K8sPod pod = getPodByName(instantiateInfo, podStatusInfo.getPodname()); pod.setPodStatus(podStatusInfo.getPodstatus()); for (PodContainers containerTmp : podStatusInfo.getContainers()) { if (!StringUtils.isEmpty(containerTmp.getContainername())) { Container container = new Container(); container.setName(containerTmp.getContainername()); container.setCpuUsage(containerTmp.getMetricsusage().getCpuusage()); container.setMemUsage(containerTmp.getMetricsusage().getMemusage()); container.setDiskUsage(containerTmp.getMetricsusage().getDiskusage()); pod.getContainerList().add(container); } } } saveServiceInfo(instantiateInfo, status.getServices()); } if (!CollectionUtils.isEmpty(events.getPods())) { List<PodEvents> eventsInfoLst = events.getPods(); for (PodEvents podEventInfo : eventsInfoLst) { K8sPod pod = getPodByName(instantiateInfo, podEventInfo.getPodName()); pod.setEventsInfo(Arrays.toString(podEventInfo.getPodEventsInfo())); } } LOGGER.info("instantiate info: {}", instantiateInfo.toString()); return containerAppOperationService.updateInstantiateInfo(applicationId, instantiateInfo); return EnumInstantiateStatus.INSTANTIATE_STATUS_FAILED; }
@Override public EnumInstantiateStatus queryInstantiateStatus(String appInstanceId, MepHost mepHost, LcmLog lcmLog) { int waitingTime = 0; PodStatusInfos status = null; PodEventsRes events = null; while (waitingTime < TIMEOUT) { String basePath = getUrlPrefix(mepHost.getLcmProtocol(), mepHost.getLcmIp(), mepHost.getLcmPort()); String workStatus = HttpClientUtil.getWorkloadStatus(basePath, appInstanceId, getContext().getUserId(), getContext().getToken(), lcmLog); LOGGER.info("Container app instantiate workStatus: {}", workStatus); String workEvents = HttpClientUtil.getWorkloadEvents(basePath, appInstanceId, getContext().getUserId(), getContext().getToken(), lcmLog); LOGGER.info("Container app instantiate workEvents: {}", workEvents); if (null != workStatus && null != workEvents) { status = gson.fromJson(workStatus, new TypeToken<PodStatusInfos>() { }.getType()); events = gson.fromJson(workEvents, new TypeToken<PodEventsRes>() { }.getType()); boolean podStatus = queryPodStatus(status.getPods()); if (podStatus) { saveWorkloadToInstantiateInfo(status, events); return EnumInstantiateStatus.INSTANTIATE_STATUS_SUCCESS; } } try { Thread.sleep(INTERVAL); waitingTime += INTERVAL; } catch (InterruptedException e) { LOGGER.error("Distribute package sleep failed."); Thread.currentThread().interrupt(); } } <DeepExtract> String applicationId = (String) getContext().getParameter(IContextParameter.PARAM_APPLICATION_ID); ContainerAppInstantiateInfo instantiateInfo = containerAppOperationService.getInstantiateInfo(applicationId); if (!CollectionUtils.isEmpty(status.getPods())) { List<PodStatusInfo> statusInfoLst = status.getPods(); for (PodStatusInfo podStatusInfo : statusInfoLst) { K8sPod pod = getPodByName(instantiateInfo, podStatusInfo.getPodname()); pod.setPodStatus(podStatusInfo.getPodstatus()); for (PodContainers containerTmp : podStatusInfo.getContainers()) { if (!StringUtils.isEmpty(containerTmp.getContainername())) { Container container = new Container(); container.setName(containerTmp.getContainername()); container.setCpuUsage(containerTmp.getMetricsusage().getCpuusage()); container.setMemUsage(containerTmp.getMetricsusage().getMemusage()); container.setDiskUsage(containerTmp.getMetricsusage().getDiskusage()); pod.getContainerList().add(container); } } } saveServiceInfo(instantiateInfo, status.getServices()); } if (!CollectionUtils.isEmpty(events.getPods())) { List<PodEvents> eventsInfoLst = events.getPods(); for (PodEvents podEventInfo : eventsInfoLst) { K8sPod pod = getPodByName(instantiateInfo, podEventInfo.getPodName()); pod.setEventsInfo(Arrays.toString(podEventInfo.getPodEventsInfo())); } } LOGGER.info("instantiate info: {}", instantiateInfo.toString()); return containerAppOperationService.updateInstantiateInfo(applicationId, instantiateInfo); </DeepExtract> return EnumInstantiateStatus.INSTANTIATE_STATUS_FAILED; }
developer-be
positive
1,571
public static byte[] gzipString(final String str, final String encType) throws IOException { final byte[] stringData = str.getBytes(encType); return gzipBytes(stringData, 0, stringData.length); }
public static byte[] gzipString(final String str, final String encType) throws IOException { final byte[] stringData = str.getBytes(encType); <DeepExtract> return gzipBytes(stringData, 0, stringData.length); </DeepExtract> }
hodor
positive
1,573
@Test public void returnMessage() { final String queueName = "bizo"; final CreateQueueRequest createQueueRequest = new CreateQueueRequest().withQueueName(queueName); sqs.createQueue(createQueueRequest); final GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest().withQueueName(queueName); final GetQueueUrlResult getQueueUrlResult = sqs.getQueueUrl(getQueueUrlRequest); String queueUrl; final String queueName = "bizo"; final CreateQueueRequest createQueueRequest = new CreateQueueRequest().withQueueName(queueName); sqs.createQueue(createQueueRequest); final GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest().withQueueName(queueName); final GetQueueUrlResult getQueueUrlResult = sqs.getQueueUrl(getQueueUrlRequest); final String queueUrl = getQueueUrlResult.getQueueUrl(); assertThat(queueUrl, containsString(queueName)); final SendMessageRequest sendMessageRequest1 = new SendMessageRequest().withQueueUrl(queueUrl).withMessageBody("hi everybody 1"); sqs.sendMessage(sendMessageRequest1); final SendMessageRequest sendMessageRequest2 = new SendMessageRequest().withQueueUrl(queueUrl).withMessageBody("hi everybody 2"); sqs.sendMessage(sendMessageRequest2); final SendMessageRequest sendMessageRequest3 = new SendMessageRequest().withQueueUrl(queueUrl).withMessageBody("hi everybody 3"); sqs.sendMessage(sendMessageRequest3); final int maxNumberOfMessages = 10; final ReceiveMessageRequest receiveMessageRequest1 = new ReceiveMessageRequest().withQueueUrl(queueUrl).withMaxNumberOfMessages(maxNumberOfMessages); final ReceiveMessageResult receiveMessageResult1 = sqs.receiveMessage(receiveMessageRequest1); final List<Message> messages1 = receiveMessageResult1.getMessages(); final SendMessageRequest sendMessageRequest4 = new SendMessageRequest().withQueueUrl(queueUrl).withMessageBody("hi everybody 4"); sqs.sendMessage(sendMessageRequest4); sqs.returnMessage(queueUrl, messages1.get(1)); final ReceiveMessageRequest receiveMessageRequest2 = new ReceiveMessageRequest().withQueueUrl(queueUrl).withMaxNumberOfMessages(maxNumberOfMessages); final ReceiveMessageResult receiveMessageResult2 = sqs.receiveMessage(receiveMessageRequest2); final List<Message> messages2 = receiveMessageResult2.getMessages(); final List<String> expectedMessageBodies = Arrays.asList(sendMessageRequest2.getMessageBody(), sendMessageRequest4.getMessageBody()); final List<String> actualMessageBodies = new ArrayList<String>(); for (Message m : messages2) { actualMessageBodies.add(m.getBody()); } assertThat(actualMessageBodies, equalTo(expectedMessageBodies)); }
@Test public void returnMessage() { final String queueName = "bizo"; final CreateQueueRequest createQueueRequest = new CreateQueueRequest().withQueueName(queueName); sqs.createQueue(createQueueRequest); final GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest().withQueueName(queueName); final GetQueueUrlResult getQueueUrlResult = sqs.getQueueUrl(getQueueUrlRequest); <DeepExtract> String queueUrl; final String queueName = "bizo"; final CreateQueueRequest createQueueRequest = new CreateQueueRequest().withQueueName(queueName); sqs.createQueue(createQueueRequest); final GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest().withQueueName(queueName); final GetQueueUrlResult getQueueUrlResult = sqs.getQueueUrl(getQueueUrlRequest); final String queueUrl = getQueueUrlResult.getQueueUrl(); assertThat(queueUrl, containsString(queueName)); </DeepExtract> final SendMessageRequest sendMessageRequest1 = new SendMessageRequest().withQueueUrl(queueUrl).withMessageBody("hi everybody 1"); sqs.sendMessage(sendMessageRequest1); final SendMessageRequest sendMessageRequest2 = new SendMessageRequest().withQueueUrl(queueUrl).withMessageBody("hi everybody 2"); sqs.sendMessage(sendMessageRequest2); final SendMessageRequest sendMessageRequest3 = new SendMessageRequest().withQueueUrl(queueUrl).withMessageBody("hi everybody 3"); sqs.sendMessage(sendMessageRequest3); final int maxNumberOfMessages = 10; final ReceiveMessageRequest receiveMessageRequest1 = new ReceiveMessageRequest().withQueueUrl(queueUrl).withMaxNumberOfMessages(maxNumberOfMessages); final ReceiveMessageResult receiveMessageResult1 = sqs.receiveMessage(receiveMessageRequest1); final List<Message> messages1 = receiveMessageResult1.getMessages(); final SendMessageRequest sendMessageRequest4 = new SendMessageRequest().withQueueUrl(queueUrl).withMessageBody("hi everybody 4"); sqs.sendMessage(sendMessageRequest4); sqs.returnMessage(queueUrl, messages1.get(1)); final ReceiveMessageRequest receiveMessageRequest2 = new ReceiveMessageRequest().withQueueUrl(queueUrl).withMaxNumberOfMessages(maxNumberOfMessages); final ReceiveMessageResult receiveMessageResult2 = sqs.receiveMessage(receiveMessageRequest2); final List<Message> messages2 = receiveMessageResult2.getMessages(); final List<String> expectedMessageBodies = Arrays.asList(sendMessageRequest2.getMessageBody(), sendMessageRequest4.getMessageBody()); final List<String> actualMessageBodies = new ArrayList<String>(); for (Message m : messages2) { actualMessageBodies.add(m.getBody()); } assertThat(actualMessageBodies, equalTo(expectedMessageBodies)); }
aws-java-sdk-stubs
positive
1,574
public void draw() { pg.beginDraw(); group("matrix"); alphaFade(pg); splitPass(pg); pg.lights(); pg.shininess(slider("shine")); hotShader("PhongFrag.glsl", "PhongVert.glsl", pg); PVector translate = sliderXYZ("translate"); pg.translate(translate.x + width * .5f, translate.y + height * .5f, translate.z); PVector rot = sliderXYZ("rotation"); pg.rotateX(rot.x); pg.rotateY(rot.y); pg.rotateZ(rot.z + (toggle("z rotation") ? t : 0)); group("params"); int uMax = sliderInt("u", 1, 1000, 10); int vMax = sliderInt("v", 1, 1000, 10); r = slider("radius", 10); h = r * (1 + slider("height", 0)); pg.strokeWeight(slider("weight", 1)); pg.stroke(picker("stroke", 1).clr()); if (toggle("no stroke")) { pg.noStroke(); } pg.fill(picker("fill", 0).clr()); for (int uIndex = 0; uIndex < uMax; uIndex++) { group("params"); if (toggle("points")) { pg.beginShape(POINTS); } else { pg.beginShape(TRIANGLE_STRIP); } for (int vIndex = 0; vIndex <= vMax; vIndex++) { float u0 = norm(uIndex, 0, uMax); float u1 = norm(uIndex + 1, 0, uMax); float v = norm(vIndex, 0, vMax); PVector a = getVector(u0, v); pg.vertex(a.x, a.y, a.z); if (!toggle("points")) { PVector b = getVector(u1, v); pg.vertex(b.x, b.y, b.z); } } pg.endShape(); } pg.endDraw(); image(pg, 0, 0); rec(pg); gui(); }
public void draw() { pg.beginDraw(); group("matrix"); alphaFade(pg); splitPass(pg); pg.lights(); pg.shininess(slider("shine")); hotShader("PhongFrag.glsl", "PhongVert.glsl", pg); PVector translate = sliderXYZ("translate"); pg.translate(translate.x + width * .5f, translate.y + height * .5f, translate.z); PVector rot = sliderXYZ("rotation"); pg.rotateX(rot.x); pg.rotateY(rot.y); pg.rotateZ(rot.z + (toggle("z rotation") ? t : 0)); <DeepExtract> group("params"); int uMax = sliderInt("u", 1, 1000, 10); int vMax = sliderInt("v", 1, 1000, 10); r = slider("radius", 10); h = r * (1 + slider("height", 0)); pg.strokeWeight(slider("weight", 1)); pg.stroke(picker("stroke", 1).clr()); if (toggle("no stroke")) { pg.noStroke(); } pg.fill(picker("fill", 0).clr()); for (int uIndex = 0; uIndex < uMax; uIndex++) { group("params"); if (toggle("points")) { pg.beginShape(POINTS); } else { pg.beginShape(TRIANGLE_STRIP); } for (int vIndex = 0; vIndex <= vMax; vIndex++) { float u0 = norm(uIndex, 0, uMax); float u1 = norm(uIndex + 1, 0, uMax); float v = norm(vIndex, 0, vMax); PVector a = getVector(u0, v); pg.vertex(a.x, a.y, a.z); if (!toggle("points")) { PVector b = getVector(u1, v); pg.vertex(b.x, b.y, b.z); } } pg.endShape(); } </DeepExtract> pg.endDraw(); image(pg, 0, 0); rec(pg); gui(); }
ProcessingSketches
positive
1,576
@Override public String toString() { PurchaseState[] values = PurchaseState.values(); if (orderId < 0 || orderId >= values.length) { return CANCELLED; } return values[orderId]; }
@Override public String toString() { <DeepExtract> PurchaseState[] values = PurchaseState.values(); if (orderId < 0 || orderId >= values.length) { return CANCELLED; } return values[orderId]; </DeepExtract> }
android-checkout
positive
1,577
public void pop(State state, Element previousTopElement) { GLCoordinateElement prev = (GLCoordinateElement) previousTopElement; boolean shouldBeEnabled = enabled; enabled = prev.enabled; if (this.enabled == shouldBeEnabled) return; this.enabled = shouldBeEnabled; GL2 gl = GLU.getCurrentGL().getGL2(); if (shouldBeEnabled) { gl.glVertexPointer(3, GL2.GL_FLOAT, 0, coords); gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); } else { gl.glDisableClientState(GL2.GL_VERTEX_ARRAY); } }
public void pop(State state, Element previousTopElement) { GLCoordinateElement prev = (GLCoordinateElement) previousTopElement; boolean shouldBeEnabled = enabled; enabled = prev.enabled; <DeepExtract> if (this.enabled == shouldBeEnabled) return; this.enabled = shouldBeEnabled; GL2 gl = GLU.getCurrentGL().getGL2(); if (shouldBeEnabled) { gl.glVertexPointer(3, GL2.GL_FLOAT, 0, coords); gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); } else { gl.glDisableClientState(GL2.GL_VERTEX_ARRAY); } </DeepExtract> }
jogl-utils
positive
1,578
public void surfaceCreated(SurfaceHolder holder) { mSurfaceHolder = holder; if (mUri == null || mSurfaceHolder == null) { return; } Intent i = new Intent("com.android.music.musicservicecommand"); i.putExtra("command", "pause"); mContext.sendBroadcast(i); release(false); try { mMediaPlayer = new MediaPlayer(); if (mAudioSession != 0) { mMediaPlayer.setAudioSessionId(mAudioSession); } else { mAudioSession = mMediaPlayer.getAudioSessionId(); } mMediaPlayer.setOnPreparedListener(mPreparedListener); mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); mMediaPlayer.setOnCompletionListener(mCompletionListener); mMediaPlayer.setOnErrorListener(mErrorListener); mMediaPlayer.setOnInfoListener(mOnInfoListener); mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); mCurrentBufferPercentage = 0; mMediaPlayer.setDataSource(mContext, mUri, mHeaders); mMediaPlayer.setDisplay(mSurfaceHolder); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mMediaPlayer.setScreenOnWhilePlaying(true); mMediaPlayer.prepareAsync(); mCurrentState = STATE_PREPARING; attachMediaController(); } catch (IOException ex) { Log.w(TAG, "Unable to open content: " + mUri, ex); mCurrentState = STATE_ERROR; mTargetState = STATE_ERROR; mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); return; } catch (IllegalArgumentException ex) { Log.w(TAG, "Unable to open content: " + mUri, ex); mCurrentState = STATE_ERROR; mTargetState = STATE_ERROR; mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); return; } }
public void surfaceCreated(SurfaceHolder holder) { mSurfaceHolder = holder; <DeepExtract> if (mUri == null || mSurfaceHolder == null) { return; } Intent i = new Intent("com.android.music.musicservicecommand"); i.putExtra("command", "pause"); mContext.sendBroadcast(i); release(false); try { mMediaPlayer = new MediaPlayer(); if (mAudioSession != 0) { mMediaPlayer.setAudioSessionId(mAudioSession); } else { mAudioSession = mMediaPlayer.getAudioSessionId(); } mMediaPlayer.setOnPreparedListener(mPreparedListener); mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); mMediaPlayer.setOnCompletionListener(mCompletionListener); mMediaPlayer.setOnErrorListener(mErrorListener); mMediaPlayer.setOnInfoListener(mOnInfoListener); mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); mCurrentBufferPercentage = 0; mMediaPlayer.setDataSource(mContext, mUri, mHeaders); mMediaPlayer.setDisplay(mSurfaceHolder); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mMediaPlayer.setScreenOnWhilePlaying(true); mMediaPlayer.prepareAsync(); mCurrentState = STATE_PREPARING; attachMediaController(); } catch (IOException ex) { Log.w(TAG, "Unable to open content: " + mUri, ex); mCurrentState = STATE_ERROR; mTargetState = STATE_ERROR; mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); return; } catch (IllegalArgumentException ex) { Log.w(TAG, "Unable to open content: " + mUri, ex); mCurrentState = STATE_ERROR; mTargetState = STATE_ERROR; mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); return; } </DeepExtract> }
MediaNote-Android
positive
1,579
public void rotate(double theta, CompPoint _focus) { double[] pointRT = Geom.cartToPolar(this.getX() - _focus.getX(), this.getY() - _focus.getY()); double pointTheta = pointRT[1]; double pointR = pointRT[0]; double newPointTheta = pointTheta + theta; CompPoint newPoint = Geom.polarToCart(pointR, newPointTheta); this.x = newPoint.getX() + _focus.getX(); this.y = newPoint.getY() + _focus.getY(); }
public void rotate(double theta, CompPoint _focus) { double[] pointRT = Geom.cartToPolar(this.getX() - _focus.getX(), this.getY() - _focus.getY()); double pointTheta = pointRT[1]; double pointR = pointRT[0]; double newPointTheta = pointTheta + theta; CompPoint newPoint = Geom.polarToCart(pointR, newPointTheta); this.x = newPoint.getX() + _focus.getX(); <DeepExtract> this.y = newPoint.getY() + _focus.getY(); </DeepExtract> }
Codeable_Objects
positive
1,581
@Override public Object get(long timeout, TimeUnit unit) { long start = System.currentTimeMillis(); if (!this.isDone()) { this.lock.lock(); try { while (!this.isDone()) { this.doneCondition.await(2000, TimeUnit.MICROSECONDS); if (System.currentTimeMillis() - start > timeout) { throw new TimeoutRpcException("ResponseFuture.get() timeout"); } } } catch (InterruptedException ex) { throw new RpcException(ex); } finally { this.lock.unlock(); } } if (isDone()) { return this.response.getResult(); } throw new RpcException("action is not completed"); }
@Override public Object get(long timeout, TimeUnit unit) { long start = System.currentTimeMillis(); if (!this.isDone()) { this.lock.lock(); try { while (!this.isDone()) { this.doneCondition.await(2000, TimeUnit.MICROSECONDS); if (System.currentTimeMillis() - start > timeout) { throw new TimeoutRpcException("ResponseFuture.get() timeout"); } } } catch (InterruptedException ex) { throw new RpcException(ex); } finally { this.lock.unlock(); } } <DeepExtract> if (isDone()) { return this.response.getResult(); } throw new RpcException("action is not completed"); </DeepExtract> }
jim-framework
positive
1,583
@Override protected void setUp() throws Exception { super.setUp(); this.getInstrumentation().waitForIdleSync(); TestApplication app = (TestApplication) this.getInstrumentation().getTargetContext().getApplicationContext(); app.setObjectGraph(ObjectGraph.create(new TestModule())); app.inject(this); System.setProperty("dexmaker.dexcache", getInstrumentation().getTargetContext().getCacheDir().getPath()); _mockEditor = mock(SharedPreferences.Editor.class); when(_mockPreferences.edit()).thenReturn(_mockEditor); when(_mockPreferences.getString("SPEEDFRAGMENT_SPEED", getInstrumentation().getTargetContext().getString(R.string.speedfragment_speed_value))).thenReturn("1.1"); when(_mockPreferences.getString("SPEEDFRAGMENT_AVGSPEED", getInstrumentation().getTargetContext().getString(R.string.speedfragment_avgspeed_value))).thenReturn("1.2"); when(_mockPreferences.getString("SPEEDFRAGMENT_DISTANCE", getInstrumentation().getTargetContext().getString(R.string.speedfragment_distance_value))).thenReturn("1.3"); when(_mockPreferences.getString("SPEEDFRAGMENT_TIME", getInstrumentation().getTargetContext().getString(R.string.speedfragment_time_value))).thenReturn("1.4"); setActivityInitialTouchMode(false); _activity = getActivity(); startFragment(new SpeedFragment()); _speedLabel = (TextView) _activity.findViewById(R.id.speed_label); _speedText = (TextView) _activity.findViewById(R.id.speed_text); _speedUnitsLabel = (TextView) _activity.findViewById(R.id.speed_units_label); _timeLabel = (TextView) _activity.findViewById(R.id.time_label); _timeText = (TextView) _activity.findViewById(R.id.time_text); _distanceLabel = (TextView) _activity.findViewById(R.id.distance_label); _distanceText = (TextView) _activity.findViewById(R.id.distance_text); _distanceUnitsLabel = (TextView) _activity.findViewById(R.id.distance_units_label); _avgspeedLabel = (TextView) _activity.findViewById(R.id.avgspeed_label); _avgspeedText = (TextView) _activity.findViewById(R.id.avgspeed_text); _avgspeedUnitsLabel = (TextView) _activity.findViewById(R.id.avgspeed_units_label); }
@Override protected void setUp() throws Exception { super.setUp(); this.getInstrumentation().waitForIdleSync(); TestApplication app = (TestApplication) this.getInstrumentation().getTargetContext().getApplicationContext(); app.setObjectGraph(ObjectGraph.create(new TestModule())); app.inject(this); <DeepExtract> System.setProperty("dexmaker.dexcache", getInstrumentation().getTargetContext().getCacheDir().getPath()); _mockEditor = mock(SharedPreferences.Editor.class); when(_mockPreferences.edit()).thenReturn(_mockEditor); when(_mockPreferences.getString("SPEEDFRAGMENT_SPEED", getInstrumentation().getTargetContext().getString(R.string.speedfragment_speed_value))).thenReturn("1.1"); when(_mockPreferences.getString("SPEEDFRAGMENT_AVGSPEED", getInstrumentation().getTargetContext().getString(R.string.speedfragment_avgspeed_value))).thenReturn("1.2"); when(_mockPreferences.getString("SPEEDFRAGMENT_DISTANCE", getInstrumentation().getTargetContext().getString(R.string.speedfragment_distance_value))).thenReturn("1.3"); when(_mockPreferences.getString("SPEEDFRAGMENT_TIME", getInstrumentation().getTargetContext().getString(R.string.speedfragment_time_value))).thenReturn("1.4"); </DeepExtract> setActivityInitialTouchMode(false); _activity = getActivity(); startFragment(new SpeedFragment()); _speedLabel = (TextView) _activity.findViewById(R.id.speed_label); _speedText = (TextView) _activity.findViewById(R.id.speed_text); _speedUnitsLabel = (TextView) _activity.findViewById(R.id.speed_units_label); _timeLabel = (TextView) _activity.findViewById(R.id.time_label); _timeText = (TextView) _activity.findViewById(R.id.time_text); _distanceLabel = (TextView) _activity.findViewById(R.id.distance_label); _distanceText = (TextView) _activity.findViewById(R.id.distance_text); _distanceUnitsLabel = (TextView) _activity.findViewById(R.id.distance_units_label); _avgspeedLabel = (TextView) _activity.findViewById(R.id.avgspeed_label); _avgspeedText = (TextView) _activity.findViewById(R.id.avgspeed_text); _avgspeedUnitsLabel = (TextView) _activity.findViewById(R.id.avgspeed_units_label); }
JayPS-AndroidApp
positive
1,585
public Criteria andClassroomIsNull() { if ("classRoom is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("classRoom is null")); return (Criteria) this; }
public Criteria andClassroomIsNull() { <DeepExtract> if ("classRoom is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("classRoom is null")); </DeepExtract> return (Criteria) this; }
SpringBoot_EducationalMS
positive
1,586
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (mProgressBarVisible) showProgressBar(); if (mScreen != null) loadGraphs(); ViewGroup layout = (LinearLayout) getView().findViewById(R.id.graphs); layout.removeAllViews(); boolean graphsDisplayed = false; if (mScreen != null && mScreen.getGraphs() != null) { for (Graph g : mScreen.getGraphs()) { if (showGraph(g)) graphsDisplayed = true; } } if (!graphsDisplayed) { layout.removeAllViews(); TextView noGraphDataView = new TextView(getActivity()); noGraphDataView.setText(R.string.no_items_to_display); layout.addView(noGraphDataView); } }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (mProgressBarVisible) showProgressBar(); if (mScreen != null) loadGraphs(); <DeepExtract> ViewGroup layout = (LinearLayout) getView().findViewById(R.id.graphs); layout.removeAllViews(); boolean graphsDisplayed = false; if (mScreen != null && mScreen.getGraphs() != null) { for (Graph g : mScreen.getGraphs()) { if (showGraph(g)) graphsDisplayed = true; } } if (!graphsDisplayed) { layout.removeAllViews(); TextView noGraphDataView = new TextView(getActivity()); noGraphDataView.setText(R.string.no_items_to_display); layout.addView(noGraphDataView); } </DeepExtract> }
zax
positive
1,587
@Override public void enableModule() { if (!mwState.readyToClose) { byte[] bleData = Registers.buildWriteCommand(Register.ENABLE, (byte) 1); if (mwState.isRecording) { mwState.etBuilder.withDestRegister(Register.ENABLE, Arrays.copyOfRange(bleData, 2, bleData.length), false); } else { queueCommand(mwState, bleData); } } }
@Override public void enableModule() { <DeepExtract> if (!mwState.readyToClose) { byte[] bleData = Registers.buildWriteCommand(Register.ENABLE, (byte) 1); if (mwState.isRecording) { mwState.etBuilder.withDestRegister(Register.ENABLE, Arrays.copyOfRange(bleData, 2, bleData.length), false); } else { queueCommand(mwState, bleData); } } </DeepExtract> }
mongodb-iot-mqtt-example
positive
1,588
public static byte[] decrypt3DES(byte[] data, byte[] key) { if (data == null || data.length == 0 || key == null || key.length == 0) return null; try { SecretKeySpec keySpec = new SecretKeySpec(key, TripleDES_Algorithm); Cipher cipher = Cipher.getInstance(TripleDES_Transformation); SecureRandom random = new SecureRandom(); cipher.init(false ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, keySpec, random); return cipher.doFinal(data); } catch (Throwable e) { e.printStackTrace(); return null; } }
public static byte[] decrypt3DES(byte[] data, byte[] key) { <DeepExtract> if (data == null || data.length == 0 || key == null || key.length == 0) return null; try { SecretKeySpec keySpec = new SecretKeySpec(key, TripleDES_Algorithm); Cipher cipher = Cipher.getInstance(TripleDES_Transformation); SecureRandom random = new SecureRandom(); cipher.init(false ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, keySpec, random); return cipher.doFinal(data); } catch (Throwable e) { e.printStackTrace(); return null; } </DeepExtract> }
AndroidBase
positive
1,589
@Override public void setSettingList(List<PSetting> listSetting) throws RemoteException { int uid = -1; for (PSetting setting : listSetting) if (uid < 0) uid = setting.uid; else if (uid != setting.uid) throw new SecurityException(); if (uid >= 0) if (Util.getUserId(uid) != Util.getUserId(Binder.getCallingUid())) throw new SecurityException("uid=" + uid + " calling=" + Binder.getCallingUid()); int callingUid = Util.getAppId(Binder.getCallingUid()); if (callingUid != getXUid() && callingUid != Process.SYSTEM_UID) throw new SecurityException("xuid=" + mXUid + " calling=" + Binder.getCallingUid()); for (PSetting setting : listSetting) setSettingInternal(setting); }
@Override public void setSettingList(List<PSetting> listSetting) throws RemoteException { int uid = -1; for (PSetting setting : listSetting) if (uid < 0) uid = setting.uid; else if (uid != setting.uid) throw new SecurityException(); <DeepExtract> if (uid >= 0) if (Util.getUserId(uid) != Util.getUserId(Binder.getCallingUid())) throw new SecurityException("uid=" + uid + " calling=" + Binder.getCallingUid()); int callingUid = Util.getAppId(Binder.getCallingUid()); if (callingUid != getXUid() && callingUid != Process.SYSTEM_UID) throw new SecurityException("xuid=" + mXUid + " calling=" + Binder.getCallingUid()); </DeepExtract> for (PSetting setting : listSetting) setSettingInternal(setting); }
XLocation
positive
1,590
public static Bitmap compressByScale(Bitmap src, int newWidth, int newHeight, boolean recycle) { if (isEmptyBitmap(src)) { return null; } Bitmap ret = Bitmap.createScaledBitmap(src, newWidth, newHeight, true); if (recycle && !src.isRecycled()) { src.recycle(); } return ret; }
public static Bitmap compressByScale(Bitmap src, int newWidth, int newHeight, boolean recycle) { <DeepExtract> if (isEmptyBitmap(src)) { return null; } Bitmap ret = Bitmap.createScaledBitmap(src, newWidth, newHeight, true); if (recycle && !src.isRecycled()) { src.recycle(); } return ret; </DeepExtract> }
InterviewQA
positive
1,591
public RestResponse post() throws RestException { if (urlString == null) { throw new RestException("No URL is set"); } try { URLConnection connection; if (true) { connection = initURLConnection(urlString, "POST"); } else { connection = initURLConnection(urlString, "PUT"); } for (final Map.Entry<String, String> header : headers.entrySet()) { connection.setRequestProperty(header.getKey(), header.getValue()); } connection.setDoOutput(true); connection.setRequestProperty("Accept-Charset", "UTF-8"); if (body != null) { final OutputStream outputStream = connection.getOutputStream(); outputStream.write(body); outputStream.close(); } else if (!parameters.isEmpty()) { connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); final OutputStream outputStream = connection.getOutputStream(); outputStream.write(parametersToQueryString().getBytes(StandardCharsets.UTF_8)); outputStream.close(); } final int statusCode = connectionStatus(connection); final String mimeType = connection.getContentType(); final byte[] body = responseBodyBytes(connection); return new RestResponse(statusCode, mimeType, body); } catch (IOException e) { throw new RestException(e); } }
public RestResponse post() throws RestException { <DeepExtract> if (urlString == null) { throw new RestException("No URL is set"); } try { URLConnection connection; if (true) { connection = initURLConnection(urlString, "POST"); } else { connection = initURLConnection(urlString, "PUT"); } for (final Map.Entry<String, String> header : headers.entrySet()) { connection.setRequestProperty(header.getKey(), header.getValue()); } connection.setDoOutput(true); connection.setRequestProperty("Accept-Charset", "UTF-8"); if (body != null) { final OutputStream outputStream = connection.getOutputStream(); outputStream.write(body); outputStream.close(); } else if (!parameters.isEmpty()) { connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); final OutputStream outputStream = connection.getOutputStream(); outputStream.write(parametersToQueryString().getBytes(StandardCharsets.UTF_8)); outputStream.close(); } final int statusCode = connectionStatus(connection); final String mimeType = connection.getContentType(); final byte[] body = responseBodyBytes(connection); return new RestResponse(statusCode, mimeType, body); } catch (IOException e) { throw new RestException(e); } </DeepExtract> }
vault-java-driver
positive
1,592
private synchronized void initAlbum() { album.setAlbumCover(null); album.setAlbumTitle(context.getString(R.string.album_untitled)); this.browserController = browserController; this.album.setBrowserController(browserController); }
private synchronized void initAlbum() { album.setAlbumCover(null); album.setAlbumTitle(context.getString(R.string.album_untitled)); <DeepExtract> this.browserController = browserController; this.album.setBrowserController(browserController); </DeepExtract> }
Ninja
positive
1,593
@Override public int size() { return this.isEmpty() ? 0 : size0(this.tail(), 0 + 1); }
@Override public int size() { <DeepExtract> return this.isEmpty() ? 0 : size0(this.tail(), 0 + 1); </DeepExtract> }
dexx
positive
1,594
public Criteria andGoodsPriceEqualTo(Double value) { if (value == null) { throw new RuntimeException("Value for " + "goodsPrice" + " cannot be null"); } criteria.add(new Criterion("goods_price =", value)); return (Criteria) this; }
public Criteria andGoodsPriceEqualTo(Double value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "goodsPrice" + " cannot be null"); } criteria.add(new Criterion("goods_price =", value)); </DeepExtract> return (Criteria) this; }
ssmxiaomi
positive
1,595
public void openSearch(String query) { if (true) mAvoidTriggerTextWatcher = true; mSearchEditText.setText(""); mSearchEditText.append(query); mAvoidTriggerTextWatcher = false; if (SearchViewState.SEARCH == SearchViewState.NORMAL) { if (mCurrentState == SearchViewState.EDITING) { fromEditingToNormal(); } else if (mCurrentState == SearchViewState.SEARCH) { fromSearchToNormal(); } } else if (SearchViewState.SEARCH == SearchViewState.EDITING) { if (mCurrentState == SearchViewState.NORMAL) { fromNormalToEditing(); } else if (mCurrentState == SearchViewState.SEARCH) { fromSearchToEditing(); } } else if (SearchViewState.SEARCH == SearchViewState.SEARCH) { if (mCurrentState == SearchViewState.NORMAL) { fromNormalToSearch(); } else if (mCurrentState == SearchViewState.EDITING) { fromEditingToSearch(); } } }
public void openSearch(String query) { if (true) mAvoidTriggerTextWatcher = true; mSearchEditText.setText(""); mSearchEditText.append(query); mAvoidTriggerTextWatcher = false; <DeepExtract> if (SearchViewState.SEARCH == SearchViewState.NORMAL) { if (mCurrentState == SearchViewState.EDITING) { fromEditingToNormal(); } else if (mCurrentState == SearchViewState.SEARCH) { fromSearchToNormal(); } } else if (SearchViewState.SEARCH == SearchViewState.EDITING) { if (mCurrentState == SearchViewState.NORMAL) { fromNormalToEditing(); } else if (mCurrentState == SearchViewState.SEARCH) { fromSearchToEditing(); } } else if (SearchViewState.SEARCH == SearchViewState.SEARCH) { if (mCurrentState == SearchViewState.NORMAL) { fromNormalToSearch(); } else if (mCurrentState == SearchViewState.EDITING) { fromEditingToSearch(); } } </DeepExtract> }
Nibo
positive
1,596
public Properties putSku(String sku) { super.putValue(SKU_KEY, sku); return this; }
public Properties putSku(String sku) { <DeepExtract> super.putValue(SKU_KEY, sku); return this; </DeepExtract> }
analytics-android
positive
1,597
public Criteria andPictureEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "picture" + " cannot be null"); } criteria.add(new Criterion("picture =", value)); return (Criteria) this; }
public Criteria andPictureEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "picture" + " cannot be null"); } criteria.add(new Criterion("picture =", value)); </DeepExtract> return (Criteria) this; }
Maven-Spring-SpringMVC-Mybatis
positive
1,598
public final void normalize() { double[] tmp_rot = new double[9]; double[] tmp_scale = new double[3]; double[] tmp = new double[9]; tmp[0] = m00; tmp[1] = m01; tmp[2] = m02; tmp[3] = m10; tmp[4] = m11; tmp[5] = m12; tmp[6] = m20; tmp[7] = m21; tmp[8] = m22; compute_svd(tmp, tmp_scale, tmp_rot); return; this.m00 = tmp_rot[0]; this.m01 = tmp_rot[1]; this.m02 = tmp_rot[2]; this.m10 = tmp_rot[3]; this.m11 = tmp_rot[4]; this.m12 = tmp_rot[5]; this.m20 = tmp_rot[6]; this.m21 = tmp_rot[7]; this.m22 = tmp_rot[8]; }
public final void normalize() { double[] tmp_rot = new double[9]; double[] tmp_scale = new double[3]; <DeepExtract> double[] tmp = new double[9]; tmp[0] = m00; tmp[1] = m01; tmp[2] = m02; tmp[3] = m10; tmp[4] = m11; tmp[5] = m12; tmp[6] = m20; tmp[7] = m21; tmp[8] = m22; compute_svd(tmp, tmp_scale, tmp_rot); return; </DeepExtract> this.m00 = tmp_rot[0]; this.m01 = tmp_rot[1]; this.m02 = tmp_rot[2]; this.m10 = tmp_rot[3]; this.m11 = tmp_rot[4]; this.m12 = tmp_rot[5]; this.m20 = tmp_rot[6]; this.m21 = tmp_rot[7]; this.m22 = tmp_rot[8]; }
vecmath
positive
1,599
public static String createArchiveId() { try { return new String(Base64.encode(generateRandomBytes(16)), Charsets.US_ASCII.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
public static String createArchiveId() { <DeepExtract> try { return new String(Base64.encode(generateRandomBytes(16)), Charsets.US_ASCII.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } </DeepExtract> }
b1-pack
positive
1,600
public void clearChildSize() { hasChildSize = false; hasChildSize = true; if (this.childSize != DEFAULT_CHILD_SIZE) { this.childSize = DEFAULT_CHILD_SIZE; requestLayout(); } }
public void clearChildSize() { hasChildSize = false; <DeepExtract> hasChildSize = true; if (this.childSize != DEFAULT_CHILD_SIZE) { this.childSize = DEFAULT_CHILD_SIZE; requestLayout(); } </DeepExtract> }
Auro
positive
1,601
public Criteria andUsernameLessThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "username" + " cannot be null"); } criteria.add(new Criterion("userName <", value)); return (Criteria) this; }
public Criteria andUsernameLessThan(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "username" + " cannot be null"); } criteria.add(new Criterion("userName <", value)); </DeepExtract> return (Criteria) this; }
JavaWeb-WeChatMini
positive
1,603
public String getWinningMessage() { if (!hasWinner()) throw new WinnerMessageProvider.NoWinnerAvailable(); Mark winner = provider.getWinner(); return winMessagesMapper.map(winner); }
public String getWinningMessage() { <DeepExtract> if (!hasWinner()) throw new WinnerMessageProvider.NoWinnerAvailable(); </DeepExtract> Mark winner = provider.getWinner(); return winMessagesMapper.map(winner); }
BoardGames.TDD-London-School
positive
1,607
public void stateUpdated() { if (cnr != null) { cnr.halt(); cnr = null; } double mpp = 1 / zoom; double leftX = wx - mpp * getWidth() / 2; double topY = wy - mpp * getHeight() / 2; if (wg == null) { colorFunc = null; } else if (normalShadingEnabled) { NormalShadingGroundColorFunction gcf = new NormalShadingGroundColorFunction(getTerrainGroundFunction(), colorMap, mpp / 2, mpp / 2, 0.3 / mpp, 0.5); gcf.heightShadingEnabled = heightShadingEnabled; colorFunc = gcf; } else { GroundColorFunction gcf = new GroundColorFunction(getTerrainGroundFunction(), colorMap); gcf.heightShadingEnabled = heightShadingEnabled; colorFunc = gcf; } if (colorFunc != null) { startRenderer(new NoiseRenderer(colorFunc, getWidth(), getHeight(), leftX, topY, mpp, mpp)); } }
public void stateUpdated() { <DeepExtract> if (cnr != null) { cnr.halt(); cnr = null; } </DeepExtract> double mpp = 1 / zoom; double leftX = wx - mpp * getWidth() / 2; double topY = wy - mpp * getHeight() / 2; if (wg == null) { colorFunc = null; } else if (normalShadingEnabled) { NormalShadingGroundColorFunction gcf = new NormalShadingGroundColorFunction(getTerrainGroundFunction(), colorMap, mpp / 2, mpp / 2, 0.3 / mpp, 0.5); gcf.heightShadingEnabled = heightShadingEnabled; colorFunc = gcf; } else { GroundColorFunction gcf = new GroundColorFunction(getTerrainGroundFunction(), colorMap); gcf.heightShadingEnabled = heightShadingEnabled; colorFunc = gcf; } if (colorFunc != null) { startRenderer(new NoiseRenderer(colorFunc, getWidth(), getHeight(), leftX, topY, mpp, mpp)); } }
TMCMG
positive
1,608
@Test public void test01() { String input = "one"; String actual = reusableResolver.expand(input); assertEquals(input, actual); VariableResolver newInstance = new VariableResolver(environmentMap); actual = newInstance.expand(input); assertEquals(input, actual); }
@Test public void test01() { String input = "one"; <DeepExtract> String actual = reusableResolver.expand(input); assertEquals(input, actual); VariableResolver newInstance = new VariableResolver(environmentMap); actual = newInstance.expand(input); assertEquals(input, actual); </DeepExtract> }
unravl
positive
1,609
@Override public void removeColor(ItemStack stack) { NBTTagCompound nbt = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound(); nbt.setInteger("color", this.defaultColor); stack.setTagCompound(nbt); }
@Override public void removeColor(ItemStack stack) { <DeepExtract> NBTTagCompound nbt = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound(); nbt.setInteger("color", this.defaultColor); stack.setTagCompound(nbt); </DeepExtract> }
Traincraft
positive
1,611
@EventHandler public void GalactCoreCompat(final FMLPreInitializationEvent e) { LogHelper.info("Attempting to load compat. biome classes..."); for (final String clazz : this.galactCoreClasses) if (ReflectionHelper.tryLoadClass(clazz) == null) LogHelper.debug("Failed to load compat. biome class " + clazz); for (final String clazz : this.galactMarsClasses) if (ReflectionHelper.tryLoadClass(clazz) == null) LogHelper.debug("Failed to load compat. biome class " + clazz); }
@EventHandler public void GalactCoreCompat(final FMLPreInitializationEvent e) { LogHelper.info("Attempting to load compat. biome classes..."); for (final String clazz : this.galactCoreClasses) if (ReflectionHelper.tryLoadClass(clazz) == null) LogHelper.debug("Failed to load compat. biome class " + clazz); <DeepExtract> for (final String clazz : this.galactMarsClasses) if (ReflectionHelper.tryLoadClass(clazz) == null) LogHelper.debug("Failed to load compat. biome class " + clazz); </DeepExtract> }
BiomeTweaker
positive
1,612
void startSession(Date date, boolean autoCaptured) { if ((!config.shouldAutoCaptureSessions() && autoCaptured) || !config.shouldNotifyForReleaseStage() || shuttingDown.get()) { return; } Date roundedStartDate = DateUtils.roundTimeToLatestMinute(date); session.set(new Session(UUID.randomUUID().toString(), roundedStartDate)); if (isNewBatchPeriod(roundedStartDate)) { synchronized (batchCount) { if (isNewBatchPeriod(roundedStartDate)) { SessionCount newCount = new SessionCount(roundedStartDate); SessionCount prevCount = batchCount.getAndSet(newCount); if (prevCount != null && prevCount.getSessionsStarted() > 0) { enqueuedSessionCounts.add(prevCount); } } } } batchCount.get().incrementSessionsStarted(); }
void startSession(Date date, boolean autoCaptured) { if ((!config.shouldAutoCaptureSessions() && autoCaptured) || !config.shouldNotifyForReleaseStage() || shuttingDown.get()) { return; } Date roundedStartDate = DateUtils.roundTimeToLatestMinute(date); session.set(new Session(UUID.randomUUID().toString(), roundedStartDate)); <DeepExtract> if (isNewBatchPeriod(roundedStartDate)) { synchronized (batchCount) { if (isNewBatchPeriod(roundedStartDate)) { SessionCount newCount = new SessionCount(roundedStartDate); SessionCount prevCount = batchCount.getAndSet(newCount); if (prevCount != null && prevCount.getSessionsStarted() > 0) { enqueuedSessionCounts.add(prevCount); } } } } </DeepExtract> batchCount.get().incrementSessionsStarted(); }
bugsnag-java
positive
1,613
@Override public final <T> T register(T bean) { return bean; beanMap.register(bean); return bean; }
@Override public final <T> T register(T bean) { <DeepExtract> return bean; </DeepExtract> beanMap.register(bean); <DeepExtract> return bean; </DeepExtract> }
avaje-inject
positive
1,614
public static <T extends QueryEntity, R> void sequentialQueryAndProcessAll(Class<T> type, String where, Set<String> fields, Consumer<T> process) { queryForAll(type, where, fields, (batch) -> { batch.forEach(process); }, 0); }
public static <T extends QueryEntity, R> void sequentialQueryAndProcessAll(Class<T> type, String where, Set<String> fields, Consumer<T> process) { <DeepExtract> queryForAll(type, where, fields, (batch) -> { batch.forEach(process); }, 0); </DeepExtract> }
starter-kit-spring-maven
positive
1,615
@Override public List<ClientRelation> getRelationListByTargetId(String targetId) { LambdaQueryWrapper<ClientRelation> lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(ClientRelation::getTargetId, targetId); if (ObjectUtil.isNotEmpty(null)) { lambdaQueryWrapper.eq(ClientRelation::getCategory, null); } return this.list(lambdaQueryWrapper); }
@Override public List<ClientRelation> getRelationListByTargetId(String targetId) { <DeepExtract> LambdaQueryWrapper<ClientRelation> lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(ClientRelation::getTargetId, targetId); if (ObjectUtil.isNotEmpty(null)) { lambdaQueryWrapper.eq(ClientRelation::getCategory, null); } return this.list(lambdaQueryWrapper); </DeepExtract> }
xiaonuo-vue
positive
1,616
@Override public void onTransitionEnd(@NonNull Transition transition) { pager.setVisibility(VISIBLE); snapshotView.setVisibility(INVISIBLE); if (urls.size() > 1) { int posi = getRealPosition(); tv_pager_indicator.setText((posi + 1) + "/" + urls.size()); } if (isShowSaveBtn) tv_save.setVisibility(VISIBLE); photoViewContainer.isReleasing = false; }
@Override public void onTransitionEnd(@NonNull Transition transition) { pager.setVisibility(VISIBLE); snapshotView.setVisibility(INVISIBLE); <DeepExtract> if (urls.size() > 1) { int posi = getRealPosition(); tv_pager_indicator.setText((posi + 1) + "/" + urls.size()); } if (isShowSaveBtn) tv_save.setVisibility(VISIBLE); </DeepExtract> photoViewContainer.isReleasing = false; }
XPopup
positive
1,617
public static <T> Object $(T param) { T[] out = (T[]) Array.newInstance(getClass(param), 1); Array.set(out, 0, param); return out; }
public static <T> Object $(T param) { <DeepExtract> T[] out = (T[]) Array.newInstance(getClass(param), 1); Array.set(out, 0, param); return out; </DeepExtract> }
jnetrobust
positive
1,618
public Criteria andVersionLessThan(int value) { if (value == null) { throw new RuntimeException("Value for " + "version" + " cannot be null"); } criteria.add(new Criterion("version <", value)); return (Criteria) this; }
public Criteria andVersionLessThan(int value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "version" + " cannot be null"); } criteria.add(new Criterion("version <", value)); </DeepExtract> return (Criteria) this; }
oauth2-resource
positive
1,619