Browse Source

Add numeric stuff to IRCDataInEvent

pull/116/head
Shane Mc Cormack 8 years ago
parent
commit
ef20a80eb7
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      irc/src/com/dmdirc/parser/irc/events/IRCDataInEvent.java

+ 13
- 0
irc/src/com/dmdirc/parser/irc/events/IRCDataInEvent.java View File

@@ -41,6 +41,7 @@ public class IRCDataInEvent extends DataInEvent {
41 41
     private final ReadLine line;
42 42
     private final String[] tokenisedData;
43 43
     private final String action;
44
+    private final int numeric;
44 45
 
45 46
     public IRCDataInEvent(final IRCParser parser, final LocalDateTime date, final ReadLine line) {
46 47
         super(parser, date, checkNotNull(line).getLine());
@@ -63,6 +64,10 @@ public class IRCDataInEvent extends DataInEvent {
63 64
         } else {
64 65
             action = "";
65 66
         }
67
+
68
+        int num = -1;
69
+        try { num = Integer.parseInt(action); } catch (final NumberFormatException e) { }
70
+        numeric = num;
66 71
     }
67 72
 
68 73
     public String[] getTokenisedData() {
@@ -76,4 +81,12 @@ public class IRCDataInEvent extends DataInEvent {
76 81
     public String getAction() {
77 82
         return action;
78 83
     }
84
+
85
+    public boolean isNumeric() {
86
+        return numeric != -1;
87
+    }
88
+
89
+    public int getNumeric() {
90
+        return numeric;
91
+    }
79 92
 }

Loading…
Cancel
Save