CPD Results

The following document contains the results of PMD's CPD 6.55.0.

Duplications

File Line
org/codehaus/modello/plugin/java/JavaModelloGenerator.java 943
org/codehaus/modello/plugin/java/JavaModelloGenerator.java 986
  1. jMethod.addParameter(new JParameter(JType.BOOLEAN, "sourceDominant"));
  2. sc = jMethod.getSourceCode();
  3. sc.add("if ( source == null )");
  4. sc.add("{");
  5. sc.addIndented("return target;");
  6. sc.add("}");
  7. sc.add("else if ( target == null )");
  8. sc.add("{");
  9. sc.addIndented("return source;");
  10. sc.add("}");
  11. sc.add("");
  12. sc.add(locationClass.getName() + " result =");
  13. sc.add(" new " + locationClass.getName() + "( target.getLineNumber(), target.getColumnNumber()"
  14. + (sourceClass != null ? ", target.get" + capitalise(source.getName()) + "()" : "") + " );");
  15. sc.add("");
  16. sc.add(fieldType + " locations;");
  17. sc.add(fieldType + " sourceLocations = source.get" + capitalise(locationsField) + "();");
  18. sc.add(fieldType + " targetLocations = target.get" + capitalise(locationsField) + "();");
  19. sc.add("if ( sourceLocations == null )");
  20. sc.add("{");
  21. sc.addIndented("locations = targetLocations;");
  22. sc.add("}");
  23. sc.add("else if ( targetLocations == null )");
  24. sc.add("{");
  25. sc.addIndented("locations = sourceLocations;");
  26. sc.add("}");
  27. sc.add("else");
  28. sc.add("{");
  29. sc.addIndented("locations = new " + fieldImpl.getName() + "();");
File Line
org/codehaus/modello/plugin/java/JavaModelloGenerator.java 1353
org/codehaus/modello/plugin/java/JavaModelloGenerator.java 1942
  1. JavaAssociationMetadata javaAssociationMetadata = getJavaAssociationMetadata(modelAssociation);
  2.  
  3. if (modelAssociation.isManyMultiplicity()) {
  4. JType componentType = getComponentType(modelAssociation, javaAssociationMetadata);
  5.  
  6. String defaultValue = getDefaultValue(modelAssociation, componentType);
  7.  
  8. JType type;
  9. if (modelAssociation.isGenericType()) {
  10. type = new JCollectionType(modelAssociation.getType(), componentType);
  11. } else if (ModelDefault.MAP.equals(modelAssociation.getType())) {
  12. JMapType mapType = new JMapType(modelAssociation.getType(), defaultValue, componentType);
  13. defaultValue = mapType.getInstanceName();
  14. type = mapType;
  15. } else {
  16. type = new JClass(modelAssociation.getType());
  17. }
  18.  
  19. JField jField = new JField(type, modelAssociation.getName());
File Line
org/codehaus/modello/plugin/java/javasource/JClass.java 578
org/codehaus/modello/plugin/java/javasource/JInterface.java 388
  1. if (fieldAnnotations != null) fieldAnnotations.print(jsw);
  2.  
  3. // -- print member
  4. jsw.write(jField.getModifiers().toString());
  5. jsw.write(' ');
  6.  
  7. JType type = jField.getType();
  8. String typeName = type.toString();
  9. // -- for esthetics use short name in some cases
  10. if (typeName.equals(toString())) {
  11. typeName = type.getLocalName();
  12. }
  13. jsw.write(typeName);
  14. jsw.write(' ');
  15. jsw.write(jField.getName());
  16.  
  17. String init = jField.getInitString();
  18. if (init != null) {
  19. jsw.write(" = ");
  20. jsw.write(init);
  21. }
  22.  
  23. jsw.writeln(';');
  24. jsw.writeln();
  25. }
File Line
org/codehaus/modello/plugin/java/javasource/JCompUnit.java 269
org/codehaus/modello/plugin/java/javasource/JStructure.java 355
  1. String javaPackagePath = "";
  2. if ((packageName != null) && (packageName.length() > 0)) {
  3. javaPackagePath = packageName.replace('.', File.separatorChar);
  4. }
  5.  
  6. // -- Create fully qualified path (including 'destDir') to file
  7. File pathFile;
  8. if (destDir == null) pathFile = new File(javaPackagePath);
  9. else pathFile = new File(destDir, javaPackagePath);
  10. if (!pathFile.exists()) {
  11. pathFile.mkdirs();
  12. }
  13.  
  14. // -- Prefix filename with path
  15. if (pathFile.toString().length() > 0) filename = pathFile.toString() + File.separator + filename;
  16.  
  17. return filename;
  18. } // -- getFilename
  19.  
  20. /**
  21. * Returns the name of the package that this JCompUnit is a member of
  22. * @return the name of the package that this JCompUnit is a member of,
  23. * or null if there is no current package name defined
  24. **/
  25. public String getPackageName() {