Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Minor updates to BibEntry #1309

Merged
merged 1 commit into from
Apr 29, 2016
Merged

Minor updates to BibEntry #1309

merged 1 commit into from
Apr 29, 2016

Conversation

koppor
Copy link
Member

@koppor koppor commented Apr 27, 2016

  • rename CiteKey to BibTeXKey to be consistent with wording of JabRef users
  • reorder methods in BibEntry to follow id, cite key, type, everything else
  • add some JavaDoc
  • remove obsolete setting of changed=true

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Apr 27, 2016
@codecov-io
Copy link

codecov-io commented Apr 27, 2016

Current coverage is 27.39%

Merging #1309 into master will decrease coverage by -0.00%

@@             master      #1309   diff @@
==========================================
  Files           694        694          
  Lines         46428      46435     +7   
  Methods           0          0          
  Messages          0          0          
  Branches       7688       7690     +2   
==========================================
  Hits          12720      12720          
- Misses        32611      32618     +7   
  Partials       1097       1097          
  1. File ...orFocusListener.java (not in diff) was modified. more
    • Misses +7
    • Partials 0
    • Hits +1

Sunburst

Powered by Codecov. Last updated by 63ecb1f

* Constructs a new BibEntry with the given ID and given type
*
* @param type The type to set. May be null or empty. In that case, DEFAULT_TYPE is used.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for creating JavaDoc - but please add the second parameter, too 😉

@matthiasgeiger
Copy link
Member

LGTM - apart from the small JavaDoc issues

@@ -44,7 +44,7 @@ public void init() throws IOException, SaveException {
Random randomizer = new Random();
for (int i = 0; i < 1000; i++) {
BibEntry entry = new BibEntry();
entry.setCiteKey("id" + i);
entry.setBibTeXKey("id" + i);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think set/getKey would work too and might be preferable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to be explicit to avoid confusion, because someone might think that a key is an id. And keys are used in SQL-based databases, too. "primary key", "foreign key", etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not introduce classes like BibTeXKey vs. InternalJabRefKey to distinguish them? Both can wrap a String inside.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you talking about the general naming of the method or about the concrete usage of setBibTeXKey(...) in this class? 😕

I think the proposed naming and reasoning of @koppor is fine. ID for internal usage - "BibTeXKey" used as in the UI...
Using additional classes for this seems to be an overkill for me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, what is your problem with getCiteKey or getKey and getID? The description makes it clear what are the differences. Also the entry is a BibEntry, so so why clutter the method name with BibTeX again? It's not a big deal, but I think a crisper method name is nicer here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to WikiPedia's BibTeX article, there is a bibtex field key, which is ...

A hidden field used for specifying or overriding the alphabetical order of entries (when the "author" and "editor" fields are missing). Note that this is very different from the key (mentioned just after this list) that is used to cite or cross-reference the entry.

BibTeX key is defined as follows:

In addition, each entry contains a key (Bibtexkey) that is used to cite or cross-reference the entry. This key is the first item in a BibTeX entry, and is not part of any field

Since "citation key" is longer than the old Cite key", I will undo this renaming and keep CiteKey.

@tobiasdiez
Copy link
Member

LGTM 👍

- reorder methods in BibEntry to follow id, cite key, type, everything else
- add some JavaDoc
- remove obsolete setting of changed=true
@lenhard
Copy link
Member

lenhard commented Apr 27, 2016

Same here. Looks good. @koppor: Is this ready to merge or do you want to implement more improvements?

@tobiasdiez tobiasdiez merged commit 5bb2a3f into master Apr 29, 2016
@tobiasdiez tobiasdiez deleted the bibEntryIdFixes branch April 29, 2016 19:23
@koppor koppor removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label May 7, 2016
@koppor koppor mentioned this pull request May 7, 2016
6 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants