use of org.jabref.model.entry.BibtexString in project jabref by JabRef.
the class BibDatabaseTest method circularStringResolvingLongerCycle.
@Test
public void circularStringResolvingLongerCycle() {
BibtexString string = new BibtexString("AAA", "#BBB#");
database.addString(string);
string = new BibtexString("BBB", "#CCC#");
database.addString(string);
string = new BibtexString("CCC", "#DDD#");
database.addString(string);
string = new BibtexString("DDD", "#AAA#");
database.addString(string);
assertEquals(database.resolveForStrings("#AAA#"), "AAA");
assertEquals(database.resolveForStrings("#BBB#"), "BBB");
assertEquals(database.resolveForStrings("#CCC#"), "CCC");
assertEquals(database.resolveForStrings("#DDD#"), "DDD");
}
use of org.jabref.model.entry.BibtexString in project jabref by JabRef.
the class BibDatabaseTest method hasStringLabelFindsString.
@Test
public void hasStringLabelFindsString() {
BibtexString string = new BibtexString("DSP", "Digital Signal Processing");
database.addString(string);
assertTrue(database.hasStringLabel("DSP"));
assertFalse(database.hasStringLabel("VLSI"));
}
use of org.jabref.model.entry.BibtexString in project jabref by JabRef.
the class BibDatabaseTest method resolveForStringsOddHashMarkAtTheEnd.
@Test
public void resolveForStringsOddHashMarkAtTheEnd() {
BibtexString string = new BibtexString("AAA", "aaa");
database.addString(string);
assertEquals(database.resolveForStrings("AAA#AAA#AAA#"), "AAAaaaAAA#");
}
use of org.jabref.model.entry.BibtexString in project jabref by JabRef.
the class BibDatabaseTest method getUsedStringsNoString.
@Test
public void getUsedStringsNoString() {
BibEntry entry = new BibEntry();
entry.setField("author", "Oscar Gustafsson");
BibtexString string = new BibtexString("AAA", "Some other text");
database.addString(string);
database.insertEntry(entry);
Collection<BibtexString> usedStrings = database.getUsedStrings(Arrays.asList(entry));
assertEquals(Collections.emptyList(), usedStrings);
}
use of org.jabref.model.entry.BibtexString in project jabref by JabRef.
the class StringChange method makeChange.
@Override
public boolean makeChange(BasePanel panel, BibDatabase secondary, NamedCompound undoEdit) {
if (string == null) {
// The string was removed or renamed locally. We guess that it was removed.
BibtexString bs = new BibtexString(label, disk);
try {
panel.getDatabase().addString(bs);
undoEdit.addEdit(new UndoableInsertString(panel, panel.getDatabase(), bs));
} catch (KeyCollisionException ex) {
LOGGER.info("Error: could not add string '" + bs.getName() + "': " + ex.getMessage(), ex);
}
} else {
string.setContent(disk);
undoEdit.addEdit(new UndoableStringChange(panel, string, false, mem, disk));
}
// Update tmp database:
if (tmpString == null) {
BibtexString bs = new BibtexString(label, disk);
secondary.addString(bs);
} else {
tmpString.setContent(disk);
}
return true;
}
Aggregations