001package de.learnlib.oracles; 002 003import de.learnlib.api.SUL; 004import de.learnlib.statistics.Counter; 005import de.learnlib.statistics.StatisticSUL; 006 007public class SymbolCounterSUL<I, O> implements StatisticSUL<I,O> { 008 009 private final SUL<I,O> sul; 010 private final Counter counter; 011 012 public SymbolCounterSUL(String name, SUL<I,O> sul) { 013 this.sul = sul; 014 this.counter = new Counter(name, "symbols"); 015 } 016 017 /* (non-Javadoc) 018 * @see de.learnlib.api.SUL#pre() 019 */ 020 @Override 021 public void pre() { 022 sul.pre(); 023 } 024 025 026 /* (non-Javadoc) 027 * @see de.learnlib.api.SUL#post() 028 */ 029 @Override 030 public void post() { 031 sul.post(); 032 } 033 034 /* (non-Javadoc) 035 * @see de.learnlib.api.SUL#step(java.lang.Object) 036 */ 037 @Override 038 public O step(I in) { 039 counter.increment(); 040 return sul.step(in); 041 } 042 043 /* (non-Javadoc) 044 * @see de.learnlib.statistics.StatisticSUL#getStatisticalData() 045 */ 046 @Override 047 public Counter getStatisticalData() { 048 return counter; 049 } 050 051 052 053}