_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q155700 | Command.destroyService | train | private static void destroyService() {
Thread thread = DESTROY_THREAD;
if (thread == null) {
thread = new Thread() {
@Override
public void run() {
try {
// we wait 5000ms, because the service maybe can use
... | java | {
"resource": ""
} |
q155701 | Command.cancelDestroyService | train | private static void cancelDestroyService() {
Thread thread = DESTROY_THREAD;
if (thread != null) {
DESTROY_THREAD = null;
thread.interrupt();
}
} | java | {
"resource": ""
} |
q155702 | Command.bindService | train | private static void bindService() {
synchronized (Command.class) {
if (!IS_BIND) {
Context context = Cmd.getContext();
if (context == null) {
throw new NullPointerException("Context not should null. Please call Cmd.init(Context)");
... | java | {
"resource": ""
} |
q155703 | Command.commandRun | train | private static String commandRun(Command command) {
// Wait bind
if (I_COMMAND == null) {
synchronized (I_LOCK) {
if (I_COMMAND == null) {
try {
I_LOCK.wait();
} catch (InterruptedException e) {
... | java | {
"resource": ""
} |
q155704 | Command.dispose | train | public static void dispose() {
synchronized (Command.class) {
if (IS_BIND) {
Context context = Cmd.getContext();
if (context != null) {
try {
context.unbindService(I_CONN);
} catch (Exception e) {
... | java | {
"resource": ""
} |
q155705 | PopupIndicator.computeFlags | train | private int computeFlags(int curFlags) {
curFlags &= ~(
WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE |
WindowManager.Lay... | java | {
"resource": ""
} |
q155706 | LoadingDrawable.setProgress | train | public void setProgress(float progress) {
if (progress < 0)
mProgress = 0;
else if (mProgress > 1)
mProgress = 1;
else
mProgress = progress;
stop();
onProgressChange(mProgress);
invalidateSelf();
} | java | {
"resource": ""
} |
q155707 | SeekBarStateDrawable.setTrackColor | train | public void setTrackColor(ColorStateList stateList) {
mTrackStateList = stateList;
mTrackColor = mTrackStateList.getDefaultColor();
if (mAlpha < 255) {
mCurTrackColor = Ui.modulateColorAlpha(mTrackColor, mAlpha);
} else {
mCurTrackColor = mTrackColor;
}
... | java | {
"resource": ""
} |
q155708 | SeekBarStateDrawable.setScrubberColor | train | public void setScrubberColor(ColorStateList stateList) {
mScrubberStateList = stateList;
mScrubberColor = mScrubberStateList.getDefaultColor();
if (mAlpha < 255) {
mCurScrubberColor = Ui.modulateColorAlpha(mScrubberColor, mAlpha);
} else {
mCurScrubberColor = mSc... | java | {
"resource": ""
} |
q155709 | SeekBarStateDrawable.setThumbColor | train | public void setThumbColor(ColorStateList stateList) {
mThumbStateList = stateList;
mThumbColor = mThumbStateList.getDefaultColor();
if (mAlpha < 255) {
mCurThumbColor = Ui.modulateColorAlpha(mThumbColor, mAlpha);
} else {
mCurThumbColor = mThumbColor;
}
... | java | {
"resource": ""
} |
q155710 | StateColorDrawable.changeColor | train | protected boolean changeColor(int color) {
boolean bFlag = mColor != color;
if (bFlag) {
mColor = color;
//We've changed states
onColorChange(color);
invalidateSelf();
}
return bFlag;
} | java | {
"resource": ""
} |
q155711 | Run.onBackground | train | public static Result onBackground(Action action) {
final HandlerPoster poster = getBackgroundPoster();
if (Looper.myLooper() == poster.getLooper()) {
action.call();
return new ActionAsyncTask(action, true);
}
ActionAsyncTask task = new ActionAsyncTask(action);
... | java | {
"resource": ""
} |
q155712 | Run.onUiAsync | train | public static Result onUiAsync(Action action) {
if (Looper.myLooper() == Looper.getMainLooper()) {
action.call();
return new ActionAsyncTask(action, true);
}
ActionAsyncTask task = new ActionAsyncTask(action);
getUiPoster().async(task);
return task;
} | java | {
"resource": ""
} |
q155713 | Run.onUiSync | train | public static void onUiSync(Action action) {
if (Looper.myLooper() == Looper.getMainLooper()) {
action.call();
return;
}
ActionSyncTask poster = new ActionSyncTask(action);
getUiPoster().sync(poster);
poster.waitRun();
} | java | {
"resource": ""
} |
q155714 | TraceRoute.onComplete | train | void onComplete(TraceRouteThread trace, boolean isError, boolean isArrived, TraceRouteContainer routeContainer) {
if (threads != null) {
synchronized (mLock) {
try {
threads.remove(trace);
} catch (NullPointerException e) {
e.pr... | java | {
"resource": ""
} |
q155715 | SVGParser.parseFontFamily | train | private static List<String> parseFontFamily(String val)
{
List<String> fonts = null;
TextScanner scan = new TextScanner(val);
while (true)
{
String item = scan.nextQuotedString();
if (item == null)
item = scan.nextTokenWithWhitespace(',');
if ... | java | {
"resource": ""
} |
q155716 | SVGParser.parseFontSize | train | private static Length parseFontSize(String val)
{
try {
Length size = FontSizeKeywords.get(val);
if (size == null)
size = parseLength(val);
return size;
} catch (SVGParseException e) {
return null;
}
} | java | {
"resource": ""
} |
q155717 | SVGParser.parseFontStyle | train | private static Style.FontStyle parseFontStyle(String val)
{
// Italic is probably the most common, so test that first :)
switch (val)
{
case "italic": return Style.FontStyle.Italic;
case "normal": return Style.FontStyle.Normal;
case "oblique": return Style.FontS... | java | {
"resource": ""
} |
q155718 | SVGParser.parseFillRule | train | private static Style.FillRule parseFillRule(String val)
{
if ("nonzero".equals(val))
return Style.FillRule.NonZero;
if ("evenodd".equals(val))
return Style.FillRule.EvenOdd;
return null;
} | java | {
"resource": ""
} |
q155719 | SVGParser.parseStrokeLineCap | train | private static Style.LineCap parseStrokeLineCap(String val)
{
if ("butt".equals(val))
return Style.LineCap.Butt;
if ("round".equals(val))
return Style.LineCap.Round;
if ("square".equals(val))
return Style.LineCap.Square;
return null;
} | java | {
"resource": ""
} |
q155720 | SVGParser.parseStrokeLineJoin | train | private static Style.LineJoin parseStrokeLineJoin(String val)
{
if ("miter".equals(val))
return Style.LineJoin.Miter;
if ("round".equals(val))
return Style.LineJoin.Round;
if ("bevel".equals(val))
return Style.LineJoin.Bevel;
return null;
} | java | {
"resource": ""
} |
q155721 | SVGParser.parseStrokeDashArray | train | private static Length[] parseStrokeDashArray(String val)
{
TextScanner scan = new TextScanner(val);
scan.skipWhitespace();
if (scan.empty())
return null;
Length dash = scan.nextLength();
if (dash == null)
return null;
if (dash.isNegative())
... | java | {
"resource": ""
} |
q155722 | SVGParser.parseVectorEffect | train | private static VectorEffect parseVectorEffect(String val)
{
switch (val)
{
case NONE: return Style.VectorEffect.None;
case "non-scaling-stroke": return Style.VectorEffect.NonScalingStroke;
default: return null;
}
} | java | {
"resource": ""
} |
q155723 | SVGParser.parseRenderQuality | train | private static RenderQuality parseRenderQuality(String val)
{
switch (val)
{
case "auto": return RenderQuality.auto;
case "optimizeQuality": return RenderQuality.optimizeQuality;
case "optimizeSpeed": return RenderQuality.optimizeSpeed;
default: ... | java | {
"resource": ""
} |
q155724 | SVGParser.parseSystemLanguage | train | private static Set<String> parseSystemLanguage(String val)
{
TextScanner scan = new TextScanner(val);
HashSet<String> result = new HashSet<>();
while (!scan.empty())
{
String language = scan.nextToken();
int hyphenPos = language.indexOf('-');
if (... | java | {
"resource": ""
} |
q155725 | SVGImageView.setSVG | train | public void setSVG(SVG svg, String css)
{
if (svg == null)
throw new IllegalArgumentException("Null value passed to setSVG()");
this.svg = svg;
this.renderOptions.css(css);
doRender();
} | java | {
"resource": ""
} |
q155726 | SVG.getFromAsset | train | @SuppressWarnings({"WeakerAccess", "unused"})
public static SVG getFromAsset(AssetManager assetManager, String filename) throws SVGParseException, IOException
{
SVGParser parser = new SVGParser();
InputStream is = assetManager.open(filename);
try {
return parser.parse(is, ena... | java | {
"resource": ""
} |
q155727 | SVG.getDocumentViewBox | train | @SuppressWarnings({"WeakerAccess", "unused"})
public RectF getDocumentViewBox()
{
if (this.rootElement == null)
throw new IllegalArgumentException("SVG document is empty");
if (this.rootElement.viewBox == null)
return null;
return this.rootElement.viewBox.toRectF();... | java | {
"resource": ""
} |
q155728 | SimpleAssetResolver.resolveFont | train | @Override
public Typeface resolveFont(String fontFamily, int fontWeight, String fontStyle)
{
Log.i(TAG, "resolveFont("+fontFamily+","+fontWeight+","+fontStyle+")");
// Try font name with suffix ".ttf"
try
{
return Typeface.createFromAsset(assetManager, fontFamily + ".ttf... | java | {
"resource": ""
} |
q155729 | SimpleAssetResolver.resolveCSSStyleSheet | train | @Override
public String resolveCSSStyleSheet(String url)
{
Log.i(TAG, "resolveCSSStyleSheet("+url+")");
return getAssetAsString(url);
} | java | {
"resource": ""
} |
q155730 | SVGAndroidRenderer.render | train | private void render(SVG.Svg obj)
{
// <svg> elements establish a new viewport.
Box viewPort = makeViewPort(obj.x, obj.y, obj.width, obj.height);
render(obj, viewPort, obj.viewBox, obj.preserveAspectRatio);
} | java | {
"resource": ""
} |
q155731 | SVGAndroidRenderer.makeViewPort | train | private Box makeViewPort(Length x, Length y, Length width, Length height)
{
float _x = (x != null) ? x.floatValueX(this) : 0f;
float _y = (y != null) ? y.floatValueY(this) : 0f;
Box viewPortUser = getCurrentViewPortInUserUnits();
float _w = (width != null) ? width.floatValueX(this) ... | java | {
"resource": ""
} |
q155732 | SVGAndroidRenderer.checkForClipPath_OldStyle | train | private void checkForClipPath_OldStyle(SvgElement obj, Box boundingBox)
{
// Use the old/original method for clip paths
// Locate the referenced object
SvgObject ref = obj.document.resolveIRI(state.style.clipPath);
if (ref == null) {
error("ClipPath reference '%s' not found"... | java | {
"resource": ""
} |
q155733 | SVGAndroidRenderer.clipStatePush | train | private void clipStatePush()
{
// Save matrix but not clip
CanvasLegacy.save(canvas, CanvasLegacy.MATRIX_SAVE_FLAG);
// Save style state
stateStack.push(state);
state = new RendererState(state);
} | java | {
"resource": ""
} |
q155734 | RenderOptions.css | train | public RenderOptions css(String css)
{
CSSParser parser = new CSSParser(CSSParser.Source.RenderOptions);
this.css = parser.parse(css);
return this;
} | java | {
"resource": ""
} |
q155735 | ScalpelFrameLayout.setChromeColor | train | public void setChromeColor(int color) {
if (chromeColor != color) {
viewBorderPaint.setColor(color);
chromeColor = color;
invalidate();
}
} | java | {
"resource": ""
} |
q155736 | ScalpelFrameLayout.setChromeShadowColor | train | public void setChromeShadowColor(int color) {
if (chromeShadowColor != color) {
viewBorderPaint.setShadowLayer(1, -1, 1, color);
chromeShadowColor = color;
invalidate();
}
} | java | {
"resource": ""
} |
q155737 | WordCloud.writeToStream | train | public void writeToStream(final String format, final OutputStream outputStream) {
try {
LOGGER.debug("Writing WordCloud image data to output stream");
ImageIO.write(bufferedImage, format, outputStream);
LOGGER.debug("Done writing WordCloud image data to output stream");
... | java | {
"resource": ""
} |
q155738 | WordCloud.drawForegroundToBackground | train | protected void drawForegroundToBackground() {
if (backgroundColor == null) { return; }
final BufferedImage backgroundBufferedImage = new BufferedImage(dimension.width, dimension.height, this.bufferedImage.getType());
final Graphics graphics = backgroundBufferedImage.getGraphics();
// d... | java | {
"resource": ""
} |
q155739 | WordCloud.computeRadius | train | static int computeRadius(final Dimension dimension, final Point start) {
final int maxDistanceX = Math.max(start.x, dimension.width - start.x) + 1;
final int maxDistanceY = Math.max(start.y, dimension.height - start.y) + 1;
// we use the pythagorean theorem to determinate the maximum ra... | java | {
"resource": ""
} |
q155740 | WordCloud.place | train | protected boolean place(final Word word, final Point start) {
final Graphics graphics = this.bufferedImage.getGraphics();
final int maxRadius = computeRadius(dimension, start);
final Point position = word.getPosition();
for (int r = 0; r < maxRadius; r += 2) {
for (... | java | {
"resource": ""
} |
q155741 | LinearGradientColorPalette.createLinearGradient | train | private static List<Color> createLinearGradient(final Color color1, final Color color2, final int gradientSteps) {
final List<Color> colors = new ArrayList<>(gradientSteps + 1);
// add beginning color to the gradient
colors.add(color1);
for (int i = 1; i < gradientSteps; i++) {
... | java | {
"resource": ""
} |
q155742 | ParallelLayeredWordCloud.writeToFile | train | public void writeToFile(final String outputFileName, final boolean blockThread, final boolean shutdownExecutor) {
if (blockThread) {
waitForFuturesToBlockCurrentThread();
}
super.writeToFile(outputFileName);
if (shutdownExecutor) {
this.shutdown();
}
... | java | {
"resource": ""
} |
q155743 | DatabaseConnection.initSyntaxRule | train | private void initSyntaxRule() throws SQLException {
// Deduce the string used to quote identifiers. For example, Oracle
// uses double-quotes:
// SELECT * FROM "My Schema"."My Table"
String identifierQuoteString = meta.getIdentifierQuoteString();
if (identifierQuoteString.length() > 1) {
sql... | java | {
"resource": ""
} |
q155744 | DatabaseConnection.connect | train | boolean connect() throws SQLException {
try {
if (driver != null && driver.length() != 0) {
Class.forName(driver);
}
} catch (ClassNotFoundException cnfe) {
return sqlLine.error(cnfe);
}
boolean foundDriver = false;
Driver theDriver = null;
try {
theDriver = Driv... | java | {
"resource": ""
} |
q155745 | Application.getOutputFormats | train | public Map<String, OutputFormat> getOutputFormats(SqlLine sqlLine) {
final Map<String, OutputFormat> outputFormats = new HashMap<>();
outputFormats.put("vertical", new VerticalOutputFormat(sqlLine));
outputFormats.put("table", new TableOutputFormat(sqlLine));
outputFormats.put("csv", new SeparatedValues... | java | {
"resource": ""
} |
q155746 | Commands.buildMetadataArgs | train | private List<Object> buildMetadataArgs(
String line,
String paramName,
String[] defaultValues) {
final List<Object> list = new ArrayList<>();
final String[][] ret = sqlLine.splitCompound(line);
String[] compound;
if (ret == null || ret.length != 2) {
if (defaultValues[defaultValu... | java | {
"resource": ""
} |
q155747 | Commands.closeall | train | public void closeall(String line, DispatchCallback callback) {
close(null, callback);
if (callback.isSuccess()) {
while (callback.isSuccess()) {
close(null, callback);
}
// the last "close" will set it to fail so reset it to success.
callback.setToSuccess();
}
// probably... | java | {
"resource": ""
} |
q155748 | Commands.close | train | public void close(String line, DispatchCallback callback) {
// close file writer
if (sqlLine.getRecordOutputFile() != null) {
// instead of line could be any string
stopRecording(line, callback);
}
DatabaseConnection databaseConnection = sqlLine.getDatabaseConnection();
if (databaseConn... | java | {
"resource": ""
} |
q155749 | Commands.properties | train | public void properties(String line, DispatchCallback callback)
throws Exception {
String example = "";
example += "Usage: properties <properties file>" + SqlLine.getSeparator();
String[] parts = sqlLine.split(line);
if (parts.length < 2) {
callback.setToFailure();
sqlLine.error(exampl... | java | {
"resource": ""
} |
q155750 | Commands.list | train | public void list(String line, DispatchCallback callback) {
int index = 0;
DatabaseConnections databaseConnections = sqlLine.getDatabaseConnections();
sqlLine.info(
sqlLine.loc("active-connections", databaseConnections.size()));
for (DatabaseConnection databaseConnection : databaseConnections) {... | java | {
"resource": ""
} |
q155751 | Commands.script | train | public void script(String line, DispatchCallback callback) {
if (sqlLine.getScriptOutputFile() == null) {
startScript(line, callback);
} else {
stopScript(line, callback);
}
} | java | {
"resource": ""
} |
q155752 | Commands.stopScript | train | private void stopScript(String line, DispatchCallback callback) {
try {
sqlLine.getScriptOutputFile().close();
} catch (Exception e) {
sqlLine.handleException(e);
}
sqlLine.output(sqlLine.loc("script-closed", sqlLine.getScriptOutputFile()));
sqlLine.setScriptOutputFile(null);
callba... | java | {
"resource": ""
} |
q155753 | Commands.startScript | train | private void startScript(String line, DispatchCallback callback) {
OutputFile outFile = sqlLine.getScriptOutputFile();
if (outFile != null) {
callback.setToFailure();
sqlLine.error(sqlLine.loc("script-already-running", outFile));
return;
}
String filename;
if (line.length() == "sc... | java | {
"resource": ""
} |
q155754 | Commands.run | train | public void run(String line, DispatchCallback callback) {
String filename;
if (line.length() == "run".length()
|| (filename =
sqlLine.dequote(line.substring("run".length() + 1))) == null) {
sqlLine.error("Usage: run <file name>");
callback.setToFailure();
return;
}
... | java | {
"resource": ""
} |
q155755 | Commands.expand | train | public static String expand(String filename) {
if (filename.startsWith("~" + File.separator)) {
try {
String home = System.getProperty("user.home");
if (home != null) {
return home + filename.substring(1);
}
} catch (SecurityException e) {
// ignore
}
... | java | {
"resource": ""
} |
q155756 | Commands.record | train | public void record(String line, DispatchCallback callback) {
if (sqlLine.getRecordOutputFile() == null) {
startRecording(line, callback);
} else {
stopRecording(line, callback);
}
} | java | {
"resource": ""
} |
q155757 | Commands.stopRecording | train | private void stopRecording(String line, DispatchCallback callback) {
try {
sqlLine.getRecordOutputFile().close();
} catch (Exception e) {
sqlLine.handleException(e);
}
sqlLine.output(sqlLine.loc("record-closed", sqlLine.getRecordOutputFile()));
sqlLine.setRecordOutputFile(null);
cal... | java | {
"resource": ""
} |
q155758 | Commands.startRecording | train | private void startRecording(String line, DispatchCallback callback) {
OutputFile outputFile = sqlLine.getRecordOutputFile();
if (outputFile != null) {
callback.setToFailure();
sqlLine.error(sqlLine.loc("record-already-running", outputFile));
return;
}
String filename;
if (line.len... | java | {
"resource": ""
} |
q155759 | SqlLine.mainWithInputRedirection | train | public static Status mainWithInputRedirection(String[] args,
InputStream inputStream) throws IOException {
return start(args, inputStream, false);
} | java | {
"resource": ""
} |
q155760 | SqlLine.registerKnownDrivers | train | void registerKnownDrivers() {
if (appConfig.allowedDrivers == null) {
return;
}
for (String driverName : appConfig.allowedDrivers) {
try {
Class.forName(driverName);
} catch (Throwable t) {
// ignore
}
}
} | java | {
"resource": ""
} |
q155761 | SqlLine.isComment | train | boolean isComment(String line, boolean trim) {
final String trimmedLine = trim ? line.trim() : line;
for (String comment: getDialect().getSqlLineOneLineComments()) {
if (trimmedLine.startsWith(comment)) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q155762 | SqlLine.error | train | public boolean error(String msg) {
output(getColorBuffer().red(msg), true, errorStream);
return false;
} | java | {
"resource": ""
} |
q155763 | SqlLine.assertAutoCommit | train | boolean assertAutoCommit() {
if (!assertConnection()) {
return false;
}
try {
if (getDatabaseConnection().connection.getAutoCommit()) {
return error(loc("autocommit-needs-off"));
}
} catch (Exception e) {
return error(e);
}
return true;
} | java | {
"resource": ""
} |
q155764 | SqlLine.assertConnection | train | boolean assertConnection() {
try {
if (getDatabaseConnection() == null
|| getDatabaseConnection().connection == null) {
return error(loc("no-current-connection"));
}
if (getDatabaseConnection().connection.isClosed()) {
return error(loc("connection-is-closed"));
}
... | java | {
"resource": ""
} |
q155765 | SqlLine.showWarnings | train | void showWarnings() {
if (getDatabaseConnection().connection == null) {
return;
}
if (!getOpts().getShowWarnings()) {
return;
}
try {
showWarnings(getDatabaseConnection().connection.getWarnings());
} catch (Exception e) {
handleException(e);
}
} | java | {
"resource": ""
} |
q155766 | SqlLine.split | train | String[] split(String line, int assertLen, String usage) {
String[] ret = split(line);
if (ret.length != assertLen) {
error(usage);
return null;
}
return ret;
} | java | {
"resource": ""
} |
q155767 | SqlLine.wrap | train | String wrap(String toWrap, int len, int start) {
StringBuilder buff = new StringBuilder();
StringBuilder line = new StringBuilder();
char[] head = new char[start];
Arrays.fill(head, ' ');
for (StringTokenizer tok = new StringTokenizer(toWrap, " ");
tok.hasMoreTokens();) {
String nex... | java | {
"resource": ""
} |
q155768 | SqlLine.progress | train | void progress(int cur, int max) {
StringBuilder out = new StringBuilder();
if (lastProgress != null) {
char[] back = new char[lastProgress.length()];
Arrays.fill(back, '\b');
out.append(back);
}
String progress =
cur + "/" + (max == -1 ? "?" : "" + max) + " "
+ (m... | java | {
"resource": ""
} |
q155769 | SqlLine.scanForDriver | train | String scanForDriver(String url) {
try {
// already registered
Driver driver;
if ((driver = findRegisteredDriver(url)) != null) {
return driver.getClass().getCanonicalName();
}
scanDrivers();
if ((driver = findRegisteredDriver(url)) != null) {
return driver.getC... | java | {
"resource": ""
} |
q155770 | SqlLine.withPrompting | train | <R> R withPrompting(Supplier<R> action) {
if (prompting) {
throw new IllegalArgumentException();
}
prompting = true;
try {
return action.get();
} finally {
prompting = false;
}
} | java | {
"resource": ""
} |
q155771 | SqlLineOpts.isDefault | train | public boolean isDefault(SqlLineProperty property) {
final String defaultValue = String.valueOf(property.defaultValue());
final String currentValue = get(property);
return String.valueOf((Object) null).equals(currentValue)
|| Objects.equals(currentValue, defaultValue);
} | java | {
"resource": ""
} |
q155772 | ColorBuffer.pad | train | ColorBuffer pad(ColorBuffer str, int len) {
int n = str.getVisibleLength();
while (n < len) {
str.append(" ");
n++;
}
return append(str);
} | java | {
"resource": ""
} |
q155773 | ColorBuffer.truncate | train | public ColorBuffer truncate(int len) {
ColorBuffer cbuff = new ColorBuffer(useColor);
ColorAttr lastAttr = null;
for (Iterator<Object> i = parts.iterator();
cbuff.getVisibleLength() < len && i.hasNext();) {
Object next = i.next();
if (next instanceof ColorAttr) {
lastAttr = (Colo... | java | {
"resource": ""
} |
q155774 | SqlLineHighlighter.getStartingPoint | train | private int getStartingPoint(String buffer) {
for (int i = 0; i < buffer.length(); i++) {
if (!Character.isWhitespace(buffer.charAt(i))) {
return i;
}
}
return buffer.length();
} | java | {
"resource": ""
} |
q155775 | SqlLineHighlighter.handleNumbers | train | int handleNumbers(String line, BitSet numberBitSet, int startingPoint) {
int end = startingPoint + 1;
while (end < line.length() && Character.isDigit(line.charAt(end))) {
end++;
}
if (end == line.length()) {
if (Character.isDigit(line.charAt(line.length() - 1))) {
numberBitSet.set(st... | java | {
"resource": ""
} |
q155776 | SqlLineHighlighter.handleComments | train | int handleComments(String line, BitSet commentBitSet,
int startingPoint, boolean isSql) {
Set<String> oneLineComments = isSql
? sqlLine.getDialect().getOneLineComments()
: sqlLine.getDialect().getSqlLineOneLineComments();
final char ch = line.charAt(startingPoint);
if (startingPoint + ... | java | {
"resource": ""
} |
q155777 | SqlLineHighlighter.handleSqlSingleQuotes | train | int handleSqlSingleQuotes(String line, BitSet quoteBitSet,
int startingPoint) {
int end;
int quoteCounter = 1;
boolean quotationEnded = false;
do {
end = line.indexOf('\'', startingPoint + 1);
if (end > -1) {
quoteCounter++;
}
if (end == -1 || end == line.length() -... | java | {
"resource": ""
} |
q155778 | Bus.post | train | public void post(Object event) {
if (event == null) {
throw new NullPointerException("Event to post must not be null.");
}
enforcer.enforce(this);
Set<Class<?>> dispatchTypes = flattenHierarchy(event.getClass());
boolean dispatched = false;
for (Class<?> eventType : dispatchTypes) {
... | java | {
"resource": ""
} |
q155779 | Bus.dispatchQueuedEvents | train | protected void dispatchQueuedEvents() {
// don't dispatch if we're already dispatching, that would allow reentrancy and out-of-order events. Instead, leave
// the events to be dispatched after the in-progress dispatch is complete.
if (isDispatching.get()) {
return;
}
isDispatching.set(true);
... | java | {
"resource": ""
} |
q155780 | ChooserDialog.goBack | train | public boolean goBack() {
if (_entries.size() > 0 &&
(_entries.get(0).getName().equals(".."))) {
_list.performItemClick(_list, 0, 0);
return true;
}
return false;
} | java | {
"resource": ""
} |
q155781 | UiUtil.getListYScroll | train | public static int getListYScroll(@NonNull final ListView list) {
View child = list.getChildAt(0);
return child == null ? -1
: list.getFirstVisiblePosition() * child.getHeight() - child.getTop() + list.getPaddingTop();
} | java | {
"resource": ""
} |
q155782 | Event.retrieve | train | public static Event retrieve(String id, RequestOptions options) throws StripeException {
return retrieve(id, null, options);
} | java | {
"resource": ""
} |
q155783 | Customer.retrieve | train | public static Customer retrieve(String customer) throws StripeException {
return retrieve(customer, (Map<String, Object>) null, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155784 | Customer.deleteDiscount | train | public Discount deleteDiscount() throws StripeException {
return deleteDiscount((Map<String, Object>) null, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155785 | ExpandableFieldSerializer.serialize | train | @Override
public JsonElement serialize(ExpandableField<?> src, Type typeOfSrc,
JsonSerializationContext context) {
if (src.isExpanded()) {
return context.serialize(src.getExpanded());
} else if (src.getId() != null) {
return new JsonPrimitive(src.getId());
} else {
return null;
... | java | {
"resource": ""
} |
q155786 | TaxRate.retrieve | train | public static TaxRate retrieve(String taxRate) throws StripeException {
return retrieve(taxRate, (Map<String, Object>) null, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155787 | TaxRate.create | train | public static TaxRate create(TaxRateCreateParams params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/tax_rates");
return request(ApiResource.RequestMethod.POST, url, params, TaxRate.class, options);
} | java | {
"resource": ""
} |
q155788 | TaxRate.update | train | @Override
public TaxRate update(Map<String, Object> params) throws StripeException {
return update(params, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155789 | Dispute.retrieve | train | public static Dispute retrieve(String dispute) throws StripeException {
return retrieve(dispute, (Map<String, Object>) null, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155790 | Dispute.close | train | public Dispute close() throws StripeException {
return close((Map<String, Object>) null, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155791 | IssuerFraudRecord.retrieve | train | public static IssuerFraudRecord retrieve(String issuerFraudRecord) throws StripeException {
return retrieve(issuerFraudRecord, (Map<String, Object>) null, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155792 | WebhookEndpoint.retrieve | train | public static WebhookEndpoint retrieve(String webhookEndpoint) throws StripeException {
return retrieve(webhookEndpoint, (Map<String, Object>) null, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155793 | SubscriptionSchedule.retrieve | train | public static SubscriptionSchedule retrieve(String schedule) throws StripeException {
return retrieve(schedule, (Map<String, Object>) null, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155794 | LoginLink.createOnAccount | train | public static LoginLink createOnAccount(
String account, Map<String, Object> params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/accounts/%s/login_links", ApiResource.urlEncodeId(accoun... | java | {
"resource": ""
} |
q155795 | Session.retrieve | train | public static Session retrieve(String session) throws StripeException {
return retrieve(session, (Map<String, Object>) null, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155796 | ScheduledQueryRun.retrieve | train | public static ScheduledQueryRun retrieve(String scheduledQueryRun) throws StripeException {
return retrieve(scheduledQueryRun, (Map<String, Object>) null, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155797 | Source.retrieve | train | public static Source retrieve(String source) throws StripeException {
return retrieve(source, (Map<String, Object>) null, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155798 | Source.verify | train | public Source verify(Map<String, Object> params) throws StripeException {
return verify(params, (RequestOptions) null);
} | java | {
"resource": ""
} |
q155799 | Account.retrieve | train | public static Account retrieve(RequestOptions options) throws StripeException {
return retrieve((Map<String, Object>) null, options);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.