mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-16 10:17:23 +00:00
ICU-6447 Retract Formatter/Parser/BaseFormat for ICU4J 4.4. We'll revisit this after 4.6.
X-SVN-Rev: 27353
This commit is contained in:
parent
76f2952142
commit
18553e9513
7 changed files with 8 additions and 126 deletions
|
@ -560,16 +560,14 @@
|
|||
<include name="com/ibm/icu/util/**"/>
|
||||
</packageset>
|
||||
<packageset dir="${icu4j.collate.dir}/src">
|
||||
<include name="com/ibm/icu/**"/>
|
||||
<exclude name="com/ibm/icu/impl/**"/>
|
||||
<include name="com/ibm/icu/text/**"/>
|
||||
<include name="com/ibm/icu/util/**"/>
|
||||
</packageset>
|
||||
<packageset dir="${icu4j.charset.dir}/src">
|
||||
<include name="com/ibm/icu/charset/**"/>
|
||||
<exclude name="com/ibm/icu/impl/**"/>
|
||||
</packageset>
|
||||
<packageset dir="${icu4j.translit.dir}/src">
|
||||
<include name="com/ibm/icu/**"/>
|
||||
<exclude name="com/ibm/icu/impl/**"/>
|
||||
<include name="com/ibm/icu/text/**"/>
|
||||
</packageset>
|
||||
<doclet name="com.ibm.icu.dev.tool.docs.GatherAPIData" path="${icu4j.build-tools.jar}">
|
||||
<param name="-name" value="ICU4J ${icu4j.impl.version}"/>
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2009, Google, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
|
||||
/**
|
||||
* @author markdavis
|
||||
*
|
||||
*/
|
||||
public interface BaseFormat<T, U extends Appendable, S extends CharSequence> extends Formatter<T, U>, Parser<T, S> {
|
||||
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
|
||||
import java.text.FieldPosition;
|
||||
|
||||
/**
|
||||
* General Interface for formatting.
|
||||
* @author markdavis
|
||||
*/
|
||||
public interface Formatter<T, U extends Appendable> {
|
||||
/**
|
||||
* Formats an object to produce a string. This is equivalent to
|
||||
* <blockquote>
|
||||
* {@link #format(Object, Appendable, FieldPosition)}<code>(obj,
|
||||
* new StringBuilder(), new FieldPosition(0)).toString();</code>
|
||||
* </blockquote>
|
||||
*
|
||||
* @param obj The object to format
|
||||
* @return Formatted string.
|
||||
* @exception IllegalArgumentException if the Format cannot format the given
|
||||
* object
|
||||
* @draft ICU 4.4
|
||||
*/
|
||||
public String format (T obj);
|
||||
|
||||
/**
|
||||
* Formats an object and appends the resulting text to a given {@link java.lang.Appendable}.
|
||||
* If the <code>pos</code> argument identifies a field used by the format,
|
||||
* then its indices are set to the beginning and end of the first such
|
||||
* field encountered.
|
||||
*
|
||||
* @param obj The object to format
|
||||
* @param toAppendTo where the text is to be appended
|
||||
* @param pos A <code>FieldPosition</code> identifying a field
|
||||
* in the formatted text
|
||||
* @return the {@link java.lang.Appendable} passed in as <code>toAppendTo</code>,
|
||||
* with formatted text appended
|
||||
* @exception NullPointerException if <code>toAppendTo</code> or
|
||||
* <code>pos</code> is null
|
||||
* @exception IllegalArgumentException if the Format cannot format the given
|
||||
* object. If the Appendable throws an exception, then the cause is that exception.
|
||||
* @draft ICU 4.4
|
||||
*/
|
||||
public U format(T obj, U toAppendTo, FieldPosition pos);
|
||||
}
|
|
@ -416,7 +416,7 @@ import com.ibm.icu.util.ULocale;
|
|||
* @author Mark Davis
|
||||
* @stable ICU 3.0
|
||||
*/
|
||||
public class MessageFormat extends UFormat implements BaseFormat<Object,StringBuffer,String> {
|
||||
public class MessageFormat extends UFormat {
|
||||
|
||||
// Generated by serialver from JDK 1.4.1_01
|
||||
static final long serialVersionUID = 7136212545847378651L;
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2009, Google, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.ParsePosition;
|
||||
|
||||
/**
|
||||
* @author markdavis
|
||||
*
|
||||
*/
|
||||
public interface Parser<T, S extends CharSequence> {
|
||||
/**
|
||||
* Parses text from the beginning of the given string to produce an object.
|
||||
* The method may not use the entire text of the given string.
|
||||
*
|
||||
* @param source A <code>String</code> whose beginning should be parsed.
|
||||
* @return An <code>Object</code> parsed from the string.
|
||||
* @exception ParseException if the beginning of the specified string
|
||||
* cannot be parsed.
|
||||
*/
|
||||
public T parseObject(S source) throws ParseException;
|
||||
|
||||
/**
|
||||
* Parses text from a string to produce an object.
|
||||
* <p>
|
||||
* The method attempts to parse text starting at the index given by
|
||||
* <code>pos</code>.
|
||||
* If parsing succeeds, then the index of <code>pos</code> is updated
|
||||
* to the index after the last character used (parsing does not necessarily
|
||||
* use all characters up to the end of the string), and the parsed
|
||||
* object is returned. The updated <code>pos</code> can be used to
|
||||
* indicate the starting point for the next call to this method.
|
||||
* If an error occurs, then the index of <code>pos</code> is not
|
||||
* changed, the error index of <code>pos</code> is set to the index of
|
||||
* the character where the error occurred, and null is returned.
|
||||
*
|
||||
* @param source A <code>String</code>, part of which should be parsed.
|
||||
* @param pos A <code>ParsePosition</code> object with index and error
|
||||
* index information as described above.
|
||||
* @return An <code>Object</code> parsed from the string. In case of
|
||||
* error, returns null.
|
||||
* @exception NullPointerException if <code>pos</code> is null.
|
||||
*/
|
||||
public T parseObject (S source, ParsePosition pos);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2003-2009, International Business Machines Corporation and *
|
||||
* Copyright (C) 2003-2010, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ import com.ibm.icu.util.ULocale;
|
|||
* @draft ICU 2.8 (retain)
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public abstract class UFormat extends Format implements BaseFormat<Object,StringBuffer,String> {
|
||||
public abstract class UFormat extends Format {
|
||||
// jdk1.4.2 serialver
|
||||
private static final long serialVersionUID = -4964390515840164416L;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2010, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
**********************************************************************
|
||||
* Author: Mark Davis
|
||||
|
@ -16,7 +16,6 @@ import java.util.TreeSet;
|
|||
|
||||
import com.ibm.icu.impl.Utility;
|
||||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.text.Formatter;
|
||||
import com.ibm.icu.text.StringTransform;
|
||||
import com.ibm.icu.text.UTF16;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
|
@ -25,7 +24,7 @@ import com.ibm.icu.text.UTF16.StringComparator;
|
|||
|
||||
/** Provides more flexible formatting of UnicodeSet patterns.
|
||||
*/
|
||||
public class PrettyPrinter implements Formatter<UnicodeSet, Appendable>{
|
||||
public class PrettyPrinter {
|
||||
private static final StringComparator CODEPOINT_ORDER = new UTF16.StringComparator(true,false,0);
|
||||
private static final UnicodeSet PATTERN_WHITESPACE = (UnicodeSet) new UnicodeSet("[[:Cn:][:Default_Ignorable_Code_Point:][:patternwhitespace:]]").freeze();
|
||||
private static final UnicodeSet SORT_AT_END = (UnicodeSet) new UnicodeSet("[[:Cn:][:Cs:][:Co:][:Ideographic:]]").freeze();
|
||||
|
|
Loading…
Add table
Reference in a new issue