Skip to content

Commit b2b7d67

Browse files
committed
wip
1 parent 74ca6c7 commit b2b7d67

12 files changed

Lines changed: 2866 additions & 418 deletions

ShiftSharp/Break.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
*/
2424

25-
2625
using NodaTime;
2726

2827
namespace Point85.ShiftSharp.Schedule
@@ -32,10 +31,21 @@ namespace Point85.ShiftSharp.Schedule
3231
/// </summary>
3332
public class Break : TimePeriod
3433
{
34+
/// <summary>
35+
/// Break constructor
36+
/// </summary>
37+
/// <param name="name">Name of break</param>
38+
/// <param name="description">Description of break</param>
39+
/// <param name="start">Start time of break</param>
40+
/// <param name="duration">Duration of break</param>
3541
public Break(string name, string description, LocalTime start, Duration duration) : base(name, description, start, duration)
3642
{
3743
}
3844

45+
/// <summary>
46+
/// A break is a working period
47+
/// </summary>
48+
/// <returns>True</returns>
3949
public override bool IsWorkingPeriod()
4050
{
4151
return true;

ShiftSharp/DayOff.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
*/
2424

25-
2625
using NodaTime;
2726

2827
namespace Point85.ShiftSharp.Schedule
@@ -37,6 +36,10 @@ internal DayOff(string name, string description, LocalTime start, Duration durat
3736
{
3837
}
3938

39+
/// <summary>
40+
/// A DayOff is not a working period
41+
/// </summary>
42+
/// <returns>False</returns>
4043
public override bool IsWorkingPeriod()
4144
{
4245
return false;

ShiftSharp/Named.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
*/
2424

25-
2625
using System;
2726

2827
namespace Point85.ShiftSharp.Schedule
@@ -32,17 +31,26 @@ namespace Point85.ShiftSharp.Schedule
3231
/// </summary>
3332
public abstract class Named
3433
{
35-
// name
34+
/// <summary>
35+
/// name
36+
/// </summary>
3637
public string Name { get; set; }
3738

38-
// description
39+
/// <summary>
40+
/// description
41+
/// </summary>
3942
public string Description { get; set; }
4043

4144
protected Named()
4245
{
4346

4447
}
4548

49+
/// <summary>
50+
/// Constructor
51+
/// </summary>
52+
/// <param name="name">Name</param>
53+
/// <param name="description">Description</param>
4654
protected Named(string name, string description)
4755
{
4856
Name = name ?? throw new Exception(WorkSchedule.GetMessage("name.not.defined"));

ShiftSharp/NonWorkingPeriod.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,24 @@ namespace Point85.ShiftSharp.Schedule
3333
/// </summary>
3434
public class NonWorkingPeriod : Named, IComparable<NonWorkingPeriod>
3535
{
36-
// owning work schedule
36+
/// <summary>
37+
/// owning work schedule
38+
/// </summary>
3739
public WorkSchedule WorkSchedule { get; internal set; }
3840

39-
// starting date and time of day
41+
/// <summary>
42+
/// starting date and time of day
43+
/// </summary>
4044
public LocalDateTime StartDateTime { get; set; }
4145

42-
// duration of period
46+
/// <summary>
47+
/// duration of period
48+
/// </summary>
4349
public Duration Duration;
4450

51+
/// <summary>
52+
/// Constructor
53+
/// </summary>
4554
public NonWorkingPeriod() : base()
4655
{
4756
}

ShiftSharp/Rotation.cs

Lines changed: 47 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
*/
2424

25-
2625
using NodaTime;
2726
using System;
2827
using System.Collections.Generic;
@@ -34,10 +33,14 @@ namespace Point85.ShiftSharp.Schedule
3433
/// </summary>
3534
public class Rotation : Named, IComparable<Rotation>
3635
{
37-
// working periods in the rotation
36+
/// <summary>
37+
/// working periods in the rotation
38+
/// </summary>
3839
public List<RotationSegment> RotationSegments { get; private set; } = new List<RotationSegment>();
3940

40-
// list of working and non-working days
41+
/// <summary>
42+
/// list of working and non-working days
43+
/// </summary>
4144
private List<TimePeriod> periods;
4245

4346
// name of the day off time period
@@ -60,33 +63,26 @@ static Rotation()
6063
DAY_OFF = dayOff;
6164
}
6265

63-
/**
64-
* Default constructor
65-
*/
66+
/// <summary>
67+
/// default constructor
68+
/// </summary>
6669
public Rotation() : base()
6770
{
6871
}
6972

70-
/**
71-
* Constructor
72-
*
73-
* @param name
74-
* Rotation name
75-
* @param description
76-
* Description
77-
* @throws Exception
78-
* Exception
79-
*/
73+
/// <summary>
74+
/// Constructor
75+
/// </summary>
76+
/// <param name="name">name of rotation</param>
77+
/// <param name="description">description of rotation</param>
8078
public Rotation(string name, string description) : base(name, description)
8179
{
82-
8380
}
8481

85-
/**
86-
* Get the shifts and off-shifts in the rotation
87-
*
88-
* @return List of periods
89-
*/
82+
/// <summary>
83+
/// get the shifts and off-shifts in the rotation
84+
/// </summary>
85+
/// <returns>List of time periods</returns>
9086
public List<TimePeriod> GetPeriods()
9187
{
9288
if (periods == null)
@@ -114,36 +110,31 @@ public List<TimePeriod> GetPeriods()
114110
}
115111
}
116112
}
117-
118113
return periods;
119114
}
120115

121-
/**
122-
* Get the number of days in the rotation
123-
*
124-
* @return Day count
125-
*/
126-
116+
/// <summary>
117+
/// Get the number of days in the rotation
118+
/// </summary>
119+
/// <returns></returns>
127120
public int GetDayCount()
128121
{
129122
return GetPeriods().Count;
130123
}
131124

132-
/**
133-
* Get the duration of this rotation
134-
*
135-
* @return Duration
136-
*/
125+
/// <summary>
126+
/// Get the duration of this rotation
127+
/// </summary>
128+
/// <returns>Duration</returns>
137129
public Duration GetDuration()
138130
{
139131
return Duration.FromDays(GetPeriods().Count);
140132
}
141133

142-
/**
143-
* Get the shift rotation's total working time
144-
*
145-
* @return Duration of working time
146-
*/
134+
/// <summary>
135+
/// Get the shift rotation's total working time
136+
/// </summary>
137+
/// <returns>Duration</returns>
147138
public Duration GetWorkingTime()
148139
{
149140
Duration sum = Duration.Zero;
@@ -158,20 +149,14 @@ public Duration GetWorkingTime()
158149
return sum;
159150
}
160151

161-
/**
162-
* Add a working period to this rotation. A working period starts with a
163-
* shift and specifies the number of days on and days off
164-
*
165-
* @param startingShift
166-
* {@link Shift} that starts the period
167-
* @param daysOn
168-
* Number of days on shift
169-
* @param daysOff
170-
* Number of days off shift
171-
* @return {@link RotationSegment}
172-
* @throws Exception
173-
* Exception
174-
*/
152+
/// <summary>
153+
/// Add a working period to this rotation. A working period starts with a
154+
/// shift and specifies the number of days on and days off.
155+
/// </summary>
156+
/// <param name="startingShift">Starting shift of rotation</param>
157+
/// <param name="daysOn">Number of day on shift</param>
158+
/// <param name="daysOff">Number of days off shift</param>
159+
/// <returns>Part of the rotation</returns>
175160
public RotationSegment AddSegment(Shift startingShift, int daysOn, int daysOff)
176161
{
177162
if (startingShift == null)
@@ -184,14 +169,20 @@ public RotationSegment AddSegment(Shift startingShift, int daysOn, int daysOff)
184169
return segment;
185170
}
186171

172+
/// <summary>
173+
/// Compare thsi rotation to another rotation
174+
/// </summary>
175+
/// <param name="other">Other rotation</param>
176+
/// <returns></returns>
187177
public int CompareTo(Rotation other)
188178
{
189179
return Name.CompareTo(other.Name);
190180
}
191181

192-
/**
193-
* Build a string representation of this rotation
194-
*/
182+
/// <summary>
183+
/// Build a string representation of this rotation
184+
/// </summary>
185+
/// <returns>String</returns>
195186
public override string ToString()
196187
{
197188
string named = base.ToString();

ShiftSharp/RotationSegment.cs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2323
*/
2424

2525
using System;
26-
using System.Collections.Generic;
27-
using System.Linq;
28-
using System.Text;
29-
using System.Threading.Tasks;
3026

3127
namespace Point85.ShiftSharp.Schedule
3228
{
@@ -41,21 +37,29 @@ public class RotationSegment : IComparable<RotationSegment>
4137
/// </summary>
4238
public Rotation Rotation { get; private set; }
4339

44-
// strict ordering
40+
/// <summary>
41+
/// ordering within the rotation
42+
/// </summary>
4543
public int Sequence { get; set; } = 0;
4644

47-
// shift that starts this segment
45+
/// <summary>
46+
/// shift that starts this segment
47+
/// </summary>
4848
public Shift StartingShift { get; set; }
4949

50-
// number of days on
50+
/// <summary>
51+
/// number of days on shift
52+
/// </summary>
5153
public int DaysOn { get; set; } = 0;
5254

53-
// number of days off
55+
/// <summary>
56+
/// number of days off shift
57+
/// </summary>
5458
public int DaysOff { get; set; } = 0;
5559

56-
/**
57-
* Constructor
58-
*/
60+
/// <summary>
61+
/// Constructor
62+
/// </summary>
5963
public RotationSegment()
6064
{
6165
}
@@ -68,13 +72,12 @@ internal RotationSegment(Shift startingShift, int daysOn, int daysOff, Rotation
6872
this.Rotation = rotation;
6973
}
7074

71-
/**
72-
* Compare this rotation segment to another one.
73-
*
74-
* @param other
75-
* rotation segment
76-
* @return -1 if less than, 0 if equal and 1 if greater than
77-
*/
75+
76+
/// <summary>
77+
/// Compare this rotation segment to
78+
/// </summary>
79+
/// <param name="other">Other rotation segment</param>
80+
/// <returns>-1 if less than, 0 if equal and 1 if greater than</returns>
7881
public int CompareTo(RotationSegment other)
7982
{
8083
int value = 0;

0 commit comments

Comments
 (0)