public class WeekdaySet extends AbstractSimpleDatatype<Integer>
Datatype
represents a set
of Weekday
s. It can
represent any unordered combination from none to all.Modifier and Type | Field and Description |
---|---|
static WeekdaySet |
ALL
|
static WeekdaySet |
NONE
|
private static long |
serialVersionUID |
private Set<Weekday> |
set |
static WeekdaySet |
WORKDAYS
|
Constructor and Description |
---|
WeekdaySet(Integer bitmask)
The constructor.
|
WeekdaySet(Set<Weekday> set)
The constructor.
|
WeekdaySet(Weekday... weekdays)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Weekday weekday)
This method determines if this
WeekdaySet contains the given Weekday . |
private static int |
encode(Set<Weekday> set)
This method encodes the given
set to a bit-mask for getValue() . |
private static int |
encode(Weekday... weekdays)
This method encodes the given
set to a bit-mask for getValue() . |
Weekday |
getNextMatch(Weekday weekday)
|
Set<Weekday> |
getSet()
|
Integer |
getValue()
This method returns the
WeekdaySet as compressed mask of seven bits. |
WeekdaySet |
invert()
This method returns a new
WeekdaySet that is the inverse selection of this WeekdaySet . |
String |
toString()
|
equals, getValue, hashCode
private static final long serialVersionUID
public static final WeekdaySet NONE
public static final WeekdaySet ALL
public static final WeekdaySet WORKDAYS
public WeekdaySet(Integer bitmask)
bitmask
- - see getValue()
.public WeekdaySet(Set<Weekday> set)
set
- is the set
representing the WeekdaySet
to create.public WeekdaySet(Weekday... weekdays)
weekdays
- are the Weekday
s representing the WeekdaySet
to create.private static int encode(Weekday... weekdays)
set
to a bit-mask for getValue()
.private static int encode(Set<Weekday> set)
set
to a bit-mask for getValue()
.public Integer getValue()
WeekdaySet
as compressed mask of seven bits.
This method returns the raw value of this datatype. This will typically be a standard datatype (like String
, Character
, Boolean
, any type of Number
, any type of java.time.LocalDate
, etc.).getValue
in interface AttributeReadValue<Integer>
getValue
in interface SimpleDatatype<Integer>
getValue
in class AbstractSimpleDatatype<Integer>
public boolean contains(Weekday weekday)
WeekdaySet
contains the given Weekday
. This is equivalent to:
getSet()
.contains
(weekday)
public Weekday getNextMatch(Weekday weekday)
Weekday
contained
in this WeekdaySet
starting
with the given weekday
. If the given weekday
is contained
, it will be
returned. Otherwise the next
successor is determined.weekday
- is the Weekday
to start with.Weekday
starting with the given weekday
or null
if this WeekdaySet
is empty
.public String toString()
Datatype
String
representation of this Datatype
. While the general contract of
Object.toString()
is very weak and mainly used for debugging, the contract here is very strong. The
returned String
has to be suitable for end-users and official output to any kind of sink. NlsMessage
for
this purpose and implement NlsObject
if you want to support I18N/L10N.public WeekdaySet invert()
WeekdaySet
that is the inverse selection of this WeekdaySet
. Every
Weekday
contained
in this WeekdaySet
is NOT contained
in the returned result and vice versa.WeekdaySet
.Copyright © 2001–2016 mmm-Team. All rights reserved.