コード例 #1
0
ファイル: StringTupel.java プロジェクト: gsautter/idaho-core
 /**
  * project this StringTupel to a given set of keys
  *
  * @param keys the keys to retain
  * @return a new StringTupel containing only the values of the specified keys
  */
 public StringTupel project(StringVector keys) {
   StringVector remainingKeys = this.getKeys().intersect(keys);
   StringTupel st = new StringTupel();
   for (int k = 0; k < remainingKeys.size(); k++)
     st.setValue(remainingKeys.get(k), this.getValue(remainingKeys.get(k)));
   return st;
 }
コード例 #2
0
ファイル: StringTupel.java プロジェクト: gsautter/idaho-core
 /**
  * join this StringTupel with another one
  *
  * @param toJoin the StringTupel to join this one with
  * @return a new StringTupel containing the key/value pairs from both this and the argument
  *     StringTupel Note: if the values for a key differ, the new StringTupel will contain the
  *     value from this StringTupel
  */
 public StringTupel join(StringTupel toJoin) {
   if ((toJoin == null) || (toJoin == this)) return this;
   StringVector joinKeys = this.getKeys().union(toJoin.getKeys());
   StringTupel st = new StringTupel();
   for (int k = 0; k < joinKeys.size(); k++)
     st.setValue(
         joinKeys.get(k), this.getValue(joinKeys.get(k), toJoin.getValue(joinKeys.get(k))));
   return st;
 }
コード例 #3
0
ファイル: StringTupel.java プロジェクト: gsautter/idaho-core
 /**
  * Convert the data in this StringTupel to a line for a CSV file.
  *
  * @param separator the value separator character
  * @param valueDelimiter the character to use as the value delimiter (will be escaped with itself
  *     if occuring in value)
  * @param keys a StringVector containing the keys whose values to include
  * @return a String concatenated from the values of the specified keys, in the order of the keys
  */
 public String toCsvString(char separator, char valueDelimiter, StringVector keys) {
   String delimiter = ("" + valueDelimiter);
   StringVector values = new StringVector();
   for (int k = 0; k < keys.size(); k++)
     values.addElement(
         delimiter
             + StringUtils.replaceAll(
                 this.getValue(keys.get(k), ""), delimiter, (delimiter + delimiter))
             + delimiter);
   return values.concatStrings("" + separator);
 }
コード例 #4
0
ファイル: StringTupel.java プロジェクト: gsautter/idaho-core
 /**
  * check if this StringTupel matches a given filter
  *
  * @param filter the StringTupel to use as the filter
  * @return true if and only if this StringTupel contains the same values as the filter for all
  *     keys contained in the filter
  */
 public boolean matches(StringTupel filter) {
   if ((filter == null) || (filter.size() == 0)) return true;
   StringVector ownKeys = this.getKeys();
   StringVector filterKeys = filter.getKeys();
   if (!ownKeys.contains(filterKeys)) return false;
   for (int k = 0; k < filterKeys.size(); k++) {
     String ownValue = this.getValue(filterKeys.get(k), "");
     String filterValue = filter.getValue(filterKeys.get(k), "");
     if (!ownValue.equals(filterValue)) return false;
   }
   return true;
 }
コード例 #5
0
 /* (non-Javadoc)
  * @see de.uka.ipd.idaho.goldenGate.plugins.AbstractGoldenGatePlugin#init()
  */
 public void init() {
   try {
     StringVector sats =
         StringVector.loadList(this.dataProvider.getInputStream("structureAnnotationTypes.cnfg"));
     for (int t = 0; t < sats.size(); t++) {
       String sat = sats.get(t).trim();
       if ((sat.length() == 0) || sat.startsWith("//")) continue;
       this.structureAnnotationTypes.add(sat);
     }
   } catch (IOException ioe) {
   }
 }
コード例 #6
0
ファイル: StringTupel.java プロジェクト: gsautter/idaho-core
 /** @see java.lang.Object#toString() */
 public String toString() {
   StringVector keys = this.getKeys();
   StringVector values = new StringVector();
   for (int k = 0; k < keys.size(); k++) values.addElement(this.getValue(keys.get(k), ""));
   return values.concatStrings("; ");
 }