/* */ package NET.worlds.network; /* */ /* */ import java.util.StringTokenizer; /* */ import java.util.Vector; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class FilthyPhrase /* */ { /* */ private long compareValue; /* */ private Vector filthyWords; /* */ private String rawData; /* */ /* */ public FilthyPhrase(String phrase) /* */ { /* 25 */ this.rawData = new String(phrase); /* 26 */ this.filthyWords = new Vector(); /* */ /* 28 */ StringTokenizer st = new StringTokenizer(phrase, /* 29 */ "\t\n\r.,;'\"!?*:/()[]{} ,「」『』《》?【】。!、;:", /* */ /* 31 */ true); /* */ /* 33 */ if (st.hasMoreTokens()) { /* 34 */ String firstToken = st.nextToken().toLowerCase(); /* 35 */ this.compareValue = firstToken.hashCode(); /* 36 */ this.filthyWords.addElement(firstToken); /* */ } /* */ /* 39 */ while (st.hasMoreTokens()) { /* 40 */ String nextWord = st.nextToken(); /* 41 */ this.filthyWords.addElement(nextWord.toLowerCase()); /* */ } /* */ } /* */ /* */ public boolean check(String toCheck) { /* 46 */ StringTokenizer st = new StringTokenizer(toCheck, /* 47 */ "\t\n\r.,;'\"!?*:/()[]{} ,「」『』《》?【】。!、;:", /* */ /* 49 */ true); /* */ /* */ /* */ /* */ /* 54 */ int idx = 0; /* 55 */ while (idx < this.filthyWords.size()) { /* 56 */ if (st.hasMoreTokens()) { /* 57 */ String token = st.nextToken().toLowerCase(); /* 58 */ String comparator = (String)this.filthyWords.elementAt(idx); /* 59 */ if (comparator.compareTo(token) != 0) { /* 60 */ return false; /* */ } /* 62 */ idx++; /* */ } else { /* 64 */ return false; /* */ } /* */ } /* 67 */ return true; /* */ } /* */ /* */ public String getReplacement() { /* 71 */ String funnyChars = new String("$!@%#@&*!%#@%!@#$%@#@!@%!@#$%*&%$!"); /* */ /* 73 */ String retVal = new String(); /* */ /* 75 */ int idx = 0; /* 76 */ while (idx < this.filthyWords.size()) { /* 77 */ int numChars = ((String)this.filthyWords.elementAt(idx)).length(); /* 78 */ String replacementWord = new String(); /* 79 */ if (numChars > 1) { /* 80 */ replacementWord = funnyChars.substring(0, numChars); /* */ } else { /* 82 */ replacementWord = (String)this.filthyWords.elementAt(idx); /* */ } /* */ /* 85 */ retVal = retVal + replacementWord; /* 86 */ idx++; /* */ } /* */ /* 89 */ return retVal; /* */ } /* */ /* */ public long size() { /* 93 */ return this.filthyWords.size(); /* */ } /* */ /* */ public long compareValue() { /* 97 */ return this.compareValue; /* */ } /* */ /* */ public String firstWord() { /* 101 */ if (this.filthyWords.size() > 0) { /* 102 */ return (String)this.filthyWords.elementAt(0); /* */ } /* 104 */ return new String(""); /* */ } /* */ /* */ public String asString() /* */ { /* 109 */ return this.rawData; /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\network\FilthyPhrase.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */