=====================================================================
Found a 103 line (445 tokens) duplication in the following files:
Starting at line 134 of /usr/local/dashboard/working/build/src/org/cougaar/tools/javadoc/EventTaglet.java
Starting at line 134 of /usr/local/dashboard/working/build/src/org/cougaar/tools/javadoc/PropertyTaglet.java
PropertyTaglet tag = new PropertyTaglet();
Taglet t = (Taglet) tagletMap.get(tag.getName());
if (t != null) {
tagletMap.remove(tag.getName());
}
tagletMap.put(tag.getName(), tag);
}
/**
* Given the Tag representation of this custom
* tag, return its string representation.
* @param tag he Tag representation of this custom tag.
*/
public String toString(Tag tag) {
Tuple t = new Tuple(tag);
return "
" + SINGULAR_HEADER + ""
+ ""+
"| "+ t.param +" | "+
""+ t.text +" | "+
"
\n";
}
/**
* Given an array of Tags representing this custom
* tag, return its string representation.
* @param tags the array of Tags representing of this custom tag.
*/
public String toString(Tag[] tags) {
if (tags.length == 0) {
return null;
}
String result = "\n" + (tags.length == 1 ? SINGULAR_HEADER : PLURAL_HEADER) + "";
result += "";
for (int i = 0; i < tags.length; i++) {
Tuple t = new Tuple((Tag)tags[i]);
result += "| "+ t.param +" | "+
""+ t.text +" |
";
}
return result + "
\n";
}
public static class Tuple implements Comparable
{
public Tag tag;
public String param = null;
public String text = null;
public final static String white = " \t\n\r"; // whitespace chars
public Tuple(Tag tag) {
this.tag = tag;
String tt = tag.text();
int i;
int l = tt.length();
int state =0; // what are we looking for?
int p0=-1,p1=-1,t0=-1;
// scan the tag text
for (i=0;i=0);
switch (state) {
case 0: // looking for param start
if (!isWhite) {
p0=i;
state=1;
}
break;
case 1: // looking for param end
if (isWhite) {
p1 = i;
state=2;
}
break;
case 2: // looking for text start
if (!isWhite) {
t0 = i;
state=3;
}
break;
default: // shouldn't get here
break;
}
if (state==3) break;
}
if (t0>=0) {
param = tt.substring(p0,p1);
text = tt.substring(t0);
} else {
}
}
public int compareTo(Object o) {
if (!(o instanceof Tuple)) return -1;
Tuple t = (Tuple) o;
int v = param.compareTo(t.param);
if (v != 0) return v;
return 0;
}
}
}
=====================================================================
Found a 71 line (356 tokens) duplication in the following files:
Starting at line 128 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/MeasureWriter.java
Starting at line 78 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
public Writer(PGParser p) {
this.p = p;
try {
filelist = new PrintWriter(new OutputStreamWriter(new FileOutputStream(new File(getTargetDir(),getGenFileName()))));
noteFile(getGenFileName());
} catch (IOException ioe) { throw new RuntimeException(); }
}
public void noteFile(String s) {
println(filelist,s);
}
public void done() {
filelist.close();
}
void grokGlobal() {
}
/** convert a string like foo_bar_baz to FooBarBaz **/
String toClassName(String s) {
StringBuffer b = new StringBuffer();
boolean isFirst = true;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '_') {
isFirst= true;
} else {
if (isFirst && Character.isLowerCase(c))
c = Character.toUpperCase(c);
isFirst=false;
b.append(c);
}
}
return b.toString();
}
/** convert a string like foo_bar_baz to fooBarBaz **/
String toVariableName(String s) {
StringBuffer b = new StringBuffer();
boolean isFirst = true;
boolean isStart = true;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '_') {
isFirst= true;
} else {
if (isStart && isFirst && Character.isLowerCase(c))
c = Character.toUpperCase(c);
isFirst=false; isStart=false;
b.append(c);
}
}
return b.toString();
}
/** convert a string like foo_bar_baz to FOO_BAR_BAZ **/
String toConstantName(String s) {
StringBuffer b = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (Character.isLowerCase(c))
c = Character.toUpperCase(c);
b.append(c);
}
return b.toString();
}
=====================================================================
Found a 51 line (220 tokens) duplication in the following files:
Starting at line 170 of /usr/local/dashboard/working/build/src/org/cougaar/tools/javadoc/CougaarDoclet.java
Starting at line 182 of /usr/local/dashboard/working/build/src/org/cougaar/tools/javadoc/EventTaglet.java
this.tag = tag;
String tt = tag.text();
int i;
int l = tt.length();
int state =0; // what are we looking for?
int p0=-1,p1=-1,t0=-1;
// scan the tag text
for (i=0;i=0);
switch (state) {
case 0: // looking for param start
if (!isWhite) {
p0=i;
state=1;
}
break;
case 1: // looking for param end
if (isWhite) {
p1 = i;
state=2;
}
break;
case 2: // looking for text start
if (!isWhite) {
t0 = i;
state=3;
}
break;
default: // shouldn't get here
break;
}
if (state==3) break;
}
if (t0>=0) {
param = tt.substring(p0,p1);
text = tt.substring(t0);
} else {
}
}
public int compareTo(Object o) {
if (!(o instanceof Tuple)) return -1;
Tuple t = (Tuple) o;
int v = param.compareTo(t.param);
if (v != 0) return v;
return 0;
=====================================================================
Found a 31 line (203 tokens) duplication in the following files:
Starting at line 369 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 480 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
" implements "+className+", Future_PG\n"+
"{");
// declare the slots
Vector slotspecs = getAllSlotSpecs(context);
Enumeration se = slotspecs.elements();
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
String clname = toClassName(name);
String slotdoc = null;
String depp = (String)p.get(context,name+".deprecated");
if (depp != null) {
slotdoc="@deprecated "+depp;
}
if (slotdoc!=null)
println(out," /** "+slotdoc+" **/");
if (as!=null) {
println(out," public "+type+" "+as.getterSpec()+"{\n"+
=====================================================================
Found a 18 line (139 tokens) duplication in the following files:
Starting at line 88 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/MeasureWriter.java
Starting at line 103 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGParser.java
public void parse(InputStream s, boolean top) throws IOException {
InputStreamReader isr = new InputStreamReader(s);
BufferedReader br = new BufferedReader(isr);
String context = "global";
int i;
getContext(context);
for (String line = br.readLine(); line != null; line=br.readLine()) {
line = line.trim();
if (line.length() == 0 || line.startsWith(";")) {
// empty or comment line
} else {
while (line.endsWith("\\")) {
String more = br.readLine();
if (more == null) throw new IOException("Unexpected EOF");
line = line.substring(0,line.length()-1)+more.trim();
}
if (line.startsWith("includedefs")) {
=====================================================================
Found a 20 line (131 tokens) duplication in the following files:
Starting at line 263 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 373 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Vector slotspecs = getAllSlotSpecs(context);
Enumeration se = slotspecs.elements();
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
String clname = toClassName(name);
String slotdoc = null;
=====================================================================
Found a 22 line (123 tokens) duplication in the following files:
Starting at line 370 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 651 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
println(out,"public interface "+newclassName+" "+extendstring+" {");
// declare the slots
Vector slotspecs = getAllSlotSpecs(context);
Enumeration se = slotspecs.elements();
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
String depp = (String)p.get(context,name+".deprecated");
=====================================================================
Found a 19 line (122 tokens) duplication in the following files:
Starting at line 263 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 654 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Vector slotspecs = getAllSlotSpecs(context);
Enumeration se = slotspecs.elements();
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
String depp = (String)p.get(context,name+".deprecated");
=====================================================================
Found a 18 line (120 tokens) duplication in the following files:
Starting at line 1041 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 1195 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
se = slotspecs.elements();
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
if (as != null) {
=====================================================================
Found a 19 line (116 tokens) duplication in the following files:
Starting at line 263 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 853 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
println(out," // Slots\n");
Enumeration se = slotspecs.elements();
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
String var = (String)p.get(context,name+".var");
=====================================================================
Found a 18 line (115 tokens) duplication in the following files:
Starting at line 1041 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 1166 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
se = slotspecs.elements();
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
if (type.equals("String")) {
=====================================================================
Found a 19 line (114 tokens) duplication in the following files:
Starting at line 1194 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 1283 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
implclassName + ".this.equals(object); }");
// dispatch getters
se = slotspecs.elements();
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
=====================================================================
Found a 18 line (114 tokens) duplication in the following files:
Starting at line 265 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 1286 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
se = slotspecs.elements();
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
String getter = "get"+toClassName(name);
=====================================================================
Found a 16 line (113 tokens) duplication in the following files:
Starting at line 265 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 1041 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
se = slotspecs.elements();
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
=====================================================================
Found a 20 line (110 tokens) duplication in the following files:
Starting at line 1041 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 1447 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
String clname = toClassName(context);
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
if (as == null) {
=====================================================================
Found a 16 line (110 tokens) duplication in the following files:
Starting at line 412 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/MeasureWriter.java
Starting at line 692 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/MeasureWriter.java
println(out," public static final "+className+" new"+unitName+"(double v) {");
println(out," return new "+className+"(v"+fexpr+");");
println(out," }");
println(out," public static final "+className+" new"+unitName+"(String s) {");
println(out," return new "+className+"((Double.valueOf(s).doubleValue())"+fexpr+");");
println(out," }");
}
println(out);
// common unit support - mostly a bogon
println(out);
println(out," public int getCommonUnit() {");
String cus = p.get(context, "common");
if (cus == null) {
println(out," return 0;");
} else {
=====================================================================
Found a 20 line (109 tokens) duplication in the following files:
Starting at line 1166 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 1447 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
String clname = toClassName(context);
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
if (as == null) {
=====================================================================
Found a 17 line (107 tokens) duplication in the following files:
Starting at line 265 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
Starting at line 1447 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/PGWriter.java
String clname = toClassName(context);
while (se.hasMoreElements()) {
String slotspec = ((String)se.nextElement()).trim();
int s = slotspec.indexOf(" ");
String type = slotspec.substring(0,s);
String name = slotspec.substring(s+1);
ActiveSlot as = parseActiveSlot(slotspec);
if (as != null) {
name = as.name;
}
String etype = null;
CollectionType ct = parseCollectionType(type);
if (ct != null) {
type = ct.ctype;
etype = ct.etype;
}
=====================================================================
Found a 22 line (103 tokens) duplication in the following files:
Starting at line 527 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/MeasureWriter.java
Starting at line 866 of /usr/local/dashboard/working/build/src/org/cougaar/tools/build/MeasureWriter.java
println(out," return (theValue*"+dtC+".convFactor[unit2]/"+dC+".convFactor[unit1]);");
println(out," else");
println(out," throw new UnknownUnitException();");
println(out," }");
println(out);
// equals et al
println(out," public boolean equals(Object o) {");
println(out," return ( o instanceof "+className+" &&");
println(out," theValue == (("+className+") o).theValue);");
println(out," }");
println(out," public String toString() {");
println(out," return Double.toString(theValue) + \""+
baseabbrev+"\";");
println(out," }");
println(out," public int hashCode() {");
println(out," return (new Double(theValue)).hashCode();");
println(out," }");
println(out);
// derivative implementation
println(out," // Derivative");