before
stringlengths 12
3.76M
| after
stringlengths 37
3.84M
| repo
stringlengths 1
56
| type
stringclasses 1
value |
|---|---|---|---|
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));
}
|
<DeepExtract>
while (reader.ready()) {
final String headerLine;
headerLine = reader.readLine();
if (CRLF.equals(headerLine) || "".equals(headerLine)) {
break;
}
}
</DeepExtract>
|
selenium-grid
|
positive
|
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;
}
|
<DeepExtract>
if (mWakeLock != null) {
if (false && !mWakeLock.isHeld()) {
mWakeLock.acquire();
} else if (!false && mWakeLock.isHeld()) {
mWakeLock.release();
}
}
mStayAwake = false;
updateSurfaceScreenOn();
</DeepExtract>
<DeepExtract>
if (mSurfaceHolder != null)
mSurfaceHolder.setKeepScreenOn(mScreenOnWhilePlaying && mStayAwake);
</DeepExtract>
<DeepExtract>
if (mFD != null) {
try {
mFD.close();
} catch (IOException e) {
e.printStackTrace();
}
mFD = null;
}
</DeepExtract>
<DeepExtract>
mOnPreparedListener = null;
mOnFreshVideo = null;
mOnBufferingUpdateListener = null;
mOnCompletionListener = null;
mOnSeekCompleteListener = null;
mOnErrorListener = null;
mOnInfoListener = null;
mOnVideoSizeChangedListener = null;
mOnHWRenderFailedListener = null;
</DeepExtract>
|
dttv-android
|
positive
|
private static String getFieldDesc(ConstantPool constantPool, int index) {
ConstantPoolInfo_FieldRef fieldRef = (ConstantPoolInfo_FieldRef) constantPool.get(index);
int nameAndTypeIndex = fieldRef.getNameAndTypeIndex();
ConstantPoolInfo_NameAndType nameAndTypeRef = (ConstantPoolInfo_NameAndType) constantPool.get(nameAndTypeIndex);
int descriptorIndex = nameAndTypeRef.getDescriptorIndex();
ConstantPoolInfo_Utf8 utf8 = (ConstantPoolInfo_Utf8) constantPool.get(descriptorIndex);
String descriptor = utf8.getString();
String normalizedDesc = descriptor.replaceAll("L[^;]*;", "L");
normalizedDesc = normalizedDesc.replaceAll("\\[+", "\\[");
normalizedDesc = normalizedDesc.replaceAll("\\[[^\\[]", "\\[");
normalizedDesc = normalizedDesc.replaceAll("V", "");
return normalizedDesc;
}
|
<DeepExtract>
String normalizedDesc = descriptor.replaceAll("L[^;]*;", "L");
normalizedDesc = normalizedDesc.replaceAll("\\[+", "\\[");
normalizedDesc = normalizedDesc.replaceAll("\\[[^\\[]", "\\[");
normalizedDesc = normalizedDesc.replaceAll("V", "");
return normalizedDesc;
</DeepExtract>
|
BASICCompiler
|
positive
|
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);
}
|
<DeepExtract>
if (refreshItem != null) {
View view = refreshItem.getActionView();
if (view != null) {
view.clearAnimation();
refreshItem.setActionView(null);
}
}
</DeepExtract>
|
Android_Expression_Package
|
positive
|
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;
}
|
<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
|
public SpannableText setBackgroundColor(int color) {
setSpan(new BackgroundColorSpan(color), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
return this;
return this;
}
|
<DeepExtract>
setSpan(new BackgroundColorSpan(color), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
return this;
</DeepExtract>
|
Utils-Everywhere
|
positive
|
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();
}
|
<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
|
@Override
public void startSession(String appKey) {
if (isDebug) {
Log.d(TAG, "startSession invoked!");
}
MobclickAgent.onResume(mContext);
}
|
<DeepExtract>
if (isDebug) {
Log.d(TAG, "startSession invoked!");
}
</DeepExtract>
|
HelloRuby
|
positive
|
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);
}
|
<DeepExtract>
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);
</DeepExtract>
<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>
|
MobileInfo
|
positive
|
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]);
}
|
<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
|
@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();
}
}
|
<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
|
@Override
public CampaignResponse method() {
return executeSyncApiCall(api.updateLoyaltyCampaign(id, updateCampaign));
}
|
<DeepExtract>
return executeSyncApiCall(api.updateLoyaltyCampaign(id, updateCampaign));
</DeepExtract>
|
voucherify-java-sdk
|
positive
|
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;
}
}
|
<DeepExtract>
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;
</DeepExtract>
<DeepExtract>
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);
</DeepExtract>
<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>
<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
|
@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());
});
}
|
<DeepExtract>
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>
<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
|
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;
}
|
<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>
|
oauth4j
|
positive
|
protected SQL buildInsertStatement(DAO dao, ModelMetaData meta, ModelDef model, Query query) {
String schema = model.getNamespace();
return getDBElementName(model, schema, "\"");
String table;
if (model == null)
table = null;
String tableName = model.getTableName();
if (caseSensitive()) {
table = tableName;
}
if (tableName == null) {
tableName = model.getModelName();
}
if (model.isCaseSensitive() || SpecialCase.isSpecial(tableName)) {
table = "\"" + model.getTableName() + "\"";
} else {
table = tableName;
}
String[] columns = model.getAttributes();
String[] correctedColumns = new String[columns.length];
String[] ignoredColumns = dao.get_IgnoreColumn();
String[] curatedIgnoredColumns;
if (ignoredColumns == null) {
curatedIgnoredColumns = null;
} else {
String[] curated = new String[ignoredColumns.length];
for (int i = 0; i < ignoredColumns.length; i++) {
if (ignoredColumns[i] != null) {
String[] splinters = ignoredColumns[i].split("\\.");
if (splinters != null && splinters.length > 0) {
String last = splinters[splinters.length - 1];
curated[i] = last;
}
}
}
curatedIgnoredColumns = curated;
}
String[] defaultedColumValues = dao.get_DefaultedColumnValues();
for (int i = 0; i < columns.length; i++) {
correctedColumns[i] = getDBElementName(model, columns[i]);
}
if (schema != null && useSchema()) {
table = schema + "." + table;
}
SQL sql = INSERT().INTO(table);
sql.openParen();
if (columns != null) {
List<String> finalColumns = new ArrayList<String>();
for (int c = 0; c < columns.length; c++) {
if (!CStringUtils.inArray(curatedIgnoredColumns, columns[c])) {
finalColumns.add(columns[c]);
}
if (CStringUtils.inArray(defaultedColumValues, columns[c])) {
sql.keyword("DEFAULT");
}
}
sql.FIELD(finalColumns.toArray(new String[finalColumns.size()]));
}
sql.closeParen();
if (query != null) {
SQL sql2 = buildSQL(meta, query, false);
sql.FIELD(sql2);
} else {
sql.VALUES().openParen();
boolean doComma = false;
for (int i = 0; i < columns.length; i++) {
if (!CStringUtils.inArray(curatedIgnoredColumns, columns[i])) {
Object value = null;
if (dao != null) {
value = dao.get_Value(columns[i]);
}
if (supportPreparedStatement()) {
if (doComma) {
sql.comma();
} else {
doComma = true;
}
sql.VALUE(value);
} else {
sql.FIELD("'" + (value != null ? value.toString() : null) + "'");
}
}
}
sql.closeParen();
}
return sql;
}
|
<DeepExtract>
return getDBElementName(model, schema, "\"");
</DeepExtract>
<DeepExtract>
String table;
if (model == null)
table = null;
String tableName = model.getTableName();
if (caseSensitive()) {
table = tableName;
}
if (tableName == null) {
tableName = model.getModelName();
}
if (model.isCaseSensitive() || SpecialCase.isSpecial(tableName)) {
table = "\"" + model.getTableName() + "\"";
} else {
table = tableName;
}
</DeepExtract>
<DeepExtract>
String[] curatedIgnoredColumns;
if (ignoredColumns == null) {
curatedIgnoredColumns = null;
} else {
String[] curated = new String[ignoredColumns.length];
for (int i = 0; i < ignoredColumns.length; i++) {
if (ignoredColumns[i] != null) {
String[] splinters = ignoredColumns[i].split("\\.");
if (splinters != null && splinters.length > 0) {
String last = splinters[splinters.length - 1];
curated[i] = last;
}
}
}
curatedIgnoredColumns = curated;
}
</DeepExtract>
|
orm
|
positive
|
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;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "userName" + " cannot be null");
}
criteria.add(new Criterion("user_name >", value));
</DeepExtract>
|
SSM_BookSystem
|
positive
|
public String getTemplateDisableWarningUnused() {
return codeTemplates.getProperty("DisableWarningUnused") == null ? "" : codeTemplates.getProperty("DisableWarningUnused");
}
|
<DeepExtract>
return codeTemplates.getProperty("DisableWarningUnused") == null ? "" : codeTemplates.getProperty("DisableWarningUnused");
</DeepExtract>
|
OpenCOLLADA
|
positive
|
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;
}
}
|
<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
|
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;
}
|
<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
|
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;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "userId" + " cannot be null");
}
criteria.add(new Criterion("user_id =", value));
</DeepExtract>
|
webim
|
positive
|
@Override
public void refreshSuccess() {
mHeaderView.stopNestedAnim();
mFooterView.stopNestedAnim();
return super.stopNestedAnim();
mHeaderView.setState(IState.STATE_SUCCESS);
mFooterView.setState(IState.STATE_NONE);
}
|
<DeepExtract>
mHeaderView.stopNestedAnim();
mFooterView.stopNestedAnim();
return super.stopNestedAnim();
</DeepExtract>
|
PullLayout
|
positive
|
@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);
}
}
|
<DeepExtract>
if (path.charAt(0) == '/') {
path = path.substring(1);
}
return path;
</DeepExtract>
|
computoser
|
positive
|
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;
}
|
<DeepExtract>
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;
</DeepExtract>
<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>
|
Android-Keyboard
|
positive
|
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);
}
|
<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>
|
hugegraph-loader
|
positive
|
public com.google.assistant.embedded.v1alpha2.AudioOutConfigOrBuilder getAudioOutConfigOrBuilder() {
return audioOutConfig_ == null ? com.google.assistant.embedded.v1alpha2.AudioOutConfig.getDefaultInstance() : audioOutConfig_;
}
|
<DeepExtract>
return audioOutConfig_ == null ? com.google.assistant.embedded.v1alpha2.AudioOutConfig.getDefaultInstance() : audioOutConfig_;
</DeepExtract>
|
google-assistant-java-demo
|
positive
|
void validateDirectionTo(DirectionPoint point) {
to = point;
fragment.showSelectedDirectionTo(point, venueLanguage);
if (from != null && to != null) {
startDirection();
}
}
|
<DeepExtract>
if (from != null && to != null) {
startDirection();
}
</DeepExtract>
|
mapwize-ui-android
|
positive
|
@Override
public String action(Jedis jedis) {
return execute(new JedisAction<String>() {
@Override
public String action(Jedis jedis) {
return jedis.rpoplpush(sourceKey, destinationKey);
}
});
}
|
<DeepExtract>
return execute(new JedisAction<String>() {
@Override
public String action(Jedis jedis) {
return jedis.rpoplpush(sourceKey, destinationKey);
}
});
</DeepExtract>
|
Wish
|
positive
|
public void listCleared() {
currentAlbums.clear();
mode = Mode.EMPTY;
CurrentListState state = getState();
for (CurrentListListener listener : listeners) {
listener.stateChanged(state);
}
allowAlbumReload = true;
}
|
<DeepExtract>
CurrentListState state = getState();
for (CurrentListListener listener : listeners) {
listener.stateChanged(state);
}
allowAlbumReload = true;
</DeepExtract>
|
HypnosMusicPlayer
|
positive
|
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;
}
|
<DeepExtract>
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>
<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>
|
dev-ref
|
positive
|
public final void setDoubleTapZoomDpi(int dpi) {
DisplayMetrics metrics = getResources().getDisplayMetrics();
float averageDpi = (metrics.xdpi + metrics.ydpi) / 2;
this.doubleTapZoomScale = averageDpi / dpi;
}
|
<DeepExtract>
this.doubleTapZoomScale = averageDpi / dpi;
</DeepExtract>
|
SurveyOnUCMap
|
positive
|
public Invitation toInvitation() {
try {
T instance = clazz.newInstance();
this.copyTo(instance);
return instance;
} catch (Exception e) {
return null;
}
}
|
<DeepExtract>
try {
T instance = clazz.newInstance();
this.copyTo(instance);
return instance;
} catch (Exception e) {
return null;
}
</DeepExtract>
|
firestream-android
|
positive
|
private boolean existsLegacyTqExe(Path basePath) {
return Paths.get(basePath.toString(), DATABASE_DIR).toFile().isDirectory() && Paths.get(basePath.toString(), "Titan Quest.exe").toFile().exists();
}
|
<DeepExtract>
return Paths.get(basePath.toString(), DATABASE_DIR).toFile().isDirectory() && Paths.get(basePath.toString(), "Titan Quest.exe").toFile().exists();
</DeepExtract>
|
tqrespec
|
positive
|
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();
}
|
<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
|
@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);
}
}
|
<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
|
@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();
}
|
<DeepExtract>
SharedPreferences.Editor edit = sp.edit();
edit.putInt("vibra", i);
edit.apply();
</DeepExtract>
|
DCTimer-Android
|
positive
|
@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));
}
});
}
}
}
|
<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
|
@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);
}
|
<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>
|
PayPal-Java-SDK
|
positive
|
public void ResumeGame() {
super.ResumeGame();
if (_timer != null) {
_timer.cancel();
_timer = null;
}
if (_updateRate != 0 && !_suspended) {
_timer = new GameTimer(_updateRate);
}
}
|
<DeepExtract>
if (_timer != null) {
_timer.cancel();
_timer = null;
}
if (_updateRate != 0 && !_suspended) {
_timer = new GameTimer(_updateRate);
}
</DeepExtract>
|
monkey
|
positive
|
@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")));
}
|
<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
|
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;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "dzdh1" + " cannot be null");
}
criteria.add(new Criterion("dzdh1 <>", value));
</DeepExtract>
|
einvoice
|
positive
|
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;
}
|
<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
|
public ParserRule getStatemachineRule() {
return rule;
}
|
<DeepExtract>
return rule;
</DeepExtract>
|
Xtext-Sirius-integration
|
positive
|
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;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "type" + " cannot be null");
}
criteria.add(new Criterion("type =", value));
</DeepExtract>
|
community
|
positive
|
public static void main(String[] args) {
PairManager manager1 = new PairManager1();
PairManager manager2 = new PairManager2();
testPair(manager1, manager2);
}
|
<DeepExtract>
PairManager manager1 = new PairManager1();
PairManager manager2 = new PairManager2();
testPair(manager1, manager2);
</DeepExtract>
|
ExerciseJava
|
positive
|
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;
}
|
<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
|
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;
}
|
<DeepExtract>
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>
<DeepExtract>
mBody = new ByteArrayInputStream(theParams.toString().getBytes(Charsets.UTF_8));
return this;
</DeepExtract>
|
Empire
|
positive
|
public long expires() {
return dateHeader(HEADER_EXPIRES, -1L);
}
|
<DeepExtract>
return dateHeader(HEADER_EXPIRES, -1L);
</DeepExtract>
|
ProtocolSupportPocketStuff
|
positive
|
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;
}
|
<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>
|
3Dscript
|
positive
|
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);
}
|
<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
|
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);
}
|
<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>
|
DroidStack
|
positive
|
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;
}
|
<DeepExtract>
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(2);
getCOMObject().call(callObject);
</DeepExtract>
|
OPC_Client
|
positive
|
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;
}
|
<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
|
public void hideWIFI() {
this.mNetworkTextView.setVisibility(View.VISIBLE);
this.mBatteryView.setStatus(UIWIFIView.STATUS_NONE);
}
|
<DeepExtract>
this.mBatteryView.setStatus(UIWIFIView.STATUS_NONE);
</DeepExtract>
|
Auie
|
positive
|
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;
}
|
<DeepExtract>
if ("roleName is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("roleName is null"));
</DeepExtract>
|
examination_system-
|
positive
|
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();
}
|
<DeepExtract>
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);
}
</DeepExtract>
<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
|
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);
}
}
|
<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
|
public void settingsWarningDialogShown() {
mHasLoggingInfo = true;
mContext.sendBroadcast(newLoggingBroadcast(LoggingEvents.VoiceIme.SETTINGS_WARNING_DIALOG_SHOWN));
}
|
<DeepExtract>
mHasLoggingInfo = true;
</DeepExtract>
|
Gingerbread-Keyboard
|
positive
|
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));
}
|
<DeepExtract>
if (true) {
masterTokenList.put(Token.groupedToken("Atomic", atomicSet).getTokenName(), Token.groupedToken("Atomic", atomicSet));
}
tokenList.put(Token.groupedToken("Atomic", atomicSet).getTokenName(), Token.groupedToken("Atomic", atomicSet));
</DeepExtract>
<DeepExtract>
if (true) {
masterTokenList.put(Token.groupedToken("Numeric", numericSet).getTokenName(), Token.groupedToken("Numeric", numericSet));
}
tokenList.put(Token.groupedToken("Numeric", numericSet).getTokenName(), Token.groupedToken("Numeric", numericSet));
</DeepExtract>
<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
|
protected static CodeRangeBuffer setAllMultiByteRange(ScanEnvironment env, CodeRangeBuffer pbuf) {
return addCodeRangeToBuff(pbuf, env, mbcodeStartPosition(env.enc), LAST_CODE_POINT, true);
}
|
<DeepExtract>
return addCodeRangeToBuff(pbuf, env, mbcodeStartPosition(env.enc), LAST_CODE_POINT, true);
</DeepExtract>
|
joni
|
positive
|
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;
}
|
<DeepExtract>
return super.mergeUnknownFields(other.getUnknownFields());
</DeepExtract>
|
FightingICE
|
positive
|
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;
}
|
<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
|
@Override
public DefaultMethodsCollection<Size, A> tail() {
return new DefaultMethodsCollection<>(delegate.tail());
}
|
<DeepExtract>
return new DefaultMethodsCollection<>(delegate.tail());
</DeepExtract>
|
shoki
|
positive
|
public <T> void waitUntil(final T target, final Matcher<T> condition, int timeoutInSeconds) {
awaitCondition(null, () -> condition.matches(target), timeoutInSeconds);
}
|
<DeepExtract>
awaitCondition(null, () -> condition.matches(target), timeoutInSeconds);
</DeepExtract>
|
javatrove
|
positive
|
@Deprecated
public java.util.Map<String, GrpcService.InferParameter> getParameters() {
return internalGetParameters().getMap();
}
|
<DeepExtract>
return internalGetParameters().getMap();
</DeepExtract>
|
dl_inference
|
positive
|
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;
}
|
<DeepExtract>
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>
<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>
|
cocostudio-ui-libgdx
|
positive
|
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();
}
|
<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
|
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());
}
|
<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
|
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;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "totalprice" + " cannot be null");
}
criteria.add(new Criterion("totalprice <=", value));
</DeepExtract>
|
PetStore
|
positive
|
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();
}
}
|
<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
|
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);
}
|
<DeepExtract>
return (int) Math.ceil(((((double) (int) (get - System.currentTimeMillis()) / 1000D) / 60D) / 60D) / 24D);
</DeepExtract>
|
Residence
|
positive
|
@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;
}
|
<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>
|
developer-be
|
positive
|
public void logForm() {
StringBuilder b = new StringBuilder("\n");
formResult.getFieldResults().forEach(entry -> {
Field container = entry.getKey();
FieldResult result = entry.getValue();
if (container.fieldType instanceof SingleFieldType) {
appendSingleType(b, container, result, "");
} else {
appendSingleType(b, container, result, "");
debugOutput(result.getChilds(), b, "" + "---- ");
}
});
return "Form valid: " + formResult.isValid() + "\n " + b.toString();
logger.log(b.toString());
}
|
<DeepExtract>
formResult.getFieldResults().forEach(entry -> {
Field container = entry.getKey();
FieldResult result = entry.getValue();
if (container.fieldType instanceof SingleFieldType) {
appendSingleType(b, container, result, "");
} else {
appendSingleType(b, container, result, "");
debugOutput(result.getChilds(), b, "" + "---- ");
}
});
return "Form valid: " + formResult.isValid() + "\n " + b.toString();
</DeepExtract>
|
jWebForm
|
positive
|
public static byte[] gzipString(final String str, final String encType) throws IOException {
final byte[] stringData = str.getBytes(encType);
return gzipBytes(stringData, 0, stringData.length);
}
|
<DeepExtract>
return gzipBytes(stringData, 0, stringData.length);
</DeepExtract>
|
hodor
|
positive
|
@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));
}
|
<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>
|
aws-java-sdk-stubs
|
positive
|
@Override
public void onResponse(ArrayList<Picture> response) {
StringBuilder sb = new StringBuilder();
for (Picture joke : response) {
sb.append("comment-" + joke.getComment_ID() + ",");
}
RequestManager.addRequest(new Request4CommentCounts(CommentNumber.getCommentCountsURL(sb.toString()), new Response.Listener<ArrayList<CommentNumber>>() {
@Override
public void onResponse(ArrayList<CommentNumber> response) {
mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null);
mLoadFinisCallBack.loadFinish(null);
for (int i = 0; i < response.size(); i++) {
response.get(i).setComment_counts(response.get(i).getComments() + "");
}
if (page == 1) {
PictureAdapter.this.pictures.clear();
PictureCache.getInstance(mActivity).clearAllCache();
}
PictureAdapter.this.pictures.addAll(response);
notifyDataSetChanged();
PictureCache.getInstance(mActivity).addResultCache(JSONParser.toString(response), page);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
ShowToast.Short(ConstantString.LOAD_FAILED);
mLoadFinisCallBack.loadFinish(null);
mLoadResultCallBack.onError(LoadResultCallBack.ERROR_NET, error.getMessage());
}
}), mActivity);
}
|
<DeepExtract>
StringBuilder sb = new StringBuilder();
for (Picture joke : response) {
sb.append("comment-" + joke.getComment_ID() + ",");
}
RequestManager.addRequest(new Request4CommentCounts(CommentNumber.getCommentCountsURL(sb.toString()), new Response.Listener<ArrayList<CommentNumber>>() {
@Override
public void onResponse(ArrayList<CommentNumber> response) {
mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null);
mLoadFinisCallBack.loadFinish(null);
for (int i = 0; i < response.size(); i++) {
response.get(i).setComment_counts(response.get(i).getComments() + "");
}
if (page == 1) {
PictureAdapter.this.pictures.clear();
PictureCache.getInstance(mActivity).clearAllCache();
}
PictureAdapter.this.pictures.addAll(response);
notifyDataSetChanged();
PictureCache.getInstance(mActivity).addResultCache(JSONParser.toString(response), page);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
ShowToast.Short(ConstantString.LOAD_FAILED);
mLoadFinisCallBack.loadFinish(null);
mLoadResultCallBack.onError(LoadResultCallBack.ERROR_NET, error.getMessage());
}
}), mActivity);
</DeepExtract>
|
JianDan
|
positive
|
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();
}
|
<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>
|
ProcessingSketches
|
positive
|
@Override
public String toString() {
PurchaseState[] values = PurchaseState.values();
if (orderId < 0 || orderId >= values.length) {
return CANCELLED;
}
return values[orderId];
}
|
<DeepExtract>
PurchaseState[] values = PurchaseState.values();
if (orderId < 0 || orderId >= values.length) {
return CANCELLED;
}
return values[orderId];
</DeepExtract>
|
android-checkout
|
positive
|
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);
}
}
|
<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
|
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;
}
}
|
<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
|
@Override
public final void onWebsocketMessage(WebSocket conn, String message) {
}
|
<DeepExtract>
</DeepExtract>
|
raspberryjammod
|
positive
|
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();
}
|
<DeepExtract>
this.x = newPoint.getX() + _focus.getX();
</DeepExtract>
<DeepExtract>
this.y = newPoint.getY() + _focus.getY();
</DeepExtract>
|
Codeable_Objects
|
positive
|
public double getVelocityMaximum() {
return (Double.parseDouble(decimalFormat.format(velocityMaximum)));
}
|
<DeepExtract>
return (Double.parseDouble(decimalFormat.format(velocityMaximum)));
</DeepExtract>
|
tgFX
|
positive
|
@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");
}
|
<DeepExtract>
if (isDone()) {
return this.response.getResult();
}
throw new RpcException("action is not completed");
</DeepExtract>
|
jim-framework
|
positive
|
public void mousePressed(PInputEvent event) {
synchronized (swaplock) {
bswap = !bswap;
}
canvas = getCanvas();
canvas.getLayer().removeAllChildren();
int nmaxcol = 0;
float frecwidth = (float) 150.0;
int OFFSET = 0;
ArrayList sigrows;
final STEM_DataSet rowset, colset;
PNode[] rownodes, colnodes;
String sztexttop, sztextleft;
synchronized (swaplock) {
if (bswap) {
sigrows = theCompareInfo.sigrowsswap;
colset = theCompareInfo.origset;
rowset = theCompareInfo.comparesetfmnel;
rowplotpanel = theCompareInfo.compareframe.thegeneplotpanel;
colplotpanel = thegeneplotpanel;
colnodes = profilenodes;
rownodes = theCompareInfo.compareframe.profilenodes;
sztexttop = "Original Set " + szprofileclusterCAP;
sztextleft = "Comparison Set " + szprofileclusterCAP;
szother = "comparison";
} else {
sigrows = theCompareInfo.sigrows;
rowset = theCompareInfo.origset;
colset = theCompareInfo.comparesetfmnel;
rownodes = profilenodes;
colnodes = theCompareInfo.compareframe.profilenodes;
colplotpanel = theCompareInfo.compareframe.thegeneplotpanel;
rowplotpanel = thegeneplotpanel;
sztextleft = "Original Set " + szprofileclusterCAP;
sztexttop = "Comparison Set " + szprofileclusterCAP;
szother = "original";
}
}
PText comparetext = new PText(sztexttop);
comparetext.setFont(new Font("times", Font.PLAIN, 14));
comparetext.translate(3.0 * SCREENWIDTH / 18.0, 0);
canvas.getLayer().addChild(comparetext);
PText originaltext = new PText(sztextleft);
originaltext.setFont(new Font("times", Font.PLAIN, 14));
originaltext.translate(0, SCREENHEIGHT / 2.0);
originaltext.rotate(-Math.PI / 2);
canvas.getLayer().addChild(originaltext);
int nsigrows = sigrows.size();
if (nsigrows >= 2) {
PText comparetext2 = new PText(sztexttop);
comparetext2.setFont(new Font("times", Font.PLAIN, 14));
comparetext2.translate(12.0 * SCREENWIDTH / 18.0, 0);
canvas.getLayer().addChild(comparetext2);
PText originaltext2 = new PText(sztextleft);
originaltext2.setFont(new Font("times", Font.PLAIN, 14));
originaltext2.translate(SCREENWIDTH / 2.0 + CAPOFFSET, SCREENHEIGHT / 2.0);
originaltext2.rotate(-Math.PI / 2);
canvas.getLayer().addChild(originaltext2);
}
for (int nrow = 0; nrow < nsigrows; nrow++) {
CompareInfo.CompareInfoRow cir = (CompareInfo.CompareInfoRow) sigrows.get(nrow);
if (cir.sigprofiles.size() >= nmaxcol) {
nmaxcol = cir.sigprofiles.size();
}
}
CompareInfo.CompareInfoRow[] sigrowsArray = new CompareInfo.CompareInfoRow[nsigrows];
for (int nrowindex = 0; nrowindex < sigrowsArray.length; nrowindex++) {
sigrowsArray[nrowindex] = (CompareInfo.CompareInfoRow) sigrows.get(nrowindex);
}
if (nsort == SORTSIG) {
Arrays.sort(sigrowsArray, new SigRowComparator());
} else if (nsort == SORTSUPRISE) {
Arrays.sort(sigrowsArray, new SupriseRowComparator());
}
double dheight = 20;
if (nsigrows > 0) {
dheight = Math.max(Math.min((SCREENHEIGHT - BUFFER) * 2 / nsigrows, (SCREENWIDTH / 2 - BUFFER) / (nmaxcol + 1)), 20);
}
for (int nrow = 0; nrow < nsigrows; nrow++) {
double dxoffset, dyoffset;
final CompareInfo.CompareInfoRow cir = (CompareInfo.CompareInfoRow) sigrowsArray[nrow];
PNode node = (PNode) rownodes[cir.nprofile].clone();
node.scale((dheight) / (node.getScale() * node.getHeight()));
if (nrow < Math.ceil(nsigrows / 2.0)) {
dxoffset = CAPOFFSET / node.getScale();
dyoffset = node.getHeight() * nrow + CAPOFFSET / node.getScale();
} else {
dxoffset = 1 / node.getScale() * SCREENWIDTH / 2 + 2 * CAPOFFSET / node.getScale();
dyoffset = node.getHeight() * (nrow - Math.ceil(nsigrows / 2.0)) + CAPOFFSET / node.getScale();
}
String szcountLabel = "" + (int) rowset.countassignments[cir.nprofile];
PText counttext = new PText(szcountLabel);
counttext.setFont(new Font("times", Font.PLAIN, (int) (Math.ceil(node.getHeight() / 6))));
counttext.translate(1, node.getHeight() - node.getHeight() / 4);
node.addChild(counttext);
node.translate(dxoffset, dyoffset);
if (nrow == 0) {
double dwidth = (float) (node.getWidth() * node.getScale());
double dtheight = Math.ceil(nsigrows / 2.0) * (float) (node.getHeight() * node.getScale());
PNode line = PPath.createRectangle((float) (CAPOFFSET + dwidth + 1.5 * node.getScale()), (float) CAPOFFSET, (float) (6 * node.getScale()), (float) (dtheight));
line.setPaint(ST.buttonColor);
canvas.getLayer().addChild(line);
} else if (nrow == Math.ceil(nsigrows / 2.0)) {
double dscale = node.getScale();
double dwidth = (float) (node.getWidth() * dscale);
double dtheight = (nsigrows - Math.ceil(nsigrows / 2.0)) * (float) (node.getHeight() * dscale);
PNode linemid = PPath.createRectangle((float) (2 * CAPOFFSET + dwidth + SCREENWIDTH / 2.0 + 1.5 * dscale), (float) CAPOFFSET, (float) (6 * dscale), (float) (dtheight));
linemid.setPaint(ST.buttonColor);
canvas.getLayer().addChild(linemid);
float flast = (float) ((CAPOFFSET / dscale + 10 + node.getHeight() * (nmaxcol + 1)) * dscale);
float fmid = (float) (flast + (SCREENWIDTH / 2.0 + CAPOFFSET / dscale - flast) / 2);
PNode line = PPath.createRectangle(fmid, (float) 5, (float) (6 * dscale), (float) (SCREENHEIGHT - BUFFER + 15));
line.setPaint(ST.lightBlue);
canvas.getLayer().addChild(line);
}
node.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
if (event.getButton() == MouseEvent.BUTTON1) {
final ProfileGui pg;
pg = new ProfileGui(rowset, cir.nprofile, null, null, -1, null, null, null, rowplotpanel, cf);
pg.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
pg.dispose();
}
public void windowOpened(WindowEvent we) {
pg.repaint();
}
});
pg.setLocation(20, 50);
pg.setSize(new Dimension(SCREENWIDTH, SCREENHEIGHT));
pg.setVisible(true);
}
}
});
canvas.getLayer().addChild(node);
ArrayList compareprofiles = cir.sigprofiles;
int ncols = compareprofiles.size();
CompareInfo.CompareInfoRec[] cirecArray = new CompareInfo.CompareInfoRec[ncols];
for (int ncolindex = 0; ncolindex < cirecArray.length; ncolindex++) {
cirecArray[ncolindex] = (CompareInfo.CompareInfoRec) compareprofiles.get(ncolindex);
}
if (nsort == SORTSIG) {
Arrays.sort(cirecArray, new SigComparator());
} else if (nsort == SORTSUPRISE) {
Arrays.sort(cirecArray, new SupriseComparator(cir.nprofile));
}
for (int ncolindex = 0; ncolindex < ncols; ncolindex++) {
final CompareInfo.CompareInfoRec cirec = (CompareInfo.CompareInfoRec) cirecArray[ncolindex];
PNode colnode = (PNode) colnodes[cirec.nprofile].clone();
colnode.scale((dheight) / (colnode.getScale() * colnode.getHeight()));
colnode.translate(10 + dxoffset + colnode.getHeight() * (ncolindex + 1), dyoffset);
String szLabel = ((int) cirec.dmatch) + ";" + MAINGUI2.doubleToSz(cirec.dpval);
PText text = new PText(szLabel);
text.setFont(new Font("times", Font.PLAIN, (int) (Math.ceil(colnode.getHeight() / 6))));
text.translate(1, 3 * colnode.getHeight() / 4);
colnode.addChild(text);
NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
nf.setMinimumFractionDigits(2);
nf.setMaximumFractionDigits(2);
String szcorrLabel = nf.format(cirec.dcorrval);
PText corrtext = new PText(szcorrLabel);
corrtext.setFont(new Font("times", Font.PLAIN, (int) (Math.ceil(colnode.getHeight() / 6))));
corrtext.translate(4 * colnode.getWidth() / 7, -1);
colnode.addChild(corrtext);
final String szIntersect = MAINGUI2.doubleToSz(cirec.dmatch) + " of the " + MAINGUI2.doubleToSz(rowset.countassignments[cir.nprofile]) + " genes assigned to Profile " + cir.nprofile + " in the " + szother + " experiment were also assigned to this profile (p-value =" + MAINGUI2.doubleToSz(cirec.dpval) + ")";
colnode.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
if (event.getButton() == MouseEvent.BUTTON1) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
final ProfileGui pg;
pg = new ProfileGui(colset, cirec.nprofile, null, cirec.inames, cir.nprofile, szIntersect, null, null, colplotpanel, cf);
pg.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
pg.dispose();
}
public void windowOpened(WindowEvent we) {
pg.repaint();
}
});
pg.setLocation(20, 50);
pg.setSize(new Dimension(SCREENWIDTH, SCREENHEIGHT));
pg.setVisible(true);
}
});
}
}
});
canvas.getLayer().addChild(colnode);
}
}
PNode supriseButton = PPath.createRectangle((float) 0.0, (float) 0.0, frecwidth, (float) 18.0);
supriseButton.translate(4 * (SCREENWIDTH + OFFSET) / 5 - 100, SCREENHEIGHT - 65);
PText thesupriseText = new PText("Order By Correlation");
thesupriseText.setFont(new Font("times", Font.PLAIN, 12));
thesupriseText.translate(23, 2);
supriseButton.setPaint(ST.buttonColor);
supriseButton.addChild(thesupriseText);
canvas.getLayer().addChild(supriseButton);
supriseButton.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
nsort = SORTSUPRISE;
drawcomparemain();
}
});
PImage helpButton = new PImage(Util.getImageURL("Help24.gif"));
canvas.getLayer().addChild(helpButton);
helpButton.translate(SCREENWIDTH - 70, SCREENHEIGHT - 68);
final CompareGui thisFrame = this;
helpButton.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
JDialog helpDialog = new JDialog(thisFrame, "Help", false);
Container theHelpDialogPane = helpDialog.getContentPane();
helpDialog.setBackground(Color.white);
theHelpDialogPane.setBackground(Color.white);
String szMessage;
if (rowset.bkmeans) {
szMessage = "The display shows to the left of the yellow line a K-means cluster from one of the data " + "sets. To the right of the yellow line are K-means clusters from the other data set for which a significant " + "number of genes assigned to the cluster on left were also assigned to it. " + "The p-value of the number of genes in the intersection is computed using the hypergeometric " + "distribution based on the number of total genes assigned to each of the two clusters, and the " + "total number of genes on the array.\n\n" + "The display is split in half by a blue line, there is no difference between clusters to the left and right " + "of the blue line. The clusters in the display can be reordered based on the significance through the " + "'Order by Significance' option. Within " + "each row the clusters are ordered in decreasing order of significance. The rows are reordered based on " + "decreasing significance of the most significant intersection for the row. 'Order by Correlation' is " + "similar but instead of re-ordering based on significance, the re-ordering is done based on correlation, " + "so that one can quickly identify dissimilar pairs of clusters. 'Order by ID' is the default method to " + "order clusters, based on increasing cluster ID. " + "'Swap Rows and Columns' swaps which data set has clusters to the left of the yellow line and " + "which data set has clusters organized in columns to the right of the yellow line.\n\n" + "Note also the main interface is zoomable and pannable, " + "hold the right button down to zoom or the left to pan while moving the mouse.";
} else {
szMessage = "The display shows to the left of the yellow line a profile from one of the data " + "sets. To the right of the yellow line are profiles from the other data set for which a significant " + "number of genes assigned to the profile on left were also assigned to it. " + "The p-value of the number of genes in the intersection is computed using the hypergeometric " + "distribution based on the number of total genes assigned to each of the two profiles, and the " + "total number of genes on the array.\n\n" + "The display is split in half by a blue line, there is no difference between profiles to the left and right " + "of the blue line. The profiles in the display can be reordered based on the significance through the " + "'Order by Significance' option. Within " + "each row the profiles are ordered in decreasing order of significance. The rows are reordered based on " + "decreasing significance of the most significant intersection for the row. 'Order by Correlation' is " + "similar but instead of re-ordering based on significance, the re-ordering is done based on correlation, " + "so that one can quickly identify dissimilar pairs of profiles. 'Order by ID' is the default method to " + "order profiles, based on increasing profile ID. " + "'Swap Rows and Columns' swaps which data set has profiles to the left of the yellow line and " + "which data set has profiles organized in columns to the right of the yellow line.\n\n" + "Note also the main interface is zoomable and pannable, " + "hold the right button down to zoom or the left to pan while moving the mouse.";
}
JTextArea textArea = new JTextArea(szMessage, 9, 60);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setBackground(Color.white);
textArea.setEditable(false);
ImageIcon ii;
if (rowset.bkmeans) {
ii = Util.createImageIcon("p6_2.png");
} else {
ii = Util.createImageIcon("p38_13.png");
}
JLabel jl = new JLabel(ii);
theHelpDialogPane.add(jl);
JPanel psl = new JPanel();
psl.setLayout(new SpringLayout());
psl.setBackground(Color.white);
psl.add(jl);
JScrollPane jsp2 = new JScrollPane(textArea);
psl.add(jsp2);
SpringUtilities.makeCompactGrid(psl, 2, 1, 2, 2, 2, 2);
JScrollPane jsp = new JScrollPane(psl);
theHelpDialogPane.add(jsp);
theHelpDialogPane.setSize(800, 600);
theHelpDialogPane.validate();
helpDialog.setLocation(thisFrame.getX() + 25, thisFrame.getY() + 25);
helpDialog.setSize(800, 600);
helpDialog.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
helpDialog.setVisible(true);
}
});
}
});
PNode idButton = PPath.createRectangle((float) 0.0, (float) 0.0, frecwidth, (float) 18.0);
idButton.translate(2 * (SCREENWIDTH + OFFSET) / 5 - 100, SCREENHEIGHT - 65);
PText theidText = new PText("Order By Profile ID");
theidText.setFont(new Font("times", Font.PLAIN, 12));
theidText.translate(25, 2);
idButton.setPaint(ST.buttonColor);
idButton.addChild(theidText);
idButton.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
nsort = SORTID;
drawcomparemain();
}
});
canvas.getLayer().addChild(idButton);
canvas.getLayer().addChild(idButton);
PNode sigButton = PPath.createRectangle((float) 0.0, (float) 0.0, (float) frecwidth, (float) 18.0);
sigButton.translate(3 * (SCREENWIDTH + OFFSET) / 5 - 100, SCREENHEIGHT - 65);
PText thesigText = new PText("Order By Significance");
thesigText.setFont(new Font("times", Font.PLAIN, 12));
thesigText.translate(20, 2);
sigButton.setPaint(ST.buttonColor);
sigButton.addChild(thesigText);
canvas.getLayer().addChild(sigButton);
sigButton.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
nsort = SORTSIG;
drawcomparemain();
}
});
PNode swapButton = PPath.createRectangle((float) 0.0, (float) 0.0, frecwidth, (float) 18.0);
swapButton.translate(1 * (SCREENWIDTH + OFFSET) / 5 - 100, SCREENHEIGHT - 65);
PText theswapText = new PText("Swap Rows and Columns");
theswapText.setFont(new Font("times", Font.PLAIN, 12));
theswapText.translate(6, 2);
swapButton.setPaint(ST.buttonColor);
swapButton.addChild(theswapText);
canvas.getLayer().addChild(swapButton);
swapButton.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
synchronized (swaplock) {
bswap = !bswap;
}
drawcomparemain();
}
});
}
|
<DeepExtract>
canvas = getCanvas();
canvas.getLayer().removeAllChildren();
int nmaxcol = 0;
float frecwidth = (float) 150.0;
int OFFSET = 0;
ArrayList sigrows;
final STEM_DataSet rowset, colset;
PNode[] rownodes, colnodes;
String sztexttop, sztextleft;
synchronized (swaplock) {
if (bswap) {
sigrows = theCompareInfo.sigrowsswap;
colset = theCompareInfo.origset;
rowset = theCompareInfo.comparesetfmnel;
rowplotpanel = theCompareInfo.compareframe.thegeneplotpanel;
colplotpanel = thegeneplotpanel;
colnodes = profilenodes;
rownodes = theCompareInfo.compareframe.profilenodes;
sztexttop = "Original Set " + szprofileclusterCAP;
sztextleft = "Comparison Set " + szprofileclusterCAP;
szother = "comparison";
} else {
sigrows = theCompareInfo.sigrows;
rowset = theCompareInfo.origset;
colset = theCompareInfo.comparesetfmnel;
rownodes = profilenodes;
colnodes = theCompareInfo.compareframe.profilenodes;
colplotpanel = theCompareInfo.compareframe.thegeneplotpanel;
rowplotpanel = thegeneplotpanel;
sztextleft = "Original Set " + szprofileclusterCAP;
sztexttop = "Comparison Set " + szprofileclusterCAP;
szother = "original";
}
}
PText comparetext = new PText(sztexttop);
comparetext.setFont(new Font("times", Font.PLAIN, 14));
comparetext.translate(3.0 * SCREENWIDTH / 18.0, 0);
canvas.getLayer().addChild(comparetext);
PText originaltext = new PText(sztextleft);
originaltext.setFont(new Font("times", Font.PLAIN, 14));
originaltext.translate(0, SCREENHEIGHT / 2.0);
originaltext.rotate(-Math.PI / 2);
canvas.getLayer().addChild(originaltext);
int nsigrows = sigrows.size();
if (nsigrows >= 2) {
PText comparetext2 = new PText(sztexttop);
comparetext2.setFont(new Font("times", Font.PLAIN, 14));
comparetext2.translate(12.0 * SCREENWIDTH / 18.0, 0);
canvas.getLayer().addChild(comparetext2);
PText originaltext2 = new PText(sztextleft);
originaltext2.setFont(new Font("times", Font.PLAIN, 14));
originaltext2.translate(SCREENWIDTH / 2.0 + CAPOFFSET, SCREENHEIGHT / 2.0);
originaltext2.rotate(-Math.PI / 2);
canvas.getLayer().addChild(originaltext2);
}
for (int nrow = 0; nrow < nsigrows; nrow++) {
CompareInfo.CompareInfoRow cir = (CompareInfo.CompareInfoRow) sigrows.get(nrow);
if (cir.sigprofiles.size() >= nmaxcol) {
nmaxcol = cir.sigprofiles.size();
}
}
CompareInfo.CompareInfoRow[] sigrowsArray = new CompareInfo.CompareInfoRow[nsigrows];
for (int nrowindex = 0; nrowindex < sigrowsArray.length; nrowindex++) {
sigrowsArray[nrowindex] = (CompareInfo.CompareInfoRow) sigrows.get(nrowindex);
}
if (nsort == SORTSIG) {
Arrays.sort(sigrowsArray, new SigRowComparator());
} else if (nsort == SORTSUPRISE) {
Arrays.sort(sigrowsArray, new SupriseRowComparator());
}
double dheight = 20;
if (nsigrows > 0) {
dheight = Math.max(Math.min((SCREENHEIGHT - BUFFER) * 2 / nsigrows, (SCREENWIDTH / 2 - BUFFER) / (nmaxcol + 1)), 20);
}
for (int nrow = 0; nrow < nsigrows; nrow++) {
double dxoffset, dyoffset;
final CompareInfo.CompareInfoRow cir = (CompareInfo.CompareInfoRow) sigrowsArray[nrow];
PNode node = (PNode) rownodes[cir.nprofile].clone();
node.scale((dheight) / (node.getScale() * node.getHeight()));
if (nrow < Math.ceil(nsigrows / 2.0)) {
dxoffset = CAPOFFSET / node.getScale();
dyoffset = node.getHeight() * nrow + CAPOFFSET / node.getScale();
} else {
dxoffset = 1 / node.getScale() * SCREENWIDTH / 2 + 2 * CAPOFFSET / node.getScale();
dyoffset = node.getHeight() * (nrow - Math.ceil(nsigrows / 2.0)) + CAPOFFSET / node.getScale();
}
String szcountLabel = "" + (int) rowset.countassignments[cir.nprofile];
PText counttext = new PText(szcountLabel);
counttext.setFont(new Font("times", Font.PLAIN, (int) (Math.ceil(node.getHeight() / 6))));
counttext.translate(1, node.getHeight() - node.getHeight() / 4);
node.addChild(counttext);
node.translate(dxoffset, dyoffset);
if (nrow == 0) {
double dwidth = (float) (node.getWidth() * node.getScale());
double dtheight = Math.ceil(nsigrows / 2.0) * (float) (node.getHeight() * node.getScale());
PNode line = PPath.createRectangle((float) (CAPOFFSET + dwidth + 1.5 * node.getScale()), (float) CAPOFFSET, (float) (6 * node.getScale()), (float) (dtheight));
line.setPaint(ST.buttonColor);
canvas.getLayer().addChild(line);
} else if (nrow == Math.ceil(nsigrows / 2.0)) {
double dscale = node.getScale();
double dwidth = (float) (node.getWidth() * dscale);
double dtheight = (nsigrows - Math.ceil(nsigrows / 2.0)) * (float) (node.getHeight() * dscale);
PNode linemid = PPath.createRectangle((float) (2 * CAPOFFSET + dwidth + SCREENWIDTH / 2.0 + 1.5 * dscale), (float) CAPOFFSET, (float) (6 * dscale), (float) (dtheight));
linemid.setPaint(ST.buttonColor);
canvas.getLayer().addChild(linemid);
float flast = (float) ((CAPOFFSET / dscale + 10 + node.getHeight() * (nmaxcol + 1)) * dscale);
float fmid = (float) (flast + (SCREENWIDTH / 2.0 + CAPOFFSET / dscale - flast) / 2);
PNode line = PPath.createRectangle(fmid, (float) 5, (float) (6 * dscale), (float) (SCREENHEIGHT - BUFFER + 15));
line.setPaint(ST.lightBlue);
canvas.getLayer().addChild(line);
}
node.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
if (event.getButton() == MouseEvent.BUTTON1) {
final ProfileGui pg;
pg = new ProfileGui(rowset, cir.nprofile, null, null, -1, null, null, null, rowplotpanel, cf);
pg.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
pg.dispose();
}
public void windowOpened(WindowEvent we) {
pg.repaint();
}
});
pg.setLocation(20, 50);
pg.setSize(new Dimension(SCREENWIDTH, SCREENHEIGHT));
pg.setVisible(true);
}
}
});
canvas.getLayer().addChild(node);
ArrayList compareprofiles = cir.sigprofiles;
int ncols = compareprofiles.size();
CompareInfo.CompareInfoRec[] cirecArray = new CompareInfo.CompareInfoRec[ncols];
for (int ncolindex = 0; ncolindex < cirecArray.length; ncolindex++) {
cirecArray[ncolindex] = (CompareInfo.CompareInfoRec) compareprofiles.get(ncolindex);
}
if (nsort == SORTSIG) {
Arrays.sort(cirecArray, new SigComparator());
} else if (nsort == SORTSUPRISE) {
Arrays.sort(cirecArray, new SupriseComparator(cir.nprofile));
}
for (int ncolindex = 0; ncolindex < ncols; ncolindex++) {
final CompareInfo.CompareInfoRec cirec = (CompareInfo.CompareInfoRec) cirecArray[ncolindex];
PNode colnode = (PNode) colnodes[cirec.nprofile].clone();
colnode.scale((dheight) / (colnode.getScale() * colnode.getHeight()));
colnode.translate(10 + dxoffset + colnode.getHeight() * (ncolindex + 1), dyoffset);
String szLabel = ((int) cirec.dmatch) + ";" + MAINGUI2.doubleToSz(cirec.dpval);
PText text = new PText(szLabel);
text.setFont(new Font("times", Font.PLAIN, (int) (Math.ceil(colnode.getHeight() / 6))));
text.translate(1, 3 * colnode.getHeight() / 4);
colnode.addChild(text);
NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
nf.setMinimumFractionDigits(2);
nf.setMaximumFractionDigits(2);
String szcorrLabel = nf.format(cirec.dcorrval);
PText corrtext = new PText(szcorrLabel);
corrtext.setFont(new Font("times", Font.PLAIN, (int) (Math.ceil(colnode.getHeight() / 6))));
corrtext.translate(4 * colnode.getWidth() / 7, -1);
colnode.addChild(corrtext);
final String szIntersect = MAINGUI2.doubleToSz(cirec.dmatch) + " of the " + MAINGUI2.doubleToSz(rowset.countassignments[cir.nprofile]) + " genes assigned to Profile " + cir.nprofile + " in the " + szother + " experiment were also assigned to this profile (p-value =" + MAINGUI2.doubleToSz(cirec.dpval) + ")";
colnode.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
if (event.getButton() == MouseEvent.BUTTON1) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
final ProfileGui pg;
pg = new ProfileGui(colset, cirec.nprofile, null, cirec.inames, cir.nprofile, szIntersect, null, null, colplotpanel, cf);
pg.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
pg.dispose();
}
public void windowOpened(WindowEvent we) {
pg.repaint();
}
});
pg.setLocation(20, 50);
pg.setSize(new Dimension(SCREENWIDTH, SCREENHEIGHT));
pg.setVisible(true);
}
});
}
}
});
canvas.getLayer().addChild(colnode);
}
}
PNode supriseButton = PPath.createRectangle((float) 0.0, (float) 0.0, frecwidth, (float) 18.0);
supriseButton.translate(4 * (SCREENWIDTH + OFFSET) / 5 - 100, SCREENHEIGHT - 65);
PText thesupriseText = new PText("Order By Correlation");
thesupriseText.setFont(new Font("times", Font.PLAIN, 12));
thesupriseText.translate(23, 2);
supriseButton.setPaint(ST.buttonColor);
supriseButton.addChild(thesupriseText);
canvas.getLayer().addChild(supriseButton);
supriseButton.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
nsort = SORTSUPRISE;
drawcomparemain();
}
});
PImage helpButton = new PImage(Util.getImageURL("Help24.gif"));
canvas.getLayer().addChild(helpButton);
helpButton.translate(SCREENWIDTH - 70, SCREENHEIGHT - 68);
final CompareGui thisFrame = this;
helpButton.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
JDialog helpDialog = new JDialog(thisFrame, "Help", false);
Container theHelpDialogPane = helpDialog.getContentPane();
helpDialog.setBackground(Color.white);
theHelpDialogPane.setBackground(Color.white);
String szMessage;
if (rowset.bkmeans) {
szMessage = "The display shows to the left of the yellow line a K-means cluster from one of the data " + "sets. To the right of the yellow line are K-means clusters from the other data set for which a significant " + "number of genes assigned to the cluster on left were also assigned to it. " + "The p-value of the number of genes in the intersection is computed using the hypergeometric " + "distribution based on the number of total genes assigned to each of the two clusters, and the " + "total number of genes on the array.\n\n" + "The display is split in half by a blue line, there is no difference between clusters to the left and right " + "of the blue line. The clusters in the display can be reordered based on the significance through the " + "'Order by Significance' option. Within " + "each row the clusters are ordered in decreasing order of significance. The rows are reordered based on " + "decreasing significance of the most significant intersection for the row. 'Order by Correlation' is " + "similar but instead of re-ordering based on significance, the re-ordering is done based on correlation, " + "so that one can quickly identify dissimilar pairs of clusters. 'Order by ID' is the default method to " + "order clusters, based on increasing cluster ID. " + "'Swap Rows and Columns' swaps which data set has clusters to the left of the yellow line and " + "which data set has clusters organized in columns to the right of the yellow line.\n\n" + "Note also the main interface is zoomable and pannable, " + "hold the right button down to zoom or the left to pan while moving the mouse.";
} else {
szMessage = "The display shows to the left of the yellow line a profile from one of the data " + "sets. To the right of the yellow line are profiles from the other data set for which a significant " + "number of genes assigned to the profile on left were also assigned to it. " + "The p-value of the number of genes in the intersection is computed using the hypergeometric " + "distribution based on the number of total genes assigned to each of the two profiles, and the " + "total number of genes on the array.\n\n" + "The display is split in half by a blue line, there is no difference between profiles to the left and right " + "of the blue line. The profiles in the display can be reordered based on the significance through the " + "'Order by Significance' option. Within " + "each row the profiles are ordered in decreasing order of significance. The rows are reordered based on " + "decreasing significance of the most significant intersection for the row. 'Order by Correlation' is " + "similar but instead of re-ordering based on significance, the re-ordering is done based on correlation, " + "so that one can quickly identify dissimilar pairs of profiles. 'Order by ID' is the default method to " + "order profiles, based on increasing profile ID. " + "'Swap Rows and Columns' swaps which data set has profiles to the left of the yellow line and " + "which data set has profiles organized in columns to the right of the yellow line.\n\n" + "Note also the main interface is zoomable and pannable, " + "hold the right button down to zoom or the left to pan while moving the mouse.";
}
JTextArea textArea = new JTextArea(szMessage, 9, 60);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setBackground(Color.white);
textArea.setEditable(false);
ImageIcon ii;
if (rowset.bkmeans) {
ii = Util.createImageIcon("p6_2.png");
} else {
ii = Util.createImageIcon("p38_13.png");
}
JLabel jl = new JLabel(ii);
theHelpDialogPane.add(jl);
JPanel psl = new JPanel();
psl.setLayout(new SpringLayout());
psl.setBackground(Color.white);
psl.add(jl);
JScrollPane jsp2 = new JScrollPane(textArea);
psl.add(jsp2);
SpringUtilities.makeCompactGrid(psl, 2, 1, 2, 2, 2, 2);
JScrollPane jsp = new JScrollPane(psl);
theHelpDialogPane.add(jsp);
theHelpDialogPane.setSize(800, 600);
theHelpDialogPane.validate();
helpDialog.setLocation(thisFrame.getX() + 25, thisFrame.getY() + 25);
helpDialog.setSize(800, 600);
helpDialog.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
helpDialog.setVisible(true);
}
});
}
});
PNode idButton = PPath.createRectangle((float) 0.0, (float) 0.0, frecwidth, (float) 18.0);
idButton.translate(2 * (SCREENWIDTH + OFFSET) / 5 - 100, SCREENHEIGHT - 65);
PText theidText = new PText("Order By Profile ID");
theidText.setFont(new Font("times", Font.PLAIN, 12));
theidText.translate(25, 2);
idButton.setPaint(ST.buttonColor);
idButton.addChild(theidText);
idButton.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
nsort = SORTID;
drawcomparemain();
}
});
canvas.getLayer().addChild(idButton);
canvas.getLayer().addChild(idButton);
PNode sigButton = PPath.createRectangle((float) 0.0, (float) 0.0, (float) frecwidth, (float) 18.0);
sigButton.translate(3 * (SCREENWIDTH + OFFSET) / 5 - 100, SCREENHEIGHT - 65);
PText thesigText = new PText("Order By Significance");
thesigText.setFont(new Font("times", Font.PLAIN, 12));
thesigText.translate(20, 2);
sigButton.setPaint(ST.buttonColor);
sigButton.addChild(thesigText);
canvas.getLayer().addChild(sigButton);
sigButton.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
nsort = SORTSIG;
drawcomparemain();
}
});
PNode swapButton = PPath.createRectangle((float) 0.0, (float) 0.0, frecwidth, (float) 18.0);
swapButton.translate(1 * (SCREENWIDTH + OFFSET) / 5 - 100, SCREENHEIGHT - 65);
PText theswapText = new PText("Swap Rows and Columns");
theswapText.setFont(new Font("times", Font.PLAIN, 12));
theswapText.translate(6, 2);
swapButton.setPaint(ST.buttonColor);
swapButton.addChild(theswapText);
canvas.getLayer().addChild(swapButton);
swapButton.addInputEventListener(new PBasicInputEventHandler() {
public void mousePressed(PInputEvent event) {
synchronized (swaplock) {
bswap = !bswap;
}
drawcomparemain();
}
});
</DeepExtract>
|
STEM_DREM
|
positive
|
@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);
}
|
<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>
|
JayPS-AndroidApp
|
positive
|
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;
}
|
<DeepExtract>
if ("classRoom is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("classRoom is null"));
</DeepExtract>
|
SpringBoot_EducationalMS
|
positive
|
@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);
}
}
|
<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
|
@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);
}
}
}
|
<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
|
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;
}
}
|
<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
|
@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);
}
|
<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>
|
XLocation
|
positive
|
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;
}
|
<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
|
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);
}
}
|
<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
|
private synchronized void initAlbum() {
album.setAlbumCover(null);
album.setAlbumTitle(context.getString(R.string.album_untitled));
this.browserController = browserController;
this.album.setBrowserController(browserController);
}
|
<DeepExtract>
album.setAlbumCover(null);
</DeepExtract>
<DeepExtract>
album.setAlbumTitle(context.getString(R.string.album_untitled));
</DeepExtract>
<DeepExtract>
this.browserController = browserController;
this.album.setBrowserController(browserController);
</DeepExtract>
|
Ninja
|
positive
|
@Override
public int size() {
return this.isEmpty() ? 0 : size0(this.tail(), 0 + 1);
}
|
<DeepExtract>
return this.isEmpty() ? 0 : size0(this.tail(), 0 + 1);
</DeepExtract>
|
dexx
|
positive
|
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;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "goodsPrice" + " cannot be null");
}
criteria.add(new Criterion("goods_price =", value));
</DeepExtract>
|
ssmxiaomi
|
positive
|
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();
}
}
}
|
<DeepExtract>
if (true)
mAvoidTriggerTextWatcher = true;
mSearchEditText.setText("");
mSearchEditText.append(query);
mAvoidTriggerTextWatcher = false;
</DeepExtract>
<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
|
public Properties putSku(String sku) {
super.putValue(SKU_KEY, sku);
return this;
}
|
<DeepExtract>
super.putValue(SKU_KEY, sku);
return this;
</DeepExtract>
|
analytics-android
|
positive
|
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;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "picture" + " cannot be null");
}
criteria.add(new Criterion("picture =", value));
</DeepExtract>
|
Maven-Spring-SpringMVC-Mybatis
|
positive
|
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];
}
|
<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>
|
vecmath
|
positive
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.