removed unused code

This commit is contained in:
Oliver Burn 2002-11-13 04:33:23 +00:00
parent 852984587a
commit f865ae5802
4 changed files with 0 additions and 303 deletions

View File

@ -1,112 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2002 Oliver Burn
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle;
/**
* Represents a Javadoc tag. Provides methods to query what type of tag it is.
* @author <a href="mailto:oliver@puppycrawl.com">Oliver Burn</a>
**/
class JavadocTag
{
/** the line number of the tag **/
private final int mLineNo;
/** the tag string **/
private final String mTag;
/** an optional first argument. For example the parameter name. **/
private final String mArg1;
/**
* Constructs the object.
* @param aLine the line number of the tag
* @param aTag the tag string
* @param aArg1 the tag argument
**/
JavadocTag(int aLine, String aTag, String aArg1)
{
mLineNo = aLine;
mTag = aTag;
mArg1 = aArg1;
}
/**
* Constructs the object.
* @param aLine the line number of the tag
* @param aTag the tag string
**/
JavadocTag(int aLine, String aTag)
{
this(aLine, aTag, null);
}
/** @return the tag string **/
String getTag()
{
return mTag;
}
/** @return the first argument. null if not set. **/
String getArg1()
{
return mArg1;
}
/** @return the line number **/
int getLineNo()
{
return mLineNo;
}
/** @return a string representation of the object **/
public String toString()
{
return "{Tag = '" + getTag() + "', lineNo = " + getLineNo()
+ ", Arg1 = '" + getArg1() + "'}";
}
/** @return whether the tag is an 'author' tag **/
boolean isAuthorTag()
{
return "author".equals(getTag());
}
/** @return whether the tag is an 'return' tag **/
boolean isReturnTag()
{
return "return".equals(getTag());
}
/** @return whether the tag is an 'param' tag **/
boolean isParamTag()
{
return "param".equals(getTag());
}
/** @return whether the tag is an 'throws' or 'exception' tag **/
boolean isThrowsTag()
{
return ("throws".equals(getTag()) || "exception".equals(getTag()));
}
/** @return whether the tag is a 'see' tag **/
boolean isSeeTag()
{
return "see".equals(getTag());
}
}

View File

@ -1,149 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2002 Oliver Burn
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle;
import java.util.ArrayList;
import java.util.List;
/**
* Represents the signature for a method. Actually this is a lie as it only
* represents the method name, parameters, exceptions and line number of
* the name.
* It does not have the return type or modifiers.
* @author <a href="mailto:oliver@puppycrawl.com">Oliver Burn</a>
**/
class MethodSignature
{
/** the parameters **/
private final List mParams = new ArrayList();
/** the throws **/
private List mThrows = new ArrayList();
/** the name **/
private MyCommonAST mName;
/** the modifiers **/
private final MyModifierSet mModSet = new MyModifierSet();
/** the return type **/
private MyCommonAST mReturnType;
/**
* Adds a parameter.
* @param aParam the parameter details.
**/
void addParam(LineText aParam)
{
mParams.add(aParam);
}
/** @return the parameters as a List that can be modified **/
List getParams()
{
return new ArrayList(mParams);
}
/**
* Sets the list of throws.
* @param aThrows the throws
**/
void setThrows(List aThrows)
{
mThrows = aThrows;
}
/** @return the list of throws as a List that can be modified **/
List getThrows()
{
return new ArrayList(mThrows);
}
/**
* @param aName method name
*/
void setName(MyCommonAST aName)
{
mName = aName;
}
/** @return method name **/
MyCommonAST getName()
{
return mName;
}
/** @return the <code>MyModifierSet</code> for the method **/
MyModifierSet getModSet()
{
return mModSet;
}
/** @return the first line of the method signature **/
int getFirstLineNo()
{
if (mModSet.size() > 0) {
return mModSet.getFirstLineNo();
}
else if (mReturnType != null) {
return mReturnType.getLineNo();
}
else {
return mName.getLineNo();
}
}
/** @return the first column of the method signature **/
int getFirstColNo()
{
if (mModSet.size() > 0) {
return mModSet.getFirstColNo();
}
else if (mReturnType != null) {
return mReturnType.getColumnNo();
}
else {
return mName.getColumnNo();
}
}
/** @return the return type **/
MyCommonAST getReturnType()
{
return mReturnType;
}
/**
* @param aReturnType the return type
*/
void setReturnType(MyCommonAST aReturnType)
{
mReturnType = aReturnType;
}
/** @return whether the method is a function **/
boolean isFunction()
{
return isConstructor()
? false
: !"void".equals(mReturnType.getText().trim());
}
/** @return whether the method is really a constructor **/
boolean isConstructor()
{
return (mReturnType == null);
}
}

View File

@ -1,21 +0,0 @@
package com.puppycrawl.tools.checkstyle;
import junit.framework.TestCase;
public class JavadocTagTest
extends TestCase
{
public JavadocTagTest(String name)
{
super(name);
}
public void testMisc()
{
final JavadocTag o = new JavadocTag(666, "@fred");
assertNotNull(o);
assertEquals("{Tag = '@fred', lineNo = 666, Arg1 = 'null'}",
o.toString());
assertEquals(false, o.isAuthorTag());
}
}

View File

@ -1,21 +0,0 @@
package com.puppycrawl.tools.checkstyle;
import junit.framework.TestCase;
public class MethodSignatureTest
extends TestCase
{
public MethodSignatureTest(String name)
{
super(name);
}
public void testMisc()
{
final MethodSignature o = new MethodSignature();
assertNotNull(o);
final MyCommonAST ret = new MyCommonAST();
o.setReturnType(ret);
assertEquals(ret, o.getReturnType());
}
}