I
IchBin
Given the following code snippet. Why would I not get a pattern match
from a JTree Selection?
( Code Snippet )____________________________
System.out.println(selectedIP.substring(0,(selectedIP.indexOf("["))
-1).trim());
TreePath currentPath = tree.getSelectionPath();
TreePath parentPath = currentPath.getParentPath();
System.out.println(parentPath.toString());
Pattern openPattern = Pattern.compile("Opens");
System.out.println("openPattern: "+openPattern);
Pattern closePattern = Pattern.compile("Closes");
System.out.println("closePattern: "+closePattern);
Pattern dropPattern = Pattern.compile("Drops");
System.out.println("dropPattern: "+dropPattern);
CharSequence inputStr = parentPath.toString();
System.out.println("CharSequence: "+inputStr);
Matcher openMatcher = openPattern.matcher(inputStr);
System.out.println("openMatch: "+openMatcher.matches());
Matcher closeMatcher = closePattern.matcher(inputStr);
System.out.println("closeMatcher: "+closeMatcher.matches());
Matcher dropMatcher = dropPattern.matcher(inputStr);
System.out.println("dropMatcher: "+dropMatcher.matches());
( Display Output per/selection )____________________________
24.229.165.60
[UDP, IP Opens, 509 Records]
openPattern: Opens
closePattern: Closes
dropPattern: Drops
CharSequence: [UDP, IP Opens, 509 Records]
openMatch: false
closeMatcher: false
dropMatcher: false
24.229.165.60
[UDP, IP Closes, 489 Records]
openPattern: Opens
closePattern: Closes
dropPattern: Drops
CharSequence: [UDP, IP Closes, 489 Records]
openMatch: false
closeMatcher: false
dropMatcher: false
Thanks in Advance...
IchBin
__________________________________________________________________________
'The meeting of two personalities is like the contact of two chemical
substances:
if there is any reaction, both are transformed.'
- Carl Gustav Jung, (1875-1961), psychiatrist and psychologist
from a JTree Selection?
( Code Snippet )____________________________
System.out.println(selectedIP.substring(0,(selectedIP.indexOf("["))
-1).trim());
TreePath currentPath = tree.getSelectionPath();
TreePath parentPath = currentPath.getParentPath();
System.out.println(parentPath.toString());
Pattern openPattern = Pattern.compile("Opens");
System.out.println("openPattern: "+openPattern);
Pattern closePattern = Pattern.compile("Closes");
System.out.println("closePattern: "+closePattern);
Pattern dropPattern = Pattern.compile("Drops");
System.out.println("dropPattern: "+dropPattern);
CharSequence inputStr = parentPath.toString();
System.out.println("CharSequence: "+inputStr);
Matcher openMatcher = openPattern.matcher(inputStr);
System.out.println("openMatch: "+openMatcher.matches());
Matcher closeMatcher = closePattern.matcher(inputStr);
System.out.println("closeMatcher: "+closeMatcher.matches());
Matcher dropMatcher = dropPattern.matcher(inputStr);
System.out.println("dropMatcher: "+dropMatcher.matches());
( Display Output per/selection )____________________________
24.229.165.60
[UDP, IP Opens, 509 Records]
openPattern: Opens
closePattern: Closes
dropPattern: Drops
CharSequence: [UDP, IP Opens, 509 Records]
openMatch: false
closeMatcher: false
dropMatcher: false
24.229.165.60
[UDP, IP Closes, 489 Records]
openPattern: Opens
closePattern: Closes
dropPattern: Drops
CharSequence: [UDP, IP Closes, 489 Records]
openMatch: false
closeMatcher: false
dropMatcher: false
Thanks in Advance...
IchBin
__________________________________________________________________________
'The meeting of two personalities is like the contact of two chemical
substances:
if there is any reaction, both are transformed.'
- Carl Gustav Jung, (1875-1961), psychiatrist and psychologist