Package com.google.gerrit.entities
Class PermissionRange
- java.lang.Object
-
- com.google.gerrit.entities.PermissionRange
-
- All Implemented Interfaces:
Comparable<PermissionRange>
- Direct Known Subclasses:
PermissionRange.WithDefaults
public class PermissionRange extends Object implements Comparable<PermissionRange>
Represents a closed interval [min, max] with a name. The special value [0, 0] is understood to be the empty range.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PermissionRange.WithDefaults
-
Constructor Summary
Constructors Modifier Constructor Description protected
PermissionRange()
PermissionRange(String name, int min, int max)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(PermissionRange o)
boolean
contains(int value)
True if the value is within the range.String
getLabel()
int
getMax()
int
getMin()
String
getName()
boolean
isEmpty()
boolean
isLabel()
int
squash(int value)
Normalize the value to fit within the bounds of the range.String
toString()
-
-
-
Field Detail
-
name
protected String name
-
min
protected int min
-
max
protected int max
-
-
Constructor Detail
-
PermissionRange
protected PermissionRange()
-
PermissionRange
public PermissionRange(String name, int min, int max)
-
-
Method Detail
-
getName
public String getName()
-
isLabel
public boolean isLabel()
-
getLabel
public String getLabel()
-
getMin
public int getMin()
-
getMax
public int getMax()
-
contains
public boolean contains(int value)
True if the value is within the range.
-
squash
public int squash(int value)
Normalize the value to fit within the bounds of the range.
-
isEmpty
public boolean isEmpty()
-
compareTo
public int compareTo(PermissionRange o)
- Specified by:
compareTo
in interfaceComparable<PermissionRange>
-
-