Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.layout.format

public Class IfPlural

extends AbstractParamLayoutFormatter
Class Inheritance
Imports
java.util.List, java.util.regex.Pattern, org.jabref.logic.layout.AbstractParamLayoutFormatter

This formatter takes two arguments and examines the field text. If the field text represents multiple individuals (i.e., it contains the string and - "and" with surrounding spaces), then the field text is replaced with the first argument, otherwise it is replaced with the second.

For example, \format[IfPlural(Eds.,Ed.)]{\editor} should expand to Eds. if the document has more than one editor and Ed. if it only has one.

Field Summary

Modifier and TypeField and Description
private static final Pattern
private String
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
format(String fieldText)

Implements org.jabref.logic.layout.LayoutFormatter.format.

Failure Mode:

Formatters should be robust in the sense that they always return some relevant string.

public void
setArgument(String arg)

Implements org.jabref.logic.layout.ParamLayoutFormatter.setArgument.

Method for setting the argument of this formatter.

Inherited from org.jabref.logic.layout.AbstractParamLayoutFormatter:
parseArgument

Field Detail

AND_PATTERNback to summary
private static final Pattern AND_PATTERN
pluralTextback to summary
private String pluralText
singularTextback to summary
private String singularText

Constructor Detail

IfPluralback to summary
public IfPlural()

Method Detail

formatback to summary
public String format(String fieldText)

Implements org.jabref.logic.layout.LayoutFormatter.format.

Doc from org.jabref.logic.layout.LayoutFormatter.format.

Failure Mode:

Formatters should be robust in the sense that they always return some relevant string.

If the formatter can detect an invalid input it should return the original string otherwise it may simply return a wrong output.

Annotations
@Override
setArgumentback to summary
public void setArgument(String arg)

Implements org.jabref.logic.layout.ParamLayoutFormatter.setArgument.

Doc from org.jabref.logic.layout.ParamLayoutFormatter.setArgument.

Method for setting the argument of this formatter.

Annotations
@Override