<commit_before>/*
 * Created on 23.11.2005
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package gvs.server;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Image;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import org.dom4j.Document;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.inject.Singleton;

import gvs.common.Configuration;
import gvs.interfaces.IBinaryNode;
import gvs.interfaces.IEdge;
import gvs.interfaces.INode;
import gvs.interfaces.IVertex;
import gvs.ui.application.controller.ApplicationController;
import gvs.ui.graph.model.DefaultVertex;
import gvs.ui.graph.model.Edge;
import gvs.ui.graph.model.GraphModel;
import gvs.ui.graph.model.IconVertex;
import gvs.ui.tree.model.BinaryNode;
import gvs.ui.tree.model.DefaultNode;
import gvs.ui.tree.model.TreeModel;

/**
 * This class builds the model which is required for the visualization. The
 * types (Line, Background ...) will be translated into Java-Objects
 * 
 * @author mkoller
 */
@Singleton
public class ModelBuilder {

  // Visualization-Service
  private ApplicationController appController = null;
  private Configuration typs = null;

  // Generaly
  private static final String ATTRIBUTEID = "Id";
  private static final String LABEL = "Label";
  private static final String FILLCOLOR = "Fillcolor";
  private static final String ICON = "Icon";
  private static final String LINECOLOR = "Linecolor";
  private static final String LINESTYLE = "Linestyle";
  private static final String LINETHICKNESS = "Linethickness";

  // Graph
  private static final String GRAPH = "Graph";
  private static final String BACKGROUND = "Background";
  private static final String MAXLABELLENGTH = "MaxLabelLength";
  private static final String VERTIZES = "Vertizes";
  private static final String RELATIVVERTEX = "RelativVertex";
  private static final String DEFAULTVERTEX = "DefaultVertex";
  private static final String XPOS = "XPos";
  private static final String YPOS = "YPos";
  private static final String EDGES = "Edges";
  private static final String ISDIRECTED = "IsDirected";
  private static final String FROMVERTEX = "FromVertex";
  private static final String TOVERTEX = "ToVertex";
  private static final String ARROWPOS = "DrawArrowOnPosition";

  // Tree
  private static final String TREE = "Tree";
  private static final String NODES = "Nodes";
  private static final String DEFAULTNODE = "DefaultNode";
  private static final String BINARYNODE = "BinaryNode";
  private static final String TREEROOTID = "TreeRootId";
  private static final String CHILDID = "Childid";
  private static final String RIGTHCHILD = "Rigthchild";
  private static final String LEFTCHILD = "Leftchild";

  // Logger
  private Logger serverLogger = null;

  /**
   * ModelBuilder.
   */
  public ModelBuilder() {
    // TODO check replacement of logger
    // serverLogger = gvs.common.Logger.getInstance().getServerLogger();
    serverLogger = LoggerFactory.getLogger(ModelBuilder.class);
    appController = ApplicationController.getInstance();
    typs = Configuration.getInstance();
  }

  /**
   * Builds a model from the recieved XML.
   * 
   * @param document
   *          Document
   */
  public synchronized void buildModelFromXML(Document document) {
    serverLogger.debug("Model will be built from XML");
    Element docRoot = document.getRootElement();
    Iterator<Element> contentIt = docRoot.elementIterator();
    while (contentIt.hasNext()) {<commit_msg>135: create static logger<commit_after>/*
 * Created on 23.11.2005
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package gvs.server;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Image;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import org.dom4j.Document;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.inject.Singleton;

import gvs.common.Configuration;
import gvs.interfaces.IBinaryNode;
import gvs.interfaces.IEdge;
import gvs.interfaces.INode;
import gvs.interfaces.IVertex;
import gvs.ui.application.controller.ApplicationController;
import gvs.ui.graph.model.DefaultVertex;
import gvs.ui.graph.model.Edge;
import gvs.ui.graph.model.GraphModel;
import gvs.ui.graph.model.IconVertex;
import gvs.ui.tree.model.BinaryNode;
import gvs.ui.tree.model.DefaultNode;
import gvs.ui.tree.model.TreeModel;

/**
 * This class builds the model which is required for the visualization. The
 * types (Line, Background ...) will be translated into Java-Objects
 * 
 * @author mkoller
 */
@Singleton
public class ModelBuilder {

  // Visualization-Service
  private ApplicationController appController = null;
  private Configuration typs = null;

  // Generaly
  private static final String ATTRIBUTEID = "Id";
  private static final String LABEL = "Label";
  private static final String FILLCOLOR = "Fillcolor";
  private static final String ICON = "Icon";
  private static final String LINECOLOR = "Linecolor";
  private static final String LINESTYLE = "Linestyle";
  private static final String LINETHICKNESS = "Linethickness";

  // Graph
  private static final String GRAPH = "Graph";
  private static final String BACKGROUND = "Background";
  private static final String MAXLABELLENGTH = "MaxLabelLength";
  private static final String VERTIZES = "Vertizes";
  private static final String RELATIVVERTEX = "RelativVertex";
  private static final String DEFAULTVERTEX = "DefaultVertex";
  private static final String XPOS = "XPos";
  private static final String YPOS = "YPos";
  private static final String EDGES = "Edges";
  private static final String ISDIRECTED = "IsDirected";
  private static final String FROMVERTEX = "FromVertex";
  private static final String TOVERTEX = "ToVertex";
  private static final String ARROWPOS = "DrawArrowOnPosition";

  // Tree
  private static final String TREE = "Tree";
  private static final String NODES = "Nodes";
  private static final String DEFAULTNODE = "DefaultNode";
  private static final String BINARYNODE = "BinaryNode";
  private static final String TREEROOTID = "TreeRootId";
  private static final String CHILDID = "Childid";
  private static final String RIGTHCHILD = "Rigthchild";
  private static final String LEFTCHILD = "Leftchild";

  // Logger
  private static final Logger serverLogger = LoggerFactory
      .getLogger(ModelBuilder.class);

  /**
   * ModelBuilder.
   */
  public ModelBuilder() {
    appController = ApplicationController.getInstance();
    typs = Configuration.getInstance();
  }

  /**
   * Builds a model from the recieved XML.
   * 
   * @param document
   *          Document
   */
  public synchronized void buildModelFromXML(Document document) {
    serverLogger.debug("Model will be built from XML");
    Element docRoot = document.getRootElement();
    Iterator<Element> contentIt = docRoot.elementIterator();
    while (contentIt.hasNext()) {
{'fraction_non_alphanumeric': 0.09287709497206705, 'fraction_numerical': 0.003770949720670391, 'mean_word_length': 4.38421052631579, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3737121', 'n_tokens_mistral': 2079, 'n_tokens_neox': 2032, 'n_words': 645}