ContentEntry.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Leah.Speech.text {
  5. public class ContentEntry {
  6. private eMood _mood;
  7. private string _text;
  8. private List<ushort> _tags;
  9. private List<ushort> _optionalTags;
  10. private float _score; // TODO: Scoring einbauen
  11. public ContentEntry(string Text) {
  12. this._text = Text;
  13. this._mood = eMood.All;
  14. this._tags = new List<ushort>();
  15. }
  16. public ContentEntry(string Text, eMood Mood) {
  17. this._text = Text;
  18. this._mood = Mood;
  19. this._tags = new List<ushort>();
  20. }
  21. public ContentEntry(string Text, eMood Mood, ushort[] Tags) {
  22. this._text = Text;
  23. this._mood = Mood;
  24. this._tags = new List<ushort>(Tags);
  25. }
  26. public void AddTag(ushort s) {
  27. if(!this._tags.Contains(s)) {
  28. this._tags.Add(s);
  29. }
  30. }
  31. public int TagCount {
  32. get {
  33. return this._tags.Count;
  34. }
  35. }
  36. public void RemoveTag(ushort tag) {
  37. this._tags.Remove(tag);
  38. }
  39. public ushort[] Tags {
  40. get {
  41. return this._tags.ToArray();
  42. }
  43. set {
  44. this._tags = new List<ushort>(value);
  45. }
  46. }
  47. public string Text {
  48. get {
  49. return this._text;
  50. }
  51. set {
  52. this._text = value;
  53. }
  54. }
  55. public eMood Mood {
  56. get {
  57. return this._mood;
  58. }
  59. set {
  60. this._mood = value;
  61. }
  62. }
  63. public bool HasTags(ushort tag) {
  64. return this._tags.Contains(tag);
  65. }
  66. public bool HasTags(ushort[] tags) {
  67. foreach (ushort t in tags)
  68. if (!this._tags.Contains(t))
  69. return false;
  70. return true;
  71. }
  72. public override string ToString() {
  73. return this._text;
  74. }
  75. }
  76. }