Compare commits
4 commits
83efaf25e7
...
a6ddce2ee1
Author | SHA1 | Date | |
---|---|---|---|
a6ddce2ee1 | |||
c8b63869b2 | |||
003fb306a0 | |||
a1e9949ca5 |
5 changed files with 46 additions and 10 deletions
|
@ -54,7 +54,7 @@ public class Categories extends ArrayList<Category>
|
||||||
|
|
||||||
for (Category category : this)
|
for (Category category : this)
|
||||||
{
|
{
|
||||||
if (category.getSoftwares().containsAnyIgnoreCase(softwareName))
|
if (category.matchesSoftware(softwareName))
|
||||||
{
|
{
|
||||||
result.add(category);
|
result.add(category);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public class Categories extends ArrayList<Category>
|
||||||
{
|
{
|
||||||
Category category = iterator.next();
|
Category category = iterator.next();
|
||||||
|
|
||||||
if (category.getSoftwares().containsIgnoreCase(softwareName))
|
if (category.matchesSoftware(softwareName))
|
||||||
{
|
{
|
||||||
ended = true;
|
ended = true;
|
||||||
result = true;
|
result = true;
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.statoolinfos.core;
|
package fr.devinsy.statoolinfos.core;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import fr.devinsy.strings.StringList;
|
import fr.devinsy.strings.StringList;
|
||||||
|
@ -126,13 +128,46 @@ public class Category
|
||||||
{
|
{
|
||||||
boolean result;
|
boolean result;
|
||||||
|
|
||||||
if (this.softwares.containsIgnoreCase(service.getSoftwareName()))
|
result = matchesSoftware(service.getSoftwareName());
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matches.
|
||||||
|
*
|
||||||
|
* @param softwareName
|
||||||
|
* the software name
|
||||||
|
* @return true, if successful
|
||||||
|
*/
|
||||||
|
public boolean matchesSoftware(final String softwareName)
|
||||||
|
{
|
||||||
|
boolean result;
|
||||||
|
|
||||||
|
String target = StringUtils.stripAccents(softwareName).replaceAll("[\\W\\s]", "");
|
||||||
|
|
||||||
|
boolean ended = false;
|
||||||
|
Iterator<String> iterator = this.softwares.iterator();
|
||||||
|
result = false;
|
||||||
|
while (!ended)
|
||||||
{
|
{
|
||||||
result = true;
|
if (iterator.hasNext())
|
||||||
}
|
{
|
||||||
else
|
String source = iterator.next();
|
||||||
{
|
source = StringUtils.stripAccents(source).replaceAll("[\\W\\s]", "");
|
||||||
result = false;
|
|
||||||
|
if (StringUtils.equalsIgnoreCase(target, source))
|
||||||
|
{
|
||||||
|
ended = true;
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ended = true;
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -38,6 +38,7 @@ Nutch-
|
||||||
^Python-urllib/
|
^Python-urllib/
|
||||||
SemrushBot
|
SemrushBot
|
||||||
^Synapse/
|
^Synapse/
|
||||||
|
TinyStatus
|
||||||
^Tusky/
|
^Tusky/
|
||||||
YisouSpider
|
YisouSpider
|
||||||
zgrab/
|
zgrab/
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class StatAgent
|
||||||
for (Service service : federation.getServices())
|
for (Service service : federation.getServices())
|
||||||
{
|
{
|
||||||
String softwareName = service.getSoftwareName();
|
String softwareName = service.getSoftwareName();
|
||||||
if (category.getSoftwares().containsIgnoreCase(softwareName))
|
if (category.matchesSoftware(softwareName))
|
||||||
{
|
{
|
||||||
stat.incServiceCount();
|
stat.incServiceCount();
|
||||||
YearMonth month = YearMonth.now().minusMonths(1);
|
YearMonth month = YearMonth.now().minusMonths(1);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||||
*
|
*
|
||||||
* This file is part of StatoolInfos, simple service statistics tool.
|
* This file is part of StatoolInfos, simple service statistics tool.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue