Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
56fe701d
提交
56fe701d
authored
12 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
A persistent multi-version map: rename built-in data type classes
上级
0d1713bb
master
noel-pr1
plus33-master
pr/267
stumc-Issue#576
version-1.4.198
version-1.4.197
version-1.4.196
version-1.4.195
version-1.4.194
version-1.4.193
version-1.4.192
version-1.4.191
version-1.4.190
version-1.4.188
version-1.4.187
version-1.4.186
version-1.4.185
version-1.4.184
version-1.4.183
version-1.4.182
version-1.4.181
version-1.4.178
version-1.4.177
version-1.3
无相关合并请求
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
43 行增加
和
43 行删除
+43
-43
SpatialDataType.java
h2/src/main/org/h2/mvstore/rtree/SpatialDataType.java
+4
-4
ObjectDataType.java
h2/src/main/org/h2/mvstore/type/ObjectDataType.java
+24
-24
ObjectDataTypeFactory.java
h2/src/main/org/h2/mvstore/type/ObjectDataTypeFactory.java
+5
-5
StringDataType.java
h2/src/main/org/h2/mvstore/type/StringDataType.java
+2
-2
RowDataType.java
h2/src/test/org/h2/test/store/RowDataType.java
+4
-4
TestObjectDataType.java
h2/src/test/org/h2/test/store/TestObjectDataType.java
+4
-4
没有找到文件。
h2/src/main/org/h2/mvstore/rtree/SpatialType.java
→
h2/src/main/org/h2/mvstore/rtree/Spatial
Data
Type.java
浏览文件 @
56fe701d
...
...
@@ -16,11 +16,11 @@ import org.h2.mvstore.type.DataType;
* can have a minimum and a maximum value of type float. For each dimension, the
* maximum value is only stored when it is not the same as the minimum.
*/
public
class
SpatialType
implements
DataType
{
public
class
Spatial
Data
Type
implements
DataType
{
private
final
int
dimensions
;
public
SpatialType
(
int
dimensions
)
{
public
Spatial
Data
Type
(
int
dimensions
)
{
if
(
dimensions
<=
0
||
dimensions
>
255
)
{
throw
new
IllegalArgumentException
(
"Dimensions: "
+
dimensions
);
}
...
...
@@ -33,8 +33,8 @@ public class SpatialType implements DataType {
* @param s the string
* @return the value
*/
public
static
SpatialType
fromString
(
String
s
)
{
return
new
SpatialType
(
Integer
.
parseInt
(
s
.
substring
(
1
)));
public
static
Spatial
Data
Type
fromString
(
String
s
)
{
return
new
Spatial
Data
Type
(
Integer
.
parseInt
(
s
.
substring
(
1
)));
}
@Override
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/type/ObjectType.java
→
h2/src/main/org/h2/mvstore/type/Object
Data
Type.java
浏览文件 @
56fe701d
...
...
@@ -17,7 +17,7 @@ import org.h2.util.Utils;
* A data type implementation for the most common data types, including
* serializable objects.
*/
public
class
ObjectType
implements
DataType
{
public
class
Object
Data
Type
implements
DataType
{
// TODO maybe support InputStream, Reader
// TODO maybe support ResultSet, Date, Time, Timestamp
...
...
@@ -341,10 +341,10 @@ public class ObjectType implements DataType {
*/
abstract
class
AutoDetectDataType
implements
DataType
{
protected
final
ObjectType
base
;
protected
final
Object
Data
Type
base
;
protected
final
int
typeId
;
AutoDetectDataType
(
ObjectType
base
,
int
typeId
)
{
AutoDetectDataType
(
Object
Data
Type
base
,
int
typeId
)
{
this
.
base
=
base
;
this
.
typeId
=
typeId
;
}
...
...
@@ -411,7 +411,7 @@ public class ObjectType implements DataType {
*/
class
BooleanType
extends
AutoDetectDataType
{
BooleanType
(
ObjectType
base
)
{
BooleanType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_BOOLEAN
);
}
...
...
@@ -457,7 +457,7 @@ public class ObjectType implements DataType {
*/
class
ByteType
extends
AutoDetectDataType
{
ByteType
(
ObjectType
base
)
{
ByteType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_BYTE
);
}
...
...
@@ -502,7 +502,7 @@ public class ObjectType implements DataType {
*/
class
CharacterType
extends
AutoDetectDataType
{
CharacterType
(
ObjectType
base
)
{
CharacterType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_CHARACTER
);
}
...
...
@@ -548,7 +548,7 @@ public class ObjectType implements DataType {
*/
class
ShortType
extends
AutoDetectDataType
{
ShortType
(
ObjectType
base
)
{
ShortType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_SHORT
);
}
...
...
@@ -594,7 +594,7 @@ public class ObjectType implements DataType {
*/
class
IntegerType
extends
AutoDetectDataType
{
IntegerType
(
ObjectType
base
)
{
IntegerType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_INTEGER
);
}
...
...
@@ -667,7 +667,7 @@ public class ObjectType implements DataType {
*/
public
class
LongType
extends
AutoDetectDataType
{
LongType
(
ObjectType
base
)
{
LongType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_LONG
);
}
...
...
@@ -740,7 +740,7 @@ public class ObjectType implements DataType {
*/
class
FloatType
extends
AutoDetectDataType
{
FloatType
(
ObjectType
base
)
{
FloatType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_FLOAT
);
}
...
...
@@ -771,9 +771,9 @@ public class ObjectType implements DataType {
if
(
obj
instanceof
Float
)
{
float
x
=
(
Float
)
obj
;
int
f
=
Float
.
floatToIntBits
(
x
);
if
(
f
==
ObjectType
.
FLOAT_ZERO_BITS
)
{
if
(
f
==
Object
Data
Type
.
FLOAT_ZERO_BITS
)
{
buff
.
put
((
byte
)
TAG_FLOAT_0
);
}
else
if
(
f
==
ObjectType
.
FLOAT_ONE_BITS
)
{
}
else
if
(
f
==
Object
Data
Type
.
FLOAT_ONE_BITS
)
{
buff
.
put
((
byte
)
TAG_FLOAT_1
);
}
else
{
int
value
=
Integer
.
reverse
(
f
);
...
...
@@ -810,7 +810,7 @@ public class ObjectType implements DataType {
*/
class
DoubleType
extends
AutoDetectDataType
{
DoubleType
(
ObjectType
base
)
{
DoubleType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_DOUBLE
);
}
...
...
@@ -841,9 +841,9 @@ public class ObjectType implements DataType {
if
(
obj
instanceof
Double
)
{
double
x
=
(
Double
)
obj
;
long
d
=
Double
.
doubleToLongBits
(
x
);
if
(
d
==
ObjectType
.
DOUBLE_ZERO_BITS
)
{
if
(
d
==
Object
Data
Type
.
DOUBLE_ZERO_BITS
)
{
buff
.
put
((
byte
)
TAG_DOUBLE_0
);
}
else
if
(
d
==
ObjectType
.
DOUBLE_ONE_BITS
)
{
}
else
if
(
d
==
Object
Data
Type
.
DOUBLE_ONE_BITS
)
{
buff
.
put
((
byte
)
TAG_DOUBLE_1
);
}
else
{
long
value
=
Long
.
reverse
(
d
);
...
...
@@ -880,7 +880,7 @@ public class ObjectType implements DataType {
*/
class
BigIntegerType
extends
AutoDetectDataType
{
BigIntegerType
(
ObjectType
base
)
{
BigIntegerType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_BIG_INTEGER
);
}
...
...
@@ -964,7 +964,7 @@ public class ObjectType implements DataType {
*/
class
BigDecimalType
extends
AutoDetectDataType
{
BigDecimalType
(
ObjectType
base
)
{
BigDecimalType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_BIG_DECIMAL
);
}
...
...
@@ -1068,7 +1068,7 @@ public class ObjectType implements DataType {
*/
class
StringType
extends
AutoDetectDataType
{
StringType
(
ObjectType
base
)
{
StringType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_STRING
);
}
...
...
@@ -1131,7 +1131,7 @@ public class ObjectType implements DataType {
*/
class
UUIDType
extends
AutoDetectDataType
{
UUIDType
(
ObjectType
base
)
{
UUIDType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_UUID
);
}
...
...
@@ -1183,7 +1183,7 @@ public class ObjectType implements DataType {
*/
class
ByteArrayType
extends
AutoDetectDataType
{
ByteArrayType
(
ObjectType
base
)
{
ByteArrayType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_BYTE_ARRAY
);
}
...
...
@@ -1250,7 +1250,7 @@ public class ObjectType implements DataType {
*/
class
CharArrayType
extends
AutoDetectDataType
{
CharArrayType
(
ObjectType
base
)
{
CharArrayType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_CHAR_ARRAY
);
}
...
...
@@ -1310,7 +1310,7 @@ public class ObjectType implements DataType {
*/
class
IntArrayType
extends
AutoDetectDataType
{
IntArrayType
(
ObjectType
base
)
{
IntArrayType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_INT_ARRAY
);
}
...
...
@@ -1370,7 +1370,7 @@ public class ObjectType implements DataType {
*/
class
LongArrayType
extends
AutoDetectDataType
{
LongArrayType
(
ObjectType
base
)
{
LongArrayType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_LONG_ARRAY
);
}
...
...
@@ -1430,7 +1430,7 @@ public class ObjectType implements DataType {
*/
class
SerializedObjectType
extends
AutoDetectDataType
{
SerializedObjectType
(
ObjectType
base
)
{
SerializedObjectType
(
Object
Data
Type
base
)
{
super
(
base
,
TYPE_SERIALIZED_OBJECT
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/type/ObjectTypeFactory.java
→
h2/src/main/org/h2/mvstore/type/Object
Data
TypeFactory.java
浏览文件 @
56fe701d
...
...
@@ -5,12 +5,12 @@
*/
package
org
.
h2
.
mvstore
.
type
;
import
org.h2.mvstore.rtree.SpatialType
;
import
org.h2.mvstore.rtree.Spatial
Data
Type
;
/**
* A data type factory.
*/
public
class
ObjectTypeFactory
implements
DataTypeFactory
{
public
class
Object
Data
TypeFactory
implements
DataTypeFactory
{
@Override
public
void
setParent
(
DataTypeFactory
parent
)
{
...
...
@@ -20,16 +20,16 @@ public class ObjectTypeFactory implements DataTypeFactory {
@Override
public
DataType
buildDataType
(
String
s
)
{
if
(
"s"
.
equals
(
s
))
{
return
SpatialType
.
fromString
(
s
);
return
Spatial
Data
Type
.
fromString
(
s
);
}
else
if
(
"o"
.
equals
(
s
))
{
return
new
ObjectType
();
return
new
Object
Data
Type
();
}
return
null
;
}
@Override
public
String
getDataType
(
Class
<?>
objectClass
)
{
if
(
objectClass
==
SpatialType
.
class
)
{
if
(
objectClass
==
Spatial
Data
Type
.
class
)
{
return
"s"
;
}
return
"o"
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/type/StringType.java
→
h2/src/main/org/h2/mvstore/type/String
Data
Type.java
浏览文件 @
56fe701d
...
...
@@ -12,9 +12,9 @@ import org.h2.mvstore.DataUtils;
/**
* A string type.
*/
public
class
StringType
implements
DataType
{
public
class
String
Data
Type
implements
DataType
{
public
static
final
String
Type
INSTANCE
=
new
String
Type
();
public
static
final
String
DataType
INSTANCE
=
new
StringData
Type
();
public
int
compare
(
Object
a
,
Object
b
)
{
return
a
.
toString
().
compareTo
(
b
.
toString
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/store/RowType.java
→
h2/src/test/org/h2/test/store/Row
Data
Type.java
浏览文件 @
56fe701d
...
...
@@ -15,13 +15,13 @@ import org.h2.util.StringUtils;
/**
* A row type.
*/
public
class
RowType
implements
DataType
{
public
class
Row
Data
Type
implements
DataType
{
static
final
String
PREFIX
=
"org.h2.test.store.row"
;
private
final
DataType
[]
types
;
RowType
(
DataType
[]
types
)
{
Row
Data
Type
(
DataType
[]
types
)
{
this
.
types
=
types
;
}
...
...
@@ -107,7 +107,7 @@ public class RowType implements DataType {
* @param factory the data type factory
* @return the row type
*/
static
RowType
fromString
(
String
t
,
DataTypeFactory
factory
)
{
static
Row
Data
Type
fromString
(
String
t
,
DataTypeFactory
factory
)
{
if
(!
t
.
startsWith
(
PREFIX
)
||
!
t
.
endsWith
(
")"
))
{
throw
new
RuntimeException
(
"Unknown type: "
+
t
);
}
...
...
@@ -117,7 +117,7 @@ public class RowType implements DataType {
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
types
[
i
]
=
factory
.
buildDataType
(
array
[
i
]);
}
return
new
RowType
(
types
);
return
new
Row
Data
Type
(
types
);
}
}
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/store/TestObjectType.java
→
h2/src/test/org/h2/test/store/TestObject
Data
Type.java
浏览文件 @
56fe701d
...
...
@@ -13,13 +13,13 @@ import java.sql.Timestamp;
import
java.util.Arrays
;
import
java.util.Random
;
import
java.util.UUID
;
import
org.h2.mvstore.type.ObjectType
;
import
org.h2.mvstore.type.Object
Data
Type
;
import
org.h2.test.TestBase
;
/**
* Test the ObjectType class.
*/
public
class
TestObjectType
extends
TestBase
{
public
class
TestObject
Data
Type
extends
TestBase
{
/**
* Run just this test.
...
...
@@ -37,7 +37,7 @@ public class TestObjectType extends TestBase {
private
void
testCommonValues
()
{
BigInteger
largeBigInt
=
BigInteger
.
probablePrime
(
200
,
new
Random
(
1
));
Object
Type
ot
=
new
Object
Type
();
Object
DataType
ot
=
new
ObjectData
Type
();
assertEquals
(
"o"
,
ot
.
asString
());
Object
[]
array
=
{
false
,
true
,
...
...
@@ -104,7 +104,7 @@ public class TestObjectType extends TestBase {
}
private
void
test
(
Object
last
,
Object
x
)
{
Object
Type
ot
=
new
Object
Type
();
Object
DataType
ot
=
new
ObjectData
Type
();
// switch to the last type before every operation,
// to test switching types
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论