org.jppf.net
Class AbstractIPAddressPattern

java.lang.Object
  extended by org.jppf.net.AbstractIPAddressPattern
Direct Known Subclasses:
IPv4AddressPattern, IPv6AddressPattern

public abstract class AbstractIPAddressPattern
extends Object

Represents a pattern used for IP addresses inclusion or exclusion lists.
A pattern represents a single value or a range of values for each component of an IP address.

Author:
Laurent Cohen

Constructor Summary
AbstractIPAddressPattern(String source, org.jppf.net.PatternConfiguration config)
          Initialize this object with the specified string pattern.
 
Method Summary
protected  void convertSource(String source)
          Convert the specified source into an IP pattern.
 boolean matches(InetAddress ip)
          Determine whether the specified IP address matches this pattern.
 boolean matches(int[] values)
          Determine whether the specified IP address matches this pattern.
protected  String postProcess(String source)
          Perform post-processing of the source string before applying common transformations.
protected  String preProcess(String source)
          Perform pre-processing of the source string before applying common transformations.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractIPAddressPattern

public AbstractIPAddressPattern(String source,
                                org.jppf.net.PatternConfiguration config)
                         throws IllegalArgumentException
Initialize this object with the specified string pattern.

Parameters:
source - the source pattern as a string.
config - the configuration used for this pattern.
Throws:
IllegalArgumentException - if the pattern is null or invalid.
Method Detail

convertSource

protected void convertSource(String source)
                      throws IllegalArgumentException
Convert the specified source into an IP pattern.

Parameters:
source - the source pattern as a string.
Throws:
IllegalArgumentException - if the pattern is null or invalid.

preProcess

protected String preProcess(String source)
Perform pre-processing of the source string before applying common transformations.

Parameters:
source - the pattern source to process.
Returns:
a new processed string.

postProcess

protected String postProcess(String source)
Perform post-processing of the source string before applying common transformations.

Parameters:
source - the pattern source to process.
Returns:
a new processed string.

matches

public boolean matches(InetAddress ip)
Determine whether the specified IP address matches this pattern. No check is made to verify that the IP address is valid.

Parameters:
ip - the ip to match as a string.
Returns:
true if the address matches this pattern, false otherwise.

matches

public boolean matches(int[] values)
Determine whether the specified IP address matches this pattern. No check is made to verify that the IP address is valid.

Parameters:
values - the ip address to match as a array of values representing its components.
Returns:
true if the address matches this pattern, false otherwise.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2005-2010 JPPF Team.