before stringlengths 12 3.21M | after stringlengths 41 3.21M | repo stringlengths 1 56 | type stringclasses 1
value | __index_level_0__ int64 0 442k |
|---|---|---|---|---|
public Criteria andXmGreaterThanOrEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "xm" + " cannot be null");
}
criteria.add(new Criterion("xm >=", value));
return (Criteria) this;
} | public Criteria andXmGreaterThanOrEqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "xm" + " cannot be null");
}
criteria.add(new Criterion("xm >=", value));
</DeepExtract>
return (Criteria) this;
} | PetStore | positive | 2,959 |
public Criteria andApprovalEqualTo(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "approval" + " cannot be null");
}
criteria.add(new Criterion("approval =", value));
return (Criteria) this;
} | public Criteria andApprovalEqualTo(Integer value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "approval" + " cannot be null");
}
criteria.add(new Criterion("approval =", value));
</DeepExtract>
return (Criteria) this;
} | webim | positive | 2,960 |
private String getNodeUrlProperty(Environment environment, int index) {
return environment.getProperty(buildNodeAttribute(NODE_URL_ATTRIBUTE, index));
} | private String getNodeUrlProperty(Environment environment, int index) {
<DeepExtract>
return environment.getProperty(buildNodeAttribute(NODE_URL_ATTRIBUTE, index));
</DeepExtract>
} | eventeum | positive | 2,961 |
@NotNull
@Override
public String getText() {
return "Reverse arrow";
} | @NotNull
@Override
public String getText() {
<DeepExtract>
return "Reverse arrow";
</DeepExtract>
} | plantuml4idea | positive | 2,962 |
private File[] getFiles(File dir, String extension) {
ArrayList<File> files = new ArrayList<>();
if (dir.isDirectory()) {
System.out.println(" ~ searching dir: " + dir);
for (File subfile : dir.listFiles()) {
getFilesEmbedded(subfile, files, extension);
}
}
if (dir.isFile() && dir.getPath().toLowerCase().endsWith(extension)) {
files.add(dir);
}
File[] filearray = new File[files.size()];
for (int i = 0; i < files.size(); i++) {
filearray[i] = files.get(i);
}
return filearray;
} | private File[] getFiles(File dir, String extension) {
ArrayList<File> files = new ArrayList<>();
<DeepExtract>
if (dir.isDirectory()) {
System.out.println(" ~ searching dir: " + dir);
for (File subfile : dir.listFiles()) {
getFilesEmbedded(subfile, files, extension);
}
}
if (dir.isFile() && dir.getPath().toLowerCase().endsWith(extension)) {
files.add(dir);
}
</DeepExtract>
File[] filearray = new File[files.size()];
for (int i = 0; i < files.size(); i++) {
filearray[i] = files.get(i);
}
return filearray;
} | Jasmin | positive | 2,963 |
public void changeItems(Collection<E> resources, int start, int before, int count) {
items.clear();
items.addAll(resources);
if (before == 0) {
if (start == 0) {
notifyDataSetChanged();
} else {
notifyItemRangeInserted(start, count);
}
} else {
if (before < count) {
notifyItemRangeInserted(start + before, count - before);
}
if (before > count) {
notifyItemRangeRemoved(start + count, before - count);
}
notifyItemRangeChanged(start, Math.min(before, count));
}
} | public void changeItems(Collection<E> resources, int start, int before, int count) {
items.clear();
items.addAll(resources);
<DeepExtract>
if (before == 0) {
if (start == 0) {
notifyDataSetChanged();
} else {
notifyItemRangeInserted(start, count);
}
} else {
if (before < count) {
notifyItemRangeInserted(start + before, count - before);
}
if (before > count) {
notifyItemRangeRemoved(start + count, before - count);
}
notifyItemRangeChanged(start, Math.min(before, count));
}
</DeepExtract>
} | Pioneer | positive | 2,965 |
@Override
public void onCreate() {
super.onCreate();
App.instance = this;
database = AppDatabase.getInstance(this);
sharedPreferences = getSharedPreferences(Constants.APP_PREFERENCES, MODE_PRIVATE);
File cacheFolder = new File(App.getInstance().getCacheDir(), "media");
int cacheSize = sharedPreferences.getInt(Constants.PREFERENCE_CACHE_SIZE, 250);
LeastRecentlyUsedCacheEvictor cacheEvictor = new LeastRecentlyUsedCacheEvictor(cacheSize * 1000000);
return new SimpleCache(cacheFolder, cacheEvictor);
cachingTasksManager = new CachingTasksManager();
} | @Override
public void onCreate() {
super.onCreate();
App.instance = this;
database = AppDatabase.getInstance(this);
sharedPreferences = getSharedPreferences(Constants.APP_PREFERENCES, MODE_PRIVATE);
<DeepExtract>
File cacheFolder = new File(App.getInstance().getCacheDir(), "media");
int cacheSize = sharedPreferences.getInt(Constants.PREFERENCE_CACHE_SIZE, 250);
LeastRecentlyUsedCacheEvictor cacheEvictor = new LeastRecentlyUsedCacheEvictor(cacheSize * 1000000);
return new SimpleCache(cacheFolder, cacheEvictor);
</DeepExtract>
cachingTasksManager = new CachingTasksManager();
} | youtube-audio-player | positive | 2,967 |
public StateListBuilder<V, T> multiline(V value) {
states.add(android.R.attr.state_multiline);
values.add(value);
return this;
} | public StateListBuilder<V, T> multiline(V value) {
<DeepExtract>
states.add(android.R.attr.state_multiline);
values.add(value);
return this;
</DeepExtract>
} | relight | positive | 2,969 |
private void resetMatrix() {
mSuppMatrix.reset();
ImageView imageView = getImageView();
if (null != imageView) {
checkImageViewScaleType();
imageView.setImageMatrix(getDrawMatrix());
if (null != mMatrixChangeListener) {
RectF displayRect = getDisplayRect(getDrawMatrix());
if (null != displayRect) {
mMatrixChangeListener.onMatrixChanged(displayRect);
}
}
}
final ImageView imageView = getImageView();
if (null == imageView) {
return false;
}
final RectF rect = getDisplayRect(getDrawMatrix());
if (null == rect) {
return false;
}
final float height = rect.height(), width = rect.width();
float deltaX = 0, deltaY = 0;
final int viewHeight = getImageViewHeight(imageView);
if (height <= viewHeight) {
switch(mScaleType) {
case FIT_START:
deltaY = -rect.top;
break;
case FIT_END:
deltaY = viewHeight - height - rect.top;
break;
default:
deltaY = (viewHeight - height) / 2 - rect.top;
break;
}
} else if (rect.top > 0) {
deltaY = -rect.top;
} else if (rect.bottom < viewHeight) {
deltaY = viewHeight - rect.bottom;
}
final int viewWidth = getImageViewWidth(imageView);
if (width <= viewWidth) {
switch(mScaleType) {
case FIT_START:
deltaX = -rect.left;
break;
case FIT_END:
deltaX = viewWidth - width - rect.left;
break;
default:
deltaX = (viewWidth - width) / 2 - rect.left;
break;
}
mScrollEdge = EDGE_BOTH;
} else if (rect.left > 0) {
mScrollEdge = EDGE_LEFT;
deltaX = -rect.left;
} else if (rect.right < viewWidth) {
deltaX = viewWidth - rect.right;
mScrollEdge = EDGE_RIGHT;
} else {
mScrollEdge = EDGE_NONE;
}
mSuppMatrix.postTranslate(deltaX, deltaY);
return true;
} | private void resetMatrix() {
mSuppMatrix.reset();
ImageView imageView = getImageView();
if (null != imageView) {
checkImageViewScaleType();
imageView.setImageMatrix(getDrawMatrix());
if (null != mMatrixChangeListener) {
RectF displayRect = getDisplayRect(getDrawMatrix());
if (null != displayRect) {
mMatrixChangeListener.onMatrixChanged(displayRect);
}
}
}
<DeepExtract>
final ImageView imageView = getImageView();
if (null == imageView) {
return false;
}
final RectF rect = getDisplayRect(getDrawMatrix());
if (null == rect) {
return false;
}
final float height = rect.height(), width = rect.width();
float deltaX = 0, deltaY = 0;
final int viewHeight = getImageViewHeight(imageView);
if (height <= viewHeight) {
switch(mScaleType) {
case FIT_START:
deltaY = -rect.top;
break;
case FIT_END:
deltaY = viewHeight - height - rect.top;
break;
default:
deltaY = (viewHeight - height) / 2 - rect.top;
break;
}
} else if (rect.top > 0) {
deltaY = -rect.top;
} else if (rect.bottom < viewHeight) {
deltaY = viewHeight - rect.bottom;
}
final int viewWidth = getImageViewWidth(imageView);
if (width <= viewWidth) {
switch(mScaleType) {
case FIT_START:
deltaX = -rect.left;
break;
case FIT_END:
deltaX = viewWidth - width - rect.left;
break;
default:
deltaX = (viewWidth - width) / 2 - rect.left;
break;
}
mScrollEdge = EDGE_BOTH;
} else if (rect.left > 0) {
mScrollEdge = EDGE_LEFT;
deltaX = -rect.left;
} else if (rect.right < viewWidth) {
deltaX = viewWidth - rect.right;
mScrollEdge = EDGE_RIGHT;
} else {
mScrollEdge = EDGE_NONE;
}
mSuppMatrix.postTranslate(deltaX, deltaY);
return true;
</DeepExtract>
} | AppleFramework | positive | 2,971 |
@Override
public void onAnimationEnd(@NonNull final Animator animation) {
mActiveDismissCount--;
if (mActiveDismissCount == 0 && getActiveSwipeCount() == 0) {
restoreViewPresentations(mDismissedViews);
notifyCallback(mDismissedPositions);
mDismissedViews.clear();
mDismissedPositions.clear();
}
} | @Override
public void onAnimationEnd(@NonNull final Animator animation) {
mActiveDismissCount--;
<DeepExtract>
if (mActiveDismissCount == 0 && getActiveSwipeCount() == 0) {
restoreViewPresentations(mDismissedViews);
notifyCallback(mDismissedPositions);
mDismissedViews.clear();
mDismissedPositions.clear();
}
</DeepExtract>
} | ListViewAnimations | positive | 2,972 |
private View addViewBelow(View theView, int position) {
int belowPosition = position + 1;
DebugUtil.i("addViewBelow:" + position);
View view = obtainView(belowPosition, mIsScrap);
int edgeOfNewChild = theView.getBottom() + mDividerHeight;
final boolean isSelected = false && shouldShowSelector();
final boolean updateChildSelected = isSelected != view.isSelected();
final int mode = mTouchMode;
final boolean isPressed = mode > TOUCH_MODE_DOWN && mode < TOUCH_MODE_SCROLL && mMotionPosition == belowPosition;
final boolean updateChildPressed = isPressed != view.isPressed();
final boolean needToMeasure = !mIsScrap[0] || updateChildSelected || view.isLayoutRequested();
PLA_AbsListView.LayoutParams p = (PLA_AbsListView.LayoutParams) view.getLayoutParams();
if (p == null) {
p = new PLA_AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0);
}
p.viewType = mAdapter.getItemViewType(belowPosition);
p.scrappedFromPosition = belowPosition;
if ((mIsScrap[0] && !p.forceAdd) || (p.recycledHeaderFooter && p.viewType == PLA_AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER)) {
attachViewToParent(view, true ? -1 : 0, p);
} else {
p.forceAdd = false;
if (p.viewType == PLA_AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {
p.recycledHeaderFooter = true;
}
addViewInLayout(view, true ? -1 : 0, p, true);
}
if (updateChildSelected) {
view.setSelected(isSelected);
}
if (updateChildPressed) {
view.setPressed(isPressed);
}
if (needToMeasure) {
int childWidthSpec = ViewGroup.getChildMeasureSpec(mWidthMeasureSpec, mListPadding.left + mListPadding.right, p.width);
int lpHeight = p.height;
int childHeightSpec;
if (lpHeight > 0) {
childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
} else {
childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
}
onMeasureChild(view, belowPosition, childWidthSpec, childHeightSpec);
} else {
cleanupLayoutState(view);
}
final int w = view.getMeasuredWidth();
final int h = view.getMeasuredHeight();
final int childTop = true ? edgeOfNewChild : edgeOfNewChild - h;
if (needToMeasure) {
final int childRight = mListPadding.left + w;
final int childBottom = childTop + h;
onLayoutChild(view, belowPosition, mListPadding.left, childTop, childRight, childBottom);
} else {
final int offsetLeft = mListPadding.left - view.getLeft();
final int offsetTop = childTop - view.getTop();
onOffsetChild(view, belowPosition, offsetLeft, offsetTop);
}
if (mCachingStarted && !view.isDrawingCacheEnabled()) {
view.setDrawingCacheEnabled(true);
}
return view;
} | private View addViewBelow(View theView, int position) {
int belowPosition = position + 1;
DebugUtil.i("addViewBelow:" + position);
View view = obtainView(belowPosition, mIsScrap);
int edgeOfNewChild = theView.getBottom() + mDividerHeight;
<DeepExtract>
final boolean isSelected = false && shouldShowSelector();
final boolean updateChildSelected = isSelected != view.isSelected();
final int mode = mTouchMode;
final boolean isPressed = mode > TOUCH_MODE_DOWN && mode < TOUCH_MODE_SCROLL && mMotionPosition == belowPosition;
final boolean updateChildPressed = isPressed != view.isPressed();
final boolean needToMeasure = !mIsScrap[0] || updateChildSelected || view.isLayoutRequested();
PLA_AbsListView.LayoutParams p = (PLA_AbsListView.LayoutParams) view.getLayoutParams();
if (p == null) {
p = new PLA_AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0);
}
p.viewType = mAdapter.getItemViewType(belowPosition);
p.scrappedFromPosition = belowPosition;
if ((mIsScrap[0] && !p.forceAdd) || (p.recycledHeaderFooter && p.viewType == PLA_AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER)) {
attachViewToParent(view, true ? -1 : 0, p);
} else {
p.forceAdd = false;
if (p.viewType == PLA_AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {
p.recycledHeaderFooter = true;
}
addViewInLayout(view, true ? -1 : 0, p, true);
}
if (updateChildSelected) {
view.setSelected(isSelected);
}
if (updateChildPressed) {
view.setPressed(isPressed);
}
if (needToMeasure) {
int childWidthSpec = ViewGroup.getChildMeasureSpec(mWidthMeasureSpec, mListPadding.left + mListPadding.right, p.width);
int lpHeight = p.height;
int childHeightSpec;
if (lpHeight > 0) {
childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
} else {
childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
}
onMeasureChild(view, belowPosition, childWidthSpec, childHeightSpec);
} else {
cleanupLayoutState(view);
}
final int w = view.getMeasuredWidth();
final int h = view.getMeasuredHeight();
final int childTop = true ? edgeOfNewChild : edgeOfNewChild - h;
if (needToMeasure) {
final int childRight = mListPadding.left + w;
final int childBottom = childTop + h;
onLayoutChild(view, belowPosition, mListPadding.left, childTop, childRight, childBottom);
} else {
final int offsetLeft = mListPadding.left - view.getLeft();
final int offsetTop = childTop - view.getTop();
onOffsetChild(view, belowPosition, offsetLeft, offsetTop);
}
if (mCachingStarted && !view.isDrawingCacheEnabled()) {
view.setDrawingCacheEnabled(true);
}
</DeepExtract>
return view;
} | MoGuJie | positive | 2,973 |
@Override
protected void doStop() throws Exception {
if (startConsumerCallable != null) {
startConsumerCallable.stop();
}
for (RabbitConsumer consumer : this.consumers) {
try {
consumer.stop();
} catch (TimeoutException e) {
log.warn("Timeout occurred while stopping consumer. This exception is ignored", e);
}
}
this.consumers.clear();
if (conn != null) {
log.debug("Closing connection: {} with timeout: {} ms.", conn, closeTimeout);
conn.close(closeTimeout);
conn = null;
}
if (executor != null) {
if (endpoint != null && endpoint.getCamelContext() != null) {
endpoint.getCamelContext().getExecutorServiceManager().shutdownNow(executor);
} else {
executor.shutdownNow();
}
executor = null;
}
} | @Override
protected void doStop() throws Exception {
<DeepExtract>
if (startConsumerCallable != null) {
startConsumerCallable.stop();
}
for (RabbitConsumer consumer : this.consumers) {
try {
consumer.stop();
} catch (TimeoutException e) {
log.warn("Timeout occurred while stopping consumer. This exception is ignored", e);
}
}
this.consumers.clear();
if (conn != null) {
log.debug("Closing connection: {} with timeout: {} ms.", conn, closeTimeout);
conn.close(closeTimeout);
conn = null;
}
</DeepExtract>
if (executor != null) {
if (endpoint != null && endpoint.getCamelContext() != null) {
endpoint.getCamelContext().getExecutorServiceManager().shutdownNow(executor);
} else {
executor.shutdownNow();
}
executor = null;
}
} | apibusinesshub-integration-recipes | positive | 2,974 |
private int jjMoveStringLiteralDfa5_3(long old0, long active0) {
if (((active0 &= old0)) == 0L)
return jjStartNfa_3(3, old0, 0L, 0L);
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
jjStopStringLiteralDfa_3(4, active0, 0L, 0L);
return 5;
}
switch(curChar) {
case 99:
return jjMoveStringLiteralDfa6_3(active0, 0x80000L);
case 100:
return jjMoveStringLiteralDfa6_3(active0, 0x400L);
case 101:
return jjMoveStringLiteralDfa6_3(active0, 0x800L);
case 105:
return jjMoveStringLiteralDfa6_3(active0, 0x200L);
case 109:
return jjMoveStringLiteralDfa6_3(active0, 0x1000L);
case 111:
return jjMoveStringLiteralDfa6_3(active0, 0x4000L);
case 116:
if ((active0 & 0x20000L) != 0L)
return jjStopAtPos(5, 17);
break;
case 117:
return jjMoveStringLiteralDfa6_3(active0, 0x8000L);
default:
break;
}
return jjMoveNfa_3(jjStopStringLiteralDfa_3(4, active0, 0L, 0L), 4 + 1);
} | private int jjMoveStringLiteralDfa5_3(long old0, long active0) {
if (((active0 &= old0)) == 0L)
return jjStartNfa_3(3, old0, 0L, 0L);
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
jjStopStringLiteralDfa_3(4, active0, 0L, 0L);
return 5;
}
switch(curChar) {
case 99:
return jjMoveStringLiteralDfa6_3(active0, 0x80000L);
case 100:
return jjMoveStringLiteralDfa6_3(active0, 0x400L);
case 101:
return jjMoveStringLiteralDfa6_3(active0, 0x800L);
case 105:
return jjMoveStringLiteralDfa6_3(active0, 0x200L);
case 109:
return jjMoveStringLiteralDfa6_3(active0, 0x1000L);
case 111:
return jjMoveStringLiteralDfa6_3(active0, 0x4000L);
case 116:
if ((active0 & 0x20000L) != 0L)
return jjStopAtPos(5, 17);
break;
case 117:
return jjMoveStringLiteralDfa6_3(active0, 0x8000L);
default:
break;
}
<DeepExtract>
return jjMoveNfa_3(jjStopStringLiteralDfa_3(4, active0, 0L, 0L), 4 + 1);
</DeepExtract>
} | OXPath | positive | 2,975 |
public String serialize(TreeNode root) {
if (root == null)
return "";
List<String> list = new ArrayList<>();
if (root != null) {
list.add(String.valueOf(root.val));
preOrder(root.left, list);
preOrder(root.right, list);
}
return String.join(",", list);
} | public String serialize(TreeNode root) {
if (root == null)
return "";
List<String> list = new ArrayList<>();
<DeepExtract>
if (root != null) {
list.add(String.valueOf(root.val));
preOrder(root.left, list);
preOrder(root.right, list);
}
</DeepExtract>
return String.join(",", list);
} | AlgoCS | positive | 2,976 |
@Test
public void testStaticRunTestOnContext() throws Exception {
Result result;
try {
result = new JUnitCore().run(new VertxUnitRunner(StaticUseRunOnContextRule.class));
} catch (InitializationError initializationError) {
throw new AssertionError(initializationError);
}
assertEquals(2, result.getRunCount());
assertEquals(0, result.getFailureCount());
for (String name : Arrays.asList("testMethod1", "testMethod2")) {
Context methodCtx = StaticUseRunOnContextRule.method.get(name);
Context beforeCtx = StaticUseRunOnContextRule.before.get(name);
Context afterCtx = StaticUseRunOnContextRule.after.get(name);
assertNotNull(methodCtx);
assertSame(methodCtx, beforeCtx);
assertSame(methodCtx, afterCtx);
}
assertSame(StaticUseRunOnContextRule.method.get("testMethod1"), StaticUseRunOnContextRule.method.get("testMethod2"));
assertSame(StaticUseRunOnContextRule.beforeClass, StaticUseRunOnContextRule.method.get("testMethod1"));
assertSame(StaticUseRunOnContextRule.afterClass, StaticUseRunOnContextRule.method.get("testMethod1"));
} | @Test
public void testStaticRunTestOnContext() throws Exception {
<DeepExtract>
Result result;
try {
result = new JUnitCore().run(new VertxUnitRunner(StaticUseRunOnContextRule.class));
} catch (InitializationError initializationError) {
throw new AssertionError(initializationError);
}
</DeepExtract>
assertEquals(2, result.getRunCount());
assertEquals(0, result.getFailureCount());
for (String name : Arrays.asList("testMethod1", "testMethod2")) {
Context methodCtx = StaticUseRunOnContextRule.method.get(name);
Context beforeCtx = StaticUseRunOnContextRule.before.get(name);
Context afterCtx = StaticUseRunOnContextRule.after.get(name);
assertNotNull(methodCtx);
assertSame(methodCtx, beforeCtx);
assertSame(methodCtx, afterCtx);
}
assertSame(StaticUseRunOnContextRule.method.get("testMethod1"), StaticUseRunOnContextRule.method.get("testMethod2"));
assertSame(StaticUseRunOnContextRule.beforeClass, StaticUseRunOnContextRule.method.get("testMethod1"));
assertSame(StaticUseRunOnContextRule.afterClass, StaticUseRunOnContextRule.method.get("testMethod1"));
} | vertx-unit | positive | 2,977 |
public Criteria andN_priorityLessThanOrEqualTo(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "n_priority" + " cannot be null");
}
criteria.add(new Criterion("n_priority <=", value));
return (Criteria) this;
} | public Criteria andN_priorityLessThanOrEqualTo(Integer value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "n_priority" + " cannot be null");
}
criteria.add(new Criterion("n_priority <=", value));
</DeepExtract>
return (Criteria) this;
} | BaiChengNews | positive | 2,978 |
public Criteria andMethodDescLessThan(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "methodDesc" + " cannot be null");
}
criteria.add(new Criterion("method_desc <", value));
return (Criteria) this;
} | public Criteria andMethodDescLessThan(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "methodDesc" + " cannot be null");
}
criteria.add(new Criterion("method_desc <", value));
</DeepExtract>
return (Criteria) this;
} | data-manage-parent | positive | 2,979 |
public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset, DragView dragView, Object dragInfo) {
if (mVacantCache != null) {
mVacantCache.clearVacantCells();
mVacantCache = null;
}
} | public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset, DragView dragView, Object dragInfo) {
<DeepExtract>
if (mVacantCache != null) {
mVacantCache.clearVacantCells();
mVacantCache = null;
}
</DeepExtract>
} | Open-Launcher-for-GTV | positive | 2,980 |
public int getTimePoint(double tTarget, int pStart) {
int p, interval = pStart;
if (timePoints == null) {
timePoints = new double[timePointsList.size()];
for (int i = 0; i < timePointsList.size(); i++) {
timePoints[i] = (double) (timePointsList.get(i));
}
}
return timePoints;
int interval;
if (pStart < 0)
interval = 0;
else if (pStart > numPoints - 2)
interval = numPoints - 2;
else
interval = pStart;
if (isAscending) {
while ((interval >= 0) && (interval <= numPoints - 2)) {
if (tTarget >= timePoints[interval + 1])
interval++;
else if (tTarget < timePoints[interval])
interval--;
else
break;
}
} else {
while ((interval >= 0) && (interval <= numPoints - 2)) {
if (tTarget >= timePoints[interval])
interval--;
else if (tTarget < timePoints[interval + 1])
interval++;
else
break;
}
}
return interval;
if (interval < 0)
p = 0;
else if (interval > numPoints - 2) {
p = numPoints - 1;
} else {
p = interval;
if (isAscending) {
if ((tTarget - timePoints[interval]) > (timePoints[interval + 1] - tTarget))
p = interval + 1;
} else {
if ((tTarget - timePoints[interval + 1]) < (timePoints[interval] - tTarget))
p = interval + 1;
}
}
return p;
} | public int getTimePoint(double tTarget, int pStart) {
int p, interval = pStart;
if (timePoints == null) {
timePoints = new double[timePointsList.size()];
for (int i = 0; i < timePointsList.size(); i++) {
timePoints[i] = (double) (timePointsList.get(i));
}
}
return timePoints;
<DeepExtract>
int interval;
if (pStart < 0)
interval = 0;
else if (pStart > numPoints - 2)
interval = numPoints - 2;
else
interval = pStart;
if (isAscending) {
while ((interval >= 0) && (interval <= numPoints - 2)) {
if (tTarget >= timePoints[interval + 1])
interval++;
else if (tTarget < timePoints[interval])
interval--;
else
break;
}
} else {
while ((interval >= 0) && (interval <= numPoints - 2)) {
if (tTarget >= timePoints[interval])
interval--;
else if (tTarget < timePoints[interval + 1])
interval++;
else
break;
}
}
return interval;
</DeepExtract>
if (interval < 0)
p = 0;
else if (interval > numPoints - 2) {
p = numPoints - 1;
} else {
p = interval;
if (isAscending) {
if ((tTarget - timePoints[interval]) > (timePoints[interval + 1] - tTarget))
p = interval + 1;
} else {
if ((tTarget - timePoints[interval + 1]) < (timePoints[interval] - tTarget))
p = interval + 1;
}
}
return p;
} | PhyDyn | positive | 2,982 |
public Criteria andIdIn(List<Integer> values) {
if (values == null) {
throw new RuntimeException("Value for " + "id" + " cannot be null");
}
criteria.add(new Criterion("id in", values));
return (Criteria) this;
} | public Criteria andIdIn(List<Integer> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "id" + " cannot be null");
}
criteria.add(new Criterion("id in", values));
</DeepExtract>
return (Criteria) this;
} | dubbo-mock | positive | 2,983 |
private static void mergeSort1(int[] array) {
for (int i = 0; i < array.length; i++) {
System.out.print(array[i] + " ");
}
System.out.println();
int midIndex = array.length / 2;
int[] tempArray = new int[array.length];
int i = 0, j = midIndex + 1, k = 0;
int i = 0, j = midIndex + 1, k = 0;
int i = 0, j = midIndex + 1, k = 0;
while (i <= midIndex && j < array.length) {
if (array[i] <= array[j]) {
tempArray[k] = array[i];
i++;
k++;
} else {
tempArray[k] = array[j];
j++;
k++;
}
}
while (i <= midIndex) {
tempArray[k] = array[i];
i++;
k++;
}
while (j < array.length) {
tempArray[k] = array[j];
j++;
k++;
}
for (int i = 0; i < tempArray.length; i++) {
System.out.print(tempArray[i] + " ");
}
System.out.println();
} | private static void mergeSort1(int[] array) {
for (int i = 0; i < array.length; i++) {
System.out.print(array[i] + " ");
}
System.out.println();
int midIndex = array.length / 2;
int[] tempArray = new int[array.length];
int i = 0, j = midIndex + 1, k = 0;
int i = 0, j = midIndex + 1, k = 0;
int i = 0, j = midIndex + 1, k = 0;
while (i <= midIndex && j < array.length) {
if (array[i] <= array[j]) {
tempArray[k] = array[i];
i++;
k++;
} else {
tempArray[k] = array[j];
j++;
k++;
}
}
while (i <= midIndex) {
tempArray[k] = array[i];
i++;
k++;
}
while (j < array.length) {
tempArray[k] = array[j];
j++;
k++;
}
<DeepExtract>
for (int i = 0; i < tempArray.length; i++) {
System.out.print(tempArray[i] + " ");
}
System.out.println();
</DeepExtract>
} | ProjectStudy | positive | 2,984 |
protected ch.qos.logback.core.Appender getLogbackDailyAndSizeRollingFileAppender(String productName, String file, String encoding, String size, String datePattern, int maxBackupIndex) {
RollingFileAppender appender = new RollingFileAppender();
appender.setContext(LogbackLoggerContextUtil.getLoggerContext());
appender.setName(productName + "." + file.replace(File.separatorChar, '.') + ".Appender");
appender.setAppend(true);
appender.setFile(LoggerHelper.getLogFile(productName, file));
TimeBasedRollingPolicy rolling = new TimeBasedRollingPolicy();
rolling.setParent(appender);
if (maxBackupIndex >= 0) {
rolling.setMaxHistory(maxBackupIndex);
}
rolling.setFileNamePattern(LoggerHelper.getLogFile(productName, file) + ".%d{" + datePattern + "}.%i");
rolling.setContext(LogbackLoggerContextUtil.getLoggerContext());
SizeAndTimeBasedFNATP fnatp = new SizeAndTimeBasedFNATP();
try {
try {
Method setMaxFileSizeMethod = fnatp.getClass().getDeclaredMethod("setMaxFileSize", String.class);
setMaxFileSizeMethod.invoke(fnatp, size);
} catch (NoSuchMethodException e) {
Method setMaxFileSizeMethod = fnatp.getClass().getDeclaredMethod("setMaxFileSize", FileSize.class);
setMaxFileSizeMethod.invoke(fnatp, FileSize.valueOf(size));
}
} catch (Throwable t) {
throw new RuntimeException("Failed to setMaxFileSize", t);
}
fnatp.setTimeBasedRollingPolicy(rolling);
rolling.setTimeBasedFileNamingAndTriggeringPolicy(fnatp);
rolling.start();
appender.setRollingPolicy(rolling);
PatternLayout layout = new PatternLayout();
layout.setPattern(LoggerHelper.getPattern(productName));
layout.setContext(LogbackLoggerContextUtil.getLoggerContext());
layout.start();
appender.setLayout(layout);
appender.start();
return appender;
} | protected ch.qos.logback.core.Appender getLogbackDailyAndSizeRollingFileAppender(String productName, String file, String encoding, String size, String datePattern, int maxBackupIndex) {
RollingFileAppender appender = new RollingFileAppender();
appender.setContext(LogbackLoggerContextUtil.getLoggerContext());
appender.setName(productName + "." + file.replace(File.separatorChar, '.') + ".Appender");
appender.setAppend(true);
appender.setFile(LoggerHelper.getLogFile(productName, file));
TimeBasedRollingPolicy rolling = new TimeBasedRollingPolicy();
rolling.setParent(appender);
if (maxBackupIndex >= 0) {
rolling.setMaxHistory(maxBackupIndex);
}
rolling.setFileNamePattern(LoggerHelper.getLogFile(productName, file) + ".%d{" + datePattern + "}.%i");
rolling.setContext(LogbackLoggerContextUtil.getLoggerContext());
SizeAndTimeBasedFNATP fnatp = new SizeAndTimeBasedFNATP();
<DeepExtract>
try {
try {
Method setMaxFileSizeMethod = fnatp.getClass().getDeclaredMethod("setMaxFileSize", String.class);
setMaxFileSizeMethod.invoke(fnatp, size);
} catch (NoSuchMethodException e) {
Method setMaxFileSizeMethod = fnatp.getClass().getDeclaredMethod("setMaxFileSize", FileSize.class);
setMaxFileSizeMethod.invoke(fnatp, FileSize.valueOf(size));
}
} catch (Throwable t) {
throw new RuntimeException("Failed to setMaxFileSize", t);
}
</DeepExtract>
fnatp.setTimeBasedRollingPolicy(rolling);
rolling.setTimeBasedFileNamingAndTriggeringPolicy(fnatp);
rolling.start();
appender.setRollingPolicy(rolling);
PatternLayout layout = new PatternLayout();
layout.setPattern(LoggerHelper.getPattern(productName));
layout.setContext(LogbackLoggerContextUtil.getLoggerContext());
layout.start();
appender.setLayout(layout);
appender.start();
return appender;
} | logger.api | positive | 2,985 |
public void itemStateChanged(ItemEvent evt) {
if (evt.getStateChange() == ItemEvent.SELECTED == autoReloadEnabled)
return;
autoReloadEnabled = evt.getStateChange() == ItemEvent.SELECTED;
if (evt.getStateChange() == ItemEvent.SELECTED) {
initFileWatcher();
} else {
if (fw != null) {
sm.remove(fw);
fw = null;
}
}
} | public void itemStateChanged(ItemEvent evt) {
<DeepExtract>
if (evt.getStateChange() == ItemEvent.SELECTED == autoReloadEnabled)
return;
autoReloadEnabled = evt.getStateChange() == ItemEvent.SELECTED;
if (evt.getStateChange() == ItemEvent.SELECTED) {
initFileWatcher();
} else {
if (fw != null) {
sm.remove(fw);
fw = null;
}
}
</DeepExtract>
} | TMCMG | positive | 2,986 |
@Override
public void setComponent(EntityId entityId, EntityComponent component) {
EntityComponent lastComp = getComponent(entityId, component.getClass());
super.setComponent(entityId, component);
Platform.runLater(() -> {
if (component.getClass() == Parenting.class) {
handleParentingChange(entityId, (Parenting) lastComp, (Parenting) component);
} else if (component.getClass() == Naming.class) {
handleNamingChange(entityId, (Naming) lastComp, (Naming) component);
}
EntityNode node = findOrCreateNode(entityId);
if (lastComp != null && component == null) {
node.componentListProperty().remove(lastComp);
} else if (lastComp != null && component != null) {
int index = node.componentListProperty().indexOf(lastComp);
if (index == -1) {
LogUtil.warning("Something went wrong with the known issue #16. We need to replace a component in an entity node, but the old component can't be found in the entity node's comp list.");
LogUtil.warning(" Component class : " + component.getClass().getSimpleName());
LogUtil.warning(" last component : " + lastComp);
LogUtil.warning(" new component : " + component);
Naming naming = getComponent(entityId, Naming.class);
LogUtil.warning(" entity : " + entityId + (naming != null ? naming.getName() : "unamed."));
LogUtil.warning(" please give info about that test case to https://github.com/brainless-studios/alchemist/issues/16");
} else
node.componentListProperty().set(index, component);
} else if (lastComp == null && component != null) {
node.componentListProperty().add(component);
}
});
} | @Override
public void setComponent(EntityId entityId, EntityComponent component) {
EntityComponent lastComp = getComponent(entityId, component.getClass());
super.setComponent(entityId, component);
<DeepExtract>
Platform.runLater(() -> {
if (component.getClass() == Parenting.class) {
handleParentingChange(entityId, (Parenting) lastComp, (Parenting) component);
} else if (component.getClass() == Naming.class) {
handleNamingChange(entityId, (Naming) lastComp, (Naming) component);
}
EntityNode node = findOrCreateNode(entityId);
if (lastComp != null && component == null) {
node.componentListProperty().remove(lastComp);
} else if (lastComp != null && component != null) {
int index = node.componentListProperty().indexOf(lastComp);
if (index == -1) {
LogUtil.warning("Something went wrong with the known issue #16. We need to replace a component in an entity node, but the old component can't be found in the entity node's comp list.");
LogUtil.warning(" Component class : " + component.getClass().getSimpleName());
LogUtil.warning(" last component : " + lastComp);
LogUtil.warning(" new component : " + component);
Naming naming = getComponent(entityId, Naming.class);
LogUtil.warning(" entity : " + entityId + (naming != null ? naming.getName() : "unamed."));
LogUtil.warning(" please give info about that test case to https://github.com/brainless-studios/alchemist/issues/16");
} else
node.componentListProperty().set(index, component);
} else if (lastComp == null && component != null) {
node.componentListProperty().add(component);
}
});
</DeepExtract>
} | alchemist | positive | 2,987 |
private String indent(ITree t) {
StringBuilder b = new StringBuilder();
for (int i = 0; i < t.getDepth(); i++) b.append("\t");
System.err.println("This terminal should currently not be used (please use toShortString())");
return toShortString();
} | private String indent(ITree t) {
StringBuilder b = new StringBuilder();
for (int i = 0; i < t.getDepth(); i++) b.append("\t");
<DeepExtract>
System.err.println("This terminal should currently not be used (please use toShortString())");
return toShortString();
</DeepExtract>
} | IntelliMerge | positive | 2,988 |
public View getView(int position, View view, ViewGroup parent) {
if (view == null) {
LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = vi.inflate(R.layout.base_restaurant_cell, parent, false);
holder = new RestaurantViewHolder(view);
view.setTag(holder);
} else {
holder = (RestaurantViewHolder) view.getTag();
}
Restaurant restaurant = getItem(position);
Drawable defaultThumbnail = new IconDrawable(context, IoniconsIcons.ion_android_restaurant).colorRes(R.color.dark_gray);
if (!restaurant.getImageUrl().isEmpty()) {
Picasso.get().load(restaurant.getImageUrl()).error(defaultThumbnail).fit().centerCrop().into(thumbnail);
} else {
thumbnail.setImageDrawable(defaultThumbnail);
}
name.setText(restaurant.getName());
address.setText(restaurant.getAddress());
if (restaurant.getCategoriesListText().isEmpty()) {
categories.setVisibility(View.GONE);
} else {
categories.setText(restaurant.getCategoriesListText());
categories.setVisibility(View.VISIBLE);
}
return view;
} | public View getView(int position, View view, ViewGroup parent) {
if (view == null) {
LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = vi.inflate(R.layout.base_restaurant_cell, parent, false);
holder = new RestaurantViewHolder(view);
view.setTag(holder);
} else {
holder = (RestaurantViewHolder) view.getTag();
}
<DeepExtract>
Restaurant restaurant = getItem(position);
Drawable defaultThumbnail = new IconDrawable(context, IoniconsIcons.ion_android_restaurant).colorRes(R.color.dark_gray);
if (!restaurant.getImageUrl().isEmpty()) {
Picasso.get().load(restaurant.getImageUrl()).error(defaultThumbnail).fit().centerCrop().into(thumbnail);
} else {
thumbnail.setImageDrawable(defaultThumbnail);
}
name.setText(restaurant.getName());
address.setText(restaurant.getAddress());
if (restaurant.getCategoriesListText().isEmpty()) {
categories.setVisibility(View.GONE);
} else {
categories.setText(restaurant.getCategoriesListText());
categories.setVisibility(View.VISIBLE);
}
</DeepExtract>
return view;
} | Food-Diary | positive | 2,989 |
public void handleEvent(Event event) {
int n = 0;
for (TableItem item : testRequirementsViewer.getTable().getItems()) {
item.setImage(1, null);
if (n % 2 == 0)
item.setBackground(Colors.WHITE);
else
item.setBackground(Colors.GREY);
testRequirementsViewer.getTable().getItem(n).setText(0, Integer.toString(n + 1));
n++;
}
if (event.detail == SWT.CHECK) {
Iterator<AbstractPath<Integer>> iterator = Activator.getDefault().getTestRequirementController().getTestRequirements().iterator();
for (TableItem item : testRequirementsViewer.getTable().getItems()) {
AbstractPath<Integer> selected = iterator.next();
if (item == event.item) {
if (item.getChecked())
Activator.getDefault().getTestRequirementController().enableInfeasible(selected);
else
Activator.getDefault().getTestRequirementController().disableInfeasible(selected);
break;
}
}
} else if (event.detail == SWT.NONE) {
Iterator<AbstractPath<Integer>> iterator = Activator.getDefault().getTestRequirementController().getTestRequirements().iterator();
for (TableItem item : testRequirementsViewer.getTable().getItems()) {
AbstractPath<Integer> selected = iterator.next();
if (item == event.item) {
Activator.getDefault().getTestRequirementController().selectTestRequirement(selected);
break;
}
}
}
} | public void handleEvent(Event event) {
<DeepExtract>
int n = 0;
for (TableItem item : testRequirementsViewer.getTable().getItems()) {
item.setImage(1, null);
if (n % 2 == 0)
item.setBackground(Colors.WHITE);
else
item.setBackground(Colors.GREY);
testRequirementsViewer.getTable().getItem(n).setText(0, Integer.toString(n + 1));
n++;
}
</DeepExtract>
if (event.detail == SWT.CHECK) {
Iterator<AbstractPath<Integer>> iterator = Activator.getDefault().getTestRequirementController().getTestRequirements().iterator();
for (TableItem item : testRequirementsViewer.getTable().getItems()) {
AbstractPath<Integer> selected = iterator.next();
if (item == event.item) {
if (item.getChecked())
Activator.getDefault().getTestRequirementController().enableInfeasible(selected);
else
Activator.getDefault().getTestRequirementController().disableInfeasible(selected);
break;
}
}
} else if (event.detail == SWT.NONE) {
Iterator<AbstractPath<Integer>> iterator = Activator.getDefault().getTestRequirementController().getTestRequirements().iterator();
for (TableItem item : testRequirementsViewer.getTable().getItems()) {
AbstractPath<Integer> selected = iterator.next();
if (item == event.item) {
Activator.getDefault().getTestRequirementController().selectTestRequirement(selected);
break;
}
}
}
} | PESTT | positive | 2,990 |
@Override
public void init() {
jobBuilders = new HashMap<String, IJobBuilder>();
FileJobBuilder fileJobBuilder = new FileJobBuilder();
fileJobBuilder.init();
jobBuilders.put("file", fileJobBuilder);
this.config = config;
if (log.isInfoEnabled()) {
log.info("mixJobBuilder init complete.");
}
} | @Override
public void init() {
jobBuilders = new HashMap<String, IJobBuilder>();
FileJobBuilder fileJobBuilder = new FileJobBuilder();
fileJobBuilder.init();
jobBuilders.put("file", fileJobBuilder);
<DeepExtract>
this.config = config;
</DeepExtract>
if (log.isInfoEnabled()) {
log.info("mixJobBuilder init complete.");
}
} | beatles | positive | 2,991 |
@Override
public void onDownloadJson(int handle, String... emojiNames) {
categorizedEmojies.clear();
if (keyboardViewManager == null)
return;
final String category = currentCategory;
currentCategory = null;
changeCategory(category, keyboardViewManager.getCurrentPage());
} | @Override
public void onDownloadJson(int handle, String... emojiNames) {
<DeepExtract>
categorizedEmojies.clear();
if (keyboardViewManager == null)
return;
final String category = currentCategory;
currentCategory = null;
changeCategory(category, keyboardViewManager.getCurrentPage());
</DeepExtract>
} | emojidex-android | positive | 2,992 |
public void assertSelectedIds(String selectLocator, String pattern) throws java.lang.Exception {
if (selectLocator instanceof String && getSelectedIds(pattern) instanceof String) {
assertEquals((String) selectLocator, (String) getSelectedIds(pattern));
} else if (selectLocator instanceof String && getSelectedIds(pattern) instanceof String[]) {
assertEquals((String) selectLocator, (String[]) getSelectedIds(pattern));
} else if (selectLocator instanceof String && getSelectedIds(pattern) instanceof Number) {
assertEquals((String) selectLocator, ((Number) getSelectedIds(pattern)).toString());
} else {
if (selectLocator instanceof String[] && getSelectedIds(pattern) instanceof String[]) {
String[] sa1 = (String[]) selectLocator;
String[] sa2 = (String[]) getSelectedIds(pattern);
if (sa1.length != sa2.length) {
throw new AssertionFailedError("Expected " + sa1 + " but saw " + sa2);
}
for (int j = 0; j < sa1.length; j++) {
Assert.assertEquals(sa1[j], sa2[j]);
}
}
}
} | public void assertSelectedIds(String selectLocator, String pattern) throws java.lang.Exception {
<DeepExtract>
if (selectLocator instanceof String && getSelectedIds(pattern) instanceof String) {
assertEquals((String) selectLocator, (String) getSelectedIds(pattern));
} else if (selectLocator instanceof String && getSelectedIds(pattern) instanceof String[]) {
assertEquals((String) selectLocator, (String[]) getSelectedIds(pattern));
} else if (selectLocator instanceof String && getSelectedIds(pattern) instanceof Number) {
assertEquals((String) selectLocator, ((Number) getSelectedIds(pattern)).toString());
} else {
if (selectLocator instanceof String[] && getSelectedIds(pattern) instanceof String[]) {
String[] sa1 = (String[]) selectLocator;
String[] sa2 = (String[]) getSelectedIds(pattern);
if (sa1.length != sa2.length) {
throw new AssertionFailedError("Expected " + sa1 + " but saw " + sa2);
}
for (int j = 0; j < sa1.length; j++) {
Assert.assertEquals(sa1[j], sa2[j]);
}
}
}
</DeepExtract>
} | selenium-client-factory | positive | 2,993 |
public void saveExecutionMillTime(String method, int exeTime) {
Statistics st = executionMillTime.get(method);
if (st == null) {
st = new Statistics((int) Math.ceil((exeTime + 1) * 1.5), statisticSum);
Statistics old = executionMillTime.putIfAbsent(method, st);
if (old != null) {
st = old;
}
}
int index = history[0]++;
final int LENGTH = history.length - 1;
if (index == LENGTH) {
history[0] = 1;
}
history[index] = exeTime;
if (index != indexOfMax) {
if (exeTime > max) {
indexOfMax = index;
max = exeTime;
}
} else if (history[LENGTH] > 0) {
if (exeTime < max) {
int imax = 1;
for (int i = 2; i < history.length; i++) {
if (history[i] > history[imax]) {
imax = i;
}
}
indexOfMax = imax;
max = history[imax];
} else {
max = exeTime;
}
}
} | public void saveExecutionMillTime(String method, int exeTime) {
Statistics st = executionMillTime.get(method);
if (st == null) {
st = new Statistics((int) Math.ceil((exeTime + 1) * 1.5), statisticSum);
Statistics old = executionMillTime.putIfAbsent(method, st);
if (old != null) {
st = old;
}
}
<DeepExtract>
int index = history[0]++;
final int LENGTH = history.length - 1;
if (index == LENGTH) {
history[0] = 1;
}
history[index] = exeTime;
if (index != indexOfMax) {
if (exeTime > max) {
indexOfMax = index;
max = exeTime;
}
} else if (history[LENGTH] > 0) {
if (exeTime < max) {
int imax = 1;
for (int i = 2; i < history.length; i++) {
if (history[i] > history[imax]) {
imax = i;
}
}
indexOfMax = imax;
max = history[imax];
} else {
max = exeTime;
}
}
</DeepExtract>
} | netty-thrift | positive | 2,994 |
private void startShadow() {
mPolygonShapeSpec.setHasShadow(true);
mBorderPaint.setShadowLayer(mPolygonShapeSpec.getShadowRadius(), mPolygonShapeSpec.getShadowXOffset(), mPolygonShapeSpec.getShadowYOffset(), mPolygonShapeSpec.getShadowColor());
updatePolygonSize(getPaddingLeft(), getPaddingTop(), getPaddingRight(), getPaddingBottom());
invalidate();
} | private void startShadow() {
mPolygonShapeSpec.setHasShadow(true);
mBorderPaint.setShadowLayer(mPolygonShapeSpec.getShadowRadius(), mPolygonShapeSpec.getShadowXOffset(), mPolygonShapeSpec.getShadowYOffset(), mPolygonShapeSpec.getShadowColor());
<DeepExtract>
updatePolygonSize(getPaddingLeft(), getPaddingTop(), getPaddingRight(), getPaddingBottom());
</DeepExtract>
invalidate();
} | BaseMyProject | positive | 2,995 |
public Criteria andAvatarIsNull() {
if ("avatar is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("avatar is null"));
return (Criteria) this;
} | public Criteria andAvatarIsNull() {
<DeepExtract>
if ("avatar is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("avatar is null"));
</DeepExtract>
return (Criteria) this;
} | oauth4j | positive | 2,996 |
public void preShow() {
if (root == null) {
throw new IllegalStateException("setContentView called with a view to display");
}
if (background == null) {
mWindow.setBackgroundDrawable(new BitmapDrawable());
} else {
mWindow.setBackgroundDrawable(background);
}
mWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
mWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
mWindow.setTouchable(true);
mWindow.setFocusable(true);
mWindow.setOutsideTouchable(true);
this.root = root;
mWindow.setContentView(root);
} | public void preShow() {
if (root == null) {
throw new IllegalStateException("setContentView called with a view to display");
}
if (background == null) {
mWindow.setBackgroundDrawable(new BitmapDrawable());
} else {
mWindow.setBackgroundDrawable(background);
}
mWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
mWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
mWindow.setTouchable(true);
mWindow.setFocusable(true);
mWindow.setOutsideTouchable(true);
<DeepExtract>
this.root = root;
mWindow.setContentView(root);
</DeepExtract>
} | owncloud-android | positive | 2,997 |
public void setTypeface(Typeface typeface, int style) {
this.tabTypeface = typeface;
this.tabTypefaceStyle = style;
for (int i = 0; i < tabCount; i++) {
View v = tabsContainer.getChildAt(i);
v.setBackgroundResource(tabBackgroundResId);
if (v instanceof TextView) {
TextView tab = (TextView) v;
tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
tab.setTypeface(tabTypeface, tabTypefaceStyle);
tab.setTextColor(tabTextColor);
if (textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
tab.setAllCaps(true);
} else {
tab.setText(tab.getText().toString().toUpperCase(locale));
}
}
if (i == selectedPosition) {
tab.setTextColor(selectedTabTextColor);
}
}
}
} | public void setTypeface(Typeface typeface, int style) {
this.tabTypeface = typeface;
this.tabTypefaceStyle = style;
<DeepExtract>
for (int i = 0; i < tabCount; i++) {
View v = tabsContainer.getChildAt(i);
v.setBackgroundResource(tabBackgroundResId);
if (v instanceof TextView) {
TextView tab = (TextView) v;
tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
tab.setTypeface(tabTypeface, tabTypefaceStyle);
tab.setTextColor(tabTextColor);
if (textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
tab.setAllCaps(true);
} else {
tab.setText(tab.getText().toString().toUpperCase(locale));
}
}
if (i == selectedPosition) {
tab.setTextColor(selectedTabTextColor);
}
}
}
</DeepExtract>
} | WeCenterMobile-Android | positive | 2,998 |
public OnBoardTest getExhaustGasRecirculationSystemTest() {
if (getIgnitionType().equals(IgnitionType.Compression)) {
return OnBoardTest.NotAvailable;
}
if (!isOn("C7")) {
return OnBoardTest.NotAvailable;
}
if (isOn("D7")) {
return OnBoardTest.AvailableIncomplete;
}
return OnBoardTest.AvailableComplete;
} | public OnBoardTest getExhaustGasRecirculationSystemTest() {
if (getIgnitionType().equals(IgnitionType.Compression)) {
return OnBoardTest.NotAvailable;
}
<DeepExtract>
if (!isOn("C7")) {
return OnBoardTest.NotAvailable;
}
if (isOn("D7")) {
return OnBoardTest.AvailableIncomplete;
}
return OnBoardTest.AvailableComplete;
</DeepExtract>
} | OBD2 | positive | 2,999 |
public static <T> Component<T> newComponentCustom(String name, ComponentFactory<T> factory) {
if (listener != null) {
listener.onComponentAdd(components.addDefinition(factory.create(components.nextId(), name)), true);
}
return components.addDefinition(factory.create(components.nextId(), name));
} | public static <T> Component<T> newComponentCustom(String name, ComponentFactory<T> factory) {
<DeepExtract>
if (listener != null) {
listener.onComponentAdd(components.addDefinition(factory.create(components.nextId(), name)), true);
}
return components.addDefinition(factory.create(components.nextId(), name));
</DeepExtract>
} | Ents | positive | 3,000 |
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if (fling != null) {
fling.cancelFling();
}
fling = new Fling((int) velocityX, (int) velocityY);
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
postOnAnimation(fling);
} else {
postDelayed(fling, 1000 / 60);
}
return super.onFling(e1, e2, velocityX, velocityY);
} | @Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if (fling != null) {
fling.cancelFling();
}
fling = new Fling((int) velocityX, (int) velocityY);
<DeepExtract>
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
postOnAnimation(fling);
} else {
postDelayed(fling, 1000 / 60);
}
</DeepExtract>
return super.onFling(e1, e2, velocityX, velocityY);
} | catnut | positive | 3,001 |
public static String[][] getListValues(List list) {
Store store = (Store) list.get(0);
if (this.size() == 0) {
col = new String[0];
}
String[] keys = new String[this.size()];
this.keySet().toArray(keys);
return keys;
values = new String[list.size() + 1][col.length];
for (int i = 0; i < list.size(); i++) {
store = (Store) list.get(i);
values[i] = store.getStrValues();
}
return values;
} | public static String[][] getListValues(List list) {
Store store = (Store) list.get(0);
<DeepExtract>
if (this.size() == 0) {
col = new String[0];
}
String[] keys = new String[this.size()];
this.keySet().toArray(keys);
return keys;
</DeepExtract>
values = new String[list.size() + 1][col.length];
for (int i = 0; i < list.size(); i++) {
store = (Store) list.get(i);
values[i] = store.getStrValues();
}
return values;
} | Uni | positive | 3,002 |
@Test
public void testParameterizedConstructorSingleResolved() {
Operation<Object, Params, Event> operation = Operations.constructorOf(this::parameterizedConstructorSingle);
Assert.assertTrue(ParameterizedConstructorHandlerSingle.class.isAssignableFrom(((OperationHandlerOperation) operation).handler().getClass()));
} | @Test
public void testParameterizedConstructorSingleResolved() {
Operation<Object, Params, Event> operation = Operations.constructorOf(this::parameterizedConstructorSingle);
<DeepExtract>
Assert.assertTrue(ParameterizedConstructorHandlerSingle.class.isAssignableFrom(((OperationHandlerOperation) operation).handler().getClass()));
</DeepExtract>
} | sourcerer | positive | 3,003 |
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
N = Integer.parseInt(br.readLine());
if (0 == N - 1) {
if (1 != 0 && 1 % 3 == 0) {
ans++;
}
return;
}
for (int i = 0; i < 3; i++) {
1 *= 10;
1 += i;
combination(0 + 1, 1);
1 -= i;
1 /= 10;
}
if (0 == N - 1) {
if (2 != 0 && 2 % 3 == 0) {
ans++;
}
return;
}
for (int i = 0; i < 3; i++) {
2 *= 10;
2 += i;
combination(0 + 1, 2);
2 -= i;
2 /= 10;
}
System.out.println(ans);
} | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
N = Integer.parseInt(br.readLine());
if (0 == N - 1) {
if (1 != 0 && 1 % 3 == 0) {
ans++;
}
return;
}
for (int i = 0; i < 3; i++) {
1 *= 10;
1 += i;
combination(0 + 1, 1);
1 -= i;
1 /= 10;
}
<DeepExtract>
if (0 == N - 1) {
if (2 != 0 && 2 % 3 == 0) {
ans++;
}
return;
}
for (int i = 0; i < 3; i++) {
2 *= 10;
2 += i;
combination(0 + 1, 2);
2 -= i;
2 /= 10;
}
</DeepExtract>
System.out.println(ans);
} | BOJ | positive | 3,004 |
private static String removeDuplicateSlashes(String string) {
StringBuffer buffer = new StringBuffer();
boolean lastWasSlash = false;
for (int i = 0; i < string.length(); i++) {
char c = string.charAt(i);
if (c == '/') {
if (!lastWasSlash) {
buffer.append(c);
lastWasSlash = true;
}
} else {
buffer.append(c);
lastWasSlash = false;
}
}
return string;
} | private static String removeDuplicateSlashes(String string) {
StringBuffer buffer = new StringBuffer();
boolean lastWasSlash = false;
for (int i = 0; i < string.length(); i++) {
char c = string.charAt(i);
if (c == '/') {
if (!lastWasSlash) {
buffer.append(c);
lastWasSlash = true;
}
} else {
buffer.append(c);
lastWasSlash = false;
}
}
<DeepExtract>
return string;
</DeepExtract>
} | unix-maven-plugin | positive | 3,005 |
public ByteTreeBasic reply(final LargeInteger integerChallenge) {
if (!(0 <= integerChallenge.compareTo(LargeInteger.ZERO) && integerChallenge.bitLength() <= vbitlen)) {
throw new ProtocolError("Malformed challenge!");
}
this.v = pField.toElement(integerChallenge);
final PRingElement a = r.innerProduct(ipe);
final PRingElement c = r.sum();
final PRingElement f = s.innerProduct(e);
k_A = a.mulAdd(v, alpha);
k_B = b.mulAdd(v, beta);
k_C = c.mulAdd(v, gamma);
k_D = d.mulAdd(v, delta);
k_E = (PFieldElementArray) ipe.mulAdd(v, epsilon);
k_F = f.mulAdd(v, phi);
final ByteTreeContainer reply = new ByteTreeContainer(k_A.toByteTree(), k_B.toByteTree(), k_C.toByteTree(), k_D.toByteTree(), k_E.toByteTree(), k_F.toByteTree());
return reply;
} | public ByteTreeBasic reply(final LargeInteger integerChallenge) {
<DeepExtract>
if (!(0 <= integerChallenge.compareTo(LargeInteger.ZERO) && integerChallenge.bitLength() <= vbitlen)) {
throw new ProtocolError("Malformed challenge!");
}
this.v = pField.toElement(integerChallenge);
</DeepExtract>
final PRingElement a = r.innerProduct(ipe);
final PRingElement c = r.sum();
final PRingElement f = s.innerProduct(e);
k_A = a.mulAdd(v, alpha);
k_B = b.mulAdd(v, beta);
k_C = c.mulAdd(v, gamma);
k_D = d.mulAdd(v, delta);
k_E = (PFieldElementArray) ipe.mulAdd(v, epsilon);
k_F = f.mulAdd(v, phi);
final ByteTreeContainer reply = new ByteTreeContainer(k_A.toByteTree(), k_B.toByteTree(), k_C.toByteTree(), k_D.toByteTree(), k_E.toByteTree(), k_F.toByteTree());
return reply;
} | verificatum-vmn | positive | 3,006 |
private void processNeedCommand(String argument) {
int p1 = argument.indexOf('\'');
int p2 = argument.indexOf('\'', p1 + 1);
String needed = argument.substring(p1 + 1, p2);
String extra = argument.split(":", 2)[1];
String status = "ok";
switch(needed) {
case "PROTECTFD":
FileDescriptor fdtoprotect = mFDList.pollFirst();
protectFileDescriptor(fdtoprotect);
break;
case "DNSSERVER":
case "DNS6SERVER":
mOpenVPNService.addDNS(extra);
break;
case "DNSDOMAIN":
mOpenVPNService.setDomain(extra);
break;
case "ROUTE":
{
String[] routeparts = extra.split(" ");
if (routeparts.length == 5) {
mOpenVPNService.addRoute(routeparts[0], routeparts[1], routeparts[2], routeparts[4]);
} else if (routeparts.length >= 3) {
mOpenVPNService.addRoute(routeparts[0], routeparts[1], routeparts[2], null);
} else {
VpnStatus.logError("Unrecognized ROUTE cmd:" + Arrays.toString(routeparts) + " | " + argument);
}
break;
}
case "ROUTE6":
{
String[] routeparts = extra.split(" ");
mOpenVPNService.addRoutev6(routeparts[0], routeparts[1]);
break;
}
case "IFCONFIG":
String[] ifconfigparts = extra.split(" ");
int mtu = Integer.parseInt(ifconfigparts[2]);
mOpenVPNService.setLocalIP(ifconfigparts[0], ifconfigparts[1], mtu, ifconfigparts[3]);
break;
case "IFCONFIG6":
String[] ifconfig6parts = extra.split(" ");
mtu = Integer.parseInt(ifconfig6parts[1]);
mOpenVPNService.setMtu(mtu);
mOpenVPNService.setLocalIPv6(ifconfig6parts[0]);
break;
case "PERSIST_TUN_ACTION":
status = mOpenVPNService.getTunReopenStatus();
break;
case "OPENTUN":
if (sendTunFD(needed, extra))
return;
else
status = "cancel";
break;
case "HTTPPROXY":
String[] httpproxy = extra.split(" ");
if (httpproxy.length == 2) {
mOpenVPNService.addHttpProxy(httpproxy[0], Integer.parseInt(httpproxy[1]));
} else {
VpnStatus.logError("Unrecognized HTTPPROXY cmd: " + Arrays.toString(httpproxy) + " | " + argument);
}
break;
default:
Log.e(TAG, "Unknown needok command " + argument);
return;
}
String cmd = String.format("needok '%s' %s\n", needed, status);
try {
if (mSocket != null && mSocket.getOutputStream() != null) {
mSocket.getOutputStream().write(cmd.getBytes());
mSocket.getOutputStream().flush();
return true;
}
} catch (IOException e) {
}
return false;
} | private void processNeedCommand(String argument) {
int p1 = argument.indexOf('\'');
int p2 = argument.indexOf('\'', p1 + 1);
String needed = argument.substring(p1 + 1, p2);
String extra = argument.split(":", 2)[1];
String status = "ok";
switch(needed) {
case "PROTECTFD":
FileDescriptor fdtoprotect = mFDList.pollFirst();
protectFileDescriptor(fdtoprotect);
break;
case "DNSSERVER":
case "DNS6SERVER":
mOpenVPNService.addDNS(extra);
break;
case "DNSDOMAIN":
mOpenVPNService.setDomain(extra);
break;
case "ROUTE":
{
String[] routeparts = extra.split(" ");
if (routeparts.length == 5) {
mOpenVPNService.addRoute(routeparts[0], routeparts[1], routeparts[2], routeparts[4]);
} else if (routeparts.length >= 3) {
mOpenVPNService.addRoute(routeparts[0], routeparts[1], routeparts[2], null);
} else {
VpnStatus.logError("Unrecognized ROUTE cmd:" + Arrays.toString(routeparts) + " | " + argument);
}
break;
}
case "ROUTE6":
{
String[] routeparts = extra.split(" ");
mOpenVPNService.addRoutev6(routeparts[0], routeparts[1]);
break;
}
case "IFCONFIG":
String[] ifconfigparts = extra.split(" ");
int mtu = Integer.parseInt(ifconfigparts[2]);
mOpenVPNService.setLocalIP(ifconfigparts[0], ifconfigparts[1], mtu, ifconfigparts[3]);
break;
case "IFCONFIG6":
String[] ifconfig6parts = extra.split(" ");
mtu = Integer.parseInt(ifconfig6parts[1]);
mOpenVPNService.setMtu(mtu);
mOpenVPNService.setLocalIPv6(ifconfig6parts[0]);
break;
case "PERSIST_TUN_ACTION":
status = mOpenVPNService.getTunReopenStatus();
break;
case "OPENTUN":
if (sendTunFD(needed, extra))
return;
else
status = "cancel";
break;
case "HTTPPROXY":
String[] httpproxy = extra.split(" ");
if (httpproxy.length == 2) {
mOpenVPNService.addHttpProxy(httpproxy[0], Integer.parseInt(httpproxy[1]));
} else {
VpnStatus.logError("Unrecognized HTTPPROXY cmd: " + Arrays.toString(httpproxy) + " | " + argument);
}
break;
default:
Log.e(TAG, "Unknown needok command " + argument);
return;
}
String cmd = String.format("needok '%s' %s\n", needed, status);
<DeepExtract>
try {
if (mSocket != null && mSocket.getOutputStream() != null) {
mSocket.getOutputStream().write(cmd.getBytes());
mSocket.getOutputStream().flush();
return true;
}
} catch (IOException e) {
}
return false;
</DeepExtract>
} | Gear-VPN | positive | 3,007 |
public synchronized void aICreateEnrouteATCAircraft(String containerTitle, String tailNumber, int flightNumber, String flightPlanPath, double flightPlanPosition, boolean touchAndGo, int dataRequestID) throws IOException {
writeBuffer.clear();
writeBuffer.position(16);
if (containerTitle == null) {
containerTitle = "";
}
byte[] b = containerTitle.getBytes();
writeBuffer.put(b, 0, Math.min(b.length, 256));
if (b.length < 256) {
for (int i = 0; i < (256 - b.length); i++) {
writeBuffer.put((byte) 0);
}
}
if (tailNumber == null) {
tailNumber = "";
}
byte[] b = tailNumber.getBytes();
writeBuffer.put(b, 0, Math.min(b.length, 12));
if (b.length < 12) {
for (int i = 0; i < (12 - b.length); i++) {
writeBuffer.put((byte) 0);
}
}
writeBuffer.putInt(flightNumber);
if (flightPlanPath == null) {
flightPlanPath = "";
}
byte[] b = flightPlanPath.getBytes();
writeBuffer.put(b, 0, Math.min(b.length, 260));
if (b.length < 260) {
for (int i = 0; i < (260 - b.length); i++) {
writeBuffer.put((byte) 0);
}
}
writeBuffer.putDouble(flightPlanPosition);
writeBuffer.putInt(touchAndGo ? 1 : 0);
writeBuffer.putInt(dataRequestID);
int packetSize = writeBuffer.position();
writeBuffer.putInt(0, packetSize);
writeBuffer.putInt(4, ourProtocol);
writeBuffer.putInt(8, 0xF0000000 | 0x28);
writeBuffer.putInt(12, currentIndex++);
writeBuffer.flip();
sc.write(writeBuffer);
packetsSent++;
bytesSent += packetSize;
} | public synchronized void aICreateEnrouteATCAircraft(String containerTitle, String tailNumber, int flightNumber, String flightPlanPath, double flightPlanPosition, boolean touchAndGo, int dataRequestID) throws IOException {
writeBuffer.clear();
writeBuffer.position(16);
if (containerTitle == null) {
containerTitle = "";
}
byte[] b = containerTitle.getBytes();
writeBuffer.put(b, 0, Math.min(b.length, 256));
if (b.length < 256) {
for (int i = 0; i < (256 - b.length); i++) {
writeBuffer.put((byte) 0);
}
}
if (tailNumber == null) {
tailNumber = "";
}
byte[] b = tailNumber.getBytes();
writeBuffer.put(b, 0, Math.min(b.length, 12));
if (b.length < 12) {
for (int i = 0; i < (12 - b.length); i++) {
writeBuffer.put((byte) 0);
}
}
writeBuffer.putInt(flightNumber);
if (flightPlanPath == null) {
flightPlanPath = "";
}
byte[] b = flightPlanPath.getBytes();
writeBuffer.put(b, 0, Math.min(b.length, 260));
if (b.length < 260) {
for (int i = 0; i < (260 - b.length); i++) {
writeBuffer.put((byte) 0);
}
}
writeBuffer.putDouble(flightPlanPosition);
writeBuffer.putInt(touchAndGo ? 1 : 0);
writeBuffer.putInt(dataRequestID);
<DeepExtract>
int packetSize = writeBuffer.position();
writeBuffer.putInt(0, packetSize);
writeBuffer.putInt(4, ourProtocol);
writeBuffer.putInt(8, 0xF0000000 | 0x28);
writeBuffer.putInt(12, currentIndex++);
writeBuffer.flip();
sc.write(writeBuffer);
packetsSent++;
bytesSent += packetSize;
</DeepExtract>
} | jsimconnect | positive | 3,008 |
public AssemblyResult parse(String text) {
AssemblyResult result = new AssemblyResult(config);
String[] lines = text.split("\n");
LogManager.LOGGER.info("Assembly job started: " + lines.length + " lines to parse.");
ByteArrayOutputStream out = new ByteArrayOutputStream();
for (int currentLine = 0; currentLine < lines.length; currentLine++) {
try {
checkForORGInstruction(lines[currentLine], result, currentLine);
} catch (PseudoInstructionException e) {
break;
} catch (AssemblyException e) {
}
}
int currentOffset = 0;
for (int currentLine = 0; currentLine < lines.length; currentLine++) {
try {
checkForLabel(lines[currentLine], result, (char) currentOffset);
currentOffset += parseInstruction(lines[currentLine], currentLine, instructionSet).length / 2;
if (currentOffset >= MEM_SIZE) {
throw new OffsetOverflowException(currentOffset, MEM_SIZE, currentLine);
}
} catch (FatalAssemblyException e) {
break;
} catch (AssemblyException e1) {
}
}
int currentOffset = 0;
for (int currentLine = 0; currentLine < lines.length; currentLine++) {
String line = lines[currentLine];
try {
line = removeComment(line);
line = removeLabel(line);
if (isLineEmpty(line)) {
throw new EmptyLineException(currentLine);
}
checkForSectionDeclaration(line, result, currentLine, currentOffset);
checkForEQUInstruction(line, result.labels, currentLine);
checkForORGInstruction(line, result, currentLine);
byte[] bytes = parseInstruction(line, currentLine, result.labels, instructionSet);
currentOffset += bytes.length / 2;
if (currentOffset >= MEM_SIZE) {
throw new OffsetOverflowException(currentOffset, MEM_SIZE, currentLine);
}
out.write(bytes);
} catch (EmptyLineException | PseudoInstructionException e) {
} catch (FatalAssemblyException asmE) {
result.exceptions.add(asmE);
break;
} catch (AssemblyException asmE) {
result.exceptions.add(asmE);
} catch (IOException ioE) {
ioE.printStackTrace();
}
}
boolean writeToMemory = true;
for (Exception e : result.exceptions) {
if (e instanceof OffsetOverflowException) {
writeToMemory = false;
break;
}
}
if (writeToMemory) {
result.bytes = out.toByteArray();
} else {
result.bytes = new byte[0];
LogManager.LOGGER.fine("Skipping writing assembled bytes to memory. (OffsetOverflowException)");
}
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
LogManager.LOGGER.info("Assembled " + result.bytes.length + " bytes (" + result.exceptions.size() + " errors)");
for (AssemblyException e : result.exceptions) {
LogManager.LOGGER.severe(e.getMessage() + '@' + e.getLine());
}
LogManager.LOGGER.info('\n' + Util.toHex(result.bytes));
return result;
} | public AssemblyResult parse(String text) {
AssemblyResult result = new AssemblyResult(config);
String[] lines = text.split("\n");
LogManager.LOGGER.info("Assembly job started: " + lines.length + " lines to parse.");
ByteArrayOutputStream out = new ByteArrayOutputStream();
for (int currentLine = 0; currentLine < lines.length; currentLine++) {
try {
checkForORGInstruction(lines[currentLine], result, currentLine);
} catch (PseudoInstructionException e) {
break;
} catch (AssemblyException e) {
}
}
int currentOffset = 0;
for (int currentLine = 0; currentLine < lines.length; currentLine++) {
try {
checkForLabel(lines[currentLine], result, (char) currentOffset);
currentOffset += parseInstruction(lines[currentLine], currentLine, instructionSet).length / 2;
if (currentOffset >= MEM_SIZE) {
throw new OffsetOverflowException(currentOffset, MEM_SIZE, currentLine);
}
} catch (FatalAssemblyException e) {
break;
} catch (AssemblyException e1) {
}
}
<DeepExtract>
int currentOffset = 0;
for (int currentLine = 0; currentLine < lines.length; currentLine++) {
String line = lines[currentLine];
try {
line = removeComment(line);
line = removeLabel(line);
if (isLineEmpty(line)) {
throw new EmptyLineException(currentLine);
}
checkForSectionDeclaration(line, result, currentLine, currentOffset);
checkForEQUInstruction(line, result.labels, currentLine);
checkForORGInstruction(line, result, currentLine);
byte[] bytes = parseInstruction(line, currentLine, result.labels, instructionSet);
currentOffset += bytes.length / 2;
if (currentOffset >= MEM_SIZE) {
throw new OffsetOverflowException(currentOffset, MEM_SIZE, currentLine);
}
out.write(bytes);
} catch (EmptyLineException | PseudoInstructionException e) {
} catch (FatalAssemblyException asmE) {
result.exceptions.add(asmE);
break;
} catch (AssemblyException asmE) {
result.exceptions.add(asmE);
} catch (IOException ioE) {
ioE.printStackTrace();
}
}
</DeepExtract>
boolean writeToMemory = true;
for (Exception e : result.exceptions) {
if (e instanceof OffsetOverflowException) {
writeToMemory = false;
break;
}
}
if (writeToMemory) {
result.bytes = out.toByteArray();
} else {
result.bytes = new byte[0];
LogManager.LOGGER.fine("Skipping writing assembled bytes to memory. (OffsetOverflowException)");
}
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
LogManager.LOGGER.info("Assembled " + result.bytes.length + " bytes (" + result.exceptions.size() + " errors)");
for (AssemblyException e : result.exceptions) {
LogManager.LOGGER.severe(e.getMessage() + '@' + e.getLine());
}
LogManager.LOGGER.info('\n' + Util.toHex(result.bytes));
return result;
} | Much-Assembly-Required | positive | 3,009 |
public SliceSeqExpand duplicate() {
SliceSeqExpand newSlice = new SliceSeqExpand();
copyAllocationInfoFrom((SliceSeqExpand) this);
return newSlice;
} | public SliceSeqExpand duplicate() {
SliceSeqExpand newSlice = new SliceSeqExpand();
<DeepExtract>
copyAllocationInfoFrom((SliceSeqExpand) this);
</DeepExtract>
return newSlice;
} | Oak | positive | 3,010 |
@Test
public void findUserIdsConnectedTo() {
return createExistingSocialUserConnection("1", "facebook", "9", 1L, null, null, null, "234567890", null, "345678901", System.currentTimeMillis() + 3600000);
return createExistingSocialUserConnection("2", "facebook", "11", 2L, null, null, null, "456789012", null, "56789012", System.currentTimeMillis() + 3600000);
Set<String> localUserIds = usersConnectionRepository.findUserIdsConnectedTo("facebook", new HashSet<>(Arrays.asList("9", "11")));
assertEquals(2, localUserIds.size());
assertTrue(localUserIds.contains("1"));
assertTrue(localUserIds.contains("2"));
} | @Test
public void findUserIdsConnectedTo() {
return createExistingSocialUserConnection("1", "facebook", "9", 1L, null, null, null, "234567890", null, "345678901", System.currentTimeMillis() + 3600000);
<DeepExtract>
return createExistingSocialUserConnection("2", "facebook", "11", 2L, null, null, null, "456789012", null, "56789012", System.currentTimeMillis() + 3600000);
</DeepExtract>
Set<String> localUserIds = usersConnectionRepository.findUserIdsConnectedTo("facebook", new HashSet<>(Arrays.asList("9", "11")));
assertEquals(2, localUserIds.size());
assertTrue(localUserIds.contains("1"));
assertTrue(localUserIds.contains("2"));
} | rfb-loyalty | positive | 3,011 |
private void sendDeliveryReceipt(SmppSession session, Address mtDestinationAddress, Address mtSourceAddress, byte dataCoding) {
DeliverSm deliver = new DeliverSm();
deliver.setEsmClass(SmppConstants.ESM_CLASS_MT_SMSC_DELIVERY_RECEIPT);
deliver.setSourceAddress(mtDestinationAddress);
deliver.setDestAddress(mtSourceAddress);
deliver.setDataCoding(dataCoding);
try {
WindowFuture<Integer, PduRequest, PduResponse> future = session.sendRequestPdu(deliver, 10000, false);
if (!future.await()) {
logger.error("Failed to receive deliver_sm_resp within specified time");
} else if (future.isSuccess()) {
DeliverSmResp deliverSmResp = (DeliverSmResp) future.getResponse();
logger.info("deliver_sm_resp: commandStatus [" + deliverSmResp.getCommandStatus() + "=" + deliverSmResp.getResultMessage() + "]");
} else {
logger.error("Failed to properly receive deliver_sm_resp: " + future.getCause());
}
} catch (Exception e) {
}
} | private void sendDeliveryReceipt(SmppSession session, Address mtDestinationAddress, Address mtSourceAddress, byte dataCoding) {
DeliverSm deliver = new DeliverSm();
deliver.setEsmClass(SmppConstants.ESM_CLASS_MT_SMSC_DELIVERY_RECEIPT);
deliver.setSourceAddress(mtDestinationAddress);
deliver.setDestAddress(mtSourceAddress);
deliver.setDataCoding(dataCoding);
<DeepExtract>
try {
WindowFuture<Integer, PduRequest, PduResponse> future = session.sendRequestPdu(deliver, 10000, false);
if (!future.await()) {
logger.error("Failed to receive deliver_sm_resp within specified time");
} else if (future.isSuccess()) {
DeliverSmResp deliverSmResp = (DeliverSmResp) future.getResponse();
logger.info("deliver_sm_resp: commandStatus [" + deliverSmResp.getCommandStatus() + "=" + deliverSmResp.getResultMessage() + "]");
} else {
logger.error("Failed to properly receive deliver_sm_resp: " + future.getCause());
}
} catch (Exception e) {
}
</DeepExtract>
} | cloudhopper-smpp | positive | 3,012 |
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
swipeRefreshLayout = view.findViewById(R.id.swiperefreshlayout);
swipeRefreshLayout.setRefreshing(false);
swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
reload();
}
});
adapter = new ImportAdapter();
recyclerView.setAdapter(adapter);
adapter.setItemClickListener(new ImportAdapter.OnItemClickListener() {
@Override
public void onItemClick(RestoreModel model) {
showRestore(model);
}
});
mPresenter = new ConfigPresenter(getContext().getApplicationContext(), this);
adapter.showData(mPresenter.getRestoreFiles());
swipeRefreshLayout.setRefreshing(false);
} | @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
swipeRefreshLayout = view.findViewById(R.id.swiperefreshlayout);
swipeRefreshLayout.setRefreshing(false);
swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
reload();
}
});
adapter = new ImportAdapter();
recyclerView.setAdapter(adapter);
adapter.setItemClickListener(new ImportAdapter.OnItemClickListener() {
@Override
public void onItemClick(RestoreModel model) {
showRestore(model);
}
});
mPresenter = new ConfigPresenter(getContext().getApplicationContext(), this);
<DeepExtract>
adapter.showData(mPresenter.getRestoreFiles());
swipeRefreshLayout.setRefreshing(false);
</DeepExtract>
} | AppOpsX | positive | 3,013 |
public Model create(File repoDir, String jarPath) {
try {
File pomFile = toPomFile(repoDir, model);
FileUtils.touch(pomFile);
FileOutputStream s = new FileOutputStream(pomFile);
new MavenXpp3Writer().write(s, model);
s.flush();
s.close();
if (!StringUtils.equals(model.getPackaging(), "pom")) {
File srcFile = new File(jarPath);
File destFile = toArtifactFile(repoDir, model);
FileUtils.copyFile(srcFile, destFile);
createChecksums(destFile);
}
if (originalText != null && demagedText != null) {
String pomText = FileUtils.readFileToString(pomFile);
pomText = pomText.replace(originalText, demagedText);
FileUtils.writeStringToFile(pomFile, pomText);
}
createChecksums(pomFile);
} catch (Exception e) {
throw new RuntimeException(e);
}
return model;
} | public Model create(File repoDir, String jarPath) {
<DeepExtract>
try {
File pomFile = toPomFile(repoDir, model);
FileUtils.touch(pomFile);
FileOutputStream s = new FileOutputStream(pomFile);
new MavenXpp3Writer().write(s, model);
s.flush();
s.close();
if (!StringUtils.equals(model.getPackaging(), "pom")) {
File srcFile = new File(jarPath);
File destFile = toArtifactFile(repoDir, model);
FileUtils.copyFile(srcFile, destFile);
createChecksums(destFile);
}
if (originalText != null && demagedText != null) {
String pomText = FileUtils.readFileToString(pomFile);
pomText = pomText.replace(originalText, demagedText);
FileUtils.writeStringToFile(pomFile, pomText);
}
createChecksums(pomFile);
} catch (Exception e) {
throw new RuntimeException(e);
}
</DeepExtract>
return model;
} | redhat-repository-validator | positive | 3,014 |
private boolean parseCloseRawBlock(PsiBuilder builder) {
PsiBuilder.Marker closeRawBlockMarker = builder.mark();
if (!parseLeafToken(builder, END_RAW_BLOCK)) {
closeRawBlockMarker.drop();
return false;
}
PsiBuilder.Marker mustacheNameMark = builder.mark();
PsiBuilder.Marker pathMarker = builder.mark();
if (parsePathSegments(builder)) {
pathMarker.done(PATH);
return true;
}
pathMarker.rollbackTo();
return false;
mustacheNameMark.done(HbTokenTypes.MUSTACHE_NAME);
if (builder.getTokenType() != CLOSE_RAW_BLOCK) {
PsiBuilder.Marker unexpectedTokensMarker = builder.mark();
while (!builder.eof() && builder.getTokenType() != CLOSE_RAW_BLOCK && !RECOVERY_SET.contains(builder.getTokenType())) {
builder.advanceLexer();
}
recordLeafTokenError(CLOSE_RAW_BLOCK, unexpectedTokensMarker);
}
if (!builder.eof() && builder.getTokenType() == CLOSE_RAW_BLOCK) {
parseLeafToken(builder, CLOSE_RAW_BLOCK);
}
closeRawBlockMarker.done(CLOSE_BLOCK_STACHE);
return true;
} | private boolean parseCloseRawBlock(PsiBuilder builder) {
PsiBuilder.Marker closeRawBlockMarker = builder.mark();
if (!parseLeafToken(builder, END_RAW_BLOCK)) {
closeRawBlockMarker.drop();
return false;
}
PsiBuilder.Marker mustacheNameMark = builder.mark();
PsiBuilder.Marker pathMarker = builder.mark();
if (parsePathSegments(builder)) {
pathMarker.done(PATH);
return true;
}
pathMarker.rollbackTo();
return false;
mustacheNameMark.done(HbTokenTypes.MUSTACHE_NAME);
<DeepExtract>
if (builder.getTokenType() != CLOSE_RAW_BLOCK) {
PsiBuilder.Marker unexpectedTokensMarker = builder.mark();
while (!builder.eof() && builder.getTokenType() != CLOSE_RAW_BLOCK && !RECOVERY_SET.contains(builder.getTokenType())) {
builder.advanceLexer();
}
recordLeafTokenError(CLOSE_RAW_BLOCK, unexpectedTokensMarker);
}
if (!builder.eof() && builder.getTokenType() == CLOSE_RAW_BLOCK) {
parseLeafToken(builder, CLOSE_RAW_BLOCK);
}
</DeepExtract>
closeRawBlockMarker.done(CLOSE_BLOCK_STACHE);
return true;
} | idea-handlebars | positive | 3,015 |
public static <T> void createNoUserForbiddenTestPut(TestRestTemplate client, URI url, T object) {
ParameterizedTypeReference<String> responseType = new ParameterizedTypeReference<>() {
};
ResponseEntity<String> result = client.exchange(RequestEntity.put(url).body(object), responseType);
assertThat(result.getStatusCode(), is(equalTo(HttpStatus.FORBIDDEN)));
} | public static <T> void createNoUserForbiddenTestPut(TestRestTemplate client, URI url, T object) {
<DeepExtract>
ParameterizedTypeReference<String> responseType = new ParameterizedTypeReference<>() {
};
ResponseEntity<String> result = client.exchange(RequestEntity.put(url).body(object), responseType);
assertThat(result.getStatusCode(), is(equalTo(HttpStatus.FORBIDDEN)));
</DeepExtract>
} | FAIRDataPoint | positive | 3,016 |
@NonNull
@Override
protected View makeCenterView() {
dayLabels = activity.getResources().getStringArray(R.array.day_labels);
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1;
int maxDays = DateUtils.calculateDaysInMonth(year, month);
days.clear();
boolean includeToday = driverHour <= 24;
switch(preDays) {
case 1:
if (includeToday) {
days.add(dayLabels[0]);
}
break;
case 2:
if (includeToday) {
days.add(dayLabels[0]);
days.add(dayLabels[1]);
} else {
days.add(dayLabels[1]);
}
break;
case 3:
if (includeToday) {
days.add(dayLabels[0]);
days.add(dayLabels[1]);
days.add(dayLabels[2]);
} else {
days.add(dayLabels[1]);
days.add(dayLabels[2]);
}
break;
default:
if (includeToday) {
days.add(dayLabels[0]);
days.add(dayLabels[1]);
days.add(dayLabels[2]);
} else {
days.add(dayLabels[1]);
days.add(dayLabels[2]);
preDays = preDays - 1;
}
for (int i = preDays; i <= maxDays; i++) {
days.add(dealDayLabel(DateUtils.fillZero(i)));
}
break;
}
if (hours.size() == 0) {
LogUtils.verbose(this, "init hours before make view");
initHourData();
}
if (minutes.size() == 0) {
LogUtils.verbose(this, "init minutes before make view");
changeMinuteData(DateUtils.trimZero(selectedHour));
}
LinearLayout layout = new LinearLayout(activity);
layout.setOrientation(LinearLayout.HORIZONTAL);
layout.setGravity(Gravity.CENTER);
layout.setWeightSum(3);
if (weightEnable) {
wheelViewParams = new LinearLayout.LayoutParams(0, WRAP_CONTENT);
wheelViewParams.weight = 1.0f;
} else {
wheelViewParams = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
}
labelViewParams = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
final WheelView dayView = new WheelView(activity);
final WheelView hourView = new WheelView(activity);
final WheelView minuteView = new WheelView(activity);
dayView.setCanLoop(canLoop);
dayView.setTextSize(textSize);
dayView.setSelectedTextColor(textColorFocus);
dayView.setUnSelectedTextColor(textColorNormal);
dayView.setAdapter(new ArrayWheelAdapter<>(days));
dayView.setCurrentItem(selectedDayIndex);
dayView.setLineConfig(lineConfig);
dayView.setDividerType(lineConfig.getDividerType());
dayView.setLayoutParams(wheelViewParams);
dayView.setOnItemPickListener(new OnItemPickListener<String>() {
@Override
public void onItemPicked(int index, String item) {
selectedDayIndex = index;
if (onWheelListener != null) {
onWheelListener.onDayWheeled(index, item);
}
}
});
layout.addView(dayView);
if (!TextUtils.isEmpty(dayLabel)) {
if (isOuterLabelEnable()) {
TextView labelView = new TextView(activity);
labelView.setLayoutParams(labelViewParams);
labelView.setTextColor(textColorFocus);
labelView.setTextSize(textSize);
labelView.setText(dayLabel);
layout.addView(labelView);
} else {
dayView.setLabel(dayLabel);
}
}
hourView.setCanLoop(canLoop);
hourView.setTextSize(textSize);
hourView.setSelectedTextColor(textColorFocus);
hourView.setUnSelectedTextColor(textColorNormal);
hourView.setDividerType(lineConfig.getDividerType());
hourView.setAdapter(new ArrayWheelAdapter<>(hours));
hourView.setCurrentItem(selectedHourIndex);
hourView.setLineConfig(lineConfig);
hourView.setLayoutParams(wheelViewParams);
hourView.setOnItemPickListener(new OnItemPickListener<String>() {
@Override
public void onItemPicked(int index, String item) {
selectedHourIndex = index;
selectedMinuteIndex = 0;
selectedHour = item;
if (onWheelListener != null) {
onWheelListener.onHourWheeled(index, item);
}
if (!canLinkage) {
return;
}
changeMinuteData(DateUtils.trimZero(item));
minuteView.setAdapter(new ArrayWheelAdapter<>(minutes));
minuteView.setCurrentItem(selectedMinuteIndex);
}
});
layout.addView(hourView);
if (!TextUtils.isEmpty(hourLabel)) {
if (isOuterLabelEnable()) {
TextView labelView = new TextView(activity);
labelView.setLayoutParams(labelViewParams);
labelView.setTextColor(textColorFocus);
labelView.setTextSize(textSize);
labelView.setText(hourLabel);
layout.addView(labelView);
} else {
hourView.setLabel(hourLabel);
}
}
minuteView.setCanLoop(canLoop);
minuteView.setTextSize(textSize);
minuteView.setSelectedTextColor(textColorFocus);
minuteView.setUnSelectedTextColor(textColorNormal);
minuteView.setAdapter(new ArrayWheelAdapter<>(minutes));
minuteView.setCurrentItem(selectedMinuteIndex);
minuteView.setDividerType(lineConfig.getDividerType());
minuteView.setLineConfig(lineConfig);
minuteView.setLayoutParams(wheelViewParams);
layout.addView(minuteView);
minuteView.setOnItemPickListener(new OnItemPickListener<String>() {
@Override
public void onItemPicked(int index, String item) {
selectedMinuteIndex = index;
selectedMinute = item;
if (onWheelListener != null) {
onWheelListener.onMinuteWheeled(index, item);
}
}
});
if (!TextUtils.isEmpty(minuteLabel)) {
if (isOuterLabelEnable()) {
TextView labelView = new TextView(activity);
labelView.setLayoutParams(labelViewParams);
labelView.setTextColor(textColorFocus);
labelView.setTextSize(textSize);
labelView.setText(minuteLabel);
layout.addView(labelView);
} else {
minuteView.setLabel(minuteLabel);
}
}
return layout;
} | @NonNull
@Override
protected View makeCenterView() {
dayLabels = activity.getResources().getStringArray(R.array.day_labels);
<DeepExtract>
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1;
int maxDays = DateUtils.calculateDaysInMonth(year, month);
days.clear();
boolean includeToday = driverHour <= 24;
switch(preDays) {
case 1:
if (includeToday) {
days.add(dayLabels[0]);
}
break;
case 2:
if (includeToday) {
days.add(dayLabels[0]);
days.add(dayLabels[1]);
} else {
days.add(dayLabels[1]);
}
break;
case 3:
if (includeToday) {
days.add(dayLabels[0]);
days.add(dayLabels[1]);
days.add(dayLabels[2]);
} else {
days.add(dayLabels[1]);
days.add(dayLabels[2]);
}
break;
default:
if (includeToday) {
days.add(dayLabels[0]);
days.add(dayLabels[1]);
days.add(dayLabels[2]);
} else {
days.add(dayLabels[1]);
days.add(dayLabels[2]);
preDays = preDays - 1;
}
for (int i = preDays; i <= maxDays; i++) {
days.add(dealDayLabel(DateUtils.fillZero(i)));
}
break;
}
</DeepExtract>
if (hours.size() == 0) {
LogUtils.verbose(this, "init hours before make view");
initHourData();
}
if (minutes.size() == 0) {
LogUtils.verbose(this, "init minutes before make view");
changeMinuteData(DateUtils.trimZero(selectedHour));
}
LinearLayout layout = new LinearLayout(activity);
layout.setOrientation(LinearLayout.HORIZONTAL);
layout.setGravity(Gravity.CENTER);
layout.setWeightSum(3);
if (weightEnable) {
wheelViewParams = new LinearLayout.LayoutParams(0, WRAP_CONTENT);
wheelViewParams.weight = 1.0f;
} else {
wheelViewParams = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
}
labelViewParams = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
final WheelView dayView = new WheelView(activity);
final WheelView hourView = new WheelView(activity);
final WheelView minuteView = new WheelView(activity);
dayView.setCanLoop(canLoop);
dayView.setTextSize(textSize);
dayView.setSelectedTextColor(textColorFocus);
dayView.setUnSelectedTextColor(textColorNormal);
dayView.setAdapter(new ArrayWheelAdapter<>(days));
dayView.setCurrentItem(selectedDayIndex);
dayView.setLineConfig(lineConfig);
dayView.setDividerType(lineConfig.getDividerType());
dayView.setLayoutParams(wheelViewParams);
dayView.setOnItemPickListener(new OnItemPickListener<String>() {
@Override
public void onItemPicked(int index, String item) {
selectedDayIndex = index;
if (onWheelListener != null) {
onWheelListener.onDayWheeled(index, item);
}
}
});
layout.addView(dayView);
if (!TextUtils.isEmpty(dayLabel)) {
if (isOuterLabelEnable()) {
TextView labelView = new TextView(activity);
labelView.setLayoutParams(labelViewParams);
labelView.setTextColor(textColorFocus);
labelView.setTextSize(textSize);
labelView.setText(dayLabel);
layout.addView(labelView);
} else {
dayView.setLabel(dayLabel);
}
}
hourView.setCanLoop(canLoop);
hourView.setTextSize(textSize);
hourView.setSelectedTextColor(textColorFocus);
hourView.setUnSelectedTextColor(textColorNormal);
hourView.setDividerType(lineConfig.getDividerType());
hourView.setAdapter(new ArrayWheelAdapter<>(hours));
hourView.setCurrentItem(selectedHourIndex);
hourView.setLineConfig(lineConfig);
hourView.setLayoutParams(wheelViewParams);
hourView.setOnItemPickListener(new OnItemPickListener<String>() {
@Override
public void onItemPicked(int index, String item) {
selectedHourIndex = index;
selectedMinuteIndex = 0;
selectedHour = item;
if (onWheelListener != null) {
onWheelListener.onHourWheeled(index, item);
}
if (!canLinkage) {
return;
}
changeMinuteData(DateUtils.trimZero(item));
minuteView.setAdapter(new ArrayWheelAdapter<>(minutes));
minuteView.setCurrentItem(selectedMinuteIndex);
}
});
layout.addView(hourView);
if (!TextUtils.isEmpty(hourLabel)) {
if (isOuterLabelEnable()) {
TextView labelView = new TextView(activity);
labelView.setLayoutParams(labelViewParams);
labelView.setTextColor(textColorFocus);
labelView.setTextSize(textSize);
labelView.setText(hourLabel);
layout.addView(labelView);
} else {
hourView.setLabel(hourLabel);
}
}
minuteView.setCanLoop(canLoop);
minuteView.setTextSize(textSize);
minuteView.setSelectedTextColor(textColorFocus);
minuteView.setUnSelectedTextColor(textColorNormal);
minuteView.setAdapter(new ArrayWheelAdapter<>(minutes));
minuteView.setCurrentItem(selectedMinuteIndex);
minuteView.setDividerType(lineConfig.getDividerType());
minuteView.setLineConfig(lineConfig);
minuteView.setLayoutParams(wheelViewParams);
layout.addView(minuteView);
minuteView.setOnItemPickListener(new OnItemPickListener<String>() {
@Override
public void onItemPicked(int index, String item) {
selectedMinuteIndex = index;
selectedMinute = item;
if (onWheelListener != null) {
onWheelListener.onMinuteWheeled(index, item);
}
}
});
if (!TextUtils.isEmpty(minuteLabel)) {
if (isOuterLabelEnable()) {
TextView labelView = new TextView(activity);
labelView.setLayoutParams(labelViewParams);
labelView.setTextColor(textColorFocus);
labelView.setTextSize(textSize);
labelView.setText(minuteLabel);
layout.addView(labelView);
} else {
minuteView.setLabel(minuteLabel);
}
}
return layout;
} | android-pickers | positive | 3,018 |
void complete(long maxIdleTimeMillis, long maxCacheTimeMillis) {
this.maxIdleTime = SecondsOrMillis.fromMillisToInternal(maxIdleTimeMillis);
this.maxCacheTime = SecondsOrMillis.fromMillisToInternal(maxCacheTimeMillis);
flags |= STATE_COMPLETE;
inputDate = SecondsOrMillis.fromMillisToInternal(currentTimeMillisEstimate() - Cache.baseTimeMillis);
lastAccess = SecondsOrMillis.fromMillisToInternal(currentTimeMillisEstimate() - Cache.baseTimeMillis);
} | void complete(long maxIdleTimeMillis, long maxCacheTimeMillis) {
this.maxIdleTime = SecondsOrMillis.fromMillisToInternal(maxIdleTimeMillis);
this.maxCacheTime = SecondsOrMillis.fromMillisToInternal(maxCacheTimeMillis);
flags |= STATE_COMPLETE;
inputDate = SecondsOrMillis.fromMillisToInternal(currentTimeMillisEstimate() - Cache.baseTimeMillis);
<DeepExtract>
lastAccess = SecondsOrMillis.fromMillisToInternal(currentTimeMillisEstimate() - Cache.baseTimeMillis);
</DeepExtract>
} | triava | positive | 3,019 |
private static boolean isRYM(String arg, Entity e) {
boolean inverted = isInverted(arg);
double mult = Double.parseDouble(arg.split("=")[1]);
return (e.getLocation().getPitch() < mult) != inverted;
} | private static boolean isRYM(String arg, Entity e) {
<DeepExtract>
boolean inverted = isInverted(arg);
double mult = Double.parseDouble(arg.split("=")[1]);
return (e.getLocation().getPitch() < mult) != inverted;
</DeepExtract>
} | advanced-achievements | positive | 3,020 |
public void testEmptyToNullCoercionForPrimitives() throws Exception {
final String EMPTY = "\"\"";
ObjectReader intR = MAPPER.readerFor(int.class);
assertEquals(Integer.valueOf(0), intR.readValue(EMPTY));
try {
intR.with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES).readValue("\"\"");
fail("Should not have passed");
} catch (JsonMappingException e) {
verifyException(e, "cannot coerce empty String");
}
final String EMPTY = "\"\"";
ObjectReader intR = MAPPER.readerFor(long.class);
assertEquals(Long.valueOf(0), intR.readValue(EMPTY));
try {
intR.with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES).readValue("\"\"");
fail("Should not have passed");
} catch (JsonMappingException e) {
verifyException(e, "cannot coerce empty String");
}
final String EMPTY = "\"\"";
ObjectReader intR = MAPPER.readerFor(double.class);
assertEquals(Double.valueOf(0.0), intR.readValue(EMPTY));
try {
intR.with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES).readValue("\"\"");
fail("Should not have passed");
} catch (JsonMappingException e) {
verifyException(e, "cannot coerce empty String");
}
final String EMPTY = "\"\"";
ObjectReader intR = MAPPER.readerFor(float.class);
assertEquals(Float.valueOf(0.0f), intR.readValue(EMPTY));
try {
intR.with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES).readValue("\"\"");
fail("Should not have passed");
} catch (JsonMappingException e) {
verifyException(e, "cannot coerce empty String");
}
} | public void testEmptyToNullCoercionForPrimitives() throws Exception {
final String EMPTY = "\"\"";
ObjectReader intR = MAPPER.readerFor(int.class);
assertEquals(Integer.valueOf(0), intR.readValue(EMPTY));
try {
intR.with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES).readValue("\"\"");
fail("Should not have passed");
} catch (JsonMappingException e) {
verifyException(e, "cannot coerce empty String");
}
final String EMPTY = "\"\"";
ObjectReader intR = MAPPER.readerFor(long.class);
assertEquals(Long.valueOf(0), intR.readValue(EMPTY));
try {
intR.with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES).readValue("\"\"");
fail("Should not have passed");
} catch (JsonMappingException e) {
verifyException(e, "cannot coerce empty String");
}
final String EMPTY = "\"\"";
ObjectReader intR = MAPPER.readerFor(double.class);
assertEquals(Double.valueOf(0.0), intR.readValue(EMPTY));
try {
intR.with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES).readValue("\"\"");
fail("Should not have passed");
} catch (JsonMappingException e) {
verifyException(e, "cannot coerce empty String");
}
<DeepExtract>
final String EMPTY = "\"\"";
ObjectReader intR = MAPPER.readerFor(float.class);
assertEquals(Float.valueOf(0.0f), intR.readValue(EMPTY));
try {
intR.with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES).readValue("\"\"");
fail("Should not have passed");
} catch (JsonMappingException e) {
verifyException(e, "cannot coerce empty String");
}
</DeepExtract>
} | jackson-blackbird | positive | 3,021 |
private final void write128(byte[] out, int off) {
out[off + 3] = (byte) ((s0 + mix128(s7, s4, s5, s6, 24) >> 24) & 0xff);
out[off + 2] = (byte) ((s0 + mix128(s7, s4, s5, s6, 24) >> 16) & 0xff);
out[off + 1] = (byte) ((s0 + mix128(s7, s4, s5, s6, 24) >> 8) & 0xff);
out[off + 0] = (byte) (s0 + mix128(s7, s4, s5, s6, 24) & 0xff);
out[off + 4 + 3] = (byte) ((s1 + mix128(s6, s7, s4, s5, 16) >> 24) & 0xff);
out[off + 4 + 2] = (byte) ((s1 + mix128(s6, s7, s4, s5, 16) >> 16) & 0xff);
out[off + 4 + 1] = (byte) ((s1 + mix128(s6, s7, s4, s5, 16) >> 8) & 0xff);
out[off + 4 + 0] = (byte) (s1 + mix128(s6, s7, s4, s5, 16) & 0xff);
out[off + 8 + 3] = (byte) ((s2 + mix128(s5, s6, s7, s4, 8) >> 24) & 0xff);
out[off + 8 + 2] = (byte) ((s2 + mix128(s5, s6, s7, s4, 8) >> 16) & 0xff);
out[off + 8 + 1] = (byte) ((s2 + mix128(s5, s6, s7, s4, 8) >> 8) & 0xff);
out[off + 8 + 0] = (byte) (s2 + mix128(s5, s6, s7, s4, 8) & 0xff);
out[off + 12 + 3] = (byte) ((s3 + mix128(s4, s5, s6, s7, 0) >> 24) & 0xff);
out[off + 12 + 2] = (byte) ((s3 + mix128(s4, s5, s6, s7, 0) >> 16) & 0xff);
out[off + 12 + 1] = (byte) ((s3 + mix128(s4, s5, s6, s7, 0) >> 8) & 0xff);
out[off + 12 + 0] = (byte) (s3 + mix128(s4, s5, s6, s7, 0) & 0xff);
} | private final void write128(byte[] out, int off) {
out[off + 3] = (byte) ((s0 + mix128(s7, s4, s5, s6, 24) >> 24) & 0xff);
out[off + 2] = (byte) ((s0 + mix128(s7, s4, s5, s6, 24) >> 16) & 0xff);
out[off + 1] = (byte) ((s0 + mix128(s7, s4, s5, s6, 24) >> 8) & 0xff);
out[off + 0] = (byte) (s0 + mix128(s7, s4, s5, s6, 24) & 0xff);
out[off + 4 + 3] = (byte) ((s1 + mix128(s6, s7, s4, s5, 16) >> 24) & 0xff);
out[off + 4 + 2] = (byte) ((s1 + mix128(s6, s7, s4, s5, 16) >> 16) & 0xff);
out[off + 4 + 1] = (byte) ((s1 + mix128(s6, s7, s4, s5, 16) >> 8) & 0xff);
out[off + 4 + 0] = (byte) (s1 + mix128(s6, s7, s4, s5, 16) & 0xff);
out[off + 8 + 3] = (byte) ((s2 + mix128(s5, s6, s7, s4, 8) >> 24) & 0xff);
out[off + 8 + 2] = (byte) ((s2 + mix128(s5, s6, s7, s4, 8) >> 16) & 0xff);
out[off + 8 + 1] = (byte) ((s2 + mix128(s5, s6, s7, s4, 8) >> 8) & 0xff);
out[off + 8 + 0] = (byte) (s2 + mix128(s5, s6, s7, s4, 8) & 0xff);
<DeepExtract>
out[off + 12 + 3] = (byte) ((s3 + mix128(s4, s5, s6, s7, 0) >> 24) & 0xff);
out[off + 12 + 2] = (byte) ((s3 + mix128(s4, s5, s6, s7, 0) >> 16) & 0xff);
out[off + 12 + 1] = (byte) ((s3 + mix128(s4, s5, s6, s7, 0) >> 8) & 0xff);
out[off + 12 + 0] = (byte) (s3 + mix128(s4, s5, s6, s7, 0) & 0xff);
</DeepExtract>
} | burst-mining-system | positive | 3,022 |
@Test
void bothValid() {
ClassNameScanner.setPomXmlPath(TESTUSER_POM_XML);
ClassNameScanner.setBuildGradlePath(TESTUSER_BUILD_GRADLE);
assertThat(ClassNameScanner.getPomXmlPath()).isEqualTo(TESTUSER_POM_XML);
assertThat(ClassNameScanner.getBuildGradlePath()).isEqualTo(TESTUSER_BUILD_GRADLE);
new ClassNameScanner("", "").getScanResult();
logs.stop();
if (!logs.list.isEmpty())
fail(logs.list.toString());
} | @Test
void bothValid() {
ClassNameScanner.setPomXmlPath(TESTUSER_POM_XML);
ClassNameScanner.setBuildGradlePath(TESTUSER_BUILD_GRADLE);
assertThat(ClassNameScanner.getPomXmlPath()).isEqualTo(TESTUSER_POM_XML);
assertThat(ClassNameScanner.getBuildGradlePath()).isEqualTo(TESTUSER_BUILD_GRADLE);
<DeepExtract>
new ClassNameScanner("", "").getScanResult();
logs.stop();
if (!logs.list.isEmpty())
fail(logs.list.toString());
</DeepExtract>
} | Ares | positive | 3,023 |
@Override
public IParseController getWrapped() {
try {
if (descriptor == null) {
descriptor = new SugarJDescriptor(createDescriptorWithRegisteredExtensions());
descriptor.setAttachmentProvider(SugarJParseControllerGenerated.class);
setDescriptor(descriptor);
org.strategoxt.imp.runtime.Environment.registerDescriptor(descriptor.getLanguage(), descriptor);
}
return descriptor;
} catch (BadDescriptorException e) {
org.strategoxt.imp.runtime.Environment.logException("Bad descriptor for " + LANGUAGE + " plugin", e);
throw new RuntimeException("Bad descriptor for " + LANGUAGE + " plugin", e);
}
IParseController result = super.getWrapped();
if (result instanceof SGLRParseController) {
JSGLRI parser = ((SGLRParseController) result).getParser();
if (!(parser instanceof SugarJParser)) {
sugarjParser = new SugarJParser(parser);
sugarjParser.setEnvironment(environment);
((SGLRParseController) result).setParser(sugarjParser);
}
}
return result;
} | @Override
public IParseController getWrapped() {
<DeepExtract>
try {
if (descriptor == null) {
descriptor = new SugarJDescriptor(createDescriptorWithRegisteredExtensions());
descriptor.setAttachmentProvider(SugarJParseControllerGenerated.class);
setDescriptor(descriptor);
org.strategoxt.imp.runtime.Environment.registerDescriptor(descriptor.getLanguage(), descriptor);
}
return descriptor;
} catch (BadDescriptorException e) {
org.strategoxt.imp.runtime.Environment.logException("Bad descriptor for " + LANGUAGE + " plugin", e);
throw new RuntimeException("Bad descriptor for " + LANGUAGE + " plugin", e);
}
</DeepExtract>
IParseController result = super.getWrapped();
if (result instanceof SGLRParseController) {
JSGLRI parser = ((SGLRParseController) result).getParser();
if (!(parser instanceof SugarJParser)) {
sugarjParser = new SugarJParser(parser);
sugarjParser.setEnvironment(environment);
((SGLRParseController) result).setParser(sugarjParser);
}
}
return result;
} | sugarj | positive | 3,024 |
public int remove() {
int ith = data.get(0);
int jth = data.get(this.data.size() - 1);
data.set(0, jth);
data.set(this.data.size() - 1, ith);
int rv = this.data.remove(this.data.size() - 1);
int lci = 2 * 0 + 1;
int rci = 2 * 0 + 2;
int mini = 0;
if (lci < this.data.size() && data.get(lci) < data.get(mini)) {
mini = lci;
}
if (rci < this.data.size() && data.get(rci) < data.get(mini)) {
mini = rci;
}
if (mini != 0) {
swap(mini, 0);
downheapify(mini);
}
return rv;
} | public int remove() {
int ith = data.get(0);
int jth = data.get(this.data.size() - 1);
data.set(0, jth);
data.set(this.data.size() - 1, ith);
int rv = this.data.remove(this.data.size() - 1);
<DeepExtract>
int lci = 2 * 0 + 1;
int rci = 2 * 0 + 2;
int mini = 0;
if (lci < this.data.size() && data.get(lci) < data.get(mini)) {
mini = lci;
}
if (rci < this.data.size() && data.get(rci) < data.get(mini)) {
mini = rci;
}
if (mini != 0) {
swap(mini, 0);
downheapify(mini);
}
</DeepExtract>
return rv;
} | JavaNagarroBootcampJan21 | positive | 3,025 |
final void readNumber() {
int pos = this.pos;
int startFlag = pos;
byte ch = sql[pos];
boolean has = true;
if (ch == '-' || ch == '+') {
pos += 1;
ch = sql[pos];
}
while ('0' <= ch && ch <= '9' && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
boolean isDouble = false;
if ((ch == '.') && has) {
if (sql[pos + 1] == '.') {
this.pos = pos - 1;
limitNumberCollector(startFlag, this.pos);
return;
}
pos += 2;
ch = sql[pos];
isDouble = true;
while ('0' <= ch && ch <= '9' && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
}
if ((ch == 'e' || ch == 'E') && has) {
pos += 2;
ch = sql[pos];
if (ch == '+' || ch == '-') {
pos += 2;
ch = sql[pos];
}
while (('0' <= ch && ch <= '9') && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
isDouble = true;
}
this.pos = has ? pos - 1 : pos;
if (isDouble) {
} else {
}
System.out.println(new String(sql, startFlag, this.pos - startFlag));
} | final void readNumber() {
int pos = this.pos;
int startFlag = pos;
byte ch = sql[pos];
boolean has = true;
if (ch == '-' || ch == '+') {
pos += 1;
ch = sql[pos];
}
while ('0' <= ch && ch <= '9' && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
boolean isDouble = false;
if ((ch == '.') && has) {
if (sql[pos + 1] == '.') {
this.pos = pos - 1;
limitNumberCollector(startFlag, this.pos);
return;
}
pos += 2;
ch = sql[pos];
isDouble = true;
while ('0' <= ch && ch <= '9' && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
}
if ((ch == 'e' || ch == 'E') && has) {
pos += 2;
ch = sql[pos];
if (ch == '+' || ch == '-') {
pos += 2;
ch = sql[pos];
}
while (('0' <= ch && ch <= '9') && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
isDouble = true;
}
this.pos = has ? pos - 1 : pos;
if (isDouble) {
} else {
}
<DeepExtract>
System.out.println(new String(sql, startFlag, this.pos - startFlag));
</DeepExtract>
} | SQLparser | positive | 3,026 |
public Criteria andRqzNotEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "rqz" + " cannot be null");
}
criteria.add(new Criterion("rqz <>", value));
return (Criteria) this;
} | public Criteria andRqzNotEqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "rqz" + " cannot be null");
}
criteria.add(new Criterion("rqz <>", value));
</DeepExtract>
return (Criteria) this;
} | einvoice | positive | 3,027 |
private static String connectorAddress(int pid) throws IOException {
VirtualMachine vm;
try {
vm = VirtualMachine.attach(String.valueOf(pid));
} catch (AttachNotSupportedException ex) {
throw failed("VM does not support attach operation", ex);
} catch (IOException ex) {
throw failed("VM attach failed", ex);
}
String address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
final Properties systemProperties = vm.getSystemProperties();
List<String> diag = new ArrayList<String>(3);
try {
Method method = VirtualMachine.class.getMethod("startLocalManagementAgent");
return (String) method.invoke(vm);
} catch (NoSuchMethodException ex) {
diag.add("VirtualMachine.startLocalManagementAgent not supported");
} catch (InvocationTargetException ex) {
throw new AssertionError(ex);
} catch (IllegalAccessException ex) {
throw new AssertionError(ex);
}
try {
Class<?> hsvm = Class.forName("sun.tools.attach.HotSpotVirtualMachine");
if (hsvm.isInstance(vm)) {
Method method = hsvm.getMethod("executeJCmd", String.class);
InputStream in = (InputStream) method.invoke(vm, "ManagementAgent.start_local");
in.close();
address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("jcmd ManagementAgent.start_local succeeded");
}
} catch (ClassNotFoundException e) {
diag.add("not a HotSpot VM - jcmd likely unsupported");
} catch (NoSuchMethodException e) {
diag.add("HotSpot VM with no jcmd support");
} catch (InvocationTargetException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
String agentPath = systemProperties.getProperty("java.home") + File.separator + "lib" + File.separator + "management-agent.jar";
if (new File(agentPath).exists()) {
try {
vm.loadAgent(agentPath);
} catch (AgentLoadException ex) {
throw failed("Unable to load agent", ex);
} catch (AgentInitializationException ex) {
throw failed("Unable to initialize agent", ex);
}
address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("management-agent.jar loaded successfully");
} else {
diag.add("management-agent.jar not found");
}
try {
Class<?> ibmVmClass = Class.forName("com.ibm.tools.attach.VirtualMachine");
Method attach = ibmVmClass.getMethod("attach", String.class);
Object ibmVm = attach.invoke(null, String.valueOf(pid));
Method method = ibmVm.getClass().getMethod("getSystemProperties");
method.setAccessible(true);
Properties props = (Properties) method.invoke(ibmVm);
address = props.getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("IBM JDK attach successful - no address provided");
} catch (ClassNotFoundException e) {
diag.add("not an IBM JDK - unable to create local JMX connection; try HOSTNAME:PORT instead");
} catch (NoSuchMethodException e) {
diag.add("IBM JDK does not seem to support attach: " + e.getMessage());
} catch (InvocationTargetException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
throw failedUnsupported("Unable to connect to JVM: " + diag.toString(), systemProperties);
} | private static String connectorAddress(int pid) throws IOException {
<DeepExtract>
VirtualMachine vm;
try {
vm = VirtualMachine.attach(String.valueOf(pid));
} catch (AttachNotSupportedException ex) {
throw failed("VM does not support attach operation", ex);
} catch (IOException ex) {
throw failed("VM attach failed", ex);
}
</DeepExtract>
String address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
final Properties systemProperties = vm.getSystemProperties();
List<String> diag = new ArrayList<String>(3);
try {
Method method = VirtualMachine.class.getMethod("startLocalManagementAgent");
return (String) method.invoke(vm);
} catch (NoSuchMethodException ex) {
diag.add("VirtualMachine.startLocalManagementAgent not supported");
} catch (InvocationTargetException ex) {
throw new AssertionError(ex);
} catch (IllegalAccessException ex) {
throw new AssertionError(ex);
}
try {
Class<?> hsvm = Class.forName("sun.tools.attach.HotSpotVirtualMachine");
if (hsvm.isInstance(vm)) {
Method method = hsvm.getMethod("executeJCmd", String.class);
InputStream in = (InputStream) method.invoke(vm, "ManagementAgent.start_local");
in.close();
address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("jcmd ManagementAgent.start_local succeeded");
}
} catch (ClassNotFoundException e) {
diag.add("not a HotSpot VM - jcmd likely unsupported");
} catch (NoSuchMethodException e) {
diag.add("HotSpot VM with no jcmd support");
} catch (InvocationTargetException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
String agentPath = systemProperties.getProperty("java.home") + File.separator + "lib" + File.separator + "management-agent.jar";
if (new File(agentPath).exists()) {
try {
vm.loadAgent(agentPath);
} catch (AgentLoadException ex) {
throw failed("Unable to load agent", ex);
} catch (AgentInitializationException ex) {
throw failed("Unable to initialize agent", ex);
}
address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("management-agent.jar loaded successfully");
} else {
diag.add("management-agent.jar not found");
}
try {
Class<?> ibmVmClass = Class.forName("com.ibm.tools.attach.VirtualMachine");
Method attach = ibmVmClass.getMethod("attach", String.class);
Object ibmVm = attach.invoke(null, String.valueOf(pid));
Method method = ibmVm.getClass().getMethod("getSystemProperties");
method.setAccessible(true);
Properties props = (Properties) method.invoke(ibmVm);
address = props.getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("IBM JDK attach successful - no address provided");
} catch (ClassNotFoundException e) {
diag.add("not an IBM JDK - unable to create local JMX connection; try HOSTNAME:PORT instead");
} catch (NoSuchMethodException e) {
diag.add("IBM JDK does not seem to support attach: " + e.getMessage());
} catch (InvocationTargetException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
throw failedUnsupported("Unable to connect to JVM: " + diag.toString(), systemProperties);
} | dumpling | positive | 3,028 |
@Override
protected void refreshVisuals() {
List<Point> bendpoints = ((ElementConnection) getModel()).getBendpoints();
List<Point> constraint = new ArrayList<Point>();
for (int i = 0; i < bendpoints.size(); ++i) {
constraint.add(new AbsoluteBendpoint(bendpoints.get(i)));
}
getConnectionFigure().setRoutingConstraint(constraint);
} | @Override
protected void refreshVisuals() {
<DeepExtract>
List<Point> bendpoints = ((ElementConnection) getModel()).getBendpoints();
List<Point> constraint = new ArrayList<Point>();
for (int i = 0; i < bendpoints.size(); ++i) {
constraint.add(new AbsoluteBendpoint(bendpoints.get(i)));
}
getConnectionFigure().setRoutingConstraint(constraint);
</DeepExtract>
} | tbbpm-designer | positive | 3,029 |
@Override
public void postAsync() {
if (TMLog.isDebug()) {
if (eventIds == null) {
throw new IllegalStateException("plz call registerEvents(int ...) or generateEventId before task post ");
}
}
preferredThread = RunningThread.BACKGROUND_THREAD;
} | @Override
public void postAsync() {
<DeepExtract>
if (TMLog.isDebug()) {
if (eventIds == null) {
throw new IllegalStateException("plz call registerEvents(int ...) or generateEventId before task post ");
}
}
</DeepExtract>
preferredThread = RunningThread.BACKGROUND_THREAD;
} | TaskManager | positive | 3,030 |
@Override
public void setImageBitmap(Bitmap bm) {
super.setImageBitmap(bm);
if (mDisableCircularTransformation) {
mBitmap = null;
} else {
mBitmap = getBitmapFromDrawable(getDrawable());
}
setup();
} | @Override
public void setImageBitmap(Bitmap bm) {
super.setImageBitmap(bm);
<DeepExtract>
if (mDisableCircularTransformation) {
mBitmap = null;
} else {
mBitmap = getBitmapFromDrawable(getDrawable());
}
setup();
</DeepExtract>
} | ShopSystem_2_App | positive | 3,031 |
public void testParseGtk20WithNoErrors() throws IOException {
assumeNotNull(System.getenv("VALA_HOME"));
PsiFile file = parseFile("gtk+-2.0.vapi");
assertThat("gtk+-2.0.vapi" + " had parse errors", file, hasNoErrors());
} | public void testParseGtk20WithNoErrors() throws IOException {
<DeepExtract>
assumeNotNull(System.getenv("VALA_HOME"));
PsiFile file = parseFile("gtk+-2.0.vapi");
assertThat("gtk+-2.0.vapi" + " had parse errors", file, hasNoErrors());
</DeepExtract>
} | vala-intellij-plugin | positive | 3,032 |
@Override
protected void onPause() {
mHandler = null;
super.onPause();
} | @Override
protected void onPause() {
<DeepExtract>
mHandler = null;
</DeepExtract>
super.onPause();
} | AndroidDemoProjects | positive | 3,033 |
@Override
public void onErrorResponse(VolleyError error) {
tracks = true;
if (tracks && count == 0) {
DatabaseManager dbManager = DatabaseManager.getInstance();
dbManager.clearDatabase();
dbManager.performInsertQueries(queries);
if (version != 1) {
}
if (mCallback != null) {
mCallback.onDataLoaded();
}
}
} | @Override
public void onErrorResponse(VolleyError error) {
tracks = true;
<DeepExtract>
if (tracks && count == 0) {
DatabaseManager dbManager = DatabaseManager.getInstance();
dbManager.clearDatabase();
dbManager.performInsertQueries(queries);
if (version != 1) {
}
if (mCallback != null) {
mCallback.onDataLoaded();
}
}
</DeepExtract>
} | ots15-companion | positive | 3,035 |
private void updateTone(float vs) {
if (vs >= minLiftThreshold) {
if (vs > maxLiftThreshold)
vs = maxLiftThreshold;
beepHz = interpolate(minLiftThreshold, maxLiftThreshold, minLiftHz, maxLiftHz, vs);
curTone = liftTone;
} else if (vs <= -minSinkThreshold) {
if (vs < -maxSinkThreshold)
vs = maxSinkThreshold;
beepHz = interpolate(minSinkThreshold, maxSinkThreshold, minSinkHz, maxSinkHz, -vs);
curTone = sinkTone;
} else
beepHz = -1f;
beepDelayMsec = (int) (1000 / beepHz);
Log.d(TAG, "vs=" + vs + " -> hz=" + beepHz + " delay=" + beepDelayMsec);
if (beepDelayMsec > 0) {
if (!isPlaying) {
isPlaying = true;
curTone.play();
handler.postDelayed(this, beepDelayMsec);
}
}
} | private void updateTone(float vs) {
if (vs >= minLiftThreshold) {
if (vs > maxLiftThreshold)
vs = maxLiftThreshold;
beepHz = interpolate(minLiftThreshold, maxLiftThreshold, minLiftHz, maxLiftHz, vs);
curTone = liftTone;
} else if (vs <= -minSinkThreshold) {
if (vs < -maxSinkThreshold)
vs = maxSinkThreshold;
beepHz = interpolate(minSinkThreshold, maxSinkThreshold, minSinkHz, maxSinkHz, -vs);
curTone = sinkTone;
} else
beepHz = -1f;
beepDelayMsec = (int) (1000 / beepHz);
Log.d(TAG, "vs=" + vs + " -> hz=" + beepHz + " delay=" + beepDelayMsec);
<DeepExtract>
if (beepDelayMsec > 0) {
if (!isPlaying) {
isPlaying = true;
curTone.play();
handler.postDelayed(this, beepDelayMsec);
}
}
</DeepExtract>
} | Gaggle | positive | 3,036 |
public Criteria andRefreshTokenKeyGreaterThan(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "refreshTokenKey" + " cannot be null");
}
criteria.add(new Criterion("refresh_token_key >", value));
return (Criteria) this;
} | public Criteria andRefreshTokenKeyGreaterThan(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "refreshTokenKey" + " cannot be null");
}
criteria.add(new Criterion("refresh_token_key >", value));
</DeepExtract>
return (Criteria) this;
} | oauth4j | positive | 3,038 |
@Override
public Number getResult(PercentageContext context) {
return getSumOfDataOne() / getSumOfDataTwo();
} | @Override
public Number getResult(PercentageContext context) {
<DeepExtract>
return getSumOfDataOne() / getSumOfDataTwo();
</DeepExtract>
} | ZK_Practice | positive | 3,039 |
public boolean containsValue(Object value) {
return (value == null ? v == null : value.equals(v));
} | public boolean containsValue(Object value) {
<DeepExtract>
return (value == null ? v == null : value.equals(v));
</DeepExtract>
} | javancss | positive | 3,040 |
@Override
public void vmLaunched(VM vm) {
idleVms.add(vm);
if (!idleVms.contains(vm)) {
return;
}
LinkedList<Task> vmqueue = vmQueues.get(vm);
Task task = vmqueue.peek();
if (task == null) {
getProvisioner().terminateVM(vm);
} else {
if (readyJobs.containsKey(task)) {
Job next = readyJobs.get(task);
submitJob(vm, next);
}
}
} | @Override
public void vmLaunched(VM vm) {
idleVms.add(vm);
<DeepExtract>
if (!idleVms.contains(vm)) {
return;
}
LinkedList<Task> vmqueue = vmQueues.get(vm);
Task task = vmqueue.peek();
if (task == null) {
getProvisioner().terminateVM(vm);
} else {
if (readyJobs.containsKey(task)) {
Job next = readyJobs.get(task);
submitJob(vm, next);
}
}
</DeepExtract>
} | cloudworkflowsimulator | positive | 3,041 |
private void fixHolesAndTryAssignmentRepair(HbckInfo hbi, String msg) throws IOException, KeeperException, InterruptedException {
LOG.info("Patching hbase:meta with with .regioninfo: " + hbi.getHdfsHRI());
int numReplicas = admin.getDescriptor(hbi.getTableName()).getRegionReplication();
HBaseFsckRepair.fixMetaHoleOnlineAndAddReplicas(getConf(), hbi.getHdfsHRI(), admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet(), numReplicas);
if (shouldFixAssignments()) {
errors.print(msg);
undeployRegions(hbi);
setShouldRerun();
RegionInfo hri = hbi.getHdfsHRI();
if (hri == null) {
hri = hbi.metaEntry;
}
HBaseFsckRepair.fixUnassigned(admin, hri);
HBaseFsckRepair.waitUntilAssigned(admin, hri);
if (hbi.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID) {
return;
}
int replicationCount = admin.getDescriptor(hri.getTable()).getRegionReplication();
for (int i = 1; i < replicationCount; i++) {
hri = RegionReplicaUtil.getRegionInfoForReplica(hri, i);
HbckInfo h = regionInfoMap.get(hri.getEncodedName());
if (h != null) {
undeployRegions(h);
h.setSkipChecks(true);
}
HBaseFsckRepair.fixUnassigned(admin, hri);
HBaseFsckRepair.waitUntilAssigned(admin, hri);
}
}
} | private void fixHolesAndTryAssignmentRepair(HbckInfo hbi, String msg) throws IOException, KeeperException, InterruptedException {
LOG.info("Patching hbase:meta with with .regioninfo: " + hbi.getHdfsHRI());
int numReplicas = admin.getDescriptor(hbi.getTableName()).getRegionReplication();
HBaseFsckRepair.fixMetaHoleOnlineAndAddReplicas(getConf(), hbi.getHdfsHRI(), admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet(), numReplicas);
<DeepExtract>
if (shouldFixAssignments()) {
errors.print(msg);
undeployRegions(hbi);
setShouldRerun();
RegionInfo hri = hbi.getHdfsHRI();
if (hri == null) {
hri = hbi.metaEntry;
}
HBaseFsckRepair.fixUnassigned(admin, hri);
HBaseFsckRepair.waitUntilAssigned(admin, hri);
if (hbi.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID) {
return;
}
int replicationCount = admin.getDescriptor(hri.getTable()).getRegionReplication();
for (int i = 1; i < replicationCount; i++) {
hri = RegionReplicaUtil.getRegionInfoForReplica(hri, i);
HbckInfo h = regionInfoMap.get(hri.getEncodedName());
if (h != null) {
undeployRegions(h);
h.setSkipChecks(true);
}
HBaseFsckRepair.fixUnassigned(admin, hri);
HBaseFsckRepair.waitUntilAssigned(admin, hri);
}
}
</DeepExtract>
} | hbase-operator-tools | positive | 3,042 |
private void adjustDayInMonthIfNeeded(UmmalquraCalendar calendar) {
int day = calendar.get(UmmalquraCalendar.DAY_OF_MONTH);
int daysInMonth = calendar.getActualMaximum(UmmalquraCalendar.DAY_OF_MONTH);
if (day > daysInMonth) {
calendar.set(UmmalquraCalendar.DAY_OF_MONTH, daysInMonth);
}
if (!selectableDays.isEmpty()) {
UmmalquraCalendar newCalendar = null;
UmmalquraCalendar higher = selectableDays.ceiling(calendar);
UmmalquraCalendar lower = selectableDays.lower(calendar);
if (higher == null && lower != null)
newCalendar = lower;
else if (lower == null && higher != null)
newCalendar = higher;
if (newCalendar != null || higher == null) {
newCalendar = newCalendar == null ? calendar : newCalendar;
newCalendar.setTimeZone(getTimeZone());
calendar.setTimeInMillis(newCalendar.getTimeInMillis());
return;
}
long highDistance = Math.abs(higher.getTimeInMillis() - calendar.getTimeInMillis());
long lowDistance = Math.abs(calendar.getTimeInMillis() - lower.getTimeInMillis());
if (lowDistance < highDistance)
calendar.setTimeInMillis(lower.getTimeInMillis());
else
calendar.setTimeInMillis(higher.getTimeInMillis());
return;
}
if (!disabledDays.isEmpty()) {
UmmalquraCalendar forwardDate = (UmmalquraCalendar) calendar.clone();
UmmalquraCalendar backwardDate = (UmmalquraCalendar) calendar.clone();
while (isDisabled(forwardDate) && isDisabled(backwardDate)) {
forwardDate.add(UmmalquraCalendar.DAY_OF_MONTH, 1);
backwardDate.add(UmmalquraCalendar.DAY_OF_MONTH, -1);
}
if (!isDisabled(backwardDate)) {
calendar.setTimeInMillis(backwardDate.getTimeInMillis());
return;
}
if (!isDisabled(forwardDate)) {
calendar.setTimeInMillis(forwardDate.getTimeInMillis());
return;
}
}
if (isBeforeMin(calendar)) {
calendar.setTimeInMillis(mMinDate.getTimeInMillis());
return;
}
if (isAfterMax(calendar)) {
calendar.setTimeInMillis(mMaxDate.getTimeInMillis());
return;
}
} | private void adjustDayInMonthIfNeeded(UmmalquraCalendar calendar) {
int day = calendar.get(UmmalquraCalendar.DAY_OF_MONTH);
int daysInMonth = calendar.getActualMaximum(UmmalquraCalendar.DAY_OF_MONTH);
if (day > daysInMonth) {
calendar.set(UmmalquraCalendar.DAY_OF_MONTH, daysInMonth);
}
<DeepExtract>
if (!selectableDays.isEmpty()) {
UmmalquraCalendar newCalendar = null;
UmmalquraCalendar higher = selectableDays.ceiling(calendar);
UmmalquraCalendar lower = selectableDays.lower(calendar);
if (higher == null && lower != null)
newCalendar = lower;
else if (lower == null && higher != null)
newCalendar = higher;
if (newCalendar != null || higher == null) {
newCalendar = newCalendar == null ? calendar : newCalendar;
newCalendar.setTimeZone(getTimeZone());
calendar.setTimeInMillis(newCalendar.getTimeInMillis());
return;
}
long highDistance = Math.abs(higher.getTimeInMillis() - calendar.getTimeInMillis());
long lowDistance = Math.abs(calendar.getTimeInMillis() - lower.getTimeInMillis());
if (lowDistance < highDistance)
calendar.setTimeInMillis(lower.getTimeInMillis());
else
calendar.setTimeInMillis(higher.getTimeInMillis());
return;
}
if (!disabledDays.isEmpty()) {
UmmalquraCalendar forwardDate = (UmmalquraCalendar) calendar.clone();
UmmalquraCalendar backwardDate = (UmmalquraCalendar) calendar.clone();
while (isDisabled(forwardDate) && isDisabled(backwardDate)) {
forwardDate.add(UmmalquraCalendar.DAY_OF_MONTH, 1);
backwardDate.add(UmmalquraCalendar.DAY_OF_MONTH, -1);
}
if (!isDisabled(backwardDate)) {
calendar.setTimeInMillis(backwardDate.getTimeInMillis());
return;
}
if (!isDisabled(forwardDate)) {
calendar.setTimeInMillis(forwardDate.getTimeInMillis());
return;
}
}
if (isBeforeMin(calendar)) {
calendar.setTimeInMillis(mMinDate.getTimeInMillis());
return;
}
if (isAfterMax(calendar)) {
calendar.setTimeInMillis(mMaxDate.getTimeInMillis());
return;
}
</DeepExtract>
} | HijriDatePicker | positive | 3,043 |
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
View toolbarView = activity.findViewById(R.id.toolbar);
int toolbarHeight = toolbarView.getHeight();
final Scrollable scrollable = getCurrentScrollable();
if (scrollable == null) {
return;
}
int scrollY = scrollable.getCurrentScrollY();
if (scrollState == ScrollState.DOWN) {
showToolbar();
} else if (scrollState == ScrollState.UP) {
if (toolbarHeight <= scrollY - hideThreshold) {
hideToolbar();
} else {
showToolbar();
}
}
} | @Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
<DeepExtract>
View toolbarView = activity.findViewById(R.id.toolbar);
int toolbarHeight = toolbarView.getHeight();
final Scrollable scrollable = getCurrentScrollable();
if (scrollable == null) {
return;
}
int scrollY = scrollable.getCurrentScrollY();
if (scrollState == ScrollState.DOWN) {
showToolbar();
} else if (scrollState == ScrollState.UP) {
if (toolbarHeight <= scrollY - hideThreshold) {
hideToolbar();
} else {
showToolbar();
}
}
</DeepExtract>
} | moviedb-android | positive | 3,044 |
private InterfaceHttpData findMultipartDelimiter(String delimiter, MultiPartStatus dispositionStatus, MultiPartStatus closeDelimiterStatus) {
int readerIndex = undecodedChunk.readerIndex();
try {
skipControlCharacters(undecodedChunk);
} catch (NotEnoughDataDecoderException ignored) {
undecodedChunk.readerIndex(readerIndex);
return null;
}
if (!undecodedChunk.isReadable()) {
return false;
}
byte nextByte = undecodedChunk.readByte();
if (nextByte == HttpConstants.CR) {
if (!undecodedChunk.isReadable()) {
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1);
return false;
}
nextByte = undecodedChunk.readByte();
if (nextByte == HttpConstants.LF) {
return true;
}
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 2);
return false;
}
if (nextByte == HttpConstants.LF) {
return true;
}
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1);
return false;
try {
newline = readDelimiter(undecodedChunk, delimiter);
} catch (NotEnoughDataDecoderException ignored) {
undecodedChunk.readerIndex(readerIndex);
return null;
}
if (newline.equals(delimiter)) {
currentStatus = dispositionStatus;
return decodeMultipart(dispositionStatus);
}
if (newline.equals(delimiter + "--")) {
currentStatus = closeDelimiterStatus;
if (currentStatus == MultiPartStatus.HEADERDELIMITER) {
currentFieldAttributes = null;
return decodeMultipart(MultiPartStatus.HEADERDELIMITER);
}
return null;
}
undecodedChunk.readerIndex(readerIndex);
throw new ErrorDataDecoderException("No Multipart delimiter found");
} | private InterfaceHttpData findMultipartDelimiter(String delimiter, MultiPartStatus dispositionStatus, MultiPartStatus closeDelimiterStatus) {
int readerIndex = undecodedChunk.readerIndex();
try {
skipControlCharacters(undecodedChunk);
} catch (NotEnoughDataDecoderException ignored) {
undecodedChunk.readerIndex(readerIndex);
return null;
}
<DeepExtract>
if (!undecodedChunk.isReadable()) {
return false;
}
byte nextByte = undecodedChunk.readByte();
if (nextByte == HttpConstants.CR) {
if (!undecodedChunk.isReadable()) {
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1);
return false;
}
nextByte = undecodedChunk.readByte();
if (nextByte == HttpConstants.LF) {
return true;
}
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 2);
return false;
}
if (nextByte == HttpConstants.LF) {
return true;
}
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1);
return false;
</DeepExtract>
try {
newline = readDelimiter(undecodedChunk, delimiter);
} catch (NotEnoughDataDecoderException ignored) {
undecodedChunk.readerIndex(readerIndex);
return null;
}
if (newline.equals(delimiter)) {
currentStatus = dispositionStatus;
return decodeMultipart(dispositionStatus);
}
if (newline.equals(delimiter + "--")) {
currentStatus = closeDelimiterStatus;
if (currentStatus == MultiPartStatus.HEADERDELIMITER) {
currentFieldAttributes = null;
return decodeMultipart(MultiPartStatus.HEADERDELIMITER);
}
return null;
}
undecodedChunk.readerIndex(readerIndex);
throw new ErrorDataDecoderException("No Multipart delimiter found");
} | dorado | positive | 3,045 |
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
mMeasureSpecHeight = View.MeasureSpec.getSize(heightMeasureSpec);
int newWidthMeasureSpec;
if (mCalendarViewPagerWidth == SIZE_UNSPECIFIED) {
newWidthMeasureSpec = widthMeasureSpec;
}
final int mode = View.MeasureSpec.getMode(widthMeasureSpec);
int smallestScreenWidthDp = getResources().getConfiguration().smallestScreenWidthDp;
int layoutWidth;
if (mode == MeasureSpec.AT_MOST) {
if (smallestScreenWidthDp >= 600) {
layoutWidth = getResources().getDimensionPixelSize(R.dimen.sesl_date_picker_dialog_min_width);
} else {
layoutWidth = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) smallestScreenWidthDp, getResources().getDisplayMetrics()) + 0.5f);
}
} else {
layoutWidth = View.MeasureSpec.getSize(widthMeasureSpec);
}
switch(mode) {
case MeasureSpec.AT_MOST:
if (smallestScreenWidthDp >= 600 && mLayoutMode == LAYOUT_MODE_DEFAULT) {
mCalendarViewPagerWidth = layoutWidth - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = layoutWidth - (mCalendarViewMargin * 2);
} else {
mCalendarViewPagerWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
}
newWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(layoutWidth, MeasureSpec.EXACTLY);
case MeasureSpec.UNSPECIFIED:
newWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(mCalendarViewPagerWidth, MeasureSpec.EXACTLY);
case MeasureSpec.EXACTLY:
if (smallestScreenWidthDp >= 600 && mLayoutMode == LAYOUT_MODE_DEFAULT) {
mCalendarViewPagerWidth = layoutWidth - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = layoutWidth - (mCalendarViewMargin * 2);
} else {
mCalendarViewPagerWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
}
newWidthMeasureSpec = widthMeasureSpec;
}
throw new IllegalArgumentException("Unknown measure mode: " + mode);
if (mIsFirstMeasure || mOldCalendarViewPagerWidth != mCalendarViewPagerWidth) {
mIsFirstMeasure = false;
mOldCalendarViewPagerWidth = mCalendarViewPagerWidth;
if (mCustomButtonLayout != null) {
mCustomButtonLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mCalendarHeaderLayoutHeight));
}
mCalendarHeaderLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mCalendarHeaderLayoutHeight));
mDayOfTheWeekLayout.setLayoutParams(new LinearLayout.LayoutParams(mDayOfTheWeekLayoutWidth, mDayOfTheWeekLayoutHeight));
mDayOfTheWeekView.setLayoutParams(new LinearLayout.LayoutParams(mDayOfTheWeekLayoutWidth, mDayOfTheWeekLayoutHeight));
mCalendarViewPager.setLayoutParams(new LinearLayout.LayoutParams(mCalendarViewPagerWidth, mCalendarViewPagerHeight));
mPickerView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mPickerViewHeight));
if (mIsRTL && mIsConfigurationChanged) {
mCalendarViewPager.seslSetConfigurationChanged(true);
}
mFirstBlankSpace.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mFirstBlankSpaceHeight));
mSecondBlankSpace.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mSecondBlankSpaceHeight));
}
super.onMeasure(newWidthMeasureSpec, heightMeasureSpec);
} | @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
mMeasureSpecHeight = View.MeasureSpec.getSize(heightMeasureSpec);
<DeepExtract>
int newWidthMeasureSpec;
if (mCalendarViewPagerWidth == SIZE_UNSPECIFIED) {
newWidthMeasureSpec = widthMeasureSpec;
}
final int mode = View.MeasureSpec.getMode(widthMeasureSpec);
int smallestScreenWidthDp = getResources().getConfiguration().smallestScreenWidthDp;
int layoutWidth;
if (mode == MeasureSpec.AT_MOST) {
if (smallestScreenWidthDp >= 600) {
layoutWidth = getResources().getDimensionPixelSize(R.dimen.sesl_date_picker_dialog_min_width);
} else {
layoutWidth = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) smallestScreenWidthDp, getResources().getDisplayMetrics()) + 0.5f);
}
} else {
layoutWidth = View.MeasureSpec.getSize(widthMeasureSpec);
}
switch(mode) {
case MeasureSpec.AT_MOST:
if (smallestScreenWidthDp >= 600 && mLayoutMode == LAYOUT_MODE_DEFAULT) {
mCalendarViewPagerWidth = layoutWidth - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = layoutWidth - (mCalendarViewMargin * 2);
} else {
mCalendarViewPagerWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
}
newWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(layoutWidth, MeasureSpec.EXACTLY);
case MeasureSpec.UNSPECIFIED:
newWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(mCalendarViewPagerWidth, MeasureSpec.EXACTLY);
case MeasureSpec.EXACTLY:
if (smallestScreenWidthDp >= 600 && mLayoutMode == LAYOUT_MODE_DEFAULT) {
mCalendarViewPagerWidth = layoutWidth - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = layoutWidth - (mCalendarViewMargin * 2);
} else {
mCalendarViewPagerWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
}
newWidthMeasureSpec = widthMeasureSpec;
}
throw new IllegalArgumentException("Unknown measure mode: " + mode);
</DeepExtract>
if (mIsFirstMeasure || mOldCalendarViewPagerWidth != mCalendarViewPagerWidth) {
mIsFirstMeasure = false;
mOldCalendarViewPagerWidth = mCalendarViewPagerWidth;
if (mCustomButtonLayout != null) {
mCustomButtonLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mCalendarHeaderLayoutHeight));
}
mCalendarHeaderLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mCalendarHeaderLayoutHeight));
mDayOfTheWeekLayout.setLayoutParams(new LinearLayout.LayoutParams(mDayOfTheWeekLayoutWidth, mDayOfTheWeekLayoutHeight));
mDayOfTheWeekView.setLayoutParams(new LinearLayout.LayoutParams(mDayOfTheWeekLayoutWidth, mDayOfTheWeekLayoutHeight));
mCalendarViewPager.setLayoutParams(new LinearLayout.LayoutParams(mCalendarViewPagerWidth, mCalendarViewPagerHeight));
mPickerView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mPickerViewHeight));
if (mIsRTL && mIsConfigurationChanged) {
mCalendarViewPager.seslSetConfigurationChanged(true);
}
mFirstBlankSpace.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mFirstBlankSpaceHeight));
mSecondBlankSpace.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mSecondBlankSpaceHeight));
}
super.onMeasure(newWidthMeasureSpec, heightMeasureSpec);
} | SamsungOneUi | positive | 3,046 |
public static void updateMenuIconColor(Context context, MenuItem m) {
if (m.getIcon() != null) {
m.getIcon().clearColorFilter();
m.getIcon().setColorFilter(getThemeColorAttr(context, m.isEnabled() ? android.R.attr.textColorTertiary : R.attr.colorPrimaryDark), PorterDuff.Mode.SRC_ATOP);
}
} | public static void updateMenuIconColor(Context context, MenuItem m) {
<DeepExtract>
if (m.getIcon() != null) {
m.getIcon().clearColorFilter();
m.getIcon().setColorFilter(getThemeColorAttr(context, m.isEnabled() ? android.R.attr.textColorTertiary : R.attr.colorPrimaryDark), PorterDuff.Mode.SRC_ATOP);
}
</DeepExtract>
} | onpc | positive | 3,047 |
public static Map<String, Object> berrySmoothieColor(AALinearGradientDirection direction) {
return linearGradient(direction, new Object[][] { { 0, "#8E78FF" }, { 1, "#FC7D7B" } });
} | public static Map<String, Object> berrySmoothieColor(AALinearGradientDirection direction) {
<DeepExtract>
return linearGradient(direction, new Object[][] { { 0, "#8E78FF" }, { 1, "#FC7D7B" } });
</DeepExtract>
} | AAChartCore | positive | 3,048 |
public static String getSystemUrl(String value) {
Map<String, CodingSystem> urlMap = getUrlMap(Constants.CODING_SYSTEM_MAPPING);
if (StringUtils.startsWith(value, "http://") || StringUtils.startsWith(value, "https://") || StringUtils.startsWith(value, "urn")) {
return value;
} else if (value != null) {
CodingSystem system = urlMap.get(StringUtils.upperCase(value));
if (system != null) {
return system.getUrl();
}
}
return null;
} | public static String getSystemUrl(String value) {
<DeepExtract>
Map<String, CodingSystem> urlMap = getUrlMap(Constants.CODING_SYSTEM_MAPPING);
if (StringUtils.startsWith(value, "http://") || StringUtils.startsWith(value, "https://") || StringUtils.startsWith(value, "urn")) {
return value;
} else if (value != null) {
CodingSystem system = urlMap.get(StringUtils.upperCase(value));
if (system != null) {
return system.getUrl();
}
}
return null;
</DeepExtract>
} | hl7v2-fhir-converter | positive | 3,049 |
public static AlipayTradeCloseResponse tradeCloseToResponse(AlipayTradeCloseModel model) throws AlipayApiException {
AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();
request.setBizModel(model);
if (AliPayApiConfigKit.getAliPayApiConfig().isCertModel()) {
return certificateExecute(request);
} else {
return execute(request);
}
} | public static AlipayTradeCloseResponse tradeCloseToResponse(AlipayTradeCloseModel model) throws AlipayApiException {
AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();
request.setBizModel(model);
<DeepExtract>
if (AliPayApiConfigKit.getAliPayApiConfig().isCertModel()) {
return certificateExecute(request);
} else {
return execute(request);
}
</DeepExtract>
} | IJPay | positive | 3,050 |
@Override
public CompletionStage<MemcacheStatus> append(final String key, final V value, final long cas) {
requireNonNull(value);
final byte[] valueBytes = valueTranscoder.encode(value);
SetRequest request = new SetRequest(OpCode.APPEND, encodeKey(key, charset, maxKeyLength), valueBytes, 0, cas, 0);
CompletionStage<MemcacheStatus> future = rawMemcacheClient.send(request);
metrics.measureSetFuture(future);
trace(OpCode.APPEND, key, valueBytes, future);
return future;
} | @Override
public CompletionStage<MemcacheStatus> append(final String key, final V value, final long cas) {
<DeepExtract>
requireNonNull(value);
final byte[] valueBytes = valueTranscoder.encode(value);
SetRequest request = new SetRequest(OpCode.APPEND, encodeKey(key, charset, maxKeyLength), valueBytes, 0, cas, 0);
CompletionStage<MemcacheStatus> future = rawMemcacheClient.send(request);
metrics.measureSetFuture(future);
trace(OpCode.APPEND, key, valueBytes, future);
return future;
</DeepExtract>
} | folsom | positive | 3,051 |
public String getDeleteSql(String schemaName, String tableName, String[] pkNames) {
StringBuilder sql = new StringBuilder();
sql.append("delete from ").append(makeFullName(schemaName, tableName)).append(" where ");
int size = pkNames.length;
for (int i = 0; i < size; i++) {
sql.append(" ").append(getColumnName(pkNames[i])).append(" = ").append("? ");
if (i != size - 1) {
sql.append("and");
}
}
return sql.toString().intern();
} | public String getDeleteSql(String schemaName, String tableName, String[] pkNames) {
StringBuilder sql = new StringBuilder();
sql.append("delete from ").append(makeFullName(schemaName, tableName)).append(" where ");
<DeepExtract>
int size = pkNames.length;
for (int i = 0; i < size; i++) {
sql.append(" ").append(getColumnName(pkNames[i])).append(" = ").append("? ");
if (i != size - 1) {
sql.append("and");
}
}
</DeepExtract>
return sql.toString().intern();
} | yugong | positive | 3,052 |
@Override
public boolean mouseMoved(int screenX, int screenY) {
messages.add("mouseMoved: screenX(" + screenX + ") screenY(" + screenY + ")" + " time: " + System.currentTimeMillis());
if (messages.size > MESSAGE_MAX) {
messages.removeIndex(0);
}
return true;
} | @Override
public boolean mouseMoved(int screenX, int screenY) {
<DeepExtract>
messages.add("mouseMoved: screenX(" + screenX + ") screenY(" + screenY + ")" + " time: " + System.currentTimeMillis());
if (messages.size > MESSAGE_MAX) {
messages.removeIndex(0);
}
</DeepExtract>
return true;
} | libgdx-cookbook | positive | 3,053 |
public static void touchScreenMove(Context ctx, int x, int y) {
byte[] report = new byte[6];
report[0] = 0x04;
if (false) {
report[1] = 0x01;
}
if (true) {
report[1] += 0x02;
}
report[2] = Util.getLSB(x);
report[3] = Util.getMSB(x);
report[4] = Util.getLSB(y);
report[5] = Util.getMSB(y);
touchScreenReport(ctx, report);
} | public static void touchScreenMove(Context ctx, int x, int y) {
<DeepExtract>
byte[] report = new byte[6];
report[0] = 0x04;
if (false) {
report[1] = 0x01;
}
if (true) {
report[1] += 0x02;
}
report[2] = Util.getLSB(x);
report[3] = Util.getMSB(x);
report[4] = Util.getLSB(y);
report[5] = Util.getMSB(y);
touchScreenReport(ctx, report);
</DeepExtract>
} | InputStickAPI-Android | positive | 3,054 |
Z found(Entry<K, V> entry) {
throw new UnsupportedOperationException();
} | Z found(Entry<K, V> entry) {
<DeepExtract>
throw new UnsupportedOperationException();
</DeepExtract>
} | lsmtree | positive | 3,055 |
public static void validateChainHash(ByteString hash, String name) throws ValidationException {
if (hash == null) {
throw new ValidationException(String.format("Missing %s", name));
}
if (hash.size() != Globals.BLOCKCHAIN_HASH_LEN) {
throw new ValidationException(String.format("Unexpected length for %s. Expected %d, got %d", name, Globals.BLOCKCHAIN_HASH_LEN, hash.size()));
}
} | public static void validateChainHash(ByteString hash, String name) throws ValidationException {
<DeepExtract>
if (hash == null) {
throw new ValidationException(String.format("Missing %s", name));
}
if (hash.size() != Globals.BLOCKCHAIN_HASH_LEN) {
throw new ValidationException(String.format("Unexpected length for %s. Expected %d, got %d", name, Globals.BLOCKCHAIN_HASH_LEN, hash.size()));
}
</DeepExtract>
} | snowblossom | positive | 3,056 |
@Override
public void onReset(LoggerContext context) {
log.info("Initializing Logstash logging");
LogstashTcpSocketAppender logstashAppender = new LogstashTcpSocketAppender();
logstashAppender.setName("LOGSTASH");
logstashAppender.setContext(context);
String customFields = "{\"app_name\":\"" + appName + "\",\"app_port\":\"" + serverPort + "\"}";
LogstashEncoder logstashEncoder = new LogstashEncoder();
logstashEncoder.setCustomFields(customFields);
logstashAppender.addDestinations(new InetSocketAddress(jHipsterProperties.getLogging().getLogstash().getHost(), jHipsterProperties.getLogging().getLogstash().getPort()));
ShortenedThrowableConverter throwableConverter = new ShortenedThrowableConverter();
throwableConverter.setRootCauseFirst(true);
logstashEncoder.setThrowableConverter(throwableConverter);
logstashEncoder.setCustomFields(customFields);
logstashAppender.setEncoder(logstashEncoder);
logstashAppender.start();
AsyncAppender asyncLogstashAppender = new AsyncAppender();
asyncLogstashAppender.setContext(context);
asyncLogstashAppender.setName("ASYNC_LOGSTASH");
asyncLogstashAppender.setQueueSize(jHipsterProperties.getLogging().getLogstash().getQueueSize());
asyncLogstashAppender.addAppender(logstashAppender);
asyncLogstashAppender.start();
context.getLogger("ROOT").addAppender(asyncLogstashAppender);
} | @Override
public void onReset(LoggerContext context) {
<DeepExtract>
log.info("Initializing Logstash logging");
LogstashTcpSocketAppender logstashAppender = new LogstashTcpSocketAppender();
logstashAppender.setName("LOGSTASH");
logstashAppender.setContext(context);
String customFields = "{\"app_name\":\"" + appName + "\",\"app_port\":\"" + serverPort + "\"}";
LogstashEncoder logstashEncoder = new LogstashEncoder();
logstashEncoder.setCustomFields(customFields);
logstashAppender.addDestinations(new InetSocketAddress(jHipsterProperties.getLogging().getLogstash().getHost(), jHipsterProperties.getLogging().getLogstash().getPort()));
ShortenedThrowableConverter throwableConverter = new ShortenedThrowableConverter();
throwableConverter.setRootCauseFirst(true);
logstashEncoder.setThrowableConverter(throwableConverter);
logstashEncoder.setCustomFields(customFields);
logstashAppender.setEncoder(logstashEncoder);
logstashAppender.start();
AsyncAppender asyncLogstashAppender = new AsyncAppender();
asyncLogstashAppender.setContext(context);
asyncLogstashAppender.setName("ASYNC_LOGSTASH");
asyncLogstashAppender.setQueueSize(jHipsterProperties.getLogging().getLogstash().getQueueSize());
asyncLogstashAppender.addAppender(logstashAppender);
asyncLogstashAppender.start();
context.getLogger("ROOT").addAppender(asyncLogstashAppender);
</DeepExtract>
} | ionic-jhipster-example | positive | 3,057 |
private void addEmptyMandatoryExceptionMessage(DObject context, DFeature feature, EmptyMandatoryException eme) {
addMessages(Set.of(new DMessage(context, feature, DMessageType.error, "EMPTY_MANDATORY", eme.getMessage())));
} | private void addEmptyMandatoryExceptionMessage(DObject context, DFeature feature, EmptyMandatoryException eme) {
<DeepExtract>
addMessages(Set.of(new DMessage(context, feature, DMessageType.error, "EMPTY_MANDATORY", eme.getMessage())));
</DeepExtract>
} | DclareForMPS | positive | 3,058 |
public PolyElement<E> sub(Element e) {
PolyElement<E> element = (PolyElement<E>) e;
n = coefficients.size();
n1 = element.coefficients.size();
if (n > n1) {
big = this;
n = n1;
n1 = coefficients.size();
} else {
big = element;
}
int k = coefficients.size();
while (k < n1) {
coefficients.add((E) field.getTargetField().newElement());
k++;
}
while (k > n1) {
k--;
coefficients.remove(coefficients.size() - 1);
}
for (i = 0; i < n; i++) {
coefficients.get(i).sub(element.coefficients.get(i));
}
for (; i < n1; i++) {
if (big == this) {
coefficients.get(i).set(big.coefficients.get(i));
} else {
coefficients.get(i).set(big.coefficients.get(i)).negate();
}
}
int n = coefficients.size() - 1;
while (n >= 0) {
Element e0 = coefficients.get(n);
if (!e0.isZero())
return;
coefficients.remove(n);
n--;
}
return this;
} | public PolyElement<E> sub(Element e) {
PolyElement<E> element = (PolyElement<E>) e;
n = coefficients.size();
n1 = element.coefficients.size();
if (n > n1) {
big = this;
n = n1;
n1 = coefficients.size();
} else {
big = element;
}
int k = coefficients.size();
while (k < n1) {
coefficients.add((E) field.getTargetField().newElement());
k++;
}
while (k > n1) {
k--;
coefficients.remove(coefficients.size() - 1);
}
for (i = 0; i < n; i++) {
coefficients.get(i).sub(element.coefficients.get(i));
}
for (; i < n1; i++) {
if (big == this) {
coefficients.get(i).set(big.coefficients.get(i));
} else {
coefficients.get(i).set(big.coefficients.get(i)).negate();
}
}
<DeepExtract>
int n = coefficients.size() - 1;
while (n >= 0) {
Element e0 = coefficients.get(n);
if (!e0.isZero())
return;
coefficients.remove(n);
n--;
}
</DeepExtract>
return this;
} | jlbc | positive | 3,059 |
public void setupCropBounds() {
int height = (int) (mThisWidth / mTargetAspectRatio);
if (height > mThisHeight) {
int width = (int) (mThisHeight * mTargetAspectRatio);
int halfDiff = (mThisWidth - width) / 2;
mCropViewRect.set(getPaddingLeft() + halfDiff, getPaddingTop(), getPaddingLeft() + width + halfDiff, getPaddingTop() + mThisHeight);
} else {
int halfDiff = (mThisHeight - height) / 2;
mCropViewRect.set(getPaddingLeft(), getPaddingTop() + halfDiff, getPaddingLeft() + mThisWidth, getPaddingTop() + height + halfDiff);
}
if (mCallback != null) {
mCallback.onCropRectUpdated(mCropViewRect);
}
mCropGridCorners = RectUtils.getCornersFromRect(mCropViewRect);
mCropGridCenter = RectUtils.getCenterFromRect(mCropViewRect);
mGridPoints = null;
mCircularPath.reset();
mCircularPath.addCircle(mCropViewRect.centerX(), mCropViewRect.centerY(), Math.min(mCropViewRect.width(), mCropViewRect.height()) / 2.f, Path.Direction.CW);
} | public void setupCropBounds() {
int height = (int) (mThisWidth / mTargetAspectRatio);
if (height > mThisHeight) {
int width = (int) (mThisHeight * mTargetAspectRatio);
int halfDiff = (mThisWidth - width) / 2;
mCropViewRect.set(getPaddingLeft() + halfDiff, getPaddingTop(), getPaddingLeft() + width + halfDiff, getPaddingTop() + mThisHeight);
} else {
int halfDiff = (mThisHeight - height) / 2;
mCropViewRect.set(getPaddingLeft(), getPaddingTop() + halfDiff, getPaddingLeft() + mThisWidth, getPaddingTop() + height + halfDiff);
}
if (mCallback != null) {
mCallback.onCropRectUpdated(mCropViewRect);
}
<DeepExtract>
mCropGridCorners = RectUtils.getCornersFromRect(mCropViewRect);
mCropGridCenter = RectUtils.getCenterFromRect(mCropViewRect);
mGridPoints = null;
mCircularPath.reset();
mCircularPath.addCircle(mCropViewRect.centerX(), mCropViewRect.centerY(), Math.min(mCropViewRect.width(), mCropViewRect.height()) / 2.f, Path.Direction.CW);
</DeepExtract>
} | Matisse-Kotlin | positive | 3,060 |
private void printall(Node parent) {
Map<String, Integer> map = new HashMap<>();
if (parent == null) {
String s = "";
return s;
}
String s = "(";
s += printduplicates(parent.left, map);
s += parent.data;
s += printduplicates(parent.right, map);
s += ")";
if (map.containsKey(s) && map.get(s) == 1) {
int i = 0;
System.out.print(parent.data + " ");
}
if (map.containsKey(s)) {
map.replace(s, map.get(s) + 1);
} else {
map.put(s, 1);
}
return s;
System.out.println(map);
int flag = 0;
if (flag == 0) {
System.out.println(-1);
}
} | private void printall(Node parent) {
Map<String, Integer> map = new HashMap<>();
<DeepExtract>
if (parent == null) {
String s = "";
return s;
}
String s = "(";
s += printduplicates(parent.left, map);
s += parent.data;
s += printduplicates(parent.right, map);
s += ")";
if (map.containsKey(s) && map.get(s) == 1) {
int i = 0;
System.out.print(parent.data + " ");
}
if (map.containsKey(s)) {
map.replace(s, map.get(s) + 1);
} else {
map.put(s, 1);
}
return s;
</DeepExtract>
System.out.println(map);
int flag = 0;
if (flag == 0) {
System.out.println(-1);
}
} | Java-Solutions | positive | 3,061 |
public Criteria andTypeGreaterThan(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "type" + " cannot be null");
}
criteria.add(new Criterion("type >", value));
return (Criteria) this;
} | public Criteria andTypeGreaterThan(Integer value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "type" + " cannot be null");
}
criteria.add(new Criterion("type >", value));
</DeepExtract>
return (Criteria) this;
} | community | positive | 3,062 |
public Tuple decodeArgs(byte[][] topics, byte[] data) {
Object[] result = new Object[inputs.size()];
for (int i = 0, topicIndex = 0, dataIndex = 0; i < indexManifest.length; i++) {
if (indexManifest[i]) {
result[i] = decodeTopicsArray(topics)[topicIndex++];
} else {
result[i] = decodeData(data).get(dataIndex++);
}
}
return new Tuple(result);
} | public Tuple decodeArgs(byte[][] topics, byte[] data) {
<DeepExtract>
Object[] result = new Object[inputs.size()];
for (int i = 0, topicIndex = 0, dataIndex = 0; i < indexManifest.length; i++) {
if (indexManifest[i]) {
result[i] = decodeTopicsArray(topics)[topicIndex++];
} else {
result[i] = decodeData(data).get(dataIndex++);
}
}
return new Tuple(result);
</DeepExtract>
} | headlong | positive | 3,063 |
public Criteria andSyncScriptEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "syncScript" + " cannot be null");
}
criteria.add(new Criterion("sync_script =", value));
return (Criteria) this;
} | public Criteria andSyncScriptEqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "syncScript" + " cannot be null");
}
criteria.add(new Criterion("sync_script =", value));
</DeepExtract>
return (Criteria) this;
} | AnyMock | positive | 3,064 |
void zoomOut() {
renderer.zoomOut();
createCanvas(BASE_CANVAS_WIDTH * renderer.getRelativeScale(), BASE_CANVAS_HEIGHT * renderer.getRelativeScale());
renderer.setCanvas(fieldCanvas);
renderer.doDraw();
} | void zoomOut() {
renderer.zoomOut();
<DeepExtract>
createCanvas(BASE_CANVAS_WIDTH * renderer.getRelativeScale(), BASE_CANVAS_HEIGHT * renderer.getRelativeScale());
renderer.setCanvas(fieldCanvas);
renderer.doDraw();
</DeepExtract>
} | Vector-Pinball-Editor | positive | 3,065 |
@Test
public void insert1000() throws SQLException {
stat.executeUpdate("create table in1000 (a);");
PreparedStatement prep = conn.prepareStatement("insert into in1000 values (?);");
conn.setAutoCommit(false);
for (int i = 0; i < 1000; i++) {
prep.setInt(1, i);
prep.executeUpdate();
}
conn.commit();
ResultSet rs = stat.executeQuery("select count(a) from in1000;");
assertTrue(rs.next());
assertEquals(rs.getInt(1), 1000);
stat.close();
conn.close();
} | @Test
public void insert1000() throws SQLException {
stat.executeUpdate("create table in1000 (a);");
PreparedStatement prep = conn.prepareStatement("insert into in1000 values (?);");
conn.setAutoCommit(false);
for (int i = 0; i < 1000; i++) {
prep.setInt(1, i);
prep.executeUpdate();
}
conn.commit();
ResultSet rs = stat.executeQuery("select count(a) from in1000;");
assertTrue(rs.next());
assertEquals(rs.getInt(1), 1000);
<DeepExtract>
stat.close();
conn.close();
</DeepExtract>
} | spatialite4-jdbc | positive | 3,066 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.