before
stringlengths 12
3.76M
| after
stringlengths 37
3.84M
| repo
stringlengths 1
56
| type
stringclasses 1
value |
|---|---|---|---|
public Criteria andUserIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "user" + " cannot be null");
}
criteria.add(new Criterion("user in", values));
return (Criteria) this;
}
|
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "user" + " cannot be null");
}
criteria.add(new Criterion("user in", values));
</DeepExtract>
|
Hospital
|
positive
|
private int parseAction() {
Integer result;
if (readIf("CASCADE")) {
result = ConstraintReferential.CASCADE;
} else if (readIf("RESTRICT")) {
result = ConstraintReferential.RESTRICT;
} else {
result = null;
}
if (result != null) {
return result;
}
if (readIf("NO")) {
read("ACTION");
return ConstraintReferential.RESTRICT;
}
if (currentTokenQuoted || !equalsToken("SET", currentToken)) {
addExpected("SET");
throw getSyntaxError();
}
read();
if (readIf("NULL")) {
return ConstraintReferential.SET_NULL;
}
if (currentTokenQuoted || !equalsToken("DEFAULT", currentToken)) {
addExpected("DEFAULT");
throw getSyntaxError();
}
read();
return ConstraintReferential.SET_DEFAULT;
}
|
<DeepExtract>
Integer result;
if (readIf("CASCADE")) {
result = ConstraintReferential.CASCADE;
} else if (readIf("RESTRICT")) {
result = ConstraintReferential.RESTRICT;
} else {
result = null;
}
</DeepExtract>
<DeepExtract>
if (currentTokenQuoted || !equalsToken("SET", currentToken)) {
addExpected("SET");
throw getSyntaxError();
}
read();
</DeepExtract>
<DeepExtract>
if (currentTokenQuoted || !equalsToken("DEFAULT", currentToken)) {
addExpected("DEFAULT");
throw getSyntaxError();
}
read();
</DeepExtract>
|
Lealone-Plugins
|
positive
|
public static void copyProperty(Object srcBean, Object destBean, String[] pros) throws InvocationTargetException, IllegalAccessException {
try {
BeanFactory.add(srcBean);
} catch (IntrospectionException | ClassNotFoundException e) {
e.printStackTrace();
}
try {
BeanFactory.add(destBean);
} catch (IntrospectionException | ClassNotFoundException e) {
e.printStackTrace();
}
if (CheckUtil.valid(pros)) {
for (String s : pros) {
Object value = readMethod(srcBean, getReadMethod(srcBean, s));
writeMethod(destBean, getWriteMethod(destBean, s), value);
}
}
}
|
<DeepExtract>
try {
BeanFactory.add(srcBean);
} catch (IntrospectionException | ClassNotFoundException e) {
e.printStackTrace();
}
</DeepExtract>
<DeepExtract>
try {
BeanFactory.add(destBean);
} catch (IntrospectionException | ClassNotFoundException e) {
e.printStackTrace();
}
</DeepExtract>
|
opslabJutil
|
positive
|
public Criteria andToidIn(List<Long> values) {
if (values == null) {
throw new RuntimeException("Value for " + "toid" + " cannot be null");
}
criteria.add(new Criterion("toId in", values));
return (Criteria) this;
}
|
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "toid" + " cannot be null");
}
criteria.add(new Criterion("toId in", values));
</DeepExtract>
|
webim
|
positive
|
@Override
public int reasonOffset() {
if (buffer() == null) {
throw new IllegalStateException("Flyweight has not been wrapped/populated yet with a ByteBuffer.");
}
int payloadLength = limit() - offset();
if (payloadLength > 2) {
return offset() + 2;
}
return -1;
}
|
<DeepExtract>
if (buffer() == null) {
throw new IllegalStateException("Flyweight has not been wrapped/populated yet with a ByteBuffer.");
}
</DeepExtract>
|
netx
|
positive
|
public void writeVarInt(int input) {
while ((input & -128) != 0) {
this.writeByte(input & 127 | 128);
input >>>= 7;
}
return byteBuf.writeByte(input);
}
|
<DeepExtract>
return byteBuf.writeByte(input);
</DeepExtract>
|
BetterProxy
|
positive
|
private void setPlugin(String name, CmdIn cmd) {
Plugin plugin = pluginService.get(name);
for (Input input : plugin.getInputs()) {
String value = cmd.getInputs().get(input.getName());
if (!StringHelper.hasValue(value) && input.hasDefaultValue()) {
cmd.getInputs().put(input.getName(), input.getValue());
continue;
}
if (!input.verify(value)) {
throw new ArgumentException("The illegal input {0} for plugin {1}", input.getName(), plugin.getName());
}
}
cmd.setPlugin(name);
cmd.setAllowFailure(plugin.isAllowFailure());
cmd.addEnvFilters(plugin.getExports());
PluginBody body = plugin.getBody();
if (body instanceof ScriptBody) {
String script = ((ScriptBody) body).getScript();
cmd.addScript(script);
return;
}
if (body instanceof ParentBody) {
ParentBody parentData = (ParentBody) body;
Plugin parent = pluginService.get(parentData.getName());
if (!(parent.getBody() instanceof ScriptBody)) {
throw new NotAvailableException("Script not found on parent plugin");
}
String scriptFromParent = ((ScriptBody) parent.getBody()).getScript();
cmd.addInputs(parentData.getEnvs());
cmd.addScript(scriptFromParent);
verifyPluginInput(cmd.getInputs(), parent);
}
}
|
<DeepExtract>
for (Input input : plugin.getInputs()) {
String value = cmd.getInputs().get(input.getName());
if (!StringHelper.hasValue(value) && input.hasDefaultValue()) {
cmd.getInputs().put(input.getName(), input.getValue());
continue;
}
if (!input.verify(value)) {
throw new ArgumentException("The illegal input {0} for plugin {1}", input.getName(), plugin.getName());
}
}
</DeepExtract>
|
flow-platform-x
|
positive
|
public void putGJString3(String s) {
writeByte(0, offset++);
checkCapacityPosition(getOffset() + s.length() + 1);
System.arraycopy(s.getBytes(), 0, getBuffer(), getOffset(), s.length());
setOffset(getOffset() + s.length());
writeByte(0);
writeByte(0, offset++);
}
|
<DeepExtract>
writeByte(0, offset++);
</DeepExtract>
<DeepExtract>
checkCapacityPosition(getOffset() + s.length() + 1);
System.arraycopy(s.getBytes(), 0, getBuffer(), getOffset(), s.length());
setOffset(getOffset() + s.length());
writeByte(0);
</DeepExtract>
<DeepExtract>
writeByte(0, offset++);
</DeepExtract>
|
Interface-tool
|
positive
|
public static void main(String[] args) {
Node head1 = new Node(1);
head1.next = new Node(2);
head1.next.next = new Node(3);
head1.next.next.next = new Node(4);
head1.next.next.next.next = new Node(5);
head1.next.next.next.next.next = head1;
if (head1 == null) {
return;
}
System.out.print("Circular List: " + head1.value + " ");
Node cur = head1.next;
while (cur != head1) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head1.value);
if (head1 == null || head1.next == head1 || 3 < 1) {
head1 = head1;
}
Node last = head1;
while (last.next != head1) {
last = last.next;
}
int count = 0;
while (head1 != last) {
if (++count == 3) {
last.next = head1.next;
count = 0;
} else {
last = last.next;
}
head1 = last.next;
}
return head1;
if (head1 == null) {
return;
}
System.out.print("Circular List: " + head1.value + " ");
Node cur = head1.next;
while (cur != head1) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head1.value);
Node head2 = new Node(1);
head2.next = new Node(2);
head2.next.next = new Node(3);
head2.next.next.next = new Node(4);
head2.next.next.next.next = new Node(5);
head2.next.next.next.next.next = head2;
if (head2 == null) {
return;
}
System.out.print("Circular List: " + head2.value + " ");
Node cur = head2.next;
while (cur != head2) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head2.value);
if (head2 == null || head2.next == head2 || 3 < 1) {
head2 = head2;
}
Node cur = head2.next;
int tmp = 1;
while (cur != head2) {
tmp++;
cur = cur.next;
}
tmp = getLive(tmp, 3);
while (--tmp != 0) {
head2 = head2.next;
}
head2.next = head2;
return head2;
if (head2 == null) {
return;
}
System.out.print("Circular List: " + head2.value + " ");
Node cur = head2.next;
while (cur != head2) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head2.value);
}
|
<DeepExtract>
if (head1 == null) {
return;
}
System.out.print("Circular List: " + head1.value + " ");
Node cur = head1.next;
while (cur != head1) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head1.value);
</DeepExtract>
<DeepExtract>
if (head1 == null || head1.next == head1 || 3 < 1) {
head1 = head1;
}
Node last = head1;
while (last.next != head1) {
last = last.next;
}
int count = 0;
while (head1 != last) {
if (++count == 3) {
last.next = head1.next;
count = 0;
} else {
last = last.next;
}
head1 = last.next;
}
return head1;
</DeepExtract>
<DeepExtract>
if (head1 == null) {
return;
}
System.out.print("Circular List: " + head1.value + " ");
Node cur = head1.next;
while (cur != head1) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head1.value);
</DeepExtract>
<DeepExtract>
if (head2 == null) {
return;
}
System.out.print("Circular List: " + head2.value + " ");
Node cur = head2.next;
while (cur != head2) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head2.value);
</DeepExtract>
<DeepExtract>
if (head2 == null || head2.next == head2 || 3 < 1) {
head2 = head2;
}
Node cur = head2.next;
int tmp = 1;
while (cur != head2) {
tmp++;
cur = cur.next;
}
tmp = getLive(tmp, 3);
while (--tmp != 0) {
head2 = head2.next;
}
head2.next = head2;
return head2;
</DeepExtract>
<DeepExtract>
if (head2 == null) {
return;
}
System.out.print("Circular List: " + head2.value + " ");
Node cur = head2.next;
while (cur != head2) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head2.value);
</DeepExtract>
|
ZuoChengyun
|
positive
|
@Override
public void onDrawing(Canvas c) {
super.onDrawing(c);
final int currentStack = ((GameEngineTwentyInARow) mGameEngine).getCurrentStack();
final String currentStackStr = String.valueOf(currentStack);
final int stackLength = currentStackStr.length();
final int radius = Math.max(mScreenWidth / (12 - stackLength), mScreenHeight / (12 - stackLength));
useTransparentBlackPainter();
c.drawOval(new RectF(-radius, mScreenHeight - radius, radius, mScreenHeight + radius), mPaint);
useWhitePainter();
mPaint.getTextBounds(currentStackStr, 0, currentStackStr.length(), mBounds);
c.drawText(currentStackStr, mBounds.width() / 2 + radius / 4, mScreenHeight - radius / 4, mPaint);
}
|
<DeepExtract>
final int currentStack = ((GameEngineTwentyInARow) mGameEngine).getCurrentStack();
final String currentStackStr = String.valueOf(currentStack);
final int stackLength = currentStackStr.length();
final int radius = Math.max(mScreenWidth / (12 - stackLength), mScreenHeight / (12 - stackLength));
useTransparentBlackPainter();
c.drawOval(new RectF(-radius, mScreenHeight - radius, radius, mScreenHeight + radius), mPaint);
useWhitePainter();
mPaint.getTextBounds(currentStackStr, 0, currentStackStr.length(), mBounds);
c.drawText(currentStackStr, mBounds.width() / 2 + radius / 4, mScreenHeight - radius / 4, mPaint);
</DeepExtract>
|
ChaseWhisplyProject
|
positive
|
public void showErrorView(String message) {
if (!TextUtils.isEmpty(message)) {
BaseVaryViewSetter.setText(mErrorView, R.id.error_tips_show, message);
}
mViewHelper.showCaseLayout(mErrorView);
if (mLoadingProgress != null && mLoadingProgress.isSpinning()) {
mLoadingProgress.stopSpinning();
}
}
|
<DeepExtract>
if (mLoadingProgress != null && mLoadingProgress.isSpinning()) {
mLoadingProgress.stopSpinning();
}
</DeepExtract>
|
RAD
|
positive
|
public static Integer[] sort(Integer[] a, Integer length) {
if (length - 0 <= 1) {
return a;
} else {
}
int left_start = 0;
int left_end = (0 + length) / 2;
int right_start = left_end;
int right_end = length;
mergesort_r(left_start, left_end, a);
mergesort_r(right_start, right_end, a);
merge(a, left_start, left_end, right_start, right_end);
return a;
return a;
}
|
<DeepExtract>
if (length - 0 <= 1) {
return a;
} else {
}
int left_start = 0;
int left_end = (0 + length) / 2;
int right_start = left_end;
int right_end = length;
mergesort_r(left_start, left_end, a);
mergesort_r(right_start, right_end, a);
merge(a, left_start, left_end, right_start, right_end);
return a;
</DeepExtract>
|
gin
|
positive
|
private void addRecord(int index, org.tosl.coronawarncompanion.gmsreadout.ContactRecordsProtos.ScanRecord value) {
value.getClass();
com.google.protobuf.Internal.ProtobufList<org.tosl.coronawarncompanion.gmsreadout.ContactRecordsProtos.ScanRecord> tmp = record_;
if (!tmp.isModifiable()) {
record_ = com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
record_.add(index, value);
}
|
<DeepExtract>
com.google.protobuf.Internal.ProtobufList<org.tosl.coronawarncompanion.gmsreadout.ContactRecordsProtos.ScanRecord> tmp = record_;
if (!tmp.isModifiable()) {
record_ = com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
</DeepExtract>
|
corona-warn-companion-android
|
positive
|
@Override
public void onServicesDiscoveredBase(BleDevice bleDevice, BluetoothGatt gatt, int status) {
if (Looper.myLooper() != Looper.getMainLooper()) {
mHandler.post(() -> onServicesDiscovered(bleDevice, gatt, status));
} else {
() -> onServicesDiscovered(bleDevice, gatt, status).run();
}
}
|
<DeepExtract>
if (Looper.myLooper() != Looper.getMainLooper()) {
mHandler.post(() -> onServicesDiscovered(bleDevice, gatt, status));
} else {
() -> onServicesDiscovered(bleDevice, gatt, status).run();
}
</DeepExtract>
|
BLELib
|
positive
|
void WriteEndMarker(int posState) throws IOException {
if (!_writeEndMark)
return;
if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumLowLenSymbols) {
_isMatch.Encode(_choice, 0, 0);
_lowCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState);
} else {
(_state << Base.kNumPosStatesBitsMax) + posState -= Base.kNumLowLenSymbols;
_isMatch.Encode(_choice, 0, 1);
if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumMidLenSymbols) {
_isMatch.Encode(_choice, 1, 0);
_midCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState);
} else {
_isMatch.Encode(_choice, 1, 1);
_highCoder.Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState - Base.kNumMidLenSymbols);
}
}
if (_state < Base.kNumLowLenSymbols) {
_isRep.Encode(_choice, 0, 0);
_lowCoder[0].Encode(_isRep, _state);
} else {
_state -= Base.kNumLowLenSymbols;
_isRep.Encode(_choice, 0, 1);
if (_state < Base.kNumMidLenSymbols) {
_isRep.Encode(_choice, 1, 0);
_midCoder[0].Encode(_isRep, _state);
} else {
_isRep.Encode(_choice, 1, 1);
_highCoder.Encode(_isRep, _state - Base.kNumMidLenSymbols);
}
}
_state = Base.StateUpdateMatch(_state);
int len = Base.kMatchMinLen;
if (len - Base.kMatchMinLen < Base.kNumLowLenSymbols) {
_rangeEncoder.Encode(_choice, 0, 0);
_lowCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen);
} else {
len - Base.kMatchMinLen -= Base.kNumLowLenSymbols;
_rangeEncoder.Encode(_choice, 0, 1);
if (len - Base.kMatchMinLen < Base.kNumMidLenSymbols) {
_rangeEncoder.Encode(_choice, 1, 0);
_midCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen);
} else {
_rangeEncoder.Encode(_choice, 1, 1);
_highCoder.Encode(_rangeEncoder, len - Base.kMatchMinLen - Base.kNumMidLenSymbols);
}
}
int posSlot = (1 << Base.kNumPosSlotBits) - 1;
int lenToPosState = Base.GetLenToPosState(len);
int context = 1;
for (int i = 7; i >= 0; i--) {
int bit = ((posSlot >> i) & 1);
_rangeEncoder.Encode(m_Encoders, context, bit);
context = (context << 1) | bit;
}
int footerBits = 30;
int posReduced = (1 << footerBits) - 1;
_rangeEncoder.EncodeDirectBits(posReduced >> Base.kNumAlignBits, footerBits - Base.kNumAlignBits);
_posAlignEncoder.ReverseEncode(_rangeEncoder, posReduced & Base.kAlignMask);
}
|
<DeepExtract>
if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumLowLenSymbols) {
_isMatch.Encode(_choice, 0, 0);
_lowCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState);
} else {
(_state << Base.kNumPosStatesBitsMax) + posState -= Base.kNumLowLenSymbols;
_isMatch.Encode(_choice, 0, 1);
if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumMidLenSymbols) {
_isMatch.Encode(_choice, 1, 0);
_midCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState);
} else {
_isMatch.Encode(_choice, 1, 1);
_highCoder.Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState - Base.kNumMidLenSymbols);
}
}
</DeepExtract>
<DeepExtract>
if (_state < Base.kNumLowLenSymbols) {
_isRep.Encode(_choice, 0, 0);
_lowCoder[0].Encode(_isRep, _state);
} else {
_state -= Base.kNumLowLenSymbols;
_isRep.Encode(_choice, 0, 1);
if (_state < Base.kNumMidLenSymbols) {
_isRep.Encode(_choice, 1, 0);
_midCoder[0].Encode(_isRep, _state);
} else {
_isRep.Encode(_choice, 1, 1);
_highCoder.Encode(_isRep, _state - Base.kNumMidLenSymbols);
}
}
</DeepExtract>
<DeepExtract>
if (len - Base.kMatchMinLen < Base.kNumLowLenSymbols) {
_rangeEncoder.Encode(_choice, 0, 0);
_lowCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen);
} else {
len - Base.kMatchMinLen -= Base.kNumLowLenSymbols;
_rangeEncoder.Encode(_choice, 0, 1);
if (len - Base.kMatchMinLen < Base.kNumMidLenSymbols) {
_rangeEncoder.Encode(_choice, 1, 0);
_midCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen);
} else {
_rangeEncoder.Encode(_choice, 1, 1);
_highCoder.Encode(_rangeEncoder, len - Base.kMatchMinLen - Base.kNumMidLenSymbols);
}
}
</DeepExtract>
<DeepExtract>
int context = 1;
for (int i = 7; i >= 0; i--) {
int bit = ((posSlot >> i) & 1);
_rangeEncoder.Encode(m_Encoders, context, bit);
context = (context << 1) | bit;
}
</DeepExtract>
|
jarchive
|
positive
|
@Override
public void onPrepared() {
mCurrentPlayState = STATE_PREPARED;
if (mVideoController != null)
mVideoController.setPlayState(STATE_PREPARED);
if (mOnVideoViewStateChangeListeners != null) {
for (int i = 0, z = mOnVideoViewStateChangeListeners.size(); i < z; i++) {
OnVideoViewStateChangeListener listener = mOnVideoViewStateChangeListeners.get(i);
if (listener != null) {
listener.onPlayStateChanged(STATE_PREPARED);
}
}
}
if (mCurrentPosition > 0) {
seekTo(mCurrentPosition);
}
}
|
<DeepExtract>
mCurrentPlayState = STATE_PREPARED;
if (mVideoController != null)
mVideoController.setPlayState(STATE_PREPARED);
if (mOnVideoViewStateChangeListeners != null) {
for (int i = 0, z = mOnVideoViewStateChangeListeners.size(); i < z; i++) {
OnVideoViewStateChangeListener listener = mOnVideoViewStateChangeListeners.get(i);
if (listener != null) {
listener.onPlayStateChanged(STATE_PREPARED);
}
}
}
</DeepExtract>
|
dkplayer
|
positive
|
public void release() {
if (null != mediaPlayer) {
if (mediaPlayer.isPlaying()) {
mediaPlayer.stop();
}
mediaPlayer.reset();
}
if (null != mediaPlayer) {
mediaPlayer.release();
mediaPlayer = null;
}
}
|
<DeepExtract>
if (null != mediaPlayer) {
if (mediaPlayer.isPlaying()) {
mediaPlayer.stop();
}
mediaPlayer.reset();
}
</DeepExtract>
|
bigapple
|
positive
|
public static int width(Component component) {
Dimension dim = component.minimumSize();
return dim.width;
}
|
<DeepExtract>
Dimension dim = component.minimumSize();
return dim.width;
</DeepExtract>
|
javancss
|
positive
|
@Test
public void testReadLine() {
equipConsoleIOProviderWithIputStream(new ByteArrayInputStream("foo\n".getBytes()));
String read = consoleInput.readLine();
assertThat(read).isEqualTo("foo");
}
|
<DeepExtract>
equipConsoleIOProviderWithIputStream(new ByteArrayInputStream("foo\n".getBytes()));
</DeepExtract>
|
gonsole
|
positive
|
@Override
protected void draw(Graphics g) {
if (bFirstDraw) {
bFirstDraw = false;
Dimension size = this.getSize();
_origin.x = size.width / 2;
_origin.y = size.height / 2;
}
final Dimension originPointerSize = new Dimension(26, 3);
super.draw(g);
g.setColor(Color.LIGHT_GRAY);
g.drawLine(0, _origin.y, getSize().width, _origin.y);
g.drawLine(_origin.x, 0, _origin.x, getSize().height);
g.setColor(Color.RED);
int x = _origin.x;
if (x < 0)
x = 0;
else if (x >= getSize().width)
x = getSize().width - originPointerSize.height;
int y = _origin.y;
if (y < 0)
y = 0;
else if (y >= getSize().height)
y = getSize().height - originPointerSize.height;
if (_origin.y <= 0 || _origin.y >= getSize().height) {
g.fillRect(x - (originPointerSize.width / 2), y, originPointerSize.width, originPointerSize.height);
}
if (_origin.x <= 0 || _origin.x >= getSize().width) {
g.fillRect(x, y - (originPointerSize.width / 2), originPointerSize.height, originPointerSize.width);
}
if (onionSkins == null)
return;
float alpha = 1.0f;
for (int i = 0; i < onionSkins.length; ++i) {
alpha /= 3.0f;
AnimationCell cell = onionSkins[i];
ArrayList<GraphicObject> graphics = cell.getGraphicList();
for (int j = 0; j < graphics.size(); ++j) {
GraphicObject graphic = graphics.get(j);
this.drawGraphicRotated(graphic, g, _origin, _zoom, alpha);
}
}
}
|
<DeepExtract>
g.setColor(Color.LIGHT_GRAY);
g.drawLine(0, _origin.y, getSize().width, _origin.y);
g.drawLine(_origin.x, 0, _origin.x, getSize().height);
</DeepExtract>
<DeepExtract>
g.setColor(Color.RED);
int x = _origin.x;
if (x < 0)
x = 0;
else if (x >= getSize().width)
x = getSize().width - originPointerSize.height;
int y = _origin.y;
if (y < 0)
y = 0;
else if (y >= getSize().height)
y = getSize().height - originPointerSize.height;
if (_origin.y <= 0 || _origin.y >= getSize().height) {
g.fillRect(x - (originPointerSize.width / 2), y, originPointerSize.width, originPointerSize.height);
}
if (_origin.x <= 0 || _origin.x >= getSize().width) {
g.fillRect(x, y - (originPointerSize.width / 2), originPointerSize.height, originPointerSize.width);
}
</DeepExtract>
<DeepExtract>
if (onionSkins == null)
return;
float alpha = 1.0f;
for (int i = 0; i < onionSkins.length; ++i) {
alpha /= 3.0f;
AnimationCell cell = onionSkins[i];
ArrayList<GraphicObject> graphics = cell.getGraphicList();
for (int j = 0; j < graphics.size(); ++j) {
GraphicObject graphic = graphics.get(j);
this.drawGraphicRotated(graphic, g, _origin, _zoom, alpha);
}
}
</DeepExtract>
|
darkFunction-Editor
|
positive
|
public Integer negate(Integer x) {
Objects.requireNonNull(x);
int y = x.intValue();
if (y < 0 || y >= size)
throw new IllegalArgumentException("Not an element of this field: " + y);
return y;
}
|
<DeepExtract>
Objects.requireNonNull(x);
int y = x.intValue();
if (y < 0 || y >= size)
throw new IllegalArgumentException("Not an element of this field: " + y);
return y;
</DeepExtract>
|
Nayuki-web-published-code
|
positive
|
private void removeSegment(int i, int j) {
int[] segments = m_segments[i];
int jmax;
for (int i = segments.length - 1; i >= 0; i--) {
if (segments[i] != NoneSegment) {
jmax = i;
}
}
throw new Error("Invalid segments state");
for (int n = j; n < jmax; n++) {
segments[n] = segments[n + 1];
}
segments[jmax] = NoneSegment;
if (j == 0) {
m_ymin[i]++;
}
}
|
<DeepExtract>
int jmax;
for (int i = segments.length - 1; i >= 0; i--) {
if (segments[i] != NoneSegment) {
jmax = i;
}
}
throw new Error("Invalid segments state");
</DeepExtract>
|
CubicChunks
|
positive
|
public void actionPerformed(ActionEvent e) {
try {
boolean printed = editor.print();
} catch (PrinterException ex) {
logger.log(Level.SEVERE, "PrinterException when trying to print StoryMap.", ex);
}
}
|
<DeepExtract>
try {
boolean printed = editor.print();
} catch (PrinterException ex) {
logger.log(Level.SEVERE, "PrinterException when trying to print StoryMap.", ex);
}
</DeepExtract>
|
storymaps
|
positive
|
@Override
public ResponseFuture<InputStream> asInputStream() {
return execute(new InputStreamParser(), null);
}
|
<DeepExtract>
return execute(new InputStreamParser(), null);
</DeepExtract>
|
ion
|
positive
|
private String parsePattern(String grokPattern) {
byte[] grokPatternBytes = grokPattern.getBytes(StandardCharsets.UTF_8);
Matcher matcher = GROK_PATTERN_REGEX.matcher(grokPatternBytes);
int result = matcher.search(0, grokPatternBytes.length, Option.NONE);
boolean matchNotFound = result == -1;
if (matchNotFound) {
return grokPattern;
}
Region region = matcher.getEagerRegion();
String patternName;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(PATTERN_GROUP.getBytes(StandardCharsets.UTF_8), 0, PATTERN_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(PATTERN_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
patternName = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
patternName = null;
}
String subName;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(SUBNAME_GROUP.getBytes(StandardCharsets.UTF_8), 0, SUBNAME_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(SUBNAME_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
subName = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
subName = null;
}
String definition;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(DEFINITION_GROUP.getBytes(StandardCharsets.UTF_8), 0, DEFINITION_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(DEFINITION_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
definition = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
definition = null;
}
if (isNotEmpty(definition)) {
addPattern(patternName, definition);
}
String pattern = patternBank.get(patternName);
if (pattern == null) {
throw new RuntimeException(String.format("failed to create grok, unknown " + Grok.PATTERN_GROUP + " [%s]", grokPattern));
}
if (namedOnly && isNotEmpty(subName)) {
grokPart = String.format("(?<%s>%s)", subName, pattern);
} else if (!namedOnly) {
grokPart = String.format("(?<%s>%s)", patternName + String.valueOf(result), pattern);
} else {
grokPart = String.format("(?:%s)", pattern);
}
String start;
try {
start = new String(grokPatternBytes, 0, result - 0, StandardCharsets.UTF_8);
} catch (StringIndexOutOfBoundsException e) {
start = null;
}
String rest;
try {
rest = new String(grokPatternBytes, region.end[0], grokPatternBytes.length - region.end[0], StandardCharsets.UTF_8);
} catch (StringIndexOutOfBoundsException e) {
rest = null;
}
return start + parsePattern(grokPart + rest);
}
|
<DeepExtract>
String patternName;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(PATTERN_GROUP.getBytes(StandardCharsets.UTF_8), 0, PATTERN_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(PATTERN_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
patternName = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
patternName = null;
}
</DeepExtract>
<DeepExtract>
String subName;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(SUBNAME_GROUP.getBytes(StandardCharsets.UTF_8), 0, SUBNAME_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(SUBNAME_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
subName = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
subName = null;
}
</DeepExtract>
<DeepExtract>
String definition;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(DEFINITION_GROUP.getBytes(StandardCharsets.UTF_8), 0, DEFINITION_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(DEFINITION_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
definition = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
definition = null;
}
</DeepExtract>
<DeepExtract>
String start;
try {
start = new String(grokPatternBytes, 0, result - 0, StandardCharsets.UTF_8);
} catch (StringIndexOutOfBoundsException e) {
start = null;
}
</DeepExtract>
<DeepExtract>
String rest;
try {
rest = new String(grokPatternBytes, region.end[0], grokPatternBytes.length - region.end[0], StandardCharsets.UTF_8);
} catch (StringIndexOutOfBoundsException e) {
rest = null;
}
</DeepExtract>
|
sawmill
|
positive
|
public void start() {
_state.start();
_state = State.STATE_LOGGING;
}
|
<DeepExtract>
_state = State.STATE_LOGGING;
</DeepExtract>
|
006921
|
positive
|
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) {
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) {
Log.e(TAG, "Purchase verification failed: missing data.");
return false;
}
PublicKey key;
try {
byte[] decodedKey = Base64.decode(base64PublicKey);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
key = keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeySpecException e) {
Log.e(TAG, "Invalid key specification.");
throw new IllegalArgumentException(e);
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
throw new IllegalArgumentException(e);
}
Signature sig;
try {
sig = Signature.getInstance(SIGNATURE_ALGORITHM);
sig.initVerify(key);
sig.update(signedData.getBytes());
if (!sig.verify(Base64.decode(signature))) {
Log.e(TAG, "Signature verification failed.");
return false;
}
return true;
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, "NoSuchAlgorithmException.");
} catch (InvalidKeyException e) {
Log.e(TAG, "Invalid key specification.");
} catch (SignatureException e) {
Log.e(TAG, "Signature exception.");
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
}
return false;
}
|
<DeepExtract>
PublicKey key;
try {
byte[] decodedKey = Base64.decode(base64PublicKey);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
key = keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeySpecException e) {
Log.e(TAG, "Invalid key specification.");
throw new IllegalArgumentException(e);
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
throw new IllegalArgumentException(e);
}
</DeepExtract>
<DeepExtract>
Signature sig;
try {
sig = Signature.getInstance(SIGNATURE_ALGORITHM);
sig.initVerify(key);
sig.update(signedData.getBytes());
if (!sig.verify(Base64.decode(signature))) {
Log.e(TAG, "Signature verification failed.");
return false;
}
return true;
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, "NoSuchAlgorithmException.");
} catch (InvalidKeyException e) {
Log.e(TAG, "Invalid key specification.");
} catch (SignatureException e) {
Log.e(TAG, "Signature exception.");
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
}
return false;
</DeepExtract>
|
Cocos2d-x-Guessing-Game
|
positive
|
private void assertEntityCleanState(final EUser entity) {
assertNull(ReflectionTestUtils.getField(entity, "username"));
assertNull(ReflectionTestUtils.getField(entity, "email"));
assertNull(ReflectionTestUtils.getField(entity, "name"));
assertNull(ReflectionTestUtils.getField(entity, "lastName"));
assertNull(ReflectionTestUtils.getField(entity, "password"));
if (ReflectionTestUtils.getField(entity, "enabled") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "enabled").toString()));
}
if (ReflectionTestUtils.getField(entity, "emailVerified") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "emailVerified").toString()));
}
if (ReflectionTestUtils.getField(entity, "accountNonExpired") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "accountNonExpired").toString()));
}
if (ReflectionTestUtils.getField(entity, "accountNonLocked") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "accountNonLocked").toString()));
}
if (ReflectionTestUtils.getField(entity, "credentialsNonExpired") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "credentialsNonExpired").toString()));
}
assertNull(ReflectionTestUtils.getField(entity, "authorities"));
}
|
<DeepExtract>
if (ReflectionTestUtils.getField(entity, "enabled") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "enabled").toString()));
}
</DeepExtract>
<DeepExtract>
if (ReflectionTestUtils.getField(entity, "emailVerified") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "emailVerified").toString()));
}
</DeepExtract>
<DeepExtract>
if (ReflectionTestUtils.getField(entity, "accountNonExpired") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "accountNonExpired").toString()));
}
</DeepExtract>
<DeepExtract>
if (ReflectionTestUtils.getField(entity, "accountNonLocked") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "accountNonLocked").toString()));
}
</DeepExtract>
<DeepExtract>
if (ReflectionTestUtils.getField(entity, "credentialsNonExpired") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "credentialsNonExpired").toString()));
}
</DeepExtract>
|
gms
|
positive
|
@Override
public void onDrmSessionManagerError(Exception e) {
Log.e(TAG, "internalError [" + getSessionTimeString() + ", " + "drmSessionManagerError" + "]", e);
}
|
<DeepExtract>
Log.e(TAG, "internalError [" + getSessionTimeString() + ", " + "drmSessionManagerError" + "]", e);
</DeepExtract>
|
iview-android-tv
|
positive
|
@Override
protected void onPause() {
super.onPause();
mSwitchCameraBtn.setEnabled(!false);
mRecordBtn.setActivated(false);
mShortVideoRecorder.pause();
}
|
<DeepExtract>
mSwitchCameraBtn.setEnabled(!false);
mRecordBtn.setActivated(false);
</DeepExtract>
|
eden
|
positive
|
@Test
public void mergeAnyAndAnyExisting() {
assertEqual(any() + " merged with " + anyExisting(), anyExisting(), merge(any(), anyExisting()));
assertEqual(anyExisting() + " merged with " + any(), anyExisting(), merge(anyExisting(), any()));
}
|
<DeepExtract>
assertEqual(any() + " merged with " + anyExisting(), anyExisting(), merge(any(), anyExisting()));
assertEqual(anyExisting() + " merged with " + any(), anyExisting(), merge(anyExisting(), any()));
</DeepExtract>
|
sourcerer
|
positive
|
private void MenuItemFileOpenActionPerformed(java.awt.event.ActionEvent evt) {
chooser.rescanCurrentDirectory();
int success = chooser.showOpenDialog(LeftBasePane);
if (success == JFileChooser.APPROVE_OPTION) {
SavePath();
int isOpen = -1;
for (int i = 0; i < iFile.size(); i++) {
if (chooser.getSelectedFile().getPath().equals(iFile.get(i).getPath())) {
iTab = i;
isOpen = i;
break;
}
}
if (isOpen >= 0) {
FilesTabbedPane.setSelectedIndex(iTab);
UpdateEditorButtons();
FileName = chooser.getSelectedFile().getName();
log("File " + FileName + " already open, select tab to file " + FileName);
JOptionPane.showMessageDialog(null, "File " + FileName + " already open. You can use 'Reload' only.");
return;
}
if (!isFileNew() || isChanged()) {
AddTab("");
}
log("Try to open file " + chooser.getSelectedFile().getName());
try {
iFile.set(iTab, chooser.getSelectedFile());
FileName = iFile.get(iTab).getName();
log("File name: " + iFile.get(iTab).getPath());
if (iFile.get(iTab).length() > 1024 * 1024) {
JOptionPane.showMessageDialog(null, "File " + FileName + " too large.");
log("File too large. Size: " + Long.toString(iFile.get(iTab).length() / 1024 / 1024) + " Mb, file: " + iFile.get(iTab).getPath());
UpdateEditorButtons();
return;
}
FilesTabbedPane.setTitleAt(iTab, iFile.get(iTab).getName());
} catch (HeadlessException ex) {
JOptionPane.showMessageDialog(null, "Error, file is not open!");
log(ex.toString());
log("Open: FAIL.");
}
if (LoadFile()) {
log("Open \"" + FileName + "\": Success.");
}
}
UpdateEditorButtons();
}
|
<DeepExtract>
chooser.rescanCurrentDirectory();
int success = chooser.showOpenDialog(LeftBasePane);
if (success == JFileChooser.APPROVE_OPTION) {
SavePath();
int isOpen = -1;
for (int i = 0; i < iFile.size(); i++) {
if (chooser.getSelectedFile().getPath().equals(iFile.get(i).getPath())) {
iTab = i;
isOpen = i;
break;
}
}
if (isOpen >= 0) {
FilesTabbedPane.setSelectedIndex(iTab);
UpdateEditorButtons();
FileName = chooser.getSelectedFile().getName();
log("File " + FileName + " already open, select tab to file " + FileName);
JOptionPane.showMessageDialog(null, "File " + FileName + " already open. You can use 'Reload' only.");
return;
}
if (!isFileNew() || isChanged()) {
AddTab("");
}
log("Try to open file " + chooser.getSelectedFile().getName());
try {
iFile.set(iTab, chooser.getSelectedFile());
FileName = iFile.get(iTab).getName();
log("File name: " + iFile.get(iTab).getPath());
if (iFile.get(iTab).length() > 1024 * 1024) {
JOptionPane.showMessageDialog(null, "File " + FileName + " too large.");
log("File too large. Size: " + Long.toString(iFile.get(iTab).length() / 1024 / 1024) + " Mb, file: " + iFile.get(iTab).getPath());
UpdateEditorButtons();
return;
}
FilesTabbedPane.setTitleAt(iTab, iFile.get(iTab).getName());
} catch (HeadlessException ex) {
JOptionPane.showMessageDialog(null, "Error, file is not open!");
log(ex.toString());
log("Open: FAIL.");
}
if (LoadFile()) {
log("Open \"" + FileName + "\": Success.");
}
}
UpdateEditorButtons();
</DeepExtract>
|
ESPlorer
|
positive
|
@Override
public long getLong(String key, long defValue) throws ClassCastException {
if (mSharedPreferences == null) {
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
}
try {
return mSharedPreferences.getLong(key, defValue);
} catch (final ClassCastException e) {
final String returnType = new Object() {
}.getClass().getEnclosingMethod().getReturnType().toString();
throw new ClassCastException("\n ======================================== \nClassCastException : " + key + "'s value is not a " + returnType + " \n ======================================== \n");
}
}
|
<DeepExtract>
if (mSharedPreferences == null) {
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
}
</DeepExtract>
|
RxAndroidBootstrap
|
positive
|
@Override
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
if (mListenerCollection.errorListener != null) {
mInErrorCallback = true;
if (mListenerCollection.errorListener.onError(mp, what, extra)) {
if (mInErrorCallback) {
setState(ERROR);
}
return true;
}
}
mState = ERROR;
mInErrorCallback = false;
onStateChanged();
return false;
}
|
<DeepExtract>
mState = ERROR;
mInErrorCallback = false;
onStateChanged();
</DeepExtract>
|
PlayerHater
|
positive
|
private void initializeBitmap() {
BitmapDrawable bd = (BitmapDrawable) getDrawable();
if (bd != null) {
mBitmap = bd.getBitmap();
}
if (getWidth() == 0 || getHeight() == 0 || mBitmap == null) {
return;
}
configPath();
if (mUseColor == -2) {
mPaint.setShader(null);
if (mArcBlur != -1) {
mBlurBitmap = mBitmap.copy(Bitmap.Config.ARGB_8888, true);
mBitmap = blur(getContext(), mBlurBitmap, mArcBlur);
}
mShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mPaint.setShader(mShader);
updateMatrix();
}
postInvalidate();
}
|
<DeepExtract>
if (getWidth() == 0 || getHeight() == 0 || mBitmap == null) {
return;
}
configPath();
if (mUseColor == -2) {
mPaint.setShader(null);
if (mArcBlur != -1) {
mBlurBitmap = mBitmap.copy(Bitmap.Config.ARGB_8888, true);
mBitmap = blur(getContext(), mBlurBitmap, mArcBlur);
}
mShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mPaint.setShader(mShader);
updateMatrix();
}
postInvalidate();
</DeepExtract>
|
ViewPagerHelper
|
positive
|
@Override
public void captureStartValues(TransitionValues transitionValues) {
if (transitionValues.view instanceof MusicCoverView) {
transitionValues.values.put(PROPNAME_RADIUS, "start");
transitionValues.values.put(PROPNAME_ALPHA, "start");
}
}
|
<DeepExtract>
if (transitionValues.view instanceof MusicCoverView) {
transitionValues.values.put(PROPNAME_RADIUS, "start");
transitionValues.values.put(PROPNAME_ALPHA, "start");
}
</DeepExtract>
|
LightWeightMusicPlayer
|
positive
|
private ListNode concat(ListNode left, ListNode middle, ListNode right) {
ListNode dummy = new ListNode(0);
ListNode tail = dummy;
tail.next = left;
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
tail.next = middle;
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
tail.next = right;
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
return dummy.next;
}
|
<DeepExtract>
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
</DeepExtract>
<DeepExtract>
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
</DeepExtract>
<DeepExtract>
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
</DeepExtract>
|
LintCode
|
positive
|
public void updateItem(@NonNull IDrawerItem drawerItem) {
if (mDrawerBuilder.checkDrawerItem(getPosition(drawerItem), false)) {
mDrawerBuilder.getAdapter().setDrawerItem(getPosition(drawerItem), drawerItem);
}
}
|
<DeepExtract>
if (mDrawerBuilder.checkDrawerItem(getPosition(drawerItem), false)) {
mDrawerBuilder.getAdapter().setDrawerItem(getPosition(drawerItem), drawerItem);
}
</DeepExtract>
|
MaterialDrawer-Xamarin
|
positive
|
public String favorite(Extension ex, String user) {
String pluginKey = ex.getKey();
data.favorite(pluginKey, user);
final String userFullName = userManager.getUserProfile(user).getFullName();
final String pluginKey = ex.getKey();
String pluginAuthor = ex.getAuthor();
if (pluginAuthor != null && !user.equals(pluginAuthor) && userManager.getUserProfile(pluginAuthor) != null) {
final Set<Extension> commonExtensions = new HashSet<Extension>();
final Set<Extension> suggestedExtensions = new HashSet<Extension>();
for (Extension plugin : getAllRemoteSpeakeasyPlugins(user)) {
if (plugin.getKey().equals(pluginKey)) {
continue;
}
List<String> favoritedKeys = data.getFavorites(plugin.getKey());
if (favoritedKeys.contains(user)) {
if (favoritedKeys.contains(pluginAuthor)) {
commonExtensions.add(plugin);
} else {
suggestedExtensions.add(plugin);
}
}
}
productAccessor.sendEmail(new EmailOptions().toUsername(pluginAuthor).subjectTemplate("email/favorited-subject.vm").bodyTemplate("email/favorited-body.vm").context(new HashMap<String, Object>() {
{
put("plugin", ex);
put("favoriteMarkerFullName", userFullName);
put("favoriteMarker", user);
put("commonExtensions", commonExtensions);
put("suggestedExtensions", suggestedExtensions);
put("favoriteTotal", data.getFavorites(pluginKey).size());
}
}));
}
eventPublisher.publish(new ExtensionFavoritedEvent(pluginKey).setUserName(user).setUserEmail(userManager.getUserProfile(user).getEmail()));
return pluginKey;
}
|
<DeepExtract>
final String userFullName = userManager.getUserProfile(user).getFullName();
final String pluginKey = ex.getKey();
String pluginAuthor = ex.getAuthor();
if (pluginAuthor != null && !user.equals(pluginAuthor) && userManager.getUserProfile(pluginAuthor) != null) {
final Set<Extension> commonExtensions = new HashSet<Extension>();
final Set<Extension> suggestedExtensions = new HashSet<Extension>();
for (Extension plugin : getAllRemoteSpeakeasyPlugins(user)) {
if (plugin.getKey().equals(pluginKey)) {
continue;
}
List<String> favoritedKeys = data.getFavorites(plugin.getKey());
if (favoritedKeys.contains(user)) {
if (favoritedKeys.contains(pluginAuthor)) {
commonExtensions.add(plugin);
} else {
suggestedExtensions.add(plugin);
}
}
}
productAccessor.sendEmail(new EmailOptions().toUsername(pluginAuthor).subjectTemplate("email/favorited-subject.vm").bodyTemplate("email/favorited-body.vm").context(new HashMap<String, Object>() {
{
put("plugin", ex);
put("favoriteMarkerFullName", userFullName);
put("favoriteMarker", user);
put("commonExtensions", commonExtensions);
put("suggestedExtensions", suggestedExtensions);
put("favoriteTotal", data.getFavorites(pluginKey).size());
}
}));
}
</DeepExtract>
|
speakeasy-plugin
|
positive
|
public Builder newBuilderForType() {
return DEFAULT_INSTANCE.toBuilder();
}
|
<DeepExtract>
return DEFAULT_INSTANCE.toBuilder();
</DeepExtract>
|
cqrs-manager-for-distributed-reactive-services
|
positive
|
private void jButtonTambahActionPerformed(java.awt.event.ActionEvent evt) {
TambahJabatanView view = new TambahJabatanView(getFormApp());
setLocationRelativeTo(this);
resetTable();
Pengguna pengguna = LoginManager.getInstance().getPengguna();
Grup grup = pengguna.getGrup();
jButtonHapus.setEnabled(grup.mengandungHakAkses(HakAksesConstant.HAPUS_JABATAN));
jButtonTambah.setEnabled(grup.mengandungHakAkses(HakAksesConstant.TAMBAH_JABATAN));
jButtonUbah.setEnabled(grup.mengandungHakAkses(HakAksesConstant.UBAH_JABATAN));
setVisible(true);
JabatanService jabatanService = SpringManager.getInstance().getBean(JabatanService.class);
dynamicTableModel.clear();
for (Jabatan jabatan : jabatanService.findAll()) {
dynamicTableModel.add(jabatan);
}
}
|
<DeepExtract>
setLocationRelativeTo(this);
resetTable();
Pengguna pengguna = LoginManager.getInstance().getPengguna();
Grup grup = pengguna.getGrup();
jButtonHapus.setEnabled(grup.mengandungHakAkses(HakAksesConstant.HAPUS_JABATAN));
jButtonTambah.setEnabled(grup.mengandungHakAkses(HakAksesConstant.TAMBAH_JABATAN));
jButtonUbah.setEnabled(grup.mengandungHakAkses(HakAksesConstant.UBAH_JABATAN));
setVisible(true);
</DeepExtract>
<DeepExtract>
JabatanService jabatanService = SpringManager.getInstance().getBean(JabatanService.class);
dynamicTableModel.clear();
for (Jabatan jabatan : jabatanService.findAll()) {
dynamicTableModel.add(jabatan);
}
</DeepExtract>
|
simple-pos
|
positive
|
public static void particleBubble(ParticleData particleType, World world, double x, double y, double z, double radius, int total) {
ParticlesRegister.instance().spawnParticleShape(particleType, world, x, y, z, new Sphere(true, radius), total);
}
|
<DeepExtract>
ParticlesRegister.instance().spawnParticleShape(particleType, world, x, y, z, new Sphere(true, radius), total);
</DeepExtract>
|
BlazeLoader
|
positive
|
public void submit() {
if (mode == Overlay.SAVE) {
save = new Save();
save.save(getEditedImage());
} else if (mode == Overlay.UPLOAD) {
upload = new Upload(getEditedImage(), false);
} else if (mode == Overlay.UPLOAD_FTP) {
new SimpleFTPUploader(ImageUtilities.saveTemporarily(getEditedImage()));
}
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(keyDispatcher);
keyDispatcher = null;
((EditorPanel) editorPanel).dispose();
instance.dispose();
}
|
<DeepExtract>
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(keyDispatcher);
keyDispatcher = null;
((EditorPanel) editorPanel).dispose();
instance.dispose();
</DeepExtract>
|
SnippingToolPlusPlus
|
positive
|
public void setInt(String key, int value) {
if ("" + value == null) {
remove(key);
return null;
} else {
return (String) put(key, "" + value);
}
}
|
<DeepExtract>
if ("" + value == null) {
remove(key);
return null;
} else {
return (String) put(key, "" + value);
}
</DeepExtract>
|
JErgometer
|
positive
|
protected void drawInflatedPOI(WFGraphics g, int left, int top, int width, int height) {
int triX1 = left + ((width - this.arrowHeight) >> 1);
int rectBottom = top + height - this.arrowHeight - 1;
int rectRight = left + width;
int triY1 = rectBottom;
int triX2 = triX1 + this.arrowHeight;
int triY2 = triY1;
int triX3 = triX2;
int triY3 = top + height;
g.setColor(bkgColorWhite);
g.fillRect(left, top, width, height - this.arrowHeight);
g.fillTriangle(triX1, triY1, triX2, triY2, triX3, triY3);
g.setColor(bkgColorGrayBorderLight);
g.drawLine(left, top, rectRight, top, 1);
g.drawLine(left, top, left, rectBottom, 1);
g.drawLine(triX1, triY1, triX3, triY3, 1);
g.setColor(bkgColorGrayBorderDark);
g.drawLine(rectRight, top, rectRight, rectBottom, 1);
g.drawLine(left, rectBottom, triX1, rectBottom, 1);
g.drawLine(triX2, rectBottom, rectRight, rectBottom, 1);
g.drawLine(triX2, triY2, triX3, triY3, 1);
int titleHeight = titleFont.getFontHeight() + PADDING + (PADDING >> 1);
g.setColor(bkgColorLight);
g.fillRect(left + 3, top + 3, width - 5, titleHeight);
g.setColor(bkgColorDark);
g.fillRect(left + 3, top + titleHeight + 3, width - 5, height - titleHeight - this.arrowHeight - 6);
int anchorLeftTop = WFGraphics.ANCHOR_LEFT | WFGraphics.ANCHOR_TOP;
g.setColor(bkgColorWhite);
int imageMaxSize = this.containerHeight - 12;
g.fillRect(left + 6, top + 6, imageMaxSize, imageMaxSize);
if (this.isImageValid()) {
g.drawImage(this.inflatedImage, left + 6 + (imageMaxSize >> 1), top + 6 + (imageMaxSize >> 1), WFGraphics.ANCHOR_HCENTER | WFGraphics.ANCHOR_VCENTER);
}
g.setColor(fontColor);
g.setFont(titleFont);
int maxTextWidth = this.textContainerWidth;
g.drawText(this.title, left + this.containerHeight - 6 + PADDING, top + PADDING, maxTextWidth, anchorLeftTop, "..");
if (this.distance != null) {
g.setFont(textFont);
g.drawText(this.distance, left + this.containerHeight - 6 + PADDING, top + PADDING + titleFont.getFontHeight() + PADDING + 3, anchorLeftTop);
}
}
|
<DeepExtract>
int triX1 = left + ((width - this.arrowHeight) >> 1);
int rectBottom = top + height - this.arrowHeight - 1;
int rectRight = left + width;
int triY1 = rectBottom;
int triX2 = triX1 + this.arrowHeight;
int triY2 = triY1;
int triX3 = triX2;
int triY3 = top + height;
g.setColor(bkgColorWhite);
g.fillRect(left, top, width, height - this.arrowHeight);
g.fillTriangle(triX1, triY1, triX2, triY2, triX3, triY3);
g.setColor(bkgColorGrayBorderLight);
g.drawLine(left, top, rectRight, top, 1);
g.drawLine(left, top, left, rectBottom, 1);
g.drawLine(triX1, triY1, triX3, triY3, 1);
g.setColor(bkgColorGrayBorderDark);
g.drawLine(rectRight, top, rectRight, rectBottom, 1);
g.drawLine(left, rectBottom, triX1, rectBottom, 1);
g.drawLine(triX2, rectBottom, rectRight, rectBottom, 1);
g.drawLine(triX2, triY2, triX3, triY3, 1);
</DeepExtract>
|
Wayfinder-Android-Navigator
|
positive
|
@Override
public void onCreatePreferences(Bundle bundle, String s) {
addPreferencesFromResource(R.xml.pref_global);
mSnoozeDuration = (ListPreference) findPreference(getString(R.string.pref_snooze_duration_key));
mRingDuration = (ListPreference) findPreference(getString(R.string.pref_ring_duration_key));
mAlarmVolume = (VolumeSliderPreference) findPreference(getString(R.string.pref_ring_volume_key));
mEnableNotifications = (SwitchPreferenceCompat) findPreference(getString(R.string.pref_enable_notifications_key));
mEnableReliability = (SwitchPreferenceCompat) findPreference(getString(R.string.pref_enable_reliability_key));
mEnableReliability.setEnabled(mEnableNotifications.isChecked());
mSnoozeDuration.setSummary(mSnoozeDuration.getEntry());
mRingDuration.setSummary(mRingDuration.getEntry());
}
|
<DeepExtract>
mSnoozeDuration.setSummary(mSnoozeDuration.getEntry());
mRingDuration.setSummary(mRingDuration.getEntry());
</DeepExtract>
|
ProjectOxford-Apps-MimickerAlarm
|
positive
|
protected JFreeChart createThroughputGraph(CategoryDataset dataset) {
final JFreeChart chart = ChartFactory.createLineChart(Messages.ProjectAction_Throughput(), null, Messages.ProjectAction_RequestsPerSeconds(), dataset, PlotOrientation.VERTICAL, true, true, false);
final LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.BOTTOM);
chart.setBackgroundPaint(Color.WHITE);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setOutlinePaint(null);
plot.setRangeGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.BLACK);
CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
plot.setDomainAxis(domainAxis);
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
domainAxis.setLowerMargin(0.0);
domainAxis.setUpperMargin(0.0);
domainAxis.setCategoryMargin(0.0);
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setBaseStroke(new BasicStroke(4.0f));
ColorPalette.apply(renderer);
plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));
return chart;
}
|
<DeepExtract>
final JFreeChart chart = ChartFactory.createLineChart(Messages.ProjectAction_Throughput(), null, Messages.ProjectAction_RequestsPerSeconds(), dataset, PlotOrientation.VERTICAL, true, true, false);
final LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.BOTTOM);
chart.setBackgroundPaint(Color.WHITE);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setOutlinePaint(null);
plot.setRangeGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.BLACK);
CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
plot.setDomainAxis(domainAxis);
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
domainAxis.setLowerMargin(0.0);
domainAxis.setUpperMargin(0.0);
domainAxis.setCategoryMargin(0.0);
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setBaseStroke(new BasicStroke(4.0f));
ColorPalette.apply(renderer);
plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));
return chart;
</DeepExtract>
|
performance-plugin
|
positive
|
public Document readFromFile(File file) throws JAXBException, FileNotFoundException, IOException {
JAXBContext ctx = JAXBContext.newInstance(XmlDocument.class);
Unmarshaller u = ctx.createUnmarshaller();
FileInputStream fileInputStream = new FileInputStream(file);
xmlDocument = (XmlDocument) u.unmarshal(fileInputStream);
fileInputStream.close();
idToXmlObject = new IdToXmlObject(xmlDocument);
Document document = new Document();
Subnet rootSubnet = getNewSubnet(xmlDocument.rootSubnet);
document.petriNet.setRootSubnet(rootSubnet);
constructInitialMarkingRecursively(document.petriNet.getInitialMarking(), xmlDocument.rootSubnet);
document.petriNet.getNodeSimpleIdGenerator().fixFutureUniqueIds();
document.petriNet.getNodeSimpleIdGenerator().ensureNumberIds();
document.petriNet.getNodeLabelGenerator().fixFutureUniqueLabels();
for (XmlRole xmlRole : xmlDocument.roles) {
Role role = new Role();
role.id = xmlRole.id;
role.name = xmlRole.name;
role.createCase = xmlRole.createCase;
role.destroyCase = xmlRole.destroyCase;
for (String transitionId : xmlRole.transitionIds) {
role.transitions.add((Transition) getObjectFromId(transitionId));
}
document.roles.add(role);
}
return document;
}
|
<DeepExtract>
Document document = new Document();
Subnet rootSubnet = getNewSubnet(xmlDocument.rootSubnet);
document.petriNet.setRootSubnet(rootSubnet);
constructInitialMarkingRecursively(document.petriNet.getInitialMarking(), xmlDocument.rootSubnet);
document.petriNet.getNodeSimpleIdGenerator().fixFutureUniqueIds();
document.petriNet.getNodeSimpleIdGenerator().ensureNumberIds();
document.petriNet.getNodeLabelGenerator().fixFutureUniqueLabels();
for (XmlRole xmlRole : xmlDocument.roles) {
Role role = new Role();
role.id = xmlRole.id;
role.name = xmlRole.name;
role.createCase = xmlRole.createCase;
role.destroyCase = xmlRole.destroyCase;
for (String transitionId : xmlRole.transitionIds) {
role.transitions.add((Transition) getObjectFromId(transitionId));
}
document.roles.add(role);
}
return document;
</DeepExtract>
|
pneditor
|
positive
|
@Override
public void callbackValue(Object source, File[] ret) {
boolean succ = true;
if (ret == null || ret.length == 0 || !ret[0].isFile() || !ret[0].exists())
succ = false;
if (succ) {
PGPSecretKeyFinder finder = new PGPSecretKeyFinder(ret[0]);
if (!finder.validFile()) {
finder.close();
succ = false;
}
}
if (!succ) {
UICenter.message(_T.PGP_privkey_wrongfile.val());
return;
}
String tmppath = ResourceCenter.getSettings().get(Settings.lastpgp_privfile);
if (tmppath == null || !tmppath.equals(ret[0].getAbsolutePath())) {
ResourceCenter.getSettings().set(Settings.lastpgp_privfile, ret[0].getAbsolutePath());
ResourceCenter.getSettings().save();
}
params.put(SuitePARAM.pgp_privkeyfile, ret[0].getAbsolutePath());
new PasswordInputdialog(source).main(cbpass, _T.PGP_privkeypasstitle.val());
}
|
<DeepExtract>
boolean succ = true;
if (ret == null || ret.length == 0 || !ret[0].isFile() || !ret[0].exists())
succ = false;
if (succ) {
PGPSecretKeyFinder finder = new PGPSecretKeyFinder(ret[0]);
if (!finder.validFile()) {
finder.close();
succ = false;
}
}
if (!succ) {
UICenter.message(_T.PGP_privkey_wrongfile.val());
return;
}
String tmppath = ResourceCenter.getSettings().get(Settings.lastpgp_privfile);
if (tmppath == null || !tmppath.equals(ret[0].getAbsolutePath())) {
ResourceCenter.getSettings().set(Settings.lastpgp_privfile, ret[0].getAbsolutePath());
ResourceCenter.getSettings().save();
}
params.put(SuitePARAM.pgp_privkeyfile, ret[0].getAbsolutePath());
new PasswordInputdialog(source).main(cbpass, _T.PGP_privkeypasstitle.val());
</DeepExtract>
|
CrococryptFile
|
positive
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
int[] sellist = listRestoreSelectedTables.getSelectedIndices();
for (int i = 0; i < sellist.length; i++) listRestoreSelectedModel.remove(listRestoreSelectedTables.getSelectedIndex());
}
|
<DeepExtract>
int[] sellist = listRestoreSelectedTables.getSelectedIndices();
for (int i = 0; i < sellist.length; i++) listRestoreSelectedModel.remove(listRestoreSelectedTables.getSelectedIndex());
</DeepExtract>
|
HBase-Manager
|
positive
|
protected void restart_lookahead() throws java.lang.Exception {
for (int i = 1; i < error_sync_size(); i++) lookahead[i - 1] = lookahead[i];
lookahead[error_sync_size() - 1] = cur_token;
Symbol sym = getScanner().next_token();
return (sym != null) ? sym : new Symbol(EOF_sym());
lookahead_pos = 0;
}
|
<DeepExtract>
Symbol sym = getScanner().next_token();
return (sym != null) ? sym : new Symbol(EOF_sym());
</DeepExtract>
|
Compiler
|
positive
|
public JSONObject editMulti(String multiPath, JSONObject multiObj) throws RedditApiException {
if (!isLoggedIn()) {
throw new RedditApiException("Reddit Login Required", true);
}
try {
url = OAUTH_ENDPOINT + "/api/multi" + multiPath + "?model=" + URLEncoder.encode(multiObj.toString(), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new RedditApiException("Encoding error: " + e.getMessage());
}
JSONObject jObj;
try {
String json = redditApiRequest(url, "PUT", REQUEST_MODE_AUTHED, null);
jObj = new JSONObject(json);
} catch (JSONException e) {
e.printStackTrace();
throw new RedditApiException("Error: " + e.getMessage());
}
return jObj;
}
|
<DeepExtract>
if (!isLoggedIn()) {
throw new RedditApiException("Reddit Login Required", true);
}
</DeepExtract>
<DeepExtract>
JSONObject jObj;
try {
String json = redditApiRequest(url, "PUT", REQUEST_MODE_AUTHED, null);
jObj = new JSONObject(json);
} catch (JSONException e) {
e.printStackTrace();
throw new RedditApiException("Error: " + e.getMessage());
}
return jObj;
</DeepExtract>
|
reddinator
|
positive
|
public static String hexlify(final short[] value) {
final StringBuilder builder = new StringBuilder("[");
for (int i = 0, n = Array.getLength(value); i < n; i++) {
if (i > 0) {
builder.append(", ");
}
builder.append(String.format("0x%04x", Array.get(value, i)));
}
return builder.append("]").toString();
}
|
<DeepExtract>
final StringBuilder builder = new StringBuilder("[");
for (int i = 0, n = Array.getLength(value); i < n; i++) {
if (i > 0) {
builder.append(", ");
}
builder.append(String.format("0x%04x", Array.get(value, i)));
}
return builder.append("]").toString();
</DeepExtract>
|
aapt
|
positive
|
@Override
public byte[] serialize(Message message) {
byte[] serialize = super.serialize(message);
try {
if (document.getLength() > MAX_TEXT_BUFFER) {
document.remove(0, 1000);
}
document.insertString(document.getLength(), sequence.getAndIncrement() + "]: " + new String(serialize) + "\n", stdOutStyle);
newLinePrinted = true;
if (!timer.isRunning()) {
timer.restart();
}
} catch (BadLocationException e) {
e.printStackTrace();
}
return serialize;
}
|
<DeepExtract>
try {
if (document.getLength() > MAX_TEXT_BUFFER) {
document.remove(0, 1000);
}
document.insertString(document.getLength(), sequence.getAndIncrement() + "]: " + new String(serialize) + "\n", stdOutStyle);
newLinePrinted = true;
if (!timer.isRunning()) {
timer.restart();
}
} catch (BadLocationException e) {
e.printStackTrace();
}
</DeepExtract>
|
RITDevX
|
positive
|
@Test
public void unnecessaryChainId() {
final BesuNodeConfig besuNodeConfig = BesuNodeConfigBuilder.aBesuNodeConfig().withGenesisFile("eth_hash_2018_no_replay_protection.json").build();
final SignerConfiguration signerConfig = new SignerConfigurationBuilder().build();
ethNode = BesuNodeFactory.create(besuNodeConfig);
ethNode.start();
ethNode.awaitStartupCompletion();
ethSigner = new Signer(signerConfig, besuNodeConfig.getHostName(), ethNode.ports());
ethSigner.start();
ethSigner.awaitStartupCompletion();
final SignerResponse<JsonRpcErrorResponse> signerResponse = ethSigner.transactions().submitExceptional(Transaction.createEtherTransaction(richBenefactor().address(), richBenefactor().nextNonceAndIncrement(), GAS_PRICE, INTRINSIC_GAS, RECIPIENT, TRANSFER_AMOUNT_WEI));
assertThat(signerResponse.status()).isEqualTo(OK);
assertThat(signerResponse.jsonRpc().getError()).isEqualTo(REPLAY_PROTECTED_SIGNATURES_NOT_SUPPORTED);
}
|
<DeepExtract>
final BesuNodeConfig besuNodeConfig = BesuNodeConfigBuilder.aBesuNodeConfig().withGenesisFile("eth_hash_2018_no_replay_protection.json").build();
final SignerConfiguration signerConfig = new SignerConfigurationBuilder().build();
ethNode = BesuNodeFactory.create(besuNodeConfig);
ethNode.start();
ethNode.awaitStartupCompletion();
ethSigner = new Signer(signerConfig, besuNodeConfig.getHostName(), ethNode.ports());
ethSigner.start();
ethSigner.awaitStartupCompletion();
</DeepExtract>
|
ethsigner
|
positive
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String url = request.getParameter("url");
String word = request.getParameter("word");
String dict = request.getParameter("dict");
if (url == null || word == null || dict == null) {
return;
}
User user = (User) request.getSession().getAttribute("user");
UserWord userWord = new UserWord();
userWord.setDateTime(new Date());
userWord.setUserName(user == null ? "anonymity" : user.getUserName());
userWord.setWord(word);
MySQLUtils.saveUserWordToDatabase(userWord);
response.sendRedirect(url);
}
|
<DeepExtract>
String url = request.getParameter("url");
String word = request.getParameter("word");
String dict = request.getParameter("dict");
if (url == null || word == null || dict == null) {
return;
}
User user = (User) request.getSession().getAttribute("user");
UserWord userWord = new UserWord();
userWord.setDateTime(new Date());
userWord.setUserName(user == null ? "anonymity" : user.getUserName());
userWord.setWord(word);
MySQLUtils.saveUserWordToDatabase(userWord);
response.sendRedirect(url);
</DeepExtract>
|
superword
|
positive
|
public static int nextInteger(int upperBound) {
return randomGenerator.nextInt(upperBound);
}
|
<DeepExtract>
return randomGenerator.nextInt(upperBound);
</DeepExtract>
|
Pac-Man
|
positive
|
@SuppressLint("CommitTransaction")
public void showFragment(Class<? extends Fragment> toFragmentClass) {
if (toFragmentClass == null) {
return;
}
String currentFragmentName = toFragmentClass.getSimpleName();
if (!TextUtils.isEmpty(mLastFragmentName) && mLastFragmentName.equals(currentFragmentName)) {
return;
}
FragmentTransaction ft = mFragmentManager.beginTransaction();
ft.setCustomAnimations(R.animator.fade_in, R.animator.fade_out);
if (mFragmentManager.findFragmentByTag(mLastFragmentName) != null && mFragmentManager.findFragmentByTag(mLastFragmentName).isVisible()) {
ft.hide(mFragmentManager.findFragmentByTag(mLastFragmentName));
}
Fragment toFragment = mFragmentManager.findFragmentByTag(currentFragmentName);
if (toFragment != null) {
ft.show(toFragment);
} else {
try {
toFragment = toFragmentClass.newInstance();
} catch (InstantiationException | IllegalAccessException ignored) {
}
ft.add(mContentId, toFragment, currentFragmentName);
}
mLastFragmentName = currentFragmentName;
ft.commitAllowingStateLoss();
}
|
<DeepExtract>
if (mFragmentManager.findFragmentByTag(mLastFragmentName) != null && mFragmentManager.findFragmentByTag(mLastFragmentName).isVisible()) {
ft.hide(mFragmentManager.findFragmentByTag(mLastFragmentName));
}
</DeepExtract>
|
TimeTable
|
positive
|
@Test
public void test10() throws Exception {
if (null == null) {
if (null == null) {
Assert.assertTrue(config.parseArgs("data/potests/test10.asm", "-po", "size"));
} else {
Assert.assertTrue(config.parseArgs("data/potests/test10.asm", "-cpu", null, "-po", "size"));
}
} else {
if (null == null) {
Assert.assertTrue(config.parseArgs("data/potests/test10.asm", "-dialect", null, "-po", "size"));
} else {
Assert.assertTrue(config.parseArgs("data/potests/test10.asm", "-dialect", null, "-cpu", null, "-po", "size"));
}
}
Assert.assertTrue("Could not parse file " + "data/potests/test10.asm", config.codeBaseParser.parseMainSourceFiles(config.inputFiles, code));
testInternal(2, 10, 10, "data/potests/test10-expected.asm");
}
|
<DeepExtract>
if (null == null) {
if (null == null) {
Assert.assertTrue(config.parseArgs("data/potests/test10.asm", "-po", "size"));
} else {
Assert.assertTrue(config.parseArgs("data/potests/test10.asm", "-cpu", null, "-po", "size"));
}
} else {
if (null == null) {
Assert.assertTrue(config.parseArgs("data/potests/test10.asm", "-dialect", null, "-po", "size"));
} else {
Assert.assertTrue(config.parseArgs("data/potests/test10.asm", "-dialect", null, "-cpu", null, "-po", "size"));
}
}
Assert.assertTrue("Could not parse file " + "data/potests/test10.asm", config.codeBaseParser.parseMainSourceFiles(config.inputFiles, code));
testInternal(2, 10, 10, "data/potests/test10-expected.asm");
</DeepExtract>
|
mdlz80optimizer
|
positive
|
public Criteria andSignatureLessThanOrEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "signature" + " cannot be null");
}
criteria.add(new Criterion("signature <=", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "signature" + " cannot be null");
}
criteria.add(new Criterion("signature <=", value));
</DeepExtract>
|
wukong-framework
|
positive
|
public Criteria andCreateByNotIn(List<Long> values) {
if (values == null) {
throw new RuntimeException("Value for " + "createBy" + " cannot be null");
}
criteria.add(new Criterion("create_by not in", values));
return (Criteria) this;
}
|
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "createBy" + " cannot be null");
}
criteria.add(new Criterion("create_by not in", values));
</DeepExtract>
|
CRM
|
positive
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public Void call() throws Exception {
if (!lollipopAndAbove()) {
gradientDrawable = new GradientDrawable();
gradientDrawable.setShape(GradientDrawable.OVAL);
gradientDrawable.setSize(mOriginalThumbHeight / 3, mOriginalThumbHeight / 3);
gradientDrawable.setColor(mIsEnabled ? mThumbColor : Color.LTGRAY);
gradientDrawable.setDither(true);
gradientDrawable.setAlpha(mThumbAlpha);
setThumb(gradientDrawable);
LayerDrawable ld = (LayerDrawable) getProgressDrawable();
ScaleDrawable shape = (ScaleDrawable) (ld.findDrawableByLayerId(android.R.id.progress));
shape.setColorFilter(mIsEnabled ? mProgressColor : Color.LTGRAY, PorterDuff.Mode.SRC_IN);
NinePatchDrawable ninePatchDrawable = (NinePatchDrawable) (ld.findDrawableByLayerId(android.R.id.background));
ninePatchDrawable.setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);
SeekBarBackgroundDrawable seekBarBackgroundDrawable = new SeekBarBackgroundDrawable(getContext(), mIsEnabled ? mProgressBackgroundColor : Color.LTGRAY, mActualBackgroundColor, getPaddingLeft(), getPaddingRight());
if (belowJellybean())
setBackgroundDrawable(seekBarBackgroundDrawable);
else
setBackground(seekBarBackgroundDrawable);
}
mIsEnabled = enabled;
triggerMethodOnceViewIsDisplayed(this, new Callable<Void>() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public Void call() throws Exception {
if (!lollipopAndAbove()) {
gradientDrawable = new GradientDrawable();
gradientDrawable.setShape(GradientDrawable.OVAL);
gradientDrawable.setSize(mOriginalThumbHeight / 3, mOriginalThumbHeight / 3);
gradientDrawable.setColor(mIsEnabled ? mThumbColor : Color.LTGRAY);
gradientDrawable.setDither(true);
gradientDrawable.setAlpha(mThumbAlpha);
setThumb(gradientDrawable);
LayerDrawable ld = (LayerDrawable) getProgressDrawable();
ScaleDrawable shape = (ScaleDrawable) (ld.findDrawableByLayerId(android.R.id.progress));
shape.setColorFilter(mIsEnabled ? mProgressColor : Color.LTGRAY, PorterDuff.Mode.SRC_IN);
NinePatchDrawable ninePatchDrawable = (NinePatchDrawable) (ld.findDrawableByLayerId(android.R.id.background));
ninePatchDrawable.setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);
SeekBarBackgroundDrawable seekBarBackgroundDrawable = new SeekBarBackgroundDrawable(getContext(), mIsEnabled ? mProgressBackgroundColor : Color.LTGRAY, mActualBackgroundColor, getPaddingLeft(), getPaddingRight());
if (belowJellybean())
setBackgroundDrawable(seekBarBackgroundDrawable);
else
setBackground(seekBarBackgroundDrawable);
}
SeekBarCompat.super.setEnabled(enabled);
return null;
}
});
return null;
}
|
<DeepExtract>
mIsEnabled = enabled;
triggerMethodOnceViewIsDisplayed(this, new Callable<Void>() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public Void call() throws Exception {
if (!lollipopAndAbove()) {
gradientDrawable = new GradientDrawable();
gradientDrawable.setShape(GradientDrawable.OVAL);
gradientDrawable.setSize(mOriginalThumbHeight / 3, mOriginalThumbHeight / 3);
gradientDrawable.setColor(mIsEnabled ? mThumbColor : Color.LTGRAY);
gradientDrawable.setDither(true);
gradientDrawable.setAlpha(mThumbAlpha);
setThumb(gradientDrawable);
LayerDrawable ld = (LayerDrawable) getProgressDrawable();
ScaleDrawable shape = (ScaleDrawable) (ld.findDrawableByLayerId(android.R.id.progress));
shape.setColorFilter(mIsEnabled ? mProgressColor : Color.LTGRAY, PorterDuff.Mode.SRC_IN);
NinePatchDrawable ninePatchDrawable = (NinePatchDrawable) (ld.findDrawableByLayerId(android.R.id.background));
ninePatchDrawable.setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);
SeekBarBackgroundDrawable seekBarBackgroundDrawable = new SeekBarBackgroundDrawable(getContext(), mIsEnabled ? mProgressBackgroundColor : Color.LTGRAY, mActualBackgroundColor, getPaddingLeft(), getPaddingRight());
if (belowJellybean())
setBackgroundDrawable(seekBarBackgroundDrawable);
else
setBackground(seekBarBackgroundDrawable);
}
SeekBarCompat.super.setEnabled(enabled);
return null;
}
});
</DeepExtract>
|
crofis-android-uikit
|
positive
|
@Test
@WithCredentials(credentialType = WithCredentials.USERNAME_PASSWORD, values = { MACHINE_USERNAME, "ath" }, id = SSH_CRED_ID)
public void provisionSshSlaveWithPasswdAuthRetryOnFailedAuth() {
ConfigFileProvider fileProvider = new ConfigFileProvider(jenkins);
UserDataConfig cloudInit = fileProvider.addFile(UserDataConfig.class);
cloudInit.name(CLOUD_INIT_NAME);
cloudInit.content(resource("SeleniumTest/" + "cloud-init-authfix").asText());
cloudInit.save();
CloudsConfiguration.addCloud(jenkins, OpenstackCloud.class, cloud -> {
if (OS_FIP_POOL_NAME != null) {
cloud.associateFloatingIp(OS_FIP_POOL_NAME);
}
cloud.instanceCap(3);
OpenstackSlaveTemplate template = cloud.addSlaveTemplate();
template.name(CLOUD_DEFAULT_TEMPLATE);
template.labels("label");
template.hardwareId(OS_HARDWARE_ID);
template.networkId(OS_NETWORK_ID);
template.imageId(OS_IMAGE_ID);
template.connectionType("SSH");
if ("SSH".equals("SSH")) {
template.sshCredentials(SSH_CRED_ID);
}
template.userData(CLOUD_INIT_NAME);
template.keyPair(OS_KEY_NAME);
template.fsRoot("/tmp/jenkins");
});
FreeStyleJob job = jenkins.jobs.create();
job.configure();
job.setLabelExpression("label");
job.save();
job.scheduleBuild().waitUntilFinished(PROVISIONING_TIMEOUT).shouldSucceed();
}
|
<DeepExtract>
ConfigFileProvider fileProvider = new ConfigFileProvider(jenkins);
UserDataConfig cloudInit = fileProvider.addFile(UserDataConfig.class);
cloudInit.name(CLOUD_INIT_NAME);
cloudInit.content(resource("SeleniumTest/" + "cloud-init-authfix").asText());
cloudInit.save();
</DeepExtract>
<DeepExtract>
CloudsConfiguration.addCloud(jenkins, OpenstackCloud.class, cloud -> {
if (OS_FIP_POOL_NAME != null) {
cloud.associateFloatingIp(OS_FIP_POOL_NAME);
}
cloud.instanceCap(3);
OpenstackSlaveTemplate template = cloud.addSlaveTemplate();
template.name(CLOUD_DEFAULT_TEMPLATE);
template.labels("label");
template.hardwareId(OS_HARDWARE_ID);
template.networkId(OS_NETWORK_ID);
template.imageId(OS_IMAGE_ID);
template.connectionType("SSH");
if ("SSH".equals("SSH")) {
template.sshCredentials(SSH_CRED_ID);
}
template.userData(CLOUD_INIT_NAME);
template.keyPair(OS_KEY_NAME);
template.fsRoot("/tmp/jenkins");
});
</DeepExtract>
|
openstack-cloud-plugin
|
positive
|
private static void defaultExport(List<Map<String, Object>> list, String fileName, HttpServletResponse response) throws IOException {
Workbook workbook = ExcelExportUtil.exportExcel(list, ExcelType.HSSF);
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + "." + ExcelTypeEnum.XLSX.getValue(), "UTF-8"));
workbook.write(response.getOutputStream());
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
|
<DeepExtract>
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + "." + ExcelTypeEnum.XLSX.getValue(), "UTF-8"));
workbook.write(response.getOutputStream());
} catch (Exception e) {
throw new IOException(e.getMessage());
}
</DeepExtract>
|
springboot
|
positive
|
public Criteria andGatewayPayTimeIsNotNull() {
if ("gateway_pay_time is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("gateway_pay_time is not null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("gateway_pay_time is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("gateway_pay_time is not null"));
</DeepExtract>
|
springcloud-e-book
|
positive
|
@Override
public void onSurfaceDestroyed() {
if (mCaptureSession != null) {
mCaptureSession.close();
mCaptureSession = null;
}
if (mCamera != null) {
mCamera.close();
mCamera = null;
}
if (mStillImageReader != null) {
mStillImageReader.close();
mStillImageReader = null;
}
if (mScanImageReader != null) {
mScanImageReader.close();
mScanImageReader = null;
}
if (mMediaRecorder != null) {
mMediaRecorder.stop();
mMediaRecorder.reset();
mMediaRecorder.release();
mMediaRecorder = null;
if (mIsRecording) {
mCallback.onRecordingEnd();
mCallback.onVideoRecorded(mVideoPath, 0, 0);
mIsRecording = false;
}
}
}
|
<DeepExtract>
if (mCaptureSession != null) {
mCaptureSession.close();
mCaptureSession = null;
}
if (mCamera != null) {
mCamera.close();
mCamera = null;
}
if (mStillImageReader != null) {
mStillImageReader.close();
mStillImageReader = null;
}
if (mScanImageReader != null) {
mScanImageReader.close();
mScanImageReader = null;
}
if (mMediaRecorder != null) {
mMediaRecorder.stop();
mMediaRecorder.reset();
mMediaRecorder.release();
mMediaRecorder = null;
if (mIsRecording) {
mCallback.onRecordingEnd();
mCallback.onVideoRecorded(mVideoPath, 0, 0);
mIsRecording = false;
}
}
</DeepExtract>
|
react-native-camera
|
positive
|
@Override
public String getCanonicalName() {
return getClass().getSimpleName() + "(" + type + ")";
}
|
<DeepExtract>
return getClass().getSimpleName() + "(" + type + ")";
</DeepExtract>
|
jumi-actors
|
positive
|
public String getAwsSseCustomerKey() {
checkProperty("aws.sse.customer.key");
return mProperties.getString("aws.sse.customer.key");
}
|
<DeepExtract>
checkProperty("aws.sse.customer.key");
return mProperties.getString("aws.sse.customer.key");
</DeepExtract>
|
secor
|
positive
|
public UserPlugins getRemotePluginList(String userName, List<String> modifiedKeys) throws UnauthorizedAccessException {
if (!permissionManager.canAccessSpeakeasy(userName)) {
log.warn("Unauthorized Speakeasy access by '" + userName + "'");
throw new UnauthorizedAccessException(userName, "Cannot access Speakeasy due to lack of permissions");
}
Iterable<UserExtension> plugins = extensionManager.getAllUserExtensions(userName);
UserPlugins userPlugins = new UserPlugins(filter(plugins, new AuthorAccessFilter(permissionManager.canAuthorExtensions(userName))));
userPlugins.setUpdated(modifiedKeys);
return userPlugins;
}
|
<DeepExtract>
if (!permissionManager.canAccessSpeakeasy(userName)) {
log.warn("Unauthorized Speakeasy access by '" + userName + "'");
throw new UnauthorizedAccessException(userName, "Cannot access Speakeasy due to lack of permissions");
}
</DeepExtract>
|
speakeasy-plugin
|
positive
|
public static boolean regionEquals(String region, String regionThat) {
if (region == null) {
region = Constants.REGION_MAINLAND;
}
if (regionThat == null) {
regionThat = Constants.REGION_MAINLAND;
}
return (region == regionThat) || (region != null && region.equals(regionThat));
}
|
<DeepExtract>
return (region == regionThat) || (region != null && region.equals(regionThat));
</DeepExtract>
|
alibabacloud-httpdns-android-sdk
|
positive
|
@Test
public void testArgumentFloatMinNormal() throws Exception {
reparseSingleArgument(Float.MIN_NORMAL, EQUALS_COMPARATOR);
}
|
<DeepExtract>
reparseSingleArgument(Float.MIN_NORMAL, EQUALS_COMPARATOR);
</DeepExtract>
|
JavaOSC
|
positive
|
public synchronized void headers(int flags, int streamId, List<String> nameValueBlock) throws IOException {
nameValueBlockBuffer.reset();
int numberOfPairs = nameValueBlock.size() / 2;
nameValueBlockOut.writeInt(numberOfPairs);
for (String s : nameValueBlock) {
nameValueBlockOut.writeInt(s.length());
nameValueBlockOut.write(s.getBytes("UTF-8"));
}
nameValueBlockOut.flush();
int type = SpdyConnection.TYPE_HEADERS;
int length = nameValueBlockBuffer.size() + 4;
out.writeInt(0x80000000 | (SpdyConnection.VERSION & 0x7fff) << 16 | type & 0xffff);
out.writeInt((flags & 0xff) << 24 | length & 0xffffff);
out.writeInt(streamId & 0x7fffffff);
nameValueBlockBuffer.writeTo(out);
out.flush();
}
|
<DeepExtract>
nameValueBlockBuffer.reset();
int numberOfPairs = nameValueBlock.size() / 2;
nameValueBlockOut.writeInt(numberOfPairs);
for (String s : nameValueBlock) {
nameValueBlockOut.writeInt(s.length());
nameValueBlockOut.write(s.getBytes("UTF-8"));
}
nameValueBlockOut.flush();
</DeepExtract>
|
phonegap-custom-camera-plugin
|
positive
|
public void setTypeface(Typeface tf, int style) {
super.setTypeface(tf, style);
requestLayout();
invalidate();
mTextPaint = new TextPaint();
mTextPaint.setAntiAlias(true);
mTextPaint.setTextSize(getTextSize());
mTextPaint.setColor(mColor);
mTextPaint.setStyle(Paint.Style.FILL);
mTextPaint.setTypeface(getTypeface());
mTextPaintOutline = new TextPaint();
mTextPaintOutline.setAntiAlias(true);
mTextPaintOutline.setTextSize(getTextSize());
mTextPaintOutline.setColor(mBorderColor);
mTextPaintOutline.setStyle(Paint.Style.STROKE);
mTextPaintOutline.setTypeface(getTypeface());
mTextPaintOutline.setStrokeWidth(mBorderSize);
}
|
<DeepExtract>
mTextPaint = new TextPaint();
mTextPaint.setAntiAlias(true);
mTextPaint.setTextSize(getTextSize());
mTextPaint.setColor(mColor);
mTextPaint.setStyle(Paint.Style.FILL);
mTextPaint.setTypeface(getTypeface());
mTextPaintOutline = new TextPaint();
mTextPaintOutline.setAntiAlias(true);
mTextPaintOutline.setTextSize(getTextSize());
mTextPaintOutline.setColor(mBorderColor);
mTextPaintOutline.setStyle(Paint.Style.STROKE);
mTextPaintOutline.setTypeface(getTypeface());
mTextPaintOutline.setStrokeWidth(mBorderSize);
</DeepExtract>
|
BambooPlayer
|
positive
|
private void moveArcPosition() {
double radians = Math.toRadians(currentRotation);
float translateX = (float) Math.cos(radians) * (shipSpeedLevels[currentSpeedLevel]);
float translateY = (float) Math.sin(radians) * (shipSpeedLevels[currentSpeedLevel]);
arkSprite.translate(translateX, translateY);
shipPosition.x = arkSprite.getX();
shipPosition.y = arkSprite.getY();
sprite.setPosition(shipPosition.x - sprite.getWidth() / 2, shipPosition.y - sprite.getHeight() / 2);
tmpVector.set(shipPosition.x, shipPosition.y);
body.setTransform(shipPosition.x, shipPosition.y, 0);
}
|
<DeepExtract>
sprite.setPosition(shipPosition.x - sprite.getWidth() / 2, shipPosition.y - sprite.getHeight() / 2);
tmpVector.set(shipPosition.x, shipPosition.y);
body.setTransform(shipPosition.x, shipPosition.y, 0);
</DeepExtract>
|
Alien-Ark
|
positive
|
public void initEvents() {
List<EEvent> list = new LinkedList<>();
list.add(new EEvent(CPP_TIME, EEvent.CPP));
for (int i = 0; i < 10; ++i) {
long time = i * SINGLE_CYCLE + OFFSET_10P;
EEvent e = new EEvent(time, EEvent.PULSE_10P);
list.add(e);
}
for (int i = 1; i < 10; ++i) {
long time = i * SINGLE_CYCLE;
EEvent e = new EEvent(time, EEvent.PULSE_9P);
list.add(e);
}
list.add(new EEvent(10, EEvent.PULSE_1P));
list.add(new EEvent(20, EEvent.PULSE_2P));
list.add(new EEvent(30, EEvent.PULSE_2P));
list.add(new EEvent(40, EEvent.PULSE_2AP));
list.add(new EEvent(50, EEvent.PULSE_2AP));
list.add(new EEvent(60, EEvent.PULSE_4P));
list.add(new EEvent(70, EEvent.PULSE_4P));
list.add(new EEvent(80, EEvent.PULSE_4P));
list.add(new EEvent(90, EEvent.PULSE_4P));
list.add(new EEvent(100, EEvent.PULSE_1AP));
list.add(new EEvent(110, EEvent.CCG_UP));
list.add(new EEvent(180, EEvent.CCG_DOWN));
list.add(new EEvent(130, EEvent.RP));
list.add(new EEvent(190, EEvent.RP));
list.add(new EEvent(ADDITION_CYCLE, EEvent.GENERATE_NEW));
for (int i = 0; i < 20; ++i) {
list.add(new EEvent(i * 10 + 6, EEvent.NOP));
}
for (int i = 10; i < 20; ++i) {
list.add(new EEvent(i * 10 + 3, EEvent.NOP));
list.add(new EEvent(i * 10 + 6, EEvent.NOP));
}
list.add(new EEvent(120, EEvent.NOP));
list.add(new EEvent(140, EEvent.NOP));
list.add(new EEvent(150, EEvent.NOP));
list.add(new EEvent(160, EEvent.NOP));
_events = new EEvent[list.size()];
Collections.shuffle(list);
list.toArray(_events);
_queue.insert(_events);
notifyAll();
}
|
<DeepExtract>
_queue.insert(_events);
notifyAll();
</DeepExtract>
|
eniac
|
positive
|
@Override
public void clear() {
if (mMemoryCache != null) {
mMemoryCache.evictAll();
VolleyLog.d(TAG, "Memory cache cleared");
}
}
|
<DeepExtract>
if (mMemoryCache != null) {
mMemoryCache.evictAll();
VolleyLog.d(TAG, "Memory cache cleared");
}
</DeepExtract>
|
VolleyPlus
|
positive
|
void writeTagLine(String tag, Object value) throws IOException {
tagWriter.write(Constants.COMMENT_PREFIX + tag + Constants.EXT_TAG_END + value);
tagWriter.write("\n");
}
|
<DeepExtract>
tagWriter.write(Constants.COMMENT_PREFIX + tag + Constants.EXT_TAG_END + value);
tagWriter.write("\n");
</DeepExtract>
|
open-m3u8
|
positive
|
public void visitElmntGreaterThanOrEqualOp(@NotNull JuliaElmntGreaterThanOrEqualOp o) {
visitPsiElement(o);
}
|
<DeepExtract>
visitPsiElement(o);
</DeepExtract>
|
juliafy
|
positive
|
private void sendSuccess(ResultReceiver receiver, Bundle data) {
DataDroidLog.d(LOG_TAG, "sendResult : " + ((SUCCESS_CODE == SUCCESS_CODE) ? "Success" : "Failure"));
if (receiver != null) {
if (data == null) {
data = new Bundle();
}
receiver.send(SUCCESS_CODE, data);
}
}
|
<DeepExtract>
DataDroidLog.d(LOG_TAG, "sendResult : " + ((SUCCESS_CODE == SUCCESS_CODE) ? "Success" : "Failure"));
if (receiver != null) {
if (data == null) {
data = new Bundle();
}
receiver.send(SUCCESS_CODE, data);
}
</DeepExtract>
|
Dribbble_rebuild
|
positive
|
private void init() {
if (SCALE_TYPE != SCALE_TYPE) {
throw new IllegalArgumentException(String.format("ScaleType %s not supported.", SCALE_TYPE));
}
mReady = true;
if (mSetupPending) {
setup();
mSetupPending = false;
}
}
|
<DeepExtract>
if (SCALE_TYPE != SCALE_TYPE) {
throw new IllegalArgumentException(String.format("ScaleType %s not supported.", SCALE_TYPE));
}
</DeepExtract>
|
book
|
positive
|
@Override
protected final void onSizeChanged(int w, int h, int oldw, int oldh) {
if (DEBUG) {
Log.d(LOG_TAG, String.format("onSizeChanged. W: %d, H: %d", w, h));
}
super.onSizeChanged(w, h, oldw, oldh);
final int maximumPullScroll = (int) (getMaximumPullScroll() * 1.2f);
int pLeft = getPaddingLeft();
int pTop = getPaddingTop();
int pRight = getPaddingRight();
int pBottom = getPaddingBottom();
switch(getPullToRefreshScrollDirection()) {
case HORIZONTAL:
if (mMode.showHeaderLoadingLayout()) {
mHeaderLayout.setWidth(maximumPullScroll);
pLeft = -maximumPullScroll;
} else {
pLeft = 0;
}
if (mMode.showFooterLoadingLayout()) {
mFooterLayout.setWidth(maximumPullScroll);
pRight = -maximumPullScroll;
} else {
pRight = 0;
}
break;
case VERTICAL:
if (mMode.showHeaderLoadingLayout()) {
mHeaderLayout.setHeight(maximumPullScroll);
pTop = -maximumPullScroll;
} else {
pTop = 0;
}
if (mMode.showFooterLoadingLayout()) {
mFooterLayout.setHeight(maximumPullScroll);
pBottom = -maximumPullScroll;
} else {
pBottom = 0;
}
break;
}
if (DEBUG) {
Log.d(LOG_TAG, String.format("Setting Padding. L: %d, T: %d, R: %d, B: %d", pLeft, pTop, pRight, pBottom));
}
setPadding(pLeft, pTop, pRight, pBottom);
LayoutParams lp = (LayoutParams) mRefreshableViewWrapper.getLayoutParams();
switch(getPullToRefreshScrollDirection()) {
case HORIZONTAL:
if (lp.width != w) {
lp.width = w;
mRefreshableViewWrapper.requestLayout();
}
break;
case VERTICAL:
if (lp.height != h) {
lp.height = h;
mRefreshableViewWrapper.requestLayout();
}
break;
}
post(new Runnable() {
@Override
public void run() {
requestLayout();
}
});
}
|
<DeepExtract>
final int maximumPullScroll = (int) (getMaximumPullScroll() * 1.2f);
int pLeft = getPaddingLeft();
int pTop = getPaddingTop();
int pRight = getPaddingRight();
int pBottom = getPaddingBottom();
switch(getPullToRefreshScrollDirection()) {
case HORIZONTAL:
if (mMode.showHeaderLoadingLayout()) {
mHeaderLayout.setWidth(maximumPullScroll);
pLeft = -maximumPullScroll;
} else {
pLeft = 0;
}
if (mMode.showFooterLoadingLayout()) {
mFooterLayout.setWidth(maximumPullScroll);
pRight = -maximumPullScroll;
} else {
pRight = 0;
}
break;
case VERTICAL:
if (mMode.showHeaderLoadingLayout()) {
mHeaderLayout.setHeight(maximumPullScroll);
pTop = -maximumPullScroll;
} else {
pTop = 0;
}
if (mMode.showFooterLoadingLayout()) {
mFooterLayout.setHeight(maximumPullScroll);
pBottom = -maximumPullScroll;
} else {
pBottom = 0;
}
break;
}
if (DEBUG) {
Log.d(LOG_TAG, String.format("Setting Padding. L: %d, T: %d, R: %d, B: %d", pLeft, pTop, pRight, pBottom));
}
setPadding(pLeft, pTop, pRight, pBottom);
</DeepExtract>
<DeepExtract>
LayoutParams lp = (LayoutParams) mRefreshableViewWrapper.getLayoutParams();
switch(getPullToRefreshScrollDirection()) {
case HORIZONTAL:
if (lp.width != w) {
lp.width = w;
mRefreshableViewWrapper.requestLayout();
}
break;
case VERTICAL:
if (lp.height != h) {
lp.height = h;
mRefreshableViewWrapper.requestLayout();
}
break;
}
</DeepExtract>
|
Android-Ptr-Comparison
|
positive
|
private void init() {
if (true) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
if (isHardwareAccelerated()) {
Paint hardwarePaint = new Paint();
hardwarePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.OVERLAY));
setLayerType(LAYER_TYPE_HARDWARE, hardwarePaint);
} else {
setLayerType(LAYER_TYPE_SOFTWARE, null);
}
} else {
setDrawingCacheEnabled(true);
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(LAYER_TYPE_SOFTWARE, null);
} else {
setDrawingCacheEnabled(true);
}
}
boolean hasShot = getContext().getSharedPreferences(PREFS_SHOWCASE_INTERNAL, Context.MODE_PRIVATE).getBoolean("hasShot" + getConfigOptions().showcaseId, false);
if (hasShot && mOptions.shotType == TYPE_ONE_SHOT) {
setVisibility(View.GONE);
isRedundant = true;
return;
}
showcaseRadius = metricScale * INNER_CIRCLE_RADIUS;
setOnTouchListener(this);
if (!mOptions.noButton && mEndButton.getParent() == null) {
RelativeLayout.LayoutParams lps = getConfigOptions().buttonLayoutParams;
if (lps == null) {
lps = (LayoutParams) generateDefaultLayoutParams();
lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
lps.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
int margin = ((Number) (metricScale * 12)).intValue();
lps.setMargins(margin, margin, margin, margin);
}
mEndButton.setLayoutParams(lps);
mEndButton.setText(buttonText != null ? buttonText : getResources().getString(android.R.string.ok));
if (!hasCustomClickListener) {
mEndButton.setOnClickListener(this);
}
addView(mEndButton);
}
}
|
<DeepExtract>
if (true) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
if (isHardwareAccelerated()) {
Paint hardwarePaint = new Paint();
hardwarePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.OVERLAY));
setLayerType(LAYER_TYPE_HARDWARE, hardwarePaint);
} else {
setLayerType(LAYER_TYPE_SOFTWARE, null);
}
} else {
setDrawingCacheEnabled(true);
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(LAYER_TYPE_SOFTWARE, null);
} else {
setDrawingCacheEnabled(true);
}
}
</DeepExtract>
|
tinfoil-sms
|
positive
|
public Criteria andDeletedLessThan(Boolean value) {
if (value == null) {
throw new RuntimeException("Value for " + "deleted" + " cannot be null");
}
criteria.add(new Criterion("deleted <", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "deleted" + " cannot be null");
}
criteria.add(new Criterion("deleted <", value));
</DeepExtract>
|
mybatis-generator-gui-extension
|
positive
|
void waitAndPrintChangeSetEvents(String stack, String changeSet, Waiter<DescribeChangeSetRequest> waiter, PollConfiguration pollConfiguration) throws ExecutionException {
final BasicFuture<AmazonWebServiceRequest> waitResult = new BasicFuture<>(null);
waiter.runAsync(new WaiterParameters<>(new DescribeChangeSetRequest().withStackName(stack).withChangeSetName(changeSet)).withPollingStrategy(this.pollingStrategy(pollConfiguration)), new WaiterHandler() {
@Override
public void onWaitSuccess(AmazonWebServiceRequest request) {
waitResult.completed(request);
}
@Override
public void onWaitFailure(Exception e) {
waitResult.failed(e);
}
});
Date startDate = new Date();
String lastEventId = null;
this.printLine();
this.printStackName(stack);
this.printLine();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
boolean run = true;
if (pollConfiguration.getPollInterval().toMillis() > 0) {
while (run && !waitResult.isDone()) {
try {
DescribeStackEventsResult result = this.client.describeStackEvents(new DescribeStackEventsRequest().withStackName(stack));
List<StackEvent> stackEvents = new ArrayList<>();
for (StackEvent event : result.getStackEvents()) {
if (event.getEventId().equals(lastEventId) || event.getTimestamp().before(startDate)) {
break;
}
stackEvents.add(event);
}
if (!stackEvents.isEmpty()) {
Collections.reverse(stackEvents);
for (StackEvent event : stackEvents) {
this.printEvent(sdf, event);
this.printLine();
}
lastEventId = stackEvents.get(stackEvents.size() - 1).getEventId();
}
} catch (AmazonCloudFormationException e) {
}
try {
Thread.sleep(pollConfiguration.getPollInterval().toMillis());
} catch (InterruptedException e) {
this.listener.getLogger().print("Task interrupted. Stopping event printer.");
run = false;
}
}
}
try {
waitResult.get();
} catch (InterruptedException e) {
this.listener.getLogger().format("Failed to wait for CFN action to complete: %s", e.getMessage());
}
}
|
<DeepExtract>
Date startDate = new Date();
String lastEventId = null;
this.printLine();
this.printStackName(stack);
this.printLine();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
boolean run = true;
if (pollConfiguration.getPollInterval().toMillis() > 0) {
while (run && !waitResult.isDone()) {
try {
DescribeStackEventsResult result = this.client.describeStackEvents(new DescribeStackEventsRequest().withStackName(stack));
List<StackEvent> stackEvents = new ArrayList<>();
for (StackEvent event : result.getStackEvents()) {
if (event.getEventId().equals(lastEventId) || event.getTimestamp().before(startDate)) {
break;
}
stackEvents.add(event);
}
if (!stackEvents.isEmpty()) {
Collections.reverse(stackEvents);
for (StackEvent event : stackEvents) {
this.printEvent(sdf, event);
this.printLine();
}
lastEventId = stackEvents.get(stackEvents.size() - 1).getEventId();
}
} catch (AmazonCloudFormationException e) {
}
try {
Thread.sleep(pollConfiguration.getPollInterval().toMillis());
} catch (InterruptedException e) {
this.listener.getLogger().print("Task interrupted. Stopping event printer.");
run = false;
}
}
}
try {
waitResult.get();
} catch (InterruptedException e) {
this.listener.getLogger().format("Failed to wait for CFN action to complete: %s", e.getMessage());
}
</DeepExtract>
|
pipeline-aws-plugin
|
positive
|
@Override
public void onSurfaceCreated(PineMediaPlayerView mediaPlayerView, SurfaceView surfaceView) {
mSurfaceView = (PineSurfaceView) surfaceView;
if (mMediaPlayer != null) {
if (isAttachViewMode() && mSurfaceView != null) {
mMediaPlayer.setDisplay(mSurfaceView.getHolder());
} else {
mMediaPlayer.setDisplay(null);
}
}
}
|
<DeepExtract>
if (mMediaPlayer != null) {
if (isAttachViewMode() && mSurfaceView != null) {
mMediaPlayer.setDisplay(mSurfaceView.getHolder());
} else {
mMediaPlayer.setDisplay(null);
}
}
</DeepExtract>
|
PinePlayer
|
positive
|
@Test
public void testConversionFromCartesian() {
double cartesianEpsilon = 1E-8;
Position pEq1 = new Position(0.0, 0.0, Position.WGS84_EQUATORIAL_RADIUS, true);
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq1.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq1.getLongitude()), 0.0, (pEq1.getLongitude() - 0.0) / 0.0, cartesianEpsilon);
}
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq1.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq1.getLatitude()), 0.0, (pEq1.getLatitude() - 0.0) / 0.0, cartesianEpsilon);
}
Position pEq2 = new Position(Position.WGS84_EQUATORIAL_RADIUS, 0.0, 0.0, true);
if (Math.abs(90.0) < 1.0) {
Assert.assertEquals(90.0, pEq2.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 90.0, pEq2.getLongitude()), 0.0, (pEq2.getLongitude() - 90.0) / 90.0, cartesianEpsilon);
}
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq2.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq2.getLatitude()), 0.0, (pEq2.getLatitude() - 0.0) / 0.0, cartesianEpsilon);
}
Position pEq3 = new Position(0.0, 0.0, -Position.WGS84_EQUATORIAL_RADIUS, true);
if (Math.abs(-180.0) < 1.0) {
Assert.assertEquals(-180.0, pEq3.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", -180.0, pEq3.getLongitude()), 0.0, (pEq3.getLongitude() - -180.0) / -180.0, cartesianEpsilon);
}
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq3.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq3.getLatitude()), 0.0, (pEq3.getLatitude() - 0.0) / 0.0, cartesianEpsilon);
}
Position pEq4 = new Position(-Position.WGS84_EQUATORIAL_RADIUS, 0.0, 0.0, true);
if (Math.abs(-90.0) < 1.0) {
Assert.assertEquals(-90.0, pEq4.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", -90.0, pEq4.getLongitude()), 0.0, (pEq4.getLongitude() - -90.0) / -90.0, cartesianEpsilon);
}
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq4.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq4.getLatitude()), 0.0, (pEq4.getLatitude() - 0.0) / 0.0, cartesianEpsilon);
}
Position pEq5 = new Position(Position.WGS84_EQUATORIAL_RADIUS / Math.sqrt(2), 0.0, Position.WGS84_EQUATORIAL_RADIUS / Math.sqrt(2), true);
if (Math.abs(45.0) < 1.0) {
Assert.assertEquals(45.0, pEq5.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 45.0, pEq5.getLongitude()), 0.0, (pEq5.getLongitude() - 45.0) / 45.0, cartesianEpsilon);
}
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq5.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq5.getLatitude()), 0.0, (pEq5.getLatitude() - 0.0) / 0.0, cartesianEpsilon);
}
Position pN = new Position(0.0, Position.WGS84_POLAR_RADIUS, 0.0, true);
if (Math.abs(90.0) < 1.0) {
Assert.assertEquals(90.0, pN.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 90.0, pN.getLatitude()), 0.0, (pN.getLatitude() - 90.0) / 90.0, cartesianEpsilon);
}
Position pS = new Position(0.0, -Position.WGS84_POLAR_RADIUS, 0.0, true);
if (Math.abs(-90.0) < 1.0) {
Assert.assertEquals(-90.0, pS.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", -90.0, pS.getLatitude()), 0.0, (pS.getLatitude() - -90.0) / -90.0, cartesianEpsilon);
}
Position pHalfN = new Position(0.0, Position.WGS84_POLAR_RADIUS / Math.sqrt(2), Position.WGS84_EQUATORIAL_RADIUS / Math.sqrt(2), true);
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pHalfN.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pHalfN.getLongitude()), 0.0, (pHalfN.getLongitude() - 0.0) / 0.0, cartesianEpsilon);
}
if (Math.abs(45.0) < 1.0) {
Assert.assertEquals(45.0, pHalfN.getLatitude(), 5E-3);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 45.0, pHalfN.getLatitude()), 0.0, (pHalfN.getLatitude() - 45.0) / 45.0, 5E-3);
}
}
|
<DeepExtract>
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq1.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq1.getLongitude()), 0.0, (pEq1.getLongitude() - 0.0) / 0.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq1.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq1.getLatitude()), 0.0, (pEq1.getLatitude() - 0.0) / 0.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(90.0) < 1.0) {
Assert.assertEquals(90.0, pEq2.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 90.0, pEq2.getLongitude()), 0.0, (pEq2.getLongitude() - 90.0) / 90.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq2.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq2.getLatitude()), 0.0, (pEq2.getLatitude() - 0.0) / 0.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(-180.0) < 1.0) {
Assert.assertEquals(-180.0, pEq3.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", -180.0, pEq3.getLongitude()), 0.0, (pEq3.getLongitude() - -180.0) / -180.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq3.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq3.getLatitude()), 0.0, (pEq3.getLatitude() - 0.0) / 0.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(-90.0) < 1.0) {
Assert.assertEquals(-90.0, pEq4.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", -90.0, pEq4.getLongitude()), 0.0, (pEq4.getLongitude() - -90.0) / -90.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq4.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq4.getLatitude()), 0.0, (pEq4.getLatitude() - 0.0) / 0.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(45.0) < 1.0) {
Assert.assertEquals(45.0, pEq5.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 45.0, pEq5.getLongitude()), 0.0, (pEq5.getLongitude() - 45.0) / 45.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pEq5.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pEq5.getLatitude()), 0.0, (pEq5.getLatitude() - 0.0) / 0.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(90.0) < 1.0) {
Assert.assertEquals(90.0, pN.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 90.0, pN.getLatitude()), 0.0, (pN.getLatitude() - 90.0) / 90.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(-90.0) < 1.0) {
Assert.assertEquals(-90.0, pS.getLatitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", -90.0, pS.getLatitude()), 0.0, (pS.getLatitude() - -90.0) / -90.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(0.0) < 1.0) {
Assert.assertEquals(0.0, pHalfN.getLongitude(), cartesianEpsilon);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 0.0, pHalfN.getLongitude()), 0.0, (pHalfN.getLongitude() - 0.0) / 0.0, cartesianEpsilon);
}
</DeepExtract>
<DeepExtract>
if (Math.abs(45.0) < 1.0) {
Assert.assertEquals(45.0, pHalfN.getLatitude(), 5E-3);
} else {
Assert.assertEquals(String.format("Expected %.4f, got %.4f", 45.0, pHalfN.getLatitude()), 0.0, (pHalfN.getLatitude() - 45.0) / 45.0, 5E-3);
}
</DeepExtract>
|
ensemble-clustering
|
positive
|
public static void drawFullFace(final AxisAlignedBB bb, final BlockPos blockPos, final float width, final int red, final int green, final int blue, final int alpha, final int alpha2) {
NordTessellator.prepareGL();
NordTessellator.begin(7);
drawFace(INSTANCE.getBuffer(), (float) blockPos.x, (float) blockPos.y, (float) blockPos.z, 1.0f, 1.0f, 1.0f, red, green, blue, alpha, 63);
NordTessellator.render();
NordTessellator.releaseGL();
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.disableDepth();
GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
GL11.glEnable(2848);
GL11.glHint(3154, 4354);
GL11.glLineWidth(width);
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR);
bufferbuilder.pos(bb.minX, bb.minY, bb.minZ).color(red, green, blue, alpha2).endVertex();
bufferbuilder.pos(bb.minX, bb.minY, bb.maxZ).color(red, green, blue, alpha2).endVertex();
bufferbuilder.pos(bb.maxX, bb.minY, bb.maxZ).color(red, green, blue, alpha2).endVertex();
bufferbuilder.pos(bb.maxX, bb.minY, bb.minZ).color(red, green, blue, alpha2).endVertex();
bufferbuilder.pos(bb.minX, bb.minY, bb.minZ).color(red, green, blue, alpha2).endVertex();
tessellator.draw();
GL11.glDisable(2848);
GlStateManager.depthMask(true);
GlStateManager.enableDepth();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
|
<DeepExtract>
NordTessellator.prepareGL();
NordTessellator.begin(7);
</DeepExtract>
<DeepExtract>
drawFace(INSTANCE.getBuffer(), (float) blockPos.x, (float) blockPos.y, (float) blockPos.z, 1.0f, 1.0f, 1.0f, red, green, blue, alpha, 63);
</DeepExtract>
<DeepExtract>
NordTessellator.render();
NordTessellator.releaseGL();
</DeepExtract>
<DeepExtract>
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.disableDepth();
GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
GL11.glEnable(2848);
GL11.glHint(3154, 4354);
GL11.glLineWidth(width);
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR);
bufferbuilder.pos(bb.minX, bb.minY, bb.minZ).color(red, green, blue, alpha2).endVertex();
bufferbuilder.pos(bb.minX, bb.minY, bb.maxZ).color(red, green, blue, alpha2).endVertex();
bufferbuilder.pos(bb.maxX, bb.minY, bb.maxZ).color(red, green, blue, alpha2).endVertex();
bufferbuilder.pos(bb.maxX, bb.minY, bb.minZ).color(red, green, blue, alpha2).endVertex();
bufferbuilder.pos(bb.minX, bb.minY, bb.minZ).color(red, green, blue, alpha2).endVertex();
tessellator.draw();
GL11.glDisable(2848);
GlStateManager.depthMask(true);
GlStateManager.enableDepth();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
</DeepExtract>
|
CousinWare
|
positive
|
@Override
protected void initialize() throws Exception {
TextFieldUtil.applyPositiveIntegerFilter(textFieldRandomInputSize, AppConstant.DEFAULT_INPUT_SIZE);
TextFieldUtil.applyPositiveDoubleFilter(textFieldRandomInputRangeMin, AppConstant.DEFAULT_RANDOM_RANGE_MIN);
TextFieldUtil.applyPositiveDoubleFilter(textFieldRandomInputRangeMax, AppConstant.DEFAULT_RANDOM_RANGE_MAX);
TextFieldUtil.applyPositiveIntegerFilter(textFieldRandomRecordNumber, AppConstant.DEFAULT_RANDOM_RECORD_NUMBER);
toggleGroupDataType.selectedToggleProperty().addListener(event -> {
if (radioButtonGaussianType.isSelected()) {
textFieldRandomInputRangeMin.setDisable(true);
textFieldRandomInputRangeMax.setDisable(true);
} else {
textFieldRandomInputRangeMin.setDisable(false);
textFieldRandomInputRangeMax.setDisable(false);
}
});
buttonGenerateRandomData.setOnAction(event -> {
int inputSize = TextFieldUtil.parseInteger(textFieldRandomInputSize);
int recordNumber = TextFieldUtil.parseInteger(textFieldRandomRecordNumber);
double randomRangeMin = TextFieldUtil.parseDouble(textFieldRandomInputRangeMin);
double randomRangeMax = TextFieldUtil.parseDouble(textFieldRandomInputRangeMax);
NumericRecordSet numericRecordSet = new NumericRecordSet();
for (int i = 0; i < recordNumber; i++) {
double[] values = new double[inputSize];
if (radioButtonIntegerType.isSelected()) {
for (int j = 0; j < inputSize; j++) values[j] = (double) RandomUtil.getInt(randomRangeMin, randomRangeMax);
} else if (radioButtonDoubleType.isSelected()) {
for (int j = 0; j < inputSize; j++) values[j] = RandomUtil.getDouble(randomRangeMin, randomRangeMax);
} else if (radioButtonGaussianType.isSelected()) {
for (int j = 0; j < inputSize; j++) values[j] = RandomUtil.getGaussian();
}
numericRecordSet.addRecord(values);
}
String[] headers = new String[inputSize];
for (int i = 0; i < inputSize; i++) headers[i] = "Column " + i;
numericRecordSet.setHeader(headers);
AIFacade.getTestFeatureSet().setNumericRecordSet(numericRecordSet);
getTabModelTestController().getModelTestFeatureController().getModelTestFeatureTableController().refreshTableView();
});
titledPane.setText(AppPropertiesSingleton.getInstance().get("frame.testTab.dataSetting.dataRandomGenerate.title"));
labelRandomMin.setText(AppPropertiesSingleton.getInstance().get("frame.testTab.dataSetting.dataRandomGenerate.min"));
labelRandomMax.setText(AppPropertiesSingleton.getInstance().get("frame.testTab.dataSetting.dataRandomGenerate.max"));
labelRandom.setText(AppPropertiesSingleton.getInstance().get("frame.testTab.dataSetting.dataRandomGenerate.randomRange"));
labelRandomInputSize.setText(AppPropertiesSingleton.getInstance().get("frame.testTab.dataSetting.dataRandomGenerate.inputSize"));
labelRandomRecordNumber.setText(AppPropertiesSingleton.getInstance().get("frame.testTab.dataSetting.dataRandomGenerate.totalDataSize"));
labelRandomDataType.setText(AppPropertiesSingleton.getInstance().get("frame.testTab.dataSetting.dataRandomGenerate.dataType"));
radioButtonIntegerType.setText(AppPropertiesSingleton.getInstance().get("frame.testTab.dataSetting.dataRandomGenerate.integer"));
radioButtonDoubleType.setText(AppPropertiesSingleton.getInstance().get("frame.testTab.dataSetting.dataRandomGenerate.float"));
radioButtonGaussianType.setText(AppPropertiesSingleton.getInstance().get("frame.testTab.dataSetting.dataRandomGenerate.gaussian"));
buttonGenerateRandomData.setText(AppPropertiesSingleton.getInstance().get("frame.testTab.dataSetting.dataRandomGenerate.generate"));
}
|
<DeepExtract>
buttonGenerateRandomData.setOnAction(event -> {
int inputSize = TextFieldUtil.parseInteger(textFieldRandomInputSize);
int recordNumber = TextFieldUtil.parseInteger(textFieldRandomRecordNumber);
double randomRangeMin = TextFieldUtil.parseDouble(textFieldRandomInputRangeMin);
double randomRangeMax = TextFieldUtil.parseDouble(textFieldRandomInputRangeMax);
NumericRecordSet numericRecordSet = new NumericRecordSet();
for (int i = 0; i < recordNumber; i++) {
double[] values = new double[inputSize];
if (radioButtonIntegerType.isSelected()) {
for (int j = 0; j < inputSize; j++) values[j] = (double) RandomUtil.getInt(randomRangeMin, randomRangeMax);
} else if (radioButtonDoubleType.isSelected()) {
for (int j = 0; j < inputSize; j++) values[j] = RandomUtil.getDouble(randomRangeMin, randomRangeMax);
} else if (radioButtonGaussianType.isSelected()) {
for (int j = 0; j < inputSize; j++) values[j] = RandomUtil.getGaussian();
}
numericRecordSet.addRecord(values);
}
String[] headers = new String[inputSize];
for (int i = 0; i < inputSize; i++) headers[i] = "Column " + i;
numericRecordSet.setHeader(headers);
AIFacade.getTestFeatureSet().setNumericRecordSet(numericRecordSet);
getTabModelTestController().getModelTestFeatureController().getModelTestFeatureTableController().refreshTableView();
});
</DeepExtract>
|
Dluid
|
positive
|
@Override
public void startDragging() {
if (actionMode != null) {
actionMode.finish();
actionMode = null;
try {
int selected = getMultiSelectListSingleCheckedItemPosition(userList);
userList.setItemChecked(selected, false);
} catch (IllegalStateException e) {
Log.e(getString(R.string.app_name), LOCAL_TAG, e);
}
}
}
|
<DeepExtract>
if (actionMode != null) {
actionMode.finish();
actionMode = null;
try {
int selected = getMultiSelectListSingleCheckedItemPosition(userList);
userList.setItemChecked(selected, false);
} catch (IllegalStateException e) {
Log.e(getString(R.string.app_name), LOCAL_TAG, e);
}
}
</DeepExtract>
|
google-authenticator-android
|
positive
|
public static LookupSet read(URL url, boolean mustExist, int minFreq, int maxFreq, Io.StringToIntsErr si) {
LookupSetBuilder lsb = new LookupSetBuilder(minFreq, maxFreq);
lsb.setMessage(String.format(" in %s", url.getPath()));
LineReader lr = new LineReader(url, mustExist);
StringBuilder err = new StringBuilder();
while ((line = lr.readLine()) != null) {
int[] in = si.cvt(line.trim(), err);
if (in.length < 1 || in[0] == Io.sm_PARSE_FAILED || (in.length >= 2 && in[1] == Io.sm_PARSE_FAILED)) {
Log.parseErr(lr, err.toString(), line);
err = new StringBuilder();
}
if (in.length == 1) {
lsb.add(in[0]);
} else {
lsb.add(in[0], in[1]);
}
}
lr.close();
return super.implement();
}
|
<DeepExtract>
return super.implement();
</DeepExtract>
|
twidlit
|
positive
|
public Criteria andStudentIdNotIn(List<Long> values) {
if (values == null) {
throw new RuntimeException("Value for " + "studentId" + " cannot be null");
}
criteria.add(new Criterion("student_id not in", values));
return (Criteria) this;
}
|
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "studentId" + " cannot be null");
}
criteria.add(new Criterion("student_id not in", values));
</DeepExtract>
|
IDEAPractice
|
positive
|
@Override
public int executeUpdate(final String sql, final String[] columnNames) throws SQLException {
if (isClosed)
throw new SQLAlreadyClosedException(this.getClass().getSimpleName());
return 0;
}
|
<DeepExtract>
if (isClosed)
throw new SQLAlreadyClosedException(this.getClass().getSimpleName());
</DeepExtract>
|
mongo-jdbc-driver
|
positive
|
public static JSONObject successJSONWithToken(String token, Object data) {
JSONObject returnJson = new JSONObject();
returnJson.put("code", PinConstants.StatusCode.SUCCESS);
returnJson.put("message", "Token needs update.");
returnJson.put("data", data);
returnJson.put("token", token);
returnJson.put("serverHost", hostAddress);
return returnJson;
}
|
<DeepExtract>
returnJson.put("serverHost", hostAddress);
return returnJson;
</DeepExtract>
|
Shop-pin-Backend
|
positive
|
private void cancelAnimations() {
if (mSecondAnimation != null && mSecondAnimation.isRunning()) {
mSecondAnimation.stop();
}
if (mThirdAnimation != null && mThirdAnimation.isRunning()) {
mThirdAnimation.stop();
}
}
|
<DeepExtract>
if (mSecondAnimation != null && mSecondAnimation.isRunning()) {
mSecondAnimation.stop();
}
</DeepExtract>
<DeepExtract>
if (mThirdAnimation != null && mThirdAnimation.isRunning()) {
mThirdAnimation.stop();
}
</DeepExtract>
|
androidRapid
|
positive
|
public void componentMoved(ComponentEvent e) {
Rectangle b = e.getComponent().getBounds();
try {
if (absCoords) {
final Container cp = SwingUtilities.getRootPane(e.getComponent()).getContentPane();
b = GUIUtil.convertRectangle(e.getComponent(), b, cp);
}
replyArgs[1] = "moved";
replyArgs[2] = new Integer(b.x);
replyArgs[3] = new Integer(b.y);
replyArgs[4] = new Integer(b.width);
replyArgs[5] = new Integer(b.height);
client.reply(new OSCMessage(getOSCCommand(), replyArgs));
} catch (IOException ex) {
SwingOSC.printException(ex, getOSCCommand());
}
}
|
<DeepExtract>
Rectangle b = e.getComponent().getBounds();
try {
if (absCoords) {
final Container cp = SwingUtilities.getRootPane(e.getComponent()).getContentPane();
b = GUIUtil.convertRectangle(e.getComponent(), b, cp);
}
replyArgs[1] = "moved";
replyArgs[2] = new Integer(b.x);
replyArgs[3] = new Integer(b.y);
replyArgs[4] = new Integer(b.width);
replyArgs[5] = new Integer(b.height);
client.reply(new OSCMessage(getOSCCommand(), replyArgs));
} catch (IOException ex) {
SwingOSC.printException(ex, getOSCCommand());
}
</DeepExtract>
|
SwingOSC
|
positive
|
@Override
public void debug(final String format, final Object... argArray) {
if (!DEBUG.isGreaterOrEqual(minimum))
throw new IllegalStateException(format("%s logging disabled for logger \"%s\" [%s]", DEBUG, getName(), getClass().getName()));
super.debug(format, argArray);
}
|
<DeepExtract>
if (!DEBUG.isGreaterOrEqual(minimum))
throw new IllegalStateException(format("%s logging disabled for logger \"%s\" [%s]", DEBUG, getName(), getClass().getName()));
</DeepExtract>
|
binkley
|
positive
|
private JSONObject execute() throws IOException {
assert (client != null);
response = this.client.send(buildRequest());
if (response == null) {
throw new IOException("No response received");
}
if (response.get("type").equals("error")) {
logger.error("Invalid response: {}", response.toString());
throw new IOException(response.get("text").toString());
}
return response;
}
|
<DeepExtract>
if (response == null) {
throw new IOException("No response received");
}
if (response.get("type").equals("error")) {
logger.error("Invalid response: {}", response.toString());
throw new IOException(response.get("text").toString());
}
</DeepExtract>
<DeepExtract>
</DeepExtract>
|
archivo
|
positive
|
@Override
public void onClick(View v) {
if (windowToken != null) {
InputMethodManager imm = (InputMethodManager) context.get().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(windowToken, 0);
}
if (onOtherButtonClickListener != null) {
if (!onOtherButtonClickListener.onClick(InputDialog.this, v, getInputText()))
materialAlertDialog.dismiss();
} else {
materialAlertDialog.dismiss();
}
}
|
<DeepExtract>
if (windowToken != null) {
InputMethodManager imm = (InputMethodManager) context.get().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(windowToken, 0);
}
</DeepExtract>
|
DialogV3
|
positive
|
@Test
public void testSetStatus() throws Throwable {
this.requestAction = http -> http.setStatus(HttpStatus.NOT_FOUND).end();
client.newRequest(uri()).send(new Response.Listener.Adapter() {
@Override
public void onSuccess(Response response) {
threadAssertEquals(response.getStatus(), 404);
resume();
}
});
await();
}
|
<DeepExtract>
this.requestAction = http -> http.setStatus(HttpStatus.NOT_FOUND).end();
</DeepExtract>
|
asity
|
positive
|
public void drawLineOrder(LineOrder line) {
int x1 = line.getStartX();
int y1 = line.getStartY();
int x2 = line.getEndX();
int y2 = line.getEndY();
int fgcolor = line.getPen().getColor();
int opcode = line.getOpcode() - 1;
fgcolor = Bitmap.convertTo24(fgcolor);
if (x1 == x2 || y1 == y2) {
drawLineVerticalHorizontal(x1, y1, x2, y2, fgcolor, opcode);
return;
}
int deltax = Math.abs(x2 - x1);
int deltay = Math.abs(y2 - y1);
int x = x1;
int y = y1;
int xinc1, xinc2, yinc1, yinc2;
int num, den, numadd, numpixels;
if (x2 >= x1) {
xinc1 = 1;
xinc2 = 1;
} else {
xinc1 = -1;
xinc2 = -1;
}
if (y2 >= y1) {
yinc1 = 1;
yinc2 = 1;
} else {
yinc1 = -1;
yinc2 = -1;
}
if (deltax >= deltay) {
xinc1 = 0;
yinc2 = 0;
den = deltax;
num = deltax / 2;
numadd = deltay;
numpixels = deltax;
} else {
xinc2 = 0;
yinc1 = 0;
den = deltay;
num = deltay / 2;
numadd = deltax;
numpixels = deltay;
}
for (int curpixel = 0; curpixel <= numpixels; curpixel++) {
setPixel(opcode, x, y, fgcolor);
num += numadd;
if (num >= den) {
num -= den;
x += xinc1;
y += yinc1;
}
x += xinc2;
y += yinc2;
}
int x_min = x1 < x2 ? x1 : x2;
int x_max = x1 > x2 ? x1 : x2;
int y_min = y1 < y2 ? y1 : y2;
int y_max = y1 > y2 ? y1 : y2;
Common.currentImageViewer.postInvalidate();
}
|
<DeepExtract>
fgcolor = Bitmap.convertTo24(fgcolor);
if (x1 == x2 || y1 == y2) {
drawLineVerticalHorizontal(x1, y1, x2, y2, fgcolor, opcode);
return;
}
int deltax = Math.abs(x2 - x1);
int deltay = Math.abs(y2 - y1);
int x = x1;
int y = y1;
int xinc1, xinc2, yinc1, yinc2;
int num, den, numadd, numpixels;
if (x2 >= x1) {
xinc1 = 1;
xinc2 = 1;
} else {
xinc1 = -1;
xinc2 = -1;
}
if (y2 >= y1) {
yinc1 = 1;
yinc2 = 1;
} else {
yinc1 = -1;
yinc2 = -1;
}
if (deltax >= deltay) {
xinc1 = 0;
yinc2 = 0;
den = deltax;
num = deltax / 2;
numadd = deltay;
numpixels = deltax;
} else {
xinc2 = 0;
yinc1 = 0;
den = deltay;
num = deltay / 2;
numadd = deltax;
numpixels = deltay;
}
for (int curpixel = 0; curpixel <= numpixels; curpixel++) {
setPixel(opcode, x, y, fgcolor);
num += numadd;
if (num >= den) {
num -= den;
x += xinc1;
y += yinc1;
}
x += xinc2;
y += yinc2;
}
int x_min = x1 < x2 ? x1 : x2;
int x_max = x1 > x2 ? x1 : x2;
int y_min = y1 < y2 ? y1 : y2;
int y_max = y1 > y2 ? y1 : y2;
Common.currentImageViewer.postInvalidate();
</DeepExtract>
|
omnidesk
|
positive
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.