Source code: com/puppycrawl/tools/checkstyle/checks/usage/transmogrify/IDefinition.java
1
2 // Transmogrify License
3 //
4 // Copyright (c) 2001, ThoughtWorks, Inc.
5 // All rights reserved.
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions
8 // are met:
9 // - Redistributions of source code must retain the above copyright notice,
10 // this list of conditions and the following disclaimer.
11 // - Redistributions in binary form must reproduce the above copyright
12 // notice, this list of conditions and the following disclaimer in the
13 // documentation and/or other materials provided with the distribution.
14 // Neither the name of the ThoughtWorks, Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from this
16 // software without specific prior written permission.
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 package com.puppycrawl.tools.checkstyle.checks.usage.transmogrify;
30
31
32
33 import java.util.Iterator;
34
35 /**
36 * implemented by all definitions of the <code>SymTabAST</code> tree, including
37 * source/non-sourced node
38 * @see net.sourceforge.transmogrify.symtab.Definition
39 * @see net.sourceforge.transmogrify.symtab.ExternalDefinition
40 */
41 public interface IDefinition {
42
43 /**
44 * verifies if this definition node is source/non-sourced(with no source-code)
45 * @return <code>true</code> if the node is parsed from a source code
46 * <code>false</code> otherwise
47 */
48 public boolean isSourced();
49
50 /**
51 * gets the name that identified this particular definition/node
52 * @return name for this definition
53 */
54 public String getName();
55
56 /**
57 * gets the fully qualified name of the definition, ie. dotted name for classes,
58 * or method name with its signature for methods, etc
59 * @return qualified name for this node
60 */
61 public String getQualifiedName();
62
63 /**
64 * adds any reference that this definition have to its collection of
65 * <code>_references</code>
66 * @param reference reference to be added which has <code>SymTabAST</code> node
67 * @return <code>void</code>
68 * @see net.sourceforge.transmogrify.symtab.antlr.SymTabAST
69 */
70 public void addReference(Reference reference);
71
72 /**
73 * gets the collection of references refer to by this definition
74 * @return iterator of the references
75 */
76 public Iterator getReferences();
77
78 /**
79 * gets the number of references refer to by this definition
80 * @return number of references
81 */
82 public int getNumReferences();
83
84 }