Package org.wikipediacleaner.api.data

Examples of org.wikipediacleaner.api.data.InternalLinkCount


      // List disambiguation links in the page
      analysis.countLinks(links);
      for (Page link : links) {
        if (Boolean.TRUE.equals(link.isDisambiguationPage())) {
          InternalLinkCount linkCount = analysis.getLinkCount(link);
          if (linkCount != null) {
            if ((linkCount.getInternalLinkCount() > 0) ||
                (linkCount.getIncorrectTemplateCount() > 0) ||
                (linkCount.getHelpNeededCount() > 0)) {
              String error = link.getTitle();
              dabLinks.add(error);
              memorizeError(error, analysis.getPage().getTitle());
            }
          }
View Full Code Here


    String pageName = (value != null) ? value.toString() : "";
    String text = pageName;
    Boolean disambiguation = null;
    Boolean exist = null;
    boolean redirect = false;
    InternalLinkCount count = null;
    if (value instanceof Page) {
      Page pageElement = (Page) value;
      pageName = pageElement.getTitle();
      text = pageName;
      disambiguation = pageElement.isDisambiguationPage();
      exist = pageElement.isExisting();
      count = (analysis != null) ? analysis.getLinkCount(pageElement) : null;
      if (showCountOccurrence &&
          (count != null) &&
          (count.getTotalLinkCount() > 0)) {
        text += " → " + count.getTotalLinkCount();
      }
      redirect = pageElement.isRedirect();
      if (redirect && showRedirectBacklinks) {
        Integer backlinks = pageElement.getBacklinksCountInMainNamespace();
        if ((backlinks != null) && (backlinks.intValue() > 0)) {
          text += " ← " + backlinks;
        }
      }
    }

    // Text
    setText(text);

    // Color
    Color background = isSelected ? list.getSelectionBackground() : Color.WHITE;
    Color foreground = isSelected ? list.getSelectionForeground() : list.getForeground();
    if (showDisambiguation) {
      if (disambiguation == null) {
        if (!isSelected) {
          foreground = Color.DARK_GRAY;
        }
      } else if (disambiguation.booleanValue()) {
        if (count == null) {
          foreground = Color.RED;
        } else if ((count.getInternalLinkCount() > 0) || (count.getIncorrectTemplateCount() > 0)) {
          foreground = Color.RED;
        } else if ((count.getHelpNeededCount() > 0)) {
          foreground = Color.ORANGE;
        } else {
          foreground = Color.BLUE;
        }
      }
View Full Code Here

      int totalCount = 0;
      int mainCount = 0;
      analysis.countLinks(filteredList);
      for (Page p : filteredList) {
        if (p != null) {
          InternalLinkCount count = analysis.getLinkCount(p);
          if (count != null) {
            totalCount += count.getTotalLinkCount();
            if ((p.getNamespace() != null) &&
                (Namespace.MAIN == p.getNamespace().intValue())) {
              mainCount += count.getTotalLinkCount();
            }
          }
        }
      }
      if (totalCount > 0) {
View Full Code Here

      modelLinks.setElements(links);
      countOccurrences(analysis, true);
      for (Page p : links) {
        if ((p != null) &&
            (Boolean.TRUE.equals(p.isDisambiguationPage()))) {
          InternalLinkCount count = analysis.getLinkCount(p);
          if ((count != null) && (count.getTotalLinkCount() > 0)) {
            mapLinksTotalCount.put(p.getTitle(), Integer.valueOf(count.getTotalLinkCount()));
            mapLinksHelpNeededCount.put(p.getTitle(), Integer.valueOf(count.getHelpNeededCount()));
          }
        }
      }
    }
    selectLinks(0);
View Full Code Here

          Integer currentHelpCount = null;
          Page page = getPage();
          if ((page != null) && (page.getLinks() != null)) {
            for (Page link : page.getLinks()) {
              if (Page.areSameTitle(p.getKey(), link.getTitle())) {
                InternalLinkCount count = analysis.getLinkCount(link);
                if (count != null) {
                  currentCount = Integer.valueOf(count.getTotalLinkCount());
                  currentHelpCount = Integer.valueOf(count.getHelpNeededCount());
                }
              }
            }
          }
          if ((currentCount == null) || (currentCount < p.getValue().intValue())) {
            fixed.add(p.getKey());
          } else {
            Integer helpCount = mapLinksHelpNeededCount.get(p.getKey());
            if ((helpCount != null) &&
                ((currentHelpCount == null) || (currentHelpCount > helpCount.intValue()))) {
              helpRequested.add(p.getKey());
            }
          }
        }
      }

      // Compute list of disambiguation links that still need to be fixed
      List<Page> links = analysis.getPage().getLinks();
      if (links != null) {
        analysis.countLinks(links);
        for (Page link : links) {
          if (Boolean.TRUE.equals(link.isDisambiguationPage())) {
            InternalLinkCount linkCount = analysis.getLinkCount(link);
            if (linkCount != null) {
              if ((linkCount.getInternalLinkCount() > 0) ||
                  (linkCount.getIncorrectTemplateCount() > 0) ||
                  (linkCount.getHelpNeededCount() > 0)) {
                dabLinks.add(link.getTitle());
              }
            }
          }
        }
View Full Code Here

      Object[] values = listLinks.getSelectedValues();
      if (values != null) {
        int count = 0;
        for (Object value : values) {
          if (value instanceof Page) {
            InternalLinkCount tmpCount = analysis.getLinkCount((Page) value);
            if (tmpCount != null) {
              count += tmpCount.getTotalLinkCount();
            }
          }
        }
        return count;
      }
View Full Code Here

TOP

Related Classes of org.wikipediacleaner.api.data.InternalLinkCount

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.