before stringlengths 33 3.21M | after stringlengths 63 3.21M | repo stringlengths 1 56 | type stringclasses 1
value | __index_level_0__ int64 0 442k |
|---|---|---|---|---|
@Override
public void raise() {
System.out.println(getLogPrefix(this) + "raise");
this.solenoidSubsystem.setSolenoid(DoubleSolenoid.Value.kForward);
} | @Override
public void raise() {
System.out.println(getLogPrefix(this) + "raise");
<DeepExtract>
this.solenoidSubsystem.setSolenoid(DoubleSolenoid.Value.kForward);
</DeepExtract>
} | 449-central-repo | positive | 439,372 |
public void setTurbidity(final float turbidity) {
this.sunDirectionWorld = this.sunDirectionWorld.normalize();
this.turbidity = turbidity;
this.sunDirection = this.sunDirectionWorld.transformReverse(this.orthoNormalBasis).normalize();
this.sunOrigin = new Point3F().add(this.sunDirectionWorld, 10000.0F);
this.theta = acos(saturate(this.sunDirection.z, -1.0F, 1.0F));
if (this.sunDirection.z > 0.0F) {
this.radiance = doCalculateAttenuatedSunlight(this.theta, turbidity);
this.sunColor = RGBColorSpace.SRGB.convertXYZToRGB(this.radiance.toXYZ().multiply(1.0e-4F)).minTo0();
} else {
this.radiance = new ConstantSpectralCurve(0.0F);
this.sunColor = Color.BLACK;
}
final double theta = this.theta;
final double theta2 = theta * theta;
final double theta3 = theta * theta * theta;
final double turbidity2 = turbidity * turbidity;
final double chi = (4.0D / 9.0D - turbidity / 120.0D) * (PI - 2.0D * this.theta);
this.zenithRelativeLuminance = ((4.0453D * turbidity - 4.9710D) * Math.tan(chi) - 0.2155D * turbidity + 2.4192D) * 1000.0D;
this.zenithX = (0.00165D * theta3 - 0.00374D * theta2 + 0.00208D * theta + 0.0D) * turbidity2 + (-0.02902D * theta3 + 0.06377D * theta2 - 0.03202D * theta + 0.00394D) * turbidity + (0.11693D * theta3 - 0.21196D * theta2 + 0.06052D * theta + 0.25885D);
this.zenithY = (0.00275D * theta3 - 0.00610D * theta2 + 0.00316D * theta + 0.0D) * turbidity2 + (-0.04212D * theta3 + 0.08970D * theta2 - 0.04153D * theta + 0.00515D) * turbidity + (0.15346D * theta3 - 0.26756D * theta2 + 0.06669D * theta + 0.26688D);
this.perezRelativeLuminance[0] = 0.17872D * turbidity - 1.46303D;
this.perezRelativeLuminance[1] = -0.35540D * turbidity + 0.42749D;
this.perezRelativeLuminance[2] = -0.02266D * turbidity + 5.32505D;
this.perezRelativeLuminance[3] = 0.12064D * turbidity - 2.57705D;
this.perezRelativeLuminance[4] = -0.06696D * turbidity + 0.37027D;
this.perezX[0] = -0.01925D * turbidity - 0.25922D;
this.perezX[1] = -0.06651D * turbidity + 0.00081D;
this.perezX[2] = -0.00041D * turbidity + 0.21247D;
this.perezX[3] = -0.06409D * turbidity - 0.89887D;
this.perezX[4] = -0.00325D * turbidity + 0.04517D;
this.perezY[0] = -0.01669D * turbidity - 0.26078D;
this.perezY[1] = -0.09495D * turbidity + 0.00921D;
this.perezY[2] = -0.00792D * turbidity + 0.21023D;
this.perezY[3] = -0.04405D * turbidity - 1.65369D;
this.perezY[4] = -0.01092D * turbidity + 0.05291D;
final int w = this.imageHistogramWidth;
final int h = this.imageHistogramHeight;
this.colHistogram = new float[w];
this.imageHistogram = new float[w * h];
final float deltaU = 1.0F / w;
final float deltaV = 1.0F / h;
for (int x = 0, index = 0; x < w; x++) {
for (int y = 0; y < h; y++, index++) {
final float u = (x + 0.5F) * deltaU;
final float v = (y + 0.5F) * deltaV;
final Color color = doCalculateColor(Vector3F.direction(u, v));
this.imageHistogram[index] = color.luminance() * sin(PI * v);
if (y > 0) {
this.imageHistogram[index] += this.imageHistogram[index - 1];
}
}
this.colHistogram[x] = this.imageHistogram[index - 1];
if (x > 0) {
this.colHistogram[x] += this.colHistogram[x - 1];
}
for (int y = 0; y < h; y++) {
this.imageHistogram[index - h + y] /= this.imageHistogram[index - 1];
}
}
for (int x = 0; x < w; x++) {
this.colHistogram[x] /= this.colHistogram[w - 1];
}
this.jacobian = (2.0F * PI * PI) / (w * h);
} | public void setTurbidity(final float turbidity) {
<DeepExtract>
this.sunDirectionWorld = this.sunDirectionWorld.normalize();
this.turbidity = turbidity;
this.sunDirection = this.sunDirectionWorld.transformReverse(this.orthoNormalBasis).normalize();
this.sunOrigin = new Point3F().add(this.sunDirectionWorld, 10000.0F);
this.theta = acos(saturate(this.sunDirection.z, -1.0F, 1.0F));
if (this.sunDirection.z > 0.0F) {
this.radiance = doCalculateAttenuatedSunlight(this.theta, turbidity);
this.sunColor = RGBColorSpace.SRGB.convertXYZToRGB(this.radiance.toXYZ().multiply(1.0e-4F)).minTo0();
} else {
this.radiance = new ConstantSpectralCurve(0.0F);
this.sunColor = Color.BLACK;
}
final double theta = this.theta;
final double theta2 = theta * theta;
final double theta3 = theta * theta * theta;
final double turbidity2 = turbidity * turbidity;
final double chi = (4.0D / 9.0D - turbidity / 120.0D) * (PI - 2.0D * this.theta);
this.zenithRelativeLuminance = ((4.0453D * turbidity - 4.9710D) * Math.tan(chi) - 0.2155D * turbidity + 2.4192D) * 1000.0D;
this.zenithX = (0.00165D * theta3 - 0.00374D * theta2 + 0.00208D * theta + 0.0D) * turbidity2 + (-0.02902D * theta3 + 0.06377D * theta2 - 0.03202D * theta + 0.00394D) * turbidity + (0.11693D * theta3 - 0.21196D * theta2 + 0.06052D * theta + 0.25885D);
this.zenithY = (0.00275D * theta3 - 0.00610D * theta2 + 0.00316D * theta + 0.0D) * turbidity2 + (-0.04212D * theta3 + 0.08970D * theta2 - 0.04153D * theta + 0.00515D) * turbidity + (0.15346D * theta3 - 0.26756D * theta2 + 0.06669D * theta + 0.26688D);
this.perezRelativeLuminance[0] = 0.17872D * turbidity - 1.46303D;
this.perezRelativeLuminance[1] = -0.35540D * turbidity + 0.42749D;
this.perezRelativeLuminance[2] = -0.02266D * turbidity + 5.32505D;
this.perezRelativeLuminance[3] = 0.12064D * turbidity - 2.57705D;
this.perezRelativeLuminance[4] = -0.06696D * turbidity + 0.37027D;
this.perezX[0] = -0.01925D * turbidity - 0.25922D;
this.perezX[1] = -0.06651D * turbidity + 0.00081D;
this.perezX[2] = -0.00041D * turbidity + 0.21247D;
this.perezX[3] = -0.06409D * turbidity - 0.89887D;
this.perezX[4] = -0.00325D * turbidity + 0.04517D;
this.perezY[0] = -0.01669D * turbidity - 0.26078D;
this.perezY[1] = -0.09495D * turbidity + 0.00921D;
this.perezY[2] = -0.00792D * turbidity + 0.21023D;
this.perezY[3] = -0.04405D * turbidity - 1.65369D;
this.perezY[4] = -0.01092D * turbidity + 0.05291D;
final int w = this.imageHistogramWidth;
final int h = this.imageHistogramHeight;
this.colHistogram = new float[w];
this.imageHistogram = new float[w * h];
final float deltaU = 1.0F / w;
final float deltaV = 1.0F / h;
for (int x = 0, index = 0; x < w; x++) {
for (int y = 0; y < h; y++, index++) {
final float u = (x + 0.5F) * deltaU;
final float v = (y + 0.5F) * deltaV;
final Color color = doCalculateColor(Vector3F.direction(u, v));
this.imageHistogram[index] = color.luminance() * sin(PI * v);
if (y > 0) {
this.imageHistogram[index] += this.imageHistogram[index - 1];
}
}
this.colHistogram[x] = this.imageHistogram[index - 1];
if (x > 0) {
this.colHistogram[x] += this.colHistogram[x - 1];
}
for (int y = 0; y < h; y++) {
this.imageHistogram[index - h + y] /= this.imageHistogram[index - 1];
}
}
for (int x = 0; x < w; x++) {
this.colHistogram[x] /= this.colHistogram[w - 1];
}
this.jacobian = (2.0F * PI * PI) / (w * h);
</DeepExtract>
} | Dayflower-Path-Tracer | positive | 439,373 |
@Override
public void write(final byte[] buffer, final int offset, final int length) throws IOException {
if (length > 0) {
writeHex(length);
out.write(buffer, offset, length);
out.write(CRLF);
out.flush();
}
} | @Override
public void write(final byte[] buffer, final int offset, final int length) throws IOException {
<DeepExtract>
if (length > 0) {
writeHex(length);
out.write(buffer, offset, length);
out.write(CRLF);
out.flush();
}
</DeepExtract>
} | adblockplusandroid | positive | 439,374 |
public String signIn(String userId, Connection<?> connection, NativeWebRequest request) {
Account account = accountRepository.findById(Long.valueOf(userId));
AccountUtils.signin(account);
HttpServletRequest nativeReq = request.getNativeRequest(HttpServletRequest.class);
HttpServletResponse nativeRes = request.getNativeResponse(HttpServletResponse.class);
SavedRequest saved = requestCache.getRequest(nativeReq, nativeRes);
if (saved == null) {
return null;
}
requestCache.removeRequest(nativeReq, nativeRes);
removeAutheticationAttributes(nativeReq.getSession(false));
return saved.getRedirectUrl();
} | public String signIn(String userId, Connection<?> connection, NativeWebRequest request) {
Account account = accountRepository.findById(Long.valueOf(userId));
AccountUtils.signin(account);
<DeepExtract>
HttpServletRequest nativeReq = request.getNativeRequest(HttpServletRequest.class);
HttpServletResponse nativeRes = request.getNativeResponse(HttpServletResponse.class);
SavedRequest saved = requestCache.getRequest(nativeReq, nativeRes);
if (saved == null) {
return null;
}
requestCache.removeRequest(nativeReq, nativeRes);
removeAutheticationAttributes(nativeReq.getSession(false));
return saved.getRedirectUrl();
</DeepExtract>
} | greenhouse | positive | 439,375 |
@Override
public void onServiceDisconnected(ComponentName name) {
sender = null;
context.unbindService(this);
if (!running) {
return;
}
running = false;
CompletedListener callback = listener;
if (callback != null) {
callback.completed(null);
}
} | @Override
public void onServiceDisconnected(ComponentName name) {
sender = null;
context.unbindService(this);
<DeepExtract>
if (!running) {
return;
}
running = false;
CompletedListener callback = listener;
if (callback != null) {
callback.completed(null);
}
</DeepExtract>
} | HypFacebook | positive | 439,376 |
@Test
public void testSoftClear() {
FilterBuilder b = new FilterBuilder(100000, 0.001);
b.overwriteIfExists(true);
switch(type) {
case TYPE_MEMORY_ONLY:
filter = new ExpiringBloomFilterMemory<>(b);
break;
case TYPE_REDIS_MEMORY:
filter = new ExpiringBloomFilterRedis<>(b);
break;
case TYPE_REDIS_ONLY:
filter = new ExpiringBloomFilterPureRedis(b);
break;
}
filter.clear();
assertTrue("Bloom filter should be empty before", filter.isEmpty());
assertEquals("Bloom filter's bits should have zero length", 0, filter.getBitSet().length());
assertEquals("Bloom filter's bit cardinality should be zero", 0, filter.getBitSet().cardinality());
filter.reportRead("Foo", 70, SECONDS);
filter.reportWrite("Foo");
assertTrue(filter.getExpirationMap().containsKey("Foo"));
assertTrue(filter.contains("Foo"));
filter.softClear();
assertFalse(filter.contains("Foo"));
assertEquals(1, filter.getRemainingTTL("Foo", MINUTES).longValue());
assertTrue(filter.isKnown("Foo"));
assertFalse(filter.getExpirationMap().containsKey("Foo"));
filter.reportWrite("Foo");
assertTrue(filter.getExpirationMap().containsKey("Foo"));
assertTrue(filter.contains("Foo"));
} | @Test
public void testSoftClear() {
FilterBuilder b = new FilterBuilder(100000, 0.001);
<DeepExtract>
b.overwriteIfExists(true);
switch(type) {
case TYPE_MEMORY_ONLY:
filter = new ExpiringBloomFilterMemory<>(b);
break;
case TYPE_REDIS_MEMORY:
filter = new ExpiringBloomFilterRedis<>(b);
break;
case TYPE_REDIS_ONLY:
filter = new ExpiringBloomFilterPureRedis(b);
break;
}
filter.clear();
assertTrue("Bloom filter should be empty before", filter.isEmpty());
assertEquals("Bloom filter's bits should have zero length", 0, filter.getBitSet().length());
assertEquals("Bloom filter's bit cardinality should be zero", 0, filter.getBitSet().cardinality());
</DeepExtract>
filter.reportRead("Foo", 70, SECONDS);
filter.reportWrite("Foo");
assertTrue(filter.getExpirationMap().containsKey("Foo"));
assertTrue(filter.contains("Foo"));
filter.softClear();
assertFalse(filter.contains("Foo"));
assertEquals(1, filter.getRemainingTTL("Foo", MINUTES).longValue());
assertTrue(filter.isKnown("Foo"));
assertFalse(filter.getExpirationMap().containsKey("Foo"));
filter.reportWrite("Foo");
assertTrue(filter.getExpirationMap().containsKey("Foo"));
assertTrue(filter.contains("Foo"));
} | Orestes-Bloomfilter | positive | 439,377 |
@Override
public void handle(long startNanos) {
renderList.clear();
double acceleration = rootHeight * 0.02;
rootHeight += acceleration;
if (rootHeight >= 2 * height) {
rootHeight = height;
}
Triangle root = new Triangle(width / 2, 0, rootHeight);
shrink(root);
gc.setFill(Color.BLACK);
gc.fillRect(0, 0, width, height);
gc.setFill(Color.WHITE);
int triangleCount = renderList.size();
for (int i = 0; i < triangleCount; i++) {
Triangle tri = renderList.get(i);
if (tri.getTopY() < height) {
drawTriangle(tri);
}
}
framesPerSecond++;
if (startNanos > nextSecond) {
System.out.println("fps: " + framesPerSecond);
framesPerSecond = 0;
nextSecond = startNanos + 1_000_000_000L;
}
} | @Override
public void handle(long startNanos) {
renderList.clear();
double acceleration = rootHeight * 0.02;
rootHeight += acceleration;
if (rootHeight >= 2 * height) {
rootHeight = height;
}
Triangle root = new Triangle(width / 2, 0, rootHeight);
shrink(root);
gc.setFill(Color.BLACK);
gc.fillRect(0, 0, width, height);
<DeepExtract>
gc.setFill(Color.WHITE);
int triangleCount = renderList.size();
for (int i = 0; i < triangleCount; i++) {
Triangle tri = renderList.get(i);
if (tri.getTopY() < height) {
drawTriangle(tri);
}
}
</DeepExtract>
framesPerSecond++;
if (startNanos > nextSecond) {
System.out.println("fps: " + framesPerSecond);
framesPerSecond = 0;
nextSecond = startNanos + 1_000_000_000L;
}
} | DemoFX | positive | 439,380 |
@Override
public void enterStructName(SwiftParser.StructNameContext ctx) {
if (enabledRules.contains(Rules.MAX_NAME_LENGTH) && SourceFileUtil.nameTooLong(ctx, constructLengths.maxNameLength)) {
createErrorMessage(Rules.MAX_NAME_LENGTH, ctx.getText().length(), ctx, Messages.STRUCT + Messages.NAME, constructLengths.maxNameLength, Messages.EXCEEDS_CHARACTER_LIMIT);
}
} | @Override
public void enterStructName(SwiftParser.StructNameContext ctx) {
<DeepExtract>
if (enabledRules.contains(Rules.MAX_NAME_LENGTH) && SourceFileUtil.nameTooLong(ctx, constructLengths.maxNameLength)) {
createErrorMessage(Rules.MAX_NAME_LENGTH, ctx.getText().length(), ctx, Messages.STRUCT + Messages.NAME, constructLengths.maxNameLength, Messages.EXCEEDS_CHARACTER_LIMIT);
}
</DeepExtract>
} | tailor | positive | 439,381 |
private void parseAttribute() throws IOException {
if (pushbackToken == Token.UNKNOWN) {
lexer.nextToken();
} else {
pushbackToken = Token.UNKNOWN;
}
String attributeName;
if (pushbackToken == Token.UNKNOWN) {
attributeName = lexer.yytext();
} else {
attributeName = pushbackText;
}
while (true) {
Token next;
if (pushbackToken == Token.UNKNOWN) {
next = lexer.nextToken();
} else {
next = pushbackToken;
pushbackToken = Token.UNKNOWN;
}
if (next != Token.WHITESPACE) {
pushBack(next);
break;
}
}
if (pushbackToken == Token.UNKNOWN) {
token = lexer.nextToken();
} else {
token = pushbackToken;
pushbackToken = Token.UNKNOWN;
}
if (token == Token.EQUALS) {
skipWhiteSpace();
if (pushbackToken == Token.UNKNOWN) {
token = lexer.nextToken();
} else {
token = pushbackToken;
pushbackToken = Token.UNKNOWN;
}
if (token == Token.QUOTED) {
parsedAttribute(attributeName, text(), true);
} else if (token == Token.WORD || token == Token.SLASH) {
String attributeValue = text();
while (true) {
Token next;
if (pushbackToken == Token.UNKNOWN) {
next = lexer.nextToken();
} else {
next = pushbackToken;
pushbackToken = Token.UNKNOWN;
}
if (next == Token.WORD || next == Token.EQUALS || next == Token.SLASH) {
attributeValue += text();
} else {
pushBack(next);
break;
}
}
parsedAttribute(attributeName, attributeValue, false);
} else if (token == Token.SLASH || token == Token.GT) {
pushBack(token);
} else if (token != Token.EOF) {
reportError("Illegal attribute value", lexer.line(), lexer.column());
}
} else if (token == Token.SLASH || token == Token.GT || token == Token.WORD) {
parsedAttribute(attributeName, null, false);
pushBack(token);
} else if (token != Token.EOF) {
reportError("Illegal attribute name", lexer.line(), lexer.column());
}
} | private void parseAttribute() throws IOException {
if (pushbackToken == Token.UNKNOWN) {
lexer.nextToken();
} else {
pushbackToken = Token.UNKNOWN;
}
String attributeName;
if (pushbackToken == Token.UNKNOWN) {
attributeName = lexer.yytext();
} else {
attributeName = pushbackText;
}
<DeepExtract>
while (true) {
Token next;
if (pushbackToken == Token.UNKNOWN) {
next = lexer.nextToken();
} else {
next = pushbackToken;
pushbackToken = Token.UNKNOWN;
}
if (next != Token.WHITESPACE) {
pushBack(next);
break;
}
}
</DeepExtract>
if (pushbackToken == Token.UNKNOWN) {
token = lexer.nextToken();
} else {
token = pushbackToken;
pushbackToken = Token.UNKNOWN;
}
if (token == Token.EQUALS) {
skipWhiteSpace();
if (pushbackToken == Token.UNKNOWN) {
token = lexer.nextToken();
} else {
token = pushbackToken;
pushbackToken = Token.UNKNOWN;
}
if (token == Token.QUOTED) {
parsedAttribute(attributeName, text(), true);
} else if (token == Token.WORD || token == Token.SLASH) {
String attributeValue = text();
while (true) {
Token next;
if (pushbackToken == Token.UNKNOWN) {
next = lexer.nextToken();
} else {
next = pushbackToken;
pushbackToken = Token.UNKNOWN;
}
if (next == Token.WORD || next == Token.EQUALS || next == Token.SLASH) {
attributeValue += text();
} else {
pushBack(next);
break;
}
}
parsedAttribute(attributeName, attributeValue, false);
} else if (token == Token.SLASH || token == Token.GT) {
pushBack(token);
} else if (token != Token.EOF) {
reportError("Illegal attribute value", lexer.line(), lexer.column());
}
} else if (token == Token.SLASH || token == Token.GT || token == Token.WORD) {
parsedAttribute(attributeName, null, false);
pushBack(token);
} else if (token != Token.EOF) {
reportError("Illegal attribute name", lexer.line(), lexer.column());
}
} | sitemesh3 | positive | 439,383 |
private Properties buildConsumerProps(Properties properties) {
Properties props = new Properties();
setProp(properties, props, ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, null);
setProp(properties, props, ConsumerConfig.GROUP_ID_CONFIG, null);
setProp(properties, props, ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, null);
setProp(properties, props, ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, null);
setProp(properties, props, ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, null);
setProp(properties, props, ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, null);
setProp(properties, props, ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, null);
setProp(properties, props, ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, null);
setProp(properties, props, ConsumerConfig.MAX_POLL_RECORDS_CONFIG, null);
setProp(properties, props, ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG, null);
return props;
} | private Properties buildConsumerProps(Properties properties) {
Properties props = new Properties();
setProp(properties, props, ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, null);
setProp(properties, props, ConsumerConfig.GROUP_ID_CONFIG, null);
setProp(properties, props, ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, null);
setProp(properties, props, ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, null);
setProp(properties, props, ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, null);
setProp(properties, props, ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, null);
setProp(properties, props, ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, null);
setProp(properties, props, ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, null);
setProp(properties, props, ConsumerConfig.MAX_POLL_RECORDS_CONFIG, null);
<DeepExtract>
setProp(properties, props, ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG, null);
</DeepExtract>
return props;
} | l2cache | positive | 439,386 |
public void all_signed() {
mSignLogList.clear();
mSectionIndices = new int[0];
mSignLogHeader = new String[0];
notifyDataSetChanged();
mShowList.addAll(mAllList);
notifyDataSetChanged();
} | public void all_signed() {
<DeepExtract>
mSignLogList.clear();
mSectionIndices = new int[0];
mSignLogHeader = new String[0];
notifyDataSetChanged();
</DeepExtract>
mShowList.addAll(mAllList);
notifyDataSetChanged();
} | Swface | positive | 439,387 |
public String toStringFull(X500Name name) {
StringBuffer buf = new StringBuffer();
boolean first = true;
RDN[] rdns = name.getRDNs();
for (int i = 0; i < rdns.length; i++) {
if (first) {
first = false;
} else {
buf.append(',');
}
if (rdns[i].isMultiValued()) {
AttributeTypeAndValue[] atv = rdns[i].getTypesAndValues();
boolean firstAtv = true;
for (int j = 0; j != atv.length; j++) {
if (firstAtv) {
firstAtv = false;
} else {
buf.append('+');
}
IETFUtils.appendTypeAndValue(buf, atv[j], asn2StringAll);
}
} else {
IETFUtils.appendTypeAndValue(buf, rdns[i].getFirst(), asn2StringAll);
}
}
return buf.toString();
} | public String toStringFull(X500Name name) {
<DeepExtract>
StringBuffer buf = new StringBuffer();
boolean first = true;
RDN[] rdns = name.getRDNs();
for (int i = 0; i < rdns.length; i++) {
if (first) {
first = false;
} else {
buf.append(',');
}
if (rdns[i].isMultiValued()) {
AttributeTypeAndValue[] atv = rdns[i].getTypesAndValues();
boolean firstAtv = true;
for (int j = 0; j != atv.length; j++) {
if (firstAtv) {
firstAtv = false;
} else {
buf.append('+');
}
IETFUtils.appendTypeAndValue(buf, atv[j], asn2StringAll);
}
} else {
IETFUtils.appendTypeAndValue(buf, rdns[i].getFirst(), asn2StringAll);
}
}
return buf.toString();
</DeepExtract>
} | canl-java | positive | 439,389 |
public void verifyNotElementHeight(String locator, String pattern) throws Exception {
try {
assertNotEquals(pattern, getElementHeight(locator));
} catch (AssertionFailedError e) {
if (verifyActAsAssert) {
throw e;
} else {
logger.warning("Verify failed : " + pattern.toString() + " is equal to " + getElementHeight(locator).toString());
addToVerificationErrors(e);
}
}
} | public void verifyNotElementHeight(String locator, String pattern) throws Exception {
<DeepExtract>
try {
assertNotEquals(pattern, getElementHeight(locator));
} catch (AssertionFailedError e) {
if (verifyActAsAssert) {
throw e;
} else {
logger.warning("Verify failed : " + pattern.toString() + " is equal to " + getElementHeight(locator).toString());
addToVerificationErrors(e);
}
}
</DeepExtract>
} | selenium-client-factory | positive | 439,390 |
@Override
public void onCreate() {
super.onCreate();
instance = this;
return instance;
if (isTestVersion) {
LogHandler.getInstance().initLog();
sNotificator.showTestVersionNotification();
}
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
Log.d("surprise", "App onCreate 162: app version is " + Grammar.getAppVersion());
Log.d("surprise", "App startTor 246: Tor start initiated");
if (!isExternalVpn()) {
if (!torInitInProgress) {
Constraints constraints = new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build();
OneTimeWorkRequest startTorWork = new OneTimeWorkRequest.Builder(StartTorWorker.class).addTag(START_TOR).setConstraints(constraints).build();
WorkManager.getInstance(this).enqueueUniqueWork(START_TOR, ExistingWorkPolicy.REPLACE, startTorWork);
}
} else {
Log.d("surprise", "App startTor 257: tor initiation skipped, use external VPN");
GlobalWebClient.mConnectionState.postValue(GlobalWebClient.CONNECTED);
}
if (getNightMode()) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
} else {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
}
mDatabase = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "database").addMigrations(AppDatabase.MIGRATION_1_2, AppDatabase.MIGRATION_2_3, AppDatabase.MIGRATION_3_4, AppDatabase.MIGRATION_4_5, AppDatabase.MIGRATION_5_6, AppDatabase.MIGRATION_6_7).allowMainThreadQueries().build();
LiveData<List<WorkInfo>> workStatus = WorkManager.getInstance(this).getWorkInfosForUniqueWorkLiveData(MULTIPLY_DOWNLOAD);
workStatus.observeForever(workInfos -> {
if (workInfos != null) {
if (workInfos.size() > 0) {
WorkInfo info = workInfos.get(0);
if (info != null) {
switch(info.getState()) {
case ENQUEUED:
sNotificator.showMassDownloadInQueueMessage();
break;
case RUNNING:
sNotificator.hideMassDownloadInQueueMessage();
break;
case SUCCEEDED:
sNotificator.cancelBookLoadNotification();
break;
default:
}
}
}
}
});
} | @Override
public void onCreate() {
super.onCreate();
instance = this;
return instance;
if (isTestVersion) {
LogHandler.getInstance().initLog();
sNotificator.showTestVersionNotification();
}
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
Log.d("surprise", "App onCreate 162: app version is " + Grammar.getAppVersion());
Log.d("surprise", "App startTor 246: Tor start initiated");
if (!isExternalVpn()) {
if (!torInitInProgress) {
Constraints constraints = new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build();
OneTimeWorkRequest startTorWork = new OneTimeWorkRequest.Builder(StartTorWorker.class).addTag(START_TOR).setConstraints(constraints).build();
WorkManager.getInstance(this).enqueueUniqueWork(START_TOR, ExistingWorkPolicy.REPLACE, startTorWork);
}
} else {
Log.d("surprise", "App startTor 257: tor initiation skipped, use external VPN");
GlobalWebClient.mConnectionState.postValue(GlobalWebClient.CONNECTED);
}
if (getNightMode()) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
} else {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
}
mDatabase = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "database").addMigrations(AppDatabase.MIGRATION_1_2, AppDatabase.MIGRATION_2_3, AppDatabase.MIGRATION_3_4, AppDatabase.MIGRATION_4_5, AppDatabase.MIGRATION_5_6, AppDatabase.MIGRATION_6_7).allowMainThreadQueries().build();
<DeepExtract>
LiveData<List<WorkInfo>> workStatus = WorkManager.getInstance(this).getWorkInfosForUniqueWorkLiveData(MULTIPLY_DOWNLOAD);
workStatus.observeForever(workInfos -> {
if (workInfos != null) {
if (workInfos.size() > 0) {
WorkInfo info = workInfos.get(0);
if (info != null) {
switch(info.getState()) {
case ENQUEUED:
sNotificator.showMassDownloadInQueueMessage();
break;
case RUNNING:
sNotificator.hideMassDownloadInQueueMessage();
break;
case SUCCEEDED:
sNotificator.cancelBookLoadNotification();
break;
default:
}
}
}
}
});
</DeepExtract>
} | FlibustaBookLoader | positive | 439,391 |
@Override
public List<? extends ForecastRegion> getRegions() {
List<Province> out = new ArrayList<>();
SQLiteDatabase db = this.getReadableDatabase();
Cursor c = db.query("provinces", null, "1", new String[] {}, null, null, getOrderBy(lang), null);
if (c != null) {
if (c.getCount() > 0) {
for (int i = 0; i < c.getCount(); i++) {
c.moveToPosition(i);
out.add(provinceFromCursor(c));
}
}
c.close();
}
db.close();
return out;
} | @Override
public List<? extends ForecastRegion> getRegions() {
<DeepExtract>
List<Province> out = new ArrayList<>();
SQLiteDatabase db = this.getReadableDatabase();
Cursor c = db.query("provinces", null, "1", new String[] {}, null, null, getOrderBy(lang), null);
if (c != null) {
if (c.getCount() > 0) {
for (int i = 0; i < c.getCount(); i++) {
c.moveToPosition(i);
out.add(provinceFromCursor(c));
}
}
c.close();
}
db.close();
return out;
</DeepExtract>
} | CanadaWeather | positive | 439,393 |
@Override
protected void provide() {
String imagePath = "PrivacyStreams/image_" + TimeUtils.getTimeTag() + ".jpg";
File tempImageFile = StorageUtils.getValidFile(this.getContext(), imagePath, true);
this.imagePath = tempImageFile.getAbsolutePath();
PSCameraActivity.setListener(this);
Intent intent = new Intent(this.getContext(), PSCameraActivity.class);
this.getContext().startActivity(intent);
} | @Override
protected void provide() {
<DeepExtract>
String imagePath = "PrivacyStreams/image_" + TimeUtils.getTimeTag() + ".jpg";
File tempImageFile = StorageUtils.getValidFile(this.getContext(), imagePath, true);
this.imagePath = tempImageFile.getAbsolutePath();
PSCameraActivity.setListener(this);
Intent intent = new Intent(this.getContext(), PSCameraActivity.class);
this.getContext().startActivity(intent);
</DeepExtract>
} | PrivacyStreams | positive | 439,397 |
@SuppressWarnings("unused")
final public String string() throws ParseException {
Token oldToken = token;
if ((token = jj_nt).next != null)
jj_nt = jj_nt.next;
else
jj_nt = jj_nt.next = token_source.getNextToken();
if (token.kind == STRING_BODY) {
jj_gen++;
if (++jj_gc > 100) {
jj_gc = 0;
for (int i = 0; i < jj_2_rtns.length; i++) {
JJCalls c = jj_2_rtns[i];
while (c != null) {
if (c.gen < jj_gen)
c.first = null;
c = c.next;
}
}
}
return token;
}
jj_nt = token;
token = oldToken;
jj_kind = STRING_BODY;
throw generateParseException();
{
if (true)
return token.image.trim();
}
throw new Error("Missing return statement in function");
} | @SuppressWarnings("unused")
final public String string() throws ParseException {
<DeepExtract>
Token oldToken = token;
if ((token = jj_nt).next != null)
jj_nt = jj_nt.next;
else
jj_nt = jj_nt.next = token_source.getNextToken();
if (token.kind == STRING_BODY) {
jj_gen++;
if (++jj_gc > 100) {
jj_gc = 0;
for (int i = 0; i < jj_2_rtns.length; i++) {
JJCalls c = jj_2_rtns[i];
while (c != null) {
if (c.gen < jj_gen)
c.first = null;
c = c.next;
}
}
}
return token;
}
jj_nt = token;
token = oldToken;
jj_kind = STRING_BODY;
throw generateParseException();
</DeepExtract>
{
if (true)
return token.image.trim();
}
throw new Error("Missing return statement in function");
} | opensoc-streaming | positive | 439,398 |
public void reloadConfigProperties() {
configList.clearElements();
configList.addElement(new GuiLabel(TextFormatting.UNDERLINE + I18n.get("pi.config.basic_config")).setYSize(12).setShadow(false).setHoverableTextCol(hovering -> StyleHandler.getInt("user_dialogs." + TEXT_COLOUR.getName())));
configList.addElement(new ConfigProperty(this, "pi.config.open_style_settings").setAction(() -> styleEditor.toggleShown(true, 550)).setCloseOnClick(true));
configList.addElement(new ConfigProperty(this, () -> "pi.config.set_pi_language", () -> (LanguageManager.isCustomUserLanguageSet() ? "" : I18n.get("pi.lang.mc_default") + " ") + LanguageManager.LANG_NAME_MAP.get(LanguageManager.getUserLanguage())).setHoverText(I18n.get("pi.config.set_pi_language.info"), TextFormatting.GRAY + I18n.get("pi.config.set_pi_language_note.info")).setAction(this::openLanguageSelector));
configList.addElement(new ConfigProperty(this, () -> "pi.config.max_tabs", () -> String.valueOf(PIConfig.maxTabs)).setHoverText(I18n.get("pi.config.max_tabs.info")).setAction(() -> {
GuiTextFieldDialog dialog = new GuiTextFieldDialog(this, I18n.get("pi.config.max_tabs.title"));
dialog.setXSize(200).setMaxLength(4096);
dialog.addChild(new StyledGuiRect("user_dialogs").setPosAndSize(dialog));
dialog.setTitleColour(StyleHandler.getInt("user_dialogs." + StyleHandler.StyleType.TEXT_COLOUR.getName()));
dialog.setText(String.valueOf(PIConfig.maxTabs));
dialog.setValidator(value -> value.isEmpty() || Utils.validInteger(value));
dialog.addTextConfirmCallback(s -> {
PIConfig.maxTabs = MathHelper.clip(Utils.parseInt(s, true), 1, 64);
PIConfig.save();
});
dialog.showCenter(displayZLevel + 50);
}));
configList.addElement(new ConfigProperty(this, () -> "pi.config.et_fluid", () -> PIConfig.etCheckFluid + "").setAction(() -> PIConfig.etCheckFluid = !PIConfig.etCheckFluid).setHoverText(I18n.get("pi.config.et_fluid.info")));
configList.addElement(new GuiLabel(TextFormatting.UNDERLINE + I18n.get("pi.config.advanced_config")).setYSize(12).setShadow(false).setHoverableTextCol(hovering -> StyleHandler.getInt("user_dialogs." + TEXT_COLOUR.getName())));
configList.addElement(new ConfigProperty(this, () -> "pi.config.edit_mode", () -> PIConfig.editMode() + "").setAction(() -> {
PIConfig.setEditMode(!PIConfig.editMode());
if (!PIConfig.editMode()) {
PIGuiHelper.closeEditor();
}
PIConfig.save();
if (PIConfig.editMode() && !new File(PIConfig.editingRepoLoc).exists()) {
reloadConfigProperties();
displayRepoSetDialog();
} else {
DocumentationManager.checkAndReloadDocFiles();
if (getParent() != null)
getParent().reloadElement();
reloadConfigProperties();
}
}));
if (PIConfig.editMode()) {
addConfig(new ConfigProperty(this, () -> "pi.config.edit_repo_loc", () -> PIConfig.editingRepoLoc.isEmpty() ? "[Not Set]" : PIConfig.editingRepoLoc).setHoverText(I18n.get("pi.config.edit_repo_loc.info")).setAction(() -> {
displayRepoSetDialog();
}));
}
configList.addElement(new ConfigProperty(this, () -> PIConfig.editMode() ? "pi.config.reload_from_disk" : "pi.config.reload_documentation").setHoverText(PIConfig.editMode() ? I18n.get("pi.config.reload_from_disk.info") : I18n.get("pi.config.reload_documentation.info")).setAction(DocumentationManager::checkAndReloadDocFiles));
if (PIConfig.editMode()) {
addConfig(new ConfigProperty(this, "pi.config.open_editor").setAction(PIGuiHelper::displayEditor));
}
if (Screen.hasShiftDown()) {
addConfig(new ConfigProperty(this, () -> "Reset PI and clear image cache").setAction(PIConfig::deleteConfigAndReload));
}
} | public void reloadConfigProperties() {
configList.clearElements();
configList.addElement(new GuiLabel(TextFormatting.UNDERLINE + I18n.get("pi.config.basic_config")).setYSize(12).setShadow(false).setHoverableTextCol(hovering -> StyleHandler.getInt("user_dialogs." + TEXT_COLOUR.getName())));
configList.addElement(new ConfigProperty(this, "pi.config.open_style_settings").setAction(() -> styleEditor.toggleShown(true, 550)).setCloseOnClick(true));
configList.addElement(new ConfigProperty(this, () -> "pi.config.set_pi_language", () -> (LanguageManager.isCustomUserLanguageSet() ? "" : I18n.get("pi.lang.mc_default") + " ") + LanguageManager.LANG_NAME_MAP.get(LanguageManager.getUserLanguage())).setHoverText(I18n.get("pi.config.set_pi_language.info"), TextFormatting.GRAY + I18n.get("pi.config.set_pi_language_note.info")).setAction(this::openLanguageSelector));
configList.addElement(new ConfigProperty(this, () -> "pi.config.max_tabs", () -> String.valueOf(PIConfig.maxTabs)).setHoverText(I18n.get("pi.config.max_tabs.info")).setAction(() -> {
GuiTextFieldDialog dialog = new GuiTextFieldDialog(this, I18n.get("pi.config.max_tabs.title"));
dialog.setXSize(200).setMaxLength(4096);
dialog.addChild(new StyledGuiRect("user_dialogs").setPosAndSize(dialog));
dialog.setTitleColour(StyleHandler.getInt("user_dialogs." + StyleHandler.StyleType.TEXT_COLOUR.getName()));
dialog.setText(String.valueOf(PIConfig.maxTabs));
dialog.setValidator(value -> value.isEmpty() || Utils.validInteger(value));
dialog.addTextConfirmCallback(s -> {
PIConfig.maxTabs = MathHelper.clip(Utils.parseInt(s, true), 1, 64);
PIConfig.save();
});
dialog.showCenter(displayZLevel + 50);
}));
configList.addElement(new ConfigProperty(this, () -> "pi.config.et_fluid", () -> PIConfig.etCheckFluid + "").setAction(() -> PIConfig.etCheckFluid = !PIConfig.etCheckFluid).setHoverText(I18n.get("pi.config.et_fluid.info")));
configList.addElement(new GuiLabel(TextFormatting.UNDERLINE + I18n.get("pi.config.advanced_config")).setYSize(12).setShadow(false).setHoverableTextCol(hovering -> StyleHandler.getInt("user_dialogs." + TEXT_COLOUR.getName())));
configList.addElement(new ConfigProperty(this, () -> "pi.config.edit_mode", () -> PIConfig.editMode() + "").setAction(() -> {
PIConfig.setEditMode(!PIConfig.editMode());
if (!PIConfig.editMode()) {
PIGuiHelper.closeEditor();
}
PIConfig.save();
if (PIConfig.editMode() && !new File(PIConfig.editingRepoLoc).exists()) {
reloadConfigProperties();
displayRepoSetDialog();
} else {
DocumentationManager.checkAndReloadDocFiles();
if (getParent() != null)
getParent().reloadElement();
reloadConfigProperties();
}
}));
if (PIConfig.editMode()) {
addConfig(new ConfigProperty(this, () -> "pi.config.edit_repo_loc", () -> PIConfig.editingRepoLoc.isEmpty() ? "[Not Set]" : PIConfig.editingRepoLoc).setHoverText(I18n.get("pi.config.edit_repo_loc.info")).setAction(() -> {
displayRepoSetDialog();
}));
}
<DeepExtract>
configList.addElement(new ConfigProperty(this, () -> PIConfig.editMode() ? "pi.config.reload_from_disk" : "pi.config.reload_documentation").setHoverText(PIConfig.editMode() ? I18n.get("pi.config.reload_from_disk.info") : I18n.get("pi.config.reload_documentation.info")).setAction(DocumentationManager::checkAndReloadDocFiles));
</DeepExtract>
if (PIConfig.editMode()) {
addConfig(new ConfigProperty(this, "pi.config.open_editor").setAction(PIGuiHelper::displayEditor));
}
if (Screen.hasShiftDown()) {
addConfig(new ConfigProperty(this, () -> "Reset PI and clear image cache").setAction(PIConfig::deleteConfigAndReload));
}
} | ProjectIntelligence | positive | 439,399 |
@Override
public void onClick(View v) {
String name = remoteName.getText().toString();
boolean error = false;
if (name.trim().isEmpty()) {
remoteNameInputLayout.setErrorEnabled(true);
remoteNameInputLayout.setError(getString(R.string.remote_name_cannot_be_empty));
error = true;
} else {
remoteNameInputLayout.setErrorEnabled(false);
}
if (remotePath == null) {
remoteSelectorLine.setBackgroundColor(Color.parseColor("#B14525"));
error = true;
}
if (error) {
return;
}
ArrayList<String> options = new ArrayList<>();
options.add(name);
options.add("alias");
options.add("remote");
options.add(remotePath);
Process process = rclone.configCreate(options);
try {
process.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
if (process.exitValue() != 0) {
Toasty.error(context, getString(R.string.error_creating_remote), Toast.LENGTH_SHORT, true).show();
} else {
Toasty.success(context, getString(R.string.remote_creation_success), Toast.LENGTH_SHORT, true).show();
}
if (getActivity() != null) {
getActivity().finish();
}
} | @Override
public void onClick(View v) {
<DeepExtract>
String name = remoteName.getText().toString();
boolean error = false;
if (name.trim().isEmpty()) {
remoteNameInputLayout.setErrorEnabled(true);
remoteNameInputLayout.setError(getString(R.string.remote_name_cannot_be_empty));
error = true;
} else {
remoteNameInputLayout.setErrorEnabled(false);
}
if (remotePath == null) {
remoteSelectorLine.setBackgroundColor(Color.parseColor("#B14525"));
error = true;
}
if (error) {
return;
}
ArrayList<String> options = new ArrayList<>();
options.add(name);
options.add("alias");
options.add("remote");
options.add(remotePath);
Process process = rclone.configCreate(options);
try {
process.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
if (process.exitValue() != 0) {
Toasty.error(context, getString(R.string.error_creating_remote), Toast.LENGTH_SHORT, true).show();
} else {
Toasty.success(context, getString(R.string.remote_creation_success), Toast.LENGTH_SHORT, true).show();
}
if (getActivity() != null) {
getActivity().finish();
}
</DeepExtract>
} | rcloneExplorer | positive | 439,403 |
public void retrievePostsWithSearchQuery(PostSearchQueryParameters queryParameters, PostListResponseHandler responseHandler) {
if (new AppDotNetApiRequest(responseHandler, queryParameters, ENDPOINT_POSTS, "search").isAuthenticated() && !hasToken()) {
throw new IllegalStateException("authentication token not set");
}
final AppDotNetClientTask task = new AppDotNetClientTask(context, authHeader, languageHeader, sslSocketFactory);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new AppDotNetApiRequest(responseHandler, queryParameters, ENDPOINT_POSTS, "search"));
} else {
task.execute(new AppDotNetApiRequest(responseHandler, queryParameters, ENDPOINT_POSTS, "search"));
}
} | public void retrievePostsWithSearchQuery(PostSearchQueryParameters queryParameters, PostListResponseHandler responseHandler) {
<DeepExtract>
if (new AppDotNetApiRequest(responseHandler, queryParameters, ENDPOINT_POSTS, "search").isAuthenticated() && !hasToken()) {
throw new IllegalStateException("authentication token not set");
}
final AppDotNetClientTask task = new AppDotNetClientTask(context, authHeader, languageHeader, sslSocketFactory);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new AppDotNetApiRequest(responseHandler, queryParameters, ENDPOINT_POSTS, "search"));
} else {
task.execute(new AppDotNetApiRequest(responseHandler, queryParameters, ENDPOINT_POSTS, "search"));
}
</DeepExtract>
} | ADNLib | positive | 439,405 |
@Override
public CheckVulnerabilitiesResult checkVulnerabilities(CheckVulnerabilitiesRequest request) throws WssServiceException {
R result;
String response = "";
try {
HttpRequestBase httpRequest = createHttpRequest(request);
RequestConfig requestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD).build();
httpRequest.setConfig(requestConfig);
logger.trace("Calling White Source service: " + request);
response = httpClient.execute(httpRequest, new BasicResponseHandler());
String data = extractResultData(response);
logger.trace("Result data is: " + data);
switch(request.type()) {
case UPDATE:
result = (R) gson.fromJson(data, UpdateInventoryResult.class);
break;
case CHECK_POLICIES:
result = (R) gson.fromJson(data, CheckPoliciesResult.class);
break;
case CHECK_POLICY_COMPLIANCE:
result = (R) gson.fromJson(data, CheckPolicyComplianceResult.class);
break;
case ASYNC_CHECK_POLICY_COMPLIANCE:
result = (R) gson.fromJson(data, AsyncCheckPolicyComplianceResult.class);
break;
case ASYNC_CHECK_POLICY_COMPLIANCE_STATUS:
result = (R) gson.fromJson(data, AsyncCheckPolicyComplianceStatusResult.class);
break;
case ASYNC_CHECK_POLICY_COMPLIANCE_RESPONSE:
result = (R) gson.fromJson(data, AsyncCheckPolicyComplianceResponseResult.class);
break;
case CHECK_VULNERABILITIES:
result = (R) gson.fromJson(data, CheckVulnerabilitiesResult.class);
break;
case GET_CLOUD_NATIVE_VULNERABILITIES:
result = (R) gson.fromJson(data, GetCloudNativeVulnerabilitiesResult.class);
break;
case GET_DEPENDENCY_DATA:
result = (R) gson.fromJson(data, GetDependencyDataResult.class);
break;
case SUMMARY_SCAN:
result = (R) gson.fromJson(data, SummaryScanResult.class);
break;
case GET_CONFIGURATION:
result = (R) gson.fromJson(data, ConfigurationResult.class);
break;
default:
throw new IllegalStateException("Unsupported request type.");
}
} catch (JsonSyntaxException e) {
throw new WssServiceException("JsonSyntax exception. Response data is: " + response + e.getMessage(), e);
} catch (HttpResponseException e) {
throw new WssServiceException("Unexpected error. Response data is: " + response + e.getMessage() + " Error code is " + e.getStatusCode(), e.getCause(), e.getStatusCode());
} catch (IOException e) {
throw new WssServiceException("Unexpected error. Response data is: " + response + e.getMessage(), e);
}
return result;
} | @Override
public CheckVulnerabilitiesResult checkVulnerabilities(CheckVulnerabilitiesRequest request) throws WssServiceException {
<DeepExtract>
R result;
String response = "";
try {
HttpRequestBase httpRequest = createHttpRequest(request);
RequestConfig requestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD).build();
httpRequest.setConfig(requestConfig);
logger.trace("Calling White Source service: " + request);
response = httpClient.execute(httpRequest, new BasicResponseHandler());
String data = extractResultData(response);
logger.trace("Result data is: " + data);
switch(request.type()) {
case UPDATE:
result = (R) gson.fromJson(data, UpdateInventoryResult.class);
break;
case CHECK_POLICIES:
result = (R) gson.fromJson(data, CheckPoliciesResult.class);
break;
case CHECK_POLICY_COMPLIANCE:
result = (R) gson.fromJson(data, CheckPolicyComplianceResult.class);
break;
case ASYNC_CHECK_POLICY_COMPLIANCE:
result = (R) gson.fromJson(data, AsyncCheckPolicyComplianceResult.class);
break;
case ASYNC_CHECK_POLICY_COMPLIANCE_STATUS:
result = (R) gson.fromJson(data, AsyncCheckPolicyComplianceStatusResult.class);
break;
case ASYNC_CHECK_POLICY_COMPLIANCE_RESPONSE:
result = (R) gson.fromJson(data, AsyncCheckPolicyComplianceResponseResult.class);
break;
case CHECK_VULNERABILITIES:
result = (R) gson.fromJson(data, CheckVulnerabilitiesResult.class);
break;
case GET_CLOUD_NATIVE_VULNERABILITIES:
result = (R) gson.fromJson(data, GetCloudNativeVulnerabilitiesResult.class);
break;
case GET_DEPENDENCY_DATA:
result = (R) gson.fromJson(data, GetDependencyDataResult.class);
break;
case SUMMARY_SCAN:
result = (R) gson.fromJson(data, SummaryScanResult.class);
break;
case GET_CONFIGURATION:
result = (R) gson.fromJson(data, ConfigurationResult.class);
break;
default:
throw new IllegalStateException("Unsupported request type.");
}
} catch (JsonSyntaxException e) {
throw new WssServiceException("JsonSyntax exception. Response data is: " + response + e.getMessage(), e);
} catch (HttpResponseException e) {
throw new WssServiceException("Unexpected error. Response data is: " + response + e.getMessage() + " Error code is " + e.getStatusCode(), e.getCause(), e.getStatusCode());
} catch (IOException e) {
throw new WssServiceException("Unexpected error. Response data is: " + response + e.getMessage(), e);
}
return result;
</DeepExtract>
} | agents | positive | 439,406 |
@Override
public void run() {
WorkerListener l = workerListener;
if (l != null) {
l.onWorkerStarted();
}
maxPacketOutSize = connection.getMaxPacketOutSize();
maxPacketInSize = connection.getMaxPacketInSize();
if (maxPacketOutSize <= 0 || maxPacketOutSize > 0xffff) {
onUsbError(String.format("Usb initialization error: out size invalid %d", maxPacketOutSize));
return;
}
if (maxPacketInSize <= 0 || maxPacketInSize > 0xffff) {
onUsbError(String.format("usb initialization error: in size invalid %d", maxPacketInSize));
return;
}
smallIn = ByteBuffer.allocate(Math.max(maxPacketInSize, maxPacketOutSize));
smallIn.order(ByteOrder.LITTLE_ENDIAN);
bigIn1 = ByteBuffer.allocate(bigInSize);
bigIn1.order(ByteOrder.LITTLE_ENDIAN);
bigIn2 = ByteBuffer.allocate(bigInSize);
bigIn2.order(ByteOrder.LITTLE_ENDIAN);
bigIn3 = ByteBuffer.allocate(bigInSize);
bigIn3.order(ByteOrder.LITTLE_ENDIAN);
fullIn = ByteBuffer.allocate(fullInSize);
fullIn.order(ByteOrder.LITTLE_ENDIAN);
r1 = connection.createInRequest();
r2 = connection.createInRequest();
r3 = connection.createInRequest();
while (true) {
synchronized (this) {
if (stop) {
break;
}
}
if (lastEventCheck + AppConfig.EVENTCHECK_PERIOD < System.currentTimeMillis()) {
lastEventCheck = System.currentTimeMillis();
PtpCamera.this.queueEventCheck();
}
PtpAction action = null;
try {
action = queue.poll(1000, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
}
if (action != null) {
action.exec(this);
}
}
r3.close();
r2.close();
r1.close();
WorkerListener l = workerListener;
if (l != null) {
l.onWorkerEnded();
}
} | @Override
public void run() {
WorkerListener l = workerListener;
if (l != null) {
l.onWorkerStarted();
}
maxPacketOutSize = connection.getMaxPacketOutSize();
maxPacketInSize = connection.getMaxPacketInSize();
if (maxPacketOutSize <= 0 || maxPacketOutSize > 0xffff) {
onUsbError(String.format("Usb initialization error: out size invalid %d", maxPacketOutSize));
return;
}
if (maxPacketInSize <= 0 || maxPacketInSize > 0xffff) {
onUsbError(String.format("usb initialization error: in size invalid %d", maxPacketInSize));
return;
}
smallIn = ByteBuffer.allocate(Math.max(maxPacketInSize, maxPacketOutSize));
smallIn.order(ByteOrder.LITTLE_ENDIAN);
bigIn1 = ByteBuffer.allocate(bigInSize);
bigIn1.order(ByteOrder.LITTLE_ENDIAN);
bigIn2 = ByteBuffer.allocate(bigInSize);
bigIn2.order(ByteOrder.LITTLE_ENDIAN);
bigIn3 = ByteBuffer.allocate(bigInSize);
bigIn3.order(ByteOrder.LITTLE_ENDIAN);
fullIn = ByteBuffer.allocate(fullInSize);
fullIn.order(ByteOrder.LITTLE_ENDIAN);
r1 = connection.createInRequest();
r2 = connection.createInRequest();
r3 = connection.createInRequest();
while (true) {
synchronized (this) {
if (stop) {
break;
}
}
if (lastEventCheck + AppConfig.EVENTCHECK_PERIOD < System.currentTimeMillis()) {
lastEventCheck = System.currentTimeMillis();
PtpCamera.this.queueEventCheck();
}
PtpAction action = null;
try {
action = queue.poll(1000, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
}
if (action != null) {
action.exec(this);
}
}
r3.close();
r2.close();
r1.close();
<DeepExtract>
WorkerListener l = workerListener;
if (l != null) {
l.onWorkerEnded();
}
</DeepExtract>
} | remoteyourcam-usb | positive | 439,407 |
private void controllerStatusMouseReleased(java.awt.event.MouseEvent evt) {
Controller current = dev.get();
if (current != null) {
try {
current.close();
} catch (IOException ex) {
Logger.getLogger(ControlTower.class.getName()).error("", ex);
}
}
try {
dev.set(findController());
} catch (IOException ex) {
Logger.getLogger(ControlTower.class.getName()).error("{0}", ex);
}
if (dev.get() == null) {
System.err.println("No suitable controller found! Using keyboard");
dev.set(new KeyboardController(this));
updateControllerStatus(false);
} else {
System.err.println("Gamepad controller found");
updateControllerStatus(true);
}
} | private void controllerStatusMouseReleased(java.awt.event.MouseEvent evt) {
<DeepExtract>
Controller current = dev.get();
if (current != null) {
try {
current.close();
} catch (IOException ex) {
Logger.getLogger(ControlTower.class.getName()).error("", ex);
}
}
try {
dev.set(findController());
} catch (IOException ex) {
Logger.getLogger(ControlTower.class.getName()).error("{0}", ex);
}
if (dev.get() == null) {
System.err.println("No suitable controller found! Using keyboard");
dev.set(new KeyboardController(this));
updateControllerStatus(false);
} else {
System.err.println("Gamepad controller found");
updateControllerStatus(true);
}
</DeepExtract>
} | javadrone | positive | 439,408 |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SDKInitializer.initialize(getApplication());
SharedPreferences read = getSharedPreferences("data", MODE_PRIVATE);
String mobileNo = read.getString("mobileNo", "");
boolean hasLogined = read.getBoolean("hasLogined", false);
if (!hasLogined) {
Intent intent = new Intent(this, LoginActivity.class);
startActivity(intent);
}
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
tabFirstPage = (TextView) findViewById(R.id.tab_first_page);
tabWallet = (TextView) findViewById(R.id.tab_circulate);
tabMy = (TextView) findViewById(R.id.tab_my);
tabFirstPage.setOnClickListener(this);
tabWallet.setOnClickListener(this);
tabMy.setOnClickListener(this);
int id = getIntent().getIntExtra("id", -1);
if (id == -1) {
tabFirstPage.performClick();
} else {
tabMy.performClick();
}
} | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SDKInitializer.initialize(getApplication());
SharedPreferences read = getSharedPreferences("data", MODE_PRIVATE);
String mobileNo = read.getString("mobileNo", "");
boolean hasLogined = read.getBoolean("hasLogined", false);
if (!hasLogined) {
Intent intent = new Intent(this, LoginActivity.class);
startActivity(intent);
}
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
<DeepExtract>
tabFirstPage = (TextView) findViewById(R.id.tab_first_page);
tabWallet = (TextView) findViewById(R.id.tab_circulate);
tabMy = (TextView) findViewById(R.id.tab_my);
tabFirstPage.setOnClickListener(this);
tabWallet.setOnClickListener(this);
tabMy.setOnClickListener(this);
int id = getIntent().getIntExtra("id", -1);
if (id == -1) {
tabFirstPage.performClick();
} else {
tabMy.performClick();
}
</DeepExtract>
} | Ethereum-Coupon | positive | 439,410 |
public byte[] printBitmap(Bitmap bitmap) {
if (bitmap == null) {
return new byte[0];
}
int width = ((576 + 7) / 8) * 8;
int height = bitmap.getHeight() * width / bitmap.getWidth();
height = ((height + 7) / 8) * 8;
Bitmap rszBitmap = ImageProcessing.resizeImage(bitmap, width, height);
Bitmap grayBitmap = ImageProcessing.toGrayscale(rszBitmap);
byte[] dithered = bitmapToBWPix(grayBitmap);
byte[] data = eachLinePixToCmd(dithered, width, 0);
return data;
} | public byte[] printBitmap(Bitmap bitmap) {
if (bitmap == null) {
return new byte[0];
}
<DeepExtract>
int width = ((576 + 7) / 8) * 8;
int height = bitmap.getHeight() * width / bitmap.getWidth();
height = ((height + 7) / 8) * 8;
Bitmap rszBitmap = ImageProcessing.resizeImage(bitmap, width, height);
Bitmap grayBitmap = ImageProcessing.toGrayscale(rszBitmap);
byte[] dithered = bitmapToBWPix(grayBitmap);
byte[] data = eachLinePixToCmd(dithered, width, 0);
return data;
</DeepExtract>
} | FrameCode | positive | 439,411 |
@Test
@SuppressWarnings("unchecked")
public void shouldReplyQueryWithout() {
init(senderMock);
when(senderMock.sendNoConfirm(any(), anyString(), anyString(), anyMap(), anyBoolean())).thenReturn(Mono.empty());
From from = new From();
from.setReplyID("replyId");
from.setCorrelationID("correlationId");
Mono<Void> result = asyncGateway.reply(null, from);
StepVerifier.create(result).verifyComplete();
ArgumentCaptor<Map<String, Object>> headersCaptor = ArgumentCaptor.forClass(Map.class);
verify(senderMock, times(1)).sendNoConfirm(eq(null), eq("globalReply"), eq("replyId"), headersCaptor.capture(), anyBoolean());
assertThat(headersCaptor.getValue().get(CORRELATION_ID)).isEqualTo("correlationId");
assertThat(headersCaptor.getValue().get(COMPLETION_ONLY_SIGNAL)).isEqualTo(Boolean.TRUE.toString());
} | @Test
@SuppressWarnings("unchecked")
public void shouldReplyQueryWithout() {
<DeepExtract>
init(senderMock);
when(senderMock.sendNoConfirm(any(), anyString(), anyString(), anyMap(), anyBoolean())).thenReturn(Mono.empty());
</DeepExtract>
From from = new From();
from.setReplyID("replyId");
from.setCorrelationID("correlationId");
Mono<Void> result = asyncGateway.reply(null, from);
StepVerifier.create(result).verifyComplete();
ArgumentCaptor<Map<String, Object>> headersCaptor = ArgumentCaptor.forClass(Map.class);
verify(senderMock, times(1)).sendNoConfirm(eq(null), eq("globalReply"), eq("replyId"), headersCaptor.capture(), anyBoolean());
assertThat(headersCaptor.getValue().get(CORRELATION_ID)).isEqualTo("correlationId");
assertThat(headersCaptor.getValue().get(COMPLETION_ONLY_SIGNAL)).isEqualTo(Boolean.TRUE.toString());
} | reactive-commons-java | positive | 439,413 |
@Override
public <T> List<T> findAllByAttribute(Class<T> type, String attribute, String value) {
try {
return () -> webContext.findAllByAttribute(type, attribute, value).get();
} catch (NoSuchFrameException | NoSuchWindowException | NoSuchSessionException e) {
throw new FindableNotPresentException(this, e);
}
} | @Override
public <T> List<T> findAllByAttribute(Class<T> type, String attribute, String value) {
<DeepExtract>
try {
return () -> webContext.findAllByAttribute(type, attribute, value).get();
} catch (NoSuchFrameException | NoSuchWindowException | NoSuchSessionException e) {
throw new FindableNotPresentException(this, e);
}
</DeepExtract>
} | darcy-webdriver | positive | 439,414 |
public static void main(String[] args) {
final SimplestCase simplestCase = new SimplestCase();
mediaDriver = ArchivingMediaDriver.launch(new MediaDriver.Context().spiesSimulateConnection(true).dirDeleteOnStart(true), new Archive.Context().deleteArchiveOnStart(true).archiveDir(tempDir));
aeron = Aeron.connect();
aeronArchive = AeronArchive.connect(new AeronArchive.Context().aeron(aeron));
LOGGER.info("Writing");
aeronArchive.startRecording(channel, streamCapture, SourceLocation.LOCAL);
try (ExclusivePublication publication = aeron.addExclusivePublication(channel, streamCapture)) {
while (!publication.isConnected()) {
idleStrategy.idle();
}
for (int i = 0; i <= sendCount; i++) {
buffer.putInt(0, i);
while (publication.offer(buffer, 0, Integer.BYTES) < 0) {
idleStrategy.idle();
}
}
final long stopPosition = publication.position();
final CountersReader countersReader = aeron.countersReader();
final int counterId = RecordingPos.findCounterIdBySession(countersReader, publication.sessionId());
while (countersReader.getCounterValue(counterId) < stopPosition) {
idleStrategy.idle();
}
}
LOGGER.info("Reading");
try (AeronArchive reader = AeronArchive.connect(new AeronArchive.Context().aeron(aeron))) {
final long recordingId = findLatestRecording(reader, channel, streamCapture);
final long position = 0L;
final long length = Long.MAX_VALUE;
final long sessionId = reader.startReplay(recordingId, position, length, channel, streamReplay);
final String channelRead = ChannelUri.addSessionId(channel, (int) sessionId);
final Subscription subscription = reader.context().aeron().addSubscription(channelRead, streamReplay);
while (!subscription.isConnected()) {
idleStrategy.idle();
}
while (!complete) {
int fragments = subscription.poll(this::archiveReader, 1);
idleStrategy.idle(fragments);
}
}
CloseHelper.quietClose(aeronArchive);
CloseHelper.quietClose(aeron);
CloseHelper.quietClose(mediaDriver);
} | public static void main(String[] args) {
final SimplestCase simplestCase = new SimplestCase();
mediaDriver = ArchivingMediaDriver.launch(new MediaDriver.Context().spiesSimulateConnection(true).dirDeleteOnStart(true), new Archive.Context().deleteArchiveOnStart(true).archiveDir(tempDir));
aeron = Aeron.connect();
aeronArchive = AeronArchive.connect(new AeronArchive.Context().aeron(aeron));
LOGGER.info("Writing");
aeronArchive.startRecording(channel, streamCapture, SourceLocation.LOCAL);
try (ExclusivePublication publication = aeron.addExclusivePublication(channel, streamCapture)) {
while (!publication.isConnected()) {
idleStrategy.idle();
}
for (int i = 0; i <= sendCount; i++) {
buffer.putInt(0, i);
while (publication.offer(buffer, 0, Integer.BYTES) < 0) {
idleStrategy.idle();
}
}
final long stopPosition = publication.position();
final CountersReader countersReader = aeron.countersReader();
final int counterId = RecordingPos.findCounterIdBySession(countersReader, publication.sessionId());
while (countersReader.getCounterValue(counterId) < stopPosition) {
idleStrategy.idle();
}
}
LOGGER.info("Reading");
try (AeronArchive reader = AeronArchive.connect(new AeronArchive.Context().aeron(aeron))) {
final long recordingId = findLatestRecording(reader, channel, streamCapture);
final long position = 0L;
final long length = Long.MAX_VALUE;
final long sessionId = reader.startReplay(recordingId, position, length, channel, streamReplay);
final String channelRead = ChannelUri.addSessionId(channel, (int) sessionId);
final Subscription subscription = reader.context().aeron().addSubscription(channelRead, streamReplay);
while (!subscription.isConnected()) {
idleStrategy.idle();
}
while (!complete) {
int fragments = subscription.poll(this::archiveReader, 1);
idleStrategy.idle(fragments);
}
}
<DeepExtract>
CloseHelper.quietClose(aeronArchive);
CloseHelper.quietClose(aeron);
CloseHelper.quietClose(mediaDriver);
</DeepExtract>
} | aeron-cookbook-code | positive | 439,416 |
@Override
public void run() {
if (performanceMetrics.isEmpty()) {
System.out.println("There is no record in measurement yet. Test is running...");
return;
}
var consoleOutputView = new PerformanceConsoleOutputView(CONTAINER_WIDTH, numberOfUsers, startTime, null != null ? null.getEndTestTime() : null, duration, verificationResult, performanceMetrics, performanceStats, performanceRollingStats);
System.out.println(consoleOutputView.getView());
} | @Override
public void run() {
<DeepExtract>
if (performanceMetrics.isEmpty()) {
System.out.println("There is no record in measurement yet. Test is running...");
return;
}
var consoleOutputView = new PerformanceConsoleOutputView(CONTAINER_WIDTH, numberOfUsers, startTime, null != null ? null.getEndTestTime() : null, duration, verificationResult, performanceMetrics, performanceStats, performanceRollingStats);
System.out.println(consoleOutputView.getView());
</DeepExtract>
} | Rhino | positive | 439,417 |
@Override
public boolean isEmpty() {
if (this == start) {
return true;
}
if (!(start instanceof AbstractRange)) {
return false;
}
AbstractRange that = (AbstractRange) start;
if (!start.equals(that.start)) {
return false;
}
if (!end.equals(that.end)) {
return false;
}
return true;
} | @Override
public boolean isEmpty() {
<DeepExtract>
if (this == start) {
return true;
}
if (!(start instanceof AbstractRange)) {
return false;
}
AbstractRange that = (AbstractRange) start;
if (!start.equals(that.start)) {
return false;
}
if (!end.equals(that.end)) {
return false;
}
return true;
</DeepExtract>
} | commons-ip-math | positive | 439,420 |
public void testIterEmpty() {
Iterator iter = db_.NewIterator(new ReadOptions());
iter.SeekToFirst();
assertTrue(IterStatus(iter).compareTo("(invalid)".toString()) == 0);
iter.SeekToLast();
assertTrue(IterStatus(iter).compareTo("(invalid)".toString()) == 0);
iter.Seek(new Slice("foo"));
assertTrue(IterStatus(iter).compareTo("(invalid)".toString()) == 0);
iter = null;
} | public void testIterEmpty() {
Iterator iter = db_.NewIterator(new ReadOptions());
iter.SeekToFirst();
<DeepExtract>
assertTrue(IterStatus(iter).compareTo("(invalid)".toString()) == 0);
</DeepExtract>
iter.SeekToLast();
<DeepExtract>
assertTrue(IterStatus(iter).compareTo("(invalid)".toString()) == 0);
</DeepExtract>
iter.Seek(new Slice("foo"));
<DeepExtract>
assertTrue(IterStatus(iter).compareTo("(invalid)".toString()) == 0);
</DeepExtract>
iter = null;
} | leveldb-java | positive | 439,421 |
@Override
public String getDraftSuffix() {
return compositeConfiguration.getString(DRAFT_SUFFIX.getKey(), "");
} | @Override
public String getDraftSuffix() {
<DeepExtract>
return compositeConfiguration.getString(DRAFT_SUFFIX.getKey(), "");
</DeepExtract>
} | jbake | positive | 439,422 |
@Override
public void onScrollChanged() {
int scrollY = mScrollView.getScrollY();
if (scrollY < 0) {
toolbar.getBackground().mutate().setAlpha(0);
return;
}
float radio = Math.min(1, scrollY / (mBanner.getHeight() - toolbar.getHeight() * 1f));
toolbar.getBackground().mutate().setAlpha((int) (radio * 0xFF));
if (mScrollView.getScrollY() >= mBanner.getHeight() - toolbar.getHeight() && !isExpand) {
expand();
isExpand = true;
} else if (mScrollView.getScrollY() <= 0 && isExpand) {
reduce();
isExpand = false;
}
mSwipeRefreshLayout.setEnabled(mScrollView.getScrollY() == 0);
} | @Override
public void onScrollChanged() {
<DeepExtract>
int scrollY = mScrollView.getScrollY();
if (scrollY < 0) {
toolbar.getBackground().mutate().setAlpha(0);
return;
}
float radio = Math.min(1, scrollY / (mBanner.getHeight() - toolbar.getHeight() * 1f));
toolbar.getBackground().mutate().setAlpha((int) (radio * 0xFF));
</DeepExtract>
if (mScrollView.getScrollY() >= mBanner.getHeight() - toolbar.getHeight() && !isExpand) {
expand();
isExpand = true;
} else if (mScrollView.getScrollY() <= 0 && isExpand) {
reduce();
isExpand = false;
}
mSwipeRefreshLayout.setEnabled(mScrollView.getScrollY() == 0);
} | SmartHome | positive | 439,423 |
public static void copyFile(File source, File target) throws IOException {
if (!target.getParentFile().exists()) {
boolean b = target.getParentFile().mkdirs();
if (!b) {
throw new IOException("Could not create directory " + target.getParentFile());
}
return true;
}
return false;
FileUtils.copyFile(source, target);
} | public static void copyFile(File source, File target) throws IOException {
<DeepExtract>
if (!target.getParentFile().exists()) {
boolean b = target.getParentFile().mkdirs();
if (!b) {
throw new IOException("Could not create directory " + target.getParentFile());
}
return true;
}
return false;
</DeepExtract>
FileUtils.copyFile(source, target);
} | license-maven-plugin | positive | 439,425 |
public void headOfStandard(String url) {
Request request = new Request.Builder().method(HEAD, getRequestBody(true, null)).headers(Headers.of()).url(getBuilder(url, Parameters.of()).build()).build();
try (Response response = call(request, url)) {
try (ResponseBody responseBody = response.body()) {
if (null == responseBody) {
return null;
}
return parseObjectOfStandard(null, url, responseBody);
}
}
} | public void headOfStandard(String url) {
<DeepExtract>
Request request = new Request.Builder().method(HEAD, getRequestBody(true, null)).headers(Headers.of()).url(getBuilder(url, Parameters.of()).build()).build();
try (Response response = call(request, url)) {
try (ResponseBody responseBody = response.body()) {
if (null == responseBody) {
return null;
}
return parseObjectOfStandard(null, url, responseBody);
}
}
</DeepExtract>
} | Doramon | positive | 439,426 |
@Override
public void onResume() {
super.onResume();
SharedPreferences prefs = getActivity().getSharedPreferences(SHARED_PREFS_NAME, Context.MODE_PRIVATE);
final String tileSourceName = prefs.getString(PREFS_TITLE_SOURCE, TileSourceFactory.DEFAULT_TILE_SOURCE.name());
setTileSource(tileSourceName);
mMapView.getController().setZoom(prefs.getInt(PREFS_ZOOM_LEVEL, 1));
mMapView.scrollTo(prefs.getInt(PREFS_SCROLL_X, 0), prefs.getInt(PREFS_SCROLL_Y, 0));
mMyLocationOverlay.enableMyLocation(mMyLocationProvider);
mMyLocationOverlay.enableFollowLocation();
mCompassOverlay.enableCompass(this.mCompassOverlay.getOrientationProvider());
} | @Override
public void onResume() {
super.onResume();
<DeepExtract>
SharedPreferences prefs = getActivity().getSharedPreferences(SHARED_PREFS_NAME, Context.MODE_PRIVATE);
final String tileSourceName = prefs.getString(PREFS_TITLE_SOURCE, TileSourceFactory.DEFAULT_TILE_SOURCE.name());
setTileSource(tileSourceName);
mMapView.getController().setZoom(prefs.getInt(PREFS_ZOOM_LEVEL, 1));
mMapView.scrollTo(prefs.getInt(PREFS_SCROLL_X, 0), prefs.getInt(PREFS_SCROLL_Y, 0));
</DeepExtract>
mMyLocationOverlay.enableMyLocation(mMyLocationProvider);
mMyLocationOverlay.enableFollowLocation();
mCompassOverlay.enableCompass(this.mCompassOverlay.getOrientationProvider());
} | RtkGps | positive | 439,428 |
public void addObserver(InventoryObserver pObserver) {
aItems.add(pObserver);
for (InventoryObserver observer : aObservers) {
observer.itemAdded(pObserver);
}
} | public void addObserver(InventoryObserver pObserver) {
<DeepExtract>
aItems.add(pObserver);
for (InventoryObserver observer : aObservers) {
observer.itemAdded(pObserver);
}
</DeepExtract>
} | DesignBook | positive | 439,429 |
public Line xformLine(Line line) {
Vec3f pt = new Vec3f();
Vec3f dir = new Vec3f();
for (int rc = 0; rc < 3; rc++) {
float tmp = 0.0f;
for (int cc = 0; cc < 3; cc++) {
tmp += get(rc, cc) * line.getPoint().get(cc);
}
tmp += get(rc, 3);
pt.set(rc, tmp);
}
for (int rc = 0; rc < 3; rc++) {
float tmp = 0.0f;
for (int cc = 0; cc < 3; cc++) {
tmp += get(rc, cc) * line.getDirection().get(cc);
}
dir.set(rc, tmp);
}
return new Line(dir, pt);
} | public Line xformLine(Line line) {
Vec3f pt = new Vec3f();
Vec3f dir = new Vec3f();
for (int rc = 0; rc < 3; rc++) {
float tmp = 0.0f;
for (int cc = 0; cc < 3; cc++) {
tmp += get(rc, cc) * line.getPoint().get(cc);
}
tmp += get(rc, 3);
pt.set(rc, tmp);
}
<DeepExtract>
for (int rc = 0; rc < 3; rc++) {
float tmp = 0.0f;
for (int cc = 0; cc < 3; cc++) {
tmp += get(rc, cc) * line.getDirection().get(cc);
}
dir.set(rc, tmp);
}
</DeepExtract>
return new Line(dir, pt);
} | jogl-utils | positive | 439,430 |
@Override
public void onSuccess(Void aVoid) {
mFirebaseRemoteConfig.activateFetched();
Long friendly_msg_length = mFirebaseRemoteConfig.getLong("friendly_msg_length");
mMessageEditText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(friendly_msg_length.intValue()) });
Log.d(TAG, "FML is: " + friendly_msg_length);
} | @Override
public void onSuccess(Void aVoid) {
mFirebaseRemoteConfig.activateFetched();
<DeepExtract>
Long friendly_msg_length = mFirebaseRemoteConfig.getLong("friendly_msg_length");
mMessageEditText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(friendly_msg_length.intValue()) });
Log.d(TAG, "FML is: " + friendly_msg_length);
</DeepExtract>
} | def-guide-to-firebase | positive | 439,432 |
public void createDynamicCircle(FixtureDef fixtureDef) {
CircleShape circle = new CircleShape();
circle.setRadius(width / 2f);
fixtureDef.shape = circle;
bodyDef = new BodyDef();
bodyDef.type = BodyType.DynamicBody;
bodyDef.position.x = getX() + width / 2f;
bodyDef.position.y = getY() + height / 2f;
bodyDef.angle = rotation * MathHelper.DEG_TO_RAD;
createBody(bodyDef, fixtureDef);
circle.dispose();
} | public void createDynamicCircle(FixtureDef fixtureDef) {
CircleShape circle = new CircleShape();
circle.setRadius(width / 2f);
fixtureDef.shape = circle;
<DeepExtract>
bodyDef = new BodyDef();
bodyDef.type = BodyType.DynamicBody;
bodyDef.position.x = getX() + width / 2f;
bodyDef.position.y = getY() + height / 2f;
bodyDef.angle = rotation * MathHelper.DEG_TO_RAD;
createBody(bodyDef, fixtureDef);
</DeepExtract>
circle.dispose();
} | rokon | positive | 439,433 |
public void start() {
if (DriverManager.propertiesFileSettings.isVirtualServerEnabled()) {
DriverManager.getDriverVirtualService();
}
RequestSpecification driver = createDriverWebAPI();
BFLogger.logDebug("driver:" + driver.toString());
return driver;
} | public void start() {
if (DriverManager.propertiesFileSettings.isVirtualServerEnabled()) {
DriverManager.getDriverVirtualService();
}
<DeepExtract>
RequestSpecification driver = createDriverWebAPI();
BFLogger.logDebug("driver:" + driver.toString());
return driver;
</DeepExtract>
} | mrchecker | positive | 439,434 |
public Integer decreaseTargetFrame() {
Integer value = null;
for (int i = 0; i < properties.size(); i++) {
if (properties.get(i).startsWith("-" + TARGET_FRAME_OPT)) {
value = Integer.parseInt(properties.get(i + 1));
if (true) {
value = value - 1;
properties.remove(i + 1);
properties.add(i + 1, (value) + "");
}
break;
} else if (properties.get(i).startsWith("-D" + TARGET_FRAME_OPT)) {
int eqIndex = properties.get(i).indexOf("=");
value = Integer.parseInt(properties.get(i).substring(eqIndex + 1));
if (true) {
value = value - 1;
properties.remove(i);
properties.add(i, "-D" + TARGET_FRAME_OPT + "=" + value);
}
break;
}
}
return value;
} | public Integer decreaseTargetFrame() {
<DeepExtract>
Integer value = null;
for (int i = 0; i < properties.size(); i++) {
if (properties.get(i).startsWith("-" + TARGET_FRAME_OPT)) {
value = Integer.parseInt(properties.get(i + 1));
if (true) {
value = value - 1;
properties.remove(i + 1);
properties.add(i + 1, (value) + "");
}
break;
} else if (properties.get(i).startsWith("-D" + TARGET_FRAME_OPT)) {
int eqIndex = properties.get(i).indexOf("=");
value = Integer.parseInt(properties.get(i).substring(eqIndex + 1));
if (true) {
value = value - 1;
properties.remove(i);
properties.add(i, "-D" + TARGET_FRAME_OPT + "=" + value);
}
break;
}
}
return value;
</DeepExtract>
} | botsing | positive | 439,435 |
@Override
public void onAdditionalEntry() {
TimesheetDayEntry newEntry = new TimesheetDayEntry();
getTimesheetDay().addEntry(newEntry);
TimesheetDayEntryChangePresenterEx entryPresenter = presenterFactory.createTimesheetDayEntryChangePresenter(null);
entryPresenter.setTimesheetDayEntry(newEntry);
this.projectList = getProjectList();
this.hoursChangeObserver = this;
entryPresenters.add(entryPresenter);
super.startPresenting();
entryPresenters.clear();
for (TimesheetDayEntry entry : getTimesheetDay().getEntries()) {
TimesheetDayEntryChangePresenterEx entryPresenter = presenterFactory.createTimesheetDayEntryChangePresenter(null);
entryPresenter.setTimesheetDayEntry(entry);
entryPresenter.setProjectList(getProjectList());
entryPresenter.setHoursChangeObserver(this);
entryPresenters.add(entryPresenter);
entryPresenter.startPresenting();
getView().addTimesheetDayEntryView(entryPresenter.getView());
}
getView().addTimesheetDayEntryView(entryPresenter.getView());
} | @Override
public void onAdditionalEntry() {
TimesheetDayEntry newEntry = new TimesheetDayEntry();
getTimesheetDay().addEntry(newEntry);
TimesheetDayEntryChangePresenterEx entryPresenter = presenterFactory.createTimesheetDayEntryChangePresenter(null);
entryPresenter.setTimesheetDayEntry(newEntry);
this.projectList = getProjectList();
this.hoursChangeObserver = this;
entryPresenters.add(entryPresenter);
<DeepExtract>
super.startPresenting();
entryPresenters.clear();
for (TimesheetDayEntry entry : getTimesheetDay().getEntries()) {
TimesheetDayEntryChangePresenterEx entryPresenter = presenterFactory.createTimesheetDayEntryChangePresenter(null);
entryPresenter.setTimesheetDayEntry(entry);
entryPresenter.setProjectList(getProjectList());
entryPresenter.setHoursChangeObserver(this);
entryPresenters.add(entryPresenter);
entryPresenter.startPresenting();
getView().addTimesheetDayEntryView(entryPresenter.getView());
}
</DeepExtract>
getView().addTimesheetDayEntryView(entryPresenter.getView());
} | vaadinator | positive | 439,436 |
protected void finalize() {
if (!released) {
released = true;
nRelease(address);
}
} | protected void finalize() {
<DeepExtract>
if (!released) {
released = true;
nRelease(address);
}
</DeepExtract>
} | Project-Sentry-Gun | positive | 439,438 |
@Override
public void run() {
editText.setText("");
setInReplyTo(PostSystem.NONE_ID);
PostSystem.clear(true);
removePicture();
} | @Override
public void run() {
<DeepExtract>
editText.setText("");
setInReplyTo(PostSystem.NONE_ID);
PostSystem.clear(true);
removePicture();
</DeepExtract>
} | SmileEssence-Lite | positive | 439,440 |
public static String encryptMD5ToString(final byte[] data, final byte[] salt) {
if (data == null && salt == null)
return "";
if (salt == null)
return bytes2HexString(encryptMD5(data));
if (data == null)
return bytes2HexString(encryptMD5(salt));
byte[] dataSalt = new byte[data.length + salt.length];
System.arraycopy(data, 0, dataSalt, 0, data.length);
System.arraycopy(salt, 0, dataSalt, data.length, salt.length);
if (encryptMD5(dataSalt) == null)
return "";
int len = encryptMD5(dataSalt).length;
if (len <= 0)
return "";
char[] ret = new char[len << 1];
for (int i = 0, j = 0; i < len; i++) {
ret[j++] = HEX_DIGITS[encryptMD5(dataSalt)[i] >> 4 & 0x0f];
ret[j++] = HEX_DIGITS[encryptMD5(dataSalt)[i] & 0x0f];
}
return new String(ret);
} | public static String encryptMD5ToString(final byte[] data, final byte[] salt) {
if (data == null && salt == null)
return "";
if (salt == null)
return bytes2HexString(encryptMD5(data));
if (data == null)
return bytes2HexString(encryptMD5(salt));
byte[] dataSalt = new byte[data.length + salt.length];
System.arraycopy(data, 0, dataSalt, 0, data.length);
System.arraycopy(salt, 0, dataSalt, data.length, salt.length);
<DeepExtract>
if (encryptMD5(dataSalt) == null)
return "";
int len = encryptMD5(dataSalt).length;
if (len <= 0)
return "";
char[] ret = new char[len << 1];
for (int i = 0, j = 0; i < len; i++) {
ret[j++] = HEX_DIGITS[encryptMD5(dataSalt)[i] >> 4 & 0x0f];
ret[j++] = HEX_DIGITS[encryptMD5(dataSalt)[i] & 0x0f];
}
return new String(ret);
</DeepExtract>
} | Utils-Everywhere | positive | 439,442 |
public boolean isPeriodSafeWithOppAndMyBombs(final PointCoord point, final int from, final int to) {
final int timeDiff = to - 1 - from;
if (timeDiff <= Bombs.EXPLOSION_FRAMES) {
return isSafeWithOppAndMyBombs(point, from) && isSafeWithOppAndMyBombs(point, to - 1);
}
for (int frame = from; frame < to; frame = frame + Bombs.EXPLOSION_FRAMES) {
if (!isSafeWithOppAndMyBombs(point, frame)) {
return false;
}
}
final GridCoord grid = Utils.pixelToGrid(point);
return allPossibleBombs.isSafe(grid, to - 1);
} | public boolean isPeriodSafeWithOppAndMyBombs(final PointCoord point, final int from, final int to) {
final int timeDiff = to - 1 - from;
if (timeDiff <= Bombs.EXPLOSION_FRAMES) {
return isSafeWithOppAndMyBombs(point, from) && isSafeWithOppAndMyBombs(point, to - 1);
}
for (int frame = from; frame < to; frame = frame + Bombs.EXPLOSION_FRAMES) {
if (!isSafeWithOppAndMyBombs(point, frame)) {
return false;
}
}
<DeepExtract>
final GridCoord grid = Utils.pixelToGrid(point);
return allPossibleBombs.isSafe(grid, to - 1);
</DeepExtract>
} | jdyna | positive | 439,443 |
@Override
public String toString() {
if (appName == null)
appName = app.loadLabel(mPm).toString();
return appName;
} | @Override
public String toString() {
<DeepExtract>
if (appName == null)
appName = app.loadLabel(mPm).toString();
return appName;
</DeepExtract>
} | XposedInstaller | positive | 439,444 |
public SynchronizationPoints build() {
SynchronizationPoints sp = new SynchronizationPoints();
knownDates.add(fixedDate);
dateToId.put(fixedDate, fixedId);
for (String skip : skipsAfter) {
if (limitAfter != null && skip.compareTo(limitAfter) >= 0) {
continue;
}
int id = sp.getId(skip);
if (id != NONE) {
sp.addDate(skip, NONE);
Calendar c = parse(skip);
c.add(Calendar.DATE, 1);
sp.addDate(unparse(c), id);
c.add(Calendar.DATE, -2);
sp.addDate(unparse(c), id - 1);
}
}
for (String skip : skipsBefore) {
if (limitBefore != null && skip.compareTo(limitBefore) <= 0) {
continue;
}
int id = sp.getId(skip);
if (id != NONE) {
sp.addDate(skip, NONE);
Calendar c = parse(skip);
c.add(Calendar.DATE, -1);
sp.addDate(unparse(c), id);
c.add(Calendar.DATE, 2);
sp.addDate(unparse(c), id + 1);
}
}
if (limitBefore != null) {
sp.addDate(limitBefore, NONE);
}
if (limitBefore != null) {
sp.addDate(limitAfter, NONE);
}
return sp;
} | public SynchronizationPoints build() {
SynchronizationPoints sp = new SynchronizationPoints();
<DeepExtract>
knownDates.add(fixedDate);
dateToId.put(fixedDate, fixedId);
</DeepExtract>
for (String skip : skipsAfter) {
if (limitAfter != null && skip.compareTo(limitAfter) >= 0) {
continue;
}
int id = sp.getId(skip);
if (id != NONE) {
sp.addDate(skip, NONE);
Calendar c = parse(skip);
c.add(Calendar.DATE, 1);
sp.addDate(unparse(c), id);
c.add(Calendar.DATE, -2);
sp.addDate(unparse(c), id - 1);
}
}
for (String skip : skipsBefore) {
if (limitBefore != null && skip.compareTo(limitBefore) <= 0) {
continue;
}
int id = sp.getId(skip);
if (id != NONE) {
sp.addDate(skip, NONE);
Calendar c = parse(skip);
c.add(Calendar.DATE, -1);
sp.addDate(unparse(c), id);
c.add(Calendar.DATE, 2);
sp.addDate(unparse(c), id + 1);
}
}
if (limitBefore != null) {
sp.addDate(limitBefore, NONE);
}
if (limitBefore != null) {
sp.addDate(limitAfter, NONE);
}
return sp;
} | robocrosswords | positive | 439,445 |
@SafeVarargs
public final int addAll(KType... elements) {
if (elements.length > resizeAt || keys == null) {
final KType[] prevKeys = Intrinsics.<KType[]>cast(this.keys);
allocateBuffers(minBufferSize(elements.length, loadFactor));
if (prevKeys != null && !isEmpty()) {
rehash(prevKeys);
}
}
int count = 0;
for (KType e : elements) {
if (add(e)) {
count++;
}
}
return count;
} | @SafeVarargs
public final int addAll(KType... elements) {
<DeepExtract>
if (elements.length > resizeAt || keys == null) {
final KType[] prevKeys = Intrinsics.<KType[]>cast(this.keys);
allocateBuffers(minBufferSize(elements.length, loadFactor));
if (prevKeys != null && !isEmpty()) {
rehash(prevKeys);
}
}
</DeepExtract>
int count = 0;
for (KType e : elements) {
if (add(e)) {
count++;
}
}
return count;
} | hppc | positive | 439,446 |
@Override
public void write(final byte[] b, final int off, final int len) throws IOException {
if (!response.isCommitted()) {
response.flushHeaders();
}
outputStream.write(b, off, len);
} | @Override
public void write(final byte[] b, final int off, final int len) throws IOException {
<DeepExtract>
if (!response.isCommitted()) {
response.flushHeaders();
}
</DeepExtract>
outputStream.write(b, off, len);
} | android-http-server | positive | 439,447 |
void coupleInheritedLinks(RuleStructure rule) {
HashMap lhsFreeLinks = rule.leftMem.freeLinks;
HashMap rhsFreeLinks = rule.rightMem.freeLinks;
HashMap links = new HashMap();
Iterator it = lhsFreeLinks.keySet().iterator();
while (it.hasNext()) {
String linkname = (String) it.next();
LinkOccurrence lhsocc = (LinkOccurrence) lhsFreeLinks.get(linkname);
addLinkOccurrence(links, lhsocc);
}
it = rhsFreeLinks.keySet().iterator();
while (it.hasNext()) {
String linkname = (String) it.next();
LinkOccurrence rhsocc = (LinkOccurrence) rhsFreeLinks.get(linkname);
addLinkOccurrence(links, rhsocc);
}
Iterator it = links.keySet().iterator();
while (it.hasNext()) {
String linkName = (String) it.next();
if (links.get(linkName) == CLOSED_LINK)
it.remove();
}
if (!links.isEmpty()) {
it = links.keySet().iterator();
while (it.hasNext()) {
LinkOccurrence link = (LinkOccurrence) links.get(it.next());
error("SYNTAX ERROR: rule with free variable: " + link.name + ", at line " + rule.lineno);
LinkedList process = new LinkedList();
process.add(new SrcLink(link.name));
SrcAtom sAtom = new SrcAtom(link.name, process);
addSrcAtomToMem(sAtom, link.atom.mem);
}
coupleLinks(rule.leftMem);
coupleLinks(rule.rightMem);
}
} | void coupleInheritedLinks(RuleStructure rule) {
HashMap lhsFreeLinks = rule.leftMem.freeLinks;
HashMap rhsFreeLinks = rule.rightMem.freeLinks;
HashMap links = new HashMap();
Iterator it = lhsFreeLinks.keySet().iterator();
while (it.hasNext()) {
String linkname = (String) it.next();
LinkOccurrence lhsocc = (LinkOccurrence) lhsFreeLinks.get(linkname);
addLinkOccurrence(links, lhsocc);
}
it = rhsFreeLinks.keySet().iterator();
while (it.hasNext()) {
String linkname = (String) it.next();
LinkOccurrence rhsocc = (LinkOccurrence) rhsFreeLinks.get(linkname);
addLinkOccurrence(links, rhsocc);
}
<DeepExtract>
Iterator it = links.keySet().iterator();
while (it.hasNext()) {
String linkName = (String) it.next();
if (links.get(linkName) == CLOSED_LINK)
it.remove();
}
</DeepExtract>
if (!links.isEmpty()) {
it = links.keySet().iterator();
while (it.hasNext()) {
LinkOccurrence link = (LinkOccurrence) links.get(it.next());
error("SYNTAX ERROR: rule with free variable: " + link.name + ", at line " + rule.lineno);
LinkedList process = new LinkedList();
process.add(new SrcLink(link.name));
SrcAtom sAtom = new SrcAtom(link.name, process);
addSrcAtomToMem(sAtom, link.atom.mem);
}
coupleLinks(rule.leftMem);
coupleLinks(rule.rightMem);
}
} | lmntal-compiler | positive | 439,449 |
@Override
protected void onDraw(Canvas canvas) {
drawCoordinate(canvas);
canvas.save();
mPaint.setColor(mTextColor);
mPaint.setTextSize(mTextSize);
mPaint.setTextAlign(Paint.Align.CENTER);
canvas.drawText(mType, getWidth() / 2, mTextSize * 2, mPaint);
canvas.restore();
canvas.save();
mPaint.setColor(mHeartAlphaColor);
canvas.translate(mHeartRect.width() / 2 + 50, mHeartRect.height() / 2 + 50);
canvas.drawPath(mHeartPath, mPaint);
mPaint.setColor(mCircleAlphaColor);
canvas.translate(mHeartRect.width() + 50, -mHeartRect.bottom + 50);
canvas.drawPath(mCirclePath, mPaint);
canvas.restore();
canvas.translate(getWidth() / 2, getHeight() / 2);
mPaint.setStyle(Paint.Style.FILL);
mPaint.setColor(mHeartAlphaColor);
canvas.drawPath(mHeartPath, mPaint);
mPaint.setColor(mCircleAlphaColor);
canvas.drawPath(mCirclePath, mPaint);
canvas.clipPath(mHeartPath);
Region.Op op;
switch(mType) {
case DIFFERENCE:
op = Region.Op.DIFFERENCE;
break;
case INTERSECT:
op = Region.Op.INTERSECT;
break;
case UNION:
op = Region.Op.UNION;
break;
case XOR:
op = Region.Op.XOR;
break;
case REVERSE_DIFFERENCE:
op = Region.Op.REVERSE_DIFFERENCE;
break;
case REPLACE:
op = Region.Op.REPLACE;
break;
default:
op = Region.Op.INTERSECT;
break;
}
canvas.clipPath(mCirclePath, op);
canvas.drawColor(mBackgroundColor);
} | @Override
protected void onDraw(Canvas canvas) {
drawCoordinate(canvas);
canvas.save();
mPaint.setColor(mTextColor);
mPaint.setTextSize(mTextSize);
mPaint.setTextAlign(Paint.Align.CENTER);
canvas.drawText(mType, getWidth() / 2, mTextSize * 2, mPaint);
canvas.restore();
canvas.save();
mPaint.setColor(mHeartAlphaColor);
canvas.translate(mHeartRect.width() / 2 + 50, mHeartRect.height() / 2 + 50);
canvas.drawPath(mHeartPath, mPaint);
mPaint.setColor(mCircleAlphaColor);
canvas.translate(mHeartRect.width() + 50, -mHeartRect.bottom + 50);
canvas.drawPath(mCirclePath, mPaint);
canvas.restore();
<DeepExtract>
canvas.translate(getWidth() / 2, getHeight() / 2);
mPaint.setStyle(Paint.Style.FILL);
mPaint.setColor(mHeartAlphaColor);
canvas.drawPath(mHeartPath, mPaint);
mPaint.setColor(mCircleAlphaColor);
canvas.drawPath(mCirclePath, mPaint);
canvas.clipPath(mHeartPath);
Region.Op op;
switch(mType) {
case DIFFERENCE:
op = Region.Op.DIFFERENCE;
break;
case INTERSECT:
op = Region.Op.INTERSECT;
break;
case UNION:
op = Region.Op.UNION;
break;
case XOR:
op = Region.Op.XOR;
break;
case REVERSE_DIFFERENCE:
op = Region.Op.REVERSE_DIFFERENCE;
break;
case REPLACE:
op = Region.Op.REPLACE;
break;
default:
op = Region.Op.INTERSECT;
break;
}
canvas.clipPath(mCirclePath, op);
canvas.drawColor(mBackgroundColor);
</DeepExtract>
} | UI2018 | positive | 439,450 |
@Override
public boolean buildStarted(@NotNull final SBuild build, @NotNull final BuildRevision revision) throws PublisherException {
if (myEventsToWait.contains(Event.STARTED)) {
try {
synchronized (Event.STARTED) {
Event.STARTED.wait(10000);
}
} catch (InterruptedException e) {
throw new PublisherException("Mock publisher interrupted", e);
}
}
myHttpRequests.add(HttpMethod.POST);
myMockState.computeIfAbsent(revision.getRevision(), k -> new HashMap<>()).computeIfAbsent(build.getBuildType() != null ? build.getBuildType().getBuildTypeId() : "unknown", k -> new LinkedList<>()).add(new MockStatus(Event.STARTED, DefaultStatusMessages.BUILD_STARTED));
return true;
} | @Override
public boolean buildStarted(@NotNull final SBuild build, @NotNull final BuildRevision revision) throws PublisherException {
if (myEventsToWait.contains(Event.STARTED)) {
try {
synchronized (Event.STARTED) {
Event.STARTED.wait(10000);
}
} catch (InterruptedException e) {
throw new PublisherException("Mock publisher interrupted", e);
}
}
myHttpRequests.add(HttpMethod.POST);
<DeepExtract>
myMockState.computeIfAbsent(revision.getRevision(), k -> new HashMap<>()).computeIfAbsent(build.getBuildType() != null ? build.getBuildType().getBuildTypeId() : "unknown", k -> new LinkedList<>()).add(new MockStatus(Event.STARTED, DefaultStatusMessages.BUILD_STARTED));
</DeepExtract>
return true;
} | commit-status-publisher | positive | 439,452 |
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final LessonGroup lessonGroup = mData.get(position);
final SimplePerson teacher = lessonGroup.getTeacher();
holder.mLessonGroup = lessonGroup;
holder.mPresenter = mPresenter;
final boolean lessonGroupSelected = mPresenter.isLessonGroupSelected(mLessonGroup);
if (lessonGroupSelected && !mLessonGroup.getGroups().isEmpty()) {
mPkGroups.setVisibility(View.VISIBLE);
final int amountOfGroups = mLessonGroup.getGroups().size();
for (int index = 0; index < mPkGroupList.size(); index++) {
final RadioButton radioButton = mPkGroupList.get(index);
if (index < amountOfGroups) {
if (mPresenter.isPkSelected(mLessonGroup, index + 1)) {
mPkGroups.check(radioButton.getId());
}
radioButton.setVisibility(View.VISIBLE);
} else {
radioButton.setVisibility(View.GONE);
}
}
} else {
mPkGroups.setVisibility(View.GONE);
}
mCheckBox.setChecked(lessonGroupSelected);
holder.mModule.setText(lessonGroup.getModule().getName());
if (teacher != null) {
holder.mTeacher.setText(teacher.getName());
holder.mTeacher.setVisibility(View.VISIBLE);
} else {
holder.mTeacher.setVisibility(View.GONE);
}
} | @Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final LessonGroup lessonGroup = mData.get(position);
final SimplePerson teacher = lessonGroup.getTeacher();
holder.mLessonGroup = lessonGroup;
holder.mPresenter = mPresenter;
<DeepExtract>
final boolean lessonGroupSelected = mPresenter.isLessonGroupSelected(mLessonGroup);
if (lessonGroupSelected && !mLessonGroup.getGroups().isEmpty()) {
mPkGroups.setVisibility(View.VISIBLE);
final int amountOfGroups = mLessonGroup.getGroups().size();
for (int index = 0; index < mPkGroupList.size(); index++) {
final RadioButton radioButton = mPkGroupList.get(index);
if (index < amountOfGroups) {
if (mPresenter.isPkSelected(mLessonGroup, index + 1)) {
mPkGroups.check(radioButton.getId());
}
radioButton.setVisibility(View.VISIBLE);
} else {
radioButton.setVisibility(View.GONE);
}
}
} else {
mPkGroups.setVisibility(View.GONE);
}
mCheckBox.setChecked(lessonGroupSelected);
</DeepExtract>
holder.mModule.setText(lessonGroup.getModule().getName());
if (teacher != null) {
holder.mTeacher.setText(teacher.getName());
holder.mTeacher.setVisibility(View.VISIBLE);
} else {
holder.mTeacher.setVisibility(View.GONE);
}
} | fs-android-app | positive | 439,453 |
public static void renderColoredIcon(IIcon icon, ResourceLocation textureMap, int color, float level) {
float min = -0.5F + 0.125F;
float max = 0.5F - 0.125F;
Minecraft.getMinecraft().getTextureManager().bindTexture(textureMap);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(color);
tessellator.setNormal(0, 1, 0);
tessellator.addVertexWithUV(min, level - 0.5F, min, icon.getMinU(), icon.getMinV());
tessellator.addVertexWithUV(min, level - 0.5F, max, icon.getMinU(), icon.getMaxV());
tessellator.addVertexWithUV(max, level - 0.5F, max, icon.getMaxU(), icon.getMaxV());
tessellator.addVertexWithUV(max, level - 0.5F, min, icon.getMaxU(), icon.getMinV());
tessellator.draw();
} | public static void renderColoredIcon(IIcon icon, ResourceLocation textureMap, int color, float level) {
float min = -0.5F + 0.125F;
float max = 0.5F - 0.125F;
<DeepExtract>
Minecraft.getMinecraft().getTextureManager().bindTexture(textureMap);
</DeepExtract>
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(color);
tessellator.setNormal(0, 1, 0);
tessellator.addVertexWithUV(min, level - 0.5F, min, icon.getMinU(), icon.getMinV());
tessellator.addVertexWithUV(min, level - 0.5F, max, icon.getMinU(), icon.getMaxV());
tessellator.addVertexWithUV(max, level - 0.5F, max, icon.getMaxU(), icon.getMaxV());
tessellator.addVertexWithUV(max, level - 0.5F, min, icon.getMaxU(), icon.getMinV());
tessellator.draw();
} | Subsistence | positive | 439,454 |
public List<JSONObject> top10TopicFileSizeRang7Days(UserInfo userInfo, long start, long end) {
List<JSONObject> objectList = new ArrayList<>();
String query;
if (Objects.equals(userInfo.getRole().name(), RoleEnum.ADMIN.name())) {
query = null;
} else {
List<TopicInfo> topicInfoList = topicInfoService.getTopicByTeamIDs(userInfo.getTeamIDs());
StringBuilder sb = new StringBuilder();
if (!CollectionUtils.isEmpty(topicInfoList)) {
topicInfoList.forEach(topicInfo -> {
sb.append("\"").append(topicInfo.getTopicName()).append("\"").append(",");
});
String str = sb.toString();
query = str.substring(0, str.length() - 1);
}
query = sb.toString();
}
if (Objects.equals("", query)) {
return objectList;
}
String searchQuery = ElasticSearchQuery.top10TopicFileSizeRang7Days(query, start, end);
try {
JSONObject result = elasticsearchUtil.searchES(searchQuery, getMonitorElasticsearchIndexName() + "*");
if (!result.containsKey(Constants.EleaticSearch.AGGREGATIONS)) {
return objectList;
}
JSONArray bucketArray = result.getJSONObject(Constants.EleaticSearch.AGGREGATIONS).getJSONObject(Constants.KeyStr.DATE).getJSONArray(Constants.EleaticSearch.BUCKETS);
for (int i = 0; i < bucketArray.size(); i++) {
JSONObject bucketObj = bucketArray.getJSONObject(i);
long time = bucketObj.getLongValue(Constants.EleaticSearch.KEY);
JSONArray clusterBuckets = bucketObj.getJSONObject(Constants.KeyStr.CLUSTER).getJSONArray(Constants.EleaticSearch.BUCKETS);
Map<String, Long> valueMap = new HashMap<>();
for (int k = 0; k < clusterBuckets.size(); k++) {
JSONObject clusterObj = clusterBuckets.getJSONObject(k);
String clusterName = clusterObj.getString(Constants.EleaticSearch.KEY);
JSONArray topicBucket = clusterObj.getJSONObject(Constants.KeyStr.TOPIC).getJSONArray(Constants.EleaticSearch.BUCKETS);
for (int j = 0; j < topicBucket.size(); j++) {
JSONObject topicObj = topicBucket.getJSONObject(j);
String topic = topicObj.getString(Constants.EleaticSearch.KEY);
long value = topicObj.getJSONObject(Constants.KeyStr.MAX_FILE).getLongValue(Constants.EleaticSearch.VALUE);
String key = clusterName + Constants.Symbol.SPACE_STR + topic;
valueMap.put(key, value);
}
}
List<JSONObject> mergeList = generateMapToArray(valueMap, time);
if (!CollectionUtils.isEmpty(mergeList)) {
objectList.addAll(mergeList);
}
}
} catch (ConnectException ce) {
LOG.warn("search top 10 topic file Size Rang 7 Days has Error,for timeout connecting to es");
} catch (Exception e) {
LOG.error("search top 10 topic file Size Rang 7 Days has Error", e);
}
return objectList;
} | public List<JSONObject> top10TopicFileSizeRang7Days(UserInfo userInfo, long start, long end) {
List<JSONObject> objectList = new ArrayList<>();
<DeepExtract>
String query;
if (Objects.equals(userInfo.getRole().name(), RoleEnum.ADMIN.name())) {
query = null;
} else {
List<TopicInfo> topicInfoList = topicInfoService.getTopicByTeamIDs(userInfo.getTeamIDs());
StringBuilder sb = new StringBuilder();
if (!CollectionUtils.isEmpty(topicInfoList)) {
topicInfoList.forEach(topicInfo -> {
sb.append("\"").append(topicInfo.getTopicName()).append("\"").append(",");
});
String str = sb.toString();
query = str.substring(0, str.length() - 1);
}
query = sb.toString();
}
</DeepExtract>
if (Objects.equals("", query)) {
return objectList;
}
String searchQuery = ElasticSearchQuery.top10TopicFileSizeRang7Days(query, start, end);
try {
JSONObject result = elasticsearchUtil.searchES(searchQuery, getMonitorElasticsearchIndexName() + "*");
if (!result.containsKey(Constants.EleaticSearch.AGGREGATIONS)) {
return objectList;
}
JSONArray bucketArray = result.getJSONObject(Constants.EleaticSearch.AGGREGATIONS).getJSONObject(Constants.KeyStr.DATE).getJSONArray(Constants.EleaticSearch.BUCKETS);
for (int i = 0; i < bucketArray.size(); i++) {
JSONObject bucketObj = bucketArray.getJSONObject(i);
long time = bucketObj.getLongValue(Constants.EleaticSearch.KEY);
JSONArray clusterBuckets = bucketObj.getJSONObject(Constants.KeyStr.CLUSTER).getJSONArray(Constants.EleaticSearch.BUCKETS);
Map<String, Long> valueMap = new HashMap<>();
for (int k = 0; k < clusterBuckets.size(); k++) {
JSONObject clusterObj = clusterBuckets.getJSONObject(k);
String clusterName = clusterObj.getString(Constants.EleaticSearch.KEY);
JSONArray topicBucket = clusterObj.getJSONObject(Constants.KeyStr.TOPIC).getJSONArray(Constants.EleaticSearch.BUCKETS);
for (int j = 0; j < topicBucket.size(); j++) {
JSONObject topicObj = topicBucket.getJSONObject(j);
String topic = topicObj.getString(Constants.EleaticSearch.KEY);
long value = topicObj.getJSONObject(Constants.KeyStr.MAX_FILE).getLongValue(Constants.EleaticSearch.VALUE);
String key = clusterName + Constants.Symbol.SPACE_STR + topic;
valueMap.put(key, value);
}
}
List<JSONObject> mergeList = generateMapToArray(valueMap, time);
if (!CollectionUtils.isEmpty(mergeList)) {
objectList.addAll(mergeList);
}
}
} catch (ConnectException ce) {
LOG.warn("search top 10 topic file Size Rang 7 Days has Error,for timeout connecting to es");
} catch (Exception e) {
LOG.error("search top 10 topic file Size Rang 7 Days has Error", e);
}
return objectList;
} | KafkaCenter | positive | 439,455 |
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int T = Integer.parseInt(br.readLine());
for (int i = 2; i < 10000; i++) {
if (isNotPrime[i])
continue;
for (int j = 2; i * j < 10000; j++) {
isNotPrime[i * j] = true;
}
}
while (T-- > 0) {
StringTokenizer st = new StringTokenizer(br.readLine());
int A = Integer.parseInt(st.nextToken());
int B = Integer.parseInt(st.nextToken());
if (A == B) {
bw.write("0\n");
continue;
}
int ret = bfs(A, B);
bw.write(ret == -1 ? "Impossible\n" : ret + "\n");
}
bw.flush();
bw.close();
br.close();
} | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int T = Integer.parseInt(br.readLine());
<DeepExtract>
for (int i = 2; i < 10000; i++) {
if (isNotPrime[i])
continue;
for (int j = 2; i * j < 10000; j++) {
isNotPrime[i * j] = true;
}
}
</DeepExtract>
while (T-- > 0) {
StringTokenizer st = new StringTokenizer(br.readLine());
int A = Integer.parseInt(st.nextToken());
int B = Integer.parseInt(st.nextToken());
if (A == B) {
bw.write("0\n");
continue;
}
int ret = bfs(A, B);
bw.write(ret == -1 ? "Impossible\n" : ret + "\n");
}
bw.flush();
bw.close();
br.close();
} | BOJ | positive | 439,458 |
@Test
public void optional() {
assertExpression("(a|[j-t])lopi", 3, new And<>(leaves("lop", "opi")));
} | @Test
public void optional() {
<DeepExtract>
assertExpression("(a|[j-t])lopi", 3, new And<>(leaves("lop", "opi")));
</DeepExtract>
} | search-extra | positive | 439,459 |
static public <C> C getParam(Map params, String name, Class<C> c) {
Object value = params.get(name);
try {
if (value instanceof SimpleScalar) {
return (C) value.toString();
} else if (value instanceof BeanModel) {
return (C) ((BeanModel) value).getWrappedObject();
} else if (value instanceof TemplateBooleanModel) {
return (C) new Boolean(((TemplateBooleanModel) value).getAsBoolean());
} else if (value instanceof SimpleNumber) {
if (c == Integer.class) {
return (C) new Integer(((SimpleNumber) value).getAsNumber().intValue());
} else if (c == Long.class) {
return (C) new Long(((SimpleNumber) value).getAsNumber().intValue());
}
}
} catch (TemplateModelException e) {
logger.error(e.getMessage());
}
return null;
} | static public <C> C getParam(Map params, String name, Class<C> c) {
Object value = params.get(name);
<DeepExtract>
try {
if (value instanceof SimpleScalar) {
return (C) value.toString();
} else if (value instanceof BeanModel) {
return (C) ((BeanModel) value).getWrappedObject();
} else if (value instanceof TemplateBooleanModel) {
return (C) new Boolean(((TemplateBooleanModel) value).getAsBoolean());
} else if (value instanceof SimpleNumber) {
if (c == Integer.class) {
return (C) new Integer(((SimpleNumber) value).getAsNumber().intValue());
} else if (c == Long.class) {
return (C) new Long(((SimpleNumber) value).getAsNumber().intValue());
}
}
} catch (TemplateModelException e) {
logger.error(e.getMessage());
}
return null;
</DeepExtract>
} | snow | positive | 439,461 |
public Criteria andSongsheetidsNotBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "songsheetids" + " cannot be null");
}
criteria.add(new Criterion("songSheetIds not between", value1, value2));
return (Criteria) this;
} | public Criteria andSongsheetidsNotBetween(String value1, String value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "songsheetids" + " cannot be null");
}
criteria.add(new Criterion("songSheetIds not between", value1, value2));
</DeepExtract>
return (Criteria) this;
} | music | positive | 439,463 |
@Override
public void readExternal(ObjectInput objInput) throws IOException, ClassNotFoundException {
int size = objInput.readInt();
if (size > 0) {
internalSet.ensureCapacity(size);
for (int i = 0; i < size; ++i) {
internalSet.add(objInput.readInt());
}
}
} | @Override
public void readExternal(ObjectInput objInput) throws IOException, ClassNotFoundException {
<DeepExtract>
int size = objInput.readInt();
if (size > 0) {
internalSet.ensureCapacity(size);
for (int i = 0; i < size; ++i) {
internalSet.add(objInput.readInt());
}
}
</DeepExtract>
} | fractal | positive | 439,464 |
@Test
public void getAdministrationAlgorithmTestAlgorithmNameIsBlank() {
Mockito.when(configurationDao.getValue(Mockito.eq(CLUSTER_ADMINISTRATION_ALGORITHMS_IN_CONFIGURATION_KEY))).thenReturn("");
spy.getAdministrationAlgorithm();
Mockito.verify(spy).getDummyClusterManagementHeuristc();
Mockito.verify(spy, Mockito.times(0)).getInstanceOfClass(Mockito.anyString());
} | @Test
public void getAdministrationAlgorithmTestAlgorithmNameIsBlank() {
Mockito.when(configurationDao.getValue(Mockito.eq(CLUSTER_ADMINISTRATION_ALGORITHMS_IN_CONFIGURATION_KEY))).thenReturn("");
spy.getAdministrationAlgorithm();
<DeepExtract>
Mockito.verify(spy).getDummyClusterManagementHeuristc();
Mockito.verify(spy, Mockito.times(0)).getInstanceOfClass(Mockito.anyString());
</DeepExtract>
} | autonomiccs-platform | positive | 439,465 |
public int executeUpdate(String sql) throws SQLException {
if (pointer == 0)
return;
rs.close();
batch = null;
batchPos = 0;
int resp = db.finalize(this);
if (resp != SQLITE_OK && resp != SQLITE_MISUSE)
db.throwex();
this.sql = sql;
int changes = 0;
try {
db.prepare(this);
changes = db.executeUpdate(this, null);
} finally {
close();
}
return changes;
} | public int executeUpdate(String sql) throws SQLException {
<DeepExtract>
if (pointer == 0)
return;
rs.close();
batch = null;
batchPos = 0;
int resp = db.finalize(this);
if (resp != SQLITE_OK && resp != SQLITE_MISUSE)
db.throwex();
</DeepExtract>
this.sql = sql;
int changes = 0;
try {
db.prepare(this);
changes = db.executeUpdate(this, null);
} finally {
close();
}
return changes;
} | sqlitejdbc | positive | 439,467 |
@Override
public void onClick(View view) {
playsound(R.raw.keyok2);
mButtonssensorLayout.setVisibility(View.GONE);
mButtonscommLayout.setVisibility(View.GONE);
mButtonsshieldLayout.setVisibility(View.GONE);
mButtonsfireLayout.setVisibility(View.GONE);
mButtonstransporterLayout.setVisibility(View.GONE);
mButtonstractorLayout.setVisibility(View.GONE);
mButtonsmotorLayout.setVisibility(View.GONE);
mButtonsviewerLayout.setVisibility(View.GONE);
mButtonslogsLayout.setVisibility(View.GONE);
mButtonsmodeLayout.setVisibility(View.GONE);
switch(8) {
case 1:
say("Sensors Mode");
mButtonssensorLayout.setVisibility(View.VISIBLE);
break;
case 2:
say("Communication Mode");
mButtonscommLayout.setVisibility(View.VISIBLE);
break;
case 3:
say("Shield Mode");
mButtonsshieldLayout.setVisibility(View.VISIBLE);
break;
case 4:
say("Fire Mode");
mButtonsfireLayout.setVisibility(View.VISIBLE);
break;
case 5:
say("Transporter Mode");
mButtonstransporterLayout.setVisibility(View.VISIBLE);
break;
case 6:
say("Tractor Mode");
mButtonstractorLayout.setVisibility(View.VISIBLE);
break;
case 7:
say("Motor Mode");
mButtonsmotorLayout.setVisibility(View.VISIBLE);
break;
case 8:
say("Viewer Mode");
mButtonsviewerLayout.setVisibility(View.VISIBLE);
break;
case 9:
say("Logs Mode");
mButtonslogsLayout.setVisibility(View.VISIBLE);
break;
case 10:
say("Mode Mode");
mButtonsmodeLayout.setVisibility(View.VISIBLE);
break;
}
mButtonsmode = 8;
} | @Override
public void onClick(View view) {
playsound(R.raw.keyok2);
<DeepExtract>
mButtonssensorLayout.setVisibility(View.GONE);
mButtonscommLayout.setVisibility(View.GONE);
mButtonsshieldLayout.setVisibility(View.GONE);
mButtonsfireLayout.setVisibility(View.GONE);
mButtonstransporterLayout.setVisibility(View.GONE);
mButtonstractorLayout.setVisibility(View.GONE);
mButtonsmotorLayout.setVisibility(View.GONE);
mButtonsviewerLayout.setVisibility(View.GONE);
mButtonslogsLayout.setVisibility(View.GONE);
mButtonsmodeLayout.setVisibility(View.GONE);
switch(8) {
case 1:
say("Sensors Mode");
mButtonssensorLayout.setVisibility(View.VISIBLE);
break;
case 2:
say("Communication Mode");
mButtonscommLayout.setVisibility(View.VISIBLE);
break;
case 3:
say("Shield Mode");
mButtonsshieldLayout.setVisibility(View.VISIBLE);
break;
case 4:
say("Fire Mode");
mButtonsfireLayout.setVisibility(View.VISIBLE);
break;
case 5:
say("Transporter Mode");
mButtonstransporterLayout.setVisibility(View.VISIBLE);
break;
case 6:
say("Tractor Mode");
mButtonstractorLayout.setVisibility(View.VISIBLE);
break;
case 7:
say("Motor Mode");
mButtonsmotorLayout.setVisibility(View.VISIBLE);
break;
case 8:
say("Viewer Mode");
mButtonsviewerLayout.setVisibility(View.VISIBLE);
break;
case 9:
say("Logs Mode");
mButtonslogsLayout.setVisibility(View.VISIBLE);
break;
case 10:
say("Mode Mode");
mButtonsmodeLayout.setVisibility(View.VISIBLE);
break;
}
mButtonsmode = 8;
</DeepExtract>
} | Trycorder5 | positive | 439,469 |
@Override
public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) {
if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
LogUtil.d("没有检索到结果");
return;
}
LogUtil.d("检索到结果:" + result.getAddress());
tvAddress.post(new Runnable() {
@Override
public void run() {
tvAddress.setText(result.getAddress());
}
});
cityName = result.getAddressDetail().city;
curLocation = result.getLocation();
if (result.getLocation() != null) {
mapView.getMap().clear();
LatLng point = new LatLng(result.getLocation().latitude, result.getLocation().longitude);
BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.mipmap.ic_dest_loc);
OverlayOptions option = new MarkerOptions().position(point).icon(bitmap);
mapView.getMap().addOverlay(option);
setMyLocationIcon(new LatLng(myInfo.getLatitude(), myInfo.getLongitude()));
}
} | @Override
public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) {
if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
LogUtil.d("没有检索到结果");
return;
}
LogUtil.d("检索到结果:" + result.getAddress());
tvAddress.post(new Runnable() {
@Override
public void run() {
tvAddress.setText(result.getAddress());
}
});
cityName = result.getAddressDetail().city;
curLocation = result.getLocation();
<DeepExtract>
if (result.getLocation() != null) {
mapView.getMap().clear();
LatLng point = new LatLng(result.getLocation().latitude, result.getLocation().longitude);
BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.mipmap.ic_dest_loc);
OverlayOptions option = new MarkerOptions().position(point).icon(bitmap);
mapView.getMap().addOverlay(option);
setMyLocationIcon(new LatLng(myInfo.getLatitude(), myInfo.getLongitude()));
}
</DeepExtract>
} | VirtualLocationPro | positive | 439,470 |
private static Localizer get() {
if (instance == null) {
instance = new Localizer();
}
return instance;
} | private static Localizer get() {
<DeepExtract>
if (instance == null) {
instance = new Localizer();
}
return instance;
</DeepExtract>
} | mythling | positive | 439,473 |
@Override
public void _INVALID_damage(int i) {
throw new UnsupportedOperationException();
} | @Override
public void _INVALID_damage(int i) {
<DeepExtract>
throw new UnsupportedOperationException();
</DeepExtract>
} | BukkitBridge | positive | 439,474 |
public void setCurState(int state) {
curState = state;
keepLoading.setVisibility((curState == DATA_LOADING) ? View.VISIBLE : View.GONE);
loadNone.setVisibility((curState == DATA_LOAD_NONE) ? View.VISIBLE : View.GONE);
loadError.setVisibility((curState == DATA_LOAD_ERROR) ? View.VISIBLE : View.GONE);
if (loadSuccess == null && curState == DATA_LOAD_SUCCESS) {
loadSuccess = onSuccessView();
mKeep.addView(loadSuccess);
}
if (loadSuccess != null) {
loadSuccess.setVisibility((curState == DATA_LOAD_SUCCESS) ? View.VISIBLE : View.GONE);
}
} | public void setCurState(int state) {
curState = state;
<DeepExtract>
keepLoading.setVisibility((curState == DATA_LOADING) ? View.VISIBLE : View.GONE);
loadNone.setVisibility((curState == DATA_LOAD_NONE) ? View.VISIBLE : View.GONE);
loadError.setVisibility((curState == DATA_LOAD_ERROR) ? View.VISIBLE : View.GONE);
if (loadSuccess == null && curState == DATA_LOAD_SUCCESS) {
loadSuccess = onSuccessView();
mKeep.addView(loadSuccess);
}
if (loadSuccess != null) {
loadSuccess.setVisibility((curState == DATA_LOAD_SUCCESS) ? View.VISIBLE : View.GONE);
}
</DeepExtract>
} | topnews | positive | 439,475 |
@Override
public void deleteLabel(String labelId) {
logger.debug("Delete request on Trello API at url {} for class {} with params {}", createUrlWithNoArgs(DELETE_LABEL), Map.class.getClass().getCanonicalName(), labelId);
return httpClient.delete(createUrlWithNoArgs(DELETE_LABEL), Map.class, enrichParams(labelId));
} | @Override
public void deleteLabel(String labelId) {
<DeepExtract>
logger.debug("Delete request on Trello API at url {} for class {} with params {}", createUrlWithNoArgs(DELETE_LABEL), Map.class.getClass().getCanonicalName(), labelId);
return httpClient.delete(createUrlWithNoArgs(DELETE_LABEL), Map.class, enrichParams(labelId));
</DeepExtract>
} | trello-java-wrapper | positive | 439,476 |
@multimethod
private static String renderExpressionClass(EvaluationContext context, String className, Assignment expression) {
return renderFragments(renderPreviousImports(context), renderClassName(className), renderClassConstructor(className), renderPreviousEvaluations(context), renderPreviousMethods(context), renderMethodName(expression), renderExpressionToken(expression), renderEndOfMethod(), renderEndOfFile());
} | @multimethod
private static String renderExpressionClass(EvaluationContext context, String className, Assignment expression) {
<DeepExtract>
return renderFragments(renderPreviousImports(context), renderClassName(className), renderClassConstructor(className), renderPreviousEvaluations(context), renderPreviousMethods(context), renderMethodName(expression), renderExpressionToken(expression), renderEndOfMethod(), renderEndOfFile());
</DeepExtract>
} | java-repl | positive | 439,477 |
@Override
protected ArrayList<LocalPic> doInBackground(Void... params) {
SparseArray<LocalPic> mImagePathMap = new SparseArray<LocalPic>();
ArrayList<LocalPic> list = new ArrayList<LocalPic>();
String[] proj = { MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA };
String sortOrder = MediaStore.Images.Media.DATE_ADDED + " desc";
Cursor cursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, proj, null, null, sortOrder);
if (cursor != null) {
while (cursor.moveToNext()) {
LocalPic temp = new LocalPic();
temp.path = cursor.getString(1);
temp.thumbnails = null;
list.add(temp);
mImagePathMap.put(cursor.getInt(0), temp);
}
}
if (cursor != null) {
cursor.close();
}
proj = new String[] { MediaStore.Images.Thumbnails.IMAGE_ID, MediaStore.Video.Thumbnails.DATA };
cursor = getContentResolver().query(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, proj, MediaStore.Images.Thumbnails.KIND + " = ?", new String[] { String.valueOf(MediaStore.Images.Thumbnails.MINI_KIND) }, null);
if (cursor != null) {
while (cursor.moveToNext()) {
LocalPic temp = mImagePathMap.get(cursor.getInt(0));
if (temp != null) {
temp.thumbnails = cursor.getString(1);
}
}
}
if (cursor != null) {
cursor.close();
}
mImagePathMap.clear();
return list;
} | @Override
protected ArrayList<LocalPic> doInBackground(Void... params) {
<DeepExtract>
SparseArray<LocalPic> mImagePathMap = new SparseArray<LocalPic>();
ArrayList<LocalPic> list = new ArrayList<LocalPic>();
String[] proj = { MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA };
String sortOrder = MediaStore.Images.Media.DATE_ADDED + " desc";
Cursor cursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, proj, null, null, sortOrder);
if (cursor != null) {
while (cursor.moveToNext()) {
LocalPic temp = new LocalPic();
temp.path = cursor.getString(1);
temp.thumbnails = null;
list.add(temp);
mImagePathMap.put(cursor.getInt(0), temp);
}
}
if (cursor != null) {
cursor.close();
}
proj = new String[] { MediaStore.Images.Thumbnails.IMAGE_ID, MediaStore.Video.Thumbnails.DATA };
cursor = getContentResolver().query(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, proj, MediaStore.Images.Thumbnails.KIND + " = ?", new String[] { String.valueOf(MediaStore.Images.Thumbnails.MINI_KIND) }, null);
if (cursor != null) {
while (cursor.moveToNext()) {
LocalPic temp = mImagePathMap.get(cursor.getInt(0));
if (temp != null) {
temp.thumbnails = cursor.getString(1);
}
}
}
if (cursor != null) {
cursor.close();
}
mImagePathMap.clear();
return list;
</DeepExtract>
} | select_picture_module | positive | 439,478 |
private static String computeComputerIdentity() {
Set<String> items = new TreeSet<>();
try {
for (Enumeration<NetworkInterface> it = NetworkInterface.getNetworkInterfaces(); it.hasMoreElements(); ) {
NetworkInterface ni = it.nextElement();
if (shouldIncludeInterface(ni)) {
items.add(prettyPrintMacAddress(ni.getHardwareAddress()));
}
}
} catch (SocketException ignore) {
}
try {
items.add(InetAddress.getLocalHost().getHostName());
} catch (UnknownHostException ignore) {
}
return Integer.toHexString(items.hashCode()).toLowerCase();
} | private static String computeComputerIdentity() {
Set<String> items = new TreeSet<>();
try {
for (Enumeration<NetworkInterface> it = NetworkInterface.getNetworkInterfaces(); it.hasMoreElements(); ) {
NetworkInterface ni = it.nextElement();
if (shouldIncludeInterface(ni)) {
items.add(prettyPrintMacAddress(ni.getHardwareAddress()));
}
}
} catch (SocketException ignore) {
}
<DeepExtract>
try {
items.add(InetAddress.getLocalHost().getHostName());
} catch (UnknownHostException ignore) {
}
</DeepExtract>
return Integer.toHexString(items.hashCode()).toLowerCase();
} | codekvast | positive | 439,481 |
public static PipePosition createFromNBT(CompoundNBT nbt) {
PipePosition position = new PipePosition(BlockPos.ZERO, Direction.NORTH);
pos = NBTUtil.readBlockPos(nbt);
direction = Direction.from3DDataValue(nbt.getInt("direction"));
return position;
} | public static PipePosition createFromNBT(CompoundNBT nbt) {
PipePosition position = new PipePosition(BlockPos.ZERO, Direction.NORTH);
<DeepExtract>
pos = NBTUtil.readBlockPos(nbt);
direction = Direction.from3DDataValue(nbt.getInt("direction"));
</DeepExtract>
return position;
} | Techarium | positive | 439,482 |
private List<Emoticon> getBundamEmoticonList() {
ImmutableList.Builder<Emoticon> builder = ImmutableList.builder();
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/7.png", "[s:1240]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/17.png", "[s:1259]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/16.png", "[s:1260]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/11.png", "[s:1261]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/21.png", "[s:1262]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/62.gif", "[s:1264]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/78.gif", "[s:1265]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/69.gif", "[s:1266]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/73.gif", "[s:1267]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/68.gif", "[s:1268]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/71.gif", "[s:1269]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/72.gif", "[s:1270]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/63.gif", "[s:1271]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/83.gif", "[s:1272]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/70.gif", "[s:1273]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/76.gif", "[s:1274]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/22.png", "[s:1258]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/10.png", "[s:1257]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/3.png", "[s:1256]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/65.gif", "[s:1263]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/18.png", "[s:1242]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/13.png", "[s:1243]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/15.png", "[s:1244]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/9.png", "[s:1245]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/2.png", "[s:1246]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/5.png", "[s:1247]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/4.png", "[s:1248]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/14.png", "[s:1249]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/20.png", "[s:1250]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/6.png", "[s:1251]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/23.png", "[s:1252]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/8.png", "[s:1253]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/19.png", "[s:1254]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/12.png", "[s:1255]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/64.gif", "[s:1275]"));
return builder.build();
} | private List<Emoticon> getBundamEmoticonList() {
ImmutableList.Builder<Emoticon> builder = ImmutableList.builder();
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/7.png", "[s:1240]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/17.png", "[s:1259]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/16.png", "[s:1260]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/11.png", "[s:1261]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/21.png", "[s:1262]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/62.gif", "[s:1264]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/78.gif", "[s:1265]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/69.gif", "[s:1266]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/73.gif", "[s:1267]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/68.gif", "[s:1268]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/71.gif", "[s:1269]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/72.gif", "[s:1270]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/63.gif", "[s:1271]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/83.gif", "[s:1272]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/70.gif", "[s:1273]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/76.gif", "[s:1274]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/22.png", "[s:1258]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/10.png", "[s:1257]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/3.png", "[s:1256]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/65.gif", "[s:1263]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/18.png", "[s:1242]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/13.png", "[s:1243]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/15.png", "[s:1244]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/9.png", "[s:1245]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/2.png", "[s:1246]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/5.png", "[s:1247]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/4.png", "[s:1248]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/14.png", "[s:1249]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/20.png", "[s:1250]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/6.png", "[s:1251]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/23.png", "[s:1252]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/8.png", "[s:1253]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/19.png", "[s:1254]"));
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/12.png", "[s:1255]"));
<DeepExtract>
builder.add(new Emoticon(ASSET_PATH_EMOTICON + "bundam/64.gif", "[s:1275]"));
</DeepExtract>
return builder.build();
} | S1-Next | positive | 439,484 |
public char[] toChars(char[] chars) {
chars[0] = (key > 0 && key < 118) ? keyToString.charAt(((key + 2) % 12) * 2) : '-';
chars[1] = (key > 0 && key < 118) ? keyToString.charAt(((key + 2) % 12) * 2 + 1) : '-';
chars[2] = (key > 0 && key < 118) ? (char) ('0' + (key + 2) / 12) : '-';
chars[3] = (instrument > 9 && instrument < 100) ? (char) ('0' + instrument / 10) : '-';
chars[4] = (instrument > 0 && instrument < 100) ? (char) ('0' + instrument % 10) : '-';
chars[5] = ((effect > 0 || parameter > 0) && effect < 16) ? hexToString.charAt(effect) : '-';
chars[6] = (effect > 0 || parameter > 0) ? hexToString.charAt((parameter >> 4) & 0xF) : '-';
chars[7] = (effect > 0 || parameter > 0) ? hexToString.charAt(parameter & 0xF) : '-';
return chars;
} | public char[] toChars(char[] chars) {
<DeepExtract>
chars[0] = (key > 0 && key < 118) ? keyToString.charAt(((key + 2) % 12) * 2) : '-';
chars[1] = (key > 0 && key < 118) ? keyToString.charAt(((key + 2) % 12) * 2 + 1) : '-';
chars[2] = (key > 0 && key < 118) ? (char) ('0' + (key + 2) / 12) : '-';
</DeepExtract>
chars[3] = (instrument > 9 && instrument < 100) ? (char) ('0' + instrument / 10) : '-';
chars[4] = (instrument > 0 && instrument < 100) ? (char) ('0' + instrument % 10) : '-';
chars[5] = ((effect > 0 || parameter > 0) && effect < 16) ? hexToString.charAt(effect) : '-';
chars[6] = (effect > 0 || parameter > 0) ? hexToString.charAt((parameter >> 4) & 0xF) : '-';
chars[7] = (effect > 0 || parameter > 0) ? hexToString.charAt(parameter & 0xF) : '-';
return chars;
} | micromod | positive | 439,486 |
public void actionPerformed(java.awt.event.ActionEvent evt) {
String taiKhoan = txtUsername.getText().trim();
String matKhau = pfdPassword.getText().trim();
if (taiKhoan.isEmpty()) {
lbl_Id_Hint.setVisible(true);
return;
}
if (!taiKhoan.isEmpty() && matKhau.isEmpty()) {
lbl_Id_Hint.setVisible(false);
lbl_PW_Hint.setVisible(true);
return;
}
lbl_Id_Hint.setVisible(false);
lbl_PW_Hint.setVisible(false);
NhanVienDAO nhanVienDAO = new NhanVienDAO();
NhanVien nv = new NhanVien();
nv = nhanVienDAO.dangNhap(nv, taiKhoan, matKhau);
if (nv != null) {
JOptionPane.showMessageDialog(this, "Successfully!!");
nv = nhanVienDAO.getNVByID(nv.getMaNhanVien());
if (!ckb_ghiNho.isSelected()) {
nv.setMatKhau("");
}
MAIN f = new MAIN(nv);
this.dispose();
f.setLocationRelativeTo(null);
f.setVisible(true);
} else {
JOptionPane.showMessageDialog(this, "Incorrect username or password!!");
}
} | public void actionPerformed(java.awt.event.ActionEvent evt) {
<DeepExtract>
String taiKhoan = txtUsername.getText().trim();
String matKhau = pfdPassword.getText().trim();
if (taiKhoan.isEmpty()) {
lbl_Id_Hint.setVisible(true);
return;
}
if (!taiKhoan.isEmpty() && matKhau.isEmpty()) {
lbl_Id_Hint.setVisible(false);
lbl_PW_Hint.setVisible(true);
return;
}
lbl_Id_Hint.setVisible(false);
lbl_PW_Hint.setVisible(false);
NhanVienDAO nhanVienDAO = new NhanVienDAO();
NhanVien nv = new NhanVien();
nv = nhanVienDAO.dangNhap(nv, taiKhoan, matKhau);
if (nv != null) {
JOptionPane.showMessageDialog(this, "Successfully!!");
nv = nhanVienDAO.getNVByID(nv.getMaNhanVien());
if (!ckb_ghiNho.isSelected()) {
nv.setMatKhau("");
}
MAIN f = new MAIN(nv);
this.dispose();
f.setLocationRelativeTo(null);
f.setVisible(true);
} else {
JOptionPane.showMessageDialog(this, "Incorrect username or password!!");
}
</DeepExtract>
} | StoreManager | positive | 439,488 |
public static void main(String[] args) {
synth = JSyn.createSynthesizer();
synth.add(lineIn = new LineIn());
synth.add(lineOut = new LineOut());
lineIn.output.connect(0, lineOut.input, 0);
lineIn.output.connect(1, lineOut.input, 1);
int numInputChannels = 2;
int numOutputChannels = 2;
synth.start(44100, AudioDeviceManager.USE_DEFAULT_DEVICE, numInputChannels, AudioDeviceManager.USE_DEFAULT_DEVICE, numOutputChannels);
lineOut.start();
System.out.println("Audio passthrough started.");
try {
double time = synth.getCurrentTime();
synth.sleepUntil(time + 8.0);
} catch (InterruptedException e) {
e.printStackTrace();
}
synth.stop();
System.out.println("All done.");
} | public static void main(String[] args) {
<DeepExtract>
synth = JSyn.createSynthesizer();
synth.add(lineIn = new LineIn());
synth.add(lineOut = new LineOut());
lineIn.output.connect(0, lineOut.input, 0);
lineIn.output.connect(1, lineOut.input, 1);
int numInputChannels = 2;
int numOutputChannels = 2;
synth.start(44100, AudioDeviceManager.USE_DEFAULT_DEVICE, numInputChannels, AudioDeviceManager.USE_DEFAULT_DEVICE, numOutputChannels);
lineOut.start();
System.out.println("Audio passthrough started.");
try {
double time = synth.getCurrentTime();
synth.sleepUntil(time + 8.0);
} catch (InterruptedException e) {
e.printStackTrace();
}
synth.stop();
System.out.println("All done.");
</DeepExtract>
} | vocobox | positive | 439,489 |
@Test
public void aggregate_fetchByIds_oneToOnesWithMatches_returnsChild() {
photon.registerAggregate(MyTable.class).withId("id").withChild("myOtherTable", MyOtherTable.class).withId("id").withForeignKeyToParent("id").withDatabaseColumn("myothervalue", "myOtherValueWithDiffName").addAsChild().register();
try (PhotonTransaction transaction = photon.beginTransaction()) {
List<MyTable> myTables = transaction.query(MyTable.class).fetchByIds(Arrays.asList(1, 2, 3, 4));
assertNotNull(myTables);
assertEquals(4, myTables.size());
assertEquals(new Integer(1), myTables.get(0).getId());
assertNull(myTables.get(0).getMyOtherTable());
assertEquals(new Integer(2), myTables.get(1).getId());
assertNull(myTables.get(1).getMyOtherTable());
assertEquals(new Integer(3), myTables.get(2).getId());
assertEquals(3, myTables.get(2).getMyOtherTable().getId());
assertEquals(new Integer(4), myTables.get(3).getId());
assertEquals(4, myTables.get(3).getMyOtherTable().getId());
}
} | @Test
public void aggregate_fetchByIds_oneToOnesWithMatches_returnsChild() {
<DeepExtract>
photon.registerAggregate(MyTable.class).withId("id").withChild("myOtherTable", MyOtherTable.class).withId("id").withForeignKeyToParent("id").withDatabaseColumn("myothervalue", "myOtherValueWithDiffName").addAsChild().register();
</DeepExtract>
try (PhotonTransaction transaction = photon.beginTransaction()) {
List<MyTable> myTables = transaction.query(MyTable.class).fetchByIds(Arrays.asList(1, 2, 3, 4));
assertNotNull(myTables);
assertEquals(4, myTables.size());
assertEquals(new Integer(1), myTables.get(0).getId());
assertNull(myTables.get(0).getMyOtherTable());
assertEquals(new Integer(2), myTables.get(1).getId());
assertNull(myTables.get(1).getMyOtherTable());
assertEquals(new Integer(3), myTables.get(2).getId());
assertEquals(3, myTables.get(2).getMyOtherTable().getId());
assertEquals(new Integer(4), myTables.get(3).getId());
assertEquals(4, myTables.get(3).getMyOtherTable().getId());
}
} | photon | positive | 439,490 |
protected static void connect(Ict ict1, Ict ict2) {
EditableProperties properties = ict1.getProperties().toEditable();
Set<String> neighbors = properties.neighbors();
neighbors.add(ict2.getAddress().getHostName() + ":" + ict2.getAddress().getPort());
properties.neighbors(neighbors);
ict1.updateProperties(properties.toFinal());
EditableProperties properties = ict2.getProperties().toEditable();
Set<String> neighbors = properties.neighbors();
neighbors.add(ict1.getAddress().getHostName() + ":" + ict1.getAddress().getPort());
properties.neighbors(neighbors);
ict2.updateProperties(properties.toFinal());
} | protected static void connect(Ict ict1, Ict ict2) {
EditableProperties properties = ict1.getProperties().toEditable();
Set<String> neighbors = properties.neighbors();
neighbors.add(ict2.getAddress().getHostName() + ":" + ict2.getAddress().getPort());
properties.neighbors(neighbors);
ict1.updateProperties(properties.toFinal());
<DeepExtract>
EditableProperties properties = ict2.getProperties().toEditable();
Set<String> neighbors = properties.neighbors();
neighbors.add(ict1.getAddress().getHostName() + ":" + ict1.getAddress().getPort());
properties.neighbors(neighbors);
ict2.updateProperties(properties.toFinal());
</DeepExtract>
} | ict | positive | 439,491 |
public void testBinaryVariantsCompact() throws Exception {
ObjectWriter w = MAPPER.writer();
if (false) {
w = w.withDefaultPrettyPrinter();
}
ObjectReader r = MAPPER.readerFor(BinaryValue.class);
if (Base64Variants.MIME != null) {
w = w.with(Base64Variants.MIME);
r = r.with(Base64Variants.MIME);
}
final String EXP = false ? "<BinaryValue>" + DEFAULT_NEW_LINE + " <value>" + XML_MIME + "</value>" + DEFAULT_NEW_LINE + "</BinaryValue>" : "<BinaryValue><value>" + XML_MIME + "</value></BinaryValue>";
final String xml = w.writeValueAsString(new BinaryValue(BINARY_DATA)).trim();
assertEquals(EXP, xml);
BinaryValue result = r.readValue(EXP);
assertArrayEquals(BINARY_DATA, result.value);
ObjectWriter w = MAPPER.writer();
if (false) {
w = w.withDefaultPrettyPrinter();
}
ObjectReader r = MAPPER.readerFor(BinaryValue.class);
if (Base64Variants.MIME_NO_LINEFEEDS != null) {
w = w.with(Base64Variants.MIME_NO_LINEFEEDS);
r = r.with(Base64Variants.MIME_NO_LINEFEEDS);
}
final String EXP = false ? "<BinaryValue>" + DEFAULT_NEW_LINE + " <value>" + XML_MIME_NO_LINEFEEDS + "</value>" + DEFAULT_NEW_LINE + "</BinaryValue>" : "<BinaryValue><value>" + XML_MIME_NO_LINEFEEDS + "</value></BinaryValue>";
final String xml = w.writeValueAsString(new BinaryValue(BINARY_DATA)).trim();
assertEquals(EXP, xml);
BinaryValue result = r.readValue(EXP);
assertArrayEquals(BINARY_DATA, result.value);
ObjectWriter w = MAPPER.writer();
if (false) {
w = w.withDefaultPrettyPrinter();
}
ObjectReader r = MAPPER.readerFor(BinaryValue.class);
if (Base64Variants.MODIFIED_FOR_URL != null) {
w = w.with(Base64Variants.MODIFIED_FOR_URL);
r = r.with(Base64Variants.MODIFIED_FOR_URL);
}
final String EXP = false ? "<BinaryValue>" + DEFAULT_NEW_LINE + " <value>" + XML_MOD_FOR_URL + "</value>" + DEFAULT_NEW_LINE + "</BinaryValue>" : "<BinaryValue><value>" + XML_MOD_FOR_URL + "</value></BinaryValue>";
final String xml = w.writeValueAsString(new BinaryValue(BINARY_DATA)).trim();
assertEquals(EXP, xml);
BinaryValue result = r.readValue(EXP);
assertArrayEquals(BINARY_DATA, result.value);
ObjectWriter w = MAPPER.writer();
if (false) {
w = w.withDefaultPrettyPrinter();
}
ObjectReader r = MAPPER.readerFor(BinaryValue.class);
if (Base64Variants.PEM != null) {
w = w.with(Base64Variants.PEM);
r = r.with(Base64Variants.PEM);
}
final String EXP = false ? "<BinaryValue>" + DEFAULT_NEW_LINE + " <value>" + XML_PEM + "</value>" + DEFAULT_NEW_LINE + "</BinaryValue>" : "<BinaryValue><value>" + XML_PEM + "</value></BinaryValue>";
final String xml = w.writeValueAsString(new BinaryValue(BINARY_DATA)).trim();
assertEquals(EXP, xml);
BinaryValue result = r.readValue(EXP);
assertArrayEquals(BINARY_DATA, result.value);
ObjectWriter w = MAPPER.writer();
if (false) {
w = w.withDefaultPrettyPrinter();
}
ObjectReader r = MAPPER.readerFor(BinaryValue.class);
if (null != null) {
w = w.with(null);
r = r.with(null);
}
final String EXP = false ? "<BinaryValue>" + DEFAULT_NEW_LINE + " <value>" + XML_MIME + "</value>" + DEFAULT_NEW_LINE + "</BinaryValue>" : "<BinaryValue><value>" + XML_MIME + "</value></BinaryValue>";
final String xml = w.writeValueAsString(new BinaryValue(BINARY_DATA)).trim();
assertEquals(EXP, xml);
BinaryValue result = r.readValue(EXP);
assertArrayEquals(BINARY_DATA, result.value);
} | public void testBinaryVariantsCompact() throws Exception {
ObjectWriter w = MAPPER.writer();
if (false) {
w = w.withDefaultPrettyPrinter();
}
ObjectReader r = MAPPER.readerFor(BinaryValue.class);
if (Base64Variants.MIME != null) {
w = w.with(Base64Variants.MIME);
r = r.with(Base64Variants.MIME);
}
final String EXP = false ? "<BinaryValue>" + DEFAULT_NEW_LINE + " <value>" + XML_MIME + "</value>" + DEFAULT_NEW_LINE + "</BinaryValue>" : "<BinaryValue><value>" + XML_MIME + "</value></BinaryValue>";
final String xml = w.writeValueAsString(new BinaryValue(BINARY_DATA)).trim();
assertEquals(EXP, xml);
BinaryValue result = r.readValue(EXP);
assertArrayEquals(BINARY_DATA, result.value);
ObjectWriter w = MAPPER.writer();
if (false) {
w = w.withDefaultPrettyPrinter();
}
ObjectReader r = MAPPER.readerFor(BinaryValue.class);
if (Base64Variants.MIME_NO_LINEFEEDS != null) {
w = w.with(Base64Variants.MIME_NO_LINEFEEDS);
r = r.with(Base64Variants.MIME_NO_LINEFEEDS);
}
final String EXP = false ? "<BinaryValue>" + DEFAULT_NEW_LINE + " <value>" + XML_MIME_NO_LINEFEEDS + "</value>" + DEFAULT_NEW_LINE + "</BinaryValue>" : "<BinaryValue><value>" + XML_MIME_NO_LINEFEEDS + "</value></BinaryValue>";
final String xml = w.writeValueAsString(new BinaryValue(BINARY_DATA)).trim();
assertEquals(EXP, xml);
BinaryValue result = r.readValue(EXP);
assertArrayEquals(BINARY_DATA, result.value);
ObjectWriter w = MAPPER.writer();
if (false) {
w = w.withDefaultPrettyPrinter();
}
ObjectReader r = MAPPER.readerFor(BinaryValue.class);
if (Base64Variants.MODIFIED_FOR_URL != null) {
w = w.with(Base64Variants.MODIFIED_FOR_URL);
r = r.with(Base64Variants.MODIFIED_FOR_URL);
}
final String EXP = false ? "<BinaryValue>" + DEFAULT_NEW_LINE + " <value>" + XML_MOD_FOR_URL + "</value>" + DEFAULT_NEW_LINE + "</BinaryValue>" : "<BinaryValue><value>" + XML_MOD_FOR_URL + "</value></BinaryValue>";
final String xml = w.writeValueAsString(new BinaryValue(BINARY_DATA)).trim();
assertEquals(EXP, xml);
BinaryValue result = r.readValue(EXP);
assertArrayEquals(BINARY_DATA, result.value);
ObjectWriter w = MAPPER.writer();
if (false) {
w = w.withDefaultPrettyPrinter();
}
ObjectReader r = MAPPER.readerFor(BinaryValue.class);
if (Base64Variants.PEM != null) {
w = w.with(Base64Variants.PEM);
r = r.with(Base64Variants.PEM);
}
final String EXP = false ? "<BinaryValue>" + DEFAULT_NEW_LINE + " <value>" + XML_PEM + "</value>" + DEFAULT_NEW_LINE + "</BinaryValue>" : "<BinaryValue><value>" + XML_PEM + "</value></BinaryValue>";
final String xml = w.writeValueAsString(new BinaryValue(BINARY_DATA)).trim();
assertEquals(EXP, xml);
BinaryValue result = r.readValue(EXP);
assertArrayEquals(BINARY_DATA, result.value);
<DeepExtract>
ObjectWriter w = MAPPER.writer();
if (false) {
w = w.withDefaultPrettyPrinter();
}
ObjectReader r = MAPPER.readerFor(BinaryValue.class);
if (null != null) {
w = w.with(null);
r = r.with(null);
}
final String EXP = false ? "<BinaryValue>" + DEFAULT_NEW_LINE + " <value>" + XML_MIME + "</value>" + DEFAULT_NEW_LINE + "</BinaryValue>" : "<BinaryValue><value>" + XML_MIME + "</value></BinaryValue>";
final String xml = w.writeValueAsString(new BinaryValue(BINARY_DATA)).trim();
assertEquals(EXP, xml);
BinaryValue result = r.readValue(EXP);
assertArrayEquals(BINARY_DATA, result.value);
</DeepExtract>
} | jackson-dataformat-xml | positive | 439,493 |
public Criteria andPermissionnameIsNotNull() {
if ("permissionName is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("permissionName is not null"));
return (Criteria) this;
} | public Criteria andPermissionnameIsNotNull() {
<DeepExtract>
if ("permissionName is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("permissionName is not null"));
</DeepExtract>
return (Criteria) this;
} | songjhh_blog | positive | 439,496 |
protected void clearRunTables() {
clearRunTable(newTable);
if (!Utils.isTableEmpty(origTable)) {
for (int i = 0; i < origTable.getRowCount(); ++i) {
for (int j = 0; j < origTable.getColumnCount(); ++j) newTable.setValueAt(origTable.getValueAt(i, j), i, j);
}
validateTable(newTable);
}
newPlot3d.removeAllPlots();
interpTypeCheckBox.setEnabled(true);
extrCheckBox.setEnabled(true);
if (Utils.isTableEmpty(origTable))
return;
if (tableType == TableType.Table3D) {
workdata = new TreeMap<Long, TreeMap<Long, Double>>();
undoStack = new Stack<ArrayList<ArrayList<Object>>>();
redoStack = new Stack<ArrayList<ArrayList<Object>>>();
undoButton.setEnabled(false);
redoButton.setEnabled(false);
long x, y;
double z;
TreeMap<Long, Double> col;
for (int i = 1; i < origTable.getColumnCount(); ++i) {
x = Math.round(Double.valueOf(origTable.getValueAt(0, i).toString()) * precision);
col = new TreeMap<Long, Double>();
workdata.put(x, col);
for (int j = 1; j < origTable.getRowCount(); ++j) {
y = Math.round(Double.valueOf(origTable.getValueAt(j, 0).toString()) * precision);
z = Double.valueOf(origTable.getValueAt(j, i).toString());
col.put(y, z);
}
}
} else
workdata = null;
} | protected void clearRunTables() {
clearRunTable(newTable);
if (!Utils.isTableEmpty(origTable)) {
for (int i = 0; i < origTable.getRowCount(); ++i) {
for (int j = 0; j < origTable.getColumnCount(); ++j) newTable.setValueAt(origTable.getValueAt(i, j), i, j);
}
validateTable(newTable);
}
newPlot3d.removeAllPlots();
interpTypeCheckBox.setEnabled(true);
extrCheckBox.setEnabled(true);
<DeepExtract>
if (Utils.isTableEmpty(origTable))
return;
if (tableType == TableType.Table3D) {
workdata = new TreeMap<Long, TreeMap<Long, Double>>();
undoStack = new Stack<ArrayList<ArrayList<Object>>>();
redoStack = new Stack<ArrayList<ArrayList<Object>>>();
undoButton.setEnabled(false);
redoButton.setEnabled(false);
long x, y;
double z;
TreeMap<Long, Double> col;
for (int i = 1; i < origTable.getColumnCount(); ++i) {
x = Math.round(Double.valueOf(origTable.getValueAt(0, i).toString()) * precision);
col = new TreeMap<Long, Double>();
workdata.put(x, col);
for (int j = 1; j < origTable.getRowCount(); ++j) {
y = Math.round(Double.valueOf(origTable.getValueAt(j, 0).toString()) * precision);
z = Double.valueOf(origTable.getValueAt(j, i).toString());
col.put(y, z);
}
}
} else
workdata = null;
</DeepExtract>
} | mafscaling | positive | 439,497 |
private void setupWithData() {
CommonApplication.setMocked();
TestCaseUtils.setExternalStorageMounted();
TestCaseUtils.setThreeTableDataset(true);
TestCaseUtils.setExternalStorageMounted();
activity = ODKFragmentTestUtil.startFragmentForTableDisplayActivity(ViewFragmentType.SPREADSHEET, TestConstants.DEFAULT_TABLE_ID);
FragmentManager mgr = activity.getFragmentManager();
fragment = (SpreadsheetFragment) mgr.findFragmentByTag(ViewFragmentType.SPREADSHEET.name());
} | private void setupWithData() {
CommonApplication.setMocked();
TestCaseUtils.setExternalStorageMounted();
TestCaseUtils.setThreeTableDataset(true);
<DeepExtract>
TestCaseUtils.setExternalStorageMounted();
activity = ODKFragmentTestUtil.startFragmentForTableDisplayActivity(ViewFragmentType.SPREADSHEET, TestConstants.DEFAULT_TABLE_ID);
FragmentManager mgr = activity.getFragmentManager();
fragment = (SpreadsheetFragment) mgr.findFragmentByTag(ViewFragmentType.SPREADSHEET.name());
</DeepExtract>
} | tables | positive | 439,499 |
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
mTitle = mTitle;
mActionBar.setTitle(mTitle);
invalidateOptionsMenu();
} | public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
<DeepExtract>
mTitle = mTitle;
mActionBar.setTitle(mTitle);
</DeepExtract>
invalidateOptionsMenu();
} | AIMSICDL | positive | 439,501 |
public boolean decide(String n, ScriptInstance i, Stack l) {
Scalar bb = (Scalar) l.pop();
Scalar aa = (Scalar) l.pop();
Pattern pattern;
Pattern temp = (Pattern) patternCache.get(bb.toString());
if (temp != null) {
pattern = temp;
} else {
temp = Pattern.compile(bb.toString());
patternCache.put(bb.toString(), temp);
pattern = temp;
}
Scalar container = null;
Matcher matcher = null;
if (n.equals("hasmatch")) {
String key = key(aa.toString(), pattern);
container = getMatcher(i.getScriptEnvironment(), key, aa.toString(), pattern);
matcher = (Matcher) container.objectValue();
rv = matcher.find();
if (!rv) {
Map matchers = (Map) i.getScriptEnvironment().getContextMetadata("matchers");
if (matchers != null) {
matchers.remove(key);
}
}
} else {
matcher = pattern.matcher(aa.toString());
container = SleepUtils.getScalar(matcher);
rv = matcher.matches();
}
if (TaintUtils.isTainted(aa) || TaintUtils.isTainted(bb)) {
TaintUtils.taintAll(container);
}
i.getScriptEnvironment().setContextMetadata("matcher", rv ? container : null);
return rv;
} | public boolean decide(String n, ScriptInstance i, Stack l) {
Scalar bb = (Scalar) l.pop();
Scalar aa = (Scalar) l.pop();
<DeepExtract>
Pattern pattern;
Pattern temp = (Pattern) patternCache.get(bb.toString());
if (temp != null) {
pattern = temp;
} else {
temp = Pattern.compile(bb.toString());
patternCache.put(bb.toString(), temp);
pattern = temp;
}
</DeepExtract>
Scalar container = null;
Matcher matcher = null;
if (n.equals("hasmatch")) {
String key = key(aa.toString(), pattern);
container = getMatcher(i.getScriptEnvironment(), key, aa.toString(), pattern);
matcher = (Matcher) container.objectValue();
rv = matcher.find();
if (!rv) {
Map matchers = (Map) i.getScriptEnvironment().getContextMetadata("matchers");
if (matchers != null) {
matchers.remove(key);
}
}
} else {
matcher = pattern.matcher(aa.toString());
container = SleepUtils.getScalar(matcher);
rv = matcher.matches();
}
if (TaintUtils.isTainted(aa) || TaintUtils.isTainted(bb)) {
TaintUtils.taintAll(container);
}
i.getScriptEnvironment().setContextMetadata("matcher", rv ? container : null);
return rv;
} | sleep | positive | 439,502 |
@Test
public void testTenThings() {
ArrayHeap<String> heap = new ArrayHeap<>();
heap.insert("c", 3);
heap.insert("i", 9);
heap.insert("g", 7);
heap.insert("d", 4);
heap.insert("a", 1);
heap.insert("h", 8);
heap.insert("e", 5);
heap.insert("b", 2);
heap.insert("c", 3);
heap.insert("d", 4);
List<Double> sortedItems = new ArrayList<>();
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
Comparable prev = null;
for (Comparable item : sortedItems) {
if (prev != null && item.compareTo(prev) < 0) {
fail("Failed heap test given to you in the main method.");
}
prev = item;
}
} | @Test
public void testTenThings() {
ArrayHeap<String> heap = new ArrayHeap<>();
heap.insert("c", 3);
heap.insert("i", 9);
heap.insert("g", 7);
heap.insert("d", 4);
heap.insert("a", 1);
heap.insert("h", 8);
heap.insert("e", 5);
heap.insert("b", 2);
heap.insert("c", 3);
heap.insert("d", 4);
List<Double> sortedItems = new ArrayList<>();
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
sortedItems.add(heap.removeMin().priority());
<DeepExtract>
Comparable prev = null;
for (Comparable item : sortedItems) {
if (prev != null && item.compareTo(prev) < 0) {
fail("Failed heap test given to you in the main method.");
}
prev = item;
}
</DeepExtract>
} | skeleton-sp16 | positive | 439,503 |
public void execute(final String sql) {
if (showSQL || logger.isDebugEnabled()) {
if (logger.isDebugEnabled()) {
logger.debug("==> SQL:[ " + sql + " ]");
} else {
logger.info("==> SQL:[ " + sql + " ]");
}
getParameters(null);
}
jdbcTemplate.execute(sql);
} | public void execute(final String sql) {
<DeepExtract>
if (showSQL || logger.isDebugEnabled()) {
if (logger.isDebugEnabled()) {
logger.debug("==> SQL:[ " + sql + " ]");
} else {
logger.info("==> SQL:[ " + sql + " ]");
}
getParameters(null);
}
</DeepExtract>
jdbcTemplate.execute(sql);
} | EasyJdbc | positive | 439,505 |
@Test
public void test2() throws IOException {
if (null == null) {
Assert.assertTrue(config.parseArgs("data/flowtests/test2.asm"));
} else {
Assert.assertTrue(config.parseArgs("data/flowtests/test2.asm", "-dialect", null));
}
Assert.assertTrue("Could not parse file " + "data/flowtests/test2.asm", config.codeBaseParser.parseMainSourceFiles(config.inputFiles, code));
config.logger.setMinLevelToLog(MDLLogger.DEBUG);
ExecutionFlowAnalysis flowAnalyzer = new ExecutionFlowAnalysis(code, config);
HashMap<CodeStatement, List<StatementTransition>> table = flowAnalyzer.findAllRetDestinations();
for (CodeStatement s : table.keySet()) {
config.info(" ret analyzed: " + s);
}
Assert.assertEquals(2, table.size());
for (CodeStatement s : table.keySet()) {
Assert.assertNotNull(s.comment);
String[] tokens = s.comment.split(" ");
String ID = tokens[1];
int nDestinations = Integer.parseInt(tokens[2]);
Assert.assertEquals(nDestinations, table.get(s).size());
for (StatementTransition sd : table.get(s)) {
Assert.assertNotNull(sd.s.comment);
Assert.assertTrue(sd.s.comment.contains(ID + "-DESTINATION"));
}
}
} | @Test
public void test2() throws IOException {
<DeepExtract>
if (null == null) {
Assert.assertTrue(config.parseArgs("data/flowtests/test2.asm"));
} else {
Assert.assertTrue(config.parseArgs("data/flowtests/test2.asm", "-dialect", null));
}
Assert.assertTrue("Could not parse file " + "data/flowtests/test2.asm", config.codeBaseParser.parseMainSourceFiles(config.inputFiles, code));
config.logger.setMinLevelToLog(MDLLogger.DEBUG);
ExecutionFlowAnalysis flowAnalyzer = new ExecutionFlowAnalysis(code, config);
HashMap<CodeStatement, List<StatementTransition>> table = flowAnalyzer.findAllRetDestinations();
for (CodeStatement s : table.keySet()) {
config.info(" ret analyzed: " + s);
}
Assert.assertEquals(2, table.size());
for (CodeStatement s : table.keySet()) {
Assert.assertNotNull(s.comment);
String[] tokens = s.comment.split(" ");
String ID = tokens[1];
int nDestinations = Integer.parseInt(tokens[2]);
Assert.assertEquals(nDestinations, table.get(s).size());
for (StatementTransition sd : table.get(s)) {
Assert.assertNotNull(sd.s.comment);
Assert.assertTrue(sd.s.comment.contains(ID + "-DESTINATION"));
}
}
</DeepExtract>
} | mdlz80optimizer | positive | 439,506 |
public void actionPerformed(ActionEvent evt) {
String deleteOption = l10n.getString("Delete");
String cancelOption = l10n.getString("Cancel");
Object[] options = RuntimeUtils.sortDialogOptions(cancelOption, deleteOption);
String message = l10n.getString("ConfigFrame.remove_credentials");
JOptionPane pane = new JOptionPane(message, JOptionPane.WARNING_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options, cancelOption);
JDialog dialog = pane.createDialog(ConfigFrame.this, null);
dialog.setResizable(true);
RuntimeUtils.setDocumentModalDialog(dialog);
dialog.pack();
dialog.setVisible(true);
if (!deleteOption.equals(pane.getValue())) {
return;
}
keyring.clearKeys();
gwSelectionListener.valueChanged(new ListSelectionEvent(gatewayTable, 0, 0, false));
} | public void actionPerformed(ActionEvent evt) {
<DeepExtract>
String deleteOption = l10n.getString("Delete");
String cancelOption = l10n.getString("Cancel");
Object[] options = RuntimeUtils.sortDialogOptions(cancelOption, deleteOption);
String message = l10n.getString("ConfigFrame.remove_credentials");
JOptionPane pane = new JOptionPane(message, JOptionPane.WARNING_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options, cancelOption);
JDialog dialog = pane.createDialog(ConfigFrame.this, null);
dialog.setResizable(true);
RuntimeUtils.setDocumentModalDialog(dialog);
dialog.pack();
dialog.setVisible(true);
if (!deleteOption.equals(pane.getValue())) {
return;
}
keyring.clearKeys();
gwSelectionListener.valueChanged(new ListSelectionEvent(gatewayTable, 0, 0, false));
</DeepExtract>
} | esmska | positive | 439,507 |
public void tick() {
new Evaluator(this) {
public void evaluate() {
if (++tickNum < 8)
return;
tickNum = 0;
if (!inCurrentWorld())
return;
if (contentIsOrListContains("is", "player"))
getPlayer();
if (entity == null)
return;
setState();
getState();
if (modified())
self.evaluate();
}
};
if (ticks == 0)
return;
if (ticks < WAITTICKS) {
ticks++;
return;
}
onNotInteracting("hitting");
onNotInteracting("placing");
onNotInteracting("touching");
ticks = 0;
} | public void tick() {
new Evaluator(this) {
public void evaluate() {
if (++tickNum < 8)
return;
tickNum = 0;
if (!inCurrentWorld())
return;
if (contentIsOrListContains("is", "player"))
getPlayer();
if (entity == null)
return;
setState();
getState();
if (modified())
self.evaluate();
}
};
<DeepExtract>
if (ticks == 0)
return;
if (ticks < WAITTICKS) {
ticks++;
return;
}
onNotInteracting("hitting");
onNotInteracting("placing");
onNotInteracting("touching");
ticks = 0;
</DeepExtract>
} | NetMash | positive | 439,508 |
public void removeNode(Player player, BlockPos pos, TransportMode transportMode) {
railwayDataLoggingModule.addEvent((ServerPlayer) player, BlockNode.class, Collections.singletonList(String.format("type:%s", transportMode)), new ArrayList<>(), pos);
removeNode(world, rails, pos);
removeSavedRailS2C(world, platforms, rails, PACKET_DELETE_PLATFORM);
removeSavedRailS2C(world, sidings, rails, PACKET_DELETE_SIDING);
final List<BlockPos> railsToRemove = new ArrayList<>();
rails.forEach((startPos, railMap) -> railMap.forEach((endPos, rail) -> {
if (rail.railType.hasSavedRail && SavedRailBase.isInvalidSavedRail(rails, endPos, startPos)) {
railsToRemove.add(startPos);
railsToRemove.add(endPos);
}
}));
for (int i = 0; i < railsToRemove.size() - 1; i += 2) {
removeRailConnection(null, rails, railsToRemove.get(i), railsToRemove.get(i + 1));
}
final FriendlyByteBuf packet = signalBlocks.getValidationPacket(rails);
if (packet != null) {
world.players().forEach(player2 -> Registry.sendToPlayer((ServerPlayer) player2, PACKET_REMOVE_SIGNALS, packet));
}
} | public void removeNode(Player player, BlockPos pos, TransportMode transportMode) {
railwayDataLoggingModule.addEvent((ServerPlayer) player, BlockNode.class, Collections.singletonList(String.format("type:%s", transportMode)), new ArrayList<>(), pos);
removeNode(world, rails, pos);
<DeepExtract>
removeSavedRailS2C(world, platforms, rails, PACKET_DELETE_PLATFORM);
removeSavedRailS2C(world, sidings, rails, PACKET_DELETE_SIDING);
final List<BlockPos> railsToRemove = new ArrayList<>();
rails.forEach((startPos, railMap) -> railMap.forEach((endPos, rail) -> {
if (rail.railType.hasSavedRail && SavedRailBase.isInvalidSavedRail(rails, endPos, startPos)) {
railsToRemove.add(startPos);
railsToRemove.add(endPos);
}
}));
for (int i = 0; i < railsToRemove.size() - 1; i += 2) {
removeRailConnection(null, rails, railsToRemove.get(i), railsToRemove.get(i + 1));
}
</DeepExtract>
final FriendlyByteBuf packet = signalBlocks.getValidationPacket(rails);
if (packet != null) {
world.players().forEach(player2 -> Registry.sendToPlayer((ServerPlayer) player2, PACKET_REMOVE_SIGNALS, packet));
}
} | Minecraft-Transit-Railway | positive | 439,512 |
@Override
public <T> TradeResultVo<T> parse(String content, TypeReference<T> responseType) {
TradeResultVo<T> resultVo = new TradeResultVo<>();
Data = Collections.emptyList();
Status = TradeResultVo.STATUS_SUCCESS;
Message = content;
return resultVo;
} | @Override
public <T> TradeResultVo<T> parse(String content, TypeReference<T> responseType) {
TradeResultVo<T> resultVo = new TradeResultVo<>();
Data = Collections.emptyList();
Status = TradeResultVo.STATUS_SUCCESS;
<DeepExtract>
Message = content;
</DeepExtract>
return resultVo;
} | stock | positive | 439,514 |
@MainThread
private void exchangeAuthorizationCode(AuthorizationResponse authorizationResponse) {
Toast.makeText(this, "Exchanging authorization code", Toast.LENGTH_SHORT).show();
ClientAuthentication clientAuthentication;
clientAuthentication = new ClientSecretBasic(NrdbHelper.NRDB_SECRET);
mAuthService.performTokenRequest(authorizationResponse.createTokenExchangeRequest(), clientAuthentication, this::handleCodeExchangeResponse);
} | @MainThread
private void exchangeAuthorizationCode(AuthorizationResponse authorizationResponse) {
Toast.makeText(this, "Exchanging authorization code", Toast.LENGTH_SHORT).show();
<DeepExtract>
ClientAuthentication clientAuthentication;
clientAuthentication = new ClientSecretBasic(NrdbHelper.NRDB_SECRET);
mAuthService.performTokenRequest(authorizationResponse.createTokenExchangeRequest(), clientAuthentication, this::handleCodeExchangeResponse);
</DeepExtract>
} | ANR-Deck-Builder | positive | 439,515 |
@Override
protected void onItemClick(PayItem item, int position) {
super.onItemClick(item, position);
for (PayItem item : mAdapter.getData()) {
if (item.equals(item)) {
item.isSelect = !item.isSelect;
} else {
item.isSelect = false;
}
}
mAdapter.notifyDataSetChanged();
} | @Override
protected void onItemClick(PayItem item, int position) {
super.onItemClick(item, position);
<DeepExtract>
for (PayItem item : mAdapter.getData()) {
if (item.equals(item)) {
item.isSelect = !item.isSelect;
} else {
item.isSelect = false;
}
}
mAdapter.notifyDataSetChanged();
</DeepExtract>
} | shop-mall-android | positive | 439,516 |
@Override
public void setFoodError() {
SnackbarUtils.showShortMessage(mRootLayout, "Invalid " + "food");
} | @Override
public void setFoodError() {
<DeepExtract>
SnackbarUtils.showShortMessage(mRootLayout, "Invalid " + "food");
</DeepExtract>
} | CleanFit | positive | 439,517 |
private void requestTakePhotoPermissions() {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA }, REQUEST_PERMISSON_CAMERA);
return;
}
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
File photoFile = com.yjing.imageeditandroid.FileUtils.genEditFile();
if (photoFile != null) {
photoURI = Uri.fromFile(photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(takePictureIntent, TAKE_PHOTO_CODE);
}
}
} | private void requestTakePhotoPermissions() {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA }, REQUEST_PERMISSON_CAMERA);
return;
}
<DeepExtract>
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
File photoFile = com.yjing.imageeditandroid.FileUtils.genEditFile();
if (photoFile != null) {
photoURI = Uri.fromFile(photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(takePictureIntent, TAKE_PHOTO_CODE);
}
}
</DeepExtract>
} | SimpleImageEditor | positive | 439,519 |
public void whiteBackground(View view) {
this.backgroundColor = WHITE;
Intent intent = new Intent(MainActivity.this, StillCutPhotoActivity.class);
intent.putExtra(Constant.VALUE_KEY, this.backgroundColor);
startActivity(intent);
} | public void whiteBackground(View view) {
this.backgroundColor = WHITE;
<DeepExtract>
Intent intent = new Intent(MainActivity.this, StillCutPhotoActivity.class);
intent.putExtra(Constant.VALUE_KEY, this.backgroundColor);
startActivity(intent);
</DeepExtract>
} | HUAWEI-HMS-MLKit-Sample | positive | 439,521 |
public String getErrorMsg() {
String result = null;
if (sections != null) {
for (SolrSingleValuedField sf : sections) {
if (sf.getFieldName().equals("msg")) {
result = sf.getValue();
break;
}
}
}
return result;
} | public String getErrorMsg() {
<DeepExtract>
String result = null;
if (sections != null) {
for (SolrSingleValuedField sf : sections) {
if (sf.getFieldName().equals("msg")) {
result = sf.getValue();
break;
}
}
}
return result;
</DeepExtract>
} | solr-fusion | positive | 439,522 |
private void processText(int x, int y) {
List<String> l0 = linesProviders[x].getLines(null);
List<String> l1 = linesProviders[y].getLines(null);
if (linesProviders[x].getFile() != null) {
process(l0, l1, linesProviders[x].getFile().getAbsolutePath(), linesProviders[y].getFile().getAbsolutePath(), invert.isSelected(), human.isSelected(), fqn);
} else {
process(l0, l1, linesProviders[x].getName(), linesProviders[y].getName(), invert.isSelected(), human.isSelected(), fqn);
}
} | private void processText(int x, int y) {
<DeepExtract>
List<String> l0 = linesProviders[x].getLines(null);
List<String> l1 = linesProviders[y].getLines(null);
if (linesProviders[x].getFile() != null) {
process(l0, l1, linesProviders[x].getFile().getAbsolutePath(), linesProviders[y].getFile().getAbsolutePath(), invert.isSelected(), human.isSelected(), fqn);
} else {
process(l0, l1, linesProviders[x].getName(), linesProviders[y].getName(), invert.isSelected(), human.isSelected(), fqn);
}
</DeepExtract>
} | java-runtime-decompiler | positive | 439,523 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.