name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
cron-utils_FieldQuestionMarkDefinitionBuilder_supportsQuestionMark_rdh
/** * Registers the field supports the LW (LW) special char. * * @return this FieldSpecialCharsDefinitionBuilder instance */ public FieldQuestionMarkDefinitionBuilder supportsQuestionMark() { constraints.addQuestionMarkSupport(); return this; }
3.26
cron-utils_ConstantsMapper_weekDayMapping_rdh
/** * Performs weekday mapping between two weekday definitions. * * @param source * - source * @param target * - target weekday definition * @param weekday * - value in source range. * @return int - mapped value */ public static int weekDayMapping(final WeekDay source, final WeekDay target, final int we...
3.26
cron-utils_CronDefinitionBuilder_cron4j_rdh
/** * Creates CronDefinition instance matching cron4j specification. * * @return CronDefinition instance, never null; */ private static CronDefinition cron4j() { return CronDefinitionBuilder.defineCron().withMinutes().withValidRange(0, 59).withStrictRange().and().withHours().withValidRange(0, 23).withStrictRange()....
3.26
cron-utils_CronDefinitionBuilder_withMinutes_rdh
/** * Adds definition for minutes field. * * @return new FieldDefinitionBuilder instance */ public FieldDefinitionBuilder withMinutes() { return new FieldDefinitionBuilder(this, CronFieldName.MINUTE);}
3.26
cron-utils_CronDefinitionBuilder_register_rdh
/** * Registers a certain FieldDefinition. * * @param definition * - FieldDefinition instance, never null */ public void register(final FieldDefinition definition) { // ensure that we can't register a mandatory definition if there are already optional ones boolean hasOptionalField = false; for (fina...
3.26
cron-utils_CronDefinitionBuilder_m0_rdh
/** * Creates a new CronDefinition instance with provided field definitions. * * @return returns CronDefinition instance, never null */ public CronDefinition m0() { final Set<CronConstraint> validations = new HashSet<>(); validations.addAll(cronConstraints); final List<FieldDefinition> v3 = new ArrayList<>(fields.v...
3.26
cron-utils_CronDefinitionBuilder_spring53_rdh
/** * Creates CronDefinition instance matching Spring (v5.2 onwards) specification. * https://spring.io/blog/2020/11/10/new-in-spring-5-3-improved-cron-expressions * * <p>The cron expression is expected to be a string comprised of 6 * fields separated by white space. Fields can contain any of the allowed * values...
3.26
cron-utils_CronDefinitionBuilder_instanceDefinitionFor_rdh
/** * Creates CronDefinition instance matching cronType specification. * * @param cronType * - some cron type. If null, a RuntimeException will be raised. * @return CronDefinition instance if definition is found; a RuntimeException otherwise. */ public static CronDefinition instanceDefinitionFor(final CronType ...
3.26
cron-utils_CronDefinitionBuilder_spring_rdh
/** * Creates CronDefinition instance matching Spring (v5.2 and below) specification. * * <p>The cron expression is expected to be a string comprised of 6 * fields separated by white space. Fields can contain any of the allowed * values, along with various combinations of the allowed special characters * for that...
3.26
cron-utils_CronDefinitionBuilder_withYear_rdh
/** * Adds definition for year field. * * @return new FieldDefinitionBuilder instance */ public FieldDefinitionBuilder withYear() { return new FieldDefinitionBuilder(this, CronFieldName.YEAR); }
3.26
cron-utils_CronDefinitionBuilder_withSupportedNicknameWeekly_rdh
/** * Supports cron nickname @weekly * * @return this CronDefinitionBuilder instance */ public CronDefinitionBuilder withSupportedNicknameWeekly() { cronNicknames.add(CronNicknames.WEEKLY); return this; }
3.26
cron-utils_CronDefinitionBuilder_withSupportedNicknameReboot_rdh
/** * Supports cron nickname @reboot * * @return this CronDefinitionBuilder instance */ public CronDefinitionBuilder withSupportedNicknameReboot() {cronNicknames.add(CronNicknames.REBOOT); return this; }
3.26
cron-utils_CronDefinitionBuilder_unixCrontab_rdh
/** * Creates CronDefinition instance matching unix crontab specification. * * @return CronDefinition instance, never null; */private static CronDefinition unixCrontab() {return CronDefinitionBuilder.defineCron().withMinutes().withValidRange(0, 59).withStrictRange().and().withHours().withValidRange(0, 23).withStr...
3.26
cron-utils_CronDefinitionBuilder_withDayOfYear_rdh
/** * Adds definition for day of year field. * * @return new FieldDefinitionBuilder instance */ public FieldQuestionMarkDefinitionBuilder withDayOfYear() { return new FieldQuestionMarkDefinitionBuilder(this, CronFieldName.DAY_OF_YEAR); }
3.26
cron-utils_CronDefinitionBuilder_withSupportedNicknameMidnight_rdh
/** * Supports cron nickname @midnight * * @return this CronDefinitionBuilder instance */ public CronDefinitionBuilder withSupportedNicknameMidnight() { cronNicknames.add(CronNicknames.MIDNIGHT); return this; }
3.26
cron-utils_CronDefinitionBuilder_withSeconds_rdh
/** * Adds definition for seconds field. * * @return new FieldDefinitionBuilder instance */ public FieldDefinitionBuilder withSeconds() { return new FieldDefinitionBuilder(this, CronFieldName.SECOND); }
3.26
cron-utils_CronDefinitionBuilder_withSupportedNicknameDaily_rdh
/** * Supports cron nickname @daily * * @return this CronDefinitionBuilder instance */ public CronDefinitionBuilder withSupportedNicknameDaily() { cronNicknames.add(CronNicknames.DAILY); return this;}
3.26
cron-utils_CronDefinitionBuilder_withCronValidation_rdh
/** * Adds a cron validation. * * @param validation * - constraint validation * @return this CronDefinitionBuilder instance */ public CronDefinitionBuilder withCronValidation(final CronConstraint validation) { cronConstraints.add(validation); return this; }
3.26
cron-utils_CronDefinitionBuilder_defineCron_rdh
/** * Creates a builder instance. * * @return new CronDefinitionBuilder instance */ public static CronDefinitionBuilder defineCron() { return new CronDefinitionBuilder(); }
3.26
cron-utils_CronDefinitionBuilder_matchDayOfWeekAndDayOfMonth_rdh
/** * Sets matchDayOfWeekAndDayOfMonth value to true. * * @return this CronDefinitionBuilder instance */ public CronDefinitionBuilder matchDayOfWeekAndDayOfMonth() {matchDayOfWeekAndDayOfMonth = true; return this;}
3.26
cron-utils_CronDefinitionBuilder_withSupportedNicknameHourly_rdh
/** * Supports cron nickname @hourly * * @return this CronDefinitionBuilder instance */ public CronDefinitionBuilder withSupportedNicknameHourly() { cronNicknames.add(CronNicknames.HOURLY); return this; }
3.26
cron-utils_SingleCron_validate_rdh
/** * Validates this Cron instance by validating its cron expression. * * @return this Cron instance * @throws IllegalArgumentException * if the cron expression is invalid */ public Cron validate() { for (final Map.Entry<CronFieldName, CronField> field : retrieveFieldsAsMap().entrySet()) { final Cro...
3.26
cron-utils_SingleCron_retrieve_rdh
/** * Retrieve value for cron field. * * @param name * - cron field name. * If null, a NullPointerException will be raised. * @return CronField that corresponds to given CronFieldName */ public CronField retrieve(final CronFieldName name) { return fields.get(Preconditions.checkNotNull(name, "CronFieldNam...
3.26
cron-utils_SingleCron_m0_rdh
/** * Provides means to compare if two cron expressions are equivalent. * * @param cronMapper * - maps 'cron' parameter to this instance definition; * @param cron * - any cron instance, never null * @return boolean - true if equivalent; false otherwise. */public boolean m0(final CronMapper cronMapper, final...
3.26
cron-utils_SingleCron_equivalent_rdh
/** * Provides means to compare if two cron expressions are equivalent. * Assumes same cron definition. * * @param cron * - any cron instance, never null * @return boolean - true if equivalent; false otherwise. */ public boolean equivalent(final Cron cron) { return asString().equals(cron.asString()); }
3.26
cron-utils_FieldDefinitionBuilder_withIntMapping_rdh
/** * Provides means to define int values mappings between equivalent values. * As a convention, higher values are mapped into lower ones * * @param source * - higher value * @param dest * - lower value with equivalent meaning to source * @return this instance */ public FieldDefinitionBuilder withIntMappin...
3.26
cron-utils_FieldDefinitionBuilder_withStrictRange_rdh
/** * Specifies that defined range for given field must be a strict range. * We understand strict range as a range defined as: "lowValue - highValue" * If some range value such as "highValue-lowValue" is specified in a field, it will fail to parse the field. * * @return same FieldDefinitionBuilder instance */ pub...
3.26
cron-utils_FieldDefinitionBuilder_withValidRange_rdh
/** * Allows to set a range of valid values for field. * * @param startRange * - start range value * @param endRange * - end range value * @return same FieldDefinitionBuilder instance */ public FieldDefinitionBuilder withValidRange(final int startRange, final int endRange) { constraints.withValidRange...
3.26
cron-utils_FieldDefinitionBuilder_optional_rdh
/** * Allows to tag a field as optional. * * @return this instance */ public FieldDefinitionBuilder optional() { optional = true; return this; }
3.26
cron-utils_ValidationFieldExpressionVisitor_isInRange_rdh
/** * Check if given number is greater or equal to start range and minor or equal to end range. * * @param fieldValue * - to be validated * @throws IllegalArgumentException * - if not in range */ @VisibleForTesting protected void isInRange(final FieldValue<?> fieldValue) { if (fieldValue instanceof ...
3.26
cron-utils_ValidationFieldExpressionVisitor_isPeriodInRange_rdh
/** * Check if given period is compatible with range. * * @param fieldValue * - to be validated * @throws IllegalArgumentException * - if not in range */ @VisibleForTestingprotected void isPeriodInRange(final FieldValue<?> fieldValue) { if (fieldValue instanceof IntegerFieldValue) { final int value = ((I...
3.26
cron-utils_Preconditions_m0_rdh
/** * Ensures the truth of an expression involving one or more parameters to the calling method. * * @param expression * a boolean expression * @param errorMessage * the exception message to use if the check fails; will be converted to a * string using {@link String#valueOf(Object)} * @throws IllegalArgum...
3.26
cron-utils_Preconditions_format_rdh
/** * Substitutes each {@code %s} in {@code template} with an argument. These are matched by * position: the first {@code %s} gets {@code args[0]}, etc. If there are more arguments than * placeholders, the unmatched arguments will be appended to the end of the formatted message in * square braces. * * @param nul...
3.26
cron-utils_Preconditions_checkNotNullNorEmpty_rdh
/** * Ensures that a collection reference passed as a parameter to the calling method is not null. * nor empty. * * @param reference * a collection reference * @param errorMessage * the exception message to use if the check fails; will be converted to a * string using {@link String#valueOf(Object)} * @re...
3.26
cron-utils_Preconditions_checkArgument_rdh
/** * Ensures the truth of an expression involving one or more parameters to the calling method. * * @param expression * a boolean expression * @param errorMessageTemplate * a template for the exception message should the check fail. The * message is formed by replacing each {@code %s} placeholder in the t...
3.26
cron-utils_Preconditions_checkState_rdh
/** * Ensures the truth of an expression involving the state of the calling instance, but not. * involving any parameters to the calling method. * * @param expression * a boolean expression * @param errorMessageTemplate * a template for the exception message should the check fail. The * message is formed ...
3.26
cron-utils_Preconditions_checkNotNull_rdh
/** * Ensures that an object reference passed as a parameter to the calling method is not null. * * @param reference * an object reference * @param errorMessage * the exception message to use if the check fails; will be converted to a * string using {@link String#valueOf(Object)} * @return the non-null re...
3.26
cron-utils_FieldSpecialCharsDefinitionBuilder_withIntMapping_rdh
/** * Defines mapping between integer values with equivalent meaning. * * @param source * - higher value * @param dest * - lower value with equivalent meaning to source * @return this FieldSpecialCharsDefinitionBuilder instance */ @Override public FieldSpecialCharsDefinitionBuilder withIntMapping(final int ...
3.26
cron-utils_FieldSpecialCharsDefinitionBuilder_withValidRange_rdh
/** * Allows to set a range of valid values for field. * * @param startRange * - start range value * @param endRange * - end range value * @return same FieldSpecialCharsDefinitionBuilder instance */ @Override public FieldSpecialCharsDefinitionBuilder withValidRange(final int startRange, final int endRange) ...
3.26
cron-utils_CronParserField_isOptional_rdh
/** * Returns optional tag. * * @return optional tag */ public final boolean isOptional() { return optional; }
3.26
cron-utils_CronParserField_parse_rdh
/** * Parses a String cron expression. * * @param expression * - cron expression * @return parse result as CronFieldParseResult instance - never null. May throw a RuntimeException if cron expression is bad. */ public CronField parse(final String expression) { String newExpression = expression; if (getF...
3.26
cron-utils_WeekDay_mapTo_rdh
/** * Maps given WeekDay to representation hold by this instance. * * @param targetWeekDayDefinition * - referred weekDay * @param dayOfWeek * - day of week to be mapped. * Value corresponds to this instance mapping. * @return - int r...
3.26
cron-utils_NominalDescriptionStrategy_addDescription_rdh
/** * Allows to provide a specific description to handle a CronFieldExpression instance. * * @param desc * - function that maps CronFieldExpression to String. * The function should return "" if does not match criteria, * or the description otherwise. * @return NominalDescriptionStrategy, this instance */ ...
3.26
cron-utils_StringUtils_isEmpty_rdh
// Empty checks // ----------------------------------------------------------------------- /** * <p>Checks if a CharSequence is empty ("") or null.</p> * * <pre> * StringUtils.isEmpty(null) = true * StringUtils.isEmpty("") = true * StringUtils.isEmpty(" ") = false * StringUtils.isEmpty("bob") ...
3.26
cron-utils_SecondsDescriptor_createAndDescription_rdh
/** * Creates human readable description for And element. * * @param builder * - StringBuilder instance to which description will be appended * @param expressions * - field expressions * @return same StringBuilder instance as parameter */ @VisibleForTesting StringBuilder createAndDescription(final StringBui...
3.26
cron-utils_SecondsDescriptor_visit_rdh
/** * Provide a human readable description for Every instance. * * @param every * - Every * @return human readable description - String */ @Override public Every visit(final Every every) { String description; if (every.getPeriod().getValue() > 1) { description = String.format("%s %...
3.26
cron-utils_SecondsDescriptor_nominalValue_rdh
/** * Given an int, will return a nominal value. Example: * 1 in weeks context, may mean "Monday", * so nominal value for 1 would be "Monday" * Default will return int as String * * @param fieldValue * - some FieldValue * @return String */ protected String nominalValue(final FieldValue<?> fieldValue) { P...
3.26
cron-utils_SecondsDescriptor_describe_rdh
/** * Provide a human readable description for On instance. * * @param on * - On * @return human readable description - String */ protected String describe(final On on, final boolean and) { if (and) { return nominalValue(on.getTime()); } return String.format("%s %s ", bundle.getString("at"),...
3.26
cron-utils_CronFieldName_getOrder_rdh
/** * Returns the order number that corresponds to the field. * * @return order number - int */ public int getOrder() { return order; }
3.26
cron-utils_FieldValue_toString_rdh
/** * String representation of encapsulated value. * * @return String, never null */@Override public final String toString() { return String.format("%s", getValue()); }
3.26
cron-utils_RebootCron_equivalent_rdh
/** * Provides means to compare if two cron expressions are equivalent. * * @param cronMapper * - maps 'cron' parameter to this instance definition; * @param cron * - any cron instance, never null * @return boolean - true if equivalent; false otherwise. */ public boolean equivalent(final CronMapper cronMapp...
3.26
cron-utils_RebootCron_retrieve_rdh
/** * Retrieve value for cron field. * * @param name * - cron field name. * If null, a NullPointerException will be raised. * @return CronField that corresponds to given CronFieldName */ public CronField retrieve(final CronFieldName name) { Preconditions.checkNotNull(name, "CronFieldName must not be nul...
3.26
cron-utils_RebootCron_validate_rdh
/** * Validates this Cron instance by validating its cron expression. * * @return this Cron instance * @throws IllegalArgumentException * if the cron expression is invalid */ public Cron validate() { for (final Map.Entry<CronFieldName, CronField> field : retrieveFieldsAsMap().entrySet()) { final ...
3.26
cron-utils_RebootCron_m0_rdh
/** * Provides means to compare if two cron expressions are equivalent. * Assumes same cron definition. * * @param cron * - any cron instance, never null * @return boolean - true if equivalent; false otherwise. */ public boolean m0(final Cron cron) { return asString().equals(cron.asString()); }
3.26
cron-utils_FieldDayOfWeekDefinitionBuilder_withValidRange_rdh
/** * Allows to set a range of valid values for field. * * @param startRange * - start range value * @param endRange * - end range value * @return same FieldDayOfWeekDefinitionBuilder instance */ @Override public FieldDayOfWeekDefinitionBuilder withValidRange(final int startRange, final int endRange) { ...
3.26
cron-utils_FieldDayOfWeekDefinitionBuilder_m0_rdh
/** * Registers the field supports the W (W) special char. * * @return this FieldSpecialCharsDefinitionBuilder instance */ public FieldDayOfWeekDefinitionBuilder m0(final int mondayDoW) { constraints.withShiftedStringMapping(mondayDoW - mondayDoWValue); mondayDoWValue = mondayDoW; return this; }
3.26
cron-utils_FieldDayOfWeekDefinitionBuilder_withIntMapping_rdh
/** * Defines mapping between integer values with equivalent meaning. * * @param source * - higher value * @param dest * - lower value with equivalent meaning to source * @return this FieldDayOfWeekDefinitionBuilder instance */ @Override public FieldDayOfWeekDefinitionBuilder withIntMapping(final int source...
3.26
cron-utils_FieldDayOfWeekDefinitionBuilder_and_rdh
/** * Registers CronField in ParserDefinitionBuilder and returns its instance. * * @return ParserDefinitionBuilder instance obtained from constructor */ @Override public CronDefinitionBuilder and() { final boolean zeroInRange = constraints.createConstraintsInstance().isInRange(0); cronDefinitionBuilder.regi...
3.26
cron-utils_FieldParser_parse_rdh
/** * Parse given expression for a single cron field. * * @param expression * - String * @return CronFieldExpression object that with interpretation of given String parameter */ public FieldExpression parse(final String expression) { if (!StringUtils.containsAny(expressio...
3.26
cron-utils_FieldParser_stringToInt_rdh
/** * Maps string expression to integer. If no mapping is found, will try to parse String as Integer * * @param exp * - expression to be mapped * @return integer value for string expression */ @VisibleForTesting protected int stringToInt(final String exp) { final Integer value = fieldConstraints.getStringMapp...
3.26
cron-utils_FieldParser_intToInt_rdh
/** * Maps integer values to another integer equivalence. Always consider mapping higher integers to lower once. Ex.: if 0 and 7 mean the * same, map 7 to 0. * * @param exp * - integer to be mapped * @return Mapping integer. If no mapping int is found, will return exp */ @VisibleForTesting protected int intToI...
3.26
cron-utils_FieldConstraintsBuilder_withShiftedStringMapping_rdh
/** * Shifts integer representation of weekday/month names. * * @param shiftSize * - size of the shift * @return same FieldConstraintsBuilder instance */ public FieldConstraintsBuilder withShiftedStringMapping(final int shiftSize) { if ((shiftSize > 0) || (endRange < stringMapping.size())) { for (fi...
3.26
cron-utils_FieldConstraintsBuilder_withValidRange_rdh
/** * Allows to set a range of valid values for field. * * @param startRange * - start range value * @param endRange * - end range value * @return same FieldConstraintsBuilder instance */ public FieldConstraintsBuilder withValidRange(final int startRange, final int endRange) { this.startRange = startRan...
3.26
cron-utils_FieldConstraintsBuilder_daysOfWeekMapping_rdh
/** * Creates days of week mapping. * * @return Map where strings are weekday names in EEE format and integers correspond to their 1-7 mappings */ private static Map<String, Integer> daysOfWeekMapping() { final Map<String, Integer> stringMapping = new HashMap<>(); stringMapping.put("MON", 1); stringMap...
3.26
cron-utils_FieldConstraintsBuilder_monthsMapping_rdh
/** * Creates months mapping. * * @return Map where strings month names in EEE format, and integers correspond to their 1-12 mappings */ private static Map<String, Integer> monthsMapping() { final Map<String, Integer> stringMapping = new HashMap<>(); stringMapping.put("JAN", 1); stringMapping.put("F...
3.26
cron-utils_FieldConstraintsBuilder_createConstraintsInstance_rdh
/** * Creates FieldConstraints instance based on previously built parameters. * * @return new FieldConstraints instance */ public FieldConstraints createConstraintsInstance() { return new FieldConstraints(stringMapping, intMapping, specialChars, startRange, endRange, strictRange); }
3.26
cron-utils_FieldConstraintsBuilder_withStrictRange_rdh
/** * With strict range. * * @return same FieldConstraintsBuilder instance */ public FieldConstraintsBuilder withStrictRange() { this.strictRange = true; return this; }
3.26
cron-utils_FieldConstraintsBuilder_forField_rdh
/** * Creates range constraints according to CronFieldName parameter. * * @param field * - CronFieldName * @return FieldConstraintsBuilder instance */ public FieldConstraintsBuilder forField(final CronFieldName field) { switch (field) { case SECOND : case MINUTE : endRange = 59;...
3.26
cron-utils_FieldConstraintsBuilder_m0_rdh
/** * Adds LW support. * * @return same FieldConstraintsBuilder instance */ public FieldConstraintsBuilder m0() { specialChars.add(SpecialChar.LW); return this; }
3.26
cron-utils_FieldConstraintsBuilder_withIntValueMapping_rdh
/** * Adds integer to integer mapping. Source should be greater than destination; * * @param source * - some int * @param dest * - some int * @return same FieldConstraintsBuilder instance */ public FieldConstraintsBuilder withIntValueMapping(final int source, final int dest) { intMapping.put(source, des...
3.26
cron-utils_FieldConstraintsBuilder_addLSupport_rdh
/** * Adds L support. * * @return same FieldConstraintsBuilder instance */ public FieldConstraintsBuilder addLSupport() { specialChars.add(SpecialChar.L); return this; }
3.26
cron-utils_CronConstraintsFactory_ensureEitherDayOfYearOrMonth_rdh
/** * Creates CronConstraint to ensure that either day-of-year or month is assigned a specific value. * * @return newly created CronConstraint instance, never {@code null}; */ public static CronConstraint ensureEitherDayOfYearOrMonth() { return new CronConstraint("Both, a day-of-year AND a day-of-month or day-o...
3.26
cron-utils_TimeNode_getValueFromList_rdh
/** * Obtain value from list considering specified index and required shifts. * * @param values * - possible values * @param index * - index to be considered * @param shift * - shifts that should be applied * @return int - required value from values list */ @VisibleForTesting int getValueFromList(fina...
3.26
cron-utils_TimeNode_getNearestBackwardValue_rdh
/** * We return same reference value if matches or previous one if does not match. * Then we start applying shifts. * This way we ensure same value is returned if no shift is requested. * * @param reference * - reference value * @param shiftsToApply * - shifts to apply * @return NearestValue instance, neve...
3.26
cron-utils_TimeNode_getNearestForwardValue_rdh
/** * We return same reference value if matches or next one if does not match. * Then we start applying shifts. * This way we ensure same value is returned if no shift is requested. * * @param reference * - reference value * @param shiftsToApply * - shifts to apply * @return NearestValue instance, never nu...
3.26
druid_Lexer_mark_rdh
// 出现多次调用mark()后调用reset()会有问题 @Deprecated public SavePoint mark() { return this.savePoint = markOut(); }
3.26
druid_Lexer_lexError_rdh
/** * Report an error at the given position using the provided arguments. */ protected void lexError(String key, Object... args) { token = ERROR; }
3.26
druid_Lexer_integerValue_rdh
// QS_TODO negative number is invisible for lexer public final Number integerValue() { long result = 0; boolean negative = false; int i = mark; int max = mark + bufPos; long limit; long multmin; int digit; if (charAt(mark) == '-') { negative = true; limit = Long.MIN_VALUE; i++; } else {limit = -Long.MAX_VALUE; } mul...
3.26
druid_Lexer_token_rdh
/** * Return the current token, set by nextToken(). */ public final Token.Token token() { return token;}
3.26
druid_Lexer_reset_rdh
// todo fix reset reset字段会导致lexer的游标不对齐 不建议使用 @Deprecated public void reset(int mark, char markChar, Token token) { this.pos = mark; this.ch = markChar; this.token = token; }
3.26
druid_Lexer_putChar_rdh
/** * Append a character to sbuf. */ protected final void putChar(char ch) { if (bufPos == buf.length) { char[] newsbuf = new char[buf.length * 2]; System.arraycopy(buf, 0, newsbuf, 0, buf.length); buf = newsbuf; } buf[bufPos++] = ch; }
3.26
druid_MySqlStatementParser_parseIf_rdh
/** * parse if statement * * @return MySqlIfStatement */ public SQLIfStatement parseIf() { accept(Token.Token.IF); SQLIfStatement stmt = new SQLIfStatement(); stmt.setCondition(this.exprParser.expr()); accept(Token.Token.THEN); this.parseStatementList(stmt.getStatements(), -1, stmt); while (lexer.token() == Token...
3.26
druid_MySqlStatementParser_parserParameters_rdh
/** * parse create procedure parameters * * @param parameters */ private void parserParameters(List<SQLParameter> parameters, SQLObject parent) { if (lexer.token() == Token.Token.RPAREN) { return; } for (; ;) { SQLParameter parameter = new SQLParameter(); if (lexer.token() == Token.Token.CURSOR) { ...
3.26
druid_MySqlStatementParser_parseRepeat_rdh
/** * parse repeat statement with label * * @param label */ public MySqlRepeatStatement parseRepeat(String label) { MySqlRepeatStatement repeatStmt = new MySqlRepeatStatement();repeatStmt.setLabelName(label); accept(Token.Token.REPEAT); this.parseStatementList(repeatStmt.getStatements(), -1, repeatStmt); accept(Tok...
3.26
druid_MySqlStatementParser_parseCursorDeclare_rdh
/** * parse cursor declare statement */ public MySqlCursorDeclareStatement parseCursorDeclare() { MySqlCursorDeclareStatement stmt = new MySqlCursorDeclareStatement(); accept(Token.Token.DECLARE); stmt.setCursorName(exprParser.name()); accept(Token.Token.CURSOR); accept(Token.Token.FOR); // SQLSelectStatement selelct...
3.26
druid_MySqlStatementParser_parseDeclareCondition_rdh
/** * zhujun [455910092@qq.com] * 2016-04-17 * 定义条件 */ public MySqlDeclareConditionStatement parseDeclareCondition() { MySqlDeclareConditionStatement stmt = new MySqlDeclareConditionStatement(); accept(Token.Token.DECLARE); stmt.setConditionName(exprParser.name().toString()); accept(Token.Token.CONDITION); accept(T...
3.26
druid_MySqlStatementParser_parseProcedureStatementList_rdh
/** * parse procedure statement block */ private void parseProcedureStatementList(List<SQLStatement> statementList, int max) { for (; ;) { if (max != (-1)) { if (statementList.size() >= max) { return; } } if (lexer.token() == Token.Token.EOF) { return; } if (lexer.token() == Token.Token.E...
3.26
druid_MySqlStatementParser_parseSpStatement_rdh
/** * zhujun [455910092@qq.com] * parse spstatement */ public SQLStatement parseSpStatement() { // update if (lexer.token() == Token.Token.UPDATE) { return parseUpdateStatement(); } // create if (lexer.token() == Token.Token.CREATE) { return parseCreate(); } // insert if (lexer.token() == Token.Token.INSE...
3.26
druid_MySqlStatementParser_parseWhile_rdh
/** * parse while statement with label * * @return MySqlWhileStatement */ public SQLWhileStatement parseWhile(String label) { accept(Token.Token.WHILE); SQLWhileStatement stmt = new SQLWhileStatement(); stmt.setLabelName(label); stmt.setCondition(this.exprParser.expr()); accept(Token.Token.DO); this.parseStatementL...
3.26
druid_MySqlStatementParser_parseBlock_rdh
/** * parse loop statement with label */ public SQLBlockStatement parseBlock(String label) { SQLBlockStatement block = new SQLBlockStatement(); block.setLabelName(label); accept(Token.Token.BEGIN); this.parseStatementList(block.getStatementList(), -1, block); accept(Token.Token.END); acceptIdentifier(label); return ...
3.26
druid_MySqlStatementParser_parseCase_rdh
/** * parse case statement * * @return MySqlCaseStatement */ public MySqlCaseStatement parseCase() { MySqlCaseStatement stmt = new MySqlCaseStatement(); accept(Token.Token.CASE); // grammar 1 if (lexer.token() == Token.Token.WHEN) { while (lexer.token() == Token.Token.WHEN) { MySqlWhenStatement when = new MySqlWh...
3.26
druid_MySqlStatementParser_parseLeave_rdh
/** * parse leave statement */ public MySqlLeaveStatement parseLeave() { accept(Token.Token.LEAVE); MySqlLeaveStatement leaveStmt = new MySqlLeaveStatement(); leaveStmt.setLabelName(exprParser.name().getSimpleName()); accept(Token.Token.SEMI); return leaveStmt; }
3.26
druid_MySqlStatementParser_parseAssign_rdh
/** * parse assign statement */ public SQLSetStatement parseAssign() { accept(Token.Token.SET); SQLSetStatement stmt = new SQLSetStatement(getDbType()); parseAssignItems(stmt.getItems(), stmt); return stmt; }
3.26
druid_MySqlStatementParser_parseCreateProcedure_rdh
/** * parse create procedure statement */ public SQLCreateProcedureStatement parseCreateProcedure() { /** * CREATE OR REPALCE PROCEDURE SP_NAME(parameter_list) BEGIN block_statement END */ SQLCreateProcedureStatement stmt = new SQLCreateProcedureStatement(); stmt.setDbType(dbType); if (lexe...
3.26
druid_MySqlStatementParser_parseLoop_rdh
/** * parse loop statement with label */ public SQLLoopStatement parseLoop(String label) { SQLLoopStatement loopStmt = new SQLLoopStatement(); loopStmt.setLabelName(label); accept(Token.Token.LOOP); this.parseStatementList(loopStmt.getStatements(), -1, loopStmt); accept(Token.Token.END); accept(Token.Token.LOOP); if ...
3.26
druid_MySqlStatementParser_parseIterate_rdh
/** * parse iterate statement */ public MySqlIterateStatement parseIterate() { accept(Token.Token.ITERATE); MySqlIterateStatement iterateStmt = new MySqlIterateStatement(); iterateStmt.setLabelName(exprParser.name().getSimpleName()); accept(Token.Token.SEMI); return iterateStmt; }
3.26
druid_MySqlStatementParser_parseDeclare_rdh
/** * parse declare statement */public SQLStatement parseDeclare() { Lexer.SavePoint savePoint = lexer.markOut(); lexer.nextToken(); if (lexer.token() == Token.Token.CONTINUE) { lexer.reset(savePoint); return this.parseDeclareHandler(); } lexer.nextToken();if (lexer.token() == Token.Token.CURSOR) { lexer.reset(saveP...
3.26
druid_MySqlStatementParser_parseSelectInto_rdh
/** * parse select into */ public MySqlSelectIntoStatement parseSelectInto() { MySqlSelectIntoParser parse = new MySqlSelectIntoParser(this.exprParser); return parse.parseSelectInto(); }
3.26
druid_NameResolveVisitor_isAliasColumn_rdh
/** * 是否是 select item 字段的别名 * * @param x * x 是否是 select item 字段的别名 * @param source * 从 source 数据中查找 and 判断 * @return true:是、false:不是 */ public boolean isAliasColumn(SQLExpr x, SQLSelectQueryBlock source) { if (x instanceof SQLIdentifierExpr) { SQLIdentifierExpr identifierExpr = ((SQLIdentifierExpr) (x)); ...
3.26
druid_NameResolveVisitor_isRowNumColumn_rdh
/** * 是否是 rownum 或者 rownum 别名 * * @param x * x 是否是 rownum 或者 rownum 别名 * @param source * 从 source 数据中查找 and 判断 * @return true:是、false:不是 */ public boolean isRowNumColumn(SQLExpr x, SQLSelectQueryBlock source) { if (x instanceof SQLIdentifierExpr) { SQLIdentifierExpr identifierExpr = ((SQLIdentifierExpr) (x...
3.26