public void load(String in) throws IOException{ int begin = in.lastIndexOf("\\"); int idx = in.indexOf('-',begin); if(idx==-1) idx = in.indexOf('.',begin); if(idx==-1) idx = in.length(); String pos = in.substring(begin+1,idx); THashSet<String> set = MyCollection.loadTSet(in); TObjectHashIterator<String> it = set.iterator(); while(it.hasNext()){ String s = it.next(); s = s.replaceAll("(\\s| | |\\t)+", ""); if(s.length()==0) continue; add(pos, s); String ss = filter(pos,s); if(ss!=null){ add(pos,ss); } } }
@SuppressWarnings({"unchecked"}) public Iterator<V> iterator() { return new TObjectHashIterator( TCustomHashMap.this ) { protected V objectAtIndex( int index ) { return _values[index]; } }; }
@SuppressWarnings({"unchecked"}) public Iterator<V> iterator() { return new TObjectHashIterator(THashMap.this) { protected V objectAtIndex(int index) { return _values[index]; } }; }
@SuppressWarnings({"unchecked", "rawtypes"}) @Override public Iterator<V> iterator() { return new TObjectHashIterator( TCustomHashMap.this ) { @Override protected V objectAtIndex( int index ) { return _values[index]; } }; }
@Override @SuppressWarnings({"unchecked", "rawtypes"}) public Iterator<V> iterator() { return new TObjectHashIterator(THashMap.this) { @Override protected V objectAtIndex(int index) { return _values[index]; } }; }
@SuppressWarnings({"unchecked"}) public Iterator<V> iterator() { return new TObjectHashIterator( THashMap.this ) { protected V objectAtIndex( int index ) { return _values[index]; } }; }
/** * 从文件中读取 * @param path 文件路径 * @param tag 词典名 * @throws IOException */ public void load(String path,String tag) throws IOException{ if(path == null) return; dict = MyCollection.loadTSet(path); maxLen = 0; TObjectHashIterator<String> it = dict.iterator(); while(it.hasNext()){ String k = it.next(); if(k.length()>maxLen){ maxLen = k.length(); } } name = tag; }
public float calc(THashSet<Object> s1, THashSet<Object> s2) { int com = 0; if (s1 == null || s2 == null) return 0; TObjectHashIterator<Object> it = s1.iterator(); for ( int i = s1.size(); i-- > 0; ) { Object v = it.next(); if(s2.contains(v)) com++; } float sim = ((float) com)/(s1.size()+s2.size()-com); return sim; }
public static void TSet2List(THashSet<String> newset, ArrayList<String> al) { TObjectHashIterator<String> it = newset.iterator(); while(it.hasNext()){ String s = it.next(); al.add(s); } }
public static int getLength(THashSet<String> set) { int i = 0; TObjectHashIterator<String> it = set.iterator(); while(it.hasNext()){ String s = it.next(); if(s.length()>i) i=s.length(); } return i; }
@SuppressWarnings({"unchecked"}) public Iterator<K> iterator() { return new TObjectHashIterator( TObjectFloatHashMap.this ); }
@SuppressWarnings({"unchecked"}) public Iterator<K> iterator() { return new TObjectHashIterator( TObjectIntHashMap.this ); }
@SuppressWarnings({"unchecked"}) public Iterator<K> iterator() { return new TObjectHashIterator( TObjectShortHashMap.this ); }
@SuppressWarnings({"unchecked"}) public Iterator<K> iterator() { return new TObjectHashIterator( TCustomHashMap.this ); }
@SuppressWarnings({"unchecked"}) public Iterator<K> iterator() { return new TObjectHashIterator<K>(THashMap.this); }
@SuppressWarnings({"unchecked"}) public Iterator<K> iterator() { return new TObjectHashIterator( TObjectByteHashMap.this ); }
@SuppressWarnings({"unchecked"}) public Iterator<K> iterator() { return new TObjectHashIterator( TObjectDoubleHashMap.this ); }
@SuppressWarnings({"unchecked"}) public Iterator<K> iterator() { return new TObjectHashIterator( TObjectLongHashMap.this ); }
@SuppressWarnings({"unchecked"}) public Iterator<K> iterator() { return new TObjectHashIterator( TObjectCharHashMap.this ); }