-
Notifications
You must be signed in to change notification settings - Fork 0
/
Researcher.cs
54 lines (53 loc) · 1.61 KB
/
Researcher.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Lab01
{
class Researcher : Person, IDeepCopy
{
public double Exp { get; set; }
protected List<Paper> listPaper;
public Researcher(Person p, double exp, params Paper[] papers) : base(p.FirstName, p.LastName, p.Date)
{
Exp = exp;
listPaper = new List<Paper>();
AddPapers(papers);
}
public override string ToString()
{
StringBuilder str = new StringBuilder();
foreach (Paper pap in listPaper)
{
str.Append(" " + pap);
}
return (base.ToString() + " exp: " + Exp + "\n research:\n" + str);
}
public override string ToShortString()
{
return (base.ToShortString() + " exp: " + Exp + "\n count research: " + listPaper.Count + "\n");
}
public void AddPapers(params Paper[] papers)
{
foreach (Paper pap in papers)
{
listPaper.Add(pap);
}
}
public void RemovePaperAt(int index)
{
listPaper.RemoveAt(index);//hz
}
public override object DeepCopy()
{
Researcher res = new Researcher((Person)base.DeepCopy(), this.Exp, new Paper[] { });
foreach (Paper pap in listPaper)
{
res.listPaper.Add((Paper)pap.DeepCopy());
//res.AddPapers((Paper)pap.DeepCopy());
}
return res;
}
}
}