before stringlengths 33 3.21M | after stringlengths 63 3.21M | repo stringlengths 1 56 | type stringclasses 1
value | __index_level_0__ int64 0 442k |
|---|---|---|---|---|
final int getUpNestedPreScrollRange() {
if (mTotalScrollRange != INVALID_SCROLL_RANGE) {
return mTotalScrollRange;
}
int range = 0;
for (int i = 0, z = getChildCount(); i < z; i++) {
final View child = getChildAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int childHeight = ViewCompat.isLaidOut(child) ? child.getHeight() : child.getMeasuredHeight();
final int flags = lp.mScrollFlags;
if ((flags & LayoutParams.SCROLL_FLAG_SCROLL) != 0) {
range += childHeight + lp.topMargin + lp.bottomMargin;
if ((flags & LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED) != 0) {
range -= ViewCompat.getMinimumHeight(child);
break;
}
} else {
break;
}
}
final int top = mLastInsets != null ? mLastInsets.getSystemWindowInsetTop() : 0;
return mTotalScrollRange = (range - top);
} | final int getUpNestedPreScrollRange() {
<DeepExtract>
if (mTotalScrollRange != INVALID_SCROLL_RANGE) {
return mTotalScrollRange;
}
int range = 0;
for (int i = 0, z = getChildCount(); i < z; i++) {
final View child = getChildAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int childHeight = ViewCompat.isLaidOut(child) ? child.getHeight() : child.getMeasuredHeight();
final int flags = lp.mScrollFlags;
if ((flags & LayoutParams.SCROLL_FLAG_SCROLL) != 0) {
range += childHeight + lp.topMargin + lp.bottomMargin;
if ((flags & LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED) != 0) {
range -= ViewCompat.getMinimumHeight(child);
break;
}
} else {
break;
}
}
final int top = mLastInsets != null ? mLastInsets.getSystemWindowInsetTop() : 0;
return mTotalScrollRange = (range - top);
</DeepExtract>
} | ForceTouch | positive | 3,373 |
@Override
public void onClick(DialogInterface dialogInterface, int which) {
int year = mDatePicker.getYear();
int month = mDatePicker.getMonth();
int day = mDatePicker.getDayOfMonth();
Date date = new GregorianCalendar(year, month, day).getTime();
if (getTargetFragment() == null) {
return;
}
Intent intent = new Intent();
intent.putExtra(EXTRA_DATE, date);
getTargetFragment().onActivityResult(getTargetRequestCode(), Activity.RESULT_OK, intent);
} | @Override
public void onClick(DialogInterface dialogInterface, int which) {
int year = mDatePicker.getYear();
int month = mDatePicker.getMonth();
int day = mDatePicker.getDayOfMonth();
Date date = new GregorianCalendar(year, month, day).getTime();
<DeepExtract>
if (getTargetFragment() == null) {
return;
}
Intent intent = new Intent();
intent.putExtra(EXTRA_DATE, date);
getTargetFragment().onActivityResult(getTargetRequestCode(), Activity.RESULT_OK, intent);
</DeepExtract>
} | Android-Programming-The-Big-Nerd-Ranch-Guide-3rd-Edition | positive | 3,374 |
public void setMediaController(MediaController controller) {
if (mMediaController != null)
mMediaController.hide();
mMediaController = controller;
if (mMediaPlayer != null && mMediaController != null) {
mMediaController.setMediaPlayer(this);
View anchorView = this.getParent() instanceof View ? (View) this.getParent() : this;
mMediaController.setAnchorView(anchorView);
mMediaController.setEnabled(isInPlaybackState());
if (mUri != null) {
List<String> paths = mUri.getPathSegments();
String name = paths == null || paths.isEmpty() ? "null" : paths.get(paths.size() - 1);
mMediaController.setFileName(name);
}
}
} | public void setMediaController(MediaController controller) {
if (mMediaController != null)
mMediaController.hide();
mMediaController = controller;
<DeepExtract>
if (mMediaPlayer != null && mMediaController != null) {
mMediaController.setMediaPlayer(this);
View anchorView = this.getParent() instanceof View ? (View) this.getParent() : this;
mMediaController.setAnchorView(anchorView);
mMediaController.setEnabled(isInPlaybackState());
if (mUri != null) {
List<String> paths = mUri.getPathSegments();
String name = paths == null || paths.isEmpty() ? "null" : paths.get(paths.size() - 1);
mMediaController.setFileName(name);
}
}
</DeepExtract>
} | Torrent | positive | 3,375 |
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
int level = 0;
if (signalStrength == null) {
cellLevel = -1;
}
if (signalStrength.isGsm()) {
level = getGsmLevel(signalStrength);
} else {
int cdmaLevel = getCdmaLevel(signalStrength);
int evdoLevel = getEvdoLevel(signalStrength);
if (evdoLevel == 0) {
level = cdmaLevel;
} else if (cdmaLevel == 0) {
level = evdoLevel;
} else {
level = evdoLevel > cdmaLevel ? cdmaLevel : evdoLevel;
}
}
return level;
super.onSignalStrengthsChanged(signalStrength);
} | @Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
<DeepExtract>
int level = 0;
if (signalStrength == null) {
cellLevel = -1;
}
if (signalStrength.isGsm()) {
level = getGsmLevel(signalStrength);
} else {
int cdmaLevel = getCdmaLevel(signalStrength);
int evdoLevel = getEvdoLevel(signalStrength);
if (evdoLevel == 0) {
level = cdmaLevel;
} else if (cdmaLevel == 0) {
level = evdoLevel;
} else {
level = evdoLevel > cdmaLevel ? cdmaLevel : evdoLevel;
}
}
return level;
</DeepExtract>
super.onSignalStrengthsChanged(signalStrength);
} | MyHttp | positive | 3,376 |
@Override
public void setClob(final int parameterIndex, final Clob x) throws SQLException {
super.setClob(parameterIndex, x);
synchronized (this.argc) {
while (parameterIndex >= this.argc.size()) {
this.argc.set(this.argc.size(), null);
}
this.argc.set(parameterIndex, x);
}
} | @Override
public void setClob(final int parameterIndex, final Clob x) throws SQLException {
super.setClob(parameterIndex, x);
<DeepExtract>
synchronized (this.argc) {
while (parameterIndex >= this.argc.size()) {
this.argc.set(this.argc.size(), null);
}
this.argc.set(parameterIndex, x);
}
</DeepExtract>
} | lightbox-jdbc | positive | 3,377 |
@Override
public void run() {
if (!mCaptureCallback.onImageCapture(bitmap) && bitmap != null) {
bitmap.recycle();
}
mCaptureCallback = null;
} | @Override
public void run() {
<DeepExtract>
if (!mCaptureCallback.onImageCapture(bitmap) && bitmap != null) {
bitmap.recycle();
}
mCaptureCallback = null;
</DeepExtract>
} | orangesignal-android-camera | positive | 3,378 |
@Override
protected void setup(Shell shell) {
super.setup(shell);
Point parentSize = mainWindow.getShell().getSize();
float ratio = 0.7f;
shell.setSize(Math.round(ratio * parentSize.x), Math.round(ratio * parentSize.y));
SWTMainWindow.centerShellRelatively(getParent(), shell);
} | @Override
protected void setup(Shell shell) {
super.setup(shell);
<DeepExtract>
Point parentSize = mainWindow.getShell().getSize();
float ratio = 0.7f;
shell.setSize(Math.round(ratio * parentSize.x), Math.round(ratio * parentSize.y));
</DeepExtract>
SWTMainWindow.centerShellRelatively(getParent(), shell);
} | TimeCult | positive | 3,379 |
public static <T> RestResult<T> failed(Exception e) {
RestResult<T> restResult = new RestResult<>(false);
if (e instanceof ServiceException) {
restResult.setErrorType(((ServiceException) e).getErrorType());
} else {
restResult.setErrorType(ErrorType.UNKNOWN_ERROR);
}
this.errorMessage = e.getMessage();
return restResult;
} | public static <T> RestResult<T> failed(Exception e) {
RestResult<T> restResult = new RestResult<>(false);
if (e instanceof ServiceException) {
restResult.setErrorType(((ServiceException) e).getErrorType());
} else {
restResult.setErrorType(ErrorType.UNKNOWN_ERROR);
}
<DeepExtract>
this.errorMessage = e.getMessage();
</DeepExtract>
return restResult;
} | flink-sql-computing-platform | positive | 3,380 |
protected void doClearLocationData() {
mDatasource.clearAllCoordinates();
String count_status;
int count = 0;
if (mStatusQ.size() > 0) {
StringBuilder sb = new StringBuilder();
for (String s : mStatusQ) {
sb.append(s);
sb.append(Const.DELIM_SYM);
}
getResources().getString(R.string.status_location_data_cleared) = sb.toString();
mStatusQ.clear();
mPushRightIn = mPushDownIn;
} else if ((getResources().getString(R.string.status_location_data_cleared) == null) || (getResources().getString(R.string.status_location_data_cleared).length() == 0)) {
if (mCursor != null)
count = mCursor.getCount();
if (count == 0)
count_status = getResources().getString(R.string.status_no_note);
else
count_status = Integer.toString(count) + getResources().getString(R.string.status_count);
if ((mCriteria != null) && (mCriteria.length() > 0))
if ((mCriteria.equals(Const.MODIFIED_AFTER_FILTER)) || (mCriteria.equals(Const.ACCESSED_AFTER_FILTER)))
getResources().getString(R.string.status_location_data_cleared) = Utils.convertCriteriaToStatus(getApplicationContext(), mCriteria, mDateFilter) + ": " + count_status;
else if (mCriteria.equals(Const.MODIFIED_NEARBY_FILTER))
getResources().getString(R.string.status_location_data_cleared) = Utils.convertCriteriaToStatus(getApplicationContext(), mCriteria, -1L) + count_status;
else
getResources().getString(R.string.status_location_data_cleared) = mCriteria + ": " + count_status;
else
getResources().getString(R.string.status_location_data_cleared) = count_status;
}
if (mPushRightIn != null)
mStatusMsg.startAnimation(mPushRightIn);
mStatusMsg.setText(getResources().getString(R.string.status_location_data_cleared));
} | protected void doClearLocationData() {
mDatasource.clearAllCoordinates();
<DeepExtract>
String count_status;
int count = 0;
if (mStatusQ.size() > 0) {
StringBuilder sb = new StringBuilder();
for (String s : mStatusQ) {
sb.append(s);
sb.append(Const.DELIM_SYM);
}
getResources().getString(R.string.status_location_data_cleared) = sb.toString();
mStatusQ.clear();
mPushRightIn = mPushDownIn;
} else if ((getResources().getString(R.string.status_location_data_cleared) == null) || (getResources().getString(R.string.status_location_data_cleared).length() == 0)) {
if (mCursor != null)
count = mCursor.getCount();
if (count == 0)
count_status = getResources().getString(R.string.status_no_note);
else
count_status = Integer.toString(count) + getResources().getString(R.string.status_count);
if ((mCriteria != null) && (mCriteria.length() > 0))
if ((mCriteria.equals(Const.MODIFIED_AFTER_FILTER)) || (mCriteria.equals(Const.ACCESSED_AFTER_FILTER)))
getResources().getString(R.string.status_location_data_cleared) = Utils.convertCriteriaToStatus(getApplicationContext(), mCriteria, mDateFilter) + ": " + count_status;
else if (mCriteria.equals(Const.MODIFIED_NEARBY_FILTER))
getResources().getString(R.string.status_location_data_cleared) = Utils.convertCriteriaToStatus(getApplicationContext(), mCriteria, -1L) + count_status;
else
getResources().getString(R.string.status_location_data_cleared) = mCriteria + ": " + count_status;
else
getResources().getString(R.string.status_location_data_cleared) = count_status;
}
if (mPushRightIn != null)
mStatusMsg.startAnimation(mPushRightIn);
mStatusMsg.setText(getResources().getString(R.string.status_location_data_cleared));
</DeepExtract>
} | neutrinote | positive | 3,381 |
@Override
public void actionPerformed(ActionEvent e) {
LoginDialog loginDialog = new LoginDialog(this);
Login login = new Login();
loginDialog.setUsername(login.getUsername());
loginDialog.setPassword(login.getPassword());
loginDialog.setModal(true);
loginDialog.setVisible(true);
if (loginDialog.getDialogResult() == JOptionPane.OK_OPTION) {
login.setUsername(loginDialog.getUsername().trim());
login.setPassword(loginDialog.getPassword().trim());
String resource = loginDialog.getResource().trim();
if (!(logins.containsKey(resource))) {
logins.put(resource, login);
loginListModel.addElement(resource);
}
loginList.revalidate();
}
} | @Override
public void actionPerformed(ActionEvent e) {
<DeepExtract>
LoginDialog loginDialog = new LoginDialog(this);
Login login = new Login();
loginDialog.setUsername(login.getUsername());
loginDialog.setPassword(login.getPassword());
loginDialog.setModal(true);
loginDialog.setVisible(true);
if (loginDialog.getDialogResult() == JOptionPane.OK_OPTION) {
login.setUsername(loginDialog.getUsername().trim());
login.setPassword(loginDialog.getPassword().trim());
String resource = loginDialog.getResource().trim();
if (!(logins.containsKey(resource))) {
logins.put(resource, login);
loginListModel.addElement(resource);
}
loginList.revalidate();
}
</DeepExtract>
} | swingsane | positive | 3,382 |
public static int compareToTime(Date time) {
Calendar firstCal = new GregorianCalendar();
firstCal.setTime(getCurrentEPTime());
firstCal.set(0, 0, 0);
Calendar secondCal = new GregorianCalendar();
secondCal.setTime(time);
secondCal.set(0, 0, 0);
return firstCal.compareTo(secondCal);
} | public static int compareToTime(Date time) {
<DeepExtract>
Calendar firstCal = new GregorianCalendar();
firstCal.setTime(getCurrentEPTime());
firstCal.set(0, 0, 0);
Calendar secondCal = new GregorianCalendar();
secondCal.setTime(time);
secondCal.set(0, 0, 0);
return firstCal.compareTo(secondCal);
</DeepExtract>
} | AlgoTrader | positive | 3,383 |
private static void init() {
if (frame != null)
frame.setVisible(false);
frame = new JFrame();
offscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
onscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
offscreen = offscreenImage.createGraphics();
onscreen = onscreenImage.createGraphics();
setXscale(DEFAULT_XMIN, DEFAULT_XMAX);
setYscale(DEFAULT_YMIN, DEFAULT_YMAX);
offscreen.setColor(DEFAULT_CLEAR_COLOR);
offscreen.fillRect(0, 0, width, height);
setPenColor(DEFAULT_PEN_COLOR);
setPenRadius(DEFAULT_PEN_RADIUS);
setFont(DEFAULT_FONT);
clear(DEFAULT_CLEAR_COLOR);
RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
offscreen.addRenderingHints(hints);
ImageIcon icon = new ImageIcon(onscreenImage);
JLabel draw = new JLabel(icon);
draw.addMouseListener(std);
draw.addMouseMotionListener(std);
frame.setContentPane(draw);
frame.addKeyListener(std);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("Standard Draw");
frame.setJMenuBar(createMenuBar());
frame.pack();
frame.requestFocusInWindow();
frame.setVisible(true);
} | private static void init() {
if (frame != null)
frame.setVisible(false);
frame = new JFrame();
offscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
onscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
offscreen = offscreenImage.createGraphics();
onscreen = onscreenImage.createGraphics();
setXscale(DEFAULT_XMIN, DEFAULT_XMAX);
setYscale(DEFAULT_YMIN, DEFAULT_YMAX);
offscreen.setColor(DEFAULT_CLEAR_COLOR);
offscreen.fillRect(0, 0, width, height);
setPenColor(DEFAULT_PEN_COLOR);
setPenRadius(DEFAULT_PEN_RADIUS);
setFont(DEFAULT_FONT);
<DeepExtract>
clear(DEFAULT_CLEAR_COLOR);
</DeepExtract>
RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
offscreen.addRenderingHints(hints);
ImageIcon icon = new ImageIcon(onscreenImage);
JLabel draw = new JLabel(icon);
draw.addMouseListener(std);
draw.addMouseMotionListener(std);
frame.setContentPane(draw);
frame.addKeyListener(std);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("Standard Draw");
frame.setJMenuBar(createMenuBar());
frame.pack();
frame.requestFocusInWindow();
frame.setVisible(true);
} | skeleton-sp17 | positive | 3,384 |
public void writeExternal(ObjectOutput out) throws IOException {
out.writeByte(1);
super.writeExternal(out);
out.writeInt(_size);
for (int i = _set.length; i-- > 0; ) {
if (_set[i] != REMOVED && _set[i] != FREE) {
out.writeObject(_set[i]);
}
}
} | public void writeExternal(ObjectOutput out) throws IOException {
out.writeByte(1);
super.writeExternal(out);
out.writeInt(_size);
<DeepExtract>
for (int i = _set.length; i-- > 0; ) {
if (_set[i] != REMOVED && _set[i] != FREE) {
out.writeObject(_set[i]);
}
}
</DeepExtract>
} | MachinaCraft | positive | 3,385 |
@Test
public void test210() {
add("test (", "test", "!", "test", "(", "test");
assertThat(mEditor.getText().toString(), is("Test (test! Test (Test"));
} | @Test
public void test210() {
add("test (", "test", "!", "test", "(", "test");
<DeepExtract>
assertThat(mEditor.getText().toString(), is("Test (test! Test (Test"));
</DeepExtract>
} | speechutils | positive | 3,386 |
public Criteria andHnameBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "hname" + " cannot be null");
}
criteria.add(new Criterion("hname between", value1, value2));
return (Criteria) this;
} | public Criteria andHnameBetween(String value1, String value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "hname" + " cannot be null");
}
criteria.add(new Criterion("hname between", value1, value2));
</DeepExtract>
return (Criteria) this;
} | Hospital | positive | 3,388 |
public final ScheduledFuture<?> scheduleAtFixedRate(Runnable r, long delay, long period) {
return Math.max(0, Math.min(MAX_DELAY, delay));
return Math.max(0, Math.min(MAX_DELAY, period));
return _scheduleExecutor.scheduleAtFixedRate(new ExecutionWrapper(r), delay, period, TimeUnit.MILLISECONDS);
} | public final ScheduledFuture<?> scheduleAtFixedRate(Runnable r, long delay, long period) {
return Math.max(0, Math.min(MAX_DELAY, delay));
<DeepExtract>
return Math.max(0, Math.min(MAX_DELAY, period));
</DeepExtract>
return _scheduleExecutor.scheduleAtFixedRate(new ExecutionWrapper(r), delay, period, TimeUnit.MILLISECONDS);
} | vethrfolnir-mu | positive | 3,389 |
private final int jjStartNfa_2(int pos, long active0) {
int startsAt = 0;
jjnewStateCnt = 3;
int i = 1;
jjstateSet[0] = jjStopStringLiteralDfa_2(pos, active0);
int kind = 0x7fffffff;
for (; ; ) {
if (++jjround == 0x7fffffff)
ReInitRounds();
if (curChar < 64) {
long l = 1L << curChar;
do {
switch(jjstateSet[--i]) {
case 1:
case 0:
if ((0xfffffffbffffdbffL & l) == 0L)
break;
if (kind > 20)
kind = 20;
jjCheckNAdd(0);
break;
case 2:
if (kind > 21)
kind = 21;
break;
default:
break;
}
} while (i != startsAt);
} else if (curChar < 128) {
long l = 1L << (curChar & 077);
do {
switch(jjstateSet[--i]) {
case 1:
if ((0xffffffffefffffffL & l) != 0L) {
if (kind > 20)
kind = 20;
jjCheckNAdd(0);
} else if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 2;
break;
case 0:
if ((0xffffffffefffffffL & l) == 0L)
break;
if (kind > 20)
kind = 20;
jjCheckNAdd(0);
break;
case 2:
if (kind > 21)
kind = 21;
break;
default:
break;
}
} while (i != startsAt);
} else {
int hiByte = (int) (curChar >> 8);
int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
do {
switch(jjstateSet[--i]) {
case 1:
case 0:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
if (kind > 20)
kind = 20;
jjCheckNAdd(0);
break;
case 2:
if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 21)
kind = 21;
break;
default:
break;
}
} while (i != startsAt);
}
if (kind != 0x7fffffff) {
jjmatchedKind = kind;
jjmatchedPos = pos + 1;
kind = 0x7fffffff;
}
++pos + 1;
if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
return pos + 1;
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
return pos + 1;
}
}
} | private final int jjStartNfa_2(int pos, long active0) {
<DeepExtract>
int startsAt = 0;
jjnewStateCnt = 3;
int i = 1;
jjstateSet[0] = jjStopStringLiteralDfa_2(pos, active0);
int kind = 0x7fffffff;
for (; ; ) {
if (++jjround == 0x7fffffff)
ReInitRounds();
if (curChar < 64) {
long l = 1L << curChar;
do {
switch(jjstateSet[--i]) {
case 1:
case 0:
if ((0xfffffffbffffdbffL & l) == 0L)
break;
if (kind > 20)
kind = 20;
jjCheckNAdd(0);
break;
case 2:
if (kind > 21)
kind = 21;
break;
default:
break;
}
} while (i != startsAt);
} else if (curChar < 128) {
long l = 1L << (curChar & 077);
do {
switch(jjstateSet[--i]) {
case 1:
if ((0xffffffffefffffffL & l) != 0L) {
if (kind > 20)
kind = 20;
jjCheckNAdd(0);
} else if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 2;
break;
case 0:
if ((0xffffffffefffffffL & l) == 0L)
break;
if (kind > 20)
kind = 20;
jjCheckNAdd(0);
break;
case 2:
if (kind > 21)
kind = 21;
break;
default:
break;
}
} while (i != startsAt);
} else {
int hiByte = (int) (curChar >> 8);
int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
do {
switch(jjstateSet[--i]) {
case 1:
case 0:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
if (kind > 20)
kind = 20;
jjCheckNAdd(0);
break;
case 2:
if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 21)
kind = 21;
break;
default:
break;
}
} while (i != startsAt);
}
if (kind != 0x7fffffff) {
jjmatchedKind = kind;
jjmatchedPos = pos + 1;
kind = 0x7fffffff;
}
++pos + 1;
if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
return pos + 1;
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
return pos + 1;
}
}
</DeepExtract>
} | C0-language | positive | 3,390 |
@Override
public void subscribe(ObservableEmitter<List<AppInfo>> e) throws Exception {
List<AppInfo> appInfoList = new ArrayList<>();
List<PackageInfo> packageInfos = manager.getInstalledPackages(0);
for (PackageInfo packageInfo : packageInfos) {
AppInfo appInfo = new AppInfo();
appInfo.setPackageName(packageInfo.packageName);
appInfo.setIcon(packageInfo.applicationInfo.loadIcon(manager));
int plan = Share.getInt(packageInfo.packageName, -1);
appInfo.setAppPlan(plan);
appInfo.setAppName(packageInfo.applicationInfo.loadLabel(manager).toString());
if (plan != -1)
selectAppInfo.add(appInfo);
else
appInfoList.add(appInfo);
}
selectAppInfo.addAll(appInfoList);
onGetDataListener.success(selectAppInfo);
} | @Override
public void subscribe(ObservableEmitter<List<AppInfo>> e) throws Exception {
List<AppInfo> appInfoList = new ArrayList<>();
List<PackageInfo> packageInfos = manager.getInstalledPackages(0);
for (PackageInfo packageInfo : packageInfos) {
AppInfo appInfo = new AppInfo();
appInfo.setPackageName(packageInfo.packageName);
appInfo.setIcon(packageInfo.applicationInfo.loadIcon(manager));
int plan = Share.getInt(packageInfo.packageName, -1);
appInfo.setAppPlan(plan);
appInfo.setAppName(packageInfo.applicationInfo.loadLabel(manager).toString());
if (plan != -1)
selectAppInfo.add(appInfo);
else
appInfoList.add(appInfo);
}
selectAppInfo.addAll(appInfoList);
<DeepExtract>
onGetDataListener.success(selectAppInfo);
</DeepExtract>
} | F5Web | positive | 3,391 |
@Override
public ConditionDoneBuilder exceptLoadingCollection(@NonNull Class<?> associationOwnerClass, @NonNull String associationField) {
return exceptOf(exclusions -> exclusions.loadingCollection(associationOwnerClass, associationField), ExclusionJoiningMode.ANY);
} | @Override
public ConditionDoneBuilder exceptLoadingCollection(@NonNull Class<?> associationOwnerClass, @NonNull String associationField) {
<DeepExtract>
return exceptOf(exclusions -> exclusions.loadingCollection(associationOwnerClass, associationField), ExclusionJoiningMode.ANY);
</DeepExtract>
} | jplusone | positive | 3,392 |
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
mDrawerLayout.closeDrawer(GravityCompat.START);
if (menuItem.getItemId() == R.id.navigation_main_stickyNav) {
startActivity(new Intent(MainActivity.this, StickyNavActivity.class));
} else {
setTitle(menuItem.getTitle());
switch(menuItem.getItemId()) {
case R.id.navigation_main_gridview:
mViewPager.setCurrentItem(0, false);
break;
case R.id.navigation_main_normallistview:
mViewPager.setCurrentItem(1, false);
break;
case R.id.navigation_main_normalrecyclerview:
mViewPager.setCurrentItem(2, false);
break;
case R.id.navigation_main_swipelistview:
mViewPager.setCurrentItem(3, false);
break;
case R.id.navigation_main_swiperecyclerview:
mViewPager.setCurrentItem(4, false);
break;
case R.id.navigation_main_staggeredgridlayoutmanager:
mViewPager.setCurrentItem(5, false);
break;
case R.id.navigation_main_scrollview:
mViewPager.setCurrentItem(6, false);
break;
case R.id.navigation_main_normalview:
mViewPager.setCurrentItem(7, false);
break;
case R.id.navigation_main_webview:
mViewPager.setCurrentItem(8, false);
break;
default:
break;
}
}
return true;
} | @Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
<DeepExtract>
mDrawerLayout.closeDrawer(GravityCompat.START);
</DeepExtract>
if (menuItem.getItemId() == R.id.navigation_main_stickyNav) {
startActivity(new Intent(MainActivity.this, StickyNavActivity.class));
} else {
setTitle(menuItem.getTitle());
switch(menuItem.getItemId()) {
case R.id.navigation_main_gridview:
mViewPager.setCurrentItem(0, false);
break;
case R.id.navigation_main_normallistview:
mViewPager.setCurrentItem(1, false);
break;
case R.id.navigation_main_normalrecyclerview:
mViewPager.setCurrentItem(2, false);
break;
case R.id.navigation_main_swipelistview:
mViewPager.setCurrentItem(3, false);
break;
case R.id.navigation_main_swiperecyclerview:
mViewPager.setCurrentItem(4, false);
break;
case R.id.navigation_main_staggeredgridlayoutmanager:
mViewPager.setCurrentItem(5, false);
break;
case R.id.navigation_main_scrollview:
mViewPager.setCurrentItem(6, false);
break;
case R.id.navigation_main_normalview:
mViewPager.setCurrentItem(7, false);
break;
case R.id.navigation_main_webview:
mViewPager.setCurrentItem(8, false);
break;
default:
break;
}
}
return true;
} | BGARefreshLayout-Android | positive | 3,393 |
public void testMetaDataInjection() throws IOException {
String path = "target/test-classes/fixtures/test_cue1.flv";
File f = new File(path);
System.out.println("Path: " + f.getAbsolutePath());
if (f.exists()) {
f.delete();
}
f.createNewFile();
IFLV flv = (IFLV) service.getStreamableFile(f);
ITagWriter writer = flv.getWriter();
File readfile = new File(path);
IFLV readflv = (IFLV) service.getStreamableFile(readfile);
readflv.setCache(NoCacheImpl.getInstance());
ITagReader reader = readflv.getReader();
IMetaCue cp = new MetaCue<Object, Object>();
cp.setName("cue_1");
cp.setTime(0.01);
cp.setType(ICueType.EVENT);
IMetaCue cp1 = new MetaCue<Object, Object>();
cp1.setName("cue_1");
cp1.setTime(2.01);
cp1.setType(ICueType.EVENT);
TreeSet<IMetaCue> ts = new TreeSet<IMetaCue>();
ts.add(cp);
ts.add(cp1);
int cuePointTimeStamp = getTimeInMilliseconds(ts.first());
ITag tag = null;
ITag injectedTag = null;
while (reader.hasMoreTags()) {
tag = reader.readTag();
if (tag.getDataType() != IoConstants.TYPE_METADATA) {
} else {
}
if (!ts.isEmpty()) {
while (tag.getTimestamp() > cuePointTimeStamp) {
injectedTag = injectMetaData(ts.first(), tag);
writer.writeTag(injectedTag);
tag.setPreviousTagSize((injectedTag.getBodySize() + 11));
ts.remove(ts.first());
if (ts.isEmpty()) {
break;
}
cuePointTimeStamp = getTimeInMilliseconds(ts.first());
}
}
writer.writeTag(tag);
}
} | public void testMetaDataInjection() throws IOException {
String path = "target/test-classes/fixtures/test_cue1.flv";
File f = new File(path);
System.out.println("Path: " + f.getAbsolutePath());
if (f.exists()) {
f.delete();
}
f.createNewFile();
IFLV flv = (IFLV) service.getStreamableFile(f);
ITagWriter writer = flv.getWriter();
File readfile = new File(path);
IFLV readflv = (IFLV) service.getStreamableFile(readfile);
readflv.setCache(NoCacheImpl.getInstance());
ITagReader reader = readflv.getReader();
<DeepExtract>
IMetaCue cp = new MetaCue<Object, Object>();
cp.setName("cue_1");
cp.setTime(0.01);
cp.setType(ICueType.EVENT);
IMetaCue cp1 = new MetaCue<Object, Object>();
cp1.setName("cue_1");
cp1.setTime(2.01);
cp1.setType(ICueType.EVENT);
TreeSet<IMetaCue> ts = new TreeSet<IMetaCue>();
ts.add(cp);
ts.add(cp1);
int cuePointTimeStamp = getTimeInMilliseconds(ts.first());
ITag tag = null;
ITag injectedTag = null;
while (reader.hasMoreTags()) {
tag = reader.readTag();
if (tag.getDataType() != IoConstants.TYPE_METADATA) {
} else {
}
if (!ts.isEmpty()) {
while (tag.getTimestamp() > cuePointTimeStamp) {
injectedTag = injectMetaData(ts.first(), tag);
writer.writeTag(injectedTag);
tag.setPreviousTagSize((injectedTag.getBodySize() + 11));
ts.remove(ts.first());
if (ts.isEmpty()) {
break;
}
cuePointTimeStamp = getTimeInMilliseconds(ts.first());
}
}
writer.writeTag(tag);
}
</DeepExtract>
} | red5-server | positive | 3,394 |
@Override
public void handle(MouseEvent event) {
try {
GridPane templateContent = (GridPane) MainApplication.getTemplate().getNamespace().get("content");
templateContent.getColumnConstraints().clear();
templateContent.getRowConstraints().clear();
templateContent.getChildren().clear();
FXMLLoader content = new FXMLLoader(getClass().getResource(fxmlFilePath));
content.setRoot(MainApplication.getTemplate().getNamespace().get("content"));
content.load();
String mainPageTitle = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties", "prop.menu.mainPage");
mainPage.setDisable(mainPageTitle.equals(title));
String webAdminTitle = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties", "prop.menu.webAdmin");
webAdmin.setDisable(webAdminTitle.equals(title));
String consoleTitle = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties", "prop.menu.console");
console.setDisable(consoleTitle.equals(title));
String mapsTitle = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties", "prop.menu.maps");
maps.setDisable(mapsTitle.equals(title));
} catch (Exception e) {
logger.error(e.getMessage(), e);
Utils.errorDialog(e.getMessage(), e);
}
} | @Override
public void handle(MouseEvent event) {
<DeepExtract>
try {
GridPane templateContent = (GridPane) MainApplication.getTemplate().getNamespace().get("content");
templateContent.getColumnConstraints().clear();
templateContent.getRowConstraints().clear();
templateContent.getChildren().clear();
FXMLLoader content = new FXMLLoader(getClass().getResource(fxmlFilePath));
content.setRoot(MainApplication.getTemplate().getNamespace().get("content"));
content.load();
String mainPageTitle = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties", "prop.menu.mainPage");
mainPage.setDisable(mainPageTitle.equals(title));
String webAdminTitle = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties", "prop.menu.webAdmin");
webAdmin.setDisable(webAdminTitle.equals(title));
String consoleTitle = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties", "prop.menu.console");
console.setDisable(consoleTitle.equals(title));
String mapsTitle = propertyService.getPropertyValue("properties/languages/" + languageCode + ".properties", "prop.menu.maps");
maps.setDisable(mapsTitle.equals(title));
} catch (Exception e) {
logger.error(e.getMessage(), e);
Utils.errorDialog(e.getMessage(), e);
}
</DeepExtract>
} | simple-kf2-server-launcher | positive | 3,395 |
public void queryInventoryAsync(final boolean querySkuDetails, final List<String> moreSkus, final QueryInventoryFinishedListener listener) {
final Handler handler = new Handler();
if (mDisposed)
throw new IllegalStateException("IabHelper was disposed of, so it cannot be used.");
if (!mSetupDone) {
logError("Illegal state for operation (" + "queryInventory" + "): IAB helper is not set up.");
throw new IllegalStateException("IAB helper is not set up. Can't perform operation: " + "queryInventory");
}
if (mAsyncInProgress)
throw new IllegalStateException("Can't start async operation (" + "refresh inventory" + ") because another async operation(" + mAsyncOperation + ") is in progress.");
mAsyncOperation = "refresh inventory";
mAsyncInProgress = true;
logDebug("Starting async operation: " + "refresh inventory");
(new Thread(new Runnable() {
public void run() {
IabResult result = new IabResult(BILLING_RESPONSE_RESULT_OK, "Inventory refresh successful.");
Inventory inv = null;
try {
inv = queryInventory(querySkuDetails, moreSkus);
} catch (IabException ex) {
result = ex.getResult();
}
flagEndAsync();
final IabResult result_f = result;
final Inventory inv_f = inv;
if (!mDisposed && listener != null) {
handler.post(new Runnable() {
public void run() {
listener.onQueryInventoryFinished(result_f, inv_f);
}
});
}
}
})).start();
} | public void queryInventoryAsync(final boolean querySkuDetails, final List<String> moreSkus, final QueryInventoryFinishedListener listener) {
final Handler handler = new Handler();
if (mDisposed)
throw new IllegalStateException("IabHelper was disposed of, so it cannot be used.");
if (!mSetupDone) {
logError("Illegal state for operation (" + "queryInventory" + "): IAB helper is not set up.");
throw new IllegalStateException("IAB helper is not set up. Can't perform operation: " + "queryInventory");
}
<DeepExtract>
if (mAsyncInProgress)
throw new IllegalStateException("Can't start async operation (" + "refresh inventory" + ") because another async operation(" + mAsyncOperation + ") is in progress.");
mAsyncOperation = "refresh inventory";
mAsyncInProgress = true;
logDebug("Starting async operation: " + "refresh inventory");
</DeepExtract>
(new Thread(new Runnable() {
public void run() {
IabResult result = new IabResult(BILLING_RESPONSE_RESULT_OK, "Inventory refresh successful.");
Inventory inv = null;
try {
inv = queryInventory(querySkuDetails, moreSkus);
} catch (IabException ex) {
result = ex.getResult();
}
flagEndAsync();
final IabResult result_f = result;
final Inventory inv_f = inv;
if (!mDisposed && listener != null) {
handler.post(new Runnable() {
public void run() {
listener.onQueryInventoryFinished(result_f, inv_f);
}
});
}
}
})).start();
} | Rashr | positive | 3,396 |
public void reBuildUI() {
listCollectors.clear();
removeAll();
for (int pos = 0; pos < list.size(); pos++) {
Item item = list.get(pos);
CollectDataFromUI collectDataFromUI = onBuildView(item, pos);
if (collectDataFromUI != null) {
listCollectors.add(collectDataFromUI);
}
}
} | public void reBuildUI() {
listCollectors.clear();
removeAll();
<DeepExtract>
for (int pos = 0; pos < list.size(); pos++) {
Item item = list.get(pos);
CollectDataFromUI collectDataFromUI = onBuildView(item, pos);
if (collectDataFromUI != null) {
listCollectors.add(collectDataFromUI);
}
}
</DeepExtract>
} | PackageTemplates | positive | 3,398 |
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityCompat.requestPermissions(this, permissions, 321);
} | @Override
public void onClick(DialogInterface dialog, int which) {
<DeepExtract>
ActivityCompat.requestPermissions(this, permissions, 321);
</DeepExtract>
} | bill | positive | 3,399 |
public String upload_file1(String master_file_id, String prefix_name, long file_size, UploadCallback callback, String file_ext_name, NameValuePair[] meta_list) throws IOException, MyException {
String[] parts = new String[2];
int pos = master_file_id.indexOf(SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR);
if ((pos <= 0) || (pos == master_file_id.length() - 1)) {
this.errno = ProtoCommon.ERR_NO_EINVAL;
}
parts[0] = master_file_id.substring(0, pos);
parts[1] = master_file_id.substring(pos + 1);
return 0;
if (this.errno != 0) {
return null;
}
parts = this.upload_file(parts[0], parts[1], prefix_name, file_size, callback, file_ext_name, meta_list);
if (parts != null) {
return parts[0] + SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR + parts[1];
} else {
return null;
}
} | public String upload_file1(String master_file_id, String prefix_name, long file_size, UploadCallback callback, String file_ext_name, NameValuePair[] meta_list) throws IOException, MyException {
String[] parts = new String[2];
<DeepExtract>
int pos = master_file_id.indexOf(SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR);
if ((pos <= 0) || (pos == master_file_id.length() - 1)) {
this.errno = ProtoCommon.ERR_NO_EINVAL;
}
parts[0] = master_file_id.substring(0, pos);
parts[1] = master_file_id.substring(pos + 1);
return 0;
</DeepExtract>
if (this.errno != 0) {
return null;
}
parts = this.upload_file(parts[0], parts[1], prefix_name, file_size, callback, file_ext_name, meta_list);
if (parts != null) {
return parts[0] + SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR + parts[1];
} else {
return null;
}
} | spring-boot-bulking | positive | 3,400 |
public static void glutSolidTeapot(double scale, boolean cStyle) {
float[] p = new float[4 * 4 * 3];
float[] q = new float[4 * 4 * 3];
float[] r = new float[4 * 4 * 3];
float[] s = new float[4 * 4 * 3];
int i, j, k, l;
glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT | GL_POLYGON_BIT);
glEnable(GL_AUTO_NORMAL);
glEnable(GL_MAP2_VERTEX_3);
glEnable(GL_MAP2_TEXTURE_COORD_2);
glPushMatrix();
if (!cStyle) {
glFrontFace(GL_CW);
glScaled(0.5 * scale, 0.5 * scale, 0.5 * scale);
} else {
glRotatef(270.0f, 1, 0, 0);
glScalef((float) (0.5 * scale), (float) (0.5 * scale), (float) (0.5 * scale));
glTranslatef(0.0f, 0.0f, -1.5f);
}
for (i = 0; i < 10; i++) {
for (j = 0; j < 4; j++) {
for (k = 0; k < 4; k++) {
for (l = 0; l < 3; l++) {
p[(j * 4 + k) * 3 + l] = teapotCPData[teapotPatchData[i][j * 4 + k]][l];
q[(j * 4 + k) * 3 + l] = teapotCPData[teapotPatchData[i][j * 4 + (3 - k)]][l];
if (l == 1)
q[(j * 4 + k) * 3 + l] *= -1.0;
if (i < 6) {
r[(j * 4 + k) * 3 + l] = teapotCPData[teapotPatchData[i][j * 4 + (3 - k)]][l];
if (l == 0)
r[(j * 4 + k) * 3 + l] *= -1.0;
s[(j * 4 + k) * 3 + l] = teapotCPData[teapotPatchData[i][j * 4 + k]][l];
if (l == 0)
s[(j * 4 + k) * 3 + l] *= -1.0;
if (l == 1)
s[(j * 4 + k) * 3 + l] *= -1.0;
}
}
}
}
glMap2f(GL_MAP2_TEXTURE_COORD_2, 0.0f, 1.0f, 2, 2, 0.0f, 1.0f, 4, 2, toBuffer(teapotTex));
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, toBuffer(p));
glMapGrid2f(14, 0.0f, 1.0f, 14, 0.0f, 1.0f);
evaluateTeapotMesh(14, GL_FILL, i, !cStyle);
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, toBuffer(q));
evaluateTeapotMesh(14, GL_FILL, i, !cStyle);
if (i < 6) {
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, toBuffer(r));
evaluateTeapotMesh(14, GL_FILL, i, !cStyle);
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, toBuffer(s));
evaluateTeapotMesh(14, GL_FILL, i, !cStyle);
}
}
glPopMatrix();
glPopAttrib();
} | public static void glutSolidTeapot(double scale, boolean cStyle) {
<DeepExtract>
float[] p = new float[4 * 4 * 3];
float[] q = new float[4 * 4 * 3];
float[] r = new float[4 * 4 * 3];
float[] s = new float[4 * 4 * 3];
int i, j, k, l;
glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT | GL_POLYGON_BIT);
glEnable(GL_AUTO_NORMAL);
glEnable(GL_MAP2_VERTEX_3);
glEnable(GL_MAP2_TEXTURE_COORD_2);
glPushMatrix();
if (!cStyle) {
glFrontFace(GL_CW);
glScaled(0.5 * scale, 0.5 * scale, 0.5 * scale);
} else {
glRotatef(270.0f, 1, 0, 0);
glScalef((float) (0.5 * scale), (float) (0.5 * scale), (float) (0.5 * scale));
glTranslatef(0.0f, 0.0f, -1.5f);
}
for (i = 0; i < 10; i++) {
for (j = 0; j < 4; j++) {
for (k = 0; k < 4; k++) {
for (l = 0; l < 3; l++) {
p[(j * 4 + k) * 3 + l] = teapotCPData[teapotPatchData[i][j * 4 + k]][l];
q[(j * 4 + k) * 3 + l] = teapotCPData[teapotPatchData[i][j * 4 + (3 - k)]][l];
if (l == 1)
q[(j * 4 + k) * 3 + l] *= -1.0;
if (i < 6) {
r[(j * 4 + k) * 3 + l] = teapotCPData[teapotPatchData[i][j * 4 + (3 - k)]][l];
if (l == 0)
r[(j * 4 + k) * 3 + l] *= -1.0;
s[(j * 4 + k) * 3 + l] = teapotCPData[teapotPatchData[i][j * 4 + k]][l];
if (l == 0)
s[(j * 4 + k) * 3 + l] *= -1.0;
if (l == 1)
s[(j * 4 + k) * 3 + l] *= -1.0;
}
}
}
}
glMap2f(GL_MAP2_TEXTURE_COORD_2, 0.0f, 1.0f, 2, 2, 0.0f, 1.0f, 4, 2, toBuffer(teapotTex));
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, toBuffer(p));
glMapGrid2f(14, 0.0f, 1.0f, 14, 0.0f, 1.0f);
evaluateTeapotMesh(14, GL_FILL, i, !cStyle);
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, toBuffer(q));
evaluateTeapotMesh(14, GL_FILL, i, !cStyle);
if (i < 6) {
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, toBuffer(r));
evaluateTeapotMesh(14, GL_FILL, i, !cStyle);
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, toBuffer(s));
evaluateTeapotMesh(14, GL_FILL, i, !cStyle);
}
}
glPopMatrix();
glPopAttrib();
</DeepExtract>
} | slim | positive | 3,402 |
@Override
public void onSuccess(FileWriter writer) {
scroller.setPostionToTop();
text.setHTML("success: writer created -- " + writer.getFileName());
} | @Override
public void onSuccess(FileWriter writer) {
<DeepExtract>
scroller.setPostionToTop();
text.setHTML("success: writer created -- " + writer.getFileName());
</DeepExtract>
} | GwtMobile-PhoneGap | positive | 3,403 |
@Override
public synchronized void close() throws IOException {
if (isClosed) {
return;
}
isClosed = true;
e.size = written;
if (out instanceof ByteArrayOutputStream)
e.bytes = ((ByteArrayOutputStream) out).toByteArray();
super.close();
beginWrite();
try {
IndexNode old = inodes.put(e, e);
if (old != null) {
removeFromTree(old);
}
if (e.type == Entry.NEW || e.type == Entry.FILECH || e.type == Entry.COPY) {
IndexNode parent = inodes.get(LOOKUPKEY.as(getParent(e.name)));
e.sibling = parent.child;
parent.child = e;
}
hasUpdate = true;
} finally {
endWrite();
}
} | @Override
public synchronized void close() throws IOException {
if (isClosed) {
return;
}
isClosed = true;
e.size = written;
if (out instanceof ByteArrayOutputStream)
e.bytes = ((ByteArrayOutputStream) out).toByteArray();
super.close();
<DeepExtract>
beginWrite();
try {
IndexNode old = inodes.put(e, e);
if (old != null) {
removeFromTree(old);
}
if (e.type == Entry.NEW || e.type == Entry.FILECH || e.type == Entry.COPY) {
IndexNode parent = inodes.get(LOOKUPKEY.as(getParent(e.name)));
e.sibling = parent.child;
parent.child = e;
}
hasUpdate = true;
} finally {
endWrite();
}
</DeepExtract>
} | masc | positive | 3,404 |
protected String encodeCookie(SerializableCookie cookie) {
if (cookie == null)
return null;
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
ObjectOutputStream outputStream = new ObjectOutputStream(os);
outputStream.writeObject(cookie);
} catch (Exception e) {
return null;
}
StringBuilder sb = new StringBuilder(os.toByteArray().length * 2);
for (byte element : os.toByteArray()) {
int v = element & 0xff;
if (v < 16) {
sb.append('0');
}
sb.append(Integer.toHexString(v));
}
return sb.toString().toUpperCase(Locale.US);
} | protected String encodeCookie(SerializableCookie cookie) {
if (cookie == null)
return null;
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
ObjectOutputStream outputStream = new ObjectOutputStream(os);
outputStream.writeObject(cookie);
} catch (Exception e) {
return null;
}
<DeepExtract>
StringBuilder sb = new StringBuilder(os.toByteArray().length * 2);
for (byte element : os.toByteArray()) {
int v = element & 0xff;
if (v < 16) {
sb.append('0');
}
sb.append(Integer.toHexString(v));
}
return sb.toString().toUpperCase(Locale.US);
</DeepExtract>
} | BlueskyAndroid | positive | 3,407 |
public Criteria andOrder_idNotBetween(Integer value1, Integer value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "order_id" + " cannot be null");
}
criteria.add(new Criterion("order_id not between", value1, value2));
return (Criteria) this;
} | public Criteria andOrder_idNotBetween(Integer value1, Integer value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "order_id" + " cannot be null");
}
criteria.add(new Criterion("order_id not between", value1, value2));
</DeepExtract>
return (Criteria) this;
} | Tmall_SSM-master | positive | 3,409 |
@Override
public void reinitializeTo(long index, LogEntry le) throws Exception {
log.reinitializeTo(index, le);
cache.clear();
return this;
cache = new ArrayRingBuffer<>(max_size, index);
cache.add(le);
return first_appended;
return commit_index;
return last_appended;
return current_term;
} | @Override
public void reinitializeTo(long index, LogEntry le) throws Exception {
log.reinitializeTo(index, le);
cache.clear();
return this;
cache = new ArrayRingBuffer<>(max_size, index);
cache.add(le);
return first_appended;
return commit_index;
return last_appended;
<DeepExtract>
return current_term;
</DeepExtract>
} | jgroups-raft | positive | 3,410 |
public ArrayList<GlobalCut> runWorker() {
long start = 0;
if (logger.isDebugEnabled()) {
start = System.currentTimeMillis();
}
if (localCache != null) {
StateSequence seq = localCache.localPeek(sequenceTime.getWallTime());
if (seq != null) {
RQLStateSequence rqlseq = new RQLStateSequence(seq);
this.seqs.add(rqlseq);
}
}
if (remoteCaches != null) {
for (IgniteCache<Long, StateSequence> seqCache : remoteCaches) {
long t2 = System.currentTimeMillis();
StateSequence seq = seqCache.get(sequenceTime.getWallTime());
System.out.println("StateSeq fetching complete in " + (System.currentTimeMillis() - t2) + " ms");
if (seq != null) {
RQLStateSequence rqlseq = new RQLStateSequence(seq);
this.seqs.add(rqlseq);
}
}
}
if (this.seqs.size() > 0) {
ScanningEnvironment env = new ScanningEnvironment(this.seqs.get(0), searchParam.getParams());
if (searchParam.getCondition() != null) {
env.addExpression(searchParam.getCondition());
}
if (searchParam.getComputeExpression() != null) {
env.setComputeExpression(searchParam.getComputeExpression());
}
env.scan();
return env.getEmittedCuts();
}
return new ArrayList<>();
} | public ArrayList<GlobalCut> runWorker() {
<DeepExtract>
long start = 0;
if (logger.isDebugEnabled()) {
start = System.currentTimeMillis();
}
if (localCache != null) {
StateSequence seq = localCache.localPeek(sequenceTime.getWallTime());
if (seq != null) {
RQLStateSequence rqlseq = new RQLStateSequence(seq);
this.seqs.add(rqlseq);
}
}
if (remoteCaches != null) {
for (IgniteCache<Long, StateSequence> seqCache : remoteCaches) {
long t2 = System.currentTimeMillis();
StateSequence seq = seqCache.get(sequenceTime.getWallTime());
System.out.println("StateSeq fetching complete in " + (System.currentTimeMillis() - t2) + " ms");
if (seq != null) {
RQLStateSequence rqlseq = new RQLStateSequence(seq);
this.seqs.add(rqlseq);
}
}
}
</DeepExtract>
if (this.seqs.size() > 0) {
ScanningEnvironment env = new ScanningEnvironment(this.seqs.get(0), searchParam.getParams());
if (searchParam.getCondition() != null) {
env.addExpression(searchParam.getCondition());
}
if (searchParam.getComputeExpression() != null) {
env.setComputeExpression(searchParam.getComputeExpression());
}
env.scan();
return env.getEmittedCuts();
}
return new ArrayList<>();
} | retroscope-lib | positive | 3,411 |
@ChangeSet(order = "0002", id = "0002_Custom_metamodel", author = "migrationBot")
public void run(MongoDatabase database) {
final MongoCollection<Document> aclCol = database.getCollection("ACL");
aclCol.updateMany(new Document(), combine(set("className", "nl.dtls.fairdatapoint.entity.metadata.Metadata")));
final MongoCollection<Document> rdCol = database.getCollection("resourceDefinition");
rdCol.insertOne(repositoryDefinition());
rdCol.insertOne(catalogDefinition());
rdCol.insertOne(datasetDefinition());
rdCol.insertOne(distributionDefinition());
} | @ChangeSet(order = "0002", id = "0002_Custom_metamodel", author = "migrationBot")
public void run(MongoDatabase database) {
final MongoCollection<Document> aclCol = database.getCollection("ACL");
aclCol.updateMany(new Document(), combine(set("className", "nl.dtls.fairdatapoint.entity.metadata.Metadata")));
<DeepExtract>
final MongoCollection<Document> rdCol = database.getCollection("resourceDefinition");
rdCol.insertOne(repositoryDefinition());
rdCol.insertOne(catalogDefinition());
rdCol.insertOne(datasetDefinition());
rdCol.insertOne(distributionDefinition());
</DeepExtract>
} | FAIRDataPoint | positive | 3,413 |
@Override
public <T> void init(Stage stage, HashMap<String, T> parameters) {
super.init(stage, parameters);
WindowsUtils.addComboBoxItens(roleComboBox, roleService);
if (parameters != null) {
this.employee = (Employee) parameters.get(EMPLOYEE_KEY);
updateTextFields();
}
ValidatorUtils.addRequiredValidator(nameTextField, "Employee Name is Required!");
ValidatorUtils.addRequiredValidator(emailTextField, "E-mail is Required!");
ValidatorUtils.addRequiredValidator(cpfTextField, "CPF is Required!");
ValidatorUtils.addRequiredValidator(passwordTextField, "Password is Required!");
ValidatorUtils.addRequiredValidator(confirmPasswordTextField, "Confirm Password is Required!");
ValidatorUtils.addPasswordAndConfirmPasswordValidator(passwordTextField, confirmPasswordTextField, "Password does not match the confirm password");
ValidatorUtils.addNumberOnlyValidator(numberTextField);
ValidatorUtils.addNumberOnlyValidator(cpfTextField);
ValidatorUtils.addNumberOnlyValidator(residentialPhoneTextField);
ValidatorUtils.addNumberOnlyValidator(cellPhoneTextField);
ValidatorUtils.addMaxLengthValidator(cpfTextField, 11);
ValidatorUtils.addMaxLengthValidator(cepTextField, 8);
ValidatorUtils.addEmailValidator(emailTextField, "Email does not match");
ValidatorUtils.addDuplicateUserValidator(emailTextField, "An account for the specified email address already exists", userService);
WindowsUtils.validateTextField(numberTextField);
WindowsUtils.validateTextField(residentialPhoneTextField);
WindowsUtils.validateTextField(cellPhoneTextField);
WindowsUtils.validateTextField(nameTextField);
WindowsUtils.validateTextField(emailTextField);
WindowsUtils.validateTextField(cpfTextField);
WindowsUtils.validateTextField(passwordTextField);
WindowsUtils.validateTextField(confirmPasswordTextField);
WindowsUtils.watchEvents(nameTextField, v -> watch());
WindowsUtils.watchEvents(emailTextField, v -> watch());
WindowsUtils.watchEvents(cpfTextField, v -> watch());
WindowsUtils.watchEvents(passwordTextField, v -> watch());
WindowsUtils.watchEvents(confirmPasswordTextField, v -> watch());
} | @Override
public <T> void init(Stage stage, HashMap<String, T> parameters) {
super.init(stage, parameters);
WindowsUtils.addComboBoxItens(roleComboBox, roleService);
if (parameters != null) {
this.employee = (Employee) parameters.get(EMPLOYEE_KEY);
updateTextFields();
}
ValidatorUtils.addRequiredValidator(nameTextField, "Employee Name is Required!");
ValidatorUtils.addRequiredValidator(emailTextField, "E-mail is Required!");
ValidatorUtils.addRequiredValidator(cpfTextField, "CPF is Required!");
ValidatorUtils.addRequiredValidator(passwordTextField, "Password is Required!");
ValidatorUtils.addRequiredValidator(confirmPasswordTextField, "Confirm Password is Required!");
ValidatorUtils.addPasswordAndConfirmPasswordValidator(passwordTextField, confirmPasswordTextField, "Password does not match the confirm password");
ValidatorUtils.addNumberOnlyValidator(numberTextField);
ValidatorUtils.addNumberOnlyValidator(cpfTextField);
ValidatorUtils.addNumberOnlyValidator(residentialPhoneTextField);
ValidatorUtils.addNumberOnlyValidator(cellPhoneTextField);
ValidatorUtils.addMaxLengthValidator(cpfTextField, 11);
ValidatorUtils.addMaxLengthValidator(cepTextField, 8);
ValidatorUtils.addEmailValidator(emailTextField, "Email does not match");
ValidatorUtils.addDuplicateUserValidator(emailTextField, "An account for the specified email address already exists", userService);
WindowsUtils.validateTextField(numberTextField);
WindowsUtils.validateTextField(residentialPhoneTextField);
WindowsUtils.validateTextField(cellPhoneTextField);
WindowsUtils.validateTextField(nameTextField);
WindowsUtils.validateTextField(emailTextField);
WindowsUtils.validateTextField(cpfTextField);
WindowsUtils.validateTextField(passwordTextField);
WindowsUtils.validateTextField(confirmPasswordTextField);
<DeepExtract>
WindowsUtils.watchEvents(nameTextField, v -> watch());
WindowsUtils.watchEvents(emailTextField, v -> watch());
WindowsUtils.watchEvents(cpfTextField, v -> watch());
WindowsUtils.watchEvents(passwordTextField, v -> watch());
WindowsUtils.watchEvents(confirmPasswordTextField, v -> watch());
</DeepExtract>
} | spring-javafx-material-design-admin | positive | 3,414 |
public static void logModifier(@NotNull final Player p, @Nullable final Event event, @NotNull final Modifier mod, @NotNull final ItemStack tool, String... args) {
if (!(MineTinker.getPlugin().getConfig().getBoolean("logging.modifiers")))
return;
final StringBuilder sb = new StringBuilder();
if (event != null) {
sb.append(event.getEventName()).append("(").append(String.format("%x", event.hashCode() % 0x100));
if (event instanceof MTBlockBreakEvent) {
sb.append("/").append(String.format("%x", ((MTBlockBreakEvent) event).getEvent().hashCode() % 0x100));
} else if (event instanceof MTEntityDamageByEntityEvent) {
sb.append("/").append(String.format("%x", ((MTEntityDamageByEntityEvent) event).getEvent().hashCode() % 0x100));
} else if (event instanceof MTEntityDamageEvent) {
sb.append("/").append(String.format("%x", ((MTEntityDamageEvent) event).getEvent().hashCode() % 0x100));
} else if (event instanceof MTEntityDeathEvent) {
sb.append("/").append(String.format("%x", ((MTEntityDeathEvent) event).getEvent().hashCode() % 0x100));
} else if (event instanceof MTPlayerInteractEvent) {
sb.append("/").append(String.format("%x", ((MTPlayerInteractEvent) event).getEvent().hashCode() % 0x100));
} else if (event instanceof MTProjectileHitEvent) {
sb.append("/").append(String.format("%x", ((MTProjectileHitEvent) event).getEvent().hashCode() % 0x100));
}
sb.append(")").append(": ");
} else {
sb.append("No event: ");
}
sb.append(p.getName()).append("/").append(mod.getKey()).append("(").append(ModManager.instance().getModLevel(tool, mod)).append(")").append(" - ").append(tool.getType());
Arrays.sort(args);
for (final String s : args) {
sb.append(" - ").append(s);
}
if (Level.INFO) {
if (MineTinker.getPlugin().getConfig().getBoolean("logging.debug")) {
Bukkit.getConsoleSender().sendMessage(CHAT_PREFIX + " " + ChatColor.RED + sb.toString());
}
} else {
if (MineTinker.getPlugin().getConfig().getBoolean("logging.standard") || MineTinker.getPlugin().getConfig().getBoolean("logging.debug")) {
Bukkit.getConsoleSender().sendMessage(CHAT_PREFIX + " " + sb.toString());
}
}
} | public static void logModifier(@NotNull final Player p, @Nullable final Event event, @NotNull final Modifier mod, @NotNull final ItemStack tool, String... args) {
if (!(MineTinker.getPlugin().getConfig().getBoolean("logging.modifiers")))
return;
final StringBuilder sb = new StringBuilder();
if (event != null) {
sb.append(event.getEventName()).append("(").append(String.format("%x", event.hashCode() % 0x100));
if (event instanceof MTBlockBreakEvent) {
sb.append("/").append(String.format("%x", ((MTBlockBreakEvent) event).getEvent().hashCode() % 0x100));
} else if (event instanceof MTEntityDamageByEntityEvent) {
sb.append("/").append(String.format("%x", ((MTEntityDamageByEntityEvent) event).getEvent().hashCode() % 0x100));
} else if (event instanceof MTEntityDamageEvent) {
sb.append("/").append(String.format("%x", ((MTEntityDamageEvent) event).getEvent().hashCode() % 0x100));
} else if (event instanceof MTEntityDeathEvent) {
sb.append("/").append(String.format("%x", ((MTEntityDeathEvent) event).getEvent().hashCode() % 0x100));
} else if (event instanceof MTPlayerInteractEvent) {
sb.append("/").append(String.format("%x", ((MTPlayerInteractEvent) event).getEvent().hashCode() % 0x100));
} else if (event instanceof MTProjectileHitEvent) {
sb.append("/").append(String.format("%x", ((MTProjectileHitEvent) event).getEvent().hashCode() % 0x100));
}
sb.append(")").append(": ");
} else {
sb.append("No event: ");
}
sb.append(p.getName()).append("/").append(mod.getKey()).append("(").append(ModManager.instance().getModLevel(tool, mod)).append(")").append(" - ").append(tool.getType());
Arrays.sort(args);
for (final String s : args) {
sb.append(" - ").append(s);
}
<DeepExtract>
if (Level.INFO) {
if (MineTinker.getPlugin().getConfig().getBoolean("logging.debug")) {
Bukkit.getConsoleSender().sendMessage(CHAT_PREFIX + " " + ChatColor.RED + sb.toString());
}
} else {
if (MineTinker.getPlugin().getConfig().getBoolean("logging.standard") || MineTinker.getPlugin().getConfig().getBoolean("logging.debug")) {
Bukkit.getConsoleSender().sendMessage(CHAT_PREFIX + " " + sb.toString());
}
}
</DeepExtract>
} | MineTinker | positive | 3,415 |
public Response get() {
Response response = null;
try {
response = this.execute("GET").get();
} catch (InterruptedException e) {
throw new ClientException(e);
} catch (ExecutionException e) {
throw new ClientException(e);
}
if (response.getStatus() >= 400) {
throw ClientExceptionFactory.createHttpExceptionFromStatusCode(response.getStatus());
}
return response;
} | public Response get() {
<DeepExtract>
Response response = null;
try {
response = this.execute("GET").get();
} catch (InterruptedException e) {
throw new ClientException(e);
} catch (ExecutionException e) {
throw new ClientException(e);
}
if (response.getStatus() >= 400) {
throw ClientExceptionFactory.createHttpExceptionFromStatusCode(response.getStatus());
}
return response;
</DeepExtract>
} | resthub-spring-stack | positive | 3,416 |
@Test
public final void testPeopleNamesShiftedRightShouldPopulateValuesCorrectly() {
List<PersonFullnameHeaderNames> expected = Arrays.asList(new PersonFullnameHeaderNames("Chuck", "Albert", "Smith"), new PersonFullnameHeaderNames("Bruce", null, "Johnson"), new PersonFullnameHeaderNames("Michael", "Davis", "Jones"));
List<T> streamResult = streamToList(PersonFullnameHeaderNames.class, FileToTest.PERSON_NAMES_SHIFTED_RIGHT);
assertEquals(expected, streamResult);
} | @Test
public final void testPeopleNamesShiftedRightShouldPopulateValuesCorrectly() {
List<PersonFullnameHeaderNames> expected = Arrays.asList(new PersonFullnameHeaderNames("Chuck", "Albert", "Smith"), new PersonFullnameHeaderNames("Bruce", null, "Johnson"), new PersonFullnameHeaderNames("Michael", "Davis", "Jones"));
<DeepExtract>
List<T> streamResult = streamToList(PersonFullnameHeaderNames.class, FileToTest.PERSON_NAMES_SHIFTED_RIGHT);
assertEquals(expected, streamResult);
</DeepExtract>
} | jexm | positive | 3,417 |
public PlayerPocket getItemAsPocketByItemIndexAndCategoryAndPocket(Integer itemIndex, String category, Pocket pocket) {
List<PlayerPocket> playerPocketList = playerPocketRepository.findAllByItemIndexAndCategoryAndPocket(itemIndex, category, pocket);
PlayerPocket playerPocket = null;
if (playerPocketList.size() >= 1) {
playerPocket = playerPocketList.get(0);
for (int i = 1; i < playerPocketList.size(); i++) {
if (playerPocketList.get(i).getCategory().equals(EItemCategory.PARTS.getName()))
this.remove(playerPocketList.get(i).getId());
}
}
return playerPocket;
} | public PlayerPocket getItemAsPocketByItemIndexAndCategoryAndPocket(Integer itemIndex, String category, Pocket pocket) {
List<PlayerPocket> playerPocketList = playerPocketRepository.findAllByItemIndexAndCategoryAndPocket(itemIndex, category, pocket);
<DeepExtract>
PlayerPocket playerPocket = null;
if (playerPocketList.size() >= 1) {
playerPocket = playerPocketList.get(0);
for (int i = 1; i < playerPocketList.size(); i++) {
if (playerPocketList.get(i).getCategory().equals(EItemCategory.PARTS.getName()))
this.remove(playerPocketList.get(i).getId());
}
}
return playerPocket;
</DeepExtract>
} | JFTSE | positive | 3,420 |
public static String getClassNameForObject(Object object) {
if (object == null) {
return null;
}
if (StringUtil.isEmpty(object.getClass().getName())) {
return object.getClass().getName();
}
if (true) {
object.getClass().getName() = object.getClass().getName().replace(INNER_CLASS_SEPARATOR_CHAR, PACKAGE_SEPARATOR_CHAR);
}
int length = object.getClass().getName().length();
int dimension = 0;
for (int i = 0; i < length; i++, dimension++) {
if (object.getClass().getName().charAt(i) != '[') {
break;
}
}
if (dimension == 0) {
return object.getClass().getName();
}
if (length <= dimension) {
return object.getClass().getName();
}
StringBuffer componentTypeName = new StringBuffer();
switch(object.getClass().getName().charAt(dimension)) {
case 'Z':
componentTypeName.append("boolean");
break;
case 'B':
componentTypeName.append("byte");
break;
case 'C':
componentTypeName.append("char");
break;
case 'D':
componentTypeName.append("double");
break;
case 'F':
componentTypeName.append("float");
break;
case 'I':
componentTypeName.append("int");
break;
case 'J':
componentTypeName.append("long");
break;
case 'S':
componentTypeName.append("short");
break;
case 'L':
if ((object.getClass().getName().charAt(length - 1) != ';') || (length <= (dimension + 2))) {
return object.getClass().getName();
}
componentTypeName.append(object.getClass().getName().substring(dimension + 1, length - 1));
break;
default:
return object.getClass().getName();
}
for (int i = 0; i < dimension; i++) {
componentTypeName.append("[]");
}
return componentTypeName.toString();
} | public static String getClassNameForObject(Object object) {
if (object == null) {
return null;
}
<DeepExtract>
if (StringUtil.isEmpty(object.getClass().getName())) {
return object.getClass().getName();
}
if (true) {
object.getClass().getName() = object.getClass().getName().replace(INNER_CLASS_SEPARATOR_CHAR, PACKAGE_SEPARATOR_CHAR);
}
int length = object.getClass().getName().length();
int dimension = 0;
for (int i = 0; i < length; i++, dimension++) {
if (object.getClass().getName().charAt(i) != '[') {
break;
}
}
if (dimension == 0) {
return object.getClass().getName();
}
if (length <= dimension) {
return object.getClass().getName();
}
StringBuffer componentTypeName = new StringBuffer();
switch(object.getClass().getName().charAt(dimension)) {
case 'Z':
componentTypeName.append("boolean");
break;
case 'B':
componentTypeName.append("byte");
break;
case 'C':
componentTypeName.append("char");
break;
case 'D':
componentTypeName.append("double");
break;
case 'F':
componentTypeName.append("float");
break;
case 'I':
componentTypeName.append("int");
break;
case 'J':
componentTypeName.append("long");
break;
case 'S':
componentTypeName.append("short");
break;
case 'L':
if ((object.getClass().getName().charAt(length - 1) != ';') || (length <= (dimension + 2))) {
return object.getClass().getName();
}
componentTypeName.append(object.getClass().getName().substring(dimension + 1, length - 1));
break;
default:
return object.getClass().getName();
}
for (int i = 0; i < dimension; i++) {
componentTypeName.append("[]");
}
return componentTypeName.toString();
</DeepExtract>
} | WiFiProbeAnalysis | positive | 3,421 |
@Override
public void onCompletion(IMediaPlayer mp) {
status = STATUS_COMPLETED;
if (!isLive && STATUS_COMPLETED == STATUS_COMPLETED) {
handler.removeMessages(MESSAGE_SHOW_PROGRESS);
hideAll();
$.id(R.id.app_video_replay).visible();
} else if (STATUS_COMPLETED == STATUS_ERROR) {
handler.removeMessages(MESSAGE_SHOW_PROGRESS);
hideAll();
if (isLive) {
showStatus(activity.getResources().getString(R.string.small_problem));
if (defaultRetryTime > 0) {
handler.sendEmptyMessageDelayed(MESSAGE_RESTART_PLAY, defaultRetryTime);
}
} else {
showStatus(activity.getResources().getString(R.string.small_problem));
}
} else if (STATUS_COMPLETED == STATUS_LOADING) {
hideAll();
$.id(R.id.app_video_loading).visible();
} else if (STATUS_COMPLETED == STATUS_PLAYING) {
hideAll();
}
} | @Override
<DeepExtract>
</DeepExtract>
public void onCompletion(IMediaPlayer mp) {
<DeepExtract>
</DeepExtract>
status = STATUS_COMPLETED;
<DeepExtract>
</DeepExtract>
if (!isLive && STATUS_COMPLETED == STATUS_COMPLETED) {
<DeepExtract>
</DeepExtract>
handler.removeMessages(MESSAGE_SHOW_PROGRESS);
<DeepExtract>
</DeepExtract>
hideAll();
<DeepExtract>
</DeepExtract>
$.id(R.id.app_video_replay).visible();
<DeepExtract>
</DeepExtract>
} else if (STATUS_COMPLETED == STATUS_ERROR) {
<DeepExtract>
</DeepExtract>
handler.removeMessages(MESSAGE_SHOW_PROGRESS);
<DeepExtract>
</DeepExtract>
hideAll();
<DeepExtract>
</DeepExtract>
if (isLive) {
<DeepExtract>
</DeepExtract>
showStatus(activity.getResources().getString(R.string.small_problem));
<DeepExtract>
</DeepExtract>
if (defaultRetryTime > 0) {
<DeepExtract>
</DeepExtract>
handler.sendEmptyMessageDelayed(MESSAGE_RESTART_PLAY, defaultRetryTime);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
} else {
<DeepExtract>
</DeepExtract>
showStatus(activity.getResources().getString(R.string.small_problem));
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
} else if (STATUS_COMPLETED == STATUS_LOADING) {
<DeepExtract>
</DeepExtract>
hideAll();
<DeepExtract>
</DeepExtract>
$.id(R.id.app_video_loading).visible();
<DeepExtract>
</DeepExtract>
} else if (STATUS_COMPLETED == STATUS_PLAYING) {
<DeepExtract>
</DeepExtract>
hideAll();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
} | LanCamera | positive | 3,422 |
public void write(OutputStream os) throws IOException {
int others = (object1 == null ? 0 : 1) + (object2 == null ? 0 : 1) + (object3 == null ? 0 : 1) + (name == null ? 0 : 1);
int length = objects == null ? 0 : objects.length;
os.write(ARGS_PREFIX);
os.write(numToBytes(length + others, true));
if (name != null)
writeObject(os, name);
if (object1 != null)
writeObject(os, object1);
if (object2 != null)
writeObject(os, object2);
if (object3 != null)
writeObject(os, object3);
if (objects != null) {
for (Object object : objects) {
writeObject(os, object);
}
}
} | public void write(OutputStream os) throws IOException {
<DeepExtract>
int others = (object1 == null ? 0 : 1) + (object2 == null ? 0 : 1) + (object3 == null ? 0 : 1) + (name == null ? 0 : 1);
int length = objects == null ? 0 : objects.length;
os.write(ARGS_PREFIX);
os.write(numToBytes(length + others, true));
if (name != null)
writeObject(os, name);
if (object1 != null)
writeObject(os, object1);
if (object2 != null)
writeObject(os, object2);
if (object3 != null)
writeObject(os, object3);
if (objects != null) {
for (Object object : objects) {
writeObject(os, object);
}
}
</DeepExtract>
} | redis-protocol | positive | 3,424 |
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mainapp = (threaded_application) getApplication();
mainapp.applyTheme(this);
setContentView(R.layout.function_settings);
orientationChange = false;
if (savedInstanceState == null) {
initSettings();
settingsCurrent = true;
}
prefs = getSharedPreferences("jmri.enginedriver_preferences", 0);
prefNumberOfDefaultFunctionLabels = prefs.getString("prefNumberOfDefaultFunctionLabels", getApplicationContext().getResources().getString(R.string.prefNumberOfDefaultFunctionLabelsDefaultValue));
prefNumberOfDefaultFunctionLabelsForRoster = prefs.getString("prefNumberOfDefaultFunctionLabelsForRoster", getApplicationContext().getResources().getString(R.string.prefNumberOfDefaultFunctionLabelsForRosterDefaultValue));
originalPrefNumberOfDefaultFunctionLabels = prefNumberOfDefaultFunctionLabels;
originalPrefNumberOfDefaultFunctionLabelsForRoster = prefNumberOfDefaultFunctionLabelsForRoster;
mainapp.prefAlwaysUseDefaultFunctionLabels = prefs.getBoolean("prefAlwaysUseDefaultFunctionLabels", getResources().getBoolean(R.bool.prefAlwaysUseDefaultFunctionLabelsDefaultValue));
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Button b = findViewById(R.id.fb_copy_labels_from_roster);
if (mainapp.function_labels == null || mainapp.function_labels[0] == null || mainapp.function_labels[0].size() == 0) {
b.setEnabled(false);
} else {
button_listener click_listener = new button_listener();
b.setOnClickListener(click_listener);
b.setEnabled(true);
}
Button bReset = findViewById(R.id.fb_reset_function_labels);
reset_button_listener reset_click_listener = new reset_button_listener();
bReset.setOnClickListener(reset_click_listener);
bReset.setEnabled(true);
et = findViewById(R.id.fb_number_of_default_function_labels);
et.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
etForRoster = findViewById(R.id.fb_number_of_default_function_labels_for_roster);
etForRoster.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
spinner = findViewById(R.id.fb_always_use_default_function_labels);
spinner.setOnItemSelectedListener(new spinner_listener());
mainapp.set_default_function_labels(true);
ViewGroup t = findViewById(R.id.label_func_table);
int ndx = 0;
for (int i = 1; i < t.getChildCount(); i++) {
ViewGroup r = (ViewGroup) t.getChildAt(i);
while (ndx < aFnc.size() && aLbl.get(ndx).length() == 0) ndx++;
if (ndx < aFnc.size()) {
((EditText) r.getChildAt(0)).setText(aLbl.get(ndx));
((EditText) r.getChildAt(1)).setText(aFnc.get(ndx).toString());
ndx++;
} else {
TextKeyListener.clear(((EditText) r.getChildAt(0)).getText());
TextKeyListener.clear(((EditText) r.getChildAt(1)).getText());
}
}
if (mainapp.prefAlwaysUseDefaultFunctionLabels) {
spinner.setSelection(0);
} else {
spinner.setSelection(1);
}
et.setText(prefNumberOfDefaultFunctionLabels);
etForRoster.setText(prefNumberOfDefaultFunctionLabelsForRoster);
if (!android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
TextView v = findViewById(R.id.fs_heading);
v.setText(getString(R.string.fs_edit_notice));
}
mainapp.function_settings_msg_handler = new function_settings_handler();
toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
mainapp.setToolbarTitle(toolbar, getApplicationContext().getResources().getString(R.string.app_name), getApplicationContext().getResources().getString(R.string.app_name_functions), "");
}
} | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mainapp = (threaded_application) getApplication();
mainapp.applyTheme(this);
setContentView(R.layout.function_settings);
orientationChange = false;
if (savedInstanceState == null) {
initSettings();
settingsCurrent = true;
}
prefs = getSharedPreferences("jmri.enginedriver_preferences", 0);
prefNumberOfDefaultFunctionLabels = prefs.getString("prefNumberOfDefaultFunctionLabels", getApplicationContext().getResources().getString(R.string.prefNumberOfDefaultFunctionLabelsDefaultValue));
prefNumberOfDefaultFunctionLabelsForRoster = prefs.getString("prefNumberOfDefaultFunctionLabelsForRoster", getApplicationContext().getResources().getString(R.string.prefNumberOfDefaultFunctionLabelsForRosterDefaultValue));
originalPrefNumberOfDefaultFunctionLabels = prefNumberOfDefaultFunctionLabels;
originalPrefNumberOfDefaultFunctionLabelsForRoster = prefNumberOfDefaultFunctionLabelsForRoster;
mainapp.prefAlwaysUseDefaultFunctionLabels = prefs.getBoolean("prefAlwaysUseDefaultFunctionLabels", getResources().getBoolean(R.bool.prefAlwaysUseDefaultFunctionLabelsDefaultValue));
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Button b = findViewById(R.id.fb_copy_labels_from_roster);
if (mainapp.function_labels == null || mainapp.function_labels[0] == null || mainapp.function_labels[0].size() == 0) {
b.setEnabled(false);
} else {
button_listener click_listener = new button_listener();
b.setOnClickListener(click_listener);
b.setEnabled(true);
}
Button bReset = findViewById(R.id.fb_reset_function_labels);
reset_button_listener reset_click_listener = new reset_button_listener();
bReset.setOnClickListener(reset_click_listener);
bReset.setEnabled(true);
et = findViewById(R.id.fb_number_of_default_function_labels);
et.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
etForRoster = findViewById(R.id.fb_number_of_default_function_labels_for_roster);
etForRoster.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
spinner = findViewById(R.id.fb_always_use_default_function_labels);
spinner.setOnItemSelectedListener(new spinner_listener());
mainapp.set_default_function_labels(true);
<DeepExtract>
ViewGroup t = findViewById(R.id.label_func_table);
int ndx = 0;
for (int i = 1; i < t.getChildCount(); i++) {
ViewGroup r = (ViewGroup) t.getChildAt(i);
while (ndx < aFnc.size() && aLbl.get(ndx).length() == 0) ndx++;
if (ndx < aFnc.size()) {
((EditText) r.getChildAt(0)).setText(aLbl.get(ndx));
((EditText) r.getChildAt(1)).setText(aFnc.get(ndx).toString());
ndx++;
} else {
TextKeyListener.clear(((EditText) r.getChildAt(0)).getText());
TextKeyListener.clear(((EditText) r.getChildAt(1)).getText());
}
}
if (mainapp.prefAlwaysUseDefaultFunctionLabels) {
spinner.setSelection(0);
} else {
spinner.setSelection(1);
}
et.setText(prefNumberOfDefaultFunctionLabels);
etForRoster.setText(prefNumberOfDefaultFunctionLabelsForRoster);
</DeepExtract>
if (!android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
TextView v = findViewById(R.id.fs_heading);
v.setText(getString(R.string.fs_edit_notice));
}
mainapp.function_settings_msg_handler = new function_settings_handler();
toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
mainapp.setToolbarTitle(toolbar, getApplicationContext().getResources().getString(R.string.app_name), getApplicationContext().getResources().getString(R.string.app_name_functions), "");
}
} | EngineDriver | positive | 3,425 |
@Override
public void onResume() {
super.onResume();
if (mActionMode != null) {
mActionMode.invalidate();
}
if (getCurrentList().getAdapter().getCount() > 0) {
mMessageView.setVisibility(View.GONE);
} else {
mMessageView.setVisibility(View.VISIBLE);
}
} | @Override
public void onResume() {
super.onResume();
if (mActionMode != null) {
mActionMode.invalidate();
}
<DeepExtract>
if (getCurrentList().getAdapter().getCount() > 0) {
mMessageView.setVisibility(View.GONE);
} else {
mMessageView.setVisibility(View.VISIBLE);
}
</DeepExtract>
} | BrewShopApp | positive | 3,427 |
protected boolean tryToggle(MH menuHolder, InventoryClickEvent event) {
if (!beforeToggle(menuHolder, event))
return false;
setCurrentState(stateUpdater.apply(getCurrentState()));
return true;
} | protected boolean tryToggle(MH menuHolder, InventoryClickEvent event) {
<DeepExtract>
</DeepExtract>
if (!beforeToggle(menuHolder, event))
<DeepExtract>
</DeepExtract>
return false;
<DeepExtract>
</DeepExtract>
setCurrentState(stateUpdater.apply(getCurrentState()));
<DeepExtract>
</DeepExtract>
return true;
<DeepExtract>
</DeepExtract>
} | GuiLib | positive | 3,428 |
@Test
public void handle_withMessage0x78_notifiesOnStrokeRateUpdated() {
return new AverageStrokeRateSubscription() {
@Override
protected void onStrokeRateUpdated(double strokeRate) {
internalSubscription.onStrokeRateUpdated(strokeRate);
}
};
subscription.handle(new DataMemoryMessage(STROKE_AVERAGE.getLocation(), 0x78));
internalSubscription.onStrokeRateUpdated(20D);
} | @Test
public void handle_withMessage0x78_notifiesOnStrokeRateUpdated() {
return new AverageStrokeRateSubscription() {
@Override
protected void onStrokeRateUpdated(double strokeRate) {
internalSubscription.onStrokeRateUpdated(strokeRate);
}
};
subscription.handle(new DataMemoryMessage(STROKE_AVERAGE.getLocation(), 0x78));
<DeepExtract>
internalSubscription.onStrokeRateUpdated(20D);
</DeepExtract>
} | waterrower-core | positive | 3,430 |
public Criteria andTrademarkSmallLabel3NotBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "trademarkSmallLabel3" + " cannot be null");
}
criteria.add(new Criterion("trademark_small_label_3 not between", value1, value2));
return (Criteria) this;
} | public Criteria andTrademarkSmallLabel3NotBetween(String value1, String value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "trademarkSmallLabel3" + " cannot be null");
}
criteria.add(new Criterion("trademark_small_label_3 not between", value1, value2));
</DeepExtract>
return (Criteria) this;
} | uccn | positive | 3,431 |
public static byte[] encryptSHA384(byte[] data) {
if (data == null || data.length <= 0) {
return null;
}
try {
MessageDigest md = MessageDigest.getInstance("SHA384");
md.update(data);
return md.digest();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
} | public static byte[] encryptSHA384(byte[] data) {
<DeepExtract>
if (data == null || data.length <= 0) {
return null;
}
try {
MessageDigest md = MessageDigest.getInstance("SHA384");
md.update(data);
return md.digest();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
</DeepExtract>
} | Engine | positive | 3,432 |
public Criteria andRoleIdLessThan(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "roleId" + " cannot be null");
}
criteria.add(new Criterion("role_id <", value));
return (Criteria) this;
} | public Criteria andRoleIdLessThan(Integer value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "roleId" + " cannot be null");
}
criteria.add(new Criterion("role_id <", value));
</DeepExtract>
return (Criteria) this;
} | wukong-framework | positive | 3,433 |
public static boolean verifyNotify(Map<String, String> params, String partnerKey, SignType signType, String signKey) {
if (StrUtil.isEmpty(signKey)) {
signKey = FIELD_SIGN;
}
String sign = params.get(signKey);
String localSign;
if (signType == null) {
signType = SignType.MD5;
}
if (StrUtil.isEmpty(signKey)) {
signKey = FIELD_SIGN;
}
params.remove(signKey);
String tempStr = PayKit.createLinkString(params);
String stringSignTemp = tempStr + "&key=" + partnerKey;
if (signType == SignType.MD5) {
localSign = md5(stringSignTemp).toUpperCase();
} else {
localSign = hmacSha256(stringSignTemp, partnerKey).toUpperCase();
}
return sign.equals(localSign);
} | public static boolean verifyNotify(Map<String, String> params, String partnerKey, SignType signType, String signKey) {
if (StrUtil.isEmpty(signKey)) {
signKey = FIELD_SIGN;
}
String sign = params.get(signKey);
<DeepExtract>
String localSign;
if (signType == null) {
signType = SignType.MD5;
}
if (StrUtil.isEmpty(signKey)) {
signKey = FIELD_SIGN;
}
params.remove(signKey);
String tempStr = PayKit.createLinkString(params);
String stringSignTemp = tempStr + "&key=" + partnerKey;
if (signType == SignType.MD5) {
localSign = md5(stringSignTemp).toUpperCase();
} else {
localSign = hmacSha256(stringSignTemp, partnerKey).toUpperCase();
}
</DeepExtract>
return sign.equals(localSign);
} | IJPay | positive | 3,434 |
private List<AppSettingInfo> loadAppSettingInfos() {
if (null == mAppSettingInfos) {
mAppSettingInfos = new ArrayList<AppSettingInfo>();
} else {
mAppSettingInfos.clear();
}
List<AppSettingInfo> appSettingInfos = AppSettingInfoUtil.findAll();
if (appSettingInfos.size() > 0) {
mAppSettingInfos.addAll(appSettingInfos);
}
return mAppSettingInfos;
} | private List<AppSettingInfo> loadAppSettingInfos() {
<DeepExtract>
if (null == mAppSettingInfos) {
mAppSettingInfos = new ArrayList<AppSettingInfo>();
} else {
mAppSettingInfos.clear();
}
</DeepExtract>
List<AppSettingInfo> appSettingInfos = AppSettingInfoUtil.findAll();
if (appSettingInfos.size() > 0) {
mAppSettingInfos.addAll(appSettingInfos);
}
return mAppSettingInfos;
} | XDesktopHelper | positive | 3,435 |
private void confirmModeAction() {
ProjectManager.getCurrentProject().mode = EnumActionMode.NONE;
assert ProjectManager.getCurrentClientLevelData() != null;
double posAvgX = 0;
boolean canGrabX = false;
double posAvgY = 0;
boolean canGrabY = false;
double posAvgZ = 0;
boolean canGrabZ = false;
double rotAvgX = 0;
double rotAvgY = 0;
double rotAvgZ = 0;
boolean canRotate = false;
double sclAvgX = 0;
double sclAvgY = 0;
double sclAvgZ = 0;
boolean canScale = false;
assert ProjectManager.getCurrentClientLevelData() != null;
Class<?> selectedIAsset;
if (ProjectManager.getCurrentClientLevelData().getSelectedPlaceables().size() > 0) {
selectedIAsset = ProjectManager.getCurrentLevelData().getPlaceable(ProjectManager.getCurrentClientLevelData().getSelectedPlaceables().iterator().next()).getAsset().getClass();
} else {
selectedIAsset = null;
}
for (String name : ProjectManager.getCurrentClientLevelData().getSelectedPlaceables()) {
Placeable placeable = ProjectManager.getCurrentLevelData().getPlaceable(name);
if (placeable.getAsset().canGrabX()) {
canGrabX = true;
posAvgX += placeable.getPosition().x;
}
if (placeable.getAsset().canGrabY()) {
canGrabY = true;
posAvgY += placeable.getPosition().y;
}
if (placeable.getAsset().canGrabZ()) {
canGrabZ = true;
posAvgZ += placeable.getPosition().z;
}
if (placeable.getAsset().canRotate()) {
canRotate = true;
rotAvgX += placeable.getRotation().x;
rotAvgY += placeable.getRotation().y;
rotAvgZ += placeable.getRotation().z;
}
if (placeable.getAsset().canScale()) {
canScale = true;
sclAvgX += placeable.getScale().x;
sclAvgY += placeable.getScale().y;
sclAvgZ += placeable.getScale().z;
} else {
sclAvgX += 1;
sclAvgY += 1;
sclAvgZ += 1;
}
if (selectedIAsset != null && !placeable.getAsset().getClass().isAssignableFrom(selectedIAsset)) {
selectedIAsset = null;
}
}
int selectedCount = ProjectManager.getCurrentClientLevelData().getSelectedPlaceables().size();
if (selectedCount != 0) {
posAvgX = posAvgX / (double) selectedCount;
posAvgY = posAvgY / (double) selectedCount;
posAvgZ = posAvgZ / (double) selectedCount;
if (canGrabX) {
placeablePositionTextFields.setXEnabled(true);
} else {
placeablePositionTextFields.setXEnabled(false);
placeablePositionTextFields.setXValue(0);
}
if (canGrabY) {
placeablePositionTextFields.setYEnabled(true);
} else {
placeablePositionTextFields.setYEnabled(false);
placeablePositionTextFields.setYValue(0);
}
if (canGrabZ) {
placeablePositionTextFields.setZEnabled(true);
} else {
placeablePositionTextFields.setZEnabled(false);
placeablePositionTextFields.setZValue(0);
}
placeablePositionTextFields.setXValue(posAvgX);
placeablePositionTextFields.setYValue(posAvgY);
placeablePositionTextFields.setZValue(posAvgZ);
} else {
placeablePositionTextFields.setXEnabled(false);
placeablePositionTextFields.setYEnabled(false);
placeablePositionTextFields.setZEnabled(false);
placeablePositionTextFields.setXValue(0);
placeablePositionTextFields.setYValue(0);
placeablePositionTextFields.setZValue(0);
}
if (selectedCount != 0 && canRotate) {
rotAvgX = rotAvgX / (double) selectedCount;
rotAvgY = rotAvgY / (double) selectedCount;
rotAvgZ = rotAvgZ / (double) selectedCount;
placeableRotationTextFields.setXEnabled(true);
placeableRotationTextFields.setYEnabled(true);
placeableRotationTextFields.setZEnabled(true);
placeableRotationTextFields.setXValue(rotAvgX);
placeableRotationTextFields.setYValue(rotAvgY);
placeableRotationTextFields.setZValue(rotAvgZ);
} else {
placeableRotationTextFields.setXEnabled(false);
placeableRotationTextFields.setYEnabled(false);
placeableRotationTextFields.setZEnabled(false);
placeableRotationTextFields.setXValue(0);
placeableRotationTextFields.setYValue(0);
placeableRotationTextFields.setZValue(0);
}
if (selectedCount != 0 && canScale) {
sclAvgX = sclAvgX / (double) selectedCount;
sclAvgY = sclAvgY / (double) selectedCount;
sclAvgZ = sclAvgZ / (double) selectedCount;
placeableScaleTextFields.setXEnabled(true);
placeableScaleTextFields.setYEnabled(true);
placeableScaleTextFields.setZEnabled(true);
placeableScaleTextFields.setXValue(sclAvgX);
placeableScaleTextFields.setYValue(sclAvgY);
placeableScaleTextFields.setZValue(sclAvgZ);
} else {
placeableScaleTextFields.setXEnabled(false);
placeableScaleTextFields.setYEnabled(false);
placeableScaleTextFields.setZEnabled(false);
placeableScaleTextFields.setXValue(1);
placeableScaleTextFields.setYValue(1);
placeableScaleTextFields.setZValue(1);
}
if (selectedCount > 0) {
boolean stageReservedOnly = true;
for (String name : ProjectManager.getCurrentClientLevelData().getSelectedPlaceables()) {
String igName = ProjectManager.getCurrentLevelData().getPlaceableItemGroupName(name);
if (!Objects.equals(igName, "STAGE_RESERVED")) {
stageReservedOnly = false;
break;
}
}
placeableItemGroupButton.setEnabled(!stageReservedOnly);
String commonItemGroup = null;
for (String name : ProjectManager.getCurrentClientLevelData().getSelectedPlaceables()) {
String igName = ProjectManager.getCurrentLevelData().getPlaceableItemGroupName(name);
if (commonItemGroup == null) {
commonItemGroup = igName;
}
if (!Objects.equals(commonItemGroup, igName)) {
commonItemGroup = null;
break;
}
}
if (commonItemGroup != null) {
placeableItemGroupButton.setText(commonItemGroup);
} else {
placeableItemGroupButton.setText("...");
}
} else {
placeableItemGroupButton.setEnabled(false);
placeableItemGroupButton.setText(LangManager.getItem("nothingSelected"));
}
if (selectedIAsset != null) {
String[] types = ProjectManager.getCurrentLevelData().getPlaceable(ProjectManager.getCurrentClientLevelData().getSelectedPlaceables().iterator().next()).getAsset().getValidTypes();
if (types != null) {
typeList = Arrays.asList(types);
typeButton.setText(LangManager.getItem(ProjectManager.getCurrentLevelData().getPlaceable(ProjectManager.getCurrentClientLevelData().getSelectedPlaceables().iterator().next()).getAsset().getType()));
typeButton.setEnabled(true);
} else {
typeList = null;
typeButton.setText(LangManager.getItem("noTypes"));
typeButton.setEnabled(false);
}
} else {
typeList = null;
typeButton.setText(LangManager.getItem("noTypes"));
typeButton.setEnabled(false);
}
deltaX = 0;
} | private void confirmModeAction() {
ProjectManager.getCurrentProject().mode = EnumActionMode.NONE;
assert ProjectManager.getCurrentClientLevelData() != null;
<DeepExtract>
double posAvgX = 0;
boolean canGrabX = false;
double posAvgY = 0;
boolean canGrabY = false;
double posAvgZ = 0;
boolean canGrabZ = false;
double rotAvgX = 0;
double rotAvgY = 0;
double rotAvgZ = 0;
boolean canRotate = false;
double sclAvgX = 0;
double sclAvgY = 0;
double sclAvgZ = 0;
boolean canScale = false;
assert ProjectManager.getCurrentClientLevelData() != null;
Class<?> selectedIAsset;
if (ProjectManager.getCurrentClientLevelData().getSelectedPlaceables().size() > 0) {
selectedIAsset = ProjectManager.getCurrentLevelData().getPlaceable(ProjectManager.getCurrentClientLevelData().getSelectedPlaceables().iterator().next()).getAsset().getClass();
} else {
selectedIAsset = null;
}
for (String name : ProjectManager.getCurrentClientLevelData().getSelectedPlaceables()) {
Placeable placeable = ProjectManager.getCurrentLevelData().getPlaceable(name);
if (placeable.getAsset().canGrabX()) {
canGrabX = true;
posAvgX += placeable.getPosition().x;
}
if (placeable.getAsset().canGrabY()) {
canGrabY = true;
posAvgY += placeable.getPosition().y;
}
if (placeable.getAsset().canGrabZ()) {
canGrabZ = true;
posAvgZ += placeable.getPosition().z;
}
if (placeable.getAsset().canRotate()) {
canRotate = true;
rotAvgX += placeable.getRotation().x;
rotAvgY += placeable.getRotation().y;
rotAvgZ += placeable.getRotation().z;
}
if (placeable.getAsset().canScale()) {
canScale = true;
sclAvgX += placeable.getScale().x;
sclAvgY += placeable.getScale().y;
sclAvgZ += placeable.getScale().z;
} else {
sclAvgX += 1;
sclAvgY += 1;
sclAvgZ += 1;
}
if (selectedIAsset != null && !placeable.getAsset().getClass().isAssignableFrom(selectedIAsset)) {
selectedIAsset = null;
}
}
int selectedCount = ProjectManager.getCurrentClientLevelData().getSelectedPlaceables().size();
if (selectedCount != 0) {
posAvgX = posAvgX / (double) selectedCount;
posAvgY = posAvgY / (double) selectedCount;
posAvgZ = posAvgZ / (double) selectedCount;
if (canGrabX) {
placeablePositionTextFields.setXEnabled(true);
} else {
placeablePositionTextFields.setXEnabled(false);
placeablePositionTextFields.setXValue(0);
}
if (canGrabY) {
placeablePositionTextFields.setYEnabled(true);
} else {
placeablePositionTextFields.setYEnabled(false);
placeablePositionTextFields.setYValue(0);
}
if (canGrabZ) {
placeablePositionTextFields.setZEnabled(true);
} else {
placeablePositionTextFields.setZEnabled(false);
placeablePositionTextFields.setZValue(0);
}
placeablePositionTextFields.setXValue(posAvgX);
placeablePositionTextFields.setYValue(posAvgY);
placeablePositionTextFields.setZValue(posAvgZ);
} else {
placeablePositionTextFields.setXEnabled(false);
placeablePositionTextFields.setYEnabled(false);
placeablePositionTextFields.setZEnabled(false);
placeablePositionTextFields.setXValue(0);
placeablePositionTextFields.setYValue(0);
placeablePositionTextFields.setZValue(0);
}
if (selectedCount != 0 && canRotate) {
rotAvgX = rotAvgX / (double) selectedCount;
rotAvgY = rotAvgY / (double) selectedCount;
rotAvgZ = rotAvgZ / (double) selectedCount;
placeableRotationTextFields.setXEnabled(true);
placeableRotationTextFields.setYEnabled(true);
placeableRotationTextFields.setZEnabled(true);
placeableRotationTextFields.setXValue(rotAvgX);
placeableRotationTextFields.setYValue(rotAvgY);
placeableRotationTextFields.setZValue(rotAvgZ);
} else {
placeableRotationTextFields.setXEnabled(false);
placeableRotationTextFields.setYEnabled(false);
placeableRotationTextFields.setZEnabled(false);
placeableRotationTextFields.setXValue(0);
placeableRotationTextFields.setYValue(0);
placeableRotationTextFields.setZValue(0);
}
if (selectedCount != 0 && canScale) {
sclAvgX = sclAvgX / (double) selectedCount;
sclAvgY = sclAvgY / (double) selectedCount;
sclAvgZ = sclAvgZ / (double) selectedCount;
placeableScaleTextFields.setXEnabled(true);
placeableScaleTextFields.setYEnabled(true);
placeableScaleTextFields.setZEnabled(true);
placeableScaleTextFields.setXValue(sclAvgX);
placeableScaleTextFields.setYValue(sclAvgY);
placeableScaleTextFields.setZValue(sclAvgZ);
} else {
placeableScaleTextFields.setXEnabled(false);
placeableScaleTextFields.setYEnabled(false);
placeableScaleTextFields.setZEnabled(false);
placeableScaleTextFields.setXValue(1);
placeableScaleTextFields.setYValue(1);
placeableScaleTextFields.setZValue(1);
}
if (selectedCount > 0) {
boolean stageReservedOnly = true;
for (String name : ProjectManager.getCurrentClientLevelData().getSelectedPlaceables()) {
String igName = ProjectManager.getCurrentLevelData().getPlaceableItemGroupName(name);
if (!Objects.equals(igName, "STAGE_RESERVED")) {
stageReservedOnly = false;
break;
}
}
placeableItemGroupButton.setEnabled(!stageReservedOnly);
String commonItemGroup = null;
for (String name : ProjectManager.getCurrentClientLevelData().getSelectedPlaceables()) {
String igName = ProjectManager.getCurrentLevelData().getPlaceableItemGroupName(name);
if (commonItemGroup == null) {
commonItemGroup = igName;
}
if (!Objects.equals(commonItemGroup, igName)) {
commonItemGroup = null;
break;
}
}
if (commonItemGroup != null) {
placeableItemGroupButton.setText(commonItemGroup);
} else {
placeableItemGroupButton.setText("...");
}
} else {
placeableItemGroupButton.setEnabled(false);
placeableItemGroupButton.setText(LangManager.getItem("nothingSelected"));
}
if (selectedIAsset != null) {
String[] types = ProjectManager.getCurrentLevelData().getPlaceable(ProjectManager.getCurrentClientLevelData().getSelectedPlaceables().iterator().next()).getAsset().getValidTypes();
if (types != null) {
typeList = Arrays.asList(types);
typeButton.setText(LangManager.getItem(ProjectManager.getCurrentLevelData().getPlaceable(ProjectManager.getCurrentClientLevelData().getSelectedPlaceables().iterator().next()).getAsset().getType()));
typeButton.setEnabled(true);
} else {
typeList = null;
typeButton.setText(LangManager.getItem("noTypes"));
typeButton.setEnabled(false);
}
} else {
typeList = null;
typeButton.setText(LangManager.getItem("noTypes"));
typeButton.setEnabled(false);
}
</DeepExtract>
deltaX = 0;
} | SMBLevelWorkshop | positive | 3,437 |
@Cached
@DontLabel
public Rule firstOf(final Object[] rules) {
Objects.requireNonNull(rules, "rules");
if (rules.length == 1)
return toRule(rules[0]);
final Collection<String> strings = new ArrayList<>();
for (final Object object : rules) {
if (!(object instanceof String))
return new FirstOfMatcher(toRules(rules));
strings.add((String) object);
}
final List<String> list = ImmutableList.copyOf(strings);
final TrieBuilder builder = Trie.newBuilder();
list.forEach(builder::addWord);
return new TrieMatcher(builder.build());
} | @Cached
@DontLabel
public Rule firstOf(final Object[] rules) {
Objects.requireNonNull(rules, "rules");
if (rules.length == 1)
return toRule(rules[0]);
final Collection<String> strings = new ArrayList<>();
for (final Object object : rules) {
if (!(object instanceof String))
return new FirstOfMatcher(toRules(rules));
strings.add((String) object);
}
<DeepExtract>
final List<String> list = ImmutableList.copyOf(strings);
final TrieBuilder builder = Trie.newBuilder();
list.forEach(builder::addWord);
return new TrieMatcher(builder.build());
</DeepExtract>
} | grappa | positive | 3,438 |
public static <K, V extends Comparable<? super V>> LinkedHashMap<K, V> sortByValue(Map<K, V> sourceMap, boolean... reverse) {
if (isEmpty(sourceMap)) {
return new LinkedHashMap<>(2, 0.5f, Boolean.FALSE);
}
Comparator<Map.Entry<K, V>> comparingByValue = Map.Entry.comparingByValue();
if (isNotEmpty(reverse) && reverse[0]) {
comparingByValue = comparingByValue.reversed();
}
return sourceMap.entrySet().stream().sorted(comparingByValue).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new));
} | public static <K, V extends Comparable<? super V>> LinkedHashMap<K, V> sortByValue(Map<K, V> sourceMap, boolean... reverse) {
if (isEmpty(sourceMap)) {
return new LinkedHashMap<>(2, 0.5f, Boolean.FALSE);
}
Comparator<Map.Entry<K, V>> comparingByValue = Map.Entry.comparingByValue();
if (isNotEmpty(reverse) && reverse[0]) {
comparingByValue = comparingByValue.reversed();
}
<DeepExtract>
return sourceMap.entrySet().stream().sorted(comparingByValue).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new));
</DeepExtract>
} | D8gerStarters | positive | 3,439 |
public Graphics2D paintSmallIcon(Graphics2D g2) {
int width = smallComponentDimension.width - 2 * padding;
int height = smallComponentDimension.height - 2 * padding;
this.x = 0 + padding;
this.y = 0 + padding;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
drawBackground(g2, arc, width, height);
if (false)
drawIcon(g2, width, height);
drawTexts(g2, width, height, false);
drawDisplayIndicator(g2, width, unit.isDisplay(), unit.isDisplaySilent());
return g2;
} | public Graphics2D paintSmallIcon(Graphics2D g2) {
int width = smallComponentDimension.width - 2 * padding;
int height = smallComponentDimension.height - 2 * padding;
<DeepExtract>
this.x = 0 + padding;
this.y = 0 + padding;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
drawBackground(g2, arc, width, height);
if (false)
drawIcon(g2, width, height);
drawTexts(g2, width, height, false);
drawDisplayIndicator(g2, width, unit.isDisplay(), unit.isDisplaySilent());
</DeepExtract>
return g2;
} | imageflow | positive | 3,440 |
@Override
public void onCreateActivity(@Nullable Bundle savedInstanceState) {
initToolbar(UiUtils.getString(R.string.app_name));
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
mDrawerLayout.addDrawerListener(toggle);
toggle.syncState();
mNavView.setNavigationItemSelectedListener(this);
View headerView = mNavView.getHeaderView(0);
mImgIcon = (ImageView) headerView.findViewById(R.id.img_icon);
mTxtPhone = (TextView) headerView.findViewById(R.id.txt_phone);
mTxtUsername = (TextView) headerView.findViewById(R.id.txt_username);
mImgIcon.setOnClickListener(this);
String[] titles = new String[12];
Calendar c = Calendar.getInstance(Locale.CHINA);
int year = c.get(Calendar.YEAR);
for (int i = 1; i <= 12; i++) {
String month = i < 10 ? "0".concat(String.valueOf(i)) : String.valueOf(i);
titles[i - 1] = year + "年" + month + "月";
}
MainFragmentPagerAdapter adapter = new MainFragmentPagerAdapter(getSupportFragmentManager(), titles);
mViewPager.setAdapter(adapter);
mTabLayout.setupWithViewPager(mViewPager);
mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
int month = c.get(Calendar.MONTH);
mViewPager.setCurrentItem(month);
mCommonRepository = new CommonRepository();
mExitAppHelper = new ExitAppHelper(mContext);
SPUtils.setSP(mContext, AppConstants.KEY_LAST_UPDATE_TIME, AppUtils.getLastUpdateTime());
} | @Override
public void onCreateActivity(@Nullable Bundle savedInstanceState) {
initToolbar(UiUtils.getString(R.string.app_name));
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
mDrawerLayout.addDrawerListener(toggle);
toggle.syncState();
mNavView.setNavigationItemSelectedListener(this);
View headerView = mNavView.getHeaderView(0);
mImgIcon = (ImageView) headerView.findViewById(R.id.img_icon);
mTxtPhone = (TextView) headerView.findViewById(R.id.txt_phone);
mTxtUsername = (TextView) headerView.findViewById(R.id.txt_username);
mImgIcon.setOnClickListener(this);
<DeepExtract>
String[] titles = new String[12];
Calendar c = Calendar.getInstance(Locale.CHINA);
int year = c.get(Calendar.YEAR);
for (int i = 1; i <= 12; i++) {
String month = i < 10 ? "0".concat(String.valueOf(i)) : String.valueOf(i);
titles[i - 1] = year + "年" + month + "月";
}
MainFragmentPagerAdapter adapter = new MainFragmentPagerAdapter(getSupportFragmentManager(), titles);
mViewPager.setAdapter(adapter);
mTabLayout.setupWithViewPager(mViewPager);
mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
int month = c.get(Calendar.MONTH);
mViewPager.setCurrentItem(month);
</DeepExtract>
mCommonRepository = new CommonRepository();
mExitAppHelper = new ExitAppHelper(mContext);
SPUtils.setSP(mContext, AppConstants.KEY_LAST_UPDATE_TIME, AppUtils.getLastUpdateTime());
} | AccountBook | positive | 3,442 |
@Override
public void run() {
this.data.clear();
this.data.addAll(extras);
notifyDataSetChanged();
swipeRefreshLayout.setRefreshing(false);
} | @Override
public void run() {
<DeepExtract>
this.data.clear();
this.data.addAll(extras);
notifyDataSetChanged();
</DeepExtract>
swipeRefreshLayout.setRefreshing(false);
} | X-Touch | positive | 3,443 |
public boolean onLongClick(View v) {
if (handler == null)
return false;
Method method = null;
try {
method = handler.getClass().getDeclaredMethod(longClickMethod, View.class);
if (method != null) {
Object obj = method.invoke(handler, v);
return obj == null ? false : Boolean.valueOf(obj.toString());
} else
throw new ViewException("no such method:" + longClickMethod);
} catch (Exception e) {
e.printStackTrace();
}
return false;
} | public boolean onLongClick(View v) {
<DeepExtract>
if (handler == null)
return false;
Method method = null;
try {
method = handler.getClass().getDeclaredMethod(longClickMethod, View.class);
if (method != null) {
Object obj = method.invoke(handler, v);
return obj == null ? false : Boolean.valueOf(obj.toString());
} else
throw new ViewException("no such method:" + longClickMethod);
} catch (Exception e) {
e.printStackTrace();
}
return false;
</DeepExtract>
} | afinal | positive | 3,444 |
public static int[] Argsort(final double[] array, final boolean ascending) {
Integer[] indexes = new Integer[array.length];
for (int i = 0; i < indexes.length; i++) {
indexes[i] = i;
}
Arrays.sort(indexes, new Comparator<Integer>() {
@Override
public int compare(final Integer i1, final Integer i2) {
return (ascending ? 1 : -1) * Double.compare(array[i1], array[i2]);
}
});
int[] b = new int[indexes.length];
for (int i = 0; i < b.length; i++) {
b[i] = indexes[i].intValue();
}
return b;
} | public static int[] Argsort(final double[] array, final boolean ascending) {
Integer[] indexes = new Integer[array.length];
for (int i = 0; i < indexes.length; i++) {
indexes[i] = i;
}
Arrays.sort(indexes, new Comparator<Integer>() {
@Override
public int compare(final Integer i1, final Integer i2) {
return (ascending ? 1 : -1) * Double.compare(array[i1], array[i2]);
}
});
<DeepExtract>
int[] b = new int[indexes.length];
for (int i = 0; i < b.length; i++) {
b[i] = indexes[i].intValue();
}
return b;
</DeepExtract>
} | WizardCamera | positive | 3,445 |
public static void main(String[] args) {
List<String> result = new ArrayList<>();
fileId = 1;
try {
SAXBuilder builder = new SAXBuilder();
builder.setEntityResolver(new Catalog(args[2]));
Document doc = builder.build(args[0]);
Element root = doc.getRootElement();
if (!root.getAttributeValue("version", "1.2").equals("1.2")) {
result.add(Constants.ERROR);
result.add(Messages.getString("ToXliff2.1"));
return result;
}
Document xliff2 = new Document(null, "xliff", null, null);
root2 = xliff2.getRootElement();
recurse(root, root2);
Indenter.indent(root2, 2);
XMLOutputter outputter = new XMLOutputter();
outputter.preserveSpace(true);
try (FileOutputStream out = new FileOutputStream(new File(args[1]))) {
out.write(XMLUtils.UTF8BOM);
outputter.output(xliff2, out);
}
result.add(Constants.SUCCESS);
} catch (SAXException | IOException | ParserConfigurationException | URISyntaxException ex) {
Logger logger = System.getLogger(ToXliff2.class.getName());
logger.log(Level.ERROR, Messages.getString("ToXliff2.2"));
result.add(Constants.ERROR);
result.add(ex.getMessage());
}
return result;
} | public static void main(String[] args) {
<DeepExtract>
List<String> result = new ArrayList<>();
fileId = 1;
try {
SAXBuilder builder = new SAXBuilder();
builder.setEntityResolver(new Catalog(args[2]));
Document doc = builder.build(args[0]);
Element root = doc.getRootElement();
if (!root.getAttributeValue("version", "1.2").equals("1.2")) {
result.add(Constants.ERROR);
result.add(Messages.getString("ToXliff2.1"));
return result;
}
Document xliff2 = new Document(null, "xliff", null, null);
root2 = xliff2.getRootElement();
recurse(root, root2);
Indenter.indent(root2, 2);
XMLOutputter outputter = new XMLOutputter();
outputter.preserveSpace(true);
try (FileOutputStream out = new FileOutputStream(new File(args[1]))) {
out.write(XMLUtils.UTF8BOM);
outputter.output(xliff2, out);
}
result.add(Constants.SUCCESS);
} catch (SAXException | IOException | ParserConfigurationException | URISyntaxException ex) {
Logger logger = System.getLogger(ToXliff2.class.getName());
logger.log(Level.ERROR, Messages.getString("ToXliff2.2"));
result.add(Constants.ERROR);
result.add(ex.getMessage());
}
return result;
</DeepExtract>
} | OpenXLIFF | positive | 3,446 |
@Test
public void testToStringAndWithCommentMarkerTakingCharacter() {
final CSVFormat.Predefined csvFormat_Predefined = CSVFormat.Predefined.Default;
final CSVFormat csvFormat = csvFormat_Predefined.getFormat();
assertNull(csvFormat.getEscapeCharacter());
assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(csvFormat.getTrim());
assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(csvFormat.getTrailingDelimiter());
assertEquals(',', csvFormat.getDelimiter());
assertFalse(csvFormat.getIgnoreHeaderCase());
assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(csvFormat.isCommentMarkerSet());
assertNull(csvFormat.getCommentMarker());
assertFalse(csvFormat.isNullStringSet());
assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(csvFormat.isEscapeCharacterSet());
assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(csvFormat.getNullString());
assertNull(csvFormat.getQuoteMode());
assertTrue(csvFormat.getIgnoreEmptyLines());
assertEquals('\"', (char) csvFormat.getQuoteCharacter());
final Character character = Character.valueOf('n');
final CSVFormat csvFormatTwo = csvFormat.withCommentMarker(character);
assertNull(csvFormat.getEscapeCharacter());
assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(csvFormat.getTrim());
assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(csvFormat.getTrailingDelimiter());
assertEquals(',', csvFormat.getDelimiter());
assertFalse(csvFormat.getIgnoreHeaderCase());
assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(csvFormat.isCommentMarkerSet());
assertNull(csvFormat.getCommentMarker());
assertFalse(csvFormat.isNullStringSet());
assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(csvFormat.isEscapeCharacterSet());
assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(csvFormat.getNullString());
assertNull(csvFormat.getQuoteMode());
assertTrue(csvFormat.getIgnoreEmptyLines());
assertEquals('\"', (char) csvFormat.getQuoteCharacter());
assertFalse(csvFormatTwo.isNullStringSet());
assertFalse(csvFormatTwo.getAllowMissingColumnNames());
assertEquals('\"', (char) csvFormatTwo.getQuoteCharacter());
assertNull(csvFormatTwo.getNullString());
assertEquals(',', csvFormatTwo.getDelimiter());
assertFalse(csvFormatTwo.getTrailingDelimiter());
assertTrue(csvFormatTwo.isCommentMarkerSet());
assertFalse(csvFormatTwo.getIgnoreHeaderCase());
assertFalse(csvFormatTwo.getTrim());
assertNull(csvFormatTwo.getEscapeCharacter());
assertTrue(csvFormatTwo.isQuoteCharacterSet());
assertFalse(csvFormatTwo.getIgnoreSurroundingSpaces());
assertEquals("\r\n", csvFormatTwo.getRecordSeparator());
assertNull(csvFormatTwo.getQuoteMode());
assertEquals('n', (char) csvFormatTwo.getCommentMarker());
assertFalse(csvFormatTwo.getSkipHeaderRecord());
assertFalse(csvFormatTwo.isEscapeCharacterSet());
assertTrue(csvFormatTwo.getIgnoreEmptyLines());
assertNotSame(csvFormat, csvFormatTwo);
assertNotSame(csvFormatTwo, csvFormat);
Assertions.assertNotEquals(csvFormatTwo, csvFormat);
Assertions.assertNotEquals(csvFormat, csvFormatTwo);
assertNull(csvFormat.getEscapeCharacter());
assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(csvFormat.getTrim());
assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(csvFormat.getTrailingDelimiter());
assertEquals(',', csvFormat.getDelimiter());
assertFalse(csvFormat.getIgnoreHeaderCase());
assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(csvFormat.isCommentMarkerSet());
assertNull(csvFormat.getCommentMarker());
assertFalse(csvFormat.isNullStringSet());
assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(csvFormat.isEscapeCharacterSet());
assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(csvFormat.getNullString());
assertNull(csvFormat.getQuoteMode());
assertTrue(csvFormat.getIgnoreEmptyLines());
assertEquals('\"', (char) csvFormat.getQuoteCharacter());
assertFalse(csvFormatTwo.isNullStringSet());
assertFalse(csvFormatTwo.getAllowMissingColumnNames());
assertEquals('\"', (char) csvFormatTwo.getQuoteCharacter());
assertNull(csvFormatTwo.getNullString());
assertEquals(',', csvFormatTwo.getDelimiter());
assertFalse(csvFormatTwo.getTrailingDelimiter());
assertTrue(csvFormatTwo.isCommentMarkerSet());
assertFalse(csvFormatTwo.getIgnoreHeaderCase());
assertFalse(csvFormatTwo.getTrim());
assertNull(csvFormatTwo.getEscapeCharacter());
assertTrue(csvFormatTwo.isQuoteCharacterSet());
assertFalse(csvFormatTwo.getIgnoreSurroundingSpaces());
assertEquals("\r\n", csvFormatTwo.getRecordSeparator());
assertNull(csvFormatTwo.getQuoteMode());
assertEquals('n', (char) csvFormatTwo.getCommentMarker());
assertFalse(csvFormatTwo.getSkipHeaderRecord());
assertFalse(csvFormatTwo.isEscapeCharacterSet());
assertTrue(csvFormatTwo.getIgnoreEmptyLines());
assertNotSame(csvFormat, csvFormatTwo);
assertNotSame(csvFormatTwo, csvFormat);
Assertions.assertNotEquals(csvFormat, csvFormatTwo);
Assertions.assertNotEquals(csvFormatTwo, csvFormat);
Assertions.assertNotEquals(csvFormatTwo, csvFormat);
Assertions.assertNotEquals(csvFormat, csvFormatTwo);
assertEquals("Delimiter=<,> QuoteChar=<\"> CommentStart=<n> " + "RecordSeparator=<\r\n> EmptyLines:ignored SkipHeaderRecord:false", csvFormatTwo.toString());
} | @Test
public void testToStringAndWithCommentMarkerTakingCharacter() {
final CSVFormat.Predefined csvFormat_Predefined = CSVFormat.Predefined.Default;
final CSVFormat csvFormat = csvFormat_Predefined.getFormat();
assertNull(csvFormat.getEscapeCharacter());
assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(csvFormat.getTrim());
assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(csvFormat.getTrailingDelimiter());
assertEquals(',', csvFormat.getDelimiter());
assertFalse(csvFormat.getIgnoreHeaderCase());
assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(csvFormat.isCommentMarkerSet());
assertNull(csvFormat.getCommentMarker());
assertFalse(csvFormat.isNullStringSet());
assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(csvFormat.isEscapeCharacterSet());
assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(csvFormat.getNullString());
assertNull(csvFormat.getQuoteMode());
assertTrue(csvFormat.getIgnoreEmptyLines());
assertEquals('\"', (char) csvFormat.getQuoteCharacter());
final Character character = Character.valueOf('n');
final CSVFormat csvFormatTwo = csvFormat.withCommentMarker(character);
assertNull(csvFormat.getEscapeCharacter());
assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(csvFormat.getTrim());
assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(csvFormat.getTrailingDelimiter());
assertEquals(',', csvFormat.getDelimiter());
assertFalse(csvFormat.getIgnoreHeaderCase());
assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(csvFormat.isCommentMarkerSet());
assertNull(csvFormat.getCommentMarker());
assertFalse(csvFormat.isNullStringSet());
assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(csvFormat.isEscapeCharacterSet());
assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(csvFormat.getNullString());
assertNull(csvFormat.getQuoteMode());
assertTrue(csvFormat.getIgnoreEmptyLines());
assertEquals('\"', (char) csvFormat.getQuoteCharacter());
assertFalse(csvFormatTwo.isNullStringSet());
assertFalse(csvFormatTwo.getAllowMissingColumnNames());
assertEquals('\"', (char) csvFormatTwo.getQuoteCharacter());
assertNull(csvFormatTwo.getNullString());
assertEquals(',', csvFormatTwo.getDelimiter());
assertFalse(csvFormatTwo.getTrailingDelimiter());
assertTrue(csvFormatTwo.isCommentMarkerSet());
assertFalse(csvFormatTwo.getIgnoreHeaderCase());
assertFalse(csvFormatTwo.getTrim());
assertNull(csvFormatTwo.getEscapeCharacter());
assertTrue(csvFormatTwo.isQuoteCharacterSet());
assertFalse(csvFormatTwo.getIgnoreSurroundingSpaces());
assertEquals("\r\n", csvFormatTwo.getRecordSeparator());
assertNull(csvFormatTwo.getQuoteMode());
assertEquals('n', (char) csvFormatTwo.getCommentMarker());
assertFalse(csvFormatTwo.getSkipHeaderRecord());
assertFalse(csvFormatTwo.isEscapeCharacterSet());
assertTrue(csvFormatTwo.getIgnoreEmptyLines());
assertNotSame(csvFormat, csvFormatTwo);
assertNotSame(csvFormatTwo, csvFormat);
<DeepExtract>
Assertions.assertNotEquals(csvFormatTwo, csvFormat);
Assertions.assertNotEquals(csvFormat, csvFormatTwo);
</DeepExtract>
assertNull(csvFormat.getEscapeCharacter());
assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(csvFormat.getTrim());
assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(csvFormat.getTrailingDelimiter());
assertEquals(',', csvFormat.getDelimiter());
assertFalse(csvFormat.getIgnoreHeaderCase());
assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(csvFormat.isCommentMarkerSet());
assertNull(csvFormat.getCommentMarker());
assertFalse(csvFormat.isNullStringSet());
assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(csvFormat.isEscapeCharacterSet());
assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(csvFormat.getNullString());
assertNull(csvFormat.getQuoteMode());
assertTrue(csvFormat.getIgnoreEmptyLines());
assertEquals('\"', (char) csvFormat.getQuoteCharacter());
assertFalse(csvFormatTwo.isNullStringSet());
assertFalse(csvFormatTwo.getAllowMissingColumnNames());
assertEquals('\"', (char) csvFormatTwo.getQuoteCharacter());
assertNull(csvFormatTwo.getNullString());
assertEquals(',', csvFormatTwo.getDelimiter());
assertFalse(csvFormatTwo.getTrailingDelimiter());
assertTrue(csvFormatTwo.isCommentMarkerSet());
assertFalse(csvFormatTwo.getIgnoreHeaderCase());
assertFalse(csvFormatTwo.getTrim());
assertNull(csvFormatTwo.getEscapeCharacter());
assertTrue(csvFormatTwo.isQuoteCharacterSet());
assertFalse(csvFormatTwo.getIgnoreSurroundingSpaces());
assertEquals("\r\n", csvFormatTwo.getRecordSeparator());
assertNull(csvFormatTwo.getQuoteMode());
assertEquals('n', (char) csvFormatTwo.getCommentMarker());
assertFalse(csvFormatTwo.getSkipHeaderRecord());
assertFalse(csvFormatTwo.isEscapeCharacterSet());
assertTrue(csvFormatTwo.getIgnoreEmptyLines());
assertNotSame(csvFormat, csvFormatTwo);
assertNotSame(csvFormatTwo, csvFormat);
Assertions.assertNotEquals(csvFormat, csvFormatTwo);
Assertions.assertNotEquals(csvFormatTwo, csvFormat);
<DeepExtract>
Assertions.assertNotEquals(csvFormatTwo, csvFormat);
Assertions.assertNotEquals(csvFormat, csvFormatTwo);
</DeepExtract>
assertEquals("Delimiter=<,> QuoteChar=<\"> CommentStart=<n> " + "RecordSeparator=<\r\n> EmptyLines:ignored SkipHeaderRecord:false", csvFormatTwo.toString());
} | commons-csv | positive | 3,447 |
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
this.mCurrentTab = position;
this.mCurrentPositionOffset = positionOffset;
if (mTabCount <= 0) {
return;
}
int offset = (int) (mCurrentPositionOffset * mTabsContainer.getChildAt(mCurrentTab).getWidth());
int newScrollX = mTabsContainer.getChildAt(mCurrentTab).getLeft() + offset;
if (mCurrentTab > 0 || offset > 0) {
newScrollX -= getWidth() / 2 - getPaddingLeft();
calcIndicatorRect();
newScrollX += ((mTabRect.right - mTabRect.left) / 2);
}
if (newScrollX != mLastScrollX) {
mLastScrollX = newScrollX;
scrollTo(newScrollX, 0);
}
invalidate();
} | @Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
this.mCurrentTab = position;
this.mCurrentPositionOffset = positionOffset;
<DeepExtract>
if (mTabCount <= 0) {
return;
}
int offset = (int) (mCurrentPositionOffset * mTabsContainer.getChildAt(mCurrentTab).getWidth());
int newScrollX = mTabsContainer.getChildAt(mCurrentTab).getLeft() + offset;
if (mCurrentTab > 0 || offset > 0) {
newScrollX -= getWidth() / 2 - getPaddingLeft();
calcIndicatorRect();
newScrollX += ((mTabRect.right - mTabRect.left) / 2);
}
if (newScrollX != mLastScrollX) {
mLastScrollX = newScrollX;
scrollTo(newScrollX, 0);
}
</DeepExtract>
invalidate();
} | MDWechat | positive | 3,451 |
public static void main(String[] args) {
LFUCache cache = new LFUCache(2);
if (!values.containsKey(1)) {
Node node = new Node(1, 1);
if (values.size() == MAX_CAPACITY) {
int lowestCount = frequencies.firstKey();
Node nodeTodelete = frequencies.get(lowestCount).head();
frequencies.get(lowestCount).remove(nodeTodelete);
int keyToDelete = nodeTodelete.key();
removeIfListEmpty(lowestCount);
values.remove(keyToDelete);
counts.remove(keyToDelete);
}
values.put(1, node);
counts.put(1, 1);
frequencies.computeIfAbsent(1, k -> new DoubleLinkedList()).add(node);
}
if (!values.containsKey(2)) {
Node node = new Node(2, 2);
if (values.size() == MAX_CAPACITY) {
int lowestCount = frequencies.firstKey();
Node nodeTodelete = frequencies.get(lowestCount).head();
frequencies.get(lowestCount).remove(nodeTodelete);
int keyToDelete = nodeTodelete.key();
removeIfListEmpty(lowestCount);
values.remove(keyToDelete);
counts.remove(keyToDelete);
}
values.put(2, node);
counts.put(2, 1);
frequencies.computeIfAbsent(1, k -> new DoubleLinkedList()).add(node);
}
System.out.println(cache.get(1));
if (!values.containsKey(3)) {
Node node = new Node(3, 3);
if (values.size() == MAX_CAPACITY) {
int lowestCount = frequencies.firstKey();
Node nodeTodelete = frequencies.get(lowestCount).head();
frequencies.get(lowestCount).remove(nodeTodelete);
int keyToDelete = nodeTodelete.key();
removeIfListEmpty(lowestCount);
values.remove(keyToDelete);
counts.remove(keyToDelete);
}
values.put(3, node);
counts.put(3, 1);
frequencies.computeIfAbsent(1, k -> new DoubleLinkedList()).add(node);
}
System.out.println(cache.get(2));
System.out.println(cache.get(3));
if (!values.containsKey(4)) {
Node node = new Node(4, 4);
if (values.size() == MAX_CAPACITY) {
int lowestCount = frequencies.firstKey();
Node nodeTodelete = frequencies.get(lowestCount).head();
frequencies.get(lowestCount).remove(nodeTodelete);
int keyToDelete = nodeTodelete.key();
removeIfListEmpty(lowestCount);
values.remove(keyToDelete);
counts.remove(keyToDelete);
}
values.put(4, node);
counts.put(4, 1);
frequencies.computeIfAbsent(1, k -> new DoubleLinkedList()).add(node);
}
System.out.println(cache.get(1));
System.out.println(cache.get(3));
System.out.println(cache.get(4));
} | public static void main(String[] args) {
LFUCache cache = new LFUCache(2);
if (!values.containsKey(1)) {
Node node = new Node(1, 1);
if (values.size() == MAX_CAPACITY) {
int lowestCount = frequencies.firstKey();
Node nodeTodelete = frequencies.get(lowestCount).head();
frequencies.get(lowestCount).remove(nodeTodelete);
int keyToDelete = nodeTodelete.key();
removeIfListEmpty(lowestCount);
values.remove(keyToDelete);
counts.remove(keyToDelete);
}
values.put(1, node);
counts.put(1, 1);
frequencies.computeIfAbsent(1, k -> new DoubleLinkedList()).add(node);
}
if (!values.containsKey(2)) {
Node node = new Node(2, 2);
if (values.size() == MAX_CAPACITY) {
int lowestCount = frequencies.firstKey();
Node nodeTodelete = frequencies.get(lowestCount).head();
frequencies.get(lowestCount).remove(nodeTodelete);
int keyToDelete = nodeTodelete.key();
removeIfListEmpty(lowestCount);
values.remove(keyToDelete);
counts.remove(keyToDelete);
}
values.put(2, node);
counts.put(2, 1);
frequencies.computeIfAbsent(1, k -> new DoubleLinkedList()).add(node);
}
System.out.println(cache.get(1));
if (!values.containsKey(3)) {
Node node = new Node(3, 3);
if (values.size() == MAX_CAPACITY) {
int lowestCount = frequencies.firstKey();
Node nodeTodelete = frequencies.get(lowestCount).head();
frequencies.get(lowestCount).remove(nodeTodelete);
int keyToDelete = nodeTodelete.key();
removeIfListEmpty(lowestCount);
values.remove(keyToDelete);
counts.remove(keyToDelete);
}
values.put(3, node);
counts.put(3, 1);
frequencies.computeIfAbsent(1, k -> new DoubleLinkedList()).add(node);
}
System.out.println(cache.get(2));
System.out.println(cache.get(3));
<DeepExtract>
if (!values.containsKey(4)) {
Node node = new Node(4, 4);
if (values.size() == MAX_CAPACITY) {
int lowestCount = frequencies.firstKey();
Node nodeTodelete = frequencies.get(lowestCount).head();
frequencies.get(lowestCount).remove(nodeTodelete);
int keyToDelete = nodeTodelete.key();
removeIfListEmpty(lowestCount);
values.remove(keyToDelete);
counts.remove(keyToDelete);
}
values.put(4, node);
counts.put(4, 1);
frequencies.computeIfAbsent(1, k -> new DoubleLinkedList()).add(node);
}
</DeepExtract>
System.out.println(cache.get(1));
System.out.println(cache.get(3));
System.out.println(cache.get(4));
} | Coding_Practice | positive | 3,452 |
private static FormValidation checkSoapUrl(String collabNetUrl) {
String soapURL = collabNetUrl + CollabNetApp.SOAP_SERVICE + "CollabNet?wsdl";
CloseableHttpClient httpClient = null;
try {
httpClient = getHttpClient();
HttpGet httpGet = new HttpGet(soapURL);
CloseableHttpResponse r = httpClient.execute(httpGet);
try {
if (r.getStatusLine().getStatusCode() == 200) {
return FormValidation.ok();
} else {
return FormValidation.error(soapURL + " reported HTTP status code " + r.getStatusLine().getStatusCode() + " with resaon " + r.getStatusLine().getReasonPhrase());
}
} finally {
if (r != null) {
r.close();
}
}
} catch (Exception e) {
return FormValidation.error(e, "Failed to connect to " + soapURL + " : " + e.getMessage());
} finally {
if (httpClient != null) {
try {
httpClient.close();
} catch (IOException e) {
}
}
}
} | private static FormValidation checkSoapUrl(String collabNetUrl) {
String soapURL = collabNetUrl + CollabNetApp.SOAP_SERVICE + "CollabNet?wsdl";
<DeepExtract>
CloseableHttpClient httpClient = null;
try {
httpClient = getHttpClient();
HttpGet httpGet = new HttpGet(soapURL);
CloseableHttpResponse r = httpClient.execute(httpGet);
try {
if (r.getStatusLine().getStatusCode() == 200) {
return FormValidation.ok();
} else {
return FormValidation.error(soapURL + " reported HTTP status code " + r.getStatusLine().getStatusCode() + " with resaon " + r.getStatusLine().getReasonPhrase());
}
} finally {
if (r != null) {
r.close();
}
}
} catch (Exception e) {
return FormValidation.error(e, "Failed to connect to " + soapURL + " : " + e.getMessage());
} finally {
if (httpClient != null) {
try {
httpClient.close();
} catch (IOException e) {
}
}
}
</DeepExtract>
} | collabnet-plugin | positive | 3,453 |
@Restricted(NoExternalUse.class)
public void updateByXml(Source source) throws IOException {
getACL().checkPermission(CredentialsProvider.MANAGE_DOMAINS);
final StringWriter out = new StringWriter();
try {
XMLUtils.safeTransform(source, new StreamResult(out));
out.close();
} catch (TransformerException | SAXException e) {
throw new IOException("Failed to parse credential", e);
}
Domain replacement = (Domain) Items.XSTREAM.unmarshal(new XppDriver().createReader(new StringReader(out.toString())));
getStore().updateDomain(domain, replacement);
} | @Restricted(NoExternalUse.class)
public void updateByXml(Source source) throws IOException {
<DeepExtract>
getACL().checkPermission(CredentialsProvider.MANAGE_DOMAINS);
</DeepExtract>
final StringWriter out = new StringWriter();
try {
XMLUtils.safeTransform(source, new StreamResult(out));
out.close();
} catch (TransformerException | SAXException e) {
throw new IOException("Failed to parse credential", e);
}
Domain replacement = (Domain) Items.XSTREAM.unmarshal(new XppDriver().createReader(new StringReader(out.toString())));
getStore().updateDomain(domain, replacement);
} | credentials-plugin | positive | 3,454 |
public boolean isValidBST(TreeNode root) {
if (root == null) {
return true;
}
if (null != null && root.val <= null)
return false;
if (null != null && root.val >= null)
return false;
if (!helper(root.left, null, root.val))
return false;
if (!helper(root.right, root.val, null))
return false;
return true;
} | public boolean isValidBST(TreeNode root) {
<DeepExtract>
if (root == null) {
return true;
}
if (null != null && root.val <= null)
return false;
if (null != null && root.val >= null)
return false;
if (!helper(root.left, null, root.val))
return false;
if (!helper(root.right, root.val, null))
return false;
return true;
</DeepExtract>
} | learning-note | positive | 3,455 |
protected synchronized void add(int note, int length) throws InvalidMidiDataException {
assert Thread.holdsLock(this);
ShortMessage message = new ShortMessage();
message.setMessage(ShortMessage.NOTE_ON, 0, note, volume());
track.add(new MidiEvent(message, pos));
pos += length;
assert Thread.holdsLock(this);
ShortMessage message = new ShortMessage();
message.setMessage(ShortMessage.NOTE_OFF, 0, note, 0);
track.add(new MidiEvent(message, pos));
} | protected synchronized void add(int note, int length) throws InvalidMidiDataException {
assert Thread.holdsLock(this);
ShortMessage message = new ShortMessage();
message.setMessage(ShortMessage.NOTE_ON, 0, note, volume());
track.add(new MidiEvent(message, pos));
pos += length;
<DeepExtract>
assert Thread.holdsLock(this);
ShortMessage message = new ShortMessage();
message.setMessage(ShortMessage.NOTE_OFF, 0, note, 0);
track.add(new MidiEvent(message, pos));
</DeepExtract>
} | javaspecialists | positive | 3,456 |
protected <T> Future<T> submitTask2(java.util.function.BiConsumer<Consumer<K, V>, Promise<T>> task) {
Promise<T> promise = Promise.promise();
if (this.closed.compareAndSet(true, false)) {
this.start(task, promise);
} else {
this.submitTaskWhenStarted(task, promise);
}
return promise.future();
} | protected <T> Future<T> submitTask2(java.util.function.BiConsumer<Consumer<K, V>, Promise<T>> task) {
Promise<T> promise = Promise.promise();
<DeepExtract>
if (this.closed.compareAndSet(true, false)) {
this.start(task, promise);
} else {
this.submitTaskWhenStarted(task, promise);
}
</DeepExtract>
return promise.future();
} | vertx-kafka-client | positive | 3,457 |
public void onFooterRefreshComplete() {
LayoutParams params = (LayoutParams) mHeaderView.getLayoutParams();
params.topMargin = -mHeaderViewHeight;
mHeaderView.setLayoutParams(params);
invalidate();
mFooterImageView.setVisibility(View.VISIBLE);
mFooterImageView.setImageResource(R.drawable.ic_pulltorefresh_arrow_up);
mFooterTextView.setText(R.string.pull_to_refresh_footer_pull_label);
mFooterProgressBar.setVisibility(View.GONE);
mFooterState = PULL_TO_REFRESH;
} | public void onFooterRefreshComplete() {
<DeepExtract>
LayoutParams params = (LayoutParams) mHeaderView.getLayoutParams();
params.topMargin = -mHeaderViewHeight;
mHeaderView.setLayoutParams(params);
invalidate();
</DeepExtract>
mFooterImageView.setVisibility(View.VISIBLE);
mFooterImageView.setImageResource(R.drawable.ic_pulltorefresh_arrow_up);
mFooterTextView.setText(R.string.pull_to_refresh_footer_pull_label);
mFooterProgressBar.setVisibility(View.GONE);
mFooterState = PULL_TO_REFRESH;
} | AppMarket | positive | 3,458 |
public static ChildProcess startShellCommand(String cmd) {
String[] cmdarray = new String[3];
cmdarray[0] = "sh";
cmdarray[1] = "-c";
cmdarray[2] = cmd;
return new ChildProcess(cmdarray, null);
} | public static ChildProcess startShellCommand(String cmd) {
String[] cmdarray = new String[3];
cmdarray[0] = "sh";
cmdarray[1] = "-c";
cmdarray[2] = cmd;
<DeepExtract>
return new ChildProcess(cmdarray, null);
</DeepExtract>
} | android-kernel-tweaker | positive | 3,459 |
public boolean chooseFont() {
final FontChooserPopup popup = new FontChooserPopup(this);
popup.createContent(colorChooserFactory);
this.fontData = fontData;
this.fontColor = fontColor;
return popup.open(() -> {
fontData = popup.getFontData();
fontColor = popup.getFontColor();
});
} | public boolean chooseFont() {
final FontChooserPopup popup = new FontChooserPopup(this);
popup.createContent(colorChooserFactory);
this.fontData = fontData;
<DeepExtract>
this.fontColor = fontColor;
</DeepExtract>
return popup.open(() -> {
fontData = popup.getFontData();
fontColor = popup.getFontColor();
});
} | greip | positive | 3,460 |
@Test
public void test96() {
add("010010001", "select 1", "select @sel()", "select @sel()");
for (String text : "selection_replace !") {
assertNotNull(mEditor.commitFinalResult(text));
}
assertThat(mEditor.getText().toString(), is("0!0010001"));
} | @Test
public void test96() {
add("010010001", "select 1", "select @sel()", "select @sel()");
for (String text : "selection_replace !") {
assertNotNull(mEditor.commitFinalResult(text));
}
<DeepExtract>
assertThat(mEditor.getText().toString(), is("0!0010001"));
</DeepExtract>
} | speechutils | positive | 3,461 |
public void setNormalAndU(Vec3f normal, Vec3f uAxis) {
Vec3f vAxis = normal.cross(uAxis);
this.normal.set(normal);
this.origin.set(origin);
this.uAxis.set(uAxis);
this.vAxis.set(vAxis);
this.normal.normalize();
this.uAxis.normalize();
this.vAxis.normalize();
} | public void setNormalAndU(Vec3f normal, Vec3f uAxis) {
Vec3f vAxis = normal.cross(uAxis);
<DeepExtract>
this.normal.set(normal);
this.origin.set(origin);
this.uAxis.set(uAxis);
this.vAxis.set(vAxis);
this.normal.normalize();
this.uAxis.normalize();
this.vAxis.normalize();
</DeepExtract>
} | jogl-utils | positive | 3,462 |
public static String downloadStrFromS3(AmazonS3Client s3, String s3bucket, String s3key, boolean gzip) throws IOException {
byte[] bytes;
InputStream is = downloadStreamFromS3(s3, s3bucket, s3key);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
GZIPInputStream gis = null;
try {
if (gzip) {
gis = new GZIPInputStream(is);
IOUtil.copy(gis, bos);
} else {
IOUtil.copy(is, bos);
}
bytes = bos.toByteArray();
} finally {
IOUtil.close(gis);
IOUtil.close(bos);
IOUtil.close(is);
}
return new String(bytes, "UTF-8");
} | public static String downloadStrFromS3(AmazonS3Client s3, String s3bucket, String s3key, boolean gzip) throws IOException {
<DeepExtract>
byte[] bytes;
InputStream is = downloadStreamFromS3(s3, s3bucket, s3key);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
GZIPInputStream gis = null;
try {
if (gzip) {
gis = new GZIPInputStream(is);
IOUtil.copy(gis, bos);
} else {
IOUtil.copy(is, bos);
}
bytes = bos.toByteArray();
} finally {
IOUtil.close(gis);
IOUtil.close(bos);
IOUtil.close(is);
}
</DeepExtract>
return new String(bytes, "UTF-8");
} | jsoda | positive | 3,464 |
@Override
public boolean onMyLocationButtonClick() {
googleMap.clear();
if (googleMap.getMyLocation().getLatitude() != 0 || googleMap.getMyLocation().getLongitude() != 0) {
setFusedLatitude(googleMap.getMyLocation().getLatitude());
setFusedLongitude(googleMap.getMyLocation().getLongitude());
stopFusedLocation();
CameraPosition oldPos = googleMap.getCameraPosition();
CameraPosition pos = CameraPosition.builder(oldPos).target(getPosition()).zoom(zoom).build();
googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(pos));
Marker marker = googleMap.addMarker(new MarkerOptions().position(getPosition()).title("My Location").icon(BitmapDescriptorFactory.fromResource(R.drawable.placeholder)));
AsyncTask placesAsync = new Places().execute(getPosition());
}
return true;
} | @Override
public boolean onMyLocationButtonClick() {
googleMap.clear();
<DeepExtract>
if (googleMap.getMyLocation().getLatitude() != 0 || googleMap.getMyLocation().getLongitude() != 0) {
setFusedLatitude(googleMap.getMyLocation().getLatitude());
setFusedLongitude(googleMap.getMyLocation().getLongitude());
stopFusedLocation();
CameraPosition oldPos = googleMap.getCameraPosition();
CameraPosition pos = CameraPosition.builder(oldPos).target(getPosition()).zoom(zoom).build();
googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(pos));
Marker marker = googleMap.addMarker(new MarkerOptions().position(getPosition()).title("My Location").icon(BitmapDescriptorFactory.fromResource(R.drawable.placeholder)));
AsyncTask placesAsync = new Places().execute(getPosition());
}
</DeepExtract>
return true;
} | MuslimMateAndroid | positive | 3,466 |
@Override
public DbModel findDbModelFirst(SqlInfo sqlInfo) throws DbException {
Cursor cursor;
try {
cursor = database.rawQuery(sqlInfo.getSql(), sqlInfo.getBindArgsAsStrArray());
} catch (Throwable e) {
throw new DbException(e);
}
if (cursor != null) {
try {
if (cursor.moveToNext()) {
return CursorUtils.getDbModel(cursor);
}
} catch (Throwable e) {
throw new DbException(e);
} finally {
IOUtil.closeQuietly(cursor);
}
}
return null;
} | @Override
public DbModel findDbModelFirst(SqlInfo sqlInfo) throws DbException {
<DeepExtract>
Cursor cursor;
try {
cursor = database.rawQuery(sqlInfo.getSql(), sqlInfo.getBindArgsAsStrArray());
} catch (Throwable e) {
throw new DbException(e);
}
</DeepExtract>
if (cursor != null) {
try {
if (cursor.moveToNext()) {
return CursorUtils.getDbModel(cursor);
}
} catch (Throwable e) {
throw new DbException(e);
} finally {
IOUtil.closeQuietly(cursor);
}
}
return null;
} | xUtils3 | positive | 3,467 |
public static void main(String[] args) {
createConn = new CreateConnection();
String qry = "select recipe_num, name, description from recipes";
try (Connection conn = createConn.getConnection();
Statement stmt = conn.createStatement()) {
ResultSet rs = stmt.executeQuery(qry);
while (rs.next()) {
}
} catch (SQLException e) {
e.printStackTrace();
}
} | public static void main(String[] args) {
createConn = new CreateConnection();
<DeepExtract>
String qry = "select recipe_num, name, description from recipes";
try (Connection conn = createConn.getConnection();
Statement stmt = conn.createStatement()) {
ResultSet rs = stmt.executeQuery(qry);
while (rs.next()) {
}
} catch (SQLException e) {
e.printStackTrace();
}
</DeepExtract>
} | java-8-recipes | positive | 3,468 |
public static void drawBoundingBox(AxisAlignedBB bb, double width, GSColor color, int alpha) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
GlStateManager.glLineWidth((float) width);
color.glColor();
bufferbuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
tessellator.draw();
} | public static void drawBoundingBox(AxisAlignedBB bb, double width, GSColor color, int alpha) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
GlStateManager.glLineWidth((float) width);
color.glColor();
bufferbuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
<DeepExtract>
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
</DeepExtract>
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.maxZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.minY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
bufferbuilder.pos(bb.maxX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
<DeepExtract>
bufferbuilder.pos(bb.minX - mc.getRenderManager().viewerPosX, bb.maxY - mc.getRenderManager().viewerPosY, bb.minZ - mc.getRenderManager().viewerPosZ).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
</DeepExtract>
tessellator.draw();
} | gamesense-client | positive | 3,469 |
public static <K, V> Map<K, V> convertJsonToMap(InputStream json, JsonSerializationStrategy jsonSerializationStrategy, TypeReference<Map<K, V>> typeReference) {
if (json == null) {
return new HashMap<>();
}
try {
return getObjectMapper(jsonSerializationStrategy).readValue(json, typeReference);
} catch (IOException e) {
throw new ParsingException(e, Messages.CANNOT_CONVERT_JSON_STREAM_TO_MAP, e.getMessage(), json);
}
} | public static <K, V> Map<K, V> convertJsonToMap(InputStream json, JsonSerializationStrategy jsonSerializationStrategy, TypeReference<Map<K, V>> typeReference) {
<DeepExtract>
if (json == null) {
return new HashMap<>();
}
try {
return getObjectMapper(jsonSerializationStrategy).readValue(json, typeReference);
} catch (IOException e) {
throw new ParsingException(e, Messages.CANNOT_CONVERT_JSON_STREAM_TO_MAP, e.getMessage(), json);
}
</DeepExtract>
} | multiapps | positive | 3,471 |
@Override
public void onCreate(Database db) {
Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
LiveCategoryDao.createTable(db, false);
} | @Override
public void onCreate(Database db) {
Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
<DeepExtract>
LiveCategoryDao.createTable(db, false);
</DeepExtract>
} | KingTV | positive | 3,472 |
public void startBottomLoading() {
mBottomLoading = false;
mKeepOnAppending = false;
} | public void startBottomLoading() {
<DeepExtract>
mBottomLoading = false;
mKeepOnAppending = false;
</DeepExtract>
} | robird-reborn | positive | 3,473 |
@Override
public void setNotBefore(final Date notBefore) {
return null == notBefore ? null : (Date) notBefore.clone();
} | @Override
public void setNotBefore(final Date notBefore) {
<DeepExtract>
return null == notBefore ? null : (Date) notBefore.clone();
</DeepExtract>
} | truelicense | positive | 3,476 |
@SmallTest
public void a_introSingelUtrecht30Seconds() throws InterruptedException {
this.mMapView.getController().setZoom(ZOOM_LEVEL);
Thread.sleep(1 * 1000);
this.mSender.sendSMS("Selecting a previous recorded track");
Thread.sleep(1 * 1000);
this.sendKeys("MENU DPAD_RIGHT");
Thread.sleep(2 * 1000);
this.sendKeys("L");
Thread.sleep(2 * 1000);
this.mSender.sendSMS("The walk around the \"singel\" in Utrecht");
this.sendKeys("DPAD_CENTER");
Thread.sleep(2 * 1000);
Thread.sleep(2 * 1000);
this.mSender.sendSMS("Scrolling about");
this.mMapView.getController().animateTo(new GeoPoint(52095829, 5118599));
Thread.sleep(2 * 1000);
this.mMapView.getController().animateTo(new GeoPoint(52096778, 5125090));
Thread.sleep(2 * 1000);
this.mMapView.getController().animateTo(new GeoPoint(52085117, 5128255));
Thread.sleep(2 * 1000);
this.mMapView.getController().animateTo(new GeoPoint(52081517, 5121646));
Thread.sleep(2 * 1000);
this.mMapView.getController().animateTo(new GeoPoint(52093535, 5116711));
Thread.sleep(2 * 1000);
this.sendKeys("G G");
Thread.sleep(5 * 1000);
} | @SmallTest
public void a_introSingelUtrecht30Seconds() throws InterruptedException {
this.mMapView.getController().setZoom(ZOOM_LEVEL);
Thread.sleep(1 * 1000);
this.mSender.sendSMS("Selecting a previous recorded track");
Thread.sleep(1 * 1000);
this.sendKeys("MENU DPAD_RIGHT");
Thread.sleep(2 * 1000);
this.sendKeys("L");
Thread.sleep(2 * 1000);
this.mSender.sendSMS("The walk around the \"singel\" in Utrecht");
this.sendKeys("DPAD_CENTER");
Thread.sleep(2 * 1000);
Thread.sleep(2 * 1000);
<DeepExtract>
this.mSender.sendSMS("Scrolling about");
</DeepExtract>
this.mMapView.getController().animateTo(new GeoPoint(52095829, 5118599));
Thread.sleep(2 * 1000);
this.mMapView.getController().animateTo(new GeoPoint(52096778, 5125090));
Thread.sleep(2 * 1000);
this.mMapView.getController().animateTo(new GeoPoint(52085117, 5128255));
Thread.sleep(2 * 1000);
this.mMapView.getController().animateTo(new GeoPoint(52081517, 5121646));
Thread.sleep(2 * 1000);
this.mMapView.getController().animateTo(new GeoPoint(52093535, 5116711));
Thread.sleep(2 * 1000);
this.sendKeys("G G");
Thread.sleep(5 * 1000);
} | open-gpstracker | positive | 3,477 |
private void purgeLogs(DataCategory category, long retentionTime) {
String cql1 = "Select * from MetricLog where keyA = ";
String cql2 = " and keyB = ";
String cql3 = " and time < " + retentionTime;
this.batch = new BatchStatement();
for (TSDRCacheEntry entry : this.cache.getAll()) {
if (entry.getDataCategory() == category) {
String cql = cql1 + entry.getMd5ID().getMd5Long1() + cql2 + entry.getMd5ID().getMd5Long2() + cql3;
session.execute(cql);
}
}
if (this.batch.size() > 0) {
this.executeBatch();
this.startBatch();
}
} | private void purgeLogs(DataCategory category, long retentionTime) {
String cql1 = "Select * from MetricLog where keyA = ";
String cql2 = " and keyB = ";
String cql3 = " and time < " + retentionTime;
<DeepExtract>
this.batch = new BatchStatement();
</DeepExtract>
for (TSDRCacheEntry entry : this.cache.getAll()) {
if (entry.getDataCategory() == category) {
String cql = cql1 + entry.getMd5ID().getMd5Long1() + cql2 + entry.getMd5ID().getMd5Long2() + cql3;
session.execute(cql);
}
}
if (this.batch.size() > 0) {
this.executeBatch();
this.startBatch();
}
} | tsdr | positive | 3,478 |
private void stopCameraHardwareHandlerThread() {
sync.lock();
if (cameraHardwareHandlerThread == null)
return;
cameraHardwareHandlerThread.quitSafely();
cameraHardwareHandlerThread.interrupt();
boolean interrupted = false;
while (true) {
try {
cameraHardwareHandlerThread.join();
break;
} catch (InterruptedException e) {
e.printStackTrace();
interrupted = true;
}
}
if (interrupted) {
Thread.currentThread().interrupt();
}
cameraHardwareHandlerThread = null;
cameraHardwareHandler = null;
sync.unlock();
} | private void stopCameraHardwareHandlerThread() {
sync.lock();
if (cameraHardwareHandlerThread == null)
return;
cameraHardwareHandlerThread.quitSafely();
cameraHardwareHandlerThread.interrupt();
<DeepExtract>
boolean interrupted = false;
while (true) {
try {
cameraHardwareHandlerThread.join();
break;
} catch (InterruptedException e) {
e.printStackTrace();
interrupted = true;
}
}
if (interrupted) {
Thread.currentThread().interrupt();
}
</DeepExtract>
cameraHardwareHandlerThread = null;
cameraHardwareHandler = null;
sync.unlock();
} | virtual_robot | positive | 3,479 |
@Override
public TensorOrBuilder getTensorOrBuilder() {
if (dataOneofCase_ == 2) {
return (Tensor) dataOneof_;
}
return DEFAULT_INSTANCE;
} | @Override
public TensorOrBuilder getTensorOrBuilder() {
if (dataOneofCase_ == 2) {
return (Tensor) dataOneof_;
}
<DeepExtract>
return DEFAULT_INSTANCE;
</DeepExtract>
} | dl_inference | positive | 3,480 |
@Deprecated
public int getViewPosition() {
return mPreLayoutPosition == NO_POSITION ? mPosition : mPreLayoutPosition;
} | @Deprecated
public int getViewPosition() {
<DeepExtract>
return mPreLayoutPosition == NO_POSITION ? mPosition : mPreLayoutPosition;
</DeepExtract>
} | SamsungOneUi | positive | 3,481 |
public void testCheckBoxMatchers() {
assertFalse(isChecked().matches(new Spinner(getInstrumentation().getTargetContext())));
assertFalse(isNotChecked().matches(new Spinner(getInstrumentation().getTargetContext())));
CheckBox checkBox = new CheckBox(getInstrumentation().getTargetContext());
assertTrue(isChecked().matches(checkBox));
assertFalse(isNotChecked().matches(checkBox));
assertFalse(isChecked().matches(checkBox));
assertTrue(isNotChecked().matches(checkBox));
RadioButton radioButton = new RadioButton(getInstrumentation().getTargetContext());
assertFalse(isChecked().matches(radioButton));
assertTrue(isNotChecked().matches(radioButton));
assertTrue(isChecked().matches(radioButton));
assertFalse(isNotChecked().matches(radioButton));
CheckedTextView checkedText = new CheckedTextView(getInstrumentation().getTargetContext());
assertFalse(isChecked().matches(checkedText));
assertTrue(isNotChecked().matches(checkedText));
assertTrue(isChecked().matches(checkedText));
assertFalse(isNotChecked().matches(checkedText));
Checkable checkable = new Checkable() {
@Override
public boolean isChecked() {
return true;
}
@Override
public void setChecked(boolean ignored) {
}
@Override
public void toggle() {
}
};
assertFalse(isChecked().matches(checkable));
assertFalse(isNotChecked().matches(checkable));
} | public void testCheckBoxMatchers() {
<DeepExtract>
</DeepExtract>
assertFalse(isChecked().matches(new Spinner(getInstrumentation().getTargetContext())));
<DeepExtract>
</DeepExtract>
assertFalse(isNotChecked().matches(new Spinner(getInstrumentation().getTargetContext())));
<DeepExtract>
</DeepExtract>
CheckBox checkBox = new CheckBox(getInstrumentation().getTargetContext());
<DeepExtract>
</DeepExtract>
assertTrue(isChecked().matches(checkBox));
<DeepExtract>
</DeepExtract>
assertFalse(isNotChecked().matches(checkBox));
<DeepExtract>
</DeepExtract>
assertFalse(isChecked().matches(checkBox));
<DeepExtract>
</DeepExtract>
assertTrue(isNotChecked().matches(checkBox));
<DeepExtract>
</DeepExtract>
RadioButton radioButton = new RadioButton(getInstrumentation().getTargetContext());
<DeepExtract>
</DeepExtract>
assertFalse(isChecked().matches(radioButton));
<DeepExtract>
</DeepExtract>
assertTrue(isNotChecked().matches(radioButton));
<DeepExtract>
</DeepExtract>
assertTrue(isChecked().matches(radioButton));
<DeepExtract>
</DeepExtract>
assertFalse(isNotChecked().matches(radioButton));
<DeepExtract>
</DeepExtract>
CheckedTextView checkedText = new CheckedTextView(getInstrumentation().getTargetContext());
<DeepExtract>
</DeepExtract>
assertFalse(isChecked().matches(checkedText));
<DeepExtract>
</DeepExtract>
assertTrue(isNotChecked().matches(checkedText));
<DeepExtract>
</DeepExtract>
assertTrue(isChecked().matches(checkedText));
<DeepExtract>
</DeepExtract>
assertFalse(isNotChecked().matches(checkedText));
<DeepExtract>
</DeepExtract>
Checkable checkable = new Checkable() {
<DeepExtract>
</DeepExtract>
@Override
<DeepExtract>
</DeepExtract>
public boolean isChecked() {
<DeepExtract>
</DeepExtract>
return true;
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
@Override
<DeepExtract>
</DeepExtract>
public void setChecked(boolean ignored) {
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
@Override
<DeepExtract>
</DeepExtract>
public void toggle() {
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
};
<DeepExtract>
</DeepExtract>
assertFalse(isChecked().matches(checkable));
<DeepExtract>
</DeepExtract>
assertFalse(isNotChecked().matches(checkable));
<DeepExtract>
</DeepExtract>
} | double-espresso | positive | 3,482 |
static Option remote() {
final Option option = new Option("remote", true, "Remote command");
option.setArgs(10);
option.setOptionalArg(true);
option.setValueSeparator(' ');
return option;
} | static Option remote() {
<DeepExtract>
final Option option = new Option("remote", true, "Remote command");
option.setArgs(10);
option.setOptionalArg(true);
option.setValueSeparator(' ');
return option;
</DeepExtract>
} | triada | positive | 3,483 |
private void getConnections(RoutingContext context) {
context.request().bodyHandler(totalBuffer -> {
try {
Scope scope = HttpUtils.getScope(context, server);
if (scope == null) {
return;
}
ConnectionReport report = t -> t.getConnections().getRootReport().apply(HttpUtils.find(server, scope));
StringBuilder response = new StringBuilder();
String connectionsStr = om.writerWithDefaultPrettyPrinter().writeValueAsString(report);
response.append(connectionsStr);
context.request().response().putHeader("content-type", "application/json").setStatusCode(200).end(response.toString());
} catch (Exception e) {
logger.error("Error occurred while processing getConnections request", e);
handleError(new ErrorMessage(e.getMessage(), 400), context);
}
});
} | private void getConnections(RoutingContext context) {
<DeepExtract>
context.request().bodyHandler(totalBuffer -> {
try {
Scope scope = HttpUtils.getScope(context, server);
if (scope == null) {
return;
}
ConnectionReport report = t -> t.getConnections().getRootReport().apply(HttpUtils.find(server, scope));
StringBuilder response = new StringBuilder();
String connectionsStr = om.writerWithDefaultPrettyPrinter().writeValueAsString(report);
response.append(connectionsStr);
context.request().response().putHeader("content-type", "application/json").setStatusCode(200).end(response.toString());
} catch (Exception e) {
logger.error("Error occurred while processing getConnections request", e);
handleError(new ErrorMessage(e.getMessage(), 400), context);
}
});
</DeepExtract>
} | simulacron | positive | 3,484 |
@Before
public void initTest() {
ProductOrder productOrder = new ProductOrder().placedDate(DEFAULT_PLACED_DATE).status(DEFAULT_STATUS).code(DEFAULT_CODE).invoiceId(DEFAULT_INVOICE_ID);
Customer customer = CustomerResourceIntTest.createEntity(em);
em.persist(customer);
em.flush();
productOrder.setCustomer(customer);
return productOrder;
} | @Before
public void initTest() {
<DeepExtract>
ProductOrder productOrder = new ProductOrder().placedDate(DEFAULT_PLACED_DATE).status(DEFAULT_STATUS).code(DEFAULT_CODE).invoiceId(DEFAULT_INVOICE_ID);
Customer customer = CustomerResourceIntTest.createEntity(em);
em.persist(customer);
em.flush();
productOrder.setCustomer(customer);
return productOrder;
</DeepExtract>
} | e-commerce-microservice | positive | 3,485 |
private Expression readSum() {
Expression r;
Expression r = readTerm();
while (true) {
if (readIf("*")) {
r = new Operation(Operation.MULTIPLY, r, readTerm());
} else if (readIf("/")) {
r = new Operation(Operation.DIVIDE, r, readTerm());
} else if (readIf("%")) {
r = new Operation(Operation.MODULUS, r, readTerm());
} else {
r = r;
}
}
while (true) {
if (readIf("+")) {
r = new Operation(Operation.PLUS, r, readFactor());
} else if (readIf("-")) {
r = new Operation(Operation.MINUS, r, readFactor());
} else {
return r;
}
}
} | private Expression readSum() {
<DeepExtract>
Expression r;
Expression r = readTerm();
while (true) {
if (readIf("*")) {
r = new Operation(Operation.MULTIPLY, r, readTerm());
} else if (readIf("/")) {
r = new Operation(Operation.DIVIDE, r, readTerm());
} else if (readIf("%")) {
r = new Operation(Operation.MODULUS, r, readTerm());
} else {
r = r;
}
}
</DeepExtract>
while (true) {
if (readIf("+")) {
r = new Operation(Operation.PLUS, r, readFactor());
} else if (readIf("-")) {
r = new Operation(Operation.MINUS, r, readFactor());
} else {
return r;
}
}
} | Rider | positive | 3,486 |
private Parent createRootPane() {
rootPane = new BorderPane();
rootPane.setPadding(new Insets(5));
samplesSelectionList = new ListView<>();
samplesSelectionList.getSelectionModel().selectedItemProperty().addListener((obs, oldVal, newVal) -> showSample(newVal));
samplesSelectionList.setPrefWidth(150);
BorderPane.setMargin(samplesSelectionList, new Insets(5));
rootPane.setLeft(samplesSelectionList);
samplesMap.put(new DataIndicatorsSample().getName(), new DataIndicatorsSample());
samplesSelectionList.getItems().add(new DataIndicatorsSample().getName());
BorderPane.setMargin(new DataIndicatorsSample(), new Insets(5));
samplesMap.put(new HeatMapChartSample().getName(), new HeatMapChartSample());
samplesSelectionList.getItems().add(new HeatMapChartSample().getName());
BorderPane.setMargin(new HeatMapChartSample(), new Insets(5));
samplesMap.put(new OverlayChartSample().getName(), new OverlayChartSample());
samplesSelectionList.getItems().add(new OverlayChartSample().getName());
BorderPane.setMargin(new OverlayChartSample(), new Insets(5));
samplesMap.put(new LargeDataSetsSample().getName(), new LargeDataSetsSample());
samplesSelectionList.getItems().add(new LargeDataSetsSample().getName());
BorderPane.setMargin(new LargeDataSetsSample(), new Insets(5));
samplesMap.put(new LogarithmicAxisSample().getName(), new LogarithmicAxisSample());
samplesSelectionList.getItems().add(new LogarithmicAxisSample().getName());
BorderPane.setMargin(new LogarithmicAxisSample(), new Insets(5));
return rootPane;
} | private Parent createRootPane() {
rootPane = new BorderPane();
rootPane.setPadding(new Insets(5));
samplesSelectionList = new ListView<>();
samplesSelectionList.getSelectionModel().selectedItemProperty().addListener((obs, oldVal, newVal) -> showSample(newVal));
samplesSelectionList.setPrefWidth(150);
BorderPane.setMargin(samplesSelectionList, new Insets(5));
rootPane.setLeft(samplesSelectionList);
samplesMap.put(new DataIndicatorsSample().getName(), new DataIndicatorsSample());
samplesSelectionList.getItems().add(new DataIndicatorsSample().getName());
BorderPane.setMargin(new DataIndicatorsSample(), new Insets(5));
samplesMap.put(new HeatMapChartSample().getName(), new HeatMapChartSample());
samplesSelectionList.getItems().add(new HeatMapChartSample().getName());
BorderPane.setMargin(new HeatMapChartSample(), new Insets(5));
samplesMap.put(new OverlayChartSample().getName(), new OverlayChartSample());
samplesSelectionList.getItems().add(new OverlayChartSample().getName());
BorderPane.setMargin(new OverlayChartSample(), new Insets(5));
samplesMap.put(new LargeDataSetsSample().getName(), new LargeDataSetsSample());
samplesSelectionList.getItems().add(new LargeDataSetsSample().getName());
BorderPane.setMargin(new LargeDataSetsSample(), new Insets(5));
<DeepExtract>
samplesMap.put(new LogarithmicAxisSample().getName(), new LogarithmicAxisSample());
samplesSelectionList.getItems().add(new LogarithmicAxisSample().getName());
BorderPane.setMargin(new LogarithmicAxisSample(), new Insets(5));
</DeepExtract>
return rootPane;
} | extjfx | positive | 3,487 |
public static void exitApplication() {
AppConfig.getAppConfig().writeConfig();
Global.getCustomGlobal().onExit();
System.exit(0);
} | public static void exitApplication() {
<DeepExtract>
AppConfig.getAppConfig().writeConfig();
</DeepExtract>
Global.getCustomGlobal().onExit();
System.exit(0);
} | sinalgo | positive | 3,488 |
@Override
public void writeInt(int i) {
writeByte(i >> 24, offset++);
writeByte(i >> 16, offset++);
writeByte(i >> 8, offset++);
writeByte(i, offset++);
} | @Override
public void writeInt(int i) {
writeByte(i >> 24, offset++);
writeByte(i >> 16, offset++);
writeByte(i >> 8, offset++);
<DeepExtract>
writeByte(i, offset++);
</DeepExtract>
} | Interface-tool | positive | 3,489 |
public Criteria andDjGreaterThanOrEqualTo(BigDecimal value) {
if (value == null) {
throw new RuntimeException("Value for " + "dj" + " cannot be null");
}
criteria.add(new Criterion("dj >=", value));
return (Criteria) this;
} | public Criteria andDjGreaterThanOrEqualTo(BigDecimal value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "dj" + " cannot be null");
}
criteria.add(new Criterion("dj >=", value));
</DeepExtract>
return (Criteria) this;
} | einvoice | positive | 3,490 |
public static void main(String[] args) {
ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
Validator validator = validatorFactory.getValidator();
ValidateGroup testFirst = new ValidateGroup();
this.userName = "wangji";
for (ConstraintViolation<ValidateGroup> constraintViolation : validator.validate(testFirst)) {
log.info("错误:" + constraintViolation.getMessage());
log.info("å—æ®µï¼š" + constraintViolation.getPropertyPath().toString());
}
} | public static void main(String[] args) {
ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
Validator validator = validatorFactory.getValidator();
ValidateGroup testFirst = new ValidateGroup();
this.userName = "wangji";
<DeepExtract>
for (ConstraintViolation<ValidateGroup> constraintViolation : validator.validate(testFirst)) {
log.info("错误:" + constraintViolation.getMessage());
log.info("å—æ®µï¼š" + constraintViolation.getPropertyPath().toString());
}
</DeepExtract>
} | mybatits-study | positive | 3,491 |
@Override
public void run() {
try {
String argument = filteredCommand.getArgument();
String project = pathToProjectNameConverter.convert(argument);
String username = getUsername();
AuthorizationLevel result = projectAuthorizer.userIsAuthorizedForProject(username, project);
if (result != null) {
sCMCommandHandler.execute(filteredCommand, getInputStream(), getOutputStream(), getErrorStream(), getExitCallback(), getConfiguration(), result);
} else {
getExitCallback().onExit(1);
}
} catch (UnparsableProjectException e) {
log.error("Error running impl", e);
}
} | @Override
public void run() {
<DeepExtract>
try {
String argument = filteredCommand.getArgument();
String project = pathToProjectNameConverter.convert(argument);
String username = getUsername();
AuthorizationLevel result = projectAuthorizer.userIsAuthorizedForProject(username, project);
if (result != null) {
sCMCommandHandler.execute(filteredCommand, getInputStream(), getOutputStream(), getErrorStream(), getExitCallback(), getConfiguration(), result);
} else {
getExitCallback().onExit(1);
}
} catch (UnparsableProjectException e) {
log.error("Error running impl", e);
}
</DeepExtract>
} | scumd | positive | 3,492 |
@Override
public Long sadd4Sets(final String key, final Object... values) {
if (values == null) {
return -1L;
}
byte[][] valBytes = new byte[values.length][];
for (int i = 0; i < values.length; i++) {
valBytes[i] = serializer.serialize(values[i]);
}
return sadd4Sets(getKey(key), valBytes);
} | @Override
public Long sadd4Sets(final String key, final Object... values) {
if (values == null) {
return -1L;
}
byte[][] valBytes = new byte[values.length][];
for (int i = 0; i < values.length; i++) {
valBytes[i] = serializer.serialize(values[i]);
}
<DeepExtract>
return sadd4Sets(getKey(key), valBytes);
</DeepExtract>
} | daisy-framework | positive | 3,494 |
@Override
public void start() {
try {
logger.info("Starting transcode");
notifyObservers(SessionEvent.PRESTART, null);
this.outstream = new TranscodeSessionOutputStream(this);
this.resultHandler = new TranscodeSessionResultHandler(this.watchdog, this);
this.executor.setWorkingDirectory(new File(this.workingDirectoryPath));
this.executor.setStreamHandler(new PumpStreamHandler(this.outstream));
this.executor.setProcessDestroyer(new TranscodeSessionDestroyer(this));
this.executor.setWatchdog(this.watchdog);
this.executor.setExitValue(0);
this.executor.execute(this.cmdLine, this.resultHandler);
} catch (Exception e) {
logger.info("Error starting process " + e.getMessage());
}
} | @Override
public void start() {
<DeepExtract>
try {
logger.info("Starting transcode");
notifyObservers(SessionEvent.PRESTART, null);
this.outstream = new TranscodeSessionOutputStream(this);
this.resultHandler = new TranscodeSessionResultHandler(this.watchdog, this);
this.executor.setWorkingDirectory(new File(this.workingDirectoryPath));
this.executor.setStreamHandler(new PumpStreamHandler(this.outstream));
this.executor.setProcessDestroyer(new TranscodeSessionDestroyer(this));
this.executor.setWatchdog(this.watchdog);
this.executor.setExitValue(0);
this.executor.execute(this.cmdLine, this.resultHandler);
} catch (Exception e) {
logger.info("Error starting process " + e.getMessage());
}
</DeepExtract>
} | poor-man-transcoder | positive | 3,495 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.