/**
 * redpen: a text inspection tool
 * Copyright (c) 2014-2015 Recruit Technologies Co., Ltd. and contributors
 * (see CONTRIBUTORS.md)
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cc.redpen.validator.sentence;

import cc.redpen.model.Sentence;
import cc.redpen.tokenizer.TokenElement;
import cc.redpen.validator.Validator;

import java.util.*;

import static java.util.Collections.emptySet;
import static java.util.Collections.singletonList;

/**
 * JapaneseAmbiguousNounConjunctionValidator looks for ambiguous conjuctions among nouns.
 * <br>
 * Note: this validator works only for Japanese texts.
 */
public class JapaneseAmbiguousNounConjunctionValidator extends Validator {
    public JapaneseAmbiguousNounConjunctionValidator() {
        super("list", emptySet());
    }

    @Override
    public void validate(Sentence sentence) {
        int st = 0;
        final List<String> q = new LinkedList<>();

        for (TokenElement tokenElement : sentence.getTokens()) {
            final List<String> tags = tokenElement.getTags();
            switch (st) {
            case 0:
                if (tags.get(0).equals("助詞") && tags.get(6).equals("の")) {
                    q.add(tags.get(6));
                    st = 1;
                }
                break;
            case 1:
                if (tags.get(0).equals("名詞")) {
                    q.add(tags.get(6));
                } else {
                    if (tags.get(0).equals("助詞") && tags.get(6).equals("の")) {
                        q.add(tags.get(6));
                        st = 2;
                    } else {
                        q.clear();
                        st = 0;
                    }
                }
                break;
            case 2:
                addLocalizedError(sentence, String.join("", q));
                st = 0;
                break;
            }
        }
    }

    @Override
    public List<String> getSupportedLanguages() {
        return singletonList(Locale.JAPANESE.getLanguage());
    }
}

@@ -841,16 +841,26 @@
 lidator.
+Dictionary
 Validato
@@ -884,57 +884,68 @@
 til.
-*;%0A%0Aimport static java.util.Collections.emptySet;
+LinkedList;%0Aimport java.util.List;%0Aimport java.util.Locale;%0A
 %0Aimp
@@ -1217,16 +1217,26 @@
 extends 
+Dictionary
 Validato
@@ -1299,48 +1299,8 @@
 () %7B
-%0A        super(%22list%22, emptySet());%0A    
 %7D%0A%0A 
@@ -1372,16 +1372,23 @@
   int st
+ackSize
  = 0;%0A  
@@ -1412,17 +1412,24 @@
 String%3E 
-q
+surfaces
  = new L
@@ -1593,16 +1593,23 @@
 itch (st
+ackSize
 ) %7B%0A    
@@ -1711,33 +1711,40 @@
                 
-q
+surfaces
 .add(tags.get(6)
@@ -1768,16 +1768,23 @@
       st
+ackSize
  = 1;%0A  
@@ -1902,33 +1902,40 @@
                 
-q
+surfaces
 .add(tags.get(6)
@@ -2065,17 +2065,24 @@
         
-q
+surfaces
 .add(tag
@@ -2118,16 +2118,23 @@
       st
+ackSize
  = 2;%0A  
@@ -2184,17 +2184,24 @@
         
-q
+surfaces
 .clear()
@@ -2220,32 +2220,39 @@
               st
+ackSize
  = 0;%0A          
@@ -2384,17 +2384,24 @@
 oin(%22%22, 
-q
+surfaces
 ));%0A    
@@ -2414,16 +2414,23 @@
       st
+ackSize
  = 0;%0A  

Rename too short variables