/**
  * @param patterns
  * @return ????
  */
 public Vector<EventSequence> postProcessing(Vector<EventSequence> patterns) {
   Vector<EventSequence> vec = new Vector<EventSequence>();
   for (int i = 0; i < patterns.size(); i++) {
     EventSequence s = patterns.elementAt(i);
     if (postAccepts(s)) vec.addElement(s);
   }
   return vec;
 }
 /**
  * @param set
  * @param alphabet
  * @param tax
  * @return a vector with elements???
  */
 protected Vector<Element> getParents(ItemSet set, Vector<Element> alphabet, Taxonomy tax) {
   Vector<Element> v = new Vector<Element>(0);
   for (int i = 0; i < set.size(); i++) {
     Element el = set.elementAt(i);
     int found = m_tdm.m_contentC.m_taxonomy.getParentOf(el, alphabet);
     if (-1 != found) {
       Element p = alphabet.elementAt(found);
       if (-1 == v.indexOf(p)) v.addElement(p);
     }
   }
   return v;
 }
 /**
  * @param ev
  * @param alphabet
  * @param bs
  * @param sup
  * @param seqDB
  * @param posDB
  * @param sInd
  * @param eInd
  */
 protected void verifyContentGeneralAcceptance(
     Event ev,
     Vector<Element> alphabet,
     BitSet bs,
     long[] sup,
     Vector<Integer>[] seqDB,
     Vector<Integer>[] posDB,
     int sInd,
     int eInd) {
   ItemSet set = ev.getSet();
   for (int i = 0; i < set.size(); i++) {
     Element el = set.elementAt(i);
     int found = alphabet.indexOf(el);
     if (-1 != found) {
       // If current sequence did not contribute to the support of
       // this element yet, increment its support
       if (!bs.get(found)) {
         sup[found]++;
         bs.set(found);
       }
       // In any case, add another object to projecyed db
       seqDB[found].addElement(new Integer(sInd));
       posDB[found].addElement(new Integer(eInd));
     }
   }
 }
 @Override
 protected void verifyContentAcceptance(
     EventSequence alpha,
     ItemSet set,
     Vector<Element> alphabet,
     int[] sup,
     ProjectedDB[] projDBs,
     int indProj,
     int sInd,
     int eInd,
     boolean inParallel,
     BitSet visited,
     BitSet accepted) {
   for (int i = 0; i < set.size(); i++) {
     Element el = set.elementAt(i);
     int found = alphabet.indexOf(el);
     if ((-1 != found)) {
       if (!visited.get(found)) {
         visited.set(found);
         accepted.set(found, isAcceptedByRelaxation(alpha, el, inParallel));
       }
       if (accepted.get(found)) {
         if (!projDBs[found].contains(sInd)) sup[found]++;
         projDBs[found].set(sInd, eInd);
       }
     }
   }
 }
 /**
  * @param db
  * @return a db transformed in a database of events ???
  */
 public Database preProcessing(Database db) {
   Vector<Element> alphabet = m_tdm.m_contentC.m_taxonomy.getAlphabet(m_tdm.m_contentC.m_level);
   Database preprocDB = new Database();
   for (int i = 0; i < db.getSize(); i++) {
     EventSequence s = db.elementAt(i);
     Vector<Event> events = new Vector<Event>(0);
     for (int k = 0; k < s.length(); k++) {
       Event e = s.elementAtIndex(k);
       if (m_tdm.m_temporalC.accepts(e)) {
         Vector<Element> v = getParents(e.getSet(), alphabet, m_tdm.m_contentC.m_taxonomy);
         if (null != v) events.addElement(new Event(new ItemSet(v), e.getInstant()));
       }
     }
     if (0 != events.size()) preprocDB.addElement(new EventSequence(events));
   }
   preprocDB.setAlphabet(alphabet);
   return preprocDB;
 }
 /**
  * Verifies the support and creates the infrastructure to generate initial projectedDBs for each
  * element in the database.
  *
  * @param s The db sequence to verify.
  * @param alphabet The set of elements in the db.
  * @param sup An array to store elements support.
  * @param seqDB An array of vectores with the ids of sequences where each element occur.
  * @param posDB An array of vectores with the positions where each element occur.
  * @param index The first index to look for.
  * @return True if the sequence supports some valid elements.
  */
 public boolean verifyGeneralAcceptance(
     EventSequence s,
     Vector<Element> alphabet,
     long[] sup,
     Vector<Integer>[] seqDB,
     Vector<Integer>[] posDB,
     int index) {
   boolean seqSupports = false;
   BitSet bs = new BitSet(alphabet.size());
   bs.clear();
   int from = 0;
   while (from < s.length()) {
     seqSupports = true;
     verifyContentGeneralAcceptance(
         s.elementAtIndex(from), alphabet, bs, sup, seqDB, posDB, index, from);
     from++;
   }
   return seqSupports;
 }