01: /* ===========================================================================
02: * $RCSfile: SimpleName.java,v $
03: * ===========================================================================
04: *
05: * RetroGuard -- an obfuscation package for Java classfiles.
06: *
07: * Copyright (c) 1998-2006 Mark Welsh (markw@retrologic.com)
08: *
09: * This program can be redistributed and/or modified under the terms of the
10: * Version 2 of the GNU General Public License as published by the Free
11: * Software Foundation.
12: *
13: * This program is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: * GNU General Public License for more details.
17: *
18: */
19:
20: package COM.rl.obf;
21:
22: import java.io.*;
23: import java.util.*;
24:
25: /**
26: * Java 'simple name' -- a class name or a component of a package name,
27: * along with the type of this simple name.
28: *
29: * @author Mark Welsh
30: */
31: public class SimpleName {
32: // Constants -------------------------------------------------------------
33:
34: // Fields ----------------------------------------------------------------
35: private String name;
36: private boolean isAsPackage;
37:
38: // Class methods ---------------------------------------------------------
39:
40: // Instance Methods ---------------------------------------------------------
41: /** Ctor. */
42: public SimpleName(String simpleName) {
43: name = simpleName;
44: isAsPackage = true;
45: }
46:
47: /** Set simple name as package level. */
48: public SimpleName setAsPackage() {
49: isAsPackage = true;
50: return this ;
51: }
52:
53: /** Set simple name as class level. */
54: public SimpleName setAsClass() {
55: isAsPackage = false;
56: return this ;
57: }
58:
59: /** Is this a package level simple name? */
60: public boolean isAsPackage() {
61: return isAsPackage;
62: }
63:
64: /** Is this a class level simple name? */
65: public boolean isAsClass() {
66: return !isAsPackage;
67: }
68:
69: /** Return the simple name. */
70: public String getName() {
71: return name;
72: }
73: }
|