AccessNode is added as subclass of ASTMethodDeclaration. Will be subclass
of anything with AccessFlags (Field, Method and Class Declarations.) git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@105 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -2,7 +2,13 @@
|
||||
|
||||
package net.sourceforge.pmd.ast;
|
||||
|
||||
public class ASTMethodDeclaration extends SimpleNode {
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ASTMethodDeclaration extends AccessNode {
|
||||
protected List modifiers = new ArrayList();
|
||||
|
||||
|
||||
public ASTMethodDeclaration(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
164
pmd/src/net/sourceforge/pmd/ast/AccessNode.java
Normal file
164
pmd/src/net/sourceforge/pmd/ast/AccessNode.java
Normal file
@ -0,0 +1,164 @@
|
||||
package net.sourceforge.pmd.ast;
|
||||
|
||||
public class AccessNode
|
||||
extends SimpleNode
|
||||
implements AccessFlags
|
||||
{
|
||||
public AccessNode(int i) {
|
||||
super(i);
|
||||
}
|
||||
|
||||
public AccessNode( JavaParser parser, int i ) {
|
||||
super( parser, i );
|
||||
}
|
||||
|
||||
protected short accessFlags = 0x0000;
|
||||
|
||||
public void setPublic(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_PUBLIC;
|
||||
else
|
||||
accessFlags &= ~ACC_PUBLIC;
|
||||
}
|
||||
|
||||
public boolean isPublic() {
|
||||
return (accessFlags & ACC_PUBLIC) > 0;
|
||||
}
|
||||
|
||||
public void setPrivate(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_PRIVATE;
|
||||
else
|
||||
accessFlags &= ~ACC_PRIVATE;
|
||||
}
|
||||
|
||||
public boolean isPrivate() {
|
||||
return (accessFlags & ACC_PRIVATE) > 0;
|
||||
}
|
||||
|
||||
public void setProtected(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_PROTECTED;
|
||||
else
|
||||
accessFlags &= ~ACC_PROTECTED;
|
||||
}
|
||||
|
||||
public boolean isProtected() {
|
||||
return (accessFlags & ACC_PROTECTED) > 0;
|
||||
}
|
||||
|
||||
public void setStatic(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_STATIC;
|
||||
else
|
||||
accessFlags &= ~ACC_STATIC;
|
||||
}
|
||||
|
||||
public boolean isStatic() {
|
||||
return (accessFlags & ACC_STATIC) > 0;
|
||||
}
|
||||
|
||||
public void setFinal(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_FINAL;
|
||||
else
|
||||
accessFlags &= ~ACC_FINAL;
|
||||
}
|
||||
|
||||
public boolean isFinal() {
|
||||
return (accessFlags & ACC_FINAL) > 0;
|
||||
}
|
||||
|
||||
public void setSynchronized(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_SYNCHRONIZED;
|
||||
else
|
||||
accessFlags &= ~ACC_SYNCHRONIZED;
|
||||
}
|
||||
|
||||
public boolean isSynchronized() {
|
||||
return (accessFlags & ACC_SYNCHRONIZED) > 0;
|
||||
}
|
||||
|
||||
public void setVolatile(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_VOLATILE;
|
||||
else
|
||||
accessFlags &= ~ACC_VOLATILE;
|
||||
}
|
||||
|
||||
public boolean isVolatile() {
|
||||
return (accessFlags & ACC_VOLATILE) > 0;
|
||||
}
|
||||
|
||||
public void setTransient(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_TRANSIENT;
|
||||
else
|
||||
accessFlags &= ~ACC_TRANSIENT;
|
||||
}
|
||||
|
||||
public boolean isTransient() {
|
||||
return (accessFlags & ACC_TRANSIENT) > 0;
|
||||
}
|
||||
|
||||
public void setNative(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_NATIVE;
|
||||
else
|
||||
accessFlags &= ~ACC_NATIVE;
|
||||
}
|
||||
|
||||
public boolean isNative() {
|
||||
return (accessFlags & ACC_NATIVE) > 0;
|
||||
}
|
||||
|
||||
|
||||
public void setInterface(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_INTERFACE;
|
||||
else
|
||||
accessFlags &= ~ACC_INTERFACE;
|
||||
}
|
||||
|
||||
public boolean isInterface() {
|
||||
return (accessFlags & ACC_INTERFACE) > 0;
|
||||
}
|
||||
|
||||
|
||||
public void setAbstract(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_ABSTRACT;
|
||||
else
|
||||
accessFlags &= ~ACC_ABSTRACT;
|
||||
}
|
||||
|
||||
public boolean isAbstract() {
|
||||
return (accessFlags & ACC_ABSTRACT) > 0;
|
||||
}
|
||||
|
||||
|
||||
public void setStrict(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_STRICT;
|
||||
else
|
||||
accessFlags &= ~ACC_STRICT;
|
||||
}
|
||||
|
||||
public boolean isStrict() {
|
||||
return (accessFlags & ACC_STRICT) > 0;
|
||||
}
|
||||
|
||||
|
||||
public void setSuper(boolean value) {
|
||||
if (value)
|
||||
accessFlags |= ACC_SUPER;
|
||||
else
|
||||
accessFlags &= ~ACC_SUPER;
|
||||
}
|
||||
|
||||
public boolean isSuper() {
|
||||
return (accessFlags & ACC_SUPER) > 0;
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ public class SimpleNode implements Node {
|
||||
protected Node parent;
|
||||
protected Node[] children;
|
||||
protected int id;
|
||||
|
||||
protected JavaParser parser;
|
||||
|
||||
public SimpleNode(int i) {
|
||||
|
Reference in New Issue
Block a user