/libformula-1.1.3/source/org/pentaho/reporting/libraries/formula/function/text/RightFunctionDescription.java
Java | 76 lines | 42 code | 11 blank | 23 comment | 4 complexity | f1115f9dd42178c1cfb10a52ec63ce33 MD5 | raw file
Possible License(s): LGPL-2.1
1/*
2 * This program is free software; you can redistribute it and/or modify it under the
3 * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software
4 * Foundation.
5 *
6 * You should have received a copy of the GNU Lesser General Public License along with this
7 * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
8 * or from the Free Software Foundation, Inc.,
9 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU Lesser General Public License for more details.
14 *
15 * Copyright (c) 2006 - 2009 Pentaho Corporation and Contributors. All rights reserved.
16 */
17
18package org.pentaho.reporting.libraries.formula.function.text;
19
20import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription;
21import org.pentaho.reporting.libraries.formula.function.FunctionCategory;
22import org.pentaho.reporting.libraries.formula.typing.Type;
23import org.pentaho.reporting.libraries.formula.typing.coretypes.NumberType;
24import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType;
25
26/**
27 * Describes RightFunction function.
28 * @see RightFunction
29 *
30 * @author Cedric Pronzato
31 *
32 */
33public class RightFunctionDescription extends AbstractFunctionDescription
34{
35 private static final long serialVersionUID = -1227750116961019328L;
36
37 public RightFunctionDescription()
38 {
39 super("RIGHT", "org.pentaho.reporting.libraries.formula.function.text.Right-Function");
40 }
41
42 public FunctionCategory getCategory()
43 {
44 return TextFunctionCategory.CATEGORY;
45 }
46
47 public int getParameterCount()
48 {
49 return 2;
50 }
51
52 public Type getParameterType(final int position)
53 {
54 if(position == 0)
55 {
56 return TextType.TYPE;
57 }
58
59 return NumberType.GENERIC_NUMBER;
60 }
61
62 public Type getValueType()
63 {
64 return TextType.TYPE;
65 }
66
67 public boolean isParameterMandatory(final int position)
68 {
69 if(position == 2)
70 {
71 return false;
72 }
73 return true;
74 }
75
76}