input
stringlengths
10
828
output
stringlengths
5
107
public boolean is in range double value double min double max return is in range value double value min max
check if the value is within a specified range
public boolean min value double value double min return value min
check if the value is greater than or equal to a minimum
public boolean is valid local tld string i tld return local tld list contains chomp leading dot i tld to lower case
returns true if the specified code string code matches any
public boolean min value double value double min return min value value double value min
check if the value is greater than or equal to a minimum
public boolean max value double value double max return value max
check if the value is less than or equal to a maximum
public boolean max value double value double max return max value value double value max
check if the value is less than or equal to a maximum
protected object process parsed value object value format formatter if value instanceof double return value else return new double number value double value
convert the parsed value to a code double code
public boolean is valid string value return is valid value string null locale null
p validate using the default code locale code
public check digit get check digit return checkdigit
return the check digit validation routine
public boolean is valid string value string pattern return is valid value pattern locale null
p validate using the specified i pattern i
public boolean is valid string value locale locale return is valid value string null locale
p validate using the specified code locale code
public string format object value return format value string null locale null
p format an object into a code string code using
public string format object value string pattern return format value pattern locale null
p format an object into a code string code using
public regex validator get regex validator return regex validator
return the i regular expression i validator
public string format object value locale locale return format value string null locale
p format an object into a code string code using
public string format object value string pattern locale locale format formatter get format pattern locale return format value formatter
p format an object using the specified pattern and or
public boolean is valid string input return validate input null
validate the code returning either code true code
protected string format object value format formatter return formatter format value
p format a value with the specified code format code
protected object parse string value format formatter parse position pos new parse position 0 object parsed value formatter parse object value pos if pos get error index 1 return null if is strict pos get index value length return null if parsed value null parsed value process parsed value parsed value formatter return parsed value
p parse the value with the specified code format code
public object validate string input if input null return null string code input trim if code length 0 return null validate reformat using regular expression if regex validator null code regex validator validate code if code null return null check the length if min length 0 code length min length max length 0 code length max length return null validate the check digit if checkdigit null checkdigit is valid code return null return code
validate the code returning either the valid code or
public big integer validate string value return big integer parse value string null locale null
p validate convert a code big integer code using the default
public big integer validate string value string pattern return big integer parse value pattern locale null
p validate convert a code big integer code using the
public big integer validate string value locale locale return big integer parse value string null locale
p validate convert a code big integer code using the
public big integer validate string value string pattern locale locale return big integer parse value pattern locale
p validate convert a code big integer code using the
public boolean is in range big integer value long min long max return value long value min value long value max
check if the value is within a specified range
public boolean min value big integer value long min return value long value min
check if the value is greater than or equal to a minimum
public boolean max value big integer value long max return value long value max
check if the value is less than or equal to a maximum
protected object process parsed value object value format formatter return big integer value of number value long value
convert the parsed value to a code big integer code
public boolean is valid string code return is valid isbn13 code is valid isbn10 code
check the code is either a valid isbn 10 or isbn 13 code
public boolean is valid isbn10 string code return isbn10 validator is valid code
check the code is a valid isbn 10 code
public boolean is valid isbn13 string code return isbn13 validator is valid code
check the code is a valid isbn 13 code
public string validate string code string result validate isbn13 code if result null result validate isbn10 code if result null convert result convert to isbn13 result return result
check the code is either a valid isbn 10 or isbn 13 code
public string validate isbn10 string code object result isbn10 validator validate code return result null null result to string
check the code is a valid isbn 10 code
public string validate isbn13 string code object result isbn13 validator validate code return result null null result to string
check the code is a valid isbn 13 code
public string convert to isbn13 string isbn10 if isbn10 null return null string input isbn10 trim if input length 10 throw new illegal argument exception invalid length input length for input calculate the new isbn 13 code string isbn13 978 input substring 0 9 try string check digit isbn13 validator get check digit calculate isbn13 isbn13 check digit return isbn13 catch check digit exception e throw new illegal argument exception check digit error for input e get message
convert an isbn 10 code to an isbn 13 code
public long validate string value return long parse value string null locale null
p validate convert a code long code using the default
public int compare time calendar value calendar compare return compare time value compare calendar millisecond
p compare times hour minute second and millisecond not date
public long validate string value string pattern return long parse value pattern locale null
p validate convert a code long code using the
public int compare seconds calendar value calendar compare return compare time value compare calendar second
p compare seconds hours minutes and seconds
public long validate string value locale locale return long parse value string null locale
p validate convert a code long code using the
public int compare minutes calendar value calendar compare return compare time value compare calendar minute
p compare minutes hours and minutes
public long validate string value string pattern locale locale return long parse value pattern locale
p validate convert a code long code using the
public boolean is in range long value long min long max return value min value max
check if the value is within a specified range
public int compare hours calendar value calendar compare return compare time value compare calendar hour of day
p compare hours
public boolean is in range long value long min long max return is in range value long value min max
check if the value is within a specified range
public boolean min value long value long min return value min
check if the value is greater than or equal to a minimum
public boolean min value long value long min return min value value long value min
check if the value is greater than or equal to a minimum
public boolean is valid string card if card null card length 0 return false for int i 0 i card types size i code validator type code validator card types get i if type is valid card return true return false
checks if the field is a valid credit card number
public object validate string card if card null card length 0 return null object result null for int i 0 i card types size i code validator type code validator card types get i result type validate card if result null return result return null
checks if the field is a valid credit card number
public boolean max value long value long max return value max
check if the value is less than or equal to a maximum
private boolean is on long options long flag return options flag 0
tests whether the given flag is on
public boolean max value long value long max return max value value long value max
check if the value is less than or equal to a maximum
protected object process parsed value object value format formatter if value instanceof long return value else return new long number value long value
convert the parsed value to a code long code
public date validate string value return date parse value string null locale null time zone null
p validate convert a code date code using the default
public date validate string value time zone time zone return date parse value string null locale null time zone
p validate convert a code date code using the specified
public date validate string value string pattern return date parse value pattern locale null time zone null
p validate convert a code date code using the specified
public date validate string value string pattern time zone time zone return date parse value pattern locale null time zone
p validate convert a code date code using the specified
public date validate string value locale locale return date parse value string null locale time zone null
p validate convert a code date code using the specified
public date validate string value locale locale time zone time zone return date parse value string null locale time zone
p validate convert a code date code using the specified
public date validate string value string pattern locale locale return date parse value pattern locale time zone null
p validate convert a code date code using the specified pattern
protected int weighted value int char value int left pos int right pos int weight position weight right pos 2 return char value weight
p calculates the i weighted i value of a character in the
public string calculate string code throws check digit exception if code null code length 0 throw new check digit exception isbn code is missing else if code length 9 return isbn10 check digit calculate code else if code length 12 return isbn13 check digit calculate code else throw new check digit exception invalid isbn length code length
calculate an isbn 10 or isbn 13 check digit depending
public date validate string value string pattern locale locale time zone time zone return date parse value pattern locale time zone
p validate convert a code date code using the specified
public boolean is valid string code if code null return false else if code length 10 return isbn10 check digit is valid code else if code length 13 return isbn13 check digit is valid code else return false
p validate an isbn 10 or isbn 13 check digit depending
public boolean is valid string code if code null code length 5 return false try int modulus result calculate modulus code return modulus result 1 catch check digit exception ex return false
validate the check digit for an the iban code
public int compare dates date value date compare time zone time zone calendar calendar value get calendar value time zone calendar calendar compare get calendar compare time zone return compare calendar value calendar compare calendar date
p compare dates day month and year not time
public string calculate string code throws check digit exception if code null code length 5 throw new check digit exception invalid code length code null 0 code length int modulus result calculate modulus code int char value 98 modulus result string check digit integer to string char value return char value 9 check digit 0 check digit
calculate the i check digit i for an iban code
private int calculate modulus string code throws check digit exception string reformatted code code substring 4 code substring 0 4 long total 0 for int i 0 i reformatted code length i int char value character get numeric value reformatted code char at i if char value 0 char value 35 throw new check digit exception invalid character i char value total char value 9 total 100 total 10 char value if total max total total modulus return int total modulus
calculate the modulus for a code
public int compare weeks date value date compare time zone time zone calendar calendar value get calendar value time zone calendar calendar compare get calendar compare time zone return compare calendar value calendar compare calendar week of year
p compare weeks week and year
public int get modulus return modulus
return the modulus value this check digit routine is based on
public boolean is valid string code if code null code length 0 return false try int modulus result calculate modulus code true return modulus result 0 catch check digit exception ex return false
validate a modulus check digit for a code
public int compare months date value date compare time zone time zone calendar calendar value get calendar value time zone calendar calendar compare get calendar compare time zone return compare calendar value calendar compare calendar month
p compare months month and year
public string calculate string code throws check digit exception if code null code length 0 throw new check digit exception code is missing int modulus result calculate modulus code false int char value modulus modulus result modulus return to check digit char value
calculate a modulus i check digit i for a code
protected int calculate modulus string code boolean includes check digit throws check digit exception int total 0 for int i 0 i code length i int lth code length includes check digit 0 1 int left pos i 1 int right pos lth i int char value to int code char at i left pos right pos total weighted value char value left pos right pos if total 0 throw new check digit exception invalid code sum is zero return total modulus
calculate the modulus for a code
public int compare quarters date value date compare time zone time zone return compare quarters value compare time zone 1
p compare quarters quarter and year
protected int calculate modulus string code boolean includes check digit throws check digit exception string buffer transformed new string buffer code length 2 for int i 0 i code length i int char value character get numeric value code char at i if char value 0 char value 35 throw new check digit exception invalid character i 1 char value transformed append char value return super calculate modulus transformed to string includes check digit
calculate the modulus for an isin code
protected int weighted value int char value int left pos int right pos int weight position weight right pos 2 int weighted value char value weight return modulus check digit sum digits weighted value
p calculates the i weighted i value of a charcter in the
public int compare quarters date value date compare time zone time zone int month of first quarter calendar calendar value get calendar value time zone calendar calendar compare get calendar compare time zone return super compare quarters calendar value calendar compare month of first quarter
p compare quarters quarter and year
protected int weighted value int char value int left pos int right pos int weight position weight right pos 3 return char value weight
calculates the i weighted i value of a character in the
public int compare years date value date compare time zone time zone calendar calendar value get calendar value time zone calendar calendar compare get calendar compare time zone return compare calendar value calendar compare calendar year
p compare years
protected int calculate modulus string code boolean includes check digit throws check digit exception if code length 7 throw new check digit exception invalid code length code length return super calculate modulus code includes check digit
calculate the modulus for an sedol code
protected int weighted value int char value int left pos int right pos return char value position weight left pos 1
calculates the i weighted i value of a charcter in the
protected object process parsed value object value format formatter return value
p returns the parsed code date code unchanged
protected int weighted value int char value int left pos int right pos int weight position weight right pos 2 int weighted value char value weight return weighted value 9 weighted value 9 weighted value
p calculates the i weighted i value of a charcter in the
public boolean is valid string code if code null code length 0 return false try return calculate checksum code true 0 catch check digit exception e return false
validate the verhoeff i check digit i for a code
public string calculate string code throws check digit exception if code null code length 0 throw new check digit exception code is missing int checksum calculate checksum code false return integer to string inv table checksum
calculate a verhoeff i check digit i for a code
private int calculate checksum string code boolean includes check digit throws check digit exception int checksum 0 for int i 0 i code length i int idx code length i 1 int num character get numeric value code char at idx if num 0 num 9 throw new check digit exception invalid character i int code char at idx int pos includes check digit i i 1 checksum d table checksum p table pos 8 num return checksum
calculate the checksum
private calendar get calendar date value time zone time zone calendar calendar null if time zone null calendar calendar get instance time zone else calendar calendar get instance calendar set time value return calendar
p convert a code date code to a code calendar code
protected int weighted value int char value int left pos int right pos return char value right pos
calculates the i weighted i value of a charcter in the
public boolean is allow fractions return allow fractions
p indicates whether the number being validated is
public int get format type return format type
p indicates the type of code number format code created
public boolean is valid string value string pattern locale locale object parsed value parse value pattern locale return parsed value null false true
p validate using the specified code locale code
public byte validate string value return byte parse value string null locale null
p validate convert a code byte code using the default
public boolean is in range number value number min number max return min value value min max value value max
check if the value is within a specified range
public byte validate string value string pattern return byte parse value pattern locale null
p validate convert a code byte code using the
public boolean min value number value number min if is allow fractions return value double value min double value else return value long value min long value
check if the value is greater than or equal to a minimum
public byte validate string value locale locale return byte parse value string null locale
p validate convert a code byte code using the
public boolean max value number value number max if is allow fractions return value double value max double value else return value long value max long value
check if the value is less than or equal to a maximum
public byte validate string value string pattern locale locale return byte parse value pattern locale
p validate convert a code byte code using the
protected object parse string value string pattern locale locale value value null null value trim if value null value length 0 return null format formatter get format pattern locale return parse value formatter
p parse the value using the specified pattern