Package org.wikipediacleaner.api.check.algorithm

Examples of org.wikipediacleaner.api.check.algorithm.CheckErrorAlgorithm


        String algorithmNumber = args[i];
        if (algorithmNumber.startsWith("+")) {
          addition = true;
          algorithmNumber = algorithmNumber.substring(1);
        }
        CheckErrorAlgorithm algorithm = CheckErrorAlgorithms.getAlgorithm(wiki, Integer.parseInt(algorithmNumber));
        if (algorithm != null) {
          if (!addition) {
            algorithms.add(algorithm);
          }
          allAlgorithms.add(algorithm);
View Full Code Here


    if (o2 == null) {
      return 1;
    }

    // Check on priority
    CheckErrorAlgorithm a1 = o1.getAlgorithm();
    CheckErrorAlgorithm a2 = o2.getAlgorithm();
    int p1 = (a1 != null) ? a1.getPriority() : CWConfigurationError.PRIORITY_UNKOWN;
    int p2 = (a2 != null) ? a2.getPriority() : CWConfigurationError.PRIORITY_UNKOWN;
    if (p1 != p2) {
      return CWConfigurationError.comparePriority(p1, p2);
    }

    // Check on error number
View Full Code Here

  /**
   * Display description of an error.
   */
  public void displayErrorDescription() {
    CheckErrorAlgorithm algorithm = null;

    // Look in the current page
    if ((contentPane != null) &&
        (contentPane.getSelectedComponent() != null) &&
        (contentPane.getSelectedComponent() instanceof CheckWikiContentPanel)) {
View Full Code Here

  void actionSelectError() {
    CheckErrorPage errorSelected = getSelectedError();
    if (errorSelected == null) {
      textPage.setFormatter(new MWPaneBasicFormatter());
    } else {
      CheckErrorAlgorithm algorithm = errorSelected.getAlgorithm();
      MWPaneFormatter formatter = textPage.getFormatter();
      if (formatter instanceof MWPaneCheckWikiFormatter) {
        MWPaneCheckWikiFormatter cwFormatter =
          (MWPaneCheckWikiFormatter) formatter;
        if (!cwFormatter.isSameAlgorithm(algorithm)) {
View Full Code Here

    if (initialErrors == null) {
      return null;
    }
    Collection<CheckErrorAlgorithm> algorithms = new ArrayList<CheckErrorAlgorithm>();
    for (CheckErrorPage error : initialErrors) {
      CheckErrorAlgorithm algorithm = error.getAlgorithm();
      if (!algorithms.contains(algorithm)) {
        algorithms.add(algorithm);
      }
    }
    return algorithms;
View Full Code Here

      return;
    }
    List<CheckErrorAlgorithm> selectedAlgorithms = new ArrayList<CheckErrorAlgorithm>();
    for (int i = 0; i < selection.length; i++) {
      int row = Utilities.convertRowIndexToModel(tableCWAutomaticFixing, selection[i]);
      CheckErrorAlgorithm algorithm = modelCWAutomaticFixing.getAlgorithm(row);
      selectedAlgorithms.add(algorithm);
    }
    int answer = window.displayYesNoWarning(BasicWindow.experimentalMessage);
    if (answer != JOptionPane.YES_OPTION) {
      return;
View Full Code Here

    Object object = list.getModel().getElementAt(position);
    if (!(object instanceof CheckErrorPage)) {
      return;
    }
    CheckErrorPage error = (CheckErrorPage) object;
    CheckErrorAlgorithm algorithm = error.getAlgorithm();

    // Menu name
    BasicMenuCreator menu = new BasicMenuCreator();
    JPopupMenu popup = menu.createPopupMenu(GT._("Error n°{0}", algorithm.getErrorNumberString()));

    // Global fixes
    JMenuItem menuItem = null;
    String[] fixes = algorithm.getGlobalFixes();
    if ((fixes != null) && (fixes.length > 0)) {
      menu.addSeparator(popup);
      for (int i = 0; i < fixes.length; i++) {
        menuItem = new JMenuItem(fixes[i]);
        ActionListener action = new CheckErrorGlobalFixAction(
            algorithm, fixes[i], error.getPage(), textComponent, button);
        menuItem.addActionListener(action);
        popup.add(menuItem);
      }
    }

    // Create sub menus
    menu.addSeparator(popup);
    menu.addItemView(wiki, popup, algorithm.getLink(), GT._("Detail"));
    CheckWiki checkWiki = APIFactory.getCheckWiki();
    String toolserverUrl = checkWiki.getUrlDescription(wiki, algorithm);
    menu.addItemView(null, popup, toolserverUrl, GT._("List on {0}", CheckWiki.getServerName(wiki)));
    menu.addItemView(wiki, popup, algorithm.getWhiteListPageName(), GT._("View or edit whitelist"));

    popup.show(e.getComponent(), e.getX(), e.getY());
  }
View Full Code Here

      error = error.replaceAll("\n", "\u21b5"); // Replacer \n by a visual character
      boolean keep = true;
      StringBuilder comment = new StringBuilder();
      while (pos < next) {
        errorResult = errorResults.get(pos);
        CheckErrorAlgorithm algorithm = errorResult.getAlgorithm();
        PageElementISBN isbn = analysis.isInISBN(beginIndex);
        if (isbn != null) {
          if ((algorithm != null) &&
              (algorithm instanceof CheckErrorAlgorithmISBN)) {
            CheckErrorAlgorithmISBN isbnAlgo = (CheckErrorAlgorithmISBN) algorithm;
View Full Code Here

   * Add an algorithm to the list of algorithms that can be fixed by bot.
   *
   * @param errorNumber Error number.
   */
  private void addAlgorithm(int errorNumber) {
    CheckErrorAlgorithm algorithm = CheckErrorAlgorithms.getAlgorithm(wiki, errorNumber);
    if ((algorithm != null) &&
        (algorithm.isAvailable()) &&
        CheckErrorAlgorithms.isAlgorithmActive(wiki, errorNumber)) {
      botAlgorithms.add(algorithm);
    }
  }
View Full Code Here

  /**
   * @param rowIndex Row index.
   * @return true if the algorithm is for bot.
   */
  public boolean isBotAlgorithm(int rowIndex) {
    CheckErrorAlgorithm algorithm = getAlgorithm(rowIndex);
    return botAlgorithms.contains(algorithm);
  }
View Full Code Here

TOP

Related Classes of org.wikipediacleaner.api.check.algorithm.CheckErrorAlgorithm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.