public final class CallNumUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CUTTER_REGEX
regular expression string for the cutter, without preceding characters
(such as the "required" period, which is sometimes missing, or spaces).
|
static Pattern |
DEWEY_CLASS_N_CUTTER_PATTERN |
static String |
DEWEY_CLASS_N_CUTTER_REGEX
the full Dewey classification string, followed by the first cutter
|
static String |
DEWEY_CLASS_REGEX
regular expression for Dewey classification.
|
static String |
DEWEY_CUTTER_SPACE_TRAILING_LETTERS_REGEX |
static String |
DEWEY_CUTTER_TRAILING_LETTERS_REGEX |
static String |
DEWEY_FULL_CUTTER_REGEX |
static String |
DEWEY_MIN_CUTTER_LETTER_REGEX
Dewey cutters start with a letter, followed by a one to three digit
number.
|
static String |
DEWEY_MIN_CUTTER_REGEX |
static Pattern |
DEWEY_PATTERN |
static String |
LC_CLASS_N_CUTTER
the full LC classification string, followed by the first cutter
|
static Pattern |
LC_CLASS_N_CUTTER_PATTERN |
static String |
LC_CLASS_REQ_REGEX
regular expression string for the required portion of the LC classification
LC classification is
1-3 capital letters followed by float number (may be an integer)
optionally followed by a space and then a year or other number,
e.g.
|
static String |
LC_CLASS_W_SUFFIX
the full LC classification string (can have an optional suffix after LC class)
|
static String |
NOT_CUTTER
non-cutter text that can appear before or after cutters
|
static StringBuilder |
reverseDefault |
static char |
SORT_FIRST_CHAR
this character will sort first
|
static String |
SUDOC_REGEX
regular expression string for complete SuDoc classification
Splits the based on continuous numbers and alphabets
Ignore any special char and spaces.
|
Modifier and Type | Method and Description |
---|---|
static String |
addLeadingZeros(String deweyCallNum)
adds leading zeros to a dewey call number, when they're missing.
|
static String |
getDeweyB4Cutter(String callnum)
return the portion of the Dewey call number string that occurs before the
Cutter.
|
static String |
getDeweyCutter(String rawCallnum)
return the first cutter in the call number, without the preceding
characters (such as the "required" period, which is sometimes missing,
or spaces).
|
static String |
getDeweyCutterSuffix(String rawCallnum)
return suffix to the first cutter in the dewey call number
|
static String |
getDeweyShelfKey(String rawDeweyCallnum)
given a raw Dewey call number, return the shelf key - a sortable
version of the call number
|
static String |
getFirstLCcutter(String rawCallnum)
return the first cutter in the LC call number, without the preceding
characters (such as the "required" period, which is sometimes missing,
or spaces), or any suffixes
|
static String |
getFirstLCcutterSuffix(String rawLCcallnum)
return the suffix after the first cutter, if there is one.
|
static String |
getLCB4FirstCutter(String callnum)
return the portion of the LC call number string that occurs before the
Cutter.
|
static String |
getLCClassDigits(String rawLCcallnum)
return the numeric portion of the required portion of the LC classification.
|
static String |
getLCClassSuffix(String rawLCcallnum)
return the string between the LC class number and the cutter, if it
starts with a digit, null otherwise
|
static String |
getLCShelfkey(String rawLCcallnum,
String recid)
given a raw LC call number, return the shelf key - a sortable version
of the call number
|
static String |
getLCShelfkey(String rawLCcallnum,
String recid,
org.marc4j.ErrorHandler errors)
given a raw LC call number, return the shelf key - a sortable version
of the call number
|
static String |
getLCstartLetters(String rawLCcallnum)
Given a raw LC call number, return the initial letters (before any
numbers)
|
static String |
getPortionBeforeCutter(String callnum)
return the portion of the call number string that occurs before the
Cutter, NOT including any class suffixes occuring before the cutter
|
static String |
getReverseShelfKey(String shelfkey)
given a shelfkey (a lexicaly sortable call number), return the reverse
shelf key - a sortable version of the call number that will give the
reverse order (for getting "previous" call numbers in a list)
|
static String |
getSecondLCcutter(String rawLCcallnum)
return the second cutter in the call number, without the preceding
characters (such as the "required" period, which is sometimes missing,
or spaces), or any suffixes
|
static String |
getSecondLCcutterSuffix(String rawLCcallnum)
return the suffix after the first cutter, if there is one.
|
static String |
getSecondLCcutterYearSuffix(String rawLCcallnum)
Deprecated.
|
static String |
getSuDocShelfKey(String callNumber) |
static boolean |
isValidDewey(String possDeweyVal)
given a possible Dewey call number value, determine if it
matches the pattern of an Dewey call number
|
static boolean |
isValidDeweyWithCutter(String possDeweyVal)
given a possible Dewey call number value, determine if it
matches the pattern of an Dewey call number
|
static boolean |
isValidLC(String possLCval)
given a possible Library of Congress call number value, determine if it
matches the pattern of an LC call number
|
static String |
normalizeCallnum(String rawCallnum)
Used to improve call num sorting and volume lopping.
|
static String |
normalizeFloat(String floatStr,
int digitsB4,
int digitsAfter)
normalizes numbers (can have decimal portion) to (digitsB4) before
the decimal (adding leading zeroes as necessary) and (digitsAfter
after the decimal.
|
static String |
normalizeSuffix(String suffix)
normalize a suffix for shelf list sorting by changing all digit
substrings to a constant length (left padding with zeros).
|
static String |
removeDeweyVolSuffix(String rawDeweyCallnum)
remove volume information from Dewey call number if it is present as a
suffix
|
static String |
removeLCVolSuffix(String rawLCcallnum)
remove volume information from LC call number if it is present as a
suffix
|
static char[] |
reverseNonAlphanum(char ch)
for non alpha numeric characters, return a character that will sort
first or last, whichever is the opposite of the original character.
|
public static final Pattern DEWEY_PATTERN
public static final String LC_CLASS_REQ_REGEX
public static final String NOT_CUTTER
public static final String LC_CLASS_W_SUFFIX
public static final String CUTTER_REGEX
public static final String LC_CLASS_N_CUTTER
public static final Pattern LC_CLASS_N_CUTTER_PATTERN
public static final String DEWEY_CLASS_REGEX
public static final String DEWEY_MIN_CUTTER_LETTER_REGEX
public static final String DEWEY_MIN_CUTTER_REGEX
public static final String DEWEY_CUTTER_TRAILING_LETTERS_REGEX
public static final String DEWEY_CUTTER_SPACE_TRAILING_LETTERS_REGEX
public static final String DEWEY_FULL_CUTTER_REGEX
public static final String DEWEY_CLASS_N_CUTTER_REGEX
public static final Pattern DEWEY_CLASS_N_CUTTER_PATTERN
public static final String SUDOC_REGEX
public static char SORT_FIRST_CHAR
public static StringBuilder reverseDefault
public static final boolean isValidLC(String possLCval)
public static final boolean isValidDeweyWithCutter(String possDeweyVal)
public static final boolean isValidDewey(String possDeweyVal)
public static final String getPortionBeforeCutter(String callnum)
public static final String getLCB4FirstCutter(String callnum)
public static String getLCstartLetters(String rawLCcallnum)
public static String getLCClassDigits(String rawLCcallnum)
rawLCcallnum
- public static String getLCClassSuffix(String rawLCcallnum)
rawLCcallnum
- - the entire LC call number, as a stringpublic static String getFirstLCcutter(String rawCallnum)
rawCallnum
- - the entire call number, as a stringpublic static String getFirstLCcutterSuffix(String rawLCcallnum)
rawLCcallnum
- - the entire LC call number, as a stringpublic static String getSecondLCcutter(String rawLCcallnum)
rawLCcallnum
- - the entire call number, as a stringpublic static String getSecondLCcutterSuffix(String rawLCcallnum)
rawLCcallnum
- - the entire LC call number, as a stringpublic static String getSecondLCcutterYearSuffix(String rawLCcallnum)
rawLCcallnum
- - the entire LC call number, as a stringpublic static final String getDeweyB4Cutter(String callnum)
public static String getDeweyCutter(String rawCallnum)
rawCallnum
- - the entire call number, as a stringpublic static String getDeweyCutterSuffix(String rawCallnum)
rawCallnum
- - the entire call number, as a stringpublic static String normalizeCallnum(String rawCallnum)
rawCallnum
- - a non-null String containing a Dewey call numberpublic static String getLCShelfkey(String rawLCcallnum, String recid)
public static String getLCShelfkey(String rawLCcallnum, String recid, org.marc4j.ErrorHandler errors)
public static String normalizeSuffix(String suffix)
public static String getReverseShelfKey(String shelfkey)
public static char[] reverseNonAlphanum(char ch)
public static String getDeweyShelfKey(String rawDeweyCallnum)
public static String normalizeFloat(String floatStr, int digitsB4, int digitsAfter)
floatStr,
- the number, as a StringdigitsB4
- - the number of characters the result should have before the
decimal point (leading zeroes will be added as necessary). A negative
number means leave whatever digits encountered as is; don't pad with leading zeroes.digitsAfter
- - the number of characters the result should have after
the decimal point. A negative number means leave whatever fraction
encountered as is; don't pad with trailing zeroes (trailing zeroes in
this case will be removed)NumberFormatException
- if string can't be parsed as a numberpublic static String removeLCVolSuffix(String rawLCcallnum)
rawLCcallnum
- public static String removeDeweyVolSuffix(String rawDeweyCallnum)
rawDeweyCallnum
- public static String addLeadingZeros(String deweyCallNum)
deweyCallNum
- public static String getSuDocShelfKey(String callNumber)
callNumber
- Copyright © 2004–2015 The Kuali Foundation. All rights reserved.