public class LabelPatternUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.ArrayList<java.lang.String> |
DEFAULT_LABELPATTERN |
Constructor and Description |
---|
LabelPatternUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
applyModifiers(java.lang.String label,
java.lang.String[] parts,
int offset)
Applies modifiers to a label generated based on a field marker.
|
static java.lang.String |
authIniN(java.lang.String authorField,
int n)
authIniN format:
Each author gets (N div #authors) chars, the remaining (N mod #authors)
chars are equally distributed to the authors first in the row.
|
static java.lang.String |
firstAuthor(java.lang.String authorField)
Gets the last name of the first author/editor
|
static java.lang.String |
firstAuthorVonAndLast(java.lang.String authorField)
Gets the von part and the last name of the first author/editor
|
static java.lang.String |
firstPage(java.lang.String pages)
Split the pages field into separate numbers and return the lowest
|
static boolean |
isLabelUnique(java.lang.String label)
Tests whether a given label is unique.
|
static java.lang.String |
lastPage(java.lang.String pages)
Split the pages field into separate numbers and return the highest
|
static java.lang.String |
makeLabel(BibtexEntry _entry,
java.lang.String val) |
static BibtexEntry |
makeLabel(MetaData metaData,
BibtexDatabase database,
BibtexEntry _entry)
Generates a BibTeX label according to the pattern for a given entry type, and
returns the
Bibtexentry with the unique label. |
static java.lang.String[] |
parseFieldMarker(java.lang.String arg)
Parse a field marker with modifiers, possibly containing a parenthesised modifier,
as well as escaped colons and parentheses.
|
static java.util.ArrayList<java.lang.String> |
split(java.lang.String labelPattern)
This method takes a string of the form [field1]spacer[field2]spacer[field3]...,
where the fields are the (required) fields of a BibTex entry.
|
static void |
updateDefaultPattern() |
public static java.util.ArrayList<java.lang.String> DEFAULT_LABELPATTERN
public static void updateDefaultPattern()
public static java.util.ArrayList<java.lang.String> split(java.lang.String labelPattern)
labelPattern
- a String
ArrayList
The first item of the list
is a string representation of the key pattern (the parameter),
the remaining items are the fieldspublic static BibtexEntry makeLabel(MetaData metaData, BibtexDatabase database, BibtexEntry _entry)
Bibtexentry
with the unique label.
The given database is used to avoid duplicate keys.database
- a BibtexDatabase
_entry
- a BibtexEntry
public static java.lang.String applyModifiers(java.lang.String label, java.lang.String[] parts, int offset)
label
- The generated label.parts
- String array containing the modifiers.offset
- The number of initial items in the modifiers array to skip.public static java.lang.String makeLabel(BibtexEntry _entry, java.lang.String val)
public static boolean isLabelUnique(java.lang.String label)
label
- a String
true
if and only if the label
is uniquepublic static java.lang.String firstAuthor(java.lang.String authorField)
authorField
- a String
java.lang.NullPointerException
- if authorField == nullpublic static java.lang.String firstAuthorVonAndLast(java.lang.String authorField)
authorField
- a String
java.lang.NullPointerException
- if authorField == nullpublic static java.lang.String authIniN(java.lang.String authorField, int n)
authorField
- The authors to format.n
- The maximum number of characters this string will be long. A
negative number or zero will lead to "" be returned.java.lang.NullPointerException
- if authorField is null and n > 0public static java.lang.String firstPage(java.lang.String pages)
pages
- (may not be null) a pages string such as 42--111 or
7,41,73--97 or 43+java.lang.NullPointerException
- if pages is nullpublic static java.lang.String lastPage(java.lang.String pages)
pages
- a pages string such as 42--111 or 7,41,73--97 or 43+java.lang.NullPointerException
- if pages is null.public static java.lang.String[] parseFieldMarker(java.lang.String arg)
arg
- The argument string.