Пример #1
0
  public static UnitNamePart find(final String namePart) {
    final String normalizedNamePart = StringNormalizer.normalize(namePart);

    final UnitNamePart indexedUnitNamePart = unitNamePartIndexMap.get(normalizedNamePart);
    if (indexedUnitNamePart != null) {
      return indexedUnitNamePart;
    }

    for (final UnitNamePart unitNamePart : Bennu.getInstance().getUnitNamePartSet()) {
      final String otherUnitNamePart = unitNamePart.getNamePart();
      if (!unitNamePartIndexMap.containsKey(otherUnitNamePart)) {
        unitNamePartIndexMap.put(otherUnitNamePart, unitNamePart);
      }
      if (normalizedNamePart.equals(otherUnitNamePart)) {
        return unitNamePart;
      }
    }
    return null;
  }
Пример #2
0
 protected static void index(final UnitName unitName, final String namePart) {
   final UnitNamePart unitNamePart = findAndCreateIfNotFound(namePart);
   unitNamePart.addUnitName(unitName);
 }