Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
a9930a5c
提交
a9930a5c
authored
11月 12, 2017
作者:
LaughingMan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace MathUtils.compareInt() by Integer.compare()
上级
003fea5c
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
9 行增加
和
30 行删除
+9
-30
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+1
-2
MultiVersionCursor.java
h2/src/main/org/h2/index/MultiVersionCursor.java
+0
-1
ConnectionInfo.java
h2/src/main/org/h2/server/web/ConnectionInfo.java
+1
-2
ConvertTraceFile.java
h2/src/main/org/h2/tools/ConvertTraceFile.java
+1
-2
CacheObject.java
h2/src/main/org/h2/util/CacheObject.java
+1
-1
MathUtils.java
h2/src/main/org/h2/util/MathUtils.java
+0
-12
ValueByte.java
h2/src/main/org/h2/value/ValueByte.java
+1
-2
ValueEnum.java
h2/src/main/org/h2/value/ValueEnum.java
+1
-2
ValueEnumBase.java
h2/src/main/org/h2/value/ValueEnumBase.java
+1
-2
ValueInt.java
h2/src/main/org/h2/value/ValueInt.java
+1
-2
ValueShort.java
h2/src/main/org/h2/value/ValueShort.java
+1
-2
没有找到文件。
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
a9930a5c
...
@@ -21,7 +21,6 @@ import org.h2.table.Column;
...
@@ -21,7 +21,6 @@ import org.h2.table.Column;
import
org.h2.table.IndexColumn
;
import
org.h2.table.IndexColumn
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableFilter
;
import
org.h2.table.TableFilter
;
import
org.h2.util.MathUtils
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
...
@@ -348,7 +347,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
...
@@ -348,7 +347,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
if
(
isMultiVersion
)
{
if
(
isMultiVersion
)
{
int
v1
=
rowData
.
getVersion
();
int
v1
=
rowData
.
getVersion
();
int
v2
=
compare
.
getVersion
();
int
v2
=
compare
.
getVersion
();
return
MathUtils
.
compareInt
(
v2
,
v1
);
return
Integer
.
compare
(
v2
,
v1
);
}
}
return
0
;
return
0
;
}
}
...
...
h2/src/main/org/h2/index/MultiVersionCursor.java
浏览文件 @
a9930a5c
...
@@ -10,7 +10,6 @@ import org.h2.engine.SysProperties;
...
@@ -10,7 +10,6 @@ import org.h2.engine.SysProperties;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.result.Row
;
import
org.h2.result.Row
;
import
org.h2.result.SearchRow
;
import
org.h2.result.SearchRow
;
import
org.h2.util.MathUtils
;
/**
/**
* The cursor implementation for the multi-version index.
* The cursor implementation for the multi-version index.
...
...
h2/src/main/org/h2/server/web/ConnectionInfo.java
浏览文件 @
a9930a5c
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
*/
*/
package
org
.
h2
.
server
.
web
;
package
org
.
h2
.
server
.
web
;
import
org.h2.util.MathUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
/**
/**
...
@@ -61,7 +60,7 @@ public class ConnectionInfo implements Comparable<ConnectionInfo> {
...
@@ -61,7 +60,7 @@ public class ConnectionInfo implements Comparable<ConnectionInfo> {
@Override
@Override
public
int
compareTo
(
ConnectionInfo
o
)
{
public
int
compareTo
(
ConnectionInfo
o
)
{
return
-
MathUtils
.
compareInt
(
lastAccess
,
o
.
lastAccess
);
return
-
Integer
.
compare
(
lastAccess
,
o
.
lastAccess
);
}
}
}
}
h2/src/main/org/h2/tools/ConvertTraceFile.java
浏览文件 @
a9930a5c
...
@@ -16,7 +16,6 @@ import java.util.StringTokenizer;
...
@@ -16,7 +16,6 @@ import java.util.StringTokenizer;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.New
;
import
org.h2.util.New
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.util.Tool
;
import
org.h2.util.Tool
;
...
@@ -48,7 +47,7 @@ public class ConvertTraceFile extends Tool {
...
@@ -48,7 +47,7 @@ public class ConvertTraceFile extends Tool {
}
}
int
c
=
Long
.
compare
(
other
.
time
,
time
);
int
c
=
Long
.
compare
(
other
.
time
,
time
);
if
(
c
==
0
)
{
if
(
c
==
0
)
{
c
=
MathUtils
.
compareInt
(
other
.
executeCount
,
executeCount
);
c
=
Integer
.
compare
(
other
.
executeCount
,
executeCount
);
if
(
c
==
0
)
{
if
(
c
==
0
)
{
c
=
sql
.
compareTo
(
other
.
sql
);
c
=
sql
.
compareTo
(
other
.
sql
);
}
}
...
...
h2/src/main/org/h2/util/CacheObject.java
浏览文件 @
a9930a5c
...
@@ -77,7 +77,7 @@ public abstract class CacheObject implements Comparable<CacheObject> {
...
@@ -77,7 +77,7 @@ public abstract class CacheObject implements Comparable<CacheObject> {
@Override
@Override
public
int
compareTo
(
CacheObject
other
)
{
public
int
compareTo
(
CacheObject
other
)
{
return
MathUtils
.
compareInt
(
getPos
(),
other
.
getPos
());
return
Integer
.
compare
(
getPos
(),
other
.
getPos
());
}
}
public
boolean
isStream
()
{
public
boolean
isStream
()
{
...
...
h2/src/main/org/h2/util/MathUtils.java
浏览文件 @
a9930a5c
...
@@ -279,18 +279,6 @@ public class MathUtils {
...
@@ -279,18 +279,6 @@ public class MathUtils {
}
}
}
}
/**
* Compare two values. Returns -1 if the first value is smaller, 1 if
* bigger, and 0 if equal.
*
* @param a the first value
* @param b the second value
* @return the result
*/
public
static
int
compareInt
(
int
a
,
int
b
)
{
return
a
==
b
?
0
:
a
<
b
?
-
1
:
1
;
}
/**
/**
* Get a cryptographically secure pseudo random long value.
* Get a cryptographically secure pseudo random long value.
*
*
...
...
h2/src/main/org/h2/value/ValueByte.java
浏览文件 @
a9930a5c
...
@@ -10,7 +10,6 @@ import java.sql.SQLException;
...
@@ -10,7 +10,6 @@ import java.sql.SQLException;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.MathUtils
;
/**
/**
* Implementation of the BYTE data type.
* Implementation of the BYTE data type.
...
@@ -106,7 +105,7 @@ public class ValueByte extends Value {
...
@@ -106,7 +105,7 @@ public class ValueByte extends Value {
@Override
@Override
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
ValueByte
v
=
(
ValueByte
)
o
;
ValueByte
v
=
(
ValueByte
)
o
;
return
MathUtils
.
compareInt
(
value
,
v
.
value
);
return
Integer
.
compare
(
value
,
v
.
value
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/value/ValueEnum.java
浏览文件 @
a9930a5c
...
@@ -8,7 +8,6 @@ package org.h2.value;
...
@@ -8,7 +8,6 @@ package org.h2.value;
import
java.util.Locale
;
import
java.util.Locale
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.MathUtils
;
public
class
ValueEnum
extends
ValueEnumBase
{
public
class
ValueEnum
extends
ValueEnumBase
{
private
static
enum
Validation
{
private
static
enum
Validation
{
...
@@ -57,7 +56,7 @@ public class ValueEnum extends ValueEnumBase {
...
@@ -57,7 +56,7 @@ public class ValueEnum extends ValueEnumBase {
@Override
@Override
protected
int
compareSecure
(
final
Value
v
,
final
CompareMode
mode
)
{
protected
int
compareSecure
(
final
Value
v
,
final
CompareMode
mode
)
{
return
MathUtils
.
compareInt
(
getInt
(),
v
.
getInt
());
return
Integer
.
compare
(
getInt
(),
v
.
getInt
());
}
}
/**
/**
...
...
h2/src/main/org/h2/value/ValueEnumBase.java
浏览文件 @
a9930a5c
...
@@ -7,7 +7,6 @@ package org.h2.value;
...
@@ -7,7 +7,6 @@ package org.h2.value;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
org.h2.util.MathUtils
;
/**
/**
* Base implementation of the ENUM data type.
* Base implementation of the ENUM data type.
...
@@ -35,7 +34,7 @@ public class ValueEnumBase extends Value {
...
@@ -35,7 +34,7 @@ public class ValueEnumBase extends Value {
@Override
@Override
protected
int
compareSecure
(
final
Value
v
,
final
CompareMode
mode
)
{
protected
int
compareSecure
(
final
Value
v
,
final
CompareMode
mode
)
{
return
MathUtils
.
compareInt
(
getInt
(),
v
.
getInt
());
return
Integer
.
compare
(
getInt
(),
v
.
getInt
());
}
}
@Override
@Override
...
...
h2/src/main/org/h2/value/ValueInt.java
浏览文件 @
a9930a5c
...
@@ -10,7 +10,6 @@ import java.sql.SQLException;
...
@@ -10,7 +10,6 @@ import java.sql.SQLException;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.MathUtils
;
/**
/**
* Implementation of the INT data type.
* Implementation of the INT data type.
...
@@ -140,7 +139,7 @@ public class ValueInt extends Value {
...
@@ -140,7 +139,7 @@ public class ValueInt extends Value {
@Override
@Override
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
ValueInt
v
=
(
ValueInt
)
o
;
ValueInt
v
=
(
ValueInt
)
o
;
return
MathUtils
.
compareInt
(
value
,
v
.
value
);
return
Integer
.
compare
(
value
,
v
.
value
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/value/ValueShort.java
浏览文件 @
a9930a5c
...
@@ -10,7 +10,6 @@ import java.sql.SQLException;
...
@@ -10,7 +10,6 @@ import java.sql.SQLException;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.MathUtils
;
/**
/**
* Implementation of the SMALLINT data type.
* Implementation of the SMALLINT data type.
...
@@ -106,7 +105,7 @@ public class ValueShort extends Value {
...
@@ -106,7 +105,7 @@ public class ValueShort extends Value {
@Override
@Override
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
ValueShort
v
=
(
ValueShort
)
o
;
ValueShort
v
=
(
ValueShort
)
o
;
return
MathUtils
.
compareInt
(
value
,
v
.
value
);
return
Integer
.
compare
(
value
,
v
.
value
);
}
}
@Override
@Override
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论