Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.comm
Class ISeriesPDMPatternMatch

java.lang.Object
  extended by com.ibm.etools.iseries.comm.ISeriesPDMPatternMatch

public class ISeriesPDMPatternMatch
extends Object

This class offers PDM-like generic name pattern matching. PDM supports one wildcard character ('*") anywhere in the name, or one at the beginning and end of the name.

  1. ABC
  2. *
  3. ABC*
  4. *ABC
  5. AB*C
  6. *ABC*
This pattern matching class also optionally supports additional advanced patterns beyond the stricter PDM style. These allow for two '*'s anywhere in the name.
  1. AB*C*
  2. *A*C
  3. A*B*C
Instantiate this class for a given generic name, and then call matches(String input) for each input name to see if it matches the pattern. To enable the advanced patterns, pass true to the constructor.


Field Summary
static int ALL
          Example: *
static String Copyright
           
static char QUOTE
          Example: Quoted name delimiter: "
static int SCALAR
          Example: ABC
static char WILDCARD
          Wildcard character: *
static int WILDCARD_END
          Example: ABC*
static int WILDCARD_MIDDLE
          Example: A*C
static int WILDCARD_MIDDLE_END
           
static int WILDCARD_MIDDLE_MIDDLE
          Example: A*C*F
static int WILDCARD_START
          Example: *ABC
static int WILDCARD_START_END
          Example: *ABC*
static int WILDCARD_START_MIDDLE
          Example: *A*F
 
Constructor Summary
ISeriesPDMPatternMatch(String genericName)
          Constructor for traditional PDM-style only patterns, which allows for one asterisk anywhere in the name,or one asterisk each at the beginning or end of the name.
ISeriesPDMPatternMatch(String genericName, boolean advanced)
          Constructor for traditional PDM-style only patterns PLUS advanced patterns ABC*DEF* and A*C*F.
 
Method Summary
 int getPatternType()
          What type of pattern is it? One of: SCALAR, ALL, WILDCARD_END, WILDCARD_START, WILDCARD_MIDDLE, WILDCARD_START_END, or WILDCARD_MIDDLE_END
 boolean isGeneric()
          Was generic name given in the constructor a valid generic name (one or 2 '*'s)?
 boolean isQuoted()
          Was quoted name given in the constructor a quoted name like "abcDEF"?
 boolean isValid()
          Was generic name given in the constructor a valid scalar or generic name?
 boolean matches(String input)
          Test if a host name matches the pattern of this generic name.
 String toString()
          For writing this object out.
 void writeInfo(PrintWriter stream)
          For debugging/testing purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

WILDCARD

public static final char WILDCARD
Wildcard character: *

See Also:
Constant Field Values

QUOTE

public static final char QUOTE
Example: Quoted name delimiter: "

See Also:
Constant Field Values

SCALAR

public static final int SCALAR
Example: ABC

See Also:
Constant Field Values

ALL

public static final int ALL
Example: *

See Also:
Constant Field Values

WILDCARD_END

public static final int WILDCARD_END
Example: ABC*

See Also:
Constant Field Values

WILDCARD_START

public static final int WILDCARD_START
Example: *ABC

See Also:
Constant Field Values

WILDCARD_MIDDLE

public static final int WILDCARD_MIDDLE
Example: A*C

See Also:
Constant Field Values

WILDCARD_START_END

public static final int WILDCARD_START_END
Example: *ABC*

See Also:
Constant Field Values

WILDCARD_MIDDLE_END

public static final int WILDCARD_MIDDLE_END
See Also:
Constant Field Values

WILDCARD_START_MIDDLE

public static final int WILDCARD_START_MIDDLE
Example: *A*F

See Also:
Constant Field Values

WILDCARD_MIDDLE_MIDDLE

public static final int WILDCARD_MIDDLE_MIDDLE
Example: A*C*F

See Also:
Constant Field Values
Constructor Detail

ISeriesPDMPatternMatch

public ISeriesPDMPatternMatch(String genericName)
Constructor for traditional PDM-style only patterns, which allows for one asterisk anywhere in the name,or one asterisk each at the beginning or end of the name. If you don't know for sure the input is generic or valid, after constructing call:
  • isValid() to determine if given generic name was valid.
  • isGeneric() to determine if given generic name had a wildcard.
  • If curious, you can also subsequently call:
  • getPatternType() to determine which type of pattern the generic name follows.
  • Once constructed for a valid name, you can call
  • matches(String) for each host name to see if it matches this generic name pattern.

    Parameters:
    genericName - generic name to do pattern matching for (ie, ABC*DEF)

  • ISeriesPDMPatternMatch

    public ISeriesPDMPatternMatch(String genericName,
                                  boolean advanced)
    Constructor for traditional PDM-style only patterns PLUS advanced patterns ABC*DEF* and A*C*F. If you don't know for sure the input is generic or valid, after constructing call:
  • isValid() to determine if given generic name was valid.
  • isGeneric() to determine if given generic name had a wildcard.
  • If curious, you can also subsequently call:
  • getPatternType() to determine which type of pattern the generic name follows.
  • Once constructed for a valid name, you can call
  • matches(String) for each host name to see if it matches this generic name pattern.

    Parameters:
    genericName - generic name to do pattern matching for (ie, ABC*DEF)
    advanced - true if you want to support the advanced patterns.
  • Method Detail

    matches

    public boolean matches(String input)
    Test if a host name matches the pattern of this generic name.

    Returns:
    true if given name matches this generic name pattern.

    isValid

    public boolean isValid()
    Was generic name given in the constructor a valid scalar or generic name?

    Returns:
    true if name contained 0, 1 or 2 wildcards.

    isGeneric

    public boolean isGeneric()
    Was generic name given in the constructor a valid generic name (one or 2 '*'s)?


    isQuoted

    public boolean isQuoted()
    Was quoted name given in the constructor a quoted name like "abcDEF"?


    getPatternType

    public int getPatternType()
    What type of pattern is it? One of: SCALAR, ALL, WILDCARD_END, WILDCARD_START, WILDCARD_MIDDLE, WILDCARD_START_END, or WILDCARD_MIDDLE_END


    toString

    public String toString()
    For writing this object out. Writes out the original generic name specified in the constructor.

    Overrides:
    toString in class Object

    writeInfo

    public void writeInfo(PrintWriter stream)
    For debugging/testing purposes. Writes out information about this generic name to the given stream file.


    Rational Developer for Power Systems Software
    V7.6

    Copyright © 2011 IBM Corp. All Rights Reserved.

    Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.