ICU-1421 implement clone

X-SVN-Rev: 6796
This commit is contained in:
Alan Liu 2001-11-12 20:55:06 +00:00
parent 3a43d7e00d
commit a6c794e643
4 changed files with 42 additions and 10 deletions

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/translit/UnicodeSetTest.java,v $
* $Date: 2001/11/03 03:28:48 $
* $Revision: 1.15 $
* $Date: 2001/11/12 20:55:06 $
* $Revision: 1.16 $
*
*****************************************************************************************
*/
@ -275,6 +275,15 @@ public class UnicodeSetTest extends TestFmwk {
expectContainment(set, "abc", "ABC");
}
/**
* Test cloning of UnicodeSet
*/
public void TestClone() {
UnicodeSet s = new UnicodeSet("[abcxyz]");
UnicodeSet t = (UnicodeSet) s.clone();
expectContainment(t, "abc", "def");
}
/**
* Test the indexOf() and charAt() methods.
*/

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/UnicodeSet.java,v $
* $Date: 2001/11/09 00:51:54 $
* $Revision: 1.44 $
* $Date: 2001/11/12 20:54:46 $
* $Revision: 1.45 $
*
*****************************************************************************************
*/
@ -220,7 +220,7 @@ import com.ibm.util.Utility;
* added in the future.
*
* @author Alan Liu
* @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.44 $ $Date: 2001/11/09 00:51:54 $
* @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.45 $ $Date: 2001/11/12 20:54:46 $
*/
public class UnicodeSet extends UnicodeFilter {
@ -382,6 +382,13 @@ public class UnicodeSet extends UnicodeFilter {
applyPattern(pat, false);
}
/**
* Return a new set that is equivalent to this one.
*/
public Object clone() {
return new UnicodeSet(this);
}
/**
* Make this object represent the range <code>start - end</code>.
* If <code>end > start</code> then this object is set to an

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/test/translit/Attic/UnicodeSetTest.java,v $
* $Date: 2001/11/03 03:28:48 $
* $Revision: 1.15 $
* $Date: 2001/11/12 20:55:06 $
* $Revision: 1.16 $
*
*****************************************************************************************
*/
@ -275,6 +275,15 @@ public class UnicodeSetTest extends TestFmwk {
expectContainment(set, "abc", "ABC");
}
/**
* Test cloning of UnicodeSet
*/
public void TestClone() {
UnicodeSet s = new UnicodeSet("[abcxyz]");
UnicodeSet t = (UnicodeSet) s.clone();
expectContainment(t, "abc", "def");
}
/**
* Test the indexOf() and charAt() methods.
*/

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/UnicodeSet.java,v $
* $Date: 2001/11/09 00:51:54 $
* $Revision: 1.44 $
* $Date: 2001/11/12 20:54:46 $
* $Revision: 1.45 $
*
*****************************************************************************************
*/
@ -220,7 +220,7 @@ import com.ibm.util.Utility;
* added in the future.
*
* @author Alan Liu
* @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.44 $ $Date: 2001/11/09 00:51:54 $
* @version $RCSfile: UnicodeSet.java,v $ $Revision: 1.45 $ $Date: 2001/11/12 20:54:46 $
*/
public class UnicodeSet extends UnicodeFilter {
@ -382,6 +382,13 @@ public class UnicodeSet extends UnicodeFilter {
applyPattern(pat, false);
}
/**
* Return a new set that is equivalent to this one.
*/
public Object clone() {
return new UnicodeSet(this);
}
/**
* Make this object represent the range <code>start - end</code>.
* If <code>end > start</code> then this object is set to an