Skip to content

Commit

Permalink
Rename getFormatName -> getName
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez committed Sep 24, 2016
1 parent 665868b commit 1fd13fd
Show file tree
Hide file tree
Showing 35 changed files with 43 additions and 43 deletions.
6 changes: 3 additions & 3 deletions src/main/java/net/sf/jabref/gui/importer/ImportMenuItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public ImportMenuItem(JabRefFrame frame, boolean openInNew) {
}

public ImportMenuItem(JabRefFrame frame, boolean openInNew, Importer importer) {
super(importer == null ? Localization.lang("Autodetect format") : importer.getFormatName());
super(importer == null ? Localization.lang("Autodetect format") : importer.getName());
this.importer = importer;
this.frame = frame;
this.openInNew = openInNew;
Expand Down Expand Up @@ -113,10 +113,10 @@ public void run() {
// This import method never throws an IOException:
imports.add(Globals.IMPORT_FORMAT_READER.importUnknownFormat(filename));
} else {
frame.output(Localization.lang("Importing in %0 format", importer.getFormatName()) + "...");
frame.output(Localization.lang("Importing in %0 format", importer.getName()) + "...");
// Specific importer:
ParserResult pr = importer.importDatabase(file, Globals.prefs.getDefaultEncoding());
imports.add(new ImportFormatReader.UnknownFormatImport(importer.getFormatName(), pr));
imports.add(new ImportFormatReader.UnknownFormatImport(importer.getName(), pr));
}
} catch (IOException e) {
// This indicates that a specific importer was specified, and that
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/net/sf/jabref/logic/importer/Importer.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static BufferedReader getReader(Path filePath, Charset encoding)
*
* @return format name, must be unique and not <code>null</code>
*/
public abstract String getFormatName();
public abstract String getName();


/**
Expand All @@ -115,7 +115,7 @@ public static BufferedReader getReader(Path filePath, Charset encoding)
* @return ID, must be unique and not <code>null</code>
*/
public String getId() {
String id = getFormatName();
String id = getName();
StringBuilder result = new StringBuilder(id.length());
for (int i = 0; i < id.length(); i++) {
char c = id.charAt(i);
Expand All @@ -142,7 +142,7 @@ public String getId() {

@Override
public int hashCode() {
return getFormatName().hashCode();
return getName().hashCode();
}

@Override
Expand All @@ -154,16 +154,16 @@ public boolean equals(Object obj) {
return false;
}
Importer other = (Importer)obj;
return Objects.equals(this.getFormatName(), other.getFormatName());
return Objects.equals(this.getName(), other.getName());
}

@Override
public String toString() {
return getFormatName();
return getName();
}

@Override
public int compareTo(Importer o) {
return getFormatName().compareTo(o.getFormatName());
return getName().compareTo(o.getName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class BibTeXMLImporter extends Importer {


@Override
public String getFormatName() {
public String getName() {
return "BibTeXML";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
public class BiblioscapeImporter extends Importer {

@Override
public String getFormatName() {
public String getName() {
return "Biblioscape";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException {
}

@Override
public String getFormatName() {
public String getName() {
return "BibTeX";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CopacImporter extends Importer {
private static final Pattern COPAC_PATTERN = Pattern.compile("^\\s*TI- ");

@Override
public String getFormatName() {
public String getName() {
return "Copac";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public EndnoteImporter(ImportFormatPreferences preferences) {
}

@Override
public String getFormatName() {
public String getName() {
return "Refer/Endnote";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public ParserResult importEntries(String text) {
}

@Override
public String getFormatName() {
public String getName() {
return "text citations";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class InspecImporter extends Importer {
private static final Pattern INSPEC_PATTERN = Pattern.compile("Record.*INSPEC.*");

@Override
public String getFormatName() {
public String getName() {
return "INSPEC";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class IsiImporter extends Importer {


@Override
public String getFormatName() {
public String getName() {
return "ISI";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class MedlineImporter extends Importer {


@Override
public String getFormatName() {
public String getName() {
return "Medline";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class MedlinePlainImporter extends Importer {


@Override
public String getFormatName() {
public String getName() {
return "MedlinePlain";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ private void putIfValueNotNull(Map<String, String> fields, String modsKey, Strin
}

@Override
public String getFormatName() {
public String getName() {
return "MODS";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException {
}

@Override
public String getFormatName() {
public String getName() {
return "MSBib";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class OvidImporter extends Importer {
private static final int MAX_ITEMS = 50;

@Override
public String getFormatName() {
public String getName() {
return "Ovid";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ private void readLastBlock() {
}

@Override
public String getFormatName() {
public String getName() {
return "PDFcontent";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public PdfXmpImporter(XMPPreferences xmpPreferences) {
}

@Override
public String getFormatName() {
public String getName() {
return Localization.lang("XMP-annotated PDF");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public RepecNepImporter(ImportFormatPreferences importFormatPreferences) {
}

@Override
public String getFormatName() {
public String getName() {
return "REPEC New Economic Papers (NEP)";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class RisImporter extends Importer {
private static final Pattern RECOGNIZED_FORMAT_PATTERN = Pattern.compile("TY - .*");

@Override
public String getFormatName() {
public String getName() {
return "RIS";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class SilverPlatterImporter extends Importer {
private static final Pattern START_PATTERN = Pattern.compile("Record.*INSPEC.*");

@Override
public String getFormatName() {
public String getName() {
return "SilverPlatter";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void setUp() throws Exception {

@Test
public void testGetFormatName() {
assertEquals("BibTeXML", importer.getFormatName());
assertEquals("BibTeXML", importer.getName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void setUp() throws Exception {

@Test
public void testGetFormatName() {
Assert.assertEquals(importer.getFormatName(), "Biblioscape");
Assert.assertEquals(importer.getName(), "Biblioscape");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void testImportEntries() throws IOException, URISyntaxException {

@Test
public void testGetFormatName() {
assertEquals("BibTeX", importer.getFormatName());
assertEquals("BibTeX", importer.getName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void setUp() {

@Test
public void testGetFormatName() {
assertEquals("Refer/Endnote", importer.getFormatName());
assertEquals("Refer/Endnote", importer.getName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void setUp() {

@Test
public void testGetFormatName() {
assertEquals("text citations", importer.getFormatName());
assertEquals("text citations", importer.getName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void importDatabaseWithNullThrowsException() throws IOException {

@Test
public void getFormatterNameDoesNotReturnNull() {
Assert.assertNotNull(format.getFormatName());
Assert.assertNotNull(format.getName());
}

@Test
Expand All @@ -60,7 +60,7 @@ public void getIdDoesNotContainWhitespace() {
@Test
public void getIdStripsSpecialCharactersAndConvertsToLowercase() {
Importer importer = Mockito.mock(Importer.class, Mockito.CALLS_REAL_METHODS);
when(importer.getFormatName()).thenReturn("*Test-Importer");
when(importer.getName()).thenReturn("*Test-Importer");
Assert.assertEquals("testimporter", importer.getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void importMiscGivesMisc() throws IOException {

@Test
public void testGetFormatName() {
assertEquals("INSPEC", importer.getFormatName());
assertEquals("INSPEC", importer.getName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void testParseMonthException() {

@Test
public void testGetFormatName() {
assertEquals(importer.getFormatName(), "ISI");
assertEquals(importer.getName(), "ISI");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void setUp() throws Exception {

@Test
public void testGetFormatName() {
assertEquals("Medline", importer.getFormatName());
assertEquals("Medline", importer.getName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public void testAllArticleTypes() throws IOException {

@Test
public void testGetFormatName() {
assertEquals("MedlinePlain", importer.getFormatName());
assertEquals("MedlinePlain", importer.getName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public final void testImportEntriesNotRecognizedFormat() throws IOException, URI
@Test
public final void testGetFormatName() {
MsBibImporter testImporter = new MsBibImporter();
assertEquals("MSBib", testImporter.getFormatName());
assertEquals("MSBib", testImporter.getName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void setUp() {

@Test
public void testGetFormatName() {
Assert.assertEquals("Ovid", importer.getFormatName());
Assert.assertEquals("Ovid", importer.getName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void setUp() {

@Test
public void testGetFormatName() {
assertEquals("XMP-annotated PDF", importer.getFormatName());
assertEquals("XMP-annotated PDF", importer.getName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void setUp() {

@Test
public void testGetFormatName() {
Assert.assertEquals(importer.getFormatName(), "RIS");
Assert.assertEquals(importer.getName(), "RIS");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public final void testImportEntries3() throws IOException, URISyntaxException {

@Test
public final void testGetFormatName() {
Assert.assertEquals("REPEC New Economic Papers (NEP)", testImporter.getFormatName());
Assert.assertEquals("REPEC New Economic Papers (NEP)", testImporter.getName());

}

Expand Down

0 comments on commit 1fd13fd

Please sign in to comment.