Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c1394475
提交
c1394475
authored
5月 21, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Require Java 1.5 compiler
上级
24c3b0e8
全部展开
显示空白字符变更
内嵌
并排
正在显示
37 个修改的文件
包含
299 行增加
和
343 行删除
+299
-343
BuildBase.java
h2/src/tools/org/h2/build/BuildBase.java
+6
-6
MergeDocs.java
h2/src/tools/org/h2/build/doc/MergeDocs.java
+3
-4
SpellChecker.java
h2/src/tools/org/h2/build/doc/SpellChecker.java
+19
-24
UploadBuild.java
h2/src/tools/org/h2/build/doc/UploadBuild.java
+2
-3
WebSite.java
h2/src/tools/org/h2/build/doc/WebSite.java
+7
-11
XMLChecker.java
h2/src/tools/org/h2/build/doc/XMLChecker.java
+17
-14
Doclet.java
h2/src/tools/org/h2/build/doclet/Doclet.java
+25
-33
ResourceDoclet.java
h2/src/tools/org/h2/build/doclet/ResourceDoclet.java
+7
-12
PrepareTranslation.java
h2/src/tools/org/h2/build/i18n/PrepareTranslation.java
+41
-55
PropertiesToUTF8.java
h2/src/tools/org/h2/build/i18n/PropertiesToUTF8.java
+2
-4
HtmlConverter.java
h2/src/tools/org/h2/build/indexer/HtmlConverter.java
+5
-7
Indexer.java
h2/src/tools/org/h2/build/indexer/Indexer.java
+27
-37
Word.java
h2/src/tools/org/h2/build/indexer/Word.java
+11
-15
FtpClient.java
h2/src/tools/org/h2/dev/ftp/FtpClient.java
+5
-9
FtpServer.java
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
+3
-5
SecureKeyStoreBuilder.java
h2/src/tools/org/h2/dev/security/SecureKeyStoreBuilder.java
+4
-6
FileViewer.java
h2/src/tools/org/h2/dev/util/FileViewer.java
+6
-6
Condition.java
h2/src/tools/org/h2/jaqu/Condition.java
+1
-1
ConditionAndOr.java
h2/src/tools/org/h2/jaqu/ConditionAndOr.java
+1
-1
Db.java
h2/src/tools/org/h2/jaqu/Db.java
+6
-5
Define.java
h2/src/tools/org/h2/jaqu/Define.java
+2
-2
Function.java
h2/src/tools/org/h2/jaqu/Function.java
+10
-7
OrderExpression.java
h2/src/tools/org/h2/jaqu/OrderExpression.java
+4
-4
Query.java
h2/src/tools/org/h2/jaqu/Query.java
+21
-15
QueryJoin.java
h2/src/tools/org/h2/jaqu/QueryJoin.java
+2
-2
QueryJoinCondition.java
h2/src/tools/org/h2/jaqu/QueryJoinCondition.java
+2
-2
QueryWhere.java
h2/src/tools/org/h2/jaqu/QueryWhere.java
+15
-15
SelectColumn.java
h2/src/tools/org/h2/jaqu/SelectColumn.java
+7
-7
SelectTable.java
h2/src/tools/org/h2/jaqu/SelectTable.java
+7
-6
SqlStatement.java
h2/src/tools/org/h2/jaqu/SqlStatement.java
+1
-1
TableDefinition.java
h2/src/tools/org/h2/jaqu/TableDefinition.java
+10
-11
TestCondition.java
h2/src/tools/org/h2/jaqu/TestCondition.java
+6
-6
Token.java
h2/src/tools/org/h2/jaqu/Token.java
+7
-1
ClassUtils.java
h2/src/tools/org/h2/jaqu/util/ClassUtils.java
+1
-2
Utils.java
h2/src/tools/org/h2/jaqu/util/Utils.java
+1
-1
WeakIdentityHashMap.java
h2/src/tools/org/h2/jaqu/util/WeakIdentityHashMap.java
+4
-2
FunctionsMySQL.java
h2/src/tools/org/h2/mode/FunctionsMySQL.java
+1
-1
没有找到文件。
h2/src/tools/org/h2/build/BuildBase.java
浏览文件 @
c1394475
...
@@ -46,7 +46,7 @@ public class BuildBase {
...
@@ -46,7 +46,7 @@ public class BuildBase {
/**
/**
* A list of strings.
* A list of strings.
*/
*/
public
static
class
StringList
extends
ArrayList
<
String
>
implements
List
<
String
>
{
public
static
class
StringList
extends
ArrayList
<
String
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -86,7 +86,7 @@ public class BuildBase {
...
@@ -86,7 +86,7 @@ public class BuildBase {
/**
/**
* A list of files.
* A list of files.
*/
*/
public
static
class
FileList
extends
ArrayList
<
File
>
implements
List
<
File
>
{
public
static
class
FileList
extends
ArrayList
<
File
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -276,12 +276,12 @@ public class BuildBase {
...
@@ -276,12 +276,12 @@ public class BuildBase {
protected
int
exec
(
String
command
,
StringList
args
)
{
protected
int
exec
(
String
command
,
StringList
args
)
{
try
{
try
{
print
(
command
);
print
(
command
);
for
(
String
a
:
args
)
{
print
(
" "
+
a
);
}
StringList
cmd
=
new
StringList
();
StringList
cmd
=
new
StringList
();
cmd
=
cmd
.
plus
(
command
);
cmd
=
cmd
.
plus
(
command
);
if
(
args
!=
null
)
{
if
(
args
!=
null
)
{
for
(
String
a
:
args
)
{
print
(
" "
+
a
);
}
cmd
.
addAll
(
args
);
cmd
.
addAll
(
args
);
}
}
println
(
""
);
println
(
""
);
...
@@ -324,7 +324,7 @@ public class BuildBase {
...
@@ -324,7 +324,7 @@ public class BuildBase {
*/
*/
protected
String
getStaticField
(
String
className
,
String
fieldName
)
{
protected
String
getStaticField
(
String
className
,
String
fieldName
)
{
try
{
try
{
Class
clazz
=
Class
.
forName
(
className
);
Class
<
?
>
clazz
=
Class
.
forName
(
className
);
Field
field
=
clazz
.
getField
(
fieldName
);
Field
field
=
clazz
.
getField
(
fieldName
);
return
field
.
get
(
null
).
toString
();
return
field
.
get
(
null
).
toString
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
h2/src/tools/org/h2/build/doc/MergeDocs.java
浏览文件 @
c1394475
...
@@ -38,11 +38,10 @@ public class MergeDocs {
...
@@ -38,11 +38,10 @@ public class MergeDocs {
"performance.html"
,
"advanced.html"
,
"grammar.html"
,
"functions.html"
,
"datatypes.html"
,
"build.html"
,
"performance.html"
,
"advanced.html"
,
"grammar.html"
,
"functions.html"
,
"datatypes.html"
,
"build.html"
,
"history.html"
,
"faq.html"
};
"history.html"
,
"faq.html"
};
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
pages
.
length
;
i
++)
{
for
(
String
fileName
:
pages
)
{
String
fileName
=
pages
[
i
];
String
text
=
getContent
(
fileName
);
String
text
=
getContent
(
fileName
);
for
(
int
j
=
0
;
j
<
pages
.
length
;
j
++
)
{
for
(
String
page
:
pages
)
{
text
=
StringUtils
.
replaceAll
(
text
,
page
s
[
j
]
+
"#"
,
"#"
);
text
=
StringUtils
.
replaceAll
(
text
,
page
+
"#"
,
"#"
);
}
}
text
=
removeHeaderFooter
(
fileName
,
text
);
text
=
removeHeaderFooter
(
fileName
,
text
);
buff
.
append
(
text
);
buff
.
append
(
text
);
...
...
h2/src/tools/org/h2/build/doc/SpellChecker.java
浏览文件 @
c1394475
...
@@ -11,7 +11,6 @@ import java.io.IOException;
...
@@ -11,7 +11,6 @@ import java.io.IOException;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.StringTokenizer
;
import
java.util.StringTokenizer
;
import
org.h2.build.BuildBase
;
import
org.h2.build.BuildBase
;
...
@@ -32,9 +31,9 @@ public class SpellChecker {
...
@@ -32,9 +31,9 @@ public class SpellChecker {
private
static
final
String
PREFIX_IGNORE
=
"abc"
;
private
static
final
String
PREFIX_IGNORE
=
"abc"
;
private
static
final
String
IGNORE_FILE
=
"mainWeb.html"
;
private
static
final
String
IGNORE_FILE
=
"mainWeb.html"
;
private
HashSet
dictionary
=
new
HashSet
();
private
HashSet
<
String
>
dictionary
=
new
HashSet
<
String
>
();
private
HashSet
used
=
new
HashSet
();
private
HashSet
<
String
>
used
=
new
HashSet
<
String
>
();
private
HashMap
unknown
=
new
HashMap
();
private
HashMap
<
String
,
Integer
>
unknown
=
new
HashMap
<
String
,
Integer
>
();
private
boolean
debug
;
private
boolean
debug
;
private
boolean
printDictionary
;
private
boolean
printDictionary
;
private
boolean
addToDictionary
;
private
boolean
addToDictionary
;
...
@@ -61,8 +60,7 @@ public class SpellChecker {
...
@@ -61,8 +60,7 @@ public class SpellChecker {
used
.
toArray
(
list
);
used
.
toArray
(
list
);
Arrays
.
sort
(
list
);
Arrays
.
sort
(
list
);
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
for
(
String
s
:
list
)
{
String
s
=
list
[
i
];
if
(
buff
.
length
()
>
0
)
{
if
(
buff
.
length
()
>
0
)
{
if
(
buff
.
length
()
+
s
.
length
()
>
80
)
{
if
(
buff
.
length
()
+
s
.
length
()
>
80
)
{
System
.
out
.
println
(
buff
.
toString
());
System
.
out
.
println
(
buff
.
toString
());
...
@@ -78,9 +76,8 @@ public class SpellChecker {
...
@@ -78,9 +76,8 @@ public class SpellChecker {
if
(
unknown
.
size
()
>
0
)
{
if
(
unknown
.
size
()
>
0
)
{
System
.
out
.
println
();
System
.
out
.
println
();
System
.
out
.
println
(
"UNKNOWN WORDS"
);
System
.
out
.
println
(
"UNKNOWN WORDS"
);
for
(
Iterator
it
=
unknown
.
keySet
().
iterator
();
it
.
hasNext
();)
{
for
(
String
s
:
unknown
.
keySet
())
{
String
s
=
(
String
)
it
.
next
();
// int count = unknown.get(s);
// int count = ((Integer) unknown.get(s)).intValue();
System
.
out
.
print
(
s
+
" "
);
System
.
out
.
print
(
s
+
" "
);
errorCount
++;
errorCount
++;
}
}
...
@@ -101,9 +98,8 @@ public class SpellChecker {
...
@@ -101,9 +98,8 @@ public class SpellChecker {
return
;
return
;
}
}
if
(
file
.
isDirectory
())
{
if
(
file
.
isDirectory
())
{
File
[]
list
=
file
.
listFiles
();
for
(
File
f
:
file
.
listFiles
())
{
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
process
(
f
);
process
(
list
[
i
]);
}
}
}
else
{
}
else
{
String
fileName
=
file
.
getAbsolutePath
();
String
fileName
=
file
.
getAbsolutePath
();
...
@@ -115,8 +111,8 @@ public class SpellChecker {
...
@@ -115,8 +111,8 @@ public class SpellChecker {
suffix
=
fileName
.
substring
(
idx
+
1
);
suffix
=
fileName
.
substring
(
idx
+
1
);
}
}
boolean
ignore
=
false
;
boolean
ignore
=
false
;
for
(
int
i
=
0
;
i
<
IGNORE
.
length
;
i
++
)
{
for
(
String
s
:
IGNORE
)
{
if
(
IGNORE
[
i
]
.
equals
(
suffix
))
{
if
(
s
.
equals
(
suffix
))
{
ignore
=
true
;
ignore
=
true
;
break
;
break
;
}
}
...
@@ -128,8 +124,8 @@ public class SpellChecker {
...
@@ -128,8 +124,8 @@ public class SpellChecker {
return
;
return
;
}
}
boolean
ok
=
false
;
boolean
ok
=
false
;
for
(
int
i
=
0
;
i
<
SUFFIX
.
length
;
i
++
)
{
for
(
String
s
:
SUFFIX
)
{
if
(
SUFFIX
[
i
]
.
equals
(
suffix
))
{
if
(
s
.
equals
(
suffix
))
{
ok
=
true
;
ok
=
true
;
break
;
break
;
}
}
...
@@ -148,7 +144,7 @@ public class SpellChecker {
...
@@ -148,7 +144,7 @@ public class SpellChecker {
}
}
private
void
scan
(
String
fileName
,
String
text
)
{
private
void
scan
(
String
fileName
,
String
text
)
{
HashSet
notFound
=
new
HashSet
();
HashSet
<
String
>
notFound
=
new
HashSet
<
String
>
();
text
=
removeLinks
(
fileName
,
text
);
text
=
removeLinks
(
fileName
,
text
);
StringTokenizer
tokenizer
=
new
StringTokenizer
(
text
,
DELIMITERS
);
StringTokenizer
tokenizer
=
new
StringTokenizer
(
text
,
DELIMITERS
);
while
(
tokenizer
.
hasMoreTokens
())
{
while
(
tokenizer
.
hasMoreTokens
())
{
...
@@ -170,8 +166,7 @@ public class SpellChecker {
...
@@ -170,8 +166,7 @@ public class SpellChecker {
}
}
if
(
notFound
.
size
()
>
0
)
{
if
(
notFound
.
size
()
>
0
)
{
System
.
out
.
println
(
"file: "
+
fileName
);
System
.
out
.
println
(
"file: "
+
fileName
);
for
(
Iterator
it
=
notFound
.
iterator
();
it
.
hasNext
();)
{
for
(
String
s
:
notFound
)
{
String
s
=
(
String
)
it
.
next
();
System
.
out
.
print
(
s
+
" "
);
System
.
out
.
print
(
s
+
" "
);
}
}
System
.
out
.
println
();
System
.
out
.
println
();
...
@@ -208,7 +203,7 @@ public class SpellChecker {
...
@@ -208,7 +203,7 @@ public class SpellChecker {
return
changed
;
return
changed
;
}
}
private
void
scanCombinedToken
(
HashSet
notFound
,
String
token
)
{
private
void
scanCombinedToken
(
HashSet
<
String
>
notFound
,
String
token
)
{
for
(
int
i
=
1
;
i
<
token
.
length
();
i
++)
{
for
(
int
i
=
1
;
i
<
token
.
length
();
i
++)
{
char
charLeft
=
token
.
charAt
(
i
-
1
);
char
charLeft
=
token
.
charAt
(
i
-
1
);
char
charRight
=
token
.
charAt
(
i
);
char
charRight
=
token
.
charAt
(
i
);
...
@@ -225,7 +220,7 @@ public class SpellChecker {
...
@@ -225,7 +220,7 @@ public class SpellChecker {
scanToken
(
notFound
,
token
);
scanToken
(
notFound
,
token
);
}
}
private
void
scanToken
(
HashSet
notFound
,
String
token
)
{
private
void
scanToken
(
HashSet
<
String
>
notFound
,
String
token
)
{
if
(
token
.
length
()
<
3
)
{
if
(
token
.
length
()
<
3
)
{
return
;
return
;
}
}
...
@@ -267,9 +262,9 @@ public class SpellChecker {
...
@@ -267,9 +262,9 @@ public class SpellChecker {
}
}
}
}
private
void
increment
(
HashMap
map
,
String
key
)
{
private
void
increment
(
HashMap
<
String
,
Integer
>
map
,
String
key
)
{
Integer
value
=
(
Integer
)
map
.
get
(
key
);
Integer
value
=
map
.
get
(
key
);
value
=
new
Integer
(
value
==
null
?
0
:
value
.
intValue
()
+
1
);
value
=
new
Integer
(
value
==
null
?
0
:
value
+
1
);
map
.
put
(
key
,
value
);
map
.
put
(
key
,
value
);
contextCount
=
10
;
contextCount
=
10
;
}
}
...
...
h2/src/tools/org/h2/build/doc/UploadBuild.java
浏览文件 @
c1394475
...
@@ -139,9 +139,8 @@ public class UploadBuild {
...
@@ -139,9 +139,8 @@ public class UploadBuild {
private
static
void
addFiles
(
File
base
,
File
file
,
ZipOutputStream
out
)
throws
IOException
{
private
static
void
addFiles
(
File
base
,
File
file
,
ZipOutputStream
out
)
throws
IOException
{
if
(
file
.
isDirectory
())
{
if
(
file
.
isDirectory
())
{
File
[]
files
=
file
.
listFiles
();
for
(
File
f
:
file
.
listFiles
())
{
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
addFiles
(
base
,
f
,
out
);
addFiles
(
base
,
files
[
i
],
out
);
}
}
}
else
{
}
else
{
String
path
=
file
.
getAbsolutePath
().
substring
(
base
.
getAbsolutePath
().
length
());
String
path
=
file
.
getAbsolutePath
().
substring
(
base
.
getAbsolutePath
().
length
());
...
...
h2/src/tools/org/h2/build/doc/WebSite.java
浏览文件 @
c1394475
...
@@ -31,7 +31,7 @@ public class WebSite {
...
@@ -31,7 +31,7 @@ public class WebSite {
private
String
sourceDir
=
"docs"
;
private
String
sourceDir
=
"docs"
;
private
String
webDir
=
"../h2web"
;
private
String
webDir
=
"../h2web"
;
private
HashMap
fragments
=
new
HashMap
();
private
HashMap
<
String
,
String
>
fragments
=
new
HashMap
<
String
,
String
>
();
/**
/**
* This method is called when executing this application from the command
* This method is called when executing this application from the command
...
@@ -56,9 +56,7 @@ public class WebSite {
...
@@ -56,9 +56,7 @@ public class WebSite {
private
void
loadFragments
()
throws
IOException
{
private
void
loadFragments
()
throws
IOException
{
File
dir
=
new
File
(
sourceDir
,
"html"
);
File
dir
=
new
File
(
sourceDir
,
"html"
);
File
[]
list
=
dir
.
listFiles
();
for
(
File
f
:
dir
.
listFiles
())
{
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
File
f
=
list
[
i
];
if
(
f
.
getName
().
startsWith
(
"fragments"
))
{
if
(
f
.
getName
().
startsWith
(
"fragments"
))
{
FileInputStream
in
=
new
FileInputStream
(
f
);
FileInputStream
in
=
new
FileInputStream
(
f
);
byte
[]
bytes
=
IOUtils
.
readBytesAndClose
(
in
,
0
);
byte
[]
bytes
=
IOUtils
.
readBytesAndClose
(
in
,
0
);
...
@@ -78,7 +76,7 @@ public class WebSite {
...
@@ -78,7 +76,7 @@ public class WebSite {
int
end
=
fileName
.
indexOf
(
'.'
);
int
end
=
fileName
.
indexOf
(
'.'
);
language
=
fileName
.
substring
(
index
,
end
);
language
=
fileName
.
substring
(
index
,
end
);
}
}
String
fragment
=
(
String
)
fragments
.
get
(
"fragments"
+
language
+
".html"
);
String
fragment
=
fragments
.
get
(
"fragments"
+
language
+
".html"
);
int
start
=
0
;
int
start
=
0
;
while
(
true
)
{
while
(
true
)
{
start
=
fragment
.
indexOf
(
"<!-- ["
,
start
);
start
=
fragment
.
indexOf
(
"<!-- ["
,
start
);
...
@@ -106,9 +104,8 @@ public class WebSite {
...
@@ -106,9 +104,8 @@ public class WebSite {
private
void
deleteRecursive
(
File
dir
)
{
private
void
deleteRecursive
(
File
dir
)
{
if
(
dir
.
isDirectory
())
{
if
(
dir
.
isDirectory
())
{
File
[]
list
=
dir
.
listFiles
();
for
(
File
f
:
dir
.
listFiles
())
{
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
deleteRecursive
(
f
);
deleteRecursive
(
list
[
i
]);
}
}
}
}
dir
.
delete
();
dir
.
delete
();
...
@@ -117,9 +114,8 @@ public class WebSite {
...
@@ -117,9 +114,8 @@ public class WebSite {
private
void
copy
(
File
source
,
File
target
,
boolean
replaceFragments
,
boolean
web
)
throws
IOException
{
private
void
copy
(
File
source
,
File
target
,
boolean
replaceFragments
,
boolean
web
)
throws
IOException
{
if
(
source
.
isDirectory
())
{
if
(
source
.
isDirectory
())
{
target
.
mkdirs
();
target
.
mkdirs
();
File
[]
list
=
source
.
listFiles
();
for
(
File
f
:
source
.
listFiles
())
{
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
copy
(
f
,
new
File
(
target
,
f
.
getName
()),
replaceFragments
,
web
);
copy
(
list
[
i
],
new
File
(
target
,
list
[
i
].
getName
()),
replaceFragments
,
web
);
}
}
}
else
{
}
else
{
String
name
=
source
.
getName
();
String
name
=
source
.
getName
();
...
...
h2/src/tools/org/h2/build/doc/XMLChecker.java
浏览文件 @
c1394475
...
@@ -45,9 +45,8 @@ public class XMLChecker {
...
@@ -45,9 +45,8 @@ public class XMLChecker {
}
}
File
file
=
new
File
(
path
);
File
file
=
new
File
(
path
);
if
(
file
.
isDirectory
())
{
if
(
file
.
isDirectory
())
{
String
[]
list
=
file
.
list
();
for
(
String
name
:
file
.
list
())
{
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
process
(
path
+
"/"
+
name
);
process
(
path
+
"/"
+
list
[
i
]);
}
}
}
else
{
}
else
{
processFile
(
path
);
processFile
(
path
);
...
@@ -84,7 +83,7 @@ public class XMLChecker {
...
@@ -84,7 +83,7 @@ public class XMLChecker {
// use this for html file, for example if <li> is not closed
// use this for html file, for example if <li> is not closed
String
[]
noClose
=
new
String
[]
{};
String
[]
noClose
=
new
String
[]
{};
XMLParser
parser
=
new
XMLParser
(
xml
);
XMLParser
parser
=
new
XMLParser
(
xml
);
Stack
stack
=
new
Stack
();
Stack
<
Object
[]>
stack
=
new
Stack
<
Object
[]>
();
boolean
rootElement
=
false
;
boolean
rootElement
=
false
;
while
(
true
)
{
while
(
true
)
{
int
event
=
parser
.
next
();
int
event
=
parser
.
next
();
...
@@ -98,29 +97,33 @@ public class XMLChecker {
...
@@ -98,29 +97,33 @@ public class XMLChecker {
rootElement
=
true
;
rootElement
=
true
;
}
}
String
name
=
parser
.
getName
();
String
name
=
parser
.
getName
();
for
(
int
i
=
0
;
html
&&
i
<
noClose
.
length
;
i
++)
{
if
(
html
)
{
if
(
name
.
equals
(
noClose
[
i
]))
{
for
(
String
n
:
noClose
)
{
if
(
name
.
equals
(
n
))
{
name
=
null
;
name
=
null
;
break
;
break
;
}
}
}
}
}
if
(
name
!=
null
)
{
if
(
name
!=
null
)
{
stack
.
add
(
new
Object
[]
{
name
,
new
Integer
(
parser
.
getPos
()
)
});
stack
.
add
(
new
Object
[]
{
name
,
parser
.
getPos
(
)
});
}
}
}
else
if
(
event
==
XMLParser
.
END_ELEMENT
)
{
}
else
if
(
event
==
XMLParser
.
END_ELEMENT
)
{
String
name
=
parser
.
getName
();
String
name
=
parser
.
getName
();
for
(
int
i
=
0
;
html
&&
i
<
noClose
.
length
;
i
++)
{
if
(
html
)
{
if
(
name
.
equals
(
noClose
[
i
]))
{
for
(
String
n
:
noClose
)
{
if
(
name
.
equals
(
n
))
{
throw
new
Exception
(
"Unnecessary closing element "
+
name
+
" at "
+
parser
.
getRemaining
());
throw
new
Exception
(
"Unnecessary closing element "
+
name
+
" at "
+
parser
.
getRemaining
());
}
}
}
}
}
while
(
true
)
{
while
(
true
)
{
Object
[]
pop
=
(
Object
[])
stack
.
pop
();
Object
[]
pop
=
stack
.
pop
();
String
p
=
(
String
)
pop
[
0
];
String
p
=
(
String
)
pop
[
0
];
if
(
p
.
equals
(
name
))
{
if
(
p
.
equals
(
name
))
{
break
;
break
;
}
}
String
remaining
=
xml
.
substring
((
(
Integer
)
pop
[
1
]).
intValue
()
);
String
remaining
=
xml
.
substring
((
Integer
)
pop
[
1
]
);
if
(
remaining
.
length
()
>
100
)
{
if
(
remaining
.
length
()
>
100
)
{
remaining
=
remaining
.
substring
(
0
,
100
);
remaining
=
remaining
.
substring
(
0
,
100
);
}
}
...
...
h2/src/tools/org/h2/build/doclet/Doclet.java
浏览文件 @
c1394475
...
@@ -35,7 +35,7 @@ public class Doclet {
...
@@ -35,7 +35,7 @@ public class Doclet {
private
static
final
boolean
INTERFACES_ONLY
=
Boolean
.
getBoolean
(
"h2.interfacesOnly"
);
private
static
final
boolean
INTERFACES_ONLY
=
Boolean
.
getBoolean
(
"h2.interfacesOnly"
);
private
String
destDir
=
System
.
getProperty
(
"h2.destDir"
,
"docs/javadoc"
);
private
String
destDir
=
System
.
getProperty
(
"h2.destDir"
,
"docs/javadoc"
);
private
int
errorCount
;
private
int
errorCount
;
private
HashSet
errors
=
new
HashSet
();
private
HashSet
<
String
>
errors
=
new
HashSet
<
String
>
();
/**
/**
* This method is called by the javadoc framework and is required for all
* This method is called by the javadoc framework and is required for all
...
@@ -51,13 +51,12 @@ public class Doclet {
...
@@ -51,13 +51,12 @@ public class Doclet {
private
boolean
startDoc
(
RootDoc
root
)
throws
IOException
{
private
boolean
startDoc
(
RootDoc
root
)
throws
IOException
{
ClassDoc
[]
classes
=
root
.
classes
();
ClassDoc
[]
classes
=
root
.
classes
();
String
[][]
options
=
root
.
options
();
String
[][]
options
=
root
.
options
();
for
(
int
i
=
0
;
i
<
options
.
length
;
i
++
)
{
for
(
String
[]
op
:
options
)
{
if
(
op
tions
[
i
]
[
0
].
equals
(
"destdir"
))
{
if
(
op
[
0
].
equals
(
"destdir"
))
{
destDir
=
op
tions
[
i
]
[
1
];
destDir
=
op
[
1
];
}
}
}
}
for
(
int
i
=
0
;
i
<
classes
.
length
;
++
i
)
{
for
(
ClassDoc
clazz
:
classes
)
{
ClassDoc
clazz
=
classes
[
i
];
processClass
(
clazz
);
processClass
(
clazz
);
}
}
if
(
errorCount
>
0
)
{
if
(
errorCount
>
0
)
{
...
@@ -98,12 +97,12 @@ public class Doclet {
...
@@ -98,12 +97,12 @@ public class Doclet {
// methods
// methods
MethodDoc
[]
methods
=
clazz
.
methods
();
MethodDoc
[]
methods
=
clazz
.
methods
();
Arrays
.
sort
(
methods
,
new
Comparator
()
{
Arrays
.
sort
(
methods
,
new
Comparator
<
MethodDoc
>
()
{
public
int
compare
(
Object
a
,
Object
b
)
{
public
int
compare
(
MethodDoc
a
,
MethodDoc
b
)
{
return
((
MethodDoc
)
a
).
name
().
compareTo
(((
MethodDoc
)
b
)
.
name
());
return
a
.
name
().
compareTo
(
b
.
name
());
}
}
});
});
ArrayList
signatures
=
new
ArrayList
();
ArrayList
<
String
>
signatures
=
new
ArrayList
<
String
>
();
boolean
hasMethods
=
false
;
boolean
hasMethods
=
false
;
int
id
=
0
;
int
id
=
0
;
for
(
int
i
=
0
;
i
<
methods
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
methods
.
length
;
i
++)
{
...
@@ -166,14 +165,13 @@ public class Doclet {
...
@@ -166,14 +165,13 @@ public class Doclet {
if
(
clazz
.
interfaces
().
length
>
0
)
{
if
(
clazz
.
interfaces
().
length
>
0
)
{
fields
=
clazz
.
interfaces
()[
0
].
fields
();
fields
=
clazz
.
interfaces
()[
0
].
fields
();
}
}
Arrays
.
sort
(
fields
,
new
Comparator
()
{
Arrays
.
sort
(
fields
,
new
Comparator
<
FieldDoc
>
()
{
public
int
compare
(
Object
a
,
Object
b
)
{
public
int
compare
(
FieldDoc
a
,
FieldDoc
b
)
{
return
((
FieldDoc
)
a
).
name
().
compareTo
(((
FieldDoc
)
b
)
.
name
());
return
a
.
name
().
compareTo
(
b
.
name
());
}
}
});
});
int
fieldId
=
0
;
int
fieldId
=
0
;
for
(
int
i
=
0
;
i
<
fields
.
length
;
i
++)
{
for
(
FieldDoc
field
:
fields
)
{
FieldDoc
field
=
fields
[
i
];
if
(
skipField
(
clazz
,
field
))
{
if
(
skipField
(
clazz
,
field
))
{
continue
;
continue
;
}
}
...
@@ -208,20 +206,17 @@ public class Doclet {
...
@@ -208,20 +206,17 @@ public class Doclet {
}
}
// field details
// field details
Arrays
.
sort
(
fields
,
new
Comparator
()
{
Arrays
.
sort
(
fields
,
new
Comparator
<
FieldDoc
>()
{
public
int
compare
(
Object
a
,
Object
b
)
{
public
int
compare
(
FieldDoc
a
,
FieldDoc
b
)
{
FieldDoc
fa
=
(
FieldDoc
)
a
;
String
ca
=
a
.
constantValueExpression
();
FieldDoc
fb
=
(
FieldDoc
)
b
;
String
cb
=
b
.
constantValueExpression
();
String
ca
=
fa
.
constantValueExpression
();
String
cb
=
fb
.
constantValueExpression
();
if
(
ca
!=
null
&&
cb
!=
null
)
{
if
(
ca
!=
null
&&
cb
!=
null
)
{
return
ca
.
compareTo
(
cb
);
return
ca
.
compareTo
(
cb
);
}
}
return
fa
.
name
().
compareTo
(
f
b
.
name
());
return
a
.
name
().
compareTo
(
b
.
name
());
}
}
});
});
for
(
int
i
=
0
;
i
<
fields
.
length
;
i
++)
{
for
(
FieldDoc
field
:
fields
)
{
FieldDoc
field
=
fields
[
i
];
writeFieldDetails
(
writer
,
clazz
,
field
);
writeFieldDetails
(
writer
,
clazz
,
field
);
}
}
...
@@ -329,9 +324,9 @@ public class Doclet {
...
@@ -329,9 +324,9 @@ public class Doclet {
}
}
if
(
hasThrowsTag
)
{
if
(
hasThrowsTag
)
{
writer
.
println
(
"<div class=\"itemTitle\">Throws:</div>"
);
writer
.
println
(
"<div class=\"itemTitle\">Throws:</div>"
);
for
(
int
j
=
0
;
j
<
throwsTags
.
length
;
j
++
)
{
for
(
ThrowsTag
tag
:
throwsTags
)
{
String
p
=
t
hrowsTags
[
j
]
.
exceptionName
();
String
p
=
t
ag
.
exceptionName
();
String
c
=
t
hrowsTags
[
j
]
.
exceptionComment
();
String
c
=
t
ag
.
exceptionComment
();
if
(
c
.
length
()
>
0
)
{
if
(
c
.
length
()
>
0
)
{
p
+=
" - "
+
c
;
p
+=
" - "
+
c
;
}
}
...
@@ -420,17 +415,14 @@ public class Doclet {
...
@@ -420,17 +415,14 @@ public class Doclet {
private
boolean
foundMethod
(
ClassDoc
clazz
,
boolean
include
,
String
methodName
,
int
parameterCount
)
{
private
boolean
foundMethod
(
ClassDoc
clazz
,
boolean
include
,
String
methodName
,
int
parameterCount
)
{
if
(
include
)
{
if
(
include
)
{
MethodDoc
[]
ms
=
clazz
.
methods
();
for
(
MethodDoc
m
:
clazz
.
methods
())
{
for
(
int
j
=
0
;
j
<
ms
.
length
;
j
++)
{
MethodDoc
m
=
ms
[
j
];
if
(
m
.
name
().
equals
(
methodName
)
&&
m
.
parameters
().
length
==
parameterCount
)
{
if
(
m
.
name
().
equals
(
methodName
)
&&
m
.
parameters
().
length
==
parameterCount
)
{
return
true
;
return
true
;
}
}
}
}
}
}
ClassDoc
[]
ifs
=
clazz
.
interfaces
();
for
(
ClassDoc
doc
:
clazz
.
interfaces
())
{
for
(
int
i
=
0
;
i
<
ifs
.
length
;
i
++)
{
if
(
foundMethod
(
doc
,
true
,
methodName
,
parameterCount
))
{
if
(
foundMethod
(
ifs
[
i
],
true
,
methodName
,
parameterCount
))
{
return
true
;
return
true
;
}
}
}
}
...
...
h2/src/tools/org/h2/build/doclet/ResourceDoclet.java
浏览文件 @
c1394475
...
@@ -41,27 +41,24 @@ public class ResourceDoclet {
...
@@ -41,27 +41,24 @@ public class ResourceDoclet {
private
boolean
startDoc
(
RootDoc
root
)
throws
IOException
{
private
boolean
startDoc
(
RootDoc
root
)
throws
IOException
{
ClassDoc
[]
classes
=
root
.
classes
();
ClassDoc
[]
classes
=
root
.
classes
();
String
[][]
options
=
root
.
options
();
String
[][]
options
=
root
.
options
();
for
(
int
i
=
0
;
i
<
options
.
length
;
i
++
)
{
for
(
String
[]
op
:
options
)
{
if
(
op
tions
[
i
]
[
0
].
equals
(
"dest"
))
{
if
(
op
[
0
].
equals
(
"dest"
))
{
destFile
=
op
tions
[
i
]
[
1
];
destFile
=
op
[
1
];
}
}
}
}
for
(
int
i
=
0
;
i
<
classes
.
length
;
++
i
)
{
for
(
ClassDoc
clazz
:
classes
)
{
ClassDoc
clazz
=
classes
[
i
];
processClass
(
clazz
);
processClass
(
clazz
);
}
}
resources
.
store
(
destFile
);
resources
.
store
(
destFile
);
return
true
;
return
true
;
}
}
private
void
processClass
(
ClassDoc
clazz
)
throws
IOException
{
private
void
processClass
(
ClassDoc
clazz
)
{
String
packageName
=
clazz
.
containingPackage
().
name
();
String
packageName
=
clazz
.
containingPackage
().
name
();
String
className
=
clazz
.
name
();
String
className
=
clazz
.
name
();
addResource
(
packageName
+
"."
+
className
,
clazz
);
addResource
(
packageName
+
"."
+
className
,
clazz
);
MethodDoc
[]
methods
=
clazz
.
methods
();
for
(
MethodDoc
method
:
clazz
.
methods
())
{
for
(
int
i
=
0
;
i
<
methods
.
length
;
i
++)
{
MethodDoc
method
=
methods
[
i
];
String
name
=
method
.
name
();
String
name
=
method
.
name
();
addResource
(
packageName
+
"."
+
className
+
"."
+
name
,
method
);
addResource
(
packageName
+
"."
+
className
+
"."
+
name
,
method
);
}
}
...
@@ -124,9 +121,7 @@ public class ResourceDoclet {
...
@@ -124,9 +121,7 @@ public class ResourceDoclet {
}
}
private
static
boolean
isResource
(
Doc
doc
)
{
private
static
boolean
isResource
(
Doc
doc
)
{
Tag
[]
tags
=
doc
.
tags
();
for
(
Tag
t
:
doc
.
tags
())
{
for
(
int
j
=
0
;
j
<
tags
.
length
;
j
++)
{
Tag
t
=
tags
[
j
];
if
(
t
.
kind
().
equals
(
"@h2.resource"
))
{
if
(
t
.
kind
().
equals
(
"@h2.resource"
))
{
return
true
;
return
true
;
}
}
...
...
h2/src/tools/org/h2/build/i18n/PrepareTranslation.java
浏览文件 @
c1394475
差异被折叠。
点击展开。
h2/src/tools/org/h2/build/i18n/PropertiesToUTF8.java
浏览文件 @
c1394475
...
@@ -57,7 +57,7 @@ public class PropertiesToUTF8 {
...
@@ -57,7 +57,7 @@ public class PropertiesToUTF8 {
FileOutputStream
out
=
new
FileOutputStream
(
target
);
FileOutputStream
out
=
new
FileOutputStream
(
target
);
PrintWriter
writer
=
new
PrintWriter
(
new
OutputStreamWriter
(
out
,
"UTF-8"
));
PrintWriter
writer
=
new
PrintWriter
(
new
OutputStreamWriter
(
out
,
"UTF-8"
));
// keys is sorted
// keys is sorted
for
(
Enumeration
en
=
prop
.
keys
();
en
.
hasMoreElements
();)
{
for
(
Enumeration
<
Object
>
en
=
prop
.
keys
();
en
.
hasMoreElements
();)
{
String
key
=
(
String
)
en
.
nextElement
();
String
key
=
(
String
)
en
.
nextElement
();
String
value
=
prop
.
getProperty
(
key
,
null
);
String
value
=
prop
.
getProperty
(
key
,
null
);
writer
.
println
(
"@"
+
key
);
writer
.
println
(
"@"
+
key
);
...
@@ -117,9 +117,7 @@ public class PropertiesToUTF8 {
...
@@ -117,9 +117,7 @@ public class PropertiesToUTF8 {
}
}
private
static
void
convert
(
String
source
)
throws
Exception
{
private
static
void
convert
(
String
source
)
throws
Exception
{
File
[]
list
=
new
File
(
source
).
listFiles
();
for
(
File
f
:
new
File
(
source
).
listFiles
())
{
for
(
int
i
=
0
;
list
!=
null
&&
i
<
list
.
length
;
i
++)
{
File
f
=
list
[
i
];
if
(!
f
.
getName
().
endsWith
(
".properties"
))
{
if
(!
f
.
getName
().
endsWith
(
".properties"
))
{
continue
;
continue
;
}
}
...
...
h2/src/tools/org/h2/build/indexer/HtmlConverter.java
浏览文件 @
c1394475
...
@@ -14,8 +14,8 @@ import java.util.HashMap;
...
@@ -14,8 +14,8 @@ import java.util.HashMap;
*/
*/
public
class
HtmlConverter
{
public
class
HtmlConverter
{
private
static
HashMap
charMap
=
new
HashMap
();
private
static
HashMap
<
String
,
Character
>
charMap
=
new
HashMap
<
String
,
Character
>
();
private
static
HashMap
codeMap
=
new
HashMap
();
private
static
HashMap
<
Character
,
String
>
codeMap
=
new
HashMap
<
Character
,
String
>
();
private
static
final
String
[]
CHARS
=
{
"quot:34"
,
"amp:38"
,
"lt:60"
,
"gt:62"
,
"nbsp:160"
,
"iexcl:161"
,
"cent:162"
,
private
static
final
String
[]
CHARS
=
{
"quot:34"
,
"amp:38"
,
"lt:60"
,
"gt:62"
,
"nbsp:160"
,
"iexcl:161"
,
"cent:162"
,
"pound:163"
,
"curren:164"
,
"yen:165"
,
"brvbar:166"
,
"sect:167"
,
"uml:168"
,
"copy:169"
,
"ordf:170"
,
"pound:163"
,
"curren:164"
,
"yen:165"
,
"brvbar:166"
,
"sect:167"
,
"uml:168"
,
"copy:169"
,
"ordf:170"
,
...
@@ -55,8 +55,7 @@ public class HtmlConverter {
...
@@ -55,8 +55,7 @@ public class HtmlConverter {
}
}
static
{
static
{
for
(
int
i
=
0
;
i
<
CHARS
.
length
;
i
++)
{
for
(
String
token
:
CHARS
)
{
String
token
=
CHARS
[
i
];
int
idx
=
token
.
indexOf
(
':'
);
int
idx
=
token
.
indexOf
(
':'
);
String
key
=
token
.
substring
(
0
,
idx
);
String
key
=
token
.
substring
(
0
,
idx
);
int
ch
=
Integer
.
parseInt
(
token
.
substring
(
idx
+
1
));
int
ch
=
Integer
.
parseInt
(
token
.
substring
(
idx
+
1
));
...
@@ -82,8 +81,7 @@ public class HtmlConverter {
...
@@ -82,8 +81,7 @@ public class HtmlConverter {
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
ch
=
s
.
charAt
(
i
);
char
ch
=
s
.
charAt
(
i
);
Character
c
=
new
Character
(
ch
);
String
token
=
codeMap
.
get
(
ch
);
String
token
=
(
String
)
codeMap
.
get
(
c
);
if
(
token
==
null
)
{
if
(
token
==
null
)
{
if
(
ch
<
128
)
{
if
(
ch
<
128
)
{
buff
.
append
(
ch
);
buff
.
append
(
ch
);
...
@@ -144,7 +142,7 @@ public class HtmlConverter {
...
@@ -144,7 +142,7 @@ public class HtmlConverter {
repl
=
null
;
repl
=
null
;
}
}
}
else
{
}
else
{
repl
=
(
Character
)
charMap
.
get
(
key
);
repl
=
charMap
.
get
(
key
);
}
}
if
(
repl
==
null
)
{
if
(
repl
==
null
)
{
buff
.
append
(
"???"
+
key
+
"???"
);
buff
.
append
(
"???"
+
key
+
"???"
);
...
...
h2/src/tools/org/h2/build/indexer/Indexer.java
浏览文件 @
c1394475
...
@@ -36,14 +36,14 @@ public class Indexer {
...
@@ -36,14 +36,14 @@ public class Indexer {
"also;back;after;use;two;how;our;work;first;well;way;even;new;want;"
+
"also;back;after;use;two;how;our;work;first;well;way;even;new;want;"
+
"because;any;these;give;most;us;"
;
"because;any;these;give;most;us;"
;
private
ArrayList
pages
=
new
ArrayList
();
private
ArrayList
<
Page
>
pages
=
new
ArrayList
<
Page
>
();
/**
/**
* Lower case word to Word map.
* Lower case word to Word map.
*/
*/
private
HashMap
words
=
new
HashMap
();
private
HashMap
<
String
,
Word
>
words
=
new
HashMap
<
String
,
Word
>
();
private
HashSet
noIndex
=
new
HashSet
();
private
HashSet
<
String
>
noIndex
=
new
HashSet
<
String
>
();
private
ArrayList
wordList
;
private
ArrayList
<
Word
>
wordList
;
private
int
totalAllWeights
;
private
int
totalAllWeights
;
private
PrintWriter
output
;
private
PrintWriter
output
;
private
Page
page
;
private
Page
page
;
...
@@ -92,20 +92,18 @@ public class Indexer {
...
@@ -92,20 +92,18 @@ public class Indexer {
}
}
private
void
setNoIndex
(
String
[]
strings
)
{
private
void
setNoIndex
(
String
[]
strings
)
{
for
(
int
i
=
0
;
i
<
strings
.
length
;
i
++
)
{
for
(
String
s
:
strings
)
{
noIndex
.
add
(
s
trings
[
i
]
);
noIndex
.
add
(
s
);
}
}
}
}
private
void
sortWords
()
{
private
void
sortWords
()
{
ArrayList
names
=
new
ArrayList
(
words
.
keySet
());
for
(
String
name
:
words
.
keySet
())
{
for
(
int
i
=
0
;
i
<
names
.
size
();
i
++)
{
String
name
=
(
String
)
names
.
get
(
i
);
if
(
name
.
endsWith
(
"s"
))
{
if
(
name
.
endsWith
(
"s"
))
{
String
singular
=
name
.
substring
(
0
,
name
.
length
()
-
1
);
String
singular
=
name
.
substring
(
0
,
name
.
length
()
-
1
);
if
(
words
.
containsKey
(
singular
))
{
if
(
words
.
containsKey
(
singular
))
{
Word
wp
=
(
Word
)
words
.
get
(
name
);
Word
wp
=
words
.
get
(
name
);
Word
ws
=
(
Word
)
words
.
get
(
singular
);
Word
ws
=
words
.
get
(
singular
);
ws
.
addAll
(
wp
);
ws
.
addAll
(
wp
);
words
.
remove
(
name
);
words
.
remove
(
name
);
}
}
...
@@ -113,12 +111,12 @@ public class Indexer {
...
@@ -113,12 +111,12 @@ public class Indexer {
words
.
remove
(
name
);
words
.
remove
(
name
);
}
}
}
}
wordList
=
new
ArrayList
(
words
.
values
());
wordList
=
new
ArrayList
<
Word
>
(
words
.
values
());
// ignored very common words (to shrink the index)
// ignored very common words (to shrink the index)
String
ignored
=
""
;
String
ignored
=
""
;
int
maxSize
=
pages
.
size
()
/
4
;
int
maxSize
=
pages
.
size
()
/
4
;
for
(
int
i
=
0
;
i
<
wordList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
wordList
.
size
();
i
++)
{
Word
word
=
(
Word
)
wordList
.
get
(
i
);
Word
word
=
wordList
.
get
(
i
);
String
search
=
";"
+
word
.
name
.
toLowerCase
()
+
";"
;
String
search
=
";"
+
word
.
name
.
toLowerCase
()
+
";"
;
int
idxCommon
=
VERY_COMMON
.
indexOf
(
search
);
int
idxCommon
=
VERY_COMMON
.
indexOf
(
search
);
if
(
word
.
pages
.
size
()
>=
maxSize
||
idxCommon
>=
0
)
{
if
(
word
.
pages
.
size
()
>=
maxSize
||
idxCommon
>=
0
)
{
...
@@ -133,23 +131,20 @@ public class Indexer {
...
@@ -133,23 +131,20 @@ public class Indexer {
// output.println("var ignored = '" + convertUTF(ignored) + "'");
// output.println("var ignored = '" + convertUTF(ignored) + "'");
// TODO support A, B, C,... class links in the index file and use them
// TODO support A, B, C,... class links in the index file and use them
// for combined AND searches
// for combined AND searches
Collections
.
sort
(
wordList
,
new
Comparator
()
{
Collections
.
sort
(
wordList
,
new
Comparator
<
Word
>()
{
public
int
compare
(
Object
o0
,
Object
o1
)
{
public
int
compare
(
Word
w0
,
Word
w1
)
{
Word
w0
=
(
Word
)
o0
;
Word
w1
=
(
Word
)
o1
;
return
w0
.
name
.
compareToIgnoreCase
(
w1
.
name
);
return
w0
.
name
.
compareToIgnoreCase
(
w1
.
name
);
}
}
});
});
}
}
private
void
removeOverflowRelations
()
{
private
void
removeOverflowRelations
()
{
for
(
int
i
=
0
;
i
<
wordList
.
size
();
i
++)
{
for
(
Word
word
:
wordList
)
{
Word
word
=
(
Word
)
wordList
.
get
(
i
);
ArrayList
<
Weight
>
weights
=
word
.
getSortedWeights
();
ArrayList
weights
=
word
.
getSortedWeights
();
int
max
=
MAX_RELATIONS
;
int
max
=
MAX_RELATIONS
;
if
(
weights
.
size
()
>
max
)
{
if
(
weights
.
size
()
>
max
)
{
while
(
max
<
weights
.
size
())
{
while
(
max
<
weights
.
size
())
{
Weight
weight
=
(
Weight
)
weights
.
get
(
max
);
Weight
weight
=
weights
.
get
(
max
);
if
(
weight
.
value
<
Weight
.
HEADER
)
{
if
(
weight
.
value
<
Weight
.
HEADER
)
{
break
;
break
;
}
}
...
@@ -157,7 +152,7 @@ public class Indexer {
...
@@ -157,7 +152,7 @@ public class Indexer {
}
}
}
}
while
(
max
<
weights
.
size
())
{
while
(
max
<
weights
.
size
())
{
Weight
weight
=
(
Weight
)
weights
.
get
(
max
);
Weight
weight
=
weights
.
get
(
max
);
weights
.
remove
(
max
);
weights
.
remove
(
max
);
weight
.
page
.
relations
--;
weight
.
page
.
relations
--;
}
}
...
@@ -165,22 +160,19 @@ public class Indexer {
...
@@ -165,22 +160,19 @@ public class Indexer {
}
}
private
void
sortPages
()
{
private
void
sortPages
()
{
Collections
.
sort
(
pages
,
new
Comparator
()
{
Collections
.
sort
(
pages
,
new
Comparator
<
Page
>()
{
public
int
compare
(
Object
o0
,
Object
o1
)
{
public
int
compare
(
Page
p0
,
Page
p1
)
{
Page
p0
=
(
Page
)
o0
;
Page
p1
=
(
Page
)
o1
;
return
p0
.
relations
==
p1
.
relations
?
0
:
p0
.
relations
<
p1
.
relations
?
1
:
-
1
;
return
p0
.
relations
==
p1
.
relations
?
0
:
p0
.
relations
<
p1
.
relations
?
1
:
-
1
;
}
}
});
});
for
(
int
i
=
0
;
i
<
pages
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
pages
.
size
();
i
++)
{
Page
page
=
(
Page
)
pages
.
get
(
i
);
Page
page
=
pages
.
get
(
i
);
page
.
id
=
i
;
page
.
id
=
i
;
}
}
}
}
private
void
listPages
()
{
private
void
listPages
()
{
for
(
int
i
=
0
;
i
<
pages
.
size
();
i
++)
{
for
(
Page
page
:
pages
)
{
Page
page
=
(
Page
)
pages
.
get
(
i
);
output
.
println
(
"pages["
+
page
.
id
+
"]=new Page('"
+
convertUTF
(
page
.
title
)
+
"', '"
+
page
.
fileName
output
.
println
(
"pages["
+
page
.
id
+
"]=new Page('"
+
convertUTF
(
page
.
title
)
+
"', '"
+
page
.
fileName
+
"');"
);
+
"');"
);
}
}
...
@@ -190,9 +182,8 @@ public class Indexer {
...
@@ -190,9 +182,8 @@ public class Indexer {
String
name
=
file
.
getName
();
String
name
=
file
.
getName
();
String
fileName
=
dir
.
length
()
>
0
?
dir
+
"/"
+
name
:
level
>
0
?
name
:
""
;
String
fileName
=
dir
.
length
()
>
0
?
dir
+
"/"
+
name
:
level
>
0
?
name
:
""
;
if
(
file
.
isDirectory
())
{
if
(
file
.
isDirectory
())
{
File
[]
list
=
file
.
listFiles
();
for
(
File
f
:
file
.
listFiles
())
{
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
readPages
(
fileName
,
f
,
level
+
1
);
readPages
(
fileName
,
list
[
i
],
level
+
1
);
}
}
return
;
return
;
}
}
...
@@ -216,9 +207,8 @@ public class Indexer {
...
@@ -216,9 +207,8 @@ public class Indexer {
String
first
=
""
;
String
first
=
""
;
int
firstLen
=
1
;
int
firstLen
=
1
;
int
totalRelations
=
0
;
int
totalRelations
=
0
;
for
(
int
i
=
0
;
i
<
wordList
.
size
();
i
++)
{
for
(
Word
word
:
wordList
)
{
Word
word
=
(
Word
)
wordList
.
get
(
i
);
ArrayList
<
Weight
>
weights
=
word
.
getSortedWeights
();
ArrayList
weights
=
word
.
getSortedWeights
();
String
lower
=
StringUtils
.
toLowerEnglish
(
word
.
name
);
String
lower
=
StringUtils
.
toLowerEnglish
(
word
.
name
);
if
(!
first
.
equals
(
lower
.
substring
(
0
,
firstLen
)))
{
if
(!
first
.
equals
(
lower
.
substring
(
0
,
firstLen
)))
{
if
(
buff
.
length
()
>
0
)
{
if
(
buff
.
length
()
>
0
)
{
...
@@ -235,7 +225,7 @@ public class Indexer {
...
@@ -235,7 +225,7 @@ public class Indexer {
String
weightString
=
"r"
;
String
weightString
=
"r"
;
totalRelations
+=
weights
.
size
();
totalRelations
+=
weights
.
size
();
for
(
int
j
=
0
;
j
<
weights
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
weights
.
size
();
j
++)
{
Weight
weight
=
(
Weight
)
weights
.
get
(
j
);
Weight
weight
=
weights
.
get
(
j
);
Page
page
=
weight
.
page
;
Page
page
=
weight
.
page
;
if
(
j
>
0
)
{
if
(
j
>
0
)
{
buff
.
append
(
","
);
buff
.
append
(
","
);
...
@@ -356,7 +346,7 @@ public class Indexer {
...
@@ -356,7 +346,7 @@ public class Indexer {
continue
;
continue
;
}
}
String
lower
=
StringUtils
.
toLowerEnglish
(
token
);
String
lower
=
StringUtils
.
toLowerEnglish
(
token
);
Word
word
=
(
Word
)
words
.
get
(
lower
);
Word
word
=
words
.
get
(
lower
);
if
(
word
==
null
)
{
if
(
word
==
null
)
{
word
=
new
Word
(
token
);
word
=
new
Word
(
token
);
words
.
put
(
lower
,
word
);
words
.
put
(
lower
,
word
);
...
...
h2/src/tools/org/h2/build/indexer/Word.java
浏览文件 @
c1394475
...
@@ -10,8 +10,7 @@ import java.util.ArrayList;
...
@@ -10,8 +10,7 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map.Entry
;
import
java.util.Map
;
/**
/**
* Represents a word of the full text index.
* Represents a word of the full text index.
...
@@ -26,9 +25,9 @@ public class Word {
...
@@ -26,9 +25,9 @@ public class Word {
/**
/**
* The pages map.
* The pages map.
*/
*/
HashMap
pages
=
new
HashMap
();
HashMap
<
Page
,
Weight
>
pages
=
new
HashMap
<
Page
,
Weight
>
();
private
ArrayList
weightList
;
private
ArrayList
<
Weight
>
weightList
;
Word
(
String
name
)
{
Word
(
String
name
)
{
this
.
name
=
name
;
this
.
name
=
name
;
...
@@ -41,7 +40,7 @@ public class Word {
...
@@ -41,7 +40,7 @@ public class Word {
* @param weight the weight of this word in this page
* @param weight the weight of this word in this page
*/
*/
void
addPage
(
Page
page
,
int
weight
)
{
void
addPage
(
Page
page
,
int
weight
)
{
Weight
w
=
(
Weight
)
pages
.
get
(
page
);
Weight
w
=
pages
.
get
(
page
);
if
(
w
==
null
)
{
if
(
w
==
null
)
{
w
=
new
Weight
();
w
=
new
Weight
();
w
.
page
=
page
;
w
.
page
=
page
;
...
@@ -61,21 +60,18 @@ public class Word {
...
@@ -61,21 +60,18 @@ public class Word {
* @param other the other word
* @param other the other word
*/
*/
void
addAll
(
Word
other
)
{
void
addAll
(
Word
other
)
{
for
(
Iterator
it
=
other
.
pages
.
entrySet
().
iterator
();
it
.
hasNext
();)
{
for
(
Entry
<
Page
,
Weight
>
entry
:
other
.
pages
.
entrySet
())
{
Map
.
Entry
entry
=
(
Map
.
Entry
)
it
.
next
();
Page
p
=
entry
.
getKey
();
Page
p
=
(
Page
)
entry
.
getKey
();
Weight
w
=
entry
.
getValue
();
Weight
w
=
(
Weight
)
entry
.
getValue
();
addPage
(
p
,
w
.
value
);
addPage
(
p
,
w
.
value
);
}
}
}
}
ArrayList
getSortedWeights
()
{
ArrayList
<
Weight
>
getSortedWeights
()
{
if
(
weightList
==
null
)
{
if
(
weightList
==
null
)
{
weightList
=
new
ArrayList
(
pages
.
values
());
weightList
=
new
ArrayList
<
Weight
>(
pages
.
values
());
Collections
.
sort
(
weightList
,
new
Comparator
()
{
Collections
.
sort
(
weightList
,
new
Comparator
<
Weight
>()
{
public
int
compare
(
Object
o0
,
Object
o1
)
{
public
int
compare
(
Weight
w0
,
Weight
w1
)
{
Weight
w0
=
(
Weight
)
o0
;
Weight
w1
=
(
Weight
)
o1
;
return
w0
.
value
<
w1
.
value
?
1
:
w0
.
value
==
w1
.
value
?
0
:
-
1
;
return
w0
.
value
<
w1
.
value
?
1
:
w0
.
value
==
w1
.
value
?
0
:
-
1
;
}
}
});
});
...
...
h2/src/tools/org/h2/dev/ftp/FtpClient.java
浏览文件 @
c1394475
...
@@ -303,9 +303,7 @@ public class FtpClient {
...
@@ -303,9 +303,7 @@ public class FtpClient {
* @param dir the directory to remove
* @param dir the directory to remove
*/
*/
public
void
removeDirectoryRecursive
(
String
dir
)
throws
IOException
{
public
void
removeDirectoryRecursive
(
String
dir
)
throws
IOException
{
File
[]
list
=
listFiles
(
dir
);
for
(
File
f
:
listFiles
(
dir
))
{
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
File
f
=
list
[
i
];
if
(
f
.
isDirectory
())
{
if
(
f
.
isDirectory
())
{
removeDirectoryRecursive
(
dir
+
"/"
+
f
.
getName
());
removeDirectoryRecursive
(
dir
+
"/"
+
f
.
getName
());
}
else
{
}
else
{
...
@@ -351,9 +349,8 @@ public class FtpClient {
...
@@ -351,9 +349,8 @@ public class FtpClient {
if
(
file
.
isDirectory
())
{
if
(
file
.
isDirectory
())
{
makeDirectory
(
file
.
getName
());
makeDirectory
(
file
.
getName
());
changeWorkingDirectory
(
file
.
getName
());
changeWorkingDirectory
(
file
.
getName
());
File
[]
list
=
file
.
listFiles
();
for
(
File
f
:
file
.
listFiles
())
{
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
storeRecursive
(
f
);
storeRecursive
(
list
[
i
]);
}
}
changeWorkingDirectory
(
".."
);
changeWorkingDirectory
(
".."
);
}
else
{
}
else
{
...
@@ -430,9 +427,8 @@ public class FtpClient {
...
@@ -430,9 +427,8 @@ public class FtpClient {
* @return true if it exists
* @return true if it exists
*/
*/
public
boolean
exists
(
String
dir
,
String
name
)
throws
IOException
{
public
boolean
exists
(
String
dir
,
String
name
)
throws
IOException
{
File
[]
list
=
listFiles
(
dir
);
for
(
File
f
:
listFiles
(
dir
))
{
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
if
(
f
.
getName
().
equals
(
name
))
{
if
(
list
[
i
].
getName
().
equals
(
name
))
{
return
true
;
return
true
;
}
}
}
}
...
...
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
浏览文件 @
c1394475
...
@@ -80,7 +80,7 @@ public class FtpServer extends Tool implements Service {
...
@@ -80,7 +80,7 @@ public class FtpServer extends Tool implements Service {
private
String
root
=
DEFAULT_ROOT
;
private
String
root
=
DEFAULT_ROOT
;
private
String
writeUserName
=
DEFAULT_WRITE
,
writePassword
=
DEFAULT_WRITE_PASSWORD
;
private
String
writeUserName
=
DEFAULT_WRITE
,
writePassword
=
DEFAULT_WRITE_PASSWORD
;
private
String
readUserName
=
DEFAULT_READ
;
private
String
readUserName
=
DEFAULT_READ
;
private
HashMap
tasks
=
new
HashMap
();
private
HashMap
<
String
,
Process
>
tasks
=
new
HashMap
<
String
,
Process
>
();
private
FileSystem
fs
;
private
FileSystem
fs
;
private
boolean
trace
;
private
boolean
trace
;
...
@@ -295,10 +295,8 @@ public class FtpServer extends Tool implements Service {
...
@@ -295,10 +295,8 @@ public class FtpServer extends Tool implements Service {
* @return the list
* @return the list
*/
*/
String
getDirectoryListing
(
String
directory
,
boolean
listDirectories
)
throws
SQLException
{
String
getDirectoryListing
(
String
directory
,
boolean
listDirectories
)
throws
SQLException
{
String
[]
list
=
fs
.
listFiles
(
directory
);
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
for
(
int
i
=
0
;
list
!=
null
&&
i
<
list
.
length
;
i
++)
{
for
(
String
fileName
:
fs
.
listFiles
(
directory
))
{
String
fileName
=
list
[
i
];
if
(!
fs
.
isDirectory
(
fileName
)
||
(
fs
.
isDirectory
(
fileName
)
&&
listDirectories
))
{
if
(!
fs
.
isDirectory
(
fileName
)
||
(
fs
.
isDirectory
(
fileName
)
&&
listDirectories
))
{
appendFile
(
buff
,
fileName
);
appendFile
(
buff
,
fileName
);
}
}
...
@@ -512,7 +510,7 @@ public class FtpServer extends Tool implements Service {
...
@@ -512,7 +510,7 @@ public class FtpServer extends Tool implements Service {
*/
*/
void
stopTask
(
String
processName
)
{
void
stopTask
(
String
processName
)
{
trace
(
"kill process: "
+
processName
);
trace
(
"kill process: "
+
processName
);
Process
p
=
(
Process
)
tasks
.
remove
(
processName
);
Process
p
=
tasks
.
remove
(
processName
);
if
(
p
==
null
)
{
if
(
p
==
null
)
{
return
;
return
;
}
}
...
...
h2/src/tools/org/h2/dev/security/SecureKeyStoreBuilder.java
浏览文件 @
c1394475
...
@@ -50,9 +50,9 @@ public class SecureKeyStoreBuilder {
...
@@ -50,9 +50,9 @@ public class SecureKeyStoreBuilder {
System
.
out
.
println
(
"KeyStore store = KeyStore.getInstance(\""
+
store
.
getType
()+
"\");"
);
System
.
out
.
println
(
"KeyStore store = KeyStore.getInstance(\""
+
store
.
getType
()+
"\");"
);
System
.
out
.
println
(
"store.load(null, password.toCharArray());"
);
System
.
out
.
println
(
"store.load(null, password.toCharArray());"
);
//System.out.println("keystore provider="+store.getProvider().getName());
//System.out.println("keystore provider="+store.getProvider().getName());
Enumeration
en
=
store
.
aliases
();
Enumeration
<
String
>
en
=
store
.
aliases
();
while
(
en
.
hasMoreElements
())
{
while
(
en
.
hasMoreElements
())
{
String
alias
=
(
String
)
en
.
nextElement
();
String
alias
=
en
.
nextElement
();
Key
key
=
store
.
getKey
(
alias
,
password
.
toCharArray
());
Key
key
=
store
.
getKey
(
alias
,
password
.
toCharArray
());
System
.
out
.
println
(
"KeyFactory keyFactory = KeyFactory.getInstance(\""
+
key
.
getAlgorithm
()
+
"\");"
);
System
.
out
.
println
(
"KeyFactory keyFactory = KeyFactory.getInstance(\""
+
key
.
getAlgorithm
()
+
"\");"
);
System
.
out
.
println
(
"store.load(null, password.toCharArray());"
);
System
.
out
.
println
(
"store.load(null, password.toCharArray());"
);
...
@@ -61,10 +61,8 @@ public class SecureKeyStoreBuilder {
...
@@ -61,10 +61,8 @@ public class SecureKeyStoreBuilder {
System
.
out
.
println
(
pkFormat
+
"EncodedKeySpec keySpec = new "
+
pkFormat
+
"EncodedKeySpec(getBytes(\""
System
.
out
.
println
(
pkFormat
+
"EncodedKeySpec keySpec = new "
+
pkFormat
+
"EncodedKeySpec(getBytes(\""
+
encoded
+
"\"));"
);
+
encoded
+
"\"));"
);
System
.
out
.
println
(
"PrivateKey privateKey = keyFactory.generatePrivate(keySpec);"
);
System
.
out
.
println
(
"PrivateKey privateKey = keyFactory.generatePrivate(keySpec);"
);
System
.
out
.
println
(
"Certificate[] certs = new Certificate[]{"
);
System
.
out
.
println
(
"Certificate[] certs = new Certificate[] {"
);
Certificate
[]
certs
=
store
.
getCertificateChain
(
alias
);
for
(
Certificate
cert
:
store
.
getCertificateChain
(
alias
))
{
for
(
int
i
=
0
;
i
<
certs
.
length
;
i
++)
{
Certificate
cert
=
certs
[
i
];
System
.
out
.
println
(
" CertificateFactory.getInstance(\""
+
cert
.
getType
()+
"\")."
);
System
.
out
.
println
(
" CertificateFactory.getInstance(\""
+
cert
.
getType
()+
"\")."
);
String
enc
=
ByteUtils
.
convertBytesToString
(
cert
.
getEncoded
());
String
enc
=
ByteUtils
.
convertBytesToString
(
cert
.
getEncoded
());
System
.
out
.
println
(
" generateCertificate(new ByteArrayInputStream(getBytes(\""
+
enc
+
"\"))),"
);
System
.
out
.
println
(
" generateCertificate(new ByteArrayInputStream(getBytes(\""
+
enc
+
"\"))),"
);
...
...
h2/src/tools/org/h2/dev/util/FileViewer.java
浏览文件 @
c1394475
...
@@ -105,7 +105,7 @@ public class FileViewer extends Tool {
...
@@ -105,7 +105,7 @@ public class FileViewer extends Tool {
}
}
if
(
tail
)
{
if
(
tail
)
{
long
pos
=
length
-
100
*
lines
;
long
pos
=
length
-
100
*
lines
;
ArrayList
list
=
null
;
ArrayList
<
String
>
list
=
null
;
while
(
pos
>
0
)
{
while
(
pos
>
0
)
{
file
.
seek
(
pos
);
file
.
seek
(
pos
);
list
=
readLines
(
file
,
Integer
.
MAX_VALUE
);
list
=
readLines
(
file
,
Integer
.
MAX_VALUE
);
...
@@ -165,18 +165,18 @@ public class FileViewer extends Tool {
...
@@ -165,18 +165,18 @@ public class FileViewer extends Tool {
return
-
1
;
return
-
1
;
}
}
private
void
list
(
long
pos
,
String
header
,
ArrayList
list
)
{
private
void
list
(
long
pos
,
String
header
,
ArrayList
<
String
>
list
)
{
System
.
out
.
println
(
"-----------------------------------------------"
);
System
.
out
.
println
(
"-----------------------------------------------"
);
System
.
out
.
println
(
"["
+
pos
+
"]: "
+
header
);
System
.
out
.
println
(
"["
+
pos
+
"]: "
+
header
);
System
.
out
.
println
(
"-----------------------------------------------"
);
System
.
out
.
println
(
"-----------------------------------------------"
);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++
)
{
for
(
String
l
:
list
)
{
System
.
out
.
println
(
l
ist
.
get
(
i
)
);
System
.
out
.
println
(
l
);
}
}
System
.
out
.
println
(
"-----------------------------------------------"
);
System
.
out
.
println
(
"-----------------------------------------------"
);
}
}
private
ArrayList
readLines
(
RandomAccessFile
file
,
int
maxLines
)
throws
IOException
{
private
ArrayList
<
String
>
readLines
(
RandomAccessFile
file
,
int
maxLines
)
throws
IOException
{
ArrayList
lines
=
new
ArrayList
();
ArrayList
<
String
>
lines
=
new
ArrayList
<
String
>
();
ByteArrayOutputStream
buff
=
new
ByteArrayOutputStream
(
100
);
ByteArrayOutputStream
buff
=
new
ByteArrayOutputStream
(
100
);
boolean
lastNewline
=
false
;
boolean
lastNewline
=
false
;
while
(
maxLines
>
0
)
{
while
(
maxLines
>
0
)
{
...
...
h2/src/tools/org/h2/jaqu/Condition.java
浏览文件 @
c1394475
...
@@ -22,7 +22,7 @@ class Condition<A> implements Token {
...
@@ -22,7 +22,7 @@ class Condition<A> implements Token {
this
.
y
=
y
;
this
.
y
=
y
;
}
}
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
query
.
appendSQL
(
stat
,
x
);
query
.
appendSQL
(
stat
,
x
);
stat
.
appendSQL
(
" "
);
stat
.
appendSQL
(
" "
);
stat
.
appendSQL
(
compareType
.
getString
());
stat
.
appendSQL
(
compareType
.
getString
());
...
...
h2/src/tools/org/h2/jaqu/ConditionAndOr.java
浏览文件 @
c1394475
...
@@ -20,7 +20,7 @@ enum ConditionAndOr implements Token {
...
@@ -20,7 +20,7 @@ enum ConditionAndOr implements Token {
this
.
text
=
text
;
this
.
text
=
text
;
}
}
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
text
);
stat
.
appendSQL
(
text
);
}
}
...
...
h2/src/tools/org/h2/jaqu/Db.java
浏览文件 @
c1394475
...
@@ -30,7 +30,7 @@ public class Db {
...
@@ -30,7 +30,7 @@ public class Db {
Utils
.
newWeakIdentityHashMap
();
Utils
.
newWeakIdentityHashMap
();
private
final
Connection
conn
;
private
final
Connection
conn
;
private
final
Map
<
Class
,
TableDefinition
>
classMap
=
Utils
.
newHashMap
();
private
final
Map
<
Class
<
?
>,
TableDefinition
<
?
>
>
classMap
=
Utils
.
newHashMap
();
Db
(
Connection
conn
)
{
Db
(
Connection
conn
)
{
this
.
conn
=
conn
;
this
.
conn
=
conn
;
...
@@ -94,9 +94,9 @@ public class Db {
...
@@ -94,9 +94,9 @@ public class Db {
}
}
<
T
>
TableDefinition
<
T
>
define
(
Class
<
T
>
clazz
)
{
<
T
>
TableDefinition
<
T
>
define
(
Class
<
T
>
clazz
)
{
TableDefinition
def
=
classMap
.
get
(
clazz
);
TableDefinition
<
T
>
def
=
getTableDefinition
(
clazz
);
if
(
def
==
null
)
{
if
(
def
==
null
)
{
def
=
new
TableDefinition
(
clazz
);
def
=
new
TableDefinition
<
T
>
(
clazz
);
def
.
mapFields
();
def
.
mapFields
();
classMap
.
put
(
clazz
,
def
);
classMap
.
put
(
clazz
,
def
);
if
(
Table
.
class
.
isAssignableFrom
(
clazz
))
{
if
(
Table
.
class
.
isAssignableFrom
(
clazz
))
{
...
@@ -134,8 +134,9 @@ public class Db {
...
@@ -134,8 +134,9 @@ public class Db {
}
}
}
}
TableDefinition
getTableDefinition
(
Class
<
?
>
clazz
)
{
@SuppressWarnings
(
"unchecked"
)
return
classMap
.
get
(
clazz
);
<
T
>
TableDefinition
<
T
>
getTableDefinition
(
Class
<
T
>
clazz
)
{
return
(
TableDefinition
<
T
>)
classMap
.
get
(
clazz
);
}
}
ResultSet
executeQuery
(
String
sql
)
{
ResultSet
executeQuery
(
String
sql
)
{
...
...
h2/src/tools/org/h2/jaqu/Define.java
浏览文件 @
c1394475
...
@@ -13,7 +13,7 @@ package org.h2.jaqu;
...
@@ -13,7 +13,7 @@ package org.h2.jaqu;
//## Java 1.5 begin ##
//## Java 1.5 begin ##
public
class
Define
{
public
class
Define
{
private
static
TableDefinition
currentTableDefinition
;
private
static
TableDefinition
<
?
>
currentTableDefinition
;
private
static
Table
currentTable
;
private
static
Table
currentTable
;
public
static
void
primaryKey
(
Object
...
columns
)
{
public
static
void
primaryKey
(
Object
...
columns
)
{
...
@@ -35,7 +35,7 @@ public class Define {
...
@@ -35,7 +35,7 @@ public class Define {
currentTableDefinition
.
setTableName
(
tableName
);
currentTableDefinition
.
setTableName
(
tableName
);
}
}
static
synchronized
void
define
(
TableDefinition
tableDefinition
,
Table
table
)
{
static
synchronized
<
T
>
void
define
(
TableDefinition
<
T
>
tableDefinition
,
Table
table
)
{
currentTableDefinition
=
tableDefinition
;
currentTableDefinition
=
tableDefinition
;
currentTable
=
table
;
currentTable
=
table
;
tableDefinition
.
mapObject
(
table
);
tableDefinition
.
mapObject
(
table
);
...
...
h2/src/tools/org/h2/jaqu/Function.java
浏览文件 @
c1394475
...
@@ -26,7 +26,7 @@ public class Function implements Token {
...
@@ -26,7 +26,7 @@ public class Function implements Token {
this
.
x
=
x
;
this
.
x
=
x
;
}
}
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
name
);
stat
.
appendSQL
(
name
);
stat
.
appendSQL
(
"("
);
stat
.
appendSQL
(
"("
);
for
(
int
i
=
0
;
i
<
x
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
x
.
length
;
i
++)
{
...
@@ -47,6 +47,7 @@ public class Function implements Token {
...
@@ -47,6 +47,7 @@ public class Function implements Token {
Utils
.
newObject
(
Integer
.
class
),
new
Function
(
"LENGTH"
,
x
));
Utils
.
newObject
(
Integer
.
class
),
new
Function
(
"LENGTH"
,
x
));
}
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
extends
Number
>
T
sum
(
T
x
)
{
public
static
<
T
extends
Number
>
T
sum
(
T
x
)
{
return
(
T
)
Db
.
registerToken
(
return
(
T
)
Db
.
registerToken
(
Utils
.
newObject
(
x
.
getClass
()),
new
Function
(
"SUM"
,
x
));
Utils
.
newObject
(
x
.
getClass
()),
new
Function
(
"SUM"
,
x
));
...
@@ -60,7 +61,7 @@ public class Function implements Token {
...
@@ -60,7 +61,7 @@ public class Function implements Token {
public
static
Boolean
isNull
(
Object
x
)
{
public
static
Boolean
isNull
(
Object
x
)
{
return
Db
.
registerToken
(
return
Db
.
registerToken
(
Utils
.
newObject
(
Boolean
.
class
),
new
Function
(
""
,
x
)
{
Utils
.
newObject
(
Boolean
.
class
),
new
Function
(
""
,
x
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
query
.
appendSQL
(
stat
,
x
[
0
]);
query
.
appendSQL
(
stat
,
x
[
0
]);
stat
.
appendSQL
(
" IS NULL"
);
stat
.
appendSQL
(
" IS NULL"
);
}
}
...
@@ -70,7 +71,7 @@ public class Function implements Token {
...
@@ -70,7 +71,7 @@ public class Function implements Token {
public
static
Boolean
isNotNull
(
Object
x
)
{
public
static
Boolean
isNotNull
(
Object
x
)
{
return
Db
.
registerToken
(
return
Db
.
registerToken
(
Utils
.
newObject
(
Boolean
.
class
),
new
Function
(
""
,
x
)
{
Utils
.
newObject
(
Boolean
.
class
),
new
Function
(
""
,
x
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
query
.
appendSQL
(
stat
,
x
[
0
]);
query
.
appendSQL
(
stat
,
x
[
0
]);
stat
.
appendSQL
(
" IS NOT NULL"
);
stat
.
appendSQL
(
" IS NOT NULL"
);
}
}
...
@@ -80,7 +81,7 @@ public class Function implements Token {
...
@@ -80,7 +81,7 @@ public class Function implements Token {
public
static
Boolean
not
(
Boolean
x
)
{
public
static
Boolean
not
(
Boolean
x
)
{
return
Db
.
registerToken
(
return
Db
.
registerToken
(
Utils
.
newObject
(
Boolean
.
class
),
new
Function
(
""
,
x
)
{
Utils
.
newObject
(
Boolean
.
class
),
new
Function
(
""
,
x
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
"NOT "
);
stat
.
appendSQL
(
"NOT "
);
query
.
appendSQL
(
stat
,
x
[
0
]);
query
.
appendSQL
(
stat
,
x
[
0
]);
}
}
...
@@ -91,7 +92,7 @@ public class Function implements Token {
...
@@ -91,7 +92,7 @@ public class Function implements Token {
return
Db
.
registerToken
(
return
Db
.
registerToken
(
Utils
.
newObject
(
Boolean
.
class
),
Utils
.
newObject
(
Boolean
.
class
),
new
Function
(
""
,
(
Object
[])
x
)
{
new
Function
(
""
,
(
Object
[])
x
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
for
(
int
i
=
0
;
i
<
x
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
x
.
length
;
i
++)
{
if
(
i
>
0
)
{
if
(
i
>
0
)
{
stat
.
appendSQL
(
" OR "
);
stat
.
appendSQL
(
" OR "
);
...
@@ -106,7 +107,7 @@ public class Function implements Token {
...
@@ -106,7 +107,7 @@ public class Function implements Token {
return
Db
.
registerToken
(
return
Db
.
registerToken
(
Utils
.
newObject
(
Boolean
.
class
),
Utils
.
newObject
(
Boolean
.
class
),
new
Function
(
""
,
(
Object
[])
x
)
{
new
Function
(
""
,
(
Object
[])
x
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
for
(
int
i
=
0
;
i
<
x
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
x
.
length
;
i
++)
{
if
(
i
>
0
)
{
if
(
i
>
0
)
{
stat
.
appendSQL
(
" AND "
);
stat
.
appendSQL
(
" AND "
);
...
@@ -117,12 +118,14 @@ public class Function implements Token {
...
@@ -117,12 +118,14 @@ public class Function implements Token {
});
});
}
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
X
>
X
min
(
X
x
)
{
public
static
<
X
>
X
min
(
X
x
)
{
Class
<
X
>
clazz
=
(
Class
<
X
>)
x
.
getClass
();
Class
<
X
>
clazz
=
(
Class
<
X
>)
x
.
getClass
();
X
o
=
Utils
.
newObject
(
clazz
);
X
o
=
Utils
.
newObject
(
clazz
);
return
Db
.
registerToken
(
o
,
new
Function
(
"MIN"
,
x
));
return
Db
.
registerToken
(
o
,
new
Function
(
"MIN"
,
x
));
}
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
X
>
X
max
(
X
x
)
{
public
static
<
X
>
X
max
(
X
x
)
{
Class
<
X
>
clazz
=
(
Class
<
X
>)
x
.
getClass
();
Class
<
X
>
clazz
=
(
Class
<
X
>)
x
.
getClass
();
X
o
=
Utils
.
newObject
(
clazz
);
X
o
=
Utils
.
newObject
(
clazz
);
...
@@ -132,7 +135,7 @@ public class Function implements Token {
...
@@ -132,7 +135,7 @@ public class Function implements Token {
public
static
Boolean
like
(
String
x
,
String
pattern
)
{
public
static
Boolean
like
(
String
x
,
String
pattern
)
{
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
return
Db
.
registerToken
(
o
,
new
Function
(
"LIKE"
,
x
,
pattern
)
{
return
Db
.
registerToken
(
o
,
new
Function
(
"LIKE"
,
x
,
pattern
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
"("
);
stat
.
appendSQL
(
"("
);
query
.
appendSQL
(
stat
,
x
[
0
]);
query
.
appendSQL
(
stat
,
x
[
0
]);
stat
.
appendSQL
(
" LIKE "
);
stat
.
appendSQL
(
" LIKE "
);
...
...
h2/src/tools/org/h2/jaqu/OrderExpression.java
浏览文件 @
c1394475
...
@@ -9,17 +9,17 @@ package org.h2.jaqu;
...
@@ -9,17 +9,17 @@ package org.h2.jaqu;
/**
/**
* An expression to order by in a query.
* An expression to order by in a query.
*
*
* @param <T> the
expression
data type
* @param <T> the
query
data type
*/
*/
//## Java 1.5 begin ##
//## Java 1.5 begin ##
class
OrderExpression
<
T
>
{
class
OrderExpression
<
T
>
{
private
Query
query
;
private
Query
<
T
>
query
;
private
T
expression
;
private
Object
expression
;
private
boolean
desc
;
private
boolean
desc
;
private
boolean
nullsFirst
;
private
boolean
nullsFirst
;
private
boolean
nullsLast
;
private
boolean
nullsLast
;
OrderExpression
(
Query
query
,
T
expression
,
boolean
desc
,
OrderExpression
(
Query
<
T
>
query
,
Object
expression
,
boolean
desc
,
boolean
nullsFirst
,
boolean
nullsLast
)
{
boolean
nullsFirst
,
boolean
nullsLast
)
{
this
.
query
=
query
;
this
.
query
=
query
;
this
.
expression
=
expression
;
this
.
expression
=
expression
;
...
...
h2/src/tools/org/h2/jaqu/Query.java
浏览文件 @
c1394475
...
@@ -27,19 +27,20 @@ public class Query<T> {
...
@@ -27,19 +27,20 @@ public class Query<T> {
private
Db
db
;
private
Db
db
;
private
SelectTable
<
T
>
from
;
private
SelectTable
<
T
>
from
;
private
ArrayList
<
Token
>
conditions
=
Utils
.
newArrayList
();
private
ArrayList
<
Token
>
conditions
=
Utils
.
newArrayList
();
private
ArrayList
<
SelectTable
>
joins
=
Utils
.
newArrayList
();
private
ArrayList
<
SelectTable
<
?
>
>
joins
=
Utils
.
newArrayList
();
private
final
HashMap
<
Object
,
SelectColumn
>
aliasMap
=
Utils
.
newHashMap
();
private
final
HashMap
<
Object
,
SelectColumn
<
T
>
>
aliasMap
=
Utils
.
newHashMap
();
private
ArrayList
<
OrderExpression
>
orderByList
=
Utils
.
newArrayList
();
private
ArrayList
<
OrderExpression
<
T
>
>
orderByList
=
Utils
.
newArrayList
();
private
Object
[]
groupByExpressions
;
private
Object
[]
groupByExpressions
;
Query
(
Db
db
)
{
Query
(
Db
db
)
{
this
.
db
=
db
;
this
.
db
=
db
;
}
}
@SuppressWarnings
(
"unchecked"
)
static
<
T
>
Query
<
T
>
from
(
Db
db
,
T
alias
)
{
static
<
T
>
Query
<
T
>
from
(
Db
db
,
T
alias
)
{
Query
<
T
>
query
=
new
Query
<
T
>(
db
);
Query
<
T
>
query
=
new
Query
<
T
>(
db
);
TableDefinition
def
=
db
.
define
(
alias
.
getClass
());
TableDefinition
<
T
>
def
=
(
TableDefinition
<
T
>)
db
.
define
(
alias
.
getClass
());
query
.
from
=
new
SelectTable
(
db
,
query
,
alias
,
false
);
query
.
from
=
new
SelectTable
<
T
>
(
db
,
query
,
alias
,
false
);
def
.
initSelectObject
(
query
.
from
,
alias
,
query
.
aliasMap
);
def
.
initSelectObject
(
query
.
from
,
alias
,
query
.
aliasMap
);
return
query
;
return
query
;
}
}
...
@@ -65,6 +66,7 @@ public class Query<T> {
...
@@ -65,6 +66,7 @@ public class Query<T> {
return
select
(
true
);
return
select
(
true
);
}
}
@SuppressWarnings
(
"unchecked"
)
public
<
X
,
Z
>
X
selectFirst
(
Z
x
)
{
public
<
X
,
Z
>
X
selectFirst
(
Z
x
)
{
List
<
X
>
list
=
(
List
<
X
>)
select
(
x
);
List
<
X
>
list
=
(
List
<
X
>)
select
(
x
);
return
list
.
isEmpty
()
?
null
:
list
.
get
(
0
);
return
list
.
isEmpty
()
?
null
:
list
.
get
(
0
);
...
@@ -109,6 +111,7 @@ public class Query<T> {
...
@@ -109,6 +111,7 @@ public class Query<T> {
return
select
(
x
,
false
);
return
select
(
x
,
false
);
}
}
@SuppressWarnings
(
"unchecked"
)
private
<
X
,
Z
>
List
<
X
>
select
(
Z
x
,
boolean
distinct
)
{
private
<
X
,
Z
>
List
<
X
>
select
(
Z
x
,
boolean
distinct
)
{
Class
<
?
>
clazz
=
x
.
getClass
();
Class
<
?
>
clazz
=
x
.
getClass
();
if
(
Utils
.
isSimpleType
(
clazz
))
{
if
(
Utils
.
isSimpleType
(
clazz
))
{
...
@@ -135,6 +138,7 @@ public class Query<T> {
...
@@ -135,6 +138,7 @@ public class Query<T> {
return
result
;
return
result
;
}
}
@SuppressWarnings
(
"unchecked"
)
private
<
X
>
List
<
X
>
getSimple
(
X
x
,
boolean
distinct
)
{
private
<
X
>
List
<
X
>
getSimple
(
X
x
,
boolean
distinct
)
{
SqlStatement
selectList
=
new
SqlStatement
(
db
);
SqlStatement
selectList
=
new
SqlStatement
(
db
);
appendSQL
(
selectList
,
x
);
appendSQL
(
selectList
,
x
);
...
@@ -175,16 +179,16 @@ public class Query<T> {
...
@@ -175,16 +179,16 @@ public class Query<T> {
//## Java 1.5 begin ##
//## Java 1.5 begin ##
public
Query
<
T
>
orderBy
(
Object
...
expressions
)
{
public
Query
<
T
>
orderBy
(
Object
...
expressions
)
{
for
(
Object
expr
:
expressions
)
{
for
(
Object
expr
:
expressions
)
{
OrderExpression
<
Object
>
e
=
OrderExpression
<
T
>
e
=
new
OrderExpression
<
Object
>(
this
,
expr
,
false
,
false
,
false
);
new
OrderExpression
<
T
>(
this
,
expr
,
false
,
false
,
false
);
addOrderBy
(
e
);
addOrderBy
(
e
);
}
}
return
this
;
return
this
;
}
}
public
Query
<
T
>
orderByDesc
(
Object
expr
)
{
public
Query
<
T
>
orderByDesc
(
Object
expr
)
{
OrderExpression
<
Object
>
e
=
OrderExpression
<
T
>
e
=
new
OrderExpression
<
Object
>(
this
,
expr
,
true
,
false
,
false
);
new
OrderExpression
<
T
>(
this
,
expr
,
true
,
false
,
false
);
addOrderBy
(
e
);
addOrderBy
(
e
);
return
this
;
return
this
;
}
}
...
@@ -204,7 +208,7 @@ public class Query<T> {
...
@@ -204,7 +208,7 @@ public class Query<T> {
token
.
appendSQL
(
stat
,
this
);
token
.
appendSQL
(
stat
,
this
);
return
;
return
;
}
}
SelectColumn
col
=
aliasMap
.
get
(
x
);
SelectColumn
<
T
>
col
=
aliasMap
.
get
(
x
);
if
(
col
!=
null
)
{
if
(
col
!=
null
)
{
col
.
appendSQL
(
stat
);
col
.
appendSQL
(
stat
);
return
;
return
;
...
@@ -227,6 +231,7 @@ public class Query<T> {
...
@@ -227,6 +231,7 @@ public class Query<T> {
}
}
}
}
@SuppressWarnings
(
"unchecked"
)
SqlStatement
prepare
(
SqlStatement
selectList
,
boolean
distinct
)
{
SqlStatement
prepare
(
SqlStatement
selectList
,
boolean
distinct
)
{
SqlStatement
stat
=
selectList
;
SqlStatement
stat
=
selectList
;
String
selectSQL
=
stat
.
getSQL
();
String
selectSQL
=
stat
.
getSQL
();
...
@@ -275,9 +280,10 @@ public class Query<T> {
...
@@ -275,9 +280,10 @@ public class Query<T> {
* @return the joined query
* @return the joined query
*/
*/
//## Java 1.5 begin ##
//## Java 1.5 begin ##
public
QueryJoin
innerJoin
(
Object
alias
)
{
@SuppressWarnings
(
"unchecked"
)
TableDefinition
def
=
db
.
define
(
alias
.
getClass
());
public
<
U
>
QueryJoin
innerJoin
(
U
alias
)
{
SelectTable
join
=
new
SelectTable
(
db
,
this
,
alias
,
false
);
TableDefinition
<
T
>
def
=
(
TableDefinition
<
T
>)
db
.
define
(
alias
.
getClass
());
SelectTable
<
T
>
join
=
new
SelectTable
(
db
,
this
,
alias
,
false
);
def
.
initSelectObject
(
join
,
alias
,
aliasMap
);
def
.
initSelectObject
(
join
,
alias
,
aliasMap
);
joins
.
add
(
join
);
joins
.
add
(
join
);
return
new
QueryJoin
(
this
,
join
);
return
new
QueryJoin
(
this
,
join
);
...
@@ -291,11 +297,11 @@ public class Query<T> {
...
@@ -291,11 +297,11 @@ public class Query<T> {
return
!
joins
.
isEmpty
();
return
!
joins
.
isEmpty
();
}
}
SelectColumn
getSelectColumn
(
Object
obj
)
{
SelectColumn
<
T
>
getSelectColumn
(
Object
obj
)
{
return
aliasMap
.
get
(
obj
);
return
aliasMap
.
get
(
obj
);
}
}
void
addOrderBy
(
OrderExpression
expr
)
{
void
addOrderBy
(
OrderExpression
<
T
>
expr
)
{
orderByList
.
add
(
expr
);
orderByList
.
add
(
expr
);
}
}
...
...
h2/src/tools/org/h2/jaqu/QueryJoin.java
浏览文件 @
c1394475
...
@@ -13,9 +13,9 @@ package org.h2.jaqu;
...
@@ -13,9 +13,9 @@ package org.h2.jaqu;
public
class
QueryJoin
{
public
class
QueryJoin
{
private
Query
<
?
>
query
;
private
Query
<
?
>
query
;
private
SelectTable
join
;
private
SelectTable
<
?
>
join
;
QueryJoin
(
Query
<
?
>
query
,
SelectTable
join
)
{
QueryJoin
(
Query
<
?
>
query
,
SelectTable
<
?
>
join
)
{
this
.
query
=
query
;
this
.
query
=
query
;
this
.
join
=
join
;
this
.
join
=
join
;
}
}
...
...
h2/src/tools/org/h2/jaqu/QueryJoinCondition.java
浏览文件 @
c1394475
...
@@ -15,10 +15,10 @@ package org.h2.jaqu;
...
@@ -15,10 +15,10 @@ package org.h2.jaqu;
public
class
QueryJoinCondition
<
A
>
{
public
class
QueryJoinCondition
<
A
>
{
private
Query
<
?
>
query
;
private
Query
<
?
>
query
;
private
SelectTable
join
;
private
SelectTable
<
?
>
join
;
private
A
x
;
private
A
x
;
QueryJoinCondition
(
Query
<
?
>
query
,
SelectTable
join
,
A
x
)
{
QueryJoinCondition
(
Query
<
?
>
query
,
SelectTable
<
?
>
join
,
A
x
)
{
this
.
query
=
query
;
this
.
query
=
query
;
this
.
join
=
join
;
this
.
join
=
join
;
this
.
x
=
x
;
this
.
x
=
x
;
...
...
h2/src/tools/org/h2/jaqu/QueryWhere.java
浏览文件 @
c1394475
...
@@ -35,7 +35,7 @@ public class QueryWhere<T> {
...
@@ -35,7 +35,7 @@ public class QueryWhere<T> {
}
}
public
<
X
,
Z
>
List
<
X
>
select
(
Z
x
)
{
public
<
X
,
Z
>
List
<
X
>
select
(
Z
x
)
{
return
(
List
<
X
>)
query
.
select
(
x
);
return
query
.
select
(
x
);
}
}
public
String
getSQL
()
{
public
String
getSQL
()
{
...
@@ -45,11 +45,11 @@ public class QueryWhere<T> {
...
@@ -45,11 +45,11 @@ public class QueryWhere<T> {
}
}
public
<
X
,
Z
>
List
<
X
>
selectDistinct
(
Z
x
)
{
public
<
X
,
Z
>
List
<
X
>
selectDistinct
(
Z
x
)
{
return
(
List
<
X
>)
query
.
selectDistinct
(
x
);
return
query
.
selectDistinct
(
x
);
}
}
public
<
X
,
Z
>
X
selectFirst
(
Z
x
)
{
public
<
X
,
Z
>
X
selectFirst
(
Z
x
)
{
List
<
X
>
list
=
(
List
<
X
>)
query
.
select
(
x
);
List
<
X
>
list
=
query
.
select
(
x
);
return
list
.
isEmpty
()
?
null
:
list
.
get
(
0
);
return
list
.
isEmpty
()
?
null
:
list
.
get
(
0
);
}
}
...
@@ -77,44 +77,44 @@ public class QueryWhere<T> {
...
@@ -77,44 +77,44 @@ public class QueryWhere<T> {
//## Java 1.5 begin ##
//## Java 1.5 begin ##
public
QueryWhere
<
T
>
orderBy
(
Object
...
expressions
)
{
public
QueryWhere
<
T
>
orderBy
(
Object
...
expressions
)
{
for
(
Object
expr
:
expressions
)
{
for
(
Object
expr
:
expressions
)
{
OrderExpression
<
Object
>
e
=
OrderExpression
<
T
>
e
=
new
OrderExpression
<
Object
>(
query
,
expr
,
false
,
false
,
false
);
new
OrderExpression
<
T
>(
query
,
expr
,
false
,
false
,
false
);
query
.
addOrderBy
(
e
);
query
.
addOrderBy
(
e
);
}
}
return
this
;
return
this
;
}
}
public
QueryWhere
<
T
>
orderByNullsFirst
(
Object
expr
)
{
public
QueryWhere
<
T
>
orderByNullsFirst
(
Object
expr
)
{
OrderExpression
<
Object
>
e
=
OrderExpression
<
T
>
e
=
new
OrderExpression
<
Object
>(
query
,
expr
,
false
,
true
,
false
);
new
OrderExpression
<
T
>(
query
,
expr
,
false
,
true
,
false
);
query
.
addOrderBy
(
e
);
query
.
addOrderBy
(
e
);
return
this
;
return
this
;
}
}
public
QueryWhere
<
T
>
orderByNullsLast
(
Object
expr
)
{
public
QueryWhere
<
T
>
orderByNullsLast
(
Object
expr
)
{
OrderExpression
<
Object
>
e
=
OrderExpression
<
T
>
e
=
new
OrderExpression
<
Object
>(
query
,
expr
,
false
,
false
,
true
);
new
OrderExpression
<
T
>(
query
,
expr
,
false
,
false
,
true
);
query
.
addOrderBy
(
e
);
query
.
addOrderBy
(
e
);
return
this
;
return
this
;
}
}
public
QueryWhere
<
T
>
orderByDesc
(
Object
expr
)
{
public
QueryWhere
<
T
>
orderByDesc
(
Object
expr
)
{
OrderExpression
<
Object
>
e
=
OrderExpression
<
T
>
e
=
new
OrderExpression
<
Object
>(
query
,
expr
,
true
,
false
,
false
);
new
OrderExpression
<
T
>(
query
,
expr
,
true
,
false
,
false
);
query
.
addOrderBy
(
e
);
query
.
addOrderBy
(
e
);
return
this
;
return
this
;
}
}
public
QueryWhere
<
T
>
orderByDescNullsFirst
(
Object
expr
)
{
public
QueryWhere
<
T
>
orderByDescNullsFirst
(
Object
expr
)
{
OrderExpression
<
Object
>
e
=
OrderExpression
<
T
>
e
=
new
OrderExpression
<
Object
>(
query
,
expr
,
true
,
true
,
false
);
new
OrderExpression
<
T
>(
query
,
expr
,
true
,
true
,
false
);
query
.
addOrderBy
(
e
);
query
.
addOrderBy
(
e
);
return
this
;
return
this
;
}
}
public
QueryWhere
<
T
>
orderByDescNullsLast
(
Object
expr
)
{
public
QueryWhere
<
T
>
orderByDescNullsLast
(
Object
expr
)
{
OrderExpression
<
Object
>
e
=
OrderExpression
<
T
>
e
=
new
OrderExpression
<
Object
>(
query
,
expr
,
true
,
false
,
true
);
new
OrderExpression
<
T
>(
query
,
expr
,
true
,
false
,
true
);
query
.
addOrderBy
(
e
);
query
.
addOrderBy
(
e
);
return
this
;
return
this
;
}
}
...
...
h2/src/tools/org/h2/jaqu/SelectColumn.java
浏览文件 @
c1394475
...
@@ -13,14 +13,14 @@ import org.h2.jaqu.TableDefinition.FieldDefinition;
...
@@ -13,14 +13,14 @@ import org.h2.jaqu.TableDefinition.FieldDefinition;
/**
/**
* This class represents a column of a table in a query.
* This class represents a column of a table in a query.
*
*
* @param <
X> the column
data type
* @param <
T> the table
data type
*/
*/
//## Java 1.5 begin ##
//## Java 1.5 begin ##
class
SelectColumn
<
X
>
{
class
SelectColumn
<
T
>
{
private
SelectTable
selectTable
;
private
SelectTable
<
T
>
selectTable
;
private
FieldDefinition
<
X
>
fieldDef
;
private
FieldDefinition
fieldDef
;
SelectColumn
(
SelectTable
table
,
FieldDefinition
<
X
>
fieldDef
)
{
SelectColumn
(
SelectTable
<
T
>
table
,
FieldDefinition
fieldDef
)
{
this
.
selectTable
=
table
;
this
.
selectTable
=
table
;
this
.
fieldDef
=
fieldDef
;
this
.
fieldDef
=
fieldDef
;
}
}
...
@@ -33,11 +33,11 @@ class SelectColumn<X> {
...
@@ -33,11 +33,11 @@ class SelectColumn<X> {
}
}
}
}
FieldDefinition
<
X
>
getFieldDefinition
()
{
FieldDefinition
getFieldDefinition
()
{
return
fieldDef
;
return
fieldDef
;
}
}
SelectTable
getSelectTable
()
{
SelectTable
<
T
>
getSelectTable
()
{
return
selectTable
;
return
selectTable
;
}
}
...
...
h2/src/tools/org/h2/jaqu/SelectTable.java
浏览文件 @
c1394475
...
@@ -22,7 +22,7 @@ import org.h2.jaqu.util.Utils;
...
@@ -22,7 +22,7 @@ import org.h2.jaqu.util.Utils;
class
SelectTable
<
T
>
{
class
SelectTable
<
T
>
{
private
static
int
asCounter
;
private
static
int
asCounter
;
private
Query
query
;
private
Query
<
T
>
query
;
private
Class
<
T
>
clazz
;
private
Class
<
T
>
clazz
;
private
T
current
;
private
T
current
;
private
String
as
;
private
String
as
;
...
@@ -30,10 +30,11 @@ class SelectTable <T> {
...
@@ -30,10 +30,11 @@ class SelectTable <T> {
private
boolean
outerJoin
;
private
boolean
outerJoin
;
private
ArrayList
<
Token
>
joinConditions
=
Utils
.
newArrayList
();
private
ArrayList
<
Token
>
joinConditions
=
Utils
.
newArrayList
();
SelectTable
(
Db
db
,
Query
query
,
T
alias
,
boolean
outerJoin
)
{
@SuppressWarnings
(
"unchecked"
)
SelectTable
(
Db
db
,
Query
<
T
>
query
,
T
alias
,
boolean
outerJoin
)
{
this
.
query
=
query
;
this
.
query
=
query
;
this
.
outerJoin
=
outerJoin
;
this
.
outerJoin
=
outerJoin
;
aliasDef
=
db
.
getTableDefinition
(
alias
.
getClass
());
aliasDef
=
(
TableDefinition
<
T
>)
db
.
getTableDefinition
(
alias
.
getClass
());
clazz
=
ClassUtils
.
getClass
(
alias
);
clazz
=
ClassUtils
.
getClass
(
alias
);
as
=
"T"
+
asCounter
++;
as
=
"T"
+
asCounter
++;
}
}
...
@@ -42,7 +43,7 @@ class SelectTable <T> {
...
@@ -42,7 +43,7 @@ class SelectTable <T> {
return
Utils
.
newObject
(
clazz
);
return
Utils
.
newObject
(
clazz
);
}
}
TableDefinition
getAliasDefinition
()
{
TableDefinition
<
T
>
getAliasDefinition
()
{
return
aliasDef
;
return
aliasDef
;
}
}
...
@@ -54,7 +55,7 @@ class SelectTable <T> {
...
@@ -54,7 +55,7 @@ class SelectTable <T> {
}
}
}
}
void
appendSQLAsJoin
(
SqlStatement
stat
,
Query
query
)
{
void
appendSQLAsJoin
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
if
(
outerJoin
)
{
if
(
outerJoin
)
{
stat
.
appendSQL
(
" LEFT OUTER JOIN "
);
stat
.
appendSQL
(
" LEFT OUTER JOIN "
);
}
else
{
}
else
{
...
@@ -74,7 +75,7 @@ class SelectTable <T> {
...
@@ -74,7 +75,7 @@ class SelectTable <T> {
return
outerJoin
;
return
outerJoin
;
}
}
Query
getQuery
()
{
Query
<
T
>
getQuery
()
{
return
query
;
return
query
;
}
}
...
...
h2/src/tools/org/h2/jaqu/SqlStatement.java
浏览文件 @
c1394475
...
@@ -20,7 +20,7 @@ import java.util.ArrayList;
...
@@ -20,7 +20,7 @@ import java.util.ArrayList;
public
class
SqlStatement
{
public
class
SqlStatement
{
private
Db
db
;
private
Db
db
;
private
String
sql
=
""
;
private
String
sql
=
""
;
private
ArrayList
params
=
new
ArrayList
();
private
ArrayList
<
Object
>
params
=
new
ArrayList
<
Object
>
();
SqlStatement
(
Db
db
)
{
SqlStatement
(
Db
db
)
{
this
.
db
=
db
;
this
.
db
=
db
;
...
...
h2/src/tools/org/h2/jaqu/TableDefinition.java
浏览文件 @
c1394475
...
@@ -41,7 +41,7 @@ class TableDefinition<T> {
...
@@ -41,7 +41,7 @@ class TableDefinition<T> {
* The meta data of a field.
* The meta data of a field.
*/
*/
//## Java 1.5 begin ##
//## Java 1.5 begin ##
static
class
FieldDefinition
<
X
>
{
static
class
FieldDefinition
{
String
columnName
;
String
columnName
;
Field
field
;
Field
field
;
String
dataType
;
String
dataType
;
...
@@ -69,10 +69,9 @@ class TableDefinition<T> {
...
@@ -69,10 +69,9 @@ class TableDefinition<T> {
}
}
}
}
@SuppressWarnings
(
"unchecked"
)
Object
read
(
ResultSet
rs
,
int
columnIndex
)
{
X
read
(
ResultSet
rs
,
int
columnIndex
)
{
try
{
try
{
return
(
X
)
rs
.
getObject
(
columnIndex
);
return
rs
.
getObject
(
columnIndex
);
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
@@ -184,7 +183,7 @@ class TableDefinition<T> {
...
@@ -184,7 +183,7 @@ class TableDefinition<T> {
stat
.
executeUpdate
();
stat
.
executeUpdate
();
}
}
TableDefinition
createTableIfRequired
(
Db
db
)
{
TableDefinition
<
T
>
createTableIfRequired
(
Db
db
)
{
SqlStatement
stat
=
new
SqlStatement
(
db
);
SqlStatement
stat
=
new
SqlStatement
(
db
);
StringBuilder
buff
=
new
StringBuilder
(
"CREATE TABLE IF NOT EXISTS "
);
StringBuilder
buff
=
new
StringBuilder
(
"CREATE TABLE IF NOT EXISTS "
);
buff
.
append
(
tableName
);
buff
.
append
(
tableName
);
...
@@ -232,11 +231,11 @@ class TableDefinition<T> {
...
@@ -232,11 +231,11 @@ class TableDefinition<T> {
}
}
}
}
void
initSelectObject
(
SelectTable
table
,
Object
obj
,
void
initSelectObject
(
SelectTable
<
T
>
table
,
Object
obj
,
Map
<
Object
,
SelectColumn
>
map
)
{
Map
<
Object
,
SelectColumn
<
T
>
>
map
)
{
for
(
FieldDefinition
def
:
fields
)
{
for
(
FieldDefinition
def
:
fields
)
{
def
.
initWithNewObject
(
obj
);
def
.
initWithNewObject
(
obj
);
SelectColumn
column
=
new
SelectColumn
(
table
,
def
);
SelectColumn
<
T
>
column
=
new
SelectColumn
<
T
>
(
table
,
def
);
map
.
put
(
def
.
getValue
(
obj
),
column
);
map
.
put
(
def
.
getValue
(
obj
),
column
);
}
}
}
}
...
@@ -249,7 +248,7 @@ class TableDefinition<T> {
...
@@ -249,7 +248,7 @@ class TableDefinition<T> {
}
}
}
}
<
X
>
SqlStatement
getSelectList
(
Query
query
,
X
x
)
{
<
Y
,
X
>
SqlStatement
getSelectList
(
Query
<
Y
>
query
,
X
x
)
{
SqlStatement
selectList
=
new
SqlStatement
(
query
.
getDb
());
SqlStatement
selectList
=
new
SqlStatement
(
query
.
getDb
());
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
if
(
i
>
0
)
{
if
(
i
>
0
)
{
...
@@ -262,10 +261,10 @@ class TableDefinition<T> {
...
@@ -262,10 +261,10 @@ class TableDefinition<T> {
return
selectList
;
return
selectList
;
}
}
<
U
,
X
>
void
copyAttributeValues
(
Query
query
,
X
to
,
X
map
)
{
<
Y
,
X
>
void
copyAttributeValues
(
Query
<
Y
>
query
,
X
to
,
X
map
)
{
for
(
FieldDefinition
def
:
fields
)
{
for
(
FieldDefinition
def
:
fields
)
{
Object
obj
=
def
.
getValue
(
map
);
Object
obj
=
def
.
getValue
(
map
);
SelectColumn
col
=
query
.
getSelectColumn
(
obj
);
SelectColumn
<
Y
>
col
=
query
.
getSelectColumn
(
obj
);
Object
value
=
col
.
getCurrentValue
();
Object
value
=
col
.
getCurrentValue
();
def
.
setValue
(
to
,
value
);
def
.
setValue
(
to
,
value
);
}
}
...
...
h2/src/tools/org/h2/jaqu/TestCondition.java
浏览文件 @
c1394475
...
@@ -25,7 +25,7 @@ public class TestCondition<A> {
...
@@ -25,7 +25,7 @@ public class TestCondition<A> {
public
Boolean
is
(
A
y
)
{
public
Boolean
is
(
A
y
)
{
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
return
Db
.
registerToken
(
o
,
new
Function
(
"="
,
x
,
y
)
{
return
Db
.
registerToken
(
o
,
new
Function
(
"="
,
x
,
y
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
"("
);
stat
.
appendSQL
(
"("
);
query
.
appendSQL
(
stat
,
x
[
0
]);
query
.
appendSQL
(
stat
,
x
[
0
]);
stat
.
appendSQL
(
" = "
);
stat
.
appendSQL
(
" = "
);
...
@@ -38,7 +38,7 @@ public class TestCondition<A> {
...
@@ -38,7 +38,7 @@ public class TestCondition<A> {
public
Boolean
bigger
(
A
y
)
{
public
Boolean
bigger
(
A
y
)
{
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
return
Db
.
registerToken
(
o
,
new
Function
(
">"
,
x
,
y
)
{
return
Db
.
registerToken
(
o
,
new
Function
(
">"
,
x
,
y
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
"("
);
stat
.
appendSQL
(
"("
);
query
.
appendSQL
(
stat
,
x
[
0
]);
query
.
appendSQL
(
stat
,
x
[
0
]);
stat
.
appendSQL
(
" > "
);
stat
.
appendSQL
(
" > "
);
...
@@ -51,7 +51,7 @@ public class TestCondition<A> {
...
@@ -51,7 +51,7 @@ public class TestCondition<A> {
public
Boolean
biggerEqual
(
A
y
)
{
public
Boolean
biggerEqual
(
A
y
)
{
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
return
Db
.
registerToken
(
o
,
new
Function
(
">="
,
x
,
y
)
{
return
Db
.
registerToken
(
o
,
new
Function
(
">="
,
x
,
y
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
"("
);
stat
.
appendSQL
(
"("
);
query
.
appendSQL
(
stat
,
x
[
0
]);
query
.
appendSQL
(
stat
,
x
[
0
]);
stat
.
appendSQL
(
" >= "
);
stat
.
appendSQL
(
" >= "
);
...
@@ -64,7 +64,7 @@ public class TestCondition<A> {
...
@@ -64,7 +64,7 @@ public class TestCondition<A> {
public
Boolean
smaller
(
A
y
)
{
public
Boolean
smaller
(
A
y
)
{
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
return
Db
.
registerToken
(
o
,
new
Function
(
"<"
,
x
,
y
)
{
return
Db
.
registerToken
(
o
,
new
Function
(
"<"
,
x
,
y
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
"("
);
stat
.
appendSQL
(
"("
);
query
.
appendSQL
(
stat
,
x
[
0
]);
query
.
appendSQL
(
stat
,
x
[
0
]);
stat
.
appendSQL
(
" < "
);
stat
.
appendSQL
(
" < "
);
...
@@ -77,7 +77,7 @@ public class TestCondition<A> {
...
@@ -77,7 +77,7 @@ public class TestCondition<A> {
public
Boolean
smallerEqual
(
A
y
)
{
public
Boolean
smallerEqual
(
A
y
)
{
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
return
Db
.
registerToken
(
o
,
new
Function
(
"<="
,
x
,
y
)
{
return
Db
.
registerToken
(
o
,
new
Function
(
"<="
,
x
,
y
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
"("
);
stat
.
appendSQL
(
"("
);
query
.
appendSQL
(
stat
,
x
[
0
]);
query
.
appendSQL
(
stat
,
x
[
0
]);
stat
.
appendSQL
(
" <= "
);
stat
.
appendSQL
(
" <= "
);
...
@@ -90,7 +90,7 @@ public class TestCondition<A> {
...
@@ -90,7 +90,7 @@ public class TestCondition<A> {
public
Boolean
like
(
A
pattern
)
{
public
Boolean
like
(
A
pattern
)
{
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
Boolean
o
=
Utils
.
newObject
(
Boolean
.
class
);
return
Db
.
registerToken
(
o
,
new
Function
(
"LIKE"
,
x
,
pattern
)
{
return
Db
.
registerToken
(
o
,
new
Function
(
"LIKE"
,
x
,
pattern
)
{
public
void
appendSQL
(
SqlStatement
stat
,
Query
query
)
{
public
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
)
{
stat
.
appendSQL
(
"("
);
stat
.
appendSQL
(
"("
);
query
.
appendSQL
(
stat
,
x
[
0
]);
query
.
appendSQL
(
stat
,
x
[
0
]);
stat
.
appendSQL
(
" LIKE "
);
stat
.
appendSQL
(
" LIKE "
);
...
...
h2/src/tools/org/h2/jaqu/Token.java
浏览文件 @
c1394475
...
@@ -10,7 +10,13 @@ package org.h2.jaqu;
...
@@ -10,7 +10,13 @@ package org.h2.jaqu;
* Classes implementing this interface can be used as a token in a statement.
* Classes implementing this interface can be used as a token in a statement.
*/
*/
interface
Token
{
interface
Token
{
/**
* Append the SQL to the given statement using the given query.
*
* @param stat the statement to append the SQL to
* @param query the query to use
*/
//## Java 1.5 begin ##
//## Java 1.5 begin ##
void
appendSQL
(
SqlStatement
stat
,
Query
query
);
<
T
>
void
appendSQL
(
SqlStatement
stat
,
Query
<
T
>
query
);
//## Java 1.5 end ##
//## Java 1.5 end ##
}
}
h2/src/tools/org/h2/jaqu/util/ClassUtils.java
浏览文件 @
c1394475
...
@@ -20,8 +20,7 @@ public class ClassUtils {
...
@@ -20,8 +20,7 @@ public class ClassUtils {
//## Java 1.5 begin ##
//## Java 1.5 begin ##
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
public
static
<
X
>
Class
<
X
>
getClass
(
X
x
)
{
static
<
X
>
Class
<
X
>
getClass
(
X
x
)
{
return
(
Class
<
X
>)
x
.
getClass
();
return
(
Class
<
X
>)
x
.
getClass
();
}
}
...
...
h2/src/tools/org/h2/jaqu/util/Utils.java
浏览文件 @
c1394475
...
@@ -128,7 +128,7 @@ public class Utils {
...
@@ -128,7 +128,7 @@ public class Utils {
if
(
o
==
null
)
{
if
(
o
==
null
)
{
return
null
;
return
null
;
}
}
Class
currentType
=
o
.
getClass
();
Class
<
?
>
currentType
=
o
.
getClass
();
if
(
currentType
==
targetType
)
{
if
(
currentType
==
targetType
)
{
return
o
;
return
o
;
}
}
...
...
h2/src/tools/org/h2/jaqu/util/WeakIdentityHashMap.java
浏览文件 @
c1394475
...
@@ -24,7 +24,7 @@ import java.util.Set;
...
@@ -24,7 +24,7 @@ import java.util.Set;
//## Java 1.5 begin ##
//## Java 1.5 begin ##
public
class
WeakIdentityHashMap
<
K
,
V
>
implements
Map
<
K
,
V
>
{
public
class
WeakIdentityHashMap
<
K
,
V
>
implements
Map
<
K
,
V
>
{
private
static
final
int
MAX_LOAD
=
90
;
private
static
final
int
MAX_LOAD
=
90
;
private
static
final
WeakReference
DELETED_KEY
=
new
WeakReference
(
null
);
private
static
final
WeakReference
<
Object
>
DELETED_KEY
=
new
WeakReference
<
Object
>
(
null
);
private
int
mask
,
len
,
size
,
deletedCount
,
level
;
private
int
mask
,
len
,
size
,
deletedCount
,
level
;
private
int
maxSize
,
minSize
,
maxDeleted
;
private
int
maxSize
,
minSize
,
maxDeleted
;
private
WeakReference
<
K
>[]
keys
;
private
WeakReference
<
K
>[]
keys
;
...
@@ -59,6 +59,7 @@ public class WeakIdentityHashMap<K, V> implements Map<K, V> {
...
@@ -59,6 +59,7 @@ public class WeakIdentityHashMap<K, V> implements Map<K, V> {
return
System
.
identityHashCode
(
key
)
&
mask
;
return
System
.
identityHashCode
(
key
)
&
mask
;
}
}
@SuppressWarnings
(
"unchecked"
)
private
void
reset
(
int
newLevel
)
{
private
void
reset
(
int
newLevel
)
{
minSize
=
size
*
3
/
4
;
minSize
=
size
*
3
/
4
;
size
=
0
;
size
=
0
;
...
@@ -139,8 +140,9 @@ public class WeakIdentityHashMap<K, V> implements Map<K, V> {
...
@@ -139,8 +140,9 @@ public class WeakIdentityHashMap<K, V> implements Map<K, V> {
return
null
;
return
null
;
}
}
@SuppressWarnings
(
"unchecked"
)
private
void
delete
(
int
index
)
{
private
void
delete
(
int
index
)
{
keys
[
index
]
=
DELETED_KEY
;
keys
[
index
]
=
(
WeakReference
<
K
>)
DELETED_KEY
;
values
[
index
]
=
null
;
values
[
index
]
=
null
;
deletedCount
++;
deletedCount
++;
size
--;
size
--;
...
...
h2/src/tools/org/h2/mode/FunctionsMySQL.java
浏览文件 @
c1394475
...
@@ -101,7 +101,7 @@ public class FunctionsMySQL {
...
@@ -101,7 +101,7 @@ public class FunctionsMySQL {
* @param timestamp the timestamp
* @param timestamp the timestamp
* @return the current timestamp in seconds (not milliseconds).
* @return the current timestamp in seconds (not milliseconds).
*/
*/
public
static
int
unixTimestamp
(
java
.
sql
.
Timestamp
timestamp
)
throws
SQLException
{
public
static
int
unixTimestamp
(
java
.
sql
.
Timestamp
timestamp
)
{
return
(
int
)
(
timestamp
.
getTime
()
/
1000L
);
return
(
int
)
(
timestamp
.
getTime
()
/
1000L
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论