136 lines
3.1 KiB
Java
136 lines
3.1 KiB
Java
/*
|
|
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
|
*
|
|
* This file is part of StatoolInfos, simple service statistics tool.
|
|
*
|
|
* StatoolInfos is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
* License, or (at your option) any later version.
|
|
*
|
|
* StatoolInfos is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package fr.devinsy.statoolinfos.core;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import fr.devinsy.strings.StringList;
|
|
|
|
/**
|
|
* The Class Metric.
|
|
*/
|
|
public class Metric
|
|
{
|
|
private static Logger logger = LoggerFactory.getLogger(Metric.class);
|
|
|
|
public enum Type
|
|
{
|
|
MONTHS,
|
|
WEEKS,
|
|
DAYS
|
|
}
|
|
|
|
private String path;
|
|
private String name;
|
|
private String description;
|
|
private String startYear;
|
|
private StringList yearValues;
|
|
private StringList monthValues;
|
|
private StringList weekValues;
|
|
private StringList dayValues;
|
|
|
|
/**
|
|
* Instantiates a new metric.
|
|
*/
|
|
public Metric(final String path, final String name, final String description, final String startYear)
|
|
{
|
|
this.path = path;
|
|
this.name = name;
|
|
this.description = description;
|
|
this.startYear = startYear;
|
|
this.yearValues = new StringList();
|
|
this.monthValues = new StringList();
|
|
this.weekValues = new StringList();
|
|
this.dayValues = new StringList();
|
|
}
|
|
|
|
public StringList getDayValues()
|
|
{
|
|
return this.dayValues;
|
|
}
|
|
|
|
public String getDescription()
|
|
{
|
|
return this.description;
|
|
}
|
|
|
|
public StringList getMonthValues()
|
|
{
|
|
return this.monthValues;
|
|
}
|
|
|
|
public String getName()
|
|
{
|
|
return this.name;
|
|
}
|
|
|
|
public String getStartYear()
|
|
{
|
|
return this.startYear;
|
|
}
|
|
|
|
public StringList getWeekValues()
|
|
{
|
|
return this.weekValues;
|
|
}
|
|
|
|
public StringList getYearValues()
|
|
{
|
|
return this.yearValues;
|
|
}
|
|
|
|
/**
|
|
* Checks if is empty.
|
|
*
|
|
* @return true, if is empty
|
|
*/
|
|
public boolean isEmpty()
|
|
{
|
|
boolean result;
|
|
|
|
if ((this.monthValues.isEmpty()) && (this.weekValues.isEmpty()) && (this.dayValues.isEmpty()))
|
|
{
|
|
result = true;
|
|
}
|
|
else
|
|
{
|
|
result = false;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public void setDescription(final String description)
|
|
{
|
|
this.description = description;
|
|
}
|
|
|
|
public void setName(final String name)
|
|
{
|
|
this.name = name;
|
|
}
|
|
|
|
public void setStartYear(final String startYear)
|
|
{
|
|
this.startYear = startYear;
|
|
}
|
|
|
|
}
|