Klasse StringOperation

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.search.StringOperation

public final class StringOperation extends Object
This class is a collection of helper methods to manipulate strings during search.
  • Konstruktordetails

    • StringOperation

      public StringOperation()
  • Methodendetails

    • getCamelCaseMatchingRegions

      public static final int[] getCamelCaseMatchingRegions(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean samePartCount)
      Answers all the regions in a given name matching a given camel case pattern.

      Each of these regions is made of its starting index and its length in the given name. They are all concatenated in a single array of int which therefore always has an even length.

      Note that each region is disjointed from the following one.
      E.g. if the regions are { start1, length1, start2, length2 }, then start1+length1 will always be smaller than start2.

       Examples:
       
      1. pattern = "NPE" name = NullPointerException / NoPermissionException result: { 0, 1, 4, 1, 11, 1 } / { 0, 1, 2, 1, 12, 1 }
      2. pattern = "NuPoEx" name = NullPointerException result: { 0, 2, 4, 2, 11, 2 }
      3. pattern = "IPL3" name = "IPerspectiveListener3" result: { 0, 2, 12, 1, 20, 1 }
      4. pattern = "HashME" name = "HashMapEntry" result: { 0, 5, 7, 1 }

      Parameter:
      pattern - the given pattern
      patternStart - the start index of the pattern, inclusive
      patternEnd - the end index of the pattern, exclusive
      name - the given name
      nameStart - the start index of the name, inclusive
      nameEnd - the end index of the name, exclusive
      samePartCount - flag telling whether the pattern and the name should have the same count of parts or not.
        For example:
      • 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, but not 'HashMapEntry'
      • 'HMap' type string pattern will still match previous 'HashMap' and 'HtmlMapper' types, but not 'HighMagnitude'
      Gibt zurück:
      an array of int having two slots per returned regions (first one is the starting index of the region and the second one the length of the region).
      Note that it may be null if the given name does not match the pattern
      Seit:
      3.5
      Siehe auch:
    • getPatternMatchingRegions

      public static final int[] getPatternMatchingRegions(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean isCaseSensitive)
      Answers all the regions in a given name matching a given pattern pattern (e.g. "H*M??").

      Each of these regions is made of its starting index and its length in the given name. They are all concatenated in a single array of int which therefore always has an even length.

      Note that each region is disjointed from the following one.
      E.g. if the regions are { start1, length1, start2, length2 }, then start1+length1 will always be smaller than start2.

       Examples:
       
      1. pattern = "N???Po*Ex?eption" name = NullPointerException result: { 0, 1, 4, 2, 11, 2, 14, 6 }
      2. pattern = "Ha*M*ent*" name = "HashMapEntry" result: { 0, 2, 4, 1, 7, 3 }

      Parameter:
      pattern - the given pattern
      patternStart - the given pattern start
      patternEnd - the given pattern end
      name - the given name
      nameStart - the given name start
      nameEnd - the given name end
      isCaseSensitive - flag to know if the matching should be case sensitive
      Gibt zurück:
      an array of int having two slots per returned regions (first one is the starting index of the region and the second one the length of the region).
      Note that it may be null if the given name does not match the pattern
      Seit:
      3.5
      Siehe auch: