All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cloudsimplus.slametrics.SlaMetric Maven / Gradle / Ivy

Go to download

CloudSim Plus: A modern, highly extensible and easier-to-use Java 8 Framework for Modeling and Simulation of Cloud Computing Infrastructures and Services

There is a newer version: 8.0.0
Show newest version
/*
 * CloudSim Plus: A modern, highly-extensible and easier-to-use Framework for
 * Modeling and Simulation of Cloud Computing Infrastructures and Services.
 * http://cloudsimplus.org
 *
 *     Copyright (C) 2015-2018 Universidade da Beira Interior (UBI, Portugal) and
 *     the Instituto Federal de Educação Ciência e Tecnologia do Tocantins (IFTO, Brazil).
 *
 *     This file is part of CloudSim Plus.
 *
 *     CloudSim Plus is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     CloudSim Plus 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 General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with CloudSim Plus. If not, see .
 */
package org.cloudsimplus.slametrics;

import java.util.ArrayList;
import java.util.List;

/**
 * Represents a metric of a SLA contract.
 * Follows the standard defined by
 * AWS Cloudwatch.
 *
 * 

For more details, check * Raysa Oliveira's Master Thesis (only in Portuguese).

* * @author raysaoliveira */ public class SlaMetric { public static final SlaMetric NULL = new SlaMetric(); private static final SlaMetricDimension DEFAULT_MIN_DIMENSION = new SlaMetricDimension(-1); private static final SlaMetricDimension DEFAULT_MAX_DIMENSION = new SlaMetricDimension(Double.MAX_VALUE); private List dimensions; private String name; public SlaMetric(){ this(""); } public SlaMetric(final String name){ this.name = name; this.dimensions = new ArrayList<>(); } public List getDimensions() { return dimensions; } public SlaMetric setDimensions(List dimensions) { this.dimensions = dimensions == null ? new ArrayList<>() : dimensions; return this; } public String getName() { return name; } public SlaMetric setName(String name) { this.name = name == null ? "" : name; return this; } @Override public String toString() { return "Metric{name = " + name + ", dimensions = " + dimensions + '}'; } /** * Gets a {@link SlaMetricDimension} representing the minimum value expected for the metric. * If the {@link SlaMetricDimension#getValue()} is a negative number, it means * there is no minimum value. * @return */ public SlaMetricDimension getMinDimension() { return dimensions.stream() .filter(SlaMetricDimension::isMinValue) .findFirst().orElse(DEFAULT_MIN_DIMENSION); } /** * Gets a {@link SlaMetricDimension} representing the maximum value expected for the metric. * If the {@link SlaMetricDimension#getValue()} is equals to {@link Double#MAX_VALUE}, it means * there is no maximum value. * @return */ public SlaMetricDimension getMaxDimension() { return dimensions.stream() .filter(SlaMetricDimension::isMaxValue) .findFirst().orElse(DEFAULT_MAX_DIMENSION); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy