Class Utils
- java.lang.Object
-
- hudson.plugins.jacoco.portlet.utils.Utils
-
public final class Utils extends Object
Defines common methods that are used for the whole project.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Result
applyLogicalAnd(Result op1, Result op2)
Logical AND operation of Jenkins build results: Success AND Success = Success Unstable AND Unstable = Unstable Failure AND Failure = Failure X AND Failure = Failure, Failure AND X = Failure, X = Success/Unstable/Failure Y AND Unstable = Unstable, Unstable AND Y = Unstable, Y = Success/Unstablestatic Calendar
getLastDate(List<Job<?,?>> jobs)
For the given list of jobs, this will search all jobs and return the last run date of all.static int
nthOccurrence(String str, char c, int n)
static float
roundFloat(int scale, RoundingMode roundingMode, float value)
Method for rounding float values according to the requested mode.static int
validateChartAttributes(String attribute, int defaultValue)
Validate chart attributes returning a valid value to the object.
-
-
-
Method Detail
-
validateChartAttributes
public static int validateChartAttributes(String attribute, int defaultValue)
Validate chart attributes returning a valid value to the object.- Parameters:
attribute
- the attribute: width, height, number of daysdefaultValue
- default value for the attribute- Returns:
- int attribute valid value
-
getLastDate
public static Calendar getLastDate(List<Job<?,?>> jobs)
For the given list of jobs, this will search all jobs and return the last run date of all.- Parameters:
jobs
- a list of jobs from the DashBoard Portlet view- Returns:
- LocalDate the last date of all jobs that belongs to Dashboard View.
-
roundFloat
public static float roundFloat(int scale, RoundingMode roundingMode, float value)
Method for rounding float values according to the requested mode.- Parameters:
scale
- the rounding scaleroundingMode
- the rounding direction @see java.math.RoundingModevalue
- the value to be rounded- Returns:
- the rounded value
-
nthOccurrence
public static int nthOccurrence(String str, char c, int n)
-
applyLogicalAnd
public static Result applyLogicalAnd(Result op1, Result op2)
Logical AND operation of Jenkins build results: Success AND Success = Success Unstable AND Unstable = Unstable Failure AND Failure = Failure X AND Failure = Failure, Failure AND X = Failure, X = Success/Unstable/Failure Y AND Unstable = Unstable, Unstable AND Y = Unstable, Y = Success/Unstable- Parameters:
op1
- first resultop2
- second result- Returns:
- Logical AND operation of
op1 AND op2
-
-