/protocols/jain-mgcp/stack/src/main/java/org/mobicents/protocols/mgcp/jain/pkg/AnnouncementParmValue.java

http://mobicents.googlecode.com/ · Java · 125 lines · 83 code · 21 blank · 21 comment · 16 complexity · 46d2f95d8ae3e03096b1fd2ecabe0dda MD5 · raw file

  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.mobicents.protocols.mgcp.jain.pkg;
  23. import java.util.ArrayList;
  24. import java.util.List;
  25. public class AnnouncementParmValue extends Value {
  26. List<SegmentId> segmentIds = new ArrayList<SegmentId>();
  27. List<TextToSpeechSeg> textToSpeechSegs = new ArrayList<TextToSpeechSeg>();
  28. List<DisplayTextSeg> displayTextSegs = new ArrayList<DisplayTextSeg>();
  29. List<SilenceSeg> silenceSegs = new ArrayList<SilenceSeg>();
  30. Parameter parameter = null;
  31. public AnnouncementParmValue(Parameter parameter) {
  32. this.parameter = parameter;
  33. }
  34. public List<SegmentId> getSegmentIds() {
  35. return segmentIds;
  36. }
  37. public void addSegmentId(SegmentId s) {
  38. segmentIds.add(s);
  39. }
  40. public List<TextToSpeechSeg> getTextToSpeechSegs() {
  41. return textToSpeechSegs;
  42. }
  43. public void addTextToSpeechSeg(TextToSpeechSeg textToSpeechSeg) {
  44. textToSpeechSegs.add(textToSpeechSeg);
  45. }
  46. public List<DisplayTextSeg> getDisplayTextSegs() {
  47. return displayTextSegs;
  48. }
  49. public void addDisplayTextSeg(DisplayTextSeg displayTextSeg) {
  50. displayTextSegs.add(displayTextSeg);
  51. }
  52. public List<SilenceSeg> getSilenceSegs() {
  53. return silenceSegs;
  54. }
  55. public void addSilenceSeg(SilenceSeg silenceSeg) {
  56. silenceSegs.add(silenceSeg);
  57. }
  58. @Override
  59. public String toString() {
  60. String s = this.parameter + "=";
  61. boolean first = true;
  62. if (segmentIds.size() > 0) {
  63. for (SegmentId sId : segmentIds) {
  64. if (first) {
  65. s = s + sId.toString();
  66. first = false;
  67. } else {
  68. s = s + "," + sId.toString();
  69. }
  70. }
  71. }
  72. if (textToSpeechSegs.size() > 0) {
  73. for (TextToSpeechSeg ttsSeg : textToSpeechSegs) {
  74. if (first) {
  75. s = s + ttsSeg.toString();
  76. first = false;
  77. } else {
  78. s = s + "," + ttsSeg.toString();
  79. }
  80. }
  81. }
  82. if (displayTextSegs.size() > 0) {
  83. for (DisplayTextSeg dtSeg : displayTextSegs) {
  84. if (first) {
  85. s = s + dtSeg.toString();
  86. first = false;
  87. } else {
  88. s = s + "," + dtSeg.toString();
  89. }
  90. }
  91. }
  92. if (silenceSegs.size() > 0) {
  93. for (SilenceSeg siSeg : silenceSegs) {
  94. if (first) {
  95. s = s + siSeg.toString();
  96. first = false;
  97. } else {
  98. s = s + "," + siSeg.toString();
  99. }
  100. }
  101. }
  102. return s;
  103. }
  104. }