예제 #1
0
 public Tagset filterPrefix(String prefix, boolean positive, boolean removePrefix) {
   if (prefix == null) {
     throw new IllegalArgumentException("prefix == null");
   }
   Tagset set = new Tagset();
   for (Tag tag : this) {
     if (tag.normalizedValue().startsWith(prefix) == positive) {
       if (positive && removePrefix) {
         String str = tag.normalizedValue().substring(prefix.length());
         if (str.length() != 0) set.add(str);
       } else {
         set.add(tag);
       }
     }
   }
   return set;
 }
예제 #2
0
 public int compare(Tag a, Tag b) {
   return a.normalizedValue().compareTo(b.normalizedValue());
 }