Logo Search packages:      
Sourcecode: jabref-plugin-oo version File versions  Download package

String net::sf::jabref::oo::OOBibStyle::getAuthorYearInTextMarker ( BibtexEntry[]  entries,
BibtexDatabase  database,
String  authorField,
String  yearField,
int  maxA,
String  authorSep,
String  andString,
String  etAlString,
String  yearSep,
String  startBrace,
String  endBrace,
String  citationSeparator,
String[]  uniquefiers,
int[]  unlimAuthors 
) [inline]

This method produces "Author (year)" style citation strings in many different forms.

Parameters:
entries The array of BibtexEntry to get fields from.
authorField The bibtex field providing author names, e.g. "author" or "editor".
yearField The bibtex field providing the year, e.g. "year".
maxA The maximum number of authors to write out in full without using etal. Set to -1 to always write out all authors.
authorSep The String to add between author names except the last two, e.g. ", ".
andString The String to add between the two last author names, e.g. " & ".
etAlString The String to represent authors that are not mentioned, e.g. " et al."
yearSep The String to separate authors from year, e.g. "; ".
startBrace The opening parenthesis.
endBrace The closing parenthesis.
uniquefiers Optional parameters to separate similar citations. Can be null if not needed.
Returns:
The formatted citation.

Definition at line 666 of file OOBibStyle.java.

References getAuthorLastName(), and getCitationMarkerField().

Referenced by getCitationMarker().

                                                                                      {
        StringBuffer sb = new StringBuffer();
        for (int i=0; i<entries.length; i++) {

            int unlimA = (unlimAuthors != null ? unlimAuthors[i] : -1);
            int maxAuthors = unlimA > 0 ? unlimA : maxA;

            // Check if this entry has been nulled due to grouping with the previous entry(ies):
            if (entries[i] == null)
                continue;

            if (i > 0)
                sb.append(citationSeparator);
            String author = getCitationMarkerField(entries[i], database, authorField);
            if (author != null) {
                AuthorList al = AuthorList.getAuthorList(author);
                if (al.size() > 0)
                    sb.append(getAuthorLastName(al, 0));
                if ((al.size() > 1) && ((al.size() <= maxAuthors) || (maxAuthors < 0))) {
                    int j=1;
                    while (j < al.size()-1) {
                        sb.append(authorSep);
                        sb.append(getAuthorLastName(al, j));
                        j++;
                    }
                    sb.append(andString);
                    sb.append(getAuthorLastName(al, al.size()-1));
                } else if (al.size() > maxAuthors) {
                    sb.append(etAlString);
                }
                sb.append(yearSep);
            }
            sb.append(startBrace);
            String year = getCitationMarkerField(entries[i], database, yearField);
            if (year != null)
                sb.append(year);
            if ((uniquefiers != null) && (uniquefiers[i] != null))
                sb.append(uniquefiers[i]);
            sb.append(endBrace);
        }
        return sb.toString();

    }


Generated by  Doxygen 1.6.0   Back to index