Projekt

Obecné

Profil

Stáhnout (1.97 KB) Statistiky
| Větev: | Tag: | Revize:
1
//
2
// Author: A. Konig
3
//
4

    
5
using System;
6

    
7
namespace ServerApp.Parser.OutputInfo
8
{
9
    /// <summary>
10
    /// Class representing the number of events in a given time interval a given faculty
11
    /// - shortest possible interval is 1h
12
    /// </summary>
13
    /// <author>A. Konig</author>
14
    public class ActivityInfo
15
    {
16
        /// <summary> Building </summary>
17
        public string building;
18
        /// <summary> Number of events </summary>
19
        public int amount;
20
        /// <summary> Start of interval </summary>
21
        public DateTime startTime;
22
        /// <summary> Length of interval in hours </summary>
23
        public int intervalLength;
24

    
25
        /// <summary>
26
        /// Constructor
27
        /// </summary>
28
        /// <param name="faculty">Faculty</param>
29
        /// <param name="amount">Number of events</param>
30
        /// <param name="startTime">Start of recorded interval</param>
31
        /// <param name="intervalLength">Length of recorded interval</param>
32
        public ActivityInfo(string faculty, int amount, DateTime startTime, int intervalLength)
33
        {
34
            this.building = faculty;
35
            this.amount = amount;
36
            this.startTime = startTime;
37
            this.intervalLength = intervalLength;
38
        }
39

    
40
        /// <summary>
41
        /// To string
42
        /// </summary>
43
        /// <returns>"start time    faculty     number of events"</returns>
44
        public override string ToString()
45
        {
46
            return $"{startTime} \t {building} \t {amount}";
47
        }
48

    
49

    
50
        /// <summary>
51
        /// Compares object to other instance
52
        /// </summary>
53
        /// <param name="obj"></param>
54
        /// <returns></returns>
55
        public override bool Equals(object obj)
56
        {
57
            ActivityInfo other = (ActivityInfo)obj;
58

    
59
            if (building == other.building && amount == other.amount && startTime == other.startTime && intervalLength == other.intervalLength)
60
                return true;
61

    
62
            return false;
63
        }
64
    }
65
}
(1-1/4)