public static void parseIPAddress(String ipString,TraitMap map){
  String[] s=ipString.split("[^\\p{XDigit}]");
  if (s.length == IP6_BYTES) {
    throw new java.lang.IllegalArgumentException("Cannot parse IPv6 address " + ipString);
  }
 else   if (s.length <= IP4_BYTES + 1) {
    if (s.length == IP4_BYTES + 1) {
      map.parseThenPut(Trait.CIDR,s[4]);
    }
    int val;
    val=intVal(s[0]);
    val<<=8;
    val|=intVal(s[1]);
    val<<=8;
    val|=intVal(s[2]);
    val<<=8;
    val|=intVal(s[3]);
    map.put(Trait.IPv4,val);
  }
}

public static void parseIPAddress ( String ipString , TraitMap map ) { String [ ] s = ipString . split ( "[^\\p{XDigit}]" ) ; if ( s . length == IP6_BYTES ) { throw new java . lang . IllegalArgumentException ( "Cannot parse IPv6 address " + ipString ) ; } else if ( s . length <= IP4_BYTES + 1 ) { if ( s . length == IP4_BYTES + 1 ) { map . parseThenPut ( Trait . CIDR , s [ 4 ] ) ; } int val ; val = intVal ( s [ 0 ] ) ; val <<= 8 ; val |= intVal ( s [ 1 ] ) ; val <<= 8 ; val |= intVal ( s [ 2 ] ) ; val <<= 8 ; val |= intVal ( s [ 3 ] ) ; map . put ( Trait . IPv4 , val ) ; } }
parses ip4 and ip6 ip addresses and places the associated trait in the provided map .
