-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathText.cs
52 lines (44 loc) · 1.19 KB
/
Text.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
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;
using Interfaces.TextObjectModel;
using Interfaces.TextObjectModel.Sentences;
using TextObjectModel.Sentences;
namespace TextObjectModel
{
[DataContract(Namespace = "")]
[KnownType(typeof(Sentence))]
public class Text : IText
{
private IList<ISentence> _sentences;
[DataMember]
public IList<ISentence> Sentences
{
get => _sentences;
private set
{
if (value.Count == 0)
throw new ArgumentException("Value cannot be an empty collection.", nameof(value));
_sentences = value;
}
}
public Text()
{
Sentences = new List<ISentence>();
}
public Text(IList<ISentence> sentences)
{
Sentences = sentences;
}
public override string ToString()
{
var stringBuilder = new StringBuilder();
foreach (var item in Sentences)
{
stringBuilder.Append(item);
}
return stringBuilder.ToString();
}
}
}