All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.remondis.limbus.monitoring.PatternSpecifityComparator Maven / Gradle / Ivy

Go to download

API to create and process monitoring information using extendable interfaces for consumers and producers.

The newest version!
package com.remondis.limbus.monitoring;

import java.util.Comparator;

import com.remondis.limbus.utils.Lang;

public class PatternSpecifityComparator implements Comparator {

  @Override
  public int compare(Pattern o1, Pattern o2) {
    return compareSpecifity(o1, o2);
  }

  public static int compareSpecifity(Pattern o1, Pattern o2) {
    Lang.denyNull("o1", o1);
    Lang.denyNull("o2", o2);
    if (o1.getPattern()
        .length() < o2.getPattern()
            .length()) {
      return -1;
    } else if (o1.getPattern()
        .length() > o2.getPattern()
            .length()) {
      return 1;
    } else {
      return 0;
    }
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy