-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathStep.cs
More file actions
71 lines (61 loc) · 1.71 KB
/
Step.cs
File metadata and controls
71 lines (61 loc) · 1.71 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Text;
namespace Waher.Runtime.Text
{
/// <summary>
/// Represents a sub-sequence of symbols.
/// </summary>
/// <typeparam name="T">Type of symbols being compared.</typeparam>
public class Step<T>
{
private T[] symbols;
private readonly int index1;
private readonly int index2;
private readonly EditOperation operation;
/// <summary>
/// Represents a sub-sequence of symbols.
/// </summary>
/// <param name="Symbols">Sequence of symbols.</param>
/// <param name="Index1">Index into the first sequence of symbols.</param>
/// <param name="Index2">Index into the second sequence of symbols.</param>
/// <param name="Operation">Edit operation being performed.</param>
public Step(T[] Symbols, int Index1, int Index2, EditOperation Operation)
{
this.symbols = Symbols;
this.index1 = Index1;
this.index2 = Index2;
this.operation = Operation;
}
/// <summary>
/// Sequence of symbols.
/// </summary>
public T[] Symbols
{
get => this.symbols;
set => this.symbols = value;
}
/// <summary>
/// Index into the first sequence of symbols.
/// </summary>
public int Index1 => this.index1;
/// <summary>
/// Index into the second sequence of symbols.
/// </summary>
public int Index2 => this.index2;
/// <summary>
/// Edit operation being performed.
/// </summary>
public EditOperation Operation => this.operation;
/// <inheritdoc/>
public override string ToString()
{
StringBuilder Result = new StringBuilder();
Result.Append(this.operation.ToString());
Result.Append(": ");
foreach (T Symbol in this.symbols)
Result.Append(Symbol.ToString());
return Result.ToString();
}
}
}