0001: /*
0002: * The contents of this file are subject to the terms of the Common Development
0003: * and Distribution License (the License). You may not use this file except in
0004: * compliance with the License.
0005: *
0006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
0007: * or http://www.netbeans.org/cddl.txt.
0008: *
0009: * When distributing Covered Code, include this CDDL Header Notice in each file
0010: * and include the License file at http://www.netbeans.org/cddl.txt.
0011: * If applicable, add the following below the CDDL Header, with the fields
0012: * enclosed by brackets [] replaced by your own identifying information:
0013: * "Portions Copyrighted [year] [name of copyright owner]"
0014: *
0015: * The Original Software is NetBeans. The Initial Developer of the Original
0016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
0017: * Microsystems, Inc. All Rights Reserved.
0018: */
0019:
0020: package org.netbeans.modules.xml.xpath.ext.metadata.impl;
0021:
0022: import java.util.ArrayList;
0023: import java.util.List;
0024: import javax.swing.Icon;
0025: import org.netbeans.modules.xml.xpath.ext.XPathOperationOrFuntion;
0026: import org.netbeans.modules.xml.xpath.ext.metadata.AbstractArgument;
0027: import org.netbeans.modules.xml.xpath.ext.metadata.ArgumentDescriptor;
0028: import org.netbeans.modules.xml.xpath.ext.metadata.CoreFunctionMetadata;
0029: import org.netbeans.modules.xml.xpath.ext.metadata.GeneralFunctionMetadata.FunctionType;
0030: import org.netbeans.modules.xml.xpath.ext.metadata.ResultTypeCalculator;
0031: import org.netbeans.modules.xml.xpath.ext.metadata.XPathType;
0032: import org.netbeans.modules.xml.xpath.ext.metadata.impl.images.IconLoader;
0033: import org.openide.util.NbBundle;
0034:
0035: /**
0036: * Contains static metadata classes for all XPath Core Functions.
0037: *
0038: * @author nk160297
0039: */
0040: public abstract class CoreFunctionMetadataImpl implements
0041: CoreFunctionMetadata {
0042:
0043: protected ArrayList<AbstractArgument> mArguments = new ArrayList<AbstractArgument>();
0044:
0045: protected Icon mIcon;
0046:
0047: protected CoreFunctionMetadataImpl() {
0048: initArguments();
0049: }
0050:
0051: public Icon getIcon() {
0052: if (mIcon == null) {
0053: loadIcon();
0054: }
0055: return mIcon;
0056: }
0057:
0058: public String getLongDescription() {
0059: return "";
0060: }
0061:
0062: public FunctionType getFunctionType() {
0063: return FunctionType.CORE_FUNCTION;
0064: }
0065:
0066: public ResultTypeCalculator getResultTypeCalculator() {
0067: return null;
0068: }
0069:
0070: public List<AbstractArgument> getArguments() {
0071: return mArguments;
0072: }
0073:
0074: public boolean isContextItemRequired(XPathOperationOrFuntion func) {
0075: return false;
0076: }
0077:
0078: protected void loadIcon() {
0079: mIcon = IconLoader.getIcon(getName()); // NOI18N
0080: }
0081:
0082: protected abstract void initArguments();
0083:
0084: //==========================================================================
0085: // Node Set Functions
0086: //==========================================================================
0087:
0088: public static final class LastFuncMetadata extends
0089: CoreFunctionMetadataImpl {
0090:
0091: public String getName() {
0092: return "last"; // NOI18N
0093: }
0094:
0095: public String getDisplayName() {
0096: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0097: "DN_Last"); // NOI18N
0098: }
0099:
0100: public String getShortDescription() {
0101: return "number last()";
0102: }
0103:
0104: // public String getLongDescription() {
0105: // }
0106:
0107: public XPathType getResultType() {
0108: return XPathType.NUMBER_TYPE;
0109: }
0110:
0111: @Override
0112: public boolean isContextItemRequired(
0113: XPathOperationOrFuntion func) {
0114: return true;
0115: }
0116:
0117: protected void initArguments() {
0118: // there is not an argument
0119: }
0120:
0121: }
0122:
0123: public static final class PositionFuncMetadata extends
0124: CoreFunctionMetadataImpl {
0125:
0126: public String getName() {
0127: return "position"; // NOI18N
0128: }
0129:
0130: public String getDisplayName() {
0131: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0132: "DN_Position"); // NOI18N
0133: }
0134:
0135: public String getShortDescription() {
0136: return "number position()"; // NOI18N
0137: }
0138:
0139: // public String getLongDescription() {
0140: // }
0141:
0142: public XPathType getResultType() {
0143: return XPathType.NUMBER_TYPE;
0144: }
0145:
0146: @Override
0147: public boolean isContextItemRequired(
0148: XPathOperationOrFuntion func) {
0149: return true;
0150: }
0151:
0152: protected void initArguments() {
0153: // there is not an argument
0154: }
0155:
0156: }
0157:
0158: public static final class CountFuncMetadata extends
0159: CoreFunctionMetadataImpl {
0160:
0161: public String getName() {
0162: return "count"; // NOI18N
0163: }
0164:
0165: public String getDisplayName() {
0166: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0167: "DN_Count"); // NOI18N
0168: }
0169:
0170: public String getShortDescription() {
0171: return "number count(node-set)"; // NOI18N
0172: }
0173:
0174: // public String getLongDescription() {
0175: // }
0176:
0177: public XPathType getResultType() {
0178: return XPathType.NUMBER_TYPE;
0179: }
0180:
0181: protected void initArguments() {
0182: mArguments
0183: .add(ArgumentDescriptor.Predefined.SIMPLE_NODE_SET);
0184: }
0185:
0186: }
0187:
0188: public static final class IdFuncMetadata extends
0189: CoreFunctionMetadataImpl {
0190:
0191: public String getName() {
0192: return "id"; // NOI18N
0193: }
0194:
0195: public String getDisplayName() {
0196: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0197: "DN_Id"); // NOI18N
0198: }
0199:
0200: public String getShortDescription() {
0201: return "node-set id(object)"; // NOI18N
0202: }
0203:
0204: // public String getLongDescription() {
0205: // }
0206:
0207: public XPathType getResultType() {
0208: return XPathType.NODE_SET_TYPE;
0209: }
0210:
0211: protected void initArguments() {
0212: mArguments.add(ArgumentDescriptor.Predefined.ANY_TYPE);
0213: }
0214:
0215: }
0216:
0217: public static final class LocalNameFuncMetadata extends
0218: CoreFunctionMetadataImpl {
0219:
0220: public String getName() {
0221: return "local-name"; // NOI18N
0222: }
0223:
0224: public String getDisplayName() {
0225: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0226: "DN_LocalName"); // NOI18N
0227: }
0228:
0229: public String getShortDescription() {
0230: return "string local-name(node-set?)"; // NOI18N
0231: }
0232:
0233: // public String getLongDescription() {
0234: // }
0235:
0236: public XPathType getResultType() {
0237: return XPathType.STRING_TYPE;
0238: }
0239:
0240: @Override
0241: public boolean isContextItemRequired(
0242: XPathOperationOrFuntion func) {
0243: return func.getChildCount() == 0;
0244: }
0245:
0246: protected void initArguments() {
0247: mArguments.add(ArgumentDescriptor.Predefined.OPTIONAL_NODE);
0248: }
0249:
0250: }
0251:
0252: public static final class NamespaceUriFuncMetadata extends
0253: CoreFunctionMetadataImpl {
0254:
0255: public String getName() {
0256: return "namespace-uri"; // NOI18N
0257: }
0258:
0259: public String getDisplayName() {
0260: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0261: "DN_NamespaceURI"); // NOI18N
0262: }
0263:
0264: public String getShortDescription() {
0265: return "string namespace-uri(node-set?)"; // NOI18N
0266: }
0267:
0268: // public String getLongDescription() {
0269: // }
0270:
0271: public XPathType getResultType() {
0272: return XPathType.STRING_TYPE;
0273: }
0274:
0275: @Override
0276: public boolean isContextItemRequired(
0277: XPathOperationOrFuntion func) {
0278: return func.getChildCount() == 0;
0279: }
0280:
0281: protected void initArguments() {
0282: mArguments.add(ArgumentDescriptor.Predefined.OPTIONAL_NODE);
0283: }
0284:
0285: }
0286:
0287: public static final class NameFuncMetadata extends
0288: CoreFunctionMetadataImpl {
0289:
0290: public String getName() {
0291: return "name"; // NOI18N
0292: }
0293:
0294: public String getDisplayName() {
0295: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0296: "DN_Name"); // NOI18N
0297: }
0298:
0299: public String getShortDescription() {
0300: return "string name(node-set?)"; // NOI18N
0301: }
0302:
0303: // public String getLongDescription() {
0304: // }
0305:
0306: public XPathType getResultType() {
0307: return XPathType.STRING_TYPE;
0308: }
0309:
0310: @Override
0311: public boolean isContextItemRequired(
0312: XPathOperationOrFuntion func) {
0313: return func.getChildCount() == 0;
0314: }
0315:
0316: protected void initArguments() {
0317: mArguments.add(ArgumentDescriptor.Predefined.OPTIONAL_NODE);
0318: }
0319:
0320: }
0321:
0322: //==========================================================================
0323: // String Core Functions
0324: //==========================================================================
0325:
0326: public static final class StringFuncMetadata extends
0327: CoreFunctionMetadataImpl {
0328:
0329: public String getName() {
0330: return "string"; // NOI18N
0331: }
0332:
0333: public String getDisplayName() {
0334: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0335: "DN_String"); // NOI18N
0336: }
0337:
0338: public String getShortDescription() {
0339: return "string name(node-set?)"; // NOI18N
0340: }
0341:
0342: // public String getLongDescription() {
0343: // }
0344:
0345: public XPathType getResultType() {
0346: return XPathType.STRING_TYPE;
0347: }
0348:
0349: @Override
0350: public boolean isContextItemRequired(
0351: XPathOperationOrFuntion func) {
0352: return func.getChildCount() == 0;
0353: }
0354:
0355: protected void initArguments() {
0356: mArguments
0357: .add(ArgumentDescriptor.Predefined.OPTIONAL_ANY_TYPE);
0358: }
0359:
0360: }
0361:
0362: public static final class ConcatFuncMetadata extends
0363: CoreFunctionMetadataImpl {
0364:
0365: public String getName() {
0366: return "concat"; // NOI18N
0367: }
0368:
0369: public String getDisplayName() {
0370: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0371: "DN_Concatenation"); // NOI18N
0372: }
0373:
0374: public String getShortDescription() {
0375: return "string concat(string, string, string*)"; // NOI18N
0376: }
0377:
0378: // public String getLongDescription() {
0379: // }
0380:
0381: public XPathType getResultType() {
0382: return XPathType.STRING_TYPE;
0383: }
0384:
0385: protected void initArguments() {
0386: mArguments
0387: .add(ArgumentDescriptor.Predefined.REPEATED_STRING_2MIN);
0388: }
0389:
0390: }
0391:
0392: public static final class StartsWithFuncMetadata extends
0393: CoreFunctionMetadataImpl {
0394:
0395: public String getName() {
0396: return "starts-with"; // NOI18N
0397: }
0398:
0399: public String getDisplayName() {
0400: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0401: "DN_StartsWith"); // NOI18N
0402: }
0403:
0404: public String getShortDescription() {
0405: return "boolean starts-with(string, string)"; // NOI18N
0406: }
0407:
0408: // public String getLongDescription() {
0409: // }
0410:
0411: public XPathType getResultType() {
0412: return XPathType.BOOLEAN_TYPE;
0413: }
0414:
0415: protected void initArguments() {
0416: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0417: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0418: }
0419:
0420: }
0421:
0422: public static final class ContainsFuncMetadata extends
0423: CoreFunctionMetadataImpl {
0424:
0425: public String getName() {
0426: return "contains"; // NOI18N
0427: }
0428:
0429: public String getDisplayName() {
0430: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0431: "DN_Contains"); // NOI18N
0432: }
0433:
0434: public String getShortDescription() {
0435: return "boolean contains(string, string)"; // NOI18N
0436: }
0437:
0438: // public String getLongDescription() {
0439: // }
0440:
0441: public XPathType getResultType() {
0442: return XPathType.BOOLEAN_TYPE;
0443: }
0444:
0445: protected void initArguments() {
0446: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0447: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0448: }
0449:
0450: }
0451:
0452: public static final class SubstringBeforeFuncMetadata extends
0453: CoreFunctionMetadataImpl {
0454:
0455: public String getName() {
0456: return "substring-before"; // NOI18N
0457: }
0458:
0459: public String getDisplayName() {
0460: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0461: "DN_SubstringBefore"); // NOI18N
0462: }
0463:
0464: public String getShortDescription() {
0465: return "string substring-before(string, string)"; // NOI18N
0466: }
0467:
0468: // public String getLongDescription() {
0469: // }
0470:
0471: public XPathType getResultType() {
0472: return XPathType.STRING_TYPE;
0473: }
0474:
0475: protected void initArguments() {
0476: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0477: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0478: }
0479:
0480: }
0481:
0482: public static final class SubstringAfterFuncMetadata extends
0483: CoreFunctionMetadataImpl {
0484:
0485: public String getName() {
0486: return "substring-after"; // NOI18N
0487: }
0488:
0489: public String getDisplayName() {
0490: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0491: "DN_SubstringAfter"); // NOI18N
0492: }
0493:
0494: public String getShortDescription() {
0495: return "string substring-after(string, string)"; // NOI18N
0496: }
0497:
0498: // public String getLongDescription() {
0499: // }
0500:
0501: public XPathType getResultType() {
0502: return XPathType.STRING_TYPE;
0503: }
0504:
0505: protected void initArguments() {
0506: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0507: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0508: }
0509:
0510: }
0511:
0512: public static final class SubstringFuncMetadata extends
0513: CoreFunctionMetadataImpl {
0514:
0515: public String getName() {
0516: return "substring"; // NOI18N
0517: }
0518:
0519: public String getDisplayName() {
0520: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0521: "DN_Substring"); // NOI18N
0522: }
0523:
0524: public String getShortDescription() {
0525: return "string substring(string, number, number?)"; // NOI18N
0526: }
0527:
0528: // public String getLongDescription() {
0529: // }
0530:
0531: public XPathType getResultType() {
0532: return XPathType.STRING_TYPE;
0533: }
0534:
0535: protected void initArguments() {
0536: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0537: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_NUMBER);
0538: mArguments
0539: .add(ArgumentDescriptor.Predefined.OPTIONAL_NUMBER);
0540: }
0541:
0542: }
0543:
0544: public static final class StringLengthFuncMetadata extends
0545: CoreFunctionMetadataImpl {
0546:
0547: public String getName() {
0548: return "string-length"; // NOI18N
0549: }
0550:
0551: public String getDisplayName() {
0552: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0553: "DN_StringLength"); // NOI18N
0554: }
0555:
0556: public String getShortDescription() {
0557: return "number string-length(string?)"; // NOI18N
0558: }
0559:
0560: // public String getLongDescription() {
0561: // }
0562:
0563: public XPathType getResultType() {
0564: return XPathType.NUMBER_TYPE;
0565: }
0566:
0567: @Override
0568: public boolean isContextItemRequired(
0569: XPathOperationOrFuntion func) {
0570: return func.getChildCount() == 0;
0571: }
0572:
0573: protected void initArguments() {
0574: mArguments
0575: .add(ArgumentDescriptor.Predefined.OPTIONAL_STRING);
0576: }
0577: }
0578:
0579: public static final class NormalizeSpaceFuncMetadata extends
0580: CoreFunctionMetadataImpl {
0581:
0582: public String getName() {
0583: return "normalize-space"; // NOI18N
0584: }
0585:
0586: public String getDisplayName() {
0587: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0588: "DN_NormalizeSpace"); // NOI18N
0589: }
0590:
0591: public String getShortDescription() {
0592: return "string normalize-space(string?)"; // NOI18N
0593: }
0594:
0595: // public String getLongDescription() {
0596: // }
0597:
0598: public XPathType getResultType() {
0599: return XPathType.STRING_TYPE;
0600: }
0601:
0602: @Override
0603: public boolean isContextItemRequired(
0604: XPathOperationOrFuntion func) {
0605: return func.getChildCount() == 0;
0606: }
0607:
0608: protected void initArguments() {
0609: mArguments
0610: .add(ArgumentDescriptor.Predefined.OPTIONAL_STRING);
0611: }
0612: }
0613:
0614: public static final class TranslateFuncMetadata extends
0615: CoreFunctionMetadataImpl {
0616:
0617: public String getName() {
0618: return "translate"; // NOI18N
0619: }
0620:
0621: public String getDisplayName() {
0622: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0623: "DN_Translate"); // NOI18N
0624: }
0625:
0626: public String getShortDescription() {
0627: return "string translate(string, string, string)"; // NOI18N
0628: }
0629:
0630: // public String getLongDescription() {
0631: // }
0632:
0633: public XPathType getResultType() {
0634: return XPathType.STRING_TYPE;
0635: }
0636:
0637: protected void initArguments() {
0638: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0639: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0640: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0641: }
0642: }
0643:
0644: //==========================================================================
0645: // Boolean Core Functions
0646: //==========================================================================
0647:
0648: public static final class BooleanFuncMetadata extends
0649: CoreFunctionMetadataImpl {
0650:
0651: public String getName() {
0652: return "boolean"; // NOI18N
0653: }
0654:
0655: public String getDisplayName() {
0656: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0657: "DN_Boolean"); // NOI18N
0658: }
0659:
0660: public String getShortDescription() {
0661: return "boolean boolean(object)"; // NOI18N
0662: }
0663:
0664: // public String getLongDescription() {
0665: // }
0666:
0667: public XPathType getResultType() {
0668: return XPathType.BOOLEAN_TYPE;
0669: }
0670:
0671: protected void initArguments() {
0672: mArguments.add(ArgumentDescriptor.Predefined.ANY_TYPE);
0673: }
0674: }
0675:
0676: public static final class NotFuncMetadata extends
0677: CoreFunctionMetadataImpl {
0678:
0679: public String getName() {
0680: return "not"; // NOI18N
0681: }
0682:
0683: public String getDisplayName() {
0684: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0685: "DN_LogicalNot"); // NOI18N
0686: }
0687:
0688: public String getShortDescription() {
0689: return "boolean not(boolean)"; // NOI18N
0690: }
0691:
0692: // public String getLongDescription() {
0693: // }
0694:
0695: public XPathType getResultType() {
0696: return XPathType.BOOLEAN_TYPE;
0697: }
0698:
0699: protected void initArguments() {
0700: mArguments
0701: .add(ArgumentDescriptor.Predefined.SIMPLE_BOOLEAN);
0702: }
0703: }
0704:
0705: public static final class TrueFuncMetadata extends
0706: CoreFunctionMetadataImpl {
0707:
0708: public String getName() {
0709: return "true"; // NOI18N
0710: }
0711:
0712: public String getDisplayName() {
0713: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0714: "DN_LogicalTrue"); // NOI18N
0715: }
0716:
0717: public String getShortDescription() {
0718: return "boolean true()"; // NOI18N
0719: }
0720:
0721: // public String getLongDescription() {
0722: // }
0723:
0724: public XPathType getResultType() {
0725: return XPathType.BOOLEAN_TYPE;
0726: }
0727:
0728: protected void initArguments() {
0729: }
0730: }
0731:
0732: public static final class FalseFuncMetadata extends
0733: CoreFunctionMetadataImpl {
0734:
0735: public String getName() {
0736: return "false"; // NOI18N
0737: }
0738:
0739: public String getDisplayName() {
0740: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0741: "DN_LogicalFalse"); // NOI18N
0742: }
0743:
0744: public String getShortDescription() {
0745: return "boolean false()"; // NOI18N
0746: }
0747:
0748: // public String getLongDescription() {
0749: // }
0750:
0751: public XPathType getResultType() {
0752: return XPathType.BOOLEAN_TYPE;
0753: }
0754:
0755: protected void initArguments() {
0756: }
0757: }
0758:
0759: public static final class LangFuncMetadata extends
0760: CoreFunctionMetadataImpl {
0761:
0762: public String getName() {
0763: return "lang"; // NOI18N
0764: }
0765:
0766: public String getDisplayName() {
0767: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0768: "DN_Language"); // NOI18N
0769: }
0770:
0771: public String getShortDescription() {
0772: return "boolean lang(string)"; // NOI18N
0773: }
0774:
0775: // public String getLongDescription() {
0776: // }
0777:
0778: public XPathType getResultType() {
0779: return XPathType.BOOLEAN_TYPE;
0780: }
0781:
0782: @Override
0783: public boolean isContextItemRequired(
0784: XPathOperationOrFuntion func) {
0785: return true;
0786: }
0787:
0788: protected void initArguments() {
0789: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
0790: }
0791: }
0792:
0793: //==========================================================================
0794: // Number Core Functions
0795: //==========================================================================
0796:
0797: public static final class NumberFuncMetadata extends
0798: CoreFunctionMetadataImpl {
0799:
0800: public String getName() {
0801: return "number"; // NOI18N
0802: }
0803:
0804: public String getDisplayName() {
0805: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0806: "DN_Number"); // NOI18N
0807: }
0808:
0809: public String getShortDescription() {
0810: return "number number(object?)"; // NOI18N
0811: }
0812:
0813: // public String getLongDescription() {
0814: // }
0815:
0816: public XPathType getResultType() {
0817: return XPathType.NUMBER_TYPE;
0818: }
0819:
0820: @Override
0821: public boolean isContextItemRequired(
0822: XPathOperationOrFuntion func) {
0823: return func.getChildCount() == 0;
0824: }
0825:
0826: protected void initArguments() {
0827: mArguments
0828: .add(ArgumentDescriptor.Predefined.OPTIONAL_ANY_TYPE);
0829: }
0830: }
0831:
0832: public static final class SumFuncMetadata extends
0833: CoreFunctionMetadataImpl {
0834:
0835: public String getName() {
0836: return "sum"; // NOI18N
0837: }
0838:
0839: public String getDisplayName() {
0840: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0841: "DN_Sum"); // NOI18N
0842: }
0843:
0844: public String getShortDescription() {
0845: return "number sum(node-set)"; // NOI18N
0846: }
0847:
0848: // public String getLongDescription() {
0849: // }
0850:
0851: public XPathType getResultType() {
0852: return XPathType.NUMBER_TYPE;
0853: }
0854:
0855: protected void initArguments() {
0856: mArguments
0857: .add(ArgumentDescriptor.Predefined.SIMPLE_NODE_SET);
0858: }
0859: }
0860:
0861: public static final class FloorFuncMetadata extends
0862: CoreFunctionMetadataImpl {
0863:
0864: public String getName() {
0865: return "floor"; // NOI18N
0866: }
0867:
0868: public String getDisplayName() {
0869: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0870: "DN_Floor"); // NOI18N
0871: }
0872:
0873: public String getShortDescription() {
0874: return "number floor(number)"; // NOI18N
0875: }
0876:
0877: // public String getLongDescription() {
0878: // }
0879:
0880: public XPathType getResultType() {
0881: return XPathType.NUMBER_TYPE;
0882: }
0883:
0884: protected void initArguments() {
0885: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_NUMBER);
0886: }
0887: }
0888:
0889: public static final class CeilingFuncMetadata extends
0890: CoreFunctionMetadataImpl {
0891:
0892: public String getName() {
0893: return "ceiling"; // NOI18N
0894: }
0895:
0896: public String getDisplayName() {
0897: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0898: "DN_Ceiling"); // NOI18N
0899: }
0900:
0901: public String getShortDescription() {
0902: return "number ceiling(number)"; // NOI18N
0903: }
0904:
0905: // public String getLongDescription() {
0906: // }
0907:
0908: public XPathType getResultType() {
0909: return XPathType.NUMBER_TYPE;
0910: }
0911:
0912: protected void initArguments() {
0913: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_NUMBER);
0914: }
0915: }
0916:
0917: public static final class RoundFuncMetadata extends
0918: CoreFunctionMetadataImpl {
0919:
0920: public String getName() {
0921: return "round"; // NOI18N
0922: }
0923:
0924: public String getDisplayName() {
0925: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0926: "DN_Round"); // NOI18N
0927: }
0928:
0929: public String getShortDescription() {
0930: return "number round(number)"; // NOI18N
0931: }
0932:
0933: // public String getLongDescription() {
0934: // }
0935:
0936: public XPathType getResultType() {
0937: return XPathType.NUMBER_TYPE;
0938: }
0939:
0940: protected void initArguments() {
0941: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_NUMBER);
0942: }
0943: }
0944:
0945: //==========================================================================
0946: // XSLT Ext Functions. This function are defined in the JXPath as core functions.
0947: //==========================================================================
0948:
0949: public static final class NullFuncMetadata extends
0950: CoreFunctionMetadataImpl {
0951:
0952: public String getName() {
0953: return "null"; // NOI18N
0954: }
0955:
0956: public String getDisplayName() {
0957: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0958: "DN_Null"); // NOI18N
0959: }
0960:
0961: public String getShortDescription() {
0962: return "??? null ???"; // NOI18N
0963: }
0964:
0965: // public String getLongDescription() {
0966: // }
0967:
0968: public XPathType getResultType() {
0969: return XPathType.BOOLEAN_TYPE;
0970: }
0971:
0972: protected void initArguments() {
0973: }
0974: }
0975:
0976: public static final class KeyFuncMetadata extends
0977: CoreFunctionMetadataImpl {
0978:
0979: public String getName() {
0980: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
0981: "DN_Key"); // NOI18N
0982: }
0983:
0984: public String getDisplayName() {
0985: return "key";
0986: }
0987:
0988: public String getShortDescription() {
0989: return "??? key ???"; // NOI18N
0990: }
0991:
0992: // public String getLongDescription() {
0993: // }
0994:
0995: public XPathType getResultType() {
0996: return XPathType.NODE_SET_TYPE;
0997: }
0998:
0999: protected void initArguments() {
1000: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
1001: mArguments.add(ArgumentDescriptor.Predefined.ANY_TYPE);
1002: }
1003: }
1004:
1005: public static final class FormatNumberFuncMetadata extends
1006: CoreFunctionMetadataImpl {
1007:
1008: public String getName() {
1009: return "format-number"; // NOI18N
1010: }
1011:
1012: public String getDisplayName() {
1013: return NbBundle.getMessage(CoreFunctionMetadataImpl.class,
1014: "DN_FormatNumber"); // NOI18N
1015: }
1016:
1017: public String getShortDescription() {
1018: return "string format-number(number, string?)"; // NOI18N
1019: }
1020:
1021: // public String getLongDescription() {
1022: // }
1023:
1024: public XPathType getResultType() {
1025: return XPathType.STRING_TYPE;
1026: }
1027:
1028: protected void initArguments() {
1029: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_NUMBER);
1030: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
1031: mArguments
1032: .add(ArgumentDescriptor.Predefined.OPTIONAL_STRING);
1033: }
1034: }
1035:
1036: }
|