1 package net.sourceforge.pmd.lang.vm.directive;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 /**
23 * VelocimacroProxy.java
24 *
25 * a proxy Directive-derived object to fit with the current directive system
26 *
27 * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
28 * @version $Id: VelocimacroProxy.java 898032 2010-01-11 19:51:03Z nbubna $
29 */
30 public class VelocimacroProxy extends Directive
31 {
32 private String macroName;
33 private int numMacroArgs = 0;
34
35 /**
36 * Return name of this Velocimacro.
37 * @return The name of this Velocimacro.
38 */
39 public String getName()
40 {
41 return macroName;
42 }
43
44 /**
45 * Velocimacros are always LINE type directives.
46 * @return The type of this directive.
47 */
48 public int getType()
49 {
50 return LINE;
51 }
52
53 /**
54 * sets the directive name of this VM
55 *
56 * @param name
57 */
58 public void setName(String name)
59 {
60 macroName = name;
61 }
62
63 /**
64 * sets the array of arguments specified in the macro definition
65 *
66 * @param arr
67 */
68 public void setArgArray(String[] arr)
69 {
70 /*
71 * get the arg count from the arg array. remember that the arg array has the macro name as
72 * it's 0th element
73 */
74 numMacroArgs = arr.length - 1;
75 }
76
77 /**
78 * returns the number of ars needed for this VM
79 *
80 * @return The number of ars needed for this VM
81 */
82 public int getNumArgs()
83 {
84 return numMacroArgs;
85 }
86
87 }
88