本文整理了Java中org.h2.value.Value.compareTo()
方法的一些代码示例,展示了Value.compareTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Value.compareTo()
方法的具体详情如下:
包路径:org.h2.value.Value
类名称:Value
方法名:compareTo
[英]Compare this value against another value using the specified compare mode.
[中]使用指定的比较模式将此值与另一个值进行比较。
代码示例来源:origin: com.h2database/h2
/**
* Compare two values with the current comparison mode. The values may not
* be of the same type.
*
* @param a the first value
* @param b the second value
* @return 0 if both values are equal, -1 if the first value is smaller, and
* 1 otherwise
*/
public int compare(Value a, Value b) {
return a.compareTo(b, compareMode);
}
代码示例来源:origin: com.h2database/h2
@Override
public int compare(Value o1, Value o2) {
return o1.compareTo(o2, mode);
}
});
代码示例来源:origin: com.h2database/h2
/**
* Check if two values are equal with the current comparison mode.
*
* @param a the first value
* @param b the second value
* @return true if both objects are equal
*/
public boolean areEqual(Value a, Value b) {
// can not use equals because ValueDecimal 0.0 is not equal to 0.00.
return a.compareTo(b, compareMode) == 0;
}
代码示例来源:origin: com.h2database/h2
@Override
public int compare(Value o1, Value o2) {
return o1.compareTo(o2, mode);
}
});
代码示例来源:origin: com.h2database/h2
@Override
protected int compareSecure(Value o, CompareMode mode) {
ValueArray v = (ValueArray) o;
if (values == v.values) {
return 0;
}
int l = values.length;
int ol = v.values.length;
int len = Math.min(l, ol);
for (int i = 0; i < len; i++) {
Value v1 = values[i];
Value v2 = v.values[i];
int comp = v1.compareTo(v2, mode);
if (comp != 0) {
return comp;
}
}
return Integer.compare(l, ol);
}
代码示例来源:origin: com.h2database/h2
@Override
public int compare(ValueArray v1, ValueArray v2) {
Value a1 = v1.getList()[0];
Value a2 = v2.getList()[0];
return a1.compareTo(a2, compareMode);
}
});
代码示例来源:origin: com.h2database/h2
private void patchCurrentRow(Value[] row) {
boolean changed = false;
Value[] current = result.currentRow();
CompareMode mode = conn.getCompareMode();
for (int i = 0; i < row.length; i++) {
if (row[i].compareTo(current[i], mode) != 0) {
changed = true;
break;
}
}
if (patchedRows == null) {
patchedRows = new HashMap<>();
}
Integer rowId = result.getRowId();
if (!changed) {
patchedRows.remove(rowId);
} else {
patchedRows.put(rowId, row);
}
}
代码示例来源:origin: com.h2database/h2
private Value getMax(Value a, Value b, boolean bigger) {
if (a == null) {
return b;
} else if (b == null) {
return a;
}
if (session.getDatabase().getSettings().optimizeIsNull) {
// IS NULL must be checked later
if (a == ValueNull.INSTANCE) {
return b;
} else if (b == ValueNull.INSTANCE) {
return a;
}
}
int comp = a.compareTo(b, table.getDatabase().getCompareMode());
if (comp == 0) {
return a;
}
if (a == ValueNull.INSTANCE || b == ValueNull.INSTANCE) {
if (session.getDatabase().getSettings().optimizeIsNull) {
// column IS NULL AND column <op> <not null> is always false
return null;
}
}
if (!bigger) {
comp = -comp;
}
return comp > 0 ? a : b;
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
public boolean areEqual(Value a, Value b) throws SQLException {
// TODO optimization possible
// boolean is = a.compareEqual(b);
// boolean is2 = a.compareTo(b, compareMode) == 0;
// if(is != is2) {
// is = a.compareEqual(b);
// System.out.println("hey!");
// }
// return a.compareEqual(b);
return a.compareTo(b, compareMode) == 0;
}
代码示例来源:origin: com.eventsourcing/h2
/**
* Check if two values are equal with the current comparison mode.
*
* @param a the first value
* @param b the second value
* @return true if both objects are equal
*/
public boolean areEqual(Value a, Value b) {
// can not use equals because ValueDecimal 0.0 is not equal to 0.00.
return a.compareTo(b, compareMode) == 0;
}
代码示例来源:origin: org.wowtools/h2
/**
* Compare two values with the current comparison mode. The values may not
* be of the same type.
*
* @param a the first value
* @param b the second value
* @return 0 if both values are equal, -1 if the first value is smaller, and
* 1 otherwise
*/
public int compare(Value a, Value b) {
return a.compareTo(b, compareMode);
}
代码示例来源:origin: org.wowtools/h2
@Override
public int compare(Value o1, Value o2) {
return o1.compareTo(o2, mode);
}
});
代码示例来源:origin: org.wowtools/h2
/**
* Check if two values are equal with the current comparison mode.
*
* @param a the first value
* @param b the second value
* @return true if both objects are equal
*/
public boolean areEqual(Value a, Value b) {
// can not use equals because ValueDecimal 0.0 is not equal to 0.00.
return a.compareTo(b, compareMode) == 0;
}
代码示例来源:origin: com.eventsourcing/h2
@Override
public int compare(Value o1, Value o2) {
return o1.compareTo(o2, mode);
}
});
代码示例来源:origin: com.eventsourcing/h2
/**
* Compare two values with the current comparison mode. The values may not
* be of the same type.
*
* @param a the first value
* @param b the second value
* @return 0 if both values are equal, -1 if the first value is smaller, and
* 1 otherwise
*/
public int compare(Value a, Value b) {
return a.compareTo(b, compareMode);
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
public int compare(Value a, Value b) throws SQLException {
return a.compareTo(b, compareMode);
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
protected int compareSecure(Value o, CompareMode mode) throws SQLException {
ValueArray v = (ValueArray) o;
if (values == v.values) {
return 0;
}
int l = values.length;
int ol = v.values.length;
int len = Math.min(l, ol);
for (int i = 0; i < len; i++) {
Value v1 = values[i];
Value v2 = v.values[i];
int comp = v1.compareTo(v2, mode);
if (comp != 0) {
return comp;
}
}
return l > ol ? 1 : l == ol ? 0 : -1;
}
代码示例来源:origin: com.eventsourcing/h2
@Override
protected int compareSecure(Value o, CompareMode mode) {
ValueArray v = (ValueArray) o;
if (values == v.values) {
return 0;
}
int l = values.length;
int ol = v.values.length;
int len = Math.min(l, ol);
for (int i = 0; i < len; i++) {
Value v1 = values[i];
Value v2 = v.values[i];
int comp = v1.compareTo(v2, mode);
if (comp != 0) {
return comp;
}
}
return l > ol ? 1 : l == ol ? 0 : -1;
}
代码示例来源:origin: org.wowtools/h2
@Override
public int compare(ValueArray v1, ValueArray v2) {
Value a1 = v1.getList()[0];
Value a2 = v2.getList()[0];
return a1.compareTo(a2, compareMode);
}
});
代码示例来源:origin: com.eventsourcing/h2
@Override
public int compare(ValueArray v1, ValueArray v2) {
Value a1 = v1.getList()[0];
Value a2 = v2.getList()[0];
return a1.compareTo(a2, compareMode);
}
});
内容来源于网络,如有侵权,请联系作者删除!