~ubuntu-branches/ubuntu/saucy/fop/saucy-proposed

« back to all changes in this revision

Viewing changes to src/java/org/apache/fop/fo/expr/FunctionBase.java

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-05-21 12:21:26 UTC
  • mfrom: (15.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130521122126-3c9r5fo6ountjg6r
Tags: 1:1.1.dfsg-2ubuntu1
* Merge from Debian unstable.  Remaining changes:
  -  Transition libservlet2.5-java -> libservlet3.0-java.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * limitations under the License.
16
16
 */
17
17
 
18
 
/* $Id: FunctionBase.java 679326 2008-07-24 09:35:34Z vhennebert $ */
 
18
/* $Id: FunctionBase.java 1328964 2012-04-22 20:09:49Z gadams $ */
19
19
 
20
20
package org.apache.fop.fo.expr;
21
21
 
22
22
import org.apache.fop.datatypes.PercentBase;
 
23
import org.apache.fop.fo.properties.Property;
 
24
import org.apache.fop.fo.properties.StringProperty;
23
25
 
24
26
/**
25
27
 * Abstract Base class for XSL-FO functions
26
28
 */
27
29
public abstract class FunctionBase implements Function {
28
30
 
29
 
    /**
30
 
     * @return null (by default, functions have no percent-based arguments)
31
 
     */
 
31
    /** {@inheritDoc} */
 
32
    public int getOptionalArgsCount() {
 
33
        return 0;
 
34
    }
 
35
 
 
36
    /** {@inheritDoc} */
 
37
    public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException {
 
38
        if ( index >= getOptionalArgsCount() ) {
 
39
            PropertyException e = new PropertyException ( new IndexOutOfBoundsException ( "illegal optional argument index" ) );
 
40
            e.setPropertyInfo ( pi );
 
41
            throw e;
 
42
        } else {
 
43
            return null;
 
44
        }
 
45
    }
 
46
 
 
47
    /** {@inheritDoc} */
 
48
    public boolean hasVariableArgs() {
 
49
        return false;
 
50
    }
 
51
 
 
52
    /** {@inheritDoc} */
32
53
    public PercentBase getPercentBase() {
33
54
        return null;
34
55
    }
35
56
 
36
57
    /**
37
 
     * @return false (by default don't pad arglist with property-name)
 
58
     * @param pi property information instance that applies to property being evaluated
 
59
     * @return string property whose value is name of property being evaluated
38
60
     */
39
 
    public boolean padArgsWithPropertyName() {
40
 
        return false;
 
61
    protected final Property getPropertyName ( PropertyInfo pi ) {
 
62
        return StringProperty.getInstance ( pi.getPropertyMaker().getName() );
41
63
    }
42
64
}