コード例 #1
0
ファイル: LSPDoc.java プロジェクト: nlalak/SDARTS
 /**
  * Remove a field/value pairing. This is sometimes needed in cases where an LSPDoc is created from
  * some underlying collection before the "answer-fields" criterion can be applied. When that
  * happens, the criterion is applied during post-processing, and sometimes field/value pairings
  * have to be removed.
  *
  * @param field the field in the field/value pairing to be removed
  */
 public void removeFieldValue(LSPField field) {
   for (Iterator it = fieldValues.iterator(); it.hasNext(); ) {
     FieldValue fv = (FieldValue) it.next();
     if (fv.getField().equals(field)) {
       it.remove();
       break;
     }
   }
 }
コード例 #2
0
ファイル: LSPDoc.java プロジェクト: nlalak/SDARTS
 /**
  * Gets the value from a particular field name
  *
  * @param fieldName (use one from {@link edu.columbia.cs.sdarts.common.FieldNames FieldNames})
  * @return value the value for that field
  */
 public String getValue(String fieldName) {
   if (fieldValues == null) {
     return null;
   }
   int len = fieldValues.size();
   for (int i = 0; i < len; i++) {
     FieldValue fv = (FieldValue) fieldValues.get(i);
     if (fv.getField().getName().equals(fieldName)) {
       return fv.getValue().getValue();
     }
   }
   return null;
 }