View Javadoc

1   /*
2    * This file is part of hyphenType. hyphenType is free software: you can
3    * redistribute it and/or modify it under the terms of the GNU General Public
4    * License as published by the Free Software Foundation, either version 3 of the
5    * License, or (at your option) any later version. hyphenType is distributed in
6    * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
7    * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
8    * the GNU General Public License for more details. You should have received a
9    * copy of the GNU General Public License along with hyphenType. If not, see
10   * <http://www.gnu.org/licenses/>.
11   */
12  package org.hyphenType.datastructure.parser;
13  
14  import java.lang.reflect.Method;
15  import java.util.Collections;
16  import java.util.List;
17  
18  import org.hyphenType.datastructure.annotations.InputChannel;
19  
20  /**
21   * @author Aurelio Akira M. Matsui
22   */
23  public abstract class StructureArgument extends StructureElement implements Comparable<StructureArgument> {
24  
25      private final String name;
26      private final boolean mandatory;
27      private final int index;
28      private final String regex;
29      private final List<InputChannel> channels;
30      private final String description;
31  
32      public StructureArgument(String name, Method method, boolean mandatory, int index, String regex, List<InputChannel> channels, String description) {
33          super(method);
34          this.name = name;
35          this.mandatory = mandatory;
36          this.index = index;
37          this.regex = regex;
38          this.channels = Collections.unmodifiableList(channels);
39          this.description = description;
40      }
41  
42      public String getName() {
43          return name;
44      }
45  
46      public boolean isMandatory() {
47          return mandatory;
48      }
49  
50      public int getIndex() {
51          return index;
52      }
53  
54      public String getRegex() {
55          return regex;
56      }
57  
58      public List<InputChannel> getChannels() {
59          return channels;
60      }
61      
62      public String getDescription() {
63          return description;
64      }
65  
66      @Override
67      public int compareTo(StructureArgument other) {
68          return this.index - other.index;
69      }
70  }