public class BibtexDatabase
extends java.lang.Object
Constructor and Description |
---|
BibtexDatabase() |
Modifier and Type | Method and Description |
---|---|
void |
addDatabaseChangeListener(DatabaseChangeListener l) |
void |
addString(BibtexString string)
Inserts a Bibtex String at the given index.
|
boolean |
checkForDuplicateKeyAndAdd(java.lang.String oldKey,
java.lang.String newKey,
boolean issueWarning) |
void |
fireDatabaseChanged(DatabaseChangeEvent e) |
java.util.Collection<BibtexEntry> |
getEntries() |
BibtexEntry[] |
getEntriesByKey(java.lang.String key) |
BibtexEntry |
getEntryById(java.lang.String id)
Returns the entry with the given ID (-> entry_type + hashcode).
|
BibtexEntry |
getEntryByKey(java.lang.String key)
Returns the entry with the given bibtex key.
|
int |
getEntryCount()
Returns the number of entries.
|
java.util.Map<java.lang.String,BibtexEntry> |
getEntryMap()
Just temporary, for testing purposes....
|
java.util.Set<java.lang.String> |
getKeySet()
Returns a Set containing the keys to all entries.
|
int |
getNumberOfKeyOccurences(java.lang.String key)
Returns the number of occurences of the given key in this database.
|
java.lang.String |
getPreamble()
Returns the database's preamble.
|
static java.lang.String |
getResolvedField(java.lang.String field,
BibtexEntry bibtex,
BibtexDatabase database)
Returns the text stored in the given field of the given bibtex entry
which belongs to the given database.
|
EntrySorter |
getSorter(java.util.Comparator<BibtexEntry> comp)
Returns an EntrySorter with the sorted entries from this base,
sorted by the given Comparator.
|
BibtexString |
getString(java.lang.String o)
Returns the string at the given index.
|
int |
getStringCount()
Returns the number of strings.
|
java.util.Set<java.lang.String> |
getStringKeySet()
Returns a Set of keys to all BibtexString objects in the database.
|
java.util.Collection<BibtexString> |
getStringValues()
Returns a Collection of all BibtexString objects in the database.
|
static java.lang.String |
getText(java.lang.String toResolve,
BibtexDatabase database)
Returns a text with references resolved according to an optionally given
database.
|
boolean |
hasStringLabel(java.lang.String label)
Returns true if a string with the given label already exists.
|
boolean |
insertEntry(BibtexEntry entry)
Inserts the entry, given that its ID is not already in use.
|
void |
removeDatabaseChangeListener(DatabaseChangeListener l) |
BibtexEntry |
removeEntry(java.lang.String id)
Removes the entry with the given string.
|
void |
removeString(java.lang.String id)
Removes the string at the given index.
|
BibtexEntry |
resolveForStrings(BibtexEntry entry,
boolean inPlace)
Take the given BibtexEntry and resolve any string references.
|
java.util.List<BibtexEntry> |
resolveForStrings(java.util.Collection<BibtexEntry> entries,
boolean inPlace)
Take the given collection of BibtexEntry and resolve any string
references.
|
java.lang.String |
resolveForStrings(java.lang.String content)
Resolves any references to strings contained in this field content,
if possible.
|
boolean |
setCiteKeyForEntry(java.lang.String id,
java.lang.String key) |
void |
setFollowCrossrefs(boolean followCrossrefs) |
void |
setPreamble(java.lang.String preamble)
Sets the database's preamble.
|
public int getEntryCount()
public java.util.Set<java.lang.String> getKeySet()
public EntrySorter getSorter(java.util.Comparator<BibtexEntry> comp)
public java.util.Map<java.lang.String,BibtexEntry> getEntryMap()
public BibtexEntry getEntryById(java.lang.String id)
public java.util.Collection<BibtexEntry> getEntries()
public BibtexEntry getEntryByKey(java.lang.String key)
public BibtexEntry[] getEntriesByKey(java.lang.String key)
public boolean insertEntry(BibtexEntry entry) throws KeyCollisionException
KeyCollisionException
public BibtexEntry removeEntry(java.lang.String id)
public boolean setCiteKeyForEntry(java.lang.String id, java.lang.String key)
public void setPreamble(java.lang.String preamble)
public java.lang.String getPreamble()
public void addString(BibtexString string) throws KeyCollisionException
KeyCollisionException
public void removeString(java.lang.String id)
public java.util.Set<java.lang.String> getStringKeySet()
public java.util.Collection<BibtexString> getStringValues()
public BibtexString getString(java.lang.String o)
public int getStringCount()
public boolean hasStringLabel(java.lang.String label)
public java.lang.String resolveForStrings(java.lang.String content)
public java.util.List<BibtexEntry> resolveForStrings(java.util.Collection<BibtexEntry> entries, boolean inPlace)
entries
- A collection of BibtexEntries in which all strings of the form
#xxx# will be resolved against the hash map of string
references stored in the databasee.inPlace
- If inPlace is true then the given BibtexEntries will be modified, if false then copies of the BibtexEntries are made before resolving the strings.public BibtexEntry resolveForStrings(BibtexEntry entry, boolean inPlace)
entry
- A BibtexEntry in which all strings of the form #xxx# will be
resolved against the hash map of string references stored in
the databasee.inPlace
- If inPlace is true then the given BibtexEntry will be
modified, if false then a copy is made using close made before
resolving the strings.public boolean checkForDuplicateKeyAndAdd(java.lang.String oldKey, java.lang.String newKey, boolean issueWarning)
public int getNumberOfKeyOccurences(java.lang.String key)
public void fireDatabaseChanged(DatabaseChangeEvent e)
public void addDatabaseChangeListener(DatabaseChangeListener l)
public void removeDatabaseChangeListener(DatabaseChangeListener l)
public static java.lang.String getResolvedField(java.lang.String field, BibtexEntry bibtex, BibtexDatabase database)
field
- The field to return the value of.bibtex
- maybenull
The bibtex entry which contains the field.database
- maybenull
The database of the bibtex entry.public static java.lang.String getText(java.lang.String toResolve, BibtexDatabase database)
toResolve
- maybenull The text to resolve.database
- maybenull The database to use for resolving the text.public void setFollowCrossrefs(boolean followCrossrefs)