before
stringlengths 14
203k
| after
stringlengths 37
104k
| repo
stringlengths 2
50
| type
stringclasses 1
value |
|---|---|---|---|
public Long incr(@NonNull CacheKey key) {
Long increment = stringRedisTemplate.opsForValue().increment(key.getKey());
if (key != null && key.getExpire() != null) {
redisTemplate.expire(key.getKey(), key.getExpire());
}
return increment;
}
|
<DeepExtract>
if (key != null && key.getExpire() != null) {
redisTemplate.expire(key.getKey(), key.getExpire());
}
</DeepExtract>
|
sparkzxl-component
|
positive
|
@Override
public void run() {
isDrawSunShadow = true;
ValueAnimator valueAnimator = animMap.get(ANIM_WEATHER_SHADOW);
if (valueAnimator == null) {
valueAnimator = ValueAnimator.ofFloat().setDuration(400);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
sunShadowWidth = (float) animation.getAnimatedValue();
}
});
animMap.put(ANIM_WEATHER_SHADOW, valueAnimator);
}
valueAnimator.setFloatValues(0, getMeasuredWidth(), getMeasuredWidth() * 0.8f);
startValueAnimator(valueAnimator);
}
|
<DeepExtract>
isDrawSunShadow = true;
ValueAnimator valueAnimator = animMap.get(ANIM_WEATHER_SHADOW);
if (valueAnimator == null) {
valueAnimator = ValueAnimator.ofFloat().setDuration(400);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
sunShadowWidth = (float) animation.getAnimatedValue();
}
});
animMap.put(ANIM_WEATHER_SHADOW, valueAnimator);
}
valueAnimator.setFloatValues(0, getMeasuredWidth(), getMeasuredWidth() * 0.8f);
startValueAnimator(valueAnimator);
</DeepExtract>
|
OpenChina
|
positive
|
@Override
public void onClick(DialogInterface dialogInterface, int i) {
boolean b = getActivity().getSharedPreferences("Setting_" + device.getMac(), 0).getBoolean("always_UDP", false);
super.Send(b, device.getSendMqttTopic(), "{\"mac\":\"" + device.getMac() + "\",\"cmd\":\"restart\"}");
}
|
<DeepExtract>
boolean b = getActivity().getSharedPreferences("Setting_" + device.getMac(), 0).getBoolean("always_UDP", false);
super.Send(b, device.getSendMqttTopic(), "{\"mac\":\"" + device.getMac() + "\",\"cmd\":\"restart\"}");
</DeepExtract>
|
SmartControl_Android_MQTT
|
positive
|
public void setInnerRadius(float radius) {
innerRadius = radius;
if (innerRadius > 0 && outerRadius > 0) {
radiusDistance = outerRadius - innerRadius;
}
}
|
<DeepExtract>
if (innerRadius > 0 && outerRadius > 0) {
radiusDistance = outerRadius - innerRadius;
}
</DeepExtract>
|
LibGdx2DGameStarterTemplate
|
positive
|
public void navigator(int totalCount, View container) {
mParent = (LinearLayout) container;
while (totalCount > 0) {
View v = new View(mContext);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(getHeightWidth(false), getHeightWidth(false));
v.setLayoutParams(params);
mParent.addView(v);
totalCount--;
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
focusOnPagerDot(0);
}
}, 500);
}
|
<DeepExtract>
while (totalCount > 0) {
View v = new View(mContext);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(getHeightWidth(false), getHeightWidth(false));
v.setLayoutParams(params);
mParent.addView(v);
totalCount--;
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
focusOnPagerDot(0);
}
}, 500);
</DeepExtract>
|
hr
|
positive
|
@Override
@SneakyThrows
public void destroy() {
if (log.isDebugEnabled()) {
log.debug("清除SpringContextHolderä¸çš„ApplicationContext:" + applicationContext);
}
applicationContext = null;
}
|
<DeepExtract>
if (log.isDebugEnabled()) {
log.debug("清除SpringContextHolderä¸çš„ApplicationContext:" + applicationContext);
}
applicationContext = null;
</DeepExtract>
|
albedo
|
positive
|
public String getValueLabel() {
for (Pair pair : list) {
if (mProperties.getProperty(property) != null && pair.value.equals(mProperties.getProperty(property)))
return pair.label;
}
return null;
}
|
<DeepExtract>
for (Pair pair : list) {
if (mProperties.getProperty(property) != null && pair.value.equals(mProperties.getProperty(property)))
return pair.label;
}
return null;
</DeepExtract>
|
CoolReader
|
positive
|
@Override
public Cursor query(int pageNumber) {
if (pageNumber < 0)
throw new IllegalArgumentException("PageNumber must be over 0");
this.pageNumber = pageNumber;
return query();
}
|
<DeepExtract>
if (pageNumber < 0)
throw new IllegalArgumentException("PageNumber must be over 0");
this.pageNumber = pageNumber;
</DeepExtract>
|
DbQuery
|
positive
|
public String encrypt(String encryptionText) throws Exception {
int len = encrypt(encryptionText.getBytes()).length;
StringBuffer sb = new StringBuffer(len * 2);
for (int i = 0; i < len; i++) {
int intTmp = encrypt(encryptionText.getBytes())[i];
while (intTmp < 0) {
intTmp = intTmp + 256;
}
if (intTmp < 16) {
sb.append("0");
}
sb.append(Integer.toString(intTmp, 16));
}
return sb.toString();
}
|
<DeepExtract>
int len = encrypt(encryptionText.getBytes()).length;
StringBuffer sb = new StringBuffer(len * 2);
for (int i = 0; i < len; i++) {
int intTmp = encrypt(encryptionText.getBytes())[i];
while (intTmp < 0) {
intTmp = intTmp + 256;
}
if (intTmp < 16) {
sb.append("0");
}
sb.append(Integer.toString(intTmp, 16));
}
return sb.toString();
</DeepExtract>
|
NoHttp
|
positive
|
public Criteria andAidIsNotNull() {
if ("aid is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("aid is not null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("aid is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("aid is not null"));
</DeepExtract>
|
webike
|
positive
|
public void stroke(float gray, float alpha) {
if (((gray & 0xff000000) == 0) && (gray <= colorModeX)) {
colorCalc((float) gray, alpha);
} else {
colorCalcARGB(gray, alpha);
}
stroke = true;
strokeR = calcR;
strokeG = calcG;
strokeB = calcB;
strokeA = calcA;
strokeColor = calcColor;
}
|
<DeepExtract>
if (((gray & 0xff000000) == 0) && (gray <= colorModeX)) {
colorCalc((float) gray, alpha);
} else {
colorCalcARGB(gray, alpha);
}
</DeepExtract>
<DeepExtract>
stroke = true;
strokeR = calcR;
strokeG = calcG;
strokeB = calcB;
strokeA = calcA;
strokeColor = calcColor;
</DeepExtract>
|
rainbow
|
positive
|
public void testScaleCMYK() throws Exception {
File cmyk = new File("./src/test/resources/conf.test/simpleimage/cmyk/cmyk_noprofile_1.jpg");
File dest = new File(resultDir, "LANCZOS_cmyk1_java_lanczos_result.jpg");
ScaleParameter scaleParam = new ScaleParameter(512, 512, Algorithm.LANCZOS);
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
cmyk = new File("./src/test/resources/conf.test/simpleimage/cmyk/cmyk_noprofile_2.jpg");
dest = new File(resultDir, "LANCZOS_cmyk2_java_lanczos_result.jpg");
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
cmyk = new File("./src/test/resources/conf.test/simpleimage/cmyk/cmyk_noprofile_3.jpg");
dest = new File(resultDir, "LANCZOS_cmyk3_java_lanczos_result.jpg");
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
cmyk = new File("./src/test/resources/conf.test/simpleimage/cmyk/ycck_embedprofile_1.jpg");
dest = new File(resultDir, "LANCZOS_ycck1_java_lanczos_result.jpg");
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
cmyk = new File("./src/test/resources/conf.test/simpleimage/cmyk/ycck_embedprofile_2.jpg");
dest = new File(resultDir, "LANCZOS_ycck2_java_lanczos_result.jpg");
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
cmyk = new File("./src/test/resources/conf.test/simpleimage/cmyk/ycck_noprofile.jpg");
dest = new File(resultDir, "LANCZOS_ycckn_java_lanczos_result.jpg");
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
}
|
<DeepExtract>
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
</DeepExtract>
<DeepExtract>
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
</DeepExtract>
<DeepExtract>
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
</DeepExtract>
<DeepExtract>
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
</DeepExtract>
<DeepExtract>
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
</DeepExtract>
<DeepExtract>
FileInputStream inStream = null;
FileOutputStream outStream = null;
ImageRender wr = null;
try {
inStream = new FileInputStream(cmyk);
outStream = new FileOutputStream(dest);
ImageRender rr = new ReadRender(inStream, false);
ImageRender sr = new ScaleRender(rr, scaleParam);
wr = new WriteRender(sr, outStream, ImageFormat.JPEG);
wr.render();
} finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
if (wr != null) {
wr.dispose();
}
}
</DeepExtract>
|
simpleimage
|
positive
|
public void onLeft() {
index--;
if (index < 0)
index += staves.size();
}
|
<DeepExtract>
index--;
if (index < 0)
index += staves.size();
</DeepExtract>
|
FEMultiplayer
|
positive
|
public void putLongLE(long value) {
if (_buf.length - _index < 8) {
byte[] temp = new byte[_buf.length * 2 + 8];
System.arraycopy(_buf, 0, temp, 0, _index);
_buf = temp;
}
_buf[_index++] = (byte) (0xFFL & (value >> 0));
_buf[_index++] = (byte) (0xFFL & (value >> 8));
_buf[_index++] = (byte) (0xFFL & (value >> 16));
_buf[_index++] = (byte) (0xFFL & (value >> 24));
_buf[_index++] = (byte) (0xFFL & (value >> 32));
_buf[_index++] = (byte) (0xFFL & (value >> 40));
_buf[_index++] = (byte) (0xFFL & (value >> 48));
_buf[_index++] = (byte) (0xFFL & (value >> 56));
}
|
<DeepExtract>
if (_buf.length - _index < 8) {
byte[] temp = new byte[_buf.length * 2 + 8];
System.arraycopy(_buf, 0, temp, 0, _index);
_buf = temp;
}
</DeepExtract>
|
ETHWallet
|
positive
|
public Model createCatalogMetadata(String title, String description, String identifier, List<String> themeTaxonomies, String fdpUrl, IRI fdp) {
final Model metadata = new LinkedHashModel();
final IRI catalogUri = i(fdpUrl + "/catalog/" + identifier);
setTitle(metadata, catalogUri, l(title));
setDescription(metadata, catalogUri, l(description));
setVersion(metadata, catalogUri, l(1.0f));
setPublisher(metadata, catalogUri, new Agent(i("http://example.com/publisher"), i("http://example.com/publisher/mbox"), i(FOAF.AGENT), l("Publisher")));
if (fdp != null) {
setParent(metadata, catalogUri, fdp);
}
setThemeTaxonomies(metadata, catalogUri, themeTaxonomies.stream().map(ValueFactoryHelper::i).collect(Collectors.toList()));
return metadata;
}
|
<DeepExtract>
setTitle(metadata, catalogUri, l(title));
setDescription(metadata, catalogUri, l(description));
setVersion(metadata, catalogUri, l(1.0f));
setPublisher(metadata, catalogUri, new Agent(i("http://example.com/publisher"), i("http://example.com/publisher/mbox"), i(FOAF.AGENT), l("Publisher")));
if (fdp != null) {
setParent(metadata, catalogUri, fdp);
}
</DeepExtract>
|
FAIRDataPoint
|
positive
|
public void throttle(long currentBytes) {
int newTargetBytesPerMS = fun.targetThroughput();
if (newTargetBytesPerMS < 1) {
return;
}
if (newTargetBytesPerMS != targetBytesPerMS) {
logger.debug("{} target throughput now {} bytes/ms.", this, newTargetBytesPerMS);
}
targetBytesPerMS = newTargetBytesPerMS;
long msSinceLast = System.currentTimeMillis() - timeAtLastDelay;
long excessBytes = currentBytes - bytesAtLastDelay - msSinceLast * targetBytesPerMS;
long timeToDelay = excessBytes / Math.max(1, targetBytesPerMS);
if (timeToDelay > 0) {
if (logger.isTraceEnabled()) {
logger.trace(String.format("%s actual throughput was %d bytes in %d ms: throttling for %d ms", this, currentBytes - bytesAtLastDelay, msSinceLast, timeToDelay));
}
try {
Thread.sleep(timeToDelay);
} catch (InterruptedException e) {
throw new AssertionError(e);
}
}
bytesAtLastDelay += currentBytes - bytesAtLastDelay;
timeAtLastDelay = System.currentTimeMillis();
}
|
<DeepExtract>
int newTargetBytesPerMS = fun.targetThroughput();
if (newTargetBytesPerMS < 1) {
return;
}
if (newTargetBytesPerMS != targetBytesPerMS) {
logger.debug("{} target throughput now {} bytes/ms.", this, newTargetBytesPerMS);
}
targetBytesPerMS = newTargetBytesPerMS;
long msSinceLast = System.currentTimeMillis() - timeAtLastDelay;
long excessBytes = currentBytes - bytesAtLastDelay - msSinceLast * targetBytesPerMS;
long timeToDelay = excessBytes / Math.max(1, targetBytesPerMS);
if (timeToDelay > 0) {
if (logger.isTraceEnabled()) {
logger.trace(String.format("%s actual throughput was %d bytes in %d ms: throttling for %d ms", this, currentBytes - bytesAtLastDelay, msSinceLast, timeToDelay));
}
try {
Thread.sleep(timeToDelay);
} catch (InterruptedException e) {
throw new AssertionError(e);
}
}
bytesAtLastDelay += currentBytes - bytesAtLastDelay;
timeAtLastDelay = System.currentTimeMillis();
</DeepExtract>
|
exhibitor
|
positive
|
public Criteria andSPhoneNotIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "sPhone" + " cannot be null");
}
criteria.add(new Criterion("s_phone not in", values));
return (Criteria) this;
}
|
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "sPhone" + " cannot be null");
}
criteria.add(new Criterion("s_phone not in", values));
</DeepExtract>
|
webike
|
positive
|
public void setCdrLoggingTo(CdrLoggedType cdrLoggingTo) {
this.cdrLoggingTo = cdrLoggingTo;
try {
XMLObjectWriter writer = XMLObjectWriter.newInstance(new FileOutputStream(persistFile.toString()));
writer.setBinding(binding);
writer.setIndentation(TAB_INDENT);
if (networkIdVsUssdGwGt.size() > 0) {
ArrayList<UssdGwGtNetworkIdElement> al = new ArrayList<UssdGwGtNetworkIdElement>();
for (Entry<Integer, String> val : networkIdVsUssdGwGt.entrySet()) {
UssdGwGtNetworkIdElement el = new UssdGwGtNetworkIdElement();
el.networkId = val.getKey();
el.ussdGwGt = val.getValue();
al.add(el);
}
UssdPropertiesManagement_ussdGwGtNetworkId al2 = new UssdPropertiesManagement_ussdGwGtNetworkId(al);
writer.write(al2, USSD_GT_LIST, UssdPropertiesManagement_ussdGwGtNetworkId.class);
}
writer.write(this.noRoutingRuleConfiguredMessage, NO_ROUTING_RULE_CONFIGURED_ERROR_MESSAGE, String.class);
writer.write(this.serverOverloadedMessage, SERVER_OVERLOADED_MESSAGE, String.class);
writer.write(this.serverErrorMessage, SERVER_ERROR_MESSAGE, String.class);
writer.write(this.dialogTimeoutErrorMessage, DIALOG_TIMEOUT_ERROR_MESSAGE, String.class);
writer.write(this.dialogTimeout, DIALOG_TIMEOUT, Long.class);
writer.write(this.hrHlrGt, HR_HLR_GT, String.class);
writer.write(this.cdrLoggingTo.toString(), CDR_LOGGING_TO, String.class);
writer.write(this.cdrSeparator, CDR_SEPARATOR, String.class);
writer.write(this.maxActivityCount, MAX_ACTIVITY_COUNT, Integer.class);
writer.write(this.ussdGwGt, USSD_GT, String.class);
writer.write(this.ussdGwSsn, USSD_SSN, Integer.class);
writer.write(this.hlrSsn, HLR_SSN, Integer.class);
writer.write(this.mscSsn, MSC_SSN, Integer.class);
writer.write(this.maxMapVersion, MAX_MAP_VERSION, Integer.class);
writer.close();
} catch (Exception e) {
logger.error("Error while persisting the Rule state in file", e);
}
}
|
<DeepExtract>
try {
XMLObjectWriter writer = XMLObjectWriter.newInstance(new FileOutputStream(persistFile.toString()));
writer.setBinding(binding);
writer.setIndentation(TAB_INDENT);
if (networkIdVsUssdGwGt.size() > 0) {
ArrayList<UssdGwGtNetworkIdElement> al = new ArrayList<UssdGwGtNetworkIdElement>();
for (Entry<Integer, String> val : networkIdVsUssdGwGt.entrySet()) {
UssdGwGtNetworkIdElement el = new UssdGwGtNetworkIdElement();
el.networkId = val.getKey();
el.ussdGwGt = val.getValue();
al.add(el);
}
UssdPropertiesManagement_ussdGwGtNetworkId al2 = new UssdPropertiesManagement_ussdGwGtNetworkId(al);
writer.write(al2, USSD_GT_LIST, UssdPropertiesManagement_ussdGwGtNetworkId.class);
}
writer.write(this.noRoutingRuleConfiguredMessage, NO_ROUTING_RULE_CONFIGURED_ERROR_MESSAGE, String.class);
writer.write(this.serverOverloadedMessage, SERVER_OVERLOADED_MESSAGE, String.class);
writer.write(this.serverErrorMessage, SERVER_ERROR_MESSAGE, String.class);
writer.write(this.dialogTimeoutErrorMessage, DIALOG_TIMEOUT_ERROR_MESSAGE, String.class);
writer.write(this.dialogTimeout, DIALOG_TIMEOUT, Long.class);
writer.write(this.hrHlrGt, HR_HLR_GT, String.class);
writer.write(this.cdrLoggingTo.toString(), CDR_LOGGING_TO, String.class);
writer.write(this.cdrSeparator, CDR_SEPARATOR, String.class);
writer.write(this.maxActivityCount, MAX_ACTIVITY_COUNT, Integer.class);
writer.write(this.ussdGwGt, USSD_GT, String.class);
writer.write(this.ussdGwSsn, USSD_SSN, Integer.class);
writer.write(this.hlrSsn, HLR_SSN, Integer.class);
writer.write(this.mscSsn, MSC_SSN, Integer.class);
writer.write(this.maxMapVersion, MAX_MAP_VERSION, Integer.class);
writer.close();
} catch (Exception e) {
logger.error("Error while persisting the Rule state in file", e);
}
</DeepExtract>
|
ussdgateway
|
positive
|
@Override
public void onClick(DialogInterface dialogInterface, int i) {
result.insert(time, 2, currentScramble.getScramble(), multiPhase > 0, bluetoothTools.getCube());
btnSessionMean.setText(getString(R.string.session_mean, result.getSessionMean()));
result.calcAvg();
if (multiPhase > 0)
result.calcMpMean();
if (sortType != 0)
result.sortResult();
resAdapter.reload();
if (sortType == 0)
lvResult.setSelection(resAdapter.getCount() - 1);
if (result.isSessionBest()) {
Snackbar.make(frame, getString(R.string.new_session_best) + result.getBestTime(), Snackbar.LENGTH_SHORT).show();
} else if (result.isAvgBest(0)) {
Snackbar.make(frame, getString(R.string.new_average_best) + result.getBestAvg1(), Snackbar.LENGTH_SHORT).show();
} else if (result.isAvgBest(1)) {
Snackbar.make(frame, getString(R.string.new_average_best) + result.getBestAvg2(), Snackbar.LENGTH_SHORT).show();
}
sessionManager.setPuzzle(sessionIdx, scrambleIdx);
newScramble();
setStatsLabel();
}
|
<DeepExtract>
result.insert(time, 2, currentScramble.getScramble(), multiPhase > 0, bluetoothTools.getCube());
btnSessionMean.setText(getString(R.string.session_mean, result.getSessionMean()));
result.calcAvg();
if (multiPhase > 0)
result.calcMpMean();
if (sortType != 0)
result.sortResult();
resAdapter.reload();
if (sortType == 0)
lvResult.setSelection(resAdapter.getCount() - 1);
if (result.isSessionBest()) {
Snackbar.make(frame, getString(R.string.new_session_best) + result.getBestTime(), Snackbar.LENGTH_SHORT).show();
} else if (result.isAvgBest(0)) {
Snackbar.make(frame, getString(R.string.new_average_best) + result.getBestAvg1(), Snackbar.LENGTH_SHORT).show();
} else if (result.isAvgBest(1)) {
Snackbar.make(frame, getString(R.string.new_average_best) + result.getBestAvg2(), Snackbar.LENGTH_SHORT).show();
}
sessionManager.setPuzzle(sessionIdx, scrambleIdx);
newScramble();
setStatsLabel();
</DeepExtract>
|
DCTimer-Android
|
positive
|
@ProcessElement
public void process(@Element KV<TSKey, TSAccum> input, OutputReceiver<KV<TSKey, TSAccum>> o) {
AccumRSIBuilder rsiBuilder = new AccumRSIBuilder(input.getValue());
Long count = (long) rsiBuilder.getMovementCount().getIntVal();
Double upSum = rsiBuilder.getSumUp().getDoubleVal();
Double downSum = rsiBuilder.getSumDown().getDoubleVal();
Double ag = (upSum == 0) ? 0D : upSum / count;
Double al = (downSum == 0) ? 0D : Math.abs(downSum / count);
setValue(FsiTechnicalIndicators.ABS_MOVING_AVERAGE_LOSS.name(), CommonUtils.createNumData(al));
return this;
if (ag == 0 && al == 0) {
o.output(KV.of(input.getKey(), rsiBuilder.setRelativeStrength(CommonUtils.createNumData(0d)).setRelativeStrengthIndicator(CommonUtils.createNumData(0d)).build()));
return;
}
if (ag == 0) {
o.output(KV.of(input.getKey(), rsiBuilder.setRelativeStrength(CommonUtils.createNumData(100d)).setRelativeStrengthIndicator(CommonUtils.createNumData(0d)).build()));
return;
}
if (al == 0) {
o.output(KV.of(input.getKey(), rsiBuilder.setRelativeStrength(CommonUtils.createNumData(0d)).setRelativeStrengthIndicator(CommonUtils.createNumData(100d)).build()));
return;
}
Double rs = ag / al;
Double rsi = 100 - (100 / (1 + rs));
o.output(KV.of(input.getKey(), rsiBuilder.setRelativeStrength(CommonUtils.createNumData(rs)).setRelativeStrengthIndicator(CommonUtils.createNumData(rsi)).build()));
}
|
<DeepExtract>
setValue(FsiTechnicalIndicators.ABS_MOVING_AVERAGE_LOSS.name(), CommonUtils.createNumData(al));
return this;
</DeepExtract>
|
dataflow-sample-applications
|
positive
|
public Criteria andIdIsNull() {
if ("ID is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("ID is null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("ID is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("ID is null"));
</DeepExtract>
|
console
|
positive
|
public static String slurpFile(File file) throws IOException {
Reader r = new FileReader(file);
BufferedReader r = new BufferedReader(r);
StringBuffer buff = new StringBuffer();
try {
char[] chars = new char[SLURPBUFFSIZE];
while (true) {
int amountRead = r.read(chars, 0, SLURPBUFFSIZE);
if (amountRead < 0) {
break;
}
buff.append(chars, 0, amountRead);
}
r.close();
} catch (Exception e) {
throw new RuntimeException();
}
return buff.toString();
}
|
<DeepExtract>
BufferedReader r = new BufferedReader(r);
StringBuffer buff = new StringBuffer();
try {
char[] chars = new char[SLURPBUFFSIZE];
while (true) {
int amountRead = r.read(chars, 0, SLURPBUFFSIZE);
if (amountRead < 0) {
break;
}
buff.append(chars, 0, amountRead);
}
r.close();
} catch (Exception e) {
throw new RuntimeException();
}
return buff.toString();
</DeepExtract>
|
Canova
|
positive
|
public List<SamplePhoto> findByCondition(SamplePhoto samplePhoto) {
StringBuffer buffer = new StringBuffer("select n.id,n.title,n.content,n.userId,n.typeId," + " u.userName author,t.typeName,n.publishTime,n.pass" + " from samplePhoto n,userdetail u,photoType t" + " where n.userId=u.id and n.typeId=t.id ");
List<Object> params = new ArrayList<Object>();
if (samplePhoto != null) {
if (samplePhoto.getTitle() != null && !"".equals(samplePhoto.getTitle())) {
buffer.append(" and title like ?");
params.add("%" + samplePhoto.getTitle() + "%");
}
if (samplePhoto.getContent() != null && !"".equals(samplePhoto.getContent())) {
buffer.append(" and content like ?");
params.add("%" + samplePhoto.getContent() + "%");
}
if (samplePhoto.getTypeId() != -1) {
buffer.append(" and typeId= ?");
params.add(samplePhoto.getTypeId());
}
}
List<SamplePhoto> list = new ArrayList<SamplePhoto>();
ResultSet rs = dbUtil.executeQuery(new String(buffer), params.toArray());
try {
while (rs.next()) {
SamplePhoto samplePhoto = new SamplePhoto(rs.getInt("id"), rs.getString("title"), rs.getString("content"), rs.getInt("userId"), rs.getString("author"), rs.getInt("typeId"), rs.getString("typeName"), rs.getDate("publishTime"), rs.getInt("pass"));
list.add(samplePhoto);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
dbUtil.closeAll();
}
return list;
}
|
<DeepExtract>
List<SamplePhoto> list = new ArrayList<SamplePhoto>();
ResultSet rs = dbUtil.executeQuery(new String(buffer), params.toArray());
try {
while (rs.next()) {
SamplePhoto samplePhoto = new SamplePhoto(rs.getInt("id"), rs.getString("title"), rs.getString("content"), rs.getInt("userId"), rs.getString("author"), rs.getInt("typeId"), rs.getString("typeName"), rs.getDate("publishTime"), rs.getInt("pass"));
list.add(samplePhoto);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
dbUtil.closeAll();
}
return list;
</DeepExtract>
|
cailiao
|
positive
|
public void endBootstrap() {
this.booted = true;
bootstrapFinished = System.currentTimeMillis();
}
|
<DeepExtract>
this.booted = true;
</DeepExtract>
|
hoya
|
positive
|
public static SearchResultContainer search(String query, boolean getFilters, List<String> appliedFilters, int pageNum, int pageSize) throws API.APIException {
if (pageNum == 0)
refSet = new HashSet<>();
final Pattern r = Pattern.compile("(\\S)\"(\\S)");
String yo = r.matcher(query).replaceAll("$1\u05f4$2");
Log.d("QUERY", yo + " -> " + query);
return yo;
String coreQuery = "\"query_string\": {" + "\"query\": \"" + query + "\"," + "\"default_operator\": \"AND\"," + "\"fields\": [\"content\"]" + "}";
String jsonString = "{" + "\"from\": " + (pageNum * pageSize) + "," + "\"size\": " + pageSize + "," + "\"sort\": [{" + "\"order\": {}" + "}]," + "\"highlight\": {" + "\"pre_tags\": [\"" + SearchingDB.BIG_BOLD_START + "\"]," + "\"post_tags\": [\"" + SearchingDB.BIG_BOLD_END + "\"]," + "\"fields\": {" + "\"content\": {\"fragment_size\": 200}" + "}" + "}";
if (getFilters) {
jsonString += ",\"query\":{" + coreQuery + "}" + ",\"aggs\":{ \"category\":{\"terms\": { \"field\":\"path\",\"size\":0}}}";
} else if (appliedFilters == null || appliedFilters.size() == 0) {
jsonString += ",\"query\":{" + coreQuery + "}";
} else {
String clauses = "[";
for (int i = 0; i < appliedFilters.size(); i++) {
String filterSuffix = appliedFilters.get(i).contains("/") ? ".*" : "/.*";
String filterString = Util.regexpEscape(appliedFilters.get(i));
clauses += "{\"regexp\":{" + "\"path\":\"" + filterString + filterSuffix + "\"}}";
if (i != appliedFilters.size() - 1)
clauses += ",";
}
clauses += "]";
jsonString += ",\"query\":{" + "\"filtered\":{" + "\"query\":{" + coreQuery + "}," + "\"filter\":{" + "\"or\":" + clauses + "}}}";
}
jsonString += "}";
String result = API.getDataFromURL(SEARCH_URL, jsonString, true, API.TimeoutType.REG);
SearchResultContainer searchResultContainer = null;
JSONArray allFilters = new JSONArray();
List<Segment> results = new ArrayList<>();
int numResults = 0;
JSONObject resultJson;
try {
resultJson = new JSONObject(result);
} catch (JSONException e) {
e.printStackTrace();
return searchResultContainer;
}
if (getFilters) {
try {
allFilters = resultJson.getJSONObject("aggregations").getJSONObject("category").getJSONArray("buckets");
} catch (JSONException e) {
e.printStackTrace();
return searchResultContainer;
}
}
try {
numResults = resultJson.getJSONObject("hits").getInt("total");
JSONArray hits = resultJson.getJSONObject("hits").getJSONArray("hits");
for (int i = 0; i < hits.length(); i++) {
JSONObject source = hits.getJSONObject(i).getJSONObject("_source");
String id = hits.getJSONObject(i).getString("_id");
String ref = source.getString("ref");
if (refSet.contains(ref)) {
continue;
} else {
refSet.add(ref);
}
String content = hits.getJSONObject(i).getJSONObject("highlight").getJSONArray("content").getString(0);
String path = source.getString("path");
String title = path.substring(path.lastIndexOf("/") + 1);
String heText = "";
String enText = "";
if (id.contains("[he]")) {
heText = content;
} else {
enText = content;
}
int tempBid;
try {
tempBid = Book.getBid(title);
} catch (Book.BookNotFoundException e) {
tempBid = -1;
}
Log.d("title", title + " BID = " + tempBid);
Segment segment = new Segment(enText, heText, tempBid, ref);
results.add(segment);
}
} catch (JSONException e) {
e.printStackTrace();
}
return new SearchResultContainer(results, numResults, allFilters);
}
|
<DeepExtract>
final Pattern r = Pattern.compile("(\\S)\"(\\S)");
String yo = r.matcher(query).replaceAll("$1\u05f4$2");
Log.d("QUERY", yo + " -> " + query);
return yo;
</DeepExtract>
<DeepExtract>
SearchResultContainer searchResultContainer = null;
JSONArray allFilters = new JSONArray();
List<Segment> results = new ArrayList<>();
int numResults = 0;
JSONObject resultJson;
try {
resultJson = new JSONObject(result);
} catch (JSONException e) {
e.printStackTrace();
return searchResultContainer;
}
if (getFilters) {
try {
allFilters = resultJson.getJSONObject("aggregations").getJSONObject("category").getJSONArray("buckets");
} catch (JSONException e) {
e.printStackTrace();
return searchResultContainer;
}
}
try {
numResults = resultJson.getJSONObject("hits").getInt("total");
JSONArray hits = resultJson.getJSONObject("hits").getJSONArray("hits");
for (int i = 0; i < hits.length(); i++) {
JSONObject source = hits.getJSONObject(i).getJSONObject("_source");
String id = hits.getJSONObject(i).getString("_id");
String ref = source.getString("ref");
if (refSet.contains(ref)) {
continue;
} else {
refSet.add(ref);
}
String content = hits.getJSONObject(i).getJSONObject("highlight").getJSONArray("content").getString(0);
String path = source.getString("path");
String title = path.substring(path.lastIndexOf("/") + 1);
String heText = "";
String enText = "";
if (id.contains("[he]")) {
heText = content;
} else {
enText = content;
}
int tempBid;
try {
tempBid = Book.getBid(title);
} catch (Book.BookNotFoundException e) {
tempBid = -1;
}
Log.d("title", title + " BID = " + tempBid);
Segment segment = new Segment(enText, heText, tempBid, ref);
results.add(segment);
}
} catch (JSONException e) {
e.printStackTrace();
}
return new SearchResultContainer(results, numResults, allFilters);
</DeepExtract>
|
Sefaria-Android
|
positive
|
@Override
public void processElement2(ValenciaItem pollution, CoProcessFunction<ValenciaItem, ValenciaItem, Tuple2<ValenciaItem, ValenciaItem>>.Context context, Collector<Tuple2<ValenciaItem, ValenciaItem>> out) throws Exception {
pollutionMap.put(pollution.getTimestamp(), pollution);
Iterator<Map.Entry<Long, ValenciaItem>> pollutionEntries = pollutionMap.iterator();
ValenciaItem theOneWeAreLookingFor = null;
List<Long> toRemove = new ArrayList<Long>();
while (pollutionEntries.hasNext()) {
ValenciaItem pollutionItem = pollutionEntries.next().getValue();
if (pollutionItem.getTimestamp() <= context.timerService().currentWatermark()) {
if (theOneWeAreLookingFor != null) {
if (pollutionItem.getTimestamp() > theOneWeAreLookingFor.getTimestamp()) {
toRemove.add(theOneWeAreLookingFor.getTimestamp());
theOneWeAreLookingFor = pollutionItem;
}
} else {
theOneWeAreLookingFor = pollutionItem;
}
}
}
for (Long t : toRemove) {
System.out.println("Removing pollution @ " + t);
pollutionMap.remove(t);
}
return theOneWeAreLookingFor;
}
|
<DeepExtract>
Iterator<Map.Entry<Long, ValenciaItem>> pollutionEntries = pollutionMap.iterator();
ValenciaItem theOneWeAreLookingFor = null;
List<Long> toRemove = new ArrayList<Long>();
while (pollutionEntries.hasNext()) {
ValenciaItem pollutionItem = pollutionEntries.next().getValue();
if (pollutionItem.getTimestamp() <= context.timerService().currentWatermark()) {
if (theOneWeAreLookingFor != null) {
if (pollutionItem.getTimestamp() > theOneWeAreLookingFor.getTimestamp()) {
toRemove.add(theOneWeAreLookingFor.getTimestamp());
theOneWeAreLookingFor = pollutionItem;
}
} else {
theOneWeAreLookingFor = pollutionItem;
}
}
}
for (Long t : toRemove) {
System.out.println("Removing pollution @ " + t);
pollutionMap.remove(t);
}
return theOneWeAreLookingFor;
</DeepExtract>
|
explore-flink
|
positive
|
public Criteria andAllpriceNotBetween(Double value1, Double value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "allprice" + " cannot be null");
}
criteria.add(new Criterion("allPrice not between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "allprice" + " cannot be null");
}
criteria.add(new Criterion("allPrice not between", value1, value2));
</DeepExtract>
|
garbage-collection
|
positive
|
public static NestedInvalidationListener addNestedPropertyListenerToList(ObservableList<? extends Observable> property, FilteredInvalidationListener listener) {
NestedInvalidationListener nestedListener = new NestedInvalidationListener(listener);
property.addListener(genericListChangeListener);
for (Observable observable : property) {
addNestedListener(observable);
}
return nestedListener;
}
|
<DeepExtract>
property.addListener(genericListChangeListener);
for (Observable observable : property) {
addNestedListener(observable);
}
</DeepExtract>
|
DrawingBotV3
|
positive
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
sortByAlphaButtonActionPerformed(evt);
}
|
<DeepExtract>
sortByAlphaButtonActionPerformed(evt);
</DeepExtract>
|
vizlinc
|
positive
|
public boolean eglWaitNative(int engine, Object bindTarget) {
log("eglWaitNative" + '(');
mArgCount = 0;
if (mArgCount++ > 0) {
log(", ");
}
if (mLogArgumentNames) {
log("engine" + "=");
}
log(engine);
if (mArgCount++ > 0) {
log(", ");
}
if (mLogArgumentNames) {
log("bindTarget" + "=");
}
log(bindTarget);
log(");\n");
flush();
boolean result = mEgl10.eglWaitNative(engine, bindTarget);
log(" returns " + result + ";\n");
flush();
int eglError;
if ((eglError = mEgl10.eglGetError()) != EGL_SUCCESS) {
String errorMessage = "eglError: " + getErrorString(eglError);
logLine(errorMessage);
if (mCheckError) {
throw new GLException(eglError, errorMessage);
}
}
return result;
}
|
<DeepExtract>
log("eglWaitNative" + '(');
mArgCount = 0;
</DeepExtract>
<DeepExtract>
if (mArgCount++ > 0) {
log(", ");
}
if (mLogArgumentNames) {
log("engine" + "=");
}
log(engine);
</DeepExtract>
<DeepExtract>
if (mArgCount++ > 0) {
log(", ");
}
if (mLogArgumentNames) {
log("bindTarget" + "=");
}
log(bindTarget);
</DeepExtract>
<DeepExtract>
log(");\n");
flush();
</DeepExtract>
<DeepExtract>
log(" returns " + result + ";\n");
flush();
</DeepExtract>
<DeepExtract>
int eglError;
if ((eglError = mEgl10.eglGetError()) != EGL_SUCCESS) {
String errorMessage = "eglError: " + getErrorString(eglError);
logLine(errorMessage);
if (mCheckError) {
throw new GLException(eglError, errorMessage);
}
}
</DeepExtract>
|
android-openGL-canvas
|
positive
|
public DIDLObject replaceFirstProperty(Property property) {
if (property == null)
return this;
Iterator<Property> it = getProperties().iterator();
while (it.hasNext()) {
Property p = it.next();
if (p.getClass().isAssignableFrom(property.getClass()))
it.remove();
}
if (property == null)
return this;
getProperties().add(property);
return this;
return this;
}
|
<DeepExtract>
if (property == null)
return this;
getProperties().add(property);
return this;
</DeepExtract>
|
DLNAPush
|
positive
|
public OffsetDate toOffsetDate() {
return new OffsetDateTime(this.dateTime.getDate(), this.offset);
}
|
<DeepExtract>
return new OffsetDateTime(this.dateTime.getDate(), this.offset);
</DeepExtract>
|
gwt-time
|
positive
|
@Override
@Retry(maxRetries = 4)
public Connection service() throws IOException {
nbCalls++;
throw new IOException("cannot access delegate service");
}
|
<DeepExtract>
throw new IOException("cannot access delegate service");
</DeepExtract>
|
microprofile-fault-tolerance
|
positive
|
public JFreeChart createStackedBarChart3D(final ChartData chartData, final boolean vertical) {
PlotOrientation orientation = PlotOrientation.VERTICAL;
if (!vertical) {
orientation = PlotOrientation.HORIZONTAL;
}
final JFreeChart chart = ChartFactory.createStackedBarChart3D(chartData.getTitle(), chartData.getCatAx().getTitle(), chartData.getValAx().getTitle(), createDataset(chartData), orientation, true, false, false);
setupStyle(chart, chartData);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setBarPainter(new StandardBarPainter());
renderer.setItemMargin(TieConstants.DEFAULT_BAR_STYLE_ITEM_MARGIN);
plot.setForegroundAlpha(TieConstants.DEFAULT_BARSTYLE_FOREGROUND_ALPHA);
return chart;
}
|
<DeepExtract>
setupStyle(chart, chartData);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setBarPainter(new StandardBarPainter());
renderer.setItemMargin(TieConstants.DEFAULT_BAR_STYLE_ITEM_MARGIN);
plot.setForegroundAlpha(TieConstants.DEFAULT_BARSTYLE_FOREGROUND_ALPHA);
</DeepExtract>
|
TieFaces
|
positive
|
private void init() {
scrollListener = this;
super.setLongClickable(true);
this.mTouchState = TOUCH_STATE_NONE;
DISTANCE_X = UEMethod.dp2px(getContext(), DISTANCE_X);
DISTANCE_Y = UEMethod.dp2px(getContext(), DISTANCE_Y);
scroller = new Scroller(getContext(), new DecelerateInterpolator());
headerView = new HeaderView(getContext());
headerViewContent = headerView.mContent;
if (headerView != null) {
super.removeHeaderView(headerView);
}
super.addHeaderView(headerView);
footerView = new FooterView(getContext());
headerView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@SuppressWarnings("deprecation")
@Override
public void onGlobalLayout() {
headerViewHeight = headerViewContent.getHeight();
getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
});
this.onItemClickListener = new UIListViewOnItemClickListener();
this.onItemLongClickListener = new UIListViewOnItemLongClickListener();
}
|
<DeepExtract>
scrollListener = this;
</DeepExtract>
<DeepExtract>
if (headerView != null) {
super.removeHeaderView(headerView);
}
super.addHeaderView(headerView);
</DeepExtract>
<DeepExtract>
this.onItemClickListener = new UIListViewOnItemClickListener();
</DeepExtract>
<DeepExtract>
this.onItemLongClickListener = new UIListViewOnItemLongClickListener();
</DeepExtract>
|
Auie
|
positive
|
@Bulkhead(2)
public void waitFor(Future<?> future) {
try {
tracker.executionStarted();
future.get(1, TimeUnit.MINUTES);
} catch (InterruptedException e) {
throw new RuntimeException("Test was interrupted", e);
} catch (ExecutionException e) {
throw new RuntimeException("Passed Future threw an exception", e);
} catch (TimeoutException e) {
throw new RuntimeException("Timed out waiting for passed future to complete", e);
} finally {
tracker.executionEnded();
}
}
|
<DeepExtract>
try {
tracker.executionStarted();
future.get(1, TimeUnit.MINUTES);
} catch (InterruptedException e) {
throw new RuntimeException("Test was interrupted", e);
} catch (ExecutionException e) {
throw new RuntimeException("Passed Future threw an exception", e);
} catch (TimeoutException e) {
throw new RuntimeException("Timed out waiting for passed future to complete", e);
} finally {
tracker.executionEnded();
}
</DeepExtract>
|
microprofile-fault-tolerance
|
positive
|
public Criteria andOrderIdNotIn(List<Integer> values) {
if (values == null) {
throw new RuntimeException("Value for " + "orderId" + " cannot be null");
}
criteria.add(new Criterion("order_id not in", values));
return (Criteria) this;
}
|
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "orderId" + " cannot be null");
}
criteria.add(new Criterion("order_id not in", values));
</DeepExtract>
|
springcloud-e-book
|
positive
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (unisexAnimalSexRadio.isSelected()) {
Globals.animalGender = AnimalGender.UNISEX;
} else if (maleAnimalSexRadio.isSelected()) {
Globals.animalGender = AnimalGender.MALE;
} else if (femaleAnimalSexRadio.isSelected()) {
Globals.animalGender = AnimalGender.FEMALE;
}
}
|
<DeepExtract>
if (unisexAnimalSexRadio.isSelected()) {
Globals.animalGender = AnimalGender.UNISEX;
} else if (maleAnimalSexRadio.isSelected()) {
Globals.animalGender = AnimalGender.MALE;
} else if (femaleAnimalSexRadio.isSelected()) {
Globals.animalGender = AnimalGender.FEMALE;
}
</DeepExtract>
|
DeedPlanner-2
|
positive
|
public Criteria andUrlBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "url" + " cannot be null");
}
criteria.add(new Criterion("url between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "url" + " cannot be null");
}
criteria.add(new Criterion("url between", value1, value2));
</DeepExtract>
|
music
|
positive
|
public boolean editLoginSet(String name, String serverUrl, String school, String username, String password, boolean checked, String oldName, String oldServerUrl, String oldSchool) {
String parsedServerUrl = urlParser.parseUrl(serverUrl);
if (has(name)) {
if (name.equals(oldName)) {
loginSetHandler.editLoginSet(name, parsedServerUrl, school, username, password, checked, oldName, oldServerUrl, oldSchool);
for (LoginSet loginSet : loginSets) {
if (loginSet.getName().equals(name)) {
loginSets.remove(loginSet);
loginSets.add(new LoginSet(name, parsedServerUrl, school, username, password, checked));
return true;
}
}
} else {
return false;
}
}
loginSets.remove(getLoginSet(oldName));
loginSetHandler.removeLoginSet(getLoginSet(oldName));
return addLoginSet(new LoginSet(name, parsedServerUrl, school, username, password, checked));
}
|
<DeepExtract>
loginSets.remove(getLoginSet(oldName));
loginSetHandler.removeLoginSet(getLoginSet(oldName));
</DeepExtract>
<DeepExtract>
return addLoginSet(new LoginSet(name, parsedServerUrl, school, username, password, checked));
</DeepExtract>
|
SchoolPlanner4Untis
|
positive
|
public Builder mergeFrom(Ack other) {
if (other == Ack.getDefaultInstance())
return this;
if (other.getSerial() != 0L) {
setSerial(other.getSerial());
}
if (!other.getAckMsgId().isEmpty()) {
ackMsgId_ = other.ackMsgId_;
onChanged();
}
if (other.getAckType() != 0) {
setAckType(other.getAckType());
}
if (other.getResult() != 0) {
setResult(other.getResult());
}
if (!other.getFromId().isEmpty()) {
fromId_ = other.fromId_;
onChanged();
}
if (!other.getToId().isEmpty()) {
toId_ = other.toId_;
onChanged();
}
return super.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
|
<DeepExtract>
return super.mergeUnknownFields(other.unknownFields);
</DeepExtract>
|
NettyIM
|
positive
|
@Override
CMALocale method() {
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
assertNotNull(locale, "locale");
final CMASystem sys = locale.getSystem();
locale.setSystem(null);
try {
return service.create(spaceId, environmentId, locale).blockingFirst();
} finally {
locale.setSystem(sys);
}
}
|
<DeepExtract>
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
assertNotNull(locale, "locale");
final CMASystem sys = locale.getSystem();
locale.setSystem(null);
try {
return service.create(spaceId, environmentId, locale).blockingFirst();
} finally {
locale.setSystem(sys);
}
</DeepExtract>
|
contentful-management.java
|
positive
|
public Criteria andStatusNotIn(List<Integer> values) {
if (values == null) {
throw new RuntimeException("Value for " + "status" + " cannot be null");
}
criteria.add(new Criterion("STATUS not in", values));
return (Criteria) this;
}
|
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "status" + " cannot be null");
}
criteria.add(new Criterion("STATUS not in", values));
</DeepExtract>
|
console
|
positive
|
@Test
public void serverCanCancelClientStreamImplicitly() throws InterruptedException {
TestService svc = new TestService();
serverRule.getServiceRegistry().addService(svc);
Rx3NumbersGrpc.RxNumbersStub stub = Rx3NumbersGrpc.newRxStub(serverRule.getChannel());
this.explicitCancel.set(false);
AtomicBoolean requestWasCanceled = new AtomicBoolean(false);
AtomicBoolean requestDidProduce = new AtomicBoolean(false);
Flowable<NumberProto.Number> request = Flowable.fromIterable(IntStream.range(0, NUMBER_OF_STREAM_ELEMENTS)::iterator).delay(10, TimeUnit.MILLISECONDS).map(CancellationPropagationIntegrationTest::protoNum).doOnNext(x -> {
requestDidProduce.set(true);
System.out.println("Produced: " + x.getNumber(0));
}).doOnCancel(() -> {
requestWasCanceled.set(true);
System.out.println("Client canceled");
});
TestObserver<Number> observer = request.to(stub::requestPressure).doOnSuccess(number -> System.out.println(number.getNumber(0))).doOnError(throwable -> System.out.println(throwable.getMessage())).test();
observer.await(3, TimeUnit.SECONDS);
observer.assertComplete();
await().atMost(Duration.FIVE_HUNDRED_MILLISECONDS).untilTrue(requestWasCanceled);
assertThat(requestWasCanceled.get()).isTrue();
assertThat(requestDidProduce.get()).isTrue();
errorRule.verifyNoError();
}
|
<DeepExtract>
this.explicitCancel.set(false);
</DeepExtract>
|
reactive-grpc
|
positive
|
public Fenix andGreaterThanEqual(String field, Object value) {
if (true) {
this.source.setPrefix(SymbolConst.AND).setSymbol(SymbolConst.GTE);
new JavaSqlInfoBuilder(this.source).buildNormalSql(field, StringHelper.isBlank(null) ? StringHelper.fixDot(field) : null, value);
this.source.reset();
}
return this;
}
|
<DeepExtract>
if (true) {
this.source.setPrefix(SymbolConst.AND).setSymbol(SymbolConst.GTE);
new JavaSqlInfoBuilder(this.source).buildNormalSql(field, StringHelper.isBlank(null) ? StringHelper.fixDot(field) : null, value);
this.source.reset();
}
return this;
</DeepExtract>
|
fenix
|
positive
|
@Override
public String getMimeType() {
String mimeType;
Object value = getMetadata(DamConstants.DC_FORMAT);
if (value == null) {
mimeType = "";
} else {
mimeType = value.toString();
}
if (StringUtils.isBlank(mimeType)) {
Rendition original = getOriginal();
if (original != null) {
mimeType = original.getMimeType();
}
}
return mimeType;
}
|
<DeepExtract>
String mimeType;
Object value = getMetadata(DamConstants.DC_FORMAT);
if (value == null) {
mimeType = "";
} else {
mimeType = value.toString();
}
</DeepExtract>
|
wcm-io-testing
|
positive
|
private void hideFragment() {
mRadioGroup.check(View.NO_ID);
}
|
<DeepExtract>
mRadioGroup.check(View.NO_ID);
</DeepExtract>
|
MagicCamera
|
positive
|
public void setDrawing(Drawing newDrawing) {
if (this.drawing != null) {
drawing.removeDrawingListener(this);
}
drawing = newDrawing;
drawing.addDrawingListener(this);
updated = false;
}
|
<DeepExtract>
updated = false;
</DeepExtract>
|
Stacks-Flashcards
|
positive
|
@Override
public void execute() {
triggerAboutToPerformOperation();
try {
visibleGraph.readLock();
pageRank.setProgressTicket(this.getProgressTicket());
pageRank.setDirected(false);
pageRank.execute(graphModel, attributeModel);
if (cancelled) {
return;
}
RankingController rankingController = Lookup.getDefault().lookup(RankingController.class);
rankingController.setUseLocalScale(true);
rankingController.setInterpolator(new Interpolator.BezierInterpolator(1.0f, 0.0f, 0.0f, 1.0f));
Ranking pageRankRanking = rankingController.getModel().getRanking(Ranking.NODE_ELEMENT, PageRank.PAGERANK);
if (showBySize) {
AbstractSizeTransformer sizeTransformer = (AbstractSizeTransformer) rankingController.getModel().getTransformer(Ranking.NODE_ELEMENT, Transformer.RENDERABLE_SIZE);
sizeTransformer.setMinSize(4.0f);
sizeTransformer.setMaxSize(20.0f);
rankingController.transform(pageRankRanking, sizeTransformer);
graphToolsWin.setGraphNodeSizeInfo(NODE_INFO_PAGERANK);
}
if (showByColor) {
AbstractColorTransformer colorTransformer = (AbstractColorTransformer) rankingController.getModel().getTransformer(Ranking.NODE_ELEMENT, Transformer.RENDERABLE_COLOR);
colorTransformer.setColors(new Color[] { new Color(0xFEF0D9), new Color(0xB30000) });
rankingController.transform(pageRankRanking, colorTransformer);
graphToolsWin.setGraphNodeColorInfo(NODE_INFO_PAGERANK);
}
visibleGraph.readUnlockAll();
} finally {
stopComputation();
}
}
|
<DeepExtract>
triggerAboutToPerformOperation();
</DeepExtract>
|
vizlinc
|
positive
|
public void testEmailWithSpaces() throws ValidatorException {
final ValueBean info = new ValueBean();
info.setValue("joeblow @apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("joeblow@ apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue(" [email protected]");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("[email protected] ");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("joe [email protected] ");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("joeblow@apa che.org ");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe blow\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
}
|
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
|
commons-validator
|
positive
|
public Criteria andCommentCountIsNotNull() {
if ("comment_count is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("comment_count is not null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("comment_count is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("comment_count is not null"));
</DeepExtract>
|
emotional_analysis
|
positive
|
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields;
switch(fieldId) {
case 1:
fields = KEY;
default:
fields = null;
}
if (fields == null)
throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
|
<DeepExtract>
_Fields fields;
switch(fieldId) {
case 1:
fields = KEY;
default:
fields = null;
}
</DeepExtract>
|
bolton-sigmod2013-code
|
positive
|
public List<TimedChunk> parse(String text, long documentId, Language l) throws ParsingException {
LinkedList<TimedChunk> result = new LinkedList<TimedChunk>();
int chunkId = 0;
for (UnprocessedChunk chunk : unprocessedParser.parseUnprocessed(text)) {
result.addAll(processChunk(chunk, chunkId, documentId, l));
chunkId++;
}
return result;
}
|
<DeepExtract>
LinkedList<TimedChunk> result = new LinkedList<TimedChunk>();
int chunkId = 0;
for (UnprocessedChunk chunk : unprocessedParser.parseUnprocessed(text)) {
result.addAll(processChunk(chunk, chunkId, documentId, l));
chunkId++;
}
return result;
</DeepExtract>
|
FilmTit
|
positive
|
public void removeCommit(Commit commit) {
commits.remove(commit);
this.repository = null;
}
|
<DeepExtract>
this.repository = null;
</DeepExtract>
|
hibernate-master-class
|
positive
|
private static XColor getXColorFromRgbClr(final CTSRgbColor ctrColor) {
XSSFColor bcolor = null;
try {
byte[] rgb = ctrColor.getVal();
bcolor = new XSSFColor(rgb);
} catch (Exception ex) {
LOG.log(Level.SEVERE, "Cannot get rgb color error = " + ex.getLocalizedMessage(), ex);
return null;
}
int lumOff = 0;
int lumMod = 0;
int alphaStr = 0;
try {
lumOff = ctrColor.getLumOffArray(0).getVal();
} catch (Exception ex) {
LOG.log(Level.FINE, "No lumOff entry", ex);
}
try {
lumMod = ctrColor.getLumModArray(0).getVal();
} catch (Exception ex) {
LOG.log(Level.FINE, "No lumMod entry", ex);
}
try {
alphaStr = ctrColor.getAlphaArray(0).getVal();
} catch (Exception ex) {
LOG.log(Level.FINE, "No alpha entry", ex);
}
if (bcolor == null) {
return null;
}
double tint = 0;
if (Double.compare(tint, 0) == 0) {
if (lumOff > 0) {
tint = lumOff / MILLION_NUMBERS;
} else {
if (lumMod > 0) {
tint = -1 * (lumMod / MILLION_NUMBERS);
}
}
}
bcolor.setTint(tint);
double alpha = 0;
if (alphaStr > 0) {
alpha = alphaStr / MILLION_NUMBERS;
}
return new XColor(bcolor, alpha);
}
|
<DeepExtract>
if (bcolor == null) {
return null;
}
double tint = 0;
if (Double.compare(tint, 0) == 0) {
if (lumOff > 0) {
tint = lumOff / MILLION_NUMBERS;
} else {
if (lumMod > 0) {
tint = -1 * (lumMod / MILLION_NUMBERS);
}
}
}
bcolor.setTint(tint);
double alpha = 0;
if (alphaStr > 0) {
alpha = alphaStr / MILLION_NUMBERS;
}
return new XColor(bcolor, alpha);
</DeepExtract>
|
TieFaces
|
positive
|
private void writeBufferedChunkToSocket() throws IOException {
int size = bufferedChunk.size();
if (size <= 0) {
return;
}
int cursor = 8;
do {
hex[--cursor] = HEX_DIGITS[size & 0xf];
} while ((size >>>= 4) != 0);
socketOut.write(hex, cursor, hex.length - cursor);
bufferedChunk.writeTo(socketOut);
bufferedChunk.reset();
socketOut.write(CRLF);
}
|
<DeepExtract>
int cursor = 8;
do {
hex[--cursor] = HEX_DIGITS[size & 0xf];
} while ((size >>>= 4) != 0);
socketOut.write(hex, cursor, hex.length - cursor);
</DeepExtract>
|
phonegap-custom-camera-plugin
|
positive
|
void replaceComposingText(int from, int charCount, String text) {
boolean isInvalidateSingleRow = true;
boolean dirty = false;
if (_isInSelectionMode) {
invalidateStartRow = _hDoc.findRowNumber(_selectionAnchor);
originalOffset = _hDoc.getRowOffset(invalidateStartRow);
int totalChars = _selectionEdge - _selectionAnchor;
if (totalChars > 0) {
_caretPosition = _selectionAnchor;
_hDoc.deleteAt(_selectionAnchor, totalChars, System.nanoTime());
if (invalidateStartRow != _caretRow) {
isInvalidateSingleRow = false;
}
dirty = true;
}
setSelectText(false);
} else {
invalidateStartRow = _caretRow;
originalOffset = _hDoc.getRowOffset(_caretRow);
}
if (charCount > 0) {
int delFromRow = _hDoc.findRowNumber(from);
if (delFromRow < invalidateStartRow) {
invalidateStartRow = delFromRow;
originalOffset = _hDoc.getRowOffset(delFromRow);
}
if (invalidateStartRow != _caretRow) {
isInvalidateSingleRow = false;
}
_caretPosition = from;
_hDoc.deleteAt(from, charCount, System.nanoTime());
dirty = true;
}
if (text != null && text.length() > 0) {
int insFromRow = _hDoc.findRowNumber(from);
if (insFromRow < invalidateStartRow) {
invalidateStartRow = insFromRow;
originalOffset = _hDoc.getRowOffset(insFromRow);
}
_hDoc.insertBefore(text.toCharArray(), _caretPosition, System.nanoTime());
_caretPosition += text.length();
dirty = true;
}
_textLis.onAdd(text, _caretPosition, text.length() - charCount);
if (dirty) {
setEdited(true);
determineSpans();
}
int originalRow = _caretRow;
int newRow = _hDoc.findRowNumber(_caretPosition);
if (_caretRow != newRow) {
_caretRow = newRow;
_rowLis.onRowChange(newRow);
}
if (originalRow != _caretRow) {
isInvalidateSingleRow = false;
}
if (!makeCharVisible(_caretPosition)) {
if (_hDoc.isWordWrap() && originalOffset != _hDoc.getRowOffset(invalidateStartRow)) {
--invalidateStartRow;
}
if (isInvalidateSingleRow && !_hDoc.isWordWrap()) {
invalidateRows(_caretRow, _caretRow + 1);
} else {
invalidateFromRow(invalidateStartRow);
}
}
}
|
<DeepExtract>
int newRow = _hDoc.findRowNumber(_caretPosition);
if (_caretRow != newRow) {
_caretRow = newRow;
_rowLis.onRowChange(newRow);
}
</DeepExtract>
|
ALuaJ
|
positive
|
@Override
public void run() {
Toast t = Toast.makeText(mContext, mContext.getString(R.string.failed_request), Toast.LENGTH_LONG);
t.show();
Log.d(TAG, mContext.getString(R.string.failed_request));
}
|
<DeepExtract>
Toast t = Toast.makeText(mContext, mContext.getString(R.string.failed_request), Toast.LENGTH_LONG);
t.show();
Log.d(TAG, mContext.getString(R.string.failed_request));
</DeepExtract>
|
Examples
|
positive
|
void updateRange() {
isUpdateWeekView = true;
mWeekCount = CalendarUtil.getWeekCountBetweenBothCalendar(mDelegate.getMinYear(), mDelegate.getMinYearMonth(), mDelegate.getMinYearDay(), mDelegate.getMaxYear(), mDelegate.getMaxYearMonth(), mDelegate.getMaxYearDay(), mDelegate.getWeekStart());
notifyAdapterDataSetChanged();
isUpdateWeekView = false;
if (getVisibility() != VISIBLE) {
return;
}
isUsingScrollToCalendar = true;
Calendar calendar = mDelegate.mSelectedCalendar;
int position = CalendarUtil.getWeekFromCalendarStartWithMinCalendar(calendar, mDelegate.getMinYear(), mDelegate.getMinYearMonth(), mDelegate.getMinYearDay(), mDelegate.getWeekStart()) - 1;
int curItem = getCurrentItem();
isUsingScrollToCalendar = curItem != position;
setCurrentItem(position, false);
BaseWeekView view = findViewWithTag(position);
if (view != null) {
view.setSelectedCalendar(calendar);
view.invalidate();
}
if (mDelegate.mInnerListener != null) {
mDelegate.mInnerListener.onWeekDateSelected(calendar, false);
}
if (mDelegate.mCalendarSelectListener != null) {
mDelegate.mCalendarSelectListener.onCalendarSelect(calendar, false);
}
int i = CalendarUtil.getWeekFromDayInMonth(calendar, mDelegate.getWeekStart());
mParentLayout.updateSelectWeek(i);
}
|
<DeepExtract>
mWeekCount = CalendarUtil.getWeekCountBetweenBothCalendar(mDelegate.getMinYear(), mDelegate.getMinYearMonth(), mDelegate.getMinYearDay(), mDelegate.getMaxYear(), mDelegate.getMaxYearMonth(), mDelegate.getMaxYearDay(), mDelegate.getWeekStart());
notifyAdapterDataSetChanged();
</DeepExtract>
<DeepExtract>
int position = CalendarUtil.getWeekFromCalendarStartWithMinCalendar(calendar, mDelegate.getMinYear(), mDelegate.getMinYearMonth(), mDelegate.getMinYearDay(), mDelegate.getWeekStart()) - 1;
int curItem = getCurrentItem();
isUsingScrollToCalendar = curItem != position;
setCurrentItem(position, false);
BaseWeekView view = findViewWithTag(position);
if (view != null) {
view.setSelectedCalendar(calendar);
view.invalidate();
}
</DeepExtract>
|
CalendarView
|
positive
|
public Criteria andPhoneIsNotNull() {
if ("phone is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("phone is not null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("phone is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("phone is not null"));
</DeepExtract>
|
health_online
|
positive
|
public void drawString(final String str, final GLU glu, final GL2 gl) {
final GlyphVector gv = font.createGlyphVector(new FontRenderContext(new AffineTransform(), true, true), new StringCharacterIterator(str));
final GeneralPath gp = (GeneralPath) gv.getOutline();
PathIterator pi = gp.getPathIterator(AffineTransform.getScaleInstance(1.0, -1.0), 1.0f);
if (this.normalMode != NormalMode.NONE)
gl.glNormal3f(0, 0, -1.0f);
tesselateFace(glu, gl, pi, pi.getWindingRule(), this.edgeOnly, 0);
if (this.depth != 0.0) {
pi = gp.getPathIterator(AffineTransform.getScaleInstance(1.0, -1.0), 1.0f);
if (this.normalMode != NormalMode.NONE)
gl.glNormal3f(0, 0, 1.0f);
tesselateFace(glu, gl, pi, pi.getWindingRule(), this.edgeOnly, this.depth);
pi = gp.getPathIterator(AffineTransform.getScaleInstance(1.0, -1.0), 1.0f);
switch(this.normalMode) {
case NONE:
drawSidesNoNorm(gl, pi, this.edgeOnly, this.depth);
break;
case FLAT:
drawSidesFlatNorm(gl, pi, this.edgeOnly, this.depth);
break;
case AVERAGED:
drawSidesAvgNorm(gl, pi, this.edgeOnly, this.depth);
break;
}
}
}
|
<DeepExtract>
tesselateFace(glu, gl, pi, pi.getWindingRule(), this.edgeOnly, 0);
</DeepExtract>
|
jogl-utils
|
positive
|
public static void markEntryAsEnabled(final SQLiteDatabase db, final String id, final int version) {
final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db, id, version);
values.put(STATUS_COLUMN, STATUS_INSTALLED);
if (NOT_A_DOWNLOAD_ID != NOT_A_DOWNLOAD_ID) {
values.put(MetadataDbHelper.PENDINGID_COLUMN, NOT_A_DOWNLOAD_ID);
}
db.update(METADATA_TABLE_NAME, values, WORDLISTID_COLUMN + " = ? AND " + VERSION_COLUMN + " = ?", new String[] { id, Integer.toString(version) });
}
|
<DeepExtract>
final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db, id, version);
values.put(STATUS_COLUMN, STATUS_INSTALLED);
if (NOT_A_DOWNLOAD_ID != NOT_A_DOWNLOAD_ID) {
values.put(MetadataDbHelper.PENDINGID_COLUMN, NOT_A_DOWNLOAD_ID);
}
db.update(METADATA_TABLE_NAME, values, WORDLISTID_COLUMN + " = ? AND " + VERSION_COLUMN + " = ?", new String[] { id, Integer.toString(version) });
</DeepExtract>
|
Android-Keyboard
|
positive
|
public Criteria andAddressBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "address" + " cannot be null");
}
criteria.add(new Criterion("address between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "address" + " cannot be null");
}
criteria.add(new Criterion("address between", value1, value2));
</DeepExtract>
|
garbage-collection
|
positive
|
public static cortado.Start.Matcher textView() {
return new cortado.Start(new Cortado(TextView.class)).new Matcher();
}
|
<DeepExtract>
return new cortado.Start(new Cortado(TextView.class)).new Matcher();
</DeepExtract>
|
cortado
|
positive
|
public long getIntendedtartTimeNs() {
if (measurementInterval == 0) {
return 0L;
}
if (time == 0) {
return System.nanoTime();
} else {
return time;
}
}
|
<DeepExtract>
if (time == 0) {
return System.nanoTime();
} else {
return time;
}
</DeepExtract>
|
json-in-db
|
positive
|
public void notifySectionDataSetChanged(int section) {
mSections = new ArrayList<>();
int total = 0;
for (int s = 0, ns = getSectionCount(); s < ns; s++) {
final Section section = new Section();
section.position = total;
section.itemNumber = getSectionItemCount(s);
section.length = section.itemNumber + 1;
mSections.add(section);
total += section.length;
}
mTotalItemNumber = total;
total = 0;
mSectionIndices = new int[mTotalItemNumber];
for (int s = 0, ns = getSectionCount(); s < ns; s++) {
final Section section = mSections.get(s);
for (int i = 0; i < section.length; i++) {
mSectionIndices[total + i] = s;
}
total += section.length;
}
if (mSections == null) {
notifyAllSectionsDataSetChanged();
} else {
final Section sectionObject = mSections.get(section);
notifyItemRangeChanged(sectionObject.position, sectionObject.length);
}
}
|
<DeepExtract>
mSections = new ArrayList<>();
int total = 0;
for (int s = 0, ns = getSectionCount(); s < ns; s++) {
final Section section = new Section();
section.position = total;
section.itemNumber = getSectionItemCount(s);
section.length = section.itemNumber + 1;
mSections.add(section);
total += section.length;
}
mTotalItemNumber = total;
total = 0;
mSectionIndices = new int[mTotalItemNumber];
for (int s = 0, ns = getSectionCount(); s < ns; s++) {
final Section section = mSections.get(s);
for (int i = 0; i < section.length; i++) {
mSectionIndices[total + i] = s;
}
total += section.length;
}
</DeepExtract>
|
EasyBill
|
positive
|
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
for (int i = 0; i < _groupNameList.size(); ++i) {
Map<String, String> curGroupMap = new HashMap<String, String>();
groupData.add(curGroupMap);
curGroupMap.put(NAME, _groupNameList.get(i));
curGroupMap.put(DESCRIPTION, _groupNameList.get(i));
List<Map<String, String>> children = new ArrayList<Map<String, String>>();
for (int j = 0; j < _childNameList.get(i).size(); ++j) {
Map<String, String> curChildMap = new HashMap<String, String>();
children.add(curChildMap);
curChildMap.put(NAME, _childNameList.get(i).get(j));
curChildMap.put(DESCRIPTION, _childNameList.get(i).get(j));
}
childData.add(children);
}
setListAdapter(new TheSimpleExpandableListAdapter(this, groupData, android.R.layout.simple_expandable_list_item_1, new String[] { NAME, DESCRIPTION }, new int[] { android.R.id.text1, android.R.id.text2 }, childData, android.R.layout.simple_expandable_list_item_2, new String[] { NAME, DESCRIPTION }, new int[] { android.R.id.text1, android.R.id.text2 }));
Button button = (Button) findViewById(R.id.btnDelete);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onDelete(v);
}
});
button = (Button) findViewById(R.id.btnAdd);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onAdd(v);
}
});
ExpandableListView lv = getExpandableListView();
for (int i = 0; i < _groupNames.length; ++i) {
lv.expandGroup(i);
}
}
|
<DeepExtract>
ExpandableListView lv = getExpandableListView();
for (int i = 0; i < _groupNames.length; ++i) {
lv.expandGroup(i);
}
</DeepExtract>
|
androidtestdebug
|
positive
|
public <T> void appendRequest(int reqId, byte[] reqTopic, ByteBuffer reqMsg) {
int sz = reqMsg.remaining();
if (buffer.remaining() < 1 + 4 + 1 + reqTopic.length + 4 + sz) {
ByteBuffer resized = allocate(buffer.capacity() + Math.max(1 + 4 + 1 + reqTopic.length + 4 + sz, 128));
buffer.flip();
resized.put(buffer);
this.buffer = resized;
}
resize(1);
buffer.put((byte) MsgTypes.DataRequest);
resize(4);
buffer.putInt(reqId);
appendIntAsByte(reqTopic.length);
append(reqTopic, 0, reqTopic.length);
resize(4);
buffer.putInt(sz);
buffer.put(reqMsg);
}
|
<DeepExtract>
if (buffer.remaining() < 1 + 4 + 1 + reqTopic.length + 4 + sz) {
ByteBuffer resized = allocate(buffer.capacity() + Math.max(1 + 4 + 1 + reqTopic.length + 4 + sz, 128));
buffer.flip();
resized.put(buffer);
this.buffer = resized;
}
</DeepExtract>
<DeepExtract>
resize(1);
buffer.put((byte) MsgTypes.DataRequest);
</DeepExtract>
<DeepExtract>
resize(4);
buffer.putInt(reqId);
</DeepExtract>
<DeepExtract>
appendIntAsByte(reqTopic.length);
append(reqTopic, 0, reqTopic.length);
</DeepExtract>
<DeepExtract>
resize(4);
buffer.putInt(sz);
</DeepExtract>
|
remoting
|
positive
|
@Override
public void onMobiSageProductPlacementError(MobiSageAdProductPlacement arg0) {
DisposableStatsUtils.disposeAdLoss(mActivity, URLContainer.AD_LOSS_STEP4, SessionUnitil.playEvent_session, URLContainer.AD_LOSS_MP);
}
|
<DeepExtract>
DisposableStatsUtils.disposeAdLoss(mActivity, URLContainer.AD_LOSS_STEP4, SessionUnitil.playEvent_session, URLContainer.AD_LOSS_MP);
</DeepExtract>
|
YouKuPlayerDemo
|
positive
|
public static StronglyConnectedComponents compute(final ArcLabelledImmutableGraph graph, final LabelledArcFilter filter, final boolean computeBuckets, final ProgressLogger pl) {
final int n = graph.numNodes();
FilteredVisit filteredVisit = new FilteredVisit(graph, filter, new int[n], computeBuckets ? LongArrayBitVector.ofLength(n) : null, pl);
if (pl != null) {
pl.itemsName = "nodes";
pl.expectedUpdates = n;
pl.displayFreeMemory = true;
pl.start("Computing strongly connected components...");
}
for (int x = 0; x < n; x++) if (status[x] == 0)
visit(x);
if (pl != null)
pl.done();
for (int i = status.length; i-- != 0; ) status[i] = -status[i] - 1;
if (buckets != null)
buckets.flip();
return new StronglyConnectedComponents(filteredVisit.numberOfComponents, filteredVisit.status, filteredVisit.buckets);
}
|
<DeepExtract>
if (pl != null) {
pl.itemsName = "nodes";
pl.expectedUpdates = n;
pl.displayFreeMemory = true;
pl.start("Computing strongly connected components...");
}
for (int x = 0; x < n; x++) if (status[x] == 0)
visit(x);
if (pl != null)
pl.done();
for (int i = status.length; i-- != 0; ) status[i] = -status[i] - 1;
if (buckets != null)
buckets.flip();
</DeepExtract>
|
WebGraph
|
positive
|
public static Object getValue(final Object object, final String propertyName) {
Assertion.check().isNotNull(object).isNotNull(propertyName).isTrue(propertyName.indexOf('.') == -1, "the dot notation is forbidden");
PropertyDescriptor pd;
final PropertyDescriptor[] descriptors = getPropertyDescriptors(object.getClass());
for (final PropertyDescriptor propertyDescriptor : descriptors) {
if (propertyName.equals(propertyDescriptor.getName())) {
pd = propertyDescriptor;
}
}
throw new VSystemException("No method found for property '{0}' on class '{1}'", propertyName, object.getClass().getName());
final Method readMethod = pd.getReadMethod();
if (readMethod == null) {
throw new VSystemException("no getter found for property '{0}' on class '{1}'", propertyName, object.getClass().getName());
}
return ClassUtil.invoke(object, readMethod);
}
|
<DeepExtract>
PropertyDescriptor pd;
final PropertyDescriptor[] descriptors = getPropertyDescriptors(object.getClass());
for (final PropertyDescriptor propertyDescriptor : descriptors) {
if (propertyName.equals(propertyDescriptor.getName())) {
pd = propertyDescriptor;
}
}
throw new VSystemException("No method found for property '{0}' on class '{1}'", propertyName, object.getClass().getName());
</DeepExtract>
|
vertigo
|
positive
|
@Override
public void run() {
ChargeState cs = vtData.lastStoredChargeState.get();
if (Double.isNaN(cs.chargerVoltage) || Double.isInfinite(cs.chargerVoltage))
cs.chargerVoltage = 0;
typeToSeries.get(VTData.VoltageKey).addToSeries(cs.timestamp, cs.chargerVoltage);
if (Double.isNaN(cs.chargerActualCurrent) || Double.isInfinite(cs.chargerActualCurrent))
cs.chargerActualCurrent = 0;
typeToSeries.get(VTData.CurrentKey).addToSeries(cs.timestamp, cs.chargerActualCurrent);
if (Double.isNaN(cs.range) || Double.isInfinite(cs.range))
cs.range = 0;
typeToSeries.get(VTData.EstRangeKey).addToSeries(cs.timestamp, cs.range);
if (Double.isNaN(cs.batteryPercent) || Double.isInfinite(cs.batteryPercent))
cs.batteryPercent = 0;
typeToSeries.get(VTData.SOCKey).addToSeries(cs.timestamp, cs.batteryPercent);
if (Double.isNaN(cs.chargeRate) || Double.isInfinite(cs.chargeRate))
cs.chargeRate = 0;
typeToSeries.get(VTData.ROCKey).addToSeries(cs.timestamp, cs.chargeRate);
if (Double.isNaN(cs.batteryCurrent) || Double.isInfinite(cs.batteryCurrent))
cs.batteryCurrent = 0;
typeToSeries.get(VTData.BatteryAmpsKey).addToSeries(cs.timestamp, cs.batteryCurrent);
}
|
<DeepExtract>
if (Double.isNaN(cs.chargerVoltage) || Double.isInfinite(cs.chargerVoltage))
cs.chargerVoltage = 0;
typeToSeries.get(VTData.VoltageKey).addToSeries(cs.timestamp, cs.chargerVoltage);
</DeepExtract>
<DeepExtract>
if (Double.isNaN(cs.chargerActualCurrent) || Double.isInfinite(cs.chargerActualCurrent))
cs.chargerActualCurrent = 0;
typeToSeries.get(VTData.CurrentKey).addToSeries(cs.timestamp, cs.chargerActualCurrent);
</DeepExtract>
<DeepExtract>
if (Double.isNaN(cs.range) || Double.isInfinite(cs.range))
cs.range = 0;
typeToSeries.get(VTData.EstRangeKey).addToSeries(cs.timestamp, cs.range);
</DeepExtract>
<DeepExtract>
if (Double.isNaN(cs.batteryPercent) || Double.isInfinite(cs.batteryPercent))
cs.batteryPercent = 0;
typeToSeries.get(VTData.SOCKey).addToSeries(cs.timestamp, cs.batteryPercent);
</DeepExtract>
<DeepExtract>
if (Double.isNaN(cs.chargeRate) || Double.isInfinite(cs.chargeRate))
cs.chargeRate = 0;
typeToSeries.get(VTData.ROCKey).addToSeries(cs.timestamp, cs.chargeRate);
</DeepExtract>
<DeepExtract>
if (Double.isNaN(cs.batteryCurrent) || Double.isInfinite(cs.batteryCurrent))
cs.batteryCurrent = 0;
typeToSeries.get(VTData.BatteryAmpsKey).addToSeries(cs.timestamp, cs.batteryCurrent);
</DeepExtract>
|
VisibleTesla
|
positive
|
public void clearAndType(final String keysToSend) {
TestLogging.logWebStep("Remove data From " + toHTML(), false);
findElement();
if (!element.getAttribute("type").equalsIgnoreCase("file")) {
element.clear();
}
sendKeys(keysToSend);
}
|
<DeepExtract>
TestLogging.logWebStep("Remove data From " + toHTML(), false);
findElement();
if (!element.getAttribute("type").equalsIgnoreCase("file")) {
element.clear();
}
</DeepExtract>
<DeepExtract>
sendKeys(keysToSend);
</DeepExtract>
|
seleniumtestsframework
|
positive
|
@Override
public int mark() {
int ret;
throw new UnsupportedOperationException();
markers.add(psiBuilder.mark());
return ret;
}
|
<DeepExtract>
int ret;
throw new UnsupportedOperationException();
</DeepExtract>
|
smalidea
|
positive
|
public SelectQuery addAliasedColumn(Object column, String alias) {
_columns.addObjects(Converter.COLUMN_VALUE_TO_OBJ, Converter.toColumnSqlObject(column, alias));
return this;
}
|
<DeepExtract>
_columns.addObjects(Converter.COLUMN_VALUE_TO_OBJ, Converter.toColumnSqlObject(column, alias));
return this;
</DeepExtract>
|
sqlbuilder
|
positive
|
@Override
public Object clone() throws CloneNotSupportedException {
TOMMessage clone = new TOMMessage(sender, session, sequence, operationId, content, viewID, type);
this.replyServer = replyServer;
clone.acceptSentTime = this.acceptSentTime;
clone.alreadyProposed = this.alreadyProposed;
clone.authenticated = this.authenticated;
clone.consensusStartTime = this.consensusStartTime;
clone.decisionTime = this.decisionTime;
clone.deliveryTime = this.deliveryTime;
clone.destination = this.destination;
clone.executedTime = this.executedTime;
clone.info = this.info;
clone.isValid = this.isValid;
clone.numOfNonces = this.numOfNonces;
clone.proposeReceivedTime = this.proposeReceivedTime;
clone.receptionTime = this.receptionTime;
clone.receptionTimestamp = this.receptionTimestamp;
clone.recvFromClient = this.recvFromClient;
clone.reply = this.reply;
clone.seed = this.seed;
clone.serializedMessage = this.serializedMessage;
clone.serializedMessageMAC = this.serializedMessageMAC;
clone.serializedMessageSignature = this.serializedMessageSignature;
clone.signed = this.signed;
clone.timeout = this.timeout;
clone.timestamp = this.timestamp;
clone.writeSentTime = this.writeSentTime;
clone.retry = this.retry;
return clone;
}
|
<DeepExtract>
this.replyServer = replyServer;
</DeepExtract>
|
library
|
positive
|
public void dup2X2() {
switch(Opcodes.DUP2_X2) {
case Opcodes.NOP:
nop();
break;
case Opcodes.ACONST_NULL:
aconst(null);
break;
case Opcodes.ICONST_M1:
case Opcodes.ICONST_0:
case Opcodes.ICONST_1:
case Opcodes.ICONST_2:
case Opcodes.ICONST_3:
case Opcodes.ICONST_4:
case Opcodes.ICONST_5:
iconst(Opcodes.DUP2_X2 - Opcodes.ICONST_0);
break;
case Opcodes.LCONST_0:
case Opcodes.LCONST_1:
lconst((long) (Opcodes.DUP2_X2 - Opcodes.LCONST_0));
break;
case Opcodes.FCONST_0:
case Opcodes.FCONST_1:
case Opcodes.FCONST_2:
fconst((float) (Opcodes.DUP2_X2 - Opcodes.FCONST_0));
break;
case Opcodes.DCONST_0:
case Opcodes.DCONST_1:
dconst((double) (Opcodes.DUP2_X2 - Opcodes.DCONST_0));
break;
case Opcodes.IALOAD:
aload(Type.INT_TYPE);
break;
case Opcodes.LALOAD:
aload(Type.LONG_TYPE);
break;
case Opcodes.FALOAD:
aload(Type.FLOAT_TYPE);
break;
case Opcodes.DALOAD:
aload(Type.DOUBLE_TYPE);
break;
case Opcodes.AALOAD:
aload(OBJECT_TYPE);
break;
case Opcodes.BALOAD:
aload(Type.BYTE_TYPE);
break;
case Opcodes.CALOAD:
aload(Type.CHAR_TYPE);
break;
case Opcodes.SALOAD:
aload(Type.SHORT_TYPE);
break;
case Opcodes.IASTORE:
astore(Type.INT_TYPE);
break;
case Opcodes.LASTORE:
astore(Type.LONG_TYPE);
break;
case Opcodes.FASTORE:
astore(Type.FLOAT_TYPE);
break;
case Opcodes.DASTORE:
astore(Type.DOUBLE_TYPE);
break;
case Opcodes.AASTORE:
astore(OBJECT_TYPE);
break;
case Opcodes.BASTORE:
astore(Type.BYTE_TYPE);
break;
case Opcodes.CASTORE:
astore(Type.CHAR_TYPE);
break;
case Opcodes.SASTORE:
astore(Type.SHORT_TYPE);
break;
case Opcodes.POP:
pop();
break;
case Opcodes.POP2:
pop2();
break;
case Opcodes.DUP:
dup();
break;
case Opcodes.DUP_X1:
dupX1();
break;
case Opcodes.DUP_X2:
dupX2();
break;
case Opcodes.DUP2:
dup2();
break;
case Opcodes.DUP2_X1:
dup2X1();
break;
case Opcodes.DUP2_X2:
dup2X2();
break;
case Opcodes.SWAP:
swap();
break;
case Opcodes.IADD:
add(Type.INT_TYPE);
break;
case Opcodes.LADD:
add(Type.LONG_TYPE);
break;
case Opcodes.FADD:
add(Type.FLOAT_TYPE);
break;
case Opcodes.DADD:
add(Type.DOUBLE_TYPE);
break;
case Opcodes.ISUB:
sub(Type.INT_TYPE);
break;
case Opcodes.LSUB:
sub(Type.LONG_TYPE);
break;
case Opcodes.FSUB:
sub(Type.FLOAT_TYPE);
break;
case Opcodes.DSUB:
sub(Type.DOUBLE_TYPE);
break;
case Opcodes.IMUL:
mul(Type.INT_TYPE);
break;
case Opcodes.LMUL:
mul(Type.LONG_TYPE);
break;
case Opcodes.FMUL:
mul(Type.FLOAT_TYPE);
break;
case Opcodes.DMUL:
mul(Type.DOUBLE_TYPE);
break;
case Opcodes.IDIV:
div(Type.INT_TYPE);
break;
case Opcodes.LDIV:
div(Type.LONG_TYPE);
break;
case Opcodes.FDIV:
div(Type.FLOAT_TYPE);
break;
case Opcodes.DDIV:
div(Type.DOUBLE_TYPE);
break;
case Opcodes.IREM:
rem(Type.INT_TYPE);
break;
case Opcodes.LREM:
rem(Type.LONG_TYPE);
break;
case Opcodes.FREM:
rem(Type.FLOAT_TYPE);
break;
case Opcodes.DREM:
rem(Type.DOUBLE_TYPE);
break;
case Opcodes.INEG:
neg(Type.INT_TYPE);
break;
case Opcodes.LNEG:
neg(Type.LONG_TYPE);
break;
case Opcodes.FNEG:
neg(Type.FLOAT_TYPE);
break;
case Opcodes.DNEG:
neg(Type.DOUBLE_TYPE);
break;
case Opcodes.ISHL:
shl(Type.INT_TYPE);
break;
case Opcodes.LSHL:
shl(Type.LONG_TYPE);
break;
case Opcodes.ISHR:
shr(Type.INT_TYPE);
break;
case Opcodes.LSHR:
shr(Type.LONG_TYPE);
break;
case Opcodes.IUSHR:
ushr(Type.INT_TYPE);
break;
case Opcodes.LUSHR:
ushr(Type.LONG_TYPE);
break;
case Opcodes.IAND:
and(Type.INT_TYPE);
break;
case Opcodes.LAND:
and(Type.LONG_TYPE);
break;
case Opcodes.IOR:
or(Type.INT_TYPE);
break;
case Opcodes.LOR:
or(Type.LONG_TYPE);
break;
case Opcodes.IXOR:
xor(Type.INT_TYPE);
break;
case Opcodes.LXOR:
xor(Type.LONG_TYPE);
break;
case Opcodes.I2L:
cast(Type.INT_TYPE, Type.LONG_TYPE);
break;
case Opcodes.I2F:
cast(Type.INT_TYPE, Type.FLOAT_TYPE);
break;
case Opcodes.I2D:
cast(Type.INT_TYPE, Type.DOUBLE_TYPE);
break;
case Opcodes.L2I:
cast(Type.LONG_TYPE, Type.INT_TYPE);
break;
case Opcodes.L2F:
cast(Type.LONG_TYPE, Type.FLOAT_TYPE);
break;
case Opcodes.L2D:
cast(Type.LONG_TYPE, Type.DOUBLE_TYPE);
break;
case Opcodes.F2I:
cast(Type.FLOAT_TYPE, Type.INT_TYPE);
break;
case Opcodes.F2L:
cast(Type.FLOAT_TYPE, Type.LONG_TYPE);
break;
case Opcodes.F2D:
cast(Type.FLOAT_TYPE, Type.DOUBLE_TYPE);
break;
case Opcodes.D2I:
cast(Type.DOUBLE_TYPE, Type.INT_TYPE);
break;
case Opcodes.D2L:
cast(Type.DOUBLE_TYPE, Type.LONG_TYPE);
break;
case Opcodes.D2F:
cast(Type.DOUBLE_TYPE, Type.FLOAT_TYPE);
break;
case Opcodes.I2B:
cast(Type.INT_TYPE, Type.BYTE_TYPE);
break;
case Opcodes.I2C:
cast(Type.INT_TYPE, Type.CHAR_TYPE);
break;
case Opcodes.I2S:
cast(Type.INT_TYPE, Type.SHORT_TYPE);
break;
case Opcodes.LCMP:
lcmp();
break;
case Opcodes.FCMPL:
cmpl(Type.FLOAT_TYPE);
break;
case Opcodes.FCMPG:
cmpg(Type.FLOAT_TYPE);
break;
case Opcodes.DCMPL:
cmpl(Type.DOUBLE_TYPE);
break;
case Opcodes.DCMPG:
cmpg(Type.DOUBLE_TYPE);
break;
case Opcodes.IRETURN:
areturn(Type.INT_TYPE);
break;
case Opcodes.LRETURN:
areturn(Type.LONG_TYPE);
break;
case Opcodes.FRETURN:
areturn(Type.FLOAT_TYPE);
break;
case Opcodes.DRETURN:
areturn(Type.DOUBLE_TYPE);
break;
case Opcodes.ARETURN:
areturn(OBJECT_TYPE);
break;
case Opcodes.RETURN:
areturn(Type.VOID_TYPE);
break;
case Opcodes.ARRAYLENGTH:
arraylength();
break;
case Opcodes.ATHROW:
athrow();
break;
case Opcodes.MONITORENTER:
monitorenter();
break;
case Opcodes.MONITOREXIT:
monitorexit();
break;
default:
throw new IllegalArgumentException();
}
}
|
<DeepExtract>
switch(Opcodes.DUP2_X2) {
case Opcodes.NOP:
nop();
break;
case Opcodes.ACONST_NULL:
aconst(null);
break;
case Opcodes.ICONST_M1:
case Opcodes.ICONST_0:
case Opcodes.ICONST_1:
case Opcodes.ICONST_2:
case Opcodes.ICONST_3:
case Opcodes.ICONST_4:
case Opcodes.ICONST_5:
iconst(Opcodes.DUP2_X2 - Opcodes.ICONST_0);
break;
case Opcodes.LCONST_0:
case Opcodes.LCONST_1:
lconst((long) (Opcodes.DUP2_X2 - Opcodes.LCONST_0));
break;
case Opcodes.FCONST_0:
case Opcodes.FCONST_1:
case Opcodes.FCONST_2:
fconst((float) (Opcodes.DUP2_X2 - Opcodes.FCONST_0));
break;
case Opcodes.DCONST_0:
case Opcodes.DCONST_1:
dconst((double) (Opcodes.DUP2_X2 - Opcodes.DCONST_0));
break;
case Opcodes.IALOAD:
aload(Type.INT_TYPE);
break;
case Opcodes.LALOAD:
aload(Type.LONG_TYPE);
break;
case Opcodes.FALOAD:
aload(Type.FLOAT_TYPE);
break;
case Opcodes.DALOAD:
aload(Type.DOUBLE_TYPE);
break;
case Opcodes.AALOAD:
aload(OBJECT_TYPE);
break;
case Opcodes.BALOAD:
aload(Type.BYTE_TYPE);
break;
case Opcodes.CALOAD:
aload(Type.CHAR_TYPE);
break;
case Opcodes.SALOAD:
aload(Type.SHORT_TYPE);
break;
case Opcodes.IASTORE:
astore(Type.INT_TYPE);
break;
case Opcodes.LASTORE:
astore(Type.LONG_TYPE);
break;
case Opcodes.FASTORE:
astore(Type.FLOAT_TYPE);
break;
case Opcodes.DASTORE:
astore(Type.DOUBLE_TYPE);
break;
case Opcodes.AASTORE:
astore(OBJECT_TYPE);
break;
case Opcodes.BASTORE:
astore(Type.BYTE_TYPE);
break;
case Opcodes.CASTORE:
astore(Type.CHAR_TYPE);
break;
case Opcodes.SASTORE:
astore(Type.SHORT_TYPE);
break;
case Opcodes.POP:
pop();
break;
case Opcodes.POP2:
pop2();
break;
case Opcodes.DUP:
dup();
break;
case Opcodes.DUP_X1:
dupX1();
break;
case Opcodes.DUP_X2:
dupX2();
break;
case Opcodes.DUP2:
dup2();
break;
case Opcodes.DUP2_X1:
dup2X1();
break;
case Opcodes.DUP2_X2:
dup2X2();
break;
case Opcodes.SWAP:
swap();
break;
case Opcodes.IADD:
add(Type.INT_TYPE);
break;
case Opcodes.LADD:
add(Type.LONG_TYPE);
break;
case Opcodes.FADD:
add(Type.FLOAT_TYPE);
break;
case Opcodes.DADD:
add(Type.DOUBLE_TYPE);
break;
case Opcodes.ISUB:
sub(Type.INT_TYPE);
break;
case Opcodes.LSUB:
sub(Type.LONG_TYPE);
break;
case Opcodes.FSUB:
sub(Type.FLOAT_TYPE);
break;
case Opcodes.DSUB:
sub(Type.DOUBLE_TYPE);
break;
case Opcodes.IMUL:
mul(Type.INT_TYPE);
break;
case Opcodes.LMUL:
mul(Type.LONG_TYPE);
break;
case Opcodes.FMUL:
mul(Type.FLOAT_TYPE);
break;
case Opcodes.DMUL:
mul(Type.DOUBLE_TYPE);
break;
case Opcodes.IDIV:
div(Type.INT_TYPE);
break;
case Opcodes.LDIV:
div(Type.LONG_TYPE);
break;
case Opcodes.FDIV:
div(Type.FLOAT_TYPE);
break;
case Opcodes.DDIV:
div(Type.DOUBLE_TYPE);
break;
case Opcodes.IREM:
rem(Type.INT_TYPE);
break;
case Opcodes.LREM:
rem(Type.LONG_TYPE);
break;
case Opcodes.FREM:
rem(Type.FLOAT_TYPE);
break;
case Opcodes.DREM:
rem(Type.DOUBLE_TYPE);
break;
case Opcodes.INEG:
neg(Type.INT_TYPE);
break;
case Opcodes.LNEG:
neg(Type.LONG_TYPE);
break;
case Opcodes.FNEG:
neg(Type.FLOAT_TYPE);
break;
case Opcodes.DNEG:
neg(Type.DOUBLE_TYPE);
break;
case Opcodes.ISHL:
shl(Type.INT_TYPE);
break;
case Opcodes.LSHL:
shl(Type.LONG_TYPE);
break;
case Opcodes.ISHR:
shr(Type.INT_TYPE);
break;
case Opcodes.LSHR:
shr(Type.LONG_TYPE);
break;
case Opcodes.IUSHR:
ushr(Type.INT_TYPE);
break;
case Opcodes.LUSHR:
ushr(Type.LONG_TYPE);
break;
case Opcodes.IAND:
and(Type.INT_TYPE);
break;
case Opcodes.LAND:
and(Type.LONG_TYPE);
break;
case Opcodes.IOR:
or(Type.INT_TYPE);
break;
case Opcodes.LOR:
or(Type.LONG_TYPE);
break;
case Opcodes.IXOR:
xor(Type.INT_TYPE);
break;
case Opcodes.LXOR:
xor(Type.LONG_TYPE);
break;
case Opcodes.I2L:
cast(Type.INT_TYPE, Type.LONG_TYPE);
break;
case Opcodes.I2F:
cast(Type.INT_TYPE, Type.FLOAT_TYPE);
break;
case Opcodes.I2D:
cast(Type.INT_TYPE, Type.DOUBLE_TYPE);
break;
case Opcodes.L2I:
cast(Type.LONG_TYPE, Type.INT_TYPE);
break;
case Opcodes.L2F:
cast(Type.LONG_TYPE, Type.FLOAT_TYPE);
break;
case Opcodes.L2D:
cast(Type.LONG_TYPE, Type.DOUBLE_TYPE);
break;
case Opcodes.F2I:
cast(Type.FLOAT_TYPE, Type.INT_TYPE);
break;
case Opcodes.F2L:
cast(Type.FLOAT_TYPE, Type.LONG_TYPE);
break;
case Opcodes.F2D:
cast(Type.FLOAT_TYPE, Type.DOUBLE_TYPE);
break;
case Opcodes.D2I:
cast(Type.DOUBLE_TYPE, Type.INT_TYPE);
break;
case Opcodes.D2L:
cast(Type.DOUBLE_TYPE, Type.LONG_TYPE);
break;
case Opcodes.D2F:
cast(Type.DOUBLE_TYPE, Type.FLOAT_TYPE);
break;
case Opcodes.I2B:
cast(Type.INT_TYPE, Type.BYTE_TYPE);
break;
case Opcodes.I2C:
cast(Type.INT_TYPE, Type.CHAR_TYPE);
break;
case Opcodes.I2S:
cast(Type.INT_TYPE, Type.SHORT_TYPE);
break;
case Opcodes.LCMP:
lcmp();
break;
case Opcodes.FCMPL:
cmpl(Type.FLOAT_TYPE);
break;
case Opcodes.FCMPG:
cmpg(Type.FLOAT_TYPE);
break;
case Opcodes.DCMPL:
cmpl(Type.DOUBLE_TYPE);
break;
case Opcodes.DCMPG:
cmpg(Type.DOUBLE_TYPE);
break;
case Opcodes.IRETURN:
areturn(Type.INT_TYPE);
break;
case Opcodes.LRETURN:
areturn(Type.LONG_TYPE);
break;
case Opcodes.FRETURN:
areturn(Type.FLOAT_TYPE);
break;
case Opcodes.DRETURN:
areturn(Type.DOUBLE_TYPE);
break;
case Opcodes.ARETURN:
areturn(OBJECT_TYPE);
break;
case Opcodes.RETURN:
areturn(Type.VOID_TYPE);
break;
case Opcodes.ARRAYLENGTH:
arraylength();
break;
case Opcodes.ATHROW:
athrow();
break;
case Opcodes.MONITORENTER:
monitorenter();
break;
case Opcodes.MONITOREXIT:
monitorexit();
break;
default:
throw new IllegalArgumentException();
}
</DeepExtract>
|
LunarClientSpoofer
|
positive
|
@Test
public void successOutputCheckWithAntiCsrf() throws Exception {
String[] args = { "../" };
TestingProcessManager.TestingProcess process = TestingProcessManager.start(args);
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED));
String userId = "userId";
JsonObject userDataInJWT = new JsonObject();
userDataInJWT.addProperty("key", "value");
JsonObject userDataInDatabase = new JsonObject();
userDataInDatabase.addProperty("key", "value");
JsonObject request = new JsonObject();
request.addProperty("userId", userId);
request.add("userDataInJWT", userDataInJWT);
request.add("userDataInDatabase", userDataInDatabase);
request.addProperty("enableAntiCsrf", false);
JsonObject response = HttpRequestForTesting.sendJsonPOSTRequest(process.getProcess(), "", "http://localhost:3567/recipe/session", request, 1000, 1000, null, Utils.getCdiVersion2_9ForTests(), "session");
assertNotNull(response.get("session").getAsJsonObject().get("handle").getAsString());
assertEquals(response.get("session").getAsJsonObject().get("userId").getAsString(), userId);
assertEquals(response.get("session").getAsJsonObject().get("userDataInJWT").getAsJsonObject().toString(), userDataInJWT.toString());
assertEquals(response.get("session").getAsJsonObject().entrySet().size(), 3);
assertTrue(response.get("accessToken").getAsJsonObject().has("token"));
assertTrue(response.get("accessToken").getAsJsonObject().has("expiry"));
assertTrue(response.get("accessToken").getAsJsonObject().has("createdTime"));
assertEquals(response.get("accessToken").getAsJsonObject().entrySet().size(), 3);
assertTrue(response.get("refreshToken").getAsJsonObject().has("token"));
assertTrue(response.get("refreshToken").getAsJsonObject().has("expiry"));
assertTrue(response.get("refreshToken").getAsJsonObject().has("createdTime"));
assertEquals(response.get("refreshToken").getAsJsonObject().entrySet().size(), 3);
assertTrue(response.get("idRefreshToken").getAsJsonObject().has("token"));
assertTrue(response.get("idRefreshToken").getAsJsonObject().has("expiry"));
assertTrue(response.get("idRefreshToken").getAsJsonObject().has("createdTime"));
assertEquals(response.get("idRefreshToken").getAsJsonObject().entrySet().size(), 3);
assertTrue(response.has("jwtSigningPublicKey"));
assertTrue(response.has("jwtSigningPublicKeyExpiryTime"));
assertTrue(response.has("jwtSigningPublicKeyList"));
JsonArray respPubKeyList = response.get("jwtSigningPublicKeyList").getAsJsonArray();
for (int i = 0; i < respPubKeyList.size(); ++i) {
assertTrue(respPubKeyList.get(i).getAsJsonObject().has("publicKey"));
assertTrue(respPubKeyList.get(i).getAsJsonObject().has("expiryTime"));
assertTrue(respPubKeyList.get(i).getAsJsonObject().has("createdAt"));
assertEquals(respPubKeyList.get(i).getAsJsonObject().entrySet().size(), 3);
}
assertFalse(response.has("antiCsrfToken"));
process.kill();
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STOPPED));
}
|
<DeepExtract>
assertNotNull(response.get("session").getAsJsonObject().get("handle").getAsString());
assertEquals(response.get("session").getAsJsonObject().get("userId").getAsString(), userId);
assertEquals(response.get("session").getAsJsonObject().get("userDataInJWT").getAsJsonObject().toString(), userDataInJWT.toString());
assertEquals(response.get("session").getAsJsonObject().entrySet().size(), 3);
assertTrue(response.get("accessToken").getAsJsonObject().has("token"));
assertTrue(response.get("accessToken").getAsJsonObject().has("expiry"));
assertTrue(response.get("accessToken").getAsJsonObject().has("createdTime"));
assertEquals(response.get("accessToken").getAsJsonObject().entrySet().size(), 3);
assertTrue(response.get("refreshToken").getAsJsonObject().has("token"));
assertTrue(response.get("refreshToken").getAsJsonObject().has("expiry"));
assertTrue(response.get("refreshToken").getAsJsonObject().has("createdTime"));
assertEquals(response.get("refreshToken").getAsJsonObject().entrySet().size(), 3);
assertTrue(response.get("idRefreshToken").getAsJsonObject().has("token"));
assertTrue(response.get("idRefreshToken").getAsJsonObject().has("expiry"));
assertTrue(response.get("idRefreshToken").getAsJsonObject().has("createdTime"));
assertEquals(response.get("idRefreshToken").getAsJsonObject().entrySet().size(), 3);
assertTrue(response.has("jwtSigningPublicKey"));
assertTrue(response.has("jwtSigningPublicKeyExpiryTime"));
assertTrue(response.has("jwtSigningPublicKeyList"));
JsonArray respPubKeyList = response.get("jwtSigningPublicKeyList").getAsJsonArray();
for (int i = 0; i < respPubKeyList.size(); ++i) {
assertTrue(respPubKeyList.get(i).getAsJsonObject().has("publicKey"));
assertTrue(respPubKeyList.get(i).getAsJsonObject().has("expiryTime"));
assertTrue(respPubKeyList.get(i).getAsJsonObject().has("createdAt"));
assertEquals(respPubKeyList.get(i).getAsJsonObject().entrySet().size(), 3);
}
</DeepExtract>
|
supertokens-core
|
positive
|
public static Number dividePrecise(Number op1, Number op2) {
if (op1 instanceof BigDecimal) {
if (op2 instanceof BigDecimal) {
result = ((BigDecimal) op1).divide((BigDecimal) op2, DIVIDE_PRECISION, RoundingMode.HALF_UP);
} else {
result = ((BigDecimal) op1).divide(new BigDecimal(op2.toString()), DIVIDE_PRECISION, RoundingMode.HALF_UP);
}
} else {
if (op2 instanceof BigDecimal) {
result = new BigDecimal(op1.toString()).divide((BigDecimal) op2, DIVIDE_PRECISION, RoundingMode.HALF_UP);
} else {
result = new BigDecimal(op1.toString()).divide(new BigDecimal(op2.toString()), DIVIDE_PRECISION, RoundingMode.HALF_UP);
}
}
if (result.scale() == 0) {
if (result.compareTo(OperatorOfNumber.BIG_DECIMAL_INTEGER_MAX) < OperatorOfNumber.MORE && result.compareTo(OperatorOfNumber.BIG_DECIMAL_INTEGER_MIN) > OperatorOfNumber.LESS) {
return result.intValue();
} else if (result.compareTo(OperatorOfNumber.BIG_DECIMAL_LONG_MAX) < OperatorOfNumber.MORE && result.compareTo(OperatorOfNumber.BIG_DECIMAL_LONG_MIN) > OperatorOfNumber.LESS) {
return result.longValue();
}
}
return result;
}
|
<DeepExtract>
if (result.scale() == 0) {
if (result.compareTo(OperatorOfNumber.BIG_DECIMAL_INTEGER_MAX) < OperatorOfNumber.MORE && result.compareTo(OperatorOfNumber.BIG_DECIMAL_INTEGER_MIN) > OperatorOfNumber.LESS) {
return result.intValue();
} else if (result.compareTo(OperatorOfNumber.BIG_DECIMAL_LONG_MAX) < OperatorOfNumber.MORE && result.compareTo(OperatorOfNumber.BIG_DECIMAL_LONG_MIN) > OperatorOfNumber.LESS) {
return result.longValue();
}
}
return result;
</DeepExtract>
|
QLExpress
|
positive
|
public RPCResponseFuture invokeWithFuture(final String address, final Object request, final InvokeContext invokeContext, final int timeoutMillis) throws RemotingException, InterruptedException {
if (!this.switches().isOn(GlobalSwitch.SERVER_MANAGE_CONNECTION_SWITCH)) {
throw new UnsupportedOperationException("Please enable connection manage feature of RPC Server before call this method! See comments in constructor RGPDefaultRemoteServer(int port, boolean manageConnection) to find how to enable!");
}
return this.remoting.invokeWithFuture(address, request, invokeContext, timeoutMillis);
}
|
<DeepExtract>
if (!this.switches().isOn(GlobalSwitch.SERVER_MANAGE_CONNECTION_SWITCH)) {
throw new UnsupportedOperationException("Please enable connection manage feature of RPC Server before call this method! See comments in constructor RGPDefaultRemoteServer(int port, boolean manageConnection) to find how to enable!");
}
</DeepExtract>
|
RGP-NETTY
|
positive
|
private void setMixedColor(int toColor, float ratio, float alpha) {
float combo = alpha * (1 - ratio);
float scale = alpha * ratio / (1 - combo);
float colorScale = scale * (toColor >>> 24) / (0xff * 0xff);
float[] color = mTextureColor;
color[0] = ((toColor >>> 16) & 0xff) * colorScale;
color[1] = ((toColor >>> 8) & 0xff) * colorScale;
color[2] = (toColor & 0xff) * colorScale;
color[3] = combo;
GL11 gl = mGL;
gl.glTexEnvfv(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_COLOR, mTextureColor, 0);
gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_INTERPOLATE);
gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_COMBINE_ALPHA, GL11.GL_INTERPOLATE);
gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_SRC1_RGB, GL11.GL_CONSTANT);
gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_OPERAND1_RGB, GL11.GL_SRC_COLOR);
gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_SRC1_ALPHA, GL11.GL_CONSTANT);
gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_OPERAND1_ALPHA, GL11.GL_SRC_ALPHA);
gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_SRC2_RGB, GL11.GL_CONSTANT);
gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_OPERAND2_RGB, GL11.GL_SRC_ALPHA);
gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_SRC2_ALPHA, GL11.GL_CONSTANT);
gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_OPERAND2_ALPHA, GL11.GL_SRC_ALPHA);
}
|
<DeepExtract>
float[] color = mTextureColor;
color[0] = ((toColor >>> 16) & 0xff) * colorScale;
color[1] = ((toColor >>> 8) & 0xff) * colorScale;
color[2] = (toColor & 0xff) * colorScale;
color[3] = combo;
</DeepExtract>
|
PhotoMovie
|
positive
|
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
int size = memoizedSerializedSize;
if (size != -1)
return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, type_.getNumber());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, op_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, data_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, info_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, debug_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeUInt32(1, slaveIdx_);
}
for (int i = 0; i < slaveAddress_.size(); i++) {
output.writeBytes(2, slaveAddress_.getByteString(i));
}
for (int i = 0; i < slavePort_.size(); i++) {
output.writeUInt32(3, slavePort_.get(i));
}
getUnknownFields().writeTo(output);
}
|
<DeepExtract>
int size = memoizedSerializedSize;
if (size != -1)
return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, type_.getNumber());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, op_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, data_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, info_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, debug_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
</DeepExtract>
|
Delite
|
positive
|
public void loadShapes(Shape... shapes) {
allShapes.clear();
allShapes.add(shapes);
this.setSize(getWidth(), getHeight());
frame.pack();
}
|
<DeepExtract>
this.setSize(getWidth(), getHeight());
frame.pack();
</DeepExtract>
|
design-pattern-examples
|
positive
|
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_tab_home, container, false);
user = BmobUser.getCurrentUser(context, User.class);
refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.fragment_home_swiperefresh);
refreshLayout.setColorSchemeResources(android.R.color.holo_purple, android.R.color.holo_blue_bright, android.R.color.holo_orange_light, android.R.color.holo_red_light);
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_dynamic);
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
recyclerView.setHasFixedSize(false);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.addItemDecoration(new DividerItemDecoration(context, LinearLayoutManager.VERTICAL));
adapter = new DynamicRecyclerAdapter(getActivity(), this);
recyclerView.setAdapter(adapter);
refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
if (userTimeline != null) {
if (GeneralUtil.isNetworkAvailable(context)) {
refreshDynamic();
getLikes();
} else {
refreshLayout.setRefreshing(false);
Toast.makeText(context, "没有网络连接,请检查网络", Toast.LENGTH_SHORT).show();
}
}
}
});
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE && lastVisibleItemPosition + 1 == adapter.getItemCount()) {
boolean isRefreshing = refreshLayout.isRefreshing();
if (isRefreshing) {
return;
}
if (!isLoading) {
isLoading = true;
adapter.setIsLoadMore(true);
handler.postDelayed(new Runnable() {
@Override
public void run() {
isLoading = false;
loadDynamic();
}
}, 2000);
}
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
lastVisibleItemPosition = linearLayoutManager.findLastVisibleItemPosition();
}
});
if (user != null) {
getLikes();
getUserTimeline();
}
return view;
}
|
<DeepExtract>
refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.fragment_home_swiperefresh);
refreshLayout.setColorSchemeResources(android.R.color.holo_purple, android.R.color.holo_blue_bright, android.R.color.holo_orange_light, android.R.color.holo_red_light);
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_dynamic);
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
recyclerView.setHasFixedSize(false);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.addItemDecoration(new DividerItemDecoration(context, LinearLayoutManager.VERTICAL));
adapter = new DynamicRecyclerAdapter(getActivity(), this);
recyclerView.setAdapter(adapter);
refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
if (userTimeline != null) {
if (GeneralUtil.isNetworkAvailable(context)) {
refreshDynamic();
getLikes();
} else {
refreshLayout.setRefreshing(false);
Toast.makeText(context, "没有网络连接,请检查网络", Toast.LENGTH_SHORT).show();
}
}
}
});
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE && lastVisibleItemPosition + 1 == adapter.getItemCount()) {
boolean isRefreshing = refreshLayout.isRefreshing();
if (isRefreshing) {
return;
}
if (!isLoading) {
isLoading = true;
adapter.setIsLoadMore(true);
handler.postDelayed(new Runnable() {
@Override
public void run() {
isLoading = false;
loadDynamic();
}
}, 2000);
}
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
lastVisibleItemPosition = linearLayoutManager.findLastVisibleItemPosition();
}
});
</DeepExtract>
|
RunBang
|
positive
|
@Test
@Ignore
public void testJavaScriptEngine() throws RuleException {
StringReader sr = new StringReader(scriptRuleText);
Rule rule = RuleBuilder.build(sr, Language.JAVASCRIPT);
RuleEngineProxy proxy = new RuleEngineProxy(rule);
long start = System.currentTimeMillis();
for (int i = 0; i < testCount; i++) {
String rv = proxy.eval("a", 24);
assertThat(rv, is("美女"));
}
System.out.println("rhino" + " : " + (System.currentTimeMillis() - start) + "ms");
}
|
<DeepExtract>
long start = System.currentTimeMillis();
for (int i = 0; i < testCount; i++) {
String rv = proxy.eval("a", 24);
assertThat(rv, is("美女"));
}
System.out.println("rhino" + " : " + (System.currentTimeMillis() - start) + "ms");
</DeepExtract>
|
easyooo-framework
|
positive
|
@Override
public void onChanged(@Nullable ResultType resultType) {
if (!Objects.equals(result.getValue(), Resource.success(resultType))) {
result.setValue(Resource.success(resultType));
}
}
|
<DeepExtract>
if (!Objects.equals(result.getValue(), Resource.success(resultType))) {
result.setValue(Resource.success(resultType));
}
</DeepExtract>
|
premium-android
|
positive
|
public Criteria andStartIndexEqualTo(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "startIndex" + " cannot be null");
}
criteria.add(new Criterion("startIndex =", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "startIndex" + " cannot be null");
}
criteria.add(new Criterion("startIndex =", value));
</DeepExtract>
|
jtt808-simulator
|
positive
|
@Override
public void onClick(View v) {
String name = studentNameEt.getText().toString();
String email = studentEmailEt.getText().toString();
progressDialog.show();
AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
RequestParams params = new RequestParams();
params.put("stname", name);
params.put("email", email);
asyncHttpClient.post("https://murmuring-eyrie-28538.herokuapp.com/add", params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
String response = new String(responseBody);
Gson gson = new Gson();
ResponseModel responseModel = gson.fromJson(response, ResponseModel.class);
StudentModel studentModel = null;
try {
JSONObject jsonObject = new JSONObject(response);
studentModel = gson.fromJson(jsonObject.getJSONObject("data").toString(), StudentModel.class);
} catch (Exception e) {
e.printStackTrace();
}
students.add(studentModel);
adapter.notifyDataSetChanged();
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
String response = new String(responseBody);
Toast.makeText(MainActivity.this, response, Toast.LENGTH_LONG).show();
}
@Override
public void onFinish() {
super.onFinish();
progressDialog.dismiss();
}
});
}
|
<DeepExtract>
progressDialog.show();
AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
RequestParams params = new RequestParams();
params.put("stname", name);
params.put("email", email);
asyncHttpClient.post("https://murmuring-eyrie-28538.herokuapp.com/add", params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
String response = new String(responseBody);
Gson gson = new Gson();
ResponseModel responseModel = gson.fromJson(response, ResponseModel.class);
StudentModel studentModel = null;
try {
JSONObject jsonObject = new JSONObject(response);
studentModel = gson.fromJson(jsonObject.getJSONObject("data").toString(), StudentModel.class);
} catch (Exception e) {
e.printStackTrace();
}
students.add(studentModel);
adapter.notifyDataSetChanged();
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
String response = new String(responseBody);
Toast.makeText(MainActivity.this, response, Toast.LENGTH_LONG).show();
}
@Override
public void onFinish() {
super.onFinish();
progressDialog.dismiss();
}
});
</DeepExtract>
|
ssuet-android-adv-mar17
|
positive
|
@Override
public boolean retainAll(Collection<?> c) {
throw new CasserMappingException("should be never called");
return false;
}
|
<DeepExtract>
throw new CasserMappingException("should be never called");
</DeepExtract>
|
casser
|
positive
|
private void updateGData() {
DecimalFormat dFormat = new DecimalFormat("##0.00");
avarageTextView.setText(dFormat.format(AvaGpa[0]));
GPATextView.setText(dFormat.format(AvaGpa[1]));
sAdapter = new SimpleAdapter(this, gradeList, R.layout.grade_data_item, new String[] { "attr", "subject", "credit", "grade", "time" }, new int[] { R.id.list_grade_attr, R.id.list_grade_subject, R.id.list_grade_credit, R.id.list_grade_grade, R.id.list_grade_time });
xLvCourseList.setAdapter(sAdapter);
xLvCourseList.setDivider(null);
xLvCourseList.stopRefresh();
xLvCourseList.stopLoadMore();
xLvCourseList.setRefreshTime(getTime());
}
|
<DeepExtract>
xLvCourseList.stopRefresh();
xLvCourseList.stopLoadMore();
</DeepExtract>
|
MyStudyHelper
|
positive
|
private Class<T> deriveElementTypeParameter() {
ParameterizedType genericSuperclass = (ParameterizedType) this.getClass().getGenericSuperclass();
Class<T> derivedType;
if (genericSuperclass.getActualTypeArguments()[1] instanceof Class) {
derivedType = (Class) genericSuperclass.getActualTypeArguments()[1];
} else if (genericSuperclass.getActualTypeArguments()[1] instanceof ParameterizedType) {
derivedType = (Class) ((ParameterizedType) genericSuperclass.getActualTypeArguments()[1]).getRawType();
} else {
throw new IllegalArgumentException();
}
return derivedType;
}
|
<DeepExtract>
Class<T> derivedType;
if (genericSuperclass.getActualTypeArguments()[1] instanceof Class) {
derivedType = (Class) genericSuperclass.getActualTypeArguments()[1];
} else if (genericSuperclass.getActualTypeArguments()[1] instanceof ParameterizedType) {
derivedType = (Class) ((ParameterizedType) genericSuperclass.getActualTypeArguments()[1]).getRawType();
} else {
throw new IllegalArgumentException();
}
</DeepExtract>
|
ObjectLayout
|
positive
|
public void switchCamera(Camera camera) {
mCamera = camera;
if (mCamera != null) {
mSupportedPreviewSizes = mCamera.getParameters().getSupportedPreviewSizes();
requestLayout();
}
try {
camera.setPreviewDisplay(mHolder);
} catch (IOException exception) {
Log.e(TAG, "IOException caused by setPreviewDisplay()", exception);
}
Camera.Parameters parameters = camera.getParameters();
parameters.setPreviewSize(mPreviewSize.width, mPreviewSize.height);
requestLayout();
camera.setParameters(parameters);
}
|
<DeepExtract>
mCamera = camera;
if (mCamera != null) {
mSupportedPreviewSizes = mCamera.getParameters().getSupportedPreviewSizes();
requestLayout();
}
</DeepExtract>
|
androidtestdebug
|
positive
|
public void addFileResource(final ResourceContainer container, final String name) {
if (BytecodeViewer.viewer.viewPane1.getSelectedDecompiler() == Decompiler.NONE && BytecodeViewer.viewer.viewPane2.getSelectedDecompiler() == Decompiler.NONE && BytecodeViewer.viewer.viewPane3.getSelectedDecompiler() == Decompiler.NONE) {
BytecodeViewer.showMessage(TranslatedStrings.SUGGESTED_FIX_NO_DECOMPILER_WARNING.toString());
return;
}
BytecodeViewer.viewer.workPane.refreshClass.setEnabled(true);
final String workingName = container.getWorkingName(name);
if (!openedTabs.contains(workingName)) {
addResourceToTab(new FileViewer(container, name), workingName, container.name, name);
} else {
for (int i = 0; i < tabs.getTabCount(); i++) {
ResourceViewer tab = (ResourceViewer) tabs.getComponentAt(i);
if (tab.resource.workingName.equals(workingName)) {
tabs.setSelectedIndex(i);
break;
}
}
}
}
|
<DeepExtract>
if (BytecodeViewer.viewer.viewPane1.getSelectedDecompiler() == Decompiler.NONE && BytecodeViewer.viewer.viewPane2.getSelectedDecompiler() == Decompiler.NONE && BytecodeViewer.viewer.viewPane3.getSelectedDecompiler() == Decompiler.NONE) {
BytecodeViewer.showMessage(TranslatedStrings.SUGGESTED_FIX_NO_DECOMPILER_WARNING.toString());
return;
}
BytecodeViewer.viewer.workPane.refreshClass.setEnabled(true);
final String workingName = container.getWorkingName(name);
if (!openedTabs.contains(workingName)) {
addResourceToTab(new FileViewer(container, name), workingName, container.name, name);
} else {
for (int i = 0; i < tabs.getTabCount(); i++) {
ResourceViewer tab = (ResourceViewer) tabs.getComponentAt(i);
if (tab.resource.workingName.equals(workingName)) {
tabs.setSelectedIndex(i);
break;
}
}
}
</DeepExtract>
|
bytecode-viewer
|
positive
|
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
list = (RecyclerView) view.findViewById(android.R.id.list);
list.setItemAnimator(new DefaultItemAnimator());
int iDisplayWidth = Math.max(320, getResources().getDisplayMetrics().widthPixels);
int spanCount = Math.max(1, iDisplayWidth / 599);
list.setLayoutManager(new GridLayoutManager(activity, spanCount));
progress = (CircularProgressButton) view.findViewById(android.R.id.progress);
empty = view.findViewById(android.R.id.empty);
new AsyncTask<Void, Void, ArrayList<Track>>() {
@Override
protected void onPreExecute() {
super.onPreExecute();
activity.setRefreshing(true);
}
@Override
protected ArrayList<Track> doInBackground(Void... voids) {
return (ArrayList<Track>) FileUtils.read("artistsTracks", activity);
}
@Override
protected void onPostExecute(ArrayList<Track> tracks) {
super.onPostExecute(tracks);
activity.setRefreshing(false);
OnTaskResult(tracks);
}
}.execute();
}
|
<DeepExtract>
int iDisplayWidth = Math.max(320, getResources().getDisplayMetrics().widthPixels);
int spanCount = Math.max(1, iDisplayWidth / 599);
list.setLayoutManager(new GridLayoutManager(activity, spanCount));
</DeepExtract>
|
IdealMedia
|
positive
|
@Override
public Object put(String key, Object value) {
Objects.requireNonNull(key, "null key");
int pos = key.indexOf(':');
if (pos <= 0 || pos >= key.length() - 1)
throw new IllegalArgumentException("invalid key, must be modid:subkey");
Objects.requireNonNull(value, "null value");
synchronized (this) {
Object prev = values.put(key, value);
if (prev != null)
return prev;
pending = pendingMap.remove(key);
}
if (pending != null)
invokePending(key, value, pending);
return null;
}
|
<DeepExtract>
Objects.requireNonNull(key, "null key");
int pos = key.indexOf(':');
if (pos <= 0 || pos >= key.length() - 1)
throw new IllegalArgumentException("invalid key, must be modid:subkey");
</DeepExtract>
|
fabric-loader
|
positive
|
@Test
public void shouldRejectRequestVoteWithOlderTerm() throws StorageException {
algorithm.becomeFollower(3, null);
assertThatTermAndCommitIndexHaveValues(3, 0);
assertThat(algorithm.getRole(), equalTo(FOLLOWER));
assertThat(algorithm.getLeader(), equalTo(null));
if (false) {
verify(listener).onLeadershipChange(null);
}
algorithm.onRequestVote(S_01, 2, 1, 1);
assertThat(store.getCurrentTerm(), equalTo(3));
assertThat(store.getVotedFor(3), equalTo(null));
assertThat(algorithm.getRole(), equalTo(FOLLOWER));
assertThat(algorithm.getLeader(), nullValue());
RequestVoteReply requestVoteReply = sender.nextAndRemove(RequestVoteReply.class);
assertThat(requestVoteReply.server, equalTo(S_01));
assertThat(requestVoteReply.term, equalTo(3));
assertThat(requestVoteReply.voteGranted, equalTo(false));
assertThat(sender.getCalls().toString(), sender.hasNext(), equalTo(false));
UnitTestLogEntries.assertThatLogContainsOnlySentinel(log);
assertThat(store.getCurrentTerm(), equalTo(3));
assertThat(store.getCommitIndex(), equalTo(0));
}
|
<DeepExtract>
assertThatTermAndCommitIndexHaveValues(3, 0);
assertThat(algorithm.getRole(), equalTo(FOLLOWER));
assertThat(algorithm.getLeader(), equalTo(null));
if (false) {
verify(listener).onLeadershipChange(null);
}
</DeepExtract>
<DeepExtract>
assertThat(store.getCurrentTerm(), equalTo(3));
assertThat(store.getVotedFor(3), equalTo(null));
assertThat(algorithm.getRole(), equalTo(FOLLOWER));
assertThat(algorithm.getLeader(), nullValue());
</DeepExtract>
<DeepExtract>
assertThat(requestVoteReply.server, equalTo(S_01));
assertThat(requestVoteReply.term, equalTo(3));
assertThat(requestVoteReply.voteGranted, equalTo(false));
</DeepExtract>
<DeepExtract>
assertThat(sender.getCalls().toString(), sender.hasNext(), equalTo(false));
</DeepExtract>
<DeepExtract>
UnitTestLogEntries.assertThatLogContainsOnlySentinel(log);
</DeepExtract>
<DeepExtract>
assertThat(store.getCurrentTerm(), equalTo(3));
assertThat(store.getCommitIndex(), equalTo(0));
</DeepExtract>
|
libraft
|
positive
|
@Test
public void testReferenceTypeFieldsClassBufferPackConvert() throws Exception {
super.testReferenceTypeFieldsClass();
}
|
<DeepExtract>
super.testReferenceTypeFieldsClass();
</DeepExtract>
|
msgpack-java
|
positive
|
public List<Status> favorites(int page) throws WeiboException {
return Status.constructStatuses(get(getBaseURL() + "favorites.json", "page", String.valueOf(page), true));
}
|
<DeepExtract>
return Status.constructStatuses(get(getBaseURL() + "favorites.json", "page", String.valueOf(page), true));
</DeepExtract>
|
demo-android-login
|
positive
|
public static File copyToTempFile(InputStream in) throws IOException {
File file = File.createTempFile("nx-", ".tmp");
file.deleteOnExit();
FileOutputStream out = new FileOutputStream(file);
try {
copy(in, out);
} finally {
out.close();
if (true) {
in.close();
}
}
return file;
}
|
<DeepExtract>
FileOutputStream out = new FileOutputStream(file);
try {
copy(in, out);
} finally {
out.close();
if (true) {
in.close();
}
}
</DeepExtract>
|
nuxeo-java-client
|
positive
|
public static Duration of(long amount, PeriodUnit unit) {
Jdk7Methods.Objects_requireNonNull(unit, "unit");
if (unit == DAYS) {
return plus(Jdk8Methods.safeMultiply(amount, SECONDS_PER_DAY), 0);
}
if (unit.isDurationEstimated()) {
throw new DateTimeException("Unit must not have an estimated duration");
}
if (amount == 0) {
return this;
}
if (unit instanceof ChronoUnit) {
switch((ChronoUnit) unit) {
case NANOS:
return plusNanos(amount);
case MICROS:
return plusSeconds((amount / (1000000L * 1000)) * 1000).plusNanos((amount % (1000000L * 1000)) * 1000);
case MILLIS:
return plusMillis(amount);
case SECONDS:
return plusSeconds(amount);
}
return plusSeconds(Jdk8Methods.safeMultiply(unit.getDuration().seconds, amount));
}
Duration duration = unit.getDuration().multipliedBy(amount);
return plusSeconds(duration.getSeconds()).plusNanos(duration.getNano());
}
|
<DeepExtract>
Jdk7Methods.Objects_requireNonNull(unit, "unit");
if (unit == DAYS) {
return plus(Jdk8Methods.safeMultiply(amount, SECONDS_PER_DAY), 0);
}
if (unit.isDurationEstimated()) {
throw new DateTimeException("Unit must not have an estimated duration");
}
if (amount == 0) {
return this;
}
if (unit instanceof ChronoUnit) {
switch((ChronoUnit) unit) {
case NANOS:
return plusNanos(amount);
case MICROS:
return plusSeconds((amount / (1000000L * 1000)) * 1000).plusNanos((amount % (1000000L * 1000)) * 1000);
case MILLIS:
return plusMillis(amount);
case SECONDS:
return plusSeconds(amount);
}
return plusSeconds(Jdk8Methods.safeMultiply(unit.getDuration().seconds, amount));
}
Duration duration = unit.getDuration().multipliedBy(amount);
return plusSeconds(duration.getSeconds()).plusNanos(duration.getNano());
</DeepExtract>
|
gwt-time
|
positive
|
End of preview. Expand
in Data Studio
- Downloads last month
- 18