|
From: <js...@us...> - 2008-05-09 17:07:12
|
Revision: 47
http://jcontracts.svn.sourceforge.net/jcontracts/?rev=47&view=rev
Author: jstuyts
Date: 2008-05-09 10:07:10 -0700 (Fri, 09 May 2008)
Log Message:
-----------
Removed Dotty-related classes.
Removed Paths:
-------------
trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java
trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_PackageLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/IDependencyFilter.java
trunk/source/java/net/sf/jcontracts/codeparser/IDotty_Component_Level.java
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,235 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Vector;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureExporter;
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public class DottyVisitor implements ICodeMetaclassVisitor
-{
-
- private PrintWriter ostream;
-
- public static final int TYPE_DETAIL_LEVEL = 2;
-
- public static final int PACKAGE_DETAIL_LEVEL = 1;
-
- private IDotty_Component_Level component;
-
- private boolean layoutLR;
-
- private boolean directed;
-
- private int cluster_index;
-
- private boolean boxPackages;
-
- private boolean do_not_show_dependecy_details;
-
- private IArchitectureSpecification specification;
-
- private IDependencyFilter filter;
-
- public DottyVisitor(IArchitectureSpecification spec, String filename, String title, boolean layoutLR,
- boolean directed, int componentVisitorDetailLevel, boolean showPackages, Vector quietList, boolean check,
- boolean do_not_show_dependecy_details, IDependencyFilter filter) throws IOException
- {
- ostream = null;
- this.layoutLR = false;
- this.directed = true;
- cluster_index = 1;
- specification = null;
- this.filter = null;
- specification = spec;
- if (componentVisitorDetailLevel == 2)
- {
- component = new Dotty_Component_TypeLevel(filter, check);
- }
- if (componentVisitorDetailLevel == 1)
- {
- component = new Dotty_Component_PackageLevel(filter, check);
- }
- this.directed = directed;
- boxPackages = showPackages;
- this.layoutLR = layoutLR;
- this.do_not_show_dependecy_details = do_not_show_dependecy_details;
- this.filter = filter;
- ostream = new PrintWriter(new FileOutputStream(filename));
- if (filter == null)
- {
- writeHeader(ostream, title);
- }
- else
- {
- filter.writeHeader(ostream, title);
- }
- component.setIgnoranceList(quietList);
- }
-
- public void accept(CodeMetaclass codemetaclass)
- {
- }
-
- public void acceptMethod(CodeMetaclass item)
- {
- component.acceptMethod(item, ostream, directed, specification, do_not_show_dependecy_details);
- }
-
- public void acceptTypeMetaclass(CodeMetaclass item)
- {
- component.acceptTypeMetaclass(item, ostream, directed, specification, do_not_show_dependecy_details);
- }
-
- public void acceptVariable(CodeMetaclass item)
- {
- component.acceptVariable(item, ostream, directed, specification, do_not_show_dependecy_details);
- }
-
- public void close()
- {
- if (filter == null)
- {
- component.createErrorLinks(directed, ostream);
- ostream.println("\n}");
- }
- else
- {
- filter.writeTrailer(ostream);
- }
- ostream.close();
- }
-
- public void endSubGraph(String label)
- {
- if (boxPackages)
- {
- ostream.println("label=\"" + label + "\";");
- ostream.println("}");
- }
- }
-
- public void export(String filename)
- {
- IArchitectureExporter exporter = null;
- try
- {
- exporter = specification.newArchitectureExporter(filename);
- if (exporter == null)
- {
- throw new RuntimeException("iDarwin: error no exporter implemented for this specification language.");
- }
- }
- catch (IOException e)
- {
- throw new RuntimeException("iDarwin: error could not open " + filename + " to export specification (" + e
- + ").", e);
- }
- try
- {
- exporter.open();
- exporter.export(specification);
- }
- catch (IOException e)
- {
- throw new RuntimeException("iDarwin: error during specification export to " + filename + " (" + e + ").", e);
- }
- finally
- {
- if (exporter != null)
- {
- try
- {
- exporter.close();
- }
- catch (IOException e)
- {
- throw new RuntimeException("iDarwin: error attempt to close open stream " + filename + " failed ("
- + e + ").", e);
- }
- }
- }
- }
-
- public boolean getError()
- {
- return component.getError();
- }
-
- public int getNumberOfErrors()
- {
- return component.getNumberOfErrors();
- }
-
- public int getNumberOfLinks()
- {
- return component.getNumberOfLinks();
- }
-
- public void startSubGraph()
- {
- if (boxPackages)
- {
- ostream.println("subgraph cluster_" + cluster_index + " {");
- ostream.println("color=orange;");
- ostream.println("fontname=Helvetica;");
- ostream.println("fontsize=16;");
- cluster_index++;
- }
- }
-
- public void writeHeader(PrintWriter ostream, String title) throws IOException
- {
- if (directed)
- {
- ostream.println("digraph \"" + title + "\" {");
- }
- else
- {
- ostream.println("graph \"" + title + "\" {");
- }
- ostream.println("fontsize=" + DottyVisitorConstants.fontSize() + ";");
- ostream.println("fontname=\"" + DottyVisitorConstants.fontName() + "\"");
- if (layoutLR)
- {
- ostream.println("rankdir=LR;");
- }
- }
-
- public void writeHeader(String filename, String title) throws IOException
- {
- ostream = new PrintWriter(new FileOutputStream(filename));
- if (directed)
- {
- ostream.println("digraph \"" + title + "\" {");
- }
- else
- {
- ostream.println("graph \"" + title + "\" {");
- }
- ostream.println("fontsize=" + DottyVisitorConstants.fontSize() + ";");
- ostream.println("fontname=\"" + DottyVisitorConstants.fontName() + "\"");
- if (layoutLR)
- {
- ostream.println("rankdir=LR;");
- }
- }
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,96 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-public class DottyVisitorConstants
-{
-
- public static int FONT_SIZE = 12;
-
- public static int EDGE_LENGTH = 4;
-
- public static String FONT_NAME = "Helvetica";
-
- public static final String DEFAULT_PACKAGE = "PACKAGE_DEFAULT";
-
- public static String edgeLengthCommand(boolean directed)
- {
- String result = null;
- if (directed)
- {
- result = "minlen=" + getEdgeLength() + ",";
- }
- else
- {
- result = "len=" + getEdgeLength() + ",";
- }
- return result;
- }
-
- public static String extractPackage(String type)
- {
- String result = null;
- char tag = '.';
- if (type.indexOf('$') > type.indexOf('.'))
- {
- tag = '$';
- }
- if (type.indexOf(tag) == -1)
- {
- result = "PACKAGE_DEFAULT";
- }
- else
- {
- result = type.substring(0, type.lastIndexOf(tag));
- }
- return result;
- }
-
- public static String fontName()
- {
- return FONT_NAME;
- }
-
- public static int fontSize()
- {
- return FONT_SIZE;
- }
-
- public static int getEdgeLength()
- {
- return EDGE_LENGTH;
- }
-
- public static String linkSymbol(boolean directed)
- {
- String result = null;
- if (directed)
- {
- result = " -> ";
- }
- else
- {
- result = " -- ";
- }
- return result;
- }
-
- public DottyVisitorConstants()
- {
- }
-
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,494 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public class Dotty_Component_CommonLevel
-{
-
- protected Vector previouslyCheckedlinks;
-
- protected Vector previouslyDisplayedlinks;
-
- protected Hashtable errorBook;
-
- protected boolean hideAllButPublic;
-
- protected boolean performChecks;
-
- protected static final int BELONGS_TO = 0;
-
- public static final int INTERFACE_EXTENSION = 1;
-
- public static final int CLASS_EXTENSION = 2;
-
- public static final int INTERFACE_IMPLEMENTATION = 3;
-
- public static final int RETURN = 4;
-
- public static final int PARAMETER = 5;
-
- public static final int VARIABLE = 6;
-
- public static final int NEWED = 7;
-
- public static final int LOCALVAR = 8;
-
- protected IDependencyFilter filter;
-
- public static final int STATICREF = 9;
-
- public static final int CAST = 10;
-
- private String colorLUT[] =
- {
- "gray", "black", "black", "black", "blue", "blue", "yellow", "green", "pink", "cyan", "orange"
- };
-
- public String relationNameLUT[] =
- {
- "belongs-to", "extends", "extends", "implements", "return", "parameter", "variable", "new", "local-var",
- "static", "cast"
- };
-
- public static Vector ignore = new Vector();
-
- private boolean containsErrors;
-
- private int numberofErrors;
-
- private int errorID;
-
- private int numberNumberOfLink;
-
- public void addDependency(String source_item, String target_item, int relationType, PrintWriter ostream,
- boolean directed, String extra, IArchitectureSpecification specification, CodeMetaclass item,
- boolean do_not_show_dependecy_details)
- {
- if (filter == null)
- {
- localAddDependency(source_item, target_item, relationType, ostream, directed, extra, specification, item,
- do_not_show_dependecy_details);
- }
- else
- {
- filter.addDependency(source_item, target_item, relationType, ostream, directed, extra, specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- protected void addPackage(PrintWriter ostream, CodeMetaclass item)
- {
- if (filter == null)
- {
- localAddPackage(ostream, item);
- }
- else
- {
- filter.addPackage(ostream, item);
- }
- }
-
- protected void addType(PrintWriter ostream, CodeMetaclass item)
- {
- if (filter == null)
- {
- localAddType(ostream, item);
- }
- else
- {
- filter.addType(ostream, item);
- }
- }
-
- private final boolean atomicMatch(String item, String pattern)
- {
- boolean result = false;
- if (item.equals(pattern))
- {
- result = true;
- }
- else if (pattern.equals("*"))
- {
- result = true;
- }
- else
- {
- int starPos = -1;
- if ((starPos = pattern.indexOf('*')) != -1)
- {
- if (pattern.endsWith("*") && pattern.startsWith("*"))
- {
- String subsection = pattern.substring(1, pattern.length() - 1);
- result = item.indexOf(subsection) != -1;
- }
- else if (pattern.endsWith("*"))
- {
- String b = pattern.substring(0, starPos);
- result = item.startsWith(b);
- }
- else if (pattern.startsWith("*"))
- {
- String e = pattern.substring(starPos + 1, pattern.length());
- result = item.endsWith(e);
- }
- else
- {
- pattern.substring(0, starPos);
- String e = pattern.substring(starPos + 1, pattern.length());
- result = item.startsWith(e) && item.endsWith(e);
- }
- }
- }
- return result;
- }
-
- public void createErrorLinks(boolean directed, PrintWriter ostream)
- {
- String ms;
- String mt;
- int fontSize;
- String fontName;
- String edgeLengthCommand;
- String linkSymbol;
- String color;
- String extra;
- for (Enumeration e = errorBook.keys(); e.hasMoreElements(); ostream.println(ms + linkSymbol + mt + " ["
- + edgeLengthCommand + extra + "color=" + color + ",fontsize=" + fontSize + ",fontname=\"" + fontName
- + "\",style=bold,fontcolor=red];"))
- {
- String key = (String) e.nextElement();
- Object o[] = (Object[]) errorBook.get(key);
- String label = (String) o[1];
- int num = 0;
- for (int pos = 0; (pos = label.indexOf("\\n", pos + 1)) != -1;)
- {
- num++;
- }
-
- num++;
- String s = key.substring(0, key.indexOf("&"));
- String t = key.substring(key.indexOf("&") + 1, key.lastIndexOf("&"));
- ms = mangle(s);
- mt = mangle(t);
- fontSize = DottyVisitorConstants.fontSize();
- fontName = DottyVisitorConstants.fontName();
- edgeLengthCommand = DottyVisitorConstants.edgeLengthCommand(directed);
- linkSymbol = DottyVisitorConstants.linkSymbol(directed);
- color = "red";
- extra = "label=\"" + num;
- if (num > 1)
- {
- extra = extra + " errors:\\n";
- }
- else
- {
- extra = extra + " error:\\n";
- }
- extra = extra + label + "\"";
- }
-
- }
-
- public boolean getError()
- {
- return containsErrors;
- }
-
- protected String getErrorTextForDisplay(String source, String target, String type, String rule)
- {
- return "label=\"" + type + " VIOLATES\\n" + rule + "\",style=bold,fontcolor=red,";
- }
-
- public int getNumberOfErrors()
- {
- return numberofErrors;
- }
-
- public int getNumberOfLinks()
- {
- return numberNumberOfLink;
- }
-
- protected String getVisibilityColorCode(CodeMetaclass item)
- {
- String color = "yellow";
- if (item.isPublic())
- {
- color = "green";
- }
- if (item.isPrivate())
- {
- color = "gray";
- }
- if (item.isProtected())
- {
- color = "blue";
- }
- return color;
- }
-
- public void localAddDependency(String source_item, String target_item, int relationType, PrintWriter ostream,
- boolean directed, String extra, IArchitectureSpecification specification, CodeMetaclass item,
- boolean do_not_show_dependecy_details)
- {
- if (!shall_hide(source_item, target_item))
- {
- numberNumberOfLink++;
- boolean checkPassed = true;
- String color = colorLUT[relationType];
- StringBuffer consoleErrorReportBuffer = new StringBuffer();
- StringBuffer displayErrorReportBuffer = new StringBuffer();
- String source = mangle(pruneToLevel(source_item));
- String target = mangle(pruneToLevel(target_item));
- if (performChecks)
- {
- String checkLinkID = source_item + "__" + target_item + "__" + relationType;
- if (!previouslyCheckedlinks.contains(checkLinkID))
- {
- String errorBookKey = null;
- net.sf.jcontracts.idarwin.specification.openapi.IDependency dependency = specification
- .newDependency(source_item, target_item, relationNameLUT[relationType], item
- .getLocationDescription());
- StringBuffer errorReporBbuffer = new StringBuffer();
- if (!specification.check(dependency, consoleErrorReportBuffer, displayErrorReportBuffer))
- {
- String errorText = errorReporBbuffer.toString();
- numberofErrors++;
- System.err.print("iDarwin: error " + errorID + " ");
- System.err.println(consoleErrorReportBuffer.toString());
- if (do_not_show_dependecy_details)
- {
- errorBookKey = source + "&" + target + "&";
- }
- else
- {
- errorBookKey = source + "&" + target + "&" + relationType;
- }
- if (!errorBook.containsKey(errorBookKey))
- {
- Object arr[] = new Object[2];
- arr[0] = new Integer(0);
- arr[1] = "";
- errorBook.put(errorBookKey, ((Object) (arr)));
- }
- Object entry[] = (Object[]) errorBook.get(errorBookKey);
- entry[0] = new Integer(((Integer) entry[0]).intValue() + 1);
- if (((String) entry[1]).length() > 0)
- {
- entry[1] = entry[1] + "\\n" + errorID + " (" + relationNameLUT[relationType] + ")";
- }
- else
- {
- entry[1] = "" + errorID + " (" + relationNameLUT[relationType] + ")";
- }
- errorID++;
- entry[1] = entry[1] + errorText;
- errorBook.put(errorBookKey, ((Object) (entry)));
- color = "red";
- String latestError = "error id: " + (String) entry[1] + "\\n(console)";
- extra = "label=\"" + latestError + "\",style=bold,fontcolor=red,";
- checkPassed = false;
- }
- previouslyCheckedlinks.addElement(checkLinkID);
- }
- }
- String displayLinkID = null;
- if (do_not_show_dependecy_details)
- {
- displayLinkID = source + "__" + target;
- if (checkPassed)
- {
- color = "black";
- }
- }
- else
- {
- displayLinkID = source + "__" + target + "__" + relationType;
- }
- if (checkPassed && !previouslyDisplayedlinks.contains(displayLinkID))
- {
- int fontSize = DottyVisitorConstants.fontSize();
- String fontName = DottyVisitorConstants.fontName();
- String edgeLengthCommand = DottyVisitorConstants.edgeLengthCommand(directed);
- String linkSymbol = DottyVisitorConstants.linkSymbol(directed);
- ostream.println(source + linkSymbol + target + " [" + edgeLengthCommand + extra + "color=" + color
- + ",fontsize=" + fontSize + ",fontname=\"" + fontName + "\"];");
- previouslyDisplayedlinks.addElement(displayLinkID);
- }
- if (performChecks)
- {
- containsErrors = checkPassed;
- }
- else
- {
- containsErrors = false;
- }
- }
- }
-
- protected void localAddPackage(PrintWriter ostream, CodeMetaclass item)
- {
- int fontSize = DottyVisitorConstants.fontSize();
- String fontName = DottyVisitorConstants.fontName();
- String name = item.getName();
- ostream.print(mangle(pruneToLevel(name)));
- ostream.print(" [label=\"<<package>>\\n" + pruneToLevel(name) + "\"");
- ostream.print(",shape=box");
- ostream.println(",fontsize=" + fontSize + ",fontname=\"" + fontName + "\"];");
- }
-
- protected void localAddType(PrintWriter ostream, CodeMetaclass item)
- {
- int fontSize = DottyVisitorConstants.fontSize();
- String fontName = DottyVisitorConstants.fontName();
- String id = item.getName();
- ostream.print(mangle(id));
- if (item instanceof Class)
- {
- ostream.print(" [label=\"<<class>>\\n" + item.getName() + "\"");
- ostream.print(",shape=box,style=filled,color=" + getVisibilityColorCode(item));
- }
- else
- {
- ostream.print(" [label=\"<<interface>>\\n" + item.getName() + "\"");
- ostream.print(",shape=diamond,style=filled,color=" + getVisibilityColorCode(item));
- }
- ostream.println(",fontsize=" + fontSize + ",fontname=\"" + fontName + "\"];");
- }
-
- protected static String mangle(String name)
- {
- String newname = null;
- if (name.indexOf("Node") != -1 || name.indexOf("Graph") != -1)
- {
- newname = "_" + name;
- }
- else
- {
- newname = name;
- }
- newname = newname.replace('.', '_');
- newname = newname.replace('[', '_');
- newname = newname.replace(']', '_');
- newname = newname.replace('$', '_');
- newname = newname.replace('*', '_');
- newname = newname.replace('\\', '_');
- newname = newname.replace(' ', '_');
- return newname;
- }
-
- private boolean match(String item, String pattern)
- {
- boolean result = false;
- int pos = pattern.indexOf("\\");
- if (pos == -1)
- {
- result = atomicMatch(item, pattern);
- }
- else
- {
- String affermative = pattern.substring(0, pos);
- String negative = pattern.substring(pos + 1);
- if (match(item, affermative))
- {
- result = !atomicMatch(item, negative);
- }
- else
- {
- result = false;
- }
- }
- return result;
- }
-
- protected String pruneToLevel(String name)
- {
- return name;
- }
-
- public void setIgnoranceList(Vector quietList)
- {
- ignore = quietList;
- }
-
- private boolean shall_hide(String source_item, String target_item)
- {
- boolean hide = pruneToLevel(source_item).equals("PACKAGE_DEFAULT")
- || pruneToLevel(target_item).equals("PACKAGE_DEFAULT");
- if (!hide)
- {
- hide = target_item.indexOf("$") == -1 && target_item.indexOf("_") == -1 && target_item.indexOf(".") == -1;
- }
- return hide;
- }
-
- protected final boolean shallIgnore(String type)
- {
- if (type.equals("boolean") || type.equals("char") || type.equals("int") || type.equals("long")
- || type.equals("byte") || type.equals("float") || type.equals("PACKAGE_DEFAULT")
- || type.equals("double"))
- {
- return true;
- }
- for (int i = 0; i < ignore.size(); i++)
- {
- if (match(type, (String) ignore.elementAt(i)))
- {
- return true;
- }
- }
-
- return false;
- }
-
- protected String stripArray(String qualifiedName)
- {
- int start = qualifiedName.indexOf("[");
- String result = null;
- if (start == -1)
- {
- result = qualifiedName;
- }
- else
- {
- result = qualifiedName.substring(0, start);
- }
- return result;
- }
-
- public Dotty_Component_CommonLevel()
- {
- previouslyCheckedlinks = new Vector();
- previouslyDisplayedlinks = new Vector();
- errorBook = new Hashtable();
- hideAllButPublic = false;
- performChecks = true;
- filter = null;
- containsErrors = false;
- numberofErrors = 0;
- errorID = 1;
- numberNumberOfLink = 0;
- }
-
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_PackageLevel.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_PackageLevel.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_PackageLevel.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,244 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public class Dotty_Component_PackageLevel extends Dotty_Component_CommonLevel implements IDotty_Component_Level
-{
-
- public Dotty_Component_PackageLevel(IDependencyFilter filter, boolean performChecks)
- {
- super.performChecks = performChecks;
- super.filter = filter;
- }
-
- public Dotty_Component_PackageLevel(boolean performChecks)
- {
- super.performChecks = performChecks;
- }
-
- public void acceptMethod(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- Method m = (Method) item;
- if ((!super.hideAllButPublic || item.isPublic()) && !shallIgnore(m.getParent().getName()))
- {
- String id = m.getParent().getName();
- String otherid = "";
- if (m.hasType())
- {
- otherid = m.getType();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 4, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
- for (Enumeration e = m.getParameterNames().elements(); e.hasMoreElements();)
- {
- String t = m.getTypeOfParameter((String) e.nextElement());
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 5, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getNewedTypes().elements(); e.hasMoreElements();)
- {
- String t = (String) e.nextElement();
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 7, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getLocalVarTypes().elements(); e.hasMoreElements();)
- {
- String t = (String) e.nextElement();
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 8, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getStaticRefTypes().elements(); e.hasMoreElements();)
- {
- String t = (String) e.nextElement();
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 9, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getCastedTypes().elements(); e.hasMoreElements();)
- {
- String t = (String) e.nextElement();
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 10, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- }
-
- public void acceptTypeMetaclass(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- if ((!super.hideAllButPublic || item.isPublic()) && !shallIgnore(item.getName()))
- {
- addPackage(ostream, item);
- String id = item.getName();
- String superclassName = ((TypeMetaclass) item).getExtendedClassName();
- if (superclassName != null)
- {
- String otherid = superclassName;
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 2, ostream, directed, "weight=10,style=bold,", specification, item,
- do_not_show_dependecy_details);
- }
- }
- Vector v = ((TypeMetaclass) item).getExtendedInterfaces();
- if (v != null && !v.isEmpty())
- {
- for (Enumeration e = v.elements(); e.hasMoreElements();)
- {
- String sss = (String) e.nextElement();
- String otherid = sss;
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 1, ostream, directed, "weight=3,style=dotted,", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- v = ((TypeMetaclass) item).getImplementedInterfaces();
- if (v != null && !v.isEmpty())
- {
- for (Enumeration e = v.elements(); e.hasMoreElements();)
- {
- String sss = (String) e.nextElement();
- String otherid = sss;
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 3, ostream, directed, "weight=2,style=dotted,", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- for (Enumeration e = ((ICodeBody) item).getNewedTypes().elements(); e.hasMoreElements();)
- {
- String sss = (String) e.nextElement();
- String otherid = sss;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 7, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = ((ICodeBody) item).getStaticRefTypes().elements(); e.hasMoreElements();)
- {
- String sss = (String) e.nextElement();
- String otherid = sss;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 9, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = ((ICodeBody) item).getCastedTypes().elements(); e.hasMoreElements();)
- {
- String sss = (String) e.nextElement();
- String otherid = sss;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 10, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- }
-
- public void acceptVariable(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- try
- {
- Variable v = (Variable) item;
- if (!super.hideAllButPublic || item.isPublic())
- {
- String t = stripArray(v.getType());
- if (!shallIgnore(t))
- {
- String id = t;
- String otherid = v.getParent().getName();
- if (!shallIgnore(otherid))
- {
- addDependency(otherid, id, 6, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
- }
- }
- catch (ClassCastException e)
- {
- System.err.println(e + " during visiting " + item + "\ndelete internal cache file and restart.");
- throw e;
- }
- }
-
- protected String getErrorTextForDisplay(String source, String target, String type, String rule)
- {
- return "label=\"Dependency\\n" + source + "\\n-" + type + "->\\n" + target + "\\n" + "VIOLATES\\n" + rule
- + "\",style=bold,fontcolor=red,";
- }
-
- protected String pruneToLevel(String name)
- {
- return DottyVisitorConstants.extractPackage(name);
- }
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,236 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public class Dotty_Component_TypeLevel extends Dotty_Component_CommonLevel implements IDotty_Component_Level
-{
-
- public Dotty_Component_TypeLevel(IDependencyFilter filter, boolean performChecks)
- {
- super.performChecks = performChecks;
- super.filter = filter;
- }
-
- public Dotty_Component_TypeLevel(boolean performChecks)
- {
- super.performChecks = performChecks;
- }
-
- public void acceptMethod(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- DottyVisitorConstants.fontSize();
- DottyVisitorConstants.fontName();
- DottyVisitorConstants.edgeLengthCommand(directed);
- DottyVisitorConstants.linkSymbol(directed);
- Method m = (Method) item;
- if ((!super.hideAllButPublic || item.isPublic()) && !shallIgnore(m.getParent().getName()))
- {
- String id = m.getParent().getName();
- String otherid = "";
- if (m.hasType())
- {
- otherid = m.getType();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 4, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
- for (Enumeration e = m.getParameterNames().elements(); e.hasMoreElements();)
- {
- String t = m.getTypeOfParameter((String) e.nextElement());
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 5, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getNewedTypes().elements(); e.hasMoreElements();)
- {
- otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 7, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getLocalVarTypes().elements(); e.hasMoreElements();)
- {
- otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 8, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getStaticRefTypes().elements(); e.hasMoreElements();)
- {
- otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 9, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getCastedTypes().elements(); e.hasMoreElements();)
- {
- otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 10, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- }
-
- public void acceptTypeMetaclass(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- DottyVisitorConstants.fontSize();
- DottyVisitorConstants.fontName();
- DottyVisitorConstants.edgeLengthCommand(directed);
- DottyVisitorConstants.linkSymbol(directed);
- if ((!super.hideAllButPublic || item.isPublic()) && !shallIgnore(item.getName()))
- {
- addType(ostream, item);
- String id = item.getName();
- String superclassName = ((TypeMetaclass) item).getExtendedClassName();
- if (superclassName != null)
- {
- String otherid = superclassName;
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 2, ostream, directed, "weight=10,style=bold,", specification, item,
- do_not_show_dependecy_details);
- }
- }
- Vector v = ((TypeMetaclass) item).getExtendedInterfaces();
- if (v != null && !v.isEmpty())
- {
- for (Enumeration e = v.elements(); e.hasMoreElements();)
- {
- String otherid = (String) e.nextElement();
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 1, ostream, directed, "weight=3,style=dotted,", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- v = ((TypeMetaclass) item).getImplementedInterfaces();
- if (v != null && !v.isEmpty())
- {
- for (Enumeration e = v.elements(); e.hasMoreElements();)
- {
- String otherid = (String) e.nextElement();
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 3, ostream, directed, "weight=2,style=dotted,", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- for (Enumeration e = ((ICodeBody) item).getNewedTypes().elements(); e.hasMoreElements();)
- {
- String otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 7, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = ((ICodeBody) item).getStaticRefTypes().elements(); e.hasMoreElements();)
- {
- String otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 9, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = ((ICodeBody) item).getCastedTypes().elements(); e.hasMoreElements();)
- {
- String otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 10, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- }
-
- public void acceptVariable(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- try
- {
- DottyVisitorConstants.fontSize();
- DottyVisitorConstants.fontName();
- DottyVisitorConstants.edgeLengthCommand(directed);
- DottyVisitorConstants.linkSymbol(directed);
- Variable v = (Variable) item;
- if (!super.hideAllButPublic || item.isPublic())
- {
- String t = stripArray(v.getType());
- if (!shallIgnore(t))
- {
- String id = t;
- String otherid = v.getParent().getName();
- if (!shallIgnore(otherid))
- {
- addDependency(otherid, id, 6, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
- }
- }
- catch (ClassCastException e)
- {
- System.err.println(e + " during visiting " + item + "\ndelete internal cache file and restart.");
- throw e;
- }
- }
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/IDependencyFilter.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/IDependencyFilter.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/IDependencyFilter.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,37 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public interface IDependencyFilter
-{
-
- public abstract void addDependency(String s, String s1, int i, PrintWriter printwriter, boolean flag, String s2,
- IArchitectureSpecification iarchitecturespecification, CodeMetaclass codemetaclass, boolean flag1);
-
- public abstract void addPackage(PrintWriter printwriter, CodeMetaclass codemetaclass);
-
- public abstract void addType(PrintWriter printwriter, CodeMetaclass codemetaclass);
-
- public abstract void writeHeader(PrintWriter printwriter, String s) throws IOException;
-
- public abstract void writeTrailer(PrintWriter printwriter);
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/IDotty_Component_Level.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/IDotty_Component_Level.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/IDotty_Component_Level.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,45 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.PrintWriter;
-import java.util.Vector;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public interface IDotty_Component_Level
-{
-
- public abstract void acceptMethod(CodeMetaclass codemetaclass, PrintWriter printwriter, boolean flag,
- IArchitectureSpecification iarchitecturespecification, boolean flag1);
-
- public abstract void acceptTypeMetaclass(CodeMetaclass codemetaclass, PrintWriter printwriter, boolean flag,
- IArchitectureSpecification iarchitecturespecification, boolean flag1);
-
- public abstract void acceptVariable(CodeMetaclass codemetaclass, PrintWriter printwriter, boolean flag,
- IArchitectureSpecification iarchitecturespecification, boolean flag1);
-
- public abstract void createErrorLinks(boolean flag, PrintWriter printwriter);
-
- public abstract boolean getError();
-
- public abstract int getNumberOfErrors();
-
- public abstract int getNumberOfLinks();
-
- public abstract void setIgnoranceList(Vector vector);
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|