Last change
on this file since 15723 was
15723,
checked in by lkammere, 6 years ago
|
#2886: Add simple data analysis tests and further informations about algorithm run.
|
File size:
738 bytes
|
Rev | Line | |
---|
[15712] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using System.Threading.Tasks;
|
---|
| 6 |
|
---|
| 7 | namespace HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration.GrammarEnumeration {
|
---|
| 8 | public class SymbolString : List<Symbol> {
|
---|
| 9 |
|
---|
[15723] | 10 | public SymbolString() { }
|
---|
| 11 |
|
---|
[15712] | 12 | public SymbolString(IEnumerable<Symbol> symbols) : base(symbols) { }
|
---|
| 13 |
|
---|
| 14 | public bool IsSentence() {
|
---|
| 15 | return this.All(sym => sym is TerminalSymbol);
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | public int[] GetNonterminalSymbolIndexes() {
|
---|
| 19 | return Enumerable.Range(0, Count)
|
---|
| 20 | .Where(i => this[i] is NonterminalSymbol)
|
---|
| 21 | .ToArray();
|
---|
| 22 | }
|
---|
| 23 |
|
---|
[15723] | 24 | public override string ToString() {
|
---|
[15712] | 25 | return string.Join(" ", this);
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.