Mercurial > hg > RemoteEditor > Eclipse
changeset 73:bb5db6a67c7b
Text class
author | kent |
---|---|
date | Thu, 08 Nov 2007 16:27:56 +0900 |
parents | a77ddf4fc5c9 |
children | d44d734502da |
files | src/pathfinder/Text.java |
diffstat | 1 files changed, 44 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pathfinder/Text.java Thu Nov 08 16:27:56 2007 +0900 @@ -0,0 +1,44 @@ +package pathfinder; + +import java.util.Arrays; +import java.util.LinkedList; + +public class Text { + static private String[] text0 = { + "aaa", "bbb", "ccc", "ddd", "eee", + "fff", "ggg", "hhh", "iii", "jjj", + "kkk", "lll", "mmm", "nnn", "ooo", + "ppp", "qqq", "rrr", "sss", "ttt", + "uuu", "vvv", "www", "xxx", "yyy", "zzz" + }; + LinkedList<String> strList; + + public Text(){ + this(Text.text0); + } + public Text(String[] _strings){ + strList = new LinkedList<String>(Arrays.asList(_strings)); + } + + public void insert(int i, String str){ + strList.add(i, str); + } + public void delete(int i){ + strList.remove(i); + } + public void replace(int i, String str){ + strList.set(i, str); + } + public String get(int i){ + return strList.get(i); + } + + public void printAllText(){ + for( String str: strList){ + System.out.println(str); + } + } + public boolean equals(Text _target){ + return strList.equals(_target.strList); + } +}