Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
9df819e3
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9df819e3
编写于
7月 26, 2013
作者:
P
peytoia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8021108: Clean up doclint warnings and errors in java.text package
Reviewed-by: darcy, okutsu
上级
8f7132bc
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
466 addition
and
182 deletion
+466
-182
src/share/classes/java/text/Annotation.java
src/share/classes/java/text/Annotation.java
+7
-2
src/share/classes/java/text/AttributedCharacterIterator.java
src/share/classes/java/text/AttributedCharacterIterator.java
+34
-2
src/share/classes/java/text/Bidi.java
src/share/classes/java/text/Bidi.java
+9
-3
src/share/classes/java/text/BreakIterator.java
src/share/classes/java/text/BreakIterator.java
+3
-3
src/share/classes/java/text/ChoiceFormat.java
src/share/classes/java/text/ChoiceFormat.java
+53
-34
src/share/classes/java/text/CollationElementIterator.java
src/share/classes/java/text/CollationElementIterator.java
+8
-4
src/share/classes/java/text/CollationKey.java
src/share/classes/java/text/CollationKey.java
+18
-14
src/share/classes/java/text/DateFormat.java
src/share/classes/java/text/DateFormat.java
+40
-30
src/share/classes/java/text/DateFormatSymbols.java
src/share/classes/java/text/DateFormatSymbols.java
+2
-1
src/share/classes/java/text/DecimalFormat.java
src/share/classes/java/text/DecimalFormat.java
+58
-17
src/share/classes/java/text/DecimalFormatSymbols.java
src/share/classes/java/text/DecimalFormatSymbols.java
+55
-2
src/share/classes/java/text/FieldPosition.java
src/share/classes/java/text/FieldPosition.java
+12
-1
src/share/classes/java/text/Format.java
src/share/classes/java/text/Format.java
+2
-2
src/share/classes/java/text/MessageFormat.java
src/share/classes/java/text/MessageFormat.java
+15
-6
src/share/classes/java/text/Normalizer.java
src/share/classes/java/text/Normalizer.java
+1
-5
src/share/classes/java/text/NumberFormat.java
src/share/classes/java/text/NumberFormat.java
+90
-19
src/share/classes/java/text/ParseException.java
src/share/classes/java/text/ParseException.java
+4
-1
src/share/classes/java/text/ParsePosition.java
src/share/classes/java/text/ParsePosition.java
+12
-1
src/share/classes/java/text/RuleBasedCollator.java
src/share/classes/java/text/RuleBasedCollator.java
+20
-14
src/share/classes/java/text/SimpleDateFormat.java
src/share/classes/java/text/SimpleDateFormat.java
+20
-20
src/share/classes/java/text/StringCharacterIterator.java
src/share/classes/java/text/StringCharacterIterator.java
+3
-1
未找到文件。
src/share/classes/java/text/Annotation.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1997, 20
02
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -59,7 +59,8 @@ public class Annotation {
...
@@ -59,7 +59,8 @@ public class Annotation {
/**
/**
* Constructs an annotation record with the given value, which
* Constructs an annotation record with the given value, which
* may be null.
* may be null.
* @param value The value of the attribute
*
* @param value the value of the attribute
*/
*/
public
Annotation
(
Object
value
)
{
public
Annotation
(
Object
value
)
{
this
.
value
=
value
;
this
.
value
=
value
;
...
@@ -67,6 +68,8 @@ public class Annotation {
...
@@ -67,6 +68,8 @@ public class Annotation {
/**
/**
* Returns the value of the attribute, which may be null.
* Returns the value of the attribute, which may be null.
*
* @return the value of the attribute
*/
*/
public
Object
getValue
()
{
public
Object
getValue
()
{
return
value
;
return
value
;
...
@@ -74,6 +77,8 @@ public class Annotation {
...
@@ -74,6 +77,8 @@ public class Annotation {
/**
/**
* Returns the String representation of this Annotation.
* Returns the String representation of this Annotation.
*
* @return the {@code String} representation of this {@code Annotation}
*/
*/
public
String
toString
()
{
public
String
toString
()
{
return
getClass
().
getName
()
+
"[value="
+
value
+
"]"
;
return
getClass
().
getName
()
+
"[value="
+
value
+
"]"
;
...
...
src/share/classes/java/text/AttributedCharacterIterator.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1997, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -101,6 +101,8 @@ public interface AttributedCharacterIterator extends CharacterIterator {
...
@@ -101,6 +101,8 @@ public interface AttributedCharacterIterator extends CharacterIterator {
/**
/**
* Constructs an {@code Attribute} with the given name.
* Constructs an {@code Attribute} with the given name.
*
* @param name the name of {@code Attribute}
*/
*/
protected
Attribute
(
String
name
)
{
protected
Attribute
(
String
name
)
{
this
.
name
=
name
;
this
.
name
=
name
;
...
@@ -111,7 +113,7 @@ public interface AttributedCharacterIterator extends CharacterIterator {
...
@@ -111,7 +113,7 @@ public interface AttributedCharacterIterator extends CharacterIterator {
/**
/**
* Compares two objects for equality. This version only returns true
* Compares two objects for equality. This version only returns true
* for
<code>x.equals(y)</code> if <code>x</code> and <code>y</code>
refer
* for
{@code x.equals(y)} if {@code x} and {@code y}
refer
* to the same object, and guarantees this for all subclasses.
* to the same object, and guarantees this for all subclasses.
*/
*/
public
final
boolean
equals
(
Object
obj
)
{
public
final
boolean
equals
(
Object
obj
)
{
...
@@ -137,6 +139,8 @@ public interface AttributedCharacterIterator extends CharacterIterator {
...
@@ -137,6 +139,8 @@ public interface AttributedCharacterIterator extends CharacterIterator {
/**
/**
* Returns the name of the attribute.
* Returns the name of the attribute.
*
* @return the name of {@code Attribute}
*/
*/
protected
String
getName
()
{
protected
String
getName
()
{
return
name
;
return
name
;
...
@@ -144,6 +148,10 @@ public interface AttributedCharacterIterator extends CharacterIterator {
...
@@ -144,6 +148,10 @@ public interface AttributedCharacterIterator extends CharacterIterator {
/**
/**
* Resolves instances being deserialized to the predefined constants.
* Resolves instances being deserialized to the predefined constants.
*
* @return the resolved {@code Attribute} object
* @throws InvalidObjectException if the object to resolve is not
* an instance of {@code Attribute}
*/
*/
protected
Object
readResolve
()
throws
InvalidObjectException
{
protected
Object
readResolve
()
throws
InvalidObjectException
{
if
(
this
.
getClass
()
!=
Attribute
.
class
)
{
if
(
this
.
getClass
()
!=
Attribute
.
class
)
{
...
@@ -171,6 +179,7 @@ public interface AttributedCharacterIterator extends CharacterIterator {
...
@@ -171,6 +179,7 @@ public interface AttributedCharacterIterator extends CharacterIterator {
* it is often necessary to store the reading (pronunciation) along with the
* it is often necessary to store the reading (pronunciation) along with the
* written form.
* written form.
* <p>Values are instances of {@link Annotation} holding instances of {@link String}.
* <p>Values are instances of {@link Annotation} holding instances of {@link String}.
*
* @see Annotation
* @see Annotation
* @see java.lang.String
* @see java.lang.String
*/
*/
...
@@ -196,18 +205,26 @@ public interface AttributedCharacterIterator extends CharacterIterator {
...
@@ -196,18 +205,26 @@ public interface AttributedCharacterIterator extends CharacterIterator {
* <p>Any contiguous text segments having the same attributes (the
* <p>Any contiguous text segments having the same attributes (the
* same set of attribute/value pairs) are treated as separate runs
* same set of attribute/value pairs) are treated as separate runs
* if the attributes have been given to those text segments separately.
* if the attributes have been given to those text segments separately.
*
* @return the index of the first character of the run
*/
*/
public
int
getRunStart
();
public
int
getRunStart
();
/**
/**
* Returns the index of the first character of the run
* Returns the index of the first character of the run
* with respect to the given {@code attribute} containing the current character.
* with respect to the given {@code attribute} containing the current character.
*
* @param attribute the desired attribute.
* @return the index of the first character of the run
*/
*/
public
int
getRunStart
(
Attribute
attribute
);
public
int
getRunStart
(
Attribute
attribute
);
/**
/**
* Returns the index of the first character of the run
* Returns the index of the first character of the run
* with respect to the given {@code attributes} containing the current character.
* with respect to the given {@code attributes} containing the current character.
*
* @param attributes a set of the desired attributes.
* @return the index of the first character of the run
*/
*/
public
int
getRunStart
(
Set
<?
extends
Attribute
>
attributes
);
public
int
getRunStart
(
Set
<?
extends
Attribute
>
attributes
);
...
@@ -218,30 +235,43 @@ public interface AttributedCharacterIterator extends CharacterIterator {
...
@@ -218,30 +235,43 @@ public interface AttributedCharacterIterator extends CharacterIterator {
* <p>Any contiguous text segments having the same attributes (the
* <p>Any contiguous text segments having the same attributes (the
* same set of attribute/value pairs) are treated as separate runs
* same set of attribute/value pairs) are treated as separate runs
* if the attributes have been given to those text segments separately.
* if the attributes have been given to those text segments separately.
*
* @return the index of the first character following the run
*/
*/
public
int
getRunLimit
();
public
int
getRunLimit
();
/**
/**
* Returns the index of the first character following the run
* Returns the index of the first character following the run
* with respect to the given {@code attribute} containing the current character.
* with respect to the given {@code attribute} containing the current character.
*
* @param attribute the desired attribute
* @return the index of the first character following the run
*/
*/
public
int
getRunLimit
(
Attribute
attribute
);
public
int
getRunLimit
(
Attribute
attribute
);
/**
/**
* Returns the index of the first character following the run
* Returns the index of the first character following the run
* with respect to the given {@code attributes} containing the current character.
* with respect to the given {@code attributes} containing the current character.
*
* @param attributes a set of the desired attributes
* @return the index of the first character following the run
*/
*/
public
int
getRunLimit
(
Set
<?
extends
Attribute
>
attributes
);
public
int
getRunLimit
(
Set
<?
extends
Attribute
>
attributes
);
/**
/**
* Returns a map with the attributes defined on the current
* Returns a map with the attributes defined on the current
* character.
* character.
*
* @return a map with the attributes defined on the current character
*/
*/
public
Map
<
Attribute
,
Object
>
getAttributes
();
public
Map
<
Attribute
,
Object
>
getAttributes
();
/**
/**
* Returns the value of the named {@code attribute} for the current character.
* Returns the value of the named {@code attribute} for the current character.
* Returns {@code null} if the {@code attribute} is not defined.
* Returns {@code null} if the {@code attribute} is not defined.
*
* @param attribute the desired attribute
* @return the value of the named {@code attribute} or {@code null}
*/
*/
public
Object
getAttribute
(
Attribute
attribute
);
public
Object
getAttribute
(
Attribute
attribute
);
...
@@ -249,6 +279,8 @@ public interface AttributedCharacterIterator extends CharacterIterator {
...
@@ -249,6 +279,8 @@ public interface AttributedCharacterIterator extends CharacterIterator {
* Returns the keys of all attributes defined on the
* Returns the keys of all attributes defined on the
* iterator's text range. The set is empty if no
* iterator's text range. The set is empty if no
* attributes are defined.
* attributes are defined.
*
* @return the keys of all attributes
*/
*/
public
Set
<
Attribute
>
getAllAttributeKeys
();
public
Set
<
Attribute
>
getAllAttributeKeys
();
};
};
src/share/classes/java/text/Bidi.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 2000, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -176,8 +176,10 @@ public final class Bidi {
...
@@ -176,8 +176,10 @@ public final class Bidi {
* Create a Bidi object representing the bidi information on a line of text within
* Create a Bidi object representing the bidi information on a line of text within
* the paragraph represented by the current Bidi. This call is not required if the
* the paragraph represented by the current Bidi. This call is not required if the
* entire paragraph fits on one line.
* entire paragraph fits on one line.
*
* @param lineStart the offset from the start of the paragraph to the start of the line.
* @param lineStart the offset from the start of the paragraph to the start of the line.
* @param lineLimit the offset from the start of the paragraph to the limit of the line.
* @param lineLimit the offset from the start of the paragraph to the limit of the line.
* @return a {@code Bidi} object
*/
*/
public
Bidi
createLineBidi
(
int
lineStart
,
int
lineLimit
)
{
public
Bidi
createLineBidi
(
int
lineStart
,
int
lineLimit
)
{
AttributedString
astr
=
new
AttributedString
(
""
);
AttributedString
astr
=
new
AttributedString
(
""
);
...
@@ -189,6 +191,7 @@ public final class Bidi {
...
@@ -189,6 +191,7 @@ public final class Bidi {
/**
/**
* Return true if the line is not left-to-right or right-to-left. This means it either has mixed runs of left-to-right
* Return true if the line is not left-to-right or right-to-left. This means it either has mixed runs of left-to-right
* and right-to-left text, or the base direction differs from the direction of the only run of text.
* and right-to-left text, or the base direction differs from the direction of the only run of text.
*
* @return true if the line is not left-to-right or right-to-left.
* @return true if the line is not left-to-right or right-to-left.
*/
*/
public
boolean
isMixed
()
{
public
boolean
isMixed
()
{
...
@@ -197,6 +200,7 @@ public final class Bidi {
...
@@ -197,6 +200,7 @@ public final class Bidi {
/**
/**
* Return true if the line is all left-to-right text and the base direction is left-to-right.
* Return true if the line is all left-to-right text and the base direction is left-to-right.
*
* @return true if the line is all left-to-right text and the base direction is left-to-right
* @return true if the line is all left-to-right text and the base direction is left-to-right
*/
*/
public
boolean
isLeftToRight
()
{
public
boolean
isLeftToRight
()
{
...
@@ -236,8 +240,10 @@ public final class Bidi {
...
@@ -236,8 +240,10 @@ public final class Bidi {
}
}
/**
/**
* Return the resolved level of the character at offset. If offset is <0 or >=
* Return the resolved level of the character at offset. If offset is
* the length of the line, return the base direction level.
* {@literal <} 0 or ≥ the length of the line, return the base direction
* level.
*
* @param offset the index of the character for which to return the level
* @param offset the index of the character for which to return the level
* @return the resolved level of the character at offset
* @return the resolved level of the character at offset
*/
*/
...
...
src/share/classes/java/text/BreakIterator.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -191,7 +191,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
...
@@ -191,7 +191,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
*
*
* Find the next word:
* Find the next word:
* <blockquote>
* <blockquote>
* <pre>
* <pre>
{@code
* public static int nextWordStartAfter(int pos, String text) {
* public static int nextWordStartAfter(int pos, String text) {
* BreakIterator wb = BreakIterator.getWordInstance();
* BreakIterator wb = BreakIterator.getWordInstance();
* wb.setText(text);
* wb.setText(text);
...
@@ -207,7 +207,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
...
@@ -207,7 +207,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
* }
* }
* return BreakIterator.DONE;
* return BreakIterator.DONE;
* }
* }
* </pre>
*
}
</pre>
* (The iterator returned by BreakIterator.getWordInstance() is unique in that
* (The iterator returned by BreakIterator.getWordInstance() is unique in that
* the break positions it returns don't represent both the start and end of the
* the break positions it returns don't represent both the start and end of the
* thing being iterated over. That is, a sentence-break iterator returns breaks
* thing being iterated over. That is, a sentence-break iterator returns breaks
...
...
src/share/classes/java/text/ChoiceFormat.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -50,7 +50,7 @@ import java.util.Arrays;
...
@@ -50,7 +50,7 @@ import java.util.Arrays;
* specifies a half-open interval up to the next item:
* specifies a half-open interval up to the next item:
* <blockquote>
* <blockquote>
* <pre>
* <pre>
* X matches j if and only if limit[j] &l
t;=
X < limit[j+1]
* X matches j if and only if limit[j] &l
e;
X < limit[j+1]
* </pre>
* </pre>
* </blockquote>
* </blockquote>
* If there is no match, then either the first or last index is used, depending
* If there is no match, then either the first or last index is used, depending
...
@@ -85,21 +85,21 @@ import java.util.Arrays;
...
@@ -85,21 +85,21 @@ import java.util.Arrays;
* <p>
* <p>
* Here is a simple example that shows formatting and parsing:
* Here is a simple example that shows formatting and parsing:
* <blockquote>
* <blockquote>
* <pre>
* <pre>
{@code
* double[] limits = {1,2,3,4,5,6,7};
* double[] limits = {1,2,3,4,5,6,7};
* String[] dayOfWeekNames = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
* String[] dayOfWeekNames = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
* ChoiceFormat form = new ChoiceFormat(limits, dayOfWeekNames);
* ChoiceFormat form = new ChoiceFormat(limits, dayOfWeekNames);
* ParsePosition status = new ParsePosition(0);
* ParsePosition status = new ParsePosition(0);
* for (double i = 0.0; i
<
= 8.0; ++i) {
* for (double i = 0.0; i
<
= 8.0; ++i) {
* status.setIndex(0);
* status.setIndex(0);
* System.out.println(i + " -
> " + form.format(i) + " ->
"
* System.out.println(i + " -
> " + form.format(i) + " ->
"
* + form.parse(form.format(i),status));
* + form.parse(form.format(i),status));
* }
* }
* </pre>
*
}
</pre>
* </blockquote>
* </blockquote>
* Here is a more complex example, with a pattern format:
* Here is a more complex example, with a pattern format:
* <blockquote>
* <blockquote>
* <pre>
* <pre>
{@code
* double[] filelimits = {0,1,2};
* double[] filelimits = {0,1,2};
* String[] filepart = {"are no files","is one file","are {2} files"};
* String[] filepart = {"are no files","is one file","are {2} files"};
* ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
* ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
...
@@ -107,20 +107,20 @@ import java.util.Arrays;
...
@@ -107,20 +107,20 @@ import java.util.Arrays;
* MessageFormat pattform = new MessageFormat("There {0} on {1}");
* MessageFormat pattform = new MessageFormat("There {0} on {1}");
* pattform.setFormats(testFormats);
* pattform.setFormats(testFormats);
* Object[] testArgs = {null, "ADisk", null};
* Object[] testArgs = {null, "ADisk", null};
* for (int i = 0; i
<
4; ++i) {
* for (int i = 0; i
<
4; ++i) {
* testArgs[0] = new Integer(i);
* testArgs[0] = new Integer(i);
* testArgs[2] = testArgs[0];
* testArgs[2] = testArgs[0];
* System.out.println(pattform.format(testArgs));
* System.out.println(pattform.format(testArgs));
* }
* }
* </pre>
*
}
</pre>
* </blockquote>
* </blockquote>
* <p>
* <p>
* Specifying a pattern for ChoiceFormat objects is fairly straightforward.
* Specifying a pattern for ChoiceFormat objects is fairly straightforward.
* For example:
* For example:
* <blockquote>
* <blockquote>
* <pre>
* <pre>
{@code
* ChoiceFormat fmt = new ChoiceFormat(
* ChoiceFormat fmt = new ChoiceFormat(
* "-1#is negative| 0#is zero or fraction | 1#is one |1.0
<is 1+ |2#is two |2<
is more than 2.");
* "-1#is negative| 0#is zero or fraction | 1#is one |1.0
<is 1+ |2#is two |2<
is more than 2.");
* System.out.println("Formatter Pattern : " + fmt.toPattern());
* System.out.println("Formatter Pattern : " + fmt.toPattern());
*
*
* System.out.println("Format with -INF : " + fmt.format(Double.NEGATIVE_INFINITY));
* System.out.println("Format with -INF : " + fmt.format(Double.NEGATIVE_INFINITY));
...
@@ -133,25 +133,25 @@ import java.util.Arrays;
...
@@ -133,25 +133,25 @@ import java.util.Arrays;
* System.out.println("Format with 2.1 : " + fmt.format(2.1));
* System.out.println("Format with 2.1 : " + fmt.format(2.1));
* System.out.println("Format with NaN : " + fmt.format(Double.NaN));
* System.out.println("Format with NaN : " + fmt.format(Double.NaN));
* System.out.println("Format with +INF : " + fmt.format(Double.POSITIVE_INFINITY));
* System.out.println("Format with +INF : " + fmt.format(Double.POSITIVE_INFINITY));
* </pre>
*
}
</pre>
* </blockquote>
* </blockquote>
* And the output result would be like the following:
* And the output result would be like the following:
* <blockquote>
* <blockquote>
* <pre>
* <pre>
{@code
*
Format with -INF : is negative
* Format with -INF : is negative
*
Format with -1.0 : is negative
* Format with -1.0 : is negative
*
Format with 0 : is zero or fraction
* Format with 0 : is zero or fraction
*
Format with 0.9 : is zero or fraction
* Format with 0.9 : is zero or fraction
*
Format with 1.0 : is one
* Format with 1.0 : is one
*
Format with 1.5 : is 1+
* Format with 1.5 : is 1+
*
Format with 2 : is two
* Format with 2 : is two
*
Format with 2.1 : is more than 2.
* Format with 2.1 : is more than 2.
*
Format with NaN : is negative
* Format with NaN : is negative
*
Format with +INF : is more than 2.
* Format with +INF : is more than 2.
* </pre>
*
}
</pre>
* </blockquote>
* </blockquote>
*
*
* <h
4><a name="synchronization">Synchronization</a></h4
>
* <h
3><a name="synchronization">Synchronization</a></h3
>
*
*
* <p>
* <p>
* Choice formats are not synchronized.
* Choice formats are not synchronized.
...
@@ -255,6 +255,8 @@ public class ChoiceFormat extends NumberFormat {
...
@@ -255,6 +255,8 @@ public class ChoiceFormat extends NumberFormat {
/**
/**
* Gets the pattern.
* Gets the pattern.
*
* @return the pattern string
*/
*/
public
String
toPattern
()
{
public
String
toPattern
()
{
StringBuffer
result
=
new
StringBuffer
();
StringBuffer
result
=
new
StringBuffer
();
...
@@ -305,6 +307,8 @@ public class ChoiceFormat extends NumberFormat {
...
@@ -305,6 +307,8 @@ public class ChoiceFormat extends NumberFormat {
/**
/**
* Constructs with limits and corresponding formats based on the pattern.
* Constructs with limits and corresponding formats based on the pattern.
*
* @param newPattern the new pattern string
* @see #applyPattern
* @see #applyPattern
*/
*/
public
ChoiceFormat
(
String
newPattern
)
{
public
ChoiceFormat
(
String
newPattern
)
{
...
@@ -313,6 +317,9 @@ public class ChoiceFormat extends NumberFormat {
...
@@ -313,6 +317,9 @@ public class ChoiceFormat extends NumberFormat {
/**
/**
* Constructs with the limits and the corresponding formats.
* Constructs with the limits and the corresponding formats.
*
* @param limits limits in ascending order
* @param formats corresponding format strings
* @see #setChoices
* @see #setChoices
*/
*/
public
ChoiceFormat
(
double
[]
limits
,
String
[]
formats
)
{
public
ChoiceFormat
(
double
[]
limits
,
String
[]
formats
)
{
...
@@ -322,9 +329,9 @@ public class ChoiceFormat extends NumberFormat {
...
@@ -322,9 +329,9 @@ public class ChoiceFormat extends NumberFormat {
/**
/**
* Set the choices to be used in formatting.
* Set the choices to be used in formatting.
* @param limits contains the top value that you want
* @param limits contains the top value that you want
* parsed with that format,and should be in ascending sorted order. When
* parsed with that format,
and should be in ascending sorted order. When
* formatting X, the choice will be the i, where
* formatting X, the choice will be the i, where
* limit[i] &l
t;= X <
limit[i+1].
* limit[i] &l
e; X {@literal <}
limit[i+1].
* If the limit array is not in ascending order, the results of formatting
* If the limit array is not in ascending order, the results of formatting
* will be incorrect.
* will be incorrect.
* @param formats are the formats you want to use for each limit.
* @param formats are the formats you want to use for each limit.
...
@@ -434,9 +441,12 @@ public class ChoiceFormat extends NumberFormat {
...
@@ -434,9 +441,12 @@ public class ChoiceFormat extends NumberFormat {
}
}
/**
/**
* Finds the least double greater than
d
.
* Finds the least double greater than
{@code d}
.
* If
NaN
, returns same value.
* If
{@code NaN}
, returns same value.
* <p>Used to make half-open intervals.
* <p>Used to make half-open intervals.
*
* @param d the reference value
* @return the least double value greather than {@code d}
* @see #previousDouble
* @see #previousDouble
*/
*/
public
static
final
double
nextDouble
(
double
d
)
{
public
static
final
double
nextDouble
(
double
d
)
{
...
@@ -444,8 +454,11 @@ public class ChoiceFormat extends NumberFormat {
...
@@ -444,8 +454,11 @@ public class ChoiceFormat extends NumberFormat {
}
}
/**
/**
* Finds the greatest double less than d.
* Finds the greatest double less than {@code d}.
* If NaN, returns same value.
* If {@code NaN}, returns same value.
*
* @param d the reference value
* @return the greatest double value less than {@code d}
* @see #nextDouble
* @see #nextDouble
*/
*/
public
static
final
double
previousDouble
(
double
d
)
{
public
static
final
double
previousDouble
(
double
d
)
{
...
@@ -553,15 +566,21 @@ public class ChoiceFormat extends NumberFormat {
...
@@ -553,15 +566,21 @@ public class ChoiceFormat extends NumberFormat {
static
final
long
POSITIVEINFINITY
=
0x7FF0000000000000
L
;
static
final
long
POSITIVEINFINITY
=
0x7FF0000000000000
L
;
/**
/**
* Finds the least double greater than d (if positive == true),
* Finds the least double greater than {@code d} (if {@code positive} is
* or the greatest double less than d (if positive == false).
* {@code true}), or the greatest double less than {@code d} (if
* If NaN, returns same value.
* {@code positive} is {@code false}).
* If {@code NaN}, returns same value.
*
*
* Does not affect floating-point flags,
* Does not affect floating-point flags,
* provided these member functions do not:
* provided these member functions do not:
* Double.longBitsToDouble(long)
* Double.longBitsToDouble(long)
* Double.doubleToLongBits(double)
* Double.doubleToLongBits(double)
* Double.isNaN(double)
* Double.isNaN(double)
*
* @param d the reference value
* @param positive {@code true} if the least double is desired;
* {@code false} otherwise
* @return the least or greater double value
*/
*/
public
static
double
nextDouble
(
double
d
,
boolean
positive
)
{
public
static
double
nextDouble
(
double
d
,
boolean
positive
)
{
...
...
src/share/classes/java/text/CollationElementIterator.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -54,14 +54,14 @@ import sun.text.normalizer.NormalizerBase;
...
@@ -54,14 +54,14 @@ import sun.text.normalizer.NormalizerBase;
* For example, consider the following in Spanish:
* For example, consider the following in Spanish:
* <blockquote>
* <blockquote>
* <pre>
* <pre>
* "ca"
->
the first key is key('c') and second key is key('a').
* "ca"
→
the first key is key('c') and second key is key('a').
* "cha"
->
the first key is key('ch') and second key is key('a').
* "cha"
→
the first key is key('ch') and second key is key('a').
* </pre>
* </pre>
* </blockquote>
* </blockquote>
* And in German,
* And in German,
* <blockquote>
* <blockquote>
* <pre>
* <pre>
* "\u00e4b"
->
the first key is key('a'), the second key is key('e'), and
* "\u00e4b"
→
the first key is key('a'), the second key is key('e'), and
* the third key is key('b').
* the third key is key('b').
* </pre>
* </pre>
* </blockquote>
* </blockquote>
...
@@ -177,6 +177,8 @@ public final class CollationElementIterator
...
@@ -177,6 +177,8 @@ public final class CollationElementIterator
* means that when you change direction while iterating (i.e., call next() and
* means that when you change direction while iterating (i.e., call next() and
* then call previous(), or call previous() and then call next()), you'll get
* then call previous(), or call previous() and then call next()), you'll get
* back the same element twice.</p>
* back the same element twice.</p>
*
* @return the next collation element
*/
*/
public
int
next
()
public
int
next
()
{
{
...
@@ -272,6 +274,8 @@ public final class CollationElementIterator
...
@@ -272,6 +274,8 @@ public final class CollationElementIterator
* updates the pointer. This means that when you change direction while
* updates the pointer. This means that when you change direction while
* iterating (i.e., call next() and then call previous(), or call previous()
* iterating (i.e., call next() and then call previous(), or call previous()
* and then call next()), you'll get back the same element twice.</p>
* and then call next()), you'll get back the same element twice.</p>
*
* @return the previous collation element
* @since 1.2
* @since 1.2
*/
*/
public
int
previous
()
public
int
previous
()
...
...
src/share/classes/java/text/CollationKey.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1997, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -68,28 +68,28 @@ package java.text;
...
@@ -68,28 +68,28 @@ package java.text;
* The following example shows how <code>CollationKey</code>s might be used
* The following example shows how <code>CollationKey</code>s might be used
* to sort a list of <code>String</code>s.
* to sort a list of <code>String</code>s.
* <blockquote>
* <blockquote>
* <pre>
* <pre>
{@code
* // Create an array of CollationKeys for the Strings to be sorted.
* // Create an array of CollationKeys for the Strings to be sorted.
* Collator myCollator = Collator.getInstance();
* Collator myCollator = Collator.getInstance();
* CollationKey[] keys = new CollationKey[3];
* CollationKey[] keys = new CollationKey[3];
* keys[0] = myCollator.getCollationKey("Tom");
* keys[0] = myCollator.getCollationKey("Tom");
* keys[1] = myCollator.getCollationKey("Dick");
* keys[1] = myCollator.getCollationKey("Dick");
* keys[2] = myCollator.getCollationKey("Harry");
* keys[2] = myCollator.getCollationKey("Harry");
* sort(
keys
);
* sort(
keys
);
*
<br>
*
* //...
* //...
*
<br>
*
* // Inside body of sort routine, compare keys this way
* // Inside body of sort routine, compare keys this way
* if
( keys[i].compareTo( keys[j] ) > 0
)
* if
(keys[i].compareTo(keys[j]) > 0
)
* // swap keys[i] and keys[j]
* // swap keys[i] and keys[j]
*
<br>
*
* //...
* //...
*
<br>
*
* // Finally, when we've returned from sort.
* // Finally, when we've returned from sort.
* System.out.println(
keys[0].getSourceString()
);
* System.out.println(
keys[0].getSourceString()
);
* System.out.println(
keys[1].getSourceString()
);
* System.out.println(
keys[1].getSourceString()
);
* System.out.println(
keys[2].getSourceString()
);
* System.out.println(
keys[2].getSourceString()
);
* </pre>
*
}
</pre>
* </blockquote>
* </blockquote>
*
*
* @see Collator
* @see Collator
...
@@ -112,6 +112,8 @@ public abstract class CollationKey implements Comparable<CollationKey> {
...
@@ -112,6 +112,8 @@ public abstract class CollationKey implements Comparable<CollationKey> {
/**
/**
* Returns the String that this CollationKey represents.
* Returns the String that this CollationKey represents.
*
* @return the source string of this CollationKey
*/
*/
public
String
getSourceString
()
{
public
String
getSourceString
()
{
return
source
;
return
source
;
...
@@ -123,6 +125,8 @@ public abstract class CollationKey implements Comparable<CollationKey> {
...
@@ -123,6 +125,8 @@ public abstract class CollationKey implements Comparable<CollationKey> {
* could be legitimately compared, then one could compare the byte arrays
* could be legitimately compared, then one could compare the byte arrays
* for each of those keys to obtain the same result. Byte arrays are
* for each of those keys to obtain the same result. Byte arrays are
* organized most significant byte first.
* organized most significant byte first.
*
* @return a byte array representation of the CollationKey
*/
*/
abstract
public
byte
[]
toByteArray
();
abstract
public
byte
[]
toByteArray
();
...
@@ -130,8 +134,8 @@ public abstract class CollationKey implements Comparable<CollationKey> {
...
@@ -130,8 +134,8 @@ public abstract class CollationKey implements Comparable<CollationKey> {
/**
/**
* CollationKey constructor.
* CollationKey constructor.
*
*
* @param source
- the source string.
* @param source
the source string
* @exception NullPointerException if
<code>source</code> is null.
* @exception NullPointerException if
{@code source} is null
* @since 1.6
* @since 1.6
*/
*/
protected
CollationKey
(
String
source
)
{
protected
CollationKey
(
String
source
)
{
...
...
src/share/classes/java/text/DateFormat.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -57,7 +57,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
...
@@ -57,7 +57,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
* {@code DateFormat} is an abstract class for date/time formatting subclasses which
* {@code DateFormat} is an abstract class for date/time formatting subclasses which
* formats and parses dates or time in a language-independent manner.
* formats and parses dates or time in a language-independent manner.
* The date/time formatting subclass, such as {@link SimpleDateFormat}, allows for
* The date/time formatting subclass, such as {@link SimpleDateFormat}, allows for
* formatting (i.e., date
-> text), parsing (text ->
date), and
* formatting (i.e., date
→ text), parsing (text →
date), and
* normalization. The date is represented as a <code>Date</code> object or
* normalization. The date is represented as a <code>Date</code> object or
* as the milliseconds since January 1, 1970, 00:00:00 GMT.
* as the milliseconds since January 1, 1970, 00:00:00 GMT.
*
*
...
@@ -73,28 +73,36 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
...
@@ -73,28 +73,36 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
*
*
* <p>To format a date for the current Locale, use one of the
* <p>To format a date for the current Locale, use one of the
* static factory methods:
* static factory methods:
* <pre>
* <blockquote>
* myString = DateFormat.getDateInstance().format(myDate);
* <pre>{@code
* </pre>
* myString = DateFormat.getDateInstance().format(myDate);
* }</pre>
* </blockquote>
* <p>If you are formatting multiple dates, it is
* <p>If you are formatting multiple dates, it is
* more efficient to get the format and use it multiple times so that
* more efficient to get the format and use it multiple times so that
* the system doesn't have to fetch the information about the local
* the system doesn't have to fetch the information about the local
* language and country conventions multiple times.
* language and country conventions multiple times.
* <pre>
* <blockquote>
* DateFormat df = DateFormat.getDateInstance();
* <pre>{@code
* for (int i = 0; i < myDate.length; ++i) {
* DateFormat df = DateFormat.getDateInstance();
* output.println(df.format(myDate[i]) + "; ");
* for (int i = 0; i < myDate.length; ++i) {
* }
* output.println(df.format(myDate[i]) + "; ");
* </pre>
* }
* }</pre>
* </blockquote>
* <p>To format a date for a different Locale, specify it in the
* <p>To format a date for a different Locale, specify it in the
* call to {@link #getDateInstance(int, Locale) getDateInstance()}.
* call to {@link #getDateInstance(int, Locale) getDateInstance()}.
* <pre>
* <blockquote>
* DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
* <pre>{@code
* </pre>
* DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
* }</pre>
* </blockquote>
* <p>You can use a DateFormat to parse also.
* <p>You can use a DateFormat to parse also.
* <pre>
* <blockquote>
* myDate = df.parse(myString);
* <pre>{@code
* </pre>
* myDate = df.parse(myString);
* }</pre>
* </blockquote>
* <p>Use {@code getDateInstance} to get the normal date format for that country.
* <p>Use {@code getDateInstance} to get the normal date format for that country.
* There are other static factory methods available.
* There are other static factory methods available.
* Use {@code getTimeInstance} to get the time format for that country.
* Use {@code getTimeInstance} to get the time format for that country.
...
@@ -125,7 +133,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
...
@@ -125,7 +133,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
* on the screen.
* on the screen.
* </ul>
* </ul>
*
*
* <h
4><a name="synchronization">Synchronization</a></h4
>
* <h
3><a name="synchronization">Synchronization</a></h3
>
*
*
* <p>
* <p>
* Date formats are not synchronized.
* Date formats are not synchronized.
...
@@ -581,6 +589,8 @@ public abstract class DateFormat extends Format {
...
@@ -581,6 +589,8 @@ public abstract class DateFormat extends Format {
/**
/**
* Get a default date/time formatter that uses the SHORT style for both the
* Get a default date/time formatter that uses the SHORT style for both the
* date and the time.
* date and the time.
*
* @return a date/time formatter
*/
*/
public
final
static
DateFormat
getInstance
()
{
public
final
static
DateFormat
getInstance
()
{
return
getDateTimeInstance
(
SHORT
,
SHORT
);
return
getDateTimeInstance
(
SHORT
,
SHORT
);
...
@@ -653,9 +663,9 @@ public abstract class DateFormat extends Format {
...
@@ -653,9 +663,9 @@ public abstract class DateFormat extends Format {
/**
/**
* Sets the time zone for the calendar of this {@code DateFormat} object.
* Sets the time zone for the calendar of this {@code DateFormat} object.
* This method is equivalent to the following call.
* This method is equivalent to the following call.
* <blockquote><pre>
* <blockquote><pre>
{@code
*
getCalendar().setTimeZone(zone)
* getCalendar().setTimeZone(zone)
* </pre></blockquote>
*
}
</pre></blockquote>
*
*
* <p>The {@code TimeZone} set by this method is overwritten by a
* <p>The {@code TimeZone} set by this method is overwritten by a
* {@link #setCalendar(java.util.Calendar) setCalendar} call.
* {@link #setCalendar(java.util.Calendar) setCalendar} call.
...
@@ -673,9 +683,9 @@ public abstract class DateFormat extends Format {
...
@@ -673,9 +683,9 @@ public abstract class DateFormat extends Format {
/**
/**
* Gets the time zone.
* Gets the time zone.
* This method is equivalent to the following call.
* This method is equivalent to the following call.
* <blockquote><pre>
* <blockquote><pre>
{@code
*
getCalendar().getTimeZone()
* getCalendar().getTimeZone()
* </pre></blockquote>
*
}
</pre></blockquote>
*
*
* @return the time zone associated with the calendar of DateFormat.
* @return the time zone associated with the calendar of DateFormat.
*/
*/
...
@@ -691,9 +701,9 @@ public abstract class DateFormat extends Format {
...
@@ -691,9 +701,9 @@ public abstract class DateFormat extends Format {
* inputs must match this object's format.
* inputs must match this object's format.
*
*
* <p>This method is equivalent to the following call.
* <p>This method is equivalent to the following call.
* <blockquote><pre>
* <blockquote><pre>
{@code
*
getCalendar().setLenient(lenient)
* getCalendar().setLenient(lenient)
* </pre></blockquote>
*
}
</pre></blockquote>
*
*
* <p>This leniency value is overwritten by a call to {@link
* <p>This leniency value is overwritten by a call to {@link
* #setCalendar(java.util.Calendar) setCalendar()}.
* #setCalendar(java.util.Calendar) setCalendar()}.
...
@@ -709,9 +719,9 @@ public abstract class DateFormat extends Format {
...
@@ -709,9 +719,9 @@ public abstract class DateFormat extends Format {
/**
/**
* Tell whether date/time parsing is to be lenient.
* Tell whether date/time parsing is to be lenient.
* This method is equivalent to the following call.
* This method is equivalent to the following call.
* <blockquote><pre>
* <blockquote><pre>
{@code
*
getCalendar().isLenient()
* getCalendar().isLenient()
* </pre></blockquote>
*
}
</pre></blockquote>
*
*
* @return {@code true} if the {@link #calendar} is lenient;
* @return {@code true} if the {@link #calendar} is lenient;
* {@code false} otherwise.
* {@code false} otherwise.
...
...
src/share/classes/java/text/DateFormatSymbols.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -135,6 +135,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
...
@@ -135,6 +135,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
* implementations. For full locale coverage, use the
* implementations. For full locale coverage, use the
* {@link #getInstance(Locale) getInstance} method.
* {@link #getInstance(Locale) getInstance} method.
*
*
* @param locale the desired locale
* @see #getInstance(Locale)
* @see #getInstance(Locale)
* @exception java.util.MissingResourceException
* @exception java.util.MissingResourceException
* if the resources for the specified locale cannot be
* if the resources for the specified locale cannot be
...
...
src/share/classes/java/text/DecimalFormat.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -87,7 +87,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
...
@@ -87,7 +87,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
* the <code>NumberFormat</code> factory methods, the pattern and symbols are
* the <code>NumberFormat</code> factory methods, the pattern and symbols are
* read from localized <code>ResourceBundle</code>s.
* read from localized <code>ResourceBundle</code>s.
*
*
* <h
4>Patterns</h4
>
* <h
3>Patterns</h3
>
*
*
* <code>DecimalFormat</code> patterns have the following syntax:
* <code>DecimalFormat</code> patterns have the following syntax:
* <blockquote><pre>
* <blockquote><pre>
...
@@ -174,7 +174,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
...
@@ -174,7 +174,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
* <blockquote>
* <blockquote>
* <table border=0 cellspacing=3 cellpadding=0 summary="Chart showing symbol,
* <table border=0 cellspacing=3 cellpadding=0 summary="Chart showing symbol,
* location, localized, and meaning.">
* location, localized, and meaning.">
* <tr
bgcolor="#ccccff
">
* <tr
style="background-color: rgb(204, 204, 255);
">
* <th align=left>Symbol
* <th align=left>Symbol
* <th align=left>Location
* <th align=left>Location
* <th align=left>Localized?
* <th align=left>Localized?
...
@@ -184,7 +184,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
...
@@ -184,7 +184,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
* <td>Number
* <td>Number
* <td>Yes
* <td>Yes
* <td>Digit
* <td>Digit
* <tr
valign=top bgcolor="#eeeeff
">
* <tr
style="vertical-align: top; background-color: rgb(238, 238, 255);
">
* <td><code>#</code>
* <td><code>#</code>
* <td>Number
* <td>Number
* <td>Yes
* <td>Yes
...
@@ -194,7 +194,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
...
@@ -194,7 +194,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
* <td>Number
* <td>Number
* <td>Yes
* <td>Yes
* <td>Decimal separator or monetary decimal separator
* <td>Decimal separator or monetary decimal separator
* <tr
valign=top bgcolor="#eeeeff
">
* <tr
style="vertical-align: top; background-color: rgb(238, 238, 255);
">
* <td><code>-</code>
* <td><code>-</code>
* <td>Number
* <td>Number
* <td>Yes
* <td>Yes
...
@@ -204,7 +204,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
...
@@ -204,7 +204,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
* <td>Number
* <td>Number
* <td>Yes
* <td>Yes
* <td>Grouping separator
* <td>Grouping separator
* <tr
valign=top bgcolor="#eeeeff
">
* <tr
style="vertical-align: top; background-color: rgb(238, 238, 255);
">
* <td><code>E</code>
* <td><code>E</code>
* <td>Number
* <td>Number
* <td>Yes
* <td>Yes
...
@@ -215,7 +215,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
...
@@ -215,7 +215,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
* <td>Subpattern boundary
* <td>Subpattern boundary
* <td>Yes
* <td>Yes
* <td>Separates positive and negative subpatterns
* <td>Separates positive and negative subpatterns
* <tr
valign=top bgcolor="#eeeeff
">
* <tr
style="vertical-align: top; background-color: rgb(238, 238, 255);
">
* <td><code>%</code>
* <td><code>%</code>
* <td>Prefix or suffix
* <td>Prefix or suffix
* <td>Yes
* <td>Yes
...
@@ -225,7 +225,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
...
@@ -225,7 +225,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
* <td>Prefix or suffix
* <td>Prefix or suffix
* <td>Yes
* <td>Yes
* <td>Multiply by 1000 and show as per mille value
* <td>Multiply by 1000 and show as per mille value
* <tr
valign=top bgcolor="#eeeeff
">
* <tr
style="vertical-align: top; background-color: rgb(238, 238, 255);
">
* <td><code>¤</code> (<code>\u00A4</code>)
* <td><code>¤</code> (<code>\u00A4</code>)
* <td>Prefix or suffix
* <td>Prefix or suffix
* <td>No
* <td>No
...
@@ -248,7 +248,8 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
...
@@ -248,7 +248,8 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
*
*
* <p>Numbers in scientific notation are expressed as the product of a mantissa
* <p>Numbers in scientific notation are expressed as the product of a mantissa
* and a power of ten, for example, 1234 can be expressed as 1.234 x 10^3. The
* and a power of ten, for example, 1234 can be expressed as 1.234 x 10^3. The
* mantissa is often in the range 1.0 <= x < 10.0, but it need not be.
* mantissa is often in the range 1.0 ≤ x {@literal <} 10.0, but it need not
* be.
* <code>DecimalFormat</code> can be instructed to format and parse scientific
* <code>DecimalFormat</code> can be instructed to format and parse scientific
* notation <em>only via a pattern</em>; there is currently no factory method
* notation <em>only via a pattern</em>; there is currently no factory method
* that creates a scientific notation format. In a pattern, the exponent
* that creates a scientific notation format. In a pattern, the exponent
...
@@ -336,13 +337,13 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
...
@@ -336,13 +337,13 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
*
*
* <h4>Example</h4>
* <h4>Example</h4>
*
*
* <blockquote><pre>
* <blockquote><pre>
{@code
* <strong>// Print out a number using the localized number, integer, currency,
* <strong>// Print out a number using the localized number, integer, currency,
* // and percent format for each locale</strong>
* // and percent format for each locale</strong>
* Locale[] locales = NumberFormat.getAvailableLocales();
* Locale[] locales = NumberFormat.getAvailableLocales();
* double myNumber = -1234.56;
* double myNumber = -1234.56;
* NumberFormat form;
* NumberFormat form;
* for (int j
=0; j<
4; ++j) {
* for (int j
= 0; j <
4; ++j) {
* System.out.println("FORMAT");
* System.out.println("FORMAT");
* for (int i = 0; i < locales.length; ++i) {
* for (int i = 0; i < locales.length; ++i) {
* if (locales[i].getCountry().length() == 0) {
* if (locales[i].getCountry().length() == 0) {
...
@@ -368,7 +369,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
...
@@ -368,7 +369,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
* } catch (ParseException e) {}
* } catch (ParseException e) {}
* }
* }
* }
* }
* </pre></blockquote>
*
}
</pre></blockquote>
*
*
* @see <a href="http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html">Java Tutorial</a>
* @see <a href="http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html">Java Tutorial</a>
* @see NumberFormat
* @see NumberFormat
...
@@ -421,7 +422,7 @@ public class DecimalFormat extends NumberFormat {
...
@@ -421,7 +422,7 @@ public class DecimalFormat extends NumberFormat {
* return the most appropriate sub-class of NumberFormat for a given
* return the most appropriate sub-class of NumberFormat for a given
* locale.
* locale.
*
*
* @param pattern
A
non-localized pattern string.
* @param pattern
a
non-localized pattern string.
* @exception NullPointerException if <code>pattern</code> is null
* @exception NullPointerException if <code>pattern</code> is null
* @exception IllegalArgumentException if the given pattern is invalid.
* @exception IllegalArgumentException if the given pattern is invalid.
* @see java.text.NumberFormat#getInstance
* @see java.text.NumberFormat#getInstance
...
@@ -2382,6 +2383,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2382,6 +2383,8 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Get the positive prefix.
* Get the positive prefix.
* <P>Examples: +123, $123, sFr123
* <P>Examples: +123, $123, sFr123
*
* @return the positive prefix
*/
*/
public
String
getPositivePrefix
()
{
public
String
getPositivePrefix
()
{
return
positivePrefix
;
return
positivePrefix
;
...
@@ -2390,6 +2393,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2390,6 +2393,8 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Set the positive prefix.
* Set the positive prefix.
* <P>Examples: +123, $123, sFr123
* <P>Examples: +123, $123, sFr123
*
* @param newValue the new positive prefix
*/
*/
public
void
setPositivePrefix
(
String
newValue
)
{
public
void
setPositivePrefix
(
String
newValue
)
{
positivePrefix
=
newValue
;
positivePrefix
=
newValue
;
...
@@ -2420,6 +2425,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2420,6 +2425,8 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Get the negative prefix.
* Get the negative prefix.
* <P>Examples: -123, ($123) (with negative suffix), sFr-123
* <P>Examples: -123, ($123) (with negative suffix), sFr-123
*
* @return the negative prefix
*/
*/
public
String
getNegativePrefix
()
{
public
String
getNegativePrefix
()
{
return
negativePrefix
;
return
negativePrefix
;
...
@@ -2428,6 +2435,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2428,6 +2435,8 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Set the negative prefix.
* Set the negative prefix.
* <P>Examples: -123, ($123) (with negative suffix), sFr-123
* <P>Examples: -123, ($123) (with negative suffix), sFr-123
*
* @param newValue the new negative prefix
*/
*/
public
void
setNegativePrefix
(
String
newValue
)
{
public
void
setNegativePrefix
(
String
newValue
)
{
negativePrefix
=
newValue
;
negativePrefix
=
newValue
;
...
@@ -2457,6 +2466,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2457,6 +2466,8 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Get the positive suffix.
* Get the positive suffix.
* <P>Example: 123%
* <P>Example: 123%
*
* @return the positive suffix
*/
*/
public
String
getPositiveSuffix
()
{
public
String
getPositiveSuffix
()
{
return
positiveSuffix
;
return
positiveSuffix
;
...
@@ -2465,6 +2476,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2465,6 +2476,8 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Set the positive suffix.
* Set the positive suffix.
* <P>Example: 123%
* <P>Example: 123%
*
* @param newValue the new positive suffix
*/
*/
public
void
setPositiveSuffix
(
String
newValue
)
{
public
void
setPositiveSuffix
(
String
newValue
)
{
positiveSuffix
=
newValue
;
positiveSuffix
=
newValue
;
...
@@ -2494,6 +2507,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2494,6 +2507,8 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Get the negative suffix.
* Get the negative suffix.
* <P>Examples: -123%, ($123) (with positive suffixes)
* <P>Examples: -123%, ($123) (with positive suffixes)
*
* @return the negative suffix
*/
*/
public
String
getNegativeSuffix
()
{
public
String
getNegativeSuffix
()
{
return
negativeSuffix
;
return
negativeSuffix
;
...
@@ -2502,6 +2517,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2502,6 +2517,8 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Set the negative suffix.
* Set the negative suffix.
* <P>Examples: 123%
* <P>Examples: 123%
*
* @param newValue the new negative suffix
*/
*/
public
void
setNegativeSuffix
(
String
newValue
)
{
public
void
setNegativeSuffix
(
String
newValue
)
{
negativeSuffix
=
newValue
;
negativeSuffix
=
newValue
;
...
@@ -2532,6 +2549,7 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2532,6 +2549,7 @@ public class DecimalFormat extends NumberFormat {
* Gets the multiplier for use in percent, per mille, and similar
* Gets the multiplier for use in percent, per mille, and similar
* formats.
* formats.
*
*
* @return the multiplier
* @see #setMultiplier(int)
* @see #setMultiplier(int)
*/
*/
public
int
getMultiplier
()
{
public
int
getMultiplier
()
{
...
@@ -2549,6 +2567,7 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2549,6 +2567,7 @@ public class DecimalFormat extends NumberFormat {
* <P>Example: with multiplier 100, 1.23 is formatted as "123", and
* <P>Example: with multiplier 100, 1.23 is formatted as "123", and
* "123" is parsed into 1.23.
* "123" is parsed into 1.23.
*
*
* @param newValue the new multiplier
* @see #getMultiplier
* @see #getMultiplier
*/
*/
public
void
setMultiplier
(
int
newValue
)
{
public
void
setMultiplier
(
int
newValue
)
{
...
@@ -2571,6 +2590,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2571,6 +2590,8 @@ public class DecimalFormat extends NumberFormat {
* Return the grouping size. Grouping size is the number of digits between
* Return the grouping size. Grouping size is the number of digits between
* grouping separators in the integer portion of a number. For example,
* grouping separators in the integer portion of a number. For example,
* in the number "123,456.78", the grouping size is 3.
* in the number "123,456.78", the grouping size is 3.
*
* @return the grouping size
* @see #setGroupingSize
* @see #setGroupingSize
* @see java.text.NumberFormat#isGroupingUsed
* @see java.text.NumberFormat#isGroupingUsed
* @see java.text.DecimalFormatSymbols#getGroupingSeparator
* @see java.text.DecimalFormatSymbols#getGroupingSeparator
...
@@ -2585,6 +2606,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2585,6 +2606,8 @@ public class DecimalFormat extends NumberFormat {
* in the number "123,456.78", the grouping size is 3.
* in the number "123,456.78", the grouping size is 3.
* <br>
* <br>
* The value passed in is converted to a byte, which may lose information.
* The value passed in is converted to a byte, which may lose information.
*
* @param newValue the new grouping size
* @see #getGroupingSize
* @see #getGroupingSize
* @see java.text.NumberFormat#setGroupingUsed
* @see java.text.NumberFormat#setGroupingUsed
* @see java.text.DecimalFormatSymbols#setGroupingSeparator
* @see java.text.DecimalFormatSymbols#setGroupingSeparator
...
@@ -2597,7 +2620,10 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2597,7 +2620,10 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Allows you to get the behavior of the decimal separator with integers.
* Allows you to get the behavior of the decimal separator with integers.
* (The decimal separator will always appear with decimals.)
* (The decimal separator will always appear with decimals.)
* <P>Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
* <P>Example: Decimal ON: 12345 → 12345.; OFF: 12345 → 12345
*
* @return {@code true} if the decimal separator is always shown;
* {@code false} otherwise
*/
*/
public
boolean
isDecimalSeparatorAlwaysShown
()
{
public
boolean
isDecimalSeparatorAlwaysShown
()
{
return
decimalSeparatorAlwaysShown
;
return
decimalSeparatorAlwaysShown
;
...
@@ -2606,7 +2632,10 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2606,7 +2632,10 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Allows you to set the behavior of the decimal separator with integers.
* Allows you to set the behavior of the decimal separator with integers.
* (The decimal separator will always appear with decimals.)
* (The decimal separator will always appear with decimals.)
* <P>Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
* <P>Example: Decimal ON: 12345 → 12345.; OFF: 12345 → 12345
*
* @param newValue {@code true} if the decimal separator is always shown;
* {@code false} otherwise
*/
*/
public
void
setDecimalSeparatorAlwaysShown
(
boolean
newValue
)
{
public
void
setDecimalSeparatorAlwaysShown
(
boolean
newValue
)
{
decimalSeparatorAlwaysShown
=
newValue
;
decimalSeparatorAlwaysShown
=
newValue
;
...
@@ -2616,6 +2645,9 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2616,6 +2645,9 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Returns whether the {@link #parse(java.lang.String, java.text.ParsePosition)}
* Returns whether the {@link #parse(java.lang.String, java.text.ParsePosition)}
* method returns <code>BigDecimal</code>. The default value is false.
* method returns <code>BigDecimal</code>. The default value is false.
*
* @return {@code true} if the parse method returns BigDecimal;
* {@code false} otherwise
* @see #setParseBigDecimal
* @see #setParseBigDecimal
* @since 1.5
* @since 1.5
*/
*/
...
@@ -2626,6 +2658,9 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2626,6 +2658,9 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Sets whether the {@link #parse(java.lang.String, java.text.ParsePosition)}
* Sets whether the {@link #parse(java.lang.String, java.text.ParsePosition)}
* method returns <code>BigDecimal</code>.
* method returns <code>BigDecimal</code>.
*
* @param newValue {@code true} if the parse method returns BigDecimal;
* {@code false} otherwise
* @see #isParseBigDecimal
* @see #isParseBigDecimal
* @since 1.5
* @since 1.5
*/
*/
...
@@ -2712,6 +2747,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2712,6 +2747,8 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Synthesizes a pattern string that represents the current state
* Synthesizes a pattern string that represents the current state
* of this Format object.
* of this Format object.
*
* @return a pattern string
* @see #applyPattern
* @see #applyPattern
*/
*/
public
String
toPattern
()
{
public
String
toPattern
()
{
...
@@ -2721,6 +2758,8 @@ public class DecimalFormat extends NumberFormat {
...
@@ -2721,6 +2758,8 @@ public class DecimalFormat extends NumberFormat {
/**
/**
* Synthesizes a localized pattern string that represents the current
* Synthesizes a localized pattern string that represents the current
* state of this Format object.
* state of this Format object.
*
* @return a localized pattern string
* @see #applyPattern
* @see #applyPattern
*/
*/
public
String
toLocalizedPattern
()
{
public
String
toLocalizedPattern
()
{
...
@@ -3049,7 +3088,7 @@ public class DecimalFormat extends NumberFormat {
...
@@ -3049,7 +3088,7 @@ public class DecimalFormat extends NumberFormat {
* by this routine, since that is the typical end-user desire;
* by this routine, since that is the typical end-user desire;
* use setMaximumInteger if you want to set a real value.
* use setMaximumInteger if you want to set a real value.
* For negative numbers, use a second pattern, separated by a semicolon
* For negative numbers, use a second pattern, separated by a semicolon
* <P>Example <code>"#,#00.0#"</code>
->
1,234.56
* <P>Example <code>"#,#00.0#"</code>
→
1,234.56
* <P>This means a minimum of 2 integer digits, 1 fraction digit, and
* <P>This means a minimum of 2 integer digits, 1 fraction digit, and
* a maximum of 2 fraction digits.
* a maximum of 2 fraction digits.
* <p>Example: <code>"#,#00.0#;(#,#00.0#)"</code> for negatives in
* <p>Example: <code>"#,#00.0#;(#,#00.0#)"</code> for negatives in
...
@@ -3057,6 +3096,7 @@ public class DecimalFormat extends NumberFormat {
...
@@ -3057,6 +3096,7 @@ public class DecimalFormat extends NumberFormat {
* <p>In negative patterns, the minimum and maximum counts are ignored;
* <p>In negative patterns, the minimum and maximum counts are ignored;
* these are presumed to be set in the positive pattern.
* these are presumed to be set in the positive pattern.
*
*
* @param pattern a new pattern
* @exception NullPointerException if <code>pattern</code> is null
* @exception NullPointerException if <code>pattern</code> is null
* @exception IllegalArgumentException if the given pattern is invalid.
* @exception IllegalArgumentException if the given pattern is invalid.
*/
*/
...
@@ -3075,7 +3115,7 @@ public class DecimalFormat extends NumberFormat {
...
@@ -3075,7 +3115,7 @@ public class DecimalFormat extends NumberFormat {
* by this routine, since that is the typical end-user desire;
* by this routine, since that is the typical end-user desire;
* use setMaximumInteger if you want to set a real value.
* use setMaximumInteger if you want to set a real value.
* For negative numbers, use a second pattern, separated by a semicolon
* For negative numbers, use a second pattern, separated by a semicolon
* <P>Example <code>"#,#00.0#"</code>
->
1,234.56
* <P>Example <code>"#,#00.0#"</code>
→
1,234.56
* <P>This means a minimum of 2 integer digits, 1 fraction digit, and
* <P>This means a minimum of 2 integer digits, 1 fraction digit, and
* a maximum of 2 fraction digits.
* a maximum of 2 fraction digits.
* <p>Example: <code>"#,#00.0#;(#,#00.0#)"</code> for negatives in
* <p>Example: <code>"#,#00.0#;(#,#00.0#)"</code> for negatives in
...
@@ -3083,6 +3123,7 @@ public class DecimalFormat extends NumberFormat {
...
@@ -3083,6 +3123,7 @@ public class DecimalFormat extends NumberFormat {
* <p>In negative patterns, the minimum and maximum counts are ignored;
* <p>In negative patterns, the minimum and maximum counts are ignored;
* these are presumed to be set in the positive pattern.
* these are presumed to be set in the positive pattern.
*
*
* @param pattern a new pattern
* @exception NullPointerException if <code>pattern</code> is null
* @exception NullPointerException if <code>pattern</code> is null
* @exception IllegalArgumentException if the given pattern is invalid.
* @exception IllegalArgumentException if the given pattern is invalid.
*/
*/
...
...
src/share/classes/java/text/DecimalFormatSymbols.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -106,6 +106,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -106,6 +106,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* This may return a {@code NumberFormat} instance with the Thai numbering system,
* This may return a {@code NumberFormat} instance with the Thai numbering system,
* instead of the Latin numbering system.
* instead of the Latin numbering system.
*
*
* @param locale the desired locale
* @exception NullPointerException if <code>locale</code> is null
* @exception NullPointerException if <code>locale</code> is null
*/
*/
public
DecimalFormatSymbols
(
Locale
locale
)
{
public
DecimalFormatSymbols
(
Locale
locale
)
{
...
@@ -122,7 +123,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -122,7 +123,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* implementations. It must contain at least a <code>Locale</code>
* implementations. It must contain at least a <code>Locale</code>
* instance equal to {@link java.util.Locale#US Locale.US}.
* instance equal to {@link java.util.Locale#US Locale.US}.
*
*
* @return
A
n array of locales for which localized
* @return
a
n array of locales for which localized
* <code>DecimalFormatSymbols</code> instances are available.
* <code>DecimalFormatSymbols</code> instances are available.
* @since 1.6
* @since 1.6
*/
*/
...
@@ -166,6 +167,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -166,6 +167,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* </pre>
* </pre>
* This may return a {@code NumberFormat} instance with the Thai numbering system,
* This may return a {@code NumberFormat} instance with the Thai numbering system,
* instead of the Latin numbering system.
* instead of the Latin numbering system.
*
* @param locale the desired locale.
* @param locale the desired locale.
* @return a <code>DecimalFormatSymbols</code> instance.
* @return a <code>DecimalFormatSymbols</code> instance.
* @exception NullPointerException if <code>locale</code> is null
* @exception NullPointerException if <code>locale</code> is null
...
@@ -185,6 +187,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -185,6 +187,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Gets the character used for zero. Different for Arabic, etc.
* Gets the character used for zero. Different for Arabic, etc.
*
* @return the character used for zero
*/
*/
public
char
getZeroDigit
()
{
public
char
getZeroDigit
()
{
return
zeroDigit
;
return
zeroDigit
;
...
@@ -192,6 +196,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -192,6 +196,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Sets the character used for zero. Different for Arabic, etc.
* Sets the character used for zero. Different for Arabic, etc.
*
* @param zeroDigit the character used for zero
*/
*/
public
void
setZeroDigit
(
char
zeroDigit
)
{
public
void
setZeroDigit
(
char
zeroDigit
)
{
this
.
zeroDigit
=
zeroDigit
;
this
.
zeroDigit
=
zeroDigit
;
...
@@ -199,6 +205,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -199,6 +205,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Gets the character used for thousands separator. Different for French, etc.
* Gets the character used for thousands separator. Different for French, etc.
*
* @return the grouping separator
*/
*/
public
char
getGroupingSeparator
()
{
public
char
getGroupingSeparator
()
{
return
groupingSeparator
;
return
groupingSeparator
;
...
@@ -206,6 +214,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -206,6 +214,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Sets the character used for thousands separator. Different for French, etc.
* Sets the character used for thousands separator. Different for French, etc.
*
* @param groupingSeparator the grouping separator
*/
*/
public
void
setGroupingSeparator
(
char
groupingSeparator
)
{
public
void
setGroupingSeparator
(
char
groupingSeparator
)
{
this
.
groupingSeparator
=
groupingSeparator
;
this
.
groupingSeparator
=
groupingSeparator
;
...
@@ -213,6 +223,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -213,6 +223,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Gets the character used for decimal sign. Different for French, etc.
* Gets the character used for decimal sign. Different for French, etc.
*
* @return the character used for decimal sign
*/
*/
public
char
getDecimalSeparator
()
{
public
char
getDecimalSeparator
()
{
return
decimalSeparator
;
return
decimalSeparator
;
...
@@ -220,6 +232,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -220,6 +232,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Sets the character used for decimal sign. Different for French, etc.
* Sets the character used for decimal sign. Different for French, etc.
*
* @param decimalSeparator the character used for decimal sign
*/
*/
public
void
setDecimalSeparator
(
char
decimalSeparator
)
{
public
void
setDecimalSeparator
(
char
decimalSeparator
)
{
this
.
decimalSeparator
=
decimalSeparator
;
this
.
decimalSeparator
=
decimalSeparator
;
...
@@ -227,6 +241,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -227,6 +241,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Gets the character used for per mille sign. Different for Arabic, etc.
* Gets the character used for per mille sign. Different for Arabic, etc.
*
* @return the character used for per mille sign
*/
*/
public
char
getPerMill
()
{
public
char
getPerMill
()
{
return
perMill
;
return
perMill
;
...
@@ -234,6 +250,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -234,6 +250,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Sets the character used for per mille sign. Different for Arabic, etc.
* Sets the character used for per mille sign. Different for Arabic, etc.
*
* @param perMill the character used for per mille sign
*/
*/
public
void
setPerMill
(
char
perMill
)
{
public
void
setPerMill
(
char
perMill
)
{
this
.
perMill
=
perMill
;
this
.
perMill
=
perMill
;
...
@@ -241,6 +259,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -241,6 +259,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Gets the character used for percent sign. Different for Arabic, etc.
* Gets the character used for percent sign. Different for Arabic, etc.
*
* @return the character used for percent sign
*/
*/
public
char
getPercent
()
{
public
char
getPercent
()
{
return
percent
;
return
percent
;
...
@@ -248,6 +268,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -248,6 +268,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Sets the character used for percent sign. Different for Arabic, etc.
* Sets the character used for percent sign. Different for Arabic, etc.
*
* @param percent the character used for percent sign
*/
*/
public
void
setPercent
(
char
percent
)
{
public
void
setPercent
(
char
percent
)
{
this
.
percent
=
percent
;
this
.
percent
=
percent
;
...
@@ -255,6 +277,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -255,6 +277,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Gets the character used for a digit in a pattern.
* Gets the character used for a digit in a pattern.
*
* @return the character used for a digit in a pattern
*/
*/
public
char
getDigit
()
{
public
char
getDigit
()
{
return
digit
;
return
digit
;
...
@@ -262,6 +286,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -262,6 +286,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Sets the character used for a digit in a pattern.
* Sets the character used for a digit in a pattern.
*
* @param digit the character used for a digit in a pattern
*/
*/
public
void
setDigit
(
char
digit
)
{
public
void
setDigit
(
char
digit
)
{
this
.
digit
=
digit
;
this
.
digit
=
digit
;
...
@@ -270,6 +296,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -270,6 +296,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Gets the character used to separate positive and negative subpatterns
* Gets the character used to separate positive and negative subpatterns
* in a pattern.
* in a pattern.
*
* @return the pattern separator
*/
*/
public
char
getPatternSeparator
()
{
public
char
getPatternSeparator
()
{
return
patternSeparator
;
return
patternSeparator
;
...
@@ -278,6 +306,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -278,6 +306,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Sets the character used to separate positive and negative subpatterns
* Sets the character used to separate positive and negative subpatterns
* in a pattern.
* in a pattern.
*
* @param patternSeparator the pattern separator
*/
*/
public
void
setPatternSeparator
(
char
patternSeparator
)
{
public
void
setPatternSeparator
(
char
patternSeparator
)
{
this
.
patternSeparator
=
patternSeparator
;
this
.
patternSeparator
=
patternSeparator
;
...
@@ -286,6 +316,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -286,6 +316,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Gets the string used to represent infinity. Almost always left
* Gets the string used to represent infinity. Almost always left
* unchanged.
* unchanged.
*
* @return the string representing infinity
*/
*/
public
String
getInfinity
()
{
public
String
getInfinity
()
{
return
infinity
;
return
infinity
;
...
@@ -294,6 +326,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -294,6 +326,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Sets the string used to represent infinity. Almost always left
* Sets the string used to represent infinity. Almost always left
* unchanged.
* unchanged.
*
* @param infinity the string representing infinity
*/
*/
public
void
setInfinity
(
String
infinity
)
{
public
void
setInfinity
(
String
infinity
)
{
this
.
infinity
=
infinity
;
this
.
infinity
=
infinity
;
...
@@ -302,6 +336,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -302,6 +336,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Gets the string used to represent "not a number". Almost always left
* Gets the string used to represent "not a number". Almost always left
* unchanged.
* unchanged.
*
* @return the string representing "not a number"
*/
*/
public
String
getNaN
()
{
public
String
getNaN
()
{
return
NaN
;
return
NaN
;
...
@@ -310,6 +346,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -310,6 +346,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Sets the string used to represent "not a number". Almost always left
* Sets the string used to represent "not a number". Almost always left
* unchanged.
* unchanged.
*
* @param NaN the string representing "not a number"
*/
*/
public
void
setNaN
(
String
NaN
)
{
public
void
setNaN
(
String
NaN
)
{
this
.
NaN
=
NaN
;
this
.
NaN
=
NaN
;
...
@@ -319,6 +357,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -319,6 +357,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* Gets the character used to represent minus sign. If no explicit
* Gets the character used to represent minus sign. If no explicit
* negative format is specified, one is formed by prefixing
* negative format is specified, one is formed by prefixing
* minusSign to the positive format.
* minusSign to the positive format.
*
* @return the character representing minus sign
*/
*/
public
char
getMinusSign
()
{
public
char
getMinusSign
()
{
return
minusSign
;
return
minusSign
;
...
@@ -328,6 +368,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -328,6 +368,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* Sets the character used to represent minus sign. If no explicit
* Sets the character used to represent minus sign. If no explicit
* negative format is specified, one is formed by prefixing
* negative format is specified, one is formed by prefixing
* minusSign to the positive format.
* minusSign to the positive format.
*
* @param minusSign the character representing minus sign
*/
*/
public
void
setMinusSign
(
char
minusSign
)
{
public
void
setMinusSign
(
char
minusSign
)
{
this
.
minusSign
=
minusSign
;
this
.
minusSign
=
minusSign
;
...
@@ -336,6 +378,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -336,6 +378,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Returns the currency symbol for the currency of these
* Returns the currency symbol for the currency of these
* DecimalFormatSymbols in their locale.
* DecimalFormatSymbols in their locale.
*
* @return the currency symbol
* @since 1.2
* @since 1.2
*/
*/
public
String
getCurrencySymbol
()
public
String
getCurrencySymbol
()
...
@@ -346,6 +390,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -346,6 +390,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Sets the currency symbol for the currency of these
* Sets the currency symbol for the currency of these
* DecimalFormatSymbols in their locale.
* DecimalFormatSymbols in their locale.
*
* @param currency the currency symbol
* @since 1.2
* @since 1.2
*/
*/
public
void
setCurrencySymbol
(
String
currency
)
public
void
setCurrencySymbol
(
String
currency
)
...
@@ -356,6 +402,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -356,6 +402,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Returns the ISO 4217 currency code of the currency of these
* Returns the ISO 4217 currency code of the currency of these
* DecimalFormatSymbols.
* DecimalFormatSymbols.
*
* @return the currency code
* @since 1.2
* @since 1.2
*/
*/
public
String
getInternationalCurrencySymbol
()
public
String
getInternationalCurrencySymbol
()
...
@@ -374,6 +422,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -374,6 +422,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* then the currency attribute is set to null and the currency symbol
* then the currency attribute is set to null and the currency symbol
* attribute is not modified.
* attribute is not modified.
*
*
* @param currencyCode the currency code
* @see #setCurrency
* @see #setCurrency
* @see #setCurrencySymbol
* @see #setCurrencySymbol
* @since 1.2
* @since 1.2
...
@@ -427,6 +476,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -427,6 +476,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Returns the monetary decimal separator.
* Returns the monetary decimal separator.
*
* @return the monetary decimal separator
* @since 1.2
* @since 1.2
*/
*/
public
char
getMonetaryDecimalSeparator
()
public
char
getMonetaryDecimalSeparator
()
...
@@ -436,6 +487,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
...
@@ -436,6 +487,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
/**
* Sets the monetary decimal separator.
* Sets the monetary decimal separator.
*
* @param sep the monetary decimal separator
* @since 1.2
* @since 1.2
*/
*/
public
void
setMonetaryDecimalSeparator
(
char
sep
)
public
void
setMonetaryDecimalSeparator
(
char
sep
)
...
...
src/share/classes/java/text/FieldPosition.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 20
02
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -100,6 +100,7 @@ public class FieldPosition {
...
@@ -100,6 +100,7 @@ public class FieldPosition {
* identified by constants, whose names typically end with _FIELD,
* identified by constants, whose names typically end with _FIELD,
* in the various subclasses of Format.
* in the various subclasses of Format.
*
*
* @param field the field identifier
* @see java.text.NumberFormat#INTEGER_FIELD
* @see java.text.NumberFormat#INTEGER_FIELD
* @see java.text.NumberFormat#FRACTION_FIELD
* @see java.text.NumberFormat#FRACTION_FIELD
* @see java.text.DateFormat#YEAR_FIELD
* @see java.text.DateFormat#YEAR_FIELD
...
@@ -157,6 +158,8 @@ public class FieldPosition {
...
@@ -157,6 +158,8 @@ public class FieldPosition {
/**
/**
* Retrieves the field identifier.
* Retrieves the field identifier.
*
* @return the field identifier
*/
*/
public
int
getField
()
{
public
int
getField
()
{
return
field
;
return
field
;
...
@@ -164,6 +167,8 @@ public class FieldPosition {
...
@@ -164,6 +167,8 @@ public class FieldPosition {
/**
/**
* Retrieves the index of the first character in the requested field.
* Retrieves the index of the first character in the requested field.
*
* @return the begin index
*/
*/
public
int
getBeginIndex
()
{
public
int
getBeginIndex
()
{
return
beginIndex
;
return
beginIndex
;
...
@@ -172,6 +177,8 @@ public class FieldPosition {
...
@@ -172,6 +177,8 @@ public class FieldPosition {
/**
/**
* Retrieves the index of the character following the last character in the
* Retrieves the index of the character following the last character in the
* requested field.
* requested field.
*
* @return the end index
*/
*/
public
int
getEndIndex
()
{
public
int
getEndIndex
()
{
return
endIndex
;
return
endIndex
;
...
@@ -179,6 +186,8 @@ public class FieldPosition {
...
@@ -179,6 +186,8 @@ public class FieldPosition {
/**
/**
* Sets the begin index. For use by subclasses of Format.
* Sets the begin index. For use by subclasses of Format.
*
* @param bi the begin index
* @since 1.2
* @since 1.2
*/
*/
public
void
setBeginIndex
(
int
bi
)
{
public
void
setBeginIndex
(
int
bi
)
{
...
@@ -187,6 +196,8 @@ public class FieldPosition {
...
@@ -187,6 +196,8 @@ public class FieldPosition {
/**
/**
* Sets the end index. For use by subclasses of Format.
* Sets the end index. For use by subclasses of Format.
*
* @param ei the end index
* @since 1.2
* @since 1.2
*/
*/
public
void
setEndIndex
(
int
ei
)
{
public
void
setEndIndex
(
int
ei
)
{
...
...
src/share/classes/java/text/Format.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -58,7 +58,7 @@ import java.io.Serializable;
...
@@ -58,7 +58,7 @@ import java.io.Serializable;
* no separator in between, and in this case the <code>parseObject</code> could
* no separator in between, and in this case the <code>parseObject</code> could
* not tell which digits belong to which number.
* not tell which digits belong to which number.
*
*
* <h
4>Subclassing</h4
>
* <h
3>Subclassing</h3
>
*
*
* <p>
* <p>
* The Java Platform provides three specialized subclasses of <code>Format</code>--
* The Java Platform provides three specialized subclasses of <code>Format</code>--
...
...
src/share/classes/java/text/MessageFormat.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -68,7 +68,7 @@ import java.util.Locale;
...
@@ -68,7 +68,7 @@ import java.util.Locale;
* behavior is defined by the pattern that you provide as well as the
* behavior is defined by the pattern that you provide as well as the
* subformats used for inserted arguments.
* subformats used for inserted arguments.
*
*
* <h
4><a name="patterns">Patterns and Their Interpretation</a></h4
>
* <h
3><a name="patterns">Patterns and Their Interpretation</a></h3
>
*
*
* <code>MessageFormat</code> uses patterns of the following form:
* <code>MessageFormat</code> uses patterns of the following form:
* <blockquote><pre>
* <blockquote><pre>
...
@@ -287,10 +287,10 @@ import java.util.Locale;
...
@@ -287,10 +287,10 @@ import java.util.Locale;
* You can create the <code>ChoiceFormat</code> programmatically, as in the
* You can create the <code>ChoiceFormat</code> programmatically, as in the
* above example, or by using a pattern. See {@link ChoiceFormat}
* above example, or by using a pattern. See {@link ChoiceFormat}
* for more information.
* for more information.
* <blockquote><pre>
* <blockquote><pre>
{@code
* form.applyPattern(
* form.applyPattern(
* "There {0,choice,0#are no files|1#is one file|1
<
are {0,number,integer} files}.");
* "There {0,choice,0#are no files|1#is one file|1
<
are {0,number,integer} files}.");
* </pre></blockquote>
*
}
</pre></blockquote>
*
*
* <p>
* <p>
* <strong>Note:</strong> As we see above, the string produced
* <strong>Note:</strong> As we see above, the string produced
...
@@ -778,7 +778,7 @@ public class MessageFormat extends Format {
...
@@ -778,7 +778,7 @@ public class MessageFormat extends Format {
* <tr>
* <tr>
* <td><code>instanceof ChoiceFormat</code>
* <td><code>instanceof ChoiceFormat</code>
* <td><i>any</i>
* <td><i>any</i>
* <td><code>subformat.format(argument).indexOf('{')
>
= 0 ?<br>
* <td><code>subformat.format(argument).indexOf('{')
>
= 0 ?<br>
* (new MessageFormat(subformat.format(argument), getLocale())).format(argument) :
* (new MessageFormat(subformat.format(argument), getLocale())).format(argument) :
* subformat.format(argument)</code>
* subformat.format(argument)</code>
* <tr>
* <tr>
...
@@ -811,6 +811,8 @@ public class MessageFormat extends Format {
...
@@ -811,6 +811,8 @@ public class MessageFormat extends Format {
* @param result where text is appended.
* @param result where text is appended.
* @param pos On input: an alignment field, if desired.
* @param pos On input: an alignment field, if desired.
* On output: the offsets of the alignment field.
* On output: the offsets of the alignment field.
* @return the string buffer passed in as {@code result}, with formatted
* text appended
* @exception IllegalArgumentException if an argument in the
* @exception IllegalArgumentException if an argument in the
* <code>arguments</code> array is not of the type
* <code>arguments</code> array is not of the type
* expected by the format element(s) that use it.
* expected by the format element(s) that use it.
...
@@ -828,6 +830,9 @@ public class MessageFormat extends Format {
...
@@ -828,6 +830,9 @@ public class MessageFormat extends Format {
* <code>(new {@link #MessageFormat(String) MessageFormat}(pattern)).{@link #format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition) format}(arguments, new StringBuffer(), null).toString()</code>
* <code>(new {@link #MessageFormat(String) MessageFormat}(pattern)).{@link #format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition) format}(arguments, new StringBuffer(), null).toString()</code>
* </blockquote>
* </blockquote>
*
*
* @param pattern the pattern string
* @param arguments object(s) to format
* @return the formatted string
* @exception IllegalArgumentException if the pattern is invalid,
* @exception IllegalArgumentException if the pattern is invalid,
* or if an argument in the <code>arguments</code> array
* or if an argument in the <code>arguments</code> array
* is not of the type expected by the format element(s)
* is not of the type expected by the format element(s)
...
@@ -940,6 +945,10 @@ public class MessageFormat extends Format {
...
@@ -940,6 +945,10 @@ public class MessageFormat extends Format {
* is comparing against the pattern "AAD {0} BBB", the error index is
* is comparing against the pattern "AAD {0} BBB", the error index is
* 0. When an error occurs, the call to this method will return null.
* 0. When an error occurs, the call to this method will return null.
* If the source is null, return an empty array.
* If the source is null, return an empty array.
*
* @param source the string to parse
* @param pos the parse position
* @return an array of parsed objects
*/
*/
public
Object
[]
parse
(
String
source
,
ParsePosition
pos
)
{
public
Object
[]
parse
(
String
source
,
ParsePosition
pos
)
{
if
(
source
==
null
)
{
if
(
source
==
null
)
{
...
...
src/share/classes/java/text/Normalizer.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 2005, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -55,14 +55,12 @@ import sun.text.normalizer.NormalizerImpl;
...
@@ -55,14 +55,12 @@ import sun.text.normalizer.NormalizerImpl;
*
*
* <p><pre>
* <p><pre>
* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE</pre>
* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE</pre>
* </p>
*
*
* or as two separate characters (the "decomposed" form):
* or as two separate characters (the "decomposed" form):
*
*
* <p><pre>
* <p><pre>
* U+0041 LATIN CAPITAL LETTER A
* U+0041 LATIN CAPITAL LETTER A
* U+0301 COMBINING ACUTE ACCENT</pre>
* U+0301 COMBINING ACUTE ACCENT</pre>
* </p>
*
*
* To a user of your program, however, both of these sequences should be
* To a user of your program, however, both of these sequences should be
* treated as the same "user-level" character "A with acute accent". When you
* treated as the same "user-level" character "A with acute accent". When you
...
@@ -78,13 +76,11 @@ import sun.text.normalizer.NormalizerImpl;
...
@@ -78,13 +76,11 @@ import sun.text.normalizer.NormalizerImpl;
* U+0066 LATIN SMALL LETTER F
* U+0066 LATIN SMALL LETTER F
* U+0066 LATIN SMALL LETTER F
* U+0066 LATIN SMALL LETTER F
* U+0069 LATIN SMALL LETTER I</pre>
* U+0069 LATIN SMALL LETTER I</pre>
* </p>
*
*
* or as the single character
* or as the single character
*
*
* <p><pre>
* <p><pre>
* U+FB03 LATIN SMALL LIGATURE FFI</pre>
* U+FB03 LATIN SMALL LIGATURE FFI</pre>
* </p>
*
*
* The ffi ligature is not a distinct semantic character, and strictly speaking
* The ffi ligature is not a distinct semantic character, and strictly speaking
* it shouldn't be in Unicode at all, but it was included for compatibility
* it shouldn't be in Unicode at all, but it was included for compatibility
...
...
src/share/classes/java/text/NumberFormat.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -73,34 +73,34 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
...
@@ -73,34 +73,34 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
* To format a number for the current Locale, use one of the factory
* To format a number for the current Locale, use one of the factory
* class methods:
* class methods:
* <blockquote>
* <blockquote>
* <pre>
* <pre>
{@code
*
myString = NumberFormat.getInstance().format(myNumber);
* myString = NumberFormat.getInstance().format(myNumber);
* </pre>
*
}
</pre>
* </blockquote>
* </blockquote>
* If you are formatting multiple numbers, it is
* If you are formatting multiple numbers, it is
* more efficient to get the format and use it multiple times so that
* more efficient to get the format and use it multiple times so that
* the system doesn't have to fetch the information about the local
* the system doesn't have to fetch the information about the local
* language and country conventions multiple times.
* language and country conventions multiple times.
* <blockquote>
* <blockquote>
* <pre>
* <pre>
{@code
* NumberFormat nf = NumberFormat.getInstance();
* NumberFormat nf = NumberFormat.getInstance();
* for (int i = 0; i < myNumber.length; ++i) {
* for (int i = 0; i < myNumber.length; ++i) {
* output.println(nf.format(myNumber[i]) + "; ");
* output.println(nf.format(myNumber[i]) + "; ");
* }
* }
* </pre>
*
}
</pre>
* </blockquote>
* </blockquote>
* To format a number for a different Locale, specify it in the
* To format a number for a different Locale, specify it in the
* call to <code>getInstance</code>.
* call to <code>getInstance</code>.
* <blockquote>
* <blockquote>
* <pre>
* <pre>
{@code
* NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);
* NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);
* </pre>
*
}
</pre>
* </blockquote>
* </blockquote>
* You can also use a <code>NumberFormat</code> to parse numbers:
* You can also use a <code>NumberFormat</code> to parse numbers:
* <blockquote>
* <blockquote>
* <pre>
* <pre>
{@code
* myNumber = nf.parse(myString);
* myNumber = nf.parse(myString);
* </pre>
*
}
</pre>
* </blockquote>
* </blockquote>
* Use <code>getInstance</code> or <code>getNumberInstance</code> to get the
* Use <code>getInstance</code> or <code>getNumberInstance</code> to get the
* normal number format. Use <code>getIntegerInstance</code> to get an
* normal number format. Use <code>getIntegerInstance</code> to get an
...
@@ -125,8 +125,8 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
...
@@ -125,8 +125,8 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
* the detailed description for each these control methods,
* the detailed description for each these control methods,
* <p>
* <p>
* setParseIntegerOnly : only affects parsing, e.g.
* setParseIntegerOnly : only affects parsing, e.g.
* if true, "3456.78"
->
3456 (and leaves the parse position just after index 6)
* if true, "3456.78"
→
3456 (and leaves the parse position just after index 6)
* if false, "3456.78"
->
3456.78 (and leaves the parse position just after index 8)
* if false, "3456.78"
→
3456.78 (and leaves the parse position just after index 8)
* This is independent of formatting. If you want to not show a decimal point
* This is independent of formatting. If you want to not show a decimal point
* where there might be no digits after the decimal point, use
* where there might be no digits after the decimal point, use
* setDecimalSeparatorAlwaysShown.
* setDecimalSeparatorAlwaysShown.
...
@@ -134,8 +134,8 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
...
@@ -134,8 +134,8 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
* setDecimalSeparatorAlwaysShown : only affects formatting, and only where
* setDecimalSeparatorAlwaysShown : only affects formatting, and only where
* there might be no digits after the decimal point, such as with a pattern
* there might be no digits after the decimal point, such as with a pattern
* like "#,##0.##", e.g.,
* like "#,##0.##", e.g.,
* if true, 3456.00
->
"3,456."
* if true, 3456.00
→
"3,456."
* if false, 3456.00
->
"3456"
* if false, 3456.00
→
"3456"
* This is independent of parsing. If you want parsing to stop at the decimal
* This is independent of parsing. If you want parsing to stop at the decimal
* point, use setParseIntegerOnly.
* point, use setParseIntegerOnly.
*
*
...
@@ -166,7 +166,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
...
@@ -166,7 +166,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
* numbers: "(12)" for -12.
* numbers: "(12)" for -12.
* </ol>
* </ol>
*
*
* <h
4><a name="synchronization">Synchronization</a></h4
>
* <h
3><a name="synchronization">Synchronization</a></h3
>
*
*
* <p>
* <p>
* Number formats are generally not synchronized.
* Number formats are generally not synchronized.
...
@@ -280,6 +280,9 @@ public abstract class NumberFormat extends Format {
...
@@ -280,6 +280,9 @@ public abstract class NumberFormat extends Format {
/**
/**
* Specialization of format.
* Specialization of format.
*
* @param number the double number to format
* @return the formatted String
* @exception ArithmeticException if rounding is needed with rounding
* @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.Format#format
* @see java.text.Format#format
...
@@ -302,6 +305,9 @@ public abstract class NumberFormat extends Format {
...
@@ -302,6 +305,9 @@ public abstract class NumberFormat extends Format {
/**
/**
* Specialization of format.
* Specialization of format.
*
* @param number the long number to format
* @return the formatted String
* @exception ArithmeticException if rounding is needed with rounding
* @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.Format#format
* @see java.text.Format#format
...
@@ -313,6 +319,12 @@ public abstract class NumberFormat extends Format {
...
@@ -313,6 +319,12 @@ public abstract class NumberFormat extends Format {
/**
/**
* Specialization of format.
* Specialization of format.
*
* @param number the double number to format
* @param toAppendTo the StringBuffer to which the formatted text is to be
* appended
* @param pos the field position
* @return the formatted StringBuffer
* @exception ArithmeticException if rounding is needed with rounding
* @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.Format#format
* @see java.text.Format#format
...
@@ -323,6 +335,12 @@ public abstract class NumberFormat extends Format {
...
@@ -323,6 +335,12 @@ public abstract class NumberFormat extends Format {
/**
/**
* Specialization of format.
* Specialization of format.
*
* @param number the long number to format
* @param toAppendTo the StringBuffer to which the formatted text is to be
* appended
* @param pos the field position
* @return the formatted StringBuffer
* @exception ArithmeticException if rounding is needed with rounding
* @exception ArithmeticException if rounding is needed with rounding
* mode being set to RoundingMode.UNNECESSARY
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.Format#format
* @see java.text.Format#format
...
@@ -339,6 +357,10 @@ public abstract class NumberFormat extends Format {
...
@@ -339,6 +357,10 @@ public abstract class NumberFormat extends Format {
* after the 1).
* after the 1).
* Does not throw an exception; if no object can be parsed, index is
* Does not throw an exception; if no object can be parsed, index is
* unchanged!
* unchanged!
*
* @param source the String to parse
* @param parsePosition the parse position
* @return the parsed value
* @see java.text.NumberFormat#isParseIntegerOnly
* @see java.text.NumberFormat#isParseIntegerOnly
* @see java.text.Format#parseObject
* @see java.text.Format#parseObject
*/
*/
...
@@ -373,6 +395,9 @@ public abstract class NumberFormat extends Format {
...
@@ -373,6 +395,9 @@ public abstract class NumberFormat extends Format {
* would stop at the "." character. Of course, the exact format accepted
* would stop at the "." character. Of course, the exact format accepted
* by the parse operation is locale dependant and determined by sub-classes
* by the parse operation is locale dependant and determined by sub-classes
* of NumberFormat.
* of NumberFormat.
*
* @return {@code true} if numbers should be parsed as integers only;
* {@code false} otherwise
*/
*/
public
boolean
isParseIntegerOnly
()
{
public
boolean
isParseIntegerOnly
()
{
return
parseIntegerOnly
;
return
parseIntegerOnly
;
...
@@ -380,6 +405,9 @@ public abstract class NumberFormat extends Format {
...
@@ -380,6 +405,9 @@ public abstract class NumberFormat extends Format {
/**
/**
* Sets whether or not numbers should be parsed as integers only.
* Sets whether or not numbers should be parsed as integers only.
*
* @param value {@code true} if numbers should be parsed as integers only;
* {@code false} otherwise
* @see #isParseIntegerOnly
* @see #isParseIntegerOnly
*/
*/
public
void
setParseIntegerOnly
(
boolean
value
)
{
public
void
setParseIntegerOnly
(
boolean
value
)
{
...
@@ -393,6 +421,9 @@ public abstract class NumberFormat extends Format {
...
@@ -393,6 +421,9 @@ public abstract class NumberFormat extends Format {
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* {@link java.util.Locale.Category#FORMAT FORMAT} locale.
* This is the same as calling
* This is the same as calling
* {@link #getNumberInstance() getNumberInstance()}.
* {@link #getNumberInstance() getNumberInstance()}.
*
* @return the {@code NumberFormat} instance for general-purpose number
* formatting
*/
*/
public
final
static
NumberFormat
getInstance
()
{
public
final
static
NumberFormat
getInstance
()
{
return
getInstance
(
Locale
.
getDefault
(
Locale
.
Category
.
FORMAT
),
NUMBERSTYLE
);
return
getInstance
(
Locale
.
getDefault
(
Locale
.
Category
.
FORMAT
),
NUMBERSTYLE
);
...
@@ -402,6 +433,10 @@ public abstract class NumberFormat extends Format {
...
@@ -402,6 +433,10 @@ public abstract class NumberFormat extends Format {
* Returns a general-purpose number format for the specified locale.
* Returns a general-purpose number format for the specified locale.
* This is the same as calling
* This is the same as calling
* {@link #getNumberInstance(java.util.Locale) getNumberInstance(inLocale)}.
* {@link #getNumberInstance(java.util.Locale) getNumberInstance(inLocale)}.
*
* @param inLocale the desired locale
* @return the {@code NumberFormat} instance for general-purpose number
* formatting
*/
*/
public
static
NumberFormat
getInstance
(
Locale
inLocale
)
{
public
static
NumberFormat
getInstance
(
Locale
inLocale
)
{
return
getInstance
(
inLocale
,
NUMBERSTYLE
);
return
getInstance
(
inLocale
,
NUMBERSTYLE
);
...
@@ -413,6 +448,9 @@ public abstract class NumberFormat extends Format {
...
@@ -413,6 +448,9 @@ public abstract class NumberFormat extends Format {
* <p>This is equivalent to calling
* <p>This is equivalent to calling
* {@link #getNumberInstance(Locale)
* {@link #getNumberInstance(Locale)
* getNumberInstance(Locale.getDefault(Locale.Category.FORMAT))}.
* getNumberInstance(Locale.getDefault(Locale.Category.FORMAT))}.
*
* @return the {@code NumberFormat} instance for general-purpose number
* formatting
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @see java.util.Locale.Category#FORMAT
*/
*/
...
@@ -422,6 +460,10 @@ public abstract class NumberFormat extends Format {
...
@@ -422,6 +460,10 @@ public abstract class NumberFormat extends Format {
/**
/**
* Returns a general-purpose number format for the specified locale.
* Returns a general-purpose number format for the specified locale.
*
* @param inLocale the desired locale
* @return the {@code NumberFormat} instance for general-purpose number
* formatting
*/
*/
public
static
NumberFormat
getNumberInstance
(
Locale
inLocale
)
{
public
static
NumberFormat
getNumberInstance
(
Locale
inLocale
)
{
return
getInstance
(
inLocale
,
NUMBERSTYLE
);
return
getInstance
(
inLocale
,
NUMBERSTYLE
);
...
@@ -457,6 +499,7 @@ public abstract class NumberFormat extends Format {
...
@@ -457,6 +499,7 @@ public abstract class NumberFormat extends Format {
* and to parse only the integer part of an input string (see {@link
* and to parse only the integer part of an input string (see {@link
* #isParseIntegerOnly isParseIntegerOnly}).
* #isParseIntegerOnly isParseIntegerOnly}).
*
*
* @param inLocale the desired locale
* @see #getRoundingMode()
* @see #getRoundingMode()
* @return a number format for integer values
* @return a number format for integer values
* @since 1.4
* @since 1.4
...
@@ -472,6 +515,7 @@ public abstract class NumberFormat extends Format {
...
@@ -472,6 +515,7 @@ public abstract class NumberFormat extends Format {
* {@link #getCurrencyInstance(Locale)
* {@link #getCurrencyInstance(Locale)
* getCurrencyInstance(Locale.getDefault(Locale.Category.FORMAT))}.
* getCurrencyInstance(Locale.getDefault(Locale.Category.FORMAT))}.
*
*
* @return the {@code NumberFormat} instance for currency formatting
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @see java.util.Locale.Category#FORMAT
*/
*/
...
@@ -481,6 +525,9 @@ public abstract class NumberFormat extends Format {
...
@@ -481,6 +525,9 @@ public abstract class NumberFormat extends Format {
/**
/**
* Returns a currency format for the specified locale.
* Returns a currency format for the specified locale.
*
* @param inLocale the desired locale
* @return the {@code NumberFormat} instance for currency formatting
*/
*/
public
static
NumberFormat
getCurrencyInstance
(
Locale
inLocale
)
{
public
static
NumberFormat
getCurrencyInstance
(
Locale
inLocale
)
{
return
getInstance
(
inLocale
,
CURRENCYSTYLE
);
return
getInstance
(
inLocale
,
CURRENCYSTYLE
);
...
@@ -493,6 +540,7 @@ public abstract class NumberFormat extends Format {
...
@@ -493,6 +540,7 @@ public abstract class NumberFormat extends Format {
* {@link #getPercentInstance(Locale)
* {@link #getPercentInstance(Locale)
* getPercentInstance(Locale.getDefault(Locale.Category.FORMAT))}.
* getPercentInstance(Locale.getDefault(Locale.Category.FORMAT))}.
*
*
* @return the {@code NumberFormat} instance for percentage formatting
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale#getDefault(java.util.Locale.Category)
* @see java.util.Locale.Category#FORMAT
* @see java.util.Locale.Category#FORMAT
*/
*/
...
@@ -502,6 +550,9 @@ public abstract class NumberFormat extends Format {
...
@@ -502,6 +550,9 @@ public abstract class NumberFormat extends Format {
/**
/**
* Returns a percentage format for the specified locale.
* Returns a percentage format for the specified locale.
*
* @param inLocale the desired locale
* @return the {@code NumberFormat} instance for percentage formatting
*/
*/
public
static
NumberFormat
getPercentInstance
(
Locale
inLocale
)
{
public
static
NumberFormat
getPercentInstance
(
Locale
inLocale
)
{
return
getInstance
(
inLocale
,
PERCENTSTYLE
);
return
getInstance
(
inLocale
,
PERCENTSTYLE
);
...
@@ -516,6 +567,8 @@ public abstract class NumberFormat extends Format {
...
@@ -516,6 +567,8 @@ public abstract class NumberFormat extends Format {
/**
/**
* Returns a scientific format for the specified locale.
* Returns a scientific format for the specified locale.
*
* @param inLocale the desired locale
*/
*/
/*public*/
static
NumberFormat
getScientificInstance
(
Locale
inLocale
)
{
/*public*/
static
NumberFormat
getScientificInstance
(
Locale
inLocale
)
{
return
getInstance
(
inLocale
,
SCIENTIFICSTYLE
);
return
getInstance
(
inLocale
,
SCIENTIFICSTYLE
);
...
@@ -586,6 +639,9 @@ public abstract class NumberFormat extends Format {
...
@@ -586,6 +639,9 @@ public abstract class NumberFormat extends Format {
* English locale, with grouping on, the number 1234567 might be formatted
* English locale, with grouping on, the number 1234567 might be formatted
* as "1,234,567". The grouping separator as well as the size of each group
* as "1,234,567". The grouping separator as well as the size of each group
* is locale dependant and is determined by sub-classes of NumberFormat.
* is locale dependant and is determined by sub-classes of NumberFormat.
*
* @return {@code true} if grouping is used;
* {@code false} otherwise
* @see #setGroupingUsed
* @see #setGroupingUsed
*/
*/
public
boolean
isGroupingUsed
()
{
public
boolean
isGroupingUsed
()
{
...
@@ -594,6 +650,9 @@ public abstract class NumberFormat extends Format {
...
@@ -594,6 +650,9 @@ public abstract class NumberFormat extends Format {
/**
/**
* Set whether or not grouping will be used in this format.
* Set whether or not grouping will be used in this format.
*
* @param newValue {@code true} if grouping is used;
* {@code false} otherwise
* @see #isGroupingUsed
* @see #isGroupingUsed
*/
*/
public
void
setGroupingUsed
(
boolean
newValue
)
{
public
void
setGroupingUsed
(
boolean
newValue
)
{
...
@@ -603,6 +662,8 @@ public abstract class NumberFormat extends Format {
...
@@ -603,6 +662,8 @@ public abstract class NumberFormat extends Format {
/**
/**
* Returns the maximum number of digits allowed in the integer portion of a
* Returns the maximum number of digits allowed in the integer portion of a
* number.
* number.
*
* @return the maximum number of digits
* @see #setMaximumIntegerDigits
* @see #setMaximumIntegerDigits
*/
*/
public
int
getMaximumIntegerDigits
()
{
public
int
getMaximumIntegerDigits
()
{
...
@@ -611,10 +672,11 @@ public abstract class NumberFormat extends Format {
...
@@ -611,10 +672,11 @@ public abstract class NumberFormat extends Format {
/**
/**
* Sets the maximum number of digits allowed in the integer portion of a
* Sets the maximum number of digits allowed in the integer portion of a
* number. maximumIntegerDigits must be
>=
minimumIntegerDigits. If the
* number. maximumIntegerDigits must be
≥
minimumIntegerDigits. If the
* new value for maximumIntegerDigits is less than the current value
* new value for maximumIntegerDigits is less than the current value
* of minimumIntegerDigits, then minimumIntegerDigits will also be set to
* of minimumIntegerDigits, then minimumIntegerDigits will also be set to
* the new value.
* the new value.
*
* @param newValue the maximum number of integer digits to be shown; if
* @param newValue the maximum number of integer digits to be shown; if
* less than zero, then zero is used. The concrete subclass may enforce an
* less than zero, then zero is used. The concrete subclass may enforce an
* upper limit to this value appropriate to the numeric type being formatted.
* upper limit to this value appropriate to the numeric type being formatted.
...
@@ -630,6 +692,8 @@ public abstract class NumberFormat extends Format {
...
@@ -630,6 +692,8 @@ public abstract class NumberFormat extends Format {
/**
/**
* Returns the minimum number of digits allowed in the integer portion of a
* Returns the minimum number of digits allowed in the integer portion of a
* number.
* number.
*
* @return the minimum number of digits
* @see #setMinimumIntegerDigits
* @see #setMinimumIntegerDigits
*/
*/
public
int
getMinimumIntegerDigits
()
{
public
int
getMinimumIntegerDigits
()
{
...
@@ -638,10 +702,11 @@ public abstract class NumberFormat extends Format {
...
@@ -638,10 +702,11 @@ public abstract class NumberFormat extends Format {
/**
/**
* Sets the minimum number of digits allowed in the integer portion of a
* Sets the minimum number of digits allowed in the integer portion of a
* number. minimumIntegerDigits must be
<=
maximumIntegerDigits. If the
* number. minimumIntegerDigits must be
≤
maximumIntegerDigits. If the
* new value for minimumIntegerDigits exceeds the current value
* new value for minimumIntegerDigits exceeds the current value
* of maximumIntegerDigits, then maximumIntegerDigits will also be set to
* of maximumIntegerDigits, then maximumIntegerDigits will also be set to
* the new value
* the new value
*
* @param newValue the minimum number of integer digits to be shown; if
* @param newValue the minimum number of integer digits to be shown; if
* less than zero, then zero is used. The concrete subclass may enforce an
* less than zero, then zero is used. The concrete subclass may enforce an
* upper limit to this value appropriate to the numeric type being formatted.
* upper limit to this value appropriate to the numeric type being formatted.
...
@@ -657,6 +722,8 @@ public abstract class NumberFormat extends Format {
...
@@ -657,6 +722,8 @@ public abstract class NumberFormat extends Format {
/**
/**
* Returns the maximum number of digits allowed in the fraction portion of a
* Returns the maximum number of digits allowed in the fraction portion of a
* number.
* number.
*
* @return the maximum number of digits.
* @see #setMaximumFractionDigits
* @see #setMaximumFractionDigits
*/
*/
public
int
getMaximumFractionDigits
()
{
public
int
getMaximumFractionDigits
()
{
...
@@ -665,10 +732,11 @@ public abstract class NumberFormat extends Format {
...
@@ -665,10 +732,11 @@ public abstract class NumberFormat extends Format {
/**
/**
* Sets the maximum number of digits allowed in the fraction portion of a
* Sets the maximum number of digits allowed in the fraction portion of a
* number. maximumFractionDigits must be
>=
minimumFractionDigits. If the
* number. maximumFractionDigits must be
≥
minimumFractionDigits. If the
* new value for maximumFractionDigits is less than the current value
* new value for maximumFractionDigits is less than the current value
* of minimumFractionDigits, then minimumFractionDigits will also be set to
* of minimumFractionDigits, then minimumFractionDigits will also be set to
* the new value.
* the new value.
*
* @param newValue the maximum number of fraction digits to be shown; if
* @param newValue the maximum number of fraction digits to be shown; if
* less than zero, then zero is used. The concrete subclass may enforce an
* less than zero, then zero is used. The concrete subclass may enforce an
* upper limit to this value appropriate to the numeric type being formatted.
* upper limit to this value appropriate to the numeric type being formatted.
...
@@ -684,6 +752,8 @@ public abstract class NumberFormat extends Format {
...
@@ -684,6 +752,8 @@ public abstract class NumberFormat extends Format {
/**
/**
* Returns the minimum number of digits allowed in the fraction portion of a
* Returns the minimum number of digits allowed in the fraction portion of a
* number.
* number.
*
* @return the minimum number of digits
* @see #setMinimumFractionDigits
* @see #setMinimumFractionDigits
*/
*/
public
int
getMinimumFractionDigits
()
{
public
int
getMinimumFractionDigits
()
{
...
@@ -692,10 +762,11 @@ public abstract class NumberFormat extends Format {
...
@@ -692,10 +762,11 @@ public abstract class NumberFormat extends Format {
/**
/**
* Sets the minimum number of digits allowed in the fraction portion of a
* Sets the minimum number of digits allowed in the fraction portion of a
* number. minimumFractionDigits must be
<=
maximumFractionDigits. If the
* number. minimumFractionDigits must be
≤
maximumFractionDigits. If the
* new value for minimumFractionDigits exceeds the current value
* new value for minimumFractionDigits exceeds the current value
* of maximumFractionDigits, then maximumIntegerDigits will also be set to
* of maximumFractionDigits, then maximumIntegerDigits will also be set to
* the new value
* the new value
*
* @param newValue the minimum number of fraction digits to be shown; if
* @param newValue the minimum number of fraction digits to be shown; if
* less than zero, then zero is used. The concrete subclass may enforce an
* less than zero, then zero is used. The concrete subclass may enforce an
* upper limit to this value appropriate to the numeric type being formatted.
* upper limit to this value appropriate to the numeric type being formatted.
...
...
src/share/classes/java/text/ParseException.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -55,6 +55,7 @@ class ParseException extends Exception {
...
@@ -55,6 +55,7 @@ class ParseException extends Exception {
* Constructs a ParseException with the specified detail message and
* Constructs a ParseException with the specified detail message and
* offset.
* offset.
* A detail message is a String that describes this particular exception.
* A detail message is a String that describes this particular exception.
*
* @param s the detail message
* @param s the detail message
* @param errorOffset the position where the error is found while parsing.
* @param errorOffset the position where the error is found while parsing.
*/
*/
...
@@ -65,6 +66,8 @@ class ParseException extends Exception {
...
@@ -65,6 +66,8 @@ class ParseException extends Exception {
/**
/**
* Returns the position where the error was found.
* Returns the position where the error was found.
*
* @return the position where the error was found
*/
*/
public
int
getErrorOffset
()
{
public
int
getErrorOffset
()
{
return
errorOffset
;
return
errorOffset
;
...
...
src/share/classes/java/text/ParsePosition.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 20
02
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -69,6 +69,8 @@ public class ParsePosition {
...
@@ -69,6 +69,8 @@ public class ParsePosition {
* Retrieve the current parse position. On input to a parse method, this
* Retrieve the current parse position. On input to a parse method, this
* is the index of the character at which parsing will begin; on output, it
* is the index of the character at which parsing will begin; on output, it
* is the index of the character following the last character parsed.
* is the index of the character following the last character parsed.
*
* @return the current parse position
*/
*/
public
int
getIndex
()
{
public
int
getIndex
()
{
return
index
;
return
index
;
...
@@ -76,6 +78,8 @@ public class ParsePosition {
...
@@ -76,6 +78,8 @@ public class ParsePosition {
/**
/**
* Set the current parse position.
* Set the current parse position.
*
* @param index the current parse position
*/
*/
public
void
setIndex
(
int
index
)
{
public
void
setIndex
(
int
index
)
{
this
.
index
=
index
;
this
.
index
=
index
;
...
@@ -83,6 +87,8 @@ public class ParsePosition {
...
@@ -83,6 +87,8 @@ public class ParsePosition {
/**
/**
* Create a new ParsePosition with the given initial index.
* Create a new ParsePosition with the given initial index.
*
* @param index initial index
*/
*/
public
ParsePosition
(
int
index
)
{
public
ParsePosition
(
int
index
)
{
this
.
index
=
index
;
this
.
index
=
index
;
...
@@ -91,6 +97,8 @@ public class ParsePosition {
...
@@ -91,6 +97,8 @@ public class ParsePosition {
* Set the index at which a parse error occurred. Formatters
* Set the index at which a parse error occurred. Formatters
* should set this before returning an error code from their
* should set this before returning an error code from their
* parseObject method. The default value is -1 if this is not set.
* parseObject method. The default value is -1 if this is not set.
*
* @param ei the index at which an error occurred
* @since 1.2
* @since 1.2
*/
*/
public
void
setErrorIndex
(
int
ei
)
public
void
setErrorIndex
(
int
ei
)
...
@@ -101,12 +109,15 @@ public class ParsePosition {
...
@@ -101,12 +109,15 @@ public class ParsePosition {
/**
/**
* Retrieve the index at which an error occurred, or -1 if the
* Retrieve the index at which an error occurred, or -1 if the
* error index has not been set.
* error index has not been set.
*
* @return the index at which an error occurred
* @since 1.2
* @since 1.2
*/
*/
public
int
getErrorIndex
()
public
int
getErrorIndex
()
{
{
return
errorIndex
;
return
errorIndex
;
}
}
/**
/**
* Overrides equals
* Overrides equals
*/
*/
...
...
src/share/classes/java/text/RuleBasedCollator.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1997, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -68,17 +68,17 @@ import java.util.Locale;
...
@@ -68,17 +68,17 @@ import java.util.Locale;
* <reset> <text-argument>
* <reset> <text-argument>
* </pre>
* </pre>
* The definitions of the rule elements is as follows:
* The definitions of the rule elements is as follows:
* <UL
Type=disc
>
* <UL>
* <LI><strong>Text-Argument</strong>: A text-argument is any sequence of
* <LI><strong>Text-Argument</strong>: A text-argument is any sequence of
* characters, excluding special characters (that is, common
* characters, excluding special characters (that is, common
* whitespace characters [0009-000D, 0020] and rule syntax characters
* whitespace characters [0009-000D, 0020] and rule syntax characters
* [0021-002F, 003A-0040, 005B-0060, 007B-007E]). If those
* [0021-002F, 003A-0040, 005B-0060, 007B-007E]). If those
* characters are desired, you can put them in single quotes
* characters are desired, you can put them in single quotes
* (e.g. ampersand =
> '&
'). Note that unquoted white space characters
* (e.g. ampersand =
> '&
'). Note that unquoted white space characters
* are ignored; e.g. <code>b c</code> is treated as <code>bc</code>.
* are ignored; e.g. <code>b c</code> is treated as <code>bc</code>.
* <LI><strong>Modifier</strong>: There are currently two modifiers that
* <LI><strong>Modifier</strong>: There are currently two modifiers that
* turn on special collation rules.
* turn on special collation rules.
* <UL
Type=square
>
* <UL>
* <LI>'@' : Turns on backwards sorting of accents (secondary
* <LI>'@' : Turns on backwards sorting of accents (secondary
* differences), as in French.
* differences), as in French.
* <LI>'!' : Turns on Thai/Lao vowel-consonant swapping. If this
* <LI>'!' : Turns on Thai/Lao vowel-consonant swapping. If this
...
@@ -91,7 +91,7 @@ import java.util.Locale;
...
@@ -91,7 +91,7 @@ import java.util.Locale;
* </UL>
* </UL>
* <p>'@' : Indicates that accents are sorted backwards, as in French.
* <p>'@' : Indicates that accents are sorted backwards, as in French.
* <LI><strong>Relation</strong>: The relations are the following:
* <LI><strong>Relation</strong>: The relations are the following:
* <UL
Type=square
>
* <UL>
* <LI>'<' : Greater, as a letter difference (primary)
* <LI>'<' : Greater, as a letter difference (primary)
* <LI>';' : Greater, as an accent difference (secondary)
* <LI>';' : Greater, as an accent difference (secondary)
* <LI>',' : Greater, as a case difference (tertiary)
* <LI>',' : Greater, as a case difference (tertiary)
...
@@ -100,7 +100,7 @@ import java.util.Locale;
...
@@ -100,7 +100,7 @@ import java.util.Locale;
* <LI><strong>Reset</strong>: There is a single reset
* <LI><strong>Reset</strong>: There is a single reset
* which is used primarily for contractions and expansions, but which
* which is used primarily for contractions and expansions, but which
* can also be used to add a modification at the end of a set of rules.
* can also be used to add a modification at the end of a set of rules.
* <p>'&' : Indicates that the next rule follows the position to where
* <p>'&
amp;
' : Indicates that the next rule follows the position to where
* the reset text-argument would be sorted.
* the reset text-argument would be sorted.
* </UL>
* </UL>
*
*
...
@@ -166,7 +166,7 @@ import java.util.Locale;
...
@@ -166,7 +166,7 @@ import java.util.Locale;
* <p><strong>Errors</strong>
* <p><strong>Errors</strong>
* <p>
* <p>
* The following are errors:
* The following are errors:
* <UL
Type=disc
>
* <UL>
* <LI>A text-argument contains unquoted punctuation symbols
* <LI>A text-argument contains unquoted punctuation symbols
* (e.g. "a < b-c < d").
* (e.g. "a < b-c < d").
* <LI>A relation or reset character not followed by a text-argument
* <LI>A relation or reset character not followed by a text-argument
...
@@ -206,8 +206,8 @@ import java.util.Locale;
...
@@ -206,8 +206,8 @@ import java.util.Locale;
* String Norwegian = "< a, A < b, B < c, C < d, D < e, E < f, F < g, G < h, H < i, I" +
* String Norwegian = "< a, A < b, B < c, C < d, D < e, E < f, F < g, G < h, H < i, I" +
* "< j, J < k, K < l, L < m, M < n, N < o, O < p, P < q, Q < r, R" +
* "< j, J < k, K < l, L < m, M < n, N < o, O < p, P < q, Q < r, R" +
* "< s, S < t, T < u, U < v, V < w, W < x, X < y, Y < z, Z" +
* "< s, S < t, T < u, U < v, V < w, W < x, X < y, Y < z, Z" +
* "< \u00E6, \u00C6" + // Latin letter ae & AE
* "< \u00E6, \u00C6" + // Latin letter ae &
amp;
AE
* "< \u00F8, \u00D8" + // Latin letter o & O with stroke
* "< \u00F8, \u00D8" + // Latin letter o &
amp;
O with stroke
* "< \u00E5 = a\u030A," + // Latin letter a with ring above
* "< \u00E5 = a\u030A," + // Latin letter a with ring above
* " \u00C5 = A\u030A;" + // Latin letter A with ring above
* " \u00C5 = A\u030A;" + // Latin letter A with ring above
* " aa, AA";
* " aa, AA";
...
@@ -232,9 +232,9 @@ import java.util.Locale;
...
@@ -232,9 +232,9 @@ import java.util.Locale;
* + ";\u030B;\u030C;\u030D;\u030E" // main accents
* + ";\u030B;\u030C;\u030D;\u030E" // main accents
* + ";\u030F;\u0310;\u0311;\u0312" // main accents
* + ";\u030F;\u0310;\u0311;\u0312" // main accents
* + "< a , A ; ae, AE ; \u00e6 , \u00c6"
* + "< a , A ; ae, AE ; \u00e6 , \u00c6"
* + "< b , B < c, C < e, E & C < d, D";
* + "< b , B < c, C < e, E &
amp;
C < d, D";
* // change the order of accent characters
* // change the order of accent characters
* String addOn = "& \u0300 ; \u0308 ; \u0302";
* String addOn = "&
amp;
\u0300 ; \u0308 ; \u0302";
* RuleBasedCollator myCollator = new RuleBasedCollator(oldRules + addOn);
* RuleBasedCollator myCollator = new RuleBasedCollator(oldRules + addOn);
* </pre>
* </pre>
* </blockquote>
* </blockquote>
...
@@ -274,7 +274,7 @@ public class RuleBasedCollator extends Collator{
...
@@ -274,7 +274,7 @@ public class RuleBasedCollator extends Collator{
* @param rules the collation rules to build the collation table from.
* @param rules the collation rules to build the collation table from.
* @exception ParseException A format exception
* @exception ParseException A format exception
* will be thrown if the build process of the rules fails. For
* will be thrown if the build process of the rules fails. For
* example, build rule "a
< ? <
d" will cause the constructor to
* example, build rule "a
< ? <
d" will cause the constructor to
* throw the ParseException because the '?' is not quoted.
* throw the ParseException because the '?' is not quoted.
*/
*/
public
RuleBasedCollator
(
String
rules
)
throws
ParseException
{
public
RuleBasedCollator
(
String
rules
)
throws
ParseException
{
...
@@ -320,7 +320,10 @@ public class RuleBasedCollator extends Collator{
...
@@ -320,7 +320,10 @@ public class RuleBasedCollator extends Collator{
}
}
/**
/**
* Return a CollationElementIterator for the given String.
* Returns a CollationElementIterator for the given String.
*
* @param source the string to be collated
* @return a {@code CollationElementIterator} object
* @see java.text.CollationElementIterator
* @see java.text.CollationElementIterator
*/
*/
public
CollationElementIterator
getCollationElementIterator
(
String
source
)
{
public
CollationElementIterator
getCollationElementIterator
(
String
source
)
{
...
@@ -328,7 +331,10 @@ public class RuleBasedCollator extends Collator{
...
@@ -328,7 +331,10 @@ public class RuleBasedCollator extends Collator{
}
}
/**
/**
* Return a CollationElementIterator for the given String.
* Returns a CollationElementIterator for the given CharacterIterator.
*
* @param source the character iterator to be collated
* @return a {@code CollationElementIterator} object
* @see java.text.CollationElementIterator
* @see java.text.CollationElementIterator
* @since 1.2
* @since 1.2
*/
*/
...
...
src/share/classes/java/text/SimpleDateFormat.java
浏览文件 @
9df819e3
...
@@ -59,7 +59,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -59,7 +59,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
/**
/**
* <code>SimpleDateFormat</code> is a concrete class for formatting and
* <code>SimpleDateFormat</code> is a concrete class for formatting and
* parsing dates in a locale-sensitive manner. It allows for formatting
* parsing dates in a locale-sensitive manner. It allows for formatting
* (date
-> text), parsing (text ->
date), and normalization.
* (date
→ text), parsing (text →
date), and normalization.
*
*
* <p>
* <p>
* <code>SimpleDateFormat</code> allows you to start by choosing
* <code>SimpleDateFormat</code> allows you to start by choosing
...
@@ -73,7 +73,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -73,7 +73,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* For more information on using these methods, see
* For more information on using these methods, see
* {@link DateFormat}.
* {@link DateFormat}.
*
*
* <h
4>Date and Time Patterns</h4
>
* <h
3>Date and Time Patterns</h3
>
* <p>
* <p>
* Date and time formats are specified by <em>date and time pattern</em>
* Date and time formats are specified by <em>date and time pattern</em>
* strings.
* strings.
...
@@ -93,7 +93,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -93,7 +93,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <code>'z'</code> are reserved):
* <code>'z'</code> are reserved):
* <blockquote>
* <blockquote>
* <table border=0 cellspacing=3 cellpadding=0 summary="Chart shows pattern letters, date/time component, presentation, and examples.">
* <table border=0 cellspacing=3 cellpadding=0 summary="Chart shows pattern letters, date/time component, presentation, and examples.">
* <tr
bgcolor="#ccccff
">
* <tr
style="background-color: rgb(204, 204, 255);
">
* <th align=left>Letter
* <th align=left>Letter
* <th align=left>Date or Time Component
* <th align=left>Date or Time Component
* <th align=left>Presentation
* <th align=left>Presentation
...
@@ -103,7 +103,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -103,7 +103,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <td>Era designator
* <td>Era designator
* <td><a href="#text">Text</a>
* <td><a href="#text">Text</a>
* <td><code>AD</code>
* <td><code>AD</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>y</code>
* <td><code>y</code>
* <td>Year
* <td>Year
* <td><a href="#year">Year</a>
* <td><a href="#year">Year</a>
...
@@ -113,7 +113,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -113,7 +113,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <td>Week year
* <td>Week year
* <td><a href="#year">Year</a>
* <td><a href="#year">Year</a>
* <td><code>2009</code>; <code>09</code>
* <td><code>2009</code>; <code>09</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>M</code>
* <td><code>M</code>
* <td>Month in year (context sensitive)
* <td>Month in year (context sensitive)
* <td><a href="#month">Month</a>
* <td><a href="#month">Month</a>
...
@@ -123,7 +123,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -123,7 +123,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <td>Month in year (standalone form)
* <td>Month in year (standalone form)
* <td><a href="#month">Month</a>
* <td><a href="#month">Month</a>
* <td><code>July</code>; <code>Jul</code>; <code>07</code>
* <td><code>July</code>; <code>Jul</code>; <code>07</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>w</code>
* <td><code>w</code>
* <td>Week in year
* <td>Week in year
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
...
@@ -133,7 +133,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -133,7 +133,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <td>Week in month
* <td>Week in month
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
* <td><code>2</code>
* <td><code>2</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>D</code>
* <td><code>D</code>
* <td>Day in year
* <td>Day in year
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
...
@@ -143,7 +143,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -143,7 +143,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <td>Day in month
* <td>Day in month
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
* <td><code>10</code>
* <td><code>10</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>F</code>
* <td><code>F</code>
* <td>Day of week in month
* <td>Day of week in month
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
...
@@ -153,7 +153,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -153,7 +153,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <td>Day name in week
* <td>Day name in week
* <td><a href="#text">Text</a>
* <td><a href="#text">Text</a>
* <td><code>Tuesday</code>; <code>Tue</code>
* <td><code>Tuesday</code>; <code>Tue</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>u</code>
* <td><code>u</code>
* <td>Day number of week (1 = Monday, ..., 7 = Sunday)
* <td>Day number of week (1 = Monday, ..., 7 = Sunday)
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
...
@@ -163,7 +163,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -163,7 +163,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <td>Am/pm marker
* <td>Am/pm marker
* <td><a href="#text">Text</a>
* <td><a href="#text">Text</a>
* <td><code>PM</code>
* <td><code>PM</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>H</code>
* <td><code>H</code>
* <td>Hour in day (0-23)
* <td>Hour in day (0-23)
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
...
@@ -173,7 +173,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -173,7 +173,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <td>Hour in day (1-24)
* <td>Hour in day (1-24)
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
* <td><code>24</code>
* <td><code>24</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>K</code>
* <td><code>K</code>
* <td>Hour in am/pm (0-11)
* <td>Hour in am/pm (0-11)
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
...
@@ -183,7 +183,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -183,7 +183,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <td>Hour in am/pm (1-12)
* <td>Hour in am/pm (1-12)
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
* <td><code>12</code>
* <td><code>12</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>m</code>
* <td><code>m</code>
* <td>Minute in hour
* <td>Minute in hour
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
...
@@ -193,7 +193,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -193,7 +193,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <td>Second in minute
* <td>Second in minute
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
* <td><code>55</code>
* <td><code>55</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>S</code>
* <td><code>S</code>
* <td>Millisecond
* <td>Millisecond
* <td><a href="#number">Number</a>
* <td><a href="#number">Number</a>
...
@@ -203,7 +203,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -203,7 +203,7 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* <td>Time zone
* <td>Time zone
* <td><a href="#timezone">General time zone</a>
* <td><a href="#timezone">General time zone</a>
* <td><code>Pacific Standard Time</code>; <code>PST</code>; <code>GMT-08:00</code>
* <td><code>Pacific Standard Time</code>; <code>PST</code>; <code>GMT-08:00</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>Z</code>
* <td><code>Z</code>
* <td>Time zone
* <td>Time zone
* <td><a href="#rfc822timezone">RFC 822 time zone</a>
* <td><a href="#rfc822timezone">RFC 822 time zone</a>
...
@@ -365,37 +365,37 @@ import sun.util.locale.provider.LocaleProviderAdapter;
...
@@ -365,37 +365,37 @@ import sun.util.locale.provider.LocaleProviderAdapter;
* in the U.S. Pacific Time time zone.
* in the U.S. Pacific Time time zone.
* <blockquote>
* <blockquote>
* <table border=0 cellspacing=3 cellpadding=0 summary="Examples of date and time patterns interpreted in the U.S. locale">
* <table border=0 cellspacing=3 cellpadding=0 summary="Examples of date and time patterns interpreted in the U.S. locale">
* <tr
bgcolor="#ccccff
">
* <tr
style="background-color: rgb(204, 204, 255);
">
* <th align=left>Date and Time Pattern
* <th align=left>Date and Time Pattern
* <th align=left>Result
* <th align=left>Result
* <tr>
* <tr>
* <td><code>"yyyy.MM.dd G 'at' HH:mm:ss z"</code>
* <td><code>"yyyy.MM.dd G 'at' HH:mm:ss z"</code>
* <td><code>2001.07.04 AD at 12:08:56 PDT</code>
* <td><code>2001.07.04 AD at 12:08:56 PDT</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>"EEE, MMM d, ''yy"</code>
* <td><code>"EEE, MMM d, ''yy"</code>
* <td><code>Wed, Jul 4, '01</code>
* <td><code>Wed, Jul 4, '01</code>
* <tr>
* <tr>
* <td><code>"h:mm a"</code>
* <td><code>"h:mm a"</code>
* <td><code>12:08 PM</code>
* <td><code>12:08 PM</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>"hh 'o''clock' a, zzzz"</code>
* <td><code>"hh 'o''clock' a, zzzz"</code>
* <td><code>12 o'clock PM, Pacific Daylight Time</code>
* <td><code>12 o'clock PM, Pacific Daylight Time</code>
* <tr>
* <tr>
* <td><code>"K:mm a, z"</code>
* <td><code>"K:mm a, z"</code>
* <td><code>0:08 PM, PDT</code>
* <td><code>0:08 PM, PDT</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>"yyyyy.MMMMM.dd GGG hh:mm aaa"</code>
* <td><code>"yyyyy.MMMMM.dd GGG hh:mm aaa"</code>
* <td><code>02001.July.04 AD 12:08 PM</code>
* <td><code>02001.July.04 AD 12:08 PM</code>
* <tr>
* <tr>
* <td><code>"EEE, d MMM yyyy HH:mm:ss Z"</code>
* <td><code>"EEE, d MMM yyyy HH:mm:ss Z"</code>
* <td><code>Wed, 4 Jul 2001 12:08:56 -0700</code>
* <td><code>Wed, 4 Jul 2001 12:08:56 -0700</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>"yyMMddHHmmssZ"</code>
* <td><code>"yyMMddHHmmssZ"</code>
* <td><code>010704120856-0700</code>
* <td><code>010704120856-0700</code>
* <tr>
* <tr>
* <td><code>"yyyy-MM-dd'T'HH:mm:ss.SSSZ"</code>
* <td><code>"yyyy-MM-dd'T'HH:mm:ss.SSSZ"</code>
* <td><code>2001-07-04T12:08:56.235-0700</code>
* <td><code>2001-07-04T12:08:56.235-0700</code>
* <tr
bgcolor="#eeeeff
">
* <tr
style="background-color: rgb(238, 238, 255);
">
* <td><code>"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"</code>
* <td><code>"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"</code>
* <td><code>2001-07-04T12:08:56.235-07:00</code>
* <td><code>2001-07-04T12:08:56.235-07:00</code>
* <tr>
* <tr>
...
...
src/share/classes/java/text/StringCharacterIterator.java
浏览文件 @
9df819e3
/*
/*
* Copyright (c) 1996, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -59,6 +59,8 @@ public final class StringCharacterIterator implements CharacterIterator
...
@@ -59,6 +59,8 @@ public final class StringCharacterIterator implements CharacterIterator
/**
/**
* Constructs an iterator with an initial index of 0.
* Constructs an iterator with an initial index of 0.
*
* @param text the {@code String} to be iterated over
*/
*/
public
StringCharacterIterator
(
String
text
)
public
StringCharacterIterator
(
String
text
)
{
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录