Print the given {@link ProjectModel} as Graphviz .dot file to the given
writer. If includeClasses is true, the individual classes are printed as
well.
7095
public void print(ProjectModel project, Writer w, boolean includeClasses) {
		PrintWriter out = new PrintWriter(w);

		out.println("digraph ModuleGraph {");
		if (includeClasses) {
			out.println("ratio=1;");
		} else {
			out.println("overlap=false;");
			out.println("spline=true;");
		}

		if (layoutHorizontal) {
			out.println("rankdir=\"LR\";");
		}

		int i = 0;
		// print nodes
		for (ModuleModel module : project.getModules().values()) {
			if (module.isHideFromDependencyGraphOutput()) {
				continue;
			}

			if (includeClasses) {
				out.printf("subgraph cluster%d {\n", i++);
			}

			out.printf(
					"  \"MODULE$%s\" [label=\"%s\", shape=box, tooltip=\"%s\"%s];\n",
					module.getQualifiedNameOfRepresentingClass(),
					module.getIdentification(),
					(module.getDescription() != null && !module
							.getDescription().isEmpty()) ? module
							.getDescription() : "No Description",
					includeClasses ? ", color=green" : "");

			if (includeClasses) {
				for (ClassModel clazz : module.getClasses()) {
					out.printf("  \"CLASS$%s\" [label=\"%s\"];\n",
							clazz.getQualifiedName(), clazz.getSimpleName());
				}
			}

			if (includeClasses) {
				out.printf("}\n");
			}
		}

		// print edges

		for (ModuleModel module : project.getModules().values()) {
			if (module.isHideFromDependencyGraphOutput()) {
				continue;
			}
			for (ModuleModel imported : module.getImportedModules()) {
				if (imported.isHideFromDependencyGraphOutput()) {
					continue;
				}
				out.printf("\"MODULE$%s\"->\"MODULE$%s\"%s;\n",
						module.getQualifiedNameOfRepresentingClass(),
						imported.getQualifiedNameOfRepresentingClass(),
						includeClasses ? " [color=green]" : "");
			}
			for (ModuleModel exported : module.getExportedModules()) {
				if (exported.isHideFromDependencyGraphOutput()) {
					continue;
				}
				out.printf("\"MODULE$%s\"->\"MODULE$%s\" [color=green];\n",
						module.getQualifiedNameOfRepresentingClass(),
						exported.getQualifiedNameOfRepresentingClass());
			}

		}

		if (includeClasses) {
			for (ClassModel clazz : project.getClasses().values()) {
				for (ClassModel used : clazz.getUsesClasses()) {
					if (used.equals(clazz)) {
						continue;
					}
					out.printf("\"CLASS$%s\"->\"CLASS$%s\";\n",
							clazz.getQualifiedName(), used.getQualifiedName());
				}
			}
		}

		out.println("}");
		out.flush();
	}
415264
protected final PrintWriter getPrintWriter( String packageName, String className ) {
        return context.tryCreate( logger, packageName, className );
    }
677859
@Override
  public void writeToText(TextWriterStream out, String label) {
    if(label != null) {
      out.commentPrintLn(label);
    }
    out.commentPrintLn("Model class: " + getClass().getName());
    out.commentPrintLn("Centroid: " + getPrototype().toString());
    out.commentPrintLn("Strong Eigenvectors:");
    String strong = FormatUtil.format(getPCAResult().getStrongEigenvectors());
    while(strong.endsWith("\n")) {
      strong = strong.substring(0, strong.length() - 1);
    }
    out.commentPrintLn(strong);
    out.commentPrintLn("Weak Eigenvectors:");
    String weak = FormatUtil.format(getPCAResult().getWeakEigenvectors());
    while(weak.endsWith("\n")) {
      weak = weak.substring(0, weak.length() - 1);
    }
    out.commentPrintLn(weak);
    out.commentPrintLn("Eigenvalues: " + FormatUtil.format(getPCAResult().getEigenvalues()));
  }
719434
public static ProjectModel getProjectModel() {
		synchronized (Modules.class) {
			if (Modules.projectModel == null) {
				ClassLoader classLoader = Modules.class.getClassLoader();
				Config config = new Config(new Properties());
				try (InputStream in = classLoader
						.getResourceAsStream("jabsaw.properties")) {
					Properties properties = new Properties();
					if (in != null) {
						properties.load(in);
					} else {
						Modules.logger.info("jabsaw.properties not found");
					}
					config = new Config(properties);
					Modules.logger.info("loaded jabsaw.properties");
				} catch (IOException e1) {
					Modules.logger.error("error loading jabsaw.properties");
				}

				try {
					// load all classes on the classpath
					ImmutableList<ClassInfo> classes = FluentIterable
							.from(ClassPath.from(classLoader).getResources())
							.filter(ClassInfo.class).toList();
					ClassParser parser = new ClassParser();
					parser.getProject()
							.setUseModuleNames(config.useModuleNames);
					for (ClassInfo info : classes) {
						if (!config.includeJars) {
							if ("jar".equals(info.url().getProtocol())) {
								continue;
							}
						}
						if (config.excludePath != null
								&& info.url().getPath()
										.contains(config.excludePath)) {
							continue;
						}
						Modules.logger.trace("parsing" + info.url());

						try (InputStream is = classLoader
								.getResourceAsStream(info.getResourceName())) {
							ClassReader reader = new ClassReader(is);
							parser.parse(reader);
						} catch (Throwable t) {
							Modules.logger.error(
									"Error while reading " + info.getName(), t);
						}
					}
					parser.getProject().resolveDependencies();
					Modules.projectModel = parser.getProject();
				} catch (IOException e) {
					throw new RuntimeException(
							"error while reading classes on classpath", e);
				}
			}
		}
		return Modules.projectModel;
	}
967404
private void writeProjectProperties()
   {
      ProjectProperties properties = m_projectFile.getProjectProperties();

      m_plannerProject.setCompany(properties.getCompany());
      m_plannerProject.setManager(properties.getManager());
      m_plannerProject.setName(getString(properties.getName()));
      m_plannerProject.setProjectStart(getDateTime(properties.getStartDate()));
      m_plannerProject.setCalendar(getIntegerString(m_projectFile.getDefaultCalendar().getUniqueID()));
      m_plannerProject.setMrprojectVersion("2");
   }
224590
@VisibleForTesting
  @GwtIncompatible("Unnecessary")
  void printModuleGraphManifestOrBundleTo(JSModuleGraph graph, Appendable out, boolean isManifest)
      throws IOException {
    Joiner commas = Joiner.on(",");
    boolean requiresNewline = false;
    for (JSModule module : graph.getAllModules()) {
      if (requiresNewline) {
        out.append("\n");
      }

      if (isManifest) {
        // See CommandLineRunnerTest to see what the format of this
        // manifest looks like.
        String dependencies = commas.join(module.getSortedDependencyNames());
        out.append(
            String.format("{%s%s}\n",
                module.getName(),
                dependencies.isEmpty() ? "" : ":" + dependencies));
        printManifestTo(module.getInputs(), out);
      } else {
        printBundleTo(module.getInputs(), out);
      }
      requiresNewline = true;
    }
  }
742959
private void writeFileCreationRecord() throws IOException
   {
      ProjectProperties properties = m_projectFile.getProjectProperties();

      m_buffer.setLength(0);
      m_buffer.append("MPX");
      m_buffer.append(m_delimiter);
      m_buffer.append(properties.getMpxProgramName());
      m_buffer.append(m_delimiter);
      m_buffer.append(properties.getMpxFileVersion());
      m_buffer.append(m_delimiter);
      m_buffer.append(properties.getMpxCodePage());
      m_buffer.append(MPXConstants.EOL);
      m_writer.write(m_buffer.toString());
   }
1250455
public static void writeGen(JavaFileObject fileObject, JsonModelModel model) throws IOException {
		Map<String, Object> map = convModelToMap(model);

		Writer writer = fileObject.openWriter();
		PrintWriter printWriter = new PrintWriter(writer);
		String generated =
				(String) TemplateRuntime.eval(getTemplateString("JsonModelGen.java.mvel"), map);
		try {
			printWriter.write(generated);
			printWriter.flush();
			printWriter.close();
		} catch (Exception e) {
			throw new RuntimeException("error raised in process " + model.getTarget(), e);
		}
	}
129982
public static void print(Collection<TypedDependency> dependencies, PrintWriter pw) {
    pw.println(toString(dependencies, false));
  }
1072869
private void writeProperties() throws IOException
   {
      writeAttributeTypes("property_types", ProjectField.values());
      writeFields("property_values", m_projectFile.getProjectProperties(), ProjectField.values());
   }
972229
public void write(Model project, Document document, String encoding, OutputStreamWriter writer)
            throws java.io.IOException
   {
      Format format = Format.getRawFormat().setEncoding(encoding).setLineSeparator(LS);
      write(project, document, writer, format);
   }
899995
public void export( Graph pGraph, Schema pSchema, DotWriter pDotWriter, boolean pOutRefsOnly )
  {
    pDotWriter.printHeaderStart( pGraph.getStyleForGraph() );

    if( pGraph.isCollapseSubgraphs() )
    {
      _writeSubgraphRecursiveCollapsed( pGraph, pSchema, pDotWriter, pOutRefsOnly );

      List<Graph> lEndGraphs = _getEndGraphListRecursive( pGraph );

      List<GraphAssociation> lGraphAssociations = new ArrayList<GraphAssociation>();

      for( Graph lGraphFrom : lEndGraphs )
      {
        for( Graph lGraphTo : lEndGraphs )
        {
          GraphAssociation lGraphAssociation = new GraphAssociation();
          lGraphAssociation._graphFrom = lGraphFrom;
          lGraphAssociation._graphTo = lGraphTo;

          for( Table lTableFrom : pSchema.getTables() )
          {
            if( lGraphFrom.containsTableRecursive( lTableFrom ) )
            {
              for( Table lTableTo : pSchema.getTables() )
              {
                if( lGraphTo.containsTableRecursive( lTableTo ) )
                {
                  for( Association lAssociation : pSchema.getAssociations() )
                  {
                    if( lAssociation.getTableFrom() == lTableFrom && lAssociation.getTableTo() == lTableTo )
                    {
                      lGraphAssociation._countTableFks += 1;
                    }
                  }
                }
              }
            }
          }

          if( lGraphAssociation._countTableFks > 0 )
          {
            lGraphAssociations.add( lGraphAssociation );
          }
        }
      }

      for( GraphAssociation lGraphAssociation : _filterGraphAssociations( lGraphAssociations ) )
      {
        _printGraphAssociation( lGraphAssociation, pDotWriter );
      }
    }
    else
    {
      List<Association> lExtraAssociations = new ArrayList<Association>();
      boolean lOtherTablesFound = false;

      for( Table lTable : pSchema.getTables() )
      {
        if( !pGraph.containsTableRecursive( lTable ) )
        {
          List<Association> lVisibleAssociation = pGraph.getVisibleAssociation( lTable, pSchema, pOutRefsOnly );

          if( !lVisibleAssociation.isEmpty() )
          {
            lExtraAssociations.addAll( lVisibleAssociation );
            lOtherTablesFound = true;
            _printTable( lTable, pDotWriter, lVisibleAssociation, pOutRefsOnly, pGraph.getStyleForTable( lTable ) );
          }
        }
      }

      _writeSubgraphRecursive( pGraph, pSchema, pDotWriter, pOutRefsOnly, new ArrayList<Table>(), lOtherTablesFound, pGraph.isRenderClusterForSubgraphs() );

      for( Association lAssociation : pSchema.getAssociations() )
      {
        if( lExtraAssociations.contains( lAssociation )
            || (pGraph.allAssociations() && (pGraph.containsTableRecursive( lAssociation.getTableFrom() ) || (!pOutRefsOnly && pGraph.containsTableRecursive( lAssociation.getTableTo() )))) )
        {
          _printAssociation( lAssociation, pDotWriter, pGraph );
        }
      }
    }

    pDotWriter.printHeaderEnd();
  }
328759
@GwtIncompatible("Unnecessary")
  private void outputModuleGraphJson() throws IOException {
    if (config.outputModuleDependencies != null &&
        config.outputModuleDependencies.length() != 0) {
      try (Writer out = fileNameToOutputWriter2(config.outputModuleDependencies)) {
        printModuleGraphJsonTo(out);
      }
    }
  }
385237
public static void writeEdge(Node src, Node tgt, Edge edge,
            PrintWriter writer) {
        StringBuilder sb = new StringBuilder();
        RelationshipType rel = edge.rel;
        String reldispval = rel.getDisplayValue();
        sb.append("  <edge label='");
        String dispval = format(EDGE_LABEL, src.label, rel, tgt.label);
        sb.append(dispval);
        sb.append("' source='");
        sb.append(edge.source.toString());
        sb.append("' target='");
        sb.append(edge.target.toString());
        sb.append("'>\n");
        sb.append("    <att name='relationship type'");
        sb.append(" value='");
        sb.append(reldispval);
        sb.append("' />\n");

        // Edge graphics
        String color = color(rel);
        String graphics = format(EDGE_GRAPHICS, 1, color, 1, reldispval);
        sb.append(graphics);

        sb.append("  </edge>\n");
        writer.write(sb.toString());
    }
1366227
public void write(final ComponentDocumentationWrapper componentWrapper, final OutputStream outputStream)
            throws IOException {

        final Map<String, Object> data = new HashMap<>();

        try {
            data.put("breadcrumbs", _breadcrumbs);
            data.put("component", componentWrapper);

            {
                final Set<ConfiguredPropertyDescriptor> configuredProperties =
                        componentWrapper.getComponentDescriptor().getConfiguredProperties();
                final List<ConfiguredPropertyDescriptor> properties = new ArrayList<>(configuredProperties);
                final List<ConfiguredPropertyDocumentationWrapper> propertyList = new ArrayList<>();
                for (final ConfiguredPropertyDescriptor property : properties) {
                    final HiddenProperty hiddenProperty = property.getAnnotation(HiddenProperty.class);
                    final Deprecated deprecatedProperty = property.getAnnotation(Deprecated.class);

                    // we do not show hidden or deprecated properties in docs
                    if ((hiddenProperty == null || hiddenProperty.hiddenForLocalAccess() == false)
                            && deprecatedProperty == null) {
                        final ConfiguredPropertyDocumentationWrapper wrapper =
                                new ConfiguredPropertyDocumentationWrapper(property);
                        propertyList.add(wrapper);
                    }
                }

                data.put("properties", propertyList);
            }

            /* Write data to a file */
            final Writer out = new OutputStreamWriter(outputStream);
            _template.process(data, out);
            out.flush();
            out.close();
        } catch (final TemplateException e) {
            throw new IllegalStateException("Unexpected templare exception", e);
        }
    }
987482
private void renderAsDT(Writer writer, ProjectModel project, Iterator<Link> links, boolean wrap) throws IOException
    {
        if (!links.hasNext())
            return;

        if (wrap)
            writer.append("<dl>");
        while (links.hasNext())
        {
            Link link = links.next();
            writer.append("<dt>").append(link.getDescription());
            writer.append("</dt><dd><a href='").append(link.getLink());
            appendProject(writer, project);
            writer.append("'>Link</a></dd>");
        }
        if (wrap)
            writer.append("</dl>");
    }
1182076
private static <N, E> void writeRaw(Graph<N, E> graph,
                                        Appendable a,
                                        DOTVisualizationHelper<N, ? super E> dotHelperOrNull) throws IOException {

        final DOTVisualizationHelper<N, ? super E> dotHelper;

        if (dotHelperOrNull == null) {
            dotHelper = new DefaultDOTVisualizationHelper<>();
        } else {
            dotHelper = dotHelperOrNull;
        }

        final boolean directed = !(graph instanceof UndirectedGraph);

        if (directed) {
            a.append("di");
        }

        a.append("graph g {").append(System.lineSeparator());

        Map<String, String> props = new HashMap<>();

        dotHelper.getGlobalNodeProperties(props);
        if (!props.isEmpty()) {
            a.append('\t').append("node");
            appendParams(props, a);
            a.append(';').append(System.lineSeparator());
        }

        props.clear();
        dotHelper.getGlobalEdgeProperties(props);
        if (!props.isEmpty()) {
            a.append('\t').append("edge");
            appendParams(props, a);
            a.append(';').append(System.lineSeparator());
        }

        dotHelper.writePreamble(a);
        a.append(System.lineSeparator());

        MutableMapping<N, String> nodeNames = graph.createStaticNodeMapping();
        Set<String> initialNodes = new HashSet<>();

        int i = 0;

        for (N node : graph) {
            props.clear();
            if (!dotHelper.getNodeProperties(node, props)) {
                continue;
            }
            String id = "s" + i++;

            // remove potential attributes that are no valid DOT attributes
            if (Boolean.parseBoolean(props.remove(NodeAttrs.INITIAL))) {
                initialNodes.add(id);
            }
            props.remove(NodeAttrs.ACCEPTING);

            a.append('\t').append(id);
            appendParams(props, a);
            a.append(';').append(System.lineSeparator());
            nodeNames.put(node, id);
        }

        for (N node : graph) {
            String srcId = nodeNames.get(node);
            if (srcId == null) {
                continue;
            }
            Collection<E> outEdges = graph.getOutgoingEdges(node);
            if (outEdges.isEmpty()) {
                continue;
            }
            for (E e : outEdges) {
                N tgt = graph.getTarget(e);
                String tgtId = nodeNames.get(tgt);
                if (tgtId == null) {
                    continue;
                }

                if (!directed && tgtId.compareTo(srcId) < 0) {
                    continue;
                }

                props.clear();
                if (!dotHelper.getEdgeProperties(node, e, tgt, props)) {
                    continue;
                }

                a.append('\t').append(srcId).append(' ');
                if (directed) {
                    a.append("-> ");
                } else {
                    a.append("-- ");
                }
                a.append(tgtId);
                appendParams(props, a);
                a.append(';').append(System.lineSeparator());
            }
        }

        a.append(System.lineSeparator());
        renderInitialArrowTip(initialNodes, a);

        dotHelper.writePostamble(a);
        a.append(System.lineSeparator());

        a.append('}').append(System.lineSeparator());
        if (a instanceof Flushable) {
            ((Flushable) a).flush();
        }
    }