OSDN Git Service

フィールド名変更
authoryukihane <yukihane.feather@gmail.com>
Mon, 12 Sep 2011 07:57:43 +0000 (16:57 +0900)
committeryukihane <yukihane.feather@gmail.com>
Mon, 12 Sep 2011 07:57:43 +0000 (16:57 +0900)
frontend/src/saccubus/conv/NicoXMLReader.java

index 1f7f704..2b75a70 100644 (file)
@@ -27,16 +27,16 @@ import org.xml.sax.Attributes;
  */
 public class NicoXMLReader extends DefaultHandler {
 
-    private final Packet Packet;
+    private final Packet packet;
+    private final Pattern ngWord;
+    private final Pattern ngId;
     private Chat item;
-    private boolean item_kicked;
-    private final Pattern NG_Word;
-    private final Pattern NG_ID;
+    private boolean itemKicked;
 
     public NicoXMLReader(Packet packet, String ng_id, String ng_word) {
-        Packet = packet;
-        NG_Word = makePattern(ng_word);
-        NG_ID = makePattern(ng_id);
+        this.packet = packet;
+        this.ngWord = makePattern(ng_word);
+        this.ngId = makePattern(ng_id);
     }
 
     private static Pattern makePattern(String word) {
@@ -127,24 +127,24 @@ public class NicoXMLReader extends DefaultHandler {
         if (qName.equalsIgnoreCase("chat")) {
             // System.out.println("----------");
             item = new Chat();
-            item_kicked = false;
+            itemKicked = false;
             //マイメモリ削除対象
             final String deleted = attributes.getValue("deleted");
             if (deleted != null && deleted.equalsIgnoreCase("1")) {
-                item_kicked = true;
+                itemKicked = true;
                 return;
             }
             item.setDate(attributes.getValue("date"));
             final String mail = attributes.getValue("mail");
-            if (match(NG_Word, mail)) {
-                item_kicked = true;
+            if (match(ngWord, mail)) {
+                itemKicked = true;
                 return;
             }
             item.setMail(mail);
             item.setNo(attributes.getValue("no"));
             final String user_id = attributes.getValue("user_id");
-            if (match(NG_ID, user_id)) {
-                item_kicked = true;
+            if (match(ngId, user_id)) {
+                itemKicked = true;
                 return;
             }
             item.setUserID(user_id);
@@ -172,8 +172,8 @@ public class NicoXMLReader extends DefaultHandler {
         }
         if (item != null) {
             final String com = new String(input);
-            if (match(NG_Word, com)) {
-                item_kicked = true;
+            if (match(ngWord, com)) {
+                itemKicked = true;
                 return;
             }
             item.setComment(com);
@@ -192,8 +192,8 @@ public class NicoXMLReader extends DefaultHandler {
     @Override
     public void endElement(final String uri, final String localName, final String qName) {
         if (qName.equalsIgnoreCase("chat")) {
-            if (!item_kicked) {
-                Packet.addChat(item);
+            if (!itemKicked) {
+                packet.addChat(item);
             }
             item = null;
         }