James Moger
2013-11-20 8f1c9fd7e0f7ea3d7d0b87788eb92ba2f0f09d59
commit | author | age
f13c4c 1 /*
JM 2  * Copyright 2011 gitblit.com.
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  */
1f9dae 16 package com.gitblit.models;
fc8426 17
JM 18 import java.io.Serializable;
19
d9f687 20 /**
JM 21  * Metric is a serializable model class that encapsulates metrics for some given
22  * type.
699e71 23  *
d9f687 24  * @author James Moger
699e71 25  *
d9f687 26  */
e19d3d 27 public class Metric implements Serializable, Comparable<Metric> {
fc8426 28
JM 29     private static final long serialVersionUID = 1L;
30
d9f687 31     public final String name;
fc8426 32     public double count;
45c0d6 33     public double tag;
JM 34     public int duration;
fc8426 35
JM 36     public Metric(String name) {
37         this.name = name;
38     }
e19d3d 39
JM 40     @Override
41     public int compareTo(Metric o) {
42         if (count > o.count) {
43             return -1;
44         }
45         if (count < o.count) {
46             return 1;
47         }
48         return 0;
49     }
fc8426 50 }