From 29e89219e568a0f43f51e1f15b5a2f6e044ddf38 Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Thu, 7 Jul 2011 09:09:16 +0000
Subject: [PATCH] DIPLODOCUS: Lossy ch, evt, req in txt specs

---
 src/tmltranslator/TMLTextSpecification.java | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/tmltranslator/TMLTextSpecification.java b/src/tmltranslator/TMLTextSpecification.java
index 7d78767078..88a1a21a14 100755
--- a/src/tmltranslator/TMLTextSpecification.java
+++ b/src/tmltranslator/TMLTextSpecification.java
@@ -739,7 +739,7 @@ public class TMLTextSpecification {
 				return -1;
 			}
 			
-			if (!checkParameter("LOSSYCHANNEL", _split, 3, 1, _lineNb)) {
+			if (!checkParameter("LOSSYCHANNEL", _split, 3, 9, _lineNb)) {
 				return -1;
 			}
 			
@@ -876,7 +876,7 @@ public class TMLTextSpecification {
 				return -1;
 			}
 			
-			if (!checkParameter("LOSSYEVENT", _split, 3, 1, _lineNb)) {
+			if (!checkParameter("LOSSYEVENT", _split, 3, 9, _lineNb)) {
 				return -1;
 			}
 			
@@ -979,7 +979,7 @@ public class TMLTextSpecification {
 				return -1;
 			}
 			
-			if (!checkParameter("LOSSYREQUEST", _split, 3, 1, _lineNb)) {
+			if (!checkParameter("LOSSYREQUEST", _split, 3, 9, _lineNb)) {
 				return -1;
 			}
 			
@@ -2408,6 +2408,11 @@ public class TMLTextSpecification {
 					err = true;
 				}
 				break;	
+			case 9:
+				if (!isANegativeOrPositiveNumeral(_split[_parameter])) {
+					err = true;
+				}
+				break;
 			}
 		} else {
 			err = true;
@@ -2444,6 +2449,13 @@ public class TMLTextSpecification {
 		return _num.matches("\\d*");
 	}
 	
+	public boolean isANegativeOrPositiveNumeral(String _num) {
+		if (_num.startsWith("-")) {
+			return isANumeral(_num.substring(1, _num.length()));
+		}
+		return isANumeral(_num);
+	}
+	
 	public boolean isAValidUnit(String s) {
 		if (s.compareTo("ns") == 0) {
 			return true;
-- 
GitLab