Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
TaskItem.cs
1using System.Threading.Tasks;
3
5{
10 {
11 private readonly int checkPosition;
12 private readonly bool isChecked;
13
22 : base(Document, Child)
23 {
24 this.isChecked = IsChecked;
25 this.checkPosition = CheckPosition;
26 }
27
31 public bool IsChecked => this.isChecked;
32
36 public int CheckPosition => this.checkPosition;
37
42 public override Task Render(IRenderer Output) => Output.Render(this);
43
47 public override bool InlineSpanElement => this.Child.InlineSpanElement;
48
57 {
58 return new TaskItem(Document, this.isChecked, this.checkPosition, Child);
59 }
60
67 public override bool SameMetaData(MarkdownElement E)
68 {
69 return E is TaskItem x &&
70 x.isChecked == this.isChecked &&
71 x.checkPosition == this.checkPosition &&
72 base.SameMetaData(E);
73 }
74
80 public override bool Equals(object obj)
81 {
82 return obj is TaskItem x &&
83 this.isChecked == x.isChecked &&
84 this.checkPosition == x.checkPosition &&
85 base.Equals(obj);
86 }
87
92 public override int GetHashCode()
93 {
94 int h1 = base.GetHashCode();
95 int h2 = this.isChecked.GetHashCode();
96
97 h1 = ((h1 << 5) + h1) ^ h2;
98 h2 = this.checkPosition.GetHashCode();
99
100 h1 = ((h1 << 5) + h1) ^ h2;
101
102 return h1;
103 }
104
109 public override void IncrementStatistics(MarkdownStatistics Statistics)
110 {
111 Statistics.NrTaskItems++;
112 Statistics.NrListItems++;
113 }
114
115 }
116}
Contains a markdown document. This markdown document class supports original markdown,...
Contains some basic statistical information about a Markdown document.
int NrListItems
Number of list items (total).
Abstract base class for block elements with one child.
Represents a task item in a task list.
Definition: TaskItem.cs:10
override bool InlineSpanElement
If the element is an inline span element.
Definition: TaskItem.cs:47
TaskItem(MarkdownDocument Document, bool IsChecked, int CheckPosition, MarkdownElement Child)
Represents a task item in a task list.
Definition: TaskItem.cs:21
int CheckPosition
Position of the checkmark in the original markdown text document.
Definition: TaskItem.cs:36
override void IncrementStatistics(MarkdownStatistics Statistics)
Increments the property or properties in Statistics corresponding to the element.
Definition: TaskItem.cs:109
override Task Render(IRenderer Output)
Renders the element.
bool IsChecked
If the item is checked or not.
Definition: TaskItem.cs:31
override bool SameMetaData(MarkdownElement E)
If the current object has same meta-data as E (but not necessarily same content).
Definition: TaskItem.cs:67
override int GetHashCode()
Serves as the default hash function.
Definition: TaskItem.cs:92
override bool Equals(object obj)
Determines whether the specified object is equal to the current object.
Definition: TaskItem.cs:80
override MarkdownElementSingleChild Create(MarkdownElement Child, MarkdownDocument Document)
Creates an object of the same type, and meta-data, as the current object, but with content defined by...
Definition: TaskItem.cs:56
Abstract base class for all markdown elements.
abstract bool InlineSpanElement
If the element is an inline span element.
MarkdownDocument Document
Markdown document.
Abstract base class for all markdown elements with one child element.
Interface for Markdown renderers.
Definition: IRenderer.cs:12