summaryrefslogtreecommitdiff
path: root/NET/worlds/network/FilthyPhrase.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/network/FilthyPhrase.java
downloadworlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz
worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/network/FilthyPhrase.java')
-rw-r--r--NET/worlds/network/FilthyPhrase.java117
1 files changed, 117 insertions, 0 deletions
diff --git a/NET/worlds/network/FilthyPhrase.java b/NET/worlds/network/FilthyPhrase.java
new file mode 100644
index 0000000..4ad300d
--- /dev/null
+++ b/NET/worlds/network/FilthyPhrase.java
@@ -0,0 +1,117 @@
+/* */ package NET.worlds.network;
+/* */
+/* */ import java.util.StringTokenizer;
+/* */ import java.util.Vector;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class FilthyPhrase
+/* */ {
+/* */ private long compareValue;
+/* */ private Vector<String> 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
+ */ \ No newline at end of file