本文整理汇总了Java中org.hsqldb.types.DTIType.yearToSecondSeparators方法的典型用法代码示例。如果您正苦于以下问题:Java DTIType.yearToSecondSeparators方法的具体用法?Java DTIType.yearToSecondSeparators怎么用?Java DTIType.yearToSecondSeparators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hsqldb.types.DTIType
的用法示例。
在下文中一共展示了DTIType.yearToSecondSeparators方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanDateParts
import org.hsqldb.types.DTIType; //导入方法依赖的package包/类
void scanDateParts(int lastPart) {
byte[] separators = DTIType.yearToSecondSeparators;
int i = intervalPosition;
final int firstPart = 0;
int currentPart = firstPart;
int currentDigits = 0;
for (; currentPart <= lastPart; ) {
boolean endOfPart = false;
if (i == intervalString.length()) {
if (currentPart == lastPart) {
endOfPart = true;
} else {
// parts missing
throw Error.error(ErrorCode.X_22007);
}
} else {
int character = intervalString.charAt(i);
if (character >= '0' && character <= '9') {
currentDigits++;
i++;
} else if (character == separators[currentPart]) {
endOfPart = true;
if (currentPart != lastPart) {
i++;
}
} else if (currentPart == lastPart) {
endOfPart = true;
} else {
throw Error.error(ErrorCode.X_22007);
}
}
if (endOfPart) {
if (currentPart == firstPart) {
if (currentDigits != 4) {
throw Error.error(ErrorCode.X_22007);
}
} else {
if (currentDigits == 0 || currentDigits > 2) {
throw Error.error(ErrorCode.X_22007);
}
}
currentPart++;
currentDigits = 0;
if (i == intervalString.length()) {
break;
}
}
}
intervalPosition = i;
}
示例2: scanDateParts
import org.hsqldb.types.DTIType; //导入方法依赖的package包/类
void scanDateParts(int lastPart) {
byte[] separators = DTIType.yearToSecondSeparators;
int i = intervalPosition;
final int firstPart = 0;
int currentPart = firstPart;
int currentDigits = 0;
for (; currentPart <= lastPart; ) {
boolean endOfPart = false;
if (i == intervalString.length()) {
if (currentPart == lastPart) {
endOfPart = true;
} else {
// parts missing
throw Error.error(ErrorCode.X_22007);
}
} else {
int character = intervalString.charAt(i);
if (character >= '0' && character <= '9') {
currentDigits++;
i++;
} else if (character == separators[currentPart]) {
endOfPart = true;
if (currentPart != lastPart) {
i++;
}
} else if (currentPart == lastPart) {
endOfPart = true;
} else {
throw Error.error(ErrorCode.X_22007);
}
}
if (endOfPart) {
if (currentPart == firstPart) {
if (currentDigits != 4) {
throw Error.error(ErrorCode.X_22007);
}
} else {
if (currentDigits != 2) {
throw Error.error(ErrorCode.X_22007);
}
}
currentPart++;
currentDigits = 0;
if (i == intervalString.length()) {
break;
}
}
}
intervalPosition = i;
}