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

String net::sf::jabref::oo::OOBibStyle::getCitationMarker ( BibtexEntry[]  entries,
BibtexDatabase  database,
boolean  inParenthesis,
String[]  uniquefiers,
int[]  unlimAuthors 
) [inline]

Format the marker for the in-text citation according to this bib style. Uniquefier letters are added as provided by the uniquefiers argument. If successive entries within the citation are uniquefied from each other, this method will perform a grouping of these entries.

Parameters:
entries The array of JabRef BibtexEntry providing the data.
inParenthesis Signals whether a parenthesized citation or an in-text citation is wanted.
uniquefiers Strings to add behind the year for each entry in case it's needed to separate similar entries.
unlimAuthors Boolean for each entry. If true, we should not use "et al" formatting regardless of the number of authors. Can be null to indicate that no entries should have unlimited names.
Returns:
The formatted citation.

Definition at line 451 of file OOBibStyle.java.

References getAuthorYearInTextMarker(), getAuthorYearParenthesisMarker(), getCitationMarkerField(), and group().

                                                                              {

        // Look for groups of uniquefied entries that should be combined in the output.
        // E.g. (Olsen, 2005a, b) should be output instead of (Olsen, 2005a; Olsen, 2005b).
        int piv = -1;
        String tmpMarker = null;
        if (uniquefiers != null) {
            for (int i = 0; i < uniquefiers.length; i++) {

                if ((uniquefiers[i] != null) && (uniquefiers[i].length() > 0)) {
                    String authorField = (String)citProperties.get("AuthorField");
                    int maxAuthors = (Integer)citProperties.get("MaxAuthors");
                    if (piv == -1) {
                        piv = i;
                        tmpMarker = getAuthorYearParenthesisMarker(new BibtexEntry[] {entries[i]}, database,
                            authorField,
                            (String)citProperties.get("YearField"),
                            maxAuthors,
                            (String)citProperties.get("AuthorSeparator"),
                            (String)citProperties.get("AuthorLastSeparator"),
                            (String)citProperties.get("EtAlString"),
                            (String)citProperties.get("YearSeparator"),
                            (String)citProperties.get("BracketBefore"),
                            (String)citProperties.get("BracketAfter"),
                            (String)citProperties.get("CitationSeparator"), null, unlimAuthors);
                        //System.out.println("piv="+piv+" tmpMarker='"+tmpMarker+"'");
                    }
                    else {
                        // See if this entry can go into a group with the previous one:
                        String thisMarker = getAuthorYearParenthesisMarker(new BibtexEntry[] {entries[i]}, database,
                            authorField,
                            (String)citProperties.get("YearField"),
                            maxAuthors,
                            (String)citProperties.get("AuthorSeparator"),
                            (String)citProperties.get("AuthorLastSeparator"),
                            (String)citProperties.get("EtAlString"),
                            (String)citProperties.get("YearSeparator"),
                            (String)citProperties.get("BracketBefore"),
                            (String)citProperties.get("BracketAfter"),
                            (String)citProperties.get("CitationSeparator"), null, unlimAuthors);

                        String author = getCitationMarkerField(entries[i], database,
                                authorField);
                        AuthorList al = AuthorList.getAuthorList(author);
                        //System.out.println("i="+i+" thisMarker='"+thisMarker+"'");
                        int prevALim = i > 0 ? unlimAuthors[i-1] : unlimAuthors[0];
                        if (!thisMarker.equals(tmpMarker) ||
                                ((al.size() > maxAuthors) && (unlimAuthors[i] != prevALim))) {
                            // No match. Update piv to exclude the previous entry. But first check if the
                            // previous entry was part of a group:
                            if ((piv > -1) && (i > piv+1)) {
                                // Do the grouping:
                                group(entries, uniquefiers, piv, i-1, (String)citProperties.get("UniquefierSeparator"));
                            }
                            tmpMarker = thisMarker;
                            piv = i;
                        }
                    }
                }
                else {
                    // This entry has no uniquefier.
                    // Check if we just passed a group of more than one entry with uniquefier:
                    if ((piv > -1) && (i > piv+1)) {
                        // Do the grouping:
                        group(entries, uniquefiers, piv, i-1, (String)citProperties.get("UniquefierSeparator"));
                    }

                    piv = -1;
                }

            }
            // Finished with the loop. See if the last entries form a group:
            if (piv >= 0) {
                // Do the grouping:
                group(entries, uniquefiers, piv, uniquefiers.length-1, (String)citProperties.get("UniquefierSeparator"));
            }
        }

        if (inParenthesis)
            return getAuthorYearParenthesisMarker(entries, database,
                    (String)citProperties.get("AuthorField"),
                    (String)citProperties.get("YearField"),
                    (Integer)citProperties.get("MaxAuthors"),
                    (String)citProperties.get("AuthorSeparator"),
                    (String)citProperties.get("AuthorLastSeparator"),
                    (String)citProperties.get("EtAlString"),
                    (String)citProperties.get("YearSeparator"),
                    (String)citProperties.get("BracketBefore"),
                    (String)citProperties.get("BracketAfter"),
                    (String)citProperties.get("CitationSeparator"),
                    uniquefiers, unlimAuthors);
        else
            return getAuthorYearInTextMarker(entries, database,
                    (String)citProperties.get("AuthorField"),
                    (String)citProperties.get("YearField"),
                    (Integer)citProperties.get("MaxAuthors"),
                    (String)citProperties.get("AuthorSeparator"),
                    (String)citProperties.get("AuthorLastSeparator"),
                    (String)citProperties.get("EtAlString"),
                    (String)citProperties.get("InTextYearSeparator"),
                    (String)citProperties.get("BracketBefore"),
                    (String)citProperties.get("BracketAfter"),
                    (String)citProperties.get("CitationSeparator"),
                    uniquefiers, unlimAuthors);

    }


Generated by  Doxygen 1.6.0   Back to index