code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static void addDatatablesResourceIfNecessary(String defaultFilename, String type) {
boolean loadDatatables = shouldLibraryBeLoaded(P_GET_DATATABLE_FROM_CDN, true);
// Do we have to add datatables.min.{css|js}, or are the resources already there?
FacesContext context = FacesContext.getCurrentInstance();
U... | java |
public static Class<?> getValueType(FacesContext context, UIComponent uiComponent, Collection<Class<?>> validTypes) {
Class<?> valueType = getValueType(context, uiComponent);
if (valueType != null && isValid(validTypes, valueType)) {
return valueType;
}
else {
for (UIComponent child : uiComponent.getChild... | java |
public static Class<?> getValueType(FacesContext context, UIComponent comp) {
ValueExpression expr = comp.getValueExpression("value");
Class<?> valueType = expr == null ? null : expr.getType(context.getELContext());
return valueType;
} | java |
@SuppressWarnings("rawtypes")
private void removeMisleadingType(Slider2 slider) {
try {
Method method = getClass().getMethod("getPassThroughAttributes", (Class[]) null);
if (null != method) {
Object map = method.invoke(this, (Object[]) null);
if (null != map) {
Map attributes = (Map) map;
if ... | java |
protected SelectItem createSelectItem(FacesContext context, UISelectItems uiSelectItems, Object value,
Object label) {
String var = (String) uiSelectItems.getAttributes().get("var");
Map<String, Object> attrs = uiSelectItems.getAttributes();
Map<String, Object> requestMap = context.getExternalContext().getRequ... | java |
private void add_snake_case_properties(List<PropertyDescriptor> pdl) throws IntrospectionException {
List<PropertyDescriptor> alternatives = new ArrayList<PropertyDescriptor>();
for (PropertyDescriptor descriptor : pdl) {
String camelCase = descriptor.getName();
if (camelCase.equals("rendererType")) {
con... | java |
public static void generateJSEventHandlers(ResponseWriter rw, UIComponent component) throws IOException {
Map<String, Object> attributes = component.getAttributes();
String[] eventHandlers = {"onclick", "onblur", "onmouseover"};
for (String event:eventHandlers) {
String handler = A.asString(attribu... | java |
@Override
public Object getConvertedValue(FacesContext context, Object submittedValue) throws ConverterException {
if (submittedValue == null) {
return null;
}
String val = (String) submittedValue;
// If the Trimmed submitted value is empty, return null
if (val.trim().length() == 0) {
return null;
}... | java |
private static Number toNumber(Object object) {
if (object instanceof Number) {
return (Number) object;
}
if (object instanceof String) {
return Float.valueOf((String) object);
}
throw new IllegalArgumentException("Use number or string");
} | java |
public static final void encodeColumn(ResponseWriter rw, UIComponent c, int span, int cxs, int csm, int clg,
int offset, int oxs, int osm, int olg, String style, String sclass) throws IOException {
rw.startElement("div", c);
Map<String, Object> componentAttrs = new HashMap<String, Object>();
if (c != null) {... | java |
public static void addClass2FacetComponent(UIComponent f, String cname, String aclass) {
// If the facet contains only one component, getChildCount()=0 and the
// Facet is the UIComponent
if (f.getClass().getName().endsWith(cname)) {
addClass2Component(f, aclass);
} else {
if (f.getChildCount() > 0) {
... | java |
protected static void addClass2Component(UIComponent c, String aclass) {
Map<String, Object> a = c.getAttributes();
if (a.containsKey("styleClass")) {
a.put("styleClass", a.get("styleClass") + " " + aclass);
} else {
a.put("styleClass", aclass);
}
} | java |
public static void decorateFacetComponent(UIComponent parent, UIComponent comp, FacesContext ctx, ResponseWriter rw)
throws IOException {
/*
* System.out.println("COMPONENT CLASS = " + comp.getClass().getName());
* System.out.println("FAMILY = " + comp.getFamily());
* System.out.println("CHILD COUNT = " +... | java |
private static void decorateComponent(UIComponent parent, UIComponent comp, FacesContext ctx, ResponseWriter rw)
throws IOException {
if (comp instanceof Icon)
((Icon) comp).setAddon(true); // modifies the id of the icon
String classToApply = "input-group-addon";
if (comp.getClass().getName().endsWith("But... | java |
public static String findComponentFormId(FacesContext fc, UIComponent c) {
UIComponent parent = c.getParent();
while (parent != null) {
if (parent instanceof UIForm) {
return parent.getClientId(fc);
}
parent = parent.getParent();
}
return null;
} | java |
public static void renderChildren(FacesContext fc, UIComponent component) throws IOException {
for (Iterator<UIComponent> iterator = component.getChildren().iterator(); iterator.hasNext();) {
UIComponent child = (UIComponent) iterator.next();
renderChild(fc, child);
}
} | java |
public static void renderChild(FacesContext fc, UIComponent child) throws IOException {
if (!child.isRendered()) {
return;
}
child.encodeBegin(fc);
if (child.getRendersChildren()) {
child.encodeChildren(fc);
} else {
renderChildren(fc, child);
}
child.encodeEnd(fc);
} | java |
public static MethodExpression evalAsMethodExpression(String p_expression) throws PropertyNotFoundException {
FacesContext context = FacesContext.getCurrentInstance();
ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
ELContext elContext = context.getELContext();
MethodExpre... | java |
private void checkELSyntax(String el, ELContext context) {
int pos = el.indexOf('.');
if (pos<0) {
throw new FacesException("The EL expression doesn't contain a method call: " + el);
}
int end = el.indexOf('(');
if (end < 0)
end = el.length();
if (el.indexOf('[') >= 0)
end = Math.min(end, el.indexO... | java |
public void decode(FacesContext context, UIComponent component, List<String> legalValues, String realEventSourceName) {
InputText inputText = (InputText) component;
if (inputText.isDisabled() || inputText.isReadonly()) {
return;
}
decodeBehaviors(context, inputText);
String clientId = inputText.getClien... | java |
private void renderJQueryAfterComponent(ResponseWriter rw, String clientId, SelectOneMenu menu) throws IOException {
Boolean select2 = menu.isSelect2();
if (select2 != null && select2) {
rw.startElement("script", menu);
rw.writeAttribute("type", "text/javascript", "script");
StringBuilder buf = new Str... | java |
private SelectItemAndComponent determineSelectedItem(FacesContext context, SelectOneMenu menu, List<SelectItemAndComponent> items, Converter converter) {
Object submittedValue = menu.getSubmittedValue();
Object selectedOption;
if (submittedValue != null) {
selectedOption = submittedValue;
} else {
selecte... | java |
private String decodeAndEscapeSelectors(FacesContext context, UIComponent component, String selector) {
selector = ExpressionResolver.getComponentIDs(context, component, selector);
selector = BsfUtils.escapeJQuerySpecialCharsInSelector(selector);
return selector;
} | java |
public static String getErrorSeverityClass(String clientId) {
String[] levels = { "bf-no-message has-success", "bf-info", "bf-warning has-warning", "bf-error has-error", "bf-fatal has-error" };
int level = 0;
Iterator<FacesMessage> messages = FacesContext.getCurrentInstance().getMessages(clientId);
if (null != ... | java |
private void saveInitialChildState(FacesContext facesContext) {
index = -1;
initialChildState = new ConcurrentHashMap<String, SavedState>();
initialClientId = getClientId(facesContext);
if (getChildCount() > 0) {
for (UIComponent child : getChildren()) {
saveInitialChildState(facesContext, child);
}
... | java |
public static Date autoParseDateFormat(String dateString) {
// STEP 1: try to detect standard locale based java date format
for (Locale locale : DateFormat.getAvailableLocales()) {
for (int style = DateFormat.FULL; style <= DateFormat.SHORT; style++) {
DateFormat df = DateFormat.getDateInstance(style, locale... | java |
private static String translateFormat(String formatString, Map<String, String> mapping, String escapeStart, String escapeEnd, String targetEscapeStart, String targetEscapeEnd) {
int beginIndex = 0;
int i = 0;
char lastChar = 0;
char currentChar = 0;
String resultString = "";
char esc1 = escapeStart.charAt(0... | java |
private static String mapSubformat(String formatString, Map<String, String> mapping, int beginIndex,
int currentIndex, String escapeStart, String escapeEnd, String targetEscapeStart, String targetEscapeEnd) {
String subformat = formatString.substring(beginIndex, currentIndex);
if (subformat.equals(escapeStart) |... | java |
@Override
public Map<String, String> getJQueryEventParameterLists() {
Map<String, String> result = new HashMap<String, String>();
result.put("select", "event, datatable, typeOfSelection, indexes");
result.put("deselect", "event, datatable, typeOfSelection, indexes");
return result;
} | java |
@Override
public Map<String, String> getJQueryEventParameterListsForAjax() {
Map<String, String> result = new HashMap<String, String>();
result.put("select", "'typeOfSelection':typeOfSelection,'indexes':indexes");
result.put("deselect", "'typeOfSelection':typeOfSelection,'indexes':indexes");
return result;
} | java |
private static <T> Observable<Boolean> commitOrRollbackOnNext(final boolean isCommit,
final Database db, Observable<T> source) {
return source.concatMap(new Func1<T, Observable<Boolean>>() {
@Override
public Observable<Boolean> call(T t) {
if (isCommit)
... | java |
public Database asynchronous(final Scheduler nonTransactionalScheduler) {
return asynchronous(new Func0<Scheduler>() {
@Override
public Scheduler call() {
return nonTransactionalScheduler;
}
});
} | java |
private void connectAndPrepareStatement(Subscriber<? super T> subscriber, State state)
throws SQLException {
log.debug("connectionProvider={}", query.context().connectionProvider());
if (!subscriber.isUnsubscribed()) {
log.debug("getting connection");
state.con = quer... | java |
static int parametersCount(Query query) {
if (query.names().isEmpty())
return countQuestionMarkParameters(query.sql());
else
return query.names().size();
} | java |
private static String getTypeInfo(List<Object> list) {
StringBuilder s = new StringBuilder();
for (Object o : list) {
if (s.length() > 0)
s.append(", ");
if (o == null)
s.append("null");
else {
s.append(o.getClass().get... | java |
private static void setBlob(PreparedStatement ps, int i, Object o, Class<?> cls)
throws SQLException {
final InputStream is;
if (o instanceof byte[]) {
is = new ByteArrayInputStream((byte[]) o);
} | java |
private static HikariDataSource createPool(String url, String username, String password,
int minPoolSize, int maxPoolSize, long connectionTimeoutMs) {
HikariDataSource ds = new HikariDataSource();
ds.setJdbcUrl(url);
ds.setUsername(username);
ds.setPassword(password);
... | java |
static Observable<List<Parameter>> bufferedParameters(Query query) {
int numParamsPerQuery = numParamsPerQuery(query);
if (numParamsPerQuery > 0)
// we don't check that parameters is empty after this because by
// general design we want nothing to happen if a query is passed no
... | java |
public <T> Observable<T> execute(ResultSetMapper<? extends T> function) {
return bufferedParameters(this)
// execute once per set of parameters
.concatMap(executeOnce(function));
} | java |
private void checkSubscription(Subscriber<? super T> subscriber) {
if (subscriber.isUnsubscribed()) {
keepGoing = false;
log.debug("unsubscribing");
}
} | java |
private void getConnection(State state) {
state.con = query.context().connectionProvider().get();
debug("getting connection");
debug("cp={}", query.context().connectionProvider());
} | java |
private void complete(Subscriber<? super T> subscriber) {
if (!subscriber.isUnsubscribed()) {
debug("onCompleted");
subscriber.onCompleted();
} else
debug("unsubscribed");
} | java |
private void handleException(Throwable e, Subscriber<? super T> subscriber) {
debug("onError: ", e.getMessage());
Exceptions.throwOrReport(e, subscriber);
} | java |
private void close(State state) {
// ensure close happens once only to avoid race conditions
if (state.closed.compareAndSet(false, true)) {
Util.closeQuietly(state.ps);
if (isCommit() || isRollback())
Util.closeQuietly(state.con);
else
... | java |
<T> void parameters(Observable<T> params) {
this.parameters = Observable.concat(parameters, params.map(Parameter.TO_PARAMETER));
} | java |
void parameter(Object value) {
// TODO check on supported types?
if (value instanceof Observable)
throw new IllegalArgumentException(
"use parameters() method not the parameter() method for an Observable");
parameters(Observable.just(value));
} | java |
@SuppressLint("MissingPermission") @RequiresPermission(allOf = {
ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, CHANGE_WIFI_STATE, ACCESS_WIFI_STATE
}) public static Observable<List<ScanResult>> observeWifiAccessPoints(final Context context) {
@SuppressLint("WifiManagerPotentialLeak") final WifiManager wifiM... | java |
@RequiresPermission(ACCESS_WIFI_STATE)
public static Observable<WifiSignalLevel> observeWifiSignalLevel(final Context context) {
return observeWifiSignalLevel(context, WifiSignalLevel.getMaxLevel()).map(
new Function<Integer, WifiSignalLevel>() {
@Override public WifiSignalLevel apply(Integer le... | java |
@RequiresPermission(ACCESS_WIFI_STATE) public static Observable<Integer> observeWifiSignalLevel(
final Context context, final int numLevels) {
final WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
final IntentFilter filter = new IntentFilter();
filter.addAction(... | java |
@RequiresPermission(ACCESS_WIFI_STATE) public static Observable<WifiState> observeWifiStateChange(
final Context context) {
final IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
return Observable.create(new ObservableOnSubscribe<WifiState>() {
... | java |
public synchronized DatabaseInfo getDatabaseInfo() {
if (databaseInfo != null) {
return databaseInfo;
}
try {
_check_mtime();
boolean hasStructureInfo = false;
byte[] delim = new byte[3];
// Advance to part of file where database info i... | java |
public Location getLocation(String str) {
InetAddress addr;
try {
addr = InetAddress.getByName(str);
} catch (UnknownHostException e) {
return null;
}
return getLocation(addr);
} | java |
private synchronized int seekCountryV6(InetAddress addr) {
byte[] v6vec = addr.getAddress();
if (v6vec.length == 4) {
// sometimes java returns an ipv4 address for IPv6 input
// we have to work around that feature
// It happens for ::ffff:24.24.24.24
byte... | java |
private synchronized int seekCountry(long ipAddress) {
byte[] buf = new byte[2 * MAX_RECORD_LENGTH];
int[] x = new int[2];
int offset = 0;
_check_mtime();
for (int depth = 31; depth >= 0; depth--) {
readNode(buf, x, offset);
if ((ipAddress & (1 << depth))... | java |
private static long bytesToLong(byte[] address) {
long ipnum = 0;
for (int i = 0; i < 4; ++i) {
long y = address[i];
if (y < 0) {
y += 256;
}
ipnum += y << ((3 - i) * 8);
}
return ipnum;
} | java |
public Date getDate() {
for (int i = 0; i < info.length() - 9; i++) {
if (Character.isWhitespace(info.charAt(i))) {
String dateString = info.substring(i + 1, i + 9);
try {
synchronized (formatter) {
return formatter.parse(da... | java |
public void swapElements(int i, int j) {
if (i != j) {
double s = get(i);
set(i, get(j));
set(j, s);
}
} | java |
public Vector shuffle() {
Vector result = copy();
// Conduct Fisher-Yates shuffle
Random random = new Random();
for (int i = 0; i < length; i++) {
int j = random.nextInt(length - i) + i;
swapElements(i, j);
}
return result;
} | java |
public Vector slice(int from, int until) {
if (until - from < 0) {
fail("Wrong slice range: [" + from + ".." + until + "].");
}
Vector result = blankOfLength(until - from);
for (int i = from; i < until; i++) {
result.set(i - from, get(i));
}
ret... | java |
public Vector select(int[] indices) {
int newLength = indices.length;
if (newLength == 0) {
fail("No elements selected.");
}
Vector result = blankOfLength(newLength);
for (int i = 0; i < newLength; i++) {
result.set(i, get(indices[i]));
}
... | java |
public String mkString(NumberFormat formatter, String delimiter) {
StringBuilder sb = new StringBuilder();
VectorIterator it = iterator();
while (it.hasNext()) {
double x = it.next();
int i = it.index();
sb.append(formatter.format(x))
.app... | java |
@Override
public VectorIterator iterator() {
return new VectorIterator(length) {
private int i = -1;
@Override
public int index() {
return i;
}
@Override
public double get() {
return Vector.this.get(i);... | java |
public static VectorAccumulator asSumAccumulator(final double neutral) {
return new VectorAccumulator() {
private BigDecimal result = BigDecimal.valueOf(neutral);
@Override
public void update(int i, double value) {
result = result.add(BigDecimal.valueOf(value... | java |
public static VectorAccumulator mkMinAccumulator() {
return new VectorAccumulator() {
private double result = Double.POSITIVE_INFINITY;
@Override
public void update(int i, double value) {
result = Math.min(result, value);
}
@Override
... | java |
public static VectorAccumulator mkMaxAccumulator() {
return new VectorAccumulator() {
private double result = Double.NEGATIVE_INFINITY;
@Override
public void update(int i, double value) {
result = Math.max(result, value);
}
@Override
... | java |
public static VectorProcedure asAccumulatorProcedure(final VectorAccumulator accumulator) {
return new VectorProcedure() {
@Override
public void apply(int i, double value) {
accumulator.update(i, value);
}
};
} | java |
public static MatrixAccumulator mkMinAccumulator() {
return new MatrixAccumulator() {
private double result = Double.POSITIVE_INFINITY;
@Override
public void update(int i, int j, double value) {
result = Math.min(result, value);
}
@Ov... | java |
public static MatrixAccumulator mkMaxAccumulator() {
return new MatrixAccumulator() {
private double result = Double.NEGATIVE_INFINITY;
@Override
public void update(int i, int j, double value) {
result = Math.max(result, value);
}
@Ov... | java |
public static MatrixAccumulator asSumAccumulator(final double neutral) {
return new MatrixAccumulator() {
private BigDecimal result = BigDecimal.valueOf(neutral);
@Override
public void update(int i, int j, double value) {
result = result.add(BigDecimal.valueO... | java |
public static MatrixProcedure asAccumulatorProcedure(final MatrixAccumulator accumulator) {
return new MatrixProcedure() {
@Override
public void apply(int i, int j, double value) {
accumulator.update(i, j, value);
}
};
} | java |
public void swapRows(int i, int j) {
if (i != j) {
Vector ii = getRow(i);
Vector jj = getRow(j);
setRow(i, jj);
setRow(j, ii);
}
} | java |
public void swapColumns(int i, int j) {
if (i != j) {
Vector ii = getColumn(i);
Vector jj = getColumn(j);
setColumn(i, jj);
setColumn(j, ii);
}
} | java |
public Matrix transpose() {
Matrix result = blankOfShape(columns, rows);
MatrixIterator it = result.iterator();
while (it.hasNext()) {
it.next();
int i = it.rowIndex();
int j = it.columnIndex();
it.set(get(j, i));
}
return result;... | java |
public double trace() {
double result = 0.0;
for (int i = 0; i < rows; i++) {
result += get(i, i);
}
return result;
} | java |
public double diagonalProduct() {
BigDecimal result = BigDecimal.ONE;
for (int i = 0; i < rows; i++) {
result = result.multiply(BigDecimal.valueOf(get(i, i)));
}
return result.setScale(Matrices.ROUND_FACTOR,
RoundingMode.CEILING).doubleValue();
} | java |
public double determinant() {
if (rows != columns) {
throw new IllegalStateException("Can not compute determinant of non-square matrix.");
}
if (rows == 0) {
return 0.0;
} else if (rows == 1) {
return get(0, 0);
} else if (rows == 2) {
... | java |
public int rank() {
if (rows == 0 || columns == 0) {
return 0;
}
// TODO:
// handle small (1x1, 1xn, nx1, 2x2, 2xn, nx2, 3x3, 3xn, nx3)
// matrices without SVD
MatrixDecompositor decompositor = withDecompositor(LinearAlgebra.SVD);
Matrix[] usv = deco... | java |
public Matrix insertRow(int i, Vector row) {
if (i > rows || i < 0) {
throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + rows);
}
Matrix result;
if (columns == 0) {
result = blankOfShape(rows + 1, row.length());
} else {
r... | java |
public Matrix insertColumn(int j, Vector column) {
if (j > columns || j < 0) {
throw new IndexOutOfBoundsException("Illegal column number, must be 0.." + columns);
}
Matrix result;
if (rows == 0) {
result = blankOfShape(column.length(), columns + 1);
} el... | java |
public Matrix removeRow(int i) {
if (i >= rows || i < 0) {
throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + (rows - 1));
}
Matrix result = blankOfShape(rows - 1, columns);
for (int ii = 0; ii < i; ii++) {
result.setRow(ii, getRow(ii));
... | java |
public Matrix removeColumn(int j) {
if (j >= columns || j < 0) {
throw new IndexOutOfBoundsException("Illegal column number, must be 0.." + (columns - 1));
}
Matrix result = blankOfShape(rows, columns - 1);
for (int jj = 0; jj < j; jj++) {
result.setColumn(jj, g... | java |
public Matrix shuffle() {
Matrix result = copy();
// Conduct Fisher-Yates shuffle
Random random = new Random();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
int ii = random.nextInt(rows - i) + i;
int jj = random.nextIn... | java |
public Matrix slice(int fromRow, int fromColumn, int untilRow, int untilColumn) {
ensureIndexArgumentsAreInBounds(fromRow, fromColumn);
ensureIndexArgumentsAreInBounds(untilRow - 1, untilColumn - 1);
if (untilRow - fromRow < 0 || untilColumn - fromColumn < 0) {
fail("Wrong slice ran... | java |
public RowMajorMatrixIterator rowMajorIterator() {
return new RowMajorMatrixIterator(rows, columns) {
private long limit = (long) rows * columns;
private int i = - 1;
@Override
public int rowIndex() {
return i / columns;
}
... | java |
public ColumnMajorMatrixIterator columnMajorIterator() {
return new ColumnMajorMatrixIterator(rows, columns) {
private long limit = (long) rows * columns;
private int i = -1;
@Override
public int rowIndex() {
return i - columnIndex() * rows;
... | java |
public RowMajorMatrixIterator nonZeroRowMajorIterator() {
return new RowMajorMatrixIterator(rows, columns) {
private long limit = (long) rows * columns;
private long i = -1;
@Override
public int rowIndex() {
return (int) (i / columns);
... | java |
public static ParseException create(List<ParseError> errors) {
if (errors.size() == 1) {
return new ParseException(errors.get(0).getMessage(), errors);
} else if (errors.size() > 1) {
return new ParseException(String.format("%d errors occured. First: %s",
... | java |
public static Token create(TokenType type, Position pos) {
Token result = new Token();
result.type = type;
result.line = pos.getLine();
result.pos = pos.getPos();
return result;
} | java |
public static Token createAndFill(TokenType type, Char ch) {
Token result = new Token();
result.type = type;
result.line = ch.getLine();
result.pos = ch.getPos();
result.contents = ch.getStringValue();
result.trigger = ch.getStringValue();
result.source = ch.toStr... | java |
@SuppressWarnings("squid:S1698")
public boolean matches(TokenType type, String trigger) {
if (!is(type)) {
return false;
}
if (trigger == null) {
throw new IllegalArgumentException("trigger must not be null");
}
return getTrigger() == trigger.intern()... | java |
@SuppressWarnings("squid:S1698")
public boolean wasTriggeredBy(String... triggers) {
if (triggers.length == 0) {
return false;
}
for (String aTrigger : triggers) {
if (aTrigger != null && aTrigger.intern() == getTrigger()) {
return true;
}
... | java |
public static Expression parse(String input) throws ParseException {
return new Parser(new StringReader(input), new Scope()).parse();
} | java |
protected Expression functionCall() {
FunctionCall call = new FunctionCall();
Token funToken = tokenizer.consume();
Function fun = functionTable.get(funToken.getContents());
if (fun == null) {
errors.add(ParseError.error(funToken, String.format("Unknown function: '%s'", funTo... | java |
protected boolean canConsumeThisString(String string, boolean consume) {
if (string == null) {
return false;
}
for (int i = 0; i < string.length(); i++) {
if (!input.next(i).is(string.charAt(i))) {
return false;
}
}
if (consume)... | java |
protected void skipBlockComment() {
while (!input.current().isEndOfInput()) {
if (isAtEndOfBlockComment()) {
return;
}
input.consume();
}
problemCollector.add(ParseError.error(input.current(), "Premature end of block comment"));
} | java |
protected Token fetchString() {
char separator = input.current().getValue();
char escapeChar = stringDelimiters.get(input.current().getValue());
Token result = Token.create(Token.TokenType.STRING, input.current());
result.addToTrigger(input.consume());
while (!input.current().isN... | java |
protected Token fetchId() {
Token result = Token.create(Token.TokenType.ID, input.current());
result.addToContent(input.consume());
while (isIdentifierChar(input.current())) {
result.addToContent(input.consume());
}
if (!input.current().isEndOfInput() && specialIdTerm... | java |
protected Token handleKeywords(Token idToken) {
String keyword = keywords.get(keywordsCaseSensitive ?
idToken.getContents().intern() :
idToken.getContents().toLowerCase().intern());
if (keyword != null) {
Token keywo... | java |
protected Token fetchSpecialId() {
Token result = Token.create(Token.TokenType.SPECIAL_ID, input.current());
result.addToTrigger(input.consume());
while (isIdentifierChar(input.current())) {
result.addToContent(input.consume());
}
return handleKeywords(result);
} | java |
protected Token fetchNumber() {
Token result = Token.create(Token.TokenType.INTEGER, input.current());
result.addToContent(input.consume());
while (input.current().isDigit() || input.current().is(decimalSeparator) || (input.current()
... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.