WorkingTime

Inheritance: java.lang.Object

public class WorkingTime

Represents a working time during a weekday.

Constructors

ConstructorDescription
WorkingTime(Date fromTime, Date toTime)Initializes a new instance of the WorkingTime class with a interval with the specified start and finish times.
WorkingTime(double fromTime, double toTime)Initializes a new instance of the WorkingTime class with an interval item with the specified start and finish times.
WorkingTime(int fromHours, int toHours)Initializes a new instance of the WorkingTime class with an interval item with the specified start and finish times.

Methods

MethodDescription
equals(Object obj)Checks that the objects are equal.
getFrom()Gets the beginning of a working time.
getTo()Gets the end of a working time.
hashCode()Returns a hash code value for the instance of the WorkingTime class.

WorkingTime(Date fromTime, Date toTime)

public WorkingTime(Date fromTime, Date toTime)

Initializes a new instance of the WorkingTime class with a interval with the specified start and finish times.

Parameters:

ParameterTypeDescription
fromTimejava.util.Dateinterval start time
toTimejava.util.Dateinterval end time

WorkingTime(double fromTime, double toTime)

public WorkingTime(double fromTime, double toTime)

Initializes a new instance of the WorkingTime class with an interval item with the specified start and finish times.


The overload of WorkingTime ctor can be used to initialize interval’s start and end using TimeSpans:


 [C#]
 var wt = new WorkingTime(new TimeSpan(9, 0, 0), new TimeSpan(18, 0, 0));
 

Parameters:

ParameterTypeDescription
fromTimedoubleInterval’s start time represented by double struct.
toTimedoubleInterval’s end time represented by double struct.

WorkingTime(int fromHours, int toHours)

public WorkingTime(int fromHours, int toHours)

Initializes a new instance of the WorkingTime class with an interval item with the specified start and finish times.


The overload of WorkingTime ctor can be used to initialize interval’s start and end using whole hours:


 [C#]
 var wt = new WorkingTime(9, 13);
 

Parameters:

ParameterTypeDescription
fromHoursintInterval’s start time represented by whole number of hours (0-24).
toHoursintInterval’s end time represented by whole number of hours (0-24).

equals(Object obj)

public boolean equals(Object obj)

Checks that the objects are equal.

Parameters:

ParameterTypeDescription
objjava.lang.ObjectSecond object to compare.

Returns: boolean - True if the objects are equal, false otherwise.

getFrom()

public final Date getFrom()

Gets the beginning of a working time.

Returns: java.util.Date - the beginning of a working time.

getTo()

public final Date getTo()

Gets the end of a working time.

Returns: java.util.Date - the end of a working time.

hashCode()

public int hashCode()

Returns a hash code value for the instance of the WorkingTime class.

Returns: int - returns a hash code value for this object.