before
stringlengths
33
3.21M
after
stringlengths
63
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
public removeSource_result getResult(I iface, removeSource_args args) throws org.apache.thrift.TException { removeSource_result result = new removeSource_result(); send_removeSource(args.sceneName, args.sourceName); recv_removeSource(); return result; }
public removeSource_result getResult(I iface, removeSource_args args) throws org.apache.thrift.TException { removeSource_result result = new removeSource_result(); <DeepExtract> send_removeSource(args.sceneName, args.sourceName); recv_removeSource(); </DeepExtract> return result; }
obs-video-scheduler
positive
4,179
public Criteria andNameIsNotNull() { if ("name is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("name is not null")); return (Criteria) this; }
public Criteria andNameIsNotNull() { <DeepExtract> if ("name is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("name is not null")); </DeepExtract> return (Criteria) this; }
flink-sql-computing-platform
positive
4,180
public static prototest.Ex.TireMaker parseFrom(java.io.InputStream input) throws java.io.IOException { prototest.Ex.Hobby result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); } return result; }
public static prototest.Ex.TireMaker parseFrom(java.io.InputStream input) throws java.io.IOException { <DeepExtract> prototest.Ex.Hobby result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); } return result; </DeepExtract> }
hive-protobuf
positive
4,181
public void setCurValue(int value) { if (mValue == value) { return; } if (mWrapSelectorWheel) { value = getWrappedSelectorIndex(value); } else { value = Math.max(value, mMinValue); value = Math.min(value, mMaxValue); } int previous = mValue; mValue = value; updateInputTextView(); if (false) { notifyChange(previous, value); } initializeSelectorWheelIndices(); invalidate(); }
public void setCurValue(int value) { <DeepExtract> if (mValue == value) { return; } if (mWrapSelectorWheel) { value = getWrappedSelectorIndex(value); } else { value = Math.max(value, mMinValue); value = Math.min(value, mMaxValue); } int previous = mValue; mValue = value; updateInputTextView(); if (false) { notifyChange(previous, value); } initializeSelectorWheelIndices(); invalidate(); </DeepExtract> }
qnscalesdk
positive
4,182
public void setup() { surface.setLocation(viewport_x, viewport_y); font = createFont("data/SourceCodePro-Regular.ttf", 12); release(); world = new DwWorld(this, 18); setParticleSpawnProperties(spawn_type); initScene(); frameRate(120); }
public void setup() { surface.setLocation(viewport_x, viewport_y); font = createFont("data/SourceCodePro-Regular.ttf", 12); <DeepExtract> release(); world = new DwWorld(this, 18); setParticleSpawnProperties(spawn_type); initScene(); </DeepExtract> frameRate(120); }
LiquidFunProcessing
positive
4,183
public void transformSelect(Cursor result) throws SQLiteException { columnNames = Arrays.asList(result.getColumnNames()); List<List<String>> result = new ArrayList<>(); final int numColumns = result.getColumnCount(); while (result.moveToNext()) { ArrayList<String> flatList = new ArrayList<>(); for (int column = 0; column < numColumns; column++) { switch(result.getType(column)) { case Cursor.FIELD_TYPE_NULL: flatList.add(null); break; case Cursor.FIELD_TYPE_INTEGER: flatList.add(String.valueOf(result.getLong(column))); break; case Cursor.FIELD_TYPE_FLOAT: flatList.add(String.valueOf(result.getDouble(column))); break; case Cursor.FIELD_TYPE_BLOB: flatList.add(blobToString(result.getBlob(column))); break; case Cursor.FIELD_TYPE_STRING: default: flatList.add(result.getString(column)); break; } } result.add(flatList); } return result; }
public void transformSelect(Cursor result) throws SQLiteException { columnNames = Arrays.asList(result.getColumnNames()); <DeepExtract> List<List<String>> result = new ArrayList<>(); final int numColumns = result.getColumnCount(); while (result.moveToNext()) { ArrayList<String> flatList = new ArrayList<>(); for (int column = 0; column < numColumns; column++) { switch(result.getType(column)) { case Cursor.FIELD_TYPE_NULL: flatList.add(null); break; case Cursor.FIELD_TYPE_INTEGER: flatList.add(String.valueOf(result.getLong(column))); break; case Cursor.FIELD_TYPE_FLOAT: flatList.add(String.valueOf(result.getDouble(column))); break; case Cursor.FIELD_TYPE_BLOB: flatList.add(blobToString(result.getBlob(column))); break; case Cursor.FIELD_TYPE_STRING: default: flatList.add(result.getString(column)); break; } } result.add(flatList); } return result; </DeepExtract> }
pandora
positive
4,184
@Override public void removeStaleIndices() { getIndexModel().deleteEdgeEndpoints(this, getIndexTs()); }
@Override public void removeStaleIndices() { <DeepExtract> getIndexModel().deleteEdgeEndpoints(this, getIndexTs()); </DeepExtract> }
hgraphdb
positive
4,186
private void setSurface(int id, Surface surface, SurfaceHolder surfaceHolder) { if (mSurfacesState.get() != SURFACE_STATE_INIT) throw new IllegalStateException("Can't set view when already attached. " + "Current state: " + mSurfacesState.get() + ", " + "mSurfaces[ID_VIDEO]: " + mSurfaceHelpers[ID_VIDEO] + " / " + mSurfaces[ID_VIDEO] + ", " + "mSurfaces[ID_SUBTITLES]: " + mSurfaceHelpers[ID_SUBTITLES] + " / " + mSurfaces[ID_SUBTITLES]); if (!surface.isValid() && surfaceHolder == null) throw new IllegalStateException("surface is not attached and holder is null"); final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.release(); mSurfaceHelpers[id] = new SurfaceHelper(id, surface, surfaceHolder); }
private void setSurface(int id, Surface surface, SurfaceHolder surfaceHolder) { <DeepExtract> if (mSurfacesState.get() != SURFACE_STATE_INIT) throw new IllegalStateException("Can't set view when already attached. " + "Current state: " + mSurfacesState.get() + ", " + "mSurfaces[ID_VIDEO]: " + mSurfaceHelpers[ID_VIDEO] + " / " + mSurfaces[ID_VIDEO] + ", " + "mSurfaces[ID_SUBTITLES]: " + mSurfaceHelpers[ID_SUBTITLES] + " / " + mSurfaces[ID_SUBTITLES]); </DeepExtract> if (!surface.isValid() && surfaceHolder == null) throw new IllegalStateException("surface is not attached and holder is null"); final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.release(); mSurfaceHelpers[id] = new SurfaceHelper(id, surface, surfaceHolder); }
libvlc-sdk-android
positive
4,189
public Criteria andBirthyearEqualTo(Date value) { if (value == null) { throw new RuntimeException("Value for " + "birthyear" + " cannot be null"); } addCriterion("birthYear =", new java.sql.Date(value.getTime()), "birthyear"); return (Criteria) this; }
public Criteria andBirthyearEqualTo(Date value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "birthyear" + " cannot be null"); } addCriterion("birthYear =", new java.sql.Date(value.getTime()), "birthyear"); </DeepExtract> return (Criteria) this; }
SpringBoot_EducationalMS
positive
4,190
public void keyReleased(java.awt.event.KeyEvent evt) { boolean tick = o.engine.isFunction(jTextFieldRst1.getText()); tickCross("Rst1", tick); }
public void keyReleased(java.awt.event.KeyEvent evt) { <DeepExtract> boolean tick = o.engine.isFunction(jTextFieldRst1.getText()); tickCross("Rst1", tick); </DeepExtract> }
8085simulator
positive
4,191
@Override public void onPageSelected(int position) { for (int i = 0; i < getChildCount(); i++) { View view = getChildAt(i); if (view instanceof TextView) { ((TextView) view).setTextColor(getResources().getColor(R.color.common_text_color)); } } View view = getChildAt(position); if (view instanceof TextView) { if (changeSkinModel != null) { ((TextView) view).setTextColor(changeSkinModel.getCardColor()); } else { ((TextView) view).setTextColor(getResources().getColor(R.color.skin_colorPrimary)); } } if (onPageChangeListener != null) { onPageChangeListener.onPageSelected(position); } }
@Override public void onPageSelected(int position) { for (int i = 0; i < getChildCount(); i++) { View view = getChildAt(i); if (view instanceof TextView) { ((TextView) view).setTextColor(getResources().getColor(R.color.common_text_color)); } } <DeepExtract> View view = getChildAt(position); if (view instanceof TextView) { if (changeSkinModel != null) { ((TextView) view).setTextColor(changeSkinModel.getCardColor()); } else { ((TextView) view).setTextColor(getResources().getColor(R.color.skin_colorPrimary)); } } </DeepExtract> if (onPageChangeListener != null) { onPageChangeListener.onPageSelected(position); } }
SoHOT
positive
4,192
@Override public void prepare() { if (mDataNotSet) return; super.calcMinMax(mFixedYValues); if (!mFixedYValues) { float space = Math.abs(Math.abs(Math.max(Math.abs(mYChartMax), Math.abs(mYChartMin))) / 100f * 20f); if (Math.abs(mYChartMax - mYChartMin) < 0.00001f) { if (Math.abs(mYChartMax) < 10f) space = 1f; else space = Math.abs(mYChartMax / 100f * 20f); } Log.i(LOG_TAG, "Space: " + space); if (mStartAtZero) { if (mYChartMax < 0) { mYChartMax = 0; mYChartMin = mYChartMin - space; } else { mYChartMin = 0; mYChartMax = mYChartMax + space; } } else { mYChartMin = mYChartMin - space / 2f; mYChartMax = mYChartMax + space / 2f; } } mDeltaY = Math.abs(mYChartMax - mYChartMin); float yMin = 0f; float yMax = 0f; if (mContentRect.width() > 10 && !isFullyZoomedOutY()) { PointD p1 = getValuesByTouchPoint(mContentRect.left, mContentRect.top); PointD p2 = getValuesByTouchPoint(mContentRect.left, mContentRect.bottom); if (!mInvertYAxis) { yMin = (float) p2.y; yMax = (float) p1.y; } else { if (!mStartAtZero) yMin = (float) Math.min(p1.y, p2.y); else yMin = 0; yMax = (float) Math.max(p1.y, p2.y); } } else { if (!mInvertYAxis) { yMin = mYChartMin; yMax = mYChartMax; } else { if (!mStartAtZero) yMin = (float) Math.min(mYChartMax, mYChartMin); else yMin = 0; yMax = (float) Math.max(mYChartMax, mYChartMin); } } int labelCount = mYLabels.getLabelCount(); double range = Math.abs(yMax - yMin); if (labelCount == 0 || range <= 0) { mYLabels.mEntries = new float[] {}; mYLabels.mEntryCount = 0; return; } double rawInterval = range / labelCount; double interval = Utils.roundToNextSignificant(rawInterval); double intervalMagnitude = Math.pow(10, (int) Math.log10(interval)); int intervalSigDigit = (int) (interval / intervalMagnitude); if (intervalSigDigit > 5) { interval = Math.floor(10 * intervalMagnitude); } if (mYLabels.isShowOnlyMinMaxEnabled()) { mYLabels.mEntryCount = 2; mYLabels.mEntries = new float[2]; mYLabels.mEntries[0] = mYChartMin; mYLabels.mEntries[1] = mYChartMax; } else { double first = Math.ceil(yMin / interval) * interval; double last = Utils.nextUp(Math.floor(yMax / interval) * interval); double f; int i; int n = 0; for (f = first; f <= last; f += interval) { ++n; } mYLabels.mEntryCount = n; if (mYLabels.mEntries.length < n) { mYLabels.mEntries = new float[n]; } for (f = first, i = 0; i < n; f += interval, ++i) { mYLabels.mEntries[i] = (float) f; } } if (interval < 1) { mYLabels.mDecimals = (int) Math.ceil(-Math.log10(interval)); } else { mYLabels.mDecimals = 0; } StringBuffer a = new StringBuffer(); int max = (int) Math.round(mCurrentData.getXValAverageLength() + mXLabels.getSpaceBetweenLabels()); for (int i = 0; i < max; i++) { a.append("h"); } mXLabels.mLabelWidth = Utils.calcTextWidth(mXLabelPaint, a.toString()); mXLabels.mLabelHeight = Utils.calcTextHeight(mXLabelPaint, "Q"); prepareLegend(); float legendRight = 0f, legendBottom = 0f; if (mDrawLegend && mLegend != null && mLegend.getPosition() != LegendPosition.NONE) { if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART || mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART_CENTER) { float spacing = Utils.convertDpToPixel(12f); legendRight = mLegend.getMaximumEntryLength(mLegendLabelPaint) + mLegend.getFormSize() + mLegend.getFormToTextSpace() + spacing; mLegendLabelPaint.setTextAlign(Align.LEFT); } else if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) { if (mXLabels.getPosition() == XLabelPosition.TOP) legendBottom = mLegendLabelPaint.getTextSize() * 3.5f; else { legendBottom = mLegendLabelPaint.getTextSize() * 2.5f; } } mLegend.setOffsetBottom(legendBottom); mLegend.setOffsetRight(legendRight); } float yleft = 0f, yright = 0f; String label = mYLabels.getLongestLabel(); float ylabelwidth = Utils.calcTextWidth(mYLabelPaint, label + mUnit + (mYChartMin < 0 ? "----" : "+++")); if (mDrawYLabels) { if (mYLabels.getPosition() == YLabelPosition.LEFT) { yleft = ylabelwidth; mYLabelPaint.setTextAlign(Align.RIGHT); } else if (mYLabels.getPosition() == YLabelPosition.RIGHT) { yright = ylabelwidth; mYLabelPaint.setTextAlign(Align.LEFT); } else if (mYLabels.getPosition() == YLabelPosition.BOTH_SIDED) { yright = ylabelwidth; yleft = ylabelwidth; } } float xtop = 0f, xbottom = 0f; float xlabelheight = Utils.calcTextHeight(mXLabelPaint, "Q") * 2f; if (mDrawXLabels) { if (mXLabels.getPosition() == XLabelPosition.BOTTOM) { xbottom = xlabelheight; } else if (mXLabels.getPosition() == XLabelPosition.TOP) { xtop = xlabelheight; } else if (mXLabels.getPosition() == XLabelPosition.BOTH_SIDED) { xbottom = xlabelheight; xtop = xlabelheight; } } float min = Utils.convertDpToPixel(11f); mOffsetBottom = Math.max(min, xbottom + legendBottom); mOffsetTop = Math.max(min, xtop); mOffsetLeft = Math.max(min, yleft); mOffsetRight = Math.max(min, yright + legendRight); if (mLegend != null) { mLegend.setOffsetTop(mOffsetTop + min / 3f); mLegend.setOffsetLeft(mOffsetLeft); } prepareContentRect(); prepareMatrix(); }
@Override public void prepare() { if (mDataNotSet) return; super.calcMinMax(mFixedYValues); if (!mFixedYValues) { float space = Math.abs(Math.abs(Math.max(Math.abs(mYChartMax), Math.abs(mYChartMin))) / 100f * 20f); if (Math.abs(mYChartMax - mYChartMin) < 0.00001f) { if (Math.abs(mYChartMax) < 10f) space = 1f; else space = Math.abs(mYChartMax / 100f * 20f); } Log.i(LOG_TAG, "Space: " + space); if (mStartAtZero) { if (mYChartMax < 0) { mYChartMax = 0; mYChartMin = mYChartMin - space; } else { mYChartMin = 0; mYChartMax = mYChartMax + space; } } else { mYChartMin = mYChartMin - space / 2f; mYChartMax = mYChartMax + space / 2f; } } mDeltaY = Math.abs(mYChartMax - mYChartMin); float yMin = 0f; float yMax = 0f; if (mContentRect.width() > 10 && !isFullyZoomedOutY()) { PointD p1 = getValuesByTouchPoint(mContentRect.left, mContentRect.top); PointD p2 = getValuesByTouchPoint(mContentRect.left, mContentRect.bottom); if (!mInvertYAxis) { yMin = (float) p2.y; yMax = (float) p1.y; } else { if (!mStartAtZero) yMin = (float) Math.min(p1.y, p2.y); else yMin = 0; yMax = (float) Math.max(p1.y, p2.y); } } else { if (!mInvertYAxis) { yMin = mYChartMin; yMax = mYChartMax; } else { if (!mStartAtZero) yMin = (float) Math.min(mYChartMax, mYChartMin); else yMin = 0; yMax = (float) Math.max(mYChartMax, mYChartMin); } } int labelCount = mYLabels.getLabelCount(); double range = Math.abs(yMax - yMin); if (labelCount == 0 || range <= 0) { mYLabels.mEntries = new float[] {}; mYLabels.mEntryCount = 0; return; } double rawInterval = range / labelCount; double interval = Utils.roundToNextSignificant(rawInterval); double intervalMagnitude = Math.pow(10, (int) Math.log10(interval)); int intervalSigDigit = (int) (interval / intervalMagnitude); if (intervalSigDigit > 5) { interval = Math.floor(10 * intervalMagnitude); } if (mYLabels.isShowOnlyMinMaxEnabled()) { mYLabels.mEntryCount = 2; mYLabels.mEntries = new float[2]; mYLabels.mEntries[0] = mYChartMin; mYLabels.mEntries[1] = mYChartMax; } else { double first = Math.ceil(yMin / interval) * interval; double last = Utils.nextUp(Math.floor(yMax / interval) * interval); double f; int i; int n = 0; for (f = first; f <= last; f += interval) { ++n; } mYLabels.mEntryCount = n; if (mYLabels.mEntries.length < n) { mYLabels.mEntries = new float[n]; } for (f = first, i = 0; i < n; f += interval, ++i) { mYLabels.mEntries[i] = (float) f; } } if (interval < 1) { mYLabels.mDecimals = (int) Math.ceil(-Math.log10(interval)); } else { mYLabels.mDecimals = 0; } StringBuffer a = new StringBuffer(); int max = (int) Math.round(mCurrentData.getXValAverageLength() + mXLabels.getSpaceBetweenLabels()); for (int i = 0; i < max; i++) { a.append("h"); } mXLabels.mLabelWidth = Utils.calcTextWidth(mXLabelPaint, a.toString()); mXLabels.mLabelHeight = Utils.calcTextHeight(mXLabelPaint, "Q"); prepareLegend(); <DeepExtract> float legendRight = 0f, legendBottom = 0f; if (mDrawLegend && mLegend != null && mLegend.getPosition() != LegendPosition.NONE) { if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART || mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART_CENTER) { float spacing = Utils.convertDpToPixel(12f); legendRight = mLegend.getMaximumEntryLength(mLegendLabelPaint) + mLegend.getFormSize() + mLegend.getFormToTextSpace() + spacing; mLegendLabelPaint.setTextAlign(Align.LEFT); } else if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) { if (mXLabels.getPosition() == XLabelPosition.TOP) legendBottom = mLegendLabelPaint.getTextSize() * 3.5f; else { legendBottom = mLegendLabelPaint.getTextSize() * 2.5f; } } mLegend.setOffsetBottom(legendBottom); mLegend.setOffsetRight(legendRight); } float yleft = 0f, yright = 0f; String label = mYLabels.getLongestLabel(); float ylabelwidth = Utils.calcTextWidth(mYLabelPaint, label + mUnit + (mYChartMin < 0 ? "----" : "+++")); if (mDrawYLabels) { if (mYLabels.getPosition() == YLabelPosition.LEFT) { yleft = ylabelwidth; mYLabelPaint.setTextAlign(Align.RIGHT); } else if (mYLabels.getPosition() == YLabelPosition.RIGHT) { yright = ylabelwidth; mYLabelPaint.setTextAlign(Align.LEFT); } else if (mYLabels.getPosition() == YLabelPosition.BOTH_SIDED) { yright = ylabelwidth; yleft = ylabelwidth; } } float xtop = 0f, xbottom = 0f; float xlabelheight = Utils.calcTextHeight(mXLabelPaint, "Q") * 2f; if (mDrawXLabels) { if (mXLabels.getPosition() == XLabelPosition.BOTTOM) { xbottom = xlabelheight; } else if (mXLabels.getPosition() == XLabelPosition.TOP) { xtop = xlabelheight; } else if (mXLabels.getPosition() == XLabelPosition.BOTH_SIDED) { xbottom = xlabelheight; xtop = xlabelheight; } } float min = Utils.convertDpToPixel(11f); mOffsetBottom = Math.max(min, xbottom + legendBottom); mOffsetTop = Math.max(min, xtop); mOffsetLeft = Math.max(min, yleft); mOffsetRight = Math.max(min, yright + legendRight); if (mLegend != null) { mLegend.setOffsetTop(mOffsetTop + min / 3f); mLegend.setOffsetLeft(mOffsetLeft); } prepareContentRect(); prepareMatrix(); </DeepExtract> }
MPChartLib
positive
4,194
@Test public void at_empty_middle_argument_separated_by_twospaces() throws Exception { Content content = new Content("*Settings\nDocumentation <arg><cursor><argend> next"); ParsedString argument = content.ps("arg-argend", 1, ArgumentType.SETTING_VAL).setHasSpaceAfter(true); int lineNo = 1; List<RobotLine> lines = RobotFile.parse(content.c()).getLines(); doTest(content, lines, lineNo, argument); }
@Test public void at_empty_middle_argument_separated_by_twospaces() throws Exception { Content content = new Content("*Settings\nDocumentation <arg><cursor><argend> next"); ParsedString argument = content.ps("arg-argend", 1, ArgumentType.SETTING_VAL).setHasSpaceAfter(true); int lineNo = 1; <DeepExtract> List<RobotLine> lines = RobotFile.parse(content.c()).getLines(); doTest(content, lines, lineNo, argument); </DeepExtract> }
RobotFramework-EclipseIDE
positive
4,197
public void notParticipating() throws InterruptedException, BrokenBarrierException { awaitLatch.countDown(); awaitLatch.await(); }
public void notParticipating() throws InterruptedException, BrokenBarrierException { <DeepExtract> awaitLatch.countDown(); awaitLatch.await(); </DeepExtract> }
simple-db-hw-2021
positive
4,198
@Override public void onCreate() { super.onCreate(); mDbHandlerThread = new HandlerThread(getClass().getSimpleName()); mDbHandlerThread.start(); mContentResolver = BaseTvInputService.this.getContentResolver(); ComponentName component = new ComponentName(BaseTvInputService.this.getPackageName(), BaseTvInputService.this.getClass().getName()); String inputId = TvContract.buildInputId(component); mChannelMap = ModelUtils.buildChannelMap(mContentResolver, inputId); mChannelObserver = new ContentObserver(new Handler(mDbHandlerThread.getLooper())) { @Override public void onChange(boolean selfChange) { updateChannelMap(); } }; mContentResolver.registerContentObserver(TvContract.Channels.CONTENT_URI, true, mChannelObserver); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(TvInputManager.ACTION_BLOCKED_RATINGS_CHANGED); intentFilter.addAction(TvInputManager.ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED); registerReceiver(mParentalControlsBroadcastReceiver, intentFilter); }
@Override public void onCreate() { super.onCreate(); mDbHandlerThread = new HandlerThread(getClass().getSimpleName()); mDbHandlerThread.start(); mContentResolver = BaseTvInputService.this.getContentResolver(); <DeepExtract> ComponentName component = new ComponentName(BaseTvInputService.this.getPackageName(), BaseTvInputService.this.getClass().getName()); String inputId = TvContract.buildInputId(component); mChannelMap = ModelUtils.buildChannelMap(mContentResolver, inputId); </DeepExtract> mChannelObserver = new ContentObserver(new Handler(mDbHandlerThread.getLooper())) { @Override public void onChange(boolean selfChange) { updateChannelMap(); } }; mContentResolver.registerContentObserver(TvContract.Channels.CONTENT_URI, true, mChannelObserver); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(TvInputManager.ACTION_BLOCKED_RATINGS_CHANGED); intentFilter.addAction(TvInputManager.ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED); registerReceiver(mParentalControlsBroadcastReceiver, intentFilter); }
androidtv-sample-inputs
positive
4,200
public Transfer cancel() throws PagarMeException { validateId(); final PagarMeRequest request = new PagarMeRequest(HttpMethod.POST, String.format("/%s/%s/cancel", getClassName(), getId())); request.getParameters().put("amount", amount); request.getParameters().put("recipient_id", getRecipientId()); request.getParameters().put("bank_account_id", getBankAccountId()); final Transfer other = JSONUtils.getAsObject((JsonObject) request.execute(), Transfer.class); super.copy(other); this.amount = other.amount; this.bankAccount = other.bankAccount; this.fee = other.fee; this.fundingEstimatedDate = other.fundingEstimatedDate; this.status = other.status; this.type = other.type; flush(); return other; }
public Transfer cancel() throws PagarMeException { validateId(); final PagarMeRequest request = new PagarMeRequest(HttpMethod.POST, String.format("/%s/%s/cancel", getClassName(), getId())); request.getParameters().put("amount", amount); request.getParameters().put("recipient_id", getRecipientId()); request.getParameters().put("bank_account_id", getBankAccountId()); final Transfer other = JSONUtils.getAsObject((JsonObject) request.execute(), Transfer.class); <DeepExtract> super.copy(other); this.amount = other.amount; this.bankAccount = other.bankAccount; this.fee = other.fee; this.fundingEstimatedDate = other.fundingEstimatedDate; this.status = other.status; this.type = other.type; </DeepExtract> flush(); return other; }
pagarme-java
positive
4,201
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recharge_deposit); mMyData = BaseApplication.getInstance().getMyData(); mWXApi = WXAPIFactory.createWXAPI(this, AppConstants.WXApp_id); mIsWXRegistApp = mWXApi.registerApp(AppConstants.WXApp_id); ((TextView) findViewById(R.id.tvTitle)).setText("充押金"); findViewById(R.id.loLeft).setOnClickListener(this); mIvWeixinCheck = (ImageView) findViewById(R.id.ivWeixinCheck); mIvZhifuCheck = (ImageView) findViewById(R.id.ivZhifuCheck); if (AppConstants.Weixin == AppConstants.Weixin) { mPayType = AppConstants.Weixin; mIvWeixinCheck.setImageResource(R.drawable.check_on); mIvZhifuCheck.setImageResource(R.drawable.check_off); } else if (AppConstants.Weixin == AppConstants.Zhifu) { mPayType = AppConstants.Zhifu; mIvWeixinCheck.setImageResource(R.drawable.check_off); mIvZhifuCheck.setImageResource(R.drawable.check_on); } svProgressHUD = new SVProgressHUD(this); mTvMoney = (TextView) findViewById(R.id.tvMoney); mTvMoney.setOnClickListener(this); findViewById(R.id.loWeixin).setOnClickListener(this); findViewById(R.id.loZhifu).setOnClickListener(this); mBtnOk = (Button) findViewById(R.id.btnOK); mBtnOk.setOnClickListener(this); if (true) { mTvMoney.setTextColor(Color.WHITE); mTvMoney.setBackgroundColor(getResources().getColor(R.color.FontBlue)); } else { mTvMoney.setTextColor(getResources().getColor(R.color.FontBlue)); mTvMoney.setBackgroundDrawable(getResources().getDrawable(R.drawable.frame_blue)); } if (mMyData.mDict == null) { svProgressHUD.show(); Http.getDict(new Handler() { @Override public void handleMessage(Message msg) { if (msg.what == 1) { if (msg.obj != null) { svProgressHUD.dismiss(); mMyData.mDict = DDict.fromJSONArray((JSONArray) msg.obj).get(0); mTvMoney.setText((int) (mMyData.mDict.mDeposit) + "元"); } } } }); } else { mTvMoney.setText((int) (mMyData.mDict.mDeposit) + "元"); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recharge_deposit); mMyData = BaseApplication.getInstance().getMyData(); mWXApi = WXAPIFactory.createWXAPI(this, AppConstants.WXApp_id); mIsWXRegistApp = mWXApi.registerApp(AppConstants.WXApp_id); ((TextView) findViewById(R.id.tvTitle)).setText("充押金"); findViewById(R.id.loLeft).setOnClickListener(this); mIvWeixinCheck = (ImageView) findViewById(R.id.ivWeixinCheck); mIvZhifuCheck = (ImageView) findViewById(R.id.ivZhifuCheck); if (AppConstants.Weixin == AppConstants.Weixin) { mPayType = AppConstants.Weixin; mIvWeixinCheck.setImageResource(R.drawable.check_on); mIvZhifuCheck.setImageResource(R.drawable.check_off); } else if (AppConstants.Weixin == AppConstants.Zhifu) { mPayType = AppConstants.Zhifu; mIvWeixinCheck.setImageResource(R.drawable.check_off); mIvZhifuCheck.setImageResource(R.drawable.check_on); } svProgressHUD = new SVProgressHUD(this); mTvMoney = (TextView) findViewById(R.id.tvMoney); mTvMoney.setOnClickListener(this); findViewById(R.id.loWeixin).setOnClickListener(this); findViewById(R.id.loZhifu).setOnClickListener(this); mBtnOk = (Button) findViewById(R.id.btnOK); mBtnOk.setOnClickListener(this); <DeepExtract> if (true) { mTvMoney.setTextColor(Color.WHITE); mTvMoney.setBackgroundColor(getResources().getColor(R.color.FontBlue)); } else { mTvMoney.setTextColor(getResources().getColor(R.color.FontBlue)); mTvMoney.setBackgroundDrawable(getResources().getDrawable(R.drawable.frame_blue)); } </DeepExtract> if (mMyData.mDict == null) { svProgressHUD.show(); Http.getDict(new Handler() { @Override public void handleMessage(Message msg) { if (msg.what == 1) { if (msg.obj != null) { svProgressHUD.dismiss(); mMyData.mDict = DDict.fromJSONArray((JSONArray) msg.obj).get(0); mTvMoney.setText((int) (mMyData.mDict.mDeposit) + "元"); } } } }); } else { mTvMoney.setText((int) (mMyData.mDict.mDeposit) + "元"); } }
Electrocar-master
positive
4,202
@Override public boolean onTouch(final View v, final MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP) { if (mFlingTracker == null || mFlingTracker.isFinished()) { setCurrentScrollState(OnScrollStateChangedListener.ScrollState.SCROLL_STATE_IDLE); } requestParentListViewToNotInterceptTouchEvents(false); releaseEdgeGlow(); } else if (event.getAction() == MotionEvent.ACTION_CANCEL) { unpressTouchedChild(); releaseEdgeGlow(); requestParentListViewToNotInterceptTouchEvents(false); } return super.onTouchEvent(event); }
@Override public boolean onTouch(final View v, final MotionEvent event) { <DeepExtract> if (event.getAction() == MotionEvent.ACTION_UP) { if (mFlingTracker == null || mFlingTracker.isFinished()) { setCurrentScrollState(OnScrollStateChangedListener.ScrollState.SCROLL_STATE_IDLE); } requestParentListViewToNotInterceptTouchEvents(false); releaseEdgeGlow(); } else if (event.getAction() == MotionEvent.ACTION_CANCEL) { unpressTouchedChild(); releaseEdgeGlow(); requestParentListViewToNotInterceptTouchEvents(false); } return super.onTouchEvent(event); </DeepExtract> }
TradeIn
positive
4,203
public void setPosition(String string, float x, float y, float z) { while (this.sndSystem.randomNumberGenerator == null && running) { try { Thread.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } this.refresh(); VoiceChatClient.getSoundManager().reload(); } this.sndSystem.setPosition(string, x, y, z); }
public void setPosition(String string, float x, float y, float z) { <DeepExtract> while (this.sndSystem.randomNumberGenerator == null && running) { try { Thread.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } this.refresh(); VoiceChatClient.getSoundManager().reload(); } </DeepExtract> this.sndSystem.setPosition(string, x, y, z); }
VoiceChat
positive
4,204
private Token<PTokenId> nextSkipWhitespaceComment(TokenSequence<PTokenId> ts) { if (!ts.moveNext()) { return null; } while (ts.token() != null && (ts.token().id() == PTokenId.WHITESPACE || ts.token().id() == PTokenId.COMMENT || ts.token().id() == PTokenId.LINE_COMMENT)) { if (!ts.moveNext()) { return null; } } return ts.token(); }
private Token<PTokenId> nextSkipWhitespaceComment(TokenSequence<PTokenId> ts) { if (!ts.moveNext()) { return null; } <DeepExtract> while (ts.token() != null && (ts.token().id() == PTokenId.WHITESPACE || ts.token().id() == PTokenId.COMMENT || ts.token().id() == PTokenId.LINE_COMMENT)) { if (!ts.moveNext()) { return null; } } return ts.token(); </DeepExtract> }
NetBeansPuppet
positive
4,205
protected long encodeNewWalk(int sourceId, int sourceVertex, boolean hop) { assert (sourceVertex % bucketSize < 128); int hopbit = (hop ? 1 : 0); return ((sourceId & 0xffffff) << 8) | ((sourceVertex % bucketSize & 0x7f) << 1) | hopbit; }
protected long encodeNewWalk(int sourceId, int sourceVertex, boolean hop) { <DeepExtract> assert (sourceVertex % bucketSize < 128); int hopbit = (hop ? 1 : 0); return ((sourceId & 0xffffff) << 8) | ((sourceVertex % bucketSize & 0x7f) << 1) | hopbit; </DeepExtract> }
graphchi-java
positive
4,206
@BeforeEach void setup() throws IOException { recipientKey = memoryKeyStore.generateKeyPair(); privacyGroupMembers = new String[] { encodeBytes(senderKey.bytesArray()), encodeBytes(recipientKey.bytesArray()) }; peer = new FakePeer(recipientKey); networkNodes.addNode(Collections.singletonMap(recipientKey.bytes(), peer.getURI()).entrySet()); final PrivacyGroupRequest privacyGroupRequestExpected = buildPrivacyGroupRequest(privacyGroupMembers, encodeBytes(senderKey.bytesArray()), PRIVACY_GROUP_NAME, PRIVACY_GROUP_DESCRIPTION); final Request request = buildPrivateAPIRequest(CREATE_PRIVACY_GROUP, JSON, privacyGroupRequestExpected); final byte[] privacyGroupId = enclave.generatePrivacyGroupId(new PublicKey[] { senderKey, recipientKey }, privacyGroupRequestExpected.getSeed().get(), PrivacyGroupPayload.Type.PANTHEON); peer.addResponse(new MockResponse().setBody(encodeBytes(privacyGroupId))); final Response resp = httpClient.newCall(request).execute(); final PrivacyGroup privacyGroup = Serializer.deserialize(JSON, PrivacyGroup.class, resp.body().bytes()); return privacyGroup.getPrivacyGroupId(); }
@BeforeEach void setup() throws IOException { recipientKey = memoryKeyStore.generateKeyPair(); privacyGroupMembers = new String[] { encodeBytes(senderKey.bytesArray()), encodeBytes(recipientKey.bytesArray()) }; peer = new FakePeer(recipientKey); networkNodes.addNode(Collections.singletonMap(recipientKey.bytes(), peer.getURI()).entrySet()); <DeepExtract> final PrivacyGroupRequest privacyGroupRequestExpected = buildPrivacyGroupRequest(privacyGroupMembers, encodeBytes(senderKey.bytesArray()), PRIVACY_GROUP_NAME, PRIVACY_GROUP_DESCRIPTION); final Request request = buildPrivateAPIRequest(CREATE_PRIVACY_GROUP, JSON, privacyGroupRequestExpected); final byte[] privacyGroupId = enclave.generatePrivacyGroupId(new PublicKey[] { senderKey, recipientKey }, privacyGroupRequestExpected.getSeed().get(), PrivacyGroupPayload.Type.PANTHEON); peer.addResponse(new MockResponse().setBody(encodeBytes(privacyGroupId))); final Response resp = httpClient.newCall(request).execute(); final PrivacyGroup privacyGroup = Serializer.deserialize(JSON, PrivacyGroup.class, resp.body().bytes()); return privacyGroup.getPrivacyGroupId(); </DeepExtract> }
orion
positive
4,207
private boolean handleFailure(IOException e) throws IOException { RouteSelector routeSelector = httpEngine.routeSelector; if (routeSelector != null && httpEngine.connection != null) { routeSelector.connectFailed(httpEngine.connection, e); } OutputStream requestBody = httpEngine.getRequestBody(); boolean canRetryRequestBody = requestBody == null || requestBody instanceof RetryableOutputStream || (faultRecoveringRequestBody != null && faultRecoveringRequestBody.isRecoverable()); if (routeSelector == null && httpEngine.connection == null || routeSelector != null && !routeSelector.hasNext() || !isRecoverable(e) || !canRetryRequestBody) { httpEngineFailure = e; return false; } httpEngine.release(true); RetryableOutputStream retryableOutputStream = requestBody instanceof RetryableOutputStream ? (RetryableOutputStream) requestBody : null; if (url.getProtocol().equals("http")) { httpEngine = new HttpEngine(this, method, rawRequestHeaders, null, retryableOutputStream); } else if (url.getProtocol().equals("https")) { httpEngine = new HttpsURLConnectionImpl.HttpsEngine(this, method, rawRequestHeaders, null, retryableOutputStream); } else { throw new AssertionError(); } httpEngine.routeSelector = routeSelector; if (faultRecoveringRequestBody != null && faultRecoveringRequestBody.isRecoverable()) { httpEngine.sendRequest(); faultRecoveringRequestBody.replaceStream(httpEngine.getRequestBody()); } return true; }
private boolean handleFailure(IOException e) throws IOException { RouteSelector routeSelector = httpEngine.routeSelector; if (routeSelector != null && httpEngine.connection != null) { routeSelector.connectFailed(httpEngine.connection, e); } OutputStream requestBody = httpEngine.getRequestBody(); boolean canRetryRequestBody = requestBody == null || requestBody instanceof RetryableOutputStream || (faultRecoveringRequestBody != null && faultRecoveringRequestBody.isRecoverable()); if (routeSelector == null && httpEngine.connection == null || routeSelector != null && !routeSelector.hasNext() || !isRecoverable(e) || !canRetryRequestBody) { httpEngineFailure = e; return false; } httpEngine.release(true); RetryableOutputStream retryableOutputStream = requestBody instanceof RetryableOutputStream ? (RetryableOutputStream) requestBody : null; <DeepExtract> if (url.getProtocol().equals("http")) { httpEngine = new HttpEngine(this, method, rawRequestHeaders, null, retryableOutputStream); } else if (url.getProtocol().equals("https")) { httpEngine = new HttpsURLConnectionImpl.HttpsEngine(this, method, rawRequestHeaders, null, retryableOutputStream); } else { throw new AssertionError(); } </DeepExtract> httpEngine.routeSelector = routeSelector; if (faultRecoveringRequestBody != null && faultRecoveringRequestBody.isRecoverable()) { httpEngine.sendRequest(); faultRecoveringRequestBody.replaceStream(httpEngine.getRequestBody()); } return true; }
phonegap-custom-camera-plugin
positive
4,208
private void init(AttributeSet attrs, int defStyle) { final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ColorPicker, defStyle, 0); final Resources b = getContext().getResources(); mColorWheelThickness = a.getDimensionPixelSize(R.styleable.ColorPicker_color_wheel_thickness, b.getDimensionPixelSize(R.dimen.color_wheel_thickness)); mColorWheelRadius = a.getDimensionPixelSize(R.styleable.ColorPicker_color_wheel_radius, b.getDimensionPixelSize(R.dimen.color_wheel_radius)); mPreferredColorWheelRadius = mColorWheelRadius; mColorCenterRadius = a.getDimensionPixelSize(R.styleable.ColorPicker_color_center_radius, b.getDimensionPixelSize(R.dimen.color_center_radius)); mPreferredColorCenterRadius = mColorCenterRadius; mColorCenterHaloRadius = a.getDimensionPixelSize(R.styleable.ColorPicker_color_center_halo_radius, b.getDimensionPixelSize(R.dimen.color_center_halo_radius)); mPreferredColorCenterHaloRadius = mColorCenterHaloRadius; mColorPointerRadius = a.getDimensionPixelSize(R.styleable.ColorPicker_color_pointer_radius, b.getDimensionPixelSize(R.dimen.color_pointer_radius)); mColorPointerHaloRadius = a.getDimensionPixelSize(R.styleable.ColorPicker_color_pointer_halo_radius, b.getDimensionPixelSize(R.dimen.color_pointer_halo_radius)); a.recycle(); mAngle = (float) (-Math.PI / 2); Shader s = new SweepGradient(0, 0, COLORS, null); mColorWheelPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mColorWheelPaint.setShader(s); mColorWheelPaint.setStyle(Paint.Style.STROKE); mColorWheelPaint.setStrokeWidth(mColorWheelThickness); mPointerHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mAngle = colorToAngle(Color.BLACK); mPointerColor.setColor(calculateColor(mAngle)); if (mOpacityBar != null) { mOpacityBar.setColor(mColor); mOpacityBar.setOpacity(Color.alpha(Color.BLACK)); } if (mSVbar != null) { Color.colorToHSV(Color.BLACK, mHSV); mSVbar.setColor(mColor); if (mHSV[1] < mHSV[2]) { mSVbar.setSaturation(mHSV[1]); } else if (mHSV[1] > mHSV[2]) { mSVbar.setValue(mHSV[2]); } } if (mSaturationBar != null) { Color.colorToHSV(Color.BLACK, mHSV); mSaturationBar.setColor(mColor); mSaturationBar.setSaturation(mHSV[1]); } if (mValueBar != null && mSaturationBar == null) { Color.colorToHSV(Color.BLACK, mHSV); mValueBar.setColor(mColor); mValueBar.setValue(mHSV[2]); } else if (mValueBar != null) { Color.colorToHSV(Color.BLACK, mHSV); mValueBar.setValue(mHSV[2]); } setNewCenterColor(Color.BLACK); mPointerHaloPaint.setAlpha(0x50); mPointerColor = new Paint(Paint.ANTI_ALIAS_FLAG); mAngle = colorToAngle(calculateColor(mAngle)); mPointerColor.setColor(calculateColor(mAngle)); if (mOpacityBar != null) { mOpacityBar.setColor(mColor); mOpacityBar.setOpacity(Color.alpha(calculateColor(mAngle))); } if (mSVbar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSVbar.setColor(mColor); if (mHSV[1] < mHSV[2]) { mSVbar.setSaturation(mHSV[1]); } else if (mHSV[1] > mHSV[2]) { mSVbar.setValue(mHSV[2]); } } if (mSaturationBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSaturationBar.setColor(mColor); mSaturationBar.setSaturation(mHSV[1]); } if (mValueBar != null && mSaturationBar == null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setColor(mColor); mValueBar.setValue(mHSV[2]); } else if (mValueBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setValue(mHSV[2]); } setNewCenterColor(calculateColor(mAngle)); mCenterNewPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mAngle = colorToAngle(calculateColor(mAngle)); mPointerColor.setColor(calculateColor(mAngle)); if (mOpacityBar != null) { mOpacityBar.setColor(mColor); mOpacityBar.setOpacity(Color.alpha(calculateColor(mAngle))); } if (mSVbar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSVbar.setColor(mColor); if (mHSV[1] < mHSV[2]) { mSVbar.setSaturation(mHSV[1]); } else if (mHSV[1] > mHSV[2]) { mSVbar.setValue(mHSV[2]); } } if (mSaturationBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSaturationBar.setColor(mColor); mSaturationBar.setSaturation(mHSV[1]); } if (mValueBar != null && mSaturationBar == null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setColor(mColor); mValueBar.setValue(mHSV[2]); } else if (mValueBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setValue(mHSV[2]); } setNewCenterColor(calculateColor(mAngle)); mCenterNewPaint.setStyle(Paint.Style.FILL); mCenterOldPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mAngle = colorToAngle(calculateColor(mAngle)); mPointerColor.setColor(calculateColor(mAngle)); if (mOpacityBar != null) { mOpacityBar.setColor(mColor); mOpacityBar.setOpacity(Color.alpha(calculateColor(mAngle))); } if (mSVbar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSVbar.setColor(mColor); if (mHSV[1] < mHSV[2]) { mSVbar.setSaturation(mHSV[1]); } else if (mHSV[1] > mHSV[2]) { mSVbar.setValue(mHSV[2]); } } if (mSaturationBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSaturationBar.setColor(mColor); mSaturationBar.setSaturation(mHSV[1]); } if (mValueBar != null && mSaturationBar == null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setColor(mColor); mValueBar.setValue(mHSV[2]); } else if (mValueBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setValue(mHSV[2]); } setNewCenterColor(calculateColor(mAngle)); mCenterOldPaint.setStyle(Paint.Style.FILL); mCenterHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mAngle = colorToAngle(Color.BLACK); mPointerColor.setColor(calculateColor(mAngle)); if (mOpacityBar != null) { mOpacityBar.setColor(mColor); mOpacityBar.setOpacity(Color.alpha(Color.BLACK)); } if (mSVbar != null) { Color.colorToHSV(Color.BLACK, mHSV); mSVbar.setColor(mColor); if (mHSV[1] < mHSV[2]) { mSVbar.setSaturation(mHSV[1]); } else if (mHSV[1] > mHSV[2]) { mSVbar.setValue(mHSV[2]); } } if (mSaturationBar != null) { Color.colorToHSV(Color.BLACK, mHSV); mSaturationBar.setColor(mColor); mSaturationBar.setSaturation(mHSV[1]); } if (mValueBar != null && mSaturationBar == null) { Color.colorToHSV(Color.BLACK, mHSV); mValueBar.setColor(mColor); mValueBar.setValue(mHSV[2]); } else if (mValueBar != null) { Color.colorToHSV(Color.BLACK, mHSV); mValueBar.setValue(mHSV[2]); } setNewCenterColor(Color.BLACK); mCenterHaloPaint.setAlpha(0x00); float unit = (float) (mAngle / (2 * Math.PI)); if (unit < 0) { unit += 1; } if (unit <= 0) { mColor = COLORS[0]; mCenterNewColor = COLORS[0]; } if (unit >= 1) { mColor = COLORS[COLORS.length - 1]; mCenterNewColor = COLORS[COLORS.length - 1]; } float p = unit * (COLORS.length - 1); int i = (int) p; p -= i; int c0 = COLORS[i]; int c1 = COLORS[i + 1]; int a = ave(Color.alpha(c0), Color.alpha(c1), p); int r = ave(Color.red(c0), Color.red(c1), p); int g = ave(Color.green(c0), Color.green(c1), p); int b = ave(Color.blue(c0), Color.blue(c1), p); mColor = Color.argb(a, r, g, b); return Color.argb(a, r, g, b); float unit = (float) (mAngle / (2 * Math.PI)); if (unit < 0) { unit += 1; } if (unit <= 0) { mColor = COLORS[0]; mCenterOldColor = COLORS[0]; } if (unit >= 1) { mColor = COLORS[COLORS.length - 1]; mCenterOldColor = COLORS[COLORS.length - 1]; } float p = unit * (COLORS.length - 1); int i = (int) p; p -= i; int c0 = COLORS[i]; int c1 = COLORS[i + 1]; int a = ave(Color.alpha(c0), Color.alpha(c1), p); int r = ave(Color.red(c0), Color.red(c1), p); int g = ave(Color.green(c0), Color.green(c1), p); int b = ave(Color.blue(c0), Color.blue(c1), p); mColor = Color.argb(a, r, g, b); return Color.argb(a, r, g, b); mShowCenterOldColor = true; }
private void init(AttributeSet attrs, int defStyle) { final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ColorPicker, defStyle, 0); final Resources b = getContext().getResources(); mColorWheelThickness = a.getDimensionPixelSize(R.styleable.ColorPicker_color_wheel_thickness, b.getDimensionPixelSize(R.dimen.color_wheel_thickness)); mColorWheelRadius = a.getDimensionPixelSize(R.styleable.ColorPicker_color_wheel_radius, b.getDimensionPixelSize(R.dimen.color_wheel_radius)); mPreferredColorWheelRadius = mColorWheelRadius; mColorCenterRadius = a.getDimensionPixelSize(R.styleable.ColorPicker_color_center_radius, b.getDimensionPixelSize(R.dimen.color_center_radius)); mPreferredColorCenterRadius = mColorCenterRadius; mColorCenterHaloRadius = a.getDimensionPixelSize(R.styleable.ColorPicker_color_center_halo_radius, b.getDimensionPixelSize(R.dimen.color_center_halo_radius)); mPreferredColorCenterHaloRadius = mColorCenterHaloRadius; mColorPointerRadius = a.getDimensionPixelSize(R.styleable.ColorPicker_color_pointer_radius, b.getDimensionPixelSize(R.dimen.color_pointer_radius)); mColorPointerHaloRadius = a.getDimensionPixelSize(R.styleable.ColorPicker_color_pointer_halo_radius, b.getDimensionPixelSize(R.dimen.color_pointer_halo_radius)); a.recycle(); mAngle = (float) (-Math.PI / 2); Shader s = new SweepGradient(0, 0, COLORS, null); mColorWheelPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mColorWheelPaint.setShader(s); mColorWheelPaint.setStyle(Paint.Style.STROKE); mColorWheelPaint.setStrokeWidth(mColorWheelThickness); mPointerHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mAngle = colorToAngle(Color.BLACK); mPointerColor.setColor(calculateColor(mAngle)); if (mOpacityBar != null) { mOpacityBar.setColor(mColor); mOpacityBar.setOpacity(Color.alpha(Color.BLACK)); } if (mSVbar != null) { Color.colorToHSV(Color.BLACK, mHSV); mSVbar.setColor(mColor); if (mHSV[1] < mHSV[2]) { mSVbar.setSaturation(mHSV[1]); } else if (mHSV[1] > mHSV[2]) { mSVbar.setValue(mHSV[2]); } } if (mSaturationBar != null) { Color.colorToHSV(Color.BLACK, mHSV); mSaturationBar.setColor(mColor); mSaturationBar.setSaturation(mHSV[1]); } if (mValueBar != null && mSaturationBar == null) { Color.colorToHSV(Color.BLACK, mHSV); mValueBar.setColor(mColor); mValueBar.setValue(mHSV[2]); } else if (mValueBar != null) { Color.colorToHSV(Color.BLACK, mHSV); mValueBar.setValue(mHSV[2]); } setNewCenterColor(Color.BLACK); mPointerHaloPaint.setAlpha(0x50); mPointerColor = new Paint(Paint.ANTI_ALIAS_FLAG); mAngle = colorToAngle(calculateColor(mAngle)); mPointerColor.setColor(calculateColor(mAngle)); if (mOpacityBar != null) { mOpacityBar.setColor(mColor); mOpacityBar.setOpacity(Color.alpha(calculateColor(mAngle))); } if (mSVbar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSVbar.setColor(mColor); if (mHSV[1] < mHSV[2]) { mSVbar.setSaturation(mHSV[1]); } else if (mHSV[1] > mHSV[2]) { mSVbar.setValue(mHSV[2]); } } if (mSaturationBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSaturationBar.setColor(mColor); mSaturationBar.setSaturation(mHSV[1]); } if (mValueBar != null && mSaturationBar == null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setColor(mColor); mValueBar.setValue(mHSV[2]); } else if (mValueBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setValue(mHSV[2]); } setNewCenterColor(calculateColor(mAngle)); mCenterNewPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mAngle = colorToAngle(calculateColor(mAngle)); mPointerColor.setColor(calculateColor(mAngle)); if (mOpacityBar != null) { mOpacityBar.setColor(mColor); mOpacityBar.setOpacity(Color.alpha(calculateColor(mAngle))); } if (mSVbar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSVbar.setColor(mColor); if (mHSV[1] < mHSV[2]) { mSVbar.setSaturation(mHSV[1]); } else if (mHSV[1] > mHSV[2]) { mSVbar.setValue(mHSV[2]); } } if (mSaturationBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSaturationBar.setColor(mColor); mSaturationBar.setSaturation(mHSV[1]); } if (mValueBar != null && mSaturationBar == null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setColor(mColor); mValueBar.setValue(mHSV[2]); } else if (mValueBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setValue(mHSV[2]); } setNewCenterColor(calculateColor(mAngle)); mCenterNewPaint.setStyle(Paint.Style.FILL); mCenterOldPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mAngle = colorToAngle(calculateColor(mAngle)); mPointerColor.setColor(calculateColor(mAngle)); if (mOpacityBar != null) { mOpacityBar.setColor(mColor); mOpacityBar.setOpacity(Color.alpha(calculateColor(mAngle))); } if (mSVbar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSVbar.setColor(mColor); if (mHSV[1] < mHSV[2]) { mSVbar.setSaturation(mHSV[1]); } else if (mHSV[1] > mHSV[2]) { mSVbar.setValue(mHSV[2]); } } if (mSaturationBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mSaturationBar.setColor(mColor); mSaturationBar.setSaturation(mHSV[1]); } if (mValueBar != null && mSaturationBar == null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setColor(mColor); mValueBar.setValue(mHSV[2]); } else if (mValueBar != null) { Color.colorToHSV(calculateColor(mAngle), mHSV); mValueBar.setValue(mHSV[2]); } setNewCenterColor(calculateColor(mAngle)); mCenterOldPaint.setStyle(Paint.Style.FILL); mCenterHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mAngle = colorToAngle(Color.BLACK); mPointerColor.setColor(calculateColor(mAngle)); if (mOpacityBar != null) { mOpacityBar.setColor(mColor); mOpacityBar.setOpacity(Color.alpha(Color.BLACK)); } if (mSVbar != null) { Color.colorToHSV(Color.BLACK, mHSV); mSVbar.setColor(mColor); if (mHSV[1] < mHSV[2]) { mSVbar.setSaturation(mHSV[1]); } else if (mHSV[1] > mHSV[2]) { mSVbar.setValue(mHSV[2]); } } if (mSaturationBar != null) { Color.colorToHSV(Color.BLACK, mHSV); mSaturationBar.setColor(mColor); mSaturationBar.setSaturation(mHSV[1]); } if (mValueBar != null && mSaturationBar == null) { Color.colorToHSV(Color.BLACK, mHSV); mValueBar.setColor(mColor); mValueBar.setValue(mHSV[2]); } else if (mValueBar != null) { Color.colorToHSV(Color.BLACK, mHSV); mValueBar.setValue(mHSV[2]); } setNewCenterColor(Color.BLACK); mCenterHaloPaint.setAlpha(0x00); float unit = (float) (mAngle / (2 * Math.PI)); if (unit < 0) { unit += 1; } if (unit <= 0) { mColor = COLORS[0]; mCenterNewColor = COLORS[0]; } if (unit >= 1) { mColor = COLORS[COLORS.length - 1]; mCenterNewColor = COLORS[COLORS.length - 1]; } float p = unit * (COLORS.length - 1); int i = (int) p; p -= i; int c0 = COLORS[i]; int c1 = COLORS[i + 1]; int a = ave(Color.alpha(c0), Color.alpha(c1), p); int r = ave(Color.red(c0), Color.red(c1), p); int g = ave(Color.green(c0), Color.green(c1), p); int b = ave(Color.blue(c0), Color.blue(c1), p); mColor = Color.argb(a, r, g, b); return Color.argb(a, r, g, b); <DeepExtract> float unit = (float) (mAngle / (2 * Math.PI)); if (unit < 0) { unit += 1; } if (unit <= 0) { mColor = COLORS[0]; mCenterOldColor = COLORS[0]; } if (unit >= 1) { mColor = COLORS[COLORS.length - 1]; mCenterOldColor = COLORS[COLORS.length - 1]; } float p = unit * (COLORS.length - 1); int i = (int) p; p -= i; int c0 = COLORS[i]; int c1 = COLORS[i + 1]; int a = ave(Color.alpha(c0), Color.alpha(c1), p); int r = ave(Color.red(c0), Color.red(c1), p); int g = ave(Color.green(c0), Color.green(c1), p); int b = ave(Color.blue(c0), Color.blue(c1), p); mColor = Color.argb(a, r, g, b); return Color.argb(a, r, g, b); </DeepExtract> mShowCenterOldColor = true; }
BLImage
positive
4,209
@Override public void scrollToPosition(int position) { if (position < 0 || position > getItemCount() - 1) { return; } return Math.round(getIntervalDistance() * position); if (mRecycle == null || mState == null) { mSelectPosition = position; } else { layoutItems(mRecycle, mState, position > mSelectPosition ? SCROLL_RIGHT : SCROLL_LEFT); onSelectedCallBack(); } }
@Override public void scrollToPosition(int position) { if (position < 0 || position > getItemCount() - 1) { return; } <DeepExtract> return Math.round(getIntervalDistance() * position); </DeepExtract> if (mRecycle == null || mState == null) { mSelectPosition = position; } else { layoutItems(mRecycle, mState, position > mSelectPosition ? SCROLL_RIGHT : SCROLL_LEFT); onSelectedCallBack(); } }
YCRefreshView
positive
4,210
@Override public void initialize(URL url, ResourceBundle rb) { menuGerenciar.setText(idioma.getMensagem("gerenciar")); menuGerenciarCategorias.setText(idioma.getMensagem("categorias")); menuGerenciarItens.setText(idioma.getMensagem("itens")); menuMovimentar.setText(idioma.getMensagem("movimentar")); menuUtilitarios.setText(idioma.getMensagem("utilitarios")); menuAjuda.setText(idioma.getMensagem("ajuda")); gerenciarContas.setText(idioma.getMensagem("contas")); gerenciarAgenda.setText(idioma.getMensagem("lembretes")); gerenciarGrupos.setText(idioma.getMensagem("cotas_despesas")); gerenciarPlanejamento.setText(idioma.getMensagem("planejamento")); gerenciarCartoesCredito.setText(idioma.getMensagem("cartoes_credito")); gerenciarUsuarios.setText(idioma.getMensagem("usuarios")); gerenciarCategoriasDespesas.setText(idioma.getMensagem("despesas")); gerenciarCategoriasReceitas.setText(idioma.getMensagem("receitas")); gerenciarCategoriasTransferencias.setText(idioma.getMensagem("transferencias")); gerenciarCategoriasAgenda.setText(idioma.getMensagem("lembretes")); gerenciarItensDespesas.setText(idioma.getMensagem("despesas")); gerenciarItensReceitas.setText(idioma.getMensagem("receitas")); gerenciarItensTransferencias.setText(idioma.getMensagem("transferencias")); movimentarDespesa.setText(idioma.getMensagem("despesas")); movimentarReceita.setText(idioma.getMensagem("receitas")); movimentarTransferencia.setText(idioma.getMensagem("transferencias")); movimentarGuia.setText(idioma.getMensagem("guia")); utilitariosConfiguracoes.setText(idioma.getMensagem("configuracoes")); utilitariosRelatorios.setText(idioma.getMensagem("relatorios")); utilitariosExportarBackup.setText(idioma.getMensagem("exportar_backup")); utilitariosImportarBackup.setText(idioma.getMensagem("importar_backup")); ajudaTutorial.setText(idioma.getMensagem("tutorial")); ajudaSobreSistema.setText(idioma.getMensagem("sobre_sistema")); ajudaVerificarAtualizacoes.setText(idioma.getMensagem("verificar_atualizacoes")); botaoHome.setTooltip(new Tooltip(idioma.getMensagem("principal"))); botaoDespesas.setTooltip(new Tooltip(idioma.getMensagem("despesas"))); botaoReceitas.setTooltip(new Tooltip(idioma.getMensagem("receitas"))); botaoTransferencias.setTooltip(new Tooltip(idioma.getMensagem("transferencias"))); botaoPlanejamento.setTooltip(new Tooltip(idioma.getMensagem("planejamento"))); botaoAgenda.setTooltip(new Tooltip(idioma.getMensagem("lembretes"))); botaoGrupo.setTooltip(new Tooltip(idioma.getMensagem("cotas_despesas"))); botaoCartaoCredito.setTooltip(new Tooltip(idioma.getMensagem("cartoes_credito"))); botaoContas.setTooltip(new Tooltip(idioma.getMensagem("contas"))); botaoUsuarios.setTooltip(new Tooltip(idioma.getMensagem("usuarios"))); botaoRelatorios.setTooltip(new Tooltip(idioma.getMensagem("relatorios"))); botaoCalculadora.setTooltip(new Tooltip(idioma.getMensagem("calculadora"))); botaoGuia.setTooltip(new Tooltip(idioma.getMensagem("guia"))); botaoAjuda.setTooltip(new Tooltip(idioma.getMensagem("ajuda"))); botaoAjudaProximo.setTooltip(new Tooltip(idioma.getMensagem("proximo"))); botaoAjudaAnterior.setTooltip(new Tooltip(idioma.getMensagem("anterior"))); ajuda = false; botaoAjuda.getStyleClass().remove("botaoAjudaSair"); botaoAjuda.getStyleClass().add("botaoAjuda"); botaoAjudaProximo.setVisible(false); ajudaProgresso.setVisible(false); botaoAjudaAnterior.setVisible(false); botaoAjuda.setTooltip(new Tooltip(idioma.getMensagem("ajuda"))); Ajuda.getInstance().desativarAjuda(); Kernel.principal = this; Kernel.layoutGeral = this.layoutGeral; Kernel.layoutCentro = this.layoutCentro; try { if (Kernel.controlador == null || Kernel.controlador.sair()) { desativarAjuda(); PilhaVoltar.adicionar(Kernel.FXML_HOME); FXMLLoader loader = new FXMLLoader(); loader.setLocation(Janela.class.getResource(Kernel.FXML_HOME)); Node node = loader.load(Janela.class.getResourceAsStream(Kernel.FXML_HOME)); Animacao.fadeOutInReplace(layoutCentro, node); Kernel.controlador = loader.getController(); Ajuda.getInstance().setBotaoProgresso(ajudaProgresso); return loader.getController(); } else { return null; } } catch (Exception ex) { Janela.showException(ex); return null; } if (DAYS.between(Datas.getLocalDate(Configuracao.getPropriedade("data_atualizacao")), LocalDate.now()) >= 30) { Configuracao.setPropriedade("data_atualizacao", Datas.toSqlData(LocalDate.now())); Atualizacao task = new Atualizacao(false, ajudaVerificarAtualizacoes); } }
@Override public void initialize(URL url, ResourceBundle rb) { menuGerenciar.setText(idioma.getMensagem("gerenciar")); menuGerenciarCategorias.setText(idioma.getMensagem("categorias")); menuGerenciarItens.setText(idioma.getMensagem("itens")); menuMovimentar.setText(idioma.getMensagem("movimentar")); menuUtilitarios.setText(idioma.getMensagem("utilitarios")); menuAjuda.setText(idioma.getMensagem("ajuda")); gerenciarContas.setText(idioma.getMensagem("contas")); gerenciarAgenda.setText(idioma.getMensagem("lembretes")); gerenciarGrupos.setText(idioma.getMensagem("cotas_despesas")); gerenciarPlanejamento.setText(idioma.getMensagem("planejamento")); gerenciarCartoesCredito.setText(idioma.getMensagem("cartoes_credito")); gerenciarUsuarios.setText(idioma.getMensagem("usuarios")); gerenciarCategoriasDespesas.setText(idioma.getMensagem("despesas")); gerenciarCategoriasReceitas.setText(idioma.getMensagem("receitas")); gerenciarCategoriasTransferencias.setText(idioma.getMensagem("transferencias")); gerenciarCategoriasAgenda.setText(idioma.getMensagem("lembretes")); gerenciarItensDespesas.setText(idioma.getMensagem("despesas")); gerenciarItensReceitas.setText(idioma.getMensagem("receitas")); gerenciarItensTransferencias.setText(idioma.getMensagem("transferencias")); movimentarDespesa.setText(idioma.getMensagem("despesas")); movimentarReceita.setText(idioma.getMensagem("receitas")); movimentarTransferencia.setText(idioma.getMensagem("transferencias")); movimentarGuia.setText(idioma.getMensagem("guia")); utilitariosConfiguracoes.setText(idioma.getMensagem("configuracoes")); utilitariosRelatorios.setText(idioma.getMensagem("relatorios")); utilitariosExportarBackup.setText(idioma.getMensagem("exportar_backup")); utilitariosImportarBackup.setText(idioma.getMensagem("importar_backup")); ajudaTutorial.setText(idioma.getMensagem("tutorial")); ajudaSobreSistema.setText(idioma.getMensagem("sobre_sistema")); ajudaVerificarAtualizacoes.setText(idioma.getMensagem("verificar_atualizacoes")); botaoHome.setTooltip(new Tooltip(idioma.getMensagem("principal"))); botaoDespesas.setTooltip(new Tooltip(idioma.getMensagem("despesas"))); botaoReceitas.setTooltip(new Tooltip(idioma.getMensagem("receitas"))); botaoTransferencias.setTooltip(new Tooltip(idioma.getMensagem("transferencias"))); botaoPlanejamento.setTooltip(new Tooltip(idioma.getMensagem("planejamento"))); botaoAgenda.setTooltip(new Tooltip(idioma.getMensagem("lembretes"))); botaoGrupo.setTooltip(new Tooltip(idioma.getMensagem("cotas_despesas"))); botaoCartaoCredito.setTooltip(new Tooltip(idioma.getMensagem("cartoes_credito"))); botaoContas.setTooltip(new Tooltip(idioma.getMensagem("contas"))); botaoUsuarios.setTooltip(new Tooltip(idioma.getMensagem("usuarios"))); botaoRelatorios.setTooltip(new Tooltip(idioma.getMensagem("relatorios"))); botaoCalculadora.setTooltip(new Tooltip(idioma.getMensagem("calculadora"))); botaoGuia.setTooltip(new Tooltip(idioma.getMensagem("guia"))); botaoAjuda.setTooltip(new Tooltip(idioma.getMensagem("ajuda"))); botaoAjudaProximo.setTooltip(new Tooltip(idioma.getMensagem("proximo"))); botaoAjudaAnterior.setTooltip(new Tooltip(idioma.getMensagem("anterior"))); ajuda = false; botaoAjuda.getStyleClass().remove("botaoAjudaSair"); botaoAjuda.getStyleClass().add("botaoAjuda"); botaoAjudaProximo.setVisible(false); ajudaProgresso.setVisible(false); botaoAjudaAnterior.setVisible(false); botaoAjuda.setTooltip(new Tooltip(idioma.getMensagem("ajuda"))); Ajuda.getInstance().desativarAjuda(); Kernel.principal = this; Kernel.layoutGeral = this.layoutGeral; Kernel.layoutCentro = this.layoutCentro; try { if (Kernel.controlador == null || Kernel.controlador.sair()) { desativarAjuda(); PilhaVoltar.adicionar(Kernel.FXML_HOME); FXMLLoader loader = new FXMLLoader(); loader.setLocation(Janela.class.getResource(Kernel.FXML_HOME)); Node node = loader.load(Janela.class.getResourceAsStream(Kernel.FXML_HOME)); Animacao.fadeOutInReplace(layoutCentro, node); Kernel.controlador = loader.getController(); Ajuda.getInstance().setBotaoProgresso(ajudaProgresso); return loader.getController(); } else { return null; } } catch (Exception ex) { Janela.showException(ex); return null; } <DeepExtract> if (DAYS.between(Datas.getLocalDate(Configuracao.getPropriedade("data_atualizacao")), LocalDate.now()) >= 30) { Configuracao.setPropriedade("data_atualizacao", Datas.toSqlData(LocalDate.now())); Atualizacao task = new Atualizacao(false, ajudaVerificarAtualizacoes); } </DeepExtract> }
bgfinancas
positive
4,211
void consume(Purchase itemInfo) throws IabException { if (mDisposed) throw new IllegalStateException("IabHelper was disposed of, so it cannot be used."); if (!mSetupDone) { logError("Illegal state for operation (" + "consume" + "): IAB helper is not set up."); throw new IllegalStateException("IAB helper is not set up. Can't perform operation: " + "consume"); } if (!itemInfo.mItemType.equals(ITEM_TYPE_INAPP)) { throw new IabException(IABHELPER_INVALID_CONSUMPTION, "Items of type '" + itemInfo.mItemType + "' can't be consumed."); } try { String token = itemInfo.getToken(); String sku = itemInfo.getSku(); if (token == null || token.equals("")) { logError("Can't consume " + sku + ". No token."); throw new IabException(IABHELPER_MISSING_TOKEN, "PurchaseInfo is missing token for sku: " + sku + " " + itemInfo); } logDebug("Consuming sku: " + sku + ", token: " + token); int response = mService.consumePurchase(3, mContext.getPackageName(), token); if (response == BILLING_RESPONSE_RESULT_OK) { logDebug("Successfully consumed sku: " + sku); } else { logDebug("Error consuming consuming sku " + sku + ". " + getResponseDesc(response)); throw new IabException(response, "Error consuming sku " + sku); } } catch (RemoteException e) { throw new IabException(IABHELPER_REMOTE_EXCEPTION, "Remote exception while consuming. PurchaseInfo: " + itemInfo, e); } }
void consume(Purchase itemInfo) throws IabException { if (mDisposed) throw new IllegalStateException("IabHelper was disposed of, so it cannot be used."); <DeepExtract> if (!mSetupDone) { logError("Illegal state for operation (" + "consume" + "): IAB helper is not set up."); throw new IllegalStateException("IAB helper is not set up. Can't perform operation: " + "consume"); } </DeepExtract> if (!itemInfo.mItemType.equals(ITEM_TYPE_INAPP)) { throw new IabException(IABHELPER_INVALID_CONSUMPTION, "Items of type '" + itemInfo.mItemType + "' can't be consumed."); } try { String token = itemInfo.getToken(); String sku = itemInfo.getSku(); if (token == null || token.equals("")) { logError("Can't consume " + sku + ". No token."); throw new IabException(IABHELPER_MISSING_TOKEN, "PurchaseInfo is missing token for sku: " + sku + " " + itemInfo); } logDebug("Consuming sku: " + sku + ", token: " + token); int response = mService.consumePurchase(3, mContext.getPackageName(), token); if (response == BILLING_RESPONSE_RESULT_OK) { logDebug("Successfully consumed sku: " + sku); } else { logDebug("Error consuming consuming sku " + sku + ". " + getResponseDesc(response)); throw new IabException(response, "Error consuming sku " + sku); } } catch (RemoteException e) { throw new IabException(IABHELPER_REMOTE_EXCEPTION, "Remote exception while consuming. PurchaseInfo: " + itemInfo, e); } }
partygame-cocos2d-x
positive
4,212
private synchronized void rebuildJournal() throws IOException { if (journalWriter != null) { journalWriter.close(); } Writer writer = new BufferedWriter(new FileWriter(journalFileTmp), IO_BUFFER_SIZE); try { out.write(MAGIC); } catch (IOException e) { hasErrors = true; } try { out.write("\n"); } catch (IOException e) { hasErrors = true; } try { out.write(VERSION_1); } catch (IOException e) { hasErrors = true; } try { out.write("\n"); } catch (IOException e) { hasErrors = true; } try { out.write(Integer.toString(appVersion)); } catch (IOException e) { hasErrors = true; } try { out.write("\n"); } catch (IOException e) { hasErrors = true; } try { out.write(Integer.toString(valueCount)); } catch (IOException e) { hasErrors = true; } try { out.write("\n"); } catch (IOException e) { hasErrors = true; } try { out.write("\n"); } catch (IOException e) { hasErrors = true; } for (Entry entry : lruEntries.values()) { if (entry.currentEditor != null) { writer.write(DIRTY + ' ' + entry.key + '\n'); } else { writer.write(CLEAN + ' ' + entry.key + entry.getLengths() + '\n'); } } if (journalWriter == null) { return; } for (Entry entry : new ArrayList<Entry>(lruEntries.values())) { if (entry.currentEditor != null) { entry.currentEditor.abort(); } } trimToSize(); journalWriter.close(); journalWriter = null; journalFileTmp.renameTo(journalFile); journalWriter = new BufferedWriter(new FileWriter(journalFile, true), IO_BUFFER_SIZE); }
private synchronized void rebuildJournal() throws IOException { if (journalWriter != null) { journalWriter.close(); } Writer writer = new BufferedWriter(new FileWriter(journalFileTmp), IO_BUFFER_SIZE); try { out.write(MAGIC); } catch (IOException e) { hasErrors = true; } try { out.write("\n"); } catch (IOException e) { hasErrors = true; } try { out.write(VERSION_1); } catch (IOException e) { hasErrors = true; } try { out.write("\n"); } catch (IOException e) { hasErrors = true; } try { out.write(Integer.toString(appVersion)); } catch (IOException e) { hasErrors = true; } try { out.write("\n"); } catch (IOException e) { hasErrors = true; } try { out.write(Integer.toString(valueCount)); } catch (IOException e) { hasErrors = true; } try { out.write("\n"); } catch (IOException e) { hasErrors = true; } try { out.write("\n"); } catch (IOException e) { hasErrors = true; } for (Entry entry : lruEntries.values()) { if (entry.currentEditor != null) { writer.write(DIRTY + ' ' + entry.key + '\n'); } else { writer.write(CLEAN + ' ' + entry.key + entry.getLengths() + '\n'); } } <DeepExtract> if (journalWriter == null) { return; } for (Entry entry : new ArrayList<Entry>(lruEntries.values())) { if (entry.currentEditor != null) { entry.currentEditor.abort(); } } trimToSize(); journalWriter.close(); journalWriter = null; </DeepExtract> journalFileTmp.renameTo(journalFile); journalWriter = new BufferedWriter(new FileWriter(journalFile, true), IO_BUFFER_SIZE); }
dileber
positive
4,213
public void setComponent(int component) { if (0 == 0) return props.put("COMP", new Integer(component)); else return props.put("COMP" + "." + 0, new Integer(component)); }
public void setComponent(int component) { <DeepExtract> if (0 == 0) return props.put("COMP", new Integer(component)); else return props.put("COMP" + "." + 0, new Integer(component)); </DeepExtract> }
geneaquilt
positive
4,214
@Test public void generatePage_generatesHooks() { setUpWithJson(SAMPLE_JSON); final Feature feature = features.get(1); page = new FeatureReportPage(reportResult, configuration, feature); page.generatePage(); DocumentAssertion document = documentFrom(page.getWebPage()); ElementAssertion secondElement = document.getFeature().getElements()[0]; Element element = feature.getElements()[0]; HooksAssertion beforeHooks = secondElement.getBefore(); HookAssertion[] before = beforeHooks.getHooks(); assertThat(before).hasSize(element.getBefore().length); for (int i = 0; i < before.length; i++) { BriefAssertion brief = before[i].getBrief(); assertThat(brief.getKeyword()).isEqualTo("Before"); brief.hasStatus(element.getBefore()[i].getResult().getStatus()); if (element.getBefore()[i].getMatch() != null) { assertThat(brief.getName()).isEqualTo(element.getBefore()[i].getMatch().getLocation()); } if (element.getBefore()[i].getResult() != null) { Result result = element.getBefore()[i].getResult(); brief.hasDuration(result.getDuration()); if (StringUtils.isNotBlank(result.getErrorMessage())) { assertThat(before[i].getErrorMessage()).contains(result.getErrorMessage()); } } } BriefAssertion beforeBrief = beforeHooks.getBrief(); beforeBrief.hasStatus(element.getBeforeStatus()); HooksAssertion afterHooks = secondElement.getAfter(); HookAssertion[] after = afterHooks.getHooks(); assertThat(after).hasSize(element.getAfter().length); for (int i = 0; i < after.length; i++) { BriefAssertion brief = after[i].getBrief(); assertThat(brief.getKeyword()).isEqualTo("After"); brief.hasStatus(element.getAfter()[i].getResult().getStatus()); if (element.getAfter()[i].getMatch() != null) { assertThat(brief.getName()).isEqualTo(element.getAfter()[i].getMatch().getLocation()); } if (element.getAfter()[i].getResult() != null) { Result result = element.getAfter()[i].getResult(); brief.hasDuration(result.getDuration()); if (StringUtils.isNotBlank(result.getErrorMessage())) { assertThat(after[i].getErrorMessage()).contains(result.getErrorMessage()); } } } BriefAssertion afterBrief = afterHooks.getBrief(); afterBrief.hasStatus(element.getAfterStatus()); }
@Test public void generatePage_generatesHooks() { setUpWithJson(SAMPLE_JSON); final Feature feature = features.get(1); page = new FeatureReportPage(reportResult, configuration, feature); page.generatePage(); DocumentAssertion document = documentFrom(page.getWebPage()); ElementAssertion secondElement = document.getFeature().getElements()[0]; Element element = feature.getElements()[0]; HooksAssertion beforeHooks = secondElement.getBefore(); HookAssertion[] before = beforeHooks.getHooks(); assertThat(before).hasSize(element.getBefore().length); for (int i = 0; i < before.length; i++) { BriefAssertion brief = before[i].getBrief(); assertThat(brief.getKeyword()).isEqualTo("Before"); brief.hasStatus(element.getBefore()[i].getResult().getStatus()); if (element.getBefore()[i].getMatch() != null) { assertThat(brief.getName()).isEqualTo(element.getBefore()[i].getMatch().getLocation()); } if (element.getBefore()[i].getResult() != null) { Result result = element.getBefore()[i].getResult(); brief.hasDuration(result.getDuration()); if (StringUtils.isNotBlank(result.getErrorMessage())) { assertThat(before[i].getErrorMessage()).contains(result.getErrorMessage()); } } } BriefAssertion beforeBrief = beforeHooks.getBrief(); beforeBrief.hasStatus(element.getBeforeStatus()); HooksAssertion afterHooks = secondElement.getAfter(); HookAssertion[] after = afterHooks.getHooks(); assertThat(after).hasSize(element.getAfter().length); <DeepExtract> for (int i = 0; i < after.length; i++) { BriefAssertion brief = after[i].getBrief(); assertThat(brief.getKeyword()).isEqualTo("After"); brief.hasStatus(element.getAfter()[i].getResult().getStatus()); if (element.getAfter()[i].getMatch() != null) { assertThat(brief.getName()).isEqualTo(element.getAfter()[i].getMatch().getLocation()); } if (element.getAfter()[i].getResult() != null) { Result result = element.getAfter()[i].getResult(); brief.hasDuration(result.getDuration()); if (StringUtils.isNotBlank(result.getErrorMessage())) { assertThat(after[i].getErrorMessage()).contains(result.getErrorMessage()); } } } </DeepExtract> BriefAssertion afterBrief = afterHooks.getBrief(); afterBrief.hasStatus(element.getAfterStatus()); }
cucumber-reporting
positive
4,217
@Override public void enterFunctionType(SwiftParser.FunctionTypeContext ctx) { Optional<ParseTree> arrowOptional = ctx.children.stream().filter(node -> node.getText().equals("->")).findFirst(); if (!arrowOptional.isPresent()) { return; } ParseTree arrow = arrowOptional.get(); Token left = ParseTreeUtil.getStopTokenForNode(ParseTreeUtil.getLeftSibling(arrow)); Token right = ParseTreeUtil.getStartTokenForNode(ParseTreeUtil.getRightSibling(arrow)); verifier.verifyPunctuationIsSpaceDelimited(left, right, ((TerminalNodeImpl) arrow).getSymbol(), Messages.RETURN_ARROW); }
@Override public void enterFunctionType(SwiftParser.FunctionTypeContext ctx) { Optional<ParseTree> arrowOptional = ctx.children.stream().filter(node -> node.getText().equals("->")).findFirst(); if (!arrowOptional.isPresent()) { return; } ParseTree arrow = arrowOptional.get(); Token left = ParseTreeUtil.getStopTokenForNode(ParseTreeUtil.getLeftSibling(arrow)); Token right = ParseTreeUtil.getStartTokenForNode(ParseTreeUtil.getRightSibling(arrow)); <DeepExtract> verifier.verifyPunctuationIsSpaceDelimited(left, right, ((TerminalNodeImpl) arrow).getSymbol(), Messages.RETURN_ARROW); </DeepExtract> }
tailor
positive
4,219
public void keyReleased(java.awt.event.KeyEvent evt) { int k = evt.getKeyCode(); jField2Left.setText(KeyEvent.getKeyText(k)); keys[1][2] = k; }
public void keyReleased(java.awt.event.KeyEvent evt) { <DeepExtract> int k = evt.getKeyCode(); jField2Left.setText(KeyEvent.getKeyText(k)); keys[1][2] = k; </DeepExtract> }
halfnes
positive
4,220
public Criteria andFromurlNotBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "fromurl" + " cannot be null"); } criteria.add(new Criterion("fromurl not between", value1, value2)); return (Criteria) this; }
public Criteria andFromurlNotBetween(String value1, String value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "fromurl" + " cannot be null"); } criteria.add(new Criterion("fromurl not between", value1, value2)); </DeepExtract> return (Criteria) this; }
zheng-lite
positive
4,221
public static Date addMonths(int months) { Calendar calendar = Calendar.getInstance(); calendar.setTime(getNow()); calendar.add(Calendar.MONTH, months); return calendar.getTime(); }
public static Date addMonths(int months) { <DeepExtract> Calendar calendar = Calendar.getInstance(); calendar.setTime(getNow()); calendar.add(Calendar.MONTH, months); return calendar.getTime(); </DeepExtract> }
goodcrawler
positive
4,222
public void setRightTopCorner(int rightTopCorner) { mRightTopCorner = rightTopCorner; mCorners = new float[] { mLeftTopCorner, mLeftTopCorner, mRightTopCorner, mRightTopCorner, mRightBottomCorner, mRightBottomCorner, mLeftBottomCorner, mLeftBottomCorner }; addRoundRectPath(getWidth(), getHeight()); invalidate(); }
public void setRightTopCorner(int rightTopCorner) { mRightTopCorner = rightTopCorner; <DeepExtract> mCorners = new float[] { mLeftTopCorner, mLeftTopCorner, mRightTopCorner, mRightTopCorner, mRightBottomCorner, mRightBottomCorner, mLeftBottomCorner, mLeftBottomCorner }; addRoundRectPath(getWidth(), getHeight()); invalidate(); </DeepExtract> }
MeiWidgetView
positive
4,223
@Test public void getWithIntegerResponseCode() throws RemoteException { Bundle bundle = mDataConverter.convertToPurchaseResponseBundle(0, 0, 0, null); Mockito.when(mService.getPurchases(mBillingContext.getApiVersion(), mBillingContext.getContext().getPackageName(), Constants.TYPE_IN_APP, null)).thenReturn(bundle); Purchases purchases = null; try { purchases = mGetter.get(mService, Constants.TYPE_IN_APP); } catch (BillingException e) { assertThat(e.getErrorCode()).isEqualTo(-1); assertThat(e.getMessage()).isEqualTo(""); } finally { if (-1 == -1) { assertThat(purchases).isNotNull(); } else { assertThat(purchases).isNull(); } verify(mService).getPurchases(mBillingContext.getApiVersion(), mBillingContext.getContext().getPackageName(), Constants.TYPE_IN_APP, null); verifyNoMoreInteractions(mService); } }
@Test public void getWithIntegerResponseCode() throws RemoteException { Bundle bundle = mDataConverter.convertToPurchaseResponseBundle(0, 0, 0, null); <DeepExtract> Mockito.when(mService.getPurchases(mBillingContext.getApiVersion(), mBillingContext.getContext().getPackageName(), Constants.TYPE_IN_APP, null)).thenReturn(bundle); Purchases purchases = null; try { purchases = mGetter.get(mService, Constants.TYPE_IN_APP); } catch (BillingException e) { assertThat(e.getErrorCode()).isEqualTo(-1); assertThat(e.getMessage()).isEqualTo(""); } finally { if (-1 == -1) { assertThat(purchases).isNotNull(); } else { assertThat(purchases).isNull(); } verify(mService).getPurchases(mBillingContext.getApiVersion(), mBillingContext.getContext().getPackageName(), Constants.TYPE_IN_APP, null); verifyNoMoreInteractions(mService); } </DeepExtract> }
android-easy-checkout
positive
4,225
@Test public void testLimitOrderCreateTransaction() { ECKey privateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); expiration = (System.currentTimeMillis() / 1000) + 60 * 60; LimitOrderCreateOperation operation = new LimitOrderCreateOperation(seller, amountToSell, minToReceive, (int) expiration, false); operation.setFee(new AssetAmount(UnsignedLong.valueOf(2), CORE_ASSET)); ArrayList<BaseOperation> operationList = new ArrayList<>(); operationList.add(operation); try { Transaction transaction = new Transaction(privateKey, null, operationList); SSLContext context = null; context = NaiveSSLContext.getInstance("TLS"); WebSocketFactory factory = new WebSocketFactory(); factory.setSSLContext(context); WebSocket mWebSocket = factory.createSocket(NODE_URL); mWebSocket.addListener(new TransactionBroadcastSequence(transaction, CORE_ASSET, listener)); mWebSocket.connect(); if (null != null) { synchronized (null) { null.wait(); } } else { synchronized (listener) { listener.wait(); } } Assert.assertNotNull(baseResponse); Assert.assertNull(baseResponse.error); } catch (NoSuchAlgorithmException e) { System.out.println("NoSuchAlgoritmException. Msg: " + e.getMessage()); } catch (InterruptedException e) { System.out.println("InterruptedException. Msg: " + e.getMessage()); } catch (IOException e) { System.out.println("IOException. Msg: " + e.getMessage()); } catch (WebSocketException e) { System.out.println("WebSocketException. Msg: " + e.getMessage()); } }
@Test public void testLimitOrderCreateTransaction() { ECKey privateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); expiration = (System.currentTimeMillis() / 1000) + 60 * 60; LimitOrderCreateOperation operation = new LimitOrderCreateOperation(seller, amountToSell, minToReceive, (int) expiration, false); operation.setFee(new AssetAmount(UnsignedLong.valueOf(2), CORE_ASSET)); ArrayList<BaseOperation> operationList = new ArrayList<>(); operationList.add(operation); <DeepExtract> try { Transaction transaction = new Transaction(privateKey, null, operationList); SSLContext context = null; context = NaiveSSLContext.getInstance("TLS"); WebSocketFactory factory = new WebSocketFactory(); factory.setSSLContext(context); WebSocket mWebSocket = factory.createSocket(NODE_URL); mWebSocket.addListener(new TransactionBroadcastSequence(transaction, CORE_ASSET, listener)); mWebSocket.connect(); if (null != null) { synchronized (null) { null.wait(); } } else { synchronized (listener) { listener.wait(); } } Assert.assertNotNull(baseResponse); Assert.assertNull(baseResponse.error); } catch (NoSuchAlgorithmException e) { System.out.println("NoSuchAlgoritmException. Msg: " + e.getMessage()); } catch (InterruptedException e) { System.out.println("InterruptedException. Msg: " + e.getMessage()); } catch (IOException e) { System.out.println("IOException. Msg: " + e.getMessage()); } catch (WebSocketException e) { System.out.println("WebSocketException. Msg: " + e.getMessage()); } </DeepExtract> }
graphenej
positive
4,226
private synchronized void onBlockDownloaded(DownloadBlock block, TLBytes data) { try { if (block.task.file != null) { block.task.file.seek(block.index * block.task.blockSize); block.task.file.write(data.getData(), data.getOffset(), data.getLength()); } else { return; } } catch (IOException e) { Logger.e(TAG, e); } finally { api.getApiContext().releaseBytes(data); } block.task.lastSuccessBlock = System.nanoTime(); block.state = BLOCK_COMPLETED; if (block.task.listener != null) { int downloadedCount = 0; for (DownloadBlock b : block.task.blocks) { if (b.state == BLOCK_COMPLETED) { downloadedCount++; } } int percent = downloadedCount * 100 / block.task.blocks.length; block.task.listener.onPartDownloaded(percent, downloadedCount); } DownloadTask[] activeTasks = getActiveTasks(); outer: for (DownloadTask task : activeTasks) { for (DownloadBlock block : task.blocks) { if (block.state != BLOCK_COMPLETED) { continue outer; } } onTaskCompleted(task); } activeTasks = getActiveTasks(); int count = activeTasks.length; while (count < PARALLEL_DOWNLOAD_COUNT) { long mintime = Long.MAX_VALUE; DownloadTask minTask = null; for (DownloadTask task : tasks) { if (task.state == FILE_QUEUED && task.queueTime < mintime) { minTask = task; } } if (minTask == null) { break; } minTask.state = FILE_DOWNLOADING; Logger.d(TAG, "File #" + minTask.taskId + "| Downloading"); } synchronized (threadLocker) { threadLocker.notifyAll(); } }
private synchronized void onBlockDownloaded(DownloadBlock block, TLBytes data) { try { if (block.task.file != null) { block.task.file.seek(block.index * block.task.blockSize); block.task.file.write(data.getData(), data.getOffset(), data.getLength()); } else { return; } } catch (IOException e) { Logger.e(TAG, e); } finally { api.getApiContext().releaseBytes(data); } block.task.lastSuccessBlock = System.nanoTime(); block.state = BLOCK_COMPLETED; if (block.task.listener != null) { int downloadedCount = 0; for (DownloadBlock b : block.task.blocks) { if (b.state == BLOCK_COMPLETED) { downloadedCount++; } } int percent = downloadedCount * 100 / block.task.blocks.length; block.task.listener.onPartDownloaded(percent, downloadedCount); } <DeepExtract> DownloadTask[] activeTasks = getActiveTasks(); outer: for (DownloadTask task : activeTasks) { for (DownloadBlock block : task.blocks) { if (block.state != BLOCK_COMPLETED) { continue outer; } } onTaskCompleted(task); } activeTasks = getActiveTasks(); int count = activeTasks.length; while (count < PARALLEL_DOWNLOAD_COUNT) { long mintime = Long.MAX_VALUE; DownloadTask minTask = null; for (DownloadTask task : tasks) { if (task.state == FILE_QUEUED && task.queueTime < mintime) { minTask = task; } } if (minTask == null) { break; } minTask.state = FILE_DOWNLOADING; Logger.d(TAG, "File #" + minTask.taskId + "| Downloading"); } synchronized (threadLocker) { threadLocker.notifyAll(); } </DeepExtract> }
telegram-trivia-bot
positive
4,227
private View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyVisible, boolean acceptPartiallyVisible) { if (mOrientationHelper == null) { mOrientationHelper = OrientationHelper.createOrientationHelper(this, mOrientation); } final int start = mOrientationHelper.getStartAfterPadding(); final int end = mOrientationHelper.getEndAfterPadding(); final int next = toIndex > fromIndex ? 1 : -1; View partiallyVisible = null; for (int i = fromIndex; i != toIndex; i += next) { final View child = getChildAt(i); final int childStart = mOrientationHelper.getDecoratedStart(child); final int childEnd = mOrientationHelper.getDecoratedEnd(child); if (childStart < end && childEnd > start) { if (completelyVisible) { if (childStart >= start && childEnd <= end) { return child; } else if (acceptPartiallyVisible && partiallyVisible == null) { partiallyVisible = child; } } else { return child; } } } return partiallyVisible; }
private View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyVisible, boolean acceptPartiallyVisible) { <DeepExtract> if (mOrientationHelper == null) { mOrientationHelper = OrientationHelper.createOrientationHelper(this, mOrientation); } </DeepExtract> final int start = mOrientationHelper.getStartAfterPadding(); final int end = mOrientationHelper.getEndAfterPadding(); final int next = toIndex > fromIndex ? 1 : -1; View partiallyVisible = null; for (int i = fromIndex; i != toIndex; i += next) { final View child = getChildAt(i); final int childStart = mOrientationHelper.getDecoratedStart(child); final int childEnd = mOrientationHelper.getDecoratedEnd(child); if (childStart < end && childEnd > start) { if (completelyVisible) { if (childStart >= start && childEnd <= end) { return child; } else if (acceptPartiallyVisible && partiallyVisible == null) { partiallyVisible = child; } } else { return child; } } } return partiallyVisible; }
V14Leanback
positive
4,229
private void initTransitions() { PLFadeTransition fadeTransition = new PLFadeTransition(0, DURATION / 2, 0, 1); mTransitionMaker.addTransition(mImageView, fadeTransition); PLPositionTransition positionTransition = new PLPositionTransition(0, DURATION / 2, -mTitle.getWidth(), (int) mTitle.getY(), (int) mTitle.getX(), (int) mTitle.getY()); mTransitionMaker.addTransition(mTitle, positionTransition); mTransitionMaker.play(); super.setViewsVisible(View.VISIBLE); mImageView.setVisibility(View.VISIBLE); }
private void initTransitions() { PLFadeTransition fadeTransition = new PLFadeTransition(0, DURATION / 2, 0, 1); mTransitionMaker.addTransition(mImageView, fadeTransition); PLPositionTransition positionTransition = new PLPositionTransition(0, DURATION / 2, -mTitle.getWidth(), (int) mTitle.getY(), (int) mTitle.getX(), (int) mTitle.getY()); mTransitionMaker.addTransition(mTitle, positionTransition); mTransitionMaker.play(); <DeepExtract> super.setViewsVisible(View.VISIBLE); mImageView.setVisibility(View.VISIBLE); </DeepExtract> }
eden
positive
4,230
public static File testJar() { File a = new File("forklift-test-consumer-0.1.jar"); if (a.exists()) return a; File b = new File("forklift-test-consumer-0.1.jar"); if (b.exists()) return b; URL url = Thread.currentThread().getContextClassLoader().getResource("forklift-test-consumer-0.1.jar"); if (url != null) { File c = new File(url.getPath()); if (c.exists()) { return c; } } return null; }
public static File testJar() { <DeepExtract> File a = new File("forklift-test-consumer-0.1.jar"); if (a.exists()) return a; File b = new File("forklift-test-consumer-0.1.jar"); if (b.exists()) return b; URL url = Thread.currentThread().getContextClassLoader().getResource("forklift-test-consumer-0.1.jar"); if (url != null) { File c = new File(url.getPath()); if (c.exists()) { return c; } } return null; </DeepExtract> }
forklift
positive
4,231
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setSupportActionBar(R.id.cnd_toolbar); mVContent = findViewById(R.id.cnd_tv_content); mDensity = getResources().getDisplayMetrics().density; mDrawable = new CornerDrawable((int) (20 * mDensity), (int) (10 * mDensity), ContextCompat.getColor(this, R.color.colorRipple)); mVContent.setBackground(mDrawable); this.<Spinner>findViewById(R.id.cnd_sp_direction).setOnItemSelectedListener(this); this.<Spinner>findViewById(R.id.cnd_sp_location).setOnItemSelectedListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_width).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_height).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_margin).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_bezier).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_stoke).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_radius).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_padding).setOnSeekBarChangeListener(this); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setSupportActionBar(R.id.cnd_toolbar); mVContent = findViewById(R.id.cnd_tv_content); mDensity = getResources().getDisplayMetrics().density; mDrawable = new CornerDrawable((int) (20 * mDensity), (int) (10 * mDensity), ContextCompat.getColor(this, R.color.colorRipple)); <DeepExtract> mVContent.setBackground(mDrawable); </DeepExtract> this.<Spinner>findViewById(R.id.cnd_sp_direction).setOnItemSelectedListener(this); this.<Spinner>findViewById(R.id.cnd_sp_location).setOnItemSelectedListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_width).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_height).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_margin).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_bezier).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_stoke).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_radius).setOnSeekBarChangeListener(this); this.<SeekBar>findViewById(R.id.cnd_sb_padding).setOnSeekBarChangeListener(this); }
ProjectX
positive
4,234
@Test public void deniesIfNotBannedWithAction() { Person mod = db.mod(); Person banned = db.user1(); Person unrelated = db.person("user2"); MonitoredSubreddit sub = db.sub(); db.primarySub(); db.hma(sub, db.now(-59000)); HandledModAction hma1 = db.hma(sub, db.now(-40000)); db.bh(mod, banned, hma1, "msg", true); Set<String> cur = usersToSubreddits.getOrDefault(mod.username, null); if (cur == null) { cur = new HashSet<>(); usersToSubreddits.put(mod.username, cur); } cur.add(sub.subreddit); UnbanRequest req = db.unbanRequest(mod, banned, db.now(-10000), null, false); UnbanRequestResult result = handler.handleUnbanRequest(req); assertTrue(result.invalid); assertFalse(result.userPMs.isEmpty()); UnbanRequest req2 = db.unbanRequest(mod, unrelated, db.now(-5000), null, false); result = handler.handleUnbanRequest(req2); assertTrue(result.invalid); assertFalse(result.userPMs.isEmpty()); }
@Test public void deniesIfNotBannedWithAction() { Person mod = db.mod(); Person banned = db.user1(); Person unrelated = db.person("user2"); MonitoredSubreddit sub = db.sub(); db.primarySub(); db.hma(sub, db.now(-59000)); HandledModAction hma1 = db.hma(sub, db.now(-40000)); db.bh(mod, banned, hma1, "msg", true); <DeepExtract> Set<String> cur = usersToSubreddits.getOrDefault(mod.username, null); if (cur == null) { cur = new HashSet<>(); usersToSubreddits.put(mod.username, cur); } cur.add(sub.subreddit); </DeepExtract> UnbanRequest req = db.unbanRequest(mod, banned, db.now(-10000), null, false); UnbanRequestResult result = handler.handleUnbanRequest(req); assertTrue(result.invalid); assertFalse(result.userPMs.isEmpty()); UnbanRequest req2 = db.unbanRequest(mod, unrelated, db.now(-5000), null, false); result = handler.handleUnbanRequest(req2); assertTrue(result.invalid); assertFalse(result.userPMs.isEmpty()); }
USLBot
positive
4,235
@Override public void pathDone() { if (x0 != sx0 || y0 != sy0) { addLine(x0, y0, sx0, sy0); x0 = sx0; y0 = sy0; } if (DO_MONITORS) { rdrCtx.stats.mon_rdr_endRendering.start(); } if (edgeMinY == Integer.MAX_VALUE) { return; } final int spminX = FloatMath.max(FloatMath.ceil_int(edgeMinX - 0.5d), boundsMinX); final int spmaxX = FloatMath.min(FloatMath.ceil_int(edgeMaxX - 0.5d), boundsMaxX); final int spminY = edgeMinY; final int spmaxY = edgeMaxY; buckets_minY = spminY - boundsMinY; buckets_maxY = spmaxY - boundsMinY; if (DO_LOG_BOUNDS) { MarlinUtils.logInfo("edgesXY = [" + edgeMinX + " ... " + edgeMaxX + "[ [" + edgeMinY + " ... " + edgeMaxY + "["); MarlinUtils.logInfo("spXY = [" + spminX + " ... " + spmaxX + "[ [" + spminY + " ... " + spmaxY + "["); } if ((spminX >= spmaxX) || (spminY >= spmaxY)) { return; } final int pminX = spminX; final int pmaxX = spmaxX; final int pminY = spminY; final int pmaxY = spmaxY; initConsumer(pminX, pminY, pmaxX, pmaxY); if (ENABLE_BLOCK_FLAGS) { enableBlkFlags = this.useRLE; prevUseBlkFlags = enableBlkFlags && !ENABLE_BLOCK_FLAGS_HEURISTICS; if (enableBlkFlags) { final int blkLen = ((pmaxX - pminX) >> BLOCK_SIZE_LG) + 2; if (blkLen > INITIAL_ARRAY) { blkFlags = blkFlags_ref.getArray(blkLen); } } } bbox_spminX = pminX; bbox_spmaxX = pmaxX; bbox_spminY = spminY; bbox_spmaxY = spmaxY; if (DO_LOG_BOUNDS) { MarlinUtils.logInfo("pXY = [" + pminX + " ... " + pmaxX + "[ [" + pminY + " ... " + pmaxY + "["); MarlinUtils.logInfo("bbox_spXY = [" + bbox_spminX + " ... " + bbox_spmaxX + "[ [" + bbox_spminY + " ... " + bbox_spmaxY + "["); } final int width = (pmaxX - pminX) + 2; if (width > INITIAL_AA_ARRAY) { if (DO_STATS) { rdrCtx.stats.stat_array_renderer_alphaline.add(width); } alphaLine = alphaLine_ref.getArray(width); } }
@Override public void pathDone() { if (x0 != sx0 || y0 != sy0) { addLine(x0, y0, sx0, sy0); x0 = sx0; y0 = sy0; } <DeepExtract> if (DO_MONITORS) { rdrCtx.stats.mon_rdr_endRendering.start(); } if (edgeMinY == Integer.MAX_VALUE) { return; } final int spminX = FloatMath.max(FloatMath.ceil_int(edgeMinX - 0.5d), boundsMinX); final int spmaxX = FloatMath.min(FloatMath.ceil_int(edgeMaxX - 0.5d), boundsMaxX); final int spminY = edgeMinY; final int spmaxY = edgeMaxY; buckets_minY = spminY - boundsMinY; buckets_maxY = spmaxY - boundsMinY; if (DO_LOG_BOUNDS) { MarlinUtils.logInfo("edgesXY = [" + edgeMinX + " ... " + edgeMaxX + "[ [" + edgeMinY + " ... " + edgeMaxY + "["); MarlinUtils.logInfo("spXY = [" + spminX + " ... " + spmaxX + "[ [" + spminY + " ... " + spmaxY + "["); } if ((spminX >= spmaxX) || (spminY >= spmaxY)) { return; } final int pminX = spminX; final int pmaxX = spmaxX; final int pminY = spminY; final int pmaxY = spmaxY; initConsumer(pminX, pminY, pmaxX, pmaxY); if (ENABLE_BLOCK_FLAGS) { enableBlkFlags = this.useRLE; prevUseBlkFlags = enableBlkFlags && !ENABLE_BLOCK_FLAGS_HEURISTICS; if (enableBlkFlags) { final int blkLen = ((pmaxX - pminX) >> BLOCK_SIZE_LG) + 2; if (blkLen > INITIAL_ARRAY) { blkFlags = blkFlags_ref.getArray(blkLen); } } } bbox_spminX = pminX; bbox_spmaxX = pmaxX; bbox_spminY = spminY; bbox_spmaxY = spmaxY; if (DO_LOG_BOUNDS) { MarlinUtils.logInfo("pXY = [" + pminX + " ... " + pmaxX + "[ [" + pminY + " ... " + pmaxY + "["); MarlinUtils.logInfo("bbox_spXY = [" + bbox_spminX + " ... " + bbox_spmaxX + "[ [" + bbox_spminY + " ... " + bbox_spmaxY + "["); } final int width = (pmaxX - pminX) + 2; if (width > INITIAL_AA_ARRAY) { if (DO_STATS) { rdrCtx.stats.stat_array_renderer_alphaline.add(width); } alphaLine = alphaLine_ref.getArray(width); } </DeepExtract> }
marlin-fx
positive
4,236
@Override public synchronized void close() throws IOException { if (closed) { return; } closed = true; int size = bufferedChunk.size(); if (size <= 0) { return; } writeHex(size); bufferedChunk.writeTo(socketOut); bufferedChunk.reset(); socketOut.write(CRLF); socketOut.write(FINAL_CHUNK); }
@Override public synchronized void close() throws IOException { if (closed) { return; } closed = true; <DeepExtract> int size = bufferedChunk.size(); if (size <= 0) { return; } writeHex(size); bufferedChunk.writeTo(socketOut); bufferedChunk.reset(); socketOut.write(CRLF); </DeepExtract> socketOut.write(FINAL_CHUNK); }
phonegap-custom-camera-plugin
positive
4,237
@Override public String getFeature(int wordId, int... fields) { if (fields.length == 1) { return extractSingleFeature(wordId, fields[0]); } if (fields.length == 0) { return getAllFeatures(wordId); } if (fields.length == 1) { return extractSingleFeature(wordId, fields[0]); } String[] allFeatures = getAllFeaturesArray(wordId); String[] features = new String[fields.length]; for (int i = 0; i < fields.length; i++) { int featureNumber = fields[i]; features[i] = DictionaryEntryLineParser.escape(allFeatures[featureNumber]); } return StringUtils.join(features, FEATURE_SEPARATOR); }
@Override public String getFeature(int wordId, int... fields) { if (fields.length == 1) { return extractSingleFeature(wordId, fields[0]); } <DeepExtract> if (fields.length == 0) { return getAllFeatures(wordId); } if (fields.length == 1) { return extractSingleFeature(wordId, fields[0]); } String[] allFeatures = getAllFeaturesArray(wordId); String[] features = new String[fields.length]; for (int i = 0; i < fields.length; i++) { int featureNumber = fields[i]; features[i] = DictionaryEntryLineParser.escape(allFeatures[featureNumber]); } return StringUtils.join(features, FEATURE_SEPARATOR); </DeepExtract> }
kuromoji
positive
4,238
@Override public void visit(SkyDriveAlbum album) { if (mView == null) { mView = inflateNewSkyDriveListItem(); } ImageView img = (ImageView) mView.findViewById(R.id.skyDriveItemIcon); img.setImageResource(R.drawable.folder_image); TextView tv = (TextView) mView.findViewById(R.id.nameTextView); tv.setText(album.getName()); String description = album.getDescription(); if (description == null) { description = "No description."; } TextView tv = (TextView) mView.findViewById(R.id.descriptionTextView); tv.setText(description); }
@Override public void visit(SkyDriveAlbum album) { if (mView == null) { mView = inflateNewSkyDriveListItem(); } ImageView img = (ImageView) mView.findViewById(R.id.skyDriveItemIcon); img.setImageResource(R.drawable.folder_image); TextView tv = (TextView) mView.findViewById(R.id.nameTextView); tv.setText(album.getName()); <DeepExtract> String description = album.getDescription(); if (description == null) { description = "No description."; } TextView tv = (TextView) mView.findViewById(R.id.descriptionTextView); tv.setText(description); </DeepExtract> }
Videos
positive
4,239
@Override public void push(T element) { if (size + 1 > elements.length) { grow(); } elements[size++] = element; }
@Override public void push(T element) { <DeepExtract> if (size + 1 > elements.length) { grow(); } </DeepExtract> elements[size++] = element; }
spork
positive
4,240
private void performInsertLink(Object[] param) { int selectionStart = mEditText.getSelectionStart(); if (param == null || param.length == 0) { result = "[]()\n"; mEditText.getText().insert(selectionStart, result); mEditText.setSelection(selectionStart + 1); } else if (param.length == 1) { result = "[" + param[0] + "](" + param[0] + ")\n"; mEditText.getText().insert(selectionStart, result); mEditText.setSelection(selectionStart + result.length()); } else { result = "[" + param[0] + "](" + param[1] + ")\n"; mEditText.getText().insert(selectionStart, result); mEditText.setSelection(selectionStart + result.length()); } }
private void performInsertLink(Object[] param) { <DeepExtract> </DeepExtract> int selectionStart = mEditText.getSelectionStart(); <DeepExtract> </DeepExtract> if (param == null || param.length == 0) { <DeepExtract> </DeepExtract> result = "[]()\n"; <DeepExtract> </DeepExtract> mEditText.getText().insert(selectionStart, result); <DeepExtract> </DeepExtract> mEditText.setSelection(selectionStart + 1); <DeepExtract> </DeepExtract> } else if (param.length == 1) { <DeepExtract> </DeepExtract> result = "[" + param[0] + "](" + param[0] + ")\n"; <DeepExtract> </DeepExtract> mEditText.getText().insert(selectionStart, result); <DeepExtract> </DeepExtract> mEditText.setSelection(selectionStart + result.length()); <DeepExtract> </DeepExtract> } else { <DeepExtract> </DeepExtract> result = "[" + param[0] + "](" + param[1] + ")\n"; <DeepExtract> </DeepExtract> mEditText.getText().insert(selectionStart, result); <DeepExtract> </DeepExtract> mEditText.setSelection(selectionStart + result.length()); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> }
MarkdownEditors
positive
4,241
public String getModules() { final StringBuffer sb = new StringBuffer(); if (modules != null) { int i = 0; for (final String module : modules) { if (i++ > 0) { sb.append(", "); } sb.append(module); } } final StringBuffer sb = new StringBuffer(); int i = 0; for (final String className : origins) { if (i++ > 0) { sb.append(", "); } sb.append(className); } return getJarName() + " [" + sb.toString() + "]"; }
public String getModules() { final StringBuffer sb = new StringBuffer(); if (modules != null) { int i = 0; for (final String module : modules) { if (i++ > 0) { sb.append(", "); } sb.append(module); } } <DeepExtract> final StringBuffer sb = new StringBuffer(); int i = 0; for (final String className : origins) { if (i++ > 0) { sb.append(", "); } sb.append(className); } return getJarName() + " [" + sb.toString() + "]"; </DeepExtract> }
sonos-java
positive
4,242
protected void noViableAlt(int s, IntStream input) throws NoViableAltException { if (recognizer.state.backtracking > 0) { recognizer.state.failed = true; return; } NoViableAltException nvae = new NoViableAltException(getDescription(), decisionNumber, s, input); ; throw nvae; }
protected void noViableAlt(int s, IntStream input) throws NoViableAltException { if (recognizer.state.backtracking > 0) { recognizer.state.failed = true; return; } NoViableAltException nvae = new NoViableAltException(getDescription(), decisionNumber, s, input); <DeepExtract> ; </DeepExtract> throw nvae; }
jtcc
positive
4,243
public void nodeNotFound(final Node controlNode, final Node testNode, final String msg) { if ((msg != null) && (msg.getDifferences() != null)) { addAll(msg.getDifferences()); return true; } return false; }
public void nodeNotFound(final Node controlNode, final Node testNode, final String msg) { <DeepExtract> if ((msg != null) && (msg.getDifferences() != null)) { addAll(msg.getDifferences()); return true; } return false; </DeepExtract> }
seleniumtestsframework
positive
4,244
public static SlotMachine deserialize(Map<String, Object> map) { SlotMachine machine = new SlotMachine((String) map.get("name")); this.typeName = (String) map.get("type_name"); this.owner = (SlotMachineOwner) map.get("owner"); this.controller = (SimpleLocation) map.get("controller"); return machine; }
public static SlotMachine deserialize(Map<String, Object> map) { SlotMachine machine = new SlotMachine((String) map.get("name")); this.typeName = (String) map.get("type_name"); this.owner = (SlotMachineOwner) map.get("owner"); <DeepExtract> this.controller = (SimpleLocation) map.get("controller"); </DeepExtract> return machine; }
CasinoSlots
positive
4,245
private final void setupMenu() { final View mMoreDots = findViewById(R.id.menu_more), mMenuContent = findViewById(R.id.panelContent), mMenuHandle = findViewById(R.id.panelHandle); final View mMoreDots = findViewById(R.id.menu_more), mMenuContent = findViewById(R.id.panelContent), mMenuHandle = findViewById(R.id.panelHandle); final View mMoreDots = findViewById(R.id.menu_more), mMenuContent = findViewById(R.id.panelContent), mMenuHandle = findViewById(R.id.panelHandle); if (mMenu == null) mMenu = (Panel) findViewById(R.id.wpmenu); if (mMenu != null) { final int mMenuBackColor = getResources().getColor(((mThemeDark) ? R.color.menu : R.color.menu_light)); mMenu.setBackgroundColors(mMenuBackColor); } if (mMoreDots != null) { ((ImageView) mMoreDots).setImageResource(((mThemeDark) ? R.drawable.points_white : R.drawable.points_black)); final int mRotation = getRotation(); if (mRotation == Surface.ROTATION_90 || mRotation == Surface.ROTATION_270) { final AnimatorProxy mAnimProxy = AnimatorProxy.wrap(mMoreDots); mAnimProxy.setRotation(90); } } final TextView mSettings = (TextView) findViewById(R.id.settings_button), mHistory = (TextView) findViewById(R.id.history), mShare = (TextView) findViewById(R.id.share_button), mRate = (TextView) findViewById(R.id.rate_button); switch(MENU_NORMAL) { case MENU_NORMAL: { mSettings.setVisibility(View.VISIBLE); mShare.setVisibility(View.VISIBLE); mRate.setVisibility(View.VISIBLE); mHistory.setVisibility(View.VISIBLE); mSettings.setContentDescription(getString(R.string.settings_description)); mShare.setContentDescription(getString(R.string.share_description)); mSettings.setText(R.string.settings); mShare.setText(R.string.share); mRate.setOnClickListener((OnClickListener) new MenuClickWrapper((OnClickListener) new UrlClickListener(this, getString(R.string.rateuri)))); mShare.setOnClickListener((OnClickListener) new MenuClickWrapper((OnClickListener) new LaunchIntentListener(getShareIntent(), this))); mSettings.setOnClickListener((OnClickListener) new MenuClickWrapper((OnClickListener) new LaunchClickListener(AdvancedActivity.class, this))); mHistory.setOnClickListener(mHistoryMenuListener); break; } case MENU_HISTORY: { mSettings.setVisibility(View.VISIBLE); mShare.setVisibility(View.VISIBLE); mRate.setVisibility(View.GONE); mHistory.setVisibility(View.GONE); mSettings.setContentDescription(getString(R.string.home)); mShare.setContentDescription(getString(R.string.clear_description)); mSettings.setText(R.string.history_back); mShare.setText(R.string.history_clear); mSettings.setOnClickListener(mHistoryMenuListener); mShare.setOnClickListener(mClearMenuListener); break; } } }
private final void setupMenu() { final View mMoreDots = findViewById(R.id.menu_more), mMenuContent = findViewById(R.id.panelContent), mMenuHandle = findViewById(R.id.panelHandle); final View mMoreDots = findViewById(R.id.menu_more), mMenuContent = findViewById(R.id.panelContent), mMenuHandle = findViewById(R.id.panelHandle); final View mMoreDots = findViewById(R.id.menu_more), mMenuContent = findViewById(R.id.panelContent), mMenuHandle = findViewById(R.id.panelHandle); if (mMenu == null) mMenu = (Panel) findViewById(R.id.wpmenu); if (mMenu != null) { final int mMenuBackColor = getResources().getColor(((mThemeDark) ? R.color.menu : R.color.menu_light)); mMenu.setBackgroundColors(mMenuBackColor); } if (mMoreDots != null) { ((ImageView) mMoreDots).setImageResource(((mThemeDark) ? R.drawable.points_white : R.drawable.points_black)); final int mRotation = getRotation(); if (mRotation == Surface.ROTATION_90 || mRotation == Surface.ROTATION_270) { final AnimatorProxy mAnimProxy = AnimatorProxy.wrap(mMoreDots); mAnimProxy.setRotation(90); } } <DeepExtract> final TextView mSettings = (TextView) findViewById(R.id.settings_button), mHistory = (TextView) findViewById(R.id.history), mShare = (TextView) findViewById(R.id.share_button), mRate = (TextView) findViewById(R.id.rate_button); switch(MENU_NORMAL) { case MENU_NORMAL: { mSettings.setVisibility(View.VISIBLE); mShare.setVisibility(View.VISIBLE); mRate.setVisibility(View.VISIBLE); mHistory.setVisibility(View.VISIBLE); mSettings.setContentDescription(getString(R.string.settings_description)); mShare.setContentDescription(getString(R.string.share_description)); mSettings.setText(R.string.settings); mShare.setText(R.string.share); mRate.setOnClickListener((OnClickListener) new MenuClickWrapper((OnClickListener) new UrlClickListener(this, getString(R.string.rateuri)))); mShare.setOnClickListener((OnClickListener) new MenuClickWrapper((OnClickListener) new LaunchIntentListener(getShareIntent(), this))); mSettings.setOnClickListener((OnClickListener) new MenuClickWrapper((OnClickListener) new LaunchClickListener(AdvancedActivity.class, this))); mHistory.setOnClickListener(mHistoryMenuListener); break; } case MENU_HISTORY: { mSettings.setVisibility(View.VISIBLE); mShare.setVisibility(View.VISIBLE); mRate.setVisibility(View.GONE); mHistory.setVisibility(View.GONE); mSettings.setContentDescription(getString(R.string.home)); mShare.setContentDescription(getString(R.string.clear_description)); mSettings.setText(R.string.history_back); mShare.setText(R.string.history_clear); mSettings.setOnClickListener(mHistoryMenuListener); mShare.setOnClickListener(mClearMenuListener); break; } } </DeepExtract> }
Seven--Calculator
positive
4,246
@Override public void rebind() { setParams(Param.Texture, u_texture0); this.gamma = this.gamma; setParams(Param.Threshold, this.gamma); setParams(Param.ThresholdInvTx, 1f / (1 - this.gamma)).endParams(); }
@Override public void rebind() { setParams(Param.Texture, u_texture0); <DeepExtract> this.gamma = this.gamma; setParams(Param.Threshold, this.gamma); setParams(Param.ThresholdInvTx, 1f / (1 - this.gamma)).endParams(); </DeepExtract> }
GDX-RPG
positive
4,248
public Criteria andGoodsCountNotEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "goodsCount" + " cannot be null"); } criteria.add(new Criterion("goods_count <>", value)); return (Criteria) this; }
public Criteria andGoodsCountNotEqualTo(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "goodsCount" + " cannot be null"); } criteria.add(new Criterion("goods_count <>", value)); </DeepExtract> return (Criteria) this; }
ssmxiaomi
positive
4,249
private void resetViewState() { mCurrentScreenState = ScreenState.SCREEN_STATE_NORMAL; mVideoControllerView.setCurrentScreenState(ScreenState.SCREEN_STATE_NORMAL); PlayerManager.getInstance().setScreenState(ScreenState.SCREEN_STATE_NORMAL); mCurrentState = PlayState.STATE_NORMAL; onChangeUIState(PlayState.STATE_NORMAL); switch(PlayState.STATE_NORMAL) { case PlayState.STATE_NORMAL: Utils.log("state change to: STATE_NORMAL"); mVideoControllerView.onVideoDurationChanged(0); mVideoControllerView.stopVideoProgressUpdate(); onExitSmallWindowPlay(true); abandonAudioFocus(); ((Activity) getContext()).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); break; case PlayState.STATE_LOADING: Utils.log("state change to: STATE_LOADING"); break; case PlayState.STATE_PLAYING: Utils.log("state change to: STATE_PLAYING"); mVideoControllerView.startVideoProgressUpdate(); break; case PlayState.STATE_PAUSE: Utils.log("state change to: STATE_PAUSE"); mVideoControllerView.stopVideoProgressUpdate(); break; case PlayState.STATE_PLAYING_BUFFERING_START: Utils.log("state change to: STATE_PLAYING_BUFFERING_START"); break; case PlayState.STATE_AUTO_COMPLETE: Utils.log("state change to: STATE_AUTO_COMPLETE"); mVideoControllerView.stopVideoProgressUpdate(); onExitFullScreen(); onExitSmallWindowPlay(true); break; case PlayState.STATE_ERROR: Utils.log("state change to: STATE_ERROR"); mVideoControllerView.onVideoDurationChanged(0); mVideoControllerView.stopVideoProgressUpdate(); abandonAudioFocus(); break; default: throw new IllegalStateException("Illegal Play State:" + PlayState.STATE_NORMAL); } }
private void resetViewState() { mCurrentScreenState = ScreenState.SCREEN_STATE_NORMAL; mVideoControllerView.setCurrentScreenState(ScreenState.SCREEN_STATE_NORMAL); PlayerManager.getInstance().setScreenState(ScreenState.SCREEN_STATE_NORMAL); <DeepExtract> mCurrentState = PlayState.STATE_NORMAL; onChangeUIState(PlayState.STATE_NORMAL); switch(PlayState.STATE_NORMAL) { case PlayState.STATE_NORMAL: Utils.log("state change to: STATE_NORMAL"); mVideoControllerView.onVideoDurationChanged(0); mVideoControllerView.stopVideoProgressUpdate(); onExitSmallWindowPlay(true); abandonAudioFocus(); ((Activity) getContext()).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); break; case PlayState.STATE_LOADING: Utils.log("state change to: STATE_LOADING"); break; case PlayState.STATE_PLAYING: Utils.log("state change to: STATE_PLAYING"); mVideoControllerView.startVideoProgressUpdate(); break; case PlayState.STATE_PAUSE: Utils.log("state change to: STATE_PAUSE"); mVideoControllerView.stopVideoProgressUpdate(); break; case PlayState.STATE_PLAYING_BUFFERING_START: Utils.log("state change to: STATE_PLAYING_BUFFERING_START"); break; case PlayState.STATE_AUTO_COMPLETE: Utils.log("state change to: STATE_AUTO_COMPLETE"); mVideoControllerView.stopVideoProgressUpdate(); onExitFullScreen(); onExitSmallWindowPlay(true); break; case PlayState.STATE_ERROR: Utils.log("state change to: STATE_ERROR"); mVideoControllerView.onVideoDurationChanged(0); mVideoControllerView.stopVideoProgressUpdate(); abandonAudioFocus(); break; default: throw new IllegalStateException("Illegal Play State:" + PlayState.STATE_NORMAL); } </DeepExtract> }
TigerVideo
positive
4,250
public byte[] getBody() { this.body = org.apache.thrift.TBaseHelper.rightSize(body) == null ? (ByteBuffer) null : ByteBuffer.wrap(Arrays.copyOf(org.apache.thrift.TBaseHelper.rightSize(body), org.apache.thrift.TBaseHelper.rightSize(body).length)); return this; return body == null ? null : body.array(); }
public byte[] getBody() { <DeepExtract> this.body = org.apache.thrift.TBaseHelper.rightSize(body) == null ? (ByteBuffer) null : ByteBuffer.wrap(Arrays.copyOf(org.apache.thrift.TBaseHelper.rightSize(body), org.apache.thrift.TBaseHelper.rightSize(body).length)); return this; </DeepExtract> return body == null ? null : body.array(); }
java-rpc-thrift
positive
4,251
@Override protected SQLStmt get_query(Clock clock, WorkloadConfiguration wrklConf) { int year = RandomParameters.randBetween(1993, 1997); long date1 = RandomParameters.convertDatetoLong(year, 1, 1); long date2 = RandomParameters.convertDatetoLong(year + 1, 1, 1); Timestamp ts1 = new Timestamp(clock.transformTsFromSpecToLong(date1)); Timestamp ts2 = new Timestamp(clock.transformTsFromSpecToLong(date2)); String query = "SELECT o_ol_cnt, " + "sum(CASE WHEN o_carrier_id = 1 " + "OR o_carrier_id = 2 THEN 1 ELSE 0 END) AS high_line_count, " + "sum(CASE WHEN o_carrier_id <> 1 " + "AND o_carrier_id <> 2 THEN 1 ELSE 0 END) AS low_line_count " + "FROM " + HTAPBConstants.TABLENAME_ORDER + ", " + HTAPBConstants.TABLENAME_ORDERLINE + " WHERE ol_w_id = o_w_id " + "AND ol_d_id = o_d_id " + "AND ol_o_id = o_id " + "AND o_entry_d <= ol_delivery_d " + "AND ol_delivery_d >= '" + ts1.toString() + "' " + "AND ol_delivery_d < '" + ts2.toString() + "' " + "GROUP BY o_ol_cnt " + "ORDER BY o_ol_cnt"; return new SQLStmt(query); }
@Override protected SQLStmt get_query(Clock clock, WorkloadConfiguration wrklConf) { <DeepExtract> int year = RandomParameters.randBetween(1993, 1997); long date1 = RandomParameters.convertDatetoLong(year, 1, 1); long date2 = RandomParameters.convertDatetoLong(year + 1, 1, 1); Timestamp ts1 = new Timestamp(clock.transformTsFromSpecToLong(date1)); Timestamp ts2 = new Timestamp(clock.transformTsFromSpecToLong(date2)); String query = "SELECT o_ol_cnt, " + "sum(CASE WHEN o_carrier_id = 1 " + "OR o_carrier_id = 2 THEN 1 ELSE 0 END) AS high_line_count, " + "sum(CASE WHEN o_carrier_id <> 1 " + "AND o_carrier_id <> 2 THEN 1 ELSE 0 END) AS low_line_count " + "FROM " + HTAPBConstants.TABLENAME_ORDER + ", " + HTAPBConstants.TABLENAME_ORDERLINE + " WHERE ol_w_id = o_w_id " + "AND ol_d_id = o_d_id " + "AND ol_o_id = o_id " + "AND o_entry_d <= ol_delivery_d " + "AND ol_delivery_d >= '" + ts1.toString() + "' " + "AND ol_delivery_d < '" + ts2.toString() + "' " + "GROUP BY o_ol_cnt " + "ORDER BY o_ol_cnt"; return new SQLStmt(query); </DeepExtract> }
HTAPBench
positive
4,253
public void update() { AppInfo newApp = new AppInfo(); newApp.imageUrl = "路径已修改"; if (appList.size() > 0) tvDb.update(newApp, "num%2=1"); appList.clear(); appList = tvDb.findAll(AppInfo.class); lv_list.setAdapter(new DbListAdapter(this, appList)); }
public void update() { AppInfo newApp = new AppInfo(); newApp.imageUrl = "路径已修改"; if (appList.size() > 0) tvDb.update(newApp, "num%2=1"); <DeepExtract> appList.clear(); appList = tvDb.findAll(AppInfo.class); lv_list.setAdapter(new DbListAdapter(this, appList)); </DeepExtract> }
tvframe
positive
4,254
public void createMetaGenes(HashMap<String, MetaGene> allMetaGenes) { this.metaGenes_ = new HashSet<MetaGene>(); final int mergeDist = (int) Math.floor(1000000 * Pascal.set.mergeGenesDistance_); if (genes_.size() < 1) return; ArrayList<Gene> genesSorted = Gene.sortByPosition(genes_); Iterator<Gene> iter = genesSorted.iterator(); Gene prevGene = iter.next(); TreeSet<Gene> merge = null; while (iter.hasNext()) { Gene curGene = iter.next(); if (curGene.start_ - mergeDist <= prevGene.end_ && curGene.chr_.equals(prevGene.chr_)) { if (merge == null) { merge = new TreeSet<Gene>(); merge.add(prevGene); merge.add(curGene); } else { merge.add(curGene); } } else { if (merge != null) { MetaGene metaGene = new MetaGene(merge); String metaGeneId = metaGene.getId(); if (allMetaGenes.containsKey(metaGeneId)) { getMetaGenes().add(allMetaGenes.get(metaGeneId)); } else { getMetaGenes().add(metaGene); } merge = null; } } prevGene = curGene; } if (merge != null) { MetaGene metaGene = new MetaGene(merge); String metaGeneId = metaGene.getId(); if (allMetaGenes.containsKey(metaGeneId)) { getMetaGenes().add(allMetaGenes.get(metaGeneId)); } else { getMetaGenes().add(metaGene); } } for (MetaGene meta : getMetaGenes()) { genes_.add(meta); for (Gene g : meta.getGenes()) genes_.remove(g); } }
public void createMetaGenes(HashMap<String, MetaGene> allMetaGenes) { <DeepExtract> this.metaGenes_ = new HashSet<MetaGene>(); </DeepExtract> final int mergeDist = (int) Math.floor(1000000 * Pascal.set.mergeGenesDistance_); if (genes_.size() < 1) return; ArrayList<Gene> genesSorted = Gene.sortByPosition(genes_); Iterator<Gene> iter = genesSorted.iterator(); Gene prevGene = iter.next(); TreeSet<Gene> merge = null; while (iter.hasNext()) { Gene curGene = iter.next(); if (curGene.start_ - mergeDist <= prevGene.end_ && curGene.chr_.equals(prevGene.chr_)) { if (merge == null) { merge = new TreeSet<Gene>(); merge.add(prevGene); merge.add(curGene); } else { merge.add(curGene); } } else { if (merge != null) { MetaGene metaGene = new MetaGene(merge); String metaGeneId = metaGene.getId(); if (allMetaGenes.containsKey(metaGeneId)) { getMetaGenes().add(allMetaGenes.get(metaGeneId)); } else { getMetaGenes().add(metaGene); } merge = null; } } prevGene = curGene; } if (merge != null) { MetaGene metaGene = new MetaGene(merge); String metaGeneId = metaGene.getId(); if (allMetaGenes.containsKey(metaGeneId)) { getMetaGenes().add(allMetaGenes.get(metaGeneId)); } else { getMetaGenes().add(metaGene); } } for (MetaGene meta : getMetaGenes()) { genes_.add(meta); for (Gene g : meta.getGenes()) genes_.remove(g); } }
Pascal
positive
4,255
public List<Card> getDoneCards() { List<Card> result = new ArrayList<Card>(); for (Card card : cards) { if (Status.DONE.equals(card.getStatus())) { result.add(card); } } return result; }
public List<Card> getDoneCards() { <DeepExtract> List<Card> result = new ArrayList<Card>(); for (Card card : cards) { if (Status.DONE.equals(card.getStatus())) { result.add(card); } } return result; </DeepExtract> }
calopsita
positive
4,256
@Override public void onTextChanged(CharSequence s, int start, int before, int count) { mCrime.setTitle(s.toString()); CrimeLab.get(getActivity()).updateCrime(mCrime); mCallbacks.onCrimeUpdated(mCrime); }
@Override public void onTextChanged(CharSequence s, int start, int before, int count) { mCrime.setTitle(s.toString()); <DeepExtract> CrimeLab.get(getActivity()).updateCrime(mCrime); mCallbacks.onCrimeUpdated(mCrime); </DeepExtract> }
Android-Programming-The-Big-Nerd-Ranch-Guide-3rd-Edition
positive
4,257
public String toString(int maxCharacters) { StringBuilder sb = new StringBuilder("["); for (Iterator<Json> i = L.iterator(); i.hasNext(); ) { Json value = i.next(); String s = value.isObject() ? ((ObjectJson) value).toStringImpl(maxCharacters, new IdentityHashMap<Json, Json>()) : value.isArray() ? ((ArrayJson) value).toStringImpl(maxCharacters, new IdentityHashMap<Json, Json>()) : value.toString(maxCharacters); if (sb.length() + s.length() > maxCharacters) s = s.substring(0, Math.max(0, maxCharacters - sb.length())); else sb.append(s); if (i.hasNext()) sb.append(","); if (sb.length() >= maxCharacters) { sb.append("..."); break; } } sb.append("]"); return sb.toString(); }
public String toString(int maxCharacters) { <DeepExtract> StringBuilder sb = new StringBuilder("["); for (Iterator<Json> i = L.iterator(); i.hasNext(); ) { Json value = i.next(); String s = value.isObject() ? ((ObjectJson) value).toStringImpl(maxCharacters, new IdentityHashMap<Json, Json>()) : value.isArray() ? ((ArrayJson) value).toStringImpl(maxCharacters, new IdentityHashMap<Json, Json>()) : value.toString(maxCharacters); if (sb.length() + s.length() > maxCharacters) s = s.substring(0, Math.max(0, maxCharacters - sb.length())); else sb.append(s); if (i.hasNext()) sb.append(","); if (sb.length() >= maxCharacters) { sb.append("..."); break; } } sb.append("]"); return sb.toString(); </DeepExtract> }
NiuBi
positive
4,258
@Override public void doRender(Entity entity, double x, double y, double z, float yaw, float partialRenderTick) { if (renderOutlines) { GlStateManager.enableColorMaterial(); float h = (entity.ticksExisted % 80) / 80.0f; GlStateManager.enableOutlineMode(Color.getHSBColor(h, 0.5f, 1.0f).getRGB()); } if (standModel == null) { standModel = new WavefrontObject(modelLocation); } this.bindEntityTexture(entity); EntityBladeStand e = (EntityBladeStand) entity; try (MSAutoCloser mac = MSAutoCloser.pushMatrix()) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); float scale = 0.00675f; EntityBladeStand.StandType type = EntityBladeStand.getType(e); boolean HFlip = false; boolean VFlip = false; switch(e.getFlip()) { case 1: HFlip = false; VFlip = true; break; case 2: HFlip = true; VFlip = false; break; case 3: VFlip = true; HFlip = true; break; default: HFlip = false; VFlip = false; break; } GL11.glTranslatef((float) x, (float) y + 0.5f, (float) z); GL11.glRotatef(yaw, 0, -1, 0); if (type != EntityBladeStand.StandType.Naked) { try (MSAutoCloser msac = MSAutoCloser.pushMatrix()) { if (type == EntityBladeStand.StandType.Wall) GL11.glTranslatef(0, -0.5f, 0); GL11.glScalef(scale, scale, scale); String renderTarget = nameMap.get(type); standModel.renderPart(renderTarget); } } ItemStack blade = e.getBlade(); if (!blade.isEmpty()) try (MSAutoCloser msacc = MSAutoCloser.pushMatrix()) { GL11.glShadeModel(GL11.GL_SMOOTH); ItemSlashBlade item = (ItemSlashBlade) blade.getItem(); EnumSet<ItemSlashBlade.SwordType> types = item.getSwordType(blade); WavefrontObject model = BladeModelManager.getInstance().getModel(item.getModelLocation(blade)); ResourceLocationRaw resourceTexture = item.getModelTexture(blade); engine().bindTexture(resourceTexture); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.05f); boolean isProcessed = false; if (model instanceof WavefrontObject) { WavefrontObject obj = (WavefrontObject) model; StringBuilder sb = new StringBuilder(); sb.append("stand_"); sb.append(StandTypeName.get(type)); if (types.contains(ItemSlashBlade.SwordType.Broken)) sb.append("_damaged"); if (types.contains(ItemSlashBlade.SwordType.NoScabbard)) sb.append("_ns"); String targetBase = sb.toString(); sb.append(HFlip ? "_r" : "_l"); sb.append(VFlip ? "_u" : "_d"); String targetFull = sb.toString(); String renderTarget = null; for (GroupObject go : obj.groupObjects) { if (go.name.toLowerCase().equals(targetBase) || go.name.toLowerCase().equals(targetFull)) { renderTarget = go.name; break; } } if (renderTarget != null) { try (MSAutoCloser msac = MSAutoCloser.pushMatrix()) { GL11.glScalef(scale, scale, scale); model.renderPart(renderTarget); GlStateManager.disableLighting(); try (LightSetup ls = LightSetup.setupAdd()) { model.renderPart(renderTarget + "_luminous"); } GlStateManager.enableLighting(); } isProcessed = true; } } if (!isProcessed && (!(item instanceof ItemSlashBladeWrapper) || ItemSlashBladeWrapper.hasWrapedItem(blade))) { try (MSAutoCloser msac = MSAutoCloser.pushMatrix()) { float hFlipFactor = HFlip ? -1f : 1f; switch(type) { case Naked: GL11.glScalef(scale, scale, scale); if (!types.contains(ItemSlashBlade.SwordType.Broken)) GL11.glTranslatef(0, 200.0f, 0); else GL11.glTranslatef(0, 20.0f, 0); GL11.glRotatef(96.0f, 0, 0, 1); if (VFlip) { GL11.glTranslatef(0, 15f, 0); GL11.glRotatef(7.0f, 0, 0, 1); GL11.glRotatef(180.0f, 1, 0, 0); } break; case Dual: GL11.glTranslatef(0.8f * hFlipFactor, 0.125f, 0); GL11.glScalef(scale, scale, scale); GL11.glRotatef(-3.5f * hFlipFactor, 0, 0, 1); if (HFlip) GL11.glRotatef(180.0f, 0, 1, 0); break; case Wall: GL11.glTranslatef(0, -0.5f, -0.375f); case Single: GL11.glTranslatef(0.8f * hFlipFactor, 0.0f, 0); GL11.glScalef(scale, scale, scale); GL11.glRotatef(-3.5f * hFlipFactor, 0, 0, 1); if (HFlip) GL11.glRotatef(180.0f, 0, 1, 0); if (VFlip) { GL11.glTranslatef(0, 15f, 0); GL11.glRotatef(7.0f, 0, 0, 1); GL11.glRotatef(180.0f, 1, 0, 0); } break; case Upright: if (VFlip) { GL11.glRotatef(2f, 0, 0, 1); GL11.glTranslatef(0.05f, 0, 0); } if (!HFlip) { GL11.glScalef(scale, scale, scale); GL11.glTranslatef(-17.277f, 235.960f, 0); GL11.glRotatef(96.0f, 0, 0, 1); } else { GL11.glScalef(scale, scale, scale); GL11.glTranslatef(27.597f, -21.674f, 0); GL11.glRotatef(103.35f, 0, 0, 1); } if (HFlip) GL11.glRotatef(180.0f, 0, 1, 0); if (VFlip) { GL11.glTranslatef(0, 15f, 0); GL11.glRotatef(7.0f, 0, 0, 1); GL11.glRotatef(180.0f, 1, 0, 0); } break; } String renderTarget; if (types.contains(ItemSlashBlade.SwordType.Broken)) renderTarget = "blade_damaged"; else renderTarget = "blade"; model.renderPart(renderTarget); GlStateManager.disableLighting(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO); try (LightSetup ls = LightSetup.setup()) { model.renderPart(renderTarget + "_luminous"); } OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager.enableLighting(); } } if (!isProcessed && (!types.contains(ItemSlashBlade.SwordType.NoScabbard))) { try (MSAutoCloser msac = MSAutoCloser.pushMatrix()) { float hFlipFactor = HFlip ? -1f : 1f; float vFlipFactor = VFlip ? -1f : 1f; switch(type) { case Naked: if (HFlip) { GL11.glScalef(0, 0, 0); } GL11.glTranslatef(1.5f, -0.45f, 0.5f); GL11.glScalef(scale, scale, scale); GL11.glRotatef(90.0f, 1, 0, 0); if (HFlip) { GL11.glRotatef(180.0f, 0, 1, 0); } break; case Dual: GL11.glTranslatef(1.1f * hFlipFactor, -0.17722f, 0); GL11.glScalef(scale, scale, scale); GL11.glRotatef(-3.5f * hFlipFactor, 0, 0, 1); break; case Wall: GL11.glTranslatef(0, -0.5f, -0.375f); case Single: GL11.glTranslatef(0.8f * hFlipFactor, 0.0f, 0); GL11.glScalef(scale, scale, scale); GL11.glRotatef(-3.5f * hFlipFactor, 0, 0, 1); break; case Upright: if (VFlip) { GL11.glRotatef(2f, 0, 0, 1); GL11.glTranslatef(0.05f, 0, 0); } if (!HFlip) { GL11.glScalef(scale, scale, scale); GL11.glTranslatef(-17.277f, 235.960f, 0); GL11.glRotatef(96.0f, 0, 0, 1); } else { GL11.glScalef(scale, scale, scale); GL11.glTranslatef(27.597f, -21.674f, 0); GL11.glRotatef(103.35f, 0, 0, 1); } break; } if (HFlip) GL11.glRotatef(180.0f, 0, 1, 0); if (VFlip) { GL11.glTranslatef(0, 15f, 0); GL11.glRotatef(7.0f, 0, 0, 1); GL11.glRotatef(180.0f, 1, 0, 0); } String renderTarget = "sheath"; model.renderPart(renderTarget); GlStateManager.disableLighting(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO); try (LightSetup ls = LightSetup.setup()) { model.renderPart(renderTarget + "_luminous"); } OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager.enableLighting(); } } GL11.glShadeModel(GL11.GL_FLAT); } GL11.glPopAttrib(); } if (renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } if (entity.isBurning()) renderEntityOnFire(entity, x, y, z, partialRenderTick); }
@Override public void doRender(Entity entity, double x, double y, double z, float yaw, float partialRenderTick) { if (renderOutlines) { GlStateManager.enableColorMaterial(); float h = (entity.ticksExisted % 80) / 80.0f; GlStateManager.enableOutlineMode(Color.getHSBColor(h, 0.5f, 1.0f).getRGB()); } <DeepExtract> if (standModel == null) { standModel = new WavefrontObject(modelLocation); } this.bindEntityTexture(entity); EntityBladeStand e = (EntityBladeStand) entity; try (MSAutoCloser mac = MSAutoCloser.pushMatrix()) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); float scale = 0.00675f; EntityBladeStand.StandType type = EntityBladeStand.getType(e); boolean HFlip = false; boolean VFlip = false; switch(e.getFlip()) { case 1: HFlip = false; VFlip = true; break; case 2: HFlip = true; VFlip = false; break; case 3: VFlip = true; HFlip = true; break; default: HFlip = false; VFlip = false; break; } GL11.glTranslatef((float) x, (float) y + 0.5f, (float) z); GL11.glRotatef(yaw, 0, -1, 0); if (type != EntityBladeStand.StandType.Naked) { try (MSAutoCloser msac = MSAutoCloser.pushMatrix()) { if (type == EntityBladeStand.StandType.Wall) GL11.glTranslatef(0, -0.5f, 0); GL11.glScalef(scale, scale, scale); String renderTarget = nameMap.get(type); standModel.renderPart(renderTarget); } } ItemStack blade = e.getBlade(); if (!blade.isEmpty()) try (MSAutoCloser msacc = MSAutoCloser.pushMatrix()) { GL11.glShadeModel(GL11.GL_SMOOTH); ItemSlashBlade item = (ItemSlashBlade) blade.getItem(); EnumSet<ItemSlashBlade.SwordType> types = item.getSwordType(blade); WavefrontObject model = BladeModelManager.getInstance().getModel(item.getModelLocation(blade)); ResourceLocationRaw resourceTexture = item.getModelTexture(blade); engine().bindTexture(resourceTexture); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.05f); boolean isProcessed = false; if (model instanceof WavefrontObject) { WavefrontObject obj = (WavefrontObject) model; StringBuilder sb = new StringBuilder(); sb.append("stand_"); sb.append(StandTypeName.get(type)); if (types.contains(ItemSlashBlade.SwordType.Broken)) sb.append("_damaged"); if (types.contains(ItemSlashBlade.SwordType.NoScabbard)) sb.append("_ns"); String targetBase = sb.toString(); sb.append(HFlip ? "_r" : "_l"); sb.append(VFlip ? "_u" : "_d"); String targetFull = sb.toString(); String renderTarget = null; for (GroupObject go : obj.groupObjects) { if (go.name.toLowerCase().equals(targetBase) || go.name.toLowerCase().equals(targetFull)) { renderTarget = go.name; break; } } if (renderTarget != null) { try (MSAutoCloser msac = MSAutoCloser.pushMatrix()) { GL11.glScalef(scale, scale, scale); model.renderPart(renderTarget); GlStateManager.disableLighting(); try (LightSetup ls = LightSetup.setupAdd()) { model.renderPart(renderTarget + "_luminous"); } GlStateManager.enableLighting(); } isProcessed = true; } } if (!isProcessed && (!(item instanceof ItemSlashBladeWrapper) || ItemSlashBladeWrapper.hasWrapedItem(blade))) { try (MSAutoCloser msac = MSAutoCloser.pushMatrix()) { float hFlipFactor = HFlip ? -1f : 1f; switch(type) { case Naked: GL11.glScalef(scale, scale, scale); if (!types.contains(ItemSlashBlade.SwordType.Broken)) GL11.glTranslatef(0, 200.0f, 0); else GL11.glTranslatef(0, 20.0f, 0); GL11.glRotatef(96.0f, 0, 0, 1); if (VFlip) { GL11.glTranslatef(0, 15f, 0); GL11.glRotatef(7.0f, 0, 0, 1); GL11.glRotatef(180.0f, 1, 0, 0); } break; case Dual: GL11.glTranslatef(0.8f * hFlipFactor, 0.125f, 0); GL11.glScalef(scale, scale, scale); GL11.glRotatef(-3.5f * hFlipFactor, 0, 0, 1); if (HFlip) GL11.glRotatef(180.0f, 0, 1, 0); break; case Wall: GL11.glTranslatef(0, -0.5f, -0.375f); case Single: GL11.glTranslatef(0.8f * hFlipFactor, 0.0f, 0); GL11.glScalef(scale, scale, scale); GL11.glRotatef(-3.5f * hFlipFactor, 0, 0, 1); if (HFlip) GL11.glRotatef(180.0f, 0, 1, 0); if (VFlip) { GL11.glTranslatef(0, 15f, 0); GL11.glRotatef(7.0f, 0, 0, 1); GL11.glRotatef(180.0f, 1, 0, 0); } break; case Upright: if (VFlip) { GL11.glRotatef(2f, 0, 0, 1); GL11.glTranslatef(0.05f, 0, 0); } if (!HFlip) { GL11.glScalef(scale, scale, scale); GL11.glTranslatef(-17.277f, 235.960f, 0); GL11.glRotatef(96.0f, 0, 0, 1); } else { GL11.glScalef(scale, scale, scale); GL11.glTranslatef(27.597f, -21.674f, 0); GL11.glRotatef(103.35f, 0, 0, 1); } if (HFlip) GL11.glRotatef(180.0f, 0, 1, 0); if (VFlip) { GL11.glTranslatef(0, 15f, 0); GL11.glRotatef(7.0f, 0, 0, 1); GL11.glRotatef(180.0f, 1, 0, 0); } break; } String renderTarget; if (types.contains(ItemSlashBlade.SwordType.Broken)) renderTarget = "blade_damaged"; else renderTarget = "blade"; model.renderPart(renderTarget); GlStateManager.disableLighting(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO); try (LightSetup ls = LightSetup.setup()) { model.renderPart(renderTarget + "_luminous"); } OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager.enableLighting(); } } if (!isProcessed && (!types.contains(ItemSlashBlade.SwordType.NoScabbard))) { try (MSAutoCloser msac = MSAutoCloser.pushMatrix()) { float hFlipFactor = HFlip ? -1f : 1f; float vFlipFactor = VFlip ? -1f : 1f; switch(type) { case Naked: if (HFlip) { GL11.glScalef(0, 0, 0); } GL11.glTranslatef(1.5f, -0.45f, 0.5f); GL11.glScalef(scale, scale, scale); GL11.glRotatef(90.0f, 1, 0, 0); if (HFlip) { GL11.glRotatef(180.0f, 0, 1, 0); } break; case Dual: GL11.glTranslatef(1.1f * hFlipFactor, -0.17722f, 0); GL11.glScalef(scale, scale, scale); GL11.glRotatef(-3.5f * hFlipFactor, 0, 0, 1); break; case Wall: GL11.glTranslatef(0, -0.5f, -0.375f); case Single: GL11.glTranslatef(0.8f * hFlipFactor, 0.0f, 0); GL11.glScalef(scale, scale, scale); GL11.glRotatef(-3.5f * hFlipFactor, 0, 0, 1); break; case Upright: if (VFlip) { GL11.glRotatef(2f, 0, 0, 1); GL11.glTranslatef(0.05f, 0, 0); } if (!HFlip) { GL11.glScalef(scale, scale, scale); GL11.glTranslatef(-17.277f, 235.960f, 0); GL11.glRotatef(96.0f, 0, 0, 1); } else { GL11.glScalef(scale, scale, scale); GL11.glTranslatef(27.597f, -21.674f, 0); GL11.glRotatef(103.35f, 0, 0, 1); } break; } if (HFlip) GL11.glRotatef(180.0f, 0, 1, 0); if (VFlip) { GL11.glTranslatef(0, 15f, 0); GL11.glRotatef(7.0f, 0, 0, 1); GL11.glRotatef(180.0f, 1, 0, 0); } String renderTarget = "sheath"; model.renderPart(renderTarget); GlStateManager.disableLighting(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO); try (LightSetup ls = LightSetup.setup()) { model.renderPart(renderTarget + "_luminous"); } OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager.enableLighting(); } } GL11.glShadeModel(GL11.GL_FLAT); } GL11.glPopAttrib(); } </DeepExtract> if (renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } if (entity.isBurning()) renderEntityOnFire(entity, x, y, z, partialRenderTick); }
SlashBlade
positive
4,259
private void markContinuableAnnotation(String annotationClassDescriptor) { processedAnnotations.add(annotationClassDescriptor); continuableAnnotations.add(annotationClassDescriptor); }
private void markContinuableAnnotation(String annotationClassDescriptor) { <DeepExtract> processedAnnotations.add(annotationClassDescriptor); </DeepExtract> continuableAnnotations.add(annotationClassDescriptor); }
tascalate-javaflow
positive
4,260
@Test public void testRefreshFlowsQosToIdenticalQos() { updateThenRefreshFlowsThenCheck(Arrays.asList(tapA1a), Arrays.asList(tapA1a)); for (Event event : eventsA[0]) { eventTapWriter.write(event); } Collection<MockEventTapFlow> eventTapFlows = getEventTapFlows().get(key); assertNotNull(eventTapFlows, context()); assertEquals(eventTapFlows.size(), 1, context()); MockEventTapFlow eventTapFlow = eventTapFlows.iterator().next(); assertEquals(eventTapFlow.getTaps(), taps, context()); assertEqualsNoOrder(eventTapFlow.getEvents().toArray(), ImmutableList.copyOf(eventsA[0]).toArray(), context()); return this; updateThenRefreshFlowsThenCheck(Arrays.asList(tapA1b), Arrays.asList(tapA1b)); for (Event event : eventsA[1]) { eventTapWriter.write(event); } forTap(tapA1b).verifyEvents(eventsA[0], eventsA[1]); }
@Test public void testRefreshFlowsQosToIdenticalQos() { updateThenRefreshFlowsThenCheck(Arrays.asList(tapA1a), Arrays.asList(tapA1a)); for (Event event : eventsA[0]) { eventTapWriter.write(event); } Collection<MockEventTapFlow> eventTapFlows = getEventTapFlows().get(key); assertNotNull(eventTapFlows, context()); assertEquals(eventTapFlows.size(), 1, context()); MockEventTapFlow eventTapFlow = eventTapFlows.iterator().next(); assertEquals(eventTapFlow.getTaps(), taps, context()); assertEqualsNoOrder(eventTapFlow.getEvents().toArray(), ImmutableList.copyOf(eventsA[0]).toArray(), context()); return this; updateThenRefreshFlowsThenCheck(Arrays.asList(tapA1b), Arrays.asList(tapA1b)); <DeepExtract> for (Event event : eventsA[1]) { eventTapWriter.write(event); } </DeepExtract> forTap(tapA1b).verifyEvents(eventsA[0], eventsA[1]); }
event-collector
positive
4,261
public static void main(String[] args) throws ClassNotFoundException { String path = "/Users/zhengjun/Workspaces/inspace/insurance_risk/src/main/java/com/qunar/insurance/statistic/dao/model/BlackListRecord.class"; FileSystemClassLoader loader = new FileSystemClassLoader(); byte[] classData = getClassData(path); if (classData == null) { throw new ClassNotFoundException(); } else { String className = "com/qunar/insurance/statistic/dao/model/BlackListRecord.class"; className = className.replace("/", "."); return defineClass(className, classData, 0, classData.length); } }
public static void main(String[] args) throws ClassNotFoundException { String path = "/Users/zhengjun/Workspaces/inspace/insurance_risk/src/main/java/com/qunar/insurance/statistic/dao/model/BlackListRecord.class"; FileSystemClassLoader loader = new FileSystemClassLoader(); <DeepExtract> byte[] classData = getClassData(path); if (classData == null) { throw new ClassNotFoundException(); } else { String className = "com/qunar/insurance/statistic/dao/model/BlackListRecord.class"; className = className.replace("/", "."); return defineClass(className, classData, 0, classData.length); } </DeepExtract> }
codehelper.generator
positive
4,262
private void enableDisable() { localUploadAction.setEnabled(isLocalItemSelected()); boolean isSelected = isRemoteItemSelected(); remoteDeleteAction.setEnabled(isSelected); remoteDownloadAction.setEnabled(isSelected); diffOverwriteAction.setEnabled(isDiffItemSelected()); }
private void enableDisable() { localUploadAction.setEnabled(isLocalItemSelected()); boolean isSelected = isRemoteItemSelected(); remoteDeleteAction.setEnabled(isSelected); remoteDownloadAction.setEnabled(isSelected); <DeepExtract> diffOverwriteAction.setEnabled(isDiffItemSelected()); </DeepExtract> }
swift-explorer
positive
4,263
@Test() public void formateWithLessDigitsTest() { Template<Number> template = mock(Template.class); when(template.getLanguage()).thenReturn("de"); when(template.getInputType()).thenReturn((Class) Number.class); TemplateContext<Number> context = contextFactory.createTemplateContext(template); context.bind(1000.55); String formated = context.resolveValue("format:number(3) value"); assertEquals("1000.550", formated); }
@Test() public void formateWithLessDigitsTest() { <DeepExtract> Template<Number> template = mock(Template.class); when(template.getLanguage()).thenReturn("de"); when(template.getInputType()).thenReturn((Class) Number.class); TemplateContext<Number> context = contextFactory.createTemplateContext(template); context.bind(1000.55); String formated = context.resolveValue("format:number(3) value"); assertEquals("1000.550", formated); </DeepExtract> }
wte4j
positive
4,265
public final Town newTown(String name, Resident creator) { Town town = new Town(name); for (World world : MinecraftServer.getServer().worldServers) { if (!MyTownUniverse.instance.worlds.contains(world.provider.dimensionId)) { getDatasource().saveWorld(world.provider.dimensionId); } } town.setSpawn(new Teleport(creator.getPlayer().dimension, (float) creator.getPlayer().posX, (float) creator.getPlayer().posY, (float) creator.getPlayer().posZ, creator.getPlayer().cameraYaw, creator.getPlayer().cameraPitch)); if (!getDatasource().saveTown(town)) throw new CommandException("Failed to save Town"); int chunkX = ((int) creator.getPlayer().posX) >> 4; int chunkZ = ((int) creator.getPlayer().posZ) >> 4; int dim = creator.getPlayer().dimension; TownBlock block = newBlock(dim, chunkX, chunkZ, false, Config.instance.costAmountClaim.get(), town); if (MyTownUniverse.instance.blocks.contains(dim, chunkX, chunkZ)) { getDatasource().deleteTown(town); throw new CommandException("Chunk at (" + dim + "," + chunkX + "," + chunkZ + ") is already claimed"); } getDatasource().saveBlock(block); for (FlagType type : FlagType.values()) { if (type.isTownPerm) { getDatasource().saveFlag(new Flag(type, type.defaultValue), town); } } if (!(town instanceof AdminTown)) { for (Rank template : Rank.defaultRanks) { Rank rank = new Rank(template.getName(), town, template.getType()); rank.permissionsContainer.addAll(template.permissionsContainer); getDatasource().saveRank(rank); } if (!getDatasource().linkResidentToTown(creator, town, town.ranksContainer.getMayorRank())) { MyTown.instance.LOG.error("Problem linking resident {} to town {}", creator.getPlayerName(), town.getName()); } getDatasource().saveTownBank(town.bank); } TownEvent.fire(new TownEvent.TownCreateEvent(town)); return town; }
public final Town newTown(String name, Resident creator) { Town town = new Town(name); <DeepExtract> for (World world : MinecraftServer.getServer().worldServers) { if (!MyTownUniverse.instance.worlds.contains(world.provider.dimensionId)) { getDatasource().saveWorld(world.provider.dimensionId); } } town.setSpawn(new Teleport(creator.getPlayer().dimension, (float) creator.getPlayer().posX, (float) creator.getPlayer().posY, (float) creator.getPlayer().posZ, creator.getPlayer().cameraYaw, creator.getPlayer().cameraPitch)); if (!getDatasource().saveTown(town)) throw new CommandException("Failed to save Town"); int chunkX = ((int) creator.getPlayer().posX) >> 4; int chunkZ = ((int) creator.getPlayer().posZ) >> 4; int dim = creator.getPlayer().dimension; TownBlock block = newBlock(dim, chunkX, chunkZ, false, Config.instance.costAmountClaim.get(), town); if (MyTownUniverse.instance.blocks.contains(dim, chunkX, chunkZ)) { getDatasource().deleteTown(town); throw new CommandException("Chunk at (" + dim + "," + chunkX + "," + chunkZ + ") is already claimed"); } getDatasource().saveBlock(block); for (FlagType type : FlagType.values()) { if (type.isTownPerm) { getDatasource().saveFlag(new Flag(type, type.defaultValue), town); } } if (!(town instanceof AdminTown)) { for (Rank template : Rank.defaultRanks) { Rank rank = new Rank(template.getName(), town, template.getType()); rank.permissionsContainer.addAll(template.permissionsContainer); getDatasource().saveRank(rank); } if (!getDatasource().linkResidentToTown(creator, town, town.ranksContainer.getMayorRank())) { MyTown.instance.LOG.error("Problem linking resident {} to town {}", creator.getPlayerName(), town.getName()); } getDatasource().saveTownBank(town.bank); } TownEvent.fire(new TownEvent.TownCreateEvent(town)); </DeepExtract> return town; }
MyTown2
positive
4,267
public String getModifierDesc() { if (this.modifierList == null || this.modifierList.size() == 0) return ""; StringBuilder sb = new StringBuilder(); for (String mod : this.modifierList) { sb.append(mod).append(" "); } StringBuilder sb = new StringBuilder(); if (modifierList != null) { for (String str : modifierList) { sb.append(str).append(" "); } } if (memberType == MemberType.METHOD) { sb.append(" " + rtnType + " " + name + "(" + formatParamList() + ")" + " : " + lineNum); } else if (memberType == MemberType.CONSTRUCTOR) { sb.append(" " + name + "(" + formatParamList() + ")" + " : " + lineNum); } else if (memberType == MemberType.FIELD) { sb.append(rtnType + " " + name + " : " + lineNum); } return sb.toString(); }
public String getModifierDesc() { if (this.modifierList == null || this.modifierList.size() == 0) return ""; StringBuilder sb = new StringBuilder(); for (String mod : this.modifierList) { sb.append(mod).append(" "); } <DeepExtract> StringBuilder sb = new StringBuilder(); if (modifierList != null) { for (String str : modifierList) { sb.append(str).append(" "); } } if (memberType == MemberType.METHOD) { sb.append(" " + rtnType + " " + name + "(" + formatParamList() + ")" + " : " + lineNum); } else if (memberType == MemberType.CONSTRUCTOR) { sb.append(" " + name + "(" + formatParamList() + ")" + " : " + lineNum); } else if (memberType == MemberType.FIELD) { sb.append(rtnType + " " + name + " : " + lineNum); } return sb.toString(); </DeepExtract> }
vinja
positive
4,268
@Test public void isSupported_ridesInstalled_withoutProductPriority_andRedirectToSdkFlowVersion_shouldBeTrue() { int ridesMinVersion = REDIRECT_TO_SDK == REDIRECT_TO_SDK ? MIN_UBER_RIDES_VERSION_REDIRECT_FLOW_SUPPORTED : MIN_UBER_RIDES_VERSION_SUPPORTED; when(appProtocol.isInstalled(activity, UBER, ridesMinVersion)).thenReturn(true); when(appProtocol.isInstalled(activity, UBER_EATS, MIN_UBER_EATS_VERSION_SUPPORTED)).thenReturn(true); assertThat(ssoDeeplink.isSupported(REDIRECT_TO_SDK)).isTrue(); verify(appProtocol).isInstalled(activity, UBER, MIN_UBER_RIDES_VERSION_REDIRECT_FLOW_SUPPORTED); verify(appProtocol, never()).isInstalled(any(Context.class), eq(UBER_EATS), anyInt()); }
@Test public void isSupported_ridesInstalled_withoutProductPriority_andRedirectToSdkFlowVersion_shouldBeTrue() { <DeepExtract> int ridesMinVersion = REDIRECT_TO_SDK == REDIRECT_TO_SDK ? MIN_UBER_RIDES_VERSION_REDIRECT_FLOW_SUPPORTED : MIN_UBER_RIDES_VERSION_SUPPORTED; when(appProtocol.isInstalled(activity, UBER, ridesMinVersion)).thenReturn(true); when(appProtocol.isInstalled(activity, UBER_EATS, MIN_UBER_EATS_VERSION_SUPPORTED)).thenReturn(true); </DeepExtract> assertThat(ssoDeeplink.isSupported(REDIRECT_TO_SDK)).isTrue(); verify(appProtocol).isInstalled(activity, UBER, MIN_UBER_RIDES_VERSION_REDIRECT_FLOW_SUPPORTED); verify(appProtocol, never()).isInstalled(any(Context.class), eq(UBER_EATS), anyInt()); }
rides-android-sdk
positive
4,269
public static void main(String[] args) { if (!parseArguments(args)) { return; } OutputClass outputBlob = new OutputClass(); outputBlob.setParams(new CompareParams(bamFilenames.get(0).substring(0, Math.min(64, bamFilenames.get(0).length())), wiggle, bedFilename, identityThreshold)); outputBlob.setStats(new MapRatioRecordSum()); final SAMFileWriterFactory writerFactory = new SAMFileWriterFactory(); final SamReaderFactory factory = SamReaderFactory.makeDefault().enable(SamReaderFactory.Option.INCLUDE_SOURCE_IN_RECORDS, SamReaderFactory.Option.VALIDATE_CRC_CHECKSUMS).validationStringency(ValidationStringency.LENIENT); final Map<BlockType, SAMFileWriter> fpWriters = new EnumMap<>(BlockType.class); try (final PrintWriter jsonWriter = new PrintWriter(outPrefix + "_report.json", "UTF-8"); final SAMFileWriter tumFPWriter = writerFactory.makeBAMWriter(factory.getFileHeader(new File(bamFilenames.get(0))), false, new File(outPrefix + "_TUM_FP.bam")); final SAMFileWriter fpWriter = writerFactory.makeBAMWriter(factory.getFileHeader(new File(bamFilenames.get(0))), false, new File(outPrefix + "_FP.bam"))) { for (final BlockType blockType : BlockType.values()) { if (blockType != BlockType.UNKNOWN) { fpWriters.put(blockType, writerFactory.makeBAMWriter(factory.getFileHeader(new File(bamFilenames.get(0))), false, new File(outPrefix + "_" + blockType.getShortName() + "_FP.bam"))); } } ReadMap readMap = readMapFile != null ? new ReadMap(readMapFile) : null; final BedFile intersector = (bedFilename != null && new File(bedFilename).isFile()) ? new BedFile(bedFilename) : null; int numReads = 0; for (String filename : bamFilenames) { log.info("Reading file: " + filename); final SamReader reader = factory.open(new File(filename)); for (SAMRecord rec : reader) { if (!useNonPrimary && (rec.getNotPrimaryAlignmentFlag() || rec.getSupplementaryAlignmentFlag())) { continue; } numReads++; if (numReads % 100000 == 0) { log.info("Read " + numReads + " records ..."); } String name = rec.getReadName(); int pair_idx = rec.getReadPairedFlag() ? getPairIdx(rec.getFirstOfPairFlag()) : 0; log.trace("Getting true locations for read " + name); final Collection<GenomeLocation> trueLoci = readMap != null ? readMap.getReadMapRecord(name).getUnclippedStarts(pair_idx) : new SimulatedRead(name).getLocs(pair_idx); if (!isContainedInBed(intersector, trueLoci, rec)) { continue; } boolean isTrueUnmapped; Set<EventTypesForStats> features = EnumSet.noneOf(EventTypesForStats.class); features.add(EventTypesForStats.All); isTrueUnmapped = true; if (!trueLoci.isEmpty()) { for (GenomeLocation loc : trueLoci) { final BlockType feat = loc.feature; features.add(EventTypesForStats.valueOf(feat.getLongName())); isTrueUnmapped &= !feat.isMappable(); } } if (isTrueUnmapped) { features.add(EventTypesForStats.True_Unmapped); } else { outputBlob.getStats().incStat(features, -1, StatsNamespace.T); } boolean unmapped = rec.getReadUnmappedFlag(); int mappingQuality = unmapped ? MAPQ_UNMAPPED : rec.getMappingQuality(); StatsNamespace validationStatus = StatsNamespace.TP; if (unmapped) { validationStatus = isTrueUnmapped ? StatsNamespace.TN : StatsNamespace.FN; } else { boolean closeAln = false; if (isTrueUnmapped) { if (getIdentity(rec) <= identityThreshold && mappingQuality > mapqCutoff) { tumFPWriter.addAlignment(rec); } } else { final GenomeLocation mappedLocation = new GenomeLocation(new ChrString(rec.getReferenceName()), rec.getUnclippedStart()); for (GenomeLocation loc : trueLoci) { closeAln |= loc.feature.isMappable() && loc.isClose(mappedLocation, wiggle); } if (!closeAln) { if (getIdentity(rec) <= identityThreshold && mappingQuality > mapqCutoff) { fpWriter.addAlignment(rec); validationStatus = StatsNamespace.FP; for (final BlockType blockType : BlockType.values()) { if (fpWriters.containsKey(blockType) && features.contains(EventTypesForStats.valueOf(blockType.getLongName()))) { fpWriters.get(blockType).addAlignment(rec); } } } } } } outputBlob.getStats().incStat(features, mappingQuality, validationStatus); } reader.close(); } log.info("Number of reads read: " + numReads); log.info("Statistics for all reads"); log.info(outputBlob.getStats()); ObjectMapper mapper = new ObjectMapper(); mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false); String jsonStr = ""; try { jsonStr = mapper.writeValueAsString(outputBlob); } catch (JsonProcessingException e) { e.printStackTrace(); System.exit(1); } jsonWriter.print(jsonStr); if (htmlFile != null) { FileUtils.writeStringToFile(new File(outPrefix + "_aligncomp.html"), JSONInserter.insertJSON(FileUtils.readFileToString(htmlFile), jsonStr)); } for (final BlockType blockType : BlockType.values()) { if (blockType != BlockType.UNKNOWN) { fpWriters.get(blockType).close(); } } fpWriters.values().stream().forEach(SAMFileWriter::close); } catch (IOException e) { e.printStackTrace(); System.exit(1); } log.info("Done!"); }
public static void main(String[] args) { <DeepExtract> if (!parseArguments(args)) { return; } OutputClass outputBlob = new OutputClass(); outputBlob.setParams(new CompareParams(bamFilenames.get(0).substring(0, Math.min(64, bamFilenames.get(0).length())), wiggle, bedFilename, identityThreshold)); outputBlob.setStats(new MapRatioRecordSum()); final SAMFileWriterFactory writerFactory = new SAMFileWriterFactory(); final SamReaderFactory factory = SamReaderFactory.makeDefault().enable(SamReaderFactory.Option.INCLUDE_SOURCE_IN_RECORDS, SamReaderFactory.Option.VALIDATE_CRC_CHECKSUMS).validationStringency(ValidationStringency.LENIENT); final Map<BlockType, SAMFileWriter> fpWriters = new EnumMap<>(BlockType.class); try (final PrintWriter jsonWriter = new PrintWriter(outPrefix + "_report.json", "UTF-8"); final SAMFileWriter tumFPWriter = writerFactory.makeBAMWriter(factory.getFileHeader(new File(bamFilenames.get(0))), false, new File(outPrefix + "_TUM_FP.bam")); final SAMFileWriter fpWriter = writerFactory.makeBAMWriter(factory.getFileHeader(new File(bamFilenames.get(0))), false, new File(outPrefix + "_FP.bam"))) { for (final BlockType blockType : BlockType.values()) { if (blockType != BlockType.UNKNOWN) { fpWriters.put(blockType, writerFactory.makeBAMWriter(factory.getFileHeader(new File(bamFilenames.get(0))), false, new File(outPrefix + "_" + blockType.getShortName() + "_FP.bam"))); } } ReadMap readMap = readMapFile != null ? new ReadMap(readMapFile) : null; final BedFile intersector = (bedFilename != null && new File(bedFilename).isFile()) ? new BedFile(bedFilename) : null; int numReads = 0; for (String filename : bamFilenames) { log.info("Reading file: " + filename); final SamReader reader = factory.open(new File(filename)); for (SAMRecord rec : reader) { if (!useNonPrimary && (rec.getNotPrimaryAlignmentFlag() || rec.getSupplementaryAlignmentFlag())) { continue; } numReads++; if (numReads % 100000 == 0) { log.info("Read " + numReads + " records ..."); } String name = rec.getReadName(); int pair_idx = rec.getReadPairedFlag() ? getPairIdx(rec.getFirstOfPairFlag()) : 0; log.trace("Getting true locations for read " + name); final Collection<GenomeLocation> trueLoci = readMap != null ? readMap.getReadMapRecord(name).getUnclippedStarts(pair_idx) : new SimulatedRead(name).getLocs(pair_idx); if (!isContainedInBed(intersector, trueLoci, rec)) { continue; } boolean isTrueUnmapped; Set<EventTypesForStats> features = EnumSet.noneOf(EventTypesForStats.class); features.add(EventTypesForStats.All); isTrueUnmapped = true; if (!trueLoci.isEmpty()) { for (GenomeLocation loc : trueLoci) { final BlockType feat = loc.feature; features.add(EventTypesForStats.valueOf(feat.getLongName())); isTrueUnmapped &= !feat.isMappable(); } } if (isTrueUnmapped) { features.add(EventTypesForStats.True_Unmapped); } else { outputBlob.getStats().incStat(features, -1, StatsNamespace.T); } boolean unmapped = rec.getReadUnmappedFlag(); int mappingQuality = unmapped ? MAPQ_UNMAPPED : rec.getMappingQuality(); StatsNamespace validationStatus = StatsNamespace.TP; if (unmapped) { validationStatus = isTrueUnmapped ? StatsNamespace.TN : StatsNamespace.FN; } else { boolean closeAln = false; if (isTrueUnmapped) { if (getIdentity(rec) <= identityThreshold && mappingQuality > mapqCutoff) { tumFPWriter.addAlignment(rec); } } else { final GenomeLocation mappedLocation = new GenomeLocation(new ChrString(rec.getReferenceName()), rec.getUnclippedStart()); for (GenomeLocation loc : trueLoci) { closeAln |= loc.feature.isMappable() && loc.isClose(mappedLocation, wiggle); } if (!closeAln) { if (getIdentity(rec) <= identityThreshold && mappingQuality > mapqCutoff) { fpWriter.addAlignment(rec); validationStatus = StatsNamespace.FP; for (final BlockType blockType : BlockType.values()) { if (fpWriters.containsKey(blockType) && features.contains(EventTypesForStats.valueOf(blockType.getLongName()))) { fpWriters.get(blockType).addAlignment(rec); } } } } } } outputBlob.getStats().incStat(features, mappingQuality, validationStatus); } reader.close(); } log.info("Number of reads read: " + numReads); log.info("Statistics for all reads"); log.info(outputBlob.getStats()); ObjectMapper mapper = new ObjectMapper(); mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false); String jsonStr = ""; try { jsonStr = mapper.writeValueAsString(outputBlob); } catch (JsonProcessingException e) { e.printStackTrace(); System.exit(1); } jsonWriter.print(jsonStr); if (htmlFile != null) { FileUtils.writeStringToFile(new File(outPrefix + "_aligncomp.html"), JSONInserter.insertJSON(FileUtils.readFileToString(htmlFile), jsonStr)); } for (final BlockType blockType : BlockType.values()) { if (blockType != BlockType.UNKNOWN) { fpWriters.get(blockType).close(); } } fpWriters.values().stream().forEach(SAMFileWriter::close); } catch (IOException e) { e.printStackTrace(); System.exit(1); } log.info("Done!"); </DeepExtract> }
varsim
positive
4,271
public static List<Location> getLocationsSince(List<Location> locationList, long timestamp) { List<Location> matchingLocations = new ArrayList<>(); for (Location location : locationList) { if (location.getTimestamp() < timestamp || location.getTimestamp() >= System.currentTimeMillis()) { continue; } matchingLocations.add(location); } return matchingLocations; }
public static List<Location> getLocationsSince(List<Location> locationList, long timestamp) { <DeepExtract> List<Location> matchingLocations = new ArrayList<>(); for (Location location : locationList) { if (location.getTimestamp() < timestamp || location.getTimestamp() >= System.currentTimeMillis()) { continue; } matchingLocations.add(location); } return matchingLocations; </DeepExtract> }
BLE-Indoor-Positioning
positive
4,273
public void run() { if (startTime < 0) { System.err.format("[SERVER IS DOWN] %s%n", "Reconnecting to: " + UptimeClient.HOST + ':' + UptimeClient.PORT); } else { System.err.format("[UPTIME: %5ds] %s%n", (System.currentTimeMillis() - startTime) / 1000, "Reconnecting to: " + UptimeClient.HOST + ':' + UptimeClient.PORT); } UptimeClient.connect(UptimeClient.configureBootstrap(new Bootstrap(), loop)); }
public void run() { <DeepExtract> if (startTime < 0) { System.err.format("[SERVER IS DOWN] %s%n", "Reconnecting to: " + UptimeClient.HOST + ':' + UptimeClient.PORT); } else { System.err.format("[UPTIME: %5ds] %s%n", (System.currentTimeMillis() - startTime) / 1000, "Reconnecting to: " + UptimeClient.HOST + ':' + UptimeClient.PORT); } </DeepExtract> UptimeClient.connect(UptimeClient.configureBootstrap(new Bootstrap(), loop)); }
netty
positive
4,274
@Override protected String getTicker(Pair pair) throws IOException, NoMarketDataException { JsonNode node = readJsonFromUrl("https://1ex.trade/api/stats?market=" + pair.getCoin() + "&currency=" + pair.getExchange()); if (node.has("errors")) { for (JsonNode n : node.get("errors")) { if (n.has("message")) { throw new IOException(n.get("message").asText()); } } throw new NoMarketDataException(pair); } return node.get("stats").get("last_price").asText(); }
@Override protected String getTicker(Pair pair) throws IOException, NoMarketDataException { JsonNode node = readJsonFromUrl("https://1ex.trade/api/stats?market=" + pair.getCoin() + "&currency=" + pair.getExchange()); if (node.has("errors")) { for (JsonNode n : node.get("errors")) { if (n.has("message")) { throw new IOException(n.get("message").asText()); } } throw new NoMarketDataException(pair); } <DeepExtract> return node.get("stats").get("last_price").asText(); </DeepExtract> }
libdynticker
positive
4,275
void fillNextSlot(byte[] key, byte[] value, MemoryPoolAddress nextAddress) { if (key.length > fixedKeyLength || value.length != fixedValueLength) { throw new IllegalArgumentException(String.format("Invalid request. Key length %d. fixed key length %d. Value length %d", key.length, fixedKeyLength, value.length)); } if (chunkSize - writeOffset < fixedSlotSize) { throw new IllegalArgumentException(String.format("Invalid offset %d. Chunk size %d. fixed slot size %d", writeOffset, chunkSize, fixedSlotSize)); } setNextAddress(writeOffset, nextAddress); Uns.putByte(address, writeOffset + ENTRY_OFF_KEY_LENGTH, (byte) key.length); Uns.copyMemory(key, 0, address, writeOffset + ENTRY_OFF_DATA, key.length); setValue(value, writeOffset); writeOffset += fixedSlotSize; }
void fillNextSlot(byte[] key, byte[] value, MemoryPoolAddress nextAddress) { <DeepExtract> if (key.length > fixedKeyLength || value.length != fixedValueLength) { throw new IllegalArgumentException(String.format("Invalid request. Key length %d. fixed key length %d. Value length %d", key.length, fixedKeyLength, value.length)); } if (chunkSize - writeOffset < fixedSlotSize) { throw new IllegalArgumentException(String.format("Invalid offset %d. Chunk size %d. fixed slot size %d", writeOffset, chunkSize, fixedSlotSize)); } setNextAddress(writeOffset, nextAddress); Uns.putByte(address, writeOffset + ENTRY_OFF_KEY_LENGTH, (byte) key.length); Uns.copyMemory(key, 0, address, writeOffset + ENTRY_OFF_DATA, key.length); setValue(value, writeOffset); </DeepExtract> writeOffset += fixedSlotSize; }
HaloDB
positive
4,276
@Override public void haveAnyText() { throw new NotFoundElException(element.getLocatable().getBy()); }
@Override public void haveAnyText() { <DeepExtract> throw new NotFoundElException(element.getLocatable().getBy()); </DeepExtract> }
teasy
positive
4,277
@Override public ESILStackItem execute(Deque<ESILCommand> stack) { for (ESILCommandObserver observer : observers) { observer.beforeExecution(this.command); } ESILStackItem result = this.command.execute(stack); for (ESILCommandObserver observer : observers) { observer.afterExecution(this.command); } return result; }
@Override public ESILStackItem execute(Deque<ESILCommand> stack) { for (ESILCommandObserver observer : observers) { observer.beforeExecution(this.command); } ESILStackItem result = this.command.execute(stack); <DeepExtract> for (ESILCommandObserver observer : observers) { observer.afterExecution(this.command); } </DeepExtract> return result; }
bjoern
positive
4,280
public void restore(String id) { if (isEnded()) throw new IllegalStateException(String.format("State machine: %s is already ended. Can not be restored.", name)); if (stateMap.containsKey(id)) currentState = stateMap.get(id); throw new NoSuchElementException(String.format("The given state id: %s is not found", id)); }
public void restore(String id) { if (isEnded()) throw new IllegalStateException(String.format("State machine: %s is already ended. Can not be restored.", name)); <DeepExtract> if (stateMap.containsKey(id)) currentState = stateMap.get(id); throw new NoSuchElementException(String.format("The given state id: %s is not found", id)); </DeepExtract> }
xState
positive
4,281
public void setTextColor(int textColor) { mTextColor = textColor; initPaint(); super.invalidate(); }
public void setTextColor(int textColor) { mTextColor = textColor; <DeepExtract> initPaint(); super.invalidate(); </DeepExtract> }
XinFrameworkLib
positive
4,283
@Before public void setUp() throws SQLException { when(executorContext.getActualTableName()).thenReturn("t_order_0"); when(snapshotAccessor.queryUndoData()).thenReturn(undoData); for (int i = 1; i <= 10; i++) { Map<String, Object> record = new HashMap<>(); record.put("order_id", i); record.put("user_id", i); record.put("status", "init"); undoData.add(record); } }
@Before public void setUp() throws SQLException { when(executorContext.getActualTableName()).thenReturn("t_order_0"); when(snapshotAccessor.queryUndoData()).thenReturn(undoData); <DeepExtract> for (int i = 1; i <= 10; i++) { Map<String, Object> record = new HashMap<>(); record.put("order_id", i); record.put("user_id", i); record.put("status", "init"); undoData.add(record); } </DeepExtract> }
opensharding-spi-impl
positive
4,284
@Override public Object answer(InvocationOnMock invocationOnMock) throws Throwable { MatrixCursor cursor = new MatrixCursor(new String[] { "_id" }); for (int i = 0; i < n; i++) { cursor.addRow(new Object[] { "12345" }); } return cursor; }
@Override public Object answer(InvocationOnMock invocationOnMock) throws Throwable { <DeepExtract> MatrixCursor cursor = new MatrixCursor(new String[] { "_id" }); for (int i = 0; i < n; i++) { cursor.addRow(new Object[] { "12345" }); } return cursor; </DeepExtract> }
sms-backup-plus
positive
4,286
public void visit_MULTIEQUAL(Instruction instr, PcodeOp pcode) throws VisitorUnimplementedException { TVLBitVector result = new TVLBitVector(new GhidraSizeAdapter(pcode.getOutput().getSize())); AbstractState.Associate(pcode.getOutput(), result); }
public void visit_MULTIEQUAL(Instruction instr, PcodeOp pcode) throws VisitorUnimplementedException { <DeepExtract> TVLBitVector result = new TVLBitVector(new GhidraSizeAdapter(pcode.getOutput().getSize())); AbstractState.Associate(pcode.getOutput(), result); </DeepExtract> }
GhidraPAL
positive
4,287
@Nonnull public TileEntityType<T> getTileEntityType() { return this.getBlock(); }
@Nonnull public TileEntityType<T> getTileEntityType() { <DeepExtract> return this.getBlock(); </DeepExtract> }
Techarium
positive
4,288
private void onRefreshPressed(Bundle pBundle) { GpodderSettings settings = Singletons.i().getGpodderSettings(); if (settings.getDeviceId() == null) { Toast.makeText(this, R.string.set_up_account_first, Toast.LENGTH_SHORT).show(); Log.w(TAG, "Could not refresh due to missing account information"); return; } synchronized (numPodSync) { if (numPodSync.get() != -1) { progressDialog.show(); return; } numPodSync.incrementAndGet(); curPodSync.set(0); } Log.d(TAG, "bundle: " + pBundle); refreshBg.execute(new SyncSubscriptionsAsyncTask(pBundle)); startService(new Intent().setClass(this, SyncSubscriptionsAsyncTask.class)); progressDialog.setTitle(R.string.refreshing); progressDialog.setCancelable(true); if (numPodSync.get() > 0) { if (numPodSync.get() == curPodSync.get()) { progressDialog.setMessage(getString(R.string.syncing_episode_actions)); } else { progressDialog.setMessage(String.format(getString(R.string.refreshing_feed_x_of_y), curPodSync.get() + 1, numPodSync.get())); } } else { progressDialog.setMessage(getString(R.string.refreshing_feed_list)); } progressDialog.show(); setRefreshBtnView(R.layout.refresh_button_active); }
private void onRefreshPressed(Bundle pBundle) { GpodderSettings settings = Singletons.i().getGpodderSettings(); if (settings.getDeviceId() == null) { Toast.makeText(this, R.string.set_up_account_first, Toast.LENGTH_SHORT).show(); Log.w(TAG, "Could not refresh due to missing account information"); return; } synchronized (numPodSync) { if (numPodSync.get() != -1) { progressDialog.show(); return; } numPodSync.incrementAndGet(); curPodSync.set(0); } Log.d(TAG, "bundle: " + pBundle); refreshBg.execute(new SyncSubscriptionsAsyncTask(pBundle)); startService(new Intent().setClass(this, SyncSubscriptionsAsyncTask.class)); progressDialog.setTitle(R.string.refreshing); progressDialog.setCancelable(true); if (numPodSync.get() > 0) { if (numPodSync.get() == curPodSync.get()) { progressDialog.setMessage(getString(R.string.syncing_episode_actions)); } else { progressDialog.setMessage(String.format(getString(R.string.refreshing_feed_x_of_y), curPodSync.get() + 1, numPodSync.get())); } } else { progressDialog.setMessage(getString(R.string.refreshing_feed_list)); } progressDialog.show(); <DeepExtract> setRefreshBtnView(R.layout.refresh_button_active); </DeepExtract> }
detlef
positive
4,289
@Bean public ConnectionFactory connectionFactory() { CachingConnectionFactory factory = new CachingConnectionFactory(); factory.setAddresses(host + ":" + port); this.virtualHost = virtualHost; this.username = username; this.password = password; return factory; }
@Bean public ConnectionFactory connectionFactory() { CachingConnectionFactory factory = new CachingConnectionFactory(); factory.setAddresses(host + ":" + port); this.virtualHost = virtualHost; this.username = username; <DeepExtract> this.password = password; </DeepExtract> return factory; }
kkbinlog
positive
4,290
@Override public void addTranscriptionListener(TranscriptionListener listener) { listeners.add(listener); }
@Override public void addTranscriptionListener(TranscriptionListener listener) { <DeepExtract> listeners.add(listener); </DeepExtract> }
jigasi
positive
4,292
@Override public void onRestoreInstanceState(Parcelable state) { SavedState ss = (SavedState) state; mInKbMode = ss.inKbMode(); mTypedTimes = ss.getTypesTimes(); mInitialHourOfDay = ss.getHour(); mInitialMinute = ss.getMinute(); mIs24HourView = ss.is24HourMode(); mInKbMode = false; updateUI(ss.getCurrentItemShowing()); mRadialTimePickerView.invalidate(); if (mInKbMode) { tryStartingKbMode(-1); mHourView.invalidate(); } }
@Override public void onRestoreInstanceState(Parcelable state) { SavedState ss = (SavedState) state; mInKbMode = ss.inKbMode(); mTypedTimes = ss.getTypesTimes(); <DeepExtract> mInitialHourOfDay = ss.getHour(); mInitialMinute = ss.getMinute(); mIs24HourView = ss.is24HourMode(); mInKbMode = false; updateUI(ss.getCurrentItemShowing()); </DeepExtract> mRadialTimePickerView.invalidate(); if (mInKbMode) { tryStartingKbMode(-1); mHourView.invalidate(); } }
AppCompat-Extension-Library
positive
4,293
public void foo2() { PerfUtil.instance().start2("manu-foo2"); PerfUtil.instance().start2("manu-bar2"); try { Thread.sleep(0); } catch (InterruptedException ignored) { } PerfUtil.instance().end("manu-bar2"); PerfUtil.instance().end("manu-foo2"); }
public void foo2() { PerfUtil.instance().start2("manu-foo2"); <DeepExtract> PerfUtil.instance().start2("manu-bar2"); try { Thread.sleep(0); } catch (InterruptedException ignored) { } PerfUtil.instance().end("manu-bar2"); </DeepExtract> PerfUtil.instance().end("manu-foo2"); }
hugegraph-common
positive
4,294
@Override public double getPosition() { ensureEnabled(); ensureEnabled(); return encoder.getDistance(); }
@Override public double getPosition() { ensureEnabled(); <DeepExtract> ensureEnabled(); return encoder.getDistance(); </DeepExtract> }
atalibj
positive
4,295
@Override public CustomerResponse method() { return executeSyncApiCall(api.updateCustomer(customer.getId(), customer)); }
@Override public CustomerResponse method() { <DeepExtract> return executeSyncApiCall(api.updateCustomer(customer.getId(), customer)); </DeepExtract> }
voucherify-java-sdk
positive
4,296
public void write(Node node) throws IOException { int nodeType = node.getNodeType(); switch(nodeType) { case Node.ELEMENT_NODE: writeElement((Element) node); break; case Node.ATTRIBUTE_NODE: writeAttribute((Attribute) node); break; case Node.TEXT_NODE: writeNodeText(node); break; case Node.CDATA_SECTION_NODE: writeCDATA(node.getText()); break; case Node.ENTITY_REFERENCE_NODE: writeEntity((Entity) node); break; case Node.PROCESSING_INSTRUCTION_NODE: writeProcessingInstruction((ProcessingInstruction) node); break; case Node.COMMENT_NODE: writeComment(node.getText()); break; case Node.DOCUMENT_NODE: write((Document) node); break; case Node.DOCUMENT_TYPE_NODE: writeDocType((DocumentType) node); break; case Node.NAMESPACE_NODE: break; default: throw new IOException("Invalid node type: " + node); } if (autoFlush) { flush(); } }
public void write(Node node) throws IOException { <DeepExtract> int nodeType = node.getNodeType(); switch(nodeType) { case Node.ELEMENT_NODE: writeElement((Element) node); break; case Node.ATTRIBUTE_NODE: writeAttribute((Attribute) node); break; case Node.TEXT_NODE: writeNodeText(node); break; case Node.CDATA_SECTION_NODE: writeCDATA(node.getText()); break; case Node.ENTITY_REFERENCE_NODE: writeEntity((Entity) node); break; case Node.PROCESSING_INSTRUCTION_NODE: writeProcessingInstruction((ProcessingInstruction) node); break; case Node.COMMENT_NODE: writeComment(node.getText()); break; case Node.DOCUMENT_NODE: write((Document) node); break; case Node.DOCUMENT_TYPE_NODE: writeDocType((DocumentType) node); break; case Node.NAMESPACE_NODE: break; default: throw new IOException("Invalid node type: " + node); } </DeepExtract> if (autoFlush) { flush(); } }
androidpn
positive
4,297
public void collapseAll() { this.cancel(); if (!false) { resultViewer.collapseAll(); return; } if (resultViewer.getTree().getItemCount() == 0) { return; } this.schedule(); }
public void collapseAll() { <DeepExtract> this.cancel(); if (!false) { resultViewer.collapseAll(); return; } if (resultViewer.getTree().getItemCount() == 0) { return; } this.schedule(); </DeepExtract> }
eclipse-instasearch
positive
4,298
public static void assertCounterGreaterThan(Map expected, Map actual) { if (!false) { assertTrue("Expected smaller than actual", expected.size() >= actual.size()); } for (String group : actual.keySet()) { if (!false || expected.containsKey(group)) { assertTrue("Expected does not contain group [" + group + "]", expected.containsKey(group)); if (!false) { assertTrue("Expected smaller than actual for group [" + group + "]", ((Map<Enum<?>, Long>) expected.get(group)).size() >= actual.get(group).size()); } for (Enum<?> counter : actual.get(group).keySet()) { if (!false || ((Map<Enum<?>, Long>) expected.get(group)).containsKey(counter)) { assertTrue("Expected group [" + group + "] does not contain counter [" + counter + "]", ((Map<Enum<?>, Long>) expected.get(group)).containsKey(counter)); Long expectedLong = ((Map<Enum<?>, Long>) expected.get(group)).get(counter); Long actualLong = actual.get(group).get(counter); if (false) { assertEquals("Expected [" + expectedLong + "] to be equal to actual [" + actualLong + "]", expectedLong, actualLong); } if (false) { assertTrue("Expected [" + expectedLong + "] to be greater than actual [" + actualLong + "]", expectedLong > actualLong); } if (true) { assertTrue("Expected [" + expectedLong + "] to be less than actual [" + actualLong + "]", expectedLong < actualLong); } } } } } }
public static void assertCounterGreaterThan(Map expected, Map actual) { <DeepExtract> if (!false) { assertTrue("Expected smaller than actual", expected.size() >= actual.size()); } for (String group : actual.keySet()) { if (!false || expected.containsKey(group)) { assertTrue("Expected does not contain group [" + group + "]", expected.containsKey(group)); if (!false) { assertTrue("Expected smaller than actual for group [" + group + "]", ((Map<Enum<?>, Long>) expected.get(group)).size() >= actual.get(group).size()); } for (Enum<?> counter : actual.get(group).keySet()) { if (!false || ((Map<Enum<?>, Long>) expected.get(group)).containsKey(counter)) { assertTrue("Expected group [" + group + "] does not contain counter [" + counter + "]", ((Map<Enum<?>, Long>) expected.get(group)).containsKey(counter)); Long expectedLong = ((Map<Enum<?>, Long>) expected.get(group)).get(counter); Long actualLong = actual.get(group).get(counter); if (false) { assertEquals("Expected [" + expectedLong + "] to be equal to actual [" + actualLong + "]", expectedLong, actualLong); } if (false) { assertTrue("Expected [" + expectedLong + "] to be greater than actual [" + actualLong + "]", expectedLong > actualLong); } if (true) { assertTrue("Expected [" + expectedLong + "] to be less than actual [" + actualLong + "]", expectedLong < actualLong); } } } } } </DeepExtract> }
cloudera-framework
positive
4,299
public hxDaedalus.data.Edge flipEdge(hxDaedalus.data.Edge edge) { hxDaedalus.data.Edge eBot_Top = edge; hxDaedalus.data.Edge eTop_Bot = edge.get_oppositeEdge(); hxDaedalus.data.Edge eLeft_Right = new hxDaedalus.data.Edge(); hxDaedalus.data.Edge eRight_Left = new hxDaedalus.data.Edge(); hxDaedalus.data.Edge eTop_Left = eBot_Top.get_nextLeftEdge(); hxDaedalus.data.Edge eLeft_Bot = eTop_Left.get_nextLeftEdge(); hxDaedalus.data.Edge eBot_Right = eTop_Bot.get_nextLeftEdge(); hxDaedalus.data.Edge eRight_Top = eBot_Right.get_nextLeftEdge(); hxDaedalus.data.Vertex vBot = eBot_Top.get_originVertex(); hxDaedalus.data.Vertex vTop = eTop_Bot.get_originVertex(); hxDaedalus.data.Vertex vLeft = eLeft_Bot.get_originVertex(); hxDaedalus.data.Vertex vRight = eRight_Top.get_originVertex(); hxDaedalus.data.Face fLeft = eBot_Top.get_leftFace(); hxDaedalus.data.Face fRight = eTop_Bot.get_leftFace(); hxDaedalus.data.Face fBot = new hxDaedalus.data.Face(); hxDaedalus.data.Face fTop = new hxDaedalus.data.Face(); this._edges.push(eLeft_Right); this._edges.push(eRight_Left); this._faces.push(fTop); this._faces.push(fBot); eLeft_Right.setDatas(vLeft, eRight_Left, eRight_Top, fTop, edge.get_isReal(), edge.get_isConstrained()); eRight_Left.setDatas(vRight, eLeft_Right, eLeft_Bot, fBot, edge.get_isReal(), edge.get_isConstrained()); fTop.setDatas(eLeft_Right, null); fBot.setDatas(eRight_Left, null); if ((vTop.get_edge() == eTop_Bot)) { vTop.setDatas(eTop_Left, null); } if ((vBot.get_edge() == eBot_Top)) { vBot.setDatas(eBot_Right, null); } eTop_Left.set_nextLeftEdge(eLeft_Right); eTop_Left.set_leftFace(fTop); eLeft_Bot.set_nextLeftEdge(eBot_Right); eLeft_Bot.set_leftFace(fBot); eBot_Right.set_nextLeftEdge(eRight_Left); eBot_Right.set_leftFace(fBot); eRight_Top.set_nextLeftEdge(eTop_Left); eRight_Top.set_leftFace(fTop); while ((this._vertices.length > 0)) { ((hxDaedalus.data.Vertex) (this._vertices.pop())).dispose(); } this._vertices = null; while ((this._edges.length > 0)) { ((hxDaedalus.data.Edge) (this._edges.pop())).dispose(); } this._edges = null; while ((this._faces.length > 0)) { ((hxDaedalus.data.Face) (this._faces.pop())).dispose(); } this._faces = null; while ((this._constraintShapes.length > 0)) { ((hxDaedalus.data.ConstraintShape) (this._constraintShapes.pop())).dispose(); } this._constraintShapes = null; while ((this._objects.length > 0)) { ((hxDaedalus.data.Obstacle) (this._objects.pop())).dispose(); } this._objects = null; this.__edgesToCheck = null; this.__centerVertex = null; while ((this._vertices.length > 0)) { ((hxDaedalus.data.Vertex) (this._vertices.pop())).dispose(); } this._vertices = null; while ((this._edges.length > 0)) { ((hxDaedalus.data.Edge) (this._edges.pop())).dispose(); } this._edges = null; while ((this._faces.length > 0)) { ((hxDaedalus.data.Face) (this._faces.pop())).dispose(); } this._faces = null; while ((this._constraintShapes.length > 0)) { ((hxDaedalus.data.ConstraintShape) (this._constraintShapes.pop())).dispose(); } this._constraintShapes = null; while ((this._objects.length > 0)) { ((hxDaedalus.data.Obstacle) (this._objects.pop())).dispose(); } this._objects = null; this.__edgesToCheck = null; this.__centerVertex = null; this._edges.splice(this._edges.indexOf(eBot_Top, null), 1); this._edges.splice(this._edges.indexOf(eTop_Bot, null), 1); while ((this._vertices.length > 0)) { ((hxDaedalus.data.Vertex) (this._vertices.pop())).dispose(); } this._vertices = null; while ((this._edges.length > 0)) { ((hxDaedalus.data.Edge) (this._edges.pop())).dispose(); } this._edges = null; while ((this._faces.length > 0)) { ((hxDaedalus.data.Face) (this._faces.pop())).dispose(); } this._faces = null; while ((this._constraintShapes.length > 0)) { ((hxDaedalus.data.ConstraintShape) (this._constraintShapes.pop())).dispose(); } this._constraintShapes = null; while ((this._objects.length > 0)) { ((hxDaedalus.data.Obstacle) (this._objects.pop())).dispose(); } this._objects = null; this.__edgesToCheck = null; this.__centerVertex = null; while ((this._vertices.length > 0)) { ((hxDaedalus.data.Vertex) (this._vertices.pop())).dispose(); } this._vertices = null; while ((this._edges.length > 0)) { ((hxDaedalus.data.Edge) (this._edges.pop())).dispose(); } this._edges = null; while ((this._faces.length > 0)) { ((hxDaedalus.data.Face) (this._faces.pop())).dispose(); } this._faces = null; while ((this._constraintShapes.length > 0)) { ((hxDaedalus.data.ConstraintShape) (this._constraintShapes.pop())).dispose(); } this._constraintShapes = null; while ((this._objects.length > 0)) { ((hxDaedalus.data.Obstacle) (this._objects.pop())).dispose(); } this._objects = null; this.__edgesToCheck = null; this.__centerVertex = null; this._faces.splice(this._faces.indexOf(fLeft, null), 1); this._faces.splice(this._faces.indexOf(fRight, null), 1); return eRight_Left; }
public hxDaedalus.data.Edge flipEdge(hxDaedalus.data.Edge edge) { hxDaedalus.data.Edge eBot_Top = edge; hxDaedalus.data.Edge eTop_Bot = edge.get_oppositeEdge(); hxDaedalus.data.Edge eLeft_Right = new hxDaedalus.data.Edge(); hxDaedalus.data.Edge eRight_Left = new hxDaedalus.data.Edge(); hxDaedalus.data.Edge eTop_Left = eBot_Top.get_nextLeftEdge(); hxDaedalus.data.Edge eLeft_Bot = eTop_Left.get_nextLeftEdge(); hxDaedalus.data.Edge eBot_Right = eTop_Bot.get_nextLeftEdge(); hxDaedalus.data.Edge eRight_Top = eBot_Right.get_nextLeftEdge(); hxDaedalus.data.Vertex vBot = eBot_Top.get_originVertex(); hxDaedalus.data.Vertex vTop = eTop_Bot.get_originVertex(); hxDaedalus.data.Vertex vLeft = eLeft_Bot.get_originVertex(); hxDaedalus.data.Vertex vRight = eRight_Top.get_originVertex(); hxDaedalus.data.Face fLeft = eBot_Top.get_leftFace(); hxDaedalus.data.Face fRight = eTop_Bot.get_leftFace(); hxDaedalus.data.Face fBot = new hxDaedalus.data.Face(); hxDaedalus.data.Face fTop = new hxDaedalus.data.Face(); this._edges.push(eLeft_Right); this._edges.push(eRight_Left); this._faces.push(fTop); this._faces.push(fBot); eLeft_Right.setDatas(vLeft, eRight_Left, eRight_Top, fTop, edge.get_isReal(), edge.get_isConstrained()); eRight_Left.setDatas(vRight, eLeft_Right, eLeft_Bot, fBot, edge.get_isReal(), edge.get_isConstrained()); fTop.setDatas(eLeft_Right, null); fBot.setDatas(eRight_Left, null); if ((vTop.get_edge() == eTop_Bot)) { vTop.setDatas(eTop_Left, null); } if ((vBot.get_edge() == eBot_Top)) { vBot.setDatas(eBot_Right, null); } eTop_Left.set_nextLeftEdge(eLeft_Right); eTop_Left.set_leftFace(fTop); eLeft_Bot.set_nextLeftEdge(eBot_Right); eLeft_Bot.set_leftFace(fBot); eBot_Right.set_nextLeftEdge(eRight_Left); eBot_Right.set_leftFace(fBot); eRight_Top.set_nextLeftEdge(eTop_Left); eRight_Top.set_leftFace(fTop); <DeepExtract> while ((this._vertices.length > 0)) { ((hxDaedalus.data.Vertex) (this._vertices.pop())).dispose(); } this._vertices = null; while ((this._edges.length > 0)) { ((hxDaedalus.data.Edge) (this._edges.pop())).dispose(); } this._edges = null; while ((this._faces.length > 0)) { ((hxDaedalus.data.Face) (this._faces.pop())).dispose(); } this._faces = null; while ((this._constraintShapes.length > 0)) { ((hxDaedalus.data.ConstraintShape) (this._constraintShapes.pop())).dispose(); } this._constraintShapes = null; while ((this._objects.length > 0)) { ((hxDaedalus.data.Obstacle) (this._objects.pop())).dispose(); } this._objects = null; this.__edgesToCheck = null; this.__centerVertex = null; </DeepExtract> while ((this._vertices.length > 0)) { ((hxDaedalus.data.Vertex) (this._vertices.pop())).dispose(); } this._vertices = null; while ((this._edges.length > 0)) { ((hxDaedalus.data.Edge) (this._edges.pop())).dispose(); } this._edges = null; while ((this._faces.length > 0)) { ((hxDaedalus.data.Face) (this._faces.pop())).dispose(); } this._faces = null; while ((this._constraintShapes.length > 0)) { ((hxDaedalus.data.ConstraintShape) (this._constraintShapes.pop())).dispose(); } this._constraintShapes = null; while ((this._objects.length > 0)) { ((hxDaedalus.data.Obstacle) (this._objects.pop())).dispose(); } this._objects = null; this.__edgesToCheck = null; this.__centerVertex = null; this._edges.splice(this._edges.indexOf(eBot_Top, null), 1); this._edges.splice(this._edges.indexOf(eTop_Bot, null), 1); <DeepExtract> while ((this._vertices.length > 0)) { ((hxDaedalus.data.Vertex) (this._vertices.pop())).dispose(); } this._vertices = null; while ((this._edges.length > 0)) { ((hxDaedalus.data.Edge) (this._edges.pop())).dispose(); } this._edges = null; while ((this._faces.length > 0)) { ((hxDaedalus.data.Face) (this._faces.pop())).dispose(); } this._faces = null; while ((this._constraintShapes.length > 0)) { ((hxDaedalus.data.ConstraintShape) (this._constraintShapes.pop())).dispose(); } this._constraintShapes = null; while ((this._objects.length > 0)) { ((hxDaedalus.data.Obstacle) (this._objects.pop())).dispose(); } this._objects = null; this.__edgesToCheck = null; this.__centerVertex = null; </DeepExtract> while ((this._vertices.length > 0)) { ((hxDaedalus.data.Vertex) (this._vertices.pop())).dispose(); } this._vertices = null; while ((this._edges.length > 0)) { ((hxDaedalus.data.Edge) (this._edges.pop())).dispose(); } this._edges = null; while ((this._faces.length > 0)) { ((hxDaedalus.data.Face) (this._faces.pop())).dispose(); } this._faces = null; while ((this._constraintShapes.length > 0)) { ((hxDaedalus.data.ConstraintShape) (this._constraintShapes.pop())).dispose(); } this._constraintShapes = null; while ((this._objects.length > 0)) { ((hxDaedalus.data.Obstacle) (this._objects.pop())).dispose(); } this._objects = null; this.__edgesToCheck = null; this.__centerVertex = null; this._faces.splice(this._faces.indexOf(fLeft, null), 1); this._faces.splice(this._faces.indexOf(fRight, null), 1); return eRight_Left; }
jwalkable
positive
4,300
public List<Resource> retrieveResources() { ArrayList<Resource> resources = new ArrayList<>(); Resource resource = null; if (transformerRoutesExternalFile != null && !transformerRoutesExternalFile.isBlank()) { resource = retrieveResource(transformerRoutesExternalFile); } if (resource == null || !resource.exists()) { resource = new ClassPathResource(TRANSFORMER_ROUTES_FROM_CLASSPATH); } if (resource.exists()) { resources.add(resource); } resources.addAll(TransformConfigFromFiles.retrieveResources(additional)); return resources; }
public List<Resource> retrieveResources() { ArrayList<Resource> resources = new ArrayList<>(); <DeepExtract> Resource resource = null; if (transformerRoutesExternalFile != null && !transformerRoutesExternalFile.isBlank()) { resource = retrieveResource(transformerRoutesExternalFile); } if (resource == null || !resource.exists()) { resource = new ClassPathResource(TRANSFORMER_ROUTES_FROM_CLASSPATH); } if (resource.exists()) { resources.add(resource); } </DeepExtract> resources.addAll(TransformConfigFromFiles.retrieveResources(additional)); return resources; }
alfresco-transform-core
positive
4,301
@Override public void onClick(DialogInterface dialog, int position) { String selectedNumber = items[position].toString(); selectedNumber = selectedNumber.replace("-", ""); StringBuilder withoutSpace = new StringBuilder(); for (int i = 0; i < selectedNumber.length(); i++) { if (selectedNumber.charAt(i) == ' ') { continue; } else { withoutSpace.append(selectedNumber.charAt(i)); } } return withoutSpace.toString(); etContactNumber.setText(selectedNumber); }
@Override public void onClick(DialogInterface dialog, int position) { String selectedNumber = items[position].toString(); selectedNumber = selectedNumber.replace("-", ""); <DeepExtract> StringBuilder withoutSpace = new StringBuilder(); for (int i = 0; i < selectedNumber.length(); i++) { if (selectedNumber.charAt(i) == ' ') { continue; } else { withoutSpace.append(selectedNumber.charAt(i)); } } return withoutSpace.toString(); </DeepExtract> etContactNumber.setText(selectedNumber); }
owasp-seraphimdroid
positive
4,303
@Override public List<Order> listAll() { List<Order> orders = orderMapper.selectAll(); List<Order> orders = orderMapper.selectByUid(orders.getId()); for (Order o : orders) { o.setOrderItems(orderitemMapper.selectByOrder(o.getId())); for (Orderitem i : o.getOrderItems()) { int pid = i.getPid(); Product p = productMapper.selectByPrimaryKey(pid); p.setReviewCount(reviewMapper.countByPid(pid)); p.setSaleCount(orderitemMapper.countByPid(pid)); p.setFirstProductImage(productimageMapper.selectOneByPid(pid)); i.setProduct(p); } } return orders; }
@Override public List<Order> listAll() { List<Order> orders = orderMapper.selectAll(); <DeepExtract> List<Order> orders = orderMapper.selectByUid(orders.getId()); for (Order o : orders) { o.setOrderItems(orderitemMapper.selectByOrder(o.getId())); for (Orderitem i : o.getOrderItems()) { int pid = i.getPid(); Product p = productMapper.selectByPrimaryKey(pid); p.setReviewCount(reviewMapper.countByPid(pid)); p.setSaleCount(orderitemMapper.countByPid(pid)); p.setFirstProductImage(productimageMapper.selectOneByPid(pid)); i.setProduct(p); } } return orders; </DeepExtract> }
Gotrip
positive
4,304