// Path: stylechecker/src/main/java/com/sqatntu/stylechecker/StyleCheckerException.java
// public class StyleCheckerException extends Exception {
// 
//   public StyleCheckerException(String message) {
//     super(message);
//   }
// 
//   public StyleCheckerException(String message, Throwable cause) {
//     super(message, cause);
//   }
// }
// 
// Path: stylechecker/src/main/java/com/sqatntu/stylechecker/configuration/Configuration.java
// public interface Configuration {
// 
//   String[] getAttributeNames();
// 
//   String getAttribute(String name) throws StyleCheckerException;
// }
// 
// Path: stylechecker/src/main/java/com/sqatntu/stylechecker/configuration/StyleName.java
// public class StyleName {
// 
//   public static final String IGNORE_STYLE = "ignore";
// 
//   public static final String METHOD_NAME_FORMAT = "methodNameFormat";
//   public static final String METHOD_NAME_FORMAT_CAMEL_CASE = "camelCase";
// 
//   public static final String WILD_CARD_IMPORT = "wildCardImport";
//   public static final String WILD_CARD_IMPORT_OK = "wildCard";
//   public static final String WILD_CARD_IMPORT_NO = "noWildCard";
// 
//   public static final String BRACE_STYLE = "braceStyle";
//   public static final String BRACE_STYLE_KR = "kr";
//   public static final String BRACE_STYLE_NON_KR = "nonKr";
// 
//   public static final String[] ALL_STYLE_NAMES = {
//       METHOD_NAME_FORMAT,
//       WILD_CARD_IMPORT,
//       BRACE_STYLE,
//   };
// }
// 
// Path: stylechecker/src/main/java/com/sqatntu/stylechecker/report/StyleReport.java
// public class StyleReport {
// 
//   List<StyleReportContent> reportContents;
// 
//   public StyleReport() {
//     reportContents = new ArrayList<>();
//   }
// 
//   public List<StyleReportContent> getReportContents() {
//     return ImmutableList.<StyleReportContent>builder().addAll(reportContents).build();
//   }
// 
//   public void addReportContents(StyleReportContent reportContents) {
//     this.reportContents.add(reportContents);
//   }
// }
// 
// Path: stylechecker/src/main/java/com/sqatntu/stylechecker/report/StyleReportContent.java
// public class StyleReportContent {
// 
//   private int lineNumber;
// 
//   private int columnNumber;
// 
//   private String message;
// 
//   private String suggestion;
// 
//   public StyleReportContent(int lineNumber, int columnNumber, String message) {
//     this.lineNumber = lineNumber;
//     this.columnNumber = columnNumber;
//     this.message = message;
//   }
// 
//   public StyleReportContent(int lineNumber, int columnNumber, String message, String suggestion) {
//     this.lineNumber = lineNumber;
//     this.columnNumber = columnNumber;
//     this.message = message;
//     this.suggestion = suggestion;
//   }
// 
//   public int getLineNumber() {
//     return lineNumber;
//   }
// 
//   public int getColumnNumber() {
//     return columnNumber;
//   }
// 
//   public String getMessage() {
//     return message;
//   }
// 
//   public String getSuggestion() {
//     return suggestion;
//   }
// }


import com.sqatntu.api.JavaBaseListener;
import com.sqatntu.api.JavaParser;
import com.sqatntu.stylechecker.StyleCheckerException;
import com.sqatntu.stylechecker.configuration.Configuration;
import com.sqatntu.stylechecker.configuration.StyleName;
import com.sqatntu.stylechecker.report.StyleReport;
import com.sqatntu.stylechecker.report.StyleReportContent;
    try {
      if (configuration.getAttribute(StyleName.WILD_CARD_IMPORT)
          .equals(StyleName.WILD_CARD_IMPORT_OK)) {
        return;
      }
    } catch (StyleCheckerException e) {
      System.out.println(e.getMessage());
      return;
    }

    StringBuilder sb = new StringBuilder();

    // index 0 is always "import"
    for (int i = 1; i < ctx.getChildCount(); i++) {
      sb.append(ctx.getChild(i).getText());
    }

    String importStatement = sb.toString();
    String regex = ".+\\.\\*;$";

    if (!importStatement.matches(regex)) {
      return;
    }

    int line = ctx.getStart().getLine();
    int column = ctx.getStart().getCharPositionInLine()
        + ctx.getChild(0).getText().length() + 2;
    String message = "You should not use wild card import statement";
    String suggestion = "Split this statement to multiple import statements";

// Path: stylechecker/src/main/java/com/sqatntu/stylechecker/StyleCheckerException.java
// public class StyleCheckerException extends Exception {
// 
//   public StyleCheckerException(String message) {
//     super(message);
//   }
// 
//   public StyleCheckerException(String message, Throwable cause) {
//     super(message, cause);
//   }
// }
// 
// Path: stylechecker/src/main/java/com/sqatntu/stylechecker/configuration/Configuration.java
// public interface Configuration {
// 
//   String[] getAttributeNames();
// 
//   String getAttribute(String name) throws StyleCheckerException;
// }
// 
// Path: stylechecker/src/main/java/com/sqatntu/stylechecker/configuration/StyleName.java
// public class StyleName {
// 
//   public static final String IGNORE_STYLE = "ignore";
// 
//   public static final String METHOD_NAME_FORMAT = "methodNameFormat";
//   public static final String METHOD_NAME_FORMAT_CAMEL_CASE = "camelCase";
// 
//   public static final String WILD_CARD_IMPORT = "wildCardImport";
//   public static final String WILD_CARD_IMPORT_OK = "wildCard";
//   public static final String WILD_CARD_IMPORT_NO = "noWildCard";
// 
//   public static final String BRACE_STYLE = "braceStyle";
//   public static final String BRACE_STYLE_KR = "kr";
//   public static final String BRACE_STYLE_NON_KR = "nonKr";
// 
//   public static final String[] ALL_STYLE_NAMES = {
//       METHOD_NAME_FORMAT,
//       WILD_CARD_IMPORT,
//       BRACE_STYLE,
//   };
// }
// 
// Path: stylechecker/src/main/java/com/sqatntu/stylechecker/report/StyleReport.java
// public class StyleReport {
// 
//   List<StyleReportContent> reportContents;
// 
//   public StyleReport() {
//     reportContents = new ArrayList<>();
//   }
// 
//   public List<StyleReportContent> getReportContents() {
//     return ImmutableList.<StyleReportContent>builder().addAll(reportContents).build();
//   }
// 
//   public void addReportContents(StyleReportContent reportContents) {
//     this.reportContents.add(reportContents);
//   }
// }
// 
// Path: stylechecker/src/main/java/com/sqatntu/stylechecker/report/StyleReportContent.java
// public class StyleReportContent {
// 
//   private int lineNumber;
// 
//   private int columnNumber;
// 
//   private String message;
// 
//   private String suggestion;
// 
//   public StyleReportContent(int lineNumber, int columnNumber, String message) {
//     this.lineNumber = lineNumber;
//     this.columnNumber = columnNumber;
//     this.message = message;
//   }
// 
//   public StyleReportContent(int lineNumber, int columnNumber, String message, String suggestion) {
//     this.lineNumber = lineNumber;
//     this.columnNumber = columnNumber;
//     this.message = message;
//     this.suggestion = suggestion;
//   }
// 
//   public int getLineNumber() {
//     return lineNumber;
//   }
// 
//   public int getColumnNumber() {
//     return columnNumber;
//   }
// 
//   public String getMessage() {
//     return message;
//   }
// 
//   public String getSuggestion() {
//     return suggestion;
//   }
// }


// Path: stylechecker/src/main/java/com/sqatntu/stylechecker/listener/WildCardImportStatementListener.java
import com.sqatntu.api.JavaBaseListener;
import com.sqatntu.api.JavaParser;
import com.sqatntu.stylechecker.StyleCheckerException;
import com.sqatntu.stylechecker.configuration.Configuration;
import com.sqatntu.stylechecker.configuration.StyleName;
import com.sqatntu.stylechecker.report.StyleReport;
import com.sqatntu.stylechecker.report.StyleReportContent;

    try {
      if (configuration.getAttribute(StyleName.WILD_CARD_IMPORT)
          .equals(StyleName.WILD_CARD_IMPORT_OK)) {
        return;
      }
    } catch (StyleCheckerException e) {
      System.out.println(e.getMessage());
      return;
    }

    StringBuilder sb = new StringBuilder();

    // index 0 is always "import"
    for (int i = 1; i < ctx.getChildCount(); i++) {
      sb.append(ctx.getChild(i).getText());
    }

    String importStatement = sb.toString();
    String regex = ".+\\.\\*;$";

    if (!importStatement.matches(regex)) {
      return;
    }

    int line = ctx.getStart().getLine();
    int column = ctx.getStart().getCharPositionInLine()
        + ctx.getChild(0).getText().length() + 2;
    String message = "You should not use wild card import statement";
    String suggestion = "Split this statement to multiple import statements";

    StyleReportContent reportContent = new StyleReportContent(line, column, message, suggestion);