Example #1
0
 public static <T extends Comparable<T>> SequenceDatabaseGen<T> loadGen(
     List<List<T>>[] aryListDB) {
   SequenceDatabaseGen<T> db = new SequenceDatabaseGen<T>();
   SequenceGen<T> seq;
   for (int i = 0; i < aryListDB.length; i++) {
     if (aryListDB[i] != null) {
       seq = new SequenceGen<T>(i);
       for (List<T> itemset : aryListDB[i]) {
         seq.addItemset(itemset);
       }
       db.addSequence(seq);
     }
   }
   return db;
 }
Example #2
0
 public static <T extends Comparable<T>> SequenceDatabaseGen<T> loadGen(
     String strDB, StringParsable<T> parser) {
   SequenceDatabaseGen<T> db = new SequenceDatabaseGen<T>();
   SequenceGen<T> seq;
   List<T> iset;
   String[] sequences = strDB.split("\\n");
   String[] itemsets;
   String[] items;
   for (String seqStr : sequences) {
     itemsets = seqStr.trim().split("\\s*\\|\\s*");
     seq = new SequenceGen<T>(Integer.valueOf(itemsets[0]));
     for (int i = 1; i < itemsets.length; i++) {
       items = itemsets[i].split("\\s+");
       iset = new ArrayList<T>();
       for (String itemStr : items) {
         iset.add(parser.parse(itemStr));
       }
       seq.addItemset(iset);
     }
     db.addSequence(seq);
   }
   return db;
 }