|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RangeFunctions | Line # 26 | 3 | 0% | 3 | 0 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (3) | |||
| Result | |||
|
0.33333334
|
uk.co.gidley.jmxmonitor.functions.RangeFunctionsTest.testAbove
uk.co.gidley.jmxmonitor.functions.RangeFunctionsTest.testAbove
|
1 PASS | |
|
0.33333334
|
uk.co.gidley.jmxmonitor.functions.RangeFunctionsTest.testBetween
uk.co.gidley.jmxmonitor.functions.RangeFunctionsTest.testBetween
|
1 PASS | |
|
0.33333334
|
uk.co.gidley.jmxmonitor.functions.RangeFunctionsTest.testBelow
uk.co.gidley.jmxmonitor.functions.RangeFunctionsTest.testBelow
|
1 PASS | |
| 1 | /* | |
| 2 | * Copyright 2010 Ben Gidley | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | ||
| 17 | package uk.co.gidley.jmxmonitor.functions; | |
| 18 | ||
| 19 | /** | |
| 20 | * Library of extra functions for scripting. These are just to make it easier to do things in the scripts | |
| 21 | * <p/> | |
| 22 | * This library is themed around checking ranges | |
| 23 | * <p/> | |
| 24 | * Created by IntelliJ IDEA. User: ben Date: Jan 19, 2010 Time: 1:08:02 PM | |
| 25 | */ | |
| 26 | public class RangeFunctions { | |
| 27 | ||
| 28 | /** | |
| 29 | * Returns true IFF reading is greater than value | |
| 30 | * | |
| 31 | * @param reading | |
| 32 | * @param value | |
| 33 | * @return | |
| 34 | */ | |
| 35 | 2 |
public static boolean isAbove(long reading, long value) { |
| 36 | 2 | return reading > value; |
| 37 | } | |
| 38 | ||
| 39 | /** | |
| 40 | * Returns true IFF reading is less than value | |
| 41 | * | |
| 42 | * @param reading | |
| 43 | * @param value | |
| 44 | * @return | |
| 45 | */ | |
| 46 | 2 |
public static boolean isBelow(long reading, long value) { |
| 47 | 2 | return reading < value; |
| 48 | } | |
| 49 | ||
| 50 | /** | |
| 51 | * Returns true IFF reading is between floor and ceiling | |
| 52 | * | |
| 53 | * @param reading | |
| 54 | * @param floor | |
| 55 | * @param ceiling | |
| 56 | * @return | |
| 57 | */ | |
| 58 | 3 |
public static boolean isBetween(long reading, long floor, long ceiling) { |
| 59 | 3 | return reading < ceiling && reading > floor; |
| 60 | } | |
| 61 | } | |
|
||||||||||||