public int hashCode() { int hash = getLemma().hashCode(); for (int i = 0; i < getExceptionsSize(); i++) { hash ^= getException(i).hashCode(); } return hash; }
public boolean equals(Object obj) { return (obj instanceof Exc) && getLemma().equals(((Exc)obj).getLemma()) && getExceptions().equals(((Exc)obj).getExceptions()); }
private String getExceptionsAsString() { if (_exceptionString == null) { String str = ""; for (int i = 0; i < getExceptionsSize(); i++) { str += getException(i); if (i != getExceptionsSize() - 1) { str += ", "; } } _exceptionString = str; } return _exceptionString; }
public Exc createExc(POS pos, String derivation, ResultSet rs) throws SQLException { List exceptions = new ArrayList(); while (rs.next()) { exceptions.add(rs.getString(1)); } return new Exc(pos, derivation, exceptions); } }
public void update(Observable obs, Object obj) { if (obj instanceof IndexWord) { IndexWord word = (IndexWord) obj; removeLemma(DictionaryElementType.INDEX_WORD, word.getLemma(), word.getPOS()); } else if (obj instanceof Exc) { Exc exc = (Exc) obj; removeLemma(DictionaryElementType.EXCEPTION, exc.getLemma(), exc.getPOS()); } }
public String toString() { if (_cachedToString == null) { _cachedToString = JWNL.resolveMessage("DATA_TOSTRING_001", new Object[] { getLemma(), getExceptionsAsString() }); } return _cachedToString; }
public int getExceptionsSize() { return getExceptions().size(); }
public Object getKey() { return getLemma(); }
public boolean execute(POS pos, String derivation, BaseFormSet form) throws JWNLException { Exc exc = Dictionary.getInstance().getException(pos, derivation); if (exc != null) { String[] exceptions = exc.getExceptionArray(); for (int i = 0; i < exceptions.length; i++) { form.add(exceptions[i]); } return true; } return false; } }
public Exc createExc(POS pos, String line) { StringTokenizer st = new StringTokenizer(line); String lemma = st.nextToken().replace('_', ' '); List exceptions = new ArrayList(); while (st.hasMoreTokens()) { exceptions.add(st.nextToken().replace('_', ' ')); } if (_log.isLevelEnabled(MessageLogLevel.TRACE)) { _log.log(MessageLogLevel.TRACE, "PRINCETON_INFO_001", new Object[]{pos, lemma}); } return new Exc(pos, lemma, exceptions); } }
public void cacheObject(DictionaryElementType fileType, Object key, Object value) { if (value instanceof IndexWord) { IndexWord word = (IndexWord) value; getMap(DictionaryElementType.INDEX_WORD).put(new POSKey(word.getPOS(), word.getLemma()), key); } else if (value instanceof Exc) { Exc exc = (Exc) value; getMap(DictionaryElementType.EXCEPTION).put(new POSKey(exc.getPOS(), exc.getLemma()), key); } super.cacheObject(fileType, key, value); }
/** Get the exception at index <code>index</code>. */ public String getException(int index) { return (String)getExceptions().get(index); }
/** Get the collection of Exc objects in array form. */ public String[] getExceptionArray() { return (String[])getExceptions().toArray(new String[_exceptions.size()]); }