当前位置: 首页>>代码示例>>Java>>正文


Java ArrayUtil.find方法代码示例

本文整理汇总了Java中org.hsqldb.lib.ArrayUtil.find方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtil.find方法的具体用法?Java ArrayUtil.find怎么用?Java ArrayUtil.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hsqldb.lib.ArrayUtil的用法示例。


在下文中一共展示了ArrayUtil.find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hasColumn

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
boolean hasColumn(int colIndex) {

        switch (constType) {

            case SchemaObject.ConstraintTypes.CHECK :
                return rangeVariable.usedColumns[colIndex];

            case SchemaObject.ConstraintTypes.PRIMARY_KEY :
            case SchemaObject.ConstraintTypes.UNIQUE :
            case SchemaObject.ConstraintTypes.MAIN :
                return ArrayUtil.find(core.mainCols, colIndex) != -1;

            case SchemaObject.ConstraintTypes.FOREIGN_KEY :
                return ArrayUtil.find(core.refCols, colIndex) != -1;

            default :
                throw Error.runtimeError(ErrorCode.U_S0500, "Constraint");
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:20,代码来源:Constraint.java

示例2: getStatement

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
String getStatement(int startPosition, short[] startTokens) {

        while (true) {
            if (token.tokenType == Tokens.SEMICOLON) {
                break;
            } else if (token.tokenType == Tokens.X_ENDPARSE) {
                break;
            } else {
                if (ArrayUtil.find(startTokens, token.tokenType) != -1) {
                    break;
                }
            }

            read();
        }

        String sql = scanner.getPart(startPosition,
                                     scanner.getTokenPosition());

        return sql;
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:22,代码来源:ParserBase.java

示例3: getIntegerProperty

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
 * Choice limited to values list, defaultValue must be in the values list.
 */
public int getIntegerProperty(String key, int defaultValue, int[] values) {

    String prop  = getProperty(key);
    int    value = defaultValue;

    try {
        if (prop != null) {
            value = Integer.parseInt(prop);
        }
    } catch (NumberFormatException e) {}

    if (ArrayUtil.find(values, value) == -1) {
        return defaultValue;
    }

    return value;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:HsqlProperties.java

示例4: getStatement

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
String getStatement(int startPosition, short[] startTokens) {

        int semiPosition = 0;

        while (true) {
            if (token.tokenType == Tokens.SEMICOLON) {
                semiPosition = scanner.getPosition();
            } else if (token.tokenType == Tokens.X_ENDPARSE) {
                if (semiPosition == 0) {
                    break;
                } else {
                    rewind(semiPosition);

                    break;
                }
            } else {
                semiPosition = 0;

                if (ArrayUtil.find(startTokens, token.tokenType) != -1) {
                    break;
                }
            }

            read();
        }

        String sql = scanner.getPart(startPosition, scanner.getPosition());

        return sql;
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:31,代码来源:ParserBase.java

示例5: validateProperty

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
public boolean validateProperty(String name, int number) {

        Object[] meta = (Object[]) metaData.get(name);

        if (meta == null) {
            return false;
        }

        if (meta[indexClass].equals("Integer")) {
            if (Boolean.TRUE.equals(meta[indexIsRange])) {
                int low  = ((Integer) meta[indexRangeLow]).intValue();
                int high = ((Integer) meta[indexRangeHigh]).intValue();

                if (number < low || high < number) {
                    return false;
                }
            }

            if (meta[indexValues] != null) {
                int[] values = (int[]) meta[indexValues];

                if (ArrayUtil.find(values, number) == -1) {
                    return false;
                }
            }

            return true;
        }

        return false;
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:32,代码来源:HsqlProperties.java

示例6: getUniqueConstraintForColumns

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
 * Returns the UNIQUE or PK constraint with the given column signature.
 * Modifies the composition of refTableCols if necessary.
 */
Constraint getUniqueConstraintForColumns(int[] mainTableCols, int[] refTableCols) {

    for (int i = 0, size = constraintList.length; i < size; i++) {
        Constraint c = constraintList[i];
        int type = c.getConstraintType();

        if (type != Constraint.UNIQUE && type != Constraint.PRIMARY_KEY) {
            continue;
        }

        int[] constraintCols = c.getMainColumns();

        if (constraintCols.length != mainTableCols.length) {
            continue;
        }

        if (ArrayUtil.areEqual(constraintCols, mainTableCols, mainTableCols.length, true)) {
            return c;
        }

        if (ArrayUtil.areEqualSets(constraintCols, mainTableCols)) {
            int[] newRefTableCols = new int[mainTableCols.length];

            for (int j = 0; j < mainTableCols.length; j++) {
                int pos = ArrayUtil.find(constraintCols, mainTableCols[j]);

                newRefTableCols[pos] = refTableCols[j];
            }

            for (int j = 0; j < mainTableCols.length; j++) {
                refTableCols[j] = newRefTableCols[j];
            }

            return c;
        }
    }

    return null;
}
 
开发者ID:s-store,项目名称:s-store,代码行数:44,代码来源:Table.java

示例7: position

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
public long position(SessionInterface session, byte[] pattern,
                     long start) {

    if (pattern.length > data.length) {
        return -1;
    }

    if (start >= data.length) {
        return -1;
    }

    return ArrayUtil.find(data, (int) start, data.length, pattern);
}
 
开发者ID:s-store,项目名称:s-store,代码行数:14,代码来源:BinaryData.java

示例8: getDBIndex

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
 * return database ID
 */
synchronized final int getDBIndex(String aliasPath) {

    int    semipos  = aliasPath.indexOf(';');
    String alias    = aliasPath;
    String filepath = null;

    if (semipos != -1) {
        alias    = aliasPath.substring(0, semipos);
        filepath = aliasPath.substring(semipos + 1);
    }

    int dbIndex = ArrayUtil.find(dbAlias, alias);

    if (dbIndex == -1) {
        if (filepath == null) {
            HsqlException e = Error.error(ErrorCode.GENERAL_ERROR,
                                          "database alias does not exist");

            printError("database alias=" + alias + " does not exist");
            setServerError(e);

            throw e;
        } else {
            return openDatabase(alias, filepath);
        }
    } else {
        return dbIndex;
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:33,代码来源:Server.java

示例9: getContainingIndexNames

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
OrderedHashSet getContainingIndexNames(int colIndex) {

        OrderedHashSet set = new OrderedHashSet();

        for (int i = 0, size = indexList.length; i < size; i++) {
            Index index = indexList[i];

            if (ArrayUtil.find(index.getColumns(), colIndex) != -1) {
                set.add(index.getName());
            }
        }

        return set;
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:15,代码来源:Table.java

示例10: hasColumnPlus

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
boolean hasColumnPlus(int colIndex) {

        switch (constType) {

            case CHECK :
                return rangeVariable.usedColumns[colIndex] && ArrayUtil
                    .countTrueElements(rangeVariable.usedColumns) > 1;

            case PRIMARY_KEY :
            case UNIQUE :
                return core.mainCols.length != 1
                       && ArrayUtil.find(core.mainCols, colIndex) != -1;

            case MAIN :
                return ArrayUtil.find(core.mainCols, colIndex) != -1
                       && (core.mainCols.length != 1
                           || core.mainTable != core.refTable);

            case FOREIGN_KEY :
                return ArrayUtil.find(core.refCols, colIndex) != -1
                       && (core.mainCols.length != 1
                           || core.mainTable == core.refTable);

            default :
                throw Error.runtimeError(ErrorCode.U_S0500, "Constraint");
        }
    }
 
开发者ID:s-store,项目名称:s-store,代码行数:28,代码来源:Constraint.java

示例11: getDBID

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
 * return database ID
 */
synchronized final int getDBID(String aliasPath) throws HsqlException {

    int    semipos  = aliasPath.indexOf(';');
    String alias    = aliasPath;
    String filepath = null;

    if (semipos != -1) {
        alias    = aliasPath.substring(0, semipos);
        filepath = aliasPath.substring(semipos + 1);
    }

    int dbIndex = ArrayUtil.find(dbAlias, alias);

    if (dbIndex == -1) {
        if (filepath == null) {
            RuntimeException e =
                new RuntimeException("database alias does not exist");

            printError("database alias=" + alias + " does not exist");
            setServerError(e);

            throw e;
        } else {
            return openDatabase(alias, filepath);
        }
    } else {
        return dbID[dbIndex];
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:33,代码来源:Server.java

示例12: validateProperty

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
 * Performs any range checking for property and return an error message
 */
public static String validateProperty(String key, String value,
                                      Object[] meta) {

    if (meta[indexClass].equals("Boolean")) {
        value = value.toLowerCase();

        if (value.equals("true") || value.equals("false")) {
            return null;
        }

        return "invalid boolean value for property: " + key;
    }

    if (meta[indexClass].equals("String")) {
        return null;
    }

    if (meta[indexClass].equals("Long")) {
        return null;
    }

    if (meta[indexClass].equals("Integer")) {
        try {
            int number = Integer.parseInt(value);

            if (Boolean.TRUE.equals(meta[indexIsRange])) {
                int low  = ((Integer) meta[indexRangeLow]).intValue();
                int high = ((Integer) meta[indexRangeHigh]).intValue();

                if (number < low || high < number) {
                    return "value outside range for property: " + key;
                }
            }

            if (meta[indexValues] != null) {
                int[] values = (int[]) meta[indexValues];

                if (ArrayUtil.find(values, number) == -1) {
                    return "value not supported for property: " + key;
                }
            }
        } catch (NumberFormatException e) {
            return "invalid integer value for property: " + key;
        }

        return null;
    }

    return null;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:54,代码来源:HsqlProperties.java

示例13: readIntervalType

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
IntervalType readIntervalType() {

        int precision = -1;
        int scale     = -1;
        int startToken;
        int endToken;

        startToken = endToken = token.tokenType;

        read();

        if (token.tokenType == Tokens.OPENBRACKET) {
            read();

            precision = readInteger();

            if (precision <= 0) {
                throw Error.error(ErrorCode.X_42592);
            }

            if (token.tokenType == Tokens.COMMA) {
                if (startToken != Tokens.SECOND) {
                    throw unexpectedToken();
                }

                read();

                scale = readInteger();

                if (scale < 0) {
                    throw Error.error(ErrorCode.X_42592);
                }
            }

            readThis(Tokens.CLOSEBRACKET);
        }

        if (token.tokenType == Tokens.TO) {
            read();

            endToken = token.tokenType;

            read();
        }

        if (token.tokenType == Tokens.OPENBRACKET) {
            if (endToken != Tokens.SECOND || endToken == startToken) {
                throw unexpectedToken();
            }

            read();

            scale = readInteger();

            if (scale < 0) {
                throw Error.error(ErrorCode.X_42592);
            }

            readThis(Tokens.CLOSEBRACKET);
        }

        int startIndex = ArrayUtil.find(Tokens.SQL_INTERVAL_FIELD_CODES,
                                        startToken);
        int endIndex = ArrayUtil.find(Tokens.SQL_INTERVAL_FIELD_CODES,
                                      endToken);

        return IntervalType.getIntervalType(startIndex, endIndex, precision,
                                            scale);
    }
 
开发者ID:s-store,项目名称:s-store,代码行数:70,代码来源:ParserBase.java

示例14: enforceRowConstraints

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
 *  Enforce max field sizes according to SQL column definition.
 *  SQL92 13.8
 */
public void enforceRowConstraints(Session session, Object[] data) {

    for (int i = 0; i < columnCount; i++) {
        Type         type = colTypes[i];
        ColumnSchema column;

        if (hasDomainColumns && type.isDomainType()) {
            Constraint[] constraints =
                type.userTypeModifier.getConstraints();

            column = getColumn(i);

            for (int j = 0; j < constraints.length; j++) {
                constraints[j].checkCheckConstraint(session, this, column,
                                                    data[i]);
            }
        }

        if (colNotNull[i] && data[i] == null) {
            String     constraintName;
            Constraint c = getNotNullConstraintForColumn(i);

            if (c == null) {
                if (ArrayUtil.find(getPrimaryKey(), i) > -1) {
                    c = getPrimaryConstraint();
                }
            }

            constraintName = c == null ? ""
                                       : c.getName().name;
            column         = getColumn(i);

            String[] info = new String[] {
                constraintName, tableName.statementName,
                column.getName().statementName
            };

            throw Error.error(null, ErrorCode.X_23502,
                              ErrorCode.COLUMN_CONSTRAINT, info);
        }
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:47,代码来源:Table.java

示例15: readIntervalType

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
IntervalType readIntervalType(boolean maxPrecisionDefault) {

        int precision = -1;
        int scale     = -1;
        int startToken;
        int endToken;

        startToken = endToken = token.tokenType;

        read();

        if (token.tokenType == Tokens.OPENBRACKET) {
            read();

            precision = readInteger();

            if (precision <= 0) {
                throw Error.error(ErrorCode.X_42592);
            }

            if (token.tokenType == Tokens.COMMA) {
                if (startToken != Tokens.SECOND) {
                    throw unexpectedToken();
                }

                read();

                scale = readInteger();

                if (scale < 0) {
                    throw Error.error(ErrorCode.X_42592);
                }
            }

            readThis(Tokens.CLOSEBRACKET);
        }

        if (token.tokenType == Tokens.TO) {
            read();

            endToken = token.tokenType;

            read();
        }

        if (token.tokenType == Tokens.OPENBRACKET) {
            if (endToken != Tokens.SECOND || endToken == startToken) {
                throw unexpectedToken();
            }

            read();

            scale = readInteger();

            if (scale < 0) {
                throw Error.error(ErrorCode.X_42592);
            }

            readThis(Tokens.CLOSEBRACKET);
        }

        int startIndex = ArrayUtil.find(Tokens.SQL_INTERVAL_FIELD_CODES,
                                        startToken);
        int endIndex = ArrayUtil.find(Tokens.SQL_INTERVAL_FIELD_CODES,
                                      endToken);

        if (precision == -1 && maxPrecisionDefault) {
            if (startIndex == IntervalType.INTERVAL_SECOND_INDEX) {
                precision = IntervalType.maxIntervalSecondPrecision;
            } else {
                precision = IntervalType.maxIntervalPrecision;
            }
        }

        return IntervalType.getIntervalType(startIndex, endIndex, precision,
                                            scale);
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:78,代码来源:ParserBase.java


注:本文中的org.hsqldb.lib.ArrayUtil.find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。