Changeset 1175


Ignore:
Timestamp:
10/26/11 23:01:07 (19 months ago)
Author:
philsmart
Message:
 
Location:
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua
Files:
2 deleted
24 edited
1 moved

Legend:

Unmodified
Added
Removed
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/CapabilitiesConstructor.java

    r1097 r1175  
    4040import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    4141import uk.ac.cardiff.raptor.store.StorageEngine; 
    42 import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
     42import uk.ac.cardiff.raptormua.engine.statistics.BaseStatistic; 
    4343import uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler; 
    4444import uk.ac.cardiff.raptormua.engine.statistics.StatisticPostProcessor; 
     
    9393            capabilities = new Capabilities(); 
    9494 
    95             List<Statistic> su = statisticsHandler.getStatisticalUnits(); 
     95            List<BaseStatistic> su = statisticsHandler.getStatisticalUnits(); 
    9696 
    9797            capabilities.setMetadata(metadata); 
     
    128128 
    129129            ArrayList<StatisticalUnitInformation> stats = new ArrayList(); 
    130             for (Statistic entry : su) { 
     130            for (BaseStatistic entry : su) { 
    131131                log.debug("Setting statistical unit information as: " + entry.getStatisticParameters().getUnitName()); 
    132132                StatisticalUnitInformation information = new StatisticalUnitInformation(); 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/MUAEngine.java

    r1174 r1175  
    4848import uk.ac.cardiff.raptormua.engine.classification.ResourceClassificationBackgroundService; 
    4949import uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler; 
    50 import uk.ac.cardiff.raptormua.model.Users; 
    5150import uk.ac.cardiff.raptormua.upload.BatchFile; 
    5251 
     
    6867     */ 
    6968    private EventReleaseClient eventReleaseClient; 
    70  
    71     // TODO implement user level control on the MUA? 
    72     /** Support for user classification on the MUA. */ 
    73     private Users users; 
    7469 
    7570    /** The Storage Engine that handles all storage transactions. */ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/classification/SaveAndApplyResourceClassificationTask.java

    r1174 r1175  
    3939    private final Logger log = LoggerFactory.getLogger(SaveAndApplyResourceClassificationTask.class); 
    4040 
    41     /** The entry handler used to store entries (e.g. events) */ 
     41    /** The event handler used to access events */ 
    4242    private EventHandler entryHandler; 
    4343 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/BaseStatistic.java

    r1103 r1175  
    3535import uk.ac.cardiff.raptor.store.EventHandler; 
    3636import uk.ac.cardiff.raptormua.engine.statistics.processor.PostprocessorException; 
    37 import uk.ac.cardiff.raptormua.engine.statistics.processor.PreprocessorException; 
    3837import uk.ac.cardiff.raptormua.engine.statistics.records.Bucket; 
    3938import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
     
    4443 * @author philsmart Holds a statistics unit or one statistics operation on one piece of data 
    4544 */ 
    46 public abstract class Statistic { 
     45public abstract class BaseStatistic { 
    4746 
    4847    /** Class logger */ 
    49     private final Logger log = LoggerFactory.getLogger(Statistic.class); 
    50  
    51     /** 
    52      * The <code>EntryHandler</code> that allows access to all <code>Event</code>s this statistic works off. 
     48    private final Logger log = LoggerFactory.getLogger(BaseStatistic.class); 
     49 
     50    /** 
     51     * The <code>EventHandler</code> that allows access to all <code>Event</code>s this statistic works off. 
    5352     */ 
    5453    private EventHandler entryHandler; 
    5554 
    56     /** The parameters used to configure this statistic */ 
     55    /** The parameters used to configure this statistic. */ 
    5756    protected StatisticParameters statisticParameters; 
    5857 
    59     /** add a preprocessing module to the statistical method */ 
    60     private StatisticsPreProcessor preprocessor; 
    61  
    62     /** add a postprocessing module to the statistical method */ 
     58    /** A list of postprocessing modules. */ 
    6359    private List<StatisticPostProcessor> postprocessor; 
    6460 
     
    7268     * Default constructor. 
    7369     */ 
    74     public Statistic() { 
     70    public BaseStatistic() { 
    7571        setObservationSeries(new ArrayList<ObservationSeries>()); 
    7672    } 
     
    9692 
    9793    public void setEntryHandler(EventHandler entryHandler) { 
    98         if (preprocessor != null) 
    99             try { 
    100                 log.info("Invoking statistical preprocessor " + preprocessor.getClass()); 
    101                 preprocessor.preProcess(entryHandler); 
    102             } catch (PreprocessorException e) { 
    103                 log.error("Could not preprocess entries " + preprocessor.getClass()); 
    104             } 
    10594        this.entryHandler = entryHandler; 
    10695    } 
     
    175164            } 
    176165            // Buckets are time series, and so are already sorted chronologically. 
    177  
    178166            for (int i = 0; i < observationSeries.size(); i++) { 
    179167                buckets = (Bucket[]) observationSeries.get(i).getObservations(); 
     
    211199    /** 
    212200     * <p> 
    213      * pre processing effects the entries that go into the statistical unit post processing effects the observations 
    214      * that result form the statistical unit 
     201     * Send the results of performing the statistic to the post processors. 
    215202     * </p> 
    216203     */ 
     
    221208                        Arrays.toString(getPostprocessor().toArray(new StatisticPostProcessor[0]))); 
    222209                for (StatisticPostProcessor post : postprocessor) { 
    223                     // perform the same post process on each observationseries 
    224210                    for (ObservationSeries obsSeries : getObservationSeries()) { 
    225211                        obsSeries.setObservations(post.process(obsSeries.getObservations())); 
     
    230216            } 
    231217        } catch (PostprocessorException e) { 
    232             log.error("Could not post process entries, using " + getPostprocessor().getClass()); 
     218            log.error("Could not post process entries, using {}", getPostprocessor().getClass()); 
    233219        } 
    234220    } 
     
    252238    } 
    253239 
    254     public void setPreprocessor(StatisticsPreProcessor preprocessor) { 
    255         this.preprocessor = preprocessor; 
    256     } 
    257  
    258     public StatisticsPreProcessor getPreprocessor() { 
    259         return preprocessor; 
    260     } 
    261  
    262240    public List<StatisticPostProcessor> getPostprocessor() { 
    263241        return postprocessor; 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/ContextAwareStatisticRegistry.java

    r1097 r1175  
    4444 
    4545    /** 
    46      * List of {@link uk.ac.cardiff.raptormua.engine.statistics.Statistic}s that have been registered with this handler 
     46     * List of {@link uk.ac.cardiff.raptormua.engine.statistics.BaseStatistic}s that have been registered with this handler 
    4747     */ 
    48     private List<Statistic> statisticalUnits; 
     48    private List<BaseStatistic> statisticalUnits; 
    4949 
    5050    /** Used to automatically add statistics from the application context iff automaticallyFindStatsiticsToLoad = true */ 
     
    6363 
    6464    public void updateStatisticalUnit(StatisticalUnitInformation statisticalUnitInformation) { 
    65         Statistic toUpdate = null; 
    66         for (Statistic statistic : statisticalUnits) { 
     65        BaseStatistic toUpdate = null; 
     66        for (BaseStatistic statistic : statisticalUnits) { 
    6767            if (statistic.getStatisticParameters().getUnitName() 
    6868                    .equals(statisticalUnitInformation.getStatisticParameters().getUnitName())) 
     
    7575    } 
    7676 
    77     public Statistic getStatistic(String statisticName) { 
    78         for (Statistic statistic : statisticalUnits) { 
     77    public BaseStatistic getStatistic(String statisticName) { 
     78        for (BaseStatistic statistic : statisticalUnits) { 
    7979            if (statistic.getStatisticParameters().getUnitName().equals(statisticName)) { 
    8080                log.debug("Found statistic [{}] from statistic registry", statistic.getStatisticParameters() 
     
    9292     * @param statisticalUnitInformation - the statistical unit information to used update the <code>statistic</code> 
    9393     */ 
    94     private void performUpdate(Statistic statistic, StatisticalUnitInformation statisticalUnitInformation) { 
     94    private void performUpdate(BaseStatistic statistic, StatisticalUnitInformation statisticalUnitInformation) { 
    9595        statistic.setStatisticParameters(statisticalUnitInformation.getStatisticParameters()); 
    9696        // now deal with the post processors 
     
    123123     * <code>setStatisticalUnitsFromApplicationContext</code> method 
    124124     */ 
    125     public void setStatisticalUnits(List<Statistic> statisticalUnits) { 
    126         for (Statistic stat : statisticalUnits) { 
     125    public void setStatisticalUnits(List<BaseStatistic> statisticalUnits) { 
     126        for (BaseStatistic stat : statisticalUnits) { 
    127127            log.info("Registering statistic [{}], role {}", stat.getStatisticParameters().getUnitName(), stat 
    128128                    .getStatisticParameters().getType()); 
     
    133133 
    134134    public void setStatisticalUnitsFromApplicationContext() { 
    135         statisticalUnits = new ArrayList<Statistic>(); 
    136         Map<String, ?> allStatisticBeans = applicationContext.getBeansOfType(Statistic.class); 
     135        statisticalUnits = new ArrayList<BaseStatistic>(); 
     136        Map<String, ?> allStatisticBeans = applicationContext.getBeansOfType(BaseStatistic.class); 
    137137        for (Map.Entry<String, ?> entry : allStatisticBeans.entrySet()) { 
    138             log.debug("Registering statistic [{}], role {}", ((Statistic) entry.getValue()).getStatisticParameters() 
    139                     .getUnitName(), ((Statistic) entry.getValue()).getStatisticParameters().getType()); 
    140             statisticalUnits.add((Statistic) entry.getValue()); 
     138            log.debug("Registering statistic [{}], role {}", ((BaseStatistic) entry.getValue()).getStatisticParameters() 
     139                    .getUnitName(), ((BaseStatistic) entry.getValue()).getStatisticParameters().getType()); 
     140            statisticalUnits.add((BaseStatistic) entry.getValue()); 
    141141        } 
    142142    } 
    143143 
    144     public List<Statistic> getStatisticalUnits() { 
     144    public List<BaseStatistic> getStatisticalUnits() { 
    145145        return statisticalUnits; 
    146146    } 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/DefaultStatisticProcessorRegistry.java

    r1097 r1175  
    2121import uk.ac.cardiff.model.wsmodel.ProcessorInformation; 
    2222 
     23//TODO NEW and not finished. 
    2324public class DefaultStatisticProcessorRegistry implements StatisticProcessorRegistry { 
    2425 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/SQLFilterConstructor.java

    r787 r1175  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptormua.engine.statistics; 
    1718 
     
    2122 
    2223/** 
    23  * This is a experimental and not very well implemented  engine for constructing 
    24  * SQL filters (principaly where), for use by the statistics engine. 
    25  * 
     24 * This is a experimental and not very well implemented engine for constructing SQL filters (principaly where), for use 
     25 * by the statistics engine. 
     26 *  
    2627 * @author philsmart 
    27  * 
     28 *  
    2829 */ 
    2930public class SQLFilterConstructor { 
    3031 
    31         private SQLFilter sqlFilter; 
     32    private SQLFilter sqlFilter; 
    3233 
    33         public SQLFilterConstructor(SQLFilter sqlFilter){ 
    34                 this.sqlFilter = sqlFilter; 
     34    public SQLFilterConstructor(SQLFilter sqlFilter) { 
     35        this.sqlFilter = sqlFilter; 
    3536 
    36         } 
     37    } 
    3738 
    38         /** 
    39          * Perform the conversion of the <code>SQLFilter</code> into a string that 
    40          * can be inserted into an SQL expression. 
    41          * 
    42          * @return 
    43          */ 
    44         public String convertFilterToString(){ 
     39    /** 
     40     * Perform the conversion of the <code>SQLFilter</code> into a string that can be inserted into an SQL expression. 
     41     *  
     42     * @return 
     43     */ 
     44    public String convertFilterToString() { 
    4545 
    46                 if (sqlFilter instanceof SQLWhere){ 
    47                         return buildWhere((SQLWhere)sqlFilter); 
    48                 } 
     46        if (sqlFilter instanceof SQLWhere) { 
     47            return buildWhere((SQLWhere) sqlFilter); 
     48        } 
    4949 
    50                 return null; 
     50        return null; 
    5151 
    52         } 
     52    } 
    5353 
    54         private String buildWhere(SQLWhere sqlWhere){ 
    55                 StringBuilder sql = new StringBuilder(); 
     54    private String buildWhere(SQLWhere sqlWhere) { 
     55        StringBuilder sql = new StringBuilder(); 
    5656 
    57                 CompOp comparisonOperator = sqlWhere.getBooleanExpression().getBooleanTerm().getBooleanFactor().getBooleanTest().getBooleanPrimary().getPredicate().getComparisonPredicate().getCompOp(); 
    58                 String fieldName = sqlWhere.getBooleanExpression().getBooleanTerm().getBooleanFactor().getBooleanTest().getBooleanPrimary().getPredicate().getComparisonPredicate().getFieldName(); 
    59                 String value = sqlWhere.getBooleanExpression().getBooleanTerm().getBooleanFactor().getBooleanTest().getBooleanPrimary().getPredicate().getComparisonPredicate().getValue(); 
     57        CompOp comparisonOperator = 
     58                sqlWhere.getBooleanExpression().getBooleanTerm().getBooleanFactor().getBooleanTest() 
     59                        .getBooleanPrimary().getPredicate().getComparisonPredicate().getCompOp(); 
     60        String fieldName = 
     61                sqlWhere.getBooleanExpression().getBooleanTerm().getBooleanFactor().getBooleanTest() 
     62                        .getBooleanPrimary().getPredicate().getComparisonPredicate().getFieldName(); 
     63        String value = 
     64                sqlWhere.getBooleanExpression().getBooleanTerm().getBooleanFactor().getBooleanTest() 
     65                        .getBooleanPrimary().getPredicate().getComparisonPredicate().getValue(); 
    6066 
    61                 sql.append(fieldName); 
    62                 if (comparisonOperator==CompOp.EQUAL)sql.append("="); 
    63                 if (comparisonOperator==CompOp.NOT_EQUAL)sql.append("!="); 
    64                 sql.append("'"+value+"'"); 
     67        sql.append(fieldName); 
     68        if (comparisonOperator == CompOp.EQUAL) 
     69            sql.append("="); 
     70        if (comparisonOperator == CompOp.NOT_EQUAL) 
     71            sql.append("!="); 
     72        sql.append("'" + value + "'"); 
    6573 
    66                 if (sql.length()==0)return null; 
     74        if (sql.length() == 0) 
     75            return null; 
    6776 
    68                 return sql.toString(); 
     77        return sql.toString(); 
    6978 
    70  
    71         } 
    72  
    73  
     79    } 
    7480 
    7581} 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/StatisticHandler.java

    r1082 r1175  
    5252    public AggregatorGraphModel performStatistic(String statisticName) { 
    5353        if (statisticRegistry != null) { 
    54             Statistic statistic = statisticRegistry.getStatistic(statisticName); 
     54            BaseStatistic statistic = statisticRegistry.getStatistic(statisticName); 
    5555            if (statistic != null) { 
    5656                return performStatiticalPipeline(statistic); 
     
    6262    } 
    6363 
    64     private AggregatorGraphModel performStatiticalPipeline(Statistic statistic) { 
     64    private AggregatorGraphModel performStatiticalPipeline(BaseStatistic statistic) { 
    6565        statistic.setEntryHandler(getEventHandler()); 
    6666        Boolean success = invoke(statistic); 
     
    9292     * @param statistic 
    9393     */ 
    94     private Boolean invoke(Statistic statistic) { 
     94    private Boolean invoke(BaseStatistic statistic) { 
    9595        if (getEventHandler() != null) 
    9696            log.debug("Invoking statistic [{}], working off {} events", statistic.getStatisticParameters() 
     
    133133    } 
    134134 
    135     public List<Statistic> getStatisticalUnits() { 
     135    public List<BaseStatistic> getStatisticalUnits() { 
    136136        return statisticRegistry.getStatisticalUnits(); 
    137137    } 
     
    158158     */ 
    159159    @Deprecated 
    160     public void setStatisticalUnits(List<Statistic> statisticalUnits) { 
     160    public void setStatisticalUnits(List<BaseStatistic> statisticalUnits) { 
    161161        if (statisticRegistry == null) { 
    162162            statisticRegistry = new ContextAwareStatisticRegistry(); 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/StatisticRegistry.java

    r1097 r1175  
    3636     * @return 
    3737     */ 
    38     public Statistic getStatistic(String statisticName); 
     38    public BaseStatistic getStatistic(String statisticName); 
    3939 
    4040    /** 
     
    4343     * @param statisticalUnits - the <code>Statistic</code>s to register 
    4444     */ 
    45     public void setStatisticalUnits(List<Statistic> statisticalUnits); 
     45    public void setStatisticalUnits(List<BaseStatistic> statisticalUnits); 
    4646 
    4747    /** 
     
    5050     * @return a <code>List</code> of currently registered statistics 
    5151     */ 
    52     public List<Statistic> getStatisticalUnits(); 
     52    public List<BaseStatistic> getStatisticalUnits(); 
    5353 
    5454} 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/StatisticalUnitException.java

    r1020 r1175  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptormua.engine.statistics; 
    1718 
    18 public class StatisticalUnitException extends Exception{ 
     19public class StatisticalUnitException extends Exception { 
    1920 
    20         /** 
    21          *  
    22          */ 
    23         private static final long serialVersionUID = -4614661463043866258L; 
    24          
    25         public StatisticalUnitException (String message){ 
    26                         super(message); 
    27         } 
    28          
    29         public StatisticalUnitException (String message, Exception wrappedException){ 
    30                 super(message, wrappedException); 
    31         } 
     21    /** 
     22     * Generated serial UID. 
     23     */ 
     24    private static final long serialVersionUID = -4614661463043866258L; 
    3225 
     26    /** Constructor. */ 
     27    public StatisticalUnitException() { 
     28        super(); 
     29    } 
     30 
     31    /** 
     32     * Constructor. 
     33     *  
     34     * @param message exception message 
     35     */ 
     36    public StatisticalUnitException(final String message) { 
     37        super(message); 
     38    } 
     39 
     40    /** 
     41     * Constructor. 
     42     *  
     43     * @param wrappedException exception to be wrapped by this one 
     44     */ 
     45    public StatisticalUnitException(final Exception wrappedException) { 
     46        super(wrappedException); 
     47    } 
     48 
     49    /** 
     50     * Constructor. 
     51     *  
     52     * @param message exception message 
     53     * @param wrappedException exception to be wrapped by this one 
     54     */ 
     55    public StatisticalUnitException(final String message, final Exception wrappedException) { 
     56        super(message, wrappedException); 
     57    } 
    3358 
    3459} 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/CountEntry.java

    r1082 r1175  
    2525import uk.ac.cardiff.model.wsmodel.MethodParameter; 
    2626import uk.ac.cardiff.model.wsmodel.StatisticParameters; 
    27 import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
     27import uk.ac.cardiff.raptormua.engine.statistics.BaseStatistic; 
    2828import uk.ac.cardiff.raptormua.engine.statistics.StatisticalUnitException; 
    2929import uk.ac.cardiff.raptormua.engine.statistics.records.Bucket; 
    3030import uk.ac.cardiff.raptormua.engine.statistics.records.ObservationSeries; 
    3131 
    32 public class CountEntry extends Statistic{ 
     32public class CountEntry extends BaseStatistic{ 
    3333 
    3434        /** Class logger */ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/CountEntryPerInterval.java

    r1082 r1175  
    2626import uk.ac.cardiff.model.wsmodel.StatisticParameters; 
    2727import uk.ac.cardiff.model.wsmodel.MethodParameter.ParameterType; 
    28 import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
     28import uk.ac.cardiff.raptormua.engine.statistics.BaseStatistic; 
    2929import uk.ac.cardiff.raptormua.engine.statistics.StatisticalUnitException; 
    3030import uk.ac.cardiff.raptormua.engine.statistics.records.Bucket; 
    3131import uk.ac.cardiff.raptormua.engine.statistics.records.ObservationSeries; 
    3232 
    33 public class CountEntryPerInterval extends Statistic{ 
     33public class CountEntryPerInterval extends BaseStatistic{ 
    3434 
    3535        static Logger log = LoggerFactory.getLogger(CountEntryPerInterval.class); 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupBy.java

    r1082 r1175  
    2727import uk.ac.cardiff.model.wsmodel.MethodParameter.ParameterType; 
    2828import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    29 import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
     29import uk.ac.cardiff.raptormua.engine.statistics.BaseStatistic; 
    3030import uk.ac.cardiff.raptormua.engine.statistics.StatisticalUnitException; 
    3131import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
    3232import uk.ac.cardiff.raptormua.engine.statistics.records.ObservationSeries; 
    3333 
    34 public class GroupBy extends Statistic{ 
     34public class GroupBy extends BaseStatistic{ 
    3535 
    3636        /** Class logger */ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupByCountDistinct.java

    r1082 r1175  
    2828import uk.ac.cardiff.raptor.runtimeutils.ReflectionException; 
    2929import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    30 import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
     30import uk.ac.cardiff.raptormua.engine.statistics.BaseStatistic; 
    3131import uk.ac.cardiff.raptormua.engine.statistics.StatisticalUnitException; 
    3232import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
    3333import uk.ac.cardiff.raptormua.engine.statistics.records.ObservationSeries; 
    3434 
    35 public class GroupByCountDistinct extends Statistic { 
     35public class GroupByCountDistinct extends BaseStatistic { 
    3636 
    3737        /** Class logger */ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/functions/GroupByFrequency.java

    r1082 r1175  
    2727import uk.ac.cardiff.model.wsmodel.MethodParameter.ParameterType; 
    2828import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    29 import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
     29import uk.ac.cardiff.raptormua.engine.statistics.BaseStatistic; 
    3030import uk.ac.cardiff.raptormua.engine.statistics.StatisticalUnitException; 
    3131import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
    3232import uk.ac.cardiff.raptormua.engine.statistics.records.ObservationSeries; 
    3333 
    34 public class GroupByFrequency extends Statistic { 
     34public class GroupByFrequency extends BaseStatistic { 
    3535 
    3636        /** Class logger */ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/helper/ObservationComparator.java

    r807 r1175  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptormua.engine.statistics.helper; 
    2021 
     
    2425 
    2526/** 
     27 * The Class ObservationComparator. 
     28 *  
    2629 * @author philsmart 
    27  * 
    2830 */ 
    29 public class ObservationComparator implements Comparator<Observation>{ 
     31public class ObservationComparator implements Comparator<Observation> { 
    3032 
     33    /** Whether the observations should be sorted in ascending order. Sorted in descending order otherwise. */ 
    3134    private boolean asc; 
    3235 
    33         public ObservationComparator(boolean asc){ 
    34                 this.asc = asc; 
     36    /** 
     37     * Instantiates a new observation comparator. 
     38     *  
     39     * @param asc the asc 
     40     */ 
     41    public ObservationComparator(boolean asc) { 
     42        this.asc = asc; 
    3543    } 
    3644 
     45    /* 
     46     * (non-Javadoc) 
     47     *  
     48     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) 
     49     */ 
    3750    public int compare(Observation arg0, Observation arg1) { 
    38         if (asc) 
    39             return (int)(arg0.getValue() - arg1.getValue()); //if =0 same, < 0 smaller, >0 bigger 
    40         else 
    41             return (int)(arg1.getValue() - arg0.getValue()); 
     51        if (asc) 
     52            return (int) (arg0.getValue() - arg1.getValue()); // if =0 same, < 0 smaller, >0 bigger 
     53        else 
     54            return (int) (arg1.getValue() - arg0.getValue()); 
    4255    } 
    4356 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/helper/StringGroupComparator.java

    r807 r1175  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptormua.engine.statistics.helper; 
    2021 
     
    2526import org.slf4j.LoggerFactory; 
    2627 
    27 import uk.ac.cardiff.raptormua.engine.statistics.Statistic; 
    2828import uk.ac.cardiff.raptormua.engine.statistics.records.Group; 
    29 import uk.ac.cardiff.raptormua.engine.statistics.records.Observation; 
    3029 
    3130/** 
     31 * The Class StringGroupComparator. 
     32 *  
    3233 * @author philsmart 
    33  * 
    3434 */ 
    35 public class StringGroupComparator implements Comparator<Group>{ 
    36          
    37         /** Class logger */ 
    38         private final Logger log = LoggerFactory.getLogger(StringGroupComparator.class); 
     35public class StringGroupComparator implements Comparator<Group> { 
    3936 
     37    /** Class logger. */ 
     38    private final Logger log = LoggerFactory.getLogger(StringGroupComparator.class); 
     39 
     40    /** The asc. */ 
    4041    private boolean asc; 
    4142 
    42         public StringGroupComparator(boolean asc){ 
    43                 this.asc = asc; 
     43    /** 
     44     * Instantiates a new string group comparator. 
     45     *  
     46     * @param asc the asc 
     47     */ 
     48    public StringGroupComparator(boolean asc) { 
     49        this.asc = asc; 
    4450    } 
    4551 
     52    /* 
     53     * (non-Javadoc) 
     54     *  
     55     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) 
     56     */ 
    4657    public int compare(Group arg0, Group arg1) { 
    47         Collator c = Collator.getInstance(); 
    48         return c.compare(arg0.getGroupName(),arg1.getGroupName()); 
     58        Collator c = Collator.getInstance(); 
     59        return c.compare(arg0.getGroupName(), arg1.getGroupName()); 
    4960    } 
    5061 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/processor/NumberFormatterPostProcessor.java

    r1083 r1175  
    3434 */ 
    3535public class NumberFormatterPostProcessor implements StatisticPostProcessor { 
    36  
     36    // TODO Not implemented... 
    3737    /** class logger */ 
    3838    private static final Logger log = LoggerFactory.getLogger(NumberFormatterPostProcessor.class); 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/processor/PostprocessorException.java

    r1020 r1175  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptormua.engine.statistics.processor; 
    1718 
    18 public class PostprocessorException extends Exception{ 
     19public class PostprocessorException extends Exception { 
    1920 
    20         /** 
    21          * 
    22         */ 
    23         private static final long serialVersionUID = -4614661463043866256L; 
     21    /** 
     22     * Generated serial UID 
     23    */ 
     24    private static final long serialVersionUID = -4614661463043866256L; 
    2425 
    25         public PostprocessorException (String message){ 
    26                         super(message); 
    27         } 
     26    /** Constructor. */ 
     27    public PostprocessorException() { 
     28        super(); 
     29    } 
    2830 
     31    /** 
     32     * Constructor. 
     33     *  
     34     * @param message exception message 
     35     */ 
     36    public PostprocessorException(final String message) { 
     37        super(message); 
     38    } 
     39 
     40    /** 
     41     * Constructor. 
     42     *  
     43     * @param wrappedException exception to be wrapped by this one 
     44     */ 
     45    public PostprocessorException(final Exception wrappedException) { 
     46        super(wrappedException); 
     47    } 
     48 
     49    /** 
     50     * Constructor. 
     51     *  
     52     * @param message exception message 
     53     * @param wrappedException exception to be wrapped by this one 
     54     */ 
     55    public PostprocessorException(final String message, final Exception wrappedException) { 
     56        super(message, wrappedException); 
     57    } 
    2958 
    3059} 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/processor/SamlMetadataNameFormatter.java

    r1083 r1175  
    5555    private final Logger log = LoggerFactory.getLogger(SamlMetadataNameFormatter.class); 
    5656 
    57     /** this is not a proper URI at the moment, just a UNC path */ 
     57    /* this is not a proper URI at the moment, just a UNC path */ 
    5858    private String SAMLMetadataURI; 
    5959 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/records/Bucket.java

    r363 r1175  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptormua.engine.statistics.records; 
    1718 
    1819import org.joda.time.DateTime; 
    1920 
    20 public class Bucket extends Observation{ 
     21/** 
     22 * The Class Bucket. 
     23 */ 
     24public class Bucket extends Observation { 
    2125 
    22         private DateTime start; 
    23         private DateTime end; 
     26    /** The start date and time. */ 
     27    private DateTime start; 
    2428 
     29    /** The end date and time. */ 
     30    private DateTime end; 
    2531 
     32    /** 
     33     * Checks if is inside. 
     34     *  
     35     * @param eventTime the event time 
     36     * @return true, if is inside 
     37     */ 
     38    public boolean isInside(DateTime eventTime) { 
     39        /* semantics here are; if equal to or after start but before end return true */ 
     40        if ((eventTime.isEqual(start) && eventTime.isBefore(end)) 
     41                || (eventTime.isAfter(start) && eventTime.isBefore(end))) 
     42            return true; 
     43        return false; 
     44    } 
    2645 
    27         public boolean isInside(DateTime eventTime){ 
    28                 /* semantics here are; if equal to or after start but before end return true*/ 
    29                 if ((eventTime.isEqual(start) && eventTime.isBefore(end)) || (eventTime.isAfter(start) && eventTime.isBefore(end))) return true; 
    30                 return false; 
    31         } 
     46    /** 
     47     * Increment. 
     48     */ 
     49    public void increment() { 
     50        value++; 
     51    } 
    3252 
    33         public void increment(){ 
    34                 value++; 
    35         } 
     53    /** 
     54     * Sets the start. 
     55     *  
     56     * @param start the start to set 
     57     */ 
     58    public void setStart(DateTime start) { 
     59        this.start = start; 
     60    } 
    3661 
    37         /** 
    38          * @param start the start to set 
    39          */ 
    40         public void setStart(DateTime start) { 
    41                 this.start = start; 
    42         } 
    43         /** 
    44          * @return the start 
    45          */ 
    46         public DateTime getStart() { 
    47                 return start; 
    48         } 
    49         /** 
    50          * @param end the end to set 
    51          */ 
    52         public void setEnd(DateTime end) { 
    53                 this.end = end; 
    54         } 
    55         /** 
    56          * @return the end 
    57          */ 
    58         public DateTime getEnd() { 
    59                 return end; 
    60         } 
     62    /** 
     63     * Gets the start. 
     64     *  
     65     * @return the start 
     66     */ 
     67    public DateTime getStart() { 
     68        return start; 
     69    } 
    6170 
     71    /** 
     72     * Sets the end. 
     73     *  
     74     * @param end the end to set 
     75     */ 
     76    public void setEnd(DateTime end) { 
     77        this.end = end; 
     78    } 
     79 
     80    /** 
     81     * Gets the end. 
     82     *  
     83     * @return the end 
     84     */ 
     85    public DateTime getEnd() { 
     86        return end; 
     87    } 
    6288 
    6389} 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/records/GraphEntry.java

    r363 r1175  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptormua.engine.statistics.records; 
    2021 
    2122/** 
    22  * @author philsmart 
    23  * this is a generic category, data class to send as a result of a statistical operation for display, may need subclassing 
    24  * in the future e.g. for line charts etc that require more values - This format should be compatible with primeface 
    25  * graphing components. 
     23 * @author philsmart this is a generic category, data class to send as a result of a statistical operation for display, 
     24 *         may need subclassing in the future e.g. for line charts etc that require more values - This format should be 
     25 *         compatible with view graphing components. 
    2626 */ 
    2727public class GraphEntry { 
    28         /* the label that is to be displayed for the data entry e.g. a time interval, or a server hostname */ 
    29         private String categoryLabel; 
    30         /* the actual value of the data entry e.g. frequency, mean etc. */ 
    31         private double value; 
     28    /** the label that is to be displayed for the data entry e.g. a time interval, or a server hostname */ 
     29    private String categoryLabel; 
    3230 
     31    /** the actual value of the data entry e.g. frequency, mean etc. */ 
     32    private double value; 
    3333 
    34         public void setCategoryLabel(String categoryLabel) { 
    35                 this.categoryLabel = categoryLabel; 
    36         } 
    37         public String getCategoryLabel() { 
    38                 return categoryLabel; 
    39         } 
    40         public void setValue(double value) { 
    41                 this.value = value; 
    42         } 
    43         public double getValue() { 
    44                 return value; 
    45         } 
     34    public void setCategoryLabel(String categoryLabel) { 
     35        this.categoryLabel = categoryLabel; 
     36    } 
     37 
     38    public String getCategoryLabel() { 
     39        return categoryLabel; 
     40    } 
     41 
     42    public void setValue(double value) { 
     43        this.value = value; 
     44    } 
     45 
     46    public double getValue() { 
     47        return value; 
     48    } 
    4649 
    4750} 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/records/Group.java

    r363 r1175  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptormua.engine.statistics.records; 
    2021 
    2122/** 
     23 * The Class Group. 
     24 *  
    2225 * @author philsmart 
    23  * 
    2426 */ 
    25 public class Group extends Observation{ 
     27public class Group extends Observation { 
    2628 
    27         private String groupName; 
     29    /** The group name. */ 
     30    private String groupName; 
    2831 
     32    /** 
     33     * Sets the group name. 
     34     *  
     35     * @param groupName the new group name 
     36     */ 
     37    public void setGroupName(String groupName) { 
     38        this.groupName = groupName; 
     39    } 
    2940 
    30         public void setGroupName(String groupName) { 
    31                 this.groupName = groupName; 
    32         } 
    33         public String getGroupName() { 
    34                 return groupName; 
    35         } 
    36         public void increment() { 
    37                 value++; 
     41    /** 
     42     * Gets the group name. 
     43     *  
     44     * @return the group name 
     45     */ 
     46    public String getGroupName() { 
     47        return groupName; 
     48    } 
    3849 
    39         } 
     50    /** 
     51     * Increment. 
     52     */ 
     53    public void increment() { 
     54        value++; 
     55 
     56    } 
    4057 
    4158} 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/records/Observation.java

    r363 r1175  
    1717 * 
    1818 */ 
     19 
    1920package uk.ac.cardiff.raptormua.engine.statistics.records; 
    2021 
    2122/** 
     23 * The Class Observation. 
     24 *  
    2225 * @author philsmart 
    23  * 
    2426 */ 
    2527public class Observation { 
    2628 
    27         protected double value; 
     29    /** The value. */ 
     30    protected double value; 
    2831 
    29         public void setValue(double value) { 
    30                 this.value = value; 
    31         } 
     32    /** 
     33     * Sets the value. 
     34     *  
     35     * @param value the new value 
     36     */ 
     37    public void setValue(double value) { 
     38        this.value = value; 
     39    } 
    3240 
    33         public double getValue() { 
    34                 return value; 
    35         } 
     41    /** 
     42     * Gets the value. 
     43     *  
     44     * @return the value 
     45     */ 
     46    public double getValue() { 
     47        return value; 
     48    } 
    3649 
    3750} 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/statistics/records/ObservationSeries.java

    r1082 r1175  
    1414 * limitations under the License. 
    1515 */ 
     16 
    1617package uk.ac.cardiff.raptormua.engine.statistics.records; 
    1718 
     19/** 
     20 * The Class ObservationSeries. 
     21 */ 
     22public class ObservationSeries { 
    1823 
    19 public class ObservationSeries { 
    20          
    21         private String seriesName; 
    22          
    23     /* 
    24      * each statistical method produces objects (observations) which are stored in this array variable ready for postprocessing or construction of an 
    25      * <code>AggregatorGraphModel</code> 
     24    /** The series name. */ 
     25    private String seriesName; 
     26 
     27    /** 
     28     * Each statistical method produces objects (observations) which are stored in this array variable ready for 
     29     * postprocessing or construction of an <code>AggregatorGraphModel</code>. 
    2630     */ 
    2731    private Observation[] observations; 
    2832 
    29         public void setSeriesName(String seriesName) { 
    30                 this.seriesName = seriesName; 
    31         } 
     33    /** 
     34     * Sets the series name. 
     35     *  
     36     * @param seriesName the new series name 
     37     */ 
     38    public void setSeriesName(String seriesName) { 
     39        this.seriesName = seriesName; 
     40    } 
    3241 
    33         public String getSeriesName() { 
    34                 return seriesName; 
    35         } 
     42    /** 
     43     * Gets the series name. 
     44     *  
     45     * @return the series name 
     46     */ 
     47    public String getSeriesName() { 
     48        return seriesName; 
     49    } 
    3650 
    37         public void setObservations(Observation[] observations) { 
    38                 this.observations = observations; 
    39         } 
     51    /** 
     52     * Sets the observations. 
     53     *  
     54     * @param observations the new observations 
     55     */ 
     56    public void setObservations(Observation[] observations) { 
     57        this.observations = observations; 
     58    } 
    4059 
    41         public Observation[] getObservations() { 
    42                 return observations; 
    43         } 
     60    /** 
     61     * Gets the observations. 
     62     *  
     63     * @return the observations 
     64     */ 
     65    public Observation[] getObservations() { 
     66        return observations; 
     67    } 
    4468 
    4569} 
Note: See TracChangeset for help on using the changeset viewer.