Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Package Attributes
org.mozilla.xpcom.VersionPartTokenizer Class Reference

Specialized tokenizer for Mozilla version strings. More...

Inheritance diagram for org.mozilla.xpcom.VersionPartTokenizer:
Inheritance graph
[legend]
Collaboration diagram for org.mozilla.xpcom.VersionPartTokenizer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 VersionPartTokenizer (String aPart)
boolean hasMoreElements ()
boolean hasMoreTokens ()
Object nextElement ()
String nextToken ()
String getRemainder ()
 Returns what remains of the original string, without tokenization.

Package Attributes

String part

Detailed Description

Specialized tokenizer for Mozilla version strings.

A token can consist of one of the four sections of a version string: <number-a><string-b><number-c> <string-d (everything else)>.

Definition at line 213 of file VersionComparator.java.


Constructor & Destructor Documentation

Definition at line 217 of file VersionComparator.java.

                                            {
    part = aPart;
  }

Member Function Documentation

Returns what remains of the original string, without tokenization.

This method is useful for getting the <string-d (everything else)> section of a version string.

Returns:
remaining version string

Definition at line 268 of file VersionComparator.java.

                               {
    return part;
  }

Here is the caller graph for this function:

Definition at line 221 of file VersionComparator.java.

                                   {
    return part.length() != 0;
  }

Here is the caller graph for this function:

Definition at line 225 of file VersionComparator.java.

                                 {
    return part.length() != 0;
  }

Here is the caller graph for this function:

Definition at line 229 of file VersionComparator.java.

                              {
    if (part.matches("[\\+\\-]?[0-9].*")) {
      // if string starts with a number...
      int index = 0;
      if (part.charAt(0) == '+' || part.charAt(0) == '-') {
        index = 1;
      }

      while (index < part.length() && Character.isDigit(part.charAt(index))) {
        index++;
      }

      String numPart = part.substring(0, index);
      part = part.substring(index);
      return numPart;
    } else {
      // ... or if this is the non-numeric part of version string
      int index = 0;
      while (index < part.length() && !Character.isDigit(part.charAt(index))) {
        index++;
      }

      String alphaPart = part.substring(0, index);
      part = part.substring(index);
      return alphaPart;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 257 of file VersionComparator.java.

                            {
    return (String) nextElement();
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 215 of file VersionComparator.java.


The documentation for this class was generated from the following file: