PageRenderTime 12ms CodeModel.GetById 4ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/ictclas4j/src/org/ictclas4j/test2/WordTable0.java

http://ictclas4j.googlecode.com/
Java | 75 lines | 55 code | 19 blank | 1 comment | 16 complexity | 024864a4d6d1e9e88c5b5c9b52c17172 MD5 | raw file
 1package org.ictclas4j.test2;
 2
 3import java.util.ArrayList;
 4
 5import org.apache.commons.lang.builder.ReflectionToStringBuilder;
 6
 7public class WordTable0 {
 8	// ???????????
 9	private int count;
10
11	private ArrayList<WordItem0> words;
12
13	public WordTable0() {
14
15	}
16
17	public int getCount() {
18		return count;
19	}
20
21	public void setCount(int count) {
22		this.count = count;
23	}
24
25	public void addWordItem(WordItem0 wi) {
26		if (wi != null) {
27			if (words == null)
28				words = new ArrayList<WordItem0>();
29			words.add(wi);
30			count++;
31		}
32	}
33	
34	public void addWordItem(int index,WordItem0 wi) {
35		if (wi != null) {
36			if (words == null)
37				words = new ArrayList<WordItem0>();
38			words.add(index,wi);
39			count++;
40		}
41	}
42	
43	public WordItem0 getWordItem(int index){
44		if(words!=null){
45			if(index>=0 && index<words.size())
46				return words.get(index);
47		}
48		
49		return null;
50	}
51
52	public ArrayList<WordItem0> getWords() {
53		return words;
54	}
55
56	public void setWords(ArrayList<WordItem0> words) {
57		this.words = words;
58	}
59
60	public void setWords(WordItem0[] wis) {
61		if (wis != null) {
62			if (words == null)
63				words = new ArrayList<WordItem0>();
64			for (WordItem0 wi : wis)
65				words.add(wi);
66
67		}
68	}
69
70	public String toString() {
71
72		return ReflectionToStringBuilder.toString(this);
73
74	}
75}