View Javadoc

1   /**
2    * Copyright 2010-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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  package org.kuali.common.util;
17  
18  public enum Size {
19  
20  	BYTE(1, "b", "bytes/s"), //
21  	KB(1024, "k", "KB/s"), //
22  	MB(1024 * Size.KB.getValue(), "m", "MB/s"), //
23  	GB(1024 * Size.MB.getValue(), "g", "GB/s"), //
24  	TB(1024 * Size.GB.getValue(), "t", "TB/s"), //
25  	PB(1024 * Size.TB.getValue(), "p", "PB/s"), //
26  	EB(1024 * Size.PB.getValue(), "e", "EB/s");
27  
28  	private long value;
29  	private String sizeLabel;
30  	private String rateLabel;
31  
32  	private Size(long value, String sizeLabel, String rateLabel) {
33  		this.value = value;
34  		this.sizeLabel = sizeLabel;
35  		this.rateLabel = rateLabel;
36  	}
37  
38  	public long getValue() {
39  		return value;
40  	}
41  
42  	public String getSizeLabel() {
43  		return sizeLabel;
44  	}
45  
46  	public String getRateLabel() {
47  		return rateLabel;
48  	}
49  
50  }