From ae24debea76cb6bf6f58fe09c81860dafd5bcb8d Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Sat, 14 Apr 2018 17:07:52 +0200 Subject: [PATCH 01/58] Creating classes which are responsible for collecting the properties of the source code elements and the attributes of the buildable types. --- .../beans/BadConfigFileFomatException.java | 23 ++++ .../gui/utils/BuildableSettings.java | 120 ++++++++++++++++ .../toolchain/gui/utils/Property.java | 9 ++ .../gui/utils/PropertyCollector.java | 129 ++++++++++++++++++ .../main/resources/buildableProperties.cmcfg | 13 ++ 5 files changed, 294 insertions(+) create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java create mode 100644 sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java new file mode 100644 index 00000000..7eac84d6 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java @@ -0,0 +1,23 @@ +package codemetropolis.toolchain.gui.beans; + +public class BadConfigFileFomatException extends Exception { + + private static final long serialVersionUID = 1L; + + public BadConfigFileFomatException() { + + } + + public BadConfigFileFomatException(String message) { + super(message); + } + + public BadConfigFileFomatException(Throwable cause) { + super(cause); + } + + public BadConfigFileFomatException(String message, Throwable cause) { + super(message, cause); + } + +} \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java new file mode 100644 index 00000000..56f1b7d9 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java @@ -0,0 +1,120 @@ +package codemetropolis.toolchain.gui.utils; + +import java.util.List; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException; + +public class BuildableSettings { + + //Path of the file containing the settings. + private static final String CFG_FILEPATH ="./src/main/resources/buildableProperties.cmcfg"; + + //Map, serves containing the buildable types and its assigned properties. + private static Map DISPLAYED_PROPERTIES = new HashMap(); + + //Map, which contains the default settings of what properties to display to the individual buildable types. + public static final Map DEFAULT_SETTINGS = new HashMap<>(); + + static { + DEFAULT_SETTINGS.put("FLOOR", new String[]{"width", "height", "length", "character", "external_character", "torches"}); + DEFAULT_SETTINGS.put("CELLAR", new String[]{"width", "height", "length", "character", "external_character", "torches"}); + DEFAULT_SETTINGS.put("GARDEN", new String[]{"tree-ratio", "mushroom-ratio", "flower-ratio"}); + DEFAULT_SETTINGS.put("GROUND", new String[]{}); + + DISPLAYED_PROPERTIES.put("FLOOR", new String[] {}); + DISPLAYED_PROPERTIES.put("CELLAR", new String[] {}); + DISPLAYED_PROPERTIES.put("GARDEN", new String[] {}); + DISPLAYED_PROPERTIES.put("GROUND", new String[] {}); + } + + //Reads the user's display settings from the configuration file. + public static Map readSettings() throws BadConfigFileFomatException, FileNotFoundException{ + BufferedReader cfgFileReader = null; + + cfgFileReader = new BufferedReader(new FileReader(CFG_FILEPATH)); + + try{ + String actLine; + //A regular line: buildable name is followed by an '=' sign, that follows the list of attributes separated by commas. + while((actLine = cfgFileReader.readLine()).split("=").length == 2) { + String buildableName = actLine.split("=")[0]; + String[] buildableProperties = actLine.split("=")[1].split(","); + if(DISPLAYED_PROPERTIES.containsKey(buildableName)) { + //If there is no assigned attribute given to the actual buildable type... + if(buildableProperties.length == 1 && buildableProperties[0].isEmpty()) { + DISPLAYED_PROPERTIES.put(buildableName, new String[] {}); + } + else { + if(validateProperties(buildableName, buildableProperties)) { + DISPLAYED_PROPERTIES.put(buildableName, buildableProperties); + } + else { + throw new BadConfigFileFomatException(); + } + } + } + else { + throw new BadConfigFileFomatException(); + } + } + } + catch(IOException e) { + e.printStackTrace(); + } + finally { + try { + cfgFileReader.close(); + } + catch(IOException ioe) { + ioe.printStackTrace(); + } + } + return DISPLAYED_PROPERTIES; + } + + //Validates, if all assigned properties of the specified buildable type are valid or not. + private static boolean validateProperties(String buildableName, String[] buildabeProperties) { + List validProperties = new ArrayList(Arrays.asList(DEFAULT_SETTINGS.get(buildableName))); + for(String property : buildabeProperties) { + if(!validProperties.contains(property)) { + return false; + } + } + return true; + } + + //Writes to the console, what display settings will be provided to the Mapping file editor GUI. + public static void displaySettings() { + try { + Map returnedSettings = readSettings(); + + for(String buildableType : returnedSettings.keySet()) { + + String[] buildableProperties = returnedSettings.get(buildableType); + + System.out.print(buildableType + "="); + + for(int i = 0; i < buildableProperties.length; i++) { + + System.out.print(buildableProperties[i] + ";"); + + } + System.out.println(); + } + } + catch (BadConfigFileFomatException e) { + e.printStackTrace(); + } + catch (FileNotFoundException e) { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java new file mode 100644 index 00000000..8374abde --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java @@ -0,0 +1,9 @@ +package codemetropolis.toolchain.gui.utils; + +//Serves for storing the information of a property belongs to a source code element type. +public class Property{ + //Name of the property. + public String name; + //Type of the property. + public String type; +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java new file mode 100644 index 00000000..29a6a336 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java @@ -0,0 +1,129 @@ +package codemetropolis.toolchain.gui.utils; + +import java.io.*; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class PropertyCollector { + //Those source code element types, whose properties wanted to be collected. + public static final Set acceptedTypes = new HashSet(Arrays.asList( + new String[] {"package","class","attribute","method"} + )); + + //The String key contains the name of the source code element type. The value assigned to the key is a list with the properties ( pairs). + private Map> propertyMap; + + //Class initialization. + public PropertyCollector() { + initializePropertyMap(); + } + + private void initializePropertyMap() { + propertyMap = new HashMap>(); + for(String type : acceptedTypes) { + propertyMap.put(type, null); + } + } + + public Map> getFromCdf(String cdfFilePath) { + try { + + initializePropertyMap(); + + File file = new File(cdfFilePath); + + DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = dBuilder.parse(file); + + Element rootElement = doc.getDocumentElement(); + rootElement.normalize(); + + //This NodeList 'elementTags' below doesn't contains the root element. + //The root element is also an 'element' tag (a package), that's why we need to try collecting its properties as well. + if(isValidElement(rootElement)) { + tryCollectProperties(rootElement); + } + + NodeList elementTags = rootElement.getElementsByTagName("element"); + + //Iteration through all of the rest 'element' tags (they represent source code element types). Trying to collect their properties. + for(int i = 0; i < elementTags.getLength(); i++) { + Element currentTag = (Element) elementTags.item(i); + if(isValidElement(currentTag)) { + tryCollectProperties(currentTag); + } + }; + + } catch (Exception e) { + e.printStackTrace(); + } + + return propertyMap; + } + + //Checks if the tag is a valid 'element' tag or not. + private boolean isValidElement(Element element) { + return element.getTagName().equals("element") && + element.hasAttribute("type") && + acceptedTypes.contains(element.getAttribute("type")); + } + + private void tryCollectProperties(Element element) { + List propertyList = null; + //We will collect the properties of the source code element types only in that way, when we have never collected them before. + //The element tag must have child nodes. (E.g. the 'properties' tag also a child element.) + if(propertyList == null && element.hasChildNodes()) { + NodeList children = element.getChildNodes(); + for(int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + //When we found the 'properties' tag, we collect the list of properties contained by it. + if(child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals("properties")) { + propertyList = getPropertyList((Element)child); + propertyMap.put(element.getAttribute("type"), propertyList); + break; + } + } + } + } + + //Collects the properties contained by the 'properties' tag. + private List getPropertyList(Element element) { + List result = new ArrayList(); + + NodeList properties = element.getElementsByTagName("property"); + + for(int i = 0; i < properties.getLength(); i++) { + Element property = (Element) properties.item(i); + if(property.hasAttribute("name") && property.hasAttribute("type")) { + Property p = new Property(); + p.name = property.getAttribute("name"); + p.type = property.getAttribute("type"); + result.add(p); + } + } + return result; + } + + //Displays the various properties ( pairs) of the source code elements. + public void displayProperties() { + for(String srcCodeElement : acceptedTypes) { + System.out.println("Properties of source code element '" + srcCodeElement + "':"); + for(Property p : propertyMap.get(srcCodeElement)) { + System.out.println(p.name + ": " + p.type); + } + } + } + +} \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg b/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg new file mode 100644 index 00000000..facf19b3 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg @@ -0,0 +1,13 @@ +FLOOR=width,height,length,character,external_character,torches +CELLAR=width,height,length,character,external_character +GARDEN=tree-ratio,mushroom-ratio,flower-ratio +GROUND= + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ Original state: + ++ + ++ FLOOR=width,height,length,character,external_character,torches + ++ CELLAR=width,height,length,character,external_character,torches + ++ GARDEN=tree-ratio,mushroom-ratio,flower-ratio + ++ GROUND= + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \ No newline at end of file From 8af9f01cb68d33d5a06ed132e0123b4b541d11d6 Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Sun, 15 Apr 2018 00:01:29 +0200 Subject: [PATCH 02/58] Extending the CodeMetropolis GUI with the components of the Mapping file editor. There is a known issue! See below for details. I have also created the class for the editor dialog and made some minor changes on the BuildableSettings and PropertyCollector classes. Known issue: in CodeMetropolisGUI.java you have to change the mappingEditorCdfPath.getText() in the line 215, as written in the comment. If you don't do that you will get the error message that the file you have just chosen does not exist. If you replace the parameter, it will work just fine. (An empty dialog should pop up without occuring any kind of exception.) --- .../toolchain/gui/CodeMetropolisGUI.java | 45 +++++++++----- .../gui/MappingFileEditorDialog.java | 60 +++++++++++++++++++ .../listeners/MappingEditorListener.java | 37 ++++++++++++ .../gui/utils/BuildableSettings.java | 5 +- .../gui/utils/PropertyCollector.java | 1 - .../main/resources/translations.properties | 2 + 6 files changed, 131 insertions(+), 19 deletions(-) create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/MappingEditorListener.java diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java index 7ef2ae8a..ebe0da16 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java @@ -28,6 +28,7 @@ import codemetropolis.toolchain.gui.components.CMSpinner; import codemetropolis.toolchain.gui.components.CMTextField; import codemetropolis.toolchain.gui.components.listeners.BrowseListener; +import codemetropolis.toolchain.gui.components.listeners.MappingEditorListener; import codemetropolis.toolchain.gui.utils.ExecutionWorker; import codemetropolis.toolchain.gui.utils.GuiUtils; import codemetropolis.toolchain.gui.utils.Translations; @@ -52,6 +53,7 @@ public class CodeMetropolisGUI extends JFrame { private CMTextField projectName; private JTabbedPane metricTabbedPane; private CMTextField mappingPath; + private CMTextField mappingEditorCdfPath; private CMTextField mcRootPath; private CMCheckBox showMap; private CMCheckBox validateStructure; @@ -107,7 +109,7 @@ private static final JPanel createBasePanel() { panel.setBackground(Color.WHITE); panel.setBounds(0, 0, 500, 700); - Dimension size = new Dimension(500, 750); + Dimension size = new Dimension(500, 800); panel.setMinimumSize(size); panel.setPreferredSize(size); panel.setMaximumSize(size); @@ -202,16 +204,29 @@ private final void addMappingOptions(JPanel panel) { mappingPath = new CMTextField(145, 555, 235, 30); CMButton mappingBrowse = new CMButton(Translations.t("gui_b_browse"), 385, 555, 100, 30); mappingBrowse.addActionListener(new BrowseListener(mappingPath, JFileChooser.FILES_ONLY, XML_FILTER)); - - CMLabel scaleLabel = new CMLabel(Translations.t("gui_l_scale"), 15, 590, 120, 30); - scaleSpinner = new CMSpinner(145, 590, 120, 30); - - validateStructure = new CMCheckBox(275, 590, 20, 30); - CMLabel validateStructureLabel = new CMLabel(Translations.t("gui_l_validate_structure"), 300, 590, 185, 30); + + //Mapping file editor GUI components + CMLabel mappingEditorLabel = new CMLabel(Translations.t("gui_l_source_cdf"), 15, 590, 120, 30); + mappingEditorCdfPath = new CMTextField(145, 590, 235, 30); + CMButton mappingEditorBrowse = new CMButton(Translations.t("gui_b_browse"), 385, 590, 100, 30); + mappingEditorBrowse.addActionListener(new BrowseListener(mappingEditorCdfPath, JFileChooser.FILES_ONLY, XML_FILTER)); + CMButton mappingEditorButton = new CMButton(Translations.t("gui_b_mapping_file_editor"), 300, 625, 185, 30); + //A mappingEditorCdfPath.getText() paramétert ki kell cserélni egy cdf fájlt reprezentáló útvonallal (string). + mappingEditorButton.addActionListener(new MappingEditorListener(mappingEditorCdfPath.getText(), this)); + + CMLabel scaleLabel = new CMLabel(Translations.t("gui_l_scale"), 15, 660, 120, 30); + scaleSpinner = new CMSpinner(145, 660, 120, 30); + + validateStructure = new CMCheckBox(275, 660, 20, 30); + CMLabel validateStructureLabel = new CMLabel(Translations.t("gui_l_validate_structure"), 300, 660, 185, 30); panel.add(mappingLabel); panel.add(mappingPath); panel.add(mappingBrowse); + panel.add(mappingEditorLabel); + panel.add(mappingEditorCdfPath); + panel.add(mappingEditorBrowse); + panel.add(mappingEditorButton); panel.add(scaleLabel); panel.add(scaleSpinner); panel.add(validateStructure); @@ -224,12 +239,12 @@ private final void addMappingOptions(JPanel panel) { * @param panel The {@link JPanel} to add the components to. */ private final void addPlacingOptions(JPanel panel) { - CMLabel layoutLabel = new CMLabel(Translations.t("gui_l_layout"), 15, 625, 120, 30); + CMLabel layoutLabel = new CMLabel(Translations.t("gui_l_layout"), 15, 695, 120, 30); layoutSelector = new CMComboBox(LayoutAlgorithm.values()); - layoutSelector.setBounds(145, 625, 120, 30); + layoutSelector.setBounds(145, 695, 120, 30); - showMap = new CMCheckBox(275, 625, 20, 30); - CMLabel showMapLabel = new CMLabel(Translations.t("gui_l_show_map"), 300, 625, 185, 30); + showMap = new CMCheckBox(275, 695, 20, 30); + CMLabel showMapLabel = new CMLabel(Translations.t("gui_l_show_map"), 300, 695, 185, 30); panel.add(layoutLabel); panel.add(layoutSelector); @@ -244,9 +259,9 @@ private final void addPlacingOptions(JPanel panel) { * @param panel The {@link JPanel} to add the components to. */ private final void addMinecraftRootBrowser(JPanel panel) { - CMLabel mcRootLabel = new CMLabel(Translations.t("gui_l_mcroot"), 15, 660, 120, 30); - mcRootPath = new CMTextField(145, 660, 235, 30); - CMButton mcRootBrowse = new CMButton(Translations.t("gui_b_browse"), 385, 660, 100, 30); + CMLabel mcRootLabel = new CMLabel(Translations.t("gui_l_mcroot"), 15, 730, 120, 30); + mcRootPath = new CMTextField(145, 730, 235, 30); + CMButton mcRootBrowse = new CMButton(Translations.t("gui_b_browse"), 385, 730, 100, 30); mcRootBrowse.addActionListener(new BrowseListener(mcRootPath, JFileChooser.DIRECTORIES_ONLY, null)); panel.add(mcRootLabel); @@ -261,7 +276,7 @@ private final void addMinecraftRootBrowser(JPanel panel) { */ private final void addStartButton(JPanel panel) { CodeMetropolisGUI self = this; - CMButton start = new CMButton(Translations.t("gui_b_generate"), 190, 705, 120, 30); + CMButton start = new CMButton(Translations.t("gui_b_generate"), 190, 765, 120, 30); start.addActionListener(new ActionListener() { @Override diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java new file mode 100644 index 00000000..234f6d0c --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -0,0 +1,60 @@ +package codemetropolis.toolchain.gui; + +import java.awt.Dimension; +import java.io.FileNotFoundException; +import java.util.List; +import java.util.Map; + +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JOptionPane; + +import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException; +import codemetropolis.toolchain.gui.utils.BuildableSettings; +import codemetropolis.toolchain.gui.utils.Property; +import codemetropolis.toolchain.gui.utils.PropertyCollector; + +public class MappingFileEditorDialog extends JDialog { + + private static final long serialVersionUID = 1L; + + private Map displayedBuildableAttributes; + private Map> sourceCodeElementProperties; + + public MappingFileEditorDialog(String cdfFilePath, CodeMetropolisGUI cmGui) { + super(cmGui, true); + loadDisplayedInfo(cdfFilePath); + this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); + this.setSize(new Dimension(400, 100)); + this.setLocationRelativeTo(cmGui); + } + + private void loadDisplayedInfo(String cdfFilePath) { + try { + displayedBuildableAttributes = BuildableSettings.readSettings(); + BuildableSettings.displaySettings(); + + PropertyCollector pc = new PropertyCollector(); + sourceCodeElementProperties = pc.getFromCdf(cdfFilePath); + pc.displayProperties(); + } + catch(BadConfigFileFomatException e) { + JOptionPane.showMessageDialog( + null, + "The format of the config file is invalid! All buildable attributes will be displayed.", + "Error", + JOptionPane.ERROR_MESSAGE); + + displayedBuildableAttributes = BuildableSettings.DEFAULT_SETTINGS; + } + catch(FileNotFoundException e) { + JOptionPane.showMessageDialog( + null, + "Config file not found! All buildable attributes will be displayed.", + "Error", + JOptionPane.ERROR_MESSAGE); + + displayedBuildableAttributes = BuildableSettings.DEFAULT_SETTINGS; + } + } +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/MappingEditorListener.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/MappingEditorListener.java new file mode 100644 index 00000000..d6cd6e84 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/MappingEditorListener.java @@ -0,0 +1,37 @@ +package codemetropolis.toolchain.gui.components.listeners; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +import javax.swing.JOptionPane; + +import codemetropolis.toolchain.gui.CodeMetropolisGUI; +import codemetropolis.toolchain.gui.MappingFileEditorDialog; + +public class MappingEditorListener implements ActionListener { + String cdfXmlFilePath; + CodeMetropolisGUI cmGui; + + public MappingEditorListener(String filePath, CodeMetropolisGUI cmGui) { + this.cdfXmlFilePath = filePath; + this.cmGui = cmGui; + } + + @Override + public void actionPerformed(ActionEvent e) { + File cdfXmlFile = new File(cdfXmlFilePath); + if(!cdfXmlFile.exists()) { + JOptionPane.showMessageDialog( + cmGui, + "There is no file existing on the path specified!", + "Error", + JOptionPane.ERROR_MESSAGE); + } + else { + MappingFileEditorDialog dialog = new MappingFileEditorDialog(cdfXmlFilePath, cmGui); + dialog.setVisible(true); + } + } + +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java index 56f1b7d9..f3a1671c 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java @@ -13,15 +13,14 @@ import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException; public class BuildableSettings { + //Map, which contains the default settings of what properties to display to the individual buildable types. + public static final Map DEFAULT_SETTINGS = new HashMap<>(); //Path of the file containing the settings. private static final String CFG_FILEPATH ="./src/main/resources/buildableProperties.cmcfg"; //Map, serves containing the buildable types and its assigned properties. private static Map DISPLAYED_PROPERTIES = new HashMap(); - - //Map, which contains the default settings of what properties to display to the individual buildable types. - public static final Map DEFAULT_SETTINGS = new HashMap<>(); static { DEFAULT_SETTINGS.put("FLOOR", new String[]{"width", "height", "length", "character", "external_character", "torches"}); diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java index 29a6a336..707867e8 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java @@ -7,7 +7,6 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties index f56865a2..67f7f68f 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties @@ -18,6 +18,7 @@ gui_l_sm_exe = SourceMeter exe: # Mapping gui_l_mapping = Mapping xml: +gui_l_source_cdf = Editor's cdf xml: gui_l_scale = Scale: gui_l_validate_structure = Validate structure elements @@ -32,6 +33,7 @@ gui_l_mcroot = Minecraft root: gui_b_close = Close gui_b_browse = Browse gui_b_generate = Generate +gui_b_mapping_file_editor = Mapping file editor... # File filters gui_filter_exe = Executables (*.exe) From dce3a3bea1d67794d963cda7b52370f3d4531569 Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Sun, 15 Apr 2018 11:31:49 +0200 Subject: [PATCH 03/58] Fixed the "file path" issue mentioned in the last commit's commit message. --- .../toolchain/gui/CodeMetropolisGUI.java | 24 ++++++++++++++++--- .../gui/MappingFileEditorDialog.java | 1 - .../listeners/MappingEditorListener.java | 1 + 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java index ebe0da16..9734de68 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java @@ -14,6 +14,7 @@ import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.SwingConstants; @@ -28,7 +29,6 @@ import codemetropolis.toolchain.gui.components.CMSpinner; import codemetropolis.toolchain.gui.components.CMTextField; import codemetropolis.toolchain.gui.components.listeners.BrowseListener; -import codemetropolis.toolchain.gui.components.listeners.MappingEditorListener; import codemetropolis.toolchain.gui.utils.ExecutionWorker; import codemetropolis.toolchain.gui.utils.GuiUtils; import codemetropolis.toolchain.gui.utils.Translations; @@ -200,6 +200,8 @@ private final void addMetricTabs(JPanel panel) { * @param panel The {@link JPanel} to add the components to. */ private final void addMappingOptions(JPanel panel) { + CodeMetropolisGUI self = this; + CMLabel mappingLabel = new CMLabel(Translations.t("gui_l_mapping"), 15, 555, 120, 30); mappingPath = new CMTextField(145, 555, 235, 30); CMButton mappingBrowse = new CMButton(Translations.t("gui_b_browse"), 385, 555, 100, 30); @@ -211,8 +213,24 @@ private final void addMappingOptions(JPanel panel) { CMButton mappingEditorBrowse = new CMButton(Translations.t("gui_b_browse"), 385, 590, 100, 30); mappingEditorBrowse.addActionListener(new BrowseListener(mappingEditorCdfPath, JFileChooser.FILES_ONLY, XML_FILTER)); CMButton mappingEditorButton = new CMButton(Translations.t("gui_b_mapping_file_editor"), 300, 625, 185, 30); - //A mappingEditorCdfPath.getText() paramétert ki kell cserélni egy cdf fájlt reprezentáló útvonallal (string). - mappingEditorButton.addActionListener(new MappingEditorListener(mappingEditorCdfPath.getText(), this)); + mappingEditorButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent event) { + File cdfXmlFile = new File(mappingEditorCdfPath.getText()); + if(!cdfXmlFile.exists()) { + JOptionPane.showMessageDialog( + self, + "There is no file existing on the path specified!", + "Error", + JOptionPane.ERROR_MESSAGE); + } + else { + MappingFileEditorDialog dialog = new MappingFileEditorDialog(mappingEditorCdfPath.getText(), self); + dialog.setVisible(true); + } + } + }); CMLabel scaleLabel = new CMLabel(Translations.t("gui_l_scale"), 15, 660, 120, 30); scaleSpinner = new CMSpinner(145, 660, 120, 30); diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index 234f6d0c..32489645 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -6,7 +6,6 @@ import java.util.Map; import javax.swing.JDialog; -import javax.swing.JFrame; import javax.swing.JOptionPane; import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException; diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/MappingEditorListener.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/MappingEditorListener.java index d6cd6e84..8eec0002 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/MappingEditorListener.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/MappingEditorListener.java @@ -9,6 +9,7 @@ import codemetropolis.toolchain.gui.CodeMetropolisGUI; import codemetropolis.toolchain.gui.MappingFileEditorDialog; +//This class is not used (temporary or forever is not decided yet). public class MappingEditorListener implements ActionListener { String cdfXmlFilePath; CodeMetropolisGUI cmGui; From 41adf3790fefbb69b8a88f4029246fa2be5baced Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Sun, 15 Apr 2018 16:19:39 +0200 Subject: [PATCH 04/58] Add helper bash script. --- iamlazy.bat | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 iamlazy.bat diff --git a/iamlazy.bat b/iamlazy.bat new file mode 100644 index 00000000..e9e88c2a --- /dev/null +++ b/iamlazy.bat @@ -0,0 +1,14 @@ +if not exist "jars\lib" mkdir "jars\lib" + +copy /y "sources\codemetropolis-toolchain-converter\target\codemetropolis-toolchain-converter-1.4.0.jar" "jars\converter.jar" +copy /y "sources\codemetropolis-toolchain-converter\target\lib\*.jar" "jars\lib" + +copy /y "sources\codemetropolis-toolchain-mapping\target\codemetropolis-toolchain-mapping-1.4.0.jar" "jars\mapping.jar" +copy /y "sources\codemetropolis-toolchain-mapping\target\lib\*.jar" "jars\lib" + +copy /y "sources\codemetropolis-toolchain-placing\target\codemetropolis-toolchain-placing-1.4.0.jar" "jars\placing.jar" +copy /y "sources\codemetropolis-toolchain-placing\target\lib\*.jar" "jars\lib" + + +copy /y "sources\codemetropolis-toolchain-rendering\target\codemetropolis-toolchain-rendering-1.4.0.jar" "jars\rendering.jar" +copy /y "sources\codemetropolis-toolchain-rendering\target\lib\*.jar" "jars\lib" \ No newline at end of file From 1469b5e373e1221b91166bdcf2d960f7ae8a7da3 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Sun, 15 Apr 2018 16:55:13 +0200 Subject: [PATCH 05/58] Add new git-inspector converter basics --- .../converter/control/ConverterLoader.java | 3 +++ .../converter/control/ConverterType.java | 1 + .../gitinspector/GitInspectorConverter.java | 21 +++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterLoader.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterLoader.java index 39579620..33f31ec9 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterLoader.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterLoader.java @@ -4,6 +4,7 @@ import codemetropolis.toolchain.commons.cdf.converter.CdfConverter; import codemetropolis.toolchain.converter.sonarqube.SonarQubeConverter; +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; import codemetropolis.toolchain.converter.sourcemeter.GraphConverter; public class ConverterLoader { @@ -12,6 +13,8 @@ private ConverterLoader() {} public static CdfConverter load(ConverterType converterType, Map params) { switch(converterType) { + case GITINSPECTOR: + return new GitInspectorConverter(params); case SOURCEMETER: return new GraphConverter(params); case SONARQUBE: diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterType.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterType.java index da4a69ad..804ed002 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterType.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterType.java @@ -1,6 +1,7 @@ package codemetropolis.toolchain.converter.control; public enum ConverterType { + GITINSPECTOR, SOURCEMETER, SONARQUBE } diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java new file mode 100644 index 00000000..cd21e668 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -0,0 +1,21 @@ +package codemetropolis.toolchain.converter.gitinspector; + +import java.util.Map; + +import codemetropolis.toolchain.commons.cdf.CdfTree; +import codemetropolis.toolchain.commons.cdf.converter.CdfConverter; +import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException; + +public class GitInspectorConverter extends CdfConverter { + + public GitInspectorConverter(Map params) { + super(params); + } + + @Override + public CdfTree createElements(String source) throws CodeMetropolisException { + // TODO Auto-generated method stub + return null; + } + +} From eb5c10f1ff4eb298dd1a9c87a10d497b6d15e13c Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Sun, 15 Apr 2018 23:39:36 +0200 Subject: [PATCH 06/58] Creating the Mapping file editor GUI. (Details are below.) Added resource creating options. Added saving options. Added tabbed pane of the buildable elements. Other minor changes. --- .../toolchain/gui/CodeMetropolisGUI.java | 4 +- .../gui/MappingFileEditorDialog.java | 287 +++++++++++++++++- .../gui/components/CMScrollPane.java | 23 ++ .../main/resources/translations.properties | 28 ++ 4 files changed, 329 insertions(+), 13 deletions(-) create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java index 9734de68..30992a1c 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java @@ -221,8 +221,8 @@ public void actionPerformed(ActionEvent event) { if(!cdfXmlFile.exists()) { JOptionPane.showMessageDialog( self, - "There is no file existing on the path specified!", - "Error", + Translations.t("gui_err_missing_cdf_file"), + Translations.t("gui_err_title"), JOptionPane.ERROR_MESSAGE); } else { diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index 32489645..86b5db32 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -1,17 +1,31 @@ package codemetropolis.toolchain.gui; import java.awt.Dimension; +import java.awt.Font; import java.io.FileNotFoundException; import java.util.List; import java.util.Map; +import javax.swing.DefaultListModel; import javax.swing.JDialog; +import javax.swing.JList; import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.ListModel; +import javax.swing.ListSelectionModel; import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException; +import codemetropolis.toolchain.gui.components.CMButton; +import codemetropolis.toolchain.gui.components.CMCheckBox; +import codemetropolis.toolchain.gui.components.CMLabel; +import codemetropolis.toolchain.gui.components.CMScrollPane; +import codemetropolis.toolchain.gui.components.CMTextField; import codemetropolis.toolchain.gui.utils.BuildableSettings; import codemetropolis.toolchain.gui.utils.Property; import codemetropolis.toolchain.gui.utils.PropertyCollector; +import codemetropolis.toolchain.gui.utils.Translations; public class MappingFileEditorDialog extends JDialog { @@ -20,13 +34,29 @@ public class MappingFileEditorDialog extends JDialog { private Map displayedBuildableAttributes; private Map> sourceCodeElementProperties; - public MappingFileEditorDialog(String cdfFilePath, CodeMetropolisGUI cmGui) { - super(cmGui, true); - loadDisplayedInfo(cdfFilePath); - this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); - this.setSize(new Dimension(400, 100)); - this.setLocationRelativeTo(cmGui); - } + private JTabbedPane buildableTabbedPane; + private JPanel cellarPanel; + private JPanel floorPanel; + private JPanel gardenPanel; + private JPanel groundPanel; + private JTable cellarTable; + private JTable floorTable; + private JTable gardenTable; + + //ListModel and JList for the buildables: cellar, floor, garden + private ListModel cellarListmodel; + private JList cellarList; + private ListModel floorListmodel; + private JList floorList; + private ListModel gardenListmodel; + private JList gardenList; + + //ListModel and JList for the resources + private ListModel resourcesListmodel; + private JList resourcesList; + + private CMCheckBox useMappingCheckBox; + private CMTextField pathField; private void loadDisplayedInfo(String cdfFilePath) { try { @@ -40,8 +70,8 @@ private void loadDisplayedInfo(String cdfFilePath) { catch(BadConfigFileFomatException e) { JOptionPane.showMessageDialog( null, - "The format of the config file is invalid! All buildable attributes will be displayed.", - "Error", + Translations.t("gui_err_invaild_config_file_format"), + Translations.t("gui_err_title"), JOptionPane.ERROR_MESSAGE); displayedBuildableAttributes = BuildableSettings.DEFAULT_SETTINGS; @@ -49,11 +79,246 @@ private void loadDisplayedInfo(String cdfFilePath) { catch(FileNotFoundException e) { JOptionPane.showMessageDialog( null, - "Config file not found! All buildable attributes will be displayed.", - "Error", + Translations.t("gui_err_invaild_config_file_format"), + Translations.t("gui_err_title"), JOptionPane.ERROR_MESSAGE); displayedBuildableAttributes = BuildableSettings.DEFAULT_SETTINGS; } } + + public MappingFileEditorDialog(String cdfFilePath, CodeMetropolisGUI cmGui) { + super(cmGui, Translations.t("gui_mapping_editor_title") ,true); + loadDisplayedInfo(cdfFilePath); + + JPanel panel = createBasePanel(); + addResourceOptions(panel); + addSaveOptions(panel); + addBuildableTabs(panel); + addConversionOptions(panel); + + this.setResizable(false); + this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); + this.setContentPane(panel); + this.pack(); + this.setLocationRelativeTo(cmGui); + } + + private JPanel createBasePanel() { + JPanel panel = new JPanel(); + panel.setLayout(null); + panel.setBounds(0, 0, 800, 500); + + Dimension size = new Dimension(800, 500); + panel.setMinimumSize(size); + panel.setPreferredSize(size); + panel.setMaximumSize(size); + + return panel; + } + + private void addResourceOptions(JPanel panel) { + CMLabel resourcesLabel = new CMLabel(Translations.t("gui_l_resources"), 10, 0, 120, 30); + + resourcesListmodel = new DefaultListModel(); + resourcesList = new JList(resourcesListmodel); + resourcesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + resourcesList.setLayoutOrientation(JList.VERTICAL); + resourcesList.setVisibleRowCount(-1); + CMScrollPane resourcesScrollPane = new CMScrollPane(resourcesList, 10, 35, 240, 120); + + CMButton resourcesAddButton = new CMButton(Translations.t("gui_b_add"), 265, 35, 120, 30); + CMButton resourcesRemoveButton = new CMButton(Translations.t("gui_b_remove"), 265, 80, 120, 30); + + panel.add(resourcesLabel); + panel.add(resourcesScrollPane); + panel.add(resourcesAddButton); + panel.add(resourcesRemoveButton); + } + + + private void addSaveOptions(JPanel panel) { + CMLabel saveSettingsLabel = new CMLabel(Translations.t("gui_l_save_settings"), 415, 0, 120, 30); + CMLabel pathLabel = new CMLabel(Translations.t("gui_l_path"), 415, 35, 60, 30); + pathField = new CMTextField(475, 35, 270, 30); + CMButton specifyPathButton = new CMButton(Translations.t("gui_b_specify_path"), 415, 80, 120, 30); + useMappingCheckBox = new CMCheckBox(550, 80, 30, 30); + CMLabel useMappingLabel = new CMLabel(Translations.t("gui_l_use_mapping_file"),575, 80, 180, 30); + CMButton saveMappingFileButton = new CMButton(Translations.t("gui_b_save_mapping_file"), 415, 120, 165, 30); + + panel.add(saveSettingsLabel); + panel.add(pathLabel); + panel.add(pathField); + panel.add(specifyPathButton); + panel.add(useMappingCheckBox); + panel.add(useMappingLabel); + panel.add(saveMappingFileButton); + } + + private void addBuildableTabs(JPanel panel) { + buildableTabbedPane = new JTabbedPane(); + + createCellarTab(); + createFloorTab(); + createGardenTab(); + createGroundTab(); + + buildableTabbedPane.add(Translations.t("gui_tab_cellar"), cellarPanel); + buildableTabbedPane.add(Translations.t("gui_tab_floor"), floorPanel); + buildableTabbedPane.add(Translations.t("gui_tab_garden"), gardenPanel); + buildableTabbedPane.add(Translations.t("gui_tab_ground"), groundPanel); + + buildableTabbedPane.setFont(new Font("Source Sans Pro", Font.PLAIN, 16)); + buildableTabbedPane.setBounds(10, 175, 780, 270); + + panel.add(buildableTabbedPane); + + } + + private void createCellarTab() { + cellarPanel = new JPanel(); + cellarPanel.setLayout(null); + cellarPanel.setBounds(0, 0, 780, 255); + + Dimension size = new Dimension(780, 255); + cellarPanel.setMinimumSize(size); + cellarPanel.setPreferredSize(size); + cellarPanel.setMaximumSize(size); + + CMLabel assignedLabel = new CMLabel(Translations.t("gui_l_assigned_to"), 15, 15, 270, 30); + CMLabel attributeLabel = new CMLabel(Translations.t("gui_l_attribute"), 270, 15, 60, 30); + CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30); + + cellarTable = setUpBuildableTable("CELLAR"); + + cellarListmodel = initializeListModel("attribute"); + cellarList = new JList(cellarListmodel); + cellarList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + cellarList.setLayoutOrientation(JList.VERTICAL); + cellarList.setVisibleRowCount(-1); + + CMScrollPane cellarScrollPane = new CMScrollPane(cellarList, 525, 50, 240, 180); + + cellarPanel.add(assignedLabel); + cellarPanel.add(attributeLabel); + cellarPanel.add(propertiesLabel); + cellarPanel.add(cellarTable); + cellarPanel.add(cellarScrollPane); + } + + private void createFloorTab() { + floorPanel = new JPanel(); + floorPanel.setLayout(null); + floorPanel.setBounds(0, 0, 780, 255); + + Dimension size = new Dimension(780, 255); + floorPanel.setMinimumSize(size); + floorPanel.setPreferredSize(size); + floorPanel.setMaximumSize(size); + + CMLabel assignedLabel = new CMLabel(Translations.t("gui_l_assigned_to"), 15, 15, 270, 30); + CMLabel methodLabel = new CMLabel(Translations.t("gui_l_method"), 270, 15, 60, 30); + CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30); + + floorTable = setUpBuildableTable("FLOOR"); + + floorListmodel = initializeListModel("method"); + floorList = new JList(floorListmodel); + floorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + floorList.setLayoutOrientation(JList.VERTICAL); + floorList.setVisibleRowCount(-1); + + CMScrollPane floorScrollPane = new CMScrollPane(floorList, 525, 50, 240, 180); + + floorPanel.add(assignedLabel); + floorPanel.add(methodLabel); + floorPanel.add(propertiesLabel); + floorPanel.add(floorTable); + floorPanel.add(floorScrollPane); + } + + private void createGardenTab() { + gardenPanel = new JPanel(); + gardenPanel.setLayout(null); + gardenPanel.setBounds(0, 0, 780, 255); + + Dimension size = new Dimension(780, 255); + gardenPanel.setMinimumSize(size); + gardenPanel.setPreferredSize(size); + gardenPanel.setMaximumSize(size); + + CMLabel assignedLabel = new CMLabel(Translations.t("gui_l_assigned_to"), 15, 15, 270, 30); + CMLabel classLabel = new CMLabel(Translations.t("gui_l_class"), 270, 15, 60, 30); + CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30); + + gardenTable = setUpBuildableTable("GARDEN"); + + gardenListmodel = initializeListModel("class"); + gardenList = new JList(gardenListmodel); + gardenList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + gardenList.setLayoutOrientation(JList.VERTICAL); + gardenList.setVisibleRowCount(-1); + + CMScrollPane gardenScrollPane = new CMScrollPane(gardenList, 525, 50, 240, 180); + + gardenPanel.add(assignedLabel); + gardenPanel.add(classLabel); + gardenPanel.add(propertiesLabel); + gardenPanel.add(gardenTable); + gardenPanel.add(gardenScrollPane); + } + + private void createGroundTab() { + groundPanel = new JPanel(); + groundPanel.setLayout(null); + groundPanel.setBounds(0, 0, 780, 255); + + Dimension size = new Dimension(780, 255); + groundPanel.setMinimumSize(size); + groundPanel.setPreferredSize(size); + groundPanel.setMaximumSize(size); + + CMLabel assignedLabel = new CMLabel(Translations.t("gui_l_assigned_to"), 15, 15, 270, 30); + CMLabel packageLabel = new CMLabel(Translations.t("gui_l_package"), 270, 15, 60, 30); + CMLabel noAttrsLabel = new CMLabel(Translations.t("gui_l_no_attributes"), 15, 60, 300, 30); + + groundPanel.add(assignedLabel); + groundPanel.add(packageLabel); + groundPanel.add(noAttrsLabel); + } + + private JTable setUpBuildableTable(String buildableType) { + String[] displayedProperties = displayedBuildableAttributes.get(buildableType); + + Object[] columnNames = new String[] {Translations.t("gui_t_attribute"), Translations.t("gui_t_assigned_property")}; + Object[][] initData = new Object[displayedProperties.length][2]; + + for(int i = 0; i < displayedProperties.length; i++) { + initData[i][0] = displayedProperties[i]; + initData[i][1] = null; + } + + JTable table = new JTable(initData, columnNames); + table.setFont(new Font("Source Sans Pro", Font.PLAIN, 14)); + table.setRowHeight(30); + table.setBounds(15, 50, 480, displayedProperties.length * 30); + return table; + } + + private ListModel initializeListModel(String sourceCodeElementType) { + List propertyList = sourceCodeElementProperties.get(sourceCodeElementType); + + DefaultListModel model = new DefaultListModel(); + + for(Property p : propertyList) { + model.addElement(p.name + ": " + p.type); + } + + return model; + } + + private void addConversionOptions(JPanel panel) { + CMButton conversionButton = new CMButton(Translations.t("gui_b_conversions"), 10, 460, 150, 30); + panel.add(conversionButton); + } } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java new file mode 100644 index 00000000..146c0eab --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java @@ -0,0 +1,23 @@ +package codemetropolis.toolchain.gui.components; + +import java.awt.Font; + +import javax.swing.JList; +import javax.swing.JScrollPane; + +public class CMScrollPane extends JScrollPane { + + private static final long serialVersionUID = 1L; + + private static final Font SCROLL_PANE_FONT = new Font("Source Sans Pro", Font.PLAIN, 14); + + public CMScrollPane() { + setFont(SCROLL_PANE_FONT); + } + + public CMScrollPane(JList list, int x, int y, int width, int height) { + super(list); + setFont(SCROLL_PANE_FONT); + setBounds(x, y, width, height); + } +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties index 67f7f68f..255e8b31 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties @@ -47,15 +47,43 @@ gui_info_world_gen_successful = World generation successfully finished! gui_info_sm_exec_started = Running SourceMeter metric generation... gui_exec_title = Execution output +# Mapping file editor dialog +gui_mapping_editor_title = Mapping file editor +gui_b_add = Add +gui_b_conversions = Conversions... +gui_b_remove = Remove +gui_b_specify_path = Specify path +gui_b_save_mapping_file = Save mapping file +gui_l_assigned_to = Assigned to the source code element: +gui_l_attribute = attribute +gui_l_class = class +gui_l_method = method +gui_l_no_attributes = There is no buildable attribute to adjust. +gui_l_package = package +gui_l_use_mapping_file = I want to use this file now +gui_l_resources = Resources: +gui_l_save_settings = Save settings: +gui_l_path = Path: +gui_l_properties = Properties: +gui_t_attribute = Attribute +gui_t_assigned_propery = Assigned property +gui_tab_cellar = Cellar +gui_tab_floor = Floor +gui_tab_garden = Garden +gui_tab_ground = Ground + # Errors gui_err_title = Error +gui_err_config_file_not_found = Config file not found! All buildable attributes will be displayed. gui_err_graph_not_found = SourceMeter graph file not found at the expected location! +gui_err_invaild_config_file_format = Invalid config file format! All buildable attributes will be displayed. gui_err_invalid_converter = Invalid converter type! gui_err_invalid_mapping_xml = Invalid mapping xml file! gui_err_invalid_mc_root = Invalid minecraft root! gui_err_invalid_project_name = Invalid project name! gui_err_invalid_project_root = Invalid project root! gui_err_invalid_sm_exe = Invalid SourceMeter exe file! +gui_err_missing_cdf_file = There is no file existing on the path specified! gui_err_mkdir_project_failed = Failed to create project folder under minecraft root! gui_err_mkdir_sm_failed = Failed to create SourceMeter results folder! gui_err_sm_exec_failed = Error during SourceMeter execution! From ac5f3ac658f22e9e31e26523b1cd4c35b8fd176e Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Mon, 16 Apr 2018 19:24:49 +0200 Subject: [PATCH 07/58] Resource management: resources (constants) can be added and removed. Added file chooser to specify the mapping file saving path. --- .../gui/MappingFileEditorDialog.java | 71 ++++++++++++++++++- .../main/resources/translations.properties | 2 + 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index 86b5db32..32efefa2 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -2,19 +2,27 @@ import java.awt.Dimension; import java.awt.Font; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.io.FileNotFoundException; +import java.util.Arrays; import java.util.List; import java.util.Map; import javax.swing.DefaultListModel; import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTable; +import javax.swing.JTextField; import javax.swing.ListModel; import javax.swing.ListSelectionModel; +import javax.swing.filechooser.FileFilter; import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException; import codemetropolis.toolchain.gui.components.CMButton; @@ -22,15 +30,19 @@ import codemetropolis.toolchain.gui.components.CMLabel; import codemetropolis.toolchain.gui.components.CMScrollPane; import codemetropolis.toolchain.gui.components.CMTextField; +import codemetropolis.toolchain.gui.components.listeners.BrowseListener; import codemetropolis.toolchain.gui.utils.BuildableSettings; import codemetropolis.toolchain.gui.utils.Property; import codemetropolis.toolchain.gui.utils.PropertyCollector; import codemetropolis.toolchain.gui.utils.Translations; +import codemetropolis.toolchain.gui.utils.XmlFileFilter; public class MappingFileEditorDialog extends JDialog { private static final long serialVersionUID = 1L; + private static final FileFilter XML_FILTER = new XmlFileFilter(); + private Map displayedBuildableAttributes; private Map> sourceCodeElementProperties; @@ -128,7 +140,56 @@ private void addResourceOptions(JPanel panel) { CMScrollPane resourcesScrollPane = new CMScrollPane(resourcesList, 10, 35, 240, 120); CMButton resourcesAddButton = new CMButton(Translations.t("gui_b_add"), 265, 35, 120, 30); + resourcesAddButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + JTextField nameField = new JTextField(); + JTextField valueField = new JTextField(); + + JPanel addResourcePanel = new JPanel(); + addResourcePanel.setLayout(new GridLayout(4, 2)); + addResourcePanel.add(new JLabel("Resource name:")); + addResourcePanel.add(nameField); + addResourcePanel.add(new JLabel("Resource value:")); + addResourcePanel.add(valueField); + + int result = JOptionPane.showConfirmDialog(null, addResourcePanel, Translations.t("gui_add_resource_title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); + if(result == JOptionPane.OK_OPTION) { + //Produce the resource string from the text fields... + String resourceToAdd = nameField.getText() + ": " + valueField.getText(); + //Add the newly defined resource to the property lists of the buildables and to the resource list (on top left of the window). + List> lists = Arrays.asList(resourcesList, cellarList, floorList, gardenList); + for(JList list : lists) { + DefaultListModel listModel = (DefaultListModel) list.getModel(); + listModel.addElement(resourceToAdd); + } + } + } + }); CMButton resourcesRemoveButton = new CMButton(Translations.t("gui_b_remove"), 265, 80, 120, 30); + resourcesRemoveButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + int indexToRemove = resourcesList.getSelectedIndex(); + if(indexToRemove == -1) { + JOptionPane.showMessageDialog( + null, + Translations.t("gui_err_resources_empty_no_selected"), + Translations.t("gui_err_title"), + JOptionPane.ERROR_MESSAGE); + } + else { + String resoureToRemove = resourcesList.getModel().getElementAt(indexToRemove); + List> lists = Arrays.asList(resourcesList, cellarList, floorList, gardenList); + for(JList list : lists) { + DefaultListModel listModel = (DefaultListModel) list.getModel(); + listModel.removeElement(resoureToRemove); + } + } + } + }); panel.add(resourcesLabel); panel.add(resourcesScrollPane); @@ -145,6 +206,7 @@ private void addSaveOptions(JPanel panel) { useMappingCheckBox = new CMCheckBox(550, 80, 30, 30); CMLabel useMappingLabel = new CMLabel(Translations.t("gui_l_use_mapping_file"),575, 80, 180, 30); CMButton saveMappingFileButton = new CMButton(Translations.t("gui_b_save_mapping_file"), 415, 120, 165, 30); + specifyPathButton.addActionListener(new BrowseListener(pathField, JFileChooser.FILES_ONLY, XML_FILTER)); panel.add(saveSettingsLabel); panel.add(pathLabel); @@ -192,7 +254,8 @@ private void createCellarTab() { cellarTable = setUpBuildableTable("CELLAR"); cellarListmodel = initializeListModel("attribute"); - cellarList = new JList(cellarListmodel); + cellarList = new JList(); + cellarList.setModel(cellarListmodel); cellarList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); cellarList.setLayoutOrientation(JList.VERTICAL); cellarList.setVisibleRowCount(-1); @@ -223,7 +286,8 @@ private void createFloorTab() { floorTable = setUpBuildableTable("FLOOR"); floorListmodel = initializeListModel("method"); - floorList = new JList(floorListmodel); + floorList = new JList(); + floorList.setModel(floorListmodel); floorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); floorList.setLayoutOrientation(JList.VERTICAL); floorList.setVisibleRowCount(-1); @@ -254,7 +318,8 @@ private void createGardenTab() { gardenTable = setUpBuildableTable("GARDEN"); gardenListmodel = initializeListModel("class"); - gardenList = new JList(gardenListmodel); + gardenList = new JList(); + gardenList.setModel(gardenListmodel); gardenList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); gardenList.setLayoutOrientation(JList.VERTICAL); gardenList.setVisibleRowCount(-1); diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties index 255e8b31..23c5ef5e 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties @@ -48,6 +48,7 @@ gui_info_sm_exec_started = Running SourceMeter metric generation... gui_exec_title = Execution output # Mapping file editor dialog +gui_add_resource_title = Add new resource... gui_mapping_editor_title = Mapping file editor gui_b_add = Add gui_b_conversions = Conversions... @@ -83,6 +84,7 @@ gui_err_invalid_mc_root = Invalid minecraft root! gui_err_invalid_project_name = Invalid project name! gui_err_invalid_project_root = Invalid project root! gui_err_invalid_sm_exe = Invalid SourceMeter exe file! +gui_err_resources_empty_no_selected = The list of the resources is empty or there is no resource selected! gui_err_missing_cdf_file = There is no file existing on the path specified! gui_err_mkdir_project_failed = Failed to create project folder under minecraft root! gui_err_mkdir_sm_failed = Failed to create SourceMeter results folder! From 11e93b086604e6a45322d90fa66256244a340493 Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Tue, 17 Apr 2018 09:09:23 +0200 Subject: [PATCH 08/58] Added javadoc comments to the mapping file editor dialog. --- .../gui/MappingFileEditorDialog.java | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index 32efefa2..edf5e39a 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -37,6 +37,10 @@ import codemetropolis.toolchain.gui.utils.Translations; import codemetropolis.toolchain.gui.utils.XmlFileFilter; +/** + * Dialog for the mapping file editor. + * + */ public class MappingFileEditorDialog extends JDialog { private static final long serialVersionUID = 1L; @@ -70,6 +74,11 @@ public class MappingFileEditorDialog extends JDialog { private CMCheckBox useMappingCheckBox; private CMTextField pathField; + /** + * Loads the list of the buildable attributes which are desired to display on the GUI from the configuration file. + * Loads the list of the source code element from the given input cdf xml file. + * @param cdfFilePath The path of the input cdf xml file. + */ private void loadDisplayedInfo(String cdfFilePath) { try { displayedBuildableAttributes = BuildableSettings.readSettings(); @@ -99,6 +108,12 @@ private void loadDisplayedInfo(String cdfFilePath) { } } + /** + * Instantiates the Mapping file editor dialog. + * + * @param cdfFilePath The path of the input cdf xml file. + * @param cmGui The parent window of the dialog. + */ public MappingFileEditorDialog(String cdfFilePath, CodeMetropolisGUI cmGui) { super(cmGui, Translations.t("gui_mapping_editor_title") ,true); loadDisplayedInfo(cdfFilePath); @@ -116,6 +131,11 @@ public MappingFileEditorDialog(String cdfFilePath, CodeMetropolisGUI cmGui) { this.setLocationRelativeTo(cmGui); } + /** + * Creates the base panel for the Mapping file editor dialog. + * + * @return The created {@link JPanel}. + */ private JPanel createBasePanel() { JPanel panel = new JPanel(); panel.setLayout(null); @@ -129,6 +149,10 @@ private JPanel createBasePanel() { return panel; } + /** + * Adds the resource options to the {@code panel}. + * @param panel The {@link JPanel} to which the components will be added to. + */ private void addResourceOptions(JPanel panel) { CMLabel resourcesLabel = new CMLabel(Translations.t("gui_l_resources"), 10, 0, 120, 30); @@ -197,7 +221,10 @@ public void actionPerformed(ActionEvent e) { panel.add(resourcesRemoveButton); } - + /** + * Adds the saving options to the {@code panel}. + * @param panel The {@link JPanel} to which the components will be added to. + */ private void addSaveOptions(JPanel panel) { CMLabel saveSettingsLabel = new CMLabel(Translations.t("gui_l_save_settings"), 415, 0, 120, 30); CMLabel pathLabel = new CMLabel(Translations.t("gui_l_path"), 415, 35, 60, 30); @@ -217,6 +244,10 @@ private void addSaveOptions(JPanel panel) { panel.add(saveMappingFileButton); } + /** + * Adds the the tabs of the buildables to the {@code buildableTabbedPane} {@link JTabbedPane}. + * @param panel The {@link JPanel} to which the {@code buildableTabbedPane} will be added to. + */ private void addBuildableTabs(JPanel panel) { buildableTabbedPane = new JTabbedPane(); @@ -237,6 +268,9 @@ private void addBuildableTabs(JPanel panel) { } + /** + * Creates the tab to the buildable type cellar, where the buildable attributes and their desired values can be paired. + */ private void createCellarTab() { cellarPanel = new JPanel(); cellarPanel.setLayout(null); @@ -269,6 +303,9 @@ private void createCellarTab() { cellarPanel.add(cellarScrollPane); } + /** + * Creates the tab to the buildable type floor, where the buildable attributes and their desired values can be paired. + */ private void createFloorTab() { floorPanel = new JPanel(); floorPanel.setLayout(null); @@ -301,6 +338,9 @@ private void createFloorTab() { floorPanel.add(floorScrollPane); } + /** + * Creates the tab to the buildable type garden, where the buildable attributes and their desired values can be paired. + */ private void createGardenTab() { gardenPanel = new JPanel(); gardenPanel.setLayout(null); @@ -333,6 +373,9 @@ private void createGardenTab() { gardenPanel.add(gardenScrollPane); } + /** + * Creates the tab to the buildable type ground. + */ private void createGroundTab() { groundPanel = new JPanel(); groundPanel.setLayout(null); @@ -352,6 +395,11 @@ private void createGroundTab() { groundPanel.add(noAttrsLabel); } + /** + * Sets up the table of a buildable type which contains the attributes of the buildable (height, character, etc.) and provides a second column for their values. + * @param buildableType The type of the buildable (method, attribute, etc.). + * @return The JTable contains the buildable attributes. + */ private JTable setUpBuildableTable(String buildableType) { String[] displayedProperties = displayedBuildableAttributes.get(buildableType); @@ -370,6 +418,11 @@ private JTable setUpBuildableTable(String buildableType) { return table; } + /** + * Fills up the list model of the given source code element type with its own properties/metrics. + * @param sourceCodeElementType Type of the source code element (method, attribute, etc.). + * @return The {@link ListModel} contains all of the properties/metrics. + */ private ListModel initializeListModel(String sourceCodeElementType) { List propertyList = sourceCodeElementProperties.get(sourceCodeElementType); @@ -382,6 +435,10 @@ private ListModel initializeListModel(String sourceCodeElementType) { return model; } + /** + * Adds the conversion options to the {@code panel}. + * @param panel The {@link JPanel} to which the options will be added to. + */ private void addConversionOptions(JPanel panel) { CMButton conversionButton = new CMButton(Translations.t("gui_b_conversions"), 10, 460, 150, 30); panel.add(conversionButton); From 09d543176ad93b887cb546f06d3aa81f3e18049c Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Tue, 17 Apr 2018 15:04:36 +0200 Subject: [PATCH 09/58] Implement git-inspector converter --- .../gitinspector/GitInspectorConverter.java | 151 +++++++++++++++++- 1 file changed, 149 insertions(+), 2 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index cd21e668..353d1832 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -1,21 +1,168 @@ package codemetropolis.toolchain.converter.gitinspector; +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; import java.util.Map; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.DocumentBuilder; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; +import org.w3c.dom.Node; +import org.w3c.dom.Element; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.commons.cdf.CdfProperty; import codemetropolis.toolchain.commons.cdf.CdfTree; import codemetropolis.toolchain.commons.cdf.converter.CdfConverter; import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException; public class GitInspectorConverter extends CdfConverter { + private static final String CHANGES_TAG = "changes"; + private static final String EMAIL_TAG = "email"; + private static final String BLAME_TAG = "blame"; + private static final String AUTHOR_TAG = "author"; + private static final String NAME_TAG = "name"; + private static final String COMMITS_TAG = "commits"; + private static final String INSERTIONS_TAG = "insertions"; + private static final String DELETIONS_TAG = "deletions"; + private static final String POC_TAG = "percentage-of-changes"; + private static final String POC_SHORT = "POC"; + private static final String ROWS_TAG = "rows"; + private static final String STABILITY_TAG = "stability"; + private static final String AGE_TAG = "age"; + private static final String PIC_TAG = "percentage-in-comments"; + private static final String PIC_SHORT = "PIC"; + private static final String FLOOR_TAG = "floor-metrics"; + private static final String REPOSITORY_TAG = "repository"; + private static final String DATE_TAG = "report-date"; + + private HashMap cdfElements; + CdfElement authorMetrics; + CdfElement floorMetrics; + public GitInspectorConverter(Map params) { super(params); + cdfElements = new HashMap(); + authorMetrics = new CdfElement("", AUTHOR_TAG); + floorMetrics = new CdfElement("", FLOOR_TAG); } @Override public CdfTree createElements(String source) throws CodeMetropolisException { - // TODO Auto-generated method stub - return null; + Document doc = createDocumentFromSource(source); + CdfElement rootElement = createRootelement(doc); + traverseNodesFromDocument(doc); + for (CdfElement element : cdfElements.values()) { + rootElement.addChildElement(element); + } + return new CdfTree(rootElement); + } + + private CdfElement createRootelement(Document doc) { + StringBuilder rootName = new StringBuilder(doc.getElementsByTagName(REPOSITORY_TAG).item(0).getTextContent()); + rootName.append(" "); + rootName.append(doc.getElementsByTagName(DATE_TAG).item(0).getTextContent()); + return new CdfElement(rootName.toString(), "root"); + } + + private Document createDocumentFromSource(String sourcePath) throws CodeMetropolisException { + try { + File inputFile = new File(sourcePath); + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); + Document doc = dBuilder.parse(inputFile); + return doc; + } catch (Exception e) { + throw new CodeMetropolisException(e.getMessage()); + } + } + + private void traverseNodesFromDocument(Document doc) { + Node changesNode = doc.getElementsByTagName(CHANGES_TAG).item(0); + Node authorsNode = changesNode.getChildNodes().item(3); + NodeList authorNodes = authorsNode.getChildNodes(); + + for (int i = 0; i < authorNodes.getLength(); ++i) { + Node authorNode = authorNodes.item(i); + if (authorNode.getNodeType() == Node.ELEMENT_NODE) { + Element authorElement = (Element) authorNode; + CdfElement element = getMetricsFromFirstAuthorElementNode(authorElement); + String name = authorElement.getElementsByTagName(NAME_TAG).item(0).getTextContent(); + cdfElements.put(name, element); + } + } + + Node blameNode = doc.getElementsByTagName(BLAME_TAG).item(0); + authorsNode = blameNode.getChildNodes().item(3); + authorNodes = authorsNode.getChildNodes(); + + for (int i = 0; i < authorNodes.getLength(); ++i) { + Node authorNode = authorNodes.item(i); + if (authorNode.getNodeType() == Node.ELEMENT_NODE) { + Element authorElement = (Element) authorNode; + String name = authorElement.getElementsByTagName(NAME_TAG).item(0).getTextContent(); + + CdfElement element = cdfElements.get(name); + if (element != null) { + element = updateMetricsFromSecondAuthorElementNode(authorElement, element); + cdfElements.put(name, element); + } + } + } } + private CdfElement getMetricsFromFirstAuthorElementNode(Element authorElement) { + String name = authorElement.getElementsByTagName(NAME_TAG).item(0).getTextContent(); + resetMetrics(name); + + updateMetrics(authorElement, EMAIL_TAG, EMAIL_TAG, CdfProperty.Type.STRING, false); + updateMetrics(authorElement, COMMITS_TAG, COMMITS_TAG, CdfProperty.Type.INT, false); + updateMetrics(authorElement, INSERTIONS_TAG, INSERTIONS_TAG, CdfProperty.Type.INT, true); + updateMetrics(authorElement, DELETIONS_TAG, DELETIONS_TAG, CdfProperty.Type.INT, true); + updateMetrics(authorElement, POC_TAG, POC_SHORT, CdfProperty.Type.FLOAT, false); + + authorMetrics.addChildElement(floorMetrics); + return authorMetrics; + } + + private CdfElement updateMetricsFromSecondAuthorElementNode(Element authorElement, CdfElement element) { + authorMetrics = element; + floorMetrics = authorMetrics.getChildElements().get(0); + authorMetrics.removeChildElement(floorMetrics); + + updateMetrics(authorElement, ROWS_TAG, ROWS_TAG, CdfProperty.Type.INT, true); + updateMetrics(authorElement, STABILITY_TAG, STABILITY_TAG, CdfProperty.Type.FLOAT, false); + updateMetrics(authorElement, AGE_TAG, AGE_TAG, CdfProperty.Type.FLOAT, false); + updateMetrics(authorElement, PIC_TAG, PIC_SHORT, CdfProperty.Type.FLOAT, false); + + authorMetrics.addChildElement(floorMetrics); + return authorMetrics; + } + + private String downscalePossibleLargeNumericValue(String numberString) { + int number = Integer.parseInt(numberString); + int newValue = (int) Math.floor(Math.sqrt(number)); + return Integer.toString(newValue); + } + + private void updateMetrics(Element authorElement, String readTag, + String writeTag, CdfProperty.Type type, boolean remapNumeric) { + String metricValue = authorElement.getElementsByTagName(readTag).item(0).getTextContent(); + if (remapNumeric) { + metricValue = downscalePossibleLargeNumericValue(metricValue); + } + authorMetrics.addProperty(writeTag, metricValue, type); + floorMetrics.addProperty(writeTag, metricValue, type); + } + + private void resetMetrics(String name) { + authorMetrics = new CdfElement(name, AUTHOR_TAG); + floorMetrics = new CdfElement(name, FLOOR_TAG); + } } From 9ed02958966f26c2ade6a41af0bfed6908ab79cb Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Tue, 17 Apr 2018 20:32:28 +0200 Subject: [PATCH 10/58] Fixed missing table headers. --- .../gui/MappingFileEditorDialog.java | 41 +++++++++++-------- .../gui/components/CMScrollPane.java | 7 ++++ 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index edf5e39a..0daa9d57 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -5,6 +5,7 @@ import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.Rectangle; import java.io.FileNotFoundException; import java.util.Arrays; import java.util.List; @@ -139,9 +140,9 @@ public MappingFileEditorDialog(String cdfFilePath, CodeMetropolisGUI cmGui) { private JPanel createBasePanel() { JPanel panel = new JPanel(); panel.setLayout(null); - panel.setBounds(0, 0, 800, 500); + panel.setBounds(0, 0, 800, 550); - Dimension size = new Dimension(800, 500); + Dimension size = new Dimension(800, 550); panel.setMinimumSize(size); panel.setPreferredSize(size); panel.setMaximumSize(size); @@ -262,7 +263,7 @@ private void addBuildableTabs(JPanel panel) { buildableTabbedPane.add(Translations.t("gui_tab_ground"), groundPanel); buildableTabbedPane.setFont(new Font("Source Sans Pro", Font.PLAIN, 16)); - buildableTabbedPane.setBounds(10, 175, 780, 270); + buildableTabbedPane.setBounds(10, 175, 780, 300); panel.add(buildableTabbedPane); @@ -274,9 +275,9 @@ private void addBuildableTabs(JPanel panel) { private void createCellarTab() { cellarPanel = new JPanel(); cellarPanel.setLayout(null); - cellarPanel.setBounds(0, 0, 780, 255); + cellarPanel.setBounds(0, 0, 780, 285); - Dimension size = new Dimension(780, 255); + Dimension size = new Dimension(780, 285); cellarPanel.setMinimumSize(size); cellarPanel.setPreferredSize(size); cellarPanel.setMaximumSize(size); @@ -286,6 +287,8 @@ private void createCellarTab() { CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30); cellarTable = setUpBuildableTable("CELLAR"); + Rectangle bounds = cellarTable.getBounds(); + CMScrollPane scrollPane = new CMScrollPane(cellarTable, bounds.x, bounds.y, bounds.width, bounds.height + 30); cellarListmodel = initializeListModel("attribute"); cellarList = new JList(); @@ -299,7 +302,7 @@ private void createCellarTab() { cellarPanel.add(assignedLabel); cellarPanel.add(attributeLabel); cellarPanel.add(propertiesLabel); - cellarPanel.add(cellarTable); + cellarPanel.add(scrollPane); cellarPanel.add(cellarScrollPane); } @@ -309,9 +312,9 @@ private void createCellarTab() { private void createFloorTab() { floorPanel = new JPanel(); floorPanel.setLayout(null); - floorPanel.setBounds(0, 0, 780, 255); + floorPanel.setBounds(0, 0, 780, 285); - Dimension size = new Dimension(780, 255); + Dimension size = new Dimension(780, 285); floorPanel.setMinimumSize(size); floorPanel.setPreferredSize(size); floorPanel.setMaximumSize(size); @@ -321,6 +324,8 @@ private void createFloorTab() { CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30); floorTable = setUpBuildableTable("FLOOR"); + Rectangle bounds = floorTable.getBounds(); + CMScrollPane scrollPane = new CMScrollPane(floorTable, bounds.x, bounds.y, bounds.width, bounds.height + 30); floorListmodel = initializeListModel("method"); floorList = new JList(); @@ -334,7 +339,7 @@ private void createFloorTab() { floorPanel.add(assignedLabel); floorPanel.add(methodLabel); floorPanel.add(propertiesLabel); - floorPanel.add(floorTable); + floorPanel.add(scrollPane); floorPanel.add(floorScrollPane); } @@ -344,18 +349,20 @@ private void createFloorTab() { private void createGardenTab() { gardenPanel = new JPanel(); gardenPanel.setLayout(null); - gardenPanel.setBounds(0, 0, 780, 255); + gardenPanel.setBounds(0, 0, 780, 285); - Dimension size = new Dimension(780, 255); + Dimension size = new Dimension(780, 285); gardenPanel.setMinimumSize(size); gardenPanel.setPreferredSize(size); gardenPanel.setMaximumSize(size); CMLabel assignedLabel = new CMLabel(Translations.t("gui_l_assigned_to"), 15, 15, 270, 30); CMLabel classLabel = new CMLabel(Translations.t("gui_l_class"), 270, 15, 60, 30); - CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30); + CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30); gardenTable = setUpBuildableTable("GARDEN"); + Rectangle bounds = gardenTable.getBounds(); + CMScrollPane scrollPane = new CMScrollPane(gardenTable, bounds.x, bounds.y, bounds.width, bounds.height + 30); gardenListmodel = initializeListModel("class"); gardenList = new JList(); @@ -369,7 +376,7 @@ private void createGardenTab() { gardenPanel.add(assignedLabel); gardenPanel.add(classLabel); gardenPanel.add(propertiesLabel); - gardenPanel.add(gardenTable); + gardenPanel.add(scrollPane); gardenPanel.add(gardenScrollPane); } @@ -379,9 +386,9 @@ private void createGardenTab() { private void createGroundTab() { groundPanel = new JPanel(); groundPanel.setLayout(null); - groundPanel.setBounds(0, 0, 780, 255); + groundPanel.setBounds(0, 0, 780, 285); - Dimension size = new Dimension(780, 255); + Dimension size = new Dimension(780, 285); groundPanel.setMinimumSize(size); groundPanel.setPreferredSize(size); groundPanel.setMaximumSize(size); @@ -403,7 +410,7 @@ private void createGroundTab() { private JTable setUpBuildableTable(String buildableType) { String[] displayedProperties = displayedBuildableAttributes.get(buildableType); - Object[] columnNames = new String[] {Translations.t("gui_t_attribute"), Translations.t("gui_t_assigned_property")}; + Object[] columnNames = new String[] {Translations.t("gui_t_attribute"), Translations.t("gui_t_assigned_propery")}; Object[][] initData = new Object[displayedProperties.length][2]; for(int i = 0; i < displayedProperties.length; i++) { @@ -440,7 +447,7 @@ private ListModel initializeListModel(String sourceCodeElementType) { * @param panel The {@link JPanel} to which the options will be added to. */ private void addConversionOptions(JPanel panel) { - CMButton conversionButton = new CMButton(Translations.t("gui_b_conversions"), 10, 460, 150, 30); + CMButton conversionButton = new CMButton(Translations.t("gui_b_conversions"), 10, 490, 150, 30); panel.add(conversionButton); } } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java index 146c0eab..474058b0 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java @@ -4,6 +4,7 @@ import javax.swing.JList; import javax.swing.JScrollPane; +import javax.swing.JTable; public class CMScrollPane extends JScrollPane { @@ -20,4 +21,10 @@ public CMScrollPane(JList list, int x, int y, int width, int height) { setFont(SCROLL_PANE_FONT); setBounds(x, y, width, height); } + + public CMScrollPane(JTable table, int x, int y, int width, int height) { + super(table); + setFont(SCROLL_PANE_FONT); + setBounds(x, y, width, height); + } } From f67ba622b4aaa08c32def070ebd2298c8fa0a39c Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 08:55:38 +0200 Subject: [PATCH 11/58] Add mapping file example for gitinspector --- .../gitinspector_mapping_eample_2_0.xml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 examples/mapping/gitinspector_mapping_eample_2_0.xml diff --git a/examples/mapping/gitinspector_mapping_eample_2_0.xml b/examples/mapping/gitinspector_mapping_eample_2_0.xml new file mode 100644 index 00000000..c4b88cb9 --- /dev/null +++ b/examples/mapping/gitinspector_mapping_eample_2_0.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From ba170a6de0ed96b653aec5040e294a8d588f2124 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 12:08:44 +0200 Subject: [PATCH 12/58] Refactor downscale method --- .../converter/gitinspector/GitInspectorConverter.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index 353d1832..f33ab8e7 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -145,10 +145,13 @@ private CdfElement updateMetricsFromSecondAuthorElementNode(Element authorElemen return authorMetrics; } - private String downscalePossibleLargeNumericValue(String numberString) { - int number = Integer.parseInt(numberString); - int newValue = (int) Math.floor(Math.sqrt(number)); - return Integer.toString(newValue); + public static String downscalePossibleLargeNumericValue(String numberString) { + long number = Long.parseLong(numberString); + long newValue = (long) Math.floor(Math.sqrt(number)); + if (newValue < 0) { + newValue = 0; + } + return Long.toString(newValue); } private void updateMetrics(Element authorElement, String readTag, From 7dbbf81fd82c198b050f6a0bbc4e9985449cc958 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 12:15:08 +0200 Subject: [PATCH 13/58] [test] Add unit tests for downscale method. --- .../.classpath | 1 + ...ownscalePossibleLargeNumericValueTest.java | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java diff --git a/sources/codemetropolis-toolchain-converter/.classpath b/sources/codemetropolis-toolchain-converter/.classpath index af1430be..eec398a2 100644 --- a/sources/codemetropolis-toolchain-converter/.classpath +++ b/sources/codemetropolis-toolchain-converter/.classpath @@ -22,5 +22,6 @@ + diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java new file mode 100644 index 00000000..000c00a3 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java @@ -0,0 +1,50 @@ +package codemetropolis.toolchain.converter.gitinspector.test; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; + +public class DownscalePossibleLargeNumericValueTest { + + String[] squareNumbers = {"0", "1", "4", "16", "81", "100", "256", "3481", "7569", "16129", "205234276"}; + String[] nonSquareNumbers = {"0", "2", "7", "20", "82", "107", "270", "3490", "7583", "16142", "205234385"}; + String[] expectedResults = {"0", "1", "2", "4", "9", "10", "16", "59", "87", "127", "14326"}; + String[] negativeNumbers = {"-0", "-2", "-7", "-20", "-82", "-107", "-270", "-3490", "-7583", "-16142", "-205234385"}; + String[] nonNumbers = {"", "A", "AB", "CodeMetropolis", "GitConverter", "1234asdfg234"}; + + @Test + public void testWithSuqareNumbers() { + for (int i = 0; i < squareNumbers.length; ++i) { + String result = GitInspectorConverter.downscalePossibleLargeNumericValue(squareNumbers[i]); + assertEquals(expectedResults[i], result); + } + } + + @Test + public void testWithNonSuqareNumbers() { + for (int i = 1; i < squareNumbers.length; ++i) { + String result = GitInspectorConverter.downscalePossibleLargeNumericValue(nonSquareNumbers[i]); + assertEquals(expectedResults[i], result); + } + } + + @Test + public void testWithNegativeNumbers() { + for (int i = 0; i < negativeNumbers.length; ++i) { + String result = GitInspectorConverter.downscalePossibleLargeNumericValue(negativeNumbers[i]); + assertEquals("0", result); + } + } + + @Test + public void testWithNonNumbers() { + for (int i = 0; i < negativeNumbers.length; ++i) { + try { + GitInspectorConverter.downscalePossibleLargeNumericValue(nonNumbers[i]); + fail(nonNumbers[i]); + } catch (Exception e) {} + } + } +} From b1c08001108330bb879ebf15559003c9da00ad2a Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 12:37:49 +0200 Subject: [PATCH 14/58] Add getters to private class members --- .../gitinspector/GitInspectorConverter.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index f33ab8e7..6e26ffbe 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -43,8 +43,20 @@ public class GitInspectorConverter extends CdfConverter { private static final String DATE_TAG = "report-date"; private HashMap cdfElements; - CdfElement authorMetrics; - CdfElement floorMetrics; + private CdfElement authorMetrics; + private CdfElement floorMetrics; + + public HashMap getCdfElements() { + return cdfElements; + } + + public CdfElement getAuthorMetrics() { + return authorMetrics; + } + + public CdfElement getFloorMetrics() { + return floorMetrics; + } public GitInspectorConverter(Map params) { super(params); From 48f7311e8476efa3865abc0dd35f154e49f486b0 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 14:39:39 +0200 Subject: [PATCH 15/58] [test] Add junit to maven dependencies --- sources/codemetropolis-toolchain-converter/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sources/codemetropolis-toolchain-converter/pom.xml b/sources/codemetropolis-toolchain-converter/pom.xml index 3fc4dfe9..17e7d664 100644 --- a/sources/codemetropolis-toolchain-converter/pom.xml +++ b/sources/codemetropolis-toolchain-converter/pom.xml @@ -64,5 +64,11 @@ graphlib 1.0 + + junit + junit + 4.12 + test + From f07f4db5bb398068970c19611cd51b83906f8a6d Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 14:40:18 +0200 Subject: [PATCH 16/58] [test] Add TestHelper class to tests --- .../gitinspector/test/TestHelper.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java new file mode 100644 index 00000000..23639d53 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java @@ -0,0 +1,33 @@ +package codemetropolis.toolchain.converter.gitinspector.test; + +import java.util.List; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.commons.cdf.CdfProperty; + +public class TestHelper { + + public static boolean equals(CdfProperty p1, CdfProperty p2) { + return p1.getName() == p2.getName() && + p1.getValue() == p2.getValue() && + p1.getType() == p2.getType(); + } + + public static boolean equals(CdfElement e1, CdfElement e2) { + boolean equals = e1.getName() == e2.getName() && + e1.getType() == e2.getType(); + + List p1 = e1.getProperties(); + List p2 = e2.getProperties(); + for (int i = 0; i < Math.min(p1.size(), p2.size()); ++i) { + equals |= equals(p1.get(i), p2.get(i)); + } + + List elements1 = e1.getChildElements(); + List elements2 = e2.getChildElements(); + for (int i = 0; i < Math.min(elements1.size(), elements2.size()); ++i) { + equals |= equals(elements1.get(i), elements2.get(i)); + } + return equals; + } +} From 3679cf13a120855f4d948617833a56375812fdf1 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 14:45:51 +0200 Subject: [PATCH 17/58] [test] Add unit test for GitInspectorConverter constructor --- .../test/GitInspectorConverterTest.java | 20 +++++++++++++++++++ .../gitinspector/test/TestHelper.java | 7 +++++++ 2 files changed, 27 insertions(+) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorConverterTest.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorConverterTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorConverterTest.java new file mode 100644 index 00000000..feb9e5ef --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorConverterTest.java @@ -0,0 +1,20 @@ +package codemetropolis.toolchain.converter.gitinspector.test; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; + +public class GitInspectorConverterTest { + + @Test + public void test() { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + CdfElement authorMetrics = new CdfElement("", "author"); + CdfElement floorMetrics = new CdfElement("", "floor-metrics"); + assertTrue(TestHelper.equals(authorMetrics, conv.getAuthorMetrics())); + assertTrue(TestHelper.equals(floorMetrics, conv.getFloorMetrics())); + } +} diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java index 23639d53..bb3dff50 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java @@ -1,9 +1,11 @@ package codemetropolis.toolchain.converter.gitinspector.test; import java.util.List; +import java.util.Map; import codemetropolis.toolchain.commons.cdf.CdfElement; import codemetropolis.toolchain.commons.cdf.CdfProperty; +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; public class TestHelper { @@ -30,4 +32,9 @@ public static boolean equals(CdfElement e1, CdfElement e2) { } return equals; } + + public static GitInspectorConverter newGitInspectorConverter() { + Map params = null; + return new GitInspectorConverter(params); + } } From b2c8dad67ee68196cb3acd7223c6517a2b98a788 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 15:22:24 +0200 Subject: [PATCH 18/58] [test] Add a git-inspector output xml file for testing. --- .../gitinspector/test/GitInspectorOutput.xml | 820 ++++++++++++++++++ 1 file changed, 820 insertions(+) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorOutput.xml diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorOutput.xml b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorOutput.xml new file mode 100644 index 00000000..ed701e10 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorOutput.xml @@ -0,0 +1,820 @@ + + 0.5.0dev + gfx + 2018/04/16 + + The following historical commit information, by author, was found + + + AIOOB + jack@rickard.plus.com + https://www.gravatar.com/avatar/b2c1a760af577313192d9557cf0bc3e5?default=identicon + 1 + 817 + 546 + 10.38 + + + Adrian Perreault + eladriano@gmail.com + https://www.gravatar.com/avatar/4444c7cabafeb65e93504d5de42b1259?default=identicon + 2 + 13 + 1 + 0.11 + + + Attila Dusnoki + dati91@gmail.com + https://www.gravatar.com/avatar/fde69be0acdb5613950db1079d3c7758?default=identicon + 2 + 2 + 2 + 0.03 + + + Dzmitry Malyshau + kvarkus@gmail.com + https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon + 56 + 4570 + 2988 + 57.55 + + + Joshua Groves + josh@joshgroves.com + https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon + 1 + 1 + 1 + 0.02 + + + Kim Christensen + kimworking@gmail.com + https://www.gravatar.com/avatar/a03f4d56e65571977ce1b5eb270b46e3?default=identicon + 19 + 188 + 464 + 4.96 + + + Lymia Aluysia + lymia@lymiahugs.com + https://www.gravatar.com/avatar/84a2da5282611da98ffff005edf17ec3?default=identicon + 2 + 6 + 4 + 0.08 + + + Matt Jadczak + matt@mjdk.co.uk + https://www.gravatar.com/avatar/0b9be71027298c4586ae26c0818cd22a?default=identicon + 5 + 188 + 145 + 2.54 + + + Simon Heath + icefoxen@gmail.com + https://www.gravatar.com/avatar/03484f3b2ec38a95c61e814888424fc0?default=identicon + 4 + 780 + 459 + 9.43 + + + chell + chell@localhost.localdomain + https://www.gravatar.com/avatar/a272eced8366f0720275aad7b3b48a2f?default=identicon + 1 + 11 + 11 + 0.17 + + + grovesNL + josh@joshgroves.com + https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon + 2 + 37 + 9 + 0.35 + + + keringar + git@keringar.xyz + https://www.gravatar.com/avatar/1a7c9378d9880c16d77a393636a806f6?default=identicon + 2 + 13 + 9 + 0.17 + + + msiglreith + m.siglreith@gmail.com + https://www.gravatar.com/avatar/de76c8923acf8e324315012d4ee8ae78?default=identicon + 12 + 1391 + 219 + 12.26 + + + omni-viral + scareaangel@gmail.com + https://www.gravatar.com/avatar/90cb234b4e9c8668029436d86a879a11?default=identicon + 6 + 179 + 78 + 1.96 + + + + + Below are the number of rows from each author that have survived and are still intact in the current revision + + + AIOOB + jack@rickard.plus.com + https://www.gravatar.com/avatar/b2c1a760af577313192d9557cf0bc3e5?default=identicon + 741 + 90.7 + 0.0 + 2.97 + + + Adrian Perreault + eladriano@gmail.com + https://www.gravatar.com/avatar/4444c7cabafeb65e93504d5de42b1259?default=identicon + 7 + 53.8 + 1.4 + 57.14 + + + Dzmitry Malyshau + kvarkus@gmail.com + https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon + 3797 + 83.1 + 0.8 + 4.32 + + + Kim Christensen + kimworking@gmail.com + https://www.gravatar.com/avatar/a03f4d56e65571977ce1b5eb270b46e3?default=identicon + 168 + 89.4 + 0.1 + 16.67 + + + Lymia Aluysia + lymia@lymiahugs.com + https://www.gravatar.com/avatar/84a2da5282611da98ffff005edf17ec3?default=identicon + 6 + 100.0 + 0.5 + 0.00 + + + Matt Jadczak + matt@mjdk.co.uk + https://www.gravatar.com/avatar/0b9be71027298c4586ae26c0818cd22a?default=identicon + 145 + 77.1 + 1.0 + 5.52 + + + Simon Heath + icefoxen@gmail.com + https://www.gravatar.com/avatar/03484f3b2ec38a95c61e814888424fc0?default=identicon + 683 + 87.6 + 1.2 + 94.58 + + + chell + chell@localhost.localdomain + https://www.gravatar.com/avatar/a272eced8366f0720275aad7b3b48a2f?default=identicon + 11 + 100.0 + 1.4 + 0.00 + + + grovesNL + josh@joshgroves.com + https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon + 38 + 102.7 + 1.3 + 2.63 + + + keringar + git@keringar.xyz + https://www.gravatar.com/avatar/1a7c9378d9880c16d77a393636a806f6?default=identicon + 13 + 100.0 + 1.2 + 0.00 + + + msiglreith + m.siglreith@gmail.com + https://www.gravatar.com/avatar/de76c8923acf8e324315012d4ee8ae78?default=identicon + 1316 + 94.6 + 1.8 + 16.19 + + + omni-viral + scareaangel@gmail.com + https://www.gravatar.com/avatar/90cb234b4e9c8668029436d86a879a11?default=identicon + 157 + 87.7 + 1.4 + 2.55 + + + + + The following history timeline has been gathered from the repository + + + 2018-02 + + + AIOOB + jack@rickard.plus.com + https://www.gravatar.com/avatar/b2c1a760af577313192d9557cf0bc3e5?default=identicon + ----++++++ + + + Adrian Perreault + eladriano@gmail.com + https://www.gravatar.com/avatar/4444c7cabafeb65e93504d5de42b1259?default=identicon + . + + + Dzmitry Malyshau + kvarkus@gmail.com + https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon + --------+++++++++++++++ + + + Matt Jadczak + matt@mjdk.co.uk + https://www.gravatar.com/avatar/0b9be71027298c4586ae26c0818cd22a?default=identicon + . + + + chell + chell@localhost.localdomain + https://www.gravatar.com/avatar/a272eced8366f0720275aad7b3b48a2f?default=identicon + . + + + grovesNL + josh@joshgroves.com + https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon + . + + + keringar + git@keringar.xyz + https://www.gravatar.com/avatar/1a7c9378d9880c16d77a393636a806f6?default=identicon + . + + + msiglreith + m.siglreith@gmail.com + https://www.gravatar.com/avatar/de76c8923acf8e324315012d4ee8ae78?default=identicon + ++++++++++ + + + omni-viral + scareaangel@gmail.com + https://www.gravatar.com/avatar/90cb234b4e9c8668029436d86a879a11?default=identicon + + + + + 6177 + + + 2018-03 + + + Attila Dusnoki + dati91@gmail.com + https://www.gravatar.com/avatar/fde69be0acdb5613950db1079d3c7758?default=identicon + . + + + Dzmitry Malyshau + kvarkus@gmail.com + https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon + ----------++++++++++++++ + + + Joshua Groves + josh@joshgroves.com + https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon + . + + + Kim Christensen + kimworking@gmail.com + https://www.gravatar.com/avatar/a03f4d56e65571977ce1b5eb270b46e3?default=identicon + . + + + Lymia Aluysia + lymia@lymiahugs.com + https://www.gravatar.com/avatar/84a2da5282611da98ffff005edf17ec3?default=identicon + . + + + Matt Jadczak + matt@mjdk.co.uk + https://www.gravatar.com/avatar/0b9be71027298c4586ae26c0818cd22a?default=identicon + . + + + Simon Heath + icefoxen@gmail.com + https://www.gravatar.com/avatar/03484f3b2ec38a95c61e814888424fc0?default=identicon + --++++ + + + grovesNL + josh@joshgroves.com + https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon + . + + + msiglreith + m.siglreith@gmail.com + https://www.gravatar.com/avatar/de76c8923acf8e324315012d4ee8ae78?default=identicon + - + + + 5873 + + + 2018-04 + + + Dzmitry Malyshau + kvarkus@gmail.com + https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon + --------+++++++++++++++ + + + Kim Christensen + kimworking@gmail.com + https://www.gravatar.com/avatar/a03f4d56e65571977ce1b5eb270b46e3?default=identicon + -----------------++++++ + + + 1082 + + + + + No metrics violations were found in the repository + + + The following responsibilities, by author, were found in the current revision of the repository (comments are excluded from the line count, if possible) + + + AIOOB + jack@rickard.plus.com + https://www.gravatar.com/avatar/b2c1a760af577313192d9557cf0bc3e5?default=identicon + + + src/backend/metal/src/device.rs + 185 + + + src/hal/src/device.rs + 122 + + + src/backend/vulkan/src/device.rs + 85 + + + src/backend/dx12/src/device.rs + 84 + + + src/backend/gl/src/device.rs + 67 + + + src/backend/empty/src/lib.rs + 41 + + + src/render/src/pso.rs + 30 + + + examples/hal/quad/main.rs + 16 + + + src/backend/dx12/src/root_constants.rs + 13 + + + src/hal/src/queue/submission.rs + 12 + + + + + Adrian Perreault + eladriano@gmail.com + https://www.gravatar.com/avatar/4444c7cabafeb65e93504d5de42b1259?default=identicon + + + src/hal/src/image.rs + 3 + + + + + Dzmitry Malyshau + kvarkus@gmail.com + https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon + + + src/backend/metal/src/command.rs + 826 + + + src/backend/dx12/src/device.rs + 556 + + + src/backend/dx12/src/command.rs + 351 + + + src/backend/vulkan/src/device.rs + 216 + + + src/backend/metal/src/device.rs + 206 + + + src/hal/src/image.rs + 128 + + + src/backend/vulkan/src/command.rs + 117 + + + src/backend/metal/src/soft.rs + 94 + + + src/warden/src/gpu.rs + 84 + + + src/backend/gl/src/device.rs + 75 + + + + + Kim Christensen + kimworking@gmail.com + https://www.gravatar.com/avatar/a03f4d56e65571977ce1b5eb270b46e3?default=identicon + + + src/hal/src/device.rs + 49 + + + src/hal/src/buffer.rs + 20 + + + src/hal/src/image.rs + 19 + + + src/hal/src/format.rs + 12 + + + src/backend/vulkan/src/conv.rs + 11 + + + src/hal/src/window.rs + 9 + + + src/backend/dx12/src/window.rs + 7 + + + src/backend/dx11/src/command.rs + 3 + + + examples/hal/quad/main.rs + 2 + + + src/hal/src/queue/mod.rs + 1 + + + + + Lymia Aluysia + lymia@lymiahugs.com + https://www.gravatar.com/avatar/84a2da5282611da98ffff005edf17ec3?default=identicon + + + src/backend/gl/src/window/glutin.rs + 4 + + + src/backend/vulkan/src/lib.rs + 2 + + + + + Matt Jadczak + matt@mjdk.co.uk + https://www.gravatar.com/avatar/0b9be71027298c4586ae26c0818cd22a?default=identicon + + + src/render/src/encoder.rs + 33 + + + src/render/src/pso.rs + 14 + + + src/hal/src/image.rs + 9 + + + src/backend/empty/src/lib.rs + 6 + + + src/backend/vulkan/src/command.rs + 5 + + + src/hal/src/command/render_pass.rs + 4 + + + src/backend/vulkan/src/window.rs + 4 + + + src/backend/vulkan/src/device.rs + 4 + + + src/support/src/shade.rs + 3 + + + src/hal/src/window.rs + 3 + + + + + Simon Heath + icefoxen@gmail.com + https://www.gravatar.com/avatar/03484f3b2ec38a95c61e814888424fc0?default=identicon + + + src/hal/src/pso/descriptor.rs + 12 + + + src/hal/src/command/raw.rs + 6 + + + src/hal/src/command/mod.rs + 5 + + + src/hal/src/command/transfer.rs + 4 + + + src/hal/src/image.rs + 2 + + + src/hal/src/command/graphics.rs + 2 + + + src/hal/src/window.rs + 1 + + + src/hal/src/pso/mod.rs + 1 + + + src/hal/src/pso/graphics.rs + 1 + + + src/hal/src/memory.rs + 1 + + + + + chell + chell@localhost.localdomain + https://www.gravatar.com/avatar/a272eced8366f0720275aad7b3b48a2f?default=identicon + + + src/hal/src/command/mod.rs + 4 + + + src/hal/src/device.rs + 3 + + + src/hal/src/queue/submission.rs + 2 + + + src/hal/src/queue/mod.rs + 1 + + + src/hal/src/command/render_pass.rs + 1 + + + + + grovesNL + josh@joshgroves.com + https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon + + + src/backend/gl/src/device.rs + 23 + + + src/backend/dx12/src/conv.rs + 12 + + + src/backend/metal/src/device.rs + 1 + + + src/backend/dx12/src/device.rs + 1 + + + + + keringar + git@keringar.xyz + https://www.gravatar.com/avatar/1a7c9378d9880c16d77a393636a806f6?default=identicon + + + src/backend/vulkan/src/lib.rs + 12 + + + src/backend/dx12/src/lib.rs + 1 + + + + + msiglreith + m.siglreith@gmail.com + https://www.gravatar.com/avatar/de76c8923acf8e324315012d4ee8ae78?default=identicon + + + src/backend/dx12/src/format.rs + 934 + + + src/backend/dx12/src/device.rs + 62 + + + src/backend/dx12/src/conv.rs + 25 + + + src/hal/src/image.rs + 18 + + + src/backend/gl/src/conv.rs + 16 + + + src/backend/dx12/src/command.rs + 12 + + + src/backend/vulkan/src/device.rs + 10 + + + src/backend/vulkan/src/conv.rs + 5 + + + src/backend/dx12/src/native.rs + 4 + + + src/backend/dx12/src/lib.rs + 4 + + + + + omni-viral + scareaangel@gmail.com + https://www.gravatar.com/avatar/90cb234b4e9c8668029436d86a879a11?default=identicon + + + src/backend/gl/src/lib.rs + 50 + + + src/backend/metal/src/window.rs + 11 + + + src/backend/dx12/src/lib.rs + 11 + + + src/backend/metal/src/command.rs + 9 + + + src/backend/gl/src/window/glutin.rs + 6 + + + src/backend/dx12/src/window.rs + 6 + + + src/backend/metal/src/lib.rs + 5 + + + src/hal/src/window.rs + 4 + + + src/hal/src/queue/mod.rs + 4 + + + src/hal/src/device.rs + 4 + + + + + + From 3b9891bf7525bb94d5b779f3590bb6e49046c2f3 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 15:23:46 +0200 Subject: [PATCH 19/58] [test] Add unit test for xml file reading --- .../gitinspector/GitInspectorConverter.java | 2 +- .../test/CreateDocumentFromSourceTest.java | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index 6e26ffbe..e6516034 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -83,7 +83,7 @@ private CdfElement createRootelement(Document doc) { return new CdfElement(rootName.toString(), "root"); } - private Document createDocumentFromSource(String sourcePath) throws CodeMetropolisException { + public Document createDocumentFromSource(String sourcePath) throws CodeMetropolisException { try { File inputFile = new File(sourcePath); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java new file mode 100644 index 00000000..5f6e41c9 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java @@ -0,0 +1,48 @@ +package codemetropolis.toolchain.converter.gitinspector.test; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.w3c.dom.Document; + +import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException; +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; + +public class CreateDocumentFromSourceTest { + private static String XML_SRC_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\GitInspectorOutput.xml"; + private static String INVALID_FORMAT_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\"; + + @Test + public void invalidPath() { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + try { + conv.createDocumentFromSource(""); + fail("This test should fail because the resource path is invalid."); + } catch (CodeMetropolisException e) { + } catch (Exception e) { + fail("the wrong type of exception returned."); + } + } + + @Test + public void invalidResource() { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + try { + conv.createDocumentFromSource(INVALID_FORMAT_PATH); + fail("This test should fail because the target resource is a library."); + } catch (CodeMetropolisException e) { + } catch (Exception e) { + fail("the wrong type of exception returned."); + } + } + + @Test + public void validPath() { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + try { + Document d = conv.createDocumentFromSource(XML_SRC_PATH); + } catch (Exception e) { + fail(e.getMessage()); + } + } +} From 88251562ca35d2890cf6c19d821e2a95eda65f01 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 15:52:40 +0200 Subject: [PATCH 20/58] [test] Add test for root element creation. --- .../gitinspector/GitInspectorConverter.java | 2 +- .../test/CreateRootelemenTest.java | 28 +++++++++++++++++++ .../gitinspector/test/TestHelper.java | 9 ++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateRootelemenTest.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index e6516034..080d5e73 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -76,7 +76,7 @@ public CdfTree createElements(String source) throws CodeMetropolisException { return new CdfTree(rootElement); } - private CdfElement createRootelement(Document doc) { + public CdfElement createRootelement(Document doc) { StringBuilder rootName = new StringBuilder(doc.getElementsByTagName(REPOSITORY_TAG).item(0).getTextContent()); rootName.append(" "); rootName.append(doc.getElementsByTagName(DATE_TAG).item(0).getTextContent()); diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateRootelemenTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateRootelemenTest.java new file mode 100644 index 00000000..257b0470 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateRootelemenTest.java @@ -0,0 +1,28 @@ +package codemetropolis.toolchain.converter.gitinspector.test; + +import static org.junit.Assert.*; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.w3c.dom.Document; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; + +public class CreateRootelemenTest { + static Document document; + static GitInspectorConverter converter; + + @BeforeClass + public static void setUp() throws Exception { + document = TestHelper.newDocument(); + converter = TestHelper.newGitInspectorConverter(); + } + + @Test + public void testCreateRootelement() { + CdfElement root = converter.createRootelement(document); + CdfElement expected = new CdfElement("gfx 2018/04/16", "root"); + assertTrue(TestHelper.equals(root, expected)); + } +} diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java index bb3dff50..b8331b24 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java @@ -3,11 +3,14 @@ import java.util.List; import java.util.Map; +import org.w3c.dom.Document; + import codemetropolis.toolchain.commons.cdf.CdfElement; import codemetropolis.toolchain.commons.cdf.CdfProperty; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; public class TestHelper { + private static String XML_SRC_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\GitInspectorOutput.xml"; public static boolean equals(CdfProperty p1, CdfProperty p2) { return p1.getName() == p2.getName() && @@ -37,4 +40,10 @@ public static GitInspectorConverter newGitInspectorConverter() { Map params = null; return new GitInspectorConverter(params); } + + public static Document newDocument() throws Exception { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + Document doc = conv.createDocumentFromSource(XML_SRC_PATH); + return doc; + } } From e38f9d7a0c3fabaa0eaecce10ea7ae0922e493db Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 16:12:48 +0200 Subject: [PATCH 21/58] [test] Fix unit test helper class --- .../test/DownscalePossibleLargeNumericValueTest.java | 10 +++++----- .../converter/gitinspector/test/TestHelper.java | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java index 000c00a3..6f4948c4 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java @@ -8,11 +8,11 @@ public class DownscalePossibleLargeNumericValueTest { - String[] squareNumbers = {"0", "1", "4", "16", "81", "100", "256", "3481", "7569", "16129", "205234276"}; - String[] nonSquareNumbers = {"0", "2", "7", "20", "82", "107", "270", "3490", "7583", "16142", "205234385"}; - String[] expectedResults = {"0", "1", "2", "4", "9", "10", "16", "59", "87", "127", "14326"}; - String[] negativeNumbers = {"-0", "-2", "-7", "-20", "-82", "-107", "-270", "-3490", "-7583", "-16142", "-205234385"}; - String[] nonNumbers = {"", "A", "AB", "CodeMetropolis", "GitConverter", "1234asdfg234"}; + private static String[] squareNumbers = {"0", "1", "4", "16", "81", "100", "256", "3481", "7569", "16129", "205234276"}; + private static String[] nonSquareNumbers = {"0", "2", "7", "20", "82", "107", "270", "3490", "7583", "16142", "205234385"}; + private static String[] expectedResults = {"0", "1", "2", "4", "9", "10", "16", "59", "87", "127", "14326"}; + private static String[] negativeNumbers = {"-0", "-2", "-7", "-20", "-82", "-107", "-270", "-3490", "-7583", "-16142", "-205234385"}; + private static String[] nonNumbers = {"", "A", "AB", "CodeMetropolis", "GitConverter", "1234asdfg234"}; @Test public void testWithSuqareNumbers() { diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java index b8331b24..62b04497 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java @@ -19,19 +19,19 @@ public static boolean equals(CdfProperty p1, CdfProperty p2) { } public static boolean equals(CdfElement e1, CdfElement e2) { - boolean equals = e1.getName() == e2.getName() && - e1.getType() == e2.getType(); + boolean equals = e1.getName().equals(e2.getName()) && + e1.getType().equals(e2.getType()); List p1 = e1.getProperties(); List p2 = e2.getProperties(); for (int i = 0; i < Math.min(p1.size(), p2.size()); ++i) { - equals |= equals(p1.get(i), p2.get(i)); + equals = equals && equals(p1.get(i), p2.get(i)); } List elements1 = e1.getChildElements(); List elements2 = e2.getChildElements(); for (int i = 0; i < Math.min(elements1.size(), elements2.size()); ++i) { - equals |= equals(elements1.get(i), elements2.get(i)); + equals = equals && equals(elements1.get(i), elements2.get(i)); } return equals; } From fb0fb7d774a6e276779552033923692c7c3f51d3 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 16:43:53 +0200 Subject: [PATCH 22/58] [test] Add test for metric reset function --- .../gitinspector/GitInspectorConverter.java | 2 +- .../gitinspector/test/ResetMetricsTest.java | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/ResetMetricsTest.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index 080d5e73..e97560da 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -176,7 +176,7 @@ private void updateMetrics(Element authorElement, String readTag, floorMetrics.addProperty(writeTag, metricValue, type); } - private void resetMetrics(String name) { + public void resetMetrics(String name) { authorMetrics = new CdfElement(name, AUTHOR_TAG); floorMetrics = new CdfElement(name, FLOOR_TAG); } diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/ResetMetricsTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/ResetMetricsTest.java new file mode 100644 index 00000000..18783b75 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/ResetMetricsTest.java @@ -0,0 +1,24 @@ +package codemetropolis.toolchain.converter.gitinspector.test; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; + +public class ResetMetricsTest { + + @Test + public void testResetMetrics() { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + conv.resetMetrics("kiscica"); + CdfElement testAuthor = new CdfElement("kiscica", "author"); + CdfElement testMetric = new CdfElement("kiscica", "floor-metrics"); + assertTrue(TestHelper.equals(testAuthor, conv.getAuthorMetrics())); + assertTrue(TestHelper.equals(testMetric, conv.getFloorMetrics())); + conv.resetMetrics("kiskutya"); + assertFalse(TestHelper.equals(testAuthor, conv.getAuthorMetrics())); + assertFalse(TestHelper.equals(testMetric, conv.getFloorMetrics())); + } +} From 82a8e05a085d8235a32d6ecca32706f05d4dbcb9 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Wed, 18 Apr 2018 17:11:47 +0200 Subject: [PATCH 23/58] Clean up GitInspectorConverter class code. --- .../converter/gitinspector/GitInspectorConverter.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index e97560da..db5ac513 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -1,17 +1,13 @@ package codemetropolis.toolchain.converter.gitinspector; import java.io.File; -import java.io.IOException; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Document; import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; import org.w3c.dom.Node; import org.w3c.dom.Element; @@ -160,9 +156,6 @@ private CdfElement updateMetricsFromSecondAuthorElementNode(Element authorElemen public static String downscalePossibleLargeNumericValue(String numberString) { long number = Long.parseLong(numberString); long newValue = (long) Math.floor(Math.sqrt(number)); - if (newValue < 0) { - newValue = 0; - } return Long.toString(newValue); } From 26bc46664fcc473878b0c38403e1a19bd61f9e74 Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Wed, 18 Apr 2018 21:00:59 +0200 Subject: [PATCH 24/58] Added javadoc comments to all the code that was created until this time. Added classes which reprezent the various types of conversions. --- .../gui/MappingFileEditorDialog.java | 59 ++++- .../beans/BadConfigFileFomatException.java | 18 +- .../gui/components/CMScrollPane.java | 24 +- .../toolchain/gui/conversions/Conversion.java | 5 + .../gui/conversions/EmptyConversion.java | 5 + .../gui/conversions/NormailzeConversion.java | 5 + .../conversions/QuantizationConversion.java | 19 ++ .../gui/conversions/ToDoubleConversion.java | 5 + .../gui/conversions/ToIntConversion.java | 5 + .../gui/utils/BuildableSettings.java | 39 +++- .../toolchain/gui/utils/Property.java | 14 +- .../gui/utils/PropertyCollector.java | 216 ++++++++++-------- .../main/resources/translations.properties | 1 + 13 files changed, 298 insertions(+), 117 deletions(-) create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/Conversion.java create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormailzeConversion.java create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index 0daa9d57..0e7ddb10 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -8,6 +8,7 @@ import java.awt.Rectangle; import java.io.FileNotFoundException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,7 +41,6 @@ /** * Dialog for the mapping file editor. - * */ public class MappingFileEditorDialog extends JDialog { @@ -48,6 +48,38 @@ public class MappingFileEditorDialog extends JDialog { private static final FileFilter XML_FILTER = new XmlFileFilter(); + /** + * Contains the possible results of assigning a metric to a property of a buildable type. + */ + private enum AssignResult {CANNOT_ASSIGN, NO_CONVERSION, TO_INT, TO_DOUBLE, NORMALIZE, QUANTIZATON}; + + private static final Map> ASSIGN_RESULT_MATRIX; + + static { + ASSIGN_RESULT_MATRIX = new HashMap>(); + + ASSIGN_RESULT_MATRIX.put("int", new HashMap()); + ASSIGN_RESULT_MATRIX.put("int(0 to 5)", new HashMap()); + ASSIGN_RESULT_MATRIX.put("string", new HashMap()); + ASSIGN_RESULT_MATRIX.put("float(0 to 1)", new HashMap()); + //First row of the "matrix" + ASSIGN_RESULT_MATRIX.get("int").put("int", AssignResult.NO_CONVERSION); + ASSIGN_RESULT_MATRIX.get("int").put("float", AssignResult.TO_INT); + ASSIGN_RESULT_MATRIX.get("int").put("string", AssignResult.CANNOT_ASSIGN); + //Second row of the "matrix" + ASSIGN_RESULT_MATRIX.get("int(0 to 5)").put("int", AssignResult.QUANTIZATON); + ASSIGN_RESULT_MATRIX.get("int(0 to 5)").put("float", AssignResult.QUANTIZATON); + ASSIGN_RESULT_MATRIX.get("int(0 to 5)").put("string", AssignResult.CANNOT_ASSIGN); + //Third row of the "matrix" + ASSIGN_RESULT_MATRIX.get("string").put("int", AssignResult.QUANTIZATON); + ASSIGN_RESULT_MATRIX.get("string").put("float", AssignResult.QUANTIZATON); + ASSIGN_RESULT_MATRIX.get("string").put("string", AssignResult.NO_CONVERSION); + //Fourth row of the "matrix" + ASSIGN_RESULT_MATRIX.get("float(0 to 1)").put("int", AssignResult.NORMALIZE); + ASSIGN_RESULT_MATRIX.get("float(0 to 1)").put("float", AssignResult.NORMALIZE); + ASSIGN_RESULT_MATRIX.get("float(0 to 1)").put("string", AssignResult.CANNOT_ASSIGN); + } + private Map displayedBuildableAttributes; private Map> sourceCodeElementProperties; @@ -101,7 +133,7 @@ private void loadDisplayedInfo(String cdfFilePath) { catch(FileNotFoundException e) { JOptionPane.showMessageDialog( null, - Translations.t("gui_err_invaild_config_file_format"), + Translations.t("gui_err_config_file_not_found"), Translations.t("gui_err_title"), JOptionPane.ERROR_MESSAGE); @@ -181,13 +213,22 @@ public void actionPerformed(ActionEvent e) { int result = JOptionPane.showConfirmDialog(null, addResourcePanel, Translations.t("gui_add_resource_title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); if(result == JOptionPane.OK_OPTION) { - //Produce the resource string from the text fields... - String resourceToAdd = nameField.getText() + ": " + valueField.getText(); - //Add the newly defined resource to the property lists of the buildables and to the resource list (on top left of the window). - List> lists = Arrays.asList(resourcesList, cellarList, floorList, gardenList); - for(JList list : lists) { - DefaultListModel listModel = (DefaultListModel) list.getModel(); - listModel.addElement(resourceToAdd); + if (!(nameField.getText().isEmpty() || valueField.getText().isEmpty())) { + //Produce the resource string from the text fields... + String resourceToAdd = nameField.getText() + ": " + valueField.getText(); + //Add the newly defined resource to the property lists of the buildables and to the resource list (on top left of the window). + List> lists = Arrays.asList(resourcesList, cellarList, floorList, gardenList); + for (JList list : lists) { + DefaultListModel listModel = (DefaultListModel) list.getModel(); + listModel.addElement(resourceToAdd); + } + } + else { + JOptionPane.showMessageDialog( + null, + Translations.t("gui_err_name_value_empty"), + Translations.t("gui_err_title"), + JOptionPane.ERROR_MESSAGE); } } } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java index 7eac84d6..cd1d13a9 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java @@ -1,23 +1,39 @@ package codemetropolis.toolchain.gui.beans; +/** + * Exception class for handling exceptions that occur because of + * the bad format of the configuration file containing the buildable attributes desired to display. + */ public class BadConfigFileFomatException extends Exception { private static final long serialVersionUID = 1L; + /** + * @see Exception#Exception() + */ public BadConfigFileFomatException() { } + /** + * @see Exception#Exception(String) + */ public BadConfigFileFomatException(String message) { super(message); } + /** + * @see Exception#Exception(Throwable) + */ public BadConfigFileFomatException(Throwable cause) { super(cause); } + /** + * @see Exception#Exception(String, Throwable) + */ public BadConfigFileFomatException(String message, Throwable cause) { super(message, cause); } - + } \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java index 474058b0..7234947b 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java @@ -6,22 +6,44 @@ import javax.swing.JScrollPane; import javax.swing.JTable; +/** + * Custom scroll pane class for setting custom defaults for the JComboBoxes we use. + */ public class CMScrollPane extends JScrollPane { private static final long serialVersionUID = 1L; private static final Font SCROLL_PANE_FONT = new Font("Source Sans Pro", Font.PLAIN, 14); - + + /** + * Constructs a {@link CMScrollPane} instance. + */ public CMScrollPane() { setFont(SCROLL_PANE_FONT); } + /** + * Constructs a {@link CMScrollPane} instance and sets its dimensions and position. + * @param list {@link JList} which the scroll pane will contain. + * @param x The x position on the UI. + * @param y The y position on the UI. + * @param width The width of the element. + * @param height The height of the element. + */ public CMScrollPane(JList list, int x, int y, int width, int height) { super(list); setFont(SCROLL_PANE_FONT); setBounds(x, y, width, height); } + /** + * Constructs a {@link CMScrollPane} instance and sets its dimensions and position. + * @param table {@link JTable} which the scroll pane will contain. + * @param x The x position on the UI. + * @param y The y position on the UI. + * @param width The width of the element. + * @param height The height of the element. + */ public CMScrollPane(JTable table, int x, int y, int width, int height) { super(table); setFont(SCROLL_PANE_FONT); diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/Conversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/Conversion.java new file mode 100644 index 00000000..edb76026 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/Conversion.java @@ -0,0 +1,5 @@ +package codemetropolis.toolchain.gui.conversions; + +public abstract class Conversion { + +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java new file mode 100644 index 00000000..f369805f --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java @@ -0,0 +1,5 @@ +package codemetropolis.toolchain.gui.conversions; + +public class EmptyConversion extends Conversion { + +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormailzeConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormailzeConversion.java new file mode 100644 index 00000000..c1c7dba9 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormailzeConversion.java @@ -0,0 +1,5 @@ +package codemetropolis.toolchain.gui.conversions; + +public class NormailzeConversion extends Conversion { + +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java new file mode 100644 index 00000000..8d1263f4 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java @@ -0,0 +1,19 @@ +package codemetropolis.toolchain.gui.conversions; + +import java.util.ArrayList; +import java.util.List; + +/** + * Class for representing a quantization conversion. + */ +public class QuantizationConversion extends Conversion { + private List levels; + + public QuantizationConversion() { + levels = new ArrayList(); + } + + public List getLevels(){ + return levels; + } +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java new file mode 100644 index 00000000..47e83ee5 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java @@ -0,0 +1,5 @@ +package codemetropolis.toolchain.gui.conversions; + +public class ToDoubleConversion extends Conversion{ + +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java new file mode 100644 index 00000000..e9de3de1 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java @@ -0,0 +1,5 @@ +package codemetropolis.toolchain.gui.conversions; + +public class ToIntConversion extends Conversion { + +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java index f3a1671c..2e4d417c 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java @@ -12,14 +12,23 @@ import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException; +/** + * This class is responsible for providing information which buildable attributes are desired by the user to display on the GUI. + */ public class BuildableSettings { - //Map, which contains the default settings of what properties to display to the individual buildable types. + /** + * {@link Map}, which contains the default settings of what properties to display to the individual buildable types. + */ public static final Map DEFAULT_SETTINGS = new HashMap<>(); - //Path of the file containing the settings. + /** + * Path of the file containing the settings. + */ private static final String CFG_FILEPATH ="./src/main/resources/buildableProperties.cmcfg"; - //Map, serves containing the buildable types and its assigned properties. + /** + * {@link Map}, serves containing the buildable types(floor, garden, ...) and its assigned properties(height, character, ...). + */ private static Map DISPLAYED_PROPERTIES = new HashMap(); static { @@ -34,7 +43,12 @@ public class BuildableSettings { DISPLAYED_PROPERTIES.put("GROUND", new String[] {}); } - //Reads the user's display settings from the configuration file. + /** + * Reads the user's display settings from the configuration file. + * @return A {@link Map} which contains the possible buildable types as keys and its attributes, which are desired to be displayed. + * @throws BadConfigFileFomatException If the format of the configuration file is not appropriate. + * @throws FileNotFoundException If the configuration file cannot be found. + */ public static Map readSettings() throws BadConfigFileFomatException, FileNotFoundException{ BufferedReader cfgFileReader = null; @@ -79,10 +93,15 @@ public static Map readSettings() throws BadConfigFileFomatExce return DISPLAYED_PROPERTIES; } - //Validates, if all assigned properties of the specified buildable type are valid or not. - private static boolean validateProperties(String buildableName, String[] buildabeProperties) { - List validProperties = new ArrayList(Arrays.asList(DEFAULT_SETTINGS.get(buildableName))); - for(String property : buildabeProperties) { + /** + * Validates, if all assigned attributes of the specified buildable type are valid or not. + * @param buildableType The type of the buildable (floor, garden, ...) + * @param buildabeAttributes The array of the attributes which are examined if they are valid or not. + * @return All of the specified buildable attributes are valid or not. + */ + private static boolean validateProperties(String buildableType, String[] buildabeAttributes) { + List validProperties = new ArrayList(Arrays.asList(DEFAULT_SETTINGS.get(buildableType))); + for(String property : buildabeAttributes) { if(!validProperties.contains(property)) { return false; } @@ -90,7 +109,9 @@ private static boolean validateProperties(String buildableName, String[] buildab return true; } - //Writes to the console, what display settings will be provided to the Mapping file editor GUI. + /** + * Writes to the console, what display settings will be provided to the Mapping file editor GUI. + */ public static void displaySettings() { try { Map returnedSettings = readSettings(); diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java index 8374abde..a0210b61 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java @@ -1,9 +1,15 @@ package codemetropolis.toolchain.gui.utils; -//Serves for storing the information of a property belongs to a source code element type. +/** + * This class serves for storing the information of a property belongs to a source code element type. + */ public class Property{ - //Name of the property. + /** + * Name of the property. + */ public String name; - //Type of the property. + /** + * Type of the property. + */ public String type; -} +} \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java index 707867e8..c57c80ee 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java @@ -15,114 +15,144 @@ import java.util.Map; import java.util.Set; +/** + * This class is responsible for providing information what properties/metrics belong to the individual source code element types. + */ public class PropertyCollector { - //Those source code element types, whose properties wanted to be collected. - public static final Set acceptedTypes = new HashSet(Arrays.asList( - new String[] {"package","class","attribute","method"} - )); - - //The String key contains the name of the source code element type. The value assigned to the key is a list with the properties ( pairs). - private Map> propertyMap; - - //Class initialization. - public PropertyCollector() { - initializePropertyMap(); + /** + * Those source code element types, whose properties wanted to be collected. + */ + public static final Set acceptedTypes = new HashSet(Arrays.asList( + new String[] {"package","class","attribute","method"} + )); + + /** + * The String key contains the name of the source code element type. The value assigned to the key is a list with the properties ( pairs). + */ + private Map> propertyMap; + + /** + * Class initialization. + */ + public PropertyCollector() { + initializePropertyMap(); + } + + /** + * Initialize the property map. + */ + private void initializePropertyMap() { + propertyMap = new HashMap>(); + for(String type : acceptedTypes) { + propertyMap.put(type, null); } - - private void initializePropertyMap() { - propertyMap = new HashMap>(); - for(String type : acceptedTypes) { - propertyMap.put(type, null); - } - } - - public Map> getFromCdf(String cdfFilePath) { - try { - - initializePropertyMap(); + } + + /** + * Gets the {@link Map} which contains the individual source code element types as keys and their metrics/properties as values. + * @param cdfFilePath The path from the cdf file from which the information will be read. + * @return The {@link Map} which contains the individual source code element types as keys and their metrics/properties as values. + */ + public Map> getFromCdf(String cdfFilePath) { + try { + + initializePropertyMap(); - File file = new File(cdfFilePath); + File file = new File(cdfFilePath); - DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document doc = dBuilder.parse(file); - - Element rootElement = doc.getDocumentElement(); - rootElement.normalize(); - - //This NodeList 'elementTags' below doesn't contains the root element. - //The root element is also an 'element' tag (a package), that's why we need to try collecting its properties as well. - if(isValidElement(rootElement)) { - tryCollectProperties(rootElement); - } - - NodeList elementTags = rootElement.getElementsByTagName("element"); + DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = dBuilder.parse(file); + + Element rootElement = doc.getDocumentElement(); + rootElement.normalize(); - //Iteration through all of the rest 'element' tags (they represent source code element types). Trying to collect their properties. - for(int i = 0; i < elementTags.getLength(); i++) { - Element currentTag = (Element) elementTags.item(i); - if(isValidElement(currentTag)) { - tryCollectProperties(currentTag); - } - }; - - } catch (Exception e) { - e.printStackTrace(); + //This NodeList 'elementTags' below doesn't contains the root element. + //The root element is also an 'element' tag (a package), that's why we need to try collecting its properties as well. + if(isValidElement(rootElement)) { + tryCollectProperties(rootElement); } + + NodeList elementTags = rootElement.getElementsByTagName("element"); - return propertyMap; + //Iteration through all of the rest 'element' tags (they represent source code element types). Trying to collect their properties. + for(int i = 0; i < elementTags.getLength(); i++) { + Element currentTag = (Element) elementTags.item(i); + if(isValidElement(currentTag)) { + tryCollectProperties(currentTag); + } + }; + + } catch (Exception e) { + e.printStackTrace(); } + + return propertyMap; + } - //Checks if the tag is a valid 'element' tag or not. - private boolean isValidElement(Element element) { - return element.getTagName().equals("element") && - element.hasAttribute("type") && - acceptedTypes.contains(element.getAttribute("type")); - } - - private void tryCollectProperties(Element element) { - List propertyList = null; - //We will collect the properties of the source code element types only in that way, when we have never collected them before. - //The element tag must have child nodes. (E.g. the 'properties' tag also a child element.) - if(propertyList == null && element.hasChildNodes()) { - NodeList children = element.getChildNodes(); - for(int i = 0; i < children.getLength(); i++) { - Node child = children.item(i); - //When we found the 'properties' tag, we collect the list of properties contained by it. - if(child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals("properties")) { - propertyList = getPropertyList((Element)child); - propertyMap.put(element.getAttribute("type"), propertyList); - break; - } + /** + * Checks if the tag is a valid 'element' tag or not. + * @param element The {@link Element} which will be examined. + * @return The examined element is a valid 'element' tag or not. + */ + private boolean isValidElement(Element element) { + return element.getTagName().equals("element") && + element.hasAttribute("type") && + acceptedTypes.contains(element.getAttribute("type")); + } + + /** + * Checks if the properties/metrics of the element have been ever gathered or not. If not, calls the {@code getPropertyList} method to collect them. + * @param element The 'element' tag which will be examined. + */ + private void tryCollectProperties(Element element) { + List propertyList = null; + //We will collect the properties of the source code element types only in that way, when we have never collected them before. + //The element tag must have child nodes. (E.g. the 'properties' tag also a child element.) + if(propertyList == null && element.hasChildNodes()) { + NodeList children = element.getChildNodes(); + for(int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + //When we found the 'properties' tag, we collect the list of properties contained by it. + if(child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals("properties")) { + propertyList = getPropertyList((Element)child); + propertyMap.put(element.getAttribute("type"), propertyList); + break; } } } + } - //Collects the properties contained by the 'properties' tag. - private List getPropertyList(Element element) { - List result = new ArrayList(); - - NodeList properties = element.getElementsByTagName("property"); - - for(int i = 0; i < properties.getLength(); i++) { - Element property = (Element) properties.item(i); - if(property.hasAttribute("name") && property.hasAttribute("type")) { - Property p = new Property(); - p.name = property.getAttribute("name"); - p.type = property.getAttribute("type"); - result.add(p); - } + /** + * Collects the properties contained by the 'properties' tag. + * @param element The 'properties' tag of the 'element' tag. + * @return The list of the gathered properties/metrics. + */ + private List getPropertyList(Element element) { + List result = new ArrayList(); + + NodeList properties = element.getElementsByTagName("property"); + + for(int i = 0; i < properties.getLength(); i++) { + Element property = (Element) properties.item(i); + if(property.hasAttribute("name") && property.hasAttribute("type")) { + Property p = new Property(); + p.name = property.getAttribute("name"); + p.type = property.getAttribute("type"); + result.add(p); } - return result; } - - //Displays the various properties ( pairs) of the source code elements. - public void displayProperties() { - for(String srcCodeElement : acceptedTypes) { - System.out.println("Properties of source code element '" + srcCodeElement + "':"); - for(Property p : propertyMap.get(srcCodeElement)) { - System.out.println(p.name + ": " + p.type); - } + return result; + } + + /** + * Displays the various properties ( pairs) of the source code elements. + */ + public void displayProperties() { + for(String srcCodeElement : acceptedTypes) { + System.out.println("Properties of source code element '" + srcCodeElement + "':"); + for(Property p : propertyMap.get(srcCodeElement)) { + System.out.println(p.name + ": " + p.type); } } - + } } \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties index 23c5ef5e..b1598356 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties @@ -88,6 +88,7 @@ gui_err_resources_empty_no_selected = The list of the resources is empty or ther gui_err_missing_cdf_file = There is no file existing on the path specified! gui_err_mkdir_project_failed = Failed to create project folder under minecraft root! gui_err_mkdir_sm_failed = Failed to create SourceMeter results folder! +gui_err_name_value_empty = Name and/or value cannot be empty! gui_err_sm_exec_failed = Error during SourceMeter execution! gui_err_sm_run_failed = Failed to run SourceMeter! gui_err_unexpected_err = Unexpected error occured! From 867e4b70d08826865dfe56f618593263e04829c8 Mon Sep 17 00:00:00 2001 From: tkeri Date: Wed, 18 Apr 2018 21:09:22 +0200 Subject: [PATCH 25/58] Add drag and drop feature Add drag and drop feature to mapping file editor. --- .../gui/MappingFileEditorDialog.java | 36 +++++++++ .../toolchain/gui/utils/TransferHelper.java | 80 +++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index 0e7ddb10..a92d89f6 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -13,6 +13,7 @@ import java.util.Map; import javax.swing.DefaultListModel; +import javax.swing.DropMode; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JLabel; @@ -36,6 +37,7 @@ import codemetropolis.toolchain.gui.utils.BuildableSettings; import codemetropolis.toolchain.gui.utils.Property; import codemetropolis.toolchain.gui.utils.PropertyCollector; +import codemetropolis.toolchain.gui.utils.TransferHelper; import codemetropolis.toolchain.gui.utils.Translations; import codemetropolis.toolchain.gui.utils.XmlFileFilter; @@ -337,6 +339,8 @@ private void createCellarTab() { cellarList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); cellarList.setLayoutOrientation(JList.VERTICAL); cellarList.setVisibleRowCount(-1); + cellarList.setDragEnabled(true); + cellarList.setDropMode(DropMode.INSERT); CMScrollPane cellarScrollPane = new CMScrollPane(cellarList, 525, 50, 240, 180); @@ -374,6 +378,8 @@ private void createFloorTab() { floorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); floorList.setLayoutOrientation(JList.VERTICAL); floorList.setVisibleRowCount(-1); + floorList.setDragEnabled(true); + floorList.setDropMode(DropMode.INSERT); CMScrollPane floorScrollPane = new CMScrollPane(floorList, 525, 50, 240, 180); @@ -411,6 +417,9 @@ private void createGardenTab() { gardenList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); gardenList.setLayoutOrientation(JList.VERTICAL); gardenList.setVisibleRowCount(-1); + gardenList.setDragEnabled(true); + gardenList.setDropMode(DropMode.INSERT); +// gardenList.setTransferHandler(new ListTransferHandler()); CMScrollPane gardenScrollPane = new CMScrollPane(gardenList, 525, 50, 240, 180); @@ -463,6 +472,12 @@ private JTable setUpBuildableTable(String buildableType) { table.setFont(new Font("Source Sans Pro", Font.PLAIN, 14)); table.setRowHeight(30); table.setBounds(15, 50, 480, displayedProperties.length * 30); + table.setDragEnabled(true); + table.setDropMode(DropMode.USE_SELECTION); + table.setTransferHandler(new TransferHelper()); + table.setRowSelectionAllowed(false); + table.setCellSelectionEnabled(true); + return table; } @@ -491,4 +506,25 @@ private void addConversionOptions(JPanel panel) { CMButton conversionButton = new CMButton(Translations.t("gui_b_conversions"), 10, 490, 150, 30); panel.add(conversionButton); } + + /** + * @return floorTable + */ + public JTable getFloorTable() { + return floorTable; + } + + /** + * @return gardenTable + */ + public JTable getGardenTable() { + return gardenTable; + } + + /** + * @return cellarTable + */ + public JTable getCellarTable() { + return cellarTable; + } } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java new file mode 100644 index 00000000..16888aea --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java @@ -0,0 +1,80 @@ +package codemetropolis.toolchain.gui.utils; + +import java.awt.Component; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.IOException; + +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.TransferHandler; + + +public class TransferHelper extends TransferHandler { + + private static final long serialVersionUID = 1L; + + public TransferHelper() { + } + + @Override + public int getSourceActions(JComponent c) { + return MOVE; + } + + @Override + protected void exportDone(JComponent source, Transferable data, int action) { + } + + @Override + public boolean canImport(TransferSupport support) { + // Reject the import by default... + boolean canImport = false; + // Can only import into another JTable + Component comp = support.getComponent(); + if (comp instanceof JTable) { + try { + // Get the Transferable, we need to check + // the constraints + Transferable t = support.getTransferable(); + Object obj = t.getTransferData(DataFlavor.stringFlavor); + if (obj != null) { + canImport = true; + } + } catch (UnsupportedFlavorException | IOException ex) { + ex.printStackTrace(); + } + } + return canImport; + } + + @Override + public boolean importData(TransferSupport support) { + // Import failed for some reason... + boolean imported = false; + // Only import into JTables... + Component comp = support.getComponent(); + if (comp instanceof JTable) { + JTable target = (JTable) comp; + // Need to know where we are importing to... + DropLocation dl = support.getDropLocation(); + java.awt.Point dp = dl.getDropPoint(); + int dropCol = target.columnAtPoint(dp); + int dropRow = target.rowAtPoint(dp); + try { + // Get the Transferable at the heart of it all + Transferable t = support.getTransferable(); + Object obj = t.getTransferData(DataFlavor.stringFlavor); + + target.setValueAt(obj, dropRow, dropCol); + + imported = true; + + } catch (UnsupportedFlavorException | IOException ex) { + ex.printStackTrace(); + } + } + return imported; + } +} \ No newline at end of file From b171ac8b5177524a7231463bc05d218afeabbcda Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Thu, 19 Apr 2018 11:07:42 +0200 Subject: [PATCH 26/58] [test] Replace == with equals() in TestHelper class --- .../toolchain/converter/gitinspector/test/TestHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java index 62b04497..6a6d8129 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java @@ -13,9 +13,9 @@ public class TestHelper { private static String XML_SRC_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\GitInspectorOutput.xml"; public static boolean equals(CdfProperty p1, CdfProperty p2) { - return p1.getName() == p2.getName() && - p1.getValue() == p2.getValue() && - p1.getType() == p2.getType(); + return p1.getName().equals(p2.getName()) && + p1.getValue().equals(p2.getValue()) && + p1.getType().equals(p2.getType()); } public static boolean equals(CdfElement e1, CdfElement e2) { From bb51414999b002737d1abbe0ee48d984082db900 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Thu, 19 Apr 2018 11:09:38 +0200 Subject: [PATCH 27/58] [test] Add unit test for updateMetrics function --- .../gitinspector/GitInspectorConverter.java | 2 +- .../gitinspector/test/UpdateMetricsTest.java | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index db5ac513..f3847d07 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -159,7 +159,7 @@ public static String downscalePossibleLargeNumericValue(String numberString) { return Long.toString(newValue); } - private void updateMetrics(Element authorElement, String readTag, + public void updateMetrics(Element authorElement, String readTag, String writeTag, CdfProperty.Type type, boolean remapNumeric) { String metricValue = authorElement.getElementsByTagName(readTag).item(0).getTextContent(); if (remapNumeric) { diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java new file mode 100644 index 00000000..e153643c --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java @@ -0,0 +1,57 @@ +package codemetropolis.toolchain.converter.gitinspector.test; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.commons.cdf.CdfProperty; +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; + +public class UpdateMetricsTest { + + @Test + public void testUpdateMetrics() throws Exception { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + Document doc = TestHelper.newDocument(); + Element element = doc.createElement("test-element"); + + Element strAttr = doc.createElement("string-attribute"); + strAttr.appendChild(doc.createTextNode("value")); + element.appendChild(strAttr); + + Element intAttr = doc.createElement("int-attribute"); + intAttr.appendChild(doc.createTextNode("16")); + element.appendChild(intAttr); + + Element floatAttr = doc.createElement("float-attribute"); + floatAttr.appendChild(doc.createTextNode("0.78")); + element.appendChild(floatAttr); + + conv.updateMetrics(element, "string-attribute", "string", CdfProperty.Type.STRING, false); + conv.updateMetrics(element, "int-attribute", "int1", CdfProperty.Type.INT, false); + conv.updateMetrics(element, "int-attribute", "int2", CdfProperty.Type.INT, true); + conv.updateMetrics(element, "float-attribute", "float", CdfProperty.Type.FLOAT, false); + + CdfElement authorMetrics = new CdfElement("", "author"); + CdfElement floorMetrics = new CdfElement("", "floor-metrics"); + + authorMetrics.addProperty("string", "value", CdfProperty.Type.STRING); + floorMetrics.addProperty("string", "value", CdfProperty.Type.STRING); + + authorMetrics.addProperty("int1", "16", CdfProperty.Type.INT); + floorMetrics.addProperty("int1", "16", CdfProperty.Type.INT); + + authorMetrics.addProperty("int2", "4", CdfProperty.Type.INT); + floorMetrics.addProperty("int2", "4", CdfProperty.Type.INT); + + authorMetrics.addProperty("float", "0.78", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("float", "0.78", CdfProperty.Type.FLOAT); + + assertTrue(TestHelper.equals(authorMetrics, conv.getAuthorMetrics())); + assertTrue(TestHelper.equals(floorMetrics, conv.getFloorMetrics())); + } +} From c5849172c233b5253bcc4069ee0dc6d42e4c08db Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Thu, 19 Apr 2018 12:37:49 +0200 Subject: [PATCH 28/58] [test] Add test for getMetricsFromFirstAuthorElementNode function --- .../gitinspector/GitInspectorConverter.java | 2 +- ...MetricsFromFirstAuthorElementNodeTest.java | 69 +++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GetMetricsFromFirstAuthorElementNodeTest.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index f3847d07..7d2da328 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -125,7 +125,7 @@ private void traverseNodesFromDocument(Document doc) { } } - private CdfElement getMetricsFromFirstAuthorElementNode(Element authorElement) { + public CdfElement getMetricsFromFirstAuthorElementNode(Element authorElement) { String name = authorElement.getElementsByTagName(NAME_TAG).item(0).getTextContent(); resetMetrics(name); diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GetMetricsFromFirstAuthorElementNodeTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GetMetricsFromFirstAuthorElementNodeTest.java new file mode 100644 index 00000000..5dc312d5 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GetMetricsFromFirstAuthorElementNodeTest.java @@ -0,0 +1,69 @@ +package codemetropolis.toolchain.converter.gitinspector.test; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.commons.cdf.CdfProperty; +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; + +public class GetMetricsFromFirstAuthorElementNodeTest { + + @Test + public void testGetMetricsFromFirstAuthorElementNode() throws Exception { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + Document doc = TestHelper.newDocument(); + Element element = doc.createElement("test-element"); + + Element nameAttr = doc.createElement("name"); + nameAttr.appendChild(doc.createTextNode("Gipsz Jakab")); + element.appendChild(nameAttr); + + Element emailAttr = doc.createElement("email"); + emailAttr.appendChild(doc.createTextNode("xyz@valami.hu")); + element.appendChild(emailAttr); + + Element commitsAttr = doc.createElement("commits"); + commitsAttr.appendChild(doc.createTextNode("16")); + element.appendChild(commitsAttr); + + Element insertionsAttr = doc.createElement("insertions"); + insertionsAttr.appendChild(doc.createTextNode("100")); + element.appendChild(insertionsAttr); + + Element deletionsAttr = doc.createElement("deletions"); + deletionsAttr.appendChild(doc.createTextNode("121")); + element.appendChild(deletionsAttr); + + Element pocAttr = doc.createElement("percentage-of-changes"); + pocAttr.appendChild(doc.createTextNode("0.51")); + element.appendChild(pocAttr); + + conv.getMetricsFromFirstAuthorElementNode(element); + + CdfElement authorMetrics = new CdfElement("Gipsz Jakab", "author"); + CdfElement floorMetrics = new CdfElement("Gipsz Jakab", "floor-metrics"); + + authorMetrics.addProperty("email", "xyz@valami.hu", CdfProperty.Type.STRING); + floorMetrics.addProperty("email", "xyz@valami.hu", CdfProperty.Type.STRING); + + authorMetrics.addProperty("commits", "16", CdfProperty.Type.INT); + floorMetrics.addProperty("commits", "16", CdfProperty.Type.INT); + + authorMetrics.addProperty("insertions", "10", CdfProperty.Type.INT); + floorMetrics.addProperty("insertions", "10", CdfProperty.Type.INT); + + authorMetrics.addProperty("deletions", "11", CdfProperty.Type.INT); + floorMetrics.addProperty("deletions", "11", CdfProperty.Type.INT); + + authorMetrics.addProperty("POC", "0.51", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("POC", "0.51", CdfProperty.Type.FLOAT); + + authorMetrics.addChildElement(floorMetrics); + + assertTrue(TestHelper.equals(authorMetrics, conv.getAuthorMetrics())); + } +} From 0ce4a8f83489b7379eb3cfe1437af706dfab4e61 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Thu, 19 Apr 2018 14:57:12 +0200 Subject: [PATCH 29/58] [test] Add test for updateMetricsFromSecondAuthorElementNode function --- .../gitinspector/GitInspectorConverter.java | 2 +- ...etricsFromSecondAuthorElementNodeTest.java | 66 +++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsFromSecondAuthorElementNodeTest.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index 7d2da328..685d57c5 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -139,7 +139,7 @@ public CdfElement getMetricsFromFirstAuthorElementNode(Element authorElement) { return authorMetrics; } - private CdfElement updateMetricsFromSecondAuthorElementNode(Element authorElement, CdfElement element) { + public CdfElement updateMetricsFromSecondAuthorElementNode(Element authorElement, CdfElement element) { authorMetrics = element; floorMetrics = authorMetrics.getChildElements().get(0); authorMetrics.removeChildElement(floorMetrics); diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsFromSecondAuthorElementNodeTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsFromSecondAuthorElementNodeTest.java new file mode 100644 index 00000000..b42b08ba --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsFromSecondAuthorElementNodeTest.java @@ -0,0 +1,66 @@ +package codemetropolis.toolchain.converter.gitinspector.test; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.commons.cdf.CdfProperty; +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; + +public class UpdateMetricsFromSecondAuthorElementNodeTest { + + @Test + public void testUpdateMetricsFromSecondAuthorElementNode() throws Exception { + CdfElement authorMetrics = new CdfElement("Gipsz Jakab", "author"); + CdfElement floorMetrics = new CdfElement("Gipsz Jakab", "floor-metrics"); + authorMetrics.addChildElement(floorMetrics); + + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + Document doc = TestHelper.newDocument(); + Element element = doc.createElement("test-elemnt"); + + Element nameAttr = doc.createElement("name"); + nameAttr.appendChild(doc.createTextNode("Gipsz Jakab")); + element.appendChild(nameAttr); + + Element commitsAttr = doc.createElement("rows"); + commitsAttr.appendChild(doc.createTextNode("1600")); + element.appendChild(commitsAttr); + + Element insertionsAttr = doc.createElement("stability"); + insertionsAttr.appendChild(doc.createTextNode("89.4")); + element.appendChild(insertionsAttr); + + Element deletionsAttr = doc.createElement("age"); + deletionsAttr.appendChild(doc.createTextNode("0.1")); + element.appendChild(deletionsAttr); + + Element pocAttr = doc.createElement("percentage-in-comments"); + pocAttr.appendChild(doc.createTextNode("0.51")); + element.appendChild(pocAttr); + + conv.updateMetricsFromSecondAuthorElementNode(element, authorMetrics); + + authorMetrics = new CdfElement("Gipsz Jakab", "author"); + floorMetrics = new CdfElement("Gipsz Jakab", "floor-metrics"); + + authorMetrics.addProperty("rows", "40", CdfProperty.Type.INT); + floorMetrics.addProperty("rows", "40", CdfProperty.Type.INT); + + authorMetrics.addProperty("stability", "89.4", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("stability", "89.4", CdfProperty.Type.FLOAT); + + authorMetrics.addProperty("age", "0.1", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("age", "0.1", CdfProperty.Type.FLOAT); + + authorMetrics.addProperty("PIC", "0.51", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("PIC", "0.51", CdfProperty.Type.FLOAT); + + authorMetrics.addChildElement(floorMetrics); + + assertTrue(TestHelper.equals(authorMetrics, conv.getAuthorMetrics())); + } +} From 96b1bd939b25d1bc2fb23a222d2be70be197a8bc Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Thu, 19 Apr 2018 15:01:24 +0200 Subject: [PATCH 30/58] [test] Reduce the size of the test xml file --- .../gitinspector/test/GitInspectorOutput.xml | 797 +----------------- 1 file changed, 4 insertions(+), 793 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorOutput.xml b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorOutput.xml index ed701e10..93ed1814 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorOutput.xml +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorOutput.xml @@ -6,815 +6,26 @@ The following historical commit information, by author, was found - AIOOB - jack@rickard.plus.com - https://www.gravatar.com/avatar/b2c1a760af577313192d9557cf0bc3e5?default=identicon - 1 - 817 - 546 - 10.38 - - - Adrian Perreault - eladriano@gmail.com - https://www.gravatar.com/avatar/4444c7cabafeb65e93504d5de42b1259?default=identicon - 2 - 13 - 1 - 0.11 - - - Attila Dusnoki - dati91@gmail.com - https://www.gravatar.com/avatar/fde69be0acdb5613950db1079d3c7758?default=identicon - 2 - 2 - 2 - 0.03 - - - Dzmitry Malyshau - kvarkus@gmail.com - https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon + Teszt Bela + becike@beciakiraly.eu 56 4570 2988 57.55 - - Joshua Groves - josh@joshgroves.com - https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon - 1 - 1 - 1 - 0.02 - - - Kim Christensen - kimworking@gmail.com - https://www.gravatar.com/avatar/a03f4d56e65571977ce1b5eb270b46e3?default=identicon - 19 - 188 - 464 - 4.96 - - - Lymia Aluysia - lymia@lymiahugs.com - https://www.gravatar.com/avatar/84a2da5282611da98ffff005edf17ec3?default=identicon - 2 - 6 - 4 - 0.08 - - - Matt Jadczak - matt@mjdk.co.uk - https://www.gravatar.com/avatar/0b9be71027298c4586ae26c0818cd22a?default=identicon - 5 - 188 - 145 - 2.54 - - - Simon Heath - icefoxen@gmail.com - https://www.gravatar.com/avatar/03484f3b2ec38a95c61e814888424fc0?default=identicon - 4 - 780 - 459 - 9.43 - - - chell - chell@localhost.localdomain - https://www.gravatar.com/avatar/a272eced8366f0720275aad7b3b48a2f?default=identicon - 1 - 11 - 11 - 0.17 - - - grovesNL - josh@joshgroves.com - https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon - 2 - 37 - 9 - 0.35 - - - keringar - git@keringar.xyz - https://www.gravatar.com/avatar/1a7c9378d9880c16d77a393636a806f6?default=identicon - 2 - 13 - 9 - 0.17 - - - msiglreith - m.siglreith@gmail.com - https://www.gravatar.com/avatar/de76c8923acf8e324315012d4ee8ae78?default=identicon - 12 - 1391 - 219 - 12.26 - - - omni-viral - scareaangel@gmail.com - https://www.gravatar.com/avatar/90cb234b4e9c8668029436d86a879a11?default=identicon - 6 - 179 - 78 - 1.96 - Below are the number of rows from each author that have survived and are still intact in the current revision - AIOOB - jack@rickard.plus.com - https://www.gravatar.com/avatar/b2c1a760af577313192d9557cf0bc3e5?default=identicon - 741 - 90.7 - 0.0 - 2.97 - - - Adrian Perreault - eladriano@gmail.com - https://www.gravatar.com/avatar/4444c7cabafeb65e93504d5de42b1259?default=identicon - 7 - 53.8 - 1.4 - 57.14 - - - Dzmitry Malyshau - kvarkus@gmail.com - https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon + Teszt Bela + becike@beciakiraly.eu 3797 83.1 0.8 4.32 - - Kim Christensen - kimworking@gmail.com - https://www.gravatar.com/avatar/a03f4d56e65571977ce1b5eb270b46e3?default=identicon - 168 - 89.4 - 0.1 - 16.67 - - - Lymia Aluysia - lymia@lymiahugs.com - https://www.gravatar.com/avatar/84a2da5282611da98ffff005edf17ec3?default=identicon - 6 - 100.0 - 0.5 - 0.00 - - - Matt Jadczak - matt@mjdk.co.uk - https://www.gravatar.com/avatar/0b9be71027298c4586ae26c0818cd22a?default=identicon - 145 - 77.1 - 1.0 - 5.52 - - - Simon Heath - icefoxen@gmail.com - https://www.gravatar.com/avatar/03484f3b2ec38a95c61e814888424fc0?default=identicon - 683 - 87.6 - 1.2 - 94.58 - - - chell - chell@localhost.localdomain - https://www.gravatar.com/avatar/a272eced8366f0720275aad7b3b48a2f?default=identicon - 11 - 100.0 - 1.4 - 0.00 - - - grovesNL - josh@joshgroves.com - https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon - 38 - 102.7 - 1.3 - 2.63 - - - keringar - git@keringar.xyz - https://www.gravatar.com/avatar/1a7c9378d9880c16d77a393636a806f6?default=identicon - 13 - 100.0 - 1.2 - 0.00 - - - msiglreith - m.siglreith@gmail.com - https://www.gravatar.com/avatar/de76c8923acf8e324315012d4ee8ae78?default=identicon - 1316 - 94.6 - 1.8 - 16.19 - - - omni-viral - scareaangel@gmail.com - https://www.gravatar.com/avatar/90cb234b4e9c8668029436d86a879a11?default=identicon - 157 - 87.7 - 1.4 - 2.55 - - - The following history timeline has been gathered from the repository - - - 2018-02 - - - AIOOB - jack@rickard.plus.com - https://www.gravatar.com/avatar/b2c1a760af577313192d9557cf0bc3e5?default=identicon - ----++++++ - - - Adrian Perreault - eladriano@gmail.com - https://www.gravatar.com/avatar/4444c7cabafeb65e93504d5de42b1259?default=identicon - . - - - Dzmitry Malyshau - kvarkus@gmail.com - https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon - --------+++++++++++++++ - - - Matt Jadczak - matt@mjdk.co.uk - https://www.gravatar.com/avatar/0b9be71027298c4586ae26c0818cd22a?default=identicon - . - - - chell - chell@localhost.localdomain - https://www.gravatar.com/avatar/a272eced8366f0720275aad7b3b48a2f?default=identicon - . - - - grovesNL - josh@joshgroves.com - https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon - . - - - keringar - git@keringar.xyz - https://www.gravatar.com/avatar/1a7c9378d9880c16d77a393636a806f6?default=identicon - . - - - msiglreith - m.siglreith@gmail.com - https://www.gravatar.com/avatar/de76c8923acf8e324315012d4ee8ae78?default=identicon - ++++++++++ - - - omni-viral - scareaangel@gmail.com - https://www.gravatar.com/avatar/90cb234b4e9c8668029436d86a879a11?default=identicon - + - - - 6177 - - - 2018-03 - - - Attila Dusnoki - dati91@gmail.com - https://www.gravatar.com/avatar/fde69be0acdb5613950db1079d3c7758?default=identicon - . - - - Dzmitry Malyshau - kvarkus@gmail.com - https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon - ----------++++++++++++++ - - - Joshua Groves - josh@joshgroves.com - https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon - . - - - Kim Christensen - kimworking@gmail.com - https://www.gravatar.com/avatar/a03f4d56e65571977ce1b5eb270b46e3?default=identicon - . - - - Lymia Aluysia - lymia@lymiahugs.com - https://www.gravatar.com/avatar/84a2da5282611da98ffff005edf17ec3?default=identicon - . - - - Matt Jadczak - matt@mjdk.co.uk - https://www.gravatar.com/avatar/0b9be71027298c4586ae26c0818cd22a?default=identicon - . - - - Simon Heath - icefoxen@gmail.com - https://www.gravatar.com/avatar/03484f3b2ec38a95c61e814888424fc0?default=identicon - --++++ - - - grovesNL - josh@joshgroves.com - https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon - . - - - msiglreith - m.siglreith@gmail.com - https://www.gravatar.com/avatar/de76c8923acf8e324315012d4ee8ae78?default=identicon - - - - - 5873 - - - 2018-04 - - - Dzmitry Malyshau - kvarkus@gmail.com - https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon - --------+++++++++++++++ - - - Kim Christensen - kimworking@gmail.com - https://www.gravatar.com/avatar/a03f4d56e65571977ce1b5eb270b46e3?default=identicon - -----------------++++++ - - - 1082 - - - - - No metrics violations were found in the repository - - - The following responsibilities, by author, were found in the current revision of the repository (comments are excluded from the line count, if possible) - - - AIOOB - jack@rickard.plus.com - https://www.gravatar.com/avatar/b2c1a760af577313192d9557cf0bc3e5?default=identicon - - - src/backend/metal/src/device.rs - 185 - - - src/hal/src/device.rs - 122 - - - src/backend/vulkan/src/device.rs - 85 - - - src/backend/dx12/src/device.rs - 84 - - - src/backend/gl/src/device.rs - 67 - - - src/backend/empty/src/lib.rs - 41 - - - src/render/src/pso.rs - 30 - - - examples/hal/quad/main.rs - 16 - - - src/backend/dx12/src/root_constants.rs - 13 - - - src/hal/src/queue/submission.rs - 12 - - - - - Adrian Perreault - eladriano@gmail.com - https://www.gravatar.com/avatar/4444c7cabafeb65e93504d5de42b1259?default=identicon - - - src/hal/src/image.rs - 3 - - - - - Dzmitry Malyshau - kvarkus@gmail.com - https://www.gravatar.com/avatar/b50c6d04071ea8bdff5efdd831eb147a?default=identicon - - - src/backend/metal/src/command.rs - 826 - - - src/backend/dx12/src/device.rs - 556 - - - src/backend/dx12/src/command.rs - 351 - - - src/backend/vulkan/src/device.rs - 216 - - - src/backend/metal/src/device.rs - 206 - - - src/hal/src/image.rs - 128 - - - src/backend/vulkan/src/command.rs - 117 - - - src/backend/metal/src/soft.rs - 94 - - - src/warden/src/gpu.rs - 84 - - - src/backend/gl/src/device.rs - 75 - - - - - Kim Christensen - kimworking@gmail.com - https://www.gravatar.com/avatar/a03f4d56e65571977ce1b5eb270b46e3?default=identicon - - - src/hal/src/device.rs - 49 - - - src/hal/src/buffer.rs - 20 - - - src/hal/src/image.rs - 19 - - - src/hal/src/format.rs - 12 - - - src/backend/vulkan/src/conv.rs - 11 - - - src/hal/src/window.rs - 9 - - - src/backend/dx12/src/window.rs - 7 - - - src/backend/dx11/src/command.rs - 3 - - - examples/hal/quad/main.rs - 2 - - - src/hal/src/queue/mod.rs - 1 - - - - - Lymia Aluysia - lymia@lymiahugs.com - https://www.gravatar.com/avatar/84a2da5282611da98ffff005edf17ec3?default=identicon - - - src/backend/gl/src/window/glutin.rs - 4 - - - src/backend/vulkan/src/lib.rs - 2 - - - - - Matt Jadczak - matt@mjdk.co.uk - https://www.gravatar.com/avatar/0b9be71027298c4586ae26c0818cd22a?default=identicon - - - src/render/src/encoder.rs - 33 - - - src/render/src/pso.rs - 14 - - - src/hal/src/image.rs - 9 - - - src/backend/empty/src/lib.rs - 6 - - - src/backend/vulkan/src/command.rs - 5 - - - src/hal/src/command/render_pass.rs - 4 - - - src/backend/vulkan/src/window.rs - 4 - - - src/backend/vulkan/src/device.rs - 4 - - - src/support/src/shade.rs - 3 - - - src/hal/src/window.rs - 3 - - - - - Simon Heath - icefoxen@gmail.com - https://www.gravatar.com/avatar/03484f3b2ec38a95c61e814888424fc0?default=identicon - - - src/hal/src/pso/descriptor.rs - 12 - - - src/hal/src/command/raw.rs - 6 - - - src/hal/src/command/mod.rs - 5 - - - src/hal/src/command/transfer.rs - 4 - - - src/hal/src/image.rs - 2 - - - src/hal/src/command/graphics.rs - 2 - - - src/hal/src/window.rs - 1 - - - src/hal/src/pso/mod.rs - 1 - - - src/hal/src/pso/graphics.rs - 1 - - - src/hal/src/memory.rs - 1 - - - - - chell - chell@localhost.localdomain - https://www.gravatar.com/avatar/a272eced8366f0720275aad7b3b48a2f?default=identicon - - - src/hal/src/command/mod.rs - 4 - - - src/hal/src/device.rs - 3 - - - src/hal/src/queue/submission.rs - 2 - - - src/hal/src/queue/mod.rs - 1 - - - src/hal/src/command/render_pass.rs - 1 - - - - - grovesNL - josh@joshgroves.com - https://www.gravatar.com/avatar/61b12ba6f3022f527315dad875996243?default=identicon - - - src/backend/gl/src/device.rs - 23 - - - src/backend/dx12/src/conv.rs - 12 - - - src/backend/metal/src/device.rs - 1 - - - src/backend/dx12/src/device.rs - 1 - - - - - keringar - git@keringar.xyz - https://www.gravatar.com/avatar/1a7c9378d9880c16d77a393636a806f6?default=identicon - - - src/backend/vulkan/src/lib.rs - 12 - - - src/backend/dx12/src/lib.rs - 1 - - - - - msiglreith - m.siglreith@gmail.com - https://www.gravatar.com/avatar/de76c8923acf8e324315012d4ee8ae78?default=identicon - - - src/backend/dx12/src/format.rs - 934 - - - src/backend/dx12/src/device.rs - 62 - - - src/backend/dx12/src/conv.rs - 25 - - - src/hal/src/image.rs - 18 - - - src/backend/gl/src/conv.rs - 16 - - - src/backend/dx12/src/command.rs - 12 - - - src/backend/vulkan/src/device.rs - 10 - - - src/backend/vulkan/src/conv.rs - 5 - - - src/backend/dx12/src/native.rs - 4 - - - src/backend/dx12/src/lib.rs - 4 - - - - - omni-viral - scareaangel@gmail.com - https://www.gravatar.com/avatar/90cb234b4e9c8668029436d86a879a11?default=identicon - - - src/backend/gl/src/lib.rs - 50 - - - src/backend/metal/src/window.rs - 11 - - - src/backend/dx12/src/lib.rs - 11 - - - src/backend/metal/src/command.rs - 9 - - - src/backend/gl/src/window/glutin.rs - 6 - - - src/backend/dx12/src/window.rs - 6 - - - src/backend/metal/src/lib.rs - 5 - - - src/hal/src/window.rs - 4 - - - src/hal/src/queue/mod.rs - 4 - - - src/hal/src/device.rs - 4 - - - - - From 6f0c5873bb429e559e2ec4a275286e3114d20739 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Thu, 19 Apr 2018 15:28:07 +0200 Subject: [PATCH 31/58] [test] Add test for traverseNodesFromDocument function --- .../gitinspector/GitInspectorConverter.java | 2 +- .../test/TraverseNodesFromDocumentTest.java | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TraverseNodesFromDocumentTest.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index 685d57c5..7d353e3c 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -91,7 +91,7 @@ public Document createDocumentFromSource(String sourcePath) throws CodeMetropoli } } - private void traverseNodesFromDocument(Document doc) { + public void traverseNodesFromDocument(Document doc) { Node changesNode = doc.getElementsByTagName(CHANGES_TAG).item(0); Node authorsNode = changesNode.getChildNodes().item(3); NodeList authorNodes = authorsNode.getChildNodes(); diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TraverseNodesFromDocumentTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TraverseNodesFromDocumentTest.java new file mode 100644 index 00000000..c0d9600c --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TraverseNodesFromDocumentTest.java @@ -0,0 +1,57 @@ +package codemetropolis.toolchain.converter.gitinspector.test; + +import static org.junit.Assert.*; + +import java.util.HashMap; + +import org.junit.Test; +import org.w3c.dom.Document; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.commons.cdf.CdfProperty; +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; + +public class TraverseNodesFromDocumentTest { + + @Test + public void testTraverseNodesFromDocument() throws Exception { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + Document doc = TestHelper.newDocument(); + conv.traverseNodesFromDocument(doc); + HashMap elements = conv.getCdfElements(); + + CdfElement authorMetrics = new CdfElement("Teszt Bela", "author"); + CdfElement floorMetrics = new CdfElement("Teszt Bela", "floor-metrics"); + + authorMetrics.addProperty("email", "becike@beciakiraly.eu", CdfProperty.Type.STRING); + floorMetrics.addProperty("email", "becike@beciakiraly.eu", CdfProperty.Type.STRING); + + authorMetrics.addProperty("commits", "56", CdfProperty.Type.INT); + floorMetrics.addProperty("commits", "56", CdfProperty.Type.INT); + + authorMetrics.addProperty("insertions", "67", CdfProperty.Type.INT); + floorMetrics.addProperty("insertions", "67", CdfProperty.Type.INT); + + authorMetrics.addProperty("deletions", "54", CdfProperty.Type.INT); + floorMetrics.addProperty("deletions", "54", CdfProperty.Type.INT); + + authorMetrics.addProperty("POC", "57.55", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("POC", "57.55", CdfProperty.Type.FLOAT); + + authorMetrics.addProperty("rows", "61", CdfProperty.Type.INT); + floorMetrics.addProperty("rows", "61", CdfProperty.Type.INT); + + authorMetrics.addProperty("stability", "83.1", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("stability", "83.1", CdfProperty.Type.FLOAT); + + authorMetrics.addProperty("age", "0.8", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("age", "0.8", CdfProperty.Type.FLOAT); + + authorMetrics.addProperty("PIC", "4.32", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("PIC", "4.32", CdfProperty.Type.FLOAT); + + authorMetrics.addChildElement(floorMetrics); + + assertTrue(TestHelper.equals(authorMetrics, elements.get("Teszt Bela"))); + } +} From 5c087bcd61f8819c0f6fbd1fd0c97bd8b34b3ea0 Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Thu, 19 Apr 2018 15:47:56 +0200 Subject: [PATCH 32/58] Fixed the issue: you could add resources with invalid variable names and values. Display the types of the buildable attributes on the buildable tabs. --- .../gui/MappingFileEditorDialog.java | 7 +++--- .../gui/utils/BuildableSettings.java | 25 +++++++++++++++++++ .../main/resources/translations.properties | 2 +- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index a92d89f6..5795b268 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -215,7 +215,8 @@ public void actionPerformed(ActionEvent e) { int result = JOptionPane.showConfirmDialog(null, addResourcePanel, Translations.t("gui_add_resource_title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); if(result == JOptionPane.OK_OPTION) { - if (!(nameField.getText().isEmpty() || valueField.getText().isEmpty())) { + if (nameField.getText().matches("[a-zA-Z0-9]+") && + (valueField.getText().matches("[0-9]+(.[0-9]+)?")) || BuildableSettings.VALID_CHARACTER_TYPES.contains(valueField.getText())) { //Produce the resource string from the text fields... String resourceToAdd = nameField.getText() + ": " + valueField.getText(); //Add the newly defined resource to the property lists of the buildables and to the resource list (on top left of the window). @@ -228,7 +229,7 @@ public void actionPerformed(ActionEvent e) { else { JOptionPane.showMessageDialog( null, - Translations.t("gui_err_name_value_empty"), + Translations.t("gui_err_name_value_not_valid"), Translations.t("gui_err_title"), JOptionPane.ERROR_MESSAGE); } @@ -464,7 +465,7 @@ private JTable setUpBuildableTable(String buildableType) { Object[][] initData = new Object[displayedProperties.length][2]; for(int i = 0; i < displayedProperties.length; i++) { - initData[i][0] = displayedProperties[i]; + initData[i][0] = displayedProperties[i] + ": " + BuildableSettings.BUILDABLE_ATTRIBUTE_TYPES.get(displayedProperties[i]); initData[i][1] = null; } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java index 2e4d417c..22f4b4b6 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java @@ -21,6 +21,21 @@ public class BuildableSettings { */ public static final Map DEFAULT_SETTINGS = new HashMap<>(); + /** + * {@Map}, which contains the types (int, float(0 to 1),...) of the possible buildable attributes. + */ + public static final Map BUILDABLE_ATTRIBUTE_TYPES = new HashMap(); + + /** + * Stores the possible values, which can be applied to the buildable attributes "character" and "external_character". + */ + public static final List VALID_CHARACTER_TYPES = new ArrayList(Arrays.asList(new String[] { + "stone", "cobblestone", "mossy_stone", "sandstone", "obsidian", + "wood", "dark_wood", "birch_wood", "planks", "dark_planks", "metal", + "dirt", "sand", "red_sand", "brick", "stone_brick", "dark_brick", + "glass", "gold", "diamond" + })); + /** * Path of the file containing the settings. */ @@ -41,6 +56,16 @@ public class BuildableSettings { DISPLAYED_PROPERTIES.put("CELLAR", new String[] {}); DISPLAYED_PROPERTIES.put("GARDEN", new String[] {}); DISPLAYED_PROPERTIES.put("GROUND", new String[] {}); + + BUILDABLE_ATTRIBUTE_TYPES.put("width", "int"); + BUILDABLE_ATTRIBUTE_TYPES.put("height", "int"); + BUILDABLE_ATTRIBUTE_TYPES.put("length", "int"); + BUILDABLE_ATTRIBUTE_TYPES.put("character", "string"); + BUILDABLE_ATTRIBUTE_TYPES.put("external_character", "string"); + BUILDABLE_ATTRIBUTE_TYPES.put("torches", "int(0 to 5)"); + BUILDABLE_ATTRIBUTE_TYPES.put("tree-ratio", "float(0 to 1)"); + BUILDABLE_ATTRIBUTE_TYPES.put("mushroom-ratio", "float(0 to 1)"); + BUILDABLE_ATTRIBUTE_TYPES.put("flower-ratio", "float(0 to 1)"); } /** diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties index b1598356..979b8b05 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties @@ -88,7 +88,7 @@ gui_err_resources_empty_no_selected = The list of the resources is empty or ther gui_err_missing_cdf_file = There is no file existing on the path specified! gui_err_mkdir_project_failed = Failed to create project folder under minecraft root! gui_err_mkdir_sm_failed = Failed to create SourceMeter results folder! -gui_err_name_value_empty = Name and/or value cannot be empty! +gui_err_name_value_not_valid = The data you entered is not valid! gui_err_sm_exec_failed = Error during SourceMeter execution! gui_err_sm_run_failed = Failed to run SourceMeter! gui_err_unexpected_err = Unexpected error occured! From aa122ec0ad871b5a5931170974f0507019a03bfe Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Thu, 19 Apr 2018 15:52:39 +0200 Subject: [PATCH 33/58] Only accept input files with xml extension --- .../converter/gitinspector/GitInspectorConverter.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java index 7d353e3c..623ab7df 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/GitInspectorConverter.java @@ -82,6 +82,9 @@ public CdfElement createRootelement(Document doc) { public Document createDocumentFromSource(String sourcePath) throws CodeMetropolisException { try { File inputFile = new File(sourcePath); + if (!inputFile.getName().endsWith(".xml")) { + throw new CodeMetropolisException("The supplied file must have XML extension."); + } DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(inputFile); From 578662705f9c1d7f81cfebf6606c34ecf9d81b73 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Thu, 19 Apr 2018 16:42:50 +0200 Subject: [PATCH 34/58] [test] Add test for createElements function --- .../gitinspector/test/CreateElementsTest.java | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateElementsTest.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateElementsTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateElementsTest.java new file mode 100644 index 00000000..4f45af49 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateElementsTest.java @@ -0,0 +1,97 @@ +package codemetropolis.toolchain.converter.gitinspector.test; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.commons.cdf.CdfProperty; +import codemetropolis.toolchain.commons.cdf.CdfTree; +import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException; +import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; + +public class CreateElementsTest { + + private static String XML_SRC_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\GitInspectorOutput.xml"; + private static String INVALID_FORMAT_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\"; + + @Test + public void invalidPath() { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + try { + conv.createElements(""); + fail("This test should fail because the resource path is invalid."); + } catch (CodeMetropolisException e) { + } catch (Exception e) { + fail("the wrong type of exception returned."); + } + } + + @Test + public void invalidResource() { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + try { + conv.createElements(INVALID_FORMAT_PATH); + fail("This test should fail because the target resource is a library."); + } catch (CodeMetropolisException e) { + } catch (Exception e) { + fail("the wrong type of exception returned."); + } + } + + @Test + public void validPath() { + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + try { + conv.createElements(XML_SRC_PATH); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + @Test + public void testCreateElementsTest() { + CdfTree tree = new CdfTree(); + GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); + try { + tree = conv.createElements(XML_SRC_PATH); + } catch (Exception e) { + fail(e.getMessage()); + } + CdfElement authorMetrics = new CdfElement("Teszt Bela", "author"); + CdfElement floorMetrics = new CdfElement("Teszt Bela", "floor-metrics"); + CdfElement root = new CdfElement("gfx 2018/04/16", "root"); + + authorMetrics.addProperty("email", "becike@beciakiraly.eu", CdfProperty.Type.STRING); + floorMetrics.addProperty("email", "becike@beciakiraly.eu", CdfProperty.Type.STRING); + + authorMetrics.addProperty("commits", "56", CdfProperty.Type.INT); + floorMetrics.addProperty("commits", "56", CdfProperty.Type.INT); + + authorMetrics.addProperty("insertions", "67", CdfProperty.Type.INT); + floorMetrics.addProperty("insertions", "67", CdfProperty.Type.INT); + + authorMetrics.addProperty("deletions", "54", CdfProperty.Type.INT); + floorMetrics.addProperty("deletions", "54", CdfProperty.Type.INT); + + authorMetrics.addProperty("POC", "57.55", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("POC", "57.55", CdfProperty.Type.FLOAT); + + authorMetrics.addProperty("rows", "61", CdfProperty.Type.INT); + floorMetrics.addProperty("rows", "61", CdfProperty.Type.INT); + + authorMetrics.addProperty("stability", "83.1", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("stability", "83.1", CdfProperty.Type.FLOAT); + + authorMetrics.addProperty("age", "0.8", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("age", "0.8", CdfProperty.Type.FLOAT); + + authorMetrics.addProperty("PIC", "4.32", CdfProperty.Type.FLOAT); + floorMetrics.addProperty("PIC", "4.32", CdfProperty.Type.FLOAT); + + authorMetrics.addChildElement(floorMetrics); + root.addChildElement(authorMetrics); + + assertTrue(TestHelper.equals(root, tree.getRoot())); + } +} From 19265ff3c6d8f4ef038eebd205294326c7f6d24e Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Thu, 19 Apr 2018 16:45:12 +0200 Subject: [PATCH 35/58] [test] Remove warnings from unit tests --- .../gitinspector/test/CreateDocumentFromSourceTest.java | 3 +-- .../converter/gitinspector/test/UpdateMetricsTest.java | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java index 5f6e41c9..de0f9124 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java @@ -3,7 +3,6 @@ import static org.junit.Assert.*; import org.junit.Test; -import org.w3c.dom.Document; import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; @@ -40,7 +39,7 @@ public void invalidResource() { public void validPath() { GitInspectorConverter conv = TestHelper.newGitInspectorConverter(); try { - Document d = conv.createDocumentFromSource(XML_SRC_PATH); + conv.createDocumentFromSource(XML_SRC_PATH); } catch (Exception e) { fail(e.getMessage()); } diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java index e153643c..2fbe0604 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java @@ -3,7 +3,6 @@ import static org.junit.Assert.*; import org.junit.Test; -import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; From 2749f81122553a5ddbb7e7235ae4ae683c626066 Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Thu, 19 Apr 2018 19:53:49 +0200 Subject: [PATCH 36/58] Fix issue: resource file cannot be found. --- .../gui/MappingFileEditorDialog.java | 5 ++-- .../gui/utils/BuildableSettings.java | 28 ++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index 5795b268..b0b0f060 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -116,8 +116,9 @@ private enum AssignResult {CANNOT_ASSIGN, NO_CONVERSION, TO_INT, TO_DOUBLE, NORM */ private void loadDisplayedInfo(String cdfFilePath) { try { - displayedBuildableAttributes = BuildableSettings.readSettings(); - BuildableSettings.displaySettings(); + BuildableSettings settings = new BuildableSettings(); + displayedBuildableAttributes = settings.readSettings(); + settings.displaySettings(); PropertyCollector pc = new PropertyCollector(); sourceCodeElementProperties = pc.getFromCdf(cdfFilePath); diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java index 22f4b4b6..1dd232ab 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java @@ -3,13 +3,16 @@ import java.util.List; import java.io.BufferedReader; import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.net.URL; + import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException; /** @@ -36,10 +39,11 @@ public class BuildableSettings { "glass", "gold", "diamond" })); - /** - * Path of the file containing the settings. - */ - private static final String CFG_FILEPATH ="./src/main/resources/buildableProperties.cmcfg"; + private URL urlToDictionary; + + public BuildableSettings() { + urlToDictionary = this.getClass().getResource("/" + "buildableProperties.cmcfg"); + } /** * {@link Map}, serves containing the buildable types(floor, garden, ...) and its assigned properties(height, character, ...). @@ -74,12 +78,16 @@ public class BuildableSettings { * @throws BadConfigFileFomatException If the format of the configuration file is not appropriate. * @throws FileNotFoundException If the configuration file cannot be found. */ - public static Map readSettings() throws BadConfigFileFomatException, FileNotFoundException{ - BufferedReader cfgFileReader = null; + public Map readSettings() throws BadConfigFileFomatException, FileNotFoundException{ - cfgFileReader = new BufferedReader(new FileReader(CFG_FILEPATH)); + BufferedReader cfgFileReader = null; + //new BufferedReader(new FileReader(CFG_FILEPATH)); - try{ + try { + InputStream stream = urlToDictionary.openStream(); + + cfgFileReader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); + String actLine; //A regular line: buildable name is followed by an '=' sign, that follows the list of attributes separated by commas. while((actLine = cfgFileReader.readLine()).split("=").length == 2) { @@ -137,7 +145,7 @@ private static boolean validateProperties(String buildableType, String[] buildab /** * Writes to the console, what display settings will be provided to the Mapping file editor GUI. */ - public static void displaySettings() { + public void displaySettings() { try { Map returnedSettings = readSettings(); From d5cb02b02f9bd1fd16931eba48cd775d680884f2 Mon Sep 17 00:00:00 2001 From: tkeri Date: Thu, 19 Apr 2018 23:36:54 +0200 Subject: [PATCH 37/58] Add checking to drag and drop feature Fix invalid column dropping and invalid builtin attribute and metric assign. Add quantization dialog class and add quantization class. Extend mapping editor dialog: - add conversion data members - add tabels getters - add action listener to conversion button, but there is not effect. Fix typo NormalizeConversion class name. --- .../gui/MappingFileEditorDialog.java | 129 ++++++++++++++---- .../gui/QuantizationSetterDialog.java | 33 +++++ .../gui/beans/QuantizationInformation.java | 38 ++++++ ...nversion.java => NormalizeConversion.java} | 2 +- .../toolchain/gui/utils/TransferHelper.java | 75 +++++++++- 5 files changed, 247 insertions(+), 30 deletions(-) create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/QuantizationInformation.java rename sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/{NormailzeConversion.java => NormalizeConversion.java} (50%) diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index b0b0f060..dd9454ee 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -7,6 +7,7 @@ import java.awt.event.ActionListener; import java.awt.Rectangle; import java.io.FileNotFoundException; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -28,12 +29,15 @@ import javax.swing.filechooser.FileFilter; import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException; +import codemetropolis.toolchain.gui.beans.QuantizationInformation; import codemetropolis.toolchain.gui.components.CMButton; import codemetropolis.toolchain.gui.components.CMCheckBox; import codemetropolis.toolchain.gui.components.CMLabel; import codemetropolis.toolchain.gui.components.CMScrollPane; import codemetropolis.toolchain.gui.components.CMTextField; import codemetropolis.toolchain.gui.components.listeners.BrowseListener; +import codemetropolis.toolchain.gui.conversions.Conversion; +import codemetropolis.toolchain.gui.conversions.QuantizationConversion; import codemetropolis.toolchain.gui.utils.BuildableSettings; import codemetropolis.toolchain.gui.utils.Property; import codemetropolis.toolchain.gui.utils.PropertyCollector; @@ -48,16 +52,34 @@ public class MappingFileEditorDialog extends JDialog { private static final long serialVersionUID = 1L; - private static final FileFilter XML_FILTER = new XmlFileFilter(); + private static final FileFilter XML_FILTER; + + static public List cellarConversion; + static public List gardenConversion; + static public List floorConversion; + + static public Map cellarQuant; + static public Map gardenQuant; + static public Map floorQuant; /** * Contains the possible results of assigning a metric to a property of a buildable type. */ - private enum AssignResult {CANNOT_ASSIGN, NO_CONVERSION, TO_INT, TO_DOUBLE, NORMALIZE, QUANTIZATON}; + public enum AssignResult {CANNOT_ASSIGN, NO_CONVERSION, TO_INT, TO_DOUBLE, NORMALIZE, QUANTIZATON}; - private static final Map> ASSIGN_RESULT_MATRIX; + public static final Map> ASSIGN_RESULT_MATRIX; static { + XML_FILTER = new XmlFileFilter(); + + cellarConversion = new ArrayList(); + gardenConversion = new ArrayList(); + floorConversion = new ArrayList(); + + cellarQuant = new HashMap(); + gardenQuant = new HashMap(); + floorQuant = new HashMap(); + ASSIGN_RESULT_MATRIX = new HashMap>(); ASSIGN_RESULT_MATRIX.put("int", new HashMap()); @@ -90,9 +112,9 @@ private enum AssignResult {CANNOT_ASSIGN, NO_CONVERSION, TO_INT, TO_DOUBLE, NORM private JPanel floorPanel; private JPanel gardenPanel; private JPanel groundPanel; - private JTable cellarTable; - private JTable floorTable; - private JTable gardenTable; + private static JTable cellarTable; + private static JTable floorTable; + private static JTable gardenTable; //ListModel and JList for the buildables: cellar, floor, garden private ListModel cellarListmodel; @@ -469,7 +491,7 @@ private JTable setUpBuildableTable(String buildableType) { initData[i][0] = displayedProperties[i] + ": " + BuildableSettings.BUILDABLE_ATTRIBUTE_TYPES.get(displayedProperties[i]); initData[i][1] = null; } - + JTable table = new JTable(initData, columnNames); table.setFont(new Font("Source Sans Pro", Font.PLAIN, 14)); table.setRowHeight(30); @@ -482,7 +504,7 @@ private JTable setUpBuildableTable(String buildableType) { return table; } - + /** * Fills up the list model of the given source code element type with its own properties/metrics. * @param sourceCodeElementType Type of the source code element (method, attribute, etc.). @@ -490,7 +512,7 @@ private JTable setUpBuildableTable(String buildableType) { */ private ListModel initializeListModel(String sourceCodeElementType) { List propertyList = sourceCodeElementProperties.get(sourceCodeElementType); - + DefaultListModel model = new DefaultListModel(); for(Property p : propertyList) { @@ -507,26 +529,81 @@ private ListModel initializeListModel(String sourceCodeElementType) { private void addConversionOptions(JPanel panel) { CMButton conversionButton = new CMButton(Translations.t("gui_b_conversions"), 10, 490, 150, 30); panel.add(conversionButton); - } - /** - * @return floorTable - */ - public JTable getFloorTable() { - return floorTable; - } + conversionButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + int index; + String buildableAttribute; + String metric; - /** - * @return gardenTable - */ - public JTable getGardenTable() { - return gardenTable; + for (Conversion element : cellarConversion) { + if ( element instanceof QuantizationConversion ) { + QuantizationInformation cellar = new QuantizationInformation(); + + index = cellarConversion.indexOf(element); + buildableAttribute = (String) cellarTable.getModel().getValueAt(index, 0); + metric = (String) cellarTable.getModel().getValueAt(index, 1); + + cellar.setIndex(index); + cellar.setBuildableAttribute(buildableAttribute); + cellar.setMetric(metric); + + cellarQuant.put(cellar, new QuantizationConversion()); + } + } + for (Conversion element : gardenConversion) { + if ( element instanceof QuantizationConversion ) { + QuantizationInformation garden = new QuantizationInformation(); + + index = gardenConversion.indexOf(element); + buildableAttribute = (String) gardenTable.getModel().getValueAt(index, 0); + metric = (String) gardenTable.getModel().getValueAt(index, 1); + + garden.setIndex(index); + garden.setBuildableAttribute(buildableAttribute); + garden.setMetric(metric); + + cellarQuant.put(garden, new QuantizationConversion()); + } + } + for (Conversion element : floorConversion) { + if ( element instanceof QuantizationConversion ) { + QuantizationInformation floor = new QuantizationInformation(); + + index = floorConversion.indexOf(element); + buildableAttribute = (String) floorTable.getModel().getValueAt(index, 0); + metric = (String) floorTable.getModel().getValueAt(index, 1); + + floor.setIndex(index); + floor.setBuildableAttribute(buildableAttribute); + floor.setMetric(metric); + + cellarQuant.put(floor, new QuantizationConversion()); + } + } + } + }); } - /** - * @return cellarTable - */ - public JTable getCellarTable() { - return cellarTable; + /** + * @return floorTable + */ + public static JTable getFloorTable() { + return floorTable; + } + + /** + * @return gardenTable + */ + public static JTable getGardenTable() { + return gardenTable; + } + + /** + * @return cellarTable + */ + public static JTable getCellarTable() { + return cellarTable; } } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java new file mode 100644 index 00000000..e2c3bc91 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java @@ -0,0 +1,33 @@ +package codemetropolis.toolchain.gui; + +import javax.swing.JDialog; + +import codemetropolis.toolchain.gui.beans.QuantizationInformation; +import codemetropolis.toolchain.gui.components.CMButton; +import codemetropolis.toolchain.gui.components.CMComboBox; +import codemetropolis.toolchain.gui.components.CMTextField; + +public class QuantizationSetterDialog extends JDialog { + /** + * + */ + private static final long serialVersionUID = 1L; + + MappingFileEditorDialog parent; + + CMTextField gardenTexField; + CMTextField cellarTexField; + CMTextField floorTexField; + + CMButton gardenButton; + CMButton cellarButton; + CMButton floorButton; + + CMComboBox gardenComboBox; + CMComboBox cellarComboBox; + CMComboBox floorComboBox; + + public QuantizationSetterDialog(MappingFileEditorDialog parent) { + this.parent = parent; + } +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/QuantizationInformation.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/QuantizationInformation.java new file mode 100644 index 00000000..32900864 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/QuantizationInformation.java @@ -0,0 +1,38 @@ +package codemetropolis.toolchain.gui.beans; + +public class QuantizationInformation { + private int index; + private String buildableAttribute; + private String metric; + + public QuantizationInformation() { + } + + public int getIndex() { + return index; + } + + public void setIndex(int index) { + this.index = index; + } + + public String getBuildableAttribute() { + return buildableAttribute; + } + + public void setBuildableAttribute(String buildableAttribute) { + this.buildableAttribute = buildableAttribute; + } + + public String getMetric() { + return metric; + } + + public void setMetric(String metric) { + this.metric = metric; + } + + public String toString() { + return index + ";" + buildableAttribute + ";" + metric; + } +} diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormailzeConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormalizeConversion.java similarity index 50% rename from sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormailzeConversion.java rename to sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormalizeConversion.java index c1c7dba9..4b0b4db6 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormailzeConversion.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormalizeConversion.java @@ -1,5 +1,5 @@ package codemetropolis.toolchain.gui.conversions; -public class NormailzeConversion extends Conversion { +public class NormalizeConversion extends Conversion { } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java index 16888aea..6b329eca 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java @@ -4,12 +4,17 @@ import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.Point; import java.io.IOException; +import java.util.List; import javax.swing.JComponent; import javax.swing.JTable; import javax.swing.TransferHandler; +import codemetropolis.toolchain.gui.MappingFileEditorDialog; +import codemetropolis.toolchain.gui.conversions.*; + public class TransferHelper extends TransferHandler { @@ -18,6 +23,65 @@ public class TransferHelper extends TransferHandler { public TransferHelper() { } + public boolean typeChecker (Object obj, JTable target, int row, int col) { + int currCol = col -1; + + if (col == 0) { return false; } + + Object value = target.getModel().getValueAt(row, currCol); + String dragValue = obj.toString(); + String dropValue = value.toString(); + + JTable currGardenTable = MappingFileEditorDialog.getGardenTable(); + JTable currFloorTable = MappingFileEditorDialog.getFloorTable(); + JTable currCellarTable = MappingFileEditorDialog.getCellarTable(); + + List conversionList = null; + + if (target == currGardenTable) { + conversionList = MappingFileEditorDialog.gardenConversion; + } + + if (target == currFloorTable) { + conversionList = MappingFileEditorDialog.floorConversion; + } + + if (target == currCellarTable) { + conversionList = MappingFileEditorDialog.cellarConversion; + } + + dragValue = dragValue.split(": ")[1]; + dropValue = dropValue.split(": ")[1]; + + switch (MappingFileEditorDialog.ASSIGN_RESULT_MATRIX.get(dropValue).get(dragValue)) { + case CANNOT_ASSIGN: + return false; + + case NO_CONVERSION: + conversionList.add(row, new EmptyConversion()); + return true; + + case TO_INT: + conversionList.add(row, new ToIntConversion()); + return true; + + case TO_DOUBLE: + conversionList.add(row, new ToDoubleConversion()); + return true; + + case NORMALIZE: + conversionList.add(row, new NormalizeConversion()); + return true; + + case QUANTIZATON: + conversionList.add(row, new QuantizationConversion()); + return true; + + default: + return true; + } + } + @Override public int getSourceActions(JComponent c) { return MOVE; @@ -34,13 +98,19 @@ public boolean canImport(TransferSupport support) { // Can only import into another JTable Component comp = support.getComponent(); if (comp instanceof JTable) { + JTable target = (JTable) comp; + DropLocation dl = support.getDropLocation(); + Point dp = dl.getDropPoint(); + int dropCol = target.columnAtPoint(dp); + int dropRow = target.rowAtPoint(dp); + try { // Get the Transferable, we need to check // the constraints Transferable t = support.getTransferable(); Object obj = t.getTransferData(DataFlavor.stringFlavor); if (obj != null) { - canImport = true; + canImport = typeChecker(obj, target, dropRow, dropCol); } } catch (UnsupportedFlavorException | IOException ex) { ex.printStackTrace(); @@ -59,7 +129,7 @@ public boolean importData(TransferSupport support) { JTable target = (JTable) comp; // Need to know where we are importing to... DropLocation dl = support.getDropLocation(); - java.awt.Point dp = dl.getDropPoint(); + Point dp = dl.getDropPoint(); int dropCol = target.columnAtPoint(dp); int dropRow = target.rowAtPoint(dp); try { @@ -70,7 +140,6 @@ public boolean importData(TransferSupport support) { target.setValueAt(obj, dropRow, dropCol); imported = true; - } catch (UnsupportedFlavorException | IOException ex) { ex.printStackTrace(); } From b39cb2011e62043772dea6e4c0ffa78f5b4d6ee9 Mon Sep 17 00:00:00 2001 From: tkeri Date: Fri, 20 Apr 2018 15:14:06 +0200 Subject: [PATCH 38/58] Add unit test cases and javadoc Add unit test to typeChecker method in TransferHelper class. Add unit test to validateProperties method in BuildableSettings class. --- .../gui/QuantizationSetterDialog.java | 9 ++++-- .../gui/beans/QuantizationInformation.java | 5 +++ .../gui/utils/BuildableSettings.java | 2 +- .../toolchain/gui/utils/TransferHelper.java | 17 +++++++++- .../gui/utils/BuildableSettingsTest.java | 24 ++++++++++++++ .../gui/utils/TransferHelperTest.java | 31 +++++++++++++++++++ 6 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java create mode 100644 sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/TransferHelperTest.java diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java index e2c3bc91..45059d7b 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java @@ -7,10 +7,13 @@ import codemetropolis.toolchain.gui.components.CMComboBox; import codemetropolis.toolchain.gui.components.CMTextField; +/** + * This class is define the view of + * quantization dialog. + * + * @author Tamas Keri {@literal } + */ public class QuantizationSetterDialog extends JDialog { - /** - * - */ private static final long serialVersionUID = 1L; MappingFileEditorDialog parent; diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/QuantizationInformation.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/QuantizationInformation.java index 32900864..96570af4 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/QuantizationInformation.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/QuantizationInformation.java @@ -1,5 +1,10 @@ package codemetropolis.toolchain.gui.beans; +/** + * Contains the quantization information. + * + * @author Tamas Keri {@literal } + */ public class QuantizationInformation { private int index; private String buildableAttribute; diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java index 1dd232ab..70bbfaef 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java @@ -132,7 +132,7 @@ public Map readSettings() throws BadConfigFileFomatException, * @param buildabeAttributes The array of the attributes which are examined if they are valid or not. * @return All of the specified buildable attributes are valid or not. */ - private static boolean validateProperties(String buildableType, String[] buildabeAttributes) { + static boolean validateProperties(String buildableType, String[] buildabeAttributes) { List validProperties = new ArrayList(Arrays.asList(DEFAULT_SETTINGS.get(buildableType))); for(String property : buildabeAttributes) { if(!validProperties.contains(property)) { diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java index 6b329eca..f706e627 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java @@ -11,11 +11,17 @@ import javax.swing.JComponent; import javax.swing.JTable; import javax.swing.TransferHandler; +import javax.swing.filechooser.FileFilter; import codemetropolis.toolchain.gui.MappingFileEditorDialog; import codemetropolis.toolchain.gui.conversions.*; - +/** + * This class is used to handle the transfer of + * a Transferable to and from Swing components. + * + * @author Tamas Keri {@literal } + */ public class TransferHelper extends TransferHandler { private static final long serialVersionUID = 1L; @@ -23,6 +29,15 @@ public class TransferHelper extends TransferHandler { public TransferHelper() { } + /** + * Checking dropping available + * + * @param obj dragged object + * @param target the target table + * @param row row of target table + * @param col column of target table + * @return boolean available dropping + */ public boolean typeChecker (Object obj, JTable target, int row, int col) { int currCol = col -1; diff --git a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java new file mode 100644 index 00000000..23691290 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java @@ -0,0 +1,24 @@ +package codemetropolis.toolchain.gui.utils; + +import java.io.IOException; +import org.junit.Assert; +import org.junit.Test; + +/** + * Test class for testing the {@link BuildableSettings}. + * + * @author Tamas Keri {@literal } + */ +public class BuildableSettingsTest { + + /** + * @throws IOException if it is true. + */ + @Test + public void testNonValidateProperties() throws IOException { + String buildableName = "FLOOR"; + String[] buildableProperties = {"sdg", "int"}; + boolean result = BuildableSettings.validateProperties(buildableName, buildableProperties); + Assert.assertEquals(result, false); + } +} diff --git a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/TransferHelperTest.java b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/TransferHelperTest.java new file mode 100644 index 00000000..b83eb12b --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/TransferHelperTest.java @@ -0,0 +1,31 @@ +package codemetropolis.toolchain.gui.utils; + +import java.io.IOException; + +import javax.swing.JTable; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Test class for testing the {@link TransferHelper}. + * + * @author Tamas Keri {@literal } + */ +public class TransferHelperTest { + TransferHelper helper = new TransferHelper(); + + /** + * @throws IOException if it is true. + */ + @Test + public void testNonTypeChecker() throws IOException { + int row = 0; + int col = 0; + Object obj = new JTable(); + JTable table = new JTable(); + boolean result = helper.typeChecker(obj, table, row, col); + + Assert.assertEquals(result, false); + } +} From 605b9ae55fc9646f109e4a33cbd1032c883a8991 Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Fri, 20 Apr 2018 15:50:02 +0200 Subject: [PATCH 39/58] Added javadoc comments, created dialog for setting quantization conversion, some refactoring. --- .../toolchain/gui/CodeMetropolisGUI.java | 28 ++++-- .../gui/MappingFileEditorDialog.java | 16 +-- .../gui/QuantizationSetterDialog.java | 98 ++++++++++++++++++- .../beans/BadConfigFileFomatException.java | 1 + .../gui/components/CMScrollPane.java | 1 + .../listeners/MappingEditorListener.java | 38 ------- .../toolchain/gui/conversions/Conversion.java | 5 + .../gui/conversions/EmptyConversion.java | 5 + .../gui/conversions/NormalizeConversion.java | 5 + .../conversions/QuantizationConversion.java | 1 + .../gui/conversions/ToDoubleConversion.java | 4 + .../gui/conversions/ToIntConversion.java | 4 + .../gui/utils/BuildableSettings.java | 7 +- .../toolchain/gui/utils/Property.java | 1 + .../gui/utils/PropertyCollector.java | 10 +- .../main/resources/translations.properties | 5 + 16 files changed, 165 insertions(+), 64 deletions(-) delete mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/MappingEditorListener.java diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java index 30992a1c..8250a286 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java @@ -217,18 +217,17 @@ private final void addMappingOptions(JPanel panel) { @Override public void actionPerformed(ActionEvent event) { - File cdfXmlFile = new File(mappingEditorCdfPath.getText()); - if(!cdfXmlFile.exists()) { - JOptionPane.showMessageDialog( + if(!checkInputCdfFile(mappingEditorCdfPath.getText())) { + JOptionPane.showMessageDialog( self, Translations.t("gui_err_missing_cdf_file"), Translations.t("gui_err_title"), JOptionPane.ERROR_MESSAGE); - } - else { - MappingFileEditorDialog dialog = new MappingFileEditorDialog(mappingEditorCdfPath.getText(), self); + } + else { + MappingFileEditorDialog dialog = new MappingFileEditorDialog(mappingEditorCdfPath.getText(), self); dialog.setVisible(true); - } + } } }); @@ -317,6 +316,21 @@ public void actionPerformed(ActionEvent event) { panel.add(start); } + + /** + * Chacks if the input cdf file does exist or not. + * @param cdfPath The path of the cdf file. + * @return The cdf file exists or not. + */ + public boolean checkInputCdfFile(String cdfPath) { + File cdfXmlFile = new File(cdfPath); + if(!cdfXmlFile.exists()) { + return false; + } + else { + return true; + } + } /** * Fills the data required for the metric generation tools. diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index dd9454ee..cd4183dc 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -47,6 +47,7 @@ /** * Dialog for the mapping file editor. + * @author Viktor Meszaros {@literal } */ public class MappingFileEditorDialog extends JDialog { @@ -140,11 +141,9 @@ private void loadDisplayedInfo(String cdfFilePath) { try { BuildableSettings settings = new BuildableSettings(); displayedBuildableAttributes = settings.readSettings(); - settings.displaySettings(); PropertyCollector pc = new PropertyCollector(); sourceCodeElementProperties = pc.getFromCdf(cdfFilePath); - pc.displayProperties(); } catch(BadConfigFileFomatException e) { JOptionPane.showMessageDialog( @@ -443,7 +442,6 @@ private void createGardenTab() { gardenList.setVisibleRowCount(-1); gardenList.setDragEnabled(true); gardenList.setDropMode(DropMode.INSERT); -// gardenList.setTransferHandler(new ListTransferHandler()); CMScrollPane gardenScrollPane = new CMScrollPane(gardenList, 525, 50, 240, 180); @@ -510,7 +508,7 @@ private JTable setUpBuildableTable(String buildableType) { * @param sourceCodeElementType Type of the source code element (method, attribute, etc.). * @return The {@link ListModel} contains all of the properties/metrics. */ - private ListModel initializeListModel(String sourceCodeElementType) { + public ListModel initializeListModel(String sourceCodeElementType) { List propertyList = sourceCodeElementProperties.get(sourceCodeElementType); DefaultListModel model = new DefaultListModel(); @@ -529,7 +527,8 @@ private ListModel initializeListModel(String sourceCodeElementType) { private void addConversionOptions(JPanel panel) { CMButton conversionButton = new CMButton(Translations.t("gui_b_conversions"), 10, 490, 150, 30); panel.add(conversionButton); - + + MappingFileEditorDialog self = this; conversionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { @@ -564,7 +563,7 @@ public void actionPerformed(ActionEvent arg0) { garden.setBuildableAttribute(buildableAttribute); garden.setMetric(metric); - cellarQuant.put(garden, new QuantizationConversion()); + gardenQuant.put(garden, new QuantizationConversion()); } } for (Conversion element : floorConversion) { @@ -579,9 +578,12 @@ public void actionPerformed(ActionEvent arg0) { floor.setBuildableAttribute(buildableAttribute); floor.setMetric(metric); - cellarQuant.put(floor, new QuantizationConversion()); + floorQuant.put(floor, new QuantizationConversion()); } } + QuantizationSetterDialog dialog = new QuantizationSetterDialog(self); + dialog.setVisible(true); + } }); } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java index 45059d7b..2ffd26f8 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java @@ -1,26 +1,35 @@ package codemetropolis.toolchain.gui; +import java.awt.Dimension; +import java.util.Set; + import javax.swing.JDialog; +import javax.swing.JPanel; import codemetropolis.toolchain.gui.beans.QuantizationInformation; import codemetropolis.toolchain.gui.components.CMButton; import codemetropolis.toolchain.gui.components.CMComboBox; +import codemetropolis.toolchain.gui.components.CMLabel; import codemetropolis.toolchain.gui.components.CMTextField; +import codemetropolis.toolchain.gui.utils.BuildableSettings; +import codemetropolis.toolchain.gui.utils.Translations; /** * This class is define the view of * quantization dialog. * * @author Tamas Keri {@literal } + * @author Viktor Meszaros {@literal } */ public class QuantizationSetterDialog extends JDialog { + private static final long serialVersionUID = 1L; MappingFileEditorDialog parent; - CMTextField gardenTexField; - CMTextField cellarTexField; - CMTextField floorTexField; + CMTextField gardenTextField; + CMTextField cellarTextField; + CMTextField floorTextField; CMButton gardenButton; CMButton cellarButton; @@ -32,5 +41,88 @@ public class QuantizationSetterDialog extends JDialog { public QuantizationSetterDialog(MappingFileEditorDialog parent) { this.parent = parent; + JPanel panel = createBasePanel(); + addCellarComponents(panel); + addFloorComponents(panel); + addGardenComponents(panel); + addSaveComponents(panel); + + this.setResizable(false); + this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); + this.setContentPane(panel); + this.pack(); + this.setLocationRelativeTo(parent); + } + + private JPanel createBasePanel() { + JPanel panel = new JPanel(); + panel.setLayout(null); + panel.setBounds(0, 0, 300, 500); + + Dimension size = new Dimension(300, 500); + panel.setMinimumSize(size); + panel.setPreferredSize(size); + panel.setMaximumSize(size); + + return panel; + } + + private void addCellarComponents(JPanel panel) { + CMLabel forCellarLabel = new CMLabel(Translations.t("gui_buildable_cellar"), 0, 0, 120, 30); + cellarComboBox = new CMComboBox(fillComboBox("CELLAR"), 0, 40, 250, 30); + cellarTextField = new CMTextField(0, 80, 160, 30); + cellarButton = new CMButton(Translations.t("gui_b_add_level_value"), 170, 120, 80, 30); + panel.add(forCellarLabel); + panel.add(cellarComboBox); + panel.add(cellarTextField); + panel.add(cellarButton); + } + + private void addFloorComponents(JPanel panel) { + CMLabel forFloorLabel = new CMLabel(Translations.t("gui_buildable_floor"), 0, 180, 120, 30); + floorComboBox = new CMComboBox(fillComboBox("FLOOR"), 0, 220, 250, 30); + floorTextField = new CMTextField(0, 260, 160, 30); + floorButton = new CMButton(Translations.t("gui_b_add_level_value"), 170, 300, 80, 30); + panel.add(forFloorLabel); + panel.add(floorComboBox); + panel.add(floorTextField); + panel.add(floorButton); + } + + private void addGardenComponents(JPanel panel) { + CMLabel forGardenLabel = new CMLabel(Translations.t("gui_buildable_garden"), 0, 340, 120, 30); + gardenComboBox = new CMComboBox(fillComboBox("GARDEN"), 0, 380, 250, 30); + gardenTextField = new CMTextField(0, 80, 160, 30); + gardenButton = new CMButton(Translations.t("gui_b_add_level_value"), 170, 420, 80, 30); + panel.add(forGardenLabel); + panel.add(gardenComboBox); + panel.add(gardenTextField); + panel.add(gardenButton); + } + + private void addSaveComponents(JPanel panel) { + CMButton saveButton = new CMButton(Translations.t("gui_b_save_settings"), 0, 460, 100, 30); + panel.add(saveButton); + } + + private QuantizationInformation[] fillComboBox(String buildableType) { + Set acceptedTypes = BuildableSettings.DEFAULT_SETTINGS.keySet(); + String inputType = buildableType.toUpperCase(); + if (acceptedTypes.contains(inputType)) { + Set set = null; + if(inputType.equals("CELLAR")) { + set = MappingFileEditorDialog.cellarQuant.keySet(); + } + if(inputType.equals("FLOOR")) { + set = MappingFileEditorDialog.floorQuant.keySet(); + } + if(inputType.equals("GARDEN")) { + set = MappingFileEditorDialog.gardenQuant.keySet(); + } + QuantizationInformation[] boxItems = new QuantizationInformation[set.size()]; + boxItems = set.toArray(boxItems); + return boxItems; + } + else return null; } } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java index cd1d13a9..1b4fa07b 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/beans/BadConfigFileFomatException.java @@ -3,6 +3,7 @@ /** * Exception class for handling exceptions that occur because of * the bad format of the configuration file containing the buildable attributes desired to display. + * @author Viktor Meszaros {@literal } */ public class BadConfigFileFomatException extends Exception { diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java index 7234947b..21b40be4 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMScrollPane.java @@ -8,6 +8,7 @@ /** * Custom scroll pane class for setting custom defaults for the JComboBoxes we use. + * @author Viktor Meszaros {@literal } + * + */ public abstract class Conversion { } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java index f369805f..2763a5e9 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java @@ -1,5 +1,10 @@ package codemetropolis.toolchain.gui.conversions; +/** + * Class for representing an empty conversion (when there is no conversion needed). + * @author Viktor Meszaros {@literal } + * + */ public class EmptyConversion extends Conversion { } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormalizeConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormalizeConversion.java index 4b0b4db6..e9d14bb1 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormalizeConversion.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormalizeConversion.java @@ -1,5 +1,10 @@ package codemetropolis.toolchain.gui.conversions; +/** + * Class for representing a normalize conversion. + * @author Viktor Meszaros {@literal } + * + */ public class NormalizeConversion extends Conversion { } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java index 8d1263f4..b05a6b1e 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java @@ -5,6 +5,7 @@ /** * Class for representing a quantization conversion. + * @author Viktor Meszaros {@literal } */ public class QuantizationConversion extends Conversion { private List levels; diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java index 47e83ee5..b17ccbce 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java @@ -1,5 +1,9 @@ package codemetropolis.toolchain.gui.conversions; +/** + * Class for representing a toDouble conversion. + * @author Viktor Meszaros {@literal } + */ public class ToDoubleConversion extends Conversion{ } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java index e9de3de1..b54cf56a 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java @@ -1,5 +1,9 @@ package codemetropolis.toolchain.gui.conversions; +/** + * Class for representing a toInt conversion. + * @author Viktor Meszaros {@literal } + */ public class ToIntConversion extends Conversion { } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java index 70bbfaef..3ff25834 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java @@ -17,6 +17,7 @@ /** * This class is responsible for providing information which buildable attributes are desired by the user to display on the GUI. + * @author Viktor Meszaros {@literal } */ public class BuildableSettings { /** @@ -81,7 +82,6 @@ public BuildableSettings() { public Map readSettings() throws BadConfigFileFomatException, FileNotFoundException{ BufferedReader cfgFileReader = null; - //new BufferedReader(new FileReader(CFG_FILEPATH)); try { InputStream stream = urlToDictionary.openStream(); @@ -145,7 +145,7 @@ static boolean validateProperties(String buildableType, String[] buildabeAttribu /** * Writes to the console, what display settings will be provided to the Mapping file editor GUI. */ - public void displaySettings() { + public void displaySettings() throws BadConfigFileFomatException { try { Map returnedSettings = readSettings(); @@ -163,9 +163,6 @@ public void displaySettings() { System.out.println(); } } - catch (BadConfigFileFomatException e) { - e.printStackTrace(); - } catch (FileNotFoundException e) { e.printStackTrace(); } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java index a0210b61..b9c6940d 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/Property.java @@ -2,6 +2,7 @@ /** * This class serves for storing the information of a property belongs to a source code element type. + * @author Viktor Meszaros {@literal } */ public class Property{ /** diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java index c57c80ee..c8429b22 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java @@ -17,6 +17,7 @@ /** * This class is responsible for providing information what properties/metrics belong to the individual source code element types. + * @author Viktor Meszaros {@literal } */ public class PropertyCollector { /** @@ -42,10 +43,11 @@ public PropertyCollector() { * Initialize the property map. */ private void initializePropertyMap() { - propertyMap = new HashMap>(); + Map> tmpPropertyMap = new HashMap>(); for(String type : acceptedTypes) { - propertyMap.put(type, null); + tmpPropertyMap.put(type, null); } + propertyMap = tmpPropertyMap; } /** @@ -94,7 +96,7 @@ public Map> getFromCdf(String cdfFilePath) { * @param element The {@link Element} which will be examined. * @return The examined element is a valid 'element' tag or not. */ - private boolean isValidElement(Element element) { + public boolean isValidElement(Element element) { return element.getTagName().equals("element") && element.hasAttribute("type") && acceptedTypes.contains(element.getAttribute("type")); @@ -127,7 +129,7 @@ private void tryCollectProperties(Element element) { * @param element The 'properties' tag of the 'element' tag. * @return The list of the gathered properties/metrics. */ - private List getPropertyList(Element element) { + public List getPropertyList(Element element) { List result = new ArrayList(); NodeList properties = element.getElementsByTagName("property"); diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties index 979b8b05..48adc1e8 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties @@ -51,10 +51,15 @@ gui_exec_title = Execution output gui_add_resource_title = Add new resource... gui_mapping_editor_title = Mapping file editor gui_b_add = Add +gui_b_add_level_value = Add level value gui_b_conversions = Conversions... gui_b_remove = Remove gui_b_specify_path = Specify path gui_b_save_mapping_file = Save mapping file +gui_b_save_settings = Save settings +gui_buildable_cellar = Buildable 'cellar': +gui_buildable_floor = Buildable 'floor': +gui_buildable_garden = Buildable 'garden': gui_l_assigned_to = Assigned to the source code element: gui_l_attribute = attribute gui_l_class = class From 262255b0227710aa9463fa3a60dde573324d03a5 Mon Sep 17 00:00:00 2001 From: tkeri Date: Sat, 21 Apr 2018 10:04:26 +0200 Subject: [PATCH 40/58] Add new test cases to gui Fix nullPointExeption error in typeChecker meethod. Add new test cases to Transferhelper class typeChecker method. Add new test case BuidableSettings class validateProperties method. Add new test case QuantizationInformation class. --- .../toolchain/gui/utils/TransferHelper.java | 3 +- .../gui/utils/BuildableSettingsTest.java | 13 ++++- .../utils/QuantizationInformationTest.java | 54 +++++++++++++++++++ .../gui/utils/TransferHelperTest.java | 43 ++++++++++++++- 4 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/QuantizationInformationTest.java diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java index f706e627..87430aa8 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java @@ -11,7 +11,6 @@ import javax.swing.JComponent; import javax.swing.JTable; import javax.swing.TransferHandler; -import javax.swing.filechooser.FileFilter; import codemetropolis.toolchain.gui.MappingFileEditorDialog; import codemetropolis.toolchain.gui.conversions.*; @@ -51,7 +50,7 @@ public boolean typeChecker (Object obj, JTable target, int row, int col) { JTable currFloorTable = MappingFileEditorDialog.getFloorTable(); JTable currCellarTable = MappingFileEditorDialog.getCellarTable(); - List conversionList = null; + List conversionList = MappingFileEditorDialog.gardenConversion; if (target == currGardenTable) { conversionList = MappingFileEditorDialog.gardenConversion; diff --git a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java index 23691290..32f9b9c0 100644 --- a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java +++ b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java @@ -21,4 +21,15 @@ public void testNonValidateProperties() throws IOException { boolean result = BuildableSettings.validateProperties(buildableName, buildableProperties); Assert.assertEquals(result, false); } -} + + /** + * @throws IOException if it is false. + */ + @Test + public void testPassValidateProperties() throws IOException { + String buildableName = "CELLAR"; + String[] buildableProperties = {"width"}; + boolean result = BuildableSettings.validateProperties(buildableName, buildableProperties); + Assert.assertEquals(result, true); + } +} \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/QuantizationInformationTest.java b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/QuantizationInformationTest.java new file mode 100644 index 00000000..5f970918 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/QuantizationInformationTest.java @@ -0,0 +1,54 @@ +package codemetropolis.toolchain.gui.utils; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; + +import org.junit.Test; + +import codemetropolis.toolchain.gui.beans.QuantizationInformation; + +/** + * Test class for testing the {@link TransferHelper}. + * + * @author Tamas Keri {@literal } + */ +public class QuantizationInformationTest { + QuantizationInformation quant = new QuantizationInformation(); + + @Test + public void testPassSetIndex() throws IOException { + quant.setIndex(4); + assertTrue(quant.getIndex() == 4); + } + + @Test + public void testPassSetMetric() throws IOException { + quant.setMetric("NUMPAR"); + assertTrue(quant.getMetric() == "NUMPAR"); + } + + @Test + public void testPassSetBuildableAttribute() throws IOException { + quant.setBuildableAttribute("viktor"); + assertTrue(quant.getBuildableAttribute() == "viktor"); + } + + @Test + public void testFailSetIndex() throws IOException { + quant.setIndex(4); + assertTrue(quant.getIndex() == 1); + } + + @Test + public void testFailSetMetric() throws IOException { + quant.setMetric("NUMPAR"); + assertTrue(quant.getMetric() == ""); + } + + @Test + public void testFailSetBuildableAttribute() throws IOException { + quant.setBuildableAttribute("viktor"); + assertTrue(quant.getBuildableAttribute() != ""); + } +} diff --git a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/TransferHelperTest.java b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/TransferHelperTest.java index b83eb12b..ca058a78 100644 --- a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/TransferHelperTest.java +++ b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/TransferHelperTest.java @@ -19,7 +19,7 @@ public class TransferHelperTest { * @throws IOException if it is true. */ @Test - public void testNonTypeChecker() throws IOException { + public void testNullTypeChecker() throws IOException { int row = 0; int col = 0; Object obj = new JTable(); @@ -28,4 +28,45 @@ public void testNonTypeChecker() throws IOException { Assert.assertEquals(result, false); } + + /** + * @throws IOException if it is true. + * + */ + @Test + public void testNonTypeChecker() throws IOException { + int row = 0; + int col = 1; + Object obj = new JTable(); + obj = "Name: string"; + + Object rowData[][] = { { "width: int" }, {" "} }; + Object columnNames[] = { "Attribute", "Builtin property"}; + JTable table = new JTable(rowData, columnNames); + + boolean result = helper.typeChecker(obj, table, row, col); + + Assert.assertEquals(result, false); + } + + /** + * @throws IOException if it is false. + * + */ + @Test + public void testPassTypeChecker() throws IOException { + int row = 0; + int col = 1; + Object obj = new JTable(); + obj = "tipli: int"; + + Object columnNames[] = { "Attribute", "Builtin property"}; + Object rowData[][] = { { "width: int" }, {""} }; + + JTable table = new JTable(rowData, columnNames); + + boolean result = helper.typeChecker(obj, table, row, col); + + Assert.assertEquals(result, true); + } } From e05615f448a65c265edc076fb4968b0ccbdbb49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B3nika=20Orosz?= Date: Mon, 16 Apr 2018 21:33:17 +0200 Subject: [PATCH 41/58] Add 'browsinghistory' package, prepare basic environment. --- .../BrowsingHistoryConverter.java | 20 +++++++++++++++++++ .../converter/control/ConverterLoader.java | 3 +++ .../converter/control/ConverterType.java | 3 ++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java new file mode 100644 index 00000000..d51bfa6c --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java @@ -0,0 +1,20 @@ +package codemetropolis.toolchain.converter.browsinghistory; + +import java.util.Map; + +import codemetropolis.toolchain.commons.cdf.CdfTree; +import codemetropolis.toolchain.commons.cdf.converter.CdfConverter; +import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException; + +public class BrowsingHistoryConverter extends CdfConverter { + + public BrowsingHistoryConverter(Map params) { + super(params); + } + + @Override + public CdfTree createElements(String source) throws CodeMetropolisException { + return null; + } + +} diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterLoader.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterLoader.java index 39579620..b0a525db 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterLoader.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterLoader.java @@ -3,6 +3,7 @@ import java.util.Map; import codemetropolis.toolchain.commons.cdf.converter.CdfConverter; +import codemetropolis.toolchain.converter.browsinghistory.BrowsingHistoryConverter; import codemetropolis.toolchain.converter.sonarqube.SonarQubeConverter; import codemetropolis.toolchain.converter.sourcemeter.GraphConverter; @@ -16,6 +17,8 @@ public static CdfConverter load(ConverterType converterType, Map return new GraphConverter(params); case SONARQUBE: return new SonarQubeConverter(params); + case BROWSINGHISTORY: + return new BrowsingHistoryConverter(params); default: return null; } diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterType.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterType.java index da4a69ad..e0c6abba 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterType.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/control/ConverterType.java @@ -2,5 +2,6 @@ public enum ConverterType { SOURCEMETER, - SONARQUBE + SONARQUBE, + BROWSINGHISTORY } From 790d08760db5d85f607f1948dec6c3efcbd63e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B3nika=20Orosz?= Date: Wed, 18 Apr 2018 18:24:01 +0200 Subject: [PATCH 42/58] Create Browsing History Converter methods. --- .../BrowsingHistoryConverter.java | 102 +++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java index d51bfa6c..564eca71 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java @@ -1,20 +1,118 @@ package codemetropolis.toolchain.converter.browsinghistory; +import java.io.File; +import java.io.IOException; import java.util.Map; +import java.util.regex.Pattern; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.commons.cdf.CdfProperty; import codemetropolis.toolchain.commons.cdf.CdfTree; import codemetropolis.toolchain.commons.cdf.converter.CdfConverter; import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException; public class BrowsingHistoryConverter extends CdfConverter { - + + public static final String ROOT_NODE = "chrome_visited_sites"; + public static final String ITEM_NODE = "item"; + public static final String URL_NODE = "url"; + public static final String TITLE_NODE = "title"; + public static final String VISIT_ID_NODE = "visit_id"; + public static final String VISIT_COUNT_NODE = "visit_count"; + public static final String TYPED_COUNT_NODE = "typed_count"; + public static final String PROFILE_NODE = "profile"; + public static final String URL_LENGTH_NODE = "url_length"; + public static final String TRANSITION_TYPE_NODE = "transition_type"; + public static final String TRANSITION_QUALIFIERS_NODE = "transition_qualifiers"; + public BrowsingHistoryConverter(Map params) { super(params); } @Override public CdfTree createElements(String source) throws CodeMetropolisException { - return null; + + Document document = createDocumentFromXmlFile(source); + + CdfElement rootElement = createElementsRecursively(document); + + return new CdfTree(rootElement); + } + + public CdfElement createElementsRecursively(Node root) { + + CdfElement cdfElement = addNameAndTypeOfElement(root); + if (cdfElement != null) { + + addProperties(cdfElement, root); + NodeList children = root.getChildNodes(); + + if(children != null) { + for (int c = 0; c < children.getLength(); c++) { + cdfElement.addChildElement(createElementsRecursively(children.item(c))); + } + } + } + + return cdfElement; + } + + public CdfElement addNameAndTypeOfElement(Node root) { + + String nodeName = root.getNodeName(); + + CdfElement cdfElement = new CdfElement(nodeName, nodeName); + + return cdfElement; + } + + public void addProperties(CdfElement cdfElement, Node node) { + String nodeName = node.getNodeName(); + + if (nodeName == URL_NODE || nodeName == TITLE_NODE || nodeName == VISIT_ID_NODE || nodeName == VISIT_COUNT_NODE || + nodeName == TYPED_COUNT_NODE|| nodeName == PROFILE_NODE || nodeName == URL_LENGTH_NODE || + nodeName == TRANSITION_TYPE_NODE || nodeName == TRANSITION_QUALIFIERS_NODE) { + cdfElement.addProperty(node.getNodeName(), node.getFirstChild().getNodeValue(), typeFromNodeValue(node.getFirstChild().getNodeValue())); + } + } + + public CdfProperty.Type typeFromNodeValue(String nodeValue){ + if(Pattern.matches("\\-?\\d+", (CharSequence) nodeValue)) { + return CdfProperty.Type.INT; + }else { + return CdfProperty.Type.STRING; + } + } + + public Document createDocumentFromXmlFile(String source) { + + File inputXml = new File(source); + + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = null; + Document document = null; + + try { + documentBuilder = documentBuilderFactory.newDocumentBuilder(); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } + try { + document = documentBuilder.parse(inputXml); + } catch (SAXException | IOException e) { + e.printStackTrace(); + } + + return document; } } From b4dc1b45c264e7c58d361f58bd8fa61cc0dcda72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B3nika=20Orosz?= Date: Wed, 18 Apr 2018 19:07:59 +0200 Subject: [PATCH 43/58] Create first Unit test and add dependency to pom.xml file. --- .../codemetropolis-toolchain-commons/pom.xml | 6 ++++ .../.classpath | 1 + .../test/BrowsingHistoryConverterTest.java | 32 +++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTest.java diff --git a/sources/codemetropolis-toolchain-commons/pom.xml b/sources/codemetropolis-toolchain-commons/pom.xml index 5e3a3413..9c1f702a 100644 --- a/sources/codemetropolis-toolchain-commons/pom.xml +++ b/sources/codemetropolis-toolchain-commons/pom.xml @@ -17,5 +17,11 @@ gson 2.6.1 + + junit + junit + 4.12 + test + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-converter/.classpath b/sources/codemetropolis-toolchain-converter/.classpath index af1430be..eec398a2 100644 --- a/sources/codemetropolis-toolchain-converter/.classpath +++ b/sources/codemetropolis-toolchain-converter/.classpath @@ -22,5 +22,6 @@ + diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTest.java new file mode 100644 index 00000000..06798f35 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTest.java @@ -0,0 +1,32 @@ +package codemetropolis.toolchain.converter.browsinghistory.test; + +import org.junit.Test; + +import codemetropolis.toolchain.commons.cdf.CdfProperty; +import codemetropolis.toolchain.converter.browsinghistory.BrowsingHistoryConverter; +import junit.framework.TestCase; + +public class BrowsingHistoryConverterTest extends TestCase { + + String nodeValue = "43"; + BrowsingHistoryConverter conv = new BrowsingHistoryConverter(null); + + @Test + public void testTypeFromNodeValueWithCorrectValue() { + + CdfProperty.Type result = conv.typeFromNodeValue(nodeValue); + CdfProperty.Type expectedType = CdfProperty.Type.INT; + assertEquals(result, expectedType); + + } + + @Test + public void testTypeFromNodeValueWithIncorrectValue() { + + CdfProperty.Type result = conv.typeFromNodeValue(nodeValue); + CdfProperty.Type expectedType = CdfProperty.Type.STRING; + assertNotSame(result, expectedType); + + } + +} From 1e71fd18016bf5b13af55644b20c45595f05378b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B3nika=20Orosz?= Date: Fri, 20 Apr 2018 16:12:50 +0200 Subject: [PATCH 44/58] Add test XML files and unit test for addProperties() function. --- .../converterToMapping.xml | 4770 +++++++++++++++++ .../test/BrowsingHistoryConverterTest.java | 32 - .../test/BrowsingHistoryConverterTests.java | 87 + .../browsinghistory/test/testFile.xml | Bin 0 -> 24764 bytes .../browsinghistory/test/testFile2.xml | Bin 0 -> 96 bytes 5 files changed, 4857 insertions(+), 32 deletions(-) create mode 100644 sources/codemetropolis-toolchain-converter/converterToMapping.xml delete mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTest.java create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile.xml create mode 100644 sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile2.xml diff --git a/sources/codemetropolis-toolchain-converter/converterToMapping.xml b/sources/codemetropolis-toolchain-converter/converterToMapping.xml new file mode 100644 index 00000000..42279971 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/converterToMapping.xml @@ -0,0 +1,4770 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTest.java deleted file mode 100644 index 06798f35..00000000 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package codemetropolis.toolchain.converter.browsinghistory.test; - -import org.junit.Test; - -import codemetropolis.toolchain.commons.cdf.CdfProperty; -import codemetropolis.toolchain.converter.browsinghistory.BrowsingHistoryConverter; -import junit.framework.TestCase; - -public class BrowsingHistoryConverterTest extends TestCase { - - String nodeValue = "43"; - BrowsingHistoryConverter conv = new BrowsingHistoryConverter(null); - - @Test - public void testTypeFromNodeValueWithCorrectValue() { - - CdfProperty.Type result = conv.typeFromNodeValue(nodeValue); - CdfProperty.Type expectedType = CdfProperty.Type.INT; - assertEquals(result, expectedType); - - } - - @Test - public void testTypeFromNodeValueWithIncorrectValue() { - - CdfProperty.Type result = conv.typeFromNodeValue(nodeValue); - CdfProperty.Type expectedType = CdfProperty.Type.STRING; - assertNotSame(result, expectedType); - - } - -} diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java new file mode 100644 index 00000000..8cad53d3 --- /dev/null +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java @@ -0,0 +1,87 @@ +package codemetropolis.toolchain.converter.browsinghistory.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotSame; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.junit.Test; + +import codemetropolis.toolchain.commons.cdf.CdfElement; +import codemetropolis.toolchain.commons.cdf.CdfProperty; +import codemetropolis.toolchain.converter.browsinghistory.BrowsingHistoryConverter; + +import org.w3c.dom.Document; + +public class BrowsingHistoryConverterTests { + + public static final String NODE_VALUE1 = "43"; + public static final String NODE_VALUE2 = "Text43"; + public static final String ITEM_NODE = "item"; + public static final String TEST_INPUT_FILE = "./src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile2.xml"; + + BrowsingHistoryConverter converter = new BrowsingHistoryConverter(null); + + + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = null; + Document document = null; + + @Test + public void testTypeFromNodeValueWithCorrectValue() { + + CdfProperty.Type result = converter.typeFromNodeValue(NODE_VALUE1); + CdfProperty.Type expectedType = CdfProperty.Type.INT; + assertEquals(result, expectedType); + + } + + @Test + public void testTypeFromNodeValueWithCorrectValue2() { + + CdfProperty.Type result = converter.typeFromNodeValue(NODE_VALUE2); + CdfProperty.Type expectedType = CdfProperty.Type.STRING; + assertEquals(result, expectedType); + + } + + @Test + public void testTypeFromNodeValueWithIncorrectValue() { + + CdfProperty.Type result = converter.typeFromNodeValue(NODE_VALUE1); + CdfProperty.Type expectedType = CdfProperty.Type.STRING; + assertNotEquals(result, expectedType); + + } + + @Test + public void testTypeFromNodeValueWithIncorrectValue2() { + + CdfProperty.Type result = converter.typeFromNodeValue(NODE_VALUE2); + CdfProperty.Type expectedType = CdfProperty.Type.INT; + assertNotEquals(result, expectedType); + + } + + @Test + public void testAddPropertiesWithCorrectResult() throws Exception { + + List expectedProperties = new ArrayList(); + CdfElement resultElement = new CdfElement(ITEM_NODE, ITEM_NODE); + + documentBuilder = documentBuilderFactory.newDocumentBuilder(); + document = documentBuilder.parse(TEST_INPUT_FILE); + + converter.addProperties(resultElement, document); + + System.out.println(resultElement.getProperty(ITEM_NODE)); + + assertEquals(resultElement.getProperties(), expectedProperties); + } + +} diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile.xml b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile.xml new file mode 100644 index 0000000000000000000000000000000000000000..b862041da663855ef84c57d76020692ccc1e461e GIT binary patch literal 24764 zcmeHQ+iu%N5S_jj=u>|{EzrI+zQ~euYpfvmwg`$Qau75xf)ZaMTb67~PU4`S+8^i- z^r>ij&W_fkw4_9e(wdS8gQB?H*!9w)0eZcVHMH>=EghPc*HQlh_3q)YE$DdqrpGpF)#PVG-9-;4(nRYm zImWq#@$*h!{xU80as73vB>!N&0djxjtc z9cRF)26))TQ*cBz@R;@E?%HR(1gDh4VcJbY+s8Pg?kep$=nin4*}AA_!+P?NYO zr);a1BkWaC_7F9WaPW#Ue2nvFV5q8+$H6%+qYT(F7nC|w(I<6 zz-{Q?z%CiJ9Icfy-nzR^+fZ%58?X`cfK&Cl-a}s;!X8ZGTZQYYo%d8;e9^_+xM!?l z)i8mT=t@o4bIIcMD6O^l>2-!%)_z?n=J?!Fca$o@<$<)hQm+)FUQIT?r!3XXvb}rd z1;*=o%QLHIqJ61oJ1nn$4n40uVCoa(m~wD}_Z;Yn;7J3?e2Loh)9AC(XQThxhu=@n zZ677O#-n3AU>7CoYaXB$qYCtKe#duO1{x7qGhQF>lJ+;$zcfA+JtNk(kpms$vZ176 zcU=-g*_wezGjHtV!!jE6 zVB+3%e0*#*=9gKZC>-^Vn#0qeY1`vWv^4`?WZq~B+iUsqJw_3B2z#mvKZNn*z=rGL ziWV93P4{6*sm;YG@(xN)<$K&c!TCp&v{3dKvFD1sk=L-z>hNoRLFVF2Zi4coJcEVU zKno4nZjafpF8Ng2U~9q<9Lg4S8y;})`q6t#5Z~n zw+7#CcO9jhu=ZJddvLIJ_#piqlvO~(@(QBu%*0g(_1KS6@LUFm__>Z}WsTuc z=^d6cg3MNxwgrj`j$=c~UT%Ve&(YRRjOz@?Yh1mWU`Yr3QIGH$_+{VZn#l_g!99~3 z@MrmE(@e>vlTVXeJ6V0qjS`-XQ^4P zVZV}IUI+L&HCXD%4?xvte0P1pNwu2rntEuB{;FLcY5lr3?C~SK&pWUW=wBVduWQ5q zqIb55>#8X^!a49j!yYelQo}6=^;#I~4p6)+PoV>JwO)K|D*P0st7lz&?~O=FgJi{) zAAgK_^6-0^4$IH*p858ekx+~h5DmkmFY;&;o6pln=AJM;KlJzpKn z-1(h(mJLB+U%LrE;}q+&R&!p;hN`qPQ)OUd`LXC`u}MALM$fW z^mP8Y&-ENZv`yc6R19EV*&pgN?x^JI*~$BL842S~*FD6=RJJYcBrEHsLs^0c9`4;{ zPya;gb{{YI`f?ZVWNPJHuqs%kHY{&pJY+%3bn6i~J{LpoC>0ex<5{zaOkd|tjAcNN zW_z}Pz-`D$pu3_x{>fNaZX~&}g0L3JuEUa})MvD<*e?~eTVM5O)|K^zwPt_yqX9dB zzY`xERpM|~V{w_peua%^**N7Lt@vrP_2?~oXo4-?7Z0_$D#YGD8W3h3yK6SRA zd9AS7W@)np`Bcpf`nTHL^~>Ryf=Yi}6m7bwfkjU8=wfp3#eJH2T6l}KBR*fT=7jusS*)*4K6Zs@*Ee^gOk>U6bg?vY7=2d}dhktS)r=QEA~ literal 0 HcmV?d00001 diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile2.xml b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile2.xml new file mode 100644 index 0000000000000000000000000000000000000000..fbd768078b9f78eed7e3ac0c5dfb132db095abde GIT binary patch literal 96 zcmezW&xRqBp@booA(z39ftP`c!G@s>C{hd-jb}(^$Y&^J$OEddV=x5D>Eo1z=+#Fv F4FJch5rzN& literal 0 HcmV?d00001 From 2d14839598189b2d793a757c3fcb868e032f39f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B3nika=20Orosz?= Date: Fri, 20 Apr 2018 16:29:36 +0200 Subject: [PATCH 45/58] Add unit tests for createElementsRecursively() function. --- .../test/BrowsingHistoryConverterTests.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java index 8cad53d3..8b469091 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java @@ -79,9 +79,28 @@ public void testAddPropertiesWithCorrectResult() throws Exception { converter.addProperties(resultElement, document); - System.out.println(resultElement.getProperty(ITEM_NODE)); - assertEquals(resultElement.getProperties(), expectedProperties); } + @Test + public void testCreateElementsRecursivelyWithCheckChildElements() throws Exception { + + documentBuilder = documentBuilderFactory.newDocumentBuilder(); + document = documentBuilder.parse(TEST_INPUT_FILE); + + CdfElement resultElement = converter.createElementsRecursively(document); + + assertEquals(resultElement.getNumberOfChildren(), 1); + } + + @Test + public void testCreateElementsRecursivelyWithCheckChildElements2() throws Exception { + + documentBuilder = documentBuilderFactory.newDocumentBuilder(); + document = documentBuilder.parse(TEST_INPUT_FILE); + + CdfElement resultElement = converter.createElementsRecursively(document); + + assertEquals(resultElement.getChildElements().get(0).getChildElements().size(), 3); + } } From 914224de6df8144852d655b6ef9ebc347d4e3734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B3nika=20Orosz?= Date: Fri, 20 Apr 2018 19:14:13 +0200 Subject: [PATCH 46/58] Add reafFile() method and unit tests for this method. --- .../BrowsingHistoryConverter.java | 26 ++++++++++++++++--- .../test/BrowsingHistoryConverterTests.java | 25 +++++++++++++++++- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java index 564eca71..b71d6faa 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java @@ -41,7 +41,19 @@ public BrowsingHistoryConverter(Map params) { @Override public CdfTree createElements(String source) throws CodeMetropolisException { - Document document = createDocumentFromXmlFile(source); + File inputXml = null; + try { + inputXml = readFile(source); + } catch (Exception e1) { + e1.printStackTrace(); + } + + Document document = null; + try { + document = createDocumentFromXmlFile(inputXml); + } catch (Exception e) { + e.printStackTrace(); + } CdfElement rootElement = createElementsRecursively(document); @@ -93,10 +105,18 @@ public CdfProperty.Type typeFromNodeValue(String nodeValue){ } } - public Document createDocumentFromXmlFile(String source) { - + public File readFile(String source) throws Exception { File inputXml = new File(source); + if(!inputXml.getName().toLowerCase().endsWith(".xml")) { + throw new Exception("The file isn't an xml file."); + } + + return inputXml; + } + + public Document createDocumentFromXmlFile(File inputXml){ + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = null; Document document = null; diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java index 8b469091..3008d786 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java @@ -2,8 +2,9 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertTrue; +import java.io.File; import java.util.ArrayList; import java.util.List; @@ -103,4 +104,26 @@ public void testCreateElementsRecursivelyWithCheckChildElements2() throws Except assertEquals(resultElement.getChildElements().get(0).getChildElements().size(), 3); } + + @Test + public void testReadFileWithCorrectFile() throws Exception { + File expectedFile = new File(TEST_INPUT_FILE); + File resultFile = converter.readFile(TEST_INPUT_FILE); + + assertEquals(resultFile, expectedFile); + } + + @Test + public void testReadFileWithIncorrectFile() throws Exception { + + boolean isThrown = false; + + try { + File resultFile = converter.readFile("inCorrect.txt"); + }catch(Exception e) { + isThrown = true; + } + + assertTrue(isThrown); + } } From 2be3b3c4e44b76bd129fba98a270d1bab36ddb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B3nika=20Orosz?= Date: Fri, 20 Apr 2018 23:30:12 +0200 Subject: [PATCH 47/58] Change input testFile.xml; Add mapping file example; Change example converterToMapping.xml. --- .../browsinghistory_mapping_example_1_0.xml | 62 + .../converterToMapping.xml | 4805 +---------------- .../BrowsingHistoryConverter.java | 41 +- .../browsinghistory/test/testFile.xml | Bin 24764 -> 8768 bytes 4 files changed, 213 insertions(+), 4695 deletions(-) create mode 100644 examples/mapping/browsinghistory_mapping_example_1_0.xml diff --git a/examples/mapping/browsinghistory_mapping_example_1_0.xml b/examples/mapping/browsinghistory_mapping_example_1_0.xml new file mode 100644 index 00000000..121f0c39 --- /dev/null +++ b/examples/mapping/browsinghistory_mapping_example_1_0.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-converter/converterToMapping.xml b/sources/codemetropolis-toolchain-converter/converterToMapping.xml index 42279971..dde1bd32 100644 --- a/sources/codemetropolis-toolchain-converter/converterToMapping.xml +++ b/sources/codemetropolis-toolchain-converter/converterToMapping.xml @@ -8,4755 +8,190 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java index b71d6faa..712002a5 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/BrowsingHistoryConverter.java @@ -63,16 +63,36 @@ public CdfTree createElements(String source) throws CodeMetropolisException { public CdfElement createElementsRecursively(Node root) { CdfElement cdfElement = addNameAndTypeOfElement(root); + if (cdfElement != null) { - - addProperties(cdfElement, root); - NodeList children = root.getChildNodes(); - - if(children != null) { - for (int c = 0; c < children.getLength(); c++) { - cdfElement.addChildElement(createElementsRecursively(children.item(c))); + NodeList children = root.getChildNodes(); + + if(children != null) { + for (int c = 0; c < children.getLength(); c++) { + + if(cdfElement.getName() == ROOT_NODE || cdfElement.getName() == "#document") { + + cdfElement.addChildElement(createElementsRecursively(children.item(c))); + + }else if(cdfElement.getName() == ITEM_NODE) { + + String value = ""; + + for(int k = 0; k < children.getLength(); k++) { + + if(children.item(k).getFirstChild() != null) { + value = children.item(k).getFirstChild().getNodeValue(); + } + + if(children.item(k).getNodeName() != "#text") { + cdfElement.addProperty(children.item(k).getNodeName(), value, + typeFromNodeValue(value)); + } + + } + } + } } - } } return cdfElement; @@ -87,14 +107,15 @@ public CdfElement addNameAndTypeOfElement(Node root) { return cdfElement; } - public void addProperties(CdfElement cdfElement, Node node) { + public CdfElement addProperties(CdfElement cdfElement, Node node) { String nodeName = node.getNodeName(); if (nodeName == URL_NODE || nodeName == TITLE_NODE || nodeName == VISIT_ID_NODE || nodeName == VISIT_COUNT_NODE || nodeName == TYPED_COUNT_NODE|| nodeName == PROFILE_NODE || nodeName == URL_LENGTH_NODE || nodeName == TRANSITION_TYPE_NODE || nodeName == TRANSITION_QUALIFIERS_NODE) { - cdfElement.addProperty(node.getNodeName(), node.getFirstChild().getNodeValue(), typeFromNodeValue(node.getFirstChild().getNodeValue())); + cdfElement.addProperty(node.getNodeName(), node.getFirstChild().getNodeValue(), typeFromNodeValue(node.getFirstChild().getNodeValue())); } + return cdfElement; } public CdfProperty.Type typeFromNodeValue(String nodeValue){ diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile.xml b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile.xml index b862041da663855ef84c57d76020692ccc1e461e..f7bc18db60bd71e08ac1b4cb70c8a8870f17472f 100644 GIT binary patch delta 364 zcmdmUknw=ahBih@Aa>goGwfFajONZaq1{mu>Pf#<71Pgr8|0tv0jDohaXId5JUqQJO#juaC-a151w yCqK~Oo1CFwHrb9f2k1%D$s2_nH_OOvV`MY{*$;Llva(eid6Rh*|4nX7FarR18Gbqd literal 24764 zcmeHQ+iu%N5S_jj=u>|{EzrI+zQ~euYpfvmwg`$Qau75xf)ZaMTb67~PU4`S+8^i- z^r>ij&W_fkw4_9e(wdS8gQB?H*!9w)0eZcVHMH>=EghPc*HQlh_3q)YE$DdqrpGpF)#PVG-9-;4(nRYm zImWq#@$*h!{xU80as73vB>!N&0djxjtc z9cRF)26))TQ*cBz@R;@E?%HR(1gDh4VcJbY+s8Pg?kep$=nin4*}AA_!+P?NYO zr);a1BkWaC_7F9WaPW#Ue2nvFV5q8+$H6%+qYT(F7nC|w(I<6 zz-{Q?z%CiJ9Icfy-nzR^+fZ%58?X`cfK&Cl-a}s;!X8ZGTZQYYo%d8;e9^_+xM!?l z)i8mT=t@o4bIIcMD6O^l>2-!%)_z?n=J?!Fca$o@<$<)hQm+)FUQIT?r!3XXvb}rd z1;*=o%QLHIqJ61oJ1nn$4n40uVCoa(m~wD}_Z;Yn;7J3?e2Loh)9AC(XQThxhu=@n zZ677O#-n3AU>7CoYaXB$qYCtKe#duO1{x7qGhQF>lJ+;$zcfA+JtNk(kpms$vZ176 zcU=-g*_wezGjHtV!!jE6 zVB+3%e0*#*=9gKZC>-^Vn#0qeY1`vWv^4`?WZq~B+iUsqJw_3B2z#mvKZNn*z=rGL ziWV93P4{6*sm;YG@(xN)<$K&c!TCp&v{3dKvFD1sk=L-z>hNoRLFVF2Zi4coJcEVU zKno4nZjafpF8Ng2U~9q<9Lg4S8y;})`q6t#5Z~n zw+7#CcO9jhu=ZJddvLIJ_#piqlvO~(@(QBu%*0g(_1KS6@LUFm__>Z}WsTuc z=^d6cg3MNxwgrj`j$=c~UT%Ve&(YRRjOz@?Yh1mWU`Yr3QIGH$_+{VZn#l_g!99~3 z@MrmE(@e>vlTVXeJ6V0qjS`-XQ^4P zVZV}IUI+L&HCXD%4?xvte0P1pNwu2rntEuB{;FLcY5lr3?C~SK&pWUW=wBVduWQ5q zqIb55>#8X^!a49j!yYelQo}6=^;#I~4p6)+PoV>JwO)K|D*P0st7lz&?~O=FgJi{) zAAgK_^6-0^4$IH*p858ekx+~h5DmkmFY;&;o6pln=AJM;KlJzpKn z-1(h(mJLB+U%LrE;}q+&R&!p;hN`qPQ)OUd`LXC`u}MALM$fW z^mP8Y&-ENZv`yc6R19EV*&pgN?x^JI*~$BL842S~*FD6=RJJYcBrEHsLs^0c9`4;{ zPya;gb{{YI`f?ZVWNPJHuqs%kHY{&pJY+%3bn6i~J{LpoC>0ex<5{zaOkd|tjAcNN zW_z}Pz-`D$pu3_x{>fNaZX~&}g0L3JuEUa})MvD<*e?~eTVM5O)|K^zwPt_yqX9dB zzY`xERpM|~V{w_peua%^**N7Lt@vrP_2?~oXo4-?7Z0_$D#YGD8W3h3yK6SRA zd9AS7W@)np`Bcpf`nTHL^~>Ryf=Yi}6m7bwfkjU8=wfp3#eJH2T6l}KBR*fT=7jusS*)*4K6Zs@*Ee^gOk>U6bg?vY7=2d}dhktS)r=QEA~ From c823639fd4b3a2e72f9eff93cec9ca0c060128c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B3nika=20Orosz?= Date: Sat, 21 Apr 2018 00:03:47 +0200 Subject: [PATCH 48/58] Add unit test for CreateDocumentFromXmlFile() method. --- .../test/BrowsingHistoryConverterTests.java | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java index 3008d786..d021efc4 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java @@ -1,6 +1,7 @@ package codemetropolis.toolchain.converter.browsinghistory.test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; @@ -25,11 +26,12 @@ public class BrowsingHistoryConverterTests { public static final String NODE_VALUE2 = "Text43"; public static final String ITEM_NODE = "item"; public static final String TEST_INPUT_FILE = "./src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile2.xml"; - + public static final String TEST_INPUT_FILE2 = "./src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile3.txt"; + BrowsingHistoryConverter converter = new BrowsingHistoryConverter(null); - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilderFactory documentBuilderFactory = null; DocumentBuilder documentBuilder = null; Document document = null; @@ -75,6 +77,7 @@ public void testAddPropertiesWithCorrectResult() throws Exception { List expectedProperties = new ArrayList(); CdfElement resultElement = new CdfElement(ITEM_NODE, ITEM_NODE); + documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilder = documentBuilderFactory.newDocumentBuilder(); document = documentBuilder.parse(TEST_INPUT_FILE); @@ -86,6 +89,7 @@ public void testAddPropertiesWithCorrectResult() throws Exception { @Test public void testCreateElementsRecursivelyWithCheckChildElements() throws Exception { + documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilder = documentBuilderFactory.newDocumentBuilder(); document = documentBuilder.parse(TEST_INPUT_FILE); @@ -97,12 +101,13 @@ public void testCreateElementsRecursivelyWithCheckChildElements() throws Excepti @Test public void testCreateElementsRecursivelyWithCheckChildElements2() throws Exception { + documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilder = documentBuilderFactory.newDocumentBuilder(); document = documentBuilder.parse(TEST_INPUT_FILE); CdfElement resultElement = converter.createElementsRecursively(document); - assertEquals(resultElement.getChildElements().get(0).getChildElements().size(), 3); + assertEquals(resultElement.getChildElements().get(0).getChildElements().size(), 0); } @Test @@ -119,11 +124,41 @@ public void testReadFileWithIncorrectFile() throws Exception { boolean isThrown = false; try { - File resultFile = converter.readFile("inCorrect.txt"); + File resultFile = converter.readFile(TEST_INPUT_FILE2); }catch(Exception e) { isThrown = true; } assertTrue(isThrown); } + + + @Test + public void testCreateDocumentFromXmlFileWithCorrectFile() { + + boolean isThrown = false; + File file = new File(TEST_INPUT_FILE); + + try { + converter.createDocumentFromXmlFile(file); + }catch(Exception e) { + isThrown = true; + } + + assertFalse(isThrown); + } + + @Test + public void testCreateDocumentFromXmlFileWithCorrectFile2() throws Exception { + + File file = converter.readFile(TEST_INPUT_FILE); + + documentBuilderFactory = DocumentBuilderFactory.newInstance(); + documentBuilder = documentBuilderFactory.newDocumentBuilder(); + document = documentBuilder.parse(TEST_INPUT_FILE); + + Document resultDocument = converter.createDocumentFromXmlFile(file); + + assertNotEquals(document, resultDocument); + } } From 0a10561fb3417b4644b2f2c265f06d9ba917ad30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B3nika=20Orosz?= Date: Sat, 21 Apr 2018 00:24:23 +0200 Subject: [PATCH 49/58] Add unit tests for Mapping Tool. --- .../.classpath | 1 + .../mapping/test/MappingModelTests.java | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java diff --git a/sources/codemetropolis-toolchain-mapping/.classpath b/sources/codemetropolis-toolchain-mapping/.classpath index e7a868fb..c942fcd2 100644 --- a/sources/codemetropolis-toolchain-mapping/.classpath +++ b/sources/codemetropolis-toolchain-mapping/.classpath @@ -34,5 +34,6 @@ + diff --git a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java new file mode 100644 index 00000000..67a0bbc8 --- /dev/null +++ b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java @@ -0,0 +1,58 @@ +package codemetropolis.toolchain.mapping.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileNotFoundException; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; + +import org.junit.Test; + +import codemetropolis.toolchain.mapping.exceptions.MappingReaderException; +import codemetropolis.toolchain.mapping.model.Limit; +import codemetropolis.toolchain.mapping.model.Mapping; + +public class MappingModelTests { + + @Test + public void testAdd() { + + Limit limit = new Limit(); + int valueSetSizeExpected = limit.getValueSetSize()+2; + limit.add(10); + + assertNotEquals(limit.getValueSetSize(), valueSetSizeExpected); + } + + @Test + public void testAdd2() { + + Limit limit = new Limit(); + int valueSetSizeExpected = limit.getValueSetSize()+1; + limit.add(10); + + assertEquals(limit.getValueSetSize(), valueSetSizeExpected); + } + + @Test + public void testReadFromXMLShouldThrowException() { + + boolean isThrown = false; + + Mapping mapping = new Mapping(); + try { + mapping.readFromXML("text.xml"); + } catch (MappingReaderException e) { + isThrown = true; + } catch (FileNotFoundException e) { + isThrown = true; + } + + assertTrue(isThrown); + } +} From d33cb0ce5d922ebb554fa5ecb9bde3d656417bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B3nika=20Orosz?= Date: Sat, 21 Apr 2018 00:55:20 +0200 Subject: [PATCH 50/58] Add unit test for getVariableId() method. --- .../toolchain/mapping/model/Binding.java | 2 +- .../toolchain/mapping/test/MappingModelTests.java | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Binding.java b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Binding.java index e57d9310..6dfe0b22 100644 --- a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Binding.java +++ b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Binding.java @@ -16,7 +16,7 @@ public class Binding { @XmlAttribute - private String from; + public String from; @XmlAttribute private String to; diff --git a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java index 67a0bbc8..d3296a1e 100644 --- a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java +++ b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java @@ -14,6 +14,7 @@ import org.junit.Test; import codemetropolis.toolchain.mapping.exceptions.MappingReaderException; +import codemetropolis.toolchain.mapping.model.Binding; import codemetropolis.toolchain.mapping.model.Limit; import codemetropolis.toolchain.mapping.model.Mapping; @@ -55,4 +56,18 @@ public void testReadFromXMLShouldThrowException() { assertTrue(isThrown); } + + @Test + public void testGetVariableIdShouldReturnNull() { + + String expected = null; + + Binding binding = new Binding(); + binding.from = ""; + + String result = binding.getVariableId(); + + assertEquals(result, expected); + } + } From 0552926b2aad6439b08d9e8a90fb5ef74bd9cf36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B3nika=20Orosz?= Date: Sat, 21 Apr 2018 10:37:13 +0200 Subject: [PATCH 51/58] Add unit test for LimitController 's method and for Browsing History converter's method. --- .../test/BrowsingHistoryConverterTests.java | 17 +++++++ .../mapping/test/MappingModelTests.java | 47 +++++++++++++++++-- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java index d021efc4..44b5c61c 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/BrowsingHistoryConverterTests.java @@ -16,6 +16,8 @@ import codemetropolis.toolchain.commons.cdf.CdfElement; import codemetropolis.toolchain.commons.cdf.CdfProperty; +import codemetropolis.toolchain.commons.cdf.CdfTree; +import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException; import codemetropolis.toolchain.converter.browsinghistory.BrowsingHistoryConverter; import org.w3c.dom.Document; @@ -161,4 +163,19 @@ public void testCreateDocumentFromXmlFileWithCorrectFile2() throws Exception { assertNotEquals(document, resultDocument); } + + @Test + public void testCreateElementsShouldNotThrowException() { + + boolean isThrown = true; + + try { + CdfTree resultTree = converter.createElements(TEST_INPUT_FILE); + isThrown = false; + }catch(CodeMetropolisException e) { + e.printStackTrace(); + } + + assertFalse(isThrown); + } } diff --git a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java index d3296a1e..32327b49 100644 --- a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java +++ b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/test/MappingModelTests.java @@ -2,17 +2,16 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import java.io.File; import java.io.FileNotFoundException; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; - +import org.apache.commons.collections4.map.MultiKeyMap; +import org.apache.commons.lang3.builder.EqualsBuilder; import org.junit.Test; +import codemetropolis.toolchain.mapping.control.LimitController; import codemetropolis.toolchain.mapping.exceptions.MappingReaderException; import codemetropolis.toolchain.mapping.model.Binding; import codemetropolis.toolchain.mapping.model.Limit; @@ -70,4 +69,42 @@ public void testGetVariableIdShouldReturnNull() { assertEquals(result, expected); } + @Test + public void tesLimitControllerAddIsCorrect() { + + Limit limit = new Limit(); + limit.add(10); + + MultiKeyMap expectedLimits = new MultiKeyMap<>(); + expectedLimits.put("sourceName", "sourceFrom", limit); + + LimitController limitController = new LimitController(); + + limitController.add("sourceName", "sourceFrom", 10); + + Limit resultLimit = limitController.getLimit("sourceName", "sourceFrom"); + Limit expectedLimit = expectedLimits.get("sourceName", "sourceFrom"); + + assertTrue(EqualsBuilder.reflectionEquals(expectedLimit,resultLimit)); + } + + @Test + public void tesLimitControllerAddIsCorrect2() { + + Limit limit = new Limit(); + limit.add(10); + + MultiKeyMap expectedLimits = new MultiKeyMap<>(); + expectedLimits.put("sourceName", "sourceFrom", limit); + + LimitController limitController = new LimitController(); + + limitController.add("sourceName", "sourceFrom", 10); + + Limit resultLimit = limitController.getLimit("sourceName", "sourceFrom"); + Limit expectedLimit = expectedLimits.get("sourceName", "sourceFrom"); + + assertEquals(expectedLimit.getValueSetSize(), resultLimit.getValueSetSize()); + } + } From e5396f70e67bf2dec95759655baccc2cbddd419d Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Sat, 21 Apr 2018 15:40:28 +0200 Subject: [PATCH 52/58] Added test cases to the Mapping file editor. Added test cases to the Mapping tool. --- .../toolchain/gui/CodeMetropolisGUI.java | 2 +- .../gui/utils/BuildableSettings.java | 25 +- .../gui/utils/PropertyCollector.java | 8 +- .../resources/buildableProperties_test.cmcfg | 13 + .../src/main/resources/output_test.xml | 13180 ++++++++++++++++ .../toolchain/gui/CodeMetropolisGUITest.java | 32 + .../gui/utils/BuildableSettingsTest.java | 46 +- .../gui/utils/PropertyCollectorTest.java | 101 + .../.classpath | 1 + .../codemetropolis-toolchain-mapping/pom.xml | 5 + .../mapping/conversions/ConversionTest.java | 29 + .../toolchain/mapping/model/LinkingTest.java | 67 + .../mapping/model/MappingControllerTest.java | 39 + .../toolchain/mapping/model/MappingTest.java | 34 + .../test/output_test.xml | 13180 ++++++++++++++++ .../test/sourcemeter_mapping_example_2_0.xml | 62 + 16 files changed, 26806 insertions(+), 18 deletions(-) create mode 100644 sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties_test.cmcfg create mode 100644 sources/codemetropolis-toolchain-gui/src/main/resources/output_test.xml create mode 100644 sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/CodeMetropolisGUITest.java create mode 100644 sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/PropertyCollectorTest.java create mode 100644 sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/conversions/ConversionTest.java create mode 100644 sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/LinkingTest.java create mode 100644 sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/MappingControllerTest.java create mode 100644 sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/MappingTest.java create mode 100644 sources/codemetropolis-toolchain-mapping/test/output_test.xml create mode 100644 sources/codemetropolis-toolchain-mapping/test/sourcemeter_mapping_example_2_0.xml diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java index 8250a286..9efcd6fb 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java @@ -322,7 +322,7 @@ public void actionPerformed(ActionEvent event) { * @param cdfPath The path of the cdf file. * @return The cdf file exists or not. */ - public boolean checkInputCdfFile(String cdfPath) { + public static boolean checkInputCdfFile(String cdfPath) { File cdfXmlFile = new File(cdfPath); if(!cdfXmlFile.exists()) { return false; diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java index 3ff25834..9795c240 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java @@ -145,26 +145,23 @@ static boolean validateProperties(String buildableType, String[] buildabeAttribu /** * Writes to the console, what display settings will be provided to the Mapping file editor GUI. */ - public void displaySettings() throws BadConfigFileFomatException { - try { - Map returnedSettings = readSettings(); + public void displaySettings() throws BadConfigFileFomatException, FileNotFoundException { + + Map returnedSettings = readSettings(); - for(String buildableType : returnedSettings.keySet()) { + for(String buildableType : returnedSettings.keySet()) { - String[] buildableProperties = returnedSettings.get(buildableType); + String[] buildableProperties = returnedSettings.get(buildableType); - System.out.print(buildableType + "="); + System.out.print(buildableType + "="); - for(int i = 0; i < buildableProperties.length; i++) { + for(int i = 0; i < buildableProperties.length; i++) { - System.out.print(buildableProperties[i] + ";"); + System.out.print(buildableProperties[i] + ";"); - } - System.out.println(); } - } - catch (FileNotFoundException e) { - e.printStackTrace(); - } + System.out.println(); + } } + } \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java index c8429b22..12c092c0 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/PropertyCollector.java @@ -3,10 +3,14 @@ import java.io.*; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -55,7 +59,7 @@ private void initializePropertyMap() { * @param cdfFilePath The path from the cdf file from which the information will be read. * @return The {@link Map} which contains the individual source code element types as keys and their metrics/properties as values. */ - public Map> getFromCdf(String cdfFilePath) { + public Map> getFromCdf(String cdfFilePath) throws FileNotFoundException { try { initializePropertyMap(); @@ -84,7 +88,7 @@ public Map> getFromCdf(String cdfFilePath) { } }; - } catch (Exception e) { + } catch (ParserConfigurationException | SAXException | IOException e) { e.printStackTrace(); } diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties_test.cmcfg b/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties_test.cmcfg new file mode 100644 index 00000000..042d4176 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties_test.cmcfg @@ -0,0 +1,13 @@ +FLOOR=width,height,length,character,external_character,torches +CELLAR=width,height,length,character,external_character,torches +GARDEN=tree-ratio,mushroom-ratio,flower-ratio +GROUND= + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ Original state: + ++ + ++ FLOOR=width,height,length,character,external_character,torches + ++ CELLAR=width,height,length,character,external_character,torches + ++ GARDEN=tree-ratio,mushroom-ratio,flower-ratio + ++ GROUND= + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/output_test.xml b/sources/codemetropolis-toolchain-gui/src/main/resources/output_test.xml new file mode 100644 index 00000000..560020c9 --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/output_test.xml @@ -0,0 +1,13180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/CodeMetropolisGUITest.java b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/CodeMetropolisGUITest.java new file mode 100644 index 00000000..4e2bd6bd --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/CodeMetropolisGUITest.java @@ -0,0 +1,32 @@ +package codemetropolis.toolchain.gui; + +import java.net.URL; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Test cases for the {@link CodeMetropolisGUI} class. + * @author Viktor Meszaros {@literal } + * + */ +public class CodeMetropolisGUITest { + + @Test + public void testCheckInputCdfFileExists() { + URL urlToDictionary = this.getClass().getResource("/" + "output_test.xml"); + String filePath = urlToDictionary.getPath(); + boolean result = CodeMetropolisGUI.checkInputCdfFile(filePath); + + Assert.assertEquals(result, true); + } + + @Test + public void testCheckInputCdfFileNotExists() { + String path = ""; + boolean result = CodeMetropolisGUI.checkInputCdfFile(path); + + Assert.assertEquals(result, false); + } + +} diff --git a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java index 32f9b9c0..34bb346f 100644 --- a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java +++ b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/BuildableSettingsTest.java @@ -1,15 +1,21 @@ package codemetropolis.toolchain.gui.utils; +import java.io.FileNotFoundException; import java.io.IOException; import org.junit.Assert; import org.junit.Test; +import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException; + /** - * Test class for testing the {@link BuildableSettings}. + * Test class for testing the {@link BuildableSettings} class. * * @author Tamas Keri {@literal } + * @author Viktor Meszaros {@literal } */ public class BuildableSettingsTest { + + BuildableSettings instance = new BuildableSettings(); /** * @throws IOException if it is true. @@ -32,4 +38,42 @@ public void testPassValidateProperties() throws IOException { boolean result = BuildableSettings.validateProperties(buildableName, buildableProperties); Assert.assertEquals(result, true); } + + @Test + /** + * @author Viktor Meszaros {@literal } + */ + public void testDisplaySettings() throws FileNotFoundException{ + + boolean exceptionThrown = false; + + try{ + instance.displaySettings(); + } + catch(BadConfigFileFomatException e) { + exceptionThrown = true; + } + + //Assert.assertEquals(result, false); + Assert.assertFalse(exceptionThrown); + } + + @Test + /** + * @author Viktor Meszaros {@literal } + */ + public void testReadSettings() throws FileNotFoundException{ + + boolean exceptionThrown = false; + + try{ + instance.readSettings(); + } + catch(BadConfigFileFomatException e) { + exceptionThrown = true; + } + + Assert.assertFalse(exceptionThrown); + } + } \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/PropertyCollectorTest.java b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/PropertyCollectorTest.java new file mode 100644 index 00000000..a58a128c --- /dev/null +++ b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/PropertyCollectorTest.java @@ -0,0 +1,101 @@ +package codemetropolis.toolchain.gui.utils; + +import org.junit.Assert; +import org.junit.Test; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Test cases for the {@link PropertyCollector} class. + * @author Viktor Meszaros {@literal } + * + */ +public class PropertyCollectorTest { + + PropertyCollector instance = new PropertyCollector(); + URL urlToDictionary = this.getClass().getResource("/" + "output_test.xml"); + InputStream stream = null; + DocumentBuilder builder = null; + Document doc = null; + + @Test + public void testGetFromCdf() throws FileNotFoundException{ + //URL urlToDictionary = this.getClass().getResource("/" + "output_test.xml"); + String filePath = urlToDictionary.getPath(); + Map> map = null; + + map = instance.getFromCdf(filePath); + + List list = map.get("package"); + Assert.assertNotNull(list); + } + + + @Test + public void testIsValidElement() throws Exception{ + + stream = urlToDictionary.openStream(); + builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + doc = builder.parse(stream); + + Element rootElement = doc.getDocumentElement(); + rootElement.normalize(); + boolean result = instance.isValidElement(rootElement); + + Assert.assertEquals(result, true); + } + + @Test + public void testIsNotValidElement() throws Exception{ + + stream = urlToDictionary.openStream(); + builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + doc = builder.parse(stream); + + Element rootElement = doc.getDocumentElement(); + rootElement.normalize(); + rootElement.setAttribute("type", "AdeGw"); + boolean result = instance.isValidElement(rootElement); + + Assert.assertEquals(result, false); + } + + @Test + public void testGetPropertyList() throws Exception{ + + stream = urlToDictionary.openStream(); + builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + doc = builder.parse(stream); + + Element rootElement = doc.getDocumentElement(); + rootElement.normalize(); + NodeList children = rootElement.getChildNodes(); + + List propertyList = new ArrayList(); + + for(int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + //When we found the 'properties' tag, we collect the list of properties contained by it. + if(child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals("properties")) { + propertyList = instance.getPropertyList((Element)child); + break; + } + } + + Assert.assertNotEquals(0, propertyList.size()); + } + + +} diff --git a/sources/codemetropolis-toolchain-mapping/.classpath b/sources/codemetropolis-toolchain-mapping/.classpath index e7a868fb..2c35fc8f 100644 --- a/sources/codemetropolis-toolchain-mapping/.classpath +++ b/sources/codemetropolis-toolchain-mapping/.classpath @@ -24,6 +24,7 @@ + diff --git a/sources/codemetropolis-toolchain-mapping/pom.xml b/sources/codemetropolis-toolchain-mapping/pom.xml index 1c677c2b..10c9eb6b 100644 --- a/sources/codemetropolis-toolchain-mapping/pom.xml +++ b/sources/codemetropolis-toolchain-mapping/pom.xml @@ -65,5 +65,10 @@ commons-collections4 4.1 + + junit + junit + 4.12 + diff --git a/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/conversions/ConversionTest.java b/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/conversions/ConversionTest.java new file mode 100644 index 00000000..8567cad2 --- /dev/null +++ b/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/conversions/ConversionTest.java @@ -0,0 +1,29 @@ +package codemetropolis.toolchain.mapping.conversions; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Test cases for the {@link Conversion} class. + * @author Viktor Meszaros {@literal } + * + */ +public class ConversionTest { + + @Test + public void testCreateFromName() { + String conversionType = "multiply"; + Conversion obj = Conversion.createFromName(conversionType); + boolean result = obj instanceof MultiplyConversion; + + Assert.assertTrue(result); + } + + @Test + public void testCreateFromNameNull() { + String conversionType = "sGfijkL"; + Conversion result = Conversion.createFromName(conversionType); + + Assert.assertNull(result); + } +} diff --git a/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/LinkingTest.java b/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/LinkingTest.java new file mode 100644 index 00000000..f8035fa7 --- /dev/null +++ b/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/LinkingTest.java @@ -0,0 +1,67 @@ +package codemetropolis.toolchain.mapping.model; + +import java.io.FileNotFoundException; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; + +import codemetropolis.toolchain.mapping.exceptions.MappingReaderException; +import codemetropolis.toolchain.mapping.exceptions.MissingResourceException; +import codemetropolis.toolchain.mapping.exceptions.NotSupportedLinkingException; + +/** + * Test cases for the {@link Linking} class. + * @author Viktor Meszaros {@literal } + * + */ +public class LinkingTest { + + public static String TEST_FILE_LOCATION = "./test/sourcemeter_mapping_example_2_0.xml"; + + @Test + public void testValidateShouldNotThrowException() throws MappingReaderException, FileNotFoundException{ + + boolean exceptionThrown = false; + + Mapping mapping = Mapping.readFromXML(TEST_FILE_LOCATION); + + Linking linking = mapping.getLinkings().get(0); + List resources = mapping.getResources(); + + try { + linking.validate(resources); + } catch (NotSupportedLinkingException e) { + exceptionThrown = true; + } catch (MissingResourceException e) { + exceptionThrown = true; + } + + Assert.assertFalse(exceptionThrown); + } + + @Test + public void testValidateShouldThrowException() throws MappingReaderException, FileNotFoundException{ + + boolean exceptionThrown = false; + + String badTarget = "skyscraper"; + + Mapping mapping = Mapping.readFromXML(TEST_FILE_LOCATION); + + Linking linking = mapping.getLinkings().get(0); + linking.setTarget(badTarget); + List resources = mapping.getResources(); + + try { + linking.validate(resources); + } catch (NotSupportedLinkingException e) { + exceptionThrown = true; + } catch (MissingResourceException e) { + exceptionThrown = true; + } + + Assert.assertTrue(exceptionThrown); + } + +} diff --git a/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/MappingControllerTest.java b/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/MappingControllerTest.java new file mode 100644 index 00000000..10c2eed2 --- /dev/null +++ b/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/MappingControllerTest.java @@ -0,0 +1,39 @@ +package codemetropolis.toolchain.mapping.model; + +import java.io.FileNotFoundException; + +import org.junit.Assert; +import org.junit.Test; + +import codemetropolis.toolchain.commons.cdf.exceptions.CdfReaderException; +import codemetropolis.toolchain.mapping.control.MappingController; +import codemetropolis.toolchain.mapping.exceptions.MappingReaderException; + +/** + * Test cases for the {@link MappingController} class. + * @author Viktor Meszaros {@literal } + * + */ +public class MappingControllerTest { + + public static String MAPPING_FILE_LOCATION = "./test/sourcemeter_mapping_example_2_0.xml"; + public static String TEST_FILE_LOCATION = "./test/output_test.xml"; + + + @Test + public void testCreateBuildablesFromCdfShouldNotThrowException() throws FileNotFoundException, MappingReaderException{ + Mapping mapping = Mapping.readFromXML(MAPPING_FILE_LOCATION); + + MappingController mController = new MappingController(mapping); + boolean exceptionThrown = false; + + try { + mController.createBuildablesFromCdf(TEST_FILE_LOCATION); + } catch (CdfReaderException e) { + exceptionThrown = true; + } + + Assert.assertFalse(exceptionThrown); + } + +} diff --git a/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/MappingTest.java b/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/MappingTest.java new file mode 100644 index 00000000..43f3105f --- /dev/null +++ b/sources/codemetropolis-toolchain-mapping/test/codemetropolis/toolchain/mapping/model/MappingTest.java @@ -0,0 +1,34 @@ +package codemetropolis.toolchain.mapping.model; + +import java.io.FileNotFoundException; + +import org.junit.Assert; +import org.junit.Test; + +import codemetropolis.toolchain.mapping.exceptions.MappingReaderException; + +/** + * Test cases for the {@link Mapping} class. + * @author Viktor Meszaros {@literal } + * + */ +public class MappingTest { + + public static String TEST_FILE_LOCATION = "./test/sourcemeter_mapping_example_2_0.xml"; + + @Test + public void testReadFromXMLShouldNotThrowException() { + + boolean exceptionThrown = false; + + try { + Mapping.readFromXML(TEST_FILE_LOCATION); + }catch (MappingReaderException e) { + exceptionThrown = true; + } catch (FileNotFoundException e) { + exceptionThrown = true; + } + + Assert.assertFalse(exceptionThrown); + } +} diff --git a/sources/codemetropolis-toolchain-mapping/test/output_test.xml b/sources/codemetropolis-toolchain-mapping/test/output_test.xml new file mode 100644 index 00000000..560020c9 --- /dev/null +++ b/sources/codemetropolis-toolchain-mapping/test/output_test.xml @@ -0,0 +1,13180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sources/codemetropolis-toolchain-mapping/test/sourcemeter_mapping_example_2_0.xml b/sources/codemetropolis-toolchain-mapping/test/sourcemeter_mapping_example_2_0.xml new file mode 100644 index 00000000..efaa60e5 --- /dev/null +++ b/sources/codemetropolis-toolchain-mapping/test/sourcemeter_mapping_example_2_0.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 6bfb6b4bc100f5b2bc7beb7a69dc2c60f07c3a1c Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Sat, 21 Apr 2018 16:19:17 +0200 Subject: [PATCH 53/58] [test] Add author name to gitinspector unit tests --- .../gitinspector/test/CreateDocumentFromSourceTest.java | 6 ++++++ .../converter/gitinspector/test/CreateElementsTest.java | 6 ++++++ .../converter/gitinspector/test/CreateRootelemenTest.java | 6 ++++++ .../test/DownscalePossibleLargeNumericValueTest.java | 6 ++++++ .../test/GetMetricsFromFirstAuthorElementNodeTest.java | 6 ++++++ .../gitinspector/test/GitInspectorConverterTest.java | 6 ++++++ .../converter/gitinspector/test/ResetMetricsTest.java | 6 ++++++ .../toolchain/converter/gitinspector/test/TestHelper.java | 6 ++++++ .../gitinspector/test/TraverseNodesFromDocumentTest.java | 6 ++++++ .../test/UpdateMetricsFromSecondAuthorElementNodeTest.java | 6 ++++++ .../converter/gitinspector/test/UpdateMetricsTest.java | 6 ++++++ 11 files changed, 66 insertions(+) diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java index de0f9124..e2ead6b4 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateDocumentFromSourceTest.java @@ -7,6 +7,12 @@ import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; +/** + * + * @author Zakor Gyula {@literal } + * + */ + public class CreateDocumentFromSourceTest { private static String XML_SRC_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\GitInspectorOutput.xml"; private static String INVALID_FORMAT_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\"; diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateElementsTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateElementsTest.java index 4f45af49..630c9668 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateElementsTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateElementsTest.java @@ -10,6 +10,12 @@ import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; +/** +* +* @author Zakor Gyula {@literal } +* +*/ + public class CreateElementsTest { private static String XML_SRC_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\GitInspectorOutput.xml"; diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateRootelemenTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateRootelemenTest.java index 257b0470..bc91cc0a 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateRootelemenTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/CreateRootelemenTest.java @@ -9,6 +9,12 @@ import codemetropolis.toolchain.commons.cdf.CdfElement; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; +/** +* +* @author Zakor Gyula {@literal } +* +*/ + public class CreateRootelemenTest { static Document document; static GitInspectorConverter converter; diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java index 6f4948c4..4858b8a1 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/DownscalePossibleLargeNumericValueTest.java @@ -6,6 +6,12 @@ import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; +/** +* +* @author Zakor Gyula {@literal } +* +*/ + public class DownscalePossibleLargeNumericValueTest { private static String[] squareNumbers = {"0", "1", "4", "16", "81", "100", "256", "3481", "7569", "16129", "205234276"}; diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GetMetricsFromFirstAuthorElementNodeTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GetMetricsFromFirstAuthorElementNodeTest.java index 5dc312d5..052af9a0 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GetMetricsFromFirstAuthorElementNodeTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GetMetricsFromFirstAuthorElementNodeTest.java @@ -10,6 +10,12 @@ import codemetropolis.toolchain.commons.cdf.CdfProperty; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; +/** +* +* @author Zakor Gyula {@literal } +* +*/ + public class GetMetricsFromFirstAuthorElementNodeTest { @Test diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorConverterTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorConverterTest.java index feb9e5ef..b432e414 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorConverterTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/GitInspectorConverterTest.java @@ -7,6 +7,12 @@ import codemetropolis.toolchain.commons.cdf.CdfElement; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; +/** +* +* @author Zakor Gyula {@literal } +* +*/ + public class GitInspectorConverterTest { @Test diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/ResetMetricsTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/ResetMetricsTest.java index 18783b75..d4b12788 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/ResetMetricsTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/ResetMetricsTest.java @@ -7,6 +7,12 @@ import codemetropolis.toolchain.commons.cdf.CdfElement; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; +/** +* +* @author Zakor Gyula {@literal } +* +*/ + public class ResetMetricsTest { @Test diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java index 6a6d8129..49e8b8a6 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TestHelper.java @@ -9,6 +9,12 @@ import codemetropolis.toolchain.commons.cdf.CdfProperty; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; +/** +* +* @author Zakor Gyula {@literal } +* +*/ + public class TestHelper { private static String XML_SRC_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\GitInspectorOutput.xml"; diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TraverseNodesFromDocumentTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TraverseNodesFromDocumentTest.java index c0d9600c..c3d4dec2 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TraverseNodesFromDocumentTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/TraverseNodesFromDocumentTest.java @@ -11,6 +11,12 @@ import codemetropolis.toolchain.commons.cdf.CdfProperty; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; +/** +* +* @author Zakor Gyula {@literal } +* +*/ + public class TraverseNodesFromDocumentTest { @Test diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsFromSecondAuthorElementNodeTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsFromSecondAuthorElementNodeTest.java index b42b08ba..e515c136 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsFromSecondAuthorElementNodeTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsFromSecondAuthorElementNodeTest.java @@ -10,6 +10,12 @@ import codemetropolis.toolchain.commons.cdf.CdfProperty; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; +/** +* +* @author Zakor Gyula {@literal } +* +*/ + public class UpdateMetricsFromSecondAuthorElementNodeTest { @Test diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java index 2fbe0604..02baed32 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/gitinspector/test/UpdateMetricsTest.java @@ -10,6 +10,12 @@ import codemetropolis.toolchain.commons.cdf.CdfProperty; import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter; +/** +* +* @author Zakor Gyula {@literal } +* +*/ + public class UpdateMetricsTest { @Test From b79d7b4d4035a63d79be728973e38a8e39d436e0 Mon Sep 17 00:00:00 2001 From: Viktor Meszaros Date: Sat, 21 Apr 2018 17:19:22 +0200 Subject: [PATCH 54/58] Fixing bugs (see below for details). - Now resources can be assigned to buildable properties. - In case of bad formatted or missing coniguration file the editor will display the default list of buildable properties. --- .../gui/MappingFileEditorDialog.java | 29 +++++++--- .../gui/utils/BuildableSettings.java | 54 ++++++++++--------- .../toolchain/gui/utils/TransferHelper.java | 17 +++++- .../main/resources/buildableProperties.cmcfg | 2 +- 4 files changed, 67 insertions(+), 35 deletions(-) diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java index cd4183dc..944d1a43 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java @@ -12,7 +12,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.swing.DefaultListModel; import javax.swing.DropMode; import javax.swing.JDialog; @@ -141,9 +140,7 @@ private void loadDisplayedInfo(String cdfFilePath) { try { BuildableSettings settings = new BuildableSettings(); displayedBuildableAttributes = settings.readSettings(); - - PropertyCollector pc = new PropertyCollector(); - sourceCodeElementProperties = pc.getFromCdf(cdfFilePath); + } catch(BadConfigFileFomatException e) { JOptionPane.showMessageDialog( @@ -163,6 +160,14 @@ private void loadDisplayedInfo(String cdfFilePath) { displayedBuildableAttributes = BuildableSettings.DEFAULT_SETTINGS; } + try { + PropertyCollector pc = new PropertyCollector(); + sourceCodeElementProperties = pc.getFromCdf(cdfFilePath); + } + catch(FileNotFoundException e) { + e.printStackTrace(); + } + } /** @@ -272,11 +277,23 @@ public void actionPerformed(ActionEvent e) { JOptionPane.ERROR_MESSAGE); } else { - String resoureToRemove = resourcesList.getModel().getElementAt(indexToRemove); + String resourceToRemove = resourcesList.getModel().getElementAt(indexToRemove); List> lists = Arrays.asList(resourcesList, cellarList, floorList, gardenList); + List tables = Arrays.asList(cellarTable, floorTable, gardenTable); for(JList list : lists) { DefaultListModel listModel = (DefaultListModel) list.getModel(); - listModel.removeElement(resoureToRemove); + listModel.removeElement(resourceToRemove); + } + for(JTable table : tables) { + int rows = table.getRowCount(); + int columns = table.getColumnCount(); + for(int i = 0; i < rows; i++) + for(int j = 0; j < columns; j++) { + String cellValue = (String) table.getValueAt(i, j); + if(resourceToRemove.equals(cellValue)) { + table.setValueAt(null, i, j); + } + } } } } diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java index 9795c240..625fb175 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/BuildableSettings.java @@ -83,33 +83,33 @@ public Map readSettings() throws BadConfigFileFomatException, BufferedReader cfgFileReader = null; - try { - InputStream stream = urlToDictionary.openStream(); - - cfgFileReader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); - - String actLine; - //A regular line: buildable name is followed by an '=' sign, that follows the list of attributes separated by commas. - while((actLine = cfgFileReader.readLine()).split("=").length == 2) { - String buildableName = actLine.split("=")[0]; - String[] buildableProperties = actLine.split("=")[1].split(","); - if(DISPLAYED_PROPERTIES.containsKey(buildableName)) { - //If there is no assigned attribute given to the actual buildable type... - if(buildableProperties.length == 1 && buildableProperties[0].isEmpty()) { - DISPLAYED_PROPERTIES.put(buildableName, new String[] {}); - } - else { - if(validateProperties(buildableName, buildableProperties)) { - DISPLAYED_PROPERTIES.put(buildableName, buildableProperties); - } - else { - throw new BadConfigFileFomatException(); + try { + if (urlToDictionary != null) { + InputStream stream = urlToDictionary.openStream(); + cfgFileReader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); + String actLine; + //A regular line: buildable name is followed by an '=' sign, that follows the list of attributes separated by commas. + while ((actLine = cfgFileReader.readLine()).split("=").length == 2) { + String buildableName = actLine.split("=")[0]; + String[] buildableProperties = actLine.split("=")[1].split(","); + if (DISPLAYED_PROPERTIES.containsKey(buildableName)) { + //If there is no assigned attribute given to the actual buildable type... + if (buildableProperties.length == 1 && buildableProperties[0].isEmpty()) { + DISPLAYED_PROPERTIES.put(buildableName, new String[] {}); + } else { + if (validateProperties(buildableName, buildableProperties)) { + DISPLAYED_PROPERTIES.put(buildableName, buildableProperties); + } else { + throw new BadConfigFileFomatException(); + } } + } else { + throw new BadConfigFileFomatException(); } - } - else { - throw new BadConfigFileFomatException(); - } + } + } + else { + return DEFAULT_SETTINGS; } } catch(IOException e) { @@ -117,7 +117,9 @@ public Map readSettings() throws BadConfigFileFomatException, } finally { try { - cfgFileReader.close(); + if(cfgFileReader != null) { + cfgFileReader.close(); + } } catch(IOException ioe) { ioe.printStackTrace(); diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java index 87430aa8..8b5f5d19 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java @@ -13,6 +13,7 @@ import javax.swing.TransferHandler; import codemetropolis.toolchain.gui.MappingFileEditorDialog; +import codemetropolis.toolchain.gui.MappingFileEditorDialog.AssignResult; import codemetropolis.toolchain.gui.conversions.*; /** @@ -20,6 +21,7 @@ * a Transferable to and from Swing components. * * @author Tamas Keri {@literal } + * @author Viktor Meszaros {@literal } */ public class TransferHelper extends TransferHandler { @@ -66,8 +68,19 @@ public boolean typeChecker (Object obj, JTable target, int row, int col) { dragValue = dragValue.split(": ")[1]; dropValue = dropValue.split(": ")[1]; - - switch (MappingFileEditorDialog.ASSIGN_RESULT_MATRIX.get(dropValue).get(dragValue)) { + + AssignResult cell = MappingFileEditorDialog.ASSIGN_RESULT_MATRIX.get(dropValue).get(dragValue); + if(cell == null) { + //We are trying to drag a resource... specify its type. + if(dragValue.matches("[0-9]+")) dragValue = "int"; + else if(dragValue.matches("[0-9]+.[0-9]+")) dragValue = "float"; + else{ + dragValue = "string"; + } + cell = MappingFileEditorDialog.ASSIGN_RESULT_MATRIX.get(dropValue).get(dragValue); + } + + switch (cell) { case CANNOT_ASSIGN: return false; diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg b/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg index facf19b3..05d9382c 100644 --- a/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg @@ -1,4 +1,4 @@ -FLOOR=width,height,length,character,external_character,torches +FLOOR=width,height,length,character,external_character CELLAR=width,height,length,character,external_character GARDEN=tree-ratio,mushroom-ratio,flower-ratio GROUND= From fd7109356537313229480542c34f70aad1d9fe03 Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Sat, 21 Apr 2018 17:30:48 +0200 Subject: [PATCH 55/58] [test] Fix two wrong unit test result --- .../toolchain/gui/utils/QuantizationInformationTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/QuantizationInformationTest.java b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/QuantizationInformationTest.java index 5f970918..0f0ccd52 100644 --- a/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/QuantizationInformationTest.java +++ b/sources/codemetropolis-toolchain-gui/src/test/java/codemetropolis/toolchain/gui/utils/QuantizationInformationTest.java @@ -37,13 +37,13 @@ public void testPassSetBuildableAttribute() throws IOException { @Test public void testFailSetIndex() throws IOException { quant.setIndex(4); - assertTrue(quant.getIndex() == 1); + assertTrue(quant.getIndex() == 4); } @Test public void testFailSetMetric() throws IOException { quant.setMetric("NUMPAR"); - assertTrue(quant.getMetric() == ""); + assertTrue(quant.getMetric() == "NUMPAR"); } @Test From 338836e551efbbbfb1eca95011fc29fb2efd704d Mon Sep 17 00:00:00 2001 From: Zakor Gyula Date: Sat, 21 Apr 2018 18:00:32 +0200 Subject: [PATCH 56/58] Add test coverage report --- doc/RF2-M2B-A-Csokosok-testreport.html | 1 + .../index.html | 1 + .../CdfConverter.html | 1 + .../CdfConverter.java.html | 40 + .../ConverterEvent.html | 1 + .../ConverterEvent.java.html | 17 + .../index.html | 1 + .../index.source.html | 1 + .../CdfReaderException.html | 1 + .../CdfReaderException.java.html | 30 + .../CdfWriterException.html | 1 + .../CdfWriterException.java.html | 28 + .../index.html | 1 + .../index.source.html | 1 + .../CdfElement.html | 1 + .../CdfElement.java.html | 137 ++ .../CdfProperty$Type.html | 1 + .../CdfProperty.html | 1 + .../CdfProperty.java.html | 45 + .../CdfTree$Iterator.html | 1 + .../CdfTree.html | 1 + .../CdfTree.java.html | 97 ++ .../index.html | 1 + .../index.source.html | 1 + .../BuildableDepthComparator.html | 1 + .../BuildableDepthComparator.java.html | 15 + .../BuildableDescendantLevelComparator.html | 1 + ...ildableDescendantLevelComparator.java.html | 15 + .../BuildableSizeComparator.html | 1 + .../BuildableSizeComparator.java.html | 16 + .../BuildableWidthComparator.html | 1 + .../BuildableWidthComparator.java.html | 15 + .../index.html | 1 + .../index.source.html | 1 + .../CmxmlReaderException.html | 1 + .../CmxmlReaderException.java.html | 28 + .../CmxmlValidationFailedException.html | 1 + .../CmxmlValidationFailedException.java.html | 28 + .../CmxmlWriterException.html | 1 + .../CmxmlWriterException.java.html | 28 + .../index.html | 1 + .../index.source.html | 1 + .../Attribute.html | 1 + .../Attribute.java.html | 26 + .../Buildable$Type.html | 1 + .../Buildable.html | 1 + .../Buildable.java.html | 464 +++++ .../BuildableTree$Iterator.html | 1 + .../BuildableTree.html | 1 + .../BuildableTree.java.html | 254 +++ .../CmxmlValidator.html | 1 + .../CmxmlValidator.java.html | 33 + .../Point.html | 1 + .../Point.java.html | 53 + .../index.html | 1 + .../index.source.html | 1 + .../CodeMetropolisException.html | 1 + .../CodeMetropolisException.java.html | 28 + .../InvalidSchemeException.html | 1 + .../InvalidSchemeException.java.html | 28 + .../SchemeNotSetException.html | 1 + .../SchemeNotSetException.java.html | 28 + .../index.html | 1 + .../index.source.html | 1 + .../AbstractExecutor.html | 1 + .../AbstractExecutor.java.html | 63 + .../ExecutorArgs.html | 1 + .../ExecutorArgs.java.html | 4 + .../index.html | 1 + .../index.source.html | 1 + .../FileLogger.html | 1 + .../FileLogger.java.html | 47 + .../FileUtils.html | 1 + .../FileUtils.java.html | 24 + .../Resources.html | 1 + .../Resources.java.html | 16 + .../Settings.html | 1 + .../Settings.java.html | 16 + .../Time.html | 1 + .../Time.java.html | 24 + .../XmlValidator.html | 1 + .../XmlValidator.java.html | 55 + .../index.html | 1 + .../index.source.html | 1 + .../src_main_java/index.html | 1 + .../src_main_resources/index.html | 1 + .../index.html | 1 + .../BrowsingHistoryConverterTests.html | 1 + .../BrowsingHistoryConverterTests.java.html | 182 ++ .../index.html | 1 + .../index.source.html | 1 + .../BrowsingHistoryConverter.html | 1 + .../BrowsingHistoryConverter.java.html | 160 ++ .../index.html | 1 + .../index.source.html | 1 + .../ConverterLoader.html | 1 + .../ConverterLoader.java.html | 30 + .../ConverterType.html | 1 + .../ConverterType.java.html | 9 + .../index.html | 1 + .../index.source.html | 1 + .../CreateDocumentFromSourceTest.html | 1 + .../CreateDocumentFromSourceTest.java.html | 54 + .../CreateElementsTest.html | 1 + .../CreateElementsTest.java.html | 104 ++ .../CreateRootelemenTest.html | 1 + .../CreateRootelemenTest.java.html | 35 + ...ownscalePossibleLargeNumericValueTest.html | 1 + ...alePossibleLargeNumericValueTest.java.html | 57 + ...MetricsFromFirstAuthorElementNodeTest.html | 1 + ...csFromFirstAuthorElementNodeTest.java.html | 76 + .../GitInspectorConverterTest.html | 1 + .../GitInspectorConverterTest.java.html | 27 + .../ResetMetricsTest.html | 1 + .../ResetMetricsTest.java.html | 31 + .../TestHelper.html | 1 + .../TestHelper.java.html | 56 + .../TraverseNodesFromDocumentTest.html | 1 + .../TraverseNodesFromDocumentTest.java.html | 64 + ...etricsFromSecondAuthorElementNodeTest.html | 1 + ...sFromSecondAuthorElementNodeTest.java.html | 73 + .../UpdateMetricsTest.html | 1 + .../UpdateMetricsTest.java.html | 63 + .../index.html | 1 + .../index.source.html | 1 + .../GitInspectorConverter.html | 1 + .../GitInspectorConverter.java.html | 180 ++ .../index.html | 1 + .../index.source.html | 1 + .../SonarClient.html | 1 + .../SonarClient.java.html | 213 +++ .../SonarConnectException.html | 1 + .../SonarConnectException.java.html | 30 + .../SonarMetric$MetricType.html | 1 + .../SonarMetric.html | 1 + .../SonarMetric.java.html | 83 + .../SonarQubeConverter.html | 1 + .../SonarQubeConverter.java.html | 194 +++ .../SonarRequest.html | 1 + .../SonarRequest.java.html | 107 ++ .../SonarResource$Scope.html | 1 + .../SonarResource.html | 1 + .../SonarResource.java.html | 126 ++ .../index.html | 1 + .../index.source.html | 1 + .../GraphConverter.html | 1 + .../GraphConverter.java.html | 89 + .../index.html | 1 + .../index.source.html | 1 + .../CommandLineOptions.html | 1 + .../CommandLineOptions.java.html | 44 + .../ConverterExecutor$1.html | 1 + .../ConverterExecutor.html | 1 + .../ConverterExecutor.java.html | 56 + .../ConverterExecutorArgs.html | 1 + .../ConverterExecutorArgs.java.html | 50 + .../Main.html | 1 + .../Main.java.html | 81 + .../index.html | 1 + .../index.source.html | 1 + .../src_main_java/index.html | 1 + doc/codemetropolis-toolchain-gui/index.html | 1 + .../BadConfigFileFomatException.html | 1 + .../BadConfigFileFomatException.java.html | 41 + .../ExecutionException.html | 1 + .../ExecutionException.java.html | 41 + .../ExecutionOptions.html | 1 + .../ExecutionOptions.java.html | 121 ++ .../QuantizationInformation.html | 1 + .../QuantizationInformation.java.html | 44 + .../index.html | 1 + .../index.source.html | 1 + .../BrowseListener.html | 1 + .../BrowseListener.java.html | 47 + .../index.html | 1 + .../index.source.html | 1 + .../CMButton.html | 1 + .../CMButton.java.html | 45 + .../CMCheckBox.html | 1 + .../CMCheckBox.java.html | 36 + .../CMComboBox.html | 1 + .../CMComboBox.java.html | 46 + .../CMLabel.html | 1 + .../CMLabel.java.html | 45 + .../CMMetricPanel.html | 1 + .../CMMetricPanel.java.html | 53 + .../CMPasswordField.html | 1 + .../CMPasswordField.java.html | 41 + .../CMScrollPane.html | 1 + .../CMScrollPane.java.html | 54 + .../CMSpinner.html | 1 + .../CMSpinner.java.html | 46 + .../CMTextArea.html | 1 + .../CMTextArea.java.html | 40 + .../CMTextField.html | 1 + .../CMTextField.java.html | 40 + .../index.html | 1 + .../index.source.html | 1 + .../Conversion.html | 1 + .../Conversion.java.html | 11 + .../EmptyConversion.html | 1 + .../EmptyConversion.java.html | 11 + .../NormalizeConversion.html | 1 + .../NormalizeConversion.java.html | 11 + .../QuantizationConversion.html | 1 + .../QuantizationConversion.java.html | 21 + .../ToDoubleConversion.html | 1 + .../ToDoubleConversion.java.html | 10 + .../ToIntConversion.html | 1 + .../ToIntConversion.java.html | 10 + .../index.html | 1 + .../index.source.html | 1 + .../ConverterToolExecutor.html | 1 + .../ConverterToolExecutor.java.html | 119 ++ .../MappingToolExecutor.html | 1 + .../MappingToolExecutor.java.html | 56 + .../MetricGeneratorExecutor.html | 1 + .../MetricGeneratorExecutor.java.html | 81 + .../PlacingToolExecutor.html | 1 + .../PlacingToolExecutor.java.html | 55 + .../RenderingToolExecutor.html | 1 + .../RenderingToolExecutor.java.html | 55 + .../index.html | 1 + .../index.source.html | 1 + .../SonarQubeGenerator.html | 1 + .../SonarQubeGenerator.java.html | 128 ++ .../SourceMeterGenerator.html | 1 + .../SourceMeterGenerator.java.html | 117 ++ .../index.html | 1 + .../index.source.html | 1 + .../BuildableSettings.html | 1 + .../BuildableSettings.java.html | 170 ++ .../ExeFileFilter.html | 1 + .../ExeFileFilter.java.html | 31 + .../ExecutionWorker.html | 1 + .../ExecutionWorker.java.html | 68 + .../GuiUtils.html | 1 + .../GuiUtils.java.html | 89 + .../Property.html | 1 + .../Property.java.html | 17 + .../PropertyCollector.html | 1 + .../PropertyCollector.java.html | 165 ++ .../StreamReaderWorker.html | 1 + .../StreamReaderWorker.java.html | 59 + .../TransferHelper.html | 1 + .../TransferHelper.java.html | 177 ++ .../Translations.html | 1 + .../Translations.java.html | 34 + .../XmlFileFilter.html | 1 + .../XmlFileFilter.java.html | 31 + .../index.html | 1 + .../index.source.html | 1 + .../CodeMetropolisGUI$1.html | 1 + .../CodeMetropolisGUI$2.html | 1 + .../CodeMetropolisGUI.html | 1 + .../CodeMetropolisGUI.java.html | 366 ++++ .../ExecutionDialog$1.html | 1 + .../ExecutionDialog.html | 1 + .../ExecutionDialog.java.html | 126 ++ .../GUIController.html | 1 + .../GUIController.java.html | 103 ++ .../codemetropolis.toolchain.gui/Main.html | 1 + .../Main.java.html | 65 + .../MappingFileEditorDialog$1.html | 1 + .../MappingFileEditorDialog$2.html | 1 + .../MappingFileEditorDialog$3.html | 1 + .../MappingFileEditorDialog$AssignResult.html | 1 + .../MappingFileEditorDialog.html | 1 + .../MappingFileEditorDialog.java.html | 629 +++++++ .../QuantizationSetterDialog.html | 1 + .../QuantizationSetterDialog.java.html | 129 ++ .../codemetropolis.toolchain.gui/index.html | 1 + .../index.source.html | 1 + .../src_main_java/index.html | 1 + .../src_main_resources/index.html | 1 + .../index.html | 1 + .../LimitController.html | 1 + .../LimitController.java.html | 24 + .../MappingController.html | 1 + .../MappingController.java.html | 305 ++++ .../index.html | 1 + .../index.source.html | 1 + .../Conversion.html | 1 + .../Conversion.java.html | 73 + .../ConversionAdapter$AdaptedConversion.html | 1 + .../ConversionAdapter.html | 1 + .../ConversionAdapter.java.html | 40 + .../MultiplyConversion.html | 1 + .../MultiplyConversion.java.html | 22 + .../NormalizeConversion.html | 1 + .../NormalizeConversion.java.html | 18 + .../QuantizationConversion.html | 1 + .../QuantizationConversion.java.html | 42 + .../SwitchConversion.html | 1 + .../SwitchConversion.java.html | 29 + .../ToDoubleConversion.html | 1 + .../ToDoubleConversion.java.html | 15 + .../ToIntConversion.html | 1 + .../ToIntConversion.java.html | 15 + .../index.html | 1 + .../index.source.html | 1 + .../MappingException.html | 1 + .../MappingException.java.html | 30 + .../MappingReaderException.html | 1 + .../MappingReaderException.java.html | 28 + .../MappingWriterException.html | 1 + .../MappingWriterException.java.html | 28 + .../MissingResourceException.html | 1 + .../MissingResourceException.java.html | 28 + .../NotSupportedLinkingException.html | 1 + .../NotSupportedLinkingException.java.html | 28 + .../NotValidBuildableStructure.html | 1 + .../NotValidBuildableStructure.java.html | 16 + .../index.html | 1 + .../index.source.html | 1 + .../Binding.html | 1 + .../Binding.java.html | 83 + .../Constant.html | 1 + .../Constant.java.html | 42 + .../Limit.html | 1 + .../Limit.java.html | 34 + .../Linking.html | 1 + .../Linking.java.html | 119 ++ .../Mapping.html | 1 + .../Mapping.java.html | 143 ++ .../Parameter.html | 1 + .../Parameter.java.html | 42 + .../index.html | 1 + .../index.source.html | 1 + .../MappingModelTests.html | 1 + .../MappingModelTests.java.html | 111 ++ .../index.html | 1 + .../index.source.html | 1 + .../CommandLineOptions.html | 1 + .../CommandLineOptions.java.html | 50 + .../Main.html | 1 + .../Main.java.html | 52 + .../MappingExecutor.html | 1 + .../MappingExecutor.java.html | 93 + .../MappingExecutorArgs.html | 1 + .../MappingExecutorArgs.java.html | 43 + .../index.html | 1 + .../index.source.html | 1 + .../src_main_java/index.html | 1 + .../index.html | 1 + .../LayoutException.html | 1 + .../LayoutException.java.html | 28 + .../NonExistentLayoutException.html | 1 + .../NonExistentLayoutException.java.html | 28 + .../PlacingException.html | 1 + .../PlacingException.java.html | 30 + .../index.html | 1 + .../index.source.html | 1 + .../BuildableWrapper.html | 1 + .../BuildableWrapper.java.html | 113 ++ .../House.html | 1 + .../House.java.html | 156 ++ .../PackLayout.html | 1 + .../PackLayout.java.html | 157 ++ .../RectanglePacker$Fit.html | 1 + .../RectanglePacker$Node.html | 1 + .../RectanglePacker$Rectangle.html | 1 + .../RectanglePacker.html | 1 + .../RectanglePacker.java.html | 370 ++++ .../index.html | 1 + .../index.source.html | 1 + .../House.html | 1 + .../House.java.html | 116 ++ .../TetrisLayout.html | 1 + .../TetrisLayout.java.html | 312 ++++ .../index.html | 1 + .../index.source.html | 1 + .../Layout.html | 1 + .../Layout.java.html | 33 + .../LayoutAlgorithm.html | 1 + .../LayoutAlgorithm.java.html | 7 + .../index.html | 1 + .../index.source.html | 1 + .../CityMapGUI$1.html | 1 + .../CityMapGUI$CityMapCanvas.html | 1 + .../CityMapGUI.html | 1 + .../CityMapGUI.java.html | 105 ++ .../CommandLineOptions.html | 1 + .../CommandLineOptions.java.html | 43 + .../Main.html | 1 + .../Main.java.html | 51 + .../PlacingExecutor$1.html | 1 + .../PlacingExecutor.html | 1 + .../PlacingExecutor.java.html | 83 + .../PlacingExecutorArgs.html | 1 + .../PlacingExecutorArgs.java.html | 41 + .../index.html | 1 + .../index.source.html | 1 + .../src_main_java/index.html | 1 + .../index.html | 1 + .../BuildPhase.html | 1 + .../BuildPhase.java.html | 8 + .../WorldBuilder.html | 1 + .../WorldBuilder.java.html | 170 ++ .../index.html | 1 + .../index.source.html | 1 + .../ProgressEvent.html | 1 + .../ProgressEvent.java.html | 38 + .../index.html | 1 + .../index.source.html | 1 + .../BuildingTypeMismatchException.html | 1 + .../BuildingTypeMismatchException.java.html | 35 + .../RenderingException.html | 1 + .../RenderingException.java.html | 30 + .../TooLongRenderDurationException.html | 1 + .../TooLongRenderDurationException.java.html | 25 + .../index.html | 1 + .../index.source.html | 1 + .../Building.html | 1 + .../Building.java.html | 85 + .../Cellar.html | 1 + .../Cellar.java.html | 39 + .../Floor.html | 1 + .../Floor.java.html | 347 ++++ .../Garden.html | 1 + .../Garden.java.html | 149 ++ .../Ground.html | 1 + .../Ground.java.html | 43 + .../index.html | 1 + .../index.source.html | 1 + .../RandomPattern.html | 1 + .../RandomPattern.java.html | 44 + .../RepeationPattern.html | 1 + .../RepeationPattern.java.html | 30 + .../SplitPattern.html | 1 + .../SplitPattern.java.html | 35 + .../XSplitPattern.html | 1 + .../XSplitPattern.java.html | 22 + .../YSplitPattern.html | 1 + .../YSplitPattern.java.html | 22 + .../ZSplitPattern.html | 1 + .../ZSplitPattern.java.html | 22 + .../index.html | 1 + .../index.source.html | 1 + .../Banner$Orientation.html | 1 + .../Banner.html | 1 + .../Banner.java.html | 53 + .../Boxel.html | 1 + .../Boxel.java.html | 95 ++ .../Door$Orientation.html | 1 + .../Door.html | 1 + .../Door.java.html | 48 + .../EmptyBox.html | 1 + .../EmptyBox.java.html | 107 ++ .../Row$Direction.html | 1 + .../Row.html | 1 + .../Row.java.html | 70 + .../SignPost$Orientation.html | 1 + .../SignPost.html | 1 + .../SignPost.java.html | 53 + .../SolidBox.html | 1 + .../SolidBox.java.html | 84 + .../WallSign$Orientation.html | 1 + .../WallSign.html | 1 + .../WallSign.java.html | 53 + .../index.html | 1 + .../index.source.html | 1 + .../BasicBlock.html | 1 + .../BasicBlock.java.html | 113 ++ .../Paintable.html | 1 + .../Paintable.java.html | 24 + .../index.html | 1 + .../index.source.html | 1 + .../Character.html | 1 + .../Character.java.html | 75 + .../Orientation.html | 1 + .../Orientation.java.html | 11 + .../index.html | 1 + .../index.source.html | 1 + .../CommandLineOptions.html | 1 + .../CommandLineOptions.java.html | 36 + .../Main$1.html | 1 + .../Main.html | 1 + .../Main.java.html | 83 + .../RenderingExecutor.html | 1 + .../RenderingExecutor.java.html | 122 ++ .../RenderingExecutorArgs.html | 1 + .../RenderingExecutorArgs.java.html | 45 + .../index.html | 1 + .../index.source.html | 1 + .../src_main_java/index.html | 1 + .../src_main_resources/index.html | 1 + doc/jacoco-resources/branchfc.gif | Bin 0 -> 91 bytes doc/jacoco-resources/branchnc.gif | Bin 0 -> 91 bytes doc/jacoco-resources/branchpc.gif | Bin 0 -> 91 bytes doc/jacoco-resources/bundle.gif | Bin 0 -> 709 bytes doc/jacoco-resources/class.gif | Bin 0 -> 586 bytes doc/jacoco-resources/down.gif | Bin 0 -> 67 bytes doc/jacoco-resources/greenbar.gif | Bin 0 -> 91 bytes doc/jacoco-resources/group.gif | Bin 0 -> 351 bytes doc/jacoco-resources/method.gif | Bin 0 -> 193 bytes doc/jacoco-resources/package.gif | Bin 0 -> 227 bytes doc/jacoco-resources/prettify.css | 13 + doc/jacoco-resources/prettify.js | 1510 +++++++++++++++++ doc/jacoco-resources/redbar.gif | Bin 0 -> 91 bytes doc/jacoco-resources/report.css | 243 +++ doc/jacoco-resources/report.gif | Bin 0 -> 363 bytes doc/jacoco-resources/session.gif | Bin 0 -> 213 bytes doc/jacoco-resources/sort.gif | Bin 0 -> 58 bytes doc/jacoco-resources/sort.js | 147 ++ doc/jacoco-resources/source.gif | Bin 0 -> 354 bytes doc/jacoco-resources/up.gif | Bin 0 -> 67 bytes doc/jacoco-sessions.html | 1 + 508 files changed, 15326 insertions(+) create mode 100644 doc/RF2-M2B-A-Csokosok-testreport.html create mode 100644 doc/codemetropolis-toolchain-commons/index.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/CdfConverter.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/CdfConverter.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/ConverterEvent.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/ConverterEvent.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/index.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/index.source.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfReaderException.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfReaderException.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfWriterException.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfWriterException.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/index.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/index.source.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfElement.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfElement.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty$Type.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree$Iterator.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/index.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/index.source.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDepthComparator.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDepthComparator.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDescendantLevelComparator.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDescendantLevelComparator.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableSizeComparator.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableSizeComparator.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableWidthComparator.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableWidthComparator.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/index.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/index.source.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlReaderException.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlReaderException.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlValidationFailedException.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlValidationFailedException.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlWriterException.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlWriterException.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/index.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/index.source.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Attribute.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Attribute.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable$Type.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree$Iterator.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/CmxmlValidator.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/CmxmlValidator.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Point.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Point.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/index.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/index.source.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/CodeMetropolisException.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/CodeMetropolisException.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/InvalidSchemeException.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/InvalidSchemeException.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/SchemeNotSetException.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/SchemeNotSetException.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/index.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/index.source.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/AbstractExecutor.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/AbstractExecutor.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/ExecutorArgs.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/ExecutorArgs.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/index.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/index.source.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileLogger.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileLogger.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileUtils.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileUtils.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Resources.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Resources.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Settings.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Settings.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Time.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Time.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/XmlValidator.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/XmlValidator.java.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/index.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/index.source.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_java/index.html create mode 100644 doc/codemetropolis-toolchain-commons/src_main_resources/index.html create mode 100644 doc/codemetropolis-toolchain-converter/index.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/BrowsingHistoryConverterTests.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/BrowsingHistoryConverterTests.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/index.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/index.source.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/BrowsingHistoryConverter.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/BrowsingHistoryConverter.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/index.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/index.source.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterLoader.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterLoader.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterType.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterType.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/index.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/index.source.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateDocumentFromSourceTest.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateDocumentFromSourceTest.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateElementsTest.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateElementsTest.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateRootelemenTest.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateRootelemenTest.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/DownscalePossibleLargeNumericValueTest.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/DownscalePossibleLargeNumericValueTest.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GetMetricsFromFirstAuthorElementNodeTest.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GetMetricsFromFirstAuthorElementNodeTest.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GitInspectorConverterTest.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GitInspectorConverterTest.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/ResetMetricsTest.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/ResetMetricsTest.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TestHelper.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TestHelper.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TraverseNodesFromDocumentTest.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TraverseNodesFromDocumentTest.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsFromSecondAuthorElementNodeTest.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsFromSecondAuthorElementNodeTest.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsTest.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsTest.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/index.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/index.source.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/GitInspectorConverter.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/GitInspectorConverter.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/index.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/index.source.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarClient.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarClient.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarConnectException.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarConnectException.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric$MetricType.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarQubeConverter.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarQubeConverter.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarRequest.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarRequest.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource$Scope.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/index.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/index.source.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/GraphConverter.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/GraphConverter.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/index.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/index.source.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/CommandLineOptions.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/CommandLineOptions.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor$1.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutorArgs.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutorArgs.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/Main.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/Main.java.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/index.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/index.source.html create mode 100644 doc/codemetropolis-toolchain-converter/src_main_java/index.html create mode 100644 doc/codemetropolis-toolchain-gui/index.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/BadConfigFileFomatException.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/BadConfigFileFomatException.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionException.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionException.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionOptions.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionOptions.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/QuantizationInformation.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/QuantizationInformation.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/index.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/index.source.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/BrowseListener.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/BrowseListener.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/index.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/index.source.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMButton.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMButton.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMCheckBox.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMCheckBox.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMComboBox.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMComboBox.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMLabel.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMLabel.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMMetricPanel.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMMetricPanel.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMPasswordField.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMPasswordField.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMScrollPane.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMScrollPane.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMSpinner.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMSpinner.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextArea.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextArea.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextField.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextField.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/index.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/index.source.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/Conversion.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/Conversion.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/EmptyConversion.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/EmptyConversion.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/NormalizeConversion.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/NormalizeConversion.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/QuantizationConversion.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/QuantizationConversion.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToDoubleConversion.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToDoubleConversion.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToIntConversion.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToIntConversion.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/index.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/index.source.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/ConverterToolExecutor.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/ConverterToolExecutor.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MappingToolExecutor.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MappingToolExecutor.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MetricGeneratorExecutor.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MetricGeneratorExecutor.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/PlacingToolExecutor.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/PlacingToolExecutor.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/RenderingToolExecutor.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/RenderingToolExecutor.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/index.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/index.source.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SonarQubeGenerator.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SonarQubeGenerator.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SourceMeterGenerator.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SourceMeterGenerator.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/index.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/index.source.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/BuildableSettings.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/BuildableSettings.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExeFileFilter.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExeFileFilter.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExecutionWorker.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExecutionWorker.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/GuiUtils.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/GuiUtils.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Property.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Property.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/PropertyCollector.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/PropertyCollector.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/StreamReaderWorker.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/StreamReaderWorker.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/TransferHelper.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/TransferHelper.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Translations.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Translations.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/XmlFileFilter.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/XmlFileFilter.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/index.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/index.source.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI$1.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI$2.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog$1.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/GUIController.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/GUIController.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/Main.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/Main.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$1.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$2.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$3.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$AssignResult.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/QuantizationSetterDialog.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/QuantizationSetterDialog.java.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/index.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/index.source.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_java/index.html create mode 100644 doc/codemetropolis-toolchain-gui/src_main_resources/index.html create mode 100644 doc/codemetropolis-toolchain-mapping/index.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/LimitController.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/LimitController.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/MappingController.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/MappingController.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/index.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/index.source.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/Conversion.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/Conversion.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter$AdaptedConversion.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/MultiplyConversion.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/MultiplyConversion.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/NormalizeConversion.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/NormalizeConversion.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/QuantizationConversion.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/QuantizationConversion.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/SwitchConversion.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/SwitchConversion.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToDoubleConversion.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToDoubleConversion.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToIntConversion.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToIntConversion.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/index.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/index.source.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingException.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingException.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingReaderException.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingReaderException.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingWriterException.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingWriterException.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MissingResourceException.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MissingResourceException.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotSupportedLinkingException.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotSupportedLinkingException.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotValidBuildableStructure.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotValidBuildableStructure.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/index.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/index.source.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Binding.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Binding.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Constant.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Constant.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Limit.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Limit.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Linking.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Linking.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Mapping.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Mapping.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Parameter.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Parameter.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/index.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/index.source.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/MappingModelTests.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/MappingModelTests.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/index.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/index.source.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/CommandLineOptions.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/CommandLineOptions.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/Main.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/Main.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutor.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutor.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutorArgs.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutorArgs.java.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/index.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/index.source.html create mode 100644 doc/codemetropolis-toolchain-mapping/src_main_java/index.html create mode 100644 doc/codemetropolis-toolchain-placing/index.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/LayoutException.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/LayoutException.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/NonExistentLayoutException.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/NonExistentLayoutException.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/PlacingException.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/PlacingException.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/index.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/index.source.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/BuildableWrapper.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/BuildableWrapper.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/House.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/House.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/PackLayout.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/PackLayout.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Fit.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Node.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Rectangle.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/index.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/index.source.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/House.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/House.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/TetrisLayout.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/TetrisLayout.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/index.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/index.source.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/Layout.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/Layout.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/LayoutAlgorithm.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/LayoutAlgorithm.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/index.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/index.source.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI$1.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI$CityMapCanvas.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CommandLineOptions.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CommandLineOptions.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/Main.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/Main.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor$1.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutorArgs.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutorArgs.java.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/index.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/index.source.html create mode 100644 doc/codemetropolis-toolchain-placing/src_main_java/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/BuildPhase.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/BuildPhase.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/WorldBuilder.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/WorldBuilder.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/index.source.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/ProgressEvent.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/ProgressEvent.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/index.source.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/BuildingTypeMismatchException.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/BuildingTypeMismatchException.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/RenderingException.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/RenderingException.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/TooLongRenderDurationException.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/TooLongRenderDurationException.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/index.source.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Building.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Building.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Cellar.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Cellar.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Floor.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Floor.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Garden.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Garden.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Ground.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Ground.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/index.source.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RandomPattern.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RandomPattern.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RepeationPattern.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RepeationPattern.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/SplitPattern.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/SplitPattern.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/XSplitPattern.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/XSplitPattern.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/YSplitPattern.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/YSplitPattern.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/ZSplitPattern.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/ZSplitPattern.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/index.source.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner$Orientation.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Boxel.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Boxel.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door$Orientation.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/EmptyBox.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/EmptyBox.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row$Direction.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost$Orientation.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SolidBox.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SolidBox.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign$Orientation.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/index.source.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/BasicBlock.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/BasicBlock.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/Paintable.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/Paintable.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/index.source.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Character.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Character.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Orientation.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Orientation.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/index.source.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/CommandLineOptions.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/CommandLineOptions.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main$1.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutor.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutor.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutorArgs.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutorArgs.java.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/index.source.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_java/index.html create mode 100644 doc/codemetropolis-toolchain-rendering/src_main_resources/index.html create mode 100644 doc/jacoco-resources/branchfc.gif create mode 100644 doc/jacoco-resources/branchnc.gif create mode 100644 doc/jacoco-resources/branchpc.gif create mode 100644 doc/jacoco-resources/bundle.gif create mode 100644 doc/jacoco-resources/class.gif create mode 100644 doc/jacoco-resources/down.gif create mode 100644 doc/jacoco-resources/greenbar.gif create mode 100644 doc/jacoco-resources/group.gif create mode 100644 doc/jacoco-resources/method.gif create mode 100644 doc/jacoco-resources/package.gif create mode 100644 doc/jacoco-resources/prettify.css create mode 100644 doc/jacoco-resources/prettify.js create mode 100644 doc/jacoco-resources/redbar.gif create mode 100644 doc/jacoco-resources/report.css create mode 100644 doc/jacoco-resources/report.gif create mode 100644 doc/jacoco-resources/session.gif create mode 100644 doc/jacoco-resources/sort.gif create mode 100644 doc/jacoco-resources/sort.js create mode 100644 doc/jacoco-resources/source.gif create mode 100644 doc/jacoco-resources/up.gif create mode 100644 doc/jacoco-sessions.html diff --git a/doc/RF2-M2B-A-Csokosok-testreport.html b/doc/RF2-M2B-A-Csokosok-testreport.html new file mode 100644 index 00000000..d486edbd --- /dev/null +++ b/doc/RF2-M2B-A-Csokosok-testreport.html @@ -0,0 +1 @@ +Merged (Apr 21, 2018 5:41:32 PM)

Merged (Apr 21, 2018 5:41:32 PM)

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total24,173 of 28,66215%1,454 of 1,63310%1,6891,9444,4855,4308961,089161215
codemetropolis-toolchain-rendering8,2120%2390%3253251,0871,0871851854444
codemetropolis-toolchain-gui5,1231,08817%1955822%2943521,0711,2641832224154
codemetropolis-toolchain-placing3,9120%4310%3493497387381311312525
codemetropolis-toolchain-commons2,80035011%20662%3013376477241942292434
codemetropolis-toolchain-converter2,5382,10445%2216422%2293215611,0131031741630
codemetropolis-toolchain-mapping1,58894737%1625123%1912603816041001481128
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/index.html b/doc/codemetropolis-toolchain-commons/index.html new file mode 100644 index 00000000..80d6593e --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/index.html @@ -0,0 +1 @@ +codemetropolis-toolchain-commons

codemetropolis-toolchain-commons

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total2,800 of 3,15011%206 of 2122%3013376477241942292434
src/main/java2,80035011%20662%3013376477241942292434
src/main/resourcesn/an/a00000000
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/CdfConverter.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/CdfConverter.html new file mode 100644 index 00000000..5c6d7471 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/CdfConverter.html @@ -0,0 +1 @@ +CdfConverter

CdfConverter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total37 of 4822%2 of 20%5681245
fireConverterEvent(String)190%20%223311
getParameter(String)60%n/a111111
addConverterEventListener(ConverterEventListener)60%n/a112211
removeConverterEventListener(ConverterEventListener)60%n/a112211
CdfConverter(Map)11100%n/a010401
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/CdfConverter.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/CdfConverter.java.html new file mode 100644 index 00000000..e02cd369 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/CdfConverter.java.html @@ -0,0 +1,40 @@ +CdfConverter.java

CdfConverter.java

package codemetropolis.toolchain.commons.cdf.converter;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import codemetropolis.toolchain.commons.cdf.CdfTree;
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+
+public abstract class CdfConverter {
+	
+	private Map<String, String> params;
+	private List<ConverterEventListener> listeners = new ArrayList<>();
+	
+	protected CdfConverter(Map<String, String> params) {
+		this.params = params;
+	}
+	
+	protected String getParameter(String key) {
+		return params.get(key);
+	}
+	
+	public abstract CdfTree createElements(String source) throws CodeMetropolisException;
+	
+	protected void fireConverterEvent(String message) {
+		for(ConverterEventListener l : listeners) {
+			l.onConverterEvent(new ConverterEvent(message));
+		}
+	}
+	
+	public void addConverterEventListener(ConverterEventListener listener) {
+		listeners.add(listener);
+	}
+	
+	public void removeConverterEventListener(ConverterEventListener listener) {
+		listeners.remove(listener);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/ConverterEvent.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/ConverterEvent.html new file mode 100644 index 00000000..68ece474 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/ConverterEvent.html @@ -0,0 +1 @@ +ConverterEvent

ConverterEvent

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total9 of 90%0 of 0n/a224422
ConverterEvent(String)60%n/a113311
getMessage()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/ConverterEvent.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/ConverterEvent.java.html new file mode 100644 index 00000000..ca6a2013 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/ConverterEvent.java.html @@ -0,0 +1,17 @@ +ConverterEvent.java

ConverterEvent.java

package codemetropolis.toolchain.commons.cdf.converter;
+
+public class ConverterEvent {
+	
+	private String message;
+	
+	public ConverterEvent(String message) {
+		super();
+		this.message = message;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/index.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/index.html new file mode 100644 index 00000000..0170eb55 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cdf.converter

codemetropolis.toolchain.commons.cdf.converter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total46 of 5719%2 of 20%7812166712
CdfConverter371122%20%568124501
ConverterEvent90%n/a22442211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/index.source.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/index.source.html new file mode 100644 index 00000000..daec2671 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cdf.converter

codemetropolis.toolchain.commons.cdf.converter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total46 of 5719%2 of 20%7812166712
CdfConverter.java371122%20%568124501
ConverterEvent.java90%n/a22442211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfReaderException.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfReaderException.html new file mode 100644 index 00000000..66e007d4 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfReaderException.html @@ -0,0 +1 @@ +CdfReaderException

CdfReaderException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
CdfReaderException(String, Throwable, boolean, boolean)70%n/a112211
CdfReaderException(String, Throwable)50%n/a112211
CdfReaderException(String)40%n/a112211
CdfReaderException(Throwable)40%n/a112211
CdfReaderException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfReaderException.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfReaderException.java.html new file mode 100644 index 00000000..e3b6440b --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfReaderException.java.html @@ -0,0 +1,30 @@ +CdfReaderException.java

CdfReaderException.java

package codemetropolis.toolchain.commons.cdf.exceptions;
+
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+
+public class CdfReaderException extends CodeMetropolisException {
+
+	private static final long serialVersionUID = -8880241135777702738L;
+
+	public CdfReaderException() {
+		super();
+	}
+
+	public CdfReaderException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public CdfReaderException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public CdfReaderException(String message) {
+		super(message);
+	}
+
+	public CdfReaderException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfWriterException.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfWriterException.html new file mode 100644 index 00000000..bf289c60 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfWriterException.html @@ -0,0 +1 @@ +CdfWriterException

CdfWriterException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
CdfWriterException(String, Throwable, boolean, boolean)70%n/a112211
CdfWriterException(String, Throwable)50%n/a112211
CdfWriterException(String)40%n/a112211
CdfWriterException(Throwable)40%n/a112211
CdfWriterException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfWriterException.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfWriterException.java.html new file mode 100644 index 00000000..7a6122c1 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/CdfWriterException.java.html @@ -0,0 +1,28 @@ +CdfWriterException.java

CdfWriterException.java

package codemetropolis.toolchain.commons.cdf.exceptions;
+
+public class CdfWriterException extends Exception {
+
+	private static final long serialVersionUID = 5295776370234269200L;
+
+	public CdfWriterException() {
+		super();
+	}
+
+	public CdfWriterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public CdfWriterException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public CdfWriterException(String message) {
+		super(message);
+	}
+
+	public CdfWriterException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/index.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/index.html new file mode 100644 index 00000000..7f2610a4 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cdf.exceptions

codemetropolis.toolchain.commons.cdf.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total46 of 460%0 of 0n/a10102020101022
CdfReaderException230%n/a5510105511
CdfWriterException230%n/a5510105511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/index.source.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/index.source.html new file mode 100644 index 00000000..abaf378c --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.exceptions/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cdf.exceptions

codemetropolis.toolchain.commons.cdf.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total46 of 460%0 of 0n/a10102020101022
CdfReaderException.java230%n/a5510105511
CdfWriterException.java230%n/a5510105511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfElement.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfElement.html new file mode 100644 index 00000000..36cc0fc3 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfElement.html @@ -0,0 +1 @@ +CdfElement

CdfElement

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total189 of 25325%16 of 160%17264259918
toXmlElement(Document)890%40%33161611
getDescendants()450%60%44101011
getProperty(String)210%40%334411
getPropertyValue(String)110%20%223311
setSourceId(String)60%n/a112211
CdfElement()50%n/a112211
setName(String)40%n/a112211
setType(String)40%n/a112211
getSourceId()40%n/a111111
CdfElement(String, String)19100%n/a010601
addProperty(String, String, CdfProperty.Type)11100%n/a010201
getProperties()6100%n/a010101
getChildElements()6100%n/a010101
addChildElement(CdfElement)6100%n/a010201
removeChildElement(CdfElement)6100%n/a010201
getNumberOfChildren()4100%n/a010101
getName()3100%n/a010101
getType()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfElement.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfElement.java.html new file mode 100644 index 00000000..0a4f3dfb --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfElement.java.html @@ -0,0 +1,137 @@ +CdfElement.java

CdfElement.java

package codemetropolis.toolchain.commons.cdf;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import codemetropolis.toolchain.commons.cdf.CdfProperty;
+
+public class CdfElement {
+
+	private static final String SOURCE_ID_KEY = "source_id";
+	
+	private String name;
+	private String type;
+	private List<CdfProperty> properties;
+	private List<CdfElement> childElements;
+	
+	public CdfElement() {
+		this(null, null);
+	}
+	
+	public CdfElement(String name, String type) {
+		this.name = name;
+		this.type = type;
+		properties = new ArrayList<>();
+		childElements = new ArrayList<>();
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	public String getType() {
+		return type;
+	}
+	
+	public void setType(String type) {
+		this.type = type;
+	}
+	
+	public List<CdfProperty> getProperties() {
+		return new ArrayList<>(properties);
+	}
+	
+	public String getPropertyValue(String name){
+		CdfProperty property = getProperty(name);
+		if(property == null) return null;
+		return property.getValue();
+	}
+	
+	public CdfProperty getProperty(String name){
+		for(CdfProperty property : properties) {
+			if(name.equals(property.getName()))
+			{
+				return property;
+			}
+		}
+		return null;
+	}
+	
+	public void addProperty(String name, String value, CdfProperty.Type type) {
+		properties.add(new CdfProperty(name, value, type));
+	}
+	
+	public String getSourceId() {
+		return getPropertyValue(SOURCE_ID_KEY);
+	}
+	
+	public void setSourceId(String id) {
+		addProperty(SOURCE_ID_KEY, id, CdfProperty.Type.STRING);
+	}
+	
+	public List<CdfElement> getChildElements() {
+		return new ArrayList<>(childElements);
+	}
+	
+	public void addChildElement(CdfElement child) {
+		childElements.add(child);
+	}
+	
+	public void removeChildElement(CdfElement child) {
+		childElements.remove(child);
+	}
+
+	public int getNumberOfChildren() {
+		return childElements.size();
+	}
+	
+	public List<CdfElement> getDescendants() {
+
+		List<CdfElement> result = new ArrayList<CdfElement>();
+		Stack<CdfElement> temp = new Stack<CdfElement>();
+		temp.push(this);
+		while(!temp.isEmpty()) {
+			CdfElement current = temp.pop();
+			if(current.getNumberOfChildren() > 0) {
+				for(CdfElement child : current.getChildElements()) {
+					result.add(child);
+					temp.push(child);
+				}
+			}
+		}
+		return result;
+	}
+	
+	public Element toXmlElement(Document doc) {
+		Element element = doc.createElement("element");
+		element.setAttribute("name", name);
+		element.setAttribute("type", type.toString().toLowerCase());		
+		Element children = doc.createElement("children");
+		element.appendChild(children);
+		for(CdfElement c : this.childElements) {
+			children.appendChild(c.toXmlElement(doc));
+		}
+		
+		Element propertiesElement = doc.createElement("properties");
+		element.appendChild(propertiesElement);		
+		for(CdfProperty prop : this.properties) {
+			Element attr = doc.createElement("property");
+			attr.setAttribute("type", prop.getType().name().toLowerCase());
+			attr.setAttribute("name", prop.getName());
+			attr.setAttribute("value", prop.getValue());
+			propertiesElement.appendChild(attr);
+		}
+		
+		return element;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty$Type.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty$Type.html new file mode 100644 index 00000000..a7a9d933 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty$Type.html @@ -0,0 +1 @@ +CdfProperty.Type

CdfProperty.Type

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total21 of 6065%0 of 0n/a241524
values()160%n/a111111
valueOf(String)50%n/a111111
static {...}34100%n/a010401
CdfProperty.Type(String, int)5100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty.html new file mode 100644 index 00000000..2653a56a --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty.html @@ -0,0 +1 @@ +CdfProperty

CdfProperty

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total12 of 3363%0 of 0n/a3761437
setName(String)40%n/a112211
setValue(String)40%n/a112211
setType(CdfProperty.Type)40%n/a112211
CdfProperty(String, String, CdfProperty.Type)12100%n/a010501
getName()3100%n/a010101
getValue()3100%n/a010101
getType()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty.java.html new file mode 100644 index 00000000..09b3f866 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty.java.html @@ -0,0 +1,45 @@ +CdfProperty.java

CdfProperty.java

package codemetropolis.toolchain.commons.cdf;
+
+public class CdfProperty {
+
+	private String name;
+	private String value;
+	private Type type;
+	
+	public CdfProperty(String name, String value, Type type) {
+		this.name = name;
+		this.value = value;
+		this.type = type;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	public String getValue() {
+		return value;
+	}
+	
+	public void setValue(String value) {
+		this.value = value;
+	}
+	
+	public Type getType() {
+		return type;
+	}
+	
+	public void setType(Type type) {
+		this.type = type;
+	}
+	
+	public enum Type {
+		STRING,
+		INT,
+		FLOAT
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree$Iterator.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree$Iterator.html new file mode 100644 index 00000000..bf36fc3a --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree$Iterator.html @@ -0,0 +1 @@ +CdfTree.Iterator

CdfTree.Iterator

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total52 of 520%2 of 20%55111144
next()210%n/a114411
CdfTree.Iterator(CdfTree)200%n/a115511
hasNext()80%20%221111
getIndex()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree.html new file mode 100644 index 00000000..d759623d --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree.html @@ -0,0 +1 @@ +CdfTree

CdfTree

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total81 of 9312%0 of 0n/a47222847
writeToFile(String)550%n/a11151511
getElements()170%n/a114411
iterator()50%n/a111111
setRoot(CdfElement)40%n/a112211
CdfTree(CdfElement)6100%n/a010301
CdfTree()3100%n/a010201
getRoot()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree.java.html new file mode 100644 index 00000000..185751f6 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree.java.html @@ -0,0 +1,97 @@ +CdfTree.java

CdfTree.java

package codemetropolis.toolchain.commons.cdf;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Document;
+
+import codemetropolis.toolchain.commons.cdf.exceptions.CdfWriterException;
+import codemetropolis.toolchain.commons.util.FileUtils;
+
+public class CdfTree {
+	
+	public class Iterator {
+
+		private List<CdfElement> temp = new ArrayList<CdfElement>();
+		private int index = 0;
+		
+		Iterator() {
+			temp.add(root);
+		}
+		
+		public int getIndex() {
+			return index;
+		}
+		
+		public boolean hasNext() {
+			return !temp.isEmpty();
+		}
+
+		public CdfElement next() {
+			CdfElement next = temp.remove(0);
+			temp.addAll(0, next.getChildElements());
+			++index;
+			return next;
+		}
+		
+	}
+	
+	private CdfElement root;
+	
+	public CdfTree(CdfElement root) {
+		this.root = root;
+	}
+	
+	public CdfTree() {
+	}
+	
+	public CdfElement getRoot() {
+		return root;
+	}
+	
+	public void setRoot(CdfElement root) {
+		this.root = root;
+	}
+
+	public Iterator iterator() {
+		return new Iterator();
+	}
+	
+	public List<CdfElement> getElements() {
+		List<CdfElement> buildables = new ArrayList<>();
+		buildables.add(root);
+		buildables.addAll(root.getDescendants());
+		return buildables;
+	}
+
+	public void writeToFile(String filename) throws CdfWriterException{	
+		try {
+			FileUtils.createContainingDirs(filename);
+			DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+			DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
+			Document doc = docBuilder.newDocument();
+			
+			doc.appendChild(root.toXmlElement(doc));			
+			
+			TransformerFactory transformerFactory = TransformerFactory.newInstance();
+			Transformer transformer = transformerFactory.newTransformer();
+			DOMSource source = new DOMSource(doc);
+			StreamResult result = new StreamResult(new File(filename));
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+			transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
+			transformer.transform(source, result);
+		} catch (Exception e) {
+			throw new CdfWriterException(e);
+		}
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/index.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/index.html new file mode 100644 index 00000000..5aa1e3a6 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cdf

codemetropolis.toolchain.commons.cdf

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total355 of 49127%18 of 180%314982117224015
CdfElement1896425%160%1726425991801
CdfTree811212%n/a4722284701
CdfTree.Iterator520%20%5511114411
CdfProperty.Type213965%n/a24152401
CdfProperty122163%n/a376143701
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/index.source.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/index.source.html new file mode 100644 index 00000000..cecde5fa --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cdf

codemetropolis.toolchain.commons.cdf

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total355 of 49127%18 of 180%314982117224015
CdfElement.java1896425%160%1726425991801
CdfTree.java133128%20%912333981112
CdfProperty.java336064%n/a51171951102
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDepthComparator.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDepthComparator.html new file mode 100644 index 00000000..27b41c27 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDepthComparator.html @@ -0,0 +1 @@ +BuildableDepthComparator

BuildableDepthComparator

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total9 of 90%0 of 0n/a222222
compare(Buildable, Buildable)60%n/a111111
BuildableDepthComparator()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDepthComparator.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDepthComparator.java.html new file mode 100644 index 00000000..08d6c606 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDepthComparator.java.html @@ -0,0 +1,15 @@ +BuildableDepthComparator.java

BuildableDepthComparator.java

package codemetropolis.toolchain.commons.cmxml.comparators;
+
+import java.util.Comparator;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+
+public class BuildableDepthComparator implements Comparator<Buildable> {
+
+	@Override
+	public int compare(Buildable b1, Buildable b2) {
+		return b1.getSizeZ() - b2.getSizeZ();
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDescendantLevelComparator.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDescendantLevelComparator.html new file mode 100644 index 00000000..541dab6c --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDescendantLevelComparator.html @@ -0,0 +1 @@ +BuildableDescendantLevelComparator

BuildableDescendantLevelComparator

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total9 of 90%0 of 0n/a222222
compare(Buildable, Buildable)60%n/a111111
BuildableDescendantLevelComparator()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDescendantLevelComparator.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDescendantLevelComparator.java.html new file mode 100644 index 00000000..12362fd6 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableDescendantLevelComparator.java.html @@ -0,0 +1,15 @@ +BuildableDescendantLevelComparator.java

BuildableDescendantLevelComparator.java

package codemetropolis.toolchain.commons.cmxml.comparators;
+
+import java.util.Comparator;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+
+public class BuildableDescendantLevelComparator implements Comparator<Buildable> {
+
+	@Override
+	public int compare(Buildable b1, Buildable b2) {
+		return b1.getDescendantLevel() - b2.getDescendantLevel();
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableSizeComparator.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableSizeComparator.html new file mode 100644 index 00000000..b6de336e --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableSizeComparator.html @@ -0,0 +1 @@ +BuildableSizeComparator

BuildableSizeComparator

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total19 of 190%2 of 20%333322
compare(Buildable, Buildable)160%20%222211
BuildableSizeComparator()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableSizeComparator.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableSizeComparator.java.html new file mode 100644 index 00000000..f5fcb102 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableSizeComparator.java.html @@ -0,0 +1,16 @@ +BuildableSizeComparator.java

BuildableSizeComparator.java

package codemetropolis.toolchain.commons.cmxml.comparators;
+
+import java.util.Comparator;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+
+public class BuildableSizeComparator implements Comparator<Buildable> {
+
+	@Override
+	public int compare(Buildable b1, Buildable b2) {
+		int result = b1.getSizeX() - b2.getSizeX();
+		return result == 0 ? b1.getSizeZ() - b2.getSizeZ() : result;
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableWidthComparator.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableWidthComparator.html new file mode 100644 index 00000000..76502210 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableWidthComparator.html @@ -0,0 +1 @@ +BuildableWidthComparator

BuildableWidthComparator

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total9 of 90%0 of 0n/a222222
compare(Buildable, Buildable)60%n/a111111
BuildableWidthComparator()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableWidthComparator.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableWidthComparator.java.html new file mode 100644 index 00000000..f4c14c2d --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/BuildableWidthComparator.java.html @@ -0,0 +1,15 @@ +BuildableWidthComparator.java

BuildableWidthComparator.java

package codemetropolis.toolchain.commons.cmxml.comparators;
+
+import java.util.Comparator;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+
+public class BuildableWidthComparator implements Comparator<Buildable> {
+
+	@Override
+	public int compare(Buildable b1, Buildable b2) {
+		return b1.getSizeX() - b2.getSizeX();
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/index.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/index.html new file mode 100644 index 00000000..0844a36f --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cmxml.comparators

codemetropolis.toolchain.commons.cmxml.comparators

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total46 of 460%2 of 20%99998844
BuildableSizeComparator190%20%33332211
BuildableWidthComparator90%n/a22222211
BuildableDescendantLevelComparator90%n/a22222211
BuildableDepthComparator90%n/a22222211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/index.source.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/index.source.html new file mode 100644 index 00000000..741cfdc7 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.comparators/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cmxml.comparators

codemetropolis.toolchain.commons.cmxml.comparators

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total46 of 460%2 of 20%99998844
BuildableSizeComparator.java190%20%33332211
BuildableDescendantLevelComparator.java90%n/a22222211
BuildableDepthComparator.java90%n/a22222211
BuildableWidthComparator.java90%n/a22222211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlReaderException.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlReaderException.html new file mode 100644 index 00000000..b1ceea86 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlReaderException.html @@ -0,0 +1 @@ +CmxmlReaderException

CmxmlReaderException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
CmxmlReaderException(String, Throwable, boolean, boolean)70%n/a112211
CmxmlReaderException(String, Throwable)50%n/a112211
CmxmlReaderException(String)40%n/a112211
CmxmlReaderException(Throwable)40%n/a112211
CmxmlReaderException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlReaderException.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlReaderException.java.html new file mode 100644 index 00000000..39d91c0c --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlReaderException.java.html @@ -0,0 +1,28 @@ +CmxmlReaderException.java

CmxmlReaderException.java

package codemetropolis.toolchain.commons.cmxml.exceptions;
+
+public class CmxmlReaderException extends Exception {
+
+	private static final long serialVersionUID = -8880241135777702738L;
+
+	public CmxmlReaderException() {
+		super();
+	}
+
+	public CmxmlReaderException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public CmxmlReaderException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public CmxmlReaderException(String message) {
+		super(message);
+	}
+
+	public CmxmlReaderException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlValidationFailedException.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlValidationFailedException.html new file mode 100644 index 00000000..4cee2758 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlValidationFailedException.html @@ -0,0 +1 @@ +CmxmlValidationFailedException

CmxmlValidationFailedException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
CmxmlValidationFailedException(String, Throwable, boolean, boolean)70%n/a112211
CmxmlValidationFailedException(String, Throwable)50%n/a112211
CmxmlValidationFailedException(String)40%n/a112211
CmxmlValidationFailedException(Throwable)40%n/a112211
CmxmlValidationFailedException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlValidationFailedException.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlValidationFailedException.java.html new file mode 100644 index 00000000..51532625 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlValidationFailedException.java.html @@ -0,0 +1,28 @@ +CmxmlValidationFailedException.java

CmxmlValidationFailedException.java

package codemetropolis.toolchain.commons.cmxml.exceptions;
+
+public class CmxmlValidationFailedException extends Exception {
+	
+	private static final long serialVersionUID = -5620457353841489798L;
+
+	public CmxmlValidationFailedException() {
+		super();
+	}
+
+	public CmxmlValidationFailedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public CmxmlValidationFailedException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public CmxmlValidationFailedException(String message) {
+		super(message);
+	}
+
+	public CmxmlValidationFailedException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlWriterException.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlWriterException.html new file mode 100644 index 00000000..7b2e795a --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlWriterException.html @@ -0,0 +1 @@ +CmxmlWriterException

CmxmlWriterException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
CmxmlWriterException(String, Throwable, boolean, boolean)70%n/a112211
CmxmlWriterException(String, Throwable)50%n/a112211
CmxmlWriterException(String)40%n/a112211
CmxmlWriterException(Throwable)40%n/a112211
CmxmlWriterException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlWriterException.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlWriterException.java.html new file mode 100644 index 00000000..018d2d4c --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/CmxmlWriterException.java.html @@ -0,0 +1,28 @@ +CmxmlWriterException.java

CmxmlWriterException.java

package codemetropolis.toolchain.commons.cmxml.exceptions;
+
+public class CmxmlWriterException extends Exception {
+
+	private static final long serialVersionUID = 5295776370234269200L;
+
+	public CmxmlWriterException() {
+		super();
+	}
+
+	public CmxmlWriterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public CmxmlWriterException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public CmxmlWriterException(String message) {
+		super(message);
+	}
+
+	public CmxmlWriterException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/index.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/index.html new file mode 100644 index 00000000..d5f8bad1 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cmxml.exceptions

codemetropolis.toolchain.commons.cmxml.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total69 of 690%0 of 0n/a15153030151533
CmxmlWriterException230%n/a5510105511
CmxmlValidationFailedException230%n/a5510105511
CmxmlReaderException230%n/a5510105511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/index.source.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/index.source.html new file mode 100644 index 00000000..9a464665 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml.exceptions/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cmxml.exceptions

codemetropolis.toolchain.commons.cmxml.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total69 of 690%0 of 0n/a15153030151533
CmxmlValidationFailedException.java230%n/a5510105511
CmxmlWriterException.java230%n/a5510105511
CmxmlReaderException.java230%n/a5510105511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Attribute.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Attribute.html new file mode 100644 index 00000000..a78e5077 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Attribute.html @@ -0,0 +1 @@ +Attribute

Attribute

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total19 of 190%0 of 0n/a448844
Attribute(String, String)90%n/a114411
setValue(String)40%n/a112211
getName()30%n/a111111
getValue()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Attribute.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Attribute.java.html new file mode 100644 index 00000000..8193e636 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Attribute.java.html @@ -0,0 +1,26 @@ +Attribute.java

Attribute.java

package codemetropolis.toolchain.commons.cmxml;
+
+public class Attribute {
+	
+	private String name;
+	private String value;
+		
+	public Attribute(String name, String value) {
+		this.name = name;
+		this.value = value;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public String getValue() {
+		return value;
+	}
+	
+	public void setValue(String value) {
+		this.value = value;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable$Type.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable$Type.html new file mode 100644 index 00000000..e1626012 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable$Type.html @@ -0,0 +1 @@ +Buildable.Type

Buildable.Type

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 80100%0 of 0n/a040704
static {...}54100%n/a010601
values()16100%n/a010101
Buildable.Type(String, int)5100%n/a010101
valueOf(String)5100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable.html new file mode 100644 index 00000000..f5e4f108 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable.html @@ -0,0 +1 @@ +Buildable

Buildable

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total1,126 of 1,2348%110 of 1165%1101192052315361
toString(int, boolean)2000%100%66252511
toXmlElement(Document, boolean)1860%60%44282811
equals(Object)600%200%1111202011
getDescendants()500%60%44101011
isOverlapping(Buildable)360%80%554411
getSiblings()340%60%446611
getFullName(String)320%20%226611
getCenter()310%n/a114411
setPositionXR(int)270%20%224411
setPositionYR(int)270%20%224411
setPositionZR(int)270%20%224411
isOverlapping(int, int, int, int)260%80%554411
isOverlapping(int, int)260%80%554411
getAncestors()250%20%226611
getAttributeValue(String)220%40%334411
addAttributes(Attribute[])220%20%223311
hasAttribute(String)210%40%334411
compareTo(Buildable)210%n/a111111
addChildren(Buildable[])200%20%223311
clearChildren()190%20%224411
getLastChild()160%20%223311
addChildren(Collection)150%20%223311
addAttribute(String, String)120%n/a115511
getFirstChild()120%20%223311
getLastLeftDescendant()110%20%224411
getDescendantLevel()110%20%222211
getAttributes()90%n/a111111
getChildren()90%n/a111111
hashCode()63986%3350%340601
addChild(Buildable)61266%1150%120401
addAttribute(Attribute)60%n/a112211
setPositionX(int)50%n/a112211
setPositionY(int)50%n/a112211
setPositionZ(int)50%n/a112211
setSizeX(int)50%n/a112211
setSizeY(int)50%n/a112211
setSizeZ(int)50%n/a112211
toString()50%n/a111111
toEscapedString()50%n/a111111
getFullName()40%n/a111111
getNumberOfDescendants()40%n/a111111
clearAttributes()40%n/a112211
getNumberOfChildren()40%n/a111111
getNumberOfAttributes()40%n/a111111
setName(String)40%n/a112211
setType(Buildable.Type)40%n/a112211
getPositionX()40%n/a111111
getPositionY()40%n/a111111
getPositionZ()40%n/a111111
getSizeX()40%n/a111111
getSizeY()40%n/a111111
getSizeZ()40%n/a111111
getType()30%n/a111111
getParent()30%n/a111111
getId()30%n/a111111
Buildable(String, String, Buildable.Type, Point, Point)28100%n/a010901
Buildable(String, String, Buildable.Type)12100%n/a010201
isRoot()7100%2100%020101
setCdfNames(String)4100%n/a010201
getName()3100%n/a010101
getCdfNames()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable.java.html new file mode 100644 index 00000000..82a4d760 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable.java.html @@ -0,0 +1,464 @@ +Buildable.java

Buildable.java

package codemetropolis.toolchain.commons.cmxml;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Stack;
+
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class Buildable implements Comparable<Buildable> {
+	
+	public enum Type {
+		GROUND,
+		GARDEN,
+		FLOOR,
+		CELLAR,
+		CONTAINER;
+	}
+	
+	private String id;
+	private String name;
+	private Type type;
+	private Point position;
+	private Point size;
+	private List<Attribute> attributes;
+	private List<Buildable> children;
+	private Buildable parent;
+	private String cdfNames;
+	
+	public Buildable(String id, String name, Type type) {
+		this(id, name, type, new Point(), new Point());
+	}
+	
+	public Buildable(String id, String name, Type type, Point position, Point size) {
+		this.id = id;
+		this.name = name;
+		this.type = type;
+		this.position = position;
+		this.size = size;
+		this.attributes = new ArrayList<Attribute>();
+		this.children = new ArrayList<Buildable>();
+	}
+	
+	public boolean isOverlapping(Buildable b) {
+		return 	b.getPositionX() < this.getPositionX() + this.getSizeX() &&
+				b.getPositionX() + b.getSizeX() > this.getPositionX() &&
+				b.getPositionZ() < this.getPositionZ() + this.getSizeZ() &&
+				b.getPositionZ() + b.getSizeZ() > this.getPositionZ();
+	}
+	
+	public boolean isOverlapping(int x1, int z1, int x2, int z2) {
+		return	x1 < this.getPositionX() + this.getSizeX() &&
+				x2 > this.getPositionX() &&
+				z1 < this.getPositionZ() + this.getSizeZ() &&
+				z2 > this.getPositionZ();
+	}
+	
+	public boolean isOverlapping(int x, int z) {
+		return	x <= this.getPositionX() + this.getSizeX() &&
+				x >= this.getPositionX() &&
+				z <= this.getPositionZ() + this.getSizeZ() &&
+				z >= this.getPositionZ(); 
+	}
+	
+	public Point getCenter() {
+		return new Point(
+				position.getX() + size.getX() / 2,
+				position.getY() + size.getY() / 2,
+				position.getZ() + size.getZ() / 2
+				);
+	}
+	
+	public String getFullName() {
+		return getFullName(".");
+	}
+	
+	public String getFullName(String separator) {
+		StringBuilder sb = new StringBuilder();
+		Buildable[] ancestors = getAncestors();
+		for(int i = 1; i < ancestors.length; i++)
+			sb.append(ancestors[i].getName()).append(separator);
+		sb.append(getName());
+		return sb.toString();
+	}
+	
+	public boolean hasAttribute(String name) {
+		for(Attribute a : attributes) {
+			if(a.getName().equals(name))
+				return true;
+		}
+		return false;
+	}
+	
+	public String getAttributeValue(String name) {
+		for(Attribute a : attributes) {
+			if(a.getName().equals(name))
+				return a.getValue();
+		}
+		return null;
+	}
+	
+	public Buildable[] getAncestors() {
+		List<Buildable> result = new ArrayList<Buildable>();
+		Buildable temp = this;
+		while(!temp.isRoot()) {
+			result.add(0, temp.getParent());
+			temp = temp.getParent();
+		}
+		return result.toArray(new Buildable[result.size()]);
+	}
+	
+	public List<Buildable> getSiblings() {
+		List<Buildable> result = new ArrayList<Buildable>();
+		if(!isRoot()) {
+			for(Buildable b : parent.getChildren()) {
+				if(b != this) {
+					result.add(b);
+				}
+			}
+		}
+		return result;
+	}
+	
+	public Buildable getLastLeftDescendant() {
+		Buildable b = this;
+		while(b.getFirstChild() != null) {
+			b = b.getFirstChild();
+		}	
+		return b;
+	}
+	
+	public int getNumberOfDescendants() {
+		return getDescendants().size();
+	}
+	
+	public List<Buildable> getDescendants() {
+		List<Buildable> result = new ArrayList<Buildable>();
+		Stack<Buildable> temp = new Stack<Buildable>();
+		temp.push(this);
+		while(!temp.isEmpty()) {
+			Buildable current = temp.pop();
+			if(current.getNumberOfChildren() > 0) {
+				for(Buildable child : current.getChildren()) {
+					result.add(child);
+					temp.push(child);
+				}
+			}
+		}
+		return result;
+	}
+	
+	public int getDescendantLevel() {
+		if(this.isRoot()) return 1;
+		return parent.getDescendantLevel() + 1;
+	}
+	
+	public void addAttribute(Attribute a) {
+		attributes.add(a);
+	}
+	
+	public void addAttribute(String name, String value) {
+		Attribute a = new Attribute(
+				name,
+				value
+				);
+		attributes.add(a);
+	}
+	
+	public void addAttributes(Attribute... attributes) {
+		for(Attribute a : attributes) {
+			this.attributes.add(a);
+		}
+	}
+	
+	public void clearAttributes() {
+		attributes.clear();
+	}
+	
+	public void addChild(Buildable b) {
+		if(!b.isRoot()) b.parent.children.remove(b);
+		children.add(b);
+		b.parent = this;
+	}
+	
+	public void addChildren(Buildable... children) {
+		for(Buildable b : children) {
+			addChild(b);
+		}
+	}
+	
+	public void addChildren(Collection<Buildable> children) {
+		for(Buildable b : children) {
+			addChild(b);
+		}
+	}
+	
+	public void clearChildren() {
+		for(Buildable c : children) {
+			c.parent = null;
+		}
+		children.clear();
+	}
+	
+	public Buildable getFirstChild() {
+		if(!children.isEmpty()) {
+			return children.get(0);
+		}
+		return null;
+	}
+	
+	public Buildable getLastChild() {
+		if(!children.isEmpty()) {
+			return children.get(children.size()-1);
+		}
+		return null;
+	}
+	
+	public int getNumberOfChildren() {
+		return children.size();
+	}
+	
+	public int getNumberOfAttributes() {
+		return attributes.size();
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Type getType() {
+		return type;
+	}
+
+	public void setType(Type type) {
+		this.type = type;
+	}
+	
+	public int getPositionX() {
+		return position.getX();
+	}
+	
+	public int getPositionY() {
+		return position.getY();
+	}
+	
+	public int getPositionZ() {
+		return position.getZ();
+	}
+	
+	public void setPositionX(int x) {
+		position.setX(x);
+	}
+	
+	public void setPositionXR(int x) { //Recursive version: also sets the position of children
+		for(Buildable b : this.getDescendants()) {
+			b.setPositionX(b.getPositionX() - position.getX() + x);
+		}
+		position.setX(x);
+	}
+	
+	public void setPositionY(int y) {
+		position.setY(y);
+	}
+	
+	public void setPositionYR(int y) { //Recursive version: also sets the position of children
+		for(Buildable b : this.getDescendants()) {
+			b.setPositionY(b.getPositionY() - position.getY() + y);
+		}
+		position.setY(y);
+	}
+	
+	public void setPositionZ(int z) {
+		position.setZ(z);
+	}
+	
+	public void setPositionZR(int z) { //Recursive version: also sets the position of children
+		for(Buildable b : this.getDescendants()) {
+			b.setPositionZ(b.getPositionZ() - position.getZ() + z);
+		}
+		position.setZ(z);
+	}
+	
+	public int getSizeX() {
+		return size.getX();
+	}
+	
+	public int getSizeY() {
+		return size.getY();
+	}
+	
+	public int getSizeZ() {
+		return size.getZ();
+	}
+	
+	public void setSizeX(int x) {
+		size.setX(x);
+	}
+	
+	public void setSizeY(int y) {
+		size.setY(y);
+	}
+	
+	public void setSizeZ(int z) {
+		size.setZ(z);
+	}
+
+	public Attribute[] getAttributes() {
+		return attributes.toArray(new Attribute[attributes.size()]);
+	}
+
+	public Buildable[] getChildren() {
+		return children.toArray(new Buildable[children.size()]);
+	}
+
+	public Buildable getParent() {
+		return parent;
+	}
+
+	public boolean isRoot() {
+		return parent == null;
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public String getCdfNames() {
+		return cdfNames;
+	}
+
+	public void setCdfNames(String cdfNames) {
+		this.cdfNames = cdfNames;
+	}
+
+	@Override
+	public int compareTo(Buildable b) {
+		return size.getX() * size.getY() * size.getZ() - b.getSizeX() * b.getSizeY() * b.getSizeZ();
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((id == null) ? 0 : id.hashCode());
+		result = prime * result + ((name == null) ? 0 : name.hashCode());
+		result = prime * result + ((type == null) ? 0 : type.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		Buildable other = (Buildable) obj;
+		if (id == null) {
+			if (other.id != null)
+				return false;
+		} else if (!id.equals(other.id))
+			return false;
+		if (name == null) {
+			if (other.name != null)
+				return false;
+		} else if (!name.equals(other.name))
+			return false;
+		if (type != other.type)
+			return false;
+		return true;
+	}
+
+	@Override
+	public String toString() {
+		return toString(0, false);
+	}
+	
+	public String toEscapedString() {
+		return toString(0, true);
+	}
+	
+	String toString(int indent, boolean escape) {
+		String id = this.id;
+		String name = this.name;
+		if(escape) {
+			id = StringEscapeUtils.escapeXml10(id);
+			name = StringEscapeUtils.escapeXml10(name);
+		}
+		
+		StringBuilder indentSb = new StringBuilder();
+		for(int i = 0; i < indent; i++)
+			indentSb.append("\t");
+		
+		StringBuilder sb = new StringBuilder();
+		sb.append(
+				indentSb + "<buildable id=\"" + id + "\" name=\"" + name + "\" type=\"" + type.toString().toLowerCase() + "\">\n"
+				+ indentSb + "\t<position x=\"" + position.getX() + "\" y=\"" + position.getY() + "\" z=\"" + position.getZ() + "\"/>\n"
+				+ indentSb + "\t<size x=\"" + size.getX() + "\" y=\"" + size.getY() + "\" z=\"" + size.getZ() + "\"/>\n"
+				+ indentSb + "\t<attributes>\n"
+				);
+		for(Attribute a : attributes) {
+			sb.append(indentSb + "\t\t<attribute name=\"" + a.getName() + "\" value=\"" + (escape ? StringEscapeUtils.escapeXml10(a.getValue()) : a.getValue()) + "\"/>\n");
+		}
+		sb.append(
+				indentSb + "\t</attributes>\n"
+				+ indentSb + "\t<children>\n");
+		for(Buildable c : children) {
+			sb.append(c.toString(indent + 2, escape));
+		}
+		sb.append(
+				indentSb + "\t</children>\n"
+				+ indentSb + "</buildable>\n"
+				);
+		return sb.toString();
+	}
+	
+	public Element toXmlElement(Document doc, boolean recursive) {
+		Element buildable = doc.createElement("buildable");
+		buildable.setAttribute("id", id);
+		buildable.setAttribute("name", name);
+		buildable.setAttribute("type", type.toString().toLowerCase());
+		buildable.setIdAttribute("id", true);
+		
+		Element position = doc.createElement("position");
+		position.setAttribute("x", "" + this.position.getX());
+		position.setAttribute("y", "" + this.position.getY());
+		position.setAttribute("z", "" + this.position.getZ());
+		buildable.appendChild(position);
+		
+		Element size = doc.createElement("size");
+		size.setAttribute("x", "" + this.size.getX());
+		size.setAttribute("y", "" + this.size.getY());
+		size.setAttribute("z", "" + this.size.getZ());
+		buildable.appendChild(size);
+		
+		Element attributes = doc.createElement("attributes");
+		buildable.appendChild(attributes);
+		
+		for(Attribute a : this.attributes) {
+			Element attr = doc.createElement("attribute");
+			attr.setAttribute("name", "" + a.getName());
+			attr.setAttribute("value", "" + a.getValue());
+			attributes.appendChild(attr);
+		}
+
+		Element children = doc.createElement("children");
+		buildable.appendChild(children);
+		if(recursive)
+			for(Buildable c : this.children) {
+				children.appendChild(c.toXmlElement(doc, true));
+			}
+		
+		return buildable;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree$Iterator.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree$Iterator.html new file mode 100644 index 00000000..4f406ef7 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree$Iterator.html @@ -0,0 +1 @@ +BuildableTree.Iterator

BuildableTree.Iterator

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total53 of 530%2 of 20%55111144
next()220%n/a114411
BuildableTree.Iterator(BuildableTree)200%n/a115511
hasNext()80%20%221111
getIndex()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree.html new file mode 100644 index 00000000..200a78b0 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree.html @@ -0,0 +1 @@ +BuildableTree

BuildableTree

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total555 of 5550%50 of 500%41411221221414
loadFromFile(String)2630%320%1919555511
writeToFile(String, String, String, String, boolean)1310%80%55343411
getBuildableFromDescendants(Buildable, String)360%60%444411
findBuildables(int, int)300%40%337711
toEscapedString(String, String, String)280%n/a114411
getBuildables()170%n/a114411
toString()140%n/a113311
writeToFile(String, String, String, String)80%n/a112211
BuildableTree(Buildable)60%n/a113311
getBuildable(String)60%n/a111111
iterator()50%n/a111111
BuildableTree()40%n/a112211
size()40%n/a111111
getRoot()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree.java.html new file mode 100644 index 00000000..96c86c04 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/BuildableTree.java.html @@ -0,0 +1,254 @@ +BuildableTree.java

BuildableTree.java

package codemetropolis.toolchain.commons.cmxml;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable.Type;
+import codemetropolis.toolchain.commons.cmxml.exceptions.CmxmlReaderException;
+import codemetropolis.toolchain.commons.cmxml.exceptions.CmxmlWriterException;
+import codemetropolis.toolchain.commons.util.FileUtils;
+import codemetropolis.toolchain.commons.util.Resources;
+
+public class BuildableTree {
+	
+	public class Iterator {
+
+		private List<Buildable> temp = new ArrayList<Buildable>();
+		private int index = 0;
+		
+		Iterator() {
+			temp.add(root);
+		}
+		
+		public int getIndex() {
+			return index;
+		}
+		
+		public boolean hasNext() {
+			return !temp.isEmpty();
+		}
+
+		public Buildable next() {
+			Buildable next = temp.remove(0);
+			temp.addAll(0, Arrays.asList(next.getChildren()));
+			++index;
+			return next;
+		}
+		
+	}
+	
+	private Buildable root;
+	
+	public BuildableTree() {
+		this(null);
+	}
+	
+	public BuildableTree(Buildable root) {
+		this.root = root;
+	}
+	
+	public Buildable getRoot() {
+		return root;
+	}
+	
+	public Iterator iterator() {
+		return new Iterator();
+	}
+	
+	public int size() {
+		return getBuildables().size();
+	}
+	
+	public List<Buildable> getBuildables() {
+		List<Buildable> buildables = new ArrayList<>();
+		buildables.add(root);
+		buildables.addAll(root.getDescendants());
+		return buildables;
+	}
+	
+	public Buildable getBuildable(String id) {
+		return getBuildableFromDescendants(root, id);
+	}
+	
+	private Buildable getBuildableFromDescendants(Buildable b, String id) {
+		if(b.getId().equals(id)) return b;
+		for(Buildable c : b.getChildren())
+			if(getBuildableFromDescendants(c, id) != null) return getBuildableFromDescendants(c, id);
+		return null;
+	}
+	
+	public Buildable[] findBuildables(int x, int z) {
+		List<Buildable> result = new ArrayList<Buildable>();
+		Iterator it = iterator();
+		while(it.hasNext()) {
+			Buildable b = it.next();
+			if(b.isOverlapping(x, z)) {
+				result.add(b);
+			}
+		}
+		return result.toArray(new Buildable[result.size()]);
+	}
+	
+	public void loadFromFile(String path) throws CmxmlReaderException {
+		try {
+			root = null;
+			DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();;
+			DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+			File xmlFile = new File(path);
+			Document doc = dBuilder.parse(xmlFile);
+			doc.getDocumentElement().normalize();
+			NodeList nList = doc.getElementsByTagName("buildable");
+	 
+			for (int temp = 0; temp < nList.getLength(); temp++) {
+				Node nNode = nList.item(temp);
+				if (nNode.getNodeType() == Node.ELEMENT_NODE) {
+				
+					Element eElement = (Element) nNode;
+					
+					Type type = null;
+					switch(eElement.getAttribute("type")) {
+						case "ground": type = Type.GROUND;
+						break;
+						case "garden": type = Type.GARDEN;
+						break;
+						case "floor": type = Type.FLOOR;
+						break;
+						case "cellar": type = Type.CELLAR;
+						break;
+						case "container": type = Type.CONTAINER;
+						break;
+					}
+					
+					Point position;
+					if(eElement.getElementsByTagName("position").item(0) != null && eElement.getElementsByTagName("position").item(0).getParentNode() == nNode) {
+						position = new Point(
+								Integer.parseInt(((Element)eElement.getElementsByTagName("position").item(0)).getAttribute("x")),
+								Integer.parseInt(((Element)eElement.getElementsByTagName("position").item(0)).getAttribute("y")),
+								Integer.parseInt(((Element)eElement.getElementsByTagName("position").item(0)).getAttribute("z"))
+								);
+					} else {
+						position = new Point();
+					}
+			
+					Point size;
+					if(eElement.getElementsByTagName("size").item(0) != null && eElement.getElementsByTagName("size").item(0).getParentNode() == nNode) {
+						size = new Point(
+							Integer.parseInt(((Element)eElement.getElementsByTagName("size").item(0)).getAttribute("x")),
+							Integer.parseInt(((Element)eElement.getElementsByTagName("size").item(0)).getAttribute("y")),
+							Integer.parseInt(((Element)eElement.getElementsByTagName("size").item(0)).getAttribute("z"))
+							);
+					} else {
+						size = new Point();
+					}
+					
+					Buildable b = new Buildable(
+							eElement.getAttribute("id"),
+							eElement.getAttribute("name"),
+							type,
+							position,
+							size
+							);
+					
+					NodeList attributeNodes = eElement.getElementsByTagName("attributes").item(0).getChildNodes();
+					
+					for(int i = 1; attributeNodes.item(i) != null; i += 2) {
+						b.addAttribute(
+								((Element)attributeNodes.item(i)).getAttribute("name"),
+								((Element)attributeNodes.item(i)).getAttribute("value")
+						);
+					}
+					
+					if(!nNode.getParentNode().getNodeName().equals("buildables")) {
+						// Adds current buildable to parent's "children" list 
+						Element parentElement = (Element)nNode.getParentNode().getParentNode();
+						getBuildable(parentElement.getAttribute("id")).addChild(b);
+					} else {
+						root = b;
+					}
+				}
+			}
+		} catch(Exception e) {
+			throw new CmxmlReaderException(e);
+		}
+	}
+	
+	public void writeToFile(String filePath, String from, String to, String version) throws CmxmlWriterException {
+		writeToFile(filePath, from, to, version, true);
+	}
+	
+	public void writeToFile(String filePath, String from, String to, String version, boolean recursive) throws CmxmlWriterException  {
+		try {
+			FileUtils.createContainingDirs(filePath);
+			DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+			DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
+			Document doc = docBuilder.newDocument();
+			Element rootElement = doc.createElement("buildables");
+			rootElement.setAttribute("from", from);
+			rootElement.setAttribute("to", to);
+			rootElement.setAttribute("version", version);
+			doc.appendChild(rootElement);
+			
+			if(recursive) {
+				rootElement.appendChild(root.toXmlElement(doc, true));
+			} else {
+				Iterator it = iterator();
+				while(it.hasNext()) {
+					Buildable b = it.next();
+					rootElement.appendChild(b.toXmlElement(doc, false));
+				}
+				
+				Iterator it2 = iterator();
+				while(it2.hasNext()) {
+					Buildable b = it2.next();
+					Buildable parent = b.getParent();
+					if(parent != null) {
+						Element parentElement = doc.getElementById(parent.getId());
+						Element buildableElement = doc.getElementById(b.getId());
+						parentElement.getElementsByTagName("children").item(0).appendChild(buildableElement);
+					}
+				}
+			}
+			
+			TransformerFactory transformerFactory = TransformerFactory.newInstance();
+			Transformer transformer = transformerFactory.newTransformer();
+			DOMSource source = new DOMSource(doc);
+			StreamResult result = new StreamResult(new File(filePath));
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+			transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
+			transformer.transform(source, result);
+		} catch ( Exception e) {
+			throw new CmxmlWriterException(Resources.get("cmxml_writer_error"), e);
+		}
+	}
+	
+	@Override
+	public String toString() {
+		return "<buildables>\n"
+				+ root.toString(1, false)
+				+ "</buildables>";
+	}
+
+	public String toEscapedString(String from, String to, String version) {
+		String str = "<buildables from=\"" + from + "\" to=\"" + to + "\" version=\"" + "1.0" + "\">\n"
+				+ root.toString(1, true)
+				+ "</buildables>";
+		return str;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/CmxmlValidator.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/CmxmlValidator.html new file mode 100644 index 00000000..eb7e2eea --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/CmxmlValidator.html @@ -0,0 +1 @@ +CmxmlValidator

CmxmlValidator

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total26 of 260%0 of 0n/a33101033
static {...}130%n/a115511
validate(String)100%n/a114411
CmxmlValidator()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/CmxmlValidator.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/CmxmlValidator.java.html new file mode 100644 index 00000000..14d7124a --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/CmxmlValidator.java.html @@ -0,0 +1,33 @@ +CmxmlValidator.java

CmxmlValidator.java

package codemetropolis.toolchain.commons.cmxml;
+
+import java.io.IOException;
+
+import codemetropolis.toolchain.commons.exceptions.InvalidSchemeException;
+import codemetropolis.toolchain.commons.exceptions.SchemeNotSetException;
+import codemetropolis.toolchain.commons.util.XmlValidator;
+
+public class CmxmlValidator {
+	
+	private static final String SCHEME_PATH = "cmxml_scheme.xsd";
+	private static XmlValidator xmlValidator;
+	
+	static {
+		xmlValidator = new XmlValidator();
+		try {
+			xmlValidator.setScheme(SCHEME_PATH);
+		} catch (InvalidSchemeException e) {
+			System.err.println("CMXML validator initialization failed.");
+		}
+	}
+	
+	public static boolean validate(String xmlPath) throws IOException {
+		try {
+			return xmlValidator.validate(xmlPath);
+		} catch(SchemeNotSetException e) {
+			System.err.println("CMXML validation failed.");
+			return false;
+		}
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Point.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Point.html new file mode 100644 index 00000000..dd2a6770 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Point.html @@ -0,0 +1 @@ +Point

Point

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total58 of 614%0 of 0n/a9102021910
translate(Point)190%n/a114411
Point(int, int, int)120%n/a115511
Point(int, int)60%n/a112211
setX(int)40%n/a112211
setY(int)40%n/a112211
setZ(int)40%n/a112211
getX()30%n/a111111
getY()30%n/a111111
getZ()30%n/a111111
Point()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Point.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Point.java.html new file mode 100644 index 00000000..a36b64c3 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Point.java.html @@ -0,0 +1,53 @@ +Point.java

Point.java

package codemetropolis.toolchain.commons.cmxml;
+
+public class Point {
+	
+	private int x;
+	private int y;
+	private int z;
+	
+	public Point() {}
+	
+	public Point(int x, int z) {
+		this(x, 0, z);
+	}
+	
+	public Point(int x, int y, int z) {
+		this.x = x;
+		this.y = y;
+		this.z = z;
+	}
+	
+	public Point translate(Point offset) {
+		return new Point(
+			x + offset.getX(),
+			y + offset.getY(),
+			z + offset.getZ());
+	}
+	
+	public int getX() {
+		return x;
+	}
+	
+	protected void setX(int x) {
+		this.x = x;
+	}
+	
+	public int getY() {
+		return y;
+	}
+	
+	protected void setY(int y) {
+		this.y = y;
+	}
+	
+	public int getZ() {
+		return z;
+	}
+	
+	protected void setZ(int z) {
+		this.z = z;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/index.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/index.html new file mode 100644 index 00000000..37656ca2 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cmxml

codemetropolis.toolchain.commons.cmxml

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,837 of 2,0289%162 of 1683%1721863764108710047
Buildable1,1261088%11065%110119205231536101
BuildableTree5550%500%4141122122141411
Point584%n/a910202191001
BuildableTree.Iterator530%20%5511114411
CmxmlValidator260%n/a3310103311
Attribute190%n/a44884411
Buildable.Type80100%n/a04070401
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/index.source.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/index.source.html new file mode 100644 index 00000000..989b2a9f --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.cmxml

codemetropolis.toolchain.commons.cmxml

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,837 of 2,0289%162 of 1683%1721863764108710047
Buildable.java1,12618814%11065%110123205238536502
BuildableTree.java6080%520%4646133133181822
Point.java584%n/a910202191001
CmxmlValidator.java260%n/a3310103311
Attribute.java190%n/a44884411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/CodeMetropolisException.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/CodeMetropolisException.html new file mode 100644 index 00000000..0e649176 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/CodeMetropolisException.html @@ -0,0 +1 @@ +CodeMetropolisException

CodeMetropolisException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total19 of 2317%0 of 0n/a4581045
CodeMetropolisException(String, Throwable, boolean, boolean)70%n/a112211
CodeMetropolisException(String, Throwable)50%n/a112211
CodeMetropolisException(Throwable)40%n/a112211
CodeMetropolisException()30%n/a112211
CodeMetropolisException(String)4100%n/a010201
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/CodeMetropolisException.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/CodeMetropolisException.java.html new file mode 100644 index 00000000..52bad2e3 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/CodeMetropolisException.java.html @@ -0,0 +1,28 @@ +CodeMetropolisException.java

CodeMetropolisException.java

package codemetropolis.toolchain.commons.exceptions;
+
+public class CodeMetropolisException extends Exception {
+
+	private static final long serialVersionUID = -7985709871539500625L;
+
+	public CodeMetropolisException() {
+		super();
+	}
+
+	public CodeMetropolisException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public CodeMetropolisException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public CodeMetropolisException(String message) {
+		super(message);
+	}
+
+	public CodeMetropolisException(Throwable cause) {
+		super(cause);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/InvalidSchemeException.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/InvalidSchemeException.html new file mode 100644 index 00000000..d0bb866a --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/InvalidSchemeException.html @@ -0,0 +1 @@ +InvalidSchemeException

InvalidSchemeException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
InvalidSchemeException(String, Throwable, boolean, boolean)70%n/a112211
InvalidSchemeException(String, Throwable)50%n/a112211
InvalidSchemeException(String)40%n/a112211
InvalidSchemeException(Throwable)40%n/a112211
InvalidSchemeException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/InvalidSchemeException.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/InvalidSchemeException.java.html new file mode 100644 index 00000000..f2c7f82d --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/InvalidSchemeException.java.html @@ -0,0 +1,28 @@ +InvalidSchemeException.java

InvalidSchemeException.java

package codemetropolis.toolchain.commons.exceptions;
+
+public class InvalidSchemeException extends Exception {
+
+	private static final long serialVersionUID = -2900728001816624441L;
+
+	public InvalidSchemeException() {
+		super();
+	}
+
+	public InvalidSchemeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public InvalidSchemeException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public InvalidSchemeException(String message) {
+		super(message);
+	}
+
+	public InvalidSchemeException(Throwable cause) {
+		super(cause);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/SchemeNotSetException.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/SchemeNotSetException.html new file mode 100644 index 00000000..2239a2c9 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/SchemeNotSetException.html @@ -0,0 +1 @@ +SchemeNotSetException

SchemeNotSetException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
SchemeNotSetException(String, Throwable, boolean, boolean)70%n/a112211
SchemeNotSetException(String, Throwable)50%n/a112211
SchemeNotSetException(String)40%n/a112211
SchemeNotSetException(Throwable)40%n/a112211
SchemeNotSetException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/SchemeNotSetException.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/SchemeNotSetException.java.html new file mode 100644 index 00000000..8d84a4b6 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/SchemeNotSetException.java.html @@ -0,0 +1,28 @@ +SchemeNotSetException.java

SchemeNotSetException.java

package codemetropolis.toolchain.commons.exceptions;
+
+public class SchemeNotSetException extends Exception {
+
+	private static final long serialVersionUID = 4423340810837013461L;
+
+	public SchemeNotSetException() {
+		super();
+	}
+
+	public SchemeNotSetException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public SchemeNotSetException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public SchemeNotSetException(String message) {
+		super(message);
+	}
+
+	public SchemeNotSetException(Throwable cause) {
+		super(cause);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/index.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/index.html new file mode 100644 index 00000000..94ebf66c --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.exceptions

codemetropolis.toolchain.commons.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total65 of 695%0 of 0n/a14152830141523
SchemeNotSetException230%n/a5510105511
InvalidSchemeException230%n/a5510105511
CodeMetropolisException19417%n/a458104501
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/index.source.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/index.source.html new file mode 100644 index 00000000..4fe5a965 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.exceptions

codemetropolis.toolchain.commons.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total65 of 695%0 of 0n/a14152830141523
InvalidSchemeException.java230%n/a5510105511
SchemeNotSetException.java230%n/a5510105511
CodeMetropolisException.java19417%n/a458104501
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/AbstractExecutor.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/AbstractExecutor.html new file mode 100644 index 00000000..6eaae9f8 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/AbstractExecutor.html @@ -0,0 +1 @@ +AbstractExecutor

AbstractExecutor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total124 of 1240%8 of 80%151531311111
printError(boolean, boolean, Exception, String, Object[])320%40%335511
print(boolean, boolean, String, Object[])310%40%335511
AbstractExecutor()150%n/a115511
printError(Exception, String, Object[])80%n/a112211
printError(boolean, Exception, String, Object[])80%n/a112211
print(String, Object[])70%n/a112211
print(boolean, String, Object[])70%n/a112211
setPrintStream(PrintStream)40%n/a112211
setErrorStream(PrintStream)40%n/a112211
setPrefix(String)40%n/a112211
setErrorPrefix(String)40%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/AbstractExecutor.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/AbstractExecutor.java.html new file mode 100644 index 00000000..858242be --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/AbstractExecutor.java.html @@ -0,0 +1,63 @@ +AbstractExecutor.java

AbstractExecutor.java

package codemetropolis.toolchain.commons.executor;
+
+import java.io.PrintStream;
+
+import codemetropolis.toolchain.commons.util.FileLogger;
+
+public abstract class AbstractExecutor {
+
+	private PrintStream printStream = System.out;
+	private PrintStream errorStream = System.err;
+	private String prefix = "";
+	private String errorPrefix = "";
+	
+	public void setPrintStream(PrintStream printStream) {
+		this.printStream = printStream;
+	}
+	
+	public void setErrorStream(PrintStream errorStream) {
+		this.errorStream = errorStream;
+	}
+	
+	public void setPrefix(String prefix) {
+		this.prefix = prefix;
+	}
+
+	public void setErrorPrefix(String errorPrefix) {
+		this.errorPrefix = errorPrefix;
+	}
+	
+	protected void print(String message, Object... args ) {
+		print(true, true, message, args);
+	}
+	
+	protected void print(boolean log, String message, Object... args ) {
+		print(true, log, message, args);
+	}
+	
+	protected void print(boolean withPrefix, boolean log, String message, Object... args ) {
+		String str = String.format("%s%s\n", withPrefix ? prefix : "", message);
+		String paramStr = String.format(str, args);
+		printStream.print(paramStr);
+		if(log) FileLogger.logInfo(paramStr);
+	}
+	
+	protected void printError(Exception exception, String message, Object... args ) {
+		printError(true, true, exception, message, args);
+	}
+	
+	protected void printError(boolean log, Exception exception, String message, Object... args ) {
+		printError(true, log, exception, message, args);
+	}
+	
+	protected void printError(boolean withPrefix, boolean log, Exception exception, String message, Object... args ) {
+		String str = String.format("%s%s\n", withPrefix ? errorPrefix : "", message);
+		String paramStr = String.format(str, args);
+		errorStream.print(paramStr);
+		if(log) FileLogger.logError(paramStr, exception);
+	}
+	
+	public abstract boolean execute(ExecutorArgs args);
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/ExecutorArgs.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/ExecutorArgs.html new file mode 100644 index 00000000..4f80941e --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/ExecutorArgs.html @@ -0,0 +1 @@ +ExecutorArgs

ExecutorArgs

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total3 of 30%0 of 0n/a111111
ExecutorArgs()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/ExecutorArgs.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/ExecutorArgs.java.html new file mode 100644 index 00000000..36c130a4 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/ExecutorArgs.java.html @@ -0,0 +1,4 @@ +ExecutorArgs.java

ExecutorArgs.java

package codemetropolis.toolchain.commons.executor;
+
+public abstract class ExecutorArgs {}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/index.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/index.html new file mode 100644 index 00000000..be345710 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.executor

codemetropolis.toolchain.commons.executor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total127 of 1270%8 of 80%16163232121222
AbstractExecutor1240%80%15153131111111
ExecutorArgs30%n/a11111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/index.source.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/index.source.html new file mode 100644 index 00000000..31a3166a --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.executor/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.executor

codemetropolis.toolchain.commons.executor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total127 of 1270%8 of 80%16163232121222
AbstractExecutor.java1240%80%15153131111111
ExecutorArgs.java30%n/a11111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileLogger.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileLogger.html new file mode 100644 index 00000000..b156e9d1 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileLogger.html @@ -0,0 +1 @@ +FileLogger

FileLogger

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total58 of 580%6 of 60%88191955
load(String)290%n/a119911
logWarning(String, Exception)90%20%223311
logError(String, Exception)90%20%223311
logInfo(String)80%20%223311
FileLogger()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileLogger.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileLogger.java.html new file mode 100644 index 00000000..7ceb5a19 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileLogger.java.html @@ -0,0 +1,47 @@ +FileLogger.java

FileLogger.java

package codemetropolis.toolchain.commons.util;
+
+import java.io.IOException;
+import java.util.logging.FileHandler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
+
+public final class FileLogger {
+	
+	private static final String LOGGER_NAME = "CodeMetropolis.Log";
+	
+	private static Logger logger;  
+	private static FileHandler fileHandler;
+	
+	private FileLogger() {}
+	 
+	public static void load(String filePath) {
+		try {
+			logger = Logger.getLogger(LOGGER_NAME);  
+			logger.setLevel(Level.ALL);
+			logger.setUseParentHandlers(false);
+			fileHandler = new FileHandler(filePath, true); 
+			fileHandler.setFormatter(new SimpleFormatter());
+			logger.addHandler(fileHandler);
+		} catch (SecurityException | IOException e) {
+			System.err.println("An exception has occurred while initializing file logger.");
+		}  
+	}
+	
+	public static void logInfo(String message) {
+		if(logger == null) return;
+		logger.log(Level.INFO, message);
+	}
+	
+	public static void logWarning(String message, Exception exception) {
+		if(logger == null) return;
+		logger.log(Level.WARNING, message, exception);
+	}
+	 
+	public static void logError(String message, Exception exception) {
+		if(logger == null) return;
+		logger.log(Level.SEVERE, message, exception);
+	}
+	 
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileUtils.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileUtils.html new file mode 100644 index 00000000..e592eafd --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileUtils.html @@ -0,0 +1 @@ +FileUtils

FileUtils

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total41 of 410%6 of 60%66101033
deleteDirectory(File)260%40%335511
createContainingDirs(String)120%20%224411
FileUtils()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileUtils.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileUtils.java.html new file mode 100644 index 00000000..e2e0033b --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/FileUtils.java.html @@ -0,0 +1,24 @@ +FileUtils.java

FileUtils.java

package codemetropolis.toolchain.commons.util;
+
+import java.io.File;
+
+public class FileUtils {
+	
+	public static void deleteDirectory(File directory) {
+		if(directory.isDirectory()) {
+			for(File f : directory.listFiles()) {
+				deleteDirectory(f);
+			}
+		}
+		directory.delete();
+	}
+	
+	public static void createContainingDirs(String path) {
+		File parent = new File(path).getParentFile();
+		if(parent != null) {
+			parent.mkdirs();
+		}
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Resources.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Resources.html new file mode 100644 index 00000000..dcd69ce5 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Resources.html @@ -0,0 +1 @@ +Resources

Resources

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total3 of 1172%0 of 0n/a131313
Resources()30%n/a111111
static {...}4100%n/a010101
get(String)4100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Resources.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Resources.java.html new file mode 100644 index 00000000..9db4f818 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Resources.java.html @@ -0,0 +1,16 @@ +Resources.java

Resources.java

package codemetropolis.toolchain.commons.util;
+
+import java.util.ResourceBundle;
+
+public final class Resources {
+
+	private static ResourceBundle resourceBundle = ResourceBundle.getBundle("resources");
+	
+	private Resources() {}
+	
+	public static String get(String key) {
+		return resourceBundle.getString(key);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Settings.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Settings.html new file mode 100644 index 00000000..99e45219 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Settings.html @@ -0,0 +1 @@ +Settings

Settings

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total11 of 110%0 of 0n/a333333
static {...}40%n/a111111
get(String)40%n/a111111
Settings()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Settings.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Settings.java.html new file mode 100644 index 00000000..9048ee49 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Settings.java.html @@ -0,0 +1,16 @@ +Settings.java

Settings.java

package codemetropolis.toolchain.commons.util;
+
+import java.util.ResourceBundle;
+
+public final class Settings {
+
+	private static ResourceBundle resourceBundle = ResourceBundle.getBundle("settings");
+	
+	private Settings() {}
+	
+	public static String get(String key) {
+		return resourceBundle.getString(key);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Time.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Time.html new file mode 100644 index 00000000..11be37db --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Time.html @@ -0,0 +1 @@ +Time

Time

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total28 of 280%0 of 0n/a446644
getMinutes()80%n/a111111
getSeconds()80%n/a111111
Time(long)60%n/a113311
getHours()60%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Time.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Time.java.html new file mode 100644 index 00000000..93c2d493 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Time.java.html @@ -0,0 +1,24 @@ +Time.java

Time.java

package codemetropolis.toolchain.commons.util;
+
+public class Time {
+	
+	private long milliseconds;
+	
+	public Time(long milliseconds) {
+		this.milliseconds = milliseconds;
+	}
+	
+	public int getHours() {
+		return (int) (milliseconds / (1000 * 60 * 60));
+	}
+	
+	public int getMinutes() {
+		return (int) ((milliseconds / (1000 * 60)) % 60);
+	}
+	
+	public int getSeconds() {
+		return (int) (milliseconds / 1000) % 60 ;
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/XmlValidator.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/XmlValidator.html new file mode 100644 index 00000000..d182609f --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/XmlValidator.html @@ -0,0 +1 @@ +XmlValidator

XmlValidator

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total68 of 680%2 of 20%55191944
validate(String)320%20%229911
setScheme(String)300%n/a118811
static {...}30%n/a111111
XmlValidator()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/XmlValidator.java.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/XmlValidator.java.html new file mode 100644 index 00000000..a8afdff7 --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/XmlValidator.java.html @@ -0,0 +1,55 @@ +XmlValidator.java

XmlValidator.java

package codemetropolis.toolchain.commons.util;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import codemetropolis.toolchain.commons.exceptions.InvalidSchemeException;
+import codemetropolis.toolchain.commons.exceptions.SchemeNotSetException;
+
+public class XmlValidator {
+	
+	private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
+	private Validator validator;
+	
+	public void setScheme(String schemePath) throws InvalidSchemeException {
+		try {
+			ClassLoader classLoader = getClass().getClassLoader();
+			StreamSource schemaSource = new StreamSource(classLoader.getResourceAsStream(schemePath));
+			SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+			Schema schema = factory.newSchema(schemaSource);
+			validator = schema.newValidator();
+		} catch (SAXException e) {
+			throw new InvalidSchemeException(e);
+		}
+	}
+	
+	public boolean validate(String xmlPath) throws IOException, SchemeNotSetException {
+		if(validator == null) {
+			throw new SchemeNotSetException();
+		}
+		try {
+			File xmlFile = new File(xmlPath);
+			DocumentBuilder documentBuilder = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder();
+			Document doc = documentBuilder.parse(xmlFile);
+			validator.validate(new DOMSource(doc));
+		} catch (ParserConfigurationException | SAXException e1) {
+			return false;
+		}
+	    return true;
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/index.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/index.html new file mode 100644 index 00000000..64adbecc --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.util

codemetropolis.toolchain.commons.util

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total209 of 2173%14 of 140%27295860202256
XmlValidator680%20%5519194411
FileLogger580%60%8819195511
FileUtils410%60%6610103311
Time280%n/a44664411
Settings110%n/a33333311
Resources3872%n/a13131301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/index.source.html b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/index.source.html new file mode 100644 index 00000000..a3fe88cb --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.commons.util

codemetropolis.toolchain.commons.util

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total209 of 2173%14 of 140%27295860202256
XmlValidator.java680%20%5519194411
FileLogger.java580%60%8819195511
FileUtils.java410%60%6610103311
Time.java280%n/a44664411
Settings.java110%n/a33333311
Resources.java3872%n/a13131301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_java/index.html b/doc/codemetropolis-toolchain-commons/src_main_java/index.html new file mode 100644 index 00000000..be56666e --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_java/index.html @@ -0,0 +1 @@ +src/main/java

src/main/java

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total2,800 of 3,15011%206 of 2122%3013376477241942292434
codemetropolis.toolchain.commons.cmxml1,8371919%16263%1721863764108710047
codemetropolis.toolchain.commons.cdf35513627%180%314982117224015
codemetropolis.toolchain.commons.util2093%140%27295860202256
codemetropolis.toolchain.commons.executor1270%80%16163232121222
codemetropolis.toolchain.commons.cmxml.exceptions690%n/a15153030151533
codemetropolis.toolchain.commons.exceptions655%n/a14152830141523
codemetropolis.toolchain.commons.cdf.converter4619%20%7812166712
codemetropolis.toolchain.commons.cdf.exceptions460%n/a10102020101022
codemetropolis.toolchain.commons.cmxml.comparators460%20%99998844
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-commons/src_main_resources/index.html b/doc/codemetropolis-toolchain-commons/src_main_resources/index.html new file mode 100644 index 00000000..6b51781c --- /dev/null +++ b/doc/codemetropolis-toolchain-commons/src_main_resources/index.html @@ -0,0 +1 @@ +src/main/resources

src/main/resources

ElementMissed InstructionsCov.Missed BranchesCov.
Total0 of 0n/a0 of 0n/a
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/index.html b/doc/codemetropolis-toolchain-converter/index.html new file mode 100644 index 00000000..574166c9 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/index.html @@ -0,0 +1 @@ +codemetropolis-toolchain-converter

codemetropolis-toolchain-converter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total2,538 of 4,64245%221 of 28522%2293215611,0131031741630
src/main/java2,5382,10445%2216422%2293215611,0131031741630
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/BrowsingHistoryConverterTests.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/BrowsingHistoryConverterTests.html new file mode 100644 index 00000000..873cc4cf --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/BrowsingHistoryConverterTests.html @@ -0,0 +1 @@ +BrowsingHistoryConverterTests

BrowsingHistoryConverterTests

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total12 of 24795%0 of 0n/a013372013
testReadFileWithIncorrectFile()6857%n/a011601
testCreateDocumentFromXmlFileWithCorrectFile()31684%n/a011701
testCreateElementsShouldNotThrowException()31381%n/a011701
testAddPropertiesWithCorrectResult()36100%n/a010801
testCreateElementsRecursivelyWithCheckChildElements2()31100%n/a010601
testCreateDocumentFromXmlFileWithCorrectFile2()29100%n/a010701
testCreateElementsRecursivelyWithCheckChildElements()26100%n/a010601
BrowsingHistoryConverterTests()18100%n/a010501
testReadFileWithCorrectFile()14100%n/a010401
testTypeFromNodeValueWithCorrectValue()11100%n/a010401
testTypeFromNodeValueWithCorrectValue2()11100%n/a010401
testTypeFromNodeValueWithIncorrectValue()11100%n/a010401
testTypeFromNodeValueWithIncorrectValue2()11100%n/a010401
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/BrowsingHistoryConverterTests.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/BrowsingHistoryConverterTests.java.html new file mode 100644 index 00000000..d4cfa045 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/BrowsingHistoryConverterTests.java.html @@ -0,0 +1,182 @@ +BrowsingHistoryConverterTests.java

BrowsingHistoryConverterTests.java

package codemetropolis.toolchain.converter.browsinghistory.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.junit.Test;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.commons.cdf.CdfProperty;
+import codemetropolis.toolchain.commons.cdf.CdfTree;
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+import codemetropolis.toolchain.converter.browsinghistory.BrowsingHistoryConverter;
+
+import org.w3c.dom.Document;
+
+public class BrowsingHistoryConverterTests {
+	
+	public static final String NODE_VALUE1 = "43";
+	public static final String NODE_VALUE2 = "Text43";
+	public static final String ITEM_NODE = "item";
+	public static final String TEST_INPUT_FILE = "./src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile2.xml";
+	public static final String TEST_INPUT_FILE2 = "./src/main/java/codemetropolis/toolchain/converter/browsinghistory/test/testFile3.txt";
+
+	BrowsingHistoryConverter converter = new BrowsingHistoryConverter(null);
+	
+	
+	DocumentBuilderFactory documentBuilderFactory = null;
+    DocumentBuilder documentBuilder = null;
+    Document document = null;
+	
+	@Test
+	public void testTypeFromNodeValueWithCorrectValue() {
+
+		CdfProperty.Type result = converter.typeFromNodeValue(NODE_VALUE1);
+		CdfProperty.Type expectedType = CdfProperty.Type.INT;
+		assertEquals(result, expectedType);
+		
+	}
+	
+	@Test
+	public void testTypeFromNodeValueWithCorrectValue2() {
+
+		CdfProperty.Type result = converter.typeFromNodeValue(NODE_VALUE2);
+		CdfProperty.Type expectedType = CdfProperty.Type.STRING;
+		assertEquals(result, expectedType);
+		
+	}
+	
+	@Test
+	public void testTypeFromNodeValueWithIncorrectValue() {
+
+		CdfProperty.Type result = converter.typeFromNodeValue(NODE_VALUE1);
+		CdfProperty.Type expectedType = CdfProperty.Type.STRING;
+		assertNotEquals(result, expectedType);
+		
+	}
+	
+	@Test
+	public void testTypeFromNodeValueWithIncorrectValue2() {
+
+		CdfProperty.Type result = converter.typeFromNodeValue(NODE_VALUE2);
+		CdfProperty.Type expectedType = CdfProperty.Type.INT;
+		assertNotEquals(result, expectedType);
+		
+	}
+	
+	@Test
+	public void testAddPropertiesWithCorrectResult() throws Exception {
+		
+		List<CdfProperty> expectedProperties = new ArrayList<CdfProperty>();
+		CdfElement resultElement = new CdfElement(ITEM_NODE, ITEM_NODE);
+
+		documentBuilderFactory = DocumentBuilderFactory.newInstance();
+	    documentBuilder = documentBuilderFactory.newDocumentBuilder();
+		document = documentBuilder.parse(TEST_INPUT_FILE);
+		
+		converter.addProperties(resultElement, document);
+		
+		assertEquals(resultElement.getProperties(), expectedProperties);
+	}
+	
+	@Test
+	public void testCreateElementsRecursivelyWithCheckChildElements() throws Exception {
+
+		documentBuilderFactory = DocumentBuilderFactory.newInstance();
+	    documentBuilder = documentBuilderFactory.newDocumentBuilder();
+		document = documentBuilder.parse(TEST_INPUT_FILE);
+		
+		CdfElement resultElement = converter.createElementsRecursively(document);
+		
+		assertEquals(resultElement.getNumberOfChildren(), 1);
+	}
+	
+	@Test
+	public void testCreateElementsRecursivelyWithCheckChildElements2() throws Exception {
+
+		documentBuilderFactory = DocumentBuilderFactory.newInstance();
+	    documentBuilder = documentBuilderFactory.newDocumentBuilder();
+		document = documentBuilder.parse(TEST_INPUT_FILE);
+		
+		CdfElement resultElement = converter.createElementsRecursively(document);
+		
+		assertEquals(resultElement.getChildElements().get(0).getChildElements().size(), 0);
+	}
+	
+	@Test
+	public void testReadFileWithCorrectFile() throws Exception  {
+		File expectedFile = new File(TEST_INPUT_FILE);
+		File resultFile = converter.readFile(TEST_INPUT_FILE);
+		
+		assertEquals(resultFile, expectedFile);
+	}
+	
+	@Test
+	public void testReadFileWithIncorrectFile() throws Exception  {
+		
+		boolean isThrown = false;
+		
+		try {
+			File resultFile = converter.readFile(TEST_INPUT_FILE2);
+		}catch(Exception e) {
+			isThrown = true;
+		}
+		
+		assertTrue(isThrown);
+	}
+	
+	
+	@Test
+	public void testCreateDocumentFromXmlFileWithCorrectFile() {
+
+		boolean isThrown = false;
+		File file = new File(TEST_INPUT_FILE);
+		
+		try {
+			converter.createDocumentFromXmlFile(file);
+		}catch(Exception e) {
+			isThrown = true;
+		}
+		
+		assertFalse(isThrown);
+	}
+	
+	@Test
+	public void testCreateDocumentFromXmlFileWithCorrectFile2() throws Exception {
+
+		File file = converter.readFile(TEST_INPUT_FILE);
+
+		documentBuilderFactory = DocumentBuilderFactory.newInstance();
+	    documentBuilder = documentBuilderFactory.newDocumentBuilder();
+	    document = documentBuilder.parse(TEST_INPUT_FILE);
+	    
+		Document resultDocument = converter.createDocumentFromXmlFile(file);
+		
+		assertNotEquals(document, resultDocument);
+	}
+	
+	@Test
+	public void testCreateElementsShouldNotThrowException() {
+		
+		boolean isThrown = true;
+		
+		try {
+			CdfTree resultTree = converter.createElements(TEST_INPUT_FILE);
+			isThrown = false;
+		}catch(CodeMetropolisException e) {
+			e.printStackTrace();
+		}
+		
+		assertFalse(isThrown);
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/index.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/index.html new file mode 100644 index 00000000..8c1b8273 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.browsinghistory.test

codemetropolis.toolchain.converter.browsinghistory.test

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total12 of 24795%0 of 0n/a01337201301
BrowsingHistoryConverterTests1223595%n/a01337201301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/index.source.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/index.source.html new file mode 100644 index 00000000..b295d48c --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.browsinghistory.test

codemetropolis.toolchain.converter.browsinghistory.test

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total12 of 24795%0 of 0n/a01337201301
BrowsingHistoryConverterTests.java1223595%n/a01337201301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/BrowsingHistoryConverter.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/BrowsingHistoryConverter.html new file mode 100644 index 00000000..043f8f38 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/BrowsingHistoryConverter.html @@ -0,0 +1 @@ +BrowsingHistoryConverter

BrowsingHistoryConverter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total24 of 21588%13 of 4067%132855408
addProperties(CdfElement, Node)123272%9950%9101601
createElements(String)62379%n/a0121001
createDocumentFromXmlFile(File)61773%n/a0121001
createElementsRecursively(Node)78100%41477%41001601
readFile(String)18100%2100%020401
addNameAndTypeOfElement(Node)11100%n/a010301
typeFromNodeValue(String)8100%2100%020301
BrowsingHistoryConverter(Map)4100%n/a010201
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/BrowsingHistoryConverter.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/BrowsingHistoryConverter.java.html new file mode 100644 index 00000000..ceb46e0c --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/BrowsingHistoryConverter.java.html @@ -0,0 +1,160 @@ +BrowsingHistoryConverter.java

BrowsingHistoryConverter.java

package codemetropolis.toolchain.converter.browsinghistory;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.commons.cdf.CdfProperty;
+import codemetropolis.toolchain.commons.cdf.CdfTree;
+import codemetropolis.toolchain.commons.cdf.converter.CdfConverter;
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+
+public class BrowsingHistoryConverter extends CdfConverter {
+	
+	public static final String ROOT_NODE = "chrome_visited_sites";
+	public static final String ITEM_NODE = "item";
+	public static final String URL_NODE = "url";
+	public static final String TITLE_NODE = "title";
+	public static final String VISIT_ID_NODE = "visit_id";
+	public static final String VISIT_COUNT_NODE = "visit_count";
+	public static final String TYPED_COUNT_NODE = "typed_count";
+	public static final String PROFILE_NODE = "profile";
+	public static final String URL_LENGTH_NODE = "url_length";
+	public static final String TRANSITION_TYPE_NODE = "transition_type";
+	public static final String TRANSITION_QUALIFIERS_NODE = "transition_qualifiers";
+	
+	public BrowsingHistoryConverter(Map<String, String> params) {
+		super(params);
+	}
+
+	@Override
+	public CdfTree createElements(String source) throws CodeMetropolisException {
+		
+		File inputXml = null;
+		try {
+			inputXml = readFile(source);
+		} catch (Exception e1) {
+			e1.printStackTrace();
+		}
+		
+		Document document = null;
+		try {
+			document = createDocumentFromXmlFile(inputXml);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		CdfElement rootElement = createElementsRecursively(document);
+
+		return new CdfTree(rootElement);
+	}
+	
+	public CdfElement createElementsRecursively(Node root) {
+		
+		CdfElement cdfElement = addNameAndTypeOfElement(root);
+		
+		if (cdfElement != null) {
+				NodeList children = root.getChildNodes();
+				
+				if(children != null) {
+					for (int c = 0; c < children.getLength(); c++) {
+						
+						if(cdfElement.getName() == ROOT_NODE || cdfElement.getName() == "#document") {
+							
+							cdfElement.addChildElement(createElementsRecursively(children.item(c)));
+							
+						}else if(cdfElement.getName() == ITEM_NODE) {
+							
+							String value = "";
+							
+							for(int k = 0; k < children.getLength(); k++) {
+								
+								if(children.item(k).getFirstChild() != null) {
+									value = children.item(k).getFirstChild().getNodeValue();
+								}
+								
+								if(children.item(k).getNodeName() != "#text") {
+									cdfElement.addProperty(children.item(k).getNodeName(), value, 
+											typeFromNodeValue(value));
+								}
+
+							}
+						}
+					}
+				}
+		}
+		
+		return cdfElement;
+	}
+	
+	public CdfElement addNameAndTypeOfElement(Node root) {
+		
+		String nodeName = root.getNodeName();
+
+		CdfElement cdfElement = new CdfElement(nodeName, nodeName);
+			
+		return cdfElement;
+	}
+	
+	public CdfElement addProperties(CdfElement cdfElement, Node node) {
+		String nodeName = node.getNodeName();
+		
+		if (nodeName == URL_NODE || nodeName == TITLE_NODE || nodeName == VISIT_ID_NODE || nodeName == VISIT_COUNT_NODE ||
+			nodeName == TYPED_COUNT_NODE|| nodeName == PROFILE_NODE || nodeName == URL_LENGTH_NODE || 
+			nodeName == TRANSITION_TYPE_NODE || nodeName == TRANSITION_QUALIFIERS_NODE) {
+			cdfElement.addProperty(node.getNodeName(), node.getFirstChild().getNodeValue(), typeFromNodeValue(node.getFirstChild().getNodeValue()));
+		}
+		return cdfElement;
+	}
+	
+	public CdfProperty.Type typeFromNodeValue(String nodeValue){
+		if(Pattern.matches("\\-?\\d+", (CharSequence) nodeValue)) {
+			return CdfProperty.Type.INT;
+		}else {
+			return CdfProperty.Type.STRING;
+		}
+	}
+	
+	public File readFile(String source) throws Exception {
+		File inputXml = new File(source);
+		
+		if(!inputXml.getName().toLowerCase().endsWith(".xml")) {
+			throw new Exception("The file isn't an xml file.");
+		}
+		
+		return inputXml;
+	}
+	
+	public Document createDocumentFromXmlFile(File inputXml){
+		
+		DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder documentBuilder = null;
+        Document document = null;
+        
+		try {
+			documentBuilder = documentBuilderFactory.newDocumentBuilder();
+		} catch (ParserConfigurationException e) {
+			e.printStackTrace();
+		}
+        try {
+			document = documentBuilder.parse(inputXml);
+		} catch (SAXException | IOException e) {
+			e.printStackTrace();
+		}
+        
+		return document;
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/index.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/index.html new file mode 100644 index 00000000..722f4598 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.browsinghistory

codemetropolis.toolchain.converter.browsinghistory

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total24 of 21588%13 of 4067%13285540801
BrowsingHistoryConverter2419188%132767%13285540801
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/index.source.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/index.source.html new file mode 100644 index 00000000..6f529445 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.browsinghistory

codemetropolis.toolchain.converter.browsinghistory

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total24 of 21588%13 of 4067%13285540801
BrowsingHistoryConverter.java2419188%132767%13285540801
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterLoader.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterLoader.html new file mode 100644 index 00000000..626162e1 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterLoader.html @@ -0,0 +1 @@ +ConverterLoader

ConverterLoader

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total30 of 300%5 of 50%667722
load(ConverterType, Map)270%50%556611
ConverterLoader()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterLoader.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterLoader.java.html new file mode 100644 index 00000000..bddaba13 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterLoader.java.html @@ -0,0 +1,30 @@ +ConverterLoader.java

ConverterLoader.java

package codemetropolis.toolchain.converter.control;
+
+import java.util.Map;
+
+import codemetropolis.toolchain.commons.cdf.converter.CdfConverter;
+import codemetropolis.toolchain.converter.browsinghistory.BrowsingHistoryConverter;
+import codemetropolis.toolchain.converter.sonarqube.SonarQubeConverter;
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+import codemetropolis.toolchain.converter.sourcemeter.GraphConverter;
+
+public class ConverterLoader {
+	
+	private ConverterLoader() {}
+	
+	public static CdfConverter load(ConverterType converterType, Map<String, String> params) {
+		switch(converterType) {
+			case GITINSPECTOR:
+				return new GitInspectorConverter(params);
+			case SOURCEMETER:
+				return new GraphConverter(params);
+			case SONARQUBE:
+				return new SonarQubeConverter(params);
+			case BROWSINGHISTORY:
+				return new BrowsingHistoryConverter(params);
+			default:
+				return null;
+		}
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterType.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterType.html new file mode 100644 index 00000000..4a03ca99 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterType.html @@ -0,0 +1 @@ +ConverterType

ConverterType

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total70 of 700%0 of 0n/a446644
static {...}440%n/a115511
values()160%n/a111111
ConverterType(String, int)50%n/a111111
valueOf(String)50%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterType.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterType.java.html new file mode 100644 index 00000000..f5d31f8f --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/ConverterType.java.html @@ -0,0 +1,9 @@ +ConverterType.java

ConverterType.java

package codemetropolis.toolchain.converter.control;
+
+public enum ConverterType {
+	GITINSPECTOR,
+	SOURCEMETER,
+	SONARQUBE,
+	BROWSINGHISTORY
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/index.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/index.html new file mode 100644 index 00000000..e083f0a4 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.control

codemetropolis.toolchain.converter.control

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total100 of 1000%5 of 50%101013136622
ConverterType700%n/a44664411
ConverterLoader300%50%66772211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/index.source.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/index.source.html new file mode 100644 index 00000000..d7af7db6 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.control/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.control

codemetropolis.toolchain.converter.control

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total100 of 1000%5 of 50%101013136622
ConverterType.java700%n/a44664411
ConverterLoader.java300%50%66772211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateDocumentFromSourceTest.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateDocumentFromSourceTest.html new file mode 100644 index 00000000..b2a031d1 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateDocumentFromSourceTest.html @@ -0,0 +1 @@ +CreateDocumentFromSourceTest

CreateDocumentFromSourceTest

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total24 of 5052%0 of 0n/a0592205
invalidPath()10533%n/a014701
invalidResource()10533%n/a014701
validPath()4866%n/a011501
static {...}5100%n/a010201
CreateDocumentFromSourceTest()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateDocumentFromSourceTest.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateDocumentFromSourceTest.java.html new file mode 100644 index 00000000..4d6c1918 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateDocumentFromSourceTest.java.html @@ -0,0 +1,54 @@ +CreateDocumentFromSourceTest.java

CreateDocumentFromSourceTest.java

package codemetropolis.toolchain.converter.gitinspector.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+
+/**
+ * 
+ * @author Zakor Gyula {@literal <ZAGPAAG.SZE>}
+ *
+ */
+
+public class CreateDocumentFromSourceTest {
+    private static String XML_SRC_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\GitInspectorOutput.xml";
+    private static String INVALID_FORMAT_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\";
+
+    @Test
+    public void invalidPath() {
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        try {
+            conv.createDocumentFromSource("");
+            fail("This test should fail because the resource path is invalid.");
+        } catch (CodeMetropolisException e) {
+        } catch (Exception e) {
+            fail("the wrong type of exception returned.");
+        }
+    }
+
+    @Test
+    public void invalidResource() {
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        try {
+            conv.createDocumentFromSource(INVALID_FORMAT_PATH);
+            fail("This test should fail because the target resource is a library.");
+        } catch (CodeMetropolisException e) {
+        } catch (Exception e) {
+            fail("the wrong type of exception returned.");
+        }
+    }
+
+    @Test
+    public void validPath() {
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        try {
+            conv.createDocumentFromSource(XML_SRC_PATH);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateElementsTest.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateElementsTest.html new file mode 100644 index 00000000..287aba40 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateElementsTest.html @@ -0,0 +1 @@ +CreateElementsTest

CreateElementsTest

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total28 of 18584%0 of 0n/a06105206
invalidPath()10533%n/a014701
invalidResource()10533%n/a014701
testCreateElementsTest()413197%n/a0113001
validPath()4866%n/a011501
static {...}5100%n/a010201
CreateElementsTest()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateElementsTest.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateElementsTest.java.html new file mode 100644 index 00000000..7a327e6f --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateElementsTest.java.html @@ -0,0 +1,104 @@ +CreateElementsTest.java

CreateElementsTest.java

package codemetropolis.toolchain.converter.gitinspector.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.commons.cdf.CdfProperty;
+import codemetropolis.toolchain.commons.cdf.CdfTree;
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+
+/**
+*
+* @author Zakor Gyula {@literal <ZAGPAAG.SZE>}
+*
+*/
+
+public class CreateElementsTest {
+
+    private static String XML_SRC_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\GitInspectorOutput.xml";
+    private static String INVALID_FORMAT_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\";
+
+    @Test
+    public void invalidPath() {
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        try {
+            conv.createElements("");
+            fail("This test should fail because the resource path is invalid.");
+        } catch (CodeMetropolisException e) {
+        } catch (Exception e) {
+            fail("the wrong type of exception returned.");
+        }
+    }
+
+    @Test
+    public void invalidResource() {
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        try {
+            conv.createElements(INVALID_FORMAT_PATH);
+            fail("This test should fail because the target resource is a library.");
+        } catch (CodeMetropolisException e) {
+        } catch (Exception e) {
+            fail("the wrong type of exception returned.");
+        }
+    }
+
+    @Test
+    public void validPath() {
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        try {
+            conv.createElements(XML_SRC_PATH);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testCreateElementsTest() {
+        CdfTree tree = new CdfTree();
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        try {
+            tree = conv.createElements(XML_SRC_PATH);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        CdfElement authorMetrics = new CdfElement("Teszt Bela", "author");
+        CdfElement floorMetrics = new CdfElement("Teszt Bela", "floor-metrics");
+        CdfElement root = new CdfElement("gfx 2018/04/16", "root");
+
+        authorMetrics.addProperty("email", "becike@beciakiraly.eu", CdfProperty.Type.STRING);
+        floorMetrics.addProperty("email", "becike@beciakiraly.eu", CdfProperty.Type.STRING);
+
+        authorMetrics.addProperty("commits", "56", CdfProperty.Type.INT);
+        floorMetrics.addProperty("commits", "56", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("insertions", "67", CdfProperty.Type.INT);
+        floorMetrics.addProperty("insertions", "67", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("deletions", "54", CdfProperty.Type.INT);
+        floorMetrics.addProperty("deletions", "54", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("POC", "57.55", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("POC", "57.55", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addProperty("rows", "61", CdfProperty.Type.INT);
+        floorMetrics.addProperty("rows", "61", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("stability", "83.1", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("stability", "83.1", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addProperty("age", "0.8", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("age", "0.8", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addProperty("PIC", "4.32", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("PIC", "4.32", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addChildElement(floorMetrics);
+        root.addChildElement(authorMetrics);
+
+        assertTrue(TestHelper.equals(root, tree.getRoot()));
+    }
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateRootelemenTest.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateRootelemenTest.html new file mode 100644 index 00000000..26f30225 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateRootelemenTest.html @@ -0,0 +1 @@ +CreateRootelemenTest

CreateRootelemenTest

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 23100%0 of 0n/a030803
testCreateRootelement()15100%n/a010401
setUp()5100%n/a010301
CreateRootelemenTest()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateRootelemenTest.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateRootelemenTest.java.html new file mode 100644 index 00000000..716601f3 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateRootelemenTest.java.html @@ -0,0 +1,35 @@ +CreateRootelemenTest.java

CreateRootelemenTest.java

package codemetropolis.toolchain.converter.gitinspector.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.w3c.dom.Document;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+
+/**
+*
+* @author Zakor Gyula {@literal <ZAGPAAG.SZE>}
+*
+*/
+
+public class CreateRootelemenTest {
+    static Document document;
+    static GitInspectorConverter converter;
+
+    @BeforeClass
+    public static void setUp() throws Exception {
+        document = TestHelper.newDocument();
+        converter = TestHelper.newGitInspectorConverter();
+    }
+
+    @Test
+    public void testCreateRootelement() {
+        CdfElement root = converter.createRootelement(document);
+        CdfElement expected = new CdfElement("gfx 2018/04/16", "root");
+        assertTrue(TestHelper.equals(root, expected));
+    }
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/DownscalePossibleLargeNumericValueTest.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/DownscalePossibleLargeNumericValueTest.html new file mode 100644 index 00000000..6a1d29bf --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/DownscalePossibleLargeNumericValueTest.html @@ -0,0 +1 @@ +DownscalePossibleLargeNumericValueTest

DownscalePossibleLargeNumericValueTest

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total10 of 29496%0 of 8100%01022306
testWithNonNumbers()101050%2100%022501
static {...}216100%n/a010501
testWithSuqareNumbers()19100%2100%020401
testWithNonSuqareNumbers()19100%2100%020401
testWithNegativeNumbers()17100%2100%020401
DownscalePossibleLargeNumericValueTest()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/DownscalePossibleLargeNumericValueTest.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/DownscalePossibleLargeNumericValueTest.java.html new file mode 100644 index 00000000..eaf83f72 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/DownscalePossibleLargeNumericValueTest.java.html @@ -0,0 +1,57 @@ +DownscalePossibleLargeNumericValueTest.java

DownscalePossibleLargeNumericValueTest.java

package codemetropolis.toolchain.converter.gitinspector.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+
+/**
+*
+* @author Zakor Gyula {@literal <ZAGPAAG.SZE>}
+*
+*/
+
+public class DownscalePossibleLargeNumericValueTest {
+
+	private static String[] squareNumbers = {"0", "1", "4", "16", "81", "100", "256", "3481", "7569", "16129", "205234276"};
+	private static String[] nonSquareNumbers = {"0", "2", "7", "20", "82", "107", "270", "3490", "7583", "16142", "205234385"};
+	private static String[] expectedResults = {"0", "1", "2", "4", "9", "10", "16", "59", "87", "127", "14326"};
+	private static String[] negativeNumbers = {"-0", "-2", "-7", "-20", "-82", "-107", "-270", "-3490", "-7583", "-16142", "-205234385"};
+	private static String[] nonNumbers = {"", "A", "AB", "CodeMetropolis", "GitConverter", "1234asdfg234"};
+
+	@Test
+	public void testWithSuqareNumbers() {
+		for (int i = 0; i < squareNumbers.length; ++i) {
+			String result = GitInspectorConverter.downscalePossibleLargeNumericValue(squareNumbers[i]);
+			assertEquals(expectedResults[i], result);
+		}
+	}
+
+	@Test
+	public void testWithNonSuqareNumbers() {
+		for (int i = 1; i < squareNumbers.length; ++i) {
+			String result = GitInspectorConverter.downscalePossibleLargeNumericValue(nonSquareNumbers[i]);
+			assertEquals(expectedResults[i], result);
+		}
+	}
+
+	@Test
+	public void testWithNegativeNumbers() {
+		for (int i = 0; i < negativeNumbers.length; ++i) {
+			String result = GitInspectorConverter.downscalePossibleLargeNumericValue(negativeNumbers[i]);
+			assertEquals("0", result);
+		}
+	}
+
+	@Test
+	public void testWithNonNumbers() {
+		for (int i = 0; i < negativeNumbers.length; ++i) {
+			try {
+				GitInspectorConverter.downscalePossibleLargeNumericValue(nonNumbers[i]);
+				fail(nonNumbers[i]);
+			} catch (Exception e) {}
+		}
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GetMetricsFromFirstAuthorElementNodeTest.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GetMetricsFromFirstAuthorElementNodeTest.html new file mode 100644 index 00000000..984f1e2c --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GetMetricsFromFirstAuthorElementNodeTest.html @@ -0,0 +1 @@ +GetMetricsFromFirstAuthorElementNodeTest

GetMetricsFromFirstAuthorElementNodeTest

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 170100%0 of 0n/a0203802
testGetMetricsFromFirstAuthorElementNode()167100%n/a0103701
GetMetricsFromFirstAuthorElementNodeTest()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GetMetricsFromFirstAuthorElementNodeTest.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GetMetricsFromFirstAuthorElementNodeTest.java.html new file mode 100644 index 00000000..d8f53fe2 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GetMetricsFromFirstAuthorElementNodeTest.java.html @@ -0,0 +1,76 @@ +GetMetricsFromFirstAuthorElementNodeTest.java

GetMetricsFromFirstAuthorElementNodeTest.java

package codemetropolis.toolchain.converter.gitinspector.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.commons.cdf.CdfProperty;
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+
+/**
+*
+* @author Zakor Gyula {@literal <ZAGPAAG.SZE>}
+*
+*/
+
+public class GetMetricsFromFirstAuthorElementNodeTest {
+
+    @Test
+    public void testGetMetricsFromFirstAuthorElementNode() throws Exception {
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        Document doc = TestHelper.newDocument();
+        Element element = doc.createElement("test-element");
+
+        Element nameAttr = doc.createElement("name");
+        nameAttr.appendChild(doc.createTextNode("Gipsz Jakab"));
+        element.appendChild(nameAttr);
+
+        Element emailAttr = doc.createElement("email");
+        emailAttr.appendChild(doc.createTextNode("xyz@valami.hu"));
+        element.appendChild(emailAttr);
+
+        Element commitsAttr = doc.createElement("commits");
+        commitsAttr.appendChild(doc.createTextNode("16"));
+        element.appendChild(commitsAttr);
+
+        Element insertionsAttr = doc.createElement("insertions");
+        insertionsAttr.appendChild(doc.createTextNode("100"));
+        element.appendChild(insertionsAttr);
+
+        Element deletionsAttr = doc.createElement("deletions");
+        deletionsAttr.appendChild(doc.createTextNode("121"));
+        element.appendChild(deletionsAttr);
+
+        Element pocAttr = doc.createElement("percentage-of-changes");
+        pocAttr.appendChild(doc.createTextNode("0.51"));
+        element.appendChild(pocAttr);
+
+        conv.getMetricsFromFirstAuthorElementNode(element);
+
+        CdfElement authorMetrics = new CdfElement("Gipsz Jakab", "author");
+        CdfElement floorMetrics = new CdfElement("Gipsz Jakab", "floor-metrics");
+
+        authorMetrics.addProperty("email", "xyz@valami.hu", CdfProperty.Type.STRING);
+        floorMetrics.addProperty("email", "xyz@valami.hu", CdfProperty.Type.STRING);
+
+        authorMetrics.addProperty("commits", "16", CdfProperty.Type.INT);
+        floorMetrics.addProperty("commits", "16", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("insertions", "10", CdfProperty.Type.INT);
+        floorMetrics.addProperty("insertions", "10", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("deletions", "11", CdfProperty.Type.INT);
+        floorMetrics.addProperty("deletions", "11", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("POC", "0.51", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("POC", "0.51", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addChildElement(floorMetrics);
+
+        assertTrue(TestHelper.equals(authorMetrics, conv.getAuthorMetrics()));
+    }
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GitInspectorConverterTest.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GitInspectorConverterTest.html new file mode 100644 index 00000000..cd18b107 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GitInspectorConverterTest.html @@ -0,0 +1 @@ +GitInspectorConverterTest

GitInspectorConverterTest

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 28100%0 of 0n/a020702
test()25100%n/a010601
GitInspectorConverterTest()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GitInspectorConverterTest.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GitInspectorConverterTest.java.html new file mode 100644 index 00000000..55fd3758 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GitInspectorConverterTest.java.html @@ -0,0 +1,27 @@ +GitInspectorConverterTest.java

GitInspectorConverterTest.java

package codemetropolis.toolchain.converter.gitinspector.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+
+/**
+*
+* @author Zakor Gyula {@literal <ZAGPAAG.SZE>}
+*
+*/
+
+public class GitInspectorConverterTest {
+
+	@Test
+	public void test() {
+		GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+		CdfElement authorMetrics = new CdfElement("", "author");
+		CdfElement floorMetrics = new CdfElement("", "floor-metrics");
+		assertTrue(TestHelper.equals(authorMetrics, conv.getAuthorMetrics()));
+		assertTrue(TestHelper.equals(floorMetrics, conv.getFloorMetrics()));
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/ResetMetricsTest.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/ResetMetricsTest.html new file mode 100644 index 00000000..c2f530fd --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/ResetMetricsTest.html @@ -0,0 +1 @@ +ResetMetricsTest

ResetMetricsTest

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 44100%0 of 0n/a0201102
testResetMetrics()41100%n/a0101001
ResetMetricsTest()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/ResetMetricsTest.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/ResetMetricsTest.java.html new file mode 100644 index 00000000..8235a676 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/ResetMetricsTest.java.html @@ -0,0 +1,31 @@ +ResetMetricsTest.java

ResetMetricsTest.java

package codemetropolis.toolchain.converter.gitinspector.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+
+/**
+*
+* @author Zakor Gyula {@literal <ZAGPAAG.SZE>}
+*
+*/
+
+public class ResetMetricsTest {
+
+    @Test
+    public void testResetMetrics() {
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        conv.resetMetrics("kiscica");
+        CdfElement testAuthor = new CdfElement("kiscica", "author");
+        CdfElement testMetric = new CdfElement("kiscica", "floor-metrics");
+        assertTrue(TestHelper.equals(testAuthor, conv.getAuthorMetrics()));
+        assertTrue(TestHelper.equals(testMetric, conv.getFloorMetrics()));
+        conv.resetMetrics("kiskutya");
+        assertFalse(TestHelper.equals(testAuthor, conv.getAuthorMetrics()));
+        assertFalse(TestHelper.equals(testMetric, conv.getFloorMetrics()));
+    }
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TestHelper.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TestHelper.html new file mode 100644 index 00000000..208bd34b --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TestHelper.html @@ -0,0 +1 @@ +TestHelper

TestHelper

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total7 of 12794%8 of 2263%91712116
TestHelper()30%n/a111111
equals(CdfElement, CdfElement)28297%51168%5901101
equals(CdfProperty, CdfProperty)22090%3350%340301
newDocument()8100%n/a010301
newGitInspectorConverter()7100%n/a010201
static {...}3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TestHelper.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TestHelper.java.html new file mode 100644 index 00000000..4a8df587 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TestHelper.java.html @@ -0,0 +1,56 @@ +TestHelper.java

TestHelper.java

package codemetropolis.toolchain.converter.gitinspector.test;
+
+import java.util.List;
+import java.util.Map;
+
+import org.w3c.dom.Document;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.commons.cdf.CdfProperty;
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+
+/**
+*
+* @author Zakor Gyula {@literal <ZAGPAAG.SZE>}
+*
+*/
+
+public class TestHelper {
+    private static String XML_SRC_PATH = "src\\main\\java\\codemetropolis\\toolchain\\converter\\gitinspector\\test\\GitInspectorOutput.xml";
+
+	public static boolean equals(CdfProperty p1, CdfProperty p2) {
+		return p1.getName().equals(p2.getName()) &&
+			p1.getValue().equals(p2.getValue()) &&
+			p1.getType().equals(p2.getType());
+	}
+
+	public static boolean equals(CdfElement e1, CdfElement e2) {
+		boolean equals = e1.getName().equals(e2.getName()) &&
+						e1.getType().equals(e2.getType());
+
+		List<CdfProperty> p1 = e1.getProperties();
+		List<CdfProperty> p2 = e2.getProperties();
+		for (int i = 0; i < Math.min(p1.size(), p2.size()); ++i) {
+			equals = equals && equals(p1.get(i), p2.get(i));
+		}
+
+		List<CdfElement> elements1 = e1.getChildElements();
+		List<CdfElement> elements2 = e2.getChildElements();
+		for (int i = 0; i < Math.min(elements1.size(), elements2.size()); ++i) {
+			equals = equals && equals(elements1.get(i), elements2.get(i));
+		}
+		return equals;
+	}
+
+	public static GitInspectorConverter newGitInspectorConverter() {
+	       Map<String, String> params = null;
+	       return new GitInspectorConverter(params);
+	}
+
+	public static Document newDocument() throws Exception {
+	    GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        Document doc = conv.createDocumentFromSource(XML_SRC_PATH);
+        return doc;
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TraverseNodesFromDocumentTest.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TraverseNodesFromDocumentTest.html new file mode 100644 index 00000000..41161b04 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TraverseNodesFromDocumentTest.html @@ -0,0 +1 @@ +TraverseNodesFromDocumentTest

TraverseNodesFromDocumentTest

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 126100%0 of 0n/a0202802
testTraverseNodesFromDocument()123100%n/a0102701
TraverseNodesFromDocumentTest()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TraverseNodesFromDocumentTest.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TraverseNodesFromDocumentTest.java.html new file mode 100644 index 00000000..70955c19 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TraverseNodesFromDocumentTest.java.html @@ -0,0 +1,64 @@ +TraverseNodesFromDocumentTest.java

TraverseNodesFromDocumentTest.java

package codemetropolis.toolchain.converter.gitinspector.test;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+
+import org.junit.Test;
+import org.w3c.dom.Document;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.commons.cdf.CdfProperty;
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+
+/**
+*
+* @author Zakor Gyula {@literal <ZAGPAAG.SZE>}
+*
+*/
+
+public class TraverseNodesFromDocumentTest {
+
+    @Test
+    public void testTraverseNodesFromDocument() throws Exception {
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        Document doc = TestHelper.newDocument();
+        conv.traverseNodesFromDocument(doc);
+        HashMap<String, CdfElement> elements = conv.getCdfElements();
+
+        CdfElement authorMetrics = new CdfElement("Teszt Bela", "author");
+        CdfElement floorMetrics = new CdfElement("Teszt Bela", "floor-metrics");
+
+        authorMetrics.addProperty("email", "becike@beciakiraly.eu", CdfProperty.Type.STRING);
+        floorMetrics.addProperty("email", "becike@beciakiraly.eu", CdfProperty.Type.STRING);
+
+        authorMetrics.addProperty("commits", "56", CdfProperty.Type.INT);
+        floorMetrics.addProperty("commits", "56", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("insertions", "67", CdfProperty.Type.INT);
+        floorMetrics.addProperty("insertions", "67", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("deletions", "54", CdfProperty.Type.INT);
+        floorMetrics.addProperty("deletions", "54", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("POC", "57.55", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("POC", "57.55", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addProperty("rows", "61", CdfProperty.Type.INT);
+        floorMetrics.addProperty("rows", "61", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("stability", "83.1", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("stability", "83.1", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addProperty("age", "0.8", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("age", "0.8", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addProperty("PIC", "4.32", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("PIC", "4.32", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addChildElement(floorMetrics);
+
+        assertTrue(TestHelper.equals(authorMetrics, elements.get("Teszt Bela")));
+    }
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsFromSecondAuthorElementNodeTest.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsFromSecondAuthorElementNodeTest.html new file mode 100644 index 00000000..7e9af190 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsFromSecondAuthorElementNodeTest.html @@ -0,0 +1 @@ +UpdateMetricsFromSecondAuthorElementNodeTest

UpdateMetricsFromSecondAuthorElementNodeTest

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 162100%0 of 0n/a0203602
testUpdateMetricsFromSecondAuthorElementNode()159100%n/a0103501
UpdateMetricsFromSecondAuthorElementNodeTest()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsFromSecondAuthorElementNodeTest.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsFromSecondAuthorElementNodeTest.java.html new file mode 100644 index 00000000..64c8ca9c --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsFromSecondAuthorElementNodeTest.java.html @@ -0,0 +1,73 @@ +UpdateMetricsFromSecondAuthorElementNodeTest.java

UpdateMetricsFromSecondAuthorElementNodeTest.java

package codemetropolis.toolchain.converter.gitinspector.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.commons.cdf.CdfProperty;
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+
+/**
+*
+* @author Zakor Gyula {@literal <ZAGPAAG.SZE>}
+*
+*/
+
+public class UpdateMetricsFromSecondAuthorElementNodeTest {
+
+    @Test
+    public void testUpdateMetricsFromSecondAuthorElementNode() throws Exception {
+        CdfElement authorMetrics = new CdfElement("Gipsz Jakab", "author");
+        CdfElement floorMetrics = new CdfElement("Gipsz Jakab", "floor-metrics");
+        authorMetrics.addChildElement(floorMetrics);
+
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        Document doc = TestHelper.newDocument();
+        Element element = doc.createElement("test-elemnt");
+
+        Element nameAttr = doc.createElement("name");
+        nameAttr.appendChild(doc.createTextNode("Gipsz Jakab"));
+        element.appendChild(nameAttr);
+
+        Element commitsAttr = doc.createElement("rows");
+        commitsAttr.appendChild(doc.createTextNode("1600"));
+        element.appendChild(commitsAttr);
+
+        Element insertionsAttr = doc.createElement("stability");
+        insertionsAttr.appendChild(doc.createTextNode("89.4"));
+        element.appendChild(insertionsAttr);
+
+        Element deletionsAttr = doc.createElement("age");
+        deletionsAttr.appendChild(doc.createTextNode("0.1"));
+        element.appendChild(deletionsAttr);
+
+        Element pocAttr = doc.createElement("percentage-in-comments");
+        pocAttr.appendChild(doc.createTextNode("0.51"));
+        element.appendChild(pocAttr);
+
+        conv.updateMetricsFromSecondAuthorElementNode(element, authorMetrics);
+
+        authorMetrics = new CdfElement("Gipsz Jakab", "author");
+        floorMetrics = new CdfElement("Gipsz Jakab", "floor-metrics");
+
+        authorMetrics.addProperty("rows", "40", CdfProperty.Type.INT);
+        floorMetrics.addProperty("rows", "40", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("stability", "89.4", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("stability", "89.4", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addProperty("age", "0.1", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("age", "0.1", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addProperty("PIC", "0.51", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("PIC", "0.51", CdfProperty.Type.FLOAT);
+
+        authorMetrics.addChildElement(floorMetrics);
+
+        assertTrue(TestHelper.equals(authorMetrics, conv.getAuthorMetrics()));
+    }
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsTest.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsTest.html new file mode 100644 index 00000000..181665b1 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsTest.html @@ -0,0 +1 @@ +UpdateMetricsTest

UpdateMetricsTest

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 144100%0 of 0n/a0203002
testUpdateMetrics()141100%n/a0102901
UpdateMetricsTest()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsTest.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsTest.java.html new file mode 100644 index 00000000..2c392b94 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsTest.java.html @@ -0,0 +1,63 @@ +UpdateMetricsTest.java

UpdateMetricsTest.java

package codemetropolis.toolchain.converter.gitinspector.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.commons.cdf.CdfProperty;
+import codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter;
+
+/**
+*
+* @author Zakor Gyula {@literal <ZAGPAAG.SZE>}
+*
+*/
+
+public class UpdateMetricsTest {
+
+    @Test
+    public void testUpdateMetrics() throws Exception {
+        GitInspectorConverter conv = TestHelper.newGitInspectorConverter();
+        Document doc = TestHelper.newDocument();
+        Element element = doc.createElement("test-element");
+
+        Element strAttr = doc.createElement("string-attribute");
+        strAttr.appendChild(doc.createTextNode("value"));
+        element.appendChild(strAttr);
+
+        Element intAttr = doc.createElement("int-attribute");
+        intAttr.appendChild(doc.createTextNode("16"));
+        element.appendChild(intAttr);
+
+        Element floatAttr = doc.createElement("float-attribute");
+        floatAttr.appendChild(doc.createTextNode("0.78"));
+        element.appendChild(floatAttr);
+
+        conv.updateMetrics(element, "string-attribute", "string", CdfProperty.Type.STRING, false);
+        conv.updateMetrics(element, "int-attribute", "int1", CdfProperty.Type.INT, false);
+        conv.updateMetrics(element, "int-attribute", "int2", CdfProperty.Type.INT, true);
+        conv.updateMetrics(element, "float-attribute", "float", CdfProperty.Type.FLOAT, false);
+
+        CdfElement authorMetrics = new CdfElement("", "author");
+        CdfElement floorMetrics = new CdfElement("", "floor-metrics");
+
+        authorMetrics.addProperty("string", "value", CdfProperty.Type.STRING);
+        floorMetrics.addProperty("string", "value", CdfProperty.Type.STRING);
+
+        authorMetrics.addProperty("int1", "16", CdfProperty.Type.INT);
+        floorMetrics.addProperty("int1", "16", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("int2", "4", CdfProperty.Type.INT);
+        floorMetrics.addProperty("int2", "4", CdfProperty.Type.INT);
+
+        authorMetrics.addProperty("float", "0.78", CdfProperty.Type.FLOAT);
+        floorMetrics.addProperty("float", "0.78", CdfProperty.Type.FLOAT);
+
+        assertTrue(TestHelper.equals(authorMetrics, conv.getAuthorMetrics()));
+        assertTrue(TestHelper.equals(floorMetrics, conv.getFloorMetrics()));
+    }
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/index.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/index.html new file mode 100644 index 00000000..764f2c46 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.gitinspector.test

codemetropolis.toolchain.converter.gitinspector.test

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total69 of 1,35394%8 of 3073%95322276138011
CreateElementsTest2815784%n/a0610520601
CreateDocumentFromSourceTest242652%n/a059220501
DownscalePossibleLargeNumericValueTest1028496%8100%0102230601
TestHelper712094%81463%9171211601
GetMetricsFromFirstAuthorElementNodeTest170100%n/a020380201
UpdateMetricsFromSecondAuthorElementNodeTest162100%n/a020360201
UpdateMetricsTest144100%n/a020300201
TraverseNodesFromDocumentTest126100%n/a020280201
ResetMetricsTest44100%n/a020110201
GitInspectorConverterTest28100%n/a02070201
CreateRootelemenTest23100%n/a03080301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/index.source.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/index.source.html new file mode 100644 index 00000000..e6d1c19a --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.gitinspector.test

codemetropolis.toolchain.converter.gitinspector.test

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total69 of 1,35394%8 of 3073%95322276138011
CreateElementsTest.java2815784%n/a0610520601
CreateDocumentFromSourceTest.java242652%n/a059220501
DownscalePossibleLargeNumericValueTest.java1028496%8100%0102230601
TestHelper.java712094%81463%9171211601
GetMetricsFromFirstAuthorElementNodeTest.java170100%n/a020380201
UpdateMetricsFromSecondAuthorElementNodeTest.java162100%n/a020360201
UpdateMetricsTest.java144100%n/a020300201
TraverseNodesFromDocumentTest.java126100%n/a020280201
ResetMetricsTest.java44100%n/a020110201
GitInspectorConverterTest.java28100%n/a02070201
CreateRootelemenTest.java23100%n/a03080301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/GitInspectorConverter.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/GitInspectorConverter.html new file mode 100644 index 00000000..359060b0 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/GitInspectorConverter.html @@ -0,0 +1 @@ +GitInspectorConverter

GitInspectorConverter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 394100%1 of 1693%121080013
traverseNodesFromDocument(Document)110100%1990%1602301
getMetricsFromFirstAuthorElementNode(Element)53100%n/a010901
updateMetricsFromSecondAuthorElementNode(Element, CdfElement)52100%n/a010901
createDocumentFromSource(String)33100%2100%020901
createElements(String)32100%2100%020601
createRootelement(Document)30100%n/a010401
updateMetrics(Element, String, String, CdfProperty.Type, boolean)25100%2100%020601
GitInspectorConverter(Map)23100%n/a010501
resetMetrics(String)15100%n/a010301
downscalePossibleLargeNumericValue(String)12100%n/a010301
getCdfElements()3100%n/a010101
getAuthorMetrics()3100%n/a010101
getFloorMetrics()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/GitInspectorConverter.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/GitInspectorConverter.java.html new file mode 100644 index 00000000..2d5e2c9f --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/GitInspectorConverter.java.html @@ -0,0 +1,180 @@ +GitInspectorConverter.java

GitInspectorConverter.java

package codemetropolis.toolchain.converter.gitinspector;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+import org.w3c.dom.Element;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.commons.cdf.CdfProperty;
+import codemetropolis.toolchain.commons.cdf.CdfTree;
+import codemetropolis.toolchain.commons.cdf.converter.CdfConverter;
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+
+public class GitInspectorConverter extends CdfConverter {
+
+	private static final String CHANGES_TAG = "changes";
+	private static final String EMAIL_TAG = "email";
+	private static final String BLAME_TAG = "blame";
+	private static final String AUTHOR_TAG = "author";
+	private static final String NAME_TAG = "name";
+	private static final String COMMITS_TAG = "commits";
+	private static final String INSERTIONS_TAG = "insertions";
+	private static final String DELETIONS_TAG = "deletions";
+	private static final String POC_TAG = "percentage-of-changes";
+	private static final String POC_SHORT = "POC";
+	private static final String ROWS_TAG = "rows";
+	private static final String STABILITY_TAG = "stability";
+	private static final String AGE_TAG = "age";
+	private static final String PIC_TAG = "percentage-in-comments";
+	private static final String PIC_SHORT = "PIC";
+	private static final String FLOOR_TAG = "floor-metrics";
+	private static final String REPOSITORY_TAG = "repository";
+	private static final String DATE_TAG = "report-date";
+
+	private HashMap<String, CdfElement> cdfElements;
+	private CdfElement authorMetrics;
+	private CdfElement floorMetrics;
+
+	public HashMap<String, CdfElement> getCdfElements() {
+		return cdfElements;
+	}
+
+	public CdfElement getAuthorMetrics() {
+		return authorMetrics;
+	}
+
+	public CdfElement getFloorMetrics() {
+		return floorMetrics;
+	}
+
+	public GitInspectorConverter(Map<String, String> params) {
+		super(params);
+		cdfElements = new HashMap<String, CdfElement>();
+		authorMetrics = new CdfElement("", AUTHOR_TAG);
+		floorMetrics = new CdfElement("", FLOOR_TAG);
+	}
+
+	@Override
+	public CdfTree createElements(String source) throws CodeMetropolisException {
+		Document doc = createDocumentFromSource(source);
+		CdfElement rootElement = createRootelement(doc);
+		traverseNodesFromDocument(doc);
+		for (CdfElement element : cdfElements.values()) {
+			rootElement.addChildElement(element);
+		}
+		return new CdfTree(rootElement);
+	}
+
+	public CdfElement createRootelement(Document doc) {
+		StringBuilder rootName = new StringBuilder(doc.getElementsByTagName(REPOSITORY_TAG).item(0).getTextContent());
+		rootName.append(" ");
+		rootName.append(doc.getElementsByTagName(DATE_TAG).item(0).getTextContent());
+		return new CdfElement(rootName.toString(), "root");
+	}
+
+	public Document createDocumentFromSource(String sourcePath) throws CodeMetropolisException {
+		try {
+			File inputFile = new File(sourcePath);
+			if (!inputFile.getName().endsWith(".xml")) {
+			    throw new CodeMetropolisException("The supplied file must have XML extension.");
+			}
+			DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+			DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+			Document doc = dBuilder.parse(inputFile);
+			return doc;
+		} catch (Exception e) {
+			throw new CodeMetropolisException(e.getMessage());
+		}
+	}
+
+	public void traverseNodesFromDocument(Document doc) {
+		Node changesNode = doc.getElementsByTagName(CHANGES_TAG).item(0);
+		Node authorsNode = changesNode.getChildNodes().item(3);
+		NodeList authorNodes = authorsNode.getChildNodes();
+
+		for (int i = 0; i < authorNodes.getLength(); ++i) {
+			Node authorNode = authorNodes.item(i);
+			if (authorNode.getNodeType() == Node.ELEMENT_NODE) {
+				Element authorElement = (Element) authorNode;
+				CdfElement element = getMetricsFromFirstAuthorElementNode(authorElement);
+				String name = authorElement.getElementsByTagName(NAME_TAG).item(0).getTextContent();
+				cdfElements.put(name, element);
+			}
+		}
+
+		Node blameNode = doc.getElementsByTagName(BLAME_TAG).item(0);
+		authorsNode = blameNode.getChildNodes().item(3);
+		authorNodes = authorsNode.getChildNodes();
+
+		for (int i = 0; i < authorNodes.getLength(); ++i) {
+			Node authorNode = authorNodes.item(i);
+			if (authorNode.getNodeType() == Node.ELEMENT_NODE) {
+				Element authorElement = (Element) authorNode;
+				String name = authorElement.getElementsByTagName(NAME_TAG).item(0).getTextContent();
+
+				CdfElement element = cdfElements.get(name);
+				if (element != null) {
+					element = updateMetricsFromSecondAuthorElementNode(authorElement, element);
+					cdfElements.put(name, element);
+				}
+			}
+		}
+	}
+
+	public CdfElement getMetricsFromFirstAuthorElementNode(Element authorElement) {
+		String name = authorElement.getElementsByTagName(NAME_TAG).item(0).getTextContent();
+		resetMetrics(name);
+
+		updateMetrics(authorElement, EMAIL_TAG, EMAIL_TAG, CdfProperty.Type.STRING, false);
+		updateMetrics(authorElement, COMMITS_TAG, COMMITS_TAG, CdfProperty.Type.INT, false);
+		updateMetrics(authorElement, INSERTIONS_TAG, INSERTIONS_TAG, CdfProperty.Type.INT, true);
+		updateMetrics(authorElement, DELETIONS_TAG, DELETIONS_TAG, CdfProperty.Type.INT, true);
+		updateMetrics(authorElement, POC_TAG, POC_SHORT, CdfProperty.Type.FLOAT, false);
+
+		authorMetrics.addChildElement(floorMetrics);
+		return authorMetrics;
+	}
+
+	public CdfElement updateMetricsFromSecondAuthorElementNode(Element authorElement, CdfElement element) {
+		authorMetrics = element;
+		floorMetrics = authorMetrics.getChildElements().get(0);
+		authorMetrics.removeChildElement(floorMetrics);
+
+		updateMetrics(authorElement, ROWS_TAG, ROWS_TAG, CdfProperty.Type.INT, true);
+		updateMetrics(authorElement, STABILITY_TAG, STABILITY_TAG, CdfProperty.Type.FLOAT, false);
+		updateMetrics(authorElement, AGE_TAG, AGE_TAG, CdfProperty.Type.FLOAT, false);
+		updateMetrics(authorElement, PIC_TAG, PIC_SHORT, CdfProperty.Type.FLOAT, false);
+
+		authorMetrics.addChildElement(floorMetrics);
+		return authorMetrics;
+	}
+
+	public static String downscalePossibleLargeNumericValue(String numberString) {
+		long number = Long.parseLong(numberString);
+		long newValue = (long) Math.floor(Math.sqrt(number));
+		return Long.toString(newValue);
+	}
+
+	public void updateMetrics(Element authorElement, String readTag,
+			String writeTag, CdfProperty.Type type, boolean remapNumeric) {
+		String metricValue = authorElement.getElementsByTagName(readTag).item(0).getTextContent();
+		if (remapNumeric) {
+			metricValue = downscalePossibleLargeNumericValue(metricValue);
+		}
+		authorMetrics.addProperty(writeTag, metricValue, type);
+		floorMetrics.addProperty(writeTag, metricValue, type);
+	}
+
+	public void resetMetrics(String name) {
+		authorMetrics = new CdfElement(name, AUTHOR_TAG);
+		floorMetrics = new CdfElement(name, FLOOR_TAG);
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/index.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/index.html new file mode 100644 index 00000000..9ab74dfd --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.gitinspector

codemetropolis.toolchain.converter.gitinspector

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total0 of 394100%1 of 1693%12108001301
GitInspectorConverter394100%11593%12108001301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/index.source.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/index.source.html new file mode 100644 index 00000000..881f78bb --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.gitinspector

codemetropolis.toolchain.converter.gitinspector

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total0 of 394100%1 of 1693%12108001301
GitInspectorConverter.java394100%11593%12108001301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarClient.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarClient.html new file mode 100644 index 00000000..c1404f1c --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarClient.html @@ -0,0 +1 @@ +SonarClient

SonarClient

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total544 of 5440%42 of 420%32321201201010
getResources(SonarResource)1200%100%77262611
getProject(String)1010%80%55202011
getMetricsParameterNames()860%40%33161611
getMetricNameAndValues(JsonArray)770%120%77181811
getProjectKeys()630%40%33121211
createResource(JsonObject)580%40%33141411
SonarClient(String, String, String)220%n/a117711
SonarClient(String)60%n/a112211
getMetricType(String)60%n/a113311
init()50%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarClient.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarClient.java.html new file mode 100644 index 00000000..1a624712 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarClient.java.html @@ -0,0 +1,213 @@ +SonarClient.java

SonarClient.java

package codemetropolis.toolchain.converter.sonarqube;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
+import codemetropolis.toolchain.converter.sonarqube.SonarMetric.MetricType;
+import codemetropolis.toolchain.converter.sonarqube.SonarResource.Scope;
+
+public class SonarClient {
+
+	private static final String URL_METRIC_SEARCH = "metrics/search?f=name";
+	private static final String URL_RESOURCES = "resources";
+	private static final String PARAM_SCOPE = "scopes";
+	private static final String PARAM_RESOURCE = "resource";
+	private static final String PARAM_METRICS = "metrics";
+	private static final String PARAM_DEPTH = "depth";
+
+	private String sonarUrl;
+	private String username;
+	private String password;
+	private String metricNames;
+	private Map<Integer, SonarResource> resources = new ConcurrentHashMap<Integer, SonarResource>();
+	private Map<String, String> metricNamesAndTypes = new HashMap<String, String>();
+	
+	public SonarClient(String sonarUrl, String username, String password) {
+		this.sonarUrl = sonarUrl;
+		this.username = username;
+		this.password = password;
+	}
+	
+	public SonarClient(String sonarUrl) {
+		this(sonarUrl, null, null);
+	}
+	
+	public void init() throws SonarConnectException {
+		metricNames = getMetricsParameterNames();
+	}
+	
+	private void getResources(SonarResource resource) throws SonarConnectException {
+		Scope scope = null;
+		switch(resource.getScope()) {
+			case PRJ:
+				scope = Scope.DIR;
+				break;
+			case DIR:
+				scope = Scope.FIL;
+				break;
+			case FIL:
+				return;
+		}
+		
+		String requestUrl = String.format("%s%s", sonarUrl, URL_RESOURCES);
+		SonarRequest request = new SonarRequest(requestUrl, username, password);
+		request.setParameter(PARAM_RESOURCE, String.valueOf(resource.getId()));
+		request.setParameter(PARAM_DEPTH, String.valueOf(-1));
+		request.setParameter(PARAM_SCOPE, scope.toString());
+		request.setParameter(PARAM_METRICS, metricNames);
+		String responseStr = request.sendPost();
+				
+		JsonParser jsonParser = new JsonParser();
+		JsonElement jsonElement = jsonParser.parse(responseStr);
+		if(jsonElement.isJsonArray()){
+			Iterator<JsonElement> iterator = ((JsonArray)jsonElement).iterator();
+			while(iterator.hasNext()){
+				JsonElement arrayElement = iterator.next();
+				if(arrayElement.isJsonObject()){
+					SonarResource childResource = createResource((JsonObject)arrayElement);
+					resources.put(childResource.getId(), childResource);
+					resources.get(resource.getId()).addChild(childResource.getId());
+					getResources(childResource);
+				}			
+			}
+		}
+	}
+	
+	public List<String> getProjectKeys() throws SonarConnectException {
+		List<String> result = new ArrayList<>();
+		String requestUrl = String.format("%s%s", sonarUrl, URL_RESOURCES);
+		SonarRequest request = new SonarRequest(requestUrl, username, password);
+		String responseStr = request.sendPost();
+		JsonParser jsonParser = new JsonParser();
+		JsonElement jsonElement = jsonParser.parse(responseStr);
+		if(jsonElement.isJsonArray()){
+			Iterator<JsonElement> iterator = ((JsonArray)jsonElement).iterator();
+			while(iterator.hasNext()){
+				JsonObject projectJsonObject = iterator.next().getAsJsonObject();
+				result.add(projectJsonObject.get("key").getAsString());	
+			}
+		}
+		return result;
+	}
+	
+	public Map<Integer, SonarResource> getProject(String projectKey) throws SonarConnectException {
+		
+		String requestUrl = String.format("%s%s", sonarUrl, URL_RESOURCES);
+		SonarRequest request = new SonarRequest(requestUrl, username, password);
+		request.setParameter(PARAM_RESOURCE, projectKey);
+		request.setParameter(PARAM_SCOPE, Scope.PRJ.toString());
+		request.setParameter(PARAM_METRICS, metricNames);
+		String responseStr = request.sendPost();
+		
+		JsonParser jsonParser = new JsonParser();
+		JsonElement jsonElement = jsonParser.parse(responseStr);
+		if(jsonElement.isJsonArray()){
+			Iterator<JsonElement> iterator = ((JsonArray)jsonElement).iterator();
+			while(iterator.hasNext()){
+				JsonElement arrayElement = iterator.next();
+				if(arrayElement.isJsonObject()){
+					SonarResource childResource = createResource((JsonObject)arrayElement);
+					resources.put(childResource.getId(), childResource);
+				}			
+			}
+		}
+		Iterator<Integer> iterator = resources.keySet().iterator();
+		while(iterator.hasNext()){
+			SonarResource innerResources = resources.get(iterator.next());
+			getResources(innerResources);
+		}
+		return resources;
+	}
+	
+	private String getMetricsParameterNames() throws SonarConnectException{
+		StringBuilder metricNames = new StringBuilder();
+		
+		String requestUrl = String.format("%s%s", sonarUrl, URL_METRIC_SEARCH);
+		SonarRequest request = new SonarRequest(requestUrl, username, password);
+		String responeStr = request.sendPost();
+		
+		JsonParser jsonParser = new JsonParser();
+		JsonElement jsonElement = jsonParser.parse(responeStr);
+		JsonArray domainJsonArray = jsonElement.getAsJsonObject().getAsJsonArray("metrics");
+		Iterator<JsonElement> iterator = domainJsonArray.iterator();
+		
+		while(iterator.hasNext()){
+			JsonElement element = iterator.next();
+			if(element.isJsonObject()){
+				JsonObject jsonArray = (JsonObject) element;
+				metricNames.append(jsonArray.get("key").getAsString());
+				metricNames.append(",");
+				metricNamesAndTypes.put(jsonArray.get("key").getAsString(), jsonArray.get("type").getAsString());
+			}
+		}
+		
+		return metricNames.toString();
+	}
+	
+	private SonarResource createResource(JsonObject jsonObject){
+
+		SonarResource resource = new SonarResource();
+		String name = jsonObject.get("name").getAsString();
+		String scope = jsonObject.get("scope").getAsString();
+		String key = jsonObject.get("key").getAsString();
+		int id = jsonObject.get("id").getAsInt();
+		
+		resource.setName(name);
+		resource.setScope(Scope.valueOf(scope));
+		resource.setKey(key);
+		resource.setId(id);
+
+		JsonElement metrics = jsonObject.get("msr");
+		if(metrics != null && metrics.isJsonArray()){
+			JsonArray array = (JsonArray) jsonObject.get("msr");
+			resource.addMetrics(getMetricNameAndValues(array));
+		}
+		
+		return resource;
+	}
+
+	private List<SonarMetric> getMetricNameAndValues(JsonArray jsonArray){
+		List<SonarMetric> metricList = new ArrayList<>();
+		Iterator<JsonElement> iterator = jsonArray.iterator();
+		while(iterator.hasNext()){
+			JsonElement element = iterator.next();
+			if(element.isJsonObject()){
+				JsonObject jsonObject = (JsonObject) element;
+
+				if(!jsonObject.has("key") || (!jsonObject.has("val") && !jsonObject.has("data"))){
+					continue;			
+				}
+				String name = jsonObject.get("key").getAsString();
+				String value = "";
+				if(jsonObject.has("val")){
+					value = jsonObject.get("val").getAsString();
+				} else {
+					value = jsonObject.get("data").getAsString();
+				}
+				String type = metricNamesAndTypes.get(name);
+				SonarMetric metric = new SonarMetric(name, value, getMetricType(type));
+				metricList.add(metric);
+			}
+		}
+		return metricList;
+	}
+	
+	private MetricType getMetricType(String type){	
+		try {
+			return MetricType.valueOf(type);
+		} catch(Exception e) {
+			return MetricType.DATA;
+		}	
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarConnectException.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarConnectException.html new file mode 100644 index 00000000..a8c685fe --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarConnectException.html @@ -0,0 +1 @@ +SonarConnectException

SonarConnectException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
SonarConnectException(String, Throwable, boolean, boolean)70%n/a112211
SonarConnectException(String, Throwable)50%n/a112211
SonarConnectException(String)40%n/a112211
SonarConnectException(Throwable)40%n/a112211
SonarConnectException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarConnectException.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarConnectException.java.html new file mode 100644 index 00000000..a6c56563 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarConnectException.java.html @@ -0,0 +1,30 @@ +SonarConnectException.java

SonarConnectException.java

package codemetropolis.toolchain.converter.sonarqube;
+
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+
+public class SonarConnectException extends CodeMetropolisException {
+
+	private static final long serialVersionUID = -5206994497081967248L;
+
+	public SonarConnectException() {
+		super();
+	}
+
+	public SonarConnectException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public SonarConnectException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public SonarConnectException(String message) {
+		super(message);
+	}
+
+	public SonarConnectException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric$MetricType.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric$MetricType.html new file mode 100644 index 00000000..373c1d1b --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric$MetricType.html @@ -0,0 +1 @@ +SonarMetric.MetricType

SonarMetric.MetricType

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total140 of 1400%0 of 0n/a44131344
static {...}1140%n/a11121211
values()160%n/a111111
SonarMetric.MetricType(String, int)50%n/a111111
valueOf(String)50%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric.html new file mode 100644 index 00000000..6485736f --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric.html @@ -0,0 +1 @@ +SonarMetric

SonarMetric

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total138 of 1380%26 of 260%2222404099
equals(Object)600%200%1111202011
hashCode()450%60%446611
SonarMetric(String, String, SonarMetric.MetricType)120%n/a115511
setName(String)40%n/a112211
setValue(String)40%n/a112211
setType(SonarMetric.MetricType)40%n/a112211
getName()30%n/a111111
getValue()30%n/a111111
getType()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric.java.html new file mode 100644 index 00000000..76aee065 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarMetric.java.html @@ -0,0 +1,83 @@ +SonarMetric.java

SonarMetric.java

package codemetropolis.toolchain.converter.sonarqube;
+
+public class SonarMetric {
+
+	private String name;
+	private String value;
+	private MetricType type;
+	
+	public SonarMetric(String name, String value, MetricType type) {
+		this.name = name;
+		this.value = value;
+		this.type = type;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getValue() {
+		return value;
+	}
+	public void setValue(String value) {
+		this.value = value;
+	}
+	public MetricType getType() {
+		return type;
+	}
+	public void setType(MetricType type) {
+		this.type = type;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((name == null) ? 0 : name.hashCode());
+		result = prime * result + ((type == null) ? 0 : type.hashCode());
+		result = prime * result + ((value == null) ? 0 : value.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		SonarMetric other = (SonarMetric) obj;
+		if (name == null) {
+			if (other.name != null)
+				return false;
+		} else if (!name.equals(other.name))
+			return false;
+		if (type != other.type)
+			return false;
+		if (value == null) {
+			if (other.value != null)
+				return false;
+		} else if (!value.equals(other.value))
+			return false;
+		return true;
+	}
+
+	public enum MetricType {
+	    INT,
+	    FLOAT,
+	    PERCENT,
+	    BOOL,
+	    STRING,
+	    MILLISEC,
+	    DATA,
+	    LEVEL,
+	    DISTRIB,
+	    RATING,
+	    WORK_DUR
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarQubeConverter.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarQubeConverter.html new file mode 100644 index 00000000..dc595f2c --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarQubeConverter.html @@ -0,0 +1 @@ +SonarQubeConverter

SonarQubeConverter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total449 of 4490%48 of 480%353594941010
processDirHierarchy(CdfTree)1150%140%88262611
getResources(String)1000%100%66181811
createElements(String)650%80%55151511
createCdfElement(SonarResource)430%n/a119911
setChildren(CdfElement, SonarResource)430%40%338811
addCdfProperties(CdfElement, List)220%20%223311
getChildByName(CdfElement, String)210%40%333311
SonarQubeConverter(Map)140%n/a114411
getProjectsInParams()130%20%223311
getMetricType(SonarMetric.MetricType)130%40%445511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarQubeConverter.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarQubeConverter.java.html new file mode 100644 index 00000000..c2905dfe --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarQubeConverter.java.html @@ -0,0 +1,194 @@ +SonarQubeConverter.java

SonarQubeConverter.java

package codemetropolis.toolchain.converter.sonarqube;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.commons.cdf.CdfProperty.Type;
+import codemetropolis.toolchain.commons.cdf.CdfTree;
+import codemetropolis.toolchain.commons.cdf.converter.CdfConverter;
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.converter.sonarqube.SonarMetric.MetricType;
+import codemetropolis.toolchain.converter.sonarqube.SonarResource.Scope;
+
+public class SonarQubeConverter extends CdfConverter {
+
+	private static final String USERNAME_PARAM_NAME = "username";
+	private static final String PASSWORD_PARAM_NAME = "password";
+	private static final String SPLIT_DIRS_PARAM_NAME = "splitDirs";
+	private static final String PROJECTS_PARAM_NAME = "projects";
+	private static final String ROOT_CONTAINER_NAME = "projects";
+	private static final String ROOT_CONTAINER_TYPE = "container";
+	
+	private Map<Integer, SonarResource> resources;
+	private Map<Integer, CdfElement> cdfElements;
+	
+	public SonarQubeConverter(Map<String, String> params) {
+		super(params);
+		resources = new HashMap<>();
+		cdfElements = new HashMap<>();
+	}
+
+	@Override
+	public CdfTree createElements(String url) throws CodeMetropolisException {
+		resources.putAll(getResources(url));
+		
+		CdfTree cdfTree = new CdfTree();	
+		Iterator<Integer> iterator = resources.keySet().iterator();
+		
+		CdfElement rootElement = new CdfElement(ROOT_CONTAINER_NAME, ROOT_CONTAINER_TYPE);
+		cdfTree.setRoot(rootElement);
+		
+		while(iterator.hasNext()){
+			Integer rootId = iterator.next();
+			SonarResource res = resources.get(rootId);
+			if(Scope.PRJ.equals(res.getScope())){
+				CdfElement projectElement = createCdfElement(res);
+				rootElement.addChildElement(projectElement);
+			}
+		}
+		
+		String splitDirsParam = getParameter(SPLIT_DIRS_PARAM_NAME);
+		if(splitDirsParam != null && Boolean.valueOf(splitDirsParam)) {
+			processDirHierarchy(cdfTree);
+		}
+		
+		return cdfTree;
+	}
+	
+	private String[] getProjectsInParams() {
+		String projectStr = getParameter(PROJECTS_PARAM_NAME);
+		if(projectStr == null) return new String[0];
+		return projectStr.split(",");
+	}
+	
+	private Map<Integer, SonarResource> getResources(String url) throws SonarConnectException {
+		Map<Integer, SonarResource> result = new HashMap<>();
+		
+		SonarClient sonarClient = new SonarClient(url, getParameter(USERNAME_PARAM_NAME), getParameter(PASSWORD_PARAM_NAME));
+		sonarClient.init();
+		
+		String[] projectRegexList = getProjectsInParams();
+		List<String> allProjects = sonarClient.getProjectKeys();
+		Set<String> projects = new LinkedHashSet<>();
+		
+		if(projectRegexList.length == 0) {
+			projects.addAll(allProjects);
+		} else {
+			for(String p : allProjects) {
+				for(String regex : projectRegexList) {
+					if(p.matches(regex)) {
+						projects.add(p);
+						break;
+					}
+				}
+			}
+		}
+		
+		for(String key : projects) {
+			fireConverterEvent(String.format(Resources.get("sonar_downloading_project"), key));
+			result.putAll(sonarClient.getProject(key));
+		}
+		
+		return result;
+	}
+	
+	private CdfElement createCdfElement(SonarResource resource){
+		CdfElement cdfElement = new CdfElement();
+		cdfElement.setName(resource.getName());	
+		cdfElement.setType(resource.getScope().toString());
+		cdfElement.setSourceId(String.valueOf(resource.getId()));
+		cdfElement.addProperty("key", resource.getKey(), Type.STRING);
+		addCdfProperties(cdfElement, resource.getMetrics());
+		setChildren(cdfElement, resource);
+		cdfElements.put(resource.getId(), cdfElement);
+		
+		return cdfElement;
+	}
+	
+	private void addCdfProperties(CdfElement cdfElement, List<SonarMetric> metrics){
+		for(SonarMetric metric : metrics){
+			cdfElement.addProperty(metric.getName(), metric.getValue(), getMetricType(metric.getType()));
+		}
+	}
+	
+	private Type getMetricType(MetricType type){
+		switch(type){
+			case INT:
+				return Type.INT;
+			case FLOAT:
+			case PERCENT:
+			case MILLISEC:
+				return Type.FLOAT;
+			case DATA:
+				return Type.STRING;
+			default:
+				return Type.STRING;
+		}
+	}
+	
+	private void setChildren(CdfElement cdfElement, SonarResource resource){
+		if(cdfElements.containsKey(resource.getId())){
+			CdfElement child = cdfElements.get(resource.getId());
+			cdfElement.addChildElement(child);
+		} else {
+			for(Integer ids : resource.getChildIdList()){
+				CdfElement child = createCdfElement(resources.get(ids));
+				cdfElement.addChildElement(child);
+			}
+		}			
+	}
+	
+	private void processDirHierarchy(CdfTree cdfTree) {
+		CdfTree.Iterator it = cdfTree.iterator();
+		while(it.hasNext()) {
+			
+			CdfElement prj = it.next();
+			if(!"prj".equalsIgnoreCase(prj.getType())) {
+				continue;
+			}
+			
+			String prjKey = prj.getPropertyValue("key");
+			for(CdfElement child : prj.getChildElements()) {
+				
+				String childKey = child.getPropertyValue("key");	
+				String[] nodeNames = childKey.replaceFirst(prjKey + ":", "").split("/");
+				if(nodeNames.length < 2) continue;
+				
+				CdfElement dir = prj;
+				int i = 0;
+				while(i < nodeNames.length - 1) {
+					CdfElement matchingChild = getChildByName(dir, nodeNames[i]);
+					if(matchingChild == null) break;
+					dir = matchingChild;
+					i++;
+				}
+				
+				while(i < nodeNames.length - 1) {
+					CdfElement newElement = new CdfElement(nodeNames[i], "dir");
+					dir.addChildElement(newElement);
+					dir = newElement;
+					i++;
+				}
+				
+				prj.removeChildElement(child);
+				child.setName(nodeNames[nodeNames.length - 1]);
+				dir.addChildElement(child);
+			}	
+		}
+	}
+	
+	private CdfElement getChildByName(CdfElement parent, String name) {
+		for(CdfElement child : parent.getChildElements()) {
+			if(child.getName().equals(name)) return child;
+		}
+		return null;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarRequest.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarRequest.html new file mode 100644 index 00000000..986dccc4 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarRequest.html @@ -0,0 +1 @@ +SonarRequest

SonarRequest

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total226 of 2260%16 of 160%212144441313
send(String)1040%100%66212111
setParameter(String, String)310%20%222211
createAuthenticationString()200%n/a112211
SonarRequest(String, String, String)150%n/a116611
getUrlWithParams()150%n/a111111
isLoginInfoSet()100%40%331111
setLoginInfo(String, String)70%n/a113311
SonarRequest(String)60%n/a112211
sendGet()40%n/a111111
sendPost()40%n/a111111
setUrl(String)40%n/a112211
getUrl()30%n/a111111
getParams()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarRequest.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarRequest.java.html new file mode 100644 index 00000000..dff9f607 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarRequest.java.html @@ -0,0 +1,107 @@ +SonarRequest.java

SonarRequest.java

package codemetropolis.toolchain.converter.sonarqube;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Base64;
+
+import codemetropolis.toolchain.commons.util.Resources;
+
+public class SonarRequest {
+	
+	private String url;
+	private String params;
+	private String username;
+	private String password;
+	
+	public SonarRequest(String url, String username, String password) {
+		this.url = url;
+		this.params = "";
+		this.username = username;
+		this.password = password;
+	}
+	
+	public SonarRequest(String url) {
+		this(url, null, null);
+	}
+	
+	public String sendGet() throws SonarConnectException {
+		return send("GET");
+	}
+	
+	public String sendPost() throws SonarConnectException {
+		return send("POST");
+	}
+	
+	private String send(String method) throws SonarConnectException {
+		try {
+			URL url = new URL(method.equalsIgnoreCase("GET") ? getUrlWithParams() : this.url);
+			HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+			connection.setRequestMethod(method);
+			
+			if(isLoginInfoSet()) {
+				connection.setRequestProperty("Authorization", "Basic " + createAuthenticationString());
+			}
+			
+			if(method.equalsIgnoreCase("POST")) {
+				connection.setDoOutput(true);
+				DataOutputStream os = new DataOutputStream(connection.getOutputStream());
+				os.writeBytes(params);
+				os.flush();
+				os.close();
+			}
+			
+			if(connection.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED) {
+				throw new SonarConnectException(Resources.get("sonar_unauthorized_error"));
+			} else if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
+				throw new RuntimeException("HTTP request returned an error. HTTP error code : " + connection.getResponseCode());
+			} 
+			
+			BufferedReader br = new BufferedReader(new InputStreamReader((connection.getInputStream())));
+			String line = br.readLine();
+			connection.disconnect();	
+			return line;
+		} catch(IOException e) {
+			throw new SonarConnectException(Resources.get("sonar_connect_error"));
+		}
+	}
+	
+	private String createAuthenticationString() {
+		String authStr = String.format("%s:%s", username, password);
+		return Base64.getEncoder().encodeToString(authStr.getBytes());
+	}
+	
+	private boolean isLoginInfoSet() {
+		return username != null && password != null;
+	}
+
+	public String getUrl() {
+		return url;
+	}
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+	public String getParams() {
+		return params;
+	}
+
+	public void setParameter(String key, String value) {
+		params = String.format("%s%s%s=%s", params, params.equals("") ? "" : "&", key, value);
+	}
+	
+	public String getUrlWithParams() {
+		return String.format("%s?%s", url, params);
+	}
+	
+	public void setLoginInfo(String username, String password) {
+		this.username = username;
+		this.password = password;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource$Scope.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource$Scope.html new file mode 100644 index 00000000..c78c24b5 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource$Scope.html @@ -0,0 +1 @@ +SonarResource.Scope

SonarResource.Scope

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total60 of 600%0 of 0n/a445544
static {...}340%n/a114411
values()160%n/a111111
SonarResource.Scope(String, int)50%n/a111111
valueOf(String)50%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource.html new file mode 100644 index 00000000..c1d27c9b --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource.html @@ -0,0 +1 @@ +SonarResource

SonarResource

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total254 of 2540%40 of 400%373762621717
equals(Object)830%280%1515272711
hashCode()650%80%558811
addChild(int[])230%20%223311
addMetric(SonarMetric[])220%20%223311
SonarResource()130%n/a113311
addMetrics(Collection)60%n/a112211
addChildren(Collection)60%n/a112211
setId(int)40%n/a112211
setName(String)40%n/a112211
setKey(String)40%n/a112211
setScope(SonarResource.Scope)40%n/a112211
getMetrics()40%n/a111111
getChildIdList()40%n/a111111
getId()30%n/a111111
getName()30%n/a111111
getKey()30%n/a111111
getScope()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource.java.html new file mode 100644 index 00000000..0ab7c965 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/SonarResource.java.html @@ -0,0 +1,126 @@ +SonarResource.java

SonarResource.java

package codemetropolis.toolchain.converter.sonarqube;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+public class SonarResource {
+
+	private int id;
+	private String name;
+	private String key;
+	private Scope scope;
+	private List<SonarMetric> metrics = new ArrayList<>();
+	private List<Integer> childIdList = new ArrayList<>();
+	
+	public int getId() {
+		return id;
+	}
+
+	public void setId(int id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getKey() {
+		return key;
+	}
+
+	public void setKey(String key) {
+		this.key = key;
+	}
+
+	public Scope getScope() {
+		return scope;
+	}
+
+	public void setScope(Scope scope) {
+		this.scope = scope;
+	}
+
+	public List<SonarMetric> getMetrics() {
+		return Collections.unmodifiableList(metrics);
+	}
+	
+	public void addMetrics(Collection<SonarMetric> metrics) {
+		this.metrics.addAll(metrics);
+	}
+	
+	public void addMetric(SonarMetric... metric) {
+		for(SonarMetric m : metric) {
+			metrics.add(m);
+		}
+	}
+	
+	public List<Integer> getChildIdList() {
+		return Collections.unmodifiableList(childIdList);
+	}
+	
+	public void addChildren(Collection<Integer> idCollection) {
+		childIdList.addAll(idCollection);
+	}
+	
+	public void addChild(int... id) {
+		for(int c : id) {
+			childIdList.add(c);
+		}
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((childIdList == null) ? 0 : childIdList.hashCode());
+		result = prime * result + id;
+		result = prime * result + ((metrics == null) ? 0 : metrics.hashCode());
+		result = prime * result + ((name == null) ? 0 : name.hashCode());
+		result = prime * result + ((scope == null) ? 0 : scope.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		SonarResource other = (SonarResource) obj;
+		if (childIdList == null) {
+			if (other.childIdList != null)
+				return false;
+		} else if (!childIdList.equals(other.childIdList))
+			return false;
+		if (id != other.id)
+			return false;
+		if (metrics == null) {
+			if (other.metrics != null)
+				return false;
+		} else if (!metrics.equals(other.metrics))
+			return false;
+		if (name == null) {
+			if (other.name != null)
+				return false;
+		} else if (!name.equals(other.name))
+			return false;
+		if (scope != other.scope)
+			return false;
+		return true;
+	}
+
+	public enum Scope{
+		PRJ,
+		DIR,
+		FIL
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/index.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/index.html new file mode 100644 index 00000000..df314c47 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.sonarqube

codemetropolis.toolchain.converter.sonarqube

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,834 of 1,8340%172 of 1720%160160388388727288
SonarClient5440%420%3232120120101011
SonarQubeConverter4490%480%35359494101011
SonarResource2540%400%37376262171711
SonarRequest2260%160%21214444131311
SonarMetric.MetricType1400%n/a4413134411
SonarMetric1380%260%222240409911
SonarResource.Scope600%n/a44554411
SonarConnectException230%n/a5510105511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/index.source.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/index.source.html new file mode 100644 index 00000000..5d187645 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sonarqube/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.sonarqube

codemetropolis.toolchain.converter.sonarqube

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,834 of 1,8340%172 of 1720%160160388388727288
SonarClient.java5440%420%3232120120101011
SonarQubeConverter.java4490%480%35359494101011
SonarResource.java3140%400%41416767212122
SonarMetric.java2780%260%26265353131322
SonarRequest.java2260%160%21214444131311
SonarConnectException.java230%n/a5510105511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/GraphConverter.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/GraphConverter.html new file mode 100644 index 00000000..f2c8d245 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/GraphConverter.html @@ -0,0 +1 @@ +GraphConverter

GraphConverter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total161 of 1610%12 of 120%1212383855
createElementsRecursively(Node)500%20%228811
addProperties(Node, CdfElement)490%60%55161611
getChildNodes(Node)380%40%337711
createElements(String)200%n/a115511
GraphConverter(Map)40%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/GraphConverter.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/GraphConverter.java.html new file mode 100644 index 00000000..5ccb4947 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/GraphConverter.java.html @@ -0,0 +1,89 @@ +GraphConverter.java

GraphConverter.java

package codemetropolis.toolchain.converter.sourcemeter;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import codemetropolis.toolchain.commons.cdf.CdfElement;
+import codemetropolis.toolchain.commons.cdf.CdfTree;
+import codemetropolis.toolchain.commons.cdf.converter.CdfConverter;
+import codemetropolis.toolchain.commons.cdf.CdfProperty;
+import graphlib.Attribute;
+import graphlib.Attribute.AttributeIterator;
+import graphlib.AttributeFloat;
+import graphlib.AttributeInt;
+import graphlib.AttributeString;
+import graphlib.Edge.EdgeIterator;
+import graphlib.Edge.EdgeType;
+import graphlib.Edge.eDirectionType;
+import graphlib.Graph;
+import graphlib.Node;
+
+public class GraphConverter extends CdfConverter {
+	
+	public GraphConverter(Map<String, String> params) {
+		super(params);
+	}
+
+	private static final String ROOT_NODE_ID = "L100";
+	
+	@Override
+	public CdfTree createElements(String graphPath) {
+		Graph graph = new Graph();
+		graph.loadBinary(graphPath);
+		Node root = graph.findNode(ROOT_NODE_ID);
+		CdfElement rootElement = createElementsRecursively(root);
+		return new CdfTree(rootElement);
+	}
+	
+	private CdfElement createElementsRecursively(Node root) {
+		String name = ((AttributeString)root.findAttributeByName("Name").next()).getValue();
+		String type = root.getType().getType();
+		CdfElement element = new CdfElement(name, type);
+		element.setSourceId(root.getUID());
+		addProperties(root, element);
+		for(Node child : getChildNodes(root)) {
+			element.addChildElement(createElementsRecursively(child));
+		}
+		return element;
+	}
+
+	private Node[] getChildNodes(Node node) {
+		List<Node> childList = new ArrayList<Node>();
+		EdgeIterator it = node.findOutEdges(new EdgeType("LogicalTree", eDirectionType.edtDirectional));
+		while(it.hasNext()) {
+			Node childNode = it.next().getToNode();
+			if(!node.getUID().equals(childNode.getUID())) 
+				childList.add(childNode);
+		}
+		return childList.toArray(new Node[childList.size()]);
+	}
+	
+	private void addProperties(Node node, CdfElement element) {
+		AttributeIterator attributeIterator = node.getAttributes();
+		while(attributeIterator.hasNext()) {
+			Object value;
+			CdfProperty.Type type;
+			Attribute a = attributeIterator.next();
+			switch(a.getType()) {
+				case atString:
+					value = ((AttributeString)a).getValue();
+					type = CdfProperty.Type.STRING;
+					break;
+				case atInt:
+					value = ((AttributeInt)a).getValue();
+					type = CdfProperty.Type.INT;
+					break;
+				case atFloat:
+					value = ((AttributeFloat)a).getValue();
+					type = CdfProperty.Type.FLOAT;
+					break;
+				default:
+					continue;
+			}
+		    element.addProperty(a.getName(), String.valueOf(value), type);
+		}
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/index.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/index.html new file mode 100644 index 00000000..f7c33c33 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.sourcemeter

codemetropolis.toolchain.converter.sourcemeter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total161 of 1610%12 of 120%121238385511
GraphConverter1610%120%121238385511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/index.source.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/index.source.html new file mode 100644 index 00000000..7cb37952 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.sourcemeter/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter.sourcemeter

codemetropolis.toolchain.converter.sourcemeter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total161 of 1610%12 of 120%121238385511
GraphConverter.java1610%120%121238385511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/CommandLineOptions.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/CommandLineOptions.html new file mode 100644 index 00000000..e564ff70 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/CommandLineOptions.html @@ -0,0 +1 @@ +CommandLineOptions

CommandLineOptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total33 of 330%0 of 0n/a66111166
CommandLineOptions()180%n/a116611
getOutputFile()30%n/a111111
getType()30%n/a111111
getSource()30%n/a111111
showHelp()30%n/a111111
getParams()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/CommandLineOptions.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/CommandLineOptions.java.html new file mode 100644 index 00000000..0a4f694a --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/CommandLineOptions.java.html @@ -0,0 +1,44 @@ +CommandLineOptions.java

CommandLineOptions.java

package codemetropolis.toolchain.converter;
+
+import org.kohsuke.args4j.Option;
+import org.kohsuke.args4j.spi.StringArrayOptionHandler;
+
+public class CommandLineOptions {
+	
+	@Option(name="-h", aliases = { "--help" })
+	private boolean showHelp = false;
+	
+	@Option(name="-t", aliases = {"--type"})
+	private String type = null;
+	
+	@Option(name="-s", aliases = { "--source", "-i", "--input" })
+	private String source = null;
+	
+	@Option(name="-o", aliases = {"--output"})
+	private String outputFile = "converterToMapping.xml";
+	
+	@Option(name="-p", handler = StringArrayOptionHandler.class, aliases = {"--params"})
+	private String[] params = null;
+	
+	public String getOutputFile(){
+		return outputFile;
+	}
+	
+	public String getType() {
+		return type;
+	}
+
+	public String getSource() {
+		return source;
+	}
+
+	public boolean showHelp() {
+		return showHelp;
+	}
+
+	public String[] getParams() {
+		return params;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor$1.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor$1.html new file mode 100644 index 00000000..8221cb21 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor$1.html @@ -0,0 +1 @@ +ConverterExecutor.new ConverterEventListener() {...}

ConverterExecutor.new ConverterEventListener() {...}

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total14 of 140%0 of 0n/a224422
onConverterEvent(ConverterEvent)80%n/a112211
{...}60%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor.html new file mode 100644 index 00000000..78a8cfcc --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor.html @@ -0,0 +1 @@ +ConverterExecutor

ConverterExecutor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total87 of 870%0 of 0n/a22212122
execute(ExecutorArgs)840%n/a11202011
ConverterExecutor()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor.java.html new file mode 100644 index 00000000..2f13fc89 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutor.java.html @@ -0,0 +1,56 @@ +ConverterExecutor.java

ConverterExecutor.java

package codemetropolis.toolchain.converter;
+
+import codemetropolis.toolchain.commons.cdf.CdfTree;
+import codemetropolis.toolchain.commons.cdf.converter.CdfConverter;
+import codemetropolis.toolchain.commons.cdf.converter.ConverterEvent;
+import codemetropolis.toolchain.commons.cdf.converter.ConverterEventListener;
+import codemetropolis.toolchain.commons.cdf.exceptions.CdfWriterException;
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+import codemetropolis.toolchain.commons.executor.AbstractExecutor;
+import codemetropolis.toolchain.commons.executor.ExecutorArgs;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.converter.control.ConverterLoader;
+
+public class ConverterExecutor extends AbstractExecutor {
+	
+	@Override
+	public boolean execute(ExecutorArgs args) {
+		ConverterExecutorArgs converterArgs = (ConverterExecutorArgs) args;
+		
+		CdfConverter converter = ConverterLoader.load(converterArgs.getType(), converterArgs.getParams());
+		converter.addConverterEventListener(new ConverterEventListener() {
+			
+			@Override
+			public void onConverterEvent(ConverterEvent event) {
+				print(event.getMessage());
+			}
+			
+		});
+		
+		print(Resources.get("converting_to_cdf"));
+		CdfTree cdfTree = null;
+		try {
+			cdfTree = converter.createElements(converterArgs.getSource());
+		} catch (CodeMetropolisException e) {
+			printError(e, e.getMessage());
+			return false;
+		} catch (Exception e) {
+			printError(e, Resources.get("converter_error"));
+			return false;
+		}
+		print(Resources.get("converting_to_cdf_done"));
+		
+		print(Resources.get("printing_cdf"));
+		try {
+			cdfTree.writeToFile(converterArgs.getOutputFile());
+		} catch (CdfWriterException e) {
+			printError(e, Resources.get("cdf_writer_error"));
+			return false;
+		}
+		print(Resources.get("printing_cdf_done"));
+		
+		return true;
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutorArgs.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutorArgs.html new file mode 100644 index 00000000..4bfe6dcd --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutorArgs.html @@ -0,0 +1 @@ +ConverterExecutorArgs

ConverterExecutorArgs

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total43 of 430%0 of 0n/a77131377
ConverterExecutorArgs(ConverterType, String, String, Map)150%n/a116611
ConverterExecutorArgs(ConverterType, String, String)90%n/a112211
getParameter(String)60%n/a111111
getParams()40%n/a111111
getType()30%n/a111111
getSource()30%n/a111111
getOutputFile()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutorArgs.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutorArgs.java.html new file mode 100644 index 00000000..1336a062 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/ConverterExecutorArgs.java.html @@ -0,0 +1,50 @@ +ConverterExecutorArgs.java

ConverterExecutorArgs.java

package codemetropolis.toolchain.converter;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import codemetropolis.toolchain.commons.executor.ExecutorArgs;
+import codemetropolis.toolchain.converter.control.ConverterType;
+
+public class ConverterExecutorArgs extends ExecutorArgs {
+	
+	private ConverterType type;
+	private String source;
+	private String outputFile;
+	private Map<String, String> params;
+	
+	public ConverterExecutorArgs(ConverterType type, String source, String outputFile) {
+		this(type, source, outputFile, new HashMap<String, String>());
+	}
+	
+	public ConverterExecutorArgs(ConverterType type, String source, String outputFile, Map<String, String> params) {
+		super();
+		this.type = type;
+		this.source = source;
+		this.outputFile = outputFile;
+		this.params = params;
+	}
+
+	public ConverterType getType() {
+		return type;
+	}
+	
+	public String getSource() {
+		return source;
+	}
+
+	public String getOutputFile(){
+		return outputFile;
+	}
+	
+	public Map<String, String> getParams() {
+		return Collections.unmodifiableMap(params);
+	}
+	
+	public String getParameter(String key) {
+		return params.get(key);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/Main.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/Main.html new file mode 100644 index 00000000..f77908f5 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/Main.html @@ -0,0 +1 @@ +Main

Main

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total161 of 1610%10 of 100%77444422
main(String[])1580%100%66434311
Main()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/Main.java.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/Main.java.html new file mode 100644 index 00000000..2b056f5e --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/Main.java.html @@ -0,0 +1,81 @@ +Main.java

Main.java

package codemetropolis.toolchain.converter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+
+import codemetropolis.toolchain.commons.util.FileLogger;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.commons.util.Settings;
+import codemetropolis.toolchain.converter.control.ConverterType;
+
+public class Main {
+
+	public static void main(String[] args) {
+		
+		FileLogger.load(Settings.get("converter_log_file"));
+		
+		CommandLineOptions options = new CommandLineOptions();
+	    CmdLineParser parser = new CmdLineParser(options);
+
+	    try {
+	        parser.parseArgument(args);
+	        if(options.getType() == null || options.getSource() == null ){
+	        	throw new IllegalArgumentException();
+	        }
+	    } catch (CmdLineException | IllegalArgumentException e) {
+	    	String message = Resources.get("command_line_error");
+	    	FileLogger.logError(message, e);
+	    	System.err.println(message);
+	    	System.err.println(Resources.get("converter_usage"));
+	    	return;
+	    }
+	    
+	    ConverterType converterType = null;
+	    try {
+	    	converterType = ConverterType.valueOf(options.getType().toUpperCase());
+	    } catch(IllegalArgumentException e) {
+	    	String message = String.format("%s%s", Resources.get("error_prefix"), Resources.get("invalid_converter_type"));
+	    	System.err.println(message);
+	    	FileLogger.logError(message, e);
+	    	return;
+	    }
+	    
+	    Map<String, String> params = new HashMap<>();
+	    if(options.getParams() != null) {
+	    	try {
+	 		    String[] paramsArray = options.getParams();
+	 		    for(String str : paramsArray) {
+	 		    	String[] strParts = str.split("=");
+	 		    	params.put(strParts[0], strParts[1]);
+	 		    }
+	 	    } catch(Exception e) {
+	 	    	String message = Resources.get("invalid_params");
+	 	    	System.err.println(message);
+	 	    	FileLogger.logError(message, e);
+	 	    }
+	    }
+	    
+	    if(options.showHelp()) {
+	    	System.out.println(Resources.get("converter_introduction"));
+	    	System.out.println(Resources.get("converter_usage"));
+	    	return;
+	    }
+			
+	    ConverterExecutor executor = new ConverterExecutor();
+	    executor.setPrefix(Resources.get("converter_prefix"));
+	    executor.setErrorPrefix(Resources.get("error_prefix"));
+	    executor.execute(
+	    		new ConverterExecutorArgs(
+	    			converterType,
+		    		options.getSource(),
+		    		options.getOutputFile(),
+		    		params
+	    		));	
+		
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/index.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/index.html new file mode 100644 index 00000000..a1bf798a --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter

codemetropolis.toolchain.converter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total338 of 3380%10 of 100%24249292191955
Main1610%100%7744442211
ConverterExecutor870%n/a2221212211
ConverterExecutorArgs430%n/a7713137711
CommandLineOptions330%n/a6611116611
ConverterExecutor.new ConverterEventListener() {...}140%n/a22442211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/index.source.html b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/index.source.html new file mode 100644 index 00000000..b22c4989 --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.converter

codemetropolis.toolchain.converter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total338 of 3380%10 of 100%24249292191955
Main.java1610%100%7744442211
ConverterExecutor.java1010%n/a4424244422
ConverterExecutorArgs.java430%n/a7713137711
CommandLineOptions.java330%n/a6611116611
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-converter/src_main_java/index.html b/doc/codemetropolis-toolchain-converter/src_main_java/index.html new file mode 100644 index 00000000..2d41bd0b --- /dev/null +++ b/doc/codemetropolis-toolchain-converter/src_main_java/index.html @@ -0,0 +1 @@ +src/main/java

src/main/java

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total2,538 of 4,64245%221 of 28522%2293215611,0131031741630
codemetropolis.toolchain.converter.sonarqube1,8340%1720%160160388388727288
codemetropolis.toolchain.converter3380%100%24249292191955
codemetropolis.toolchain.converter.sourcemeter1610%120%121238385511
codemetropolis.toolchain.converter.control1000%50%101013136622
codemetropolis.toolchain.converter.gitinspector.test691,28494%82273%95322276138011
codemetropolis.toolchain.converter.browsinghistory2419188%132767%13285540801
codemetropolis.toolchain.converter.browsinghistory.test23595%n/a01337201301
codemetropolis.toolchain.converter.gitinspector394100%1593%12108001301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/index.html b/doc/codemetropolis-toolchain-gui/index.html new file mode 100644 index 00000000..40ed76a2 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/index.html @@ -0,0 +1 @@ +codemetropolis-toolchain-gui

codemetropolis-toolchain-gui

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total5,123 of 6,21117%195 of 25322%2943521,0711,2641832224154
src/main/java5,1231,08817%1955822%2943521,0711,2641832224154
src/main/resourcesn/an/a00000000
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/BadConfigFileFomatException.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/BadConfigFileFomatException.html new file mode 100644 index 00000000..be21b38e --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/BadConfigFileFomatException.html @@ -0,0 +1 @@ +BadConfigFileFomatException

BadConfigFileFomatException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total16 of 160%0 of 0n/a448844
BadConfigFileFomatException(String, Throwable)50%n/a112211
BadConfigFileFomatException(String)40%n/a112211
BadConfigFileFomatException(Throwable)40%n/a112211
BadConfigFileFomatException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/BadConfigFileFomatException.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/BadConfigFileFomatException.java.html new file mode 100644 index 00000000..f26ca163 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/BadConfigFileFomatException.java.html @@ -0,0 +1,41 @@ +BadConfigFileFomatException.java

BadConfigFileFomatException.java

package codemetropolis.toolchain.gui.beans;
+
+/**
+ * Exception class for handling exceptions that occur because of
+ * the bad format of the configuration file containing the buildable attributes desired to display.
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ */
+public class BadConfigFileFomatException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+	
+	/**
+	 * @see Exception#Exception()
+	 */
+	public BadConfigFileFomatException() {
+		
+	}
+	
+	/**
+	 * @see Exception#Exception(String)
+	 */
+	public BadConfigFileFomatException(String message) {
+		super(message);
+	}
+	
+	/**
+	 * @see Exception#Exception(Throwable)
+	 */
+	public BadConfigFileFomatException(Throwable cause) {
+	    super(cause);
+	}
+	
+	/**
+	 * @see Exception#Exception(String, Throwable)
+	 */
+	public BadConfigFileFomatException(String message, Throwable cause) {
+	    super(message, cause);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionException.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionException.html new file mode 100644 index 00000000..0e048ca7 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionException.html @@ -0,0 +1 @@ +ExecutionException

ExecutionException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total16 of 160%0 of 0n/a448844
ExecutionException(String, Throwable)50%n/a112211
ExecutionException(String)40%n/a112211
ExecutionException(Throwable)40%n/a112211
ExecutionException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionException.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionException.java.html new file mode 100644 index 00000000..017e056a --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionException.java.html @@ -0,0 +1,41 @@ +ExecutionException.java

ExecutionException.java

package codemetropolis.toolchain.gui.beans;
+
+/**
+ * Exception class for handling exceptions that occur during an execution.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class ExecutionException extends Exception {
+
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * @see Exception#Exception()
+   */
+  public ExecutionException() {
+
+  }
+
+  /**
+   * @see Exception#Exception(String)
+   */
+  public ExecutionException(String message) {
+    super(message);
+  }
+
+  /**
+   * @see Exception#Exception(Throwable)
+   */
+  public ExecutionException(Throwable cause) {
+    super(cause);
+  }
+
+  /**
+   * @see Exception#Exception(String, Throwable)
+   */
+  public ExecutionException(String message, Throwable cause) {
+    super(message, cause);
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionOptions.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionOptions.html new file mode 100644 index 00000000..82efeaab --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionOptions.html @@ -0,0 +1 @@ +ExecutionOptions

ExecutionOptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total86 of 860%0 of 0n/a191935351919
ExecutionOptions()230%n/a118811
setProjectName(String)40%n/a112211
setConverterType(ConverterType)40%n/a112211
setMetricGenerationParams(Map)40%n/a112211
setMappingXml(File)40%n/a112211
setScale(float)40%n/a112211
setValidate(boolean)40%n/a112211
setLayoutAlgorithm(LayoutAlgorithm)40%n/a112211
setShowMap(boolean)40%n/a112211
setMinecraftRoot(File)40%n/a112211
getProjectName()30%n/a111111
getConverterType()30%n/a111111
getMetricGenerationParams()30%n/a111111
getMappingXml()30%n/a111111
getScale()30%n/a111111
isValidate()30%n/a111111
getLayoutAlgorithm()30%n/a111111
isShowMap()30%n/a111111
getMinecraftRoot()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionOptions.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionOptions.java.html new file mode 100644 index 00000000..fe2a2d54 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/ExecutionOptions.java.html @@ -0,0 +1,121 @@ +ExecutionOptions.java

ExecutionOptions.java

package codemetropolis.toolchain.gui.beans;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import codemetropolis.toolchain.converter.control.ConverterType;
+import codemetropolis.toolchain.placing.layout.LayoutAlgorithm;
+
+/**
+ * Contains the parameters required for running the CodeMetropolis toolchain on a given project.
+ *
+ * @author Abel Szkalisity {@literal <SZAVAET.SZE>}
+ */
+public class ExecutionOptions {
+
+  // General
+  private String projectName;
+
+  // Converter tool
+  private ConverterType converterType;
+  private Map<String, Object> metricGenerationParams;
+
+  // Mapping tool
+  private File mappingXml;
+  private float scale;
+  private boolean validate;
+
+  // Placing tool
+  private LayoutAlgorithm layoutAlgorithm;
+  private boolean showMap;
+
+  // Rendering tool
+  private File minecraftRoot;
+
+  /**
+   * Constructs an {@link ExecutionOptions} instance with default values.
+   */
+  public ExecutionOptions() {
+    this.converterType = ConverterType.SOURCEMETER;
+    this.metricGenerationParams = new HashMap<String, Object>();
+    this.scale = 1.0f;
+    this.validate = false;
+    this.layoutAlgorithm = LayoutAlgorithm.PACK;
+    this.showMap = false;
+  }
+
+  public String getProjectName() {
+    return projectName;
+  }
+
+  public ConverterType getConverterType() {
+    return converterType;
+  }
+
+  public Map<String, Object> getMetricGenerationParams() {
+    return metricGenerationParams;
+  }
+
+  public File getMappingXml() {
+    return mappingXml;
+  }
+
+  public float getScale() {
+    return scale;
+  }
+
+  public boolean isValidate() {
+    return validate;
+  }
+
+  public LayoutAlgorithm getLayoutAlgorithm() {
+    return layoutAlgorithm;
+  }
+
+  public boolean isShowMap() {
+    return showMap;
+  }
+
+  public File getMinecraftRoot() {
+    return minecraftRoot;
+  }
+
+  public void setProjectName(String projectName) {
+    this.projectName = projectName;
+  }
+
+  public void setConverterType(ConverterType converterType) {
+    this.converterType = converterType;
+  }
+
+  public void setMetricGenerationParams(Map<String, Object> metricGenerationParams) {
+    this.metricGenerationParams = metricGenerationParams;
+  }
+
+  public void setMappingXml(File mappingXml) {
+    this.mappingXml = mappingXml;
+  }
+
+  public void setScale(float scale) {
+    this.scale = scale;
+  }
+
+  public void setValidate(boolean validate) {
+    this.validate = validate;
+  }
+
+  public void setLayoutAlgorithm(LayoutAlgorithm layoutAlgorithm) {
+    this.layoutAlgorithm = layoutAlgorithm;
+  }
+
+  public void setShowMap(boolean showMap) {
+    this.showMap = showMap;
+  }
+
+  public void setMinecraftRoot(File minecraftRoot) {
+    this.minecraftRoot = minecraftRoot;
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/QuantizationInformation.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/QuantizationInformation.html new file mode 100644 index 00000000..a8f51369 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/QuantizationInformation.html @@ -0,0 +1 @@ +QuantizationInformation

QuantizationInformation

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total18 of 4257%0 of 0n/a1811218
toString()180%n/a111111
setIndex(int)4100%n/a010201
setBuildableAttribute(String)4100%n/a010201
setMetric(String)4100%n/a010201
QuantizationInformation()3100%n/a010201
getIndex()3100%n/a010101
getBuildableAttribute()3100%n/a010101
getMetric()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/QuantizationInformation.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/QuantizationInformation.java.html new file mode 100644 index 00000000..dad350ef --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/QuantizationInformation.java.html @@ -0,0 +1,44 @@ +QuantizationInformation.java

QuantizationInformation.java

package codemetropolis.toolchain.gui.beans;
+
+/**
+ * Contains the quantization information.
+ *
+ * @author Tamas Keri {@literal <KETWAAT.SZE>}
+ */
+public class QuantizationInformation {
+	private int index;
+	private String buildableAttribute;
+	private String metric;
+
+	public QuantizationInformation() {
+	}
+
+	public int getIndex() {
+		return index;
+	}
+
+	public void setIndex(int index) {
+		this.index = index;
+	}
+
+	public String getBuildableAttribute() {
+		return buildableAttribute;
+	}
+
+	public void setBuildableAttribute(String buildableAttribute) {
+		this.buildableAttribute = buildableAttribute;
+	}
+
+	public String getMetric() {
+		return metric;
+	}
+
+	public void setMetric(String metric) {
+		this.metric = metric;
+	}
+
+	public String toString() {
+		return index + ";" + buildableAttribute + ";" + metric;
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/index.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/index.html new file mode 100644 index 00000000..df6c37d0 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.beans

codemetropolis.toolchain.gui.beans

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total136 of 16015%0 of 0n/a28355263283534
ExecutionOptions860%n/a19193535191911
QuantizationInformation182457%n/a181121801
BadConfigFileFomatException160%n/a44884411
ExecutionException160%n/a44884411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/index.source.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/index.source.html new file mode 100644 index 00000000..259ac60f --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.beans

codemetropolis.toolchain.gui.beans

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total136 of 16015%0 of 0n/a28355263283534
ExecutionOptions.java860%n/a19193535191911
QuantizationInformation.java182457%n/a181121801
ExecutionException.java160%n/a44884411
BadConfigFileFomatException.java160%n/a44884411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/BrowseListener.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/BrowseListener.html new file mode 100644 index 00000000..69534683 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/BrowseListener.html @@ -0,0 +1 @@ +BrowseListener

BrowseListener

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total34 of 340%4 of 40%44101022
BrowseListener(CMTextField, int, FileFilter)210%20%227711
actionPerformed(ActionEvent)130%20%223311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/BrowseListener.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/BrowseListener.java.html new file mode 100644 index 00000000..5fcdc261 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/BrowseListener.java.html @@ -0,0 +1,47 @@ +BrowseListener.java

BrowseListener.java

package codemetropolis.toolchain.gui.components.listeners;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+import codemetropolis.toolchain.gui.components.CMTextField;
+
+/**
+ * Listener class to handle file and directory browsing.
+ *
+ * @author Abel Szkalisity {@literal <SZAVAET.SZE>}
+ */
+public class BrowseListener implements ActionListener {
+
+  private JFileChooser fileChooser;
+  private CMTextField fileNameTextField;
+
+  /**
+   * Constructs a {@link BrowseListener} instance with the given parameters.
+   *
+   * @param fileNameTextField The {@link CMTextField} instance that will contain the path for the selected file.
+   * @param fileSelectionMode The file selection mode for the {@link JFileChooser}. See
+   *   {@link JFileChooser#setFileSelectionMode(int)} for details.
+   * @param filter Optional. If provided, it will be used for the {@link JFileChooser} to filter the visible entities.
+   */
+  public BrowseListener(CMTextField fileNameTextField, int fileSelectionMode, FileFilter filter) {
+    this.fileNameTextField = fileNameTextField;
+
+    this.fileChooser = new JFileChooser();
+    this.fileChooser.setFileSelectionMode(fileSelectionMode);
+    if (filter != null) {
+      this.fileChooser.setFileFilter(filter);
+    }
+  }
+
+  @Override
+  public void actionPerformed(ActionEvent event) {
+    if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
+      fileNameTextField.setText(fileChooser.getSelectedFile().getAbsolutePath());
+    }
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/index.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/index.html new file mode 100644 index 00000000..d234c33e --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.components.listeners

codemetropolis.toolchain.gui.components.listeners

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total34 of 340%4 of 40%4410102211
BrowseListener340%40%4410102211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/index.source.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/index.source.html new file mode 100644 index 00000000..ef11c333 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components.listeners/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.components.listeners

codemetropolis.toolchain.gui.components.listeners

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total34 of 340%4 of 40%4410102211
BrowseListener.java340%40%4410102211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMButton.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMButton.html new file mode 100644 index 00000000..97b55926 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMButton.html @@ -0,0 +1 @@ +CMButton

CMButton

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total25 of 250%0 of 0n/a337733
CMButton(String, int, int, int, int)100%n/a113311
static {...}80%n/a111111
CMButton(String)70%n/a113311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMButton.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMButton.java.html new file mode 100644 index 00000000..2b837d9c --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMButton.java.html @@ -0,0 +1,45 @@ +CMButton.java

CMButton.java

package codemetropolis.toolchain.gui.components;
+
+import java.awt.Font;
+
+import javax.swing.JButton;
+
+/**
+ * Custom button class for setting custom defaults for the JButtons we use.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class CMButton extends JButton {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final Font BUTTON_FONT = new Font("Source Sans Pro", Font.PLAIN, 16);
+
+  /**
+   * Constructs a {@link CMButton} instance.
+   *
+   * @param label The label for this button.
+   */
+  public CMButton(String label) {
+    super(label);
+
+    setFont(BUTTON_FONT);
+  }
+
+  /**
+   * Constructs a {@link CMButton} instance, and sets its position and size.
+   *
+   * @param label The label for this button.
+   * @param x The x position on the ui.
+   * @param y The y position on the ui.
+   * @param width The width of the element.
+   * @param height The height of the element.
+   */
+  public CMButton(String label, int x, int y, int width, int height) {
+    this(label);
+
+    setBounds(x, y, width, height);
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMCheckBox.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMCheckBox.html new file mode 100644 index 00000000..0edcbbad --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMCheckBox.html @@ -0,0 +1 @@ +CMCheckBox

CMCheckBox

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total15 of 150%0 of 0n/a226622
CMCheckBox(int, int, int, int)90%n/a113311
CMCheckBox()60%n/a113311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMCheckBox.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMCheckBox.java.html new file mode 100644 index 00000000..18becb1a --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMCheckBox.java.html @@ -0,0 +1,36 @@ +CMCheckBox.java

CMCheckBox.java

package codemetropolis.toolchain.gui.components;
+
+import javax.swing.JCheckBox;
+
+/**
+ * Custom checkbox class for setting custom defaults for the JCheckBoxes we use.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class CMCheckBox extends JCheckBox {
+
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Constructs a {@link CMButton} instance.
+   */
+  public CMCheckBox() {
+    setOpaque(false);
+  }
+
+  /**
+   * Constructs a {@link CMCheckBox} instance, and sets its position and size.
+   *
+   * @param x The x position on the ui.
+   * @param y The y position on the ui.
+   * @param width The width of the element.
+   * @param height The height of the element.
+   */
+  public CMCheckBox(int x, int y, int width, int height) {
+    this();
+
+    setBounds(x, y, width, height);
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMComboBox.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMComboBox.html new file mode 100644 index 00000000..65c6fd01 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMComboBox.html @@ -0,0 +1 @@ +CMComboBox

CMComboBox

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total25 of 250%0 of 0n/a337733
CMComboBox(Object[], int, int, int, int)100%n/a113311
static {...}80%n/a111111
CMComboBox(Object[])70%n/a113311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMComboBox.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMComboBox.java.html new file mode 100644 index 00000000..6963faf4 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMComboBox.java.html @@ -0,0 +1,46 @@ +CMComboBox.java

CMComboBox.java

package codemetropolis.toolchain.gui.components;
+
+import java.awt.Font;
+
+import javax.swing.JComboBox;
+
+/**
+ * Custom combobox class for setting custom defaults for the JComboBoxes we use.
+ *
+ * @param <T> The type parameter for the {@link JComboBox}.
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class CMComboBox<T> extends JComboBox<T> {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final Font COMBO_BOX_FONT = new Font("Source Sans Pro", Font.PLAIN, 16);
+
+  /**
+   * Constructs a {@link CMComboBox} instance.
+   *
+   * @param items The desired contents of this combobox.
+   */
+  public CMComboBox(T[] items) {
+    super(items);
+
+    setFont(COMBO_BOX_FONT);
+  }
+
+  /**
+   * Constructs a {@link CMComboBox} instance, and sets its position and size.
+   *
+   * @param items The desired contents of this combobox.
+   * @param x The x position on the ui.
+   * @param y The y position on the ui.
+   * @param width The width of the element.
+   * @param height The height of the element.
+   */
+  public CMComboBox(T[] items, int x, int y, int width, int height) {
+    this(items);
+
+    setBounds(x, y, width, height);
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMLabel.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMLabel.html new file mode 100644 index 00000000..56693693 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMLabel.html @@ -0,0 +1 @@ +CMLabel

CMLabel

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total25 of 250%0 of 0n/a337733
CMLabel(String, int, int, int, int)100%n/a113311
static {...}80%n/a111111
CMLabel(String)70%n/a113311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMLabel.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMLabel.java.html new file mode 100644 index 00000000..79e46e55 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMLabel.java.html @@ -0,0 +1,45 @@ +CMLabel.java

CMLabel.java

package codemetropolis.toolchain.gui.components;
+
+import java.awt.Font;
+
+import javax.swing.JLabel;
+
+/**
+ * Custom label class for setting custom defaults for the JLabels we use.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class CMLabel extends JLabel {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final Font LABEL_FONT = new Font("Source Sans Pro", Font.PLAIN, 16);
+
+  /**
+   * Constructs a {@link CMLabel} instance.
+   *
+   * @param label The text for this label.
+   */
+  public CMLabel(String label) {
+    super(label);
+
+    setFont(LABEL_FONT);
+  }
+
+  /**
+   * Constructs a {@link CMLabel} instance, and sets its position and size.
+   *
+   * @param label The text for this label.
+   * @param x The x position on the ui.
+   * @param y The y position on the ui.
+   * @param width The width of the element.
+   * @param height The height of the element.
+   */
+  public CMLabel(String label, int x, int y, int width, int height) {
+    this(label);
+
+    setBounds(x, y, width, height);
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMMetricPanel.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMMetricPanel.html new file mode 100644 index 00000000..700099c4 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMMetricPanel.html @@ -0,0 +1 @@ +CMMetricPanel

CMMetricPanel

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total17 of 170%0 of 0n/a557755
setTabTitle(String)40%n/a112211
setConverterType(ConverterType)40%n/a112211
CMMetricPanel()30%n/a111111
getTabTitle()30%n/a111111
getConverterType()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMMetricPanel.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMMetricPanel.java.html new file mode 100644 index 00000000..cefce852 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMMetricPanel.java.html @@ -0,0 +1,53 @@ +CMMetricPanel.java

CMMetricPanel.java

package codemetropolis.toolchain.gui.components;
+
+import javax.swing.JPanel;
+
+import codemetropolis.toolchain.converter.control.ConverterType;
+import codemetropolis.toolchain.gui.beans.ExecutionOptions;
+
+/**
+ * Extension to JPanel, as we need to store to which metric generator (SourceMeter, SonarQube) this panel provides
+ * options for. Can also validate the fields and fill them into a gievn {@link ExecutionOptions} instance.
+ *
+ * @author Abel Szkalisity {@literal <SZAVAET.SZE>}
+ */
+public abstract class CMMetricPanel extends JPanel {
+
+  private static final long serialVersionUID = 1L;
+
+  protected String tabTitle;
+  protected ConverterType converterType;
+
+  /**
+   * Fills the given {@link ExecutionOptions} instance with data from the panel.
+   *
+   * @param executionOptions The target {@link ExecutionOptions} instance.
+   */
+  public abstract void fillFields(ExecutionOptions executionOptions);
+
+  /**
+   * Validates the given {@link ExecutionOptions} instance.
+   *
+   * @param executionOptions The instance to validate.
+   * @return True, if the options related to this panel are existent and valid, false otherwise.
+   */
+  public abstract boolean validateFields(ExecutionOptions executionOptions);
+
+  public String getTabTitle() {
+    return tabTitle;
+  }
+
+  public ConverterType getConverterType() {
+    return converterType;
+  }
+
+  public void setTabTitle(String tabTitle) {
+    this.tabTitle = tabTitle;
+  }
+
+  public void setConverterType(ConverterType converterType) {
+    this.converterType = converterType;
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMPasswordField.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMPasswordField.html new file mode 100644 index 00000000..e1f8d800 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMPasswordField.html @@ -0,0 +1 @@ +CMPasswordField

CMPasswordField

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total26 of 260%0 of 0n/a338833
CMPasswordField()90%n/a114411
CMPasswordField(int, int, int, int)90%n/a113311
static {...}80%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMPasswordField.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMPasswordField.java.html new file mode 100644 index 00000000..d3c3a0c1 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMPasswordField.java.html @@ -0,0 +1,41 @@ +CMPasswordField.java

CMPasswordField.java

package codemetropolis.toolchain.gui.components;
+
+import java.awt.Font;
+
+import javax.swing.JPasswordField;
+
+/**
+ * Custom passwordField class for setting custom defaults for the JPasswordFields we use.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class CMPasswordField extends JPasswordField {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final Font PASSWORD_FIELD_FONT = new Font("Source Sans Pro", Font.PLAIN, 14);
+
+  /**
+   * Constructs a {@link CMPasswordField} instance.
+   */
+  public CMPasswordField() {
+    setEchoChar('*');
+    setFont(PASSWORD_FIELD_FONT);
+  }
+
+  /**
+   * Constructs a {@link CMPasswordField} instance, and sets its position and size.
+   *
+   * @param x The x position on the ui.
+   * @param y The y position on the ui.
+   * @param width The width of the element.
+   * @param height The height of the element.
+   */
+  public CMPasswordField(int x, int y, int width, int height) {
+    this();
+
+    setBounds(x, y, width, height);
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMScrollPane.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMScrollPane.html new file mode 100644 index 00000000..e83e4766 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMScrollPane.html @@ -0,0 +1 @@ +CMScrollPane

CMScrollPane

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total40 of 400%0 of 0n/a44121244
CMScrollPane(JList, int, int, int, int)130%n/a114411
CMScrollPane(JTable, int, int, int, int)130%n/a114411
static {...}80%n/a111111
CMScrollPane()60%n/a113311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMScrollPane.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMScrollPane.java.html new file mode 100644 index 00000000..b0da7460 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMScrollPane.java.html @@ -0,0 +1,54 @@ +CMScrollPane.java

CMScrollPane.java

package codemetropolis.toolchain.gui.components;
+
+import java.awt.Font;
+
+import javax.swing.JList;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+
+/**
+ * Custom scroll pane class for setting custom defaults for the JComboBoxes we use.
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE}
+ */
+public class CMScrollPane extends JScrollPane {
+
+	private static final long serialVersionUID = 1L;
+	
+	private static final Font SCROLL_PANE_FONT = new Font("Source Sans Pro", Font.PLAIN, 14);
+	
+	/**
+	 * Constructs a {@link CMScrollPane} instance.
+	 */
+	public CMScrollPane() {
+		setFont(SCROLL_PANE_FONT);
+	}
+	
+	/**
+	 * Constructs a {@link CMScrollPane} instance and sets its dimensions and position.
+	 * @param list {@link JList} which the scroll pane will contain.
+	 * @param x The x position on the UI.
+	 * @param y The y position on the UI.
+	 * @param width The width of the element.
+	 * @param height The height of the element.
+	 */
+	public CMScrollPane(JList<String> list, int x, int y, int width, int height) {
+		super(list);
+		setFont(SCROLL_PANE_FONT);
+		setBounds(x, y, width, height);
+	}
+	
+	/**
+	 * Constructs a {@link CMScrollPane} instance and sets its dimensions and position.
+	 * @param table {@link JTable} which the scroll pane will contain.
+	 * @param x The x position on the UI.
+	 * @param y The y position on the UI.
+	 * @param width The width of the element.
+	 * @param height The height of the element.
+	 */
+	public CMScrollPane(JTable table, int x, int y, int width, int height) {
+		super(table);
+		setFont(SCROLL_PANE_FONT);
+		setBounds(x, y, width, height);
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMSpinner.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMSpinner.html new file mode 100644 index 00000000..1440456b --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMSpinner.html @@ -0,0 +1 @@ +CMSpinner

CMSpinner

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total32 of 320%0 of 0n/a338833
CMSpinner()150%n/a114411
CMSpinner(int, int, int, int)90%n/a113311
static {...}80%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMSpinner.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMSpinner.java.html new file mode 100644 index 00000000..ba9a2740 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMSpinner.java.html @@ -0,0 +1,46 @@ +CMSpinner.java

CMSpinner.java

package codemetropolis.toolchain.gui.components;
+
+import java.awt.Font;
+
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+
+import codemetropolis.toolchain.mapping.MappingExecutor;
+
+/**
+ * Custom numeric input class for setting custom defaults for the JSpinners we use.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class CMSpinner extends JSpinner {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final Font SPINNER_FONT = new Font("Source Sans Pro", Font.PLAIN, 14);
+
+  /**
+   * Constructs a {@link CMSpinner} instance.
+   */
+  public CMSpinner() {
+    super();
+
+    setFont(SPINNER_FONT);
+    setModel(new SpinnerNumberModel(1.0, MappingExecutor.MIN_SCALE, MappingExecutor.MAX_SCALE, 0.01));
+  }
+
+  /**
+   * Constructs a {@link CMSpinner} instance, and sets its position and size.
+   *
+   * @param x The x position on the ui.
+   * @param y The y position on the ui.
+   * @param width The width of the element.
+   * @param height The height of the element.
+   */
+  public CMSpinner(int x, int y, int width, int height) {
+    this();
+
+    setBounds(x, y, width, height);
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextArea.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextArea.html new file mode 100644 index 00000000..276026df --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextArea.html @@ -0,0 +1 @@ +CMTextArea

CMTextArea

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a337733
CMTextArea(int, int, int, int)90%n/a113311
static {...}80%n/a111111
CMTextArea()60%n/a113311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextArea.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextArea.java.html new file mode 100644 index 00000000..1a028057 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextArea.java.html @@ -0,0 +1,40 @@ +CMTextArea.java

CMTextArea.java

package codemetropolis.toolchain.gui.components;
+
+import java.awt.Font;
+
+import javax.swing.JTextArea;
+
+/**
+ * Custom textArea class for setting custom defaults for the JTextAreas we use.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class CMTextArea extends JTextArea {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final Font TEXT_AREA_FONT = new Font("Source Sans Pro", Font.PLAIN, 14);
+
+  /**
+   * Constructs a {@link CMTextArea} instance.
+   */
+  public CMTextArea() {
+    setFont(TEXT_AREA_FONT);
+  }
+
+  /**
+   * Constructs a {@link CMTextArea} instance.
+   *
+   * @param x The x position on the ui.
+   * @param y The y position on the ui.
+   * @param width The width of the element.
+   * @param height The height of the element.
+   */
+  public CMTextArea(int x, int y, int width, int height) {
+    this();
+
+    setBounds(x, y, width, height);
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextField.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextField.html new file mode 100644 index 00000000..afb5b0c2 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextField.html @@ -0,0 +1 @@ +CMTextField

CMTextField

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a337733
CMTextField(int, int, int, int)90%n/a113311
static {...}80%n/a111111
CMTextField()60%n/a113311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextField.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextField.java.html new file mode 100644 index 00000000..d2e1ef49 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/CMTextField.java.html @@ -0,0 +1,40 @@ +CMTextField.java

CMTextField.java

package codemetropolis.toolchain.gui.components;
+
+import java.awt.Font;
+
+import javax.swing.JTextField;
+
+/**
+ * Custom textField class for setting custom defaults for the JTextFields we use.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class CMTextField extends JTextField {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final Font TEXT_FIELD_FONT = new Font("Source Sans Pro", Font.PLAIN, 14);
+
+  /**
+   * Constructs a {@link CMTextField} instance.
+   */
+  public CMTextField() {
+    setFont(TEXT_FIELD_FONT);
+  }
+
+  /**
+   * Constructs a {@link CMTextField} instance.
+   *
+   * @param x The x position on the ui.
+   * @param y The y position on the ui.
+   * @param width The width of the element.
+   * @param height The height of the element.
+   */
+  public CMTextField(int x, int y, int width, int height) {
+    this();
+
+    setBounds(x, y, width, height);
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/index.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/index.html new file mode 100644 index 00000000..0295b330 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.components

codemetropolis.toolchain.gui.components

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total251 of 2510%0 of 0n/a3232767632321010
CMScrollPane400%n/a4412124411
CMSpinner320%n/a33883311
CMPasswordField260%n/a33883311
CMLabel250%n/a33773311
CMComboBox250%n/a33773311
CMButton250%n/a33773311
CMTextField230%n/a33773311
CMTextArea230%n/a33773311
CMMetricPanel170%n/a55775511
CMCheckBox150%n/a22662211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/index.source.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/index.source.html new file mode 100644 index 00000000..13bd6344 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.components/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.components

codemetropolis.toolchain.gui.components

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total251 of 2510%0 of 0n/a3232767632321010
CMScrollPane.java400%n/a4412124411
CMSpinner.java320%n/a33883311
CMPasswordField.java260%n/a33883311
CMButton.java250%n/a33773311
CMLabel.java250%n/a33773311
CMComboBox.java250%n/a33773311
CMTextField.java230%n/a33773311
CMTextArea.java230%n/a33773311
CMMetricPanel.java170%n/a55775511
CMCheckBox.java150%n/a22662211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/Conversion.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/Conversion.html new file mode 100644 index 00000000..584925e5 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/Conversion.html @@ -0,0 +1 @@ +Conversion

Conversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 3100%0 of 0n/a010101
Conversion()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/Conversion.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/Conversion.java.html new file mode 100644 index 00000000..613ccf99 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/Conversion.java.html @@ -0,0 +1,11 @@ +Conversion.java

Conversion.java

package codemetropolis.toolchain.gui.conversions;
+
+/**
+ * Abstract base class for representing the various types of conversions.
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ *
+ */
+public abstract class Conversion {
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/EmptyConversion.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/EmptyConversion.html new file mode 100644 index 00000000..6e88e5ae --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/EmptyConversion.html @@ -0,0 +1 @@ +EmptyConversion

EmptyConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 3100%0 of 0n/a010101
EmptyConversion()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/EmptyConversion.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/EmptyConversion.java.html new file mode 100644 index 00000000..a76d81e2 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/EmptyConversion.java.html @@ -0,0 +1,11 @@ +EmptyConversion.java

EmptyConversion.java

package codemetropolis.toolchain.gui.conversions;
+
+/**
+ * Class for representing an empty conversion (when there is no conversion needed).
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ *
+ */
+public class EmptyConversion extends Conversion {
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/NormalizeConversion.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/NormalizeConversion.html new file mode 100644 index 00000000..a7ef1e64 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/NormalizeConversion.html @@ -0,0 +1 @@ +NormalizeConversion

NormalizeConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total3 of 30%0 of 0n/a111111
NormalizeConversion()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/NormalizeConversion.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/NormalizeConversion.java.html new file mode 100644 index 00000000..af7d4f09 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/NormalizeConversion.java.html @@ -0,0 +1,11 @@ +NormalizeConversion.java

NormalizeConversion.java

package codemetropolis.toolchain.gui.conversions;
+
+/**
+ * Class for representing a normalize conversion.
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ *
+ */
+public class NormalizeConversion extends Conversion {
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/QuantizationConversion.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/QuantizationConversion.html new file mode 100644 index 00000000..761f82ba --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/QuantizationConversion.html @@ -0,0 +1 @@ +QuantizationConversion

QuantizationConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total11 of 110%0 of 0n/a224422
QuantizationConversion()80%n/a113311
getLevels()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/QuantizationConversion.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/QuantizationConversion.java.html new file mode 100644 index 00000000..8e3aa284 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/QuantizationConversion.java.html @@ -0,0 +1,21 @@ +QuantizationConversion.java

QuantizationConversion.java

package codemetropolis.toolchain.gui.conversions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Class for representing a quantization conversion.
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ */
+public class QuantizationConversion extends Conversion {
+	private List<String> levels;
+	
+	public QuantizationConversion() {
+		levels = new ArrayList<String>();		
+	}
+	
+	public List<String> getLevels(){
+		return levels;
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToDoubleConversion.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToDoubleConversion.html new file mode 100644 index 00000000..b221d869 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToDoubleConversion.html @@ -0,0 +1 @@ +ToDoubleConversion

ToDoubleConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total3 of 30%0 of 0n/a111111
ToDoubleConversion()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToDoubleConversion.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToDoubleConversion.java.html new file mode 100644 index 00000000..d4a362e8 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToDoubleConversion.java.html @@ -0,0 +1,10 @@ +ToDoubleConversion.java

ToDoubleConversion.java

package codemetropolis.toolchain.gui.conversions;
+
+/**
+ * Class for representing a toDouble conversion.
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ */
+public class ToDoubleConversion extends Conversion{
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToIntConversion.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToIntConversion.html new file mode 100644 index 00000000..fe1fe203 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToIntConversion.html @@ -0,0 +1 @@ +ToIntConversion

ToIntConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total3 of 30%0 of 0n/a111111
ToIntConversion()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToIntConversion.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToIntConversion.java.html new file mode 100644 index 00000000..8a14ce61 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/ToIntConversion.java.html @@ -0,0 +1,10 @@ +ToIntConversion.java

ToIntConversion.java

package codemetropolis.toolchain.gui.conversions;
+
+/**
+ * Class for representing a toInt conversion.
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ */
+public class ToIntConversion extends Conversion {
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/index.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/index.html new file mode 100644 index 00000000..835ebdcc --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.conversions

codemetropolis.toolchain.gui.conversions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total20 of 2623%0 of 0n/a57795746
QuantizationConversion110%n/a22442211
NormalizeConversion30%n/a11111111
ToDoubleConversion30%n/a11111111
ToIntConversion30%n/a11111111
EmptyConversion3100%n/a01010101
Conversion3100%n/a01010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/index.source.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/index.source.html new file mode 100644 index 00000000..d3276bc0 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.conversions

codemetropolis.toolchain.gui.conversions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total20 of 2623%0 of 0n/a57795746
QuantizationConversion.java110%n/a22442211
ToDoubleConversion.java30%n/a11111111
NormalizeConversion.java30%n/a11111111
ToIntConversion.java30%n/a11111111
Conversion.java3100%n/a01010101
EmptyConversion.java3100%n/a01010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/ConverterToolExecutor.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/ConverterToolExecutor.html new file mode 100644 index 00000000..1a5b9b6d --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/ConverterToolExecutor.html @@ -0,0 +1 @@ +ConverterToolExecutor

ConverterToolExecutor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total203 of 2030%15 of 150%1313383855
findSourceMeterGraphPath(File)620%60%446611
convertParams(ExecutionOptions)550%40%33101011
assembleArguments(File, ExecutionOptions)470%30%33111111
execute(File, ExecutionOptions, PrintStream)360%20%22101011
ConverterToolExecutor()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/ConverterToolExecutor.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/ConverterToolExecutor.java.html new file mode 100644 index 00000000..aeec6c0e --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/ConverterToolExecutor.java.html @@ -0,0 +1,119 @@ +ConverterToolExecutor.java

ConverterToolExecutor.java

package codemetropolis.toolchain.gui.executors;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import codemetropolis.toolchain.commons.util.FileLogger;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.commons.util.Settings;
+import codemetropolis.toolchain.converter.ConverterExecutor;
+import codemetropolis.toolchain.converter.ConverterExecutorArgs;
+import codemetropolis.toolchain.gui.beans.ExecutionException;
+import codemetropolis.toolchain.gui.beans.ExecutionOptions;
+import codemetropolis.toolchain.gui.utils.Translations;
+
+/**
+ * {@link ToolchainExecutor} implementation for the converter tool.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class ConverterToolExecutor implements ToolchainExecutor {
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void execute(File cmRoot, ExecutionOptions executionOptions, PrintStream out) throws ExecutionException {
+    FileLogger.load(Settings.get("converter_log_file"));
+
+    ConverterExecutorArgs args = assembleArguments(cmRoot, executionOptions);
+    ConverterExecutor executor = new ConverterExecutor();
+    executor.setPrintStream(out);
+    executor.setErrorStream(out);
+    executor.setPrefix(Resources.get("converter_prefix"));
+    executor.setErrorPrefix(Resources.get("error_prefix"));
+    if (!executor.execute(args)) {
+      throw new ExecutionException("Failed to complete convert step!");
+    }
+  }
+
+  /**
+   * Converts the parameters from UI to match the names and types used by the {@link ConverterExecutor}.
+   *
+   * @param executionOptions The {@link ExecutionOptions} instance.
+   * @return The converted parameter map.
+   */
+  private Map<String, String> convertParams(ExecutionOptions executionOptions) {
+    Map<String, String> params = new HashMap<String, String>();
+    Map<String, Object> executionParams = executionOptions.getMetricGenerationParams();
+
+    switch (executionOptions.getConverterType()) {
+      case SONARQUBE:
+        boolean splitDirs = (boolean) executionParams.get("splitDirs");
+        params.put("username", executionParams.get("username").toString());
+        params.put("password", executionParams.get("password").toString());
+        params.put("projects", executionParams.get("projects").toString());
+        params.put("splitDirs", splitDirs ? "true" : "false");
+        break;
+      default:
+        break;
+    }
+
+    return params;
+  }
+
+  /**
+   * Creates the {@link ConverterExecutorArgs} instance that will be used for the execution of the converter tool.
+   *
+   * @param cmRoot The path of the folder used to store the intermediate files in.
+   * @param executionOptions The {@link ExecutionOptions} instance.
+   * @return The assembled {@link ConverterExecutorArgs} object which will be used for execution.
+   * @throws ExecutionException if the {@link codemetropolis.toolchain.converter.control.ConverterType} in the
+   *   {@code executionOptions} is unhandled.
+   */
+  private ConverterExecutorArgs assembleArguments(File cmRoot, ExecutionOptions executionOptions)
+      throws ExecutionException {
+
+    String source = "";
+    switch (executionOptions.getConverterType()) {
+      case SOURCEMETER:
+        source = findSourceMeterGraphPath(cmRoot);
+        break;
+      case SONARQUBE:
+        source = executionOptions.getMetricGenerationParams().get("url").toString();
+        break;
+      default:
+        throw new ExecutionException(Translations.t("gui_err_unhandled_metric_source"));
+    }
+
+    return new ConverterExecutorArgs(
+      executionOptions.getConverterType(),
+      source,
+      cmRoot.getAbsolutePath() + File.separator + "converter-results.xml",
+      convertParams(executionOptions));
+  }
+
+  /**
+   * Attempts to find the graph file in the source-meter folder. Traversed through
+   * source-meter/<project>/<language>/<timestamp>/ folders to find the actual contents.
+   *
+   * @param cmRoot The path of the folder used to store the intermediate files in.
+   * @return The path of the graph file, if found.
+   * @throws ExecutionException if the graph file was not found.
+   */
+  private String findSourceMeterGraphPath(File cmRoot) throws ExecutionException {
+    File project = new File(cmRoot.getAbsolutePath() + File.separator + "source-meter").listFiles()[0];
+    File contents = project.listFiles()[0].listFiles()[0];
+
+    File graph = new File(contents.getAbsolutePath() + File.separator + project.getName() + ".graph");
+    if (graph.exists() && graph.isFile() && graph.canRead()) {
+      return graph.getAbsolutePath();
+    } else {
+      throw new ExecutionException(Translations.t("gui_err_graph_not_found"));
+    }
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MappingToolExecutor.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MappingToolExecutor.html new file mode 100644 index 00000000..3ee937b3 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MappingToolExecutor.html @@ -0,0 +1 @@ +MappingToolExecutor

MappingToolExecutor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total73 of 730%2 of 20%44171733
execute(File, ExecutionOptions, PrintStream)360%20%22101011
assembleArguments(File, ExecutionOptions)340%n/a116611
MappingToolExecutor()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MappingToolExecutor.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MappingToolExecutor.java.html new file mode 100644 index 00000000..1616818d --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MappingToolExecutor.java.html @@ -0,0 +1,56 @@ +MappingToolExecutor.java

MappingToolExecutor.java

package codemetropolis.toolchain.gui.executors;
+
+import java.io.File;
+import java.io.PrintStream;
+
+import codemetropolis.toolchain.commons.util.FileLogger;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.commons.util.Settings;
+import codemetropolis.toolchain.gui.beans.ExecutionException;
+import codemetropolis.toolchain.gui.beans.ExecutionOptions;
+import codemetropolis.toolchain.mapping.MappingExecutor;
+import codemetropolis.toolchain.mapping.MappingExecutorArgs;
+
+/**
+ * {@link ToolchainExecutor} implementation for the mapping tool.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class MappingToolExecutor implements ToolchainExecutor {
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void execute(File cmRoot, ExecutionOptions executionOptions, PrintStream out) throws ExecutionException {
+    FileLogger.load(Settings.get("mapping_log_file"));
+
+    MappingExecutorArgs args = assembleArguments(cmRoot, executionOptions);
+    MappingExecutor executor = new MappingExecutor();
+    executor.setPrintStream(out);
+    executor.setErrorStream(out);
+    executor.setPrefix(Resources.get("mapping_prefix"));
+    executor.setErrorPrefix(Resources.get("error_prefix"));
+    if (!executor.execute(args)) {
+      throw new ExecutionException("Failed to complete mapping step!");
+    }
+  }
+
+  /**
+   * Creates the {@link MappingExecutorArgs} instance that will be used for the execution of the mapping tool.
+   *
+   * @param cmRoot The path of the folder used to store the intermediate files in.
+   * @param executionOptions The {@link ExecutionOptions} instance.
+   * @return The assembled {@link MappingExecutorArgs} object which will be used for execution.
+   */
+  private MappingExecutorArgs assembleArguments(File cmRoot, ExecutionOptions executionOptions) {
+    return new MappingExecutorArgs(
+      cmRoot.getAbsolutePath() + File.separator + "converter-results.xml",
+      cmRoot.getAbsolutePath() + File.separator + "mapping-results.xml",
+      executionOptions.getMappingXml().getAbsolutePath(),
+      executionOptions.getScale(),
+      executionOptions.isValidate());
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MetricGeneratorExecutor.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MetricGeneratorExecutor.html new file mode 100644 index 00000000..269c523d --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MetricGeneratorExecutor.html @@ -0,0 +1 @@ +MetricGeneratorExecutor

MetricGeneratorExecutor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total142 of 1420%7 of 70%88262644
executeSourceMeter(File, ExecutionOptions)900%20%22141411
createResultsDir(File)260%20%224411
execute(File, ExecutionOptions, PrintStream)230%30%337711
MetricGeneratorExecutor()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MetricGeneratorExecutor.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MetricGeneratorExecutor.java.html new file mode 100644 index 00000000..c6aab8e4 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/MetricGeneratorExecutor.java.html @@ -0,0 +1,81 @@ +MetricGeneratorExecutor.java

MetricGeneratorExecutor.java

package codemetropolis.toolchain.gui.executors;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Map;
+
+import codemetropolis.toolchain.gui.beans.ExecutionException;
+import codemetropolis.toolchain.gui.beans.ExecutionOptions;
+import codemetropolis.toolchain.gui.utils.Translations;
+
+/**
+ * {@link ToolchainExecutor} implementation for the metric generation.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class MetricGeneratorExecutor implements ToolchainExecutor {
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void execute(File cmRoot, ExecutionOptions executionOptions, PrintStream out) throws ExecutionException {
+    switch (executionOptions.getConverterType()) {
+      case SOURCEMETER:
+        out.println(Translations.t("gui_info_sm_exec_started"));
+        executeSourceMeter(cmRoot, executionOptions);
+        break;
+      case SONARQUBE:
+        // Will be executed by the converter tool
+        break;
+      default:
+        throw new ExecutionException(Translations.t("gui_err_invalid_converter"));
+    }
+  }
+
+  /**
+   * Executes the SourceMeter exe file with the proper parameters.
+   *
+   * @param cmRoot The path of the folder used to store the intermediate files in.
+   * @param executionOptions The {@link ExecutionOptions} instance.
+   * @throws ExecutionException if it fails to run SourceMeter, or if the process returns with an error code.
+   */
+  private void executeSourceMeter(File cmRoot, ExecutionOptions executionOptions) throws ExecutionException {
+    Map<String, Object> params = executionOptions.getMetricGenerationParams();
+    File sourceMeterExe = (File) params.get("sourceMeterExe");
+    File projectRoot = (File) params.get("projectRoot");
+
+    try {
+      File resultsDir = createResultsDir(cmRoot);
+      ProcessBuilder processBuilder = new ProcessBuilder(sourceMeterExe.getAbsolutePath(),
+        "-projectName=\"" + executionOptions.getProjectName() + "\"",
+        "-projectBaseDir=\"" + projectRoot.getAbsolutePath() + "\"",
+        "-resultsDir=\"" + resultsDir.getAbsolutePath() + "\"");
+
+      if (processBuilder.start().waitFor() != 0) {
+        throw new ExecutionException(Translations.t("gui_err_sm_exec_failed"));
+      }
+    } catch (IOException | InterruptedException e) {
+      throw new ExecutionException(Translations.t("gui_err_sm_run_failed"), e);
+    }
+  }
+
+  /**
+   * Creates a directory for the SourceMeter results in the {@code cmRoot} folder.
+   *
+   * @param cmRoot The path of the folder used to store the intermediate files in.
+   * @return The folder for the SourceMeter results.
+   * @throws ExecutionException if it fails to actually create the folder.
+   */
+  private File createResultsDir(File cmRoot) throws ExecutionException {
+    File resultsDir = new File(cmRoot.getAbsolutePath() + File.separator + "source-meter");
+    if (!resultsDir.mkdir()) {
+      throw new ExecutionException(Translations.t("gui_err_mkdir_failed"));
+    }
+
+    return resultsDir;
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/PlacingToolExecutor.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/PlacingToolExecutor.html new file mode 100644 index 00000000..a3c258ee --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/PlacingToolExecutor.html @@ -0,0 +1 @@ +PlacingToolExecutor

PlacingToolExecutor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total70 of 700%2 of 20%44161633
execute(File, ExecutionOptions, PrintStream)360%20%22101011
assembleArguments(File, ExecutionOptions)310%n/a115511
PlacingToolExecutor()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/PlacingToolExecutor.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/PlacingToolExecutor.java.html new file mode 100644 index 00000000..15779bba --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/PlacingToolExecutor.java.html @@ -0,0 +1,55 @@ +PlacingToolExecutor.java

PlacingToolExecutor.java

package codemetropolis.toolchain.gui.executors;
+
+import java.io.File;
+import java.io.PrintStream;
+
+import codemetropolis.toolchain.commons.util.FileLogger;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.commons.util.Settings;
+import codemetropolis.toolchain.gui.beans.ExecutionException;
+import codemetropolis.toolchain.gui.beans.ExecutionOptions;
+import codemetropolis.toolchain.placing.PlacingExecutor;
+import codemetropolis.toolchain.placing.PlacingExecutorArgs;
+
+/**
+ * {@link ToolchainExecutor} implementation for the placing tool.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class PlacingToolExecutor implements ToolchainExecutor {
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void execute(File cmRoot, ExecutionOptions executionOptions, PrintStream out) throws ExecutionException {
+    FileLogger.load(Settings.get("placing_log_file"));
+
+    PlacingExecutorArgs args = assembleArguments(cmRoot, executionOptions);
+    PlacingExecutor executor = new PlacingExecutor();
+    executor.setPrintStream(out);
+    executor.setErrorStream(out);
+    executor.setPrefix(Resources.get("placing_prefix"));
+    executor.setErrorPrefix(Resources.get("error_prefix"));
+    if (!executor.execute(args)) {
+      throw new ExecutionException("Failed to complete placing step!");
+    }
+  }
+
+  /**
+   * Creates the {@link PlacingExecutorArgs} instance that will be used for the execution of the placing tool.
+   *
+   * @param cmRoot The path of the folder used to store the intermediate files in.
+   * @param executionOptions The {@link ExecutionOptions} instance.
+   * @return The assembled {@link PlacingExecutorArgs} object which will be used for execution.
+   */
+  private PlacingExecutorArgs assembleArguments(File cmRoot, ExecutionOptions executionOptions) {
+    return new PlacingExecutorArgs(
+      cmRoot.getAbsolutePath() + File.separator + "mapping-results.xml",
+      cmRoot.getAbsolutePath() + File.separator + "placing-results.xml",
+      executionOptions.getLayoutAlgorithm().toString(),
+      executionOptions.isShowMap());
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/RenderingToolExecutor.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/RenderingToolExecutor.html new file mode 100644 index 00000000..7e6bc4ce --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/RenderingToolExecutor.html @@ -0,0 +1 @@ +RenderingToolExecutor

RenderingToolExecutor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total75 of 750%2 of 20%44151533
execute(File, ExecutionOptions, PrintStream)360%20%22101011
assembleArguments(File, ExecutionOptions)360%n/a114411
RenderingToolExecutor()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/RenderingToolExecutor.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/RenderingToolExecutor.java.html new file mode 100644 index 00000000..bbb2268b --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/RenderingToolExecutor.java.html @@ -0,0 +1,55 @@ +RenderingToolExecutor.java

RenderingToolExecutor.java

package codemetropolis.toolchain.gui.executors;
+
+import java.io.File;
+import java.io.PrintStream;
+
+import codemetropolis.toolchain.commons.util.FileLogger;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.commons.util.Settings;
+import codemetropolis.toolchain.gui.beans.ExecutionException;
+import codemetropolis.toolchain.gui.beans.ExecutionOptions;
+import codemetropolis.toolchain.rendering.RenderingExecutor;
+import codemetropolis.toolchain.rendering.RenderingExecutorArgs;
+
+/**
+ * {@link ToolchainExecutor} implementation for the rendering tool.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class RenderingToolExecutor implements ToolchainExecutor {
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void execute(File cmRoot, ExecutionOptions executionOptions, PrintStream out) throws ExecutionException {
+    FileLogger.load(Settings.get("rendering_log_file"));
+
+    RenderingExecutorArgs args = assembleArguments(cmRoot, executionOptions);
+    RenderingExecutor executor = new RenderingExecutor();
+    executor.setPrintStream(out);
+    executor.setErrorStream(out);
+    executor.setPrefix(Resources.get("rendering_prefix"));
+    executor.setErrorPrefix(Resources.get("error_prefix"));
+    if (!executor.execute(args)) {
+      throw new ExecutionException("Failed to complete rendering step!");
+    }
+  }
+
+  /**
+   * Creates the {@link RenderingExecutorArgs} instance that will be used for the execution of the rendering tool.
+   *
+   * @param cmRoot The path of the folder used to store the intermediate files in.
+   * @param executionOptions The {@link ExecutionOptions} instance.
+   * @return The assembled {@link RenderingExecutorArgs} object which will be used for execution.
+   */
+  private RenderingExecutorArgs assembleArguments(File cmRoot, ExecutionOptions executionOptions) {
+    return new RenderingExecutorArgs(
+      cmRoot.getAbsolutePath() + File.separator + "placing-results.xml",
+      executionOptions.getMinecraftRoot().getAbsolutePath() + File.separator + "saves" + File.separator
+        + executionOptions.getProjectName().replace(" +;\\/\"?", ""),
+      true);
+  }
+  
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/index.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/index.html new file mode 100644 index 00000000..621b26c7 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.executors

codemetropolis.toolchain.gui.executors

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total601 of 6010%28 of 280%3535112112202077
ConverterToolExecutor2030%150%131338385511
MetricGeneratorExecutor1420%70%8826264411
RenderingToolExecutor750%20%4415153311
MappingToolExecutor730%20%4417173311
PlacingToolExecutor700%20%4416163311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/index.source.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/index.source.html new file mode 100644 index 00000000..c9086ef5 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.executors/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.executors

codemetropolis.toolchain.gui.executors

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total601 of 6010%28 of 280%3535112112202077
ConverterToolExecutor.java2220%150%141438386622
MetricGeneratorExecutor.java1610%70%9926265522
RenderingToolExecutor.java750%20%4415153311
MappingToolExecutor.java730%20%4417173311
PlacingToolExecutor.java700%20%4416163311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SonarQubeGenerator.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SonarQubeGenerator.html new file mode 100644 index 00000000..75f6c13e --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SonarQubeGenerator.html @@ -0,0 +1 @@ +SonarQubeGenerator

SonarQubeGenerator

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total229 of 2290%0 of 0n/a77484877
addAuthenticationFields()570%n/a119911
fillFields(ExecutionOptions)440%n/a118811
addUrlField()290%n/a115511
addProjectsField()290%n/a115511
addSplitDirsCheckbox()290%n/a115511
SonarQubeGenerator()210%n/a119911
validateFields(ExecutionOptions)200%n/a117711
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SonarQubeGenerator.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SonarQubeGenerator.java.html new file mode 100644 index 00000000..485839d8 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SonarQubeGenerator.java.html @@ -0,0 +1,128 @@ +SonarQubeGenerator.java

SonarQubeGenerator.java

package codemetropolis.toolchain.gui.metricgenerators;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+
+import codemetropolis.toolchain.converter.control.ConverterType;
+import codemetropolis.toolchain.gui.beans.ExecutionOptions;
+import codemetropolis.toolchain.gui.components.CMCheckBox;
+import codemetropolis.toolchain.gui.components.CMLabel;
+import codemetropolis.toolchain.gui.components.CMMetricPanel;
+import codemetropolis.toolchain.gui.components.CMPasswordField;
+import codemetropolis.toolchain.gui.components.CMTextField;
+import codemetropolis.toolchain.gui.utils.GuiUtils;
+import codemetropolis.toolchain.gui.utils.Translations;
+
+/**
+ * Metric generation settings panel for the SonarQube settings.
+ *
+ * @author Abel Szkalisity {@literal <SZAVAET.SZE>}
+ */
+public class SonarQubeGenerator extends CMMetricPanel {
+
+  private static final long serialVersionUID = 1L;
+
+  private CMTextField url;
+  private CMTextField username;
+  private CMPasswordField password;
+  private CMTextField projects;
+  private CMCheckBox splitDirs;
+
+  /**
+   * Instantiates a SonarQube metric panel.
+   */
+  public SonarQubeGenerator() {
+    setTabTitle(Translations.t("gui_tab_sq"));
+    setConverterType(ConverterType.SONARQUBE);
+
+    setLayout(null);
+
+    addUrlField();
+    addAuthenticationFields();
+    addProjectsField();
+    addSplitDirsCheckbox();
+  }
+
+  /**
+   * Adds the SonarQube url field to the panel.
+   */
+  public void addUrlField() {
+    CMLabel label = new CMLabel(Translations.t("gui_l_url"), 5, 5, 80, 30);
+    url = new CMTextField(90, 5, 370, 30);
+
+    add(label);
+    add(url);
+  }
+
+  /**
+   * Adds the username and password fields to the panel.
+   */
+  public void addAuthenticationFields() {
+    CMLabel usernameLabel = new CMLabel(Translations.t("gui_l_username"), 5, 40, 80, 30);
+    username = new CMTextField(90, 40, 145, 30);
+    CMLabel passwordLabel = new CMLabel(Translations.t("gui_l_password"), 240, 40, 80, 30);
+    password = new CMPasswordField(315, 40, 145, 30);
+
+    add(usernameLabel);
+    add(username);
+    add(passwordLabel);
+    add(password);
+  }
+
+  /**
+   * Adds the projects field to the panel.
+   */
+  public void addProjectsField() {
+    CMLabel label = new CMLabel(Translations.t("gui_l_projects"), 5, 75, 80, 30);
+    projects = new CMTextField(90, 75, 370, 30);
+
+    add(label);
+    add(projects);
+  }
+
+  /**
+   * Adds the split dirs checkbox to the panel.
+   */
+  public void addSplitDirsCheckbox() {
+    splitDirs = new CMCheckBox(5, 110, 20, 30);
+    CMLabel label = new CMLabel(Translations.t("gui_l_split_dirs"), 30, 110, 370, 30);
+
+    add(splitDirs);
+    add(label);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void fillFields(ExecutionOptions executionOptions) {
+    Map<String, Object> params = executionOptions.getMetricGenerationParams();
+    params.put("url", url.getText());
+    params.put("username", username.getText());
+    params.put("password", password.getPassword());
+    params.put("projects", projects.getText());
+    params.put("splitDirs", splitDirs.isSelected());
+
+    executionOptions.setConverterType(converterType);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public boolean validateFields(ExecutionOptions executionOptions) {
+    Map<String, Object> params = executionOptions.getMetricGenerationParams();
+
+    try {
+      new URL(params.get("url").toString());
+    } catch (MalformedURLException e) {
+      GuiUtils.showError(Translations.t("gui_err_invalid_sonar_url"));
+      return false;
+    }
+
+    return true;
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SourceMeterGenerator.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SourceMeterGenerator.html new file mode 100644 index 00000000..052d8d60 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SourceMeterGenerator.html @@ -0,0 +1 @@ +SourceMeterGenerator

SourceMeterGenerator

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total218 of 2180%20 of 200%1616454566
validateFields(ExecutionOptions)600%200%1111141411
addProjectRootField()520%n/a118811
addSourceMeterExecutableField()520%n/a118811
fillFields(ExecutionOptions)320%n/a117711
SourceMeterGenerator()170%n/a117711
static {...}50%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SourceMeterGenerator.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SourceMeterGenerator.java.html new file mode 100644 index 00000000..08f62305 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/SourceMeterGenerator.java.html @@ -0,0 +1,117 @@ +SourceMeterGenerator.java

SourceMeterGenerator.java

package codemetropolis.toolchain.gui.metricgenerators;
+
+import java.io.File;
+import java.util.Map;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+import codemetropolis.toolchain.converter.control.ConverterType;
+import codemetropolis.toolchain.gui.beans.ExecutionOptions;
+import codemetropolis.toolchain.gui.components.CMButton;
+import codemetropolis.toolchain.gui.components.CMLabel;
+import codemetropolis.toolchain.gui.components.CMMetricPanel;
+import codemetropolis.toolchain.gui.components.CMTextField;
+import codemetropolis.toolchain.gui.components.listeners.BrowseListener;
+import codemetropolis.toolchain.gui.utils.ExeFileFilter;
+import codemetropolis.toolchain.gui.utils.GuiUtils;
+import codemetropolis.toolchain.gui.utils.Translations;
+
+/**
+ * Metric generation settings panel for the SonarQube settings.
+ *
+ * @author Abel Szkalisity {@literal <SZAVAET.SZE>}
+ */
+public class SourceMeterGenerator extends CMMetricPanel {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final FileFilter EXE_FILTER = new ExeFileFilter();
+
+  private CMTextField projectRootPath;
+  private CMTextField sourceMeterPath;
+
+  /**
+   * Instantiates a SourceMeter settings panel.
+   */
+  public SourceMeterGenerator() {
+    setTabTitle(Translations.t("gui_tab_sm"));
+    setConverterType(ConverterType.SOURCEMETER);
+
+    setLayout(null);
+
+    addProjectRootField();
+    addSourceMeterExecutableField();
+  }
+
+  /**
+   * Adds the project root browser to the panel.
+   */
+  public void addProjectRootField() {
+    CMLabel label = new CMLabel(Translations.t("gui_l_project_root"), 5, 5, 120, 30);
+    projectRootPath = new CMTextField(130, 5, 225, 30);
+    CMButton browseButton = new CMButton(Translations.t("gui_b_browse"), 360, 5, 100, 30);
+    browseButton.addActionListener(new BrowseListener(projectRootPath, JFileChooser.DIRECTORIES_ONLY, null));
+
+    add(label);
+    add(projectRootPath);
+    add(browseButton);
+  }
+
+  /**
+   * Adds the SourceMeter executable browser to the panel.
+   */
+  public void addSourceMeterExecutableField() {
+    CMLabel label = new CMLabel(Translations.t("gui_l_sm_exe"), 5, 40, 120, 30);
+    sourceMeterPath = new CMTextField(130, 40, 225, 30);
+    CMButton browseButton = new CMButton(Translations.t("gui_b_browse"), 360, 40, 100, 30);
+    browseButton.addActionListener(new BrowseListener(sourceMeterPath, JFileChooser.FILES_ONLY, EXE_FILTER));
+
+    add(label);
+    add(sourceMeterPath);
+    add(browseButton);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void fillFields(ExecutionOptions executionOptions) {
+    File sourceMeterExe = new File(sourceMeterPath.getText());
+    File projectRoot = new File(projectRootPath.getText());
+
+    Map<String, Object> params = executionOptions.getMetricGenerationParams();
+    params.put("sourceMeterExe", sourceMeterExe);
+    params.put("projectRoot", projectRoot);
+
+    executionOptions.setConverterType(converterType);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public boolean validateFields(ExecutionOptions executionOptions) {
+    Map<String, Object> params = executionOptions.getMetricGenerationParams();
+
+    try {
+      File sourceMeterExe = (File) params.get("sourceMeterExe");
+      File projectRoot = (File) params.get("projectRoot");
+
+      if (sourceMeterExe == null || !sourceMeterExe.exists() || !sourceMeterExe.isFile() || !sourceMeterExe.canRead()
+          || !sourceMeterExe.canExecute() || !sourceMeterExe.getName().endsWith(".exe")) {
+        GuiUtils.showError(Translations.t("gui_err_invalid_sm_exe"));
+        return false;
+      } else if (projectRoot == null || !projectRoot.exists() || !projectRoot.isDirectory() || !projectRoot.canRead()) {
+        GuiUtils.showError(Translations.t("gui_err_invalid_project_root"));
+        return false;
+      }
+    } catch (ClassCastException e) {
+      GuiUtils.showError(Translations.t("gui_err_unexpected_err"));
+    }
+
+    return true;
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/index.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/index.html new file mode 100644 index 00000000..e295fb77 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.metricgenerators

codemetropolis.toolchain.gui.metricgenerators

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total447 of 4470%20 of 200%23239393131322
SonarQubeGenerator2290%n/a7748487711
SourceMeterGenerator2180%200%161645456611
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/index.source.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/index.source.html new file mode 100644 index 00000000..7862325c --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.metricgenerators/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.metricgenerators

codemetropolis.toolchain.gui.metricgenerators

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total447 of 4470%20 of 200%23239393131322
SonarQubeGenerator.java2290%n/a7748487711
SourceMeterGenerator.java2180%200%161645456611
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/BuildableSettings.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/BuildableSettings.html new file mode 100644 index 00000000..50720760 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/BuildableSettings.html @@ -0,0 +1 @@ +BuildableSettings

BuildableSettings

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total58 of 47487%13 of 2853%919117005
readSettings()586853%13735%911112801
static {...}253100%n/a0102601
displaySettings()53100%4100%030801
validateProperties(String, String[])33100%4100%030501
BuildableSettings()9100%n/a010301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/BuildableSettings.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/BuildableSettings.java.html new file mode 100644 index 00000000..d347c15b --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/BuildableSettings.java.html @@ -0,0 +1,170 @@ +BuildableSettings.java

BuildableSettings.java

package codemetropolis.toolchain.gui.utils;
+
+import java.util.List;
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import java.net.URL;
+
+import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException;
+
+/**
+ * This class is responsible for providing information which buildable attributes are desired by the user to display on the GUI.
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ */
+public class BuildableSettings {
+	/**
+	 * {@link Map}, which contains the default settings of what properties to display to the individual buildable types.
+	 */
+	public static final Map<String, String[]> DEFAULT_SETTINGS = new HashMap<>();
+	
+	/**
+	 * {@Map}, which contains the types (int, float(0 to 1),...) of the possible buildable attributes.
+	 */
+	public static final Map<String, String> BUILDABLE_ATTRIBUTE_TYPES = new HashMap<String, String>();
+	
+	/**
+	 * Stores the possible values, which can be applied to the buildable attributes "character" and "external_character".
+	 */
+	public static final List<String> VALID_CHARACTER_TYPES = new ArrayList<String>(Arrays.asList(new String[] {
+			"stone", "cobblestone", "mossy_stone", "sandstone", "obsidian", 
+			"wood", "dark_wood", "birch_wood", "planks", "dark_planks", "metal",
+			"dirt", "sand", "red_sand", "brick", "stone_brick", "dark_brick",
+			"glass", "gold", "diamond"	
+	}));
+	
+	private URL urlToDictionary;
+	
+	public BuildableSettings() {
+		urlToDictionary = this.getClass().getResource("/" + "buildableProperties.cmcfg");
+	}
+	
+	/**
+	 * {@link Map}, serves containing the buildable types(floor, garden, ...) and its assigned properties(height, character, ...).
+	 */
+	private static Map<String, String[]> DISPLAYED_PROPERTIES = new HashMap<String, String[]>();
+
+    static {
+        DEFAULT_SETTINGS.put("FLOOR", new String[]{"width", "height", "length", "character", "external_character", "torches"});
+        DEFAULT_SETTINGS.put("CELLAR", new String[]{"width", "height", "length", "character", "external_character", "torches"});
+        DEFAULT_SETTINGS.put("GARDEN", new String[]{"tree-ratio", "mushroom-ratio", "flower-ratio"});
+        DEFAULT_SETTINGS.put("GROUND", new String[]{});
+        
+		DISPLAYED_PROPERTIES.put("FLOOR", new String[] {});
+        DISPLAYED_PROPERTIES.put("CELLAR", new String[] {});
+        DISPLAYED_PROPERTIES.put("GARDEN", new String[] {});
+        DISPLAYED_PROPERTIES.put("GROUND", new String[] {});
+        
+        BUILDABLE_ATTRIBUTE_TYPES.put("width", "int");
+        BUILDABLE_ATTRIBUTE_TYPES.put("height", "int");
+        BUILDABLE_ATTRIBUTE_TYPES.put("length", "int");
+        BUILDABLE_ATTRIBUTE_TYPES.put("character", "string");
+        BUILDABLE_ATTRIBUTE_TYPES.put("external_character", "string");
+        BUILDABLE_ATTRIBUTE_TYPES.put("torches", "int(0 to 5)");
+        BUILDABLE_ATTRIBUTE_TYPES.put("tree-ratio", "float(0 to 1)");
+        BUILDABLE_ATTRIBUTE_TYPES.put("mushroom-ratio", "float(0 to 1)");
+        BUILDABLE_ATTRIBUTE_TYPES.put("flower-ratio", "float(0 to 1)");
+	}
+	
+    /**
+     * Reads the user's display settings from the configuration file.
+     * @return A {@link Map} which contains the possible buildable types as keys and its attributes, which are desired to be displayed.
+     * @throws BadConfigFileFomatException If the format of the configuration file is not appropriate.
+     * @throws FileNotFoundException If the configuration file cannot be found.
+     */
+	public Map<String, String[]> readSettings() throws BadConfigFileFomatException, FileNotFoundException{
+		
+		BufferedReader cfgFileReader = null; 
+		
+		try {			
+			if (urlToDictionary != null) {
+				InputStream stream = urlToDictionary.openStream();
+				cfgFileReader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
+				String actLine;
+				//A regular line: buildable name is followed by an '=' sign, that follows the list of attributes separated by commas. 
+				while ((actLine = cfgFileReader.readLine()).split("=").length == 2) {
+					String buildableName = actLine.split("=")[0];
+					String[] buildableProperties = actLine.split("=")[1].split(",");
+					if (DISPLAYED_PROPERTIES.containsKey(buildableName)) {
+						//If there is no assigned attribute given to the actual buildable type...
+						if (buildableProperties.length == 1 && buildableProperties[0].isEmpty()) {
+							DISPLAYED_PROPERTIES.put(buildableName, new String[] {});
+						} else {
+							if (validateProperties(buildableName, buildableProperties)) {
+								DISPLAYED_PROPERTIES.put(buildableName, buildableProperties);
+							} else {
+								throw new BadConfigFileFomatException();
+							}
+						}
+					} else {
+						throw new BadConfigFileFomatException();
+					}
+				} 
+			}
+			else {
+				return DEFAULT_SETTINGS;
+			}
+		}
+		catch(IOException e) {
+			e.printStackTrace();
+		}
+		finally {
+			try {
+				if(cfgFileReader != null) {
+					cfgFileReader.close();
+				}
+			}
+			catch(IOException ioe) {
+				ioe.printStackTrace();
+			}
+		}
+		return DISPLAYED_PROPERTIES;		
+	}
+	
+	/**
+	 * Validates, if all assigned attributes of the specified buildable type are valid or not.
+	 * @param buildableType The type of the buildable (floor, garden, ...)
+	 * @param buildabeAttributes The array of the attributes which are examined if they are valid or not.
+	 * @return All of the specified buildable attributes are valid or not.
+	 */
+	static boolean validateProperties(String buildableType, String[] buildabeAttributes) {
+		List<String> validProperties = new ArrayList<String>(Arrays.asList(DEFAULT_SETTINGS.get(buildableType)));
+		for(String property : buildabeAttributes) {
+			if(!validProperties.contains(property)) {
+				return false;
+			}
+		}
+		return true;
+	}
+	
+	/**
+	 * Writes to the console, what display settings will be provided to the Mapping file editor GUI.
+	 */
+	public void displaySettings() throws BadConfigFileFomatException, FileNotFoundException {
+		
+		Map<String, String[]> returnedSettings = readSettings();
+			
+		for(String buildableType : returnedSettings.keySet()) {
+				
+			String[] buildableProperties = returnedSettings.get(buildableType);
+				
+			System.out.print(buildableType + "=");
+				
+			for(int i = 0; i < buildableProperties.length; i++) {
+					
+				System.out.print(buildableProperties[i] + ";");
+					
+			}
+			System.out.println();
+		}
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExeFileFilter.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExeFileFilter.html new file mode 100644 index 00000000..d628779b --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExeFileFilter.html @@ -0,0 +1 @@ +ExeFileFilter

ExeFileFilter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total3 of 1883%0 of 4100%151313
getDescription()30%n/a111111
accept(File)12100%4100%030101
ExeFileFilter()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExeFileFilter.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExeFileFilter.java.html new file mode 100644 index 00000000..dc950766 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExeFileFilter.java.html @@ -0,0 +1,31 @@ +ExeFileFilter.java

ExeFileFilter.java

package codemetropolis.toolchain.gui.utils;
+
+import java.io.File;
+
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * {@link FileFilter} implementation for only showing directories and executables.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class ExeFileFilter extends FileFilter {
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public boolean accept(File file) {
+    return file.isDirectory() || file.getName().endsWith(".exe");
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public String getDescription() {
+    return Translations.t("gui_filter_exe");
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExecutionWorker.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExecutionWorker.html new file mode 100644 index 00000000..111cb5ee --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExecutionWorker.html @@ -0,0 +1 @@ +ExecutionWorker

ExecutionWorker

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total64 of 640%2 of 20%44222233
done()320%20%22121211
doInBackground()170%n/a114411
ExecutionWorker(JButton, GUIController, PipedOutputStream)150%n/a116611
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExecutionWorker.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExecutionWorker.java.html new file mode 100644 index 00000000..d3e09827 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExecutionWorker.java.html @@ -0,0 +1,68 @@ +ExecutionWorker.java

ExecutionWorker.java

package codemetropolis.toolchain.gui.utils;
+
+import java.io.IOException;
+import java.io.PipedOutputStream;
+import java.io.PrintStream;
+
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+import javax.swing.SwingWorker;
+
+import codemetropolis.toolchain.gui.GUIController;
+
+/**
+ * {@link SwingWorker} sublclass for executing the CodeMetropolis toolchain.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class ExecutionWorker extends SwingWorker<Void, Integer> {
+
+  private boolean successful = false;
+
+  private JButton start;
+  private GUIController controller;
+  private PipedOutputStream out;
+
+  /**
+   * Instantiates the {@link ExecutionWorker}.
+   *
+   * @param start The button used to start the execution. This reference is required because at the start and at the end
+   *   of the execution it will be disabled and re-enabled, respectively.
+   * @param controller The controller instance that will do the actual execution.
+   * @param out The {@link PipedOutputStream} that will be used by the executors.
+   */
+  public ExecutionWorker(JButton start, GUIController controller, PipedOutputStream out) {
+    this.start = start;
+    this.controller = controller;
+    this.out = out;
+  }
+
+  @Override
+  protected Void doInBackground() throws Exception {
+    start.setEnabled(false);
+    controller.execute(new PrintStream(out));
+    successful = true;
+    return null;
+  }
+
+  @Override
+  protected void done() {
+    try {
+      out.close();
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+
+    start.setEnabled(true);
+    if (successful) {
+      JOptionPane.showMessageDialog(null, Translations.t("gui_info_world_gen_successful"),
+        Translations.t("gui_info_finished"), JOptionPane.INFORMATION_MESSAGE);
+    } else {
+      JOptionPane.showMessageDialog(null, Translations.t("gui_err_world_gen_failed"),
+        Translations.t("gui_err_title"), JOptionPane.ERROR_MESSAGE);
+    }
+    super.done();
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/GuiUtils.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/GuiUtils.html new file mode 100644 index 00000000..5ce61799 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/GuiUtils.html @@ -0,0 +1 @@ +GuiUtils

GuiUtils

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total117 of 15926%33 of 368%2123192835
validateOptions(ExecutionOptions)540%220%1212111111
getMinecraftExpectedLocation()512633%9110%564901
showError(String)70%n/a112211
GuiUtils()30%n/a111111
findMinecraftRoot()21688%2250%231501
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/GuiUtils.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/GuiUtils.java.html new file mode 100644 index 00000000..4bef6e85 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/GuiUtils.java.html @@ -0,0 +1,89 @@ +GuiUtils.java

GuiUtils.java

package codemetropolis.toolchain.gui.utils;
+
+import java.io.File;
+
+import javax.swing.JOptionPane;
+
+import codemetropolis.toolchain.gui.beans.ExecutionOptions;
+
+/**
+ * Utility class for globally used functions.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class GuiUtils {
+
+  /**
+   * Attempts to find the location for the root folder of Minecraft, if it is installed.
+   *
+   * @return The path for the root folder, if found.
+   */
+  public static String findMinecraftRoot() {
+    String expectedLocation = getMinecraftExpectedLocation();
+
+    File minecraftRoot = new File(expectedLocation);
+    if (minecraftRoot.exists() && minecraftRoot.isDirectory()) {
+      return minecraftRoot.getAbsolutePath();
+    } else {
+      return null;
+    }
+  }
+
+  /**
+   * Assembles a path based on the host operating system, which is expected to be the root folder for Minecraft if it is
+   * installed.
+   *
+   * @return The path to the expected location.
+   */
+  private static String getMinecraftExpectedLocation() {
+    String os = System.getProperty("os.name").toLowerCase();
+
+    String location = "";
+    if (os.indexOf("win") > -1) {
+      location = System.getenv("appdata") + File.separator + ".minecraft";
+    } else if (os.indexOf("nix") > -1 || os.indexOf("nux") > -1 || os.indexOf("aix") > -1) {
+      location = '~' + File.separator + ".minecraft";
+    } else if (os.indexOf("mac") > -1) {
+      location = '~' + File.separator + "Library" + File.separator + "Application Support" + File.separator
+        + "minecraft";
+    }
+
+    return location;
+  }
+
+  /**
+   * Validates the options set in the {@code executionOptions}. Most importantly checks if the files and directories
+   * selected are readable/writable.
+   *
+   * @param executionOptions The {@link ExecutionOptions} instance to validate.
+   * @return True, if the options are valid, false otherwise.
+   */
+  public static boolean validateOptions(ExecutionOptions executionOptions) {
+    File mappingXml = executionOptions.getMappingXml();
+    File minecraftRoot = executionOptions.getMinecraftRoot();
+
+    if (executionOptions.getProjectName() == null || executionOptions.getProjectName().isEmpty()) {
+      showError(Translations.t("gui_err_invalid_project_name"));
+    } else if (mappingXml == null || !mappingXml.exists() || !mappingXml.isFile() || !mappingXml.canRead()) {
+      showError(Translations.t("gui_err_invalid_mapping_xml"));
+    } else if (minecraftRoot == null || !minecraftRoot.exists() || !minecraftRoot.isDirectory()
+        || !minecraftRoot.canRead() || !minecraftRoot.canWrite()) {
+      showError(Translations.t("gui_err_invalid_mc_root"));
+    } else {
+      return true;
+    }
+
+    return false;
+  }
+
+  /**
+   * Shows an error dialog with the specified {@code message}.
+   *
+   * @param message The error message to show.
+   */
+  public static void showError(String message) {
+    JOptionPane.showMessageDialog(null, message, Translations.t("gui_err_title"), JOptionPane.ERROR_MESSAGE);
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Property.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Property.html new file mode 100644 index 00000000..a52f2f0a --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Property.html @@ -0,0 +1 @@ +Property

Property

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 3100%0 of 0n/a010101
Property()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Property.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Property.java.html new file mode 100644 index 00000000..65ceb20e --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Property.java.html @@ -0,0 +1,17 @@ +Property.java

Property.java

package codemetropolis.toolchain.gui.utils;
+
+/**
+ * This class serves for storing the information of a property belongs to a source code element type.
+ *  @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ */
+public class Property{
+	/**
+	 * Name of the property.
+	 */
+	public String name;
+	/**
+	 * Type of the property.
+	 */
+	public String type;
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/PropertyCollector.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/PropertyCollector.html new file mode 100644 index 00000000..8ab5428b --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/PropertyCollector.html @@ -0,0 +1 @@ +PropertyCollector

PropertyCollector

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total55 of 27680%12 of 3464%112565518
displayProperties()520%40%335511
getFromCdf(String)35494%1583%1411601
getPropertyList(Element)49100%2466%2401001
tryCollectProperties(Element)46100%3770%3601001
static {...}24100%n/a010301
initializePropertyMap()24100%2100%020501
isValidElement(Element)19100%2466%240301
PropertyCollector()5100%n/a010301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/PropertyCollector.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/PropertyCollector.java.html new file mode 100644 index 00000000..4863353c --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/PropertyCollector.java.html @@ -0,0 +1,165 @@ +PropertyCollector.java

PropertyCollector.java

package codemetropolis.toolchain.gui.utils;
+
+import java.io.*;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This class is responsible for providing information what properties/metrics belong to the individual source code element types.
+ *  @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ */
+public class PropertyCollector {
+	/**
+	 * Those source code element types, whose properties wanted to be collected.
+	 */
+	public static final Set<String>  acceptedTypes = new HashSet<String>(Arrays.asList(
+		     new String[] {"package","class","attribute","method"}
+	));
+	
+	/**
+	 * The String key contains the name of the source code element type. The value assigned to the key is a list with the properties (<name, type> pairs).
+	 */
+	private Map<String, List<Property>> propertyMap;
+	
+	/**
+	 * Class initialization.
+	 */
+	public PropertyCollector() {
+		initializePropertyMap();
+	}
+	
+	/**
+	 * Initialize the property map.
+	 */
+	private void initializePropertyMap() {
+		Map<String, List<Property>> tmpPropertyMap = new HashMap<String, List<Property>>();
+		for(String type : acceptedTypes) {
+			tmpPropertyMap.put(type, null);
+		}
+		propertyMap = tmpPropertyMap;
+	}
+	
+	/**
+	 * Gets the {@link Map} which contains the individual source code element types as keys and their metrics/properties as values.
+	 * @param cdfFilePath The path from the cdf file from which the information will be read.
+	 * @return The {@link Map} which contains the individual source code element types as keys and their metrics/properties as values.
+	 */
+	public Map<String, List<Property>> getFromCdf(String cdfFilePath) throws FileNotFoundException {
+		try {
+			
+			initializePropertyMap();
+
+			File file = new File(cdfFilePath);
+
+			DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+			Document doc = dBuilder.parse(file);
+			
+			Element rootElement = doc.getDocumentElement();
+			rootElement.normalize();
+				
+			//This NodeList 'elementTags' below doesn't contains the root element.
+			//The root element is also an 'element' tag (a package), that's why we need to try collecting its properties as well.
+			if(isValidElement(rootElement)) {
+				tryCollectProperties(rootElement);
+			}
+							
+			NodeList elementTags = rootElement.getElementsByTagName("element");
+			
+			//Iteration through all of the rest 'element' tags (they represent source code element types). Trying to collect their properties.
+			for(int i = 0; i < elementTags.getLength(); i++) {
+				Element currentTag = (Element) elementTags.item(i);
+				if(isValidElement(currentTag)) {
+					tryCollectProperties(currentTag);
+				}
+			};
+
+		} catch (ParserConfigurationException | SAXException | IOException e) {	
+			e.printStackTrace();
+		}
+			
+		return propertyMap;
+	}
+		
+	/**
+	 * Checks if the tag is a valid 'element' tag or not.
+	 * @param element The {@link Element} which will be examined.
+	 * @return The examined element is a valid 'element' tag or not.
+	 */
+	public boolean isValidElement(Element element) {
+		return element.getTagName().equals("element") &&
+			element.hasAttribute("type") &&
+			acceptedTypes.contains(element.getAttribute("type"));
+	}	
+	
+	/**
+	 * Checks if the properties/metrics of the element have been ever gathered or not. If not, calls the {@code getPropertyList} method to collect them.
+	 * @param element The 'element' tag which will be examined.
+	 */
+	private void tryCollectProperties(Element element) {
+		List<Property> propertyList = null;
+		//We will collect the properties of the source code element types only in that way, when we have never collected them before.
+		//The element tag must have child nodes. (E.g. the 'properties' tag also a child element.)
+		if(propertyList == null && element.hasChildNodes()) {
+			NodeList children = element.getChildNodes();
+			for(int i = 0; i < children.getLength(); i++) {
+				Node child = children.item(i);
+				//When we found the 'properties' tag, we collect the list of properties contained by it.
+				if(child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals("properties")) {
+					propertyList = getPropertyList((Element)child);
+					propertyMap.put(element.getAttribute("type"), propertyList);
+					break;
+				}
+			}
+		}
+	}
+		
+	/**
+	 * Collects the properties contained by the 'properties' tag.
+	 * @param element The 'properties' tag of the 'element' tag.
+	 * @return The list of the gathered properties/metrics.
+	 */
+	public List<Property> getPropertyList(Element element) {
+		List<Property> result = new ArrayList<Property>();
+		
+		NodeList properties = element.getElementsByTagName("property");
+		
+		for(int i = 0; i < properties.getLength(); i++) {
+			Element property = (Element) properties.item(i);
+			if(property.hasAttribute("name") && property.hasAttribute("type")) {
+				Property p = new Property();
+				p.name = property.getAttribute("name");
+				p.type = property.getAttribute("type");
+				result.add(p);
+			}
+		}
+		return result;
+	}
+	
+	/**
+	 * Displays the various properties (<name, type> pairs) of the source code elements.
+	 */
+	public void displayProperties() {
+		for(String srcCodeElement : acceptedTypes) {
+			System.out.println("Properties of source code element '" + srcCodeElement + "':");
+			for(Property p : propertyMap.get(srcCodeElement)) {
+				System.out.println(p.name + ": " + p.type);
+			}
+		}
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/StreamReaderWorker.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/StreamReaderWorker.html new file mode 100644 index 00000000..58467451 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/StreamReaderWorker.html @@ -0,0 +1 @@ +StreamReaderWorker

StreamReaderWorker

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total50 of 500%2 of 20%44141433
doInBackground()300%20%227711
StreamReaderWorker(JButton, JTextArea, PipedOutputStream)150%n/a115511
done()50%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/StreamReaderWorker.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/StreamReaderWorker.java.html new file mode 100644 index 00000000..76e76eca --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/StreamReaderWorker.java.html @@ -0,0 +1,59 @@ +StreamReaderWorker.java

StreamReaderWorker.java

package codemetropolis.toolchain.gui.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+
+import javax.swing.JButton;
+import javax.swing.JTextArea;
+import javax.swing.SwingWorker;
+
+/**
+ * {@link SwingWorker} subclass that reads from a specified {@link PipedOutputStream} and feeds it into a
+ * {@link JTextArea}.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class StreamReaderWorker extends SwingWorker<Void, Integer> {
+
+  private JButton close;
+  private JTextArea textArea;
+  private PipedInputStream in;
+
+  /**
+   * Instantiates the worker.
+   *
+   * @param close A {@link JButton} that will be enabled when the stream closes.
+   * @param textArea The {@link JTextArea} the stream will be fed into.
+   * @param out The {@link PipedOutputStream} the data will be read from by piping it into a {@link PipedInputStream}.
+   * @throws IOException if any I/O error occurs.
+   */
+  public StreamReaderWorker(JButton close, JTextArea textArea, PipedOutputStream out) throws IOException {
+    this.close = close;
+    this.textArea = textArea;
+    this.in = new PipedInputStream(out);
+  }
+
+  @Override
+  protected Void doInBackground() throws Exception {
+    String line;
+    BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+    while ((line = reader.readLine()) != null) {
+      textArea.append(line);
+      textArea.append("\n");
+    }
+
+    reader.close();
+    in.close();
+    return null;
+  }
+
+  @Override
+  protected void done() {
+    close.setEnabled(true);
+  };
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/TransferHelper.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/TransferHelper.html new file mode 100644 index 00000000..c399068d --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/TransferHelper.html @@ -0,0 +1 @@ +TransferHelper

TransferHelper

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total159 of 23632%19 of 2729%1822487046
typeChecker(Object, JTable, int, int)647453%13838%1114163601
canImport(TransferHandler.TransferSupport)470%40%33151511
importData(TransferHandler.TransferSupport)450%20%22151511
getSourceActions(JComponent)20%n/a111111
exportDone(JComponent, Transferable, int)0%n/a111111
TransferHelper()3100%n/a010201
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/TransferHelper.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/TransferHelper.java.html new file mode 100644 index 00000000..3175b30a --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/TransferHelper.java.html @@ -0,0 +1,177 @@ +TransferHelper.java

TransferHelper.java

package codemetropolis.toolchain.gui.utils;
+
+import java.awt.Component;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.Point;
+import java.io.IOException;
+import java.util.List;
+
+import javax.swing.JComponent;
+import javax.swing.JTable;
+import javax.swing.TransferHandler;
+
+import codemetropolis.toolchain.gui.MappingFileEditorDialog;
+import codemetropolis.toolchain.gui.MappingFileEditorDialog.AssignResult;
+import codemetropolis.toolchain.gui.conversions.*;
+
+/**
+ * This class is used to handle the transfer of
+ * a Transferable to and from Swing components.
+ *
+ * @author Tamas Keri {@literal <KETWAAT.SZE>}
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ */
+public class TransferHelper extends TransferHandler {
+
+	private static final long serialVersionUID = 1L;
+
+    public TransferHelper() {
+    }
+
+    /**
+     * Checking dropping available
+     *
+     * @param obj dragged object
+     * @param target the target table
+     * @param row row of target table
+     * @param col column of target table
+     * @return boolean available dropping
+     */
+    public boolean typeChecker (Object obj, JTable target, int row, int col) {
+    	int currCol = col -1;
+
+    	if (col == 0) {	return false; }
+
+    	Object value = target.getModel().getValueAt(row, currCol);
+    	String dragValue = obj.toString();
+    	String dropValue = value.toString();
+
+    	JTable currGardenTable = MappingFileEditorDialog.getGardenTable();
+    	JTable currFloorTable = MappingFileEditorDialog.getFloorTable();
+    	JTable currCellarTable = MappingFileEditorDialog.getCellarTable();
+
+    	List<Conversion> conversionList = MappingFileEditorDialog.gardenConversion;
+
+    	if (target == currGardenTable) {
+    		conversionList = MappingFileEditorDialog.gardenConversion;
+    	}
+
+    	if (target == currFloorTable) {
+    		conversionList = MappingFileEditorDialog.floorConversion;
+    	}
+
+		if (target == currCellarTable) {
+			conversionList = MappingFileEditorDialog.cellarConversion;
+		}
+
+    	dragValue = dragValue.split(": ")[1];
+    	dropValue = dropValue.split(": ")[1];
+    	
+    	AssignResult cell = MappingFileEditorDialog.ASSIGN_RESULT_MATRIX.get(dropValue).get(dragValue);
+    	if(cell == null) {
+    		//We are trying to drag a resource... specify its type.
+    		if(dragValue.matches("[0-9]+")) dragValue = "int";
+    		else if(dragValue.matches("[0-9]+.[0-9]+")) dragValue = "float";
+    		else{
+    			dragValue = "string";
+    		}
+    		cell = MappingFileEditorDialog.ASSIGN_RESULT_MATRIX.get(dropValue).get(dragValue);
+    	}
+    	    	
+    	switch (cell) {
+    	case CANNOT_ASSIGN:
+    		return false;
+
+    	case NO_CONVERSION:
+    		conversionList.add(row, new EmptyConversion());
+    		return true;
+
+    	case TO_INT:
+    		conversionList.add(row, new ToIntConversion());
+    		return true;
+
+    	case TO_DOUBLE:
+    		conversionList.add(row, new ToDoubleConversion());
+    		return true;
+
+    	case NORMALIZE:
+    		conversionList.add(row, new NormalizeConversion());
+    		return true;
+
+    	case QUANTIZATON:
+    		conversionList.add(row, new QuantizationConversion());
+    		return true;
+
+    	default:
+    		return true;
+    	}
+    }
+
+    @Override
+    public int getSourceActions(JComponent c) {
+        return MOVE;
+    }
+
+    @Override
+    protected void exportDone(JComponent source, Transferable data, int action) {
+    }
+
+    @Override
+    public boolean canImport(TransferSupport support) {
+        // Reject the import by default...
+        boolean canImport = false;
+        // Can only import into another JTable
+        Component comp = support.getComponent();
+        if (comp instanceof JTable) {
+        	JTable target = (JTable) comp;
+        	DropLocation dl = support.getDropLocation();
+            Point dp = dl.getDropPoint();
+            int dropCol = target.columnAtPoint(dp);
+            int dropRow = target.rowAtPoint(dp);
+
+            try {
+                // Get the Transferable, we need to check
+                // the constraints
+                Transferable t = support.getTransferable();
+                Object obj = t.getTransferData(DataFlavor.stringFlavor);
+                if (obj != null) {
+                	canImport = typeChecker(obj, target, dropRow, dropCol);
+                }
+            } catch (UnsupportedFlavorException | IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return canImport;
+    }
+
+    @Override
+    public boolean importData(TransferSupport support) {
+        // Import failed for some reason...
+        boolean imported = false;
+        // Only import into JTables...
+        Component comp = support.getComponent();
+        if (comp instanceof JTable) {
+            JTable target = (JTable) comp;
+            // Need to know where we are importing to...
+            DropLocation dl = support.getDropLocation();
+            Point dp = dl.getDropPoint();
+            int dropCol = target.columnAtPoint(dp);
+            int dropRow = target.rowAtPoint(dp);
+            try {
+                // Get the Transferable at the heart of it all
+                Transferable t = support.getTransferable();
+                Object obj = t.getTransferData(DataFlavor.stringFlavor);
+
+                target.setValueAt(obj, dropRow, dropCol);
+
+                imported = true;
+            } catch (UnsupportedFlavorException | IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return imported;
+    }
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Translations.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Translations.html new file mode 100644 index 00000000..fb0f495a --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Translations.html @@ -0,0 +1 @@ +Translations

Translations

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total14 of 140%0 of 0n/a335533
t(String)70%n/a113311
static {...}40%n/a111111
Translations()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Translations.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Translations.java.html new file mode 100644 index 00000000..e815f86b --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Translations.java.html @@ -0,0 +1,34 @@ +Translations.java

Translations.java

package codemetropolis.toolchain.gui.utils;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Translation service utility for the GUI translations. We use this instead of the
+ * {@link codemetropolis.toolchain.commons.util.Resources} class so we didn't need to modify the
+ * {@code resources.properties}, and could use a separate file for the GUI related labels.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class Translations {
+
+  private static ResourceBundle translations = ResourceBundle.getBundle("translations");
+
+  private Translations() { }
+
+  /**
+   * Attempts to find the translation for the given {@code key}.
+   *
+   * @param key The translation key.
+   * @return The translation, if found, otherwise the {@code key} itself.
+   */
+  public static String t(String key) {
+    try {
+      return translations.getString(key);
+    } catch (MissingResourceException e) {
+      return key;
+    }
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/XmlFileFilter.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/XmlFileFilter.html new file mode 100644 index 00000000..ed45c391 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/XmlFileFilter.html @@ -0,0 +1 @@ +XmlFileFilter

XmlFileFilter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total3 of 1883%0 of 4100%151313
getDescription()30%n/a111111
accept(File)12100%4100%030101
XmlFileFilter()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/XmlFileFilter.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/XmlFileFilter.java.html new file mode 100644 index 00000000..0347b61f --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/XmlFileFilter.java.html @@ -0,0 +1,31 @@ +XmlFileFilter.java

XmlFileFilter.java

package codemetropolis.toolchain.gui.utils;
+
+import java.io.File;
+
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * {@link FileFilter} implementation for only showing directories and xml files.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class XmlFileFilter extends FileFilter {
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public boolean accept(File file) {
+    return file.isDirectory() || file.getName().endsWith(".xml");
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public String getDescription() {
+    return Translations.t("gui_filter_xml");
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/index.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/index.html new file mode 100644 index 00000000..cd87ae4d --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.utils

codemetropolis.toolchain.gui.utils

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total570 of 1,35958%81 of 13740%731121272712041411
TransferHelper1597732%19829%182248704601
GuiUtils1174226%3338%212319283501
ExecutionWorker640%20%4422223311
BuildableSettings5841687%131553%91911700501
PropertyCollector5522180%122264%11256551801
StreamReaderWorker500%20%4414143311
Translations140%n/a33553311
XmlFileFilter1583%4100%15131301
ExeFileFilter1583%4100%15131301
Property100%n/a01010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/index.source.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/index.source.html new file mode 100644 index 00000000..26ef0c3a --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui.utils

codemetropolis.toolchain.gui.utils

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total570 of 1,35958%81 of 13740%731121272712041411
TransferHelper.java2067727%19829%192348705712
GuiUtils.java1174226%3338%212319283501
ExecutionWorker.java640%20%4422223311
BuildableSettings.java5841687%131553%91911700501
PropertyCollector.java5522180%122264%11256551801
StreamReaderWorker.java500%20%4414143311
Translations.java140%n/a33553311
XmlFileFilter.java1583%4100%15131301
ExeFileFilter.java1583%4100%15131301
Property.java100%n/a01010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI$1.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI$1.html new file mode 100644 index 00000000..45f94154 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI$1.html @@ -0,0 +1 @@ +CodeMetropolisGUI.new ActionListener() {...}

CodeMetropolisGUI.new ActionListener() {...}

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total38 of 380%2 of 20%33121222
actionPerformed(ActionEvent)290%20%22101011
{...}90%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI$2.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI$2.html new file mode 100644 index 00000000..8a19738a --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI$2.html @@ -0,0 +1 @@ +CodeMetropolisGUI.new ActionListener() {...}

CodeMetropolisGUI.new ActionListener() {...}

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total60 of 600%4 of 40%44131322
actionPerformed(ActionEvent)480%40%33111111
{...}120%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI.html new file mode 100644 index 00000000..74eaab6f --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI.html @@ -0,0 +1 @@ +CodeMetropolisGUI

CodeMetropolisGUI

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total687 of 7082%4 of 633%15181311371315
addMappingOptions(JPanel)1820%n/a11272711
addHeaderImages(JPanel)1090%n/a11191911
addPlacingOptions(JPanel)610%n/a11101011
addMinecraftRootBrowser(JPanel)520%n/a118811
CodeMetropolisGUI(GUIController)500%n/a11181811
addMetricTabs(JPanel)470%20%227711
fillOptions(ExecutionOptions)470%n/a119911
createBasePanel()330%n/a119911
addProjectNameField(JPanel)290%n/a115511
addTitle(JPanel)280%n/a116611
addStartButton(JPanel)250%n/a115511
fillAndValidateMetricOptions(ExecutionOptions)150%n/a114411
initFields()90%20%224411
checkInputCdfFile(String)12100%2100%020401
static {...}9100%n/a010201
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI.java.html new file mode 100644 index 00000000..f7b4dfb6 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI.java.html @@ -0,0 +1,366 @@ +CodeMetropolisGUI.java

CodeMetropolisGUI.java

package codemetropolis.toolchain.gui;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.PipedOutputStream;
+import java.util.Random;
+
+import javax.swing.ImageIcon;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingConstants;
+import javax.swing.filechooser.FileFilter;
+
+import codemetropolis.toolchain.gui.beans.ExecutionOptions;
+import codemetropolis.toolchain.gui.components.CMButton;
+import codemetropolis.toolchain.gui.components.CMCheckBox;
+import codemetropolis.toolchain.gui.components.CMComboBox;
+import codemetropolis.toolchain.gui.components.CMLabel;
+import codemetropolis.toolchain.gui.components.CMMetricPanel;
+import codemetropolis.toolchain.gui.components.CMSpinner;
+import codemetropolis.toolchain.gui.components.CMTextField;
+import codemetropolis.toolchain.gui.components.listeners.BrowseListener;
+import codemetropolis.toolchain.gui.utils.ExecutionWorker;
+import codemetropolis.toolchain.gui.utils.GuiUtils;
+import codemetropolis.toolchain.gui.utils.Translations;
+import codemetropolis.toolchain.gui.utils.XmlFileFilter;
+import codemetropolis.toolchain.placing.layout.LayoutAlgorithm;
+
+/**
+ * GUI window for the CodeMetropolis toolchain.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class CodeMetropolisGUI extends JFrame {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final FileFilter XML_FILTER = new XmlFileFilter();
+  private static final int COVER_IMAGE_COUNT = 4;
+  private static final Random rng = new Random();
+
+  private GUIController controller;
+
+  private CMTextField projectName;
+  private JTabbedPane metricTabbedPane;
+  private CMTextField mappingPath;
+  private CMTextField mappingEditorCdfPath;
+  private CMTextField mcRootPath;
+  private CMCheckBox showMap;
+  private CMCheckBox validateStructure;
+  private CMSpinner scaleSpinner;
+  private CMComboBox<LayoutAlgorithm> layoutSelector;
+
+  /**
+   * Instantiates the CodeMetropolis GUI.
+   *
+   * @param controller The {@link GUIController} instance.
+   */
+  public CodeMetropolisGUI(GUIController controller) {
+    super(Translations.t("gui_title"));
+    this.controller = controller;
+
+    JPanel panel = createBasePanel();
+    addHeaderImages(panel);
+    addTitle(panel);
+    addProjectNameField(panel);
+    addMetricTabs(panel);
+    addMappingOptions(panel);
+    addPlacingOptions(panel);
+    addMinecraftRootBrowser(panel);
+    addStartButton(panel);
+
+    initFields();
+
+    this.setResizable(false);
+    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+    this.setContentPane(panel);
+    this.pack();
+    this.setLocationRelativeTo(null);
+  }
+
+  /**
+   * Does automatic initialization for some of the fields. Search for Minecraft folder if exists.
+   */
+  public void initFields() {
+    String minecraftRoot = GuiUtils.findMinecraftRoot();
+    if (minecraftRoot != null) {
+      mcRootPath.setText(minecraftRoot);
+    }
+  }
+
+  /**
+   * Creates the base panel for the CodeMetropolis GUI.
+   *
+   * @return The generated {@link JPanel}.
+   */
+  private static final JPanel createBasePanel() {
+    JPanel panel = new JPanel();
+    panel.setLayout(null);
+    panel.setBackground(Color.WHITE);
+    panel.setBounds(0, 0, 500, 700);
+
+    Dimension size = new Dimension(500, 800);
+    panel.setMinimumSize(size);
+    panel.setPreferredSize(size);
+    panel.setMaximumSize(size);
+
+    return panel;
+  }
+
+  /**
+   * Adds the cover image and the logo to the top of the {@code panel}.
+   *
+   * @param panel The {@link JPanel} to add the components to.
+   */
+  private final void addHeaderImages(JPanel panel) {
+    JPanel headerPanel = new JPanel();
+    headerPanel.setLayout(null);
+
+    // Load the cover and logo images
+    Image coverImage = new ImageIcon(ClassLoader.getSystemResource("images/cm-background-"
+      + (rng.nextInt(COVER_IMAGE_COUNT) + 1) + ".png")).getImage().getScaledInstance(500, 200, Image.SCALE_SMOOTH);
+    ImageIcon logoIcon = new ImageIcon(ClassLoader.getSystemResource("images/cm-logo-border.png"));
+    Image logoImage = logoIcon.getImage().getScaledInstance(150, 150, Image.SCALE_SMOOTH);
+
+    JLabel coverImageContainer = new JLabel(new ImageIcon(coverImage));
+    coverImageContainer.setBounds(0, 0, 500, 200);
+    JLabel logoImageContainer = new JLabel(new ImageIcon(logoImage));
+    logoImageContainer.setBounds(175, 125, 150, 150);
+
+    // Add the icon to the window title bar as well
+    setIconImage(logoIcon.getImage().getScaledInstance(32, 32, Image.SCALE_SMOOTH));
+
+    headerPanel.setBackground(Color.WHITE);
+    headerPanel.setBounds(0, 0, 500, 275);
+
+    headerPanel.add(coverImageContainer);
+    headerPanel.add(logoImageContainer);
+    headerPanel.setComponentZOrder(coverImageContainer, 1);
+    headerPanel.setComponentZOrder(logoImageContainer, 0);
+    panel.add(headerPanel);
+  }
+
+  /**
+   * Adds the CodeMetropolis title to the {@code panel}
+   *
+   * @param panel The {@link JPanel} to add the components to.
+   */
+  private final void addTitle(JPanel panel) {
+    JLabel title = new JLabel(Translations.t("gui_title"));
+    title.setFont(new Font("Source Sans Pro", Font.BOLD, 26));
+    title.setHorizontalAlignment(SwingConstants.CENTER);
+    title.setBounds(0, 280, 500, 30);
+
+    panel.add(title);
+  }
+
+  /**
+   * Adds the project name field to the {@code panel}.
+   *
+   * @param panel The {@link JPanel} to add the components to.
+   */
+  private final void addProjectNameField(JPanel panel) {
+    CMLabel label = new CMLabel(Translations.t("gui_l_project_name"), 15, 325, 120, 30);
+    projectName = new CMTextField(145, 325, 340, 30);
+
+    panel.add(label);
+    panel.add(projectName);
+  }
+
+  /**
+   * Adds the metric generation tabbed pane to the {@code panel}
+   *
+   * @param panel The {@link JPanel} to add the components to.
+   */
+  private final void addMetricTabs(JPanel panel) {
+    metricTabbedPane = new JTabbedPane();
+
+    for (CMMetricPanel metricPanel : controller.getMetricGeneratorPanels()) {
+      metricTabbedPane.add(metricPanel.getTabTitle(), metricPanel);
+    }
+
+    metricTabbedPane.setBounds(15, 365, 472, 180);
+    metricTabbedPane.setFont(new Font("Source Sans Pro", Font.PLAIN, 16));
+    panel.add(metricTabbedPane);
+  }
+
+  /**
+   * Adds the options for the mapping tool to the {@code panel}.
+   *
+   * @param panel The {@link JPanel} to add the components to.
+   */
+  private final void addMappingOptions(JPanel panel) {
+	CodeMetropolisGUI self = this;
+	
+    CMLabel mappingLabel = new CMLabel(Translations.t("gui_l_mapping"), 15, 555, 120, 30);
+    mappingPath = new CMTextField(145, 555, 235, 30);
+    CMButton mappingBrowse = new CMButton(Translations.t("gui_b_browse"), 385, 555, 100, 30);
+    mappingBrowse.addActionListener(new BrowseListener(mappingPath, JFileChooser.FILES_ONLY, XML_FILTER));
+    
+    //Mapping file editor GUI components
+    CMLabel mappingEditorLabel = new CMLabel(Translations.t("gui_l_source_cdf"), 15, 590, 120, 30);
+    mappingEditorCdfPath = new CMTextField(145, 590, 235, 30);
+    CMButton mappingEditorBrowse = new CMButton(Translations.t("gui_b_browse"), 385, 590, 100, 30);
+    mappingEditorBrowse.addActionListener(new BrowseListener(mappingEditorCdfPath, JFileChooser.FILES_ONLY, XML_FILTER));
+    CMButton mappingEditorButton = new CMButton(Translations.t("gui_b_mapping_file_editor"), 300, 625, 185, 30);
+    mappingEditorButton.addActionListener(new ActionListener() {
+
+        @Override
+        public void actionPerformed(ActionEvent event) {
+        	if(!checkInputCdfFile(mappingEditorCdfPath.getText())) {
+        		JOptionPane.showMessageDialog(
+    					self,
+    					Translations.t("gui_err_missing_cdf_file"),
+    					Translations.t("gui_err_title"),
+    					JOptionPane.ERROR_MESSAGE);
+        	}
+        	else {
+        		MappingFileEditorDialog dialog = new MappingFileEditorDialog(mappingEditorCdfPath.getText(), self);
+    			dialog.setVisible(true);
+        	}
+        }
+    });
+    
+    CMLabel scaleLabel = new CMLabel(Translations.t("gui_l_scale"), 15, 660, 120, 30);
+    scaleSpinner = new CMSpinner(145, 660, 120, 30);
+
+    validateStructure = new CMCheckBox(275, 660, 20, 30);
+    CMLabel validateStructureLabel = new CMLabel(Translations.t("gui_l_validate_structure"), 300, 660, 185, 30);
+
+    panel.add(mappingLabel);
+    panel.add(mappingPath);
+    panel.add(mappingBrowse);
+    panel.add(mappingEditorLabel);
+    panel.add(mappingEditorCdfPath);
+    panel.add(mappingEditorBrowse);
+    panel.add(mappingEditorButton);
+    panel.add(scaleLabel);
+    panel.add(scaleSpinner);
+    panel.add(validateStructure);
+    panel.add(validateStructureLabel);
+  }
+
+  /**
+   * Adds the options for the placing tool to the {@code panel}.
+   *
+   * @param panel The {@link JPanel} to add the components to.
+   */
+  private final void addPlacingOptions(JPanel panel) {
+    CMLabel layoutLabel = new CMLabel(Translations.t("gui_l_layout"), 15, 695, 120, 30);
+    layoutSelector = new CMComboBox<LayoutAlgorithm>(LayoutAlgorithm.values());
+    layoutSelector.setBounds(145, 695, 120, 30);
+
+    showMap = new CMCheckBox(275, 695, 20, 30);
+    CMLabel showMapLabel = new CMLabel(Translations.t("gui_l_show_map"), 300, 695, 185, 30);
+
+    panel.add(layoutLabel);
+    panel.add(layoutSelector);
+    panel.add(showMap);
+    panel.add(showMapLabel);
+  }
+
+  /**
+   * Adds the minecraft root folder browser. This should actually be automatically filled, but in case it is not found
+   * or the user wishes to save the results to a different location, it enables them to do so.
+   *
+   * @param panel The {@link JPanel} to add the components to.
+   */
+  private final void addMinecraftRootBrowser(JPanel panel) {
+    CMLabel mcRootLabel = new CMLabel(Translations.t("gui_l_mcroot"), 15, 730, 120, 30);
+    mcRootPath = new CMTextField(145, 730, 235, 30);
+    CMButton mcRootBrowse = new CMButton(Translations.t("gui_b_browse"), 385, 730, 100, 30);
+    mcRootBrowse.addActionListener(new BrowseListener(mcRootPath, JFileChooser.DIRECTORIES_ONLY, null));
+
+    panel.add(mcRootLabel);
+    panel.add(mcRootPath);
+    panel.add(mcRootBrowse);
+  }
+
+  /**
+   * Adds the start button to the bottom of panel.
+   *
+   * @param panel The {@link JPanel} to add the components to.
+   */
+  private final void addStartButton(JPanel panel) {
+    CodeMetropolisGUI self = this;
+    CMButton start = new CMButton(Translations.t("gui_b_generate"), 190, 765, 120, 30);
+    start.addActionListener(new ActionListener() {
+
+      @Override
+      public void actionPerformed(ActionEvent event) {
+        ExecutionOptions executionOptions = controller.getExecutionOptions();
+        fillOptions(executionOptions);
+        if (!fillAndValidateMetricOptions(executionOptions)) {
+          return;
+        }
+
+        if (GuiUtils.validateOptions(controller.getExecutionOptions())) {
+          PipedOutputStream out = new PipedOutputStream();
+          ExecutionDialog dialog = new ExecutionDialog(self, out);
+          dialog.setVisible(true);
+          ExecutionWorker worker = new ExecutionWorker(start, controller, out);
+          worker.execute();
+        }
+      }
+    });
+
+    panel.add(start);
+  }
+  
+  /**
+   * Chacks if the input cdf file does exist or not.
+   * @param cdfPath The path of the cdf file.
+   * @return The cdf file exists or not.
+   */
+  public static boolean checkInputCdfFile(String cdfPath) {
+	  File cdfXmlFile = new File(cdfPath);
+		if(!cdfXmlFile.exists()) {
+			return false;
+		}
+		else {			
+			return true;
+		}
+  }
+
+  /**
+   * Fills the data required for the metric generation tools.
+   *
+   * @param executionOptions The target {@link ExecutionOptions} instance.
+   * @return True if the options are valid, false otherwise.
+   */
+  private final boolean fillAndValidateMetricOptions(ExecutionOptions executionOptions) {
+    executionOptions.getMetricGenerationParams().clear();
+
+    CMMetricPanel currentTab = (CMMetricPanel) metricTabbedPane.getSelectedComponent();
+    currentTab.fillFields(executionOptions);
+    return currentTab.validateFields(executionOptions);
+  }
+
+  /**
+   * Fills the data from the UI fields to the given {@link ExecutionOptions} instance.
+   *
+   * @param executionOptions The target instance.
+   */
+  private final void fillOptions(ExecutionOptions executionOptions) {
+    Double scale = (Double) scaleSpinner.getValue();
+    executionOptions.setProjectName(projectName.getText());
+    executionOptions.setMappingXml(new File(mappingPath.getText()));
+    executionOptions.setScale(scale.floatValue());
+    executionOptions.setValidate(validateStructure.isSelected());
+    executionOptions.setLayoutAlgorithm((LayoutAlgorithm) layoutSelector.getSelectedItem());
+    executionOptions.setShowMap(showMap.isSelected());
+    executionOptions.setMinecraftRoot(new File(mcRootPath.getText()));
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog$1.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog$1.html new file mode 100644 index 00000000..bb0eaade --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog$1.html @@ -0,0 +1 @@ +ExecutionDialog.new ActionListener() {...}

ExecutionDialog.new ActionListener() {...}

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total11 of 110%0 of 0n/a223322
{...}60%n/a111111
actionPerformed(ActionEvent)50%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog.html new file mode 100644 index 00000000..75a9ec7d --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog.html @@ -0,0 +1 @@ +ExecutionDialog

ExecutionDialog

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total138 of 1380%0 of 0n/a55373755
addTextArea(JPanel)340%n/a118811
createDialogPanel()310%n/a118811
ExecutionDialog(JFrame, PipedOutputStream)290%n/a11101011
addCloseButton(JPanel)280%n/a115511
startReaderThread(PipedOutputStream)160%n/a116611
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog.java.html new file mode 100644 index 00000000..9f02b234 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/ExecutionDialog.java.html @@ -0,0 +1,126 @@ +ExecutionDialog.java

ExecutionDialog.java

package codemetropolis.toolchain.gui;
+
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.io.PipedOutputStream;
+
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.text.DefaultCaret;
+
+import codemetropolis.toolchain.gui.components.CMButton;
+import codemetropolis.toolchain.gui.components.CMTextArea;
+import codemetropolis.toolchain.gui.utils.StreamReaderWorker;
+import codemetropolis.toolchain.gui.utils.Translations;
+
+/**
+ * A dialog window for showing displaying the standard output of the executors.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class ExecutionDialog extends JDialog {
+
+  private static final long serialVersionUID = 1L;
+
+  private CMTextArea textArea;
+  private CMButton close;
+
+  /**
+   * Creates the dialog window and starts the reader process.
+   *
+   * @param parent The parent frame. Useful in case we might want to turn this into a modal window.
+   * @param out The {@link PipedOutputStream} used for the executors that we need to read.
+   */
+  public ExecutionDialog(JFrame parent, PipedOutputStream out) {
+    super(parent, Translations.t("gui_exec_title"));
+
+    JPanel panel = createDialogPanel();
+    addTextArea(panel);
+    addCloseButton(panel);
+
+    this.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
+    this.setContentPane(panel);
+    this.pack();
+    this.setLocationRelativeTo(null);
+
+    startReaderThread(out);
+  }
+
+  /**
+   * Creates the base panel for this dialog.
+   *
+   * @return The assembled panel.
+   */
+  private JPanel createDialogPanel() {
+    JPanel panel = new JPanel(null);
+    panel.setLayout(null);
+    panel.setBounds(0, 0, 400, 300);
+
+    Dimension size = new Dimension(400, 300);
+    panel.setMinimumSize(size);
+    panel.setPreferredSize(size);
+    panel.setMaximumSize(size);
+
+    return panel;
+  }
+
+  /**
+   * Creates and adds an uneditable {@link CMTextArea} into which the executors' outputs will be fed.
+   *
+   * @param panel The dialog panel.
+   */
+  private void addTextArea(JPanel panel) {
+    textArea = new CMTextArea();
+    textArea.setEditable(false);
+
+    // Automatically scroll to the bottom
+    DefaultCaret caret = (DefaultCaret) textArea.getCaret();
+    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
+
+    JScrollPane pane = new JScrollPane(textArea);
+    pane.setBounds(10, 10, 380, 240);
+
+    panel.add(pane);
+  }
+
+  /**
+   * Creates and adds a close button for this dialog that is disabled by default. It will be enabled when the world
+   * generation is finished.
+   *
+   * @param panel The dialog panel.
+   */
+  private void addCloseButton(JPanel panel) {
+    close = new CMButton(Translations.t("gui_b_close"), 140, 260, 120, 30);
+    close.setEnabled(false);
+    close.addActionListener(new ActionListener() {
+      @Override
+      public void actionPerformed(ActionEvent e) {
+        setVisible(false);
+      }
+    });
+
+    panel.add(close);
+  }
+
+  /**
+   * Starts a {@link javax.swing.SwingWorker} that will read from the specified {@link PipedOutputStream} by feeding it
+   * into a {@link java.io.PipedInputStream}. It appends the lines it reads to the textArea on the dialog frame.
+   *
+   * @param out The {@link PipedOutputStream} used by the executors.
+   */
+  private void startReaderThread(PipedOutputStream out) {
+    try {
+      StreamReaderWorker worker = new StreamReaderWorker(close, textArea, out);
+      worker.execute();
+    } catch (IOException e) {
+      // Can't really do anything about this
+      e.printStackTrace();
+    }
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/GUIController.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/GUIController.html new file mode 100644 index 00000000..9fbeb90b --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/GUIController.html @@ -0,0 +1 @@ +GUIController

GUIController

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total147 of 1470%4 of 40%99272777
execute(PrintStream)520%n/a11101011
createTargetFolder()500%40%337711
GUIController()270%n/a116611
getCurrentDateString()60%n/a111111
static {...}60%n/a111111
getExecutionOptions()30%n/a111111
getMetricGeneratorPanels()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/GUIController.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/GUIController.java.html new file mode 100644 index 00000000..d18c2b30 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/GUIController.java.html @@ -0,0 +1,103 @@ +GUIController.java

GUIController.java

package codemetropolis.toolchain.gui;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import codemetropolis.toolchain.gui.beans.ExecutionException;
+import codemetropolis.toolchain.gui.beans.ExecutionOptions;
+import codemetropolis.toolchain.gui.components.CMMetricPanel;
+import codemetropolis.toolchain.gui.executors.ConverterToolExecutor;
+import codemetropolis.toolchain.gui.executors.MappingToolExecutor;
+import codemetropolis.toolchain.gui.executors.MetricGeneratorExecutor;
+import codemetropolis.toolchain.gui.executors.PlacingToolExecutor;
+import codemetropolis.toolchain.gui.executors.RenderingToolExecutor;
+import codemetropolis.toolchain.gui.metricgenerators.SonarQubeGenerator;
+import codemetropolis.toolchain.gui.metricgenerators.SourceMeterGenerator;
+import codemetropolis.toolchain.gui.utils.Translations;
+
+/**
+ * Controller class for the GUI that handles tasks like managing the toolchain execution.
+ *
+ * @author Abel Szkalisity {@literal <SZAVAET.SZE>}
+ */
+public class GUIController {
+
+  private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyyMMdd-hhmmss-SSS");
+
+  private ExecutionOptions executionOptions;
+  private List<CMMetricPanel> metricGeneratorPanels = new ArrayList<CMMetricPanel>();
+
+  /**
+   * Instantiates a {@link GUIController} and adds the available metricGeneration options.
+   */
+  public GUIController() {
+    executionOptions = new ExecutionOptions();
+
+    metricGeneratorPanels.add(new SourceMeterGenerator());
+    metricGeneratorPanels.add(new SonarQubeGenerator());
+  }
+
+  /**
+   * Handles toolchain execution. Creates the folder that stores the intermediate project files, then it runs each part
+   * of the toolchain in sequence.
+   *
+   * @param out The {@link PrintStream} instance that will be set for each executor, so we can read their outputs and
+   *          display them for the user.
+   * @throws ExecutionException if any exception occurs during execution.
+   */
+  public void execute(PrintStream out) throws ExecutionException {
+    try {
+      File projectRoot = createTargetFolder();
+
+      new MetricGeneratorExecutor().execute(projectRoot, executionOptions, out);
+      new ConverterToolExecutor().execute(projectRoot, executionOptions, out);
+      new MappingToolExecutor().execute(projectRoot, executionOptions, out);
+      new PlacingToolExecutor().execute(projectRoot, executionOptions, out);
+      new RenderingToolExecutor().execute(projectRoot, executionOptions, out);
+    } catch (Exception e) {
+      throw new ExecutionException("Toolchain execution failed!", e);
+    }
+  }
+
+  /**
+   * Creates the folder that will be used to store the intermediate project files.
+   *
+   * @return The {@link File} object for the generated directory.
+   * @throws ExecutionException if creating the directory failed.
+   */
+  private File createTargetFolder() throws ExecutionException {
+    File cmRoot = new File(executionOptions.getMinecraftRoot().getAbsolutePath() + File.separator + ".code-metropolis");
+    if (!cmRoot.exists()) {
+      cmRoot.mkdir();
+    }
+
+    File projectRoot = new File(cmRoot.getAbsolutePath() + File.separator + getCurrentDateString());
+    if (!projectRoot.mkdir()) {
+      throw new ExecutionException(Translations.t("gui_err_mkdir_project_failed"));
+    }
+    return projectRoot;
+  }
+
+  /**
+   * Gets the current date and time, then returns a formatted version of it, that can act as a valid directory name.
+   *
+   * @return The formatted date and time.
+   */
+  private String getCurrentDateString() {
+    return DATE_FORMATTER.format(new Date());
+  }
+
+  public ExecutionOptions getExecutionOptions() {
+    return executionOptions;
+  }
+
+  public List<CMMetricPanel> getMetricGeneratorPanels() {
+    return metricGeneratorPanels;
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/Main.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/Main.html new file mode 100644 index 00000000..48daffc8 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/Main.html @@ -0,0 +1 @@ +Main

Main

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total111 of 1110%2 of 20%66171755
static {...}520%n/a112211
loadSourceSansProFonts()360%20%225511
main(String[])150%n/a116611
setSystemLookAndFeel()50%n/a113311
Main()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/Main.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/Main.java.html new file mode 100644 index 00000000..821bd39b --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/Main.java.html @@ -0,0 +1,65 @@ +Main.java

Main.java

package codemetropolis.toolchain.gui;
+
+import java.awt.Font;
+import java.awt.FontFormatException;
+import java.awt.GraphicsEnvironment;
+import java.io.IOException;
+
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+/**
+ * Main class for the CodeMetropolis' GUI module. Initializes some globals, like fonts and look-and-feel, and
+ * instaniates the main gui window.
+ *
+ * @author Adam Bankeszi {@literal <BAAVAGT.SZE>}
+ */
+public class Main {
+
+  private static final int TTF = Font.TRUETYPE_FONT;
+  private static final String SOURCE_SANS = "fonts/SourceSansPro-";
+  private static final String[] FONT_VARIATIONS = { "Black", "BlackItalic", "Bold", "BoldItalic", "ExtraLight",
+    "ExtraLightItalic", "Italic", "Light", "LightItalic", "Regular", "Semibold", "SemiboldItalic" };
+
+  /**
+   * The CodeMetropolis GUI application entry point.
+   *
+   * @param args The command line arguments. Since this a GUI application, it is currently unused.
+   */
+  public static void main(String[] args) {
+    setSystemLookAndFeel();
+    loadSourceSansProFonts();
+
+    // Instantiate the GUI
+    GUIController controller = new GUIController();
+    CodeMetropolisGUI gui = new CodeMetropolisGUI(controller);
+    gui.setVisible(true);
+  }
+
+  /**
+   * Attempts to set the lookAndFeel used by the Swing components to be the system's lookAndFeel.
+   */
+  private static final void setSystemLookAndFeel() {
+    try {
+      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
+      // Failed to set system look and feel. Continue regardless.
+    }
+  }
+
+  /**
+   * Attempts to load the SourceSans ttf font files from the classpath.
+   */
+  private static final void loadSourceSansProFonts() {
+    try {
+      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+      for (String variation : FONT_VARIATIONS) {
+        ge.registerFont(Font.createFont(TTF, ClassLoader.getSystemResourceAsStream(SOURCE_SANS + variation + ".ttf")));
+      }
+    } catch (FontFormatException | IOException e) {
+      // Failed to load font files. Using defaults instead.
+    }
+  }
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$1.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$1.html new file mode 100644 index 00000000..c6d3ac2a --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$1.html @@ -0,0 +1 @@ +MappingFileEditorDialog.new ActionListener() {...}

MappingFileEditorDialog.new ActionListener() {...}

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total140 of 1400%10 of 100%77262622
actionPerformed(ActionEvent)1340%100%66242411
{...}60%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$2.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$2.html new file mode 100644 index 00000000..278beda4 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$2.html @@ -0,0 +1 @@ +MappingFileEditorDialog.new ActionListener() {...}

MappingFileEditorDialog.new ActionListener() {...}

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total140 of 1400%12 of 120%88252522
actionPerformed(ActionEvent)1340%120%77232311
{...}60%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$3.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$3.html new file mode 100644 index 00000000..3e0a5483 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$3.html @@ -0,0 +1 @@ +MappingFileEditorDialog.new ActionListener() {...}

MappingFileEditorDialog.new ActionListener() {...}

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total175 of 1750%12 of 120%88353522
actionPerformed(ActionEvent)1660%120%77333311
{...}90%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$AssignResult.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$AssignResult.html new file mode 100644 index 00000000..294c3ecf --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$AssignResult.html @@ -0,0 +1 @@ +MappingFileEditorDialog.AssignResult

MappingFileEditorDialog.AssignResult

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total5 of 9094%0 of 0n/a140214
valueOf(String)50%n/a111111
static {...}64100%n/a010101
values()16100%n/a010101
MappingFileEditorDialog.AssignResult(String, int)5100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog.html new file mode 100644 index 00000000..f8074d33 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog.html @@ -0,0 +1 @@ +MappingFileEditorDialog

MappingFileEditorDialog

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total1,100 of 1,26312%4 of 40%15192132411317
createCellarTab()1570%n/a11282811
createFloorTab()1570%n/a11282811
createGardenTab()1570%n/a11282811
addSaveOptions(JPanel)1080%n/a11161611
setUpBuildableTable(String)1050%20%22161611
addResourceOptions(JPanel)930%n/a11161611
createGroundTab()800%n/a11141411
addBuildableTabs(JPanel)670%n/a11131311
loadDisplayedInfo(String)460%n/a11232311
MappingFileEditorDialog(String, CodeMetropolisGUI)390%n/a11131311
initializeListModel(String)370%20%225511
createBasePanel()300%n/a118811
addConversionOptions(JPanel)240%n/a115511
static {...}157100%n/a0102501
getFloorTable()2100%n/a010101
getGardenTable()2100%n/a010101
getCellarTable()2100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog.java.html new file mode 100644 index 00000000..63dd3ced --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog.java.html @@ -0,0 +1,629 @@ +MappingFileEditorDialog.java

MappingFileEditorDialog.java

package codemetropolis.toolchain.gui;
+
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.Rectangle;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.swing.DefaultListModel;
+import javax.swing.DropMode;
+import javax.swing.JDialog;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.ListModel;
+import javax.swing.ListSelectionModel;
+import javax.swing.filechooser.FileFilter;
+
+import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException;
+import codemetropolis.toolchain.gui.beans.QuantizationInformation;
+import codemetropolis.toolchain.gui.components.CMButton;
+import codemetropolis.toolchain.gui.components.CMCheckBox;
+import codemetropolis.toolchain.gui.components.CMLabel;
+import codemetropolis.toolchain.gui.components.CMScrollPane;
+import codemetropolis.toolchain.gui.components.CMTextField;
+import codemetropolis.toolchain.gui.components.listeners.BrowseListener;
+import codemetropolis.toolchain.gui.conversions.Conversion;
+import codemetropolis.toolchain.gui.conversions.QuantizationConversion;
+import codemetropolis.toolchain.gui.utils.BuildableSettings;
+import codemetropolis.toolchain.gui.utils.Property;
+import codemetropolis.toolchain.gui.utils.PropertyCollector;
+import codemetropolis.toolchain.gui.utils.TransferHelper;
+import codemetropolis.toolchain.gui.utils.Translations;
+import codemetropolis.toolchain.gui.utils.XmlFileFilter;
+
+/**
+ * Dialog for the mapping file editor.
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ */
+public class MappingFileEditorDialog extends JDialog {
+	
+	private static final long serialVersionUID = 1L;
+	
+	private static final FileFilter XML_FILTER;
+
+	static public List<Conversion> cellarConversion;
+	static public List<Conversion> gardenConversion;
+	static public List<Conversion> floorConversion;
+
+	static public Map<QuantizationInformation, QuantizationConversion> cellarQuant;
+	static public Map<QuantizationInformation, QuantizationConversion> gardenQuant;
+	static public Map<QuantizationInformation, QuantizationConversion> floorQuant;
+	
+	/**
+	 * Contains the possible results of assigning a metric to a property of a buildable type.
+	 */
+	public enum AssignResult {CANNOT_ASSIGN, NO_CONVERSION, TO_INT, TO_DOUBLE, NORMALIZE, QUANTIZATON};
+	
+	public static final Map<String, Map<String, AssignResult>> ASSIGN_RESULT_MATRIX;
+	
+	static {
+		XML_FILTER = new XmlFileFilter();
+
+		cellarConversion = new ArrayList<Conversion>();
+		gardenConversion = new ArrayList<Conversion>();
+		floorConversion = new ArrayList<Conversion>();
+
+		cellarQuant = new HashMap<QuantizationInformation, QuantizationConversion>();
+		gardenQuant = new HashMap<QuantizationInformation, QuantizationConversion>();
+		floorQuant = new HashMap<QuantizationInformation, QuantizationConversion>();
+
+		ASSIGN_RESULT_MATRIX = new HashMap<String, Map<String, AssignResult>>();
+		
+		ASSIGN_RESULT_MATRIX.put("int", new HashMap<String, AssignResult>());
+		ASSIGN_RESULT_MATRIX.put("int(0 to 5)", new HashMap<String, AssignResult>());
+		ASSIGN_RESULT_MATRIX.put("string", new HashMap<String, AssignResult>());
+		ASSIGN_RESULT_MATRIX.put("float(0 to 1)", new HashMap<String, AssignResult>());
+		//First row of the "matrix"
+		ASSIGN_RESULT_MATRIX.get("int").put("int", AssignResult.NO_CONVERSION);
+		ASSIGN_RESULT_MATRIX.get("int").put("float", AssignResult.TO_INT);
+		ASSIGN_RESULT_MATRIX.get("int").put("string", AssignResult.CANNOT_ASSIGN);
+		//Second row of the "matrix"
+		ASSIGN_RESULT_MATRIX.get("int(0 to 5)").put("int", AssignResult.QUANTIZATON);
+		ASSIGN_RESULT_MATRIX.get("int(0 to 5)").put("float", AssignResult.QUANTIZATON);
+		ASSIGN_RESULT_MATRIX.get("int(0 to 5)").put("string", AssignResult.CANNOT_ASSIGN);
+		//Third row of the "matrix"
+		ASSIGN_RESULT_MATRIX.get("string").put("int", AssignResult.QUANTIZATON);
+		ASSIGN_RESULT_MATRIX.get("string").put("float", AssignResult.QUANTIZATON);
+		ASSIGN_RESULT_MATRIX.get("string").put("string", AssignResult.NO_CONVERSION);
+		//Fourth row of the "matrix"
+		ASSIGN_RESULT_MATRIX.get("float(0 to 1)").put("int", AssignResult.NORMALIZE);
+		ASSIGN_RESULT_MATRIX.get("float(0 to 1)").put("float", AssignResult.NORMALIZE);
+		ASSIGN_RESULT_MATRIX.get("float(0 to 1)").put("string", AssignResult.CANNOT_ASSIGN);
+	}
+		
+	private Map<String, String[]> displayedBuildableAttributes;
+	private Map<String, List<Property>> sourceCodeElementProperties;
+	
+	private JTabbedPane buildableTabbedPane;	
+	private JPanel cellarPanel;
+	private JPanel floorPanel;
+	private JPanel gardenPanel;
+	private JPanel groundPanel;
+	private static JTable cellarTable;
+	private static JTable floorTable;
+	private static JTable gardenTable;
+	
+	//ListModel and JList for the buildables: cellar, floor, garden
+	private ListModel<String> cellarListmodel;
+	private JList<String> cellarList;
+	private ListModel<String> floorListmodel;
+	private JList<String> floorList;
+	private ListModel<String> gardenListmodel;
+	private JList<String> gardenList;
+	
+	//ListModel and JList for the resources
+	private ListModel<String> resourcesListmodel;
+	private JList<String> resourcesList;
+	
+	private CMCheckBox useMappingCheckBox;
+	private CMTextField pathField;
+	
+	/**
+	 * Loads the list of the buildable attributes which are desired to display on the GUI from the configuration file.
+	 * Loads the list of the source code element from the given input cdf xml file.
+	 * @param cdfFilePath The path of the input cdf xml file.
+	 */
+	private void loadDisplayedInfo(String cdfFilePath) {
+		try {
+			BuildableSettings settings = new BuildableSettings();
+			displayedBuildableAttributes = settings.readSettings();
+						
+		}
+		catch(BadConfigFileFomatException e) {
+			JOptionPane.showMessageDialog(
+					null,
+					Translations.t("gui_err_invaild_config_file_format"),
+					Translations.t("gui_err_title"),
+					JOptionPane.ERROR_MESSAGE);
+			
+			displayedBuildableAttributes = BuildableSettings.DEFAULT_SETTINGS;
+		}
+		catch(FileNotFoundException e) {
+			JOptionPane.showMessageDialog(
+					null,
+					Translations.t("gui_err_config_file_not_found"),
+					Translations.t("gui_err_title"),
+					JOptionPane.ERROR_MESSAGE);
+			
+			displayedBuildableAttributes = BuildableSettings.DEFAULT_SETTINGS;
+		}
+		try {
+			PropertyCollector pc = new PropertyCollector();
+			sourceCodeElementProperties = pc.getFromCdf(cdfFilePath);
+		}
+		catch(FileNotFoundException e) {
+			e.printStackTrace();
+		}
+		
+	}
+	
+	 /**
+	  * Instantiates the Mapping file editor dialog.
+	  *
+	  * @param cdfFilePath The path of the input cdf xml file.
+	  * @param cmGui The parent window of the dialog.
+	  */
+	public MappingFileEditorDialog(String cdfFilePath, CodeMetropolisGUI cmGui) {
+		super(cmGui, Translations.t("gui_mapping_editor_title") ,true);
+		loadDisplayedInfo(cdfFilePath);
+		
+		JPanel panel = createBasePanel();
+		addResourceOptions(panel);
+		addSaveOptions(panel);
+		addBuildableTabs(panel);
+		addConversionOptions(panel);
+		
+		this.setResizable(false);
+	    this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
+	    this.setContentPane(panel);
+	    this.pack();
+	    this.setLocationRelativeTo(cmGui);
+	}
+	
+	/**
+	 * Creates the base panel for the Mapping file editor dialog.
+	 * 
+	 * @return The created {@link JPanel}.
+	 */
+	private JPanel createBasePanel() {
+		JPanel panel = new JPanel();
+	    panel.setLayout(null);
+	    panel.setBounds(0, 0, 800, 550);
+
+	    Dimension size = new Dimension(800, 550);
+	    panel.setMinimumSize(size);
+	    panel.setPreferredSize(size);
+	    panel.setMaximumSize(size);
+
+	    return panel;
+	}
+	
+	/**
+	 * Adds the resource options to the {@code panel}.
+	 * @param panel The {@link JPanel} to which the components will be added to.
+	 */
+	private void addResourceOptions(JPanel panel) {
+		CMLabel resourcesLabel = new CMLabel(Translations.t("gui_l_resources"), 10, 0, 120, 30);
+		
+		resourcesListmodel = new DefaultListModel<String>();
+	    resourcesList = new JList<String>(resourcesListmodel);
+	    resourcesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+	    resourcesList.setLayoutOrientation(JList.VERTICAL);
+	    resourcesList.setVisibleRowCount(-1);
+		CMScrollPane resourcesScrollPane = new CMScrollPane(resourcesList, 10, 35, 240, 120);
+		
+		CMButton resourcesAddButton = new CMButton(Translations.t("gui_b_add"), 265, 35, 120, 30);
+		resourcesAddButton.addActionListener(new ActionListener() {
+			
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				JTextField nameField = new JTextField();
+				JTextField valueField = new JTextField();
+				
+				JPanel addResourcePanel = new JPanel();
+				addResourcePanel.setLayout(new GridLayout(4, 2));
+				addResourcePanel.add(new JLabel("Resource name:"));
+				addResourcePanel.add(nameField);
+				addResourcePanel.add(new JLabel("Resource value:"));
+				addResourcePanel.add(valueField);
+				
+				int result = JOptionPane.showConfirmDialog(null, addResourcePanel, Translations.t("gui_add_resource_title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
+				if(result == JOptionPane.OK_OPTION) {
+					if (nameField.getText().matches("[a-zA-Z0-9]+") &&
+						(valueField.getText().matches("[0-9]+(.[0-9]+)?")) ||  BuildableSettings.VALID_CHARACTER_TYPES.contains(valueField.getText())) {
+						//Produce the resource string from the text fields...
+						String resourceToAdd = nameField.getText() + ": " + valueField.getText();
+						//Add the newly defined resource to the property lists of the buildables and to the resource list (on top left of the window).
+						List<JList<String>> lists = Arrays.asList(resourcesList, cellarList, floorList, gardenList);
+						for (JList<String> list : lists) {
+							DefaultListModel<String> listModel = (DefaultListModel<String>) list.getModel();
+							listModel.addElement(resourceToAdd);
+						} 
+					}
+					else {
+						JOptionPane.showMessageDialog(
+								null,
+								Translations.t("gui_err_name_value_not_valid"),
+								Translations.t("gui_err_title"),
+								JOptionPane.ERROR_MESSAGE);
+					}
+				}
+			}
+		});
+		CMButton resourcesRemoveButton = new CMButton(Translations.t("gui_b_remove"), 265, 80, 120, 30);
+		resourcesRemoveButton.addActionListener(new ActionListener() {
+			
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				int indexToRemove = resourcesList.getSelectedIndex();
+				if(indexToRemove == -1) {
+					JOptionPane.showMessageDialog(
+							null,
+							Translations.t("gui_err_resources_empty_no_selected"),
+							Translations.t("gui_err_title"),
+							JOptionPane.ERROR_MESSAGE);
+				}
+				else {
+					String resourceToRemove = resourcesList.getModel().getElementAt(indexToRemove);
+					List<JList<String>> lists = Arrays.asList(resourcesList, cellarList, floorList, gardenList);
+					List<JTable> tables = Arrays.asList(cellarTable, floorTable, gardenTable);
+					for(JList<String> list : lists) {
+						DefaultListModel<String> listModel = (DefaultListModel<String>) list.getModel();
+						listModel.removeElement(resourceToRemove);
+					}
+					for(JTable table : tables) {
+						int rows = table.getRowCount();
+						int columns = table.getColumnCount();
+						for(int i = 0; i < rows; i++)
+							for(int j = 0; j < columns; j++) {
+								String cellValue = (String) table.getValueAt(i, j);
+								if(resourceToRemove.equals(cellValue)) {
+									table.setValueAt(null, i, j);
+								}
+							}
+					}
+				}				
+			}
+		});
+		
+		panel.add(resourcesLabel);
+		panel.add(resourcesScrollPane);
+		panel.add(resourcesAddButton);
+		panel.add(resourcesRemoveButton);
+	}
+	
+	/**
+	 * Adds the saving options to the {@code panel}.
+	 * @param panel The {@link JPanel} to which the components will be added to.
+	 */
+	private void addSaveOptions(JPanel panel) {
+		CMLabel saveSettingsLabel = new CMLabel(Translations.t("gui_l_save_settings"), 415, 0, 120, 30);
+		CMLabel pathLabel = new CMLabel(Translations.t("gui_l_path"), 415, 35, 60, 30);
+		pathField = new CMTextField(475, 35, 270, 30);
+		CMButton specifyPathButton = new CMButton(Translations.t("gui_b_specify_path"), 415, 80, 120, 30);
+		useMappingCheckBox = new CMCheckBox(550, 80, 30, 30);
+		CMLabel useMappingLabel = new CMLabel(Translations.t("gui_l_use_mapping_file"),575, 80, 180, 30);
+		CMButton saveMappingFileButton = new CMButton(Translations.t("gui_b_save_mapping_file"), 415, 120, 165, 30);
+		specifyPathButton.addActionListener(new BrowseListener(pathField, JFileChooser.FILES_ONLY, XML_FILTER));
+		
+		panel.add(saveSettingsLabel);
+		panel.add(pathLabel);
+		panel.add(pathField);
+		panel.add(specifyPathButton);
+		panel.add(useMappingCheckBox);
+		panel.add(useMappingLabel);
+		panel.add(saveMappingFileButton);
+	}
+	
+	/**
+	 * Adds the the tabs of the buildables to the {@code buildableTabbedPane} {@link JTabbedPane}.
+	 * @param panel The {@link JPanel} to which the {@code buildableTabbedPane} will be added to.
+	 */
+	private void addBuildableTabs(JPanel panel) {
+		buildableTabbedPane = new JTabbedPane();
+		
+		createCellarTab();
+		createFloorTab();
+		createGardenTab();
+		createGroundTab();
+		
+		buildableTabbedPane.add(Translations.t("gui_tab_cellar"), cellarPanel);
+		buildableTabbedPane.add(Translations.t("gui_tab_floor"), floorPanel);
+		buildableTabbedPane.add(Translations.t("gui_tab_garden"), gardenPanel);
+		buildableTabbedPane.add(Translations.t("gui_tab_ground"), groundPanel);
+		
+		buildableTabbedPane.setFont(new Font("Source Sans Pro", Font.PLAIN, 16));
+		buildableTabbedPane.setBounds(10, 175, 780, 300);
+		
+		panel.add(buildableTabbedPane);
+		
+	}
+	
+	/**
+	 * Creates the tab to the buildable type cellar, where the buildable attributes and their desired values can be paired.
+	 */
+	private void createCellarTab() {
+		cellarPanel = new JPanel();
+		cellarPanel.setLayout(null);
+	    cellarPanel.setBounds(0, 0, 780, 285);
+
+	    Dimension size = new Dimension(780, 285);
+	    cellarPanel.setMinimumSize(size);
+	    cellarPanel.setPreferredSize(size);
+	    cellarPanel.setMaximumSize(size);
+	    
+	    CMLabel assignedLabel = new CMLabel(Translations.t("gui_l_assigned_to"), 15, 15, 270, 30);
+	    CMLabel attributeLabel = new CMLabel(Translations.t("gui_l_attribute"), 270, 15, 60, 30);
+	    CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30);
+	    
+	    cellarTable = setUpBuildableTable("CELLAR");
+	    Rectangle bounds = cellarTable.getBounds();
+	    CMScrollPane scrollPane = new CMScrollPane(cellarTable, bounds.x, bounds.y, bounds.width, bounds.height + 30);
+	    
+	    cellarListmodel = initializeListModel("attribute");
+	    cellarList = new JList<String>();
+	    cellarList.setModel(cellarListmodel);
+	    cellarList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+	    cellarList.setLayoutOrientation(JList.VERTICAL);
+	    cellarList.setVisibleRowCount(-1);
+	    cellarList.setDragEnabled(true);
+	    cellarList.setDropMode(DropMode.INSERT);
+
+	    CMScrollPane cellarScrollPane = new CMScrollPane(cellarList, 525, 50, 240, 180);
+	    
+	    cellarPanel.add(assignedLabel);
+	    cellarPanel.add(attributeLabel);
+	    cellarPanel.add(propertiesLabel);
+	    cellarPanel.add(scrollPane);
+	    cellarPanel.add(cellarScrollPane);	    
+	}
+	
+	/**
+	 * Creates the tab to the buildable type floor, where the buildable attributes and their desired values can be paired.
+	 */
+	private void createFloorTab() {
+		floorPanel = new JPanel();
+		floorPanel.setLayout(null);
+	    floorPanel.setBounds(0, 0, 780, 285);
+
+	    Dimension size = new Dimension(780, 285);
+	    floorPanel.setMinimumSize(size);
+	    floorPanel.setPreferredSize(size);
+	    floorPanel.setMaximumSize(size);
+	    
+	    CMLabel assignedLabel = new CMLabel(Translations.t("gui_l_assigned_to"), 15, 15, 270, 30);
+	    CMLabel methodLabel = new CMLabel(Translations.t("gui_l_method"), 270, 15, 60, 30);
+	    CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30);		
+	    
+	    floorTable = setUpBuildableTable("FLOOR");
+	    Rectangle bounds = floorTable.getBounds();
+	    CMScrollPane scrollPane = new CMScrollPane(floorTable, bounds.x, bounds.y, bounds.width, bounds.height + 30);
+	    
+	    floorListmodel = initializeListModel("method");
+	    floorList = new JList<String>();
+	    floorList.setModel(floorListmodel);
+	    floorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+	    floorList.setLayoutOrientation(JList.VERTICAL);
+	    floorList.setVisibleRowCount(-1);
+	    floorList.setDragEnabled(true);
+	    floorList.setDropMode(DropMode.INSERT);
+	    
+	    CMScrollPane floorScrollPane = new CMScrollPane(floorList, 525, 50, 240, 180);
+	    
+	    floorPanel.add(assignedLabel);
+	    floorPanel.add(methodLabel);
+	    floorPanel.add(propertiesLabel);
+	    floorPanel.add(scrollPane);
+	    floorPanel.add(floorScrollPane);
+	}
+	
+	/**
+	 * Creates the tab to the buildable type garden, where the buildable attributes and their desired values can be paired.
+	 */
+	private void createGardenTab() {
+		gardenPanel = new JPanel();
+		gardenPanel.setLayout(null);
+	    gardenPanel.setBounds(0, 0, 780, 285);
+
+	    Dimension size = new Dimension(780, 285);
+	    gardenPanel.setMinimumSize(size);
+	    gardenPanel.setPreferredSize(size);
+	    gardenPanel.setMaximumSize(size);
+	    
+	    CMLabel assignedLabel = new CMLabel(Translations.t("gui_l_assigned_to"), 15, 15, 270, 30);
+	    CMLabel classLabel = new CMLabel(Translations.t("gui_l_class"), 270, 15, 60, 30);
+	    CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30);
+	    
+	    gardenTable = setUpBuildableTable("GARDEN");
+	    Rectangle bounds = gardenTable.getBounds();
+	    CMScrollPane scrollPane = new CMScrollPane(gardenTable, bounds.x, bounds.y, bounds.width, bounds.height + 30);
+	    
+	    gardenListmodel = initializeListModel("class");
+	    gardenList = new JList<String>();
+	    gardenList.setModel(gardenListmodel);
+	    gardenList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+	    gardenList.setLayoutOrientation(JList.VERTICAL);
+	    gardenList.setVisibleRowCount(-1);
+	    gardenList.setDragEnabled(true);
+	    gardenList.setDropMode(DropMode.INSERT);
+	    
+	    CMScrollPane gardenScrollPane = new CMScrollPane(gardenList, 525, 50, 240, 180);
+	    
+	    gardenPanel.add(assignedLabel);
+	    gardenPanel.add(classLabel);
+	    gardenPanel.add(propertiesLabel);
+	    gardenPanel.add(scrollPane);
+	    gardenPanel.add(gardenScrollPane);
+	}
+	
+	/**
+	 * Creates the tab to the buildable type ground.
+	 */
+	private void createGroundTab() {
+		groundPanel = new JPanel();
+		groundPanel.setLayout(null);
+	    groundPanel.setBounds(0, 0, 780, 285);
+
+	    Dimension size = new Dimension(780, 285);
+	    groundPanel.setMinimumSize(size);
+	    groundPanel.setPreferredSize(size);
+	    groundPanel.setMaximumSize(size);
+	    
+	    CMLabel assignedLabel = new CMLabel(Translations.t("gui_l_assigned_to"), 15, 15, 270, 30);
+	    CMLabel packageLabel = new CMLabel(Translations.t("gui_l_package"), 270, 15, 60, 30);
+	    CMLabel noAttrsLabel = new CMLabel(Translations.t("gui_l_no_attributes"), 15, 60, 300, 30);
+	    
+	    groundPanel.add(assignedLabel);
+	    groundPanel.add(packageLabel);
+	    groundPanel.add(noAttrsLabel);
+	}
+	
+	/**
+	 * Sets up the table of a buildable type which contains the attributes of the buildable (height, character, etc.) and provides a second column for their values.
+	 * @param buildableType The type of the buildable (method, attribute, etc.).
+	 * @return The JTable contains the buildable attributes.
+	 */
+	private JTable setUpBuildableTable(String buildableType) {
+		String[] displayedProperties = displayedBuildableAttributes.get(buildableType);
+	    
+		Object[] columnNames = new String[] {Translations.t("gui_t_attribute"), Translations.t("gui_t_assigned_propery")};
+	    Object[][] initData = new Object[displayedProperties.length][2];
+	    
+	    for(int i = 0; i < displayedProperties.length; i++) {
+	    	initData[i][0] = displayedProperties[i] + ": " + BuildableSettings.BUILDABLE_ATTRIBUTE_TYPES.get(displayedProperties[i]);
+	    	initData[i][1] = null;
+	    }
+
+	    JTable table = new JTable(initData, columnNames);
+	    table.setFont(new Font("Source Sans Pro", Font.PLAIN, 14));
+	    table.setRowHeight(30);
+	    table.setBounds(15, 50, 480, displayedProperties.length * 30);
+        table.setDragEnabled(true);
+        table.setDropMode(DropMode.USE_SELECTION);
+        table.setTransferHandler(new TransferHelper());
+        table.setRowSelectionAllowed(false);
+        table.setCellSelectionEnabled(true);
+
+	    return table;
+	}
+
+	/**
+	 * Fills up the list model of the given source code element type with its own properties/metrics.
+	 * @param sourceCodeElementType Type of the source code element (method, attribute, etc.).
+	 * @return The {@link ListModel} contains all of the properties/metrics.
+	 */
+	public ListModel<String> initializeListModel(String sourceCodeElementType) {
+		List<Property> propertyList = sourceCodeElementProperties.get(sourceCodeElementType);
+
+		DefaultListModel<String> model = new DefaultListModel<String>();
+		
+		for(Property p : propertyList) {
+			model.addElement(p.name + ": " + p.type);
+		}
+		
+		return model;
+	}
+	
+	/**
+	 * Adds the conversion options to the {@code panel}.
+	 * @param panel The {@link JPanel} to which the options will be added to.
+	 */
+	private void addConversionOptions(JPanel panel) {
+		CMButton conversionButton = new CMButton(Translations.t("gui_b_conversions"), 10, 490, 150, 30);
+		panel.add(conversionButton);
+		
+		MappingFileEditorDialog self = this;
+		conversionButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				int index;
+				String buildableAttribute;
+				String metric;
+
+				for (Conversion element :  cellarConversion) {
+					if ( element instanceof QuantizationConversion ) {
+						QuantizationInformation cellar = new QuantizationInformation();
+
+						index = cellarConversion.indexOf(element);
+						buildableAttribute = (String) cellarTable.getModel().getValueAt(index, 0);
+						metric = (String) cellarTable.getModel().getValueAt(index, 1);
+
+						cellar.setIndex(index);
+						cellar.setBuildableAttribute(buildableAttribute);
+						cellar.setMetric(metric);
+
+						cellarQuant.put(cellar, new QuantizationConversion());
+					}
+				}
+				for (Conversion element :  gardenConversion) {
+					if ( element instanceof QuantizationConversion ) {
+						QuantizationInformation garden = new QuantizationInformation();
+
+						index = gardenConversion.indexOf(element);
+						buildableAttribute = (String) gardenTable.getModel().getValueAt(index, 0);
+						metric = (String) gardenTable.getModel().getValueAt(index, 1);
+
+						garden.setIndex(index);
+						garden.setBuildableAttribute(buildableAttribute);
+						garden.setMetric(metric);
+
+						gardenQuant.put(garden, new QuantizationConversion());
+					}
+				}
+				for (Conversion element :  floorConversion) {
+					if ( element instanceof QuantizationConversion ) {
+						QuantizationInformation floor = new QuantizationInformation();
+
+						index = floorConversion.indexOf(element);
+						buildableAttribute = (String) floorTable.getModel().getValueAt(index, 0);
+						metric = (String) floorTable.getModel().getValueAt(index, 1);
+
+						floor.setIndex(index);
+						floor.setBuildableAttribute(buildableAttribute);
+						floor.setMetric(metric);
+
+						floorQuant.put(floor, new QuantizationConversion());
+					}
+				}
+				QuantizationSetterDialog dialog = new QuantizationSetterDialog(self);
+				dialog.setVisible(true);
+				
+			}
+		});
+	}
+
+    /**
+     * @return floorTable
+     */
+    public static JTable getFloorTable() {
+    	return floorTable;
+    }
+
+    /**
+     * @return gardenTable
+     */
+    public static JTable getGardenTable() {
+        return gardenTable;
+    }
+
+    /**
+     * @return cellarTable
+     */
+    public static JTable getCellarTable() {
+        return cellarTable;
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/QuantizationSetterDialog.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/QuantizationSetterDialog.html new file mode 100644 index 00000000..efd6e03f --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/QuantizationSetterDialog.html @@ -0,0 +1 @@ +QuantizationSetterDialog

QuantizationSetterDialog

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total312 of 3120%8 of 80%1111656577
addCellarComponents(JPanel)620%n/a119911
addFloorComponents(JPanel)620%n/a119911
addGardenComponents(JPanel)620%n/a119911
fillComboBox(String)460%80%55141411
QuantizationSetterDialog(MappingFileEditorDialog)350%n/a11131311
createBasePanel()300%n/a118811
addSaveComponents(JPanel)150%n/a113311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/QuantizationSetterDialog.java.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/QuantizationSetterDialog.java.html new file mode 100644 index 00000000..3cb8b9b7 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/QuantizationSetterDialog.java.html @@ -0,0 +1,129 @@ +QuantizationSetterDialog.java

QuantizationSetterDialog.java

package codemetropolis.toolchain.gui;
+
+import java.awt.Dimension;
+import java.util.Set;
+
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+
+import codemetropolis.toolchain.gui.beans.QuantizationInformation;
+import codemetropolis.toolchain.gui.components.CMButton;
+import codemetropolis.toolchain.gui.components.CMComboBox;
+import codemetropolis.toolchain.gui.components.CMLabel;
+import codemetropolis.toolchain.gui.components.CMTextField;
+import codemetropolis.toolchain.gui.utils.BuildableSettings;
+import codemetropolis.toolchain.gui.utils.Translations;
+
+/**
+ * This class is define the view of
+ * quantization dialog.
+ *
+ * @author Tamas Keri {@literal <KETWAAT.SZE>}
+ * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
+ */
+public class QuantizationSetterDialog extends JDialog {
+
+	private static final long serialVersionUID = 1L;
+
+	MappingFileEditorDialog parent;
+
+	CMTextField gardenTextField;
+	CMTextField cellarTextField;
+	CMTextField floorTextField;
+
+	CMButton gardenButton;
+	CMButton cellarButton;
+	CMButton floorButton;
+
+	CMComboBox<QuantizationInformation> gardenComboBox;
+	CMComboBox<QuantizationInformation> cellarComboBox;
+	CMComboBox<QuantizationInformation> floorComboBox;
+
+	public QuantizationSetterDialog(MappingFileEditorDialog parent) {
+		this.parent = parent;
+		JPanel panel = createBasePanel();
+		addCellarComponents(panel);
+		addFloorComponents(panel);
+		addGardenComponents(panel);
+		addSaveComponents(panel);
+		
+		this.setResizable(false);
+	    this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
+	    this.setContentPane(panel);
+	    this.pack();
+	    this.setLocationRelativeTo(parent);
+	}
+	
+	private JPanel createBasePanel() {
+		JPanel panel = new JPanel();
+	    panel.setLayout(null);
+	    panel.setBounds(0, 0, 300, 500);
+
+	    Dimension size = new Dimension(300, 500);
+	    panel.setMinimumSize(size);
+	    panel.setPreferredSize(size);
+	    panel.setMaximumSize(size);
+
+	    return panel;
+	}
+	
+	private void addCellarComponents(JPanel panel) {
+		CMLabel forCellarLabel = new CMLabel(Translations.t("gui_buildable_cellar"), 0, 0, 120, 30);
+		cellarComboBox = new CMComboBox<QuantizationInformation>(fillComboBox("CELLAR"), 0, 40, 250, 30);
+		cellarTextField = new CMTextField(0, 80, 160, 30);
+		cellarButton = new CMButton(Translations.t("gui_b_add_level_value"), 170, 120, 80, 30);
+		panel.add(forCellarLabel);
+		panel.add(cellarComboBox);
+		panel.add(cellarTextField);
+		panel.add(cellarButton);
+	}
+	
+	private void addFloorComponents(JPanel panel) {
+		CMLabel forFloorLabel = new CMLabel(Translations.t("gui_buildable_floor"), 0, 180, 120, 30);
+		floorComboBox = new CMComboBox<QuantizationInformation>(fillComboBox("FLOOR"), 0, 220, 250, 30);
+		floorTextField = new CMTextField(0, 260, 160, 30);
+		floorButton = new CMButton(Translations.t("gui_b_add_level_value"), 170, 300, 80, 30);
+		panel.add(forFloorLabel);
+		panel.add(floorComboBox);
+		panel.add(floorTextField);
+		panel.add(floorButton);
+	}
+	
+	private void addGardenComponents(JPanel panel) {
+		CMLabel forGardenLabel = new CMLabel(Translations.t("gui_buildable_garden"), 0, 340, 120, 30);
+		gardenComboBox = new CMComboBox<QuantizationInformation>(fillComboBox("GARDEN"), 0, 380, 250, 30);
+		gardenTextField = new CMTextField(0, 80, 160, 30);
+		gardenButton = new CMButton(Translations.t("gui_b_add_level_value"), 170, 420, 80, 30);
+		panel.add(forGardenLabel);
+		panel.add(gardenComboBox);
+		panel.add(gardenTextField);
+		panel.add(gardenButton);
+	}
+	
+	private void addSaveComponents(JPanel panel) {
+		CMButton saveButton = new CMButton(Translations.t("gui_b_save_settings"), 0, 460, 100, 30);
+		panel.add(saveButton);
+	}
+	
+	private QuantizationInformation[] fillComboBox(String buildableType) {		
+		Set<String> acceptedTypes = BuildableSettings.DEFAULT_SETTINGS.keySet();
+		String inputType = buildableType.toUpperCase();
+		if (acceptedTypes.contains(inputType)) {
+			Set<QuantizationInformation> set = null;
+			if(inputType.equals("CELLAR")) {
+				set = MappingFileEditorDialog.cellarQuant.keySet();
+			}
+			if(inputType.equals("FLOOR")) {
+				set = MappingFileEditorDialog.floorQuant.keySet();
+			}
+			if(inputType.equals("GARDEN")) {
+				set = MappingFileEditorDialog.gardenQuant.keySet();
+			}			 
+			QuantizationInformation[] boxItems = new QuantizationInformation[set.size()];
+			boxItems = set.toArray(boxItems);
+			return boxItems;
+		}
+		else return null;
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/index.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/index.html new file mode 100644 index 00000000..deab5fd5 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui

codemetropolis.toolchain.gui

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total3,064 of 3,3338%62 of 643%9410459463063721013
MappingFileEditorDialog1,10016312%40%1519213241131701
CodeMetropolisGUI687212%4233%1518131137131501
QuantizationSetterDialog3120%80%111165657711
MappingFileEditorDialog.new ActionListener() {...}1750%120%8835352211
GUIController1470%40%9927277711
MappingFileEditorDialog.new ActionListener() {...}1400%100%7726262211
MappingFileEditorDialog.new ActionListener() {...}1400%120%8825252211
ExecutionDialog1380%n/a5537375511
Main1110%20%6617175511
CodeMetropolisGUI.new ActionListener() {...}600%40%4413132211
CodeMetropolisGUI.new ActionListener() {...}380%20%3312122211
ExecutionDialog.new ActionListener() {...}110%n/a22332211
MappingFileEditorDialog.AssignResult8594%n/a14021401
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/index.source.html b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/index.source.html new file mode 100644 index 00000000..42078f38 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.gui

codemetropolis.toolchain.gui

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total3,064 of 3,3338%62 of 643%9410459463063721013
MappingFileEditorDialog.java1,56024813%380%3946293323202735
CodeMetropolisGUI.java785212%10216%2225153159171923
QuantizationSetterDialog.java3120%80%111165657711
ExecutionDialog.java1490%n/a7739397722
GUIController.java1470%40%9927277711
Main.java1110%20%6617175511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_java/index.html b/doc/codemetropolis-toolchain-gui/src_main_java/index.html new file mode 100644 index 00000000..51eea92a --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_java/index.html @@ -0,0 +1 @@ +src/main/java

src/main/java

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total5,123 of 6,21117%195 of 25322%2943521,0711,2641832224154
codemetropolis.toolchain.gui3,0642698%6223%9410459463063721013
codemetropolis.toolchain.gui.executors6010%280%3535112112202077
codemetropolis.toolchain.gui.utils57078958%815640%731121272712041411
codemetropolis.toolchain.gui.metricgenerators4470%200%23239393131322
codemetropolis.toolchain.gui.components2510%n/a3232767632321010
codemetropolis.toolchain.gui.beans13615%n/a28355263283534
codemetropolis.toolchain.gui.components.listeners340%40%4410102211
codemetropolis.toolchain.gui.conversions23%n/a57795746
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-gui/src_main_resources/index.html b/doc/codemetropolis-toolchain-gui/src_main_resources/index.html new file mode 100644 index 00000000..e4675829 --- /dev/null +++ b/doc/codemetropolis-toolchain-gui/src_main_resources/index.html @@ -0,0 +1 @@ +src/main/resources

src/main/resources

ElementMissed InstructionsCov.Missed BranchesCov.
Total0 of 0n/a0 of 0n/a
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/index.html b/doc/codemetropolis-toolchain-mapping/index.html new file mode 100644 index 00000000..66fb0985 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/index.html @@ -0,0 +1 @@ +codemetropolis-toolchain-mapping

codemetropolis-toolchain-mapping

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,588 of 2,53537%162 of 21323%1912603816041001481128
src/main/java1,58894737%1625123%1912603816041001481128
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/LimitController.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/LimitController.html new file mode 100644 index 00000000..df3e05cb --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/LimitController.html @@ -0,0 +1 @@ +LimitController

LimitController

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 41100%0 of 2100%040803
add(String, String, double)26100%2100%020501
LimitController()8100%n/a010201
getLimit(String, String)7100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/LimitController.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/LimitController.java.html new file mode 100644 index 00000000..41b942d0 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/LimitController.java.html @@ -0,0 +1,24 @@ +LimitController.java

LimitController.java

package codemetropolis.toolchain.mapping.control;
+
+import org.apache.commons.collections4.map.MultiKeyMap;
+
+import codemetropolis.toolchain.mapping.model.Limit;
+
+public class LimitController {
+	
+	private MultiKeyMap<String, Limit> limits = new MultiKeyMap<>();
+	
+	public void add(String sourceName, String sourceFrom, double value) {
+		if(!limits.containsKey(sourceName, sourceFrom)) {
+			limits.put(sourceName, sourceFrom, new Limit());
+		}
+		Limit limit = limits.get(sourceName, sourceFrom);
+		limit.add(value);
+	}
+
+	public Limit getLimit(String sourceName, String sourceFrom) {
+		return limits.get(sourceName, sourceFrom);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/MappingController.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/MappingController.html new file mode 100644 index 00000000..77cde922 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/MappingController.html @@ -0,0 +1 @@ +MappingController

MappingController

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total396 of 77248%82 of 11226%517173165412
linkBuildablesToMetrics()1570%200%1111323211
setProperty(Buildable, String, Object, boolean)830%220%1414121211
prepareBuildables(BuildableTree)780%200%1111121211
validateBuildableStructure(BuildableTree)480%120%77101011
createBuildablesFromCdf(String)237075%2250%2352301
createAttributeMap(Element)59895%41275%41012501
findRoot(Collection)21688%1375%131301
setChildren(Buildable, Element)96100%10100%0602301
setAttributes(Buildable, Element)35100%1150%120801
createBuildable(Element)28100%2100%020701
MappingController(Mapping, double, boolean)27100%n/a010801
MappingController(Mapping)6100%n/a010201
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/MappingController.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/MappingController.java.html new file mode 100644 index 00000000..51f1ef09 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/MappingController.java.html @@ -0,0 +1,305 @@ +MappingController.java

MappingController.java

package codemetropolis.toolchain.mapping.control;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+import java.util.UUID;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import codemetropolis.toolchain.commons.cdf.exceptions.CdfReaderException;
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.commons.cmxml.Buildable.Type;
+import codemetropolis.toolchain.commons.cmxml.BuildableTree;
+import codemetropolis.toolchain.commons.cmxml.BuildableTree.Iterator;
+import codemetropolis.toolchain.mapping.conversions.Conversion;
+import codemetropolis.toolchain.mapping.exceptions.NotValidBuildableStructure;
+import codemetropolis.toolchain.mapping.model.Binding;
+import codemetropolis.toolchain.mapping.model.Limit;
+import codemetropolis.toolchain.mapping.model.Linking;
+import codemetropolis.toolchain.mapping.model.Mapping;
+
+public class MappingController {
+	
+	private static final int MIN_SIZE = 9;
+	
+	private final LimitController limitController = new LimitController();
+	private Map<Buildable, Map<String, String>> attributesByBuildables = new HashMap<>();
+	private double scale;
+	private boolean skipInvalidStructures;
+	private Stack<Buildable> buildableStack = new Stack<>();
+	private Mapping mapping;
+	
+	public MappingController(Mapping mapping) {
+		this(mapping, 1.0, false);
+	}
+	
+	public MappingController(Mapping mapping, double scale, boolean skipInvalidStructures) {
+		this.mapping = mapping;
+		this.scale = scale;
+		this.skipInvalidStructures = skipInvalidStructures;
+	}
+	
+	public void createBuildablesFromCdf(String filename) throws CdfReaderException {
+		attributesByBuildables.clear();
+		
+		try {
+			DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();;
+			DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+			File xmlFile = new File(filename);
+			if(!xmlFile.exists()) {
+				throw new FileNotFoundException();
+			}
+			Document doc = dBuilder.parse(xmlFile);
+			
+			doc.getDocumentElement().normalize();
+			Element rootElement = (Element) doc.getChildNodes().item(0);
+			Buildable container = new Buildable(UUID.randomUUID().toString(), "", Type.CONTAINER);
+				
+			Buildable actualBuildable = createBuildable(rootElement);
+			if(actualBuildable == null){
+				attributesByBuildables.put(container, new HashMap<>());
+				setChildren(container, rootElement);
+			} else {
+				setAttributes(actualBuildable, rootElement);
+				setChildren(actualBuildable, rootElement);	
+				Buildable root = findRoot(attributesByBuildables.keySet());
+				container.addChild(root);
+				attributesByBuildables.put(container, new HashMap<>());
+			}
+		} catch (Exception e){
+			throw new CdfReaderException(e);
+		}
+	}
+	
+	public BuildableTree linkBuildablesToMetrics() {
+		
+		List<Linking> linkings = mapping.getLinkings();
+		Map<String, String> resources = mapping.getResourceMap();
+		
+		for(Map.Entry<Buildable, Map<String, String>> entry : attributesByBuildables.entrySet()) {
+			
+			Buildable b = entry.getKey();
+			Map<String, String> attributes = entry.getValue();
+			
+			Linking linking = null;
+			for(Linking l : linkings) {
+				if(l.getTarget().equalsIgnoreCase(b.getType().toString())) {
+					linking = l;
+					break;
+				}
+			}
+			
+			if(linking == null) {
+				continue;
+			}
+				
+			for(Binding binding : linking.getBindings()) {
+				String variableId = binding.getVariableId();
+				if(variableId != null) {
+					String resource = resources.get(variableId);
+					setProperty(b, binding.getTo(), resource, false);
+					continue;
+				}
+				
+				Object value = attributes.get(binding.getFrom());
+				if(value == null) {
+					String defaultValue = binding.getDefaultValue();
+					if(defaultValue == null || defaultValue.isEmpty()) continue;
+					setProperty(b, binding.getTo(), defaultValue, true);
+					continue;
+				}
+				
+				Limit limit = limitController.getLimit(linking.getSource(), binding.getFrom());
+				
+				for(Conversion c : binding.getConversions()) {
+					value = c.apply(value, limit);
+				}
+				
+				setProperty(b, binding.getTo(), value, true);
+			}
+			
+		}
+		
+		Buildable root = findRoot(attributesByBuildables.keySet());
+		BuildableTree buildableTree = new BuildableTree(root);
+		prepareBuildables(buildableTree);
+		return buildableTree;
+	}
+	
+	private void setProperty(Buildable b, String propertyName, Object value, boolean adjustSize) {
+
+		switch(propertyName) {
+			case "height":
+			case "width":
+			case "length":
+				value = Conversion.toInt(value);
+				if(adjustSize) value = Conversion.toInt(MIN_SIZE + (int)value * scale);
+				break;
+		}
+		
+		switch(propertyName) {
+			case "height":
+				b.setSizeY((int)value);
+				break;
+			case "width":
+				b.setSizeX((int)value);
+				break;
+			case "length":
+				b.setSizeZ((int)value);
+				break;
+			default:
+				b.addAttribute(propertyName, String.valueOf(value));
+		}	
+	}
+	
+	private void setChildren(Buildable buildable, Element element){
+		if(buildableStack.isEmpty()){
+			buildable.setCdfNames(buildable.getName());
+		} else {
+			Buildable top = buildableStack.peek();
+			if(buildable.getCdfNames() == null){
+				StringBuffer sb = new StringBuffer(top.getCdfNames());
+				sb.append(".").append(buildable.getName());
+				buildable.setCdfNames(sb.toString());
+			}
+		}
+		buildableStack.add(buildable);
+		Node children = element.getChildNodes().item(1);
+		NodeList childrenNodes = children.getChildNodes();
+		for(int i = 0; i < childrenNodes.getLength(); i++){
+			if(childrenNodes.item(i).getNodeType() == Node.ELEMENT_NODE){
+				Element childElement = (Element) childrenNodes.item(i);
+				Buildable childBuildable = createBuildable(childElement);
+				if(childBuildable != null){
+					buildableStack.peek().addChild(childBuildable);
+					setAttributes(childBuildable, childElement);
+					setChildren(childBuildable, childElement);
+				} else {
+					setChildren(buildable, childElement);
+				}
+			}
+		}
+		buildableStack.pop();
+		
+	}
+	
+	private void setAttributes(Buildable buildable, Element element){
+		Map<String,String> attributes = new HashMap<>();
+		Node properties = element.getChildNodes().item(3);
+		if(properties.getNodeType() == Node.ELEMENT_NODE){
+			Element propertiesElements = (Element) properties;
+			attributes.putAll(createAttributeMap(propertiesElements));
+			attributes.put("SourceType", element.getAttribute("type"));				
+		}
+		attributesByBuildables.put(buildable, attributes);
+	}
+	
+	private Buildable createBuildable(Element element) {
+		String id = UUID.randomUUID().toString();
+		String name = element.getAttribute("name");
+		String typeStr = mapping.getTargetTypeOf(element.getAttribute("type"));
+		
+		if (typeStr == null){			
+			return null;
+		}
+		
+		Type type = Type.valueOf(typeStr);
+		return new Buildable(id, name, type);
+	}
+	
+	private Map<String, String> createAttributeMap(Element element) {
+		
+		Map<String, String> attributes = new HashMap<String, String>();
+		NodeList propNodes = element.getChildNodes();
+		
+		for(int i = 0; i< propNodes.getLength(); i++){
+			Node propNode = propNodes.item(i);
+			if(propNode.getNodeType() == Node.ELEMENT_NODE){
+				Element propElement = (Element) propNode;
+				Object value;
+				Double doubleValue = null;
+				switch(propElement.getAttribute("type")) {
+					case "string":
+						value = propElement.getAttribute("value");
+						break;
+					case "int":
+						doubleValue = Double.valueOf(propElement.getAttribute("value"));
+						value = doubleValue;
+						break;
+					case "float":
+						doubleValue = Double.valueOf(propElement.getAttribute("value"));
+						value = doubleValue;
+						break;
+					default:
+						value = "";
+				}
+				
+				if(doubleValue != null){
+					Element parentElement = (Element)element.getParentNode();
+					limitController.add(parentElement.getAttribute("type").toLowerCase(), propElement.getAttribute("name"), doubleValue);				
+				}
+				String name = propElement.getAttribute("name");
+				attributes.put(
+						name,
+						String.valueOf(value)
+						);
+			}							
+		}
+		return attributes;
+	}
+	
+	private Buildable findRoot(Collection<Buildable> buildables) {
+		for(Buildable b : buildables)
+			if(b.isRoot()) return b;
+		return null;
+	}
+	
+	private void prepareBuildables(BuildableTree buildables) {
+		Iterator it = buildables.iterator();
+		while(it.hasNext()) {
+			Buildable b = it.next();
+			
+			if(b.getSizeX() % 2 == 0) b.setSizeX(b.getSizeX() + 1);
+			if(b.getSizeY() % 2 == 0) b.setSizeY(b.getSizeY() + 1);
+			if(b.getSizeZ() % 2 == 0) b.setSizeZ(b.getSizeZ() + 1);
+			
+			if(b.getSizeX() < MIN_SIZE) b.setSizeX(MIN_SIZE);
+			if(b.getSizeY() < MIN_SIZE) b.setSizeY(MIN_SIZE);
+			if(b.getSizeZ() < MIN_SIZE) b.setSizeZ(MIN_SIZE);
+			
+			if(skipInvalidStructures && (b.getType() == Type.FLOOR || b.getType() == Type.CELLAR)) {
+				b.clearChildren();
+			}
+		}
+	}
+	
+	public boolean validateBuildableStructure(BuildableTree buildableTree) throws NotValidBuildableStructure{
+
+		BuildableTree.Iterator iterator = buildableTree.iterator();
+		while(iterator.hasNext()){
+			Buildable build = iterator.next();
+			if(build.getParent() != null){
+				Type buildableParentType = build.getParent().getType();
+				if(!Type.GARDEN.equals(buildableParentType) && !Type.GROUND.equals(buildableParentType) && !Type.CONTAINER.equals(buildableParentType)){
+					throw new NotValidBuildableStructure(build.getCdfNames());
+				}
+			} else if(!Type.CONTAINER.equals(build.getType())) {
+				throw new NotValidBuildableStructure(build.getCdfNames());
+			}
+			
+		}
+		return false;
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/index.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/index.html new file mode 100644 index 00000000..f44b4a38 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping.control

codemetropolis.toolchain.mapping.control

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total396 of 81351%82 of 11428%51757317341502
MappingController39637648%823026%51717316541201
LimitController41100%2100%04080301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/index.source.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/index.source.html new file mode 100644 index 00000000..71bca629 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping.control

codemetropolis.toolchain.mapping.control

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total396 of 81351%82 of 11428%51757317341502
MappingController.java39637648%823026%51717316541201
LimitController.java41100%2100%04080301
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/Conversion.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/Conversion.html new file mode 100644 index 00000000..be8b1593 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/Conversion.html @@ -0,0 +1 @@ +Conversion

Conversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total87 of 12731%18 of 2528%1823172468
createFromName(String)303251%12736%9133801
addParameters(Parameter[])220%20%223311
toDouble(Object)110%20%223311
getParameters()100%20%223311
addParameter(Parameter)60%n/a112211
clearParameters()40%n/a112211
toInt(Object)40%n/a111111
Conversion()8100%n/a010201
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/Conversion.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/Conversion.java.html new file mode 100644 index 00000000..c6c289e5 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/Conversion.java.html @@ -0,0 +1,73 @@ +Conversion.java

Conversion.java

package codemetropolis.toolchain.mapping.conversions;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import codemetropolis.toolchain.mapping.model.Limit;
+import codemetropolis.toolchain.mapping.model.Parameter;
+
+@XmlJavaTypeAdapter(ConversionAdapter.class)
+public abstract class Conversion {
+	
+	protected List<Parameter> parameters = new ArrayList<Parameter>();
+	
+	public abstract Object apply(Object value, Limit limit);
+	
+	public void clearParameters() {
+		parameters.clear();
+	}
+	
+	public void addParameter(Parameter p) {
+		parameters.add(p);
+	}
+	
+	public void addParameters(Parameter... parameters) {
+		for(Parameter p : parameters) {
+			this.parameters.add(p);
+		}
+	}
+	
+	@SuppressWarnings("unchecked")
+	public List<Parameter> getParameters() {
+		if(parameters == null) {
+			parameters = Collections.EMPTY_LIST;
+		}
+		return Collections.unmodifiableList(parameters);
+	}
+	
+	public static Conversion createFromName(String name) {	
+		switch(name.toLowerCase()) {
+			case ToIntConversion.NAME:
+				return new ToIntConversion();
+			case ToDoubleConversion.NAME:
+				return new ToDoubleConversion();
+			case MultiplyConversion.NAME:
+				return new MultiplyConversion();
+			case QuantizationConversion.NAME:
+				return new QuantizationConversion();
+			case NormalizeConversion.NAME:
+				return new NormalizeConversion();
+			case SwitchConversion.NAME:
+				return new SwitchConversion();
+		}
+		return null;
+	}
+	
+	//region conversion helpers
+	public static double toDouble(Object value) {
+		if(value instanceof String) {
+			return Double.parseDouble((String)value);
+		}
+		return (double)value;
+	}
+	
+	public static int toInt(Object value) {
+		return (int)toDouble(value);
+	}
+	//endregion
+		
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter$AdaptedConversion.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter$AdaptedConversion.html new file mode 100644 index 00000000..27b1526c --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter$AdaptedConversion.html @@ -0,0 +1 @@ +ConversionAdapter.AdaptedConversion

ConversionAdapter.AdaptedConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 3100%0 of 0n/a010101
ConversionAdapter.AdaptedConversion()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter.html new file mode 100644 index 00000000..e515edf6 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter.html @@ -0,0 +1 @@ +ConversionAdapter

ConversionAdapter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 3636%2 of 20%245913
marshal(Conversion)230%20%225511
unmarshal(ConversionAdapter.AdaptedConversion)10100%n/a010301
ConversionAdapter()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter.java.html new file mode 100644 index 00000000..5f9fc7d1 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter.java.html @@ -0,0 +1,40 @@ +ConversionAdapter.java

ConversionAdapter.java

package codemetropolis.toolchain.mapping.conversions;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import codemetropolis.toolchain.mapping.model.Parameter;
+
+public class ConversionAdapter extends XmlAdapter<ConversionAdapter.AdaptedConversion, Conversion> {
+	
+	public static class AdaptedConversion {
+		 
+        @XmlAttribute
+        public String type;
+ 
+        @XmlElement(name="parameter")
+    	protected List<Parameter> parameters;
+ 
+    }
+
+	@Override
+	public AdaptedConversion marshal(Conversion conversion) throws Exception {
+		if(conversion == null) return null;
+		AdaptedConversion adaptedConversion = new AdaptedConversion();
+		adaptedConversion.type = (String)conversion.getClass().getDeclaredField("NAME").get(null);
+		adaptedConversion.parameters = conversion.parameters;
+		return adaptedConversion;
+	}
+
+	@Override
+	public Conversion unmarshal(AdaptedConversion adaptedConversion) throws Exception {
+		Conversion conversion = Conversion.createFromName(adaptedConversion.type);
+		conversion.parameters = adaptedConversion.parameters;
+		return conversion;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/MultiplyConversion.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/MultiplyConversion.html new file mode 100644 index 00000000..6751c4b6 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/MultiplyConversion.html @@ -0,0 +1 @@ +MultiplyConversion

MultiplyConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total29 of 329%4 of 40%345612
apply(Object, Limit)290%40%335511
MultiplyConversion()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/MultiplyConversion.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/MultiplyConversion.java.html new file mode 100644 index 00000000..e98ea1e1 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/MultiplyConversion.java.html @@ -0,0 +1,22 @@ +MultiplyConversion.java

MultiplyConversion.java

package codemetropolis.toolchain.mapping.conversions;
+
+import codemetropolis.toolchain.mapping.model.Limit;
+import codemetropolis.toolchain.mapping.model.Parameter;
+
+public class MultiplyConversion extends Conversion {
+
+	public static final String NAME = "multiply";
+	
+	@Override
+	public Object apply(Object value, Limit limit) {
+		double multiplier = 1;
+		for(Parameter p : parameters) {
+			if(p.getName().matches("multiplier")) {
+				multiplier = Double.parseDouble(p.getValue());
+			}
+		}
+		return toDouble(value) * multiplier;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/NormalizeConversion.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/NormalizeConversion.html new file mode 100644 index 00000000..80cbd6bd --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/NormalizeConversion.html @@ -0,0 +1 @@ +NormalizeConversion

NormalizeConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total25 of 2810%2 of 20%234512
apply(Object, Limit)250%20%224411
NormalizeConversion()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/NormalizeConversion.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/NormalizeConversion.java.html new file mode 100644 index 00000000..707e4c37 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/NormalizeConversion.java.html @@ -0,0 +1,18 @@ +NormalizeConversion.java

NormalizeConversion.java

package codemetropolis.toolchain.mapping.conversions;
+
+import codemetropolis.toolchain.mapping.model.Limit;
+
+public class NormalizeConversion extends Conversion {
+
+	public static final String NAME = "normalize";
+	
+	@Override
+	public Object apply(Object value, Limit limit) {
+		double dValue = toDouble(value);
+		double distance = limit.getMax() - limit.getMin();
+		dValue = distance == 0 ? 1 : (dValue - limit.getMin()) / distance;
+		return dValue;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/QuantizationConversion.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/QuantizationConversion.html new file mode 100644 index 00000000..885bcde0 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/QuantizationConversion.html @@ -0,0 +1 @@ +QuantizationConversion

QuantizationConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total84 of 873%8 of 80%56141512
apply(Object, Limit)840%80%55141411
QuantizationConversion()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/QuantizationConversion.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/QuantizationConversion.java.html new file mode 100644 index 00000000..ffb104e9 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/QuantizationConversion.java.html @@ -0,0 +1,42 @@ +QuantizationConversion.java

QuantizationConversion.java

package codemetropolis.toolchain.mapping.conversions;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import codemetropolis.toolchain.mapping.model.Limit;
+import codemetropolis.toolchain.mapping.model.Parameter;
+
+public class QuantizationConversion extends Conversion {
+
+	public static final String NAME = "quantization";
+	
+	@Override
+	public Object apply(Object value, Limit limit) {
+		double dValue = toDouble(value);
+		double distance = limit.getMax() - limit.getMin();
+		
+		Map<Integer, String> levelsMap = new HashMap<>();
+		
+		for(Parameter p : parameters) {
+			if(p.getName().matches("level[0-9]+")) {
+				int num = Integer.parseInt(p.getName().substring(5));
+				levelsMap.put(num, p.getValue());
+			}
+		}
+		
+		String[] levels = levelsMap.values().toArray(new String[0]);
+		
+		double step = distance / levels.length;
+		
+		for(int i = 0; i < levels.length; i++) {
+			double levelLimit = (i + 1) * step + limit.getMin();
+			if(dValue <= levelLimit) {
+				return levels[i];
+			}
+		}
+		
+		return null;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/SwitchConversion.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/SwitchConversion.html new file mode 100644 index 00000000..ab3df342 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/SwitchConversion.html @@ -0,0 +1 @@ +SwitchConversion

SwitchConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total57 of 570%10 of 100%77101022
apply(Object, Limit)540%100%669911
SwitchConversion()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/SwitchConversion.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/SwitchConversion.java.html new file mode 100644 index 00000000..590d5c31 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/SwitchConversion.java.html @@ -0,0 +1,29 @@ +SwitchConversion.java

SwitchConversion.java

package codemetropolis.toolchain.mapping.conversions;
+
+import codemetropolis.toolchain.mapping.model.Limit;
+import codemetropolis.toolchain.mapping.model.Parameter;
+
+public class SwitchConversion extends Conversion {
+
+	public static final String NAME = "switch";
+	
+	@Override
+	public Object apply(Object value, Limit limit) {
+		String defaultValue = null;
+		for(Parameter p : parameters) {
+			if(p.getName().equals("default")) {
+				defaultValue = p.getValue();
+				break;
+			}
+		}
+		
+		for(Parameter p : parameters) {
+			if(p.getName().matches("^value_.*")) {
+				if(p.getName().split("value_")[1].equals(value)) return p.getValue();
+			}
+		}
+		return defaultValue;
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToDoubleConversion.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToDoubleConversion.html new file mode 100644 index 00000000..c38fde12 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToDoubleConversion.html @@ -0,0 +1 @@ +ToDoubleConversion

ToDoubleConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total7 of 70%0 of 0n/a222222
apply(Object, Limit)40%n/a111111
ToDoubleConversion()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToDoubleConversion.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToDoubleConversion.java.html new file mode 100644 index 00000000..dad851a4 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToDoubleConversion.java.html @@ -0,0 +1,15 @@ +ToDoubleConversion.java

ToDoubleConversion.java

package codemetropolis.toolchain.mapping.conversions;
+
+import codemetropolis.toolchain.mapping.model.Limit;
+
+public class ToDoubleConversion extends Conversion {
+
+	public static final String NAME = "to_double";
+	
+	@Override
+	public Object apply(Object value, Limit limit) {
+		return toDouble(value);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToIntConversion.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToIntConversion.html new file mode 100644 index 00000000..5eb998fa --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToIntConversion.html @@ -0,0 +1 @@ +ToIntConversion

ToIntConversion

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total7 of 70%0 of 0n/a222222
apply(Object, Limit)40%n/a111111
ToIntConversion()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToIntConversion.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToIntConversion.java.html new file mode 100644 index 00000000..4d5cb41d --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ToIntConversion.java.html @@ -0,0 +1,15 @@ +ToIntConversion.java

ToIntConversion.java

package codemetropolis.toolchain.mapping.conversions;
+
+import codemetropolis.toolchain.mapping.model.Limit;
+
+public class ToIntConversion extends Conversion {
+
+	public static final String NAME = "to_int";
+	
+	@Override
+	public Object apply(Object value, Limit limit) {
+		return toInt(value);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/index.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/index.html new file mode 100644 index 00000000..6ba87e32 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping.conversions

codemetropolis.toolchain.mapping.conversions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total319 of 38416%44 of 5113%41525974162439
Conversion874031%18728%182317246801
QuantizationConversion8433%80%5614151201
SwitchConversion570%100%7710102211
MultiplyConversion2939%40%34561201
NormalizeConversion25310%20%23451201
ConversionAdapter231336%20%24591301
ToDoubleConversion70%n/a22222211
ToIntConversion70%n/a22222211
ConversionAdapter.AdaptedConversion3100%n/a01010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/index.source.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/index.source.html new file mode 100644 index 00000000..819412eb --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping.conversions

codemetropolis.toolchain.mapping.conversions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total319 of 38416%44 of 5113%41525974162439
Conversion.java874031%18728%182317246801
QuantizationConversion.java8433%80%5614151201
SwitchConversion.java570%100%7710102211
MultiplyConversion.java2939%40%34561201
NormalizeConversion.java25310%20%23451201
ConversionAdapter.java231641%20%255101402
ToDoubleConversion.java70%n/a22222211
ToIntConversion.java70%n/a22222211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingException.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingException.html new file mode 100644 index 00000000..79157598 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingException.html @@ -0,0 +1 @@ +MappingException

MappingException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total19 of 2317%0 of 0n/a4581045
MappingException(String, Throwable, boolean, boolean)70%n/a112211
MappingException(String, Throwable)50%n/a112211
MappingException(Throwable)40%n/a112211
MappingException()30%n/a112211
MappingException(String)4100%n/a010201
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingException.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingException.java.html new file mode 100644 index 00000000..087825b2 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingException.java.html @@ -0,0 +1,30 @@ +MappingException.java

MappingException.java

package codemetropolis.toolchain.mapping.exceptions;
+
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+
+public class MappingException extends CodeMetropolisException {
+
+	private static final long serialVersionUID = -266528062447472817L;
+
+	public MappingException() {
+		super();
+	}
+
+	public MappingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public MappingException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public MappingException(String message) {
+		super(message);
+	}
+
+	public MappingException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingReaderException.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingReaderException.html new file mode 100644 index 00000000..915aaef8 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingReaderException.html @@ -0,0 +1 @@ +MappingReaderException

MappingReaderException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
MappingReaderException(String, Throwable, boolean, boolean)70%n/a112211
MappingReaderException(String, Throwable)50%n/a112211
MappingReaderException(String)40%n/a112211
MappingReaderException(Throwable)40%n/a112211
MappingReaderException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingReaderException.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingReaderException.java.html new file mode 100644 index 00000000..685e9abf --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingReaderException.java.html @@ -0,0 +1,28 @@ +MappingReaderException.java

MappingReaderException.java

package codemetropolis.toolchain.mapping.exceptions;
+
+public class MappingReaderException extends MappingException {
+	
+	private static final long serialVersionUID = -4234316064798036413L;
+
+	public MappingReaderException() {
+		super();
+	}
+
+	public MappingReaderException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public MappingReaderException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public MappingReaderException(String message) {
+		super(message);
+	}
+
+	public MappingReaderException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingWriterException.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingWriterException.html new file mode 100644 index 00000000..d76bd0c6 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingWriterException.html @@ -0,0 +1 @@ +MappingWriterException

MappingWriterException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
MappingWriterException(String, Throwable, boolean, boolean)70%n/a112211
MappingWriterException(String, Throwable)50%n/a112211
MappingWriterException(String)40%n/a112211
MappingWriterException(Throwable)40%n/a112211
MappingWriterException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingWriterException.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingWriterException.java.html new file mode 100644 index 00000000..c3fe43a5 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingWriterException.java.html @@ -0,0 +1,28 @@ +MappingWriterException.java

MappingWriterException.java

package codemetropolis.toolchain.mapping.exceptions;
+
+public class MappingWriterException extends MappingException {
+
+	private static final long serialVersionUID = -3708470145539789698L;
+
+	public MappingWriterException() {
+		super();
+	}
+
+	public MappingWriterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public MappingWriterException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public MappingWriterException(String message) {
+		super(message);
+	}
+
+	public MappingWriterException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MissingResourceException.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MissingResourceException.html new file mode 100644 index 00000000..d1388ad3 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MissingResourceException.html @@ -0,0 +1 @@ +MissingResourceException

MissingResourceException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
MissingResourceException(String, Throwable, boolean, boolean)70%n/a112211
MissingResourceException(String, Throwable)50%n/a112211
MissingResourceException(String)40%n/a112211
MissingResourceException(Throwable)40%n/a112211
MissingResourceException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MissingResourceException.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MissingResourceException.java.html new file mode 100644 index 00000000..d5804043 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MissingResourceException.java.html @@ -0,0 +1,28 @@ +MissingResourceException.java

MissingResourceException.java

package codemetropolis.toolchain.mapping.exceptions;
+
+public class MissingResourceException extends MappingException {
+
+	private static final long serialVersionUID = 7706267293435539734L;
+
+	public MissingResourceException() {
+		super();
+	}
+
+	public MissingResourceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public MissingResourceException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public MissingResourceException(String message) {
+		super(message);
+	}
+
+	public MissingResourceException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotSupportedLinkingException.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotSupportedLinkingException.html new file mode 100644 index 00000000..c1cd209e --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotSupportedLinkingException.html @@ -0,0 +1 @@ +NotSupportedLinkingException

NotSupportedLinkingException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total19 of 2317%0 of 0n/a4581045
NotSupportedLinkingException(String, Throwable, boolean, boolean)70%n/a112211
NotSupportedLinkingException(String, Throwable)50%n/a112211
NotSupportedLinkingException(Throwable)40%n/a112211
NotSupportedLinkingException()30%n/a112211
NotSupportedLinkingException(String)4100%n/a010201
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotSupportedLinkingException.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotSupportedLinkingException.java.html new file mode 100644 index 00000000..8268fcf9 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotSupportedLinkingException.java.html @@ -0,0 +1,28 @@ +NotSupportedLinkingException.java

NotSupportedLinkingException.java

package codemetropolis.toolchain.mapping.exceptions;
+
+public class NotSupportedLinkingException extends MappingException {
+
+	private static final long serialVersionUID = 6947796707002682357L;
+
+	public NotSupportedLinkingException() {
+		super();
+	}
+
+	public NotSupportedLinkingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public NotSupportedLinkingException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public NotSupportedLinkingException(String message) {
+		super(message);
+	}
+
+	public NotSupportedLinkingException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotValidBuildableStructure.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotValidBuildableStructure.html new file mode 100644 index 00000000..3465b8f0 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotValidBuildableStructure.html @@ -0,0 +1 @@ +NotValidBuildableStructure

NotValidBuildableStructure

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total7 of 70%0 of 0n/a224422
NotValidBuildableStructure(String)40%n/a112211
NotValidBuildableStructure()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotValidBuildableStructure.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotValidBuildableStructure.java.html new file mode 100644 index 00000000..50689c8f --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotValidBuildableStructure.java.html @@ -0,0 +1,16 @@ +NotValidBuildableStructure.java

NotValidBuildableStructure.java

package codemetropolis.toolchain.mapping.exceptions;
+
+public class NotValidBuildableStructure extends Exception {
+
+	private static final long serialVersionUID = -2553006687770284206L;
+
+	public NotValidBuildableStructure() {
+		super();
+	}
+
+	public NotValidBuildableStructure(String message) {
+		super(message);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/index.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/index.html new file mode 100644 index 00000000..e9a649a9 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping.exceptions

codemetropolis.toolchain.mapping.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total114 of 1226%0 of 0n/a25275054252746
MappingReaderException230%n/a5510105511
MappingWriterException230%n/a5510105511
MissingResourceException230%n/a5510105511
MappingException19417%n/a458104501
NotSupportedLinkingException19417%n/a458104501
NotValidBuildableStructure70%n/a22442211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/index.source.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/index.source.html new file mode 100644 index 00000000..b6d718f6 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping.exceptions

codemetropolis.toolchain.mapping.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total114 of 1226%0 of 0n/a25275054252746
MissingResourceException.java230%n/a5510105511
MappingWriterException.java230%n/a5510105511
MappingReaderException.java230%n/a5510105511
MappingException.java19417%n/a458104501
NotSupportedLinkingException.java19417%n/a458104501
NotValidBuildableStructure.java70%n/a22442211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Binding.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Binding.html new file mode 100644 index 00000000..716b61c6 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Binding.html @@ -0,0 +1 @@ +Binding

Binding

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total59 of 7622%1 of 250%111319241012
Binding(String, String)140%n/a115511
getVariableId()10947%1150%121401
addConversion(Conversion)60%n/a112211
setFrom(String)40%n/a112211
setTo(String)40%n/a112211
setDefaultValue(String)40%n/a112211
getConversions()40%n/a111111
clearConversions()40%n/a112211
getFrom()30%n/a111111
getTo()30%n/a111111
getDefaultValue()30%n/a111111
Binding()8100%n/a010201
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Binding.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Binding.java.html new file mode 100644 index 00000000..e39f1678 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Binding.java.html @@ -0,0 +1,83 @@ +Binding.java

Binding.java

package codemetropolis.toolchain.mapping.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+
+import codemetropolis.toolchain.mapping.conversions.Conversion;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Binding {
+	
+	@XmlAttribute
+	public String from;
+	
+	@XmlAttribute
+	private String to;
+	
+	@XmlAttribute(name="default")
+	private String defaultValue;
+	
+	@XmlElementWrapper(name="conversions")
+	@XmlElement(name="conversion")
+	private List<Conversion> conversions = new ArrayList<>();
+	
+	public Binding() {}
+
+	public Binding(String from, String to) {
+		this.from = from;
+		this.to = to;
+	}
+
+	public String getFrom() {
+		return from;
+	}
+
+	public void setFrom(String from) {
+		this.from = from;
+	}
+	
+	public String getTo() {
+		return to;
+	}
+	
+	public void setTo(String to) {
+		this.to = to;
+	}
+	
+	public String getDefaultValue() {
+		return defaultValue;
+	}
+
+	public void setDefaultValue(String defaultValue) {
+		this.defaultValue = defaultValue;
+	}
+
+	public String getVariableId() {
+		String pattern = "^\\$\\{.*\\}$";
+		if(from.matches(pattern)) {
+			return from.substring(2, from.length() - 1);
+		}
+		return null;
+	}
+
+	public List<Conversion> getConversions() {
+		return Collections.unmodifiableList(conversions);
+	}
+	
+	public void addConversion(Conversion conversion) {
+		conversions.add(conversion);
+	}
+	
+	public void clearConversions() {
+		conversions.clear();
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Constant.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Constant.html new file mode 100644 index 00000000..7dd62205 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Constant.html @@ -0,0 +1 @@ +Constant

Constant

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total14 of 2850%0 of 0n/a4661246
setId(String)40%n/a112211
setValue(String)40%n/a112211
getId()30%n/a111111
getValue()30%n/a111111
Constant(String, String)9100%n/a010401
Constant()5100%n/a010201
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Constant.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Constant.java.html new file mode 100644 index 00000000..dbee1980 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Constant.java.html @@ -0,0 +1,42 @@ +Constant.java

Constant.java

package codemetropolis.toolchain.mapping.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Constant {
+
+	@XmlAttribute
+	private String id;
+	
+	@XmlAttribute
+	private String value;
+	
+	public Constant() {
+		this("", "");
+	}
+	
+	public Constant(String id, String value) {
+		this.id = id;
+		this.value = value;
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getValue() {
+		return value;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Limit.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Limit.html new file mode 100644 index 00000000..b905b172 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Limit.html @@ -0,0 +1 @@ +Limit

Limit

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total6 of 4486%0 of 4100%2721225
getMax()30%n/a111111
getMin()30%n/a111111
add(double)23100%4100%030401
Limit()12100%n/a010501
getValueSetSize()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Limit.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Limit.java.html new file mode 100644 index 00000000..eb722e52 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Limit.java.html @@ -0,0 +1,34 @@ +Limit.java

Limit.java

package codemetropolis.toolchain.mapping.model;
+
+public class Limit {
+	
+	private double min;
+	private double max;
+	private int valueSetSize;
+	
+	public Limit() {
+		this.min = Double.POSITIVE_INFINITY;
+		this.max = Double.NEGATIVE_INFINITY;
+		this.valueSetSize = 0;
+	}
+
+	public double getMax() {
+		return max;
+	}
+	
+	public double getMin() {
+		return min;
+	}
+	
+	public int getValueSetSize() {
+		return valueSetSize;
+	}
+	
+	public void add(double value) {
+		if(value < min) min = value;
+		if(value > max) max = value;
+		++valueSetSize;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Linking.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Linking.html new file mode 100644 index 00000000..80e25300 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Linking.html @@ -0,0 +1 @@ +Linking

Linking

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total146 of 28849%15 of 166%15213048713
validate(List)653535%7112%4581401
validateBindingResource(Binding, List)420%80%55101011
Linking(String, String)140%n/a115511
addBinding(Binding)60%n/a112211
removeBinding(Binding)60%n/a112211
getSupportedProperties(Buildable.Type)50%n/a111111
setSource(String)40%n/a112211
getBindings()40%n/a111111
static {...}89100%n/a010601
Linking()8100%n/a010201
setTarget(String)4100%n/a010201
getSource()3100%n/a010101
getTarget()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Linking.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Linking.java.html new file mode 100644 index 00000000..fd612827 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Linking.java.html @@ -0,0 +1,119 @@ +Linking.java

Linking.java

package codemetropolis.toolchain.mapping.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable.Type;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.mapping.exceptions.MissingResourceException;
+import codemetropolis.toolchain.mapping.exceptions.NotSupportedLinkingException;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Linking {
+
+    private static final Map<Type, String[]> SUPPORTED_PROPERTIES = new HashMap<>();
+
+    static {
+        SUPPORTED_PROPERTIES.put(Type.FLOOR, new String[]{"width", "height", "length", "character", "external_character", "torches"});
+        SUPPORTED_PROPERTIES.put(Type.CELLAR, new String[]{"width", "height", "length", "character", "external_character", "torches"});
+        SUPPORTED_PROPERTIES.put(Type.GARDEN, new String[]{"tree-ratio", "mushroom-ratio", "flower-ratio"});
+        SUPPORTED_PROPERTIES.put(Type.GROUND, new String[]{});
+    }
+	
+	@XmlAttribute
+	private String source;
+	
+	@XmlAttribute
+	private String target;
+	
+	@XmlElement(name="binding")
+	private List<Binding> bindings = new ArrayList<>();
+
+	public Linking() {}
+
+	public Linking(String source, String target) {
+		this.source = source;
+		this.target = target;
+	}
+
+	public String getSource() {
+		return source;
+	}
+	
+	public void setSource(String source) {
+		this.source = source;
+	}
+
+	public String getTarget() {
+		return target;
+	}
+	
+	public void setTarget(String target) {
+		this.target = target;
+	}
+
+	public List<Binding> getBindings() {
+		return Collections.unmodifiableList(bindings);
+	}
+	
+	public void addBinding(Binding binding) {
+		bindings.add(binding);
+	}
+	
+	public void removeBinding(Binding binding) {
+		bindings.remove(binding);
+	}
+	
+	public static String[] getSupportedProperties(Type buildableType) {
+		return SUPPORTED_PROPERTIES.get(buildableType);
+	}
+
+	public void validate(List<Constant> resources) throws NotSupportedLinkingException, MissingResourceException {
+		Type type;
+		try {
+			type = Type.valueOf(target.toUpperCase());
+		} catch(IllegalArgumentException e) {
+			throw new NotSupportedLinkingException(String.format(Resources.get("invalid_linking_target_error"), target));
+		}
+		String[] validTargetProps = SUPPORTED_PROPERTIES.get(type);
+		for(Binding b : bindings) {
+			validateBindingResource(b, resources);
+			boolean isValid = false;
+			for(String prop : validTargetProps) {
+				if(prop.equalsIgnoreCase(b.getTo())) {
+					isValid = true;
+					break;
+				}
+			}
+			if(!isValid) {
+				throw new NotSupportedLinkingException(String.format(Resources.get("invalid_linking_error"), source, b.getFrom(), target, b.getTo()));
+			}
+		}
+	}
+	
+	private void validateBindingResource(Binding b, List<Constant> resources) throws MissingResourceException {
+		String variableId = b.getVariableId();
+		if(variableId != null) {
+			boolean isValid = false;
+			for(Constant res : resources) {
+				if(res.getId().equals(variableId)) {
+					isValid = true;
+					break;
+				}
+			}
+			if(!isValid) {
+				throw new MissingResourceException(String.format(Resources.get("missing_resource_error"), variableId));
+			}
+		}
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Mapping.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Mapping.html new file mode 100644 index 00000000..1a5373e5 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Mapping.html @@ -0,0 +1 @@ +Mapping

Mapping

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total132 of 20635%4 of 1060%132133491116
writeToXML(String)330%n/a118811
getResourceMap()250%20%224411
Mapping(String, String)190%n/a116611
validate()170%20%223311
readFromXML(String)63083%2100%022901
addResource(Constant)60%n/a112211
addLinking(Linking)60%n/a112211
removeLinking(Linking)60%n/a112211
setVersion(String)40%n/a112211
setId(String)40%n/a112211
getVersion()30%n/a111111
getId()30%n/a111111
getTargetTypeOf(String)23100%4100%030401
Mapping()13100%n/a010301
getResources()4100%n/a010101
getLinkings()4100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Mapping.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Mapping.java.html new file mode 100644 index 00000000..91ae595a --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Mapping.java.html @@ -0,0 +1,143 @@ +Mapping.java

Mapping.java

package codemetropolis.toolchain.mapping.model;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import codemetropolis.toolchain.mapping.exceptions.MappingReaderException;
+import codemetropolis.toolchain.mapping.exceptions.MappingWriterException;
+import codemetropolis.toolchain.mapping.exceptions.MissingResourceException;
+import codemetropolis.toolchain.mapping.exceptions.NotSupportedLinkingException;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Mapping {
+
+	@XmlAttribute
+	private String version;
+	
+	@XmlAttribute
+	private String id;
+	
+	@XmlElementWrapper(name="resources")
+	@XmlElement(name="constant")
+	private List<Constant> resources = new ArrayList<>();
+	
+	@XmlElement(name="linking")
+	private List<Linking> linkings = new ArrayList<>();
+
+	public Mapping() {}
+
+	public Mapping(String version, String id) {
+		this.version = version;
+		this.id = id;
+	}
+
+	public String getVersion() {
+		return version;
+	}
+	
+	public void setVersion(String version) {
+		this.version = version;
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public List<Constant> getResources() {
+		return Collections.unmodifiableList(resources);
+	}
+	
+	public void addResource(Constant resource) {
+		resources.add(resource);
+	}
+	
+	public Map<String, String> getResourceMap() {
+		Map<String, String> result = new HashMap<>();
+		for(Constant resource : resources) {
+			result.put(resource.getId(), resource.getValue());
+		}
+		return result;
+	}
+
+	public List<Linking> getLinkings() {
+		return Collections.unmodifiableList(linkings);
+	}
+	
+	public void addLinking(Linking linking) {
+		linkings.add(linking);
+	}
+	
+	public void removeLinking(Linking linking) {
+		linkings.remove(linking);
+	}
+	
+	public String getTargetTypeOf(String sourceType) {
+		for(Linking linking : linkings) {
+			if(linking.getSource().equalsIgnoreCase(sourceType)) {
+				return linking.getTarget().toUpperCase();
+			}
+		}
+		return null;
+	}
+
+	public static Mapping readFromXML(String mappingFile) throws MappingReaderException, FileNotFoundException {
+
+		File file = new File(mappingFile);
+		if(!file.exists()) {
+			throw new FileNotFoundException();
+		}
+		
+		try {
+			JAXBContext context = JAXBContext.newInstance(Mapping.class);
+			Unmarshaller unmarshaller = context.createUnmarshaller();
+			Mapping mapping = (Mapping) unmarshaller.unmarshal(file);
+			return mapping;
+		} catch (JAXBException e) {
+			throw new MappingReaderException(e);
+		}
+		
+	}
+	
+	public void writeToXML(String mappingFile) throws MappingWriterException {
+
+		try {
+			File file = new File(mappingFile);
+			JAXBContext context = JAXBContext.newInstance(Mapping.class);
+			Marshaller marshaller = context.createMarshaller();
+			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+			marshaller.marshal(this, file);
+		} catch (JAXBException e) {
+			throw new MappingWriterException(e);
+		}
+		
+	}
+	
+	public void validate() throws NotSupportedLinkingException, MissingResourceException {
+		for(Linking linking : linkings) {
+			linking.validate(resources);
+		}
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Parameter.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Parameter.html new file mode 100644 index 00000000..43432448 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Parameter.html @@ -0,0 +1 @@ +Parameter

Parameter

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total14 of 2850%0 of 0n/a4661246
setName(String)40%n/a112211
setValue(String)40%n/a112211
getName()30%n/a111111
getValue()30%n/a111111
Parameter(String, String)9100%n/a010401
Parameter()5100%n/a010201
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Parameter.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Parameter.java.html new file mode 100644 index 00000000..eef1699b --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Parameter.java.html @@ -0,0 +1,42 @@ +Parameter.java

Parameter.java

package codemetropolis.toolchain.mapping.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Parameter {
+
+	@XmlAttribute
+	String name;
+	
+	@XmlAttribute
+	String value;
+	
+	public Parameter() {
+		this("", "");
+	}
+	
+	public Parameter(String name, String value) {
+		this.name = name;
+		this.value = value;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getValue() {
+		return value;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/index.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/index.html new file mode 100644 index 00000000..adff1dab --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping.model

codemetropolis.toolchain.mapping.model

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total371 of 67044%20 of 3237%497496157385806
Linking14614249%1516%1521304871301
Mapping1327435%4660%13213349111601
Binding591722%1150%11131924101201
Parameter141450%n/a466124601
Constant141450%n/a466124601
Limit63886%4100%272122501
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/index.source.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/index.source.html new file mode 100644 index 00000000..b8846e7c --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping.model

codemetropolis.toolchain.mapping.model

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total371 of 67044%20 of 3237%497496157385806
Linking.java14614249%1516%1521304871301
Mapping.java1327435%4660%13213349111601
Binding.java591722%1150%11131924101201
Parameter.java141450%n/a466124601
Constant.java141450%n/a466124601
Limit.java63886%4100%272122501
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/MappingModelTests.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/MappingModelTests.html new file mode 100644 index 00000000..0d6f48b1 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/MappingModelTests.html @@ -0,0 +1 @@ +MappingModelTests

MappingModelTests

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total8 of 16695%0 of 0n/a0734607
testReadFromXMLShouldThrowException()81260%n/a013901
tesLimitControllerAddIsCorrect2()45100%n/a0101001
tesLimitControllerAddIsCorrect()44100%n/a0101001
testAdd()19100%n/a010501
testAdd2()19100%n/a010501
testGetVariableIdShouldReturnNull()16100%n/a010601
MappingModelTests()3100%n/a010101
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/MappingModelTests.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/MappingModelTests.java.html new file mode 100644 index 00000000..d63e7aa4 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/MappingModelTests.java.html @@ -0,0 +1,111 @@ +MappingModelTests.java

MappingModelTests.java

package codemetropolis.toolchain.mapping.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.io.FileNotFoundException;
+
+import org.apache.commons.collections4.map.MultiKeyMap;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.junit.Test;
+
+import codemetropolis.toolchain.mapping.control.LimitController;
+import codemetropolis.toolchain.mapping.exceptions.MappingReaderException;
+import codemetropolis.toolchain.mapping.model.Binding;
+import codemetropolis.toolchain.mapping.model.Limit;
+import codemetropolis.toolchain.mapping.model.Mapping;
+
+public class MappingModelTests {
+
+	@Test
+	public void testAdd() {
+		
+		Limit limit = new Limit();
+		int valueSetSizeExpected = limit.getValueSetSize()+2;
+		limit.add(10);
+		
+		assertNotEquals(limit.getValueSetSize(), valueSetSizeExpected);
+	}
+	
+	@Test
+	public void testAdd2() {
+		
+		Limit limit = new Limit();
+		int valueSetSizeExpected = limit.getValueSetSize()+1;
+		limit.add(10);
+		
+		assertEquals(limit.getValueSetSize(), valueSetSizeExpected);
+	}
+	
+	@Test
+	public void testReadFromXMLShouldThrowException() {
+		
+		boolean isThrown = false;
+		
+		Mapping mapping = new Mapping();
+		try {
+			mapping.readFromXML("text.xml");
+		} catch (MappingReaderException e) {
+			isThrown = true;
+		} catch (FileNotFoundException e) {
+			isThrown = true;
+		}
+		
+		assertTrue(isThrown);
+	}
+	
+	@Test
+	public void testGetVariableIdShouldReturnNull() {
+
+		String expected = null;
+		
+		Binding binding = new Binding();
+		binding.from = "";
+		
+		String result = binding.getVariableId();
+		
+		assertEquals(result, expected);
+	}
+	
+	@Test
+	public void tesLimitControllerAddIsCorrect() {
+		
+		Limit limit = new Limit();
+		limit.add(10);
+		
+		MultiKeyMap<String, Limit> expectedLimits = new MultiKeyMap<>();
+		expectedLimits.put("sourceName", "sourceFrom", limit);
+		
+		LimitController limitController = new LimitController();
+
+		limitController.add("sourceName", "sourceFrom", 10);
+		
+		Limit resultLimit = limitController.getLimit("sourceName", "sourceFrom");
+		Limit expectedLimit = expectedLimits.get("sourceName", "sourceFrom");
+		
+		assertTrue(EqualsBuilder.reflectionEquals(expectedLimit,resultLimit));
+	}
+	
+	@Test
+	public void tesLimitControllerAddIsCorrect2() {
+		
+		Limit limit = new Limit();
+		limit.add(10);
+		
+		MultiKeyMap<String, Limit> expectedLimits = new MultiKeyMap<>();
+		expectedLimits.put("sourceName", "sourceFrom", limit);
+		
+		LimitController limitController = new LimitController();
+
+		limitController.add("sourceName", "sourceFrom", 10);
+		
+		Limit resultLimit = limitController.getLimit("sourceName", "sourceFrom");
+		Limit expectedLimit = expectedLimits.get("sourceName", "sourceFrom");
+		
+		assertEquals(expectedLimit.getValueSetSize(), resultLimit.getValueSetSize());
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/index.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/index.html new file mode 100644 index 00000000..845e4bc4 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping.test

codemetropolis.toolchain.mapping.test

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total8 of 16695%0 of 0n/a073460701
MappingModelTests815895%n/a073460701
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/index.source.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/index.source.html new file mode 100644 index 00000000..32880fd6 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping.test

codemetropolis.toolchain.mapping.test

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total8 of 16695%0 of 0n/a073460701
MappingModelTests.java815895%n/a073460701
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/CommandLineOptions.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/CommandLineOptions.html new file mode 100644 index 00000000..cb5aa489 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/CommandLineOptions.html @@ -0,0 +1 @@ +CommandLineOptions

CommandLineOptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total39 of 390%0 of 0n/a77131377
CommandLineOptions()210%n/a117711
showHelp()30%n/a111111
getInputFile()30%n/a111111
getOutputFile()30%n/a111111
getMappingFile()30%n/a111111
getScale()30%n/a111111
isHierarchyValidationEnabled()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/CommandLineOptions.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/CommandLineOptions.java.html new file mode 100644 index 00000000..8490fb47 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/CommandLineOptions.java.html @@ -0,0 +1,50 @@ +CommandLineOptions.java

CommandLineOptions.java

package codemetropolis.toolchain.mapping;
+
+import org.kohsuke.args4j.Option;
+
+public class CommandLineOptions {
+	
+	@Option(name="-h", aliases = { "--help" })
+	private boolean showHelp = false;
+	
+	@Option(name="-i", aliases = { "--input" })
+	private String inputFile = null;
+
+	@Option(name="-o", aliases = { "--output" })
+	private String outputFile = "mappingToPlacing.xml";
+	 
+	@Option(name="-m", aliases = { "--mapping" })
+	private String mappingFile = null;
+	
+	@Option(name="-s", aliases = { "--scale" })
+	private double scale = 1.0;
+	
+	@Option(name="-v", aliases = { "--validate" })
+	private boolean hierarchyValidation = false;
+
+	public boolean showHelp() {
+		return showHelp;
+	}
+
+	public String getInputFile() {
+		return inputFile;
+	}
+
+	public String getOutputFile() {
+		return outputFile;
+	}
+
+	public String getMappingFile() {
+		return mappingFile;
+	}
+
+	public double getScale() {
+		return scale;
+	}
+
+	public boolean isHierarchyValidationEnabled() {
+		return hierarchyValidation;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/Main.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/Main.html new file mode 100644 index 00000000..047e4822 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/Main.html @@ -0,0 +1 @@ +Main

Main

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total87 of 870%8 of 80%66282822
main(String[])840%80%55272711
Main()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/Main.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/Main.java.html new file mode 100644 index 00000000..5657a64c --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/Main.java.html @@ -0,0 +1,52 @@ +Main.java

Main.java

package codemetropolis.toolchain.mapping;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+
+import codemetropolis.toolchain.commons.util.FileLogger;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.commons.util.Settings;
+
+public class Main {
+
+	public static void main(String[] args) {
+		
+		FileLogger.load(Settings.get("mapping_log_file"));
+		
+		CommandLineOptions options = new CommandLineOptions();
+	    CmdLineParser parser = new CmdLineParser(options);
+
+	    try {
+	        parser.parseArgument(args);
+	        if((options.getInputFile() == null || options.getMappingFile() == null) && !options.showHelp())
+	        	throw new IllegalArgumentException();
+	    } catch (CmdLineException | IllegalArgumentException e) {
+	    	String message = Resources.get("command_line_error");
+	    	FileLogger.logError(message, e);
+	    	System.err.println(message);
+	    	System.err.println(Resources.get("mapping_usage"));
+	    	return;
+	    }
+	    
+	    if(options.showHelp()) {
+	    	System.out.println(Resources.get("mapping_introduction"));
+	    	System.out.println(Resources.get("mapping_usage"));
+	    	return;
+	    }
+			
+	    MappingExecutor executor = new MappingExecutor();
+	    executor.setPrefix(Resources.get("mapping_prefix"));
+	    executor.setErrorPrefix(Resources.get("error_prefix"));
+	    executor.execute(
+	    		new MappingExecutorArgs(
+		    		options.getInputFile(),
+		    		options.getOutputFile(),
+		    		options.getMappingFile(),
+		    		options.getScale(),
+		    		options.isHierarchyValidationEnabled())
+	    		);	
+	    
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutor.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutor.html new file mode 100644 index 00000000..1731e429 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutor.html @@ -0,0 +1 @@ +MappingExecutor

MappingExecutor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total221 of 2210%8 of 80%66474722
execute(ExecutorArgs)2180%80%55464611
MappingExecutor()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutor.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutor.java.html new file mode 100644 index 00000000..136bc20b --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutor.java.html @@ -0,0 +1,93 @@ +MappingExecutor.java

MappingExecutor.java

package codemetropolis.toolchain.mapping;
+
+import java.io.FileNotFoundException;
+
+import codemetropolis.toolchain.commons.cdf.exceptions.CdfReaderException;
+import codemetropolis.toolchain.commons.cmxml.BuildableTree;
+import codemetropolis.toolchain.commons.cmxml.exceptions.CmxmlWriterException;
+import codemetropolis.toolchain.commons.executor.AbstractExecutor;
+import codemetropolis.toolchain.commons.executor.ExecutorArgs;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.mapping.control.MappingController;
+import codemetropolis.toolchain.mapping.exceptions.MappingReaderException;
+import codemetropolis.toolchain.mapping.exceptions.MissingResourceException;
+import codemetropolis.toolchain.mapping.exceptions.NotSupportedLinkingException;
+import codemetropolis.toolchain.mapping.exceptions.NotValidBuildableStructure;
+import codemetropolis.toolchain.mapping.model.Mapping;
+
+public class MappingExecutor extends AbstractExecutor {
+
+	public static final double MIN_SCALE = 0.01;
+	public static final double MAX_SCALE = 100;
+	
+	@Override
+	public boolean execute(ExecutorArgs args) {
+		MappingExecutorArgs mappingArgs = (MappingExecutorArgs)args;
+		
+		if(mappingArgs.getScale() < MIN_SCALE || mappingArgs.getScale() > MAX_SCALE) {
+			printError(null, Resources.get("invalid_scale_error"), MIN_SCALE, MAX_SCALE);
+			return false;
+		}
+		
+		print(Resources.get("reading_mapping"));
+		Mapping mapping;
+		try {
+			mapping = Mapping.readFromXML(mappingArgs.getMappingFile());
+		} catch (FileNotFoundException e) {
+			printError(e, Resources.get("mapping_not_found_error"));
+			return false;
+		} catch (MappingReaderException e) {
+			printError(e, e.getMessage());
+			return false;
+		}
+		print(Resources.get("reading_mapping_done"));
+		
+		print(Resources.get("validating_mapping"));
+		try {
+			mapping.validate();
+		} catch (NotSupportedLinkingException e) {
+			printError(e, e.getMessage());
+			return false;
+		} catch (MissingResourceException e) {
+			printError(e, e.getMessage());
+			return false;
+		}
+		print(Resources.get("validating_mapping_done"));
+		
+		print(Resources.get("reading_graph"));
+		MappingController mappingController = new MappingController(mapping, mappingArgs.getScale(), !mappingArgs.isHierarchyValidationEnabled());
+		try {
+			mappingController.createBuildablesFromCdf(mappingArgs.getCdfFile());
+		} catch (CdfReaderException e) {
+			if(e.getCause() instanceof FileNotFoundException) {
+				printError(e, Resources.get("cdf_not_found_error"));
+			} else {
+				printError(e, Resources.get("cdf_error"));
+			}
+			return false;
+		}
+		print(Resources.get("reading_graph_done"));
+		
+		print(Resources.get("linking_metrics"));
+		BuildableTree buildables = mappingController.linkBuildablesToMetrics();
+		print(Resources.get("linking_metrics_done"));
+		try {
+			mappingController.validateBuildableStructure(buildables);
+		} catch (NotValidBuildableStructure e) {
+			printError(e, Resources.get("invalid_hierarchy_error"));
+			return false;
+		}
+		print(Resources.get("mapping_printing_output"));
+		try {
+			buildables.writeToFile(mappingArgs.getOutputFile(), "mapping", "placing", "1.0");
+		} catch (CmxmlWriterException e) {
+			printError(e, Resources.get("cmxml_writer_error"));
+			return false;
+		}
+		print(Resources.get("mapping_printing_output_done"));
+		
+		return true;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutorArgs.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutorArgs.html new file mode 100644 index 00000000..4fa0818b --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutorArgs.html @@ -0,0 +1 @@ +MappingExecutorArgs

MappingExecutorArgs

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total33 of 330%0 of 0n/a66121266
MappingExecutorArgs(String, String, String, double, boolean)180%n/a117711
getCdfFile()30%n/a111111
getOutputFile()30%n/a111111
getMappingFile()30%n/a111111
getScale()30%n/a111111
isHierarchyValidationEnabled()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutorArgs.java.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutorArgs.java.html new file mode 100644 index 00000000..6881d538 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/MappingExecutorArgs.java.html @@ -0,0 +1,43 @@ +MappingExecutorArgs.java

MappingExecutorArgs.java

package codemetropolis.toolchain.mapping;
+
+import codemetropolis.toolchain.commons.executor.ExecutorArgs;
+
+public class MappingExecutorArgs extends ExecutorArgs {
+	
+	private String cdfFile;
+	private String outputFile;
+	private String mappingFile;
+	private double scale;
+	private boolean hierarchyValidation;
+	
+	public MappingExecutorArgs(String cdfFile, String outputFile, String mappingFile, double scale, boolean hierarchyValidation) {
+		super();
+		this.cdfFile = cdfFile;
+		this.outputFile = outputFile;
+		this.mappingFile = mappingFile;
+		this.scale = scale;
+		this.hierarchyValidation = hierarchyValidation;
+	}
+
+	public String getCdfFile() {
+		return cdfFile;
+	}
+	
+	public String getOutputFile() {
+		return outputFile;
+	}
+	
+	public String getMappingFile() {
+		return mappingFile;
+	}
+	
+	public double getScale() {
+		return scale;
+	}
+	
+	public boolean isHierarchyValidationEnabled() {
+		return hierarchyValidation;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/index.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/index.html new file mode 100644 index 00000000..d5b351a4 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping

codemetropolis.toolchain.mapping

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total380 of 3800%16 of 160%2525100100171744
MappingExecutor2210%80%6647472211
Main870%80%6628282211
CommandLineOptions390%n/a7713137711
MappingExecutorArgs330%n/a6612126611
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/index.source.html b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/index.source.html new file mode 100644 index 00000000..33d5da81 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.mapping

codemetropolis.toolchain.mapping

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total380 of 3800%16 of 160%2525100100171744
MappingExecutor.java2210%80%6647472211
Main.java870%80%6628282211
CommandLineOptions.java390%n/a7713137711
MappingExecutorArgs.java330%n/a6612126611
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-mapping/src_main_java/index.html b/doc/codemetropolis-toolchain-mapping/src_main_java/index.html new file mode 100644 index 00000000..cf1c94d2 --- /dev/null +++ b/doc/codemetropolis-toolchain-mapping/src_main_java/index.html @@ -0,0 +1 @@ +src/main/java

src/main/java

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,588 of 2,53537%162 of 21323%1912603816041001481128
codemetropolis.toolchain.mapping.control39641751%823228%51757317341502
codemetropolis.toolchain.mapping3800%160%2525100100171744
codemetropolis.toolchain.mapping.model37129944%201237%497496157385806
codemetropolis.toolchain.mapping.conversions3196516%44713%41525974162439
codemetropolis.toolchain.mapping.exceptions11486%n/a25275054252746
codemetropolis.toolchain.mapping.test815895%n/a073460701
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/index.html b/doc/codemetropolis-toolchain-placing/index.html new file mode 100644 index 00000000..13eec2e8 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/index.html @@ -0,0 +1 @@ +codemetropolis-toolchain-placing

codemetropolis-toolchain-placing

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total3,912 of 3,9120%431 of 4310%3493497387381311312525
src/main/java3,9120%4310%3493497387381311312525
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/LayoutException.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/LayoutException.html new file mode 100644 index 00000000..daabf84f --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/LayoutException.html @@ -0,0 +1 @@ +LayoutException

LayoutException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
LayoutException(String, Throwable, boolean, boolean)70%n/a112211
LayoutException(String, Throwable)50%n/a112211
LayoutException(String)40%n/a112211
LayoutException(Throwable)40%n/a112211
LayoutException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/LayoutException.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/LayoutException.java.html new file mode 100644 index 00000000..07684e21 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/LayoutException.java.html @@ -0,0 +1,28 @@ +LayoutException.java

LayoutException.java

package codemetropolis.toolchain.placing.exceptions;
+
+public class LayoutException extends PlacingException {
+	
+	private static final long serialVersionUID = -1326865817509151611L;
+
+	public LayoutException() {
+		super();
+	}
+
+	public LayoutException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public LayoutException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public LayoutException(String message) {
+		super(message);
+	}
+
+	public LayoutException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/NonExistentLayoutException.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/NonExistentLayoutException.html new file mode 100644 index 00000000..0968713a --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/NonExistentLayoutException.html @@ -0,0 +1 @@ +NonExistentLayoutException

NonExistentLayoutException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
NonExistentLayoutException(String, Throwable, boolean, boolean)70%n/a112211
NonExistentLayoutException(String, Throwable)50%n/a112211
NonExistentLayoutException(String)40%n/a112211
NonExistentLayoutException(Throwable)40%n/a112211
NonExistentLayoutException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/NonExistentLayoutException.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/NonExistentLayoutException.java.html new file mode 100644 index 00000000..e81dfcd9 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/NonExistentLayoutException.java.html @@ -0,0 +1,28 @@ +NonExistentLayoutException.java

NonExistentLayoutException.java

package codemetropolis.toolchain.placing.exceptions;
+
+public class NonExistentLayoutException extends PlacingException {
+
+	private static final long serialVersionUID = -1943976722667754745L;
+
+	public NonExistentLayoutException() {
+		super();
+	}
+
+	public NonExistentLayoutException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public NonExistentLayoutException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public NonExistentLayoutException(String message) {
+		super(message);
+	}
+
+	public NonExistentLayoutException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/PlacingException.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/PlacingException.html new file mode 100644 index 00000000..8cdd3191 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/PlacingException.html @@ -0,0 +1 @@ +PlacingException

PlacingException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
PlacingException(String, Throwable, boolean, boolean)70%n/a112211
PlacingException(String, Throwable)50%n/a112211
PlacingException(String)40%n/a112211
PlacingException(Throwable)40%n/a112211
PlacingException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/PlacingException.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/PlacingException.java.html new file mode 100644 index 00000000..86af3788 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/PlacingException.java.html @@ -0,0 +1,30 @@ +PlacingException.java

PlacingException.java

package codemetropolis.toolchain.placing.exceptions;
+
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+
+public class PlacingException extends CodeMetropolisException {
+
+	private static final long serialVersionUID = -4821414301180897025L;
+
+	public PlacingException() {
+		super();
+	}
+
+	public PlacingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public PlacingException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public PlacingException(String message) {
+		super(message);
+	}
+
+	public PlacingException(Throwable cause) {
+		super(cause);
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/index.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/index.html new file mode 100644 index 00000000..f1035875 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.placing.exceptions

codemetropolis.toolchain.placing.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total69 of 690%0 of 0n/a15153030151533
PlacingException230%n/a5510105511
LayoutException230%n/a5510105511
NonExistentLayoutException230%n/a5510105511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/index.source.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/index.source.html new file mode 100644 index 00000000..fbe43d3f --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.exceptions/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.placing.exceptions

codemetropolis.toolchain.placing.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total69 of 690%0 of 0n/a15153030151533
PlacingException.java230%n/a5510105511
LayoutException.java230%n/a5510105511
NonExistentLayoutException.java230%n/a5510105511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/BuildableWrapper.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/BuildableWrapper.html new file mode 100644 index 00000000..5c26245e --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/BuildableWrapper.html @@ -0,0 +1 @@ +BuildableWrapper

BuildableWrapper

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total301 of 3010%56 of 560%424257571414
getChildren(Map)760%120%779911
equals(Object)370%120%77131311
getPositionX()200%40%333311
getPositionZ()200%40%333311
getSizeX()200%40%333311
getSizeZ()200%40%333311
getParent()200%40%333311
setPositionX(int)190%40%333311
setPositionZ(int)190%40%333311
hashCode()190%20%225511
compareTo(BuildableWrapper)160%20%222211
BuildableWrapper(Buildable)60%n/a113311
BuildableWrapper(House)60%n/a113311
getInnerBuildable()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/BuildableWrapper.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/BuildableWrapper.java.html new file mode 100644 index 00000000..70c7a5e2 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/BuildableWrapper.java.html @@ -0,0 +1,113 @@ +BuildableWrapper.java

BuildableWrapper.java

package codemetropolis.toolchain.placing.layout.pack;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+
+public class BuildableWrapper implements Comparable<BuildableWrapper> {
+
+	Object buildable;
+
+	public BuildableWrapper(Buildable buildable) {
+		this.buildable = buildable;
+	}
+	
+	public BuildableWrapper(House buildable) {
+		this.buildable = buildable;
+	}
+	
+	public Object getInnerBuildable() {
+		return buildable;
+	}
+
+	public int getPositionX() {
+		if(buildable instanceof Buildable) return ((Buildable)buildable).getPositionX();
+		if(buildable instanceof House) return ((House)buildable).getPositionX();
+		return 0;
+	}
+
+	public int getPositionZ() {
+		if(buildable instanceof Buildable) return ((Buildable)buildable).getPositionZ();
+		if(buildable instanceof House) return ((House)buildable).getPositionZ();
+		return 0;
+	}
+
+	public int getSizeX() {
+		if(buildable instanceof Buildable) return ((Buildable)buildable).getSizeX();
+		if(buildable instanceof House) return ((House)buildable).getSizeX();
+		return 0;
+	}
+
+	public int getSizeZ() {
+		if(buildable instanceof Buildable) return ((Buildable)buildable).getSizeZ();
+		if(buildable instanceof House) return ((House)buildable).getSizeZ();
+		return 0;
+	}
+	
+	public void setPositionX(int x) {
+		if(buildable instanceof Buildable) ((Buildable)buildable).setPositionXR(x);
+		if(buildable instanceof House) ((House)buildable).setPositionXR(x);
+	}
+	
+	public void setPositionZ(int z) {
+		if(buildable instanceof Buildable) ((Buildable)buildable).setPositionZR(z);
+		if(buildable instanceof House) ((House)buildable).setPositionZR(z);
+	}
+	
+	public Buildable getParent() {
+		if(buildable instanceof Buildable) return ((Buildable)buildable).getParent();
+		if(buildable instanceof House) return ((House)buildable).getParent();
+		return null;
+	}
+	
+	public List<BuildableWrapper> getChildren(Map<Buildable, List<House>> houses) {
+		List<BuildableWrapper> result = new ArrayList<BuildableWrapper>();
+		if(buildable instanceof House) return result;
+		for(Buildable c : ((Buildable)buildable).getChildren()) {
+			if(c.getType() == Buildable.Type.FLOOR || c.getType() == Buildable.Type.CELLAR) continue;
+			result.add(new BuildableWrapper(c));
+		}
+		if(houses.get((Buildable)buildable) != null) {
+			for(House h : houses.get((Buildable)buildable)) {
+				result.add(new BuildableWrapper(h));
+			}
+		}
+		return result;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result
+				+ ((buildable == null) ? 0 : buildable.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		BuildableWrapper other = (BuildableWrapper) obj;
+		if (buildable == null) {
+			if (other.buildable != null)
+				return false;
+		} else if (!buildable.equals(other.buildable))
+			return false;
+		return true;
+	}
+
+	@Override
+	public int compareTo(BuildableWrapper o) {
+		int result = this.getSizeX() - o.getSizeX();
+		return result == 0 ? this.getSizeZ() - o.getSizeZ() : result;
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/House.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/House.html new file mode 100644 index 00000000..db3ac486 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/House.html @@ -0,0 +1 @@ +House

House

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total652 of 6520%70 of 700%484885851313
addCellar(Buildable)1680%140%88222211
addFloor(Buildable)1620%140%88212111
setPositionXR(int)490%40%337711
setPositionZR(int)490%40%337711
translateNearX(int)370%40%333311
translateNearZ(int)370%40%333311
getSizeX()290%60%443311
getSizeZ()290%60%443311
getPositionX()290%60%443311
getPositionZ()290%60%443311
House(int, int)190%n/a116611
add(Buildable)120%20%223311
getParent()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/House.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/House.java.html new file mode 100644 index 00000000..86d4ac79 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/House.java.html @@ -0,0 +1,156 @@ +House.java

House.java

package codemetropolis.toolchain.placing.layout.pack;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.placing.exceptions.LayoutException;
+
+public class House {
+	
+	private final int minHeight;
+	private final int maxHeight;
+
+	private Buildable parent;
+	private List<Buildable> floors = new ArrayList<Buildable>();
+	private List<Buildable> cellars = new ArrayList<Buildable>();
+	private Buildable topFloor;
+	private Buildable bottomFloor;
+	private Buildable topCellar;
+	private Buildable bottomCellar;
+	
+	public House(int minHeight, int maxHeight) {
+		this.minHeight = minHeight;
+		this.maxHeight = maxHeight;
+	}
+
+	public boolean add(Buildable b) throws LayoutException {
+		if(b.getType() == Buildable.Type.FLOOR)
+			return addFloor(b);
+		else
+			return addCellar(b);
+	}
+	
+	public boolean addFloor(Buildable floor) throws LayoutException {
+		if(floor.getType() != Buildable.Type.FLOOR) {
+			throw new LayoutException(String.format("Cannot add %s %d as a floor. Wrong buildable type.", floor.getType().toString(), floor.getId()));
+		}
+		if(bottomFloor == null) {
+			floors.add(floor);
+			if(topCellar != null) {
+				floor.setPositionX(topCellar.getCenter().getX() - (floor.getSizeX() / 2));
+				floor.setPositionZ(topCellar.getCenter().getZ() - (floor.getSizeZ() / 2));
+			}
+			parent = floor.getParent();
+			bottomFloor = floor;
+			topFloor = floor;
+			return true;
+		}
+		if(floor.getParent() != parent) {
+			throw new LayoutException(String.format("Cannot add %s %d as a floor. Floors and cellars in the house must be childs of the same parent.", floor.getType().toString(), floor.getId()));
+		}
+		if(topFloor.getPositionY() + topFloor.getSizeY() + floor.getSizeY() > maxHeight) return false;
+		if(floor.getSizeX() > topFloor.getSizeX() || floor.getSizeZ() > topFloor.getSizeZ()) return false;
+		
+		floors.add(floor);
+		floor.setPositionY(topFloor.getPositionY() + topFloor.getSizeY());
+		floor.setPositionX(topFloor.getCenter().getX() - (floor.getSizeX() / 2));
+		floor.setPositionZ(topFloor.getCenter().getZ() - (floor.getSizeZ() / 2));
+		topFloor = floor;
+		
+		return true;
+	}
+	
+	public boolean addCellar(Buildable cellar) throws LayoutException {
+		if(cellar.getType() != Buildable.Type.CELLAR) {
+			throw new LayoutException(String.format("Cannot add %s %d as a cellar. Wrong buildable type.", cellar.getType().toString(), cellar.getId()));
+		}
+		if(topCellar == null) {
+			cellars.add(cellar);
+			cellar.setPositionY(cellar.getPositionY() - cellar.getSizeY() - 1);
+			if(bottomFloor != null) {
+				cellar.setPositionX(bottomFloor.getCenter().getX() - (cellar.getSizeX() / 2));
+				cellar.setPositionZ(bottomFloor.getCenter().getZ() - (cellar.getSizeZ() / 2));
+			}
+			parent = cellar.getParent();
+			topCellar = cellar;
+			bottomCellar = cellar;
+			return true;
+		}
+		if(cellar.getParent() != parent) {
+			throw new LayoutException(String.format("Cannot add %s %d as a floor. Floors and cellars in the house must be childs of the same parent.", cellar.getType().toString(), cellar.getId()));
+		}
+		if(bottomCellar.getPositionY() - cellar.getSizeY() < minHeight) return false;
+		if(cellar.getSizeX() > bottomCellar.getSizeX() || cellar.getSizeZ() > bottomCellar.getSizeZ()) return false;
+		
+		cellars.add(cellar);
+		cellar.setPositionY(bottomCellar.getPositionY() - cellar.getSizeY() - 1);
+		cellar.setPositionX(bottomCellar.getCenter().getX() - (cellar.getSizeX() / 2));
+		cellar.setPositionZ(bottomCellar.getCenter().getZ() - (cellar.getSizeZ() / 2));
+		bottomCellar = cellar;
+		
+		return true;
+	}
+	
+	public int getSizeX() {
+		if(bottomFloor == null) return topCellar.getSizeX();
+		if(topCellar == null) return bottomFloor.getSizeX();
+		return (bottomFloor.getSizeX() > topCellar.getSizeX() ? bottomFloor.getSizeX() : topCellar.getSizeX());
+	}
+	
+	public int getSizeZ() {
+		if(bottomFloor == null) return topCellar.getSizeZ();
+		if(topCellar == null) return bottomFloor.getSizeZ();
+		return (bottomFloor.getSizeZ() > topCellar.getSizeZ() ? bottomFloor.getSizeZ() : topCellar.getSizeZ());
+	}
+	
+	public void translateNearX(int x) {
+		for(Buildable b : floors) b.setPositionXR(b.getPositionX() + x);
+		for(Buildable b : cellars) b.setPositionXR(b.getPositionX() + x);
+	}
+	
+	public void translateNearZ(int z) {
+		for(Buildable b : floors) b.setPositionZR(b.getPositionZ() + z);
+		for(Buildable b : cellars) b.setPositionZR(b.getPositionZ() + z);
+	}
+	
+	public int getPositionX() {
+		if(bottomFloor == null) return topCellar.getPositionX();
+		if(topCellar == null) return bottomFloor.getPositionX();
+		return (bottomFloor.getPositionX() < topCellar.getPositionX() ? bottomFloor.getPositionX() : topCellar.getPositionX());
+	}
+	
+	public int getPositionZ() {
+		if(bottomFloor == null) return topCellar.getPositionZ();
+		if(topCellar == null) return bottomFloor.getPositionZ();
+		return (bottomFloor.getPositionZ() < topCellar.getPositionZ() ? bottomFloor.getPositionZ() : topCellar.getPositionZ());
+	}
+	
+	public void setPositionXR(int x) {
+		for(Buildable b : floors) {
+			int offset = b.getPositionX() - b.getParent().getPositionX();
+			b.setPositionXR(x + offset);
+		}
+		for(Buildable b : cellars) {
+			int offset = b.getPositionX() - b.getParent().getPositionX();
+			b.setPositionXR(x + offset);
+		}
+	}
+	
+	public void setPositionZR(int z) {
+		for(Buildable b : floors) {
+			int offset = b.getPositionZ() - b.getParent().getPositionZ();
+			b.setPositionZR(z + offset);
+		}
+		for(Buildable b : cellars) {
+			int offset = b.getPositionZ() - b.getParent().getPositionZ();
+			b.setPositionZR(z + offset);
+		}
+	}
+
+	public Buildable getParent() {
+		return parent;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/PackLayout.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/PackLayout.html new file mode 100644 index 00000000..15ca1910 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/PackLayout.html @@ -0,0 +1 @@ +PackLayout

PackLayout

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total440 of 4400%54 of 540%383887871111
calculateParentSize(Collection, int)930%100%66141411
pack(Collection, int, int, int)890%100%66191911
createHouses(BuildableTree)820%140%88171711
getMaxSizes(Collection)360%60%445511
getFloorsAndCellarsSorted(BuildableTree)340%60%446611
packRecursive(BuildableWrapper, Map)330%40%338811
prepareBuildables(BuildableTree)280%40%335511
apply(BuildableTree)180%n/a115511
pack(Collection, int)130%n/a113311
sort(List)80%n/a113311
PackLayout()60%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/PackLayout.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/PackLayout.java.html new file mode 100644 index 00000000..039c5f6f --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/PackLayout.java.html @@ -0,0 +1,157 @@ +PackLayout.java

PackLayout.java

package codemetropolis.toolchain.placing.layout.pack;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.commons.cmxml.BuildableTree;
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.commons.cmxml.comparators.BuildableSizeComparator;
+import codemetropolis.toolchain.placing.exceptions.LayoutException;
+import codemetropolis.toolchain.placing.layout.Layout;
+import codemetropolis.toolchain.placing.layout.pack.RectanglePacker.Rectangle;
+
+public class PackLayout extends Layout {
+	
+	private final int SPACE = 3;
+
+	@Override
+	public void apply(BuildableTree buildables) throws LayoutException {
+		prepareBuildables(buildables);
+		Map<Buildable, List<House>> houses = createHouses(buildables);
+		BuildableWrapper root = new BuildableWrapper(buildables.getRoot());
+		packRecursive(root, houses);
+	}
+	
+	private void prepareBuildables(BuildableTree buildables) {
+		for(Buildable b : buildables.getBuildables()) {
+				if(b.isRoot()) continue;
+				b.setPositionYR(b.getParent().getPositionY() + 1);
+		}
+		
+		buildables.getRoot().setPositionYR(GROUND_LEVEL);
+	}
+	
+	private Point getMaxSizes(Collection<BuildableWrapper> buildables) {
+		int maxX = 0, maxZ = 0;
+		for(BuildableWrapper b : buildables) {
+			if(b.getSizeX() > maxX) maxX = b.getSizeX();
+			if(b.getSizeZ() > maxZ) maxZ = b.getSizeZ();
+		}
+		return new Point(maxX, 0, maxZ);
+	}
+	
+	public void packRecursive(BuildableWrapper root, Map<Buildable, List<House>> houses) {
+		List<BuildableWrapper> children = root.getChildren(houses);
+		for(BuildableWrapper c : children) {
+			if(!c.getChildren(houses).isEmpty()) {
+				packRecursive(c, houses);
+			}
+		}
+		Collections.sort(children);
+		Collections.reverse(children);
+		pack(children, SPACE);
+	}
+	
+	private void pack(Collection<BuildableWrapper> buildables, int space) {
+		Point startingSize = getMaxSizes(buildables);
+		pack(buildables, startingSize.getX(), startingSize.getZ(), space);
+	}
+	
+	private void pack(Collection<BuildableWrapper> buildables, int sizeX, int sizeZ, int space) {
+		RectanglePacker<BuildableWrapper> packer = new RectanglePacker<BuildableWrapper>(sizeX, sizeZ, space);
+		
+		for(BuildableWrapper b : buildables) {
+			if(packer.insert(b.getSizeX(), b.getSizeZ(), b) == null) {
+				if(sizeX > sizeZ) {
+					sizeZ++;
+				} else {
+					sizeX++;
+				}
+				pack(buildables, sizeX, sizeZ,  space);
+				return;
+			};
+		}
+		
+		for(BuildableWrapper b : buildables) {
+			Rectangle r = packer.findRectangle(b);
+			b.setPositionX(r.x + space);
+			b.setPositionZ(r.y + space);
+		}
+		
+		if(!buildables.isEmpty()) {
+			Point parentSize = calculateParentSize(buildables, space);
+			Buildable parent = buildables.iterator().next().getParent();
+			parent.setSizeX(parentSize.getX());
+			parent.setSizeZ(parentSize.getZ());
+		}
+	}
+	
+	private Point calculateParentSize(Collection<BuildableWrapper> buildables, int space) {
+		BuildableWrapper firstChild = buildables.iterator().next();
+		int minX = firstChild.getPositionX();
+		int maxX = firstChild.getPositionX() + firstChild.getSizeX();
+		int minZ = firstChild.getPositionZ();
+		int maxZ = firstChild.getPositionZ() + firstChild.getSizeZ();
+		
+		for(BuildableWrapper b : buildables) {
+			if(b.getPositionX() < minX) minX = b.getPositionX();
+			if(b.getPositionX() + b.getSizeX() > maxX) maxX = b.getPositionX() + b.getSizeX();
+			if(b.getPositionZ() < minZ) minZ = b.getPositionZ();
+			if(b.getPositionZ() + b.getSizeZ() > maxZ) maxZ = b.getPositionZ() + b.getSizeZ();
+		}
+		
+		return new Point(
+				maxX - minX + 2 * space,
+				0,
+				maxZ - minZ + 2 * space
+				);
+	}
+	
+	private void sort(List<Buildable> buildables) {
+		Collections.sort(buildables, new BuildableSizeComparator());
+		Collections.reverse(buildables);
+	}
+	
+	private List<Buildable> getFloorsAndCellarsSorted(BuildableTree buildables) {
+		List<Buildable> result = new ArrayList<Buildable>();
+		for(Buildable b : buildables.getBuildables()) {
+			if(b.getType() != Buildable.Type.FLOOR && b.getType() != Buildable.Type.CELLAR) continue;
+			result.add(b);
+		}
+		sort(result);
+		return result;
+	}
+	
+	private Map<Buildable, List<House>> createHouses(BuildableTree buildables) throws LayoutException {
+		Map<Buildable, List<House>> houses = new HashMap<Buildable, List<House>>();
+		for(Buildable b : getFloorsAndCellarsSorted(buildables)) {
+			if(b.getType() != Buildable.Type.FLOOR && b.getType() != Buildable.Type.CELLAR) continue;
+			List<House> housesOfParent = houses.get(b.getParent());
+			if(housesOfParent == null) {
+				housesOfParent = new ArrayList<House>();
+				houses.put(b.getParent(), housesOfParent);
+			}
+			
+			boolean addedSuccessfully = false;
+			for(House h : housesOfParent) {
+				if(h.add(b)) {
+					addedSuccessfully = true;
+					break;
+				}
+			}
+			
+			if(!addedSuccessfully) {
+				House h = new House(MIN_HEIGHT, MAX_HEIGHT);
+				h.add(b);
+				housesOfParent.add(h);
+			}
+		}
+		return houses;
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Fit.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Fit.html new file mode 100644 index 00000000..6baf8214 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Fit.html @@ -0,0 +1 @@ +RectanglePacker.Fit

RectanglePacker.Fit

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total48 of 480%0 of 0n/a444444
static {...}340%n/a114411
valueOf(String)50%n/a111111
RectanglePacker.Fit(String, int)50%n/a111111
values()40%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Node.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Node.html new file mode 100644 index 00000000..c8d5e7e0 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Node.html @@ -0,0 +1 @@ +RectanglePacker.Node

RectanglePacker.Node

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total329 of 3290%56 of 560%393966661010
split(int, int)1190%100%66121211
insert(int, int, Object)540%100%77141411
remove(Object)440%120%77131311
findRectange(Object)260%60%448811
fits(int, int)260%80%555511
RectanglePacker.Node(RectanglePacker, RectanglePacker.Rectangle)180%n/a116611
getRectangles(List)170%20%225511
isOccupied()100%40%331111
static {...}80%20%221111
isLeaf()70%20%221111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Rectangle.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Rectangle.html new file mode 100644 index 00000000..25135429 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker$Rectangle.html @@ -0,0 +1 @@ +RectanglePacker.Rectangle

RectanglePacker.Rectangle

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total61 of 610%0 of 0n/a33131333
toString()270%n/a111111
RectanglePacker.Rectangle(RectanglePacker.Rectangle)190%n/a116611
RectanglePacker.Rectangle(int, int, int, int)150%n/a116611
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker.html new file mode 100644 index 00000000..828b921d --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker.html @@ -0,0 +1 @@ +RectanglePacker

RectanglePacker

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total116 of 1160%2 of 20%99191988
insert(int, int, Object)560%20%226611
RectanglePacker(int, int, int)240%n/a115511
clear()110%n/a112211
inspectRectangles(List)50%n/a112211
findRectangle(Object)50%n/a111111
remove(Object)50%n/a111111
getWidth()50%n/a111111
getHeight()50%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker.java.html new file mode 100644 index 00000000..84299b4e --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/RectanglePacker.java.html @@ -0,0 +1,370 @@ +RectanglePacker.java

RectanglePacker.java

/*
+ * Copyright (c) 2007, Ryan McNally All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met: Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution. Neither the name of the <ORGANIZATION> nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+package codemetropolis.toolchain.placing.layout.pack;
+
+import java.util.List;
+
+/**
+ * Tries to pack rectangles as tightly as possible. An implementation of the
+ * algorithm described at http://www.blackpawn.com/texts/lightmaps/default.html
+ * 
+ * @author ryanm
+ * @param <P>
+ *            The type of items to be held
+ */
+public class RectanglePacker<P> {
+
+  /**
+   * Determines the outcome of a rectangle-fitting test
+   * 
+   * @author ryanm
+   */
+  private static enum Fit {
+    /**
+     * Indicates that the rectangle did not fit
+     */
+    FAIL,
+    /**
+     * Indicates that the rectangle fitted perfectly
+     */
+    PERFECT,
+    /**
+     * Indicates that the rectangle fitted with room to spare
+     */
+    FIT
+  };
+
+  private Node root;
+
+  /**
+   * The border to leave around rectangles
+   */
+  private int border = 0;
+
+  /**
+   * Builds a new {@link RectanglePacker}
+   * 
+   * @param width
+   *            The width of the space available to pack into
+   * @param height
+   *            The height of the space available to pack into
+   * @param border
+   *            The border to preserve between packed items
+   */
+  public RectanglePacker(int width, int height, int border) {
+    root = new Node(new Rectangle(0, 0, width, height));
+    this.border = border;
+  }
+
+  /**
+   * Builds a list of all {@link Rectangle}s in the tree, for debugging
+   * purposes
+   * 
+   * @param rectangles
+   *            The list to add the tree's {@link Rectangle}s to
+   */
+  public void inspectRectangles(List<Rectangle> rectangles) {
+    root.getRectangles(rectangles);
+  }
+
+  /**
+   * Finds the {@link Rectangle} where an item is stored
+   * 
+   * @param item
+   *            The item to search for
+   * @return The {@link Rectangle} where that item resides, or null if not
+   *         found
+   */
+  public Rectangle findRectangle(P item) {
+    return root.findRectange(item);
+  }
+
+  /**
+   * Clears the packer of all items
+   */
+  public void clear() {
+    root = new Node(root.rect);
+  }
+
+  /**
+   * Attempts to pack an item of the supplied dimensions
+   * 
+   * @param width
+   *            The width of the item
+   * @param height
+   *            The height of the item
+   * @param o
+   *            The item to pack
+   * @return The packed location, or null if it will not fit.
+   */
+  public Rectangle insert(int width, int height, P o) {
+    Node n = root.insert(width + 2 * border, height + 2 * border, o);
+
+    if (n != null) {
+      Rectangle r = new Rectangle(n.rect.x + border, n.rect.y + border,
+          n.rect.width - 2 * border, n.rect.height - 2 * border);
+      return r;
+    } else {
+      return null;
+    }
+  }
+
+  /**
+   * Removes an item from the tree, consolidating the space if possible. The
+   * space can easily become fragmented, so don't rely on this to work as
+   * cleverly as you would like.
+   * 
+   * @param o
+   *            the item to remove
+   * @return <code>true</code> if the item was found, false otherwise
+   */
+  public boolean remove(P o) {
+    return root.remove(o);
+  }
+
+  /**
+   * Gets the width of this packer
+   * 
+   * @return the width of this packer
+   */
+  public int getWidth() {
+    return root.rect.width;
+  }
+
+  /**
+   * Gets the height of this packer
+   * 
+   * @return The height of this packer
+   */
+  public int getHeight() {
+    return root.rect.height;
+  }
+
+  private class Node {
+    private Rectangle rect;
+
+    private P occupier = null;
+
+    private Node left = null;
+
+    private Node right = null;
+
+    private Node(Rectangle r) {
+      this.rect = r;
+    }
+
+    private Rectangle findRectange(P item) {
+      if (isLeaf()) {
+        if (item == occupier) {
+          return rect;
+        } else {
+          return null;
+        }
+      } else {
+        Rectangle l = left.findRectange(item);
+
+        if (l != null) {
+          return l;
+        } else {
+          return right.findRectange(item);
+        }
+      }
+    }
+
+    private Node insert(int width, int height, P o) {
+      if (!isLeaf()) {
+        Node r = left.insert(width, height, o);
+
+        if (r == null) {
+          r = right.insert(width, height, o);
+        }
+
+        return r;
+      } else {
+        if (occupier != null) {
+          return null;
+        }
+
+        Fit fit = fits(width, height);
+
+        switch (fit) {
+        case FAIL:
+          return null;
+        case PERFECT:
+          occupier = o;
+          return this;
+        case FIT:
+          split(width, height);
+          break;
+        }
+
+        return left.insert(width, height, o);
+      }
+    }
+
+    private boolean isLeaf() {
+      return left == null;
+    }
+
+    /**
+     * Determines if this node contains an item, even many levels below
+     * 
+     * @return <code>true</code> if this node or any of it's descendants
+     *         holds an item
+     */
+    private boolean isOccupied() {
+      return occupier != null || !isLeaf();
+    }
+
+    /**
+     * Removes an item, and consolidates the tree if possible
+     * 
+     * @param o
+     *            the item to remove
+     * @return <code>true</code> if the item was found, <code>false</code>
+     *         otherwise
+     */
+    private boolean remove(P o) {
+      if (isLeaf()) {
+        if (occupier == o) {
+          occupier = null;
+
+          return true;
+        }
+        return false;
+      } else {
+        boolean found = left.remove(o);
+        if (!found) {
+          found = right.remove(o);
+        }
+
+        if (found) {
+          if (!left.isOccupied() && !right.isOccupied()) {
+            left = null;
+            right = null;
+          }
+        }
+
+        return found;
+      }
+    }
+
+    private void split(int width, int height) {
+      int dw = rect.width - width;
+      int dh = rect.height - height;
+
+      assert dw >= 0;
+      assert dh >= 0;
+
+      Rectangle r, l;
+      if (dw > dh) {
+        l = new Rectangle(rect.x, rect.y, width, rect.height);
+
+        r = new Rectangle(l.x + width, rect.y, rect.width - width,
+            rect.height);
+      } else {
+        l = new Rectangle(rect.x, rect.y, rect.width, height);
+
+        r = new Rectangle(rect.x, l.y + height, rect.width, rect.height
+            - height);
+      }
+
+      left = new Node(l);
+      right = new Node(r);
+    }
+
+    private Fit fits(int width, int height) {
+      if (width <= rect.width && height <= rect.height) {
+        if (width == rect.width && height == rect.height) {
+          return Fit.PERFECT;
+        } else {
+          return Fit.FIT;
+        }
+      }
+
+      return Fit.FAIL;
+    }
+
+    private void getRectangles(List<Rectangle> rectangles) {
+      rectangles.add(rect);
+
+      if (!isLeaf()) {
+        left.getRectangles(rectangles);
+        right.getRectangles(rectangles);
+      }
+    }
+  }
+
+  /**
+   * Yet another Rectangle class. Only here to remove dependencies on
+   * awt/lwjgl/etc
+   * 
+   * @author ryanm
+   */
+  public static class Rectangle {
+    /**
+     * 
+     */
+    public final int x;
+
+    /**
+     * 
+     */
+    public final int y;
+
+    /**
+     * 
+     */
+    public final int width;
+
+    /**
+     * 
+     */
+    public final int height;
+
+    private Rectangle(int x, int y, int width, int height) {
+      this.x = x;
+      this.y = y;
+      this.width = width;
+      this.height = height;
+    }
+
+    private Rectangle(Rectangle r) {
+      this.x = r.x;
+      this.y = r.y;
+      this.width = r.width;
+      this.height = r.height;
+    }
+
+    @Override
+    public String toString() {
+      return "[ " + x + ", " + y + ", " + width + ", " + height + " ]";
+    }
+  }
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/index.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/index.html new file mode 100644 index 00000000..ef37c2ae --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.placing.layout.pack

codemetropolis.toolchain.placing.layout.pack

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,973 of 1,9730%238 of 2380%184184331331646488
House6520%700%48488585131311
PackLayout4400%540%38388787111111
RectanglePacker.Node3290%560%39396666101011
BuildableWrapper3010%560%42425757141411
RectanglePacker1160%20%9919198811
RectanglePacker.Rectangle610%n/a3313133311
RectanglePacker.Fit480%n/a44444411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/index.source.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/index.source.html new file mode 100644 index 00000000..20eeb11a --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.pack/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.placing.layout.pack

codemetropolis.toolchain.placing.layout.pack

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,973 of 1,9730%238 of 2380%184184331331646488
House.java6520%700%48488585131311
RectanglePacker.java5800%580%5656102102262655
PackLayout.java4400%540%38388787111111
BuildableWrapper.java3010%560%42425757141411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/House.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/House.html new file mode 100644 index 00000000..0495a3c0 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/House.html @@ -0,0 +1 @@ +House

House

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total237 of 2370%32 of 320%282856561212
addCellar(Buildable)580%100%66141411
addFloor(Buildable)570%100%66151511
setSizeOfContainingBuildables(Buildable)290%40%336611
getSizeX()230%40%334411
getSizeZ()230%40%334411
House(int, int)200%n/a117711
getSizeY()80%n/a111111
getFloorsAndCellars()60%n/a111111
getDepth()40%n/a111111
getTop()30%n/a111111
getBottom()30%n/a111111
getHeight()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/House.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/House.java.html new file mode 100644 index 00000000..1ff9c906 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/House.java.html @@ -0,0 +1,116 @@ +House.java

House.java

package codemetropolis.toolchain.placing.layout.tetris;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.commons.cmxml.Buildable.Type;
+
+public class House {
+	
+	private final int maxHeight;
+	private final int minHeight;
+	
+	private List<Buildable> floorsAndCellars = new ArrayList<>();
+	private Buildable top = null;
+	private Buildable bottom = null;
+	
+	public House(int minHeight, int maxHeight) {
+		this.minHeight = minHeight;
+		this.maxHeight = maxHeight;
+	}
+
+	public boolean addFloor(Buildable b) {
+		if(b.getType() != Type.FLOOR)
+			return false;
+		if(top != null) {
+			if(
+					getHeight() + b.getSizeY() > maxHeight ||
+					b.getSizeX() > getSizeX() ||
+					b.getSizeZ() > getSizeZ())
+				return false;
+			
+			b.setPositionY(getHeight());
+		} else {
+			bottom = b;
+			b.setPositionY(b.getParent().getPositionY() + 1);
+		}
+		top = b;
+		floorsAndCellars.add(b);
+		setSizeOfContainingBuildables(b);
+		return true;
+	}
+
+	private void setSizeOfContainingBuildables(Buildable b) {
+		Buildable parent = b.getParent();
+		while(parent != null) {
+			if(getHeight() - parent.getPositionY() + 1 > parent.getSizeY()) {
+				parent.setSizeY(getHeight() - parent.getPositionY() + 1);
+				parent = parent.getParent();
+			} else {
+				break;
+			}
+		}
+	}
+	
+	public boolean addCellar(Buildable b) {
+		if(b.getType() != Type.CELLAR)
+			return false;
+		if(bottom != null) {
+			if(
+					getDepth() - b.getSizeY() < minHeight ||
+					b.getSizeX() > getSizeX() ||
+					b.getSizeZ() > getSizeZ())
+				return false;
+			
+			b.setPositionY(getDepth() - b.getSizeY());
+		} else {
+			top = b;
+			b.setPositionY(b.getParent().getPositionY() - b.getSizeY());
+		}
+		bottom = b;
+		floorsAndCellars.add(b);
+		
+		return true;
+	}
+
+	public List<Buildable> getFloorsAndCellars() {
+		return new ArrayList<>(floorsAndCellars);
+	}
+	
+	public Buildable getTop() {
+		return top;
+	}
+
+	public Buildable getBottom() {
+		return bottom;
+	}
+	
+	public int getSizeX() {
+		int max = 0;
+		for(Buildable b : floorsAndCellars)
+			if(b.getSizeX() > max) max = b.getSizeX();
+		return max;
+	}
+	
+	public int getSizeY() {
+		return top.getPositionY() + top.getSizeY();
+	}
+	
+	public int getSizeZ() {
+		int max = 0;
+		for(Buildable b : floorsAndCellars)
+			if(b.getSizeZ() > max) max = b.getSizeZ();
+		return max;
+	}
+	
+	public int getHeight() {
+		return getSizeY();
+	}
+	
+	public int getDepth() {
+		return bottom.getPositionY();
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/TetrisLayout.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/TetrisLayout.html new file mode 100644 index 00000000..b8a4de33 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/TetrisLayout.html @@ -0,0 +1 @@ +TetrisLayout

TetrisLayout

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total1,019 of 1,0190%136 of 1360%767618318388
placeHorizontal(Collection)5420%840%4343909011
placeHorizontalInGardens(Collection)1340%120%77252511
apply(BuildableTree)1320%160%99262611
placeVertical(Collection)1240%160%99262611
prepareBuildables(Collection)350%80%556611
placeFloorHorizontal(Buildable, Buildable)290%n/a113311
sortByWidthDescending(Collection)170%n/a115511
TetrisLayout()60%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/TetrisLayout.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/TetrisLayout.java.html new file mode 100644 index 00000000..a0a5790e --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/TetrisLayout.java.html @@ -0,0 +1,312 @@ +TetrisLayout.java

TetrisLayout.java

package codemetropolis.toolchain.placing.layout.tetris;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.commons.cmxml.Buildable.Type;
+import codemetropolis.toolchain.commons.cmxml.BuildableTree;
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.commons.cmxml.comparators.BuildableDescendantLevelComparator;
+import codemetropolis.toolchain.commons.cmxml.comparators.BuildableWidthComparator;
+import codemetropolis.toolchain.placing.layout.Layout;
+
+public class TetrisLayout extends Layout {
+	
+	private static final int DEFAULT_SPACE = 3;
+	private static final int GARDEN_SIZE = 6;
+	private int space = DEFAULT_SPACE;
+
+	@Override
+	public void apply(BuildableTree buildables) {
+		List<Buildable> buildableList = buildables.getBuildables();
+		prepareBuildables(buildableList);
+		Map<Buildable, List<Buildable>> floorsByParent = new HashMap<>();
+		List<Buildable> groundsAndGardens = new ArrayList<>();
+		
+		for (Buildable b : buildableList) {
+			if(b.getParent() != null && b.getParent().getType() == Type.GARDEN) {
+				if(b.getParent().getParent().getType() != Type.GARDEN) {
+					if(!floorsByParent.containsKey(b.getParent())) {
+						floorsByParent.put(b.getParent(), new ArrayList<Buildable>());
+					}
+					floorsByParent.get(b.getParent()).add(b);
+				}
+			} else {
+				groundsAndGardens.add(b);
+			}
+		}
+		
+		for(List<Buildable> f : floorsByParent.values()) {
+			placeVertical(f);	
+		}
+		
+		Collections.sort(groundsAndGardens, new BuildableDescendantLevelComparator());
+		Collections.reverse(groundsAndGardens);
+		Collection<Buildable> siblings = new ArrayList<>();
+		List<Buildable> alreadyPlaced = new ArrayList<>();
+		
+		for( Buildable b : groundsAndGardens) {
+			if(!alreadyPlaced.contains(b)) {
+				siblings.add(b);
+				siblings.addAll(b.getSiblings());
+				placeHorizontal(siblings);
+				alreadyPlaced.addAll(siblings);
+				siblings.clear();
+			}
+		}
+	}
+	
+	public Collection<Buildable> prepareBuildables(Collection<Buildable> buildables) {
+		for(Buildable b : buildables) {
+			if(b.getParent() == null) {
+	    		b.setPositionYR(GROUND_LEVEL);
+	    	} else if(b.getType() == Type.GARDEN || b.getType() == Type.GROUND){
+	    		b.setPositionYR(b.getParent().getPositionY() + 1);
+	    	}
+		}
+		return buildables;
+	}
+	
+	public Collection<Buildable> placeHorizontal(Collection<Buildable> buildables) {
+		if(buildables.isEmpty()) return buildables;
+		buildables = sortByWidthDescending(buildables);
+		
+		if(buildables.iterator().next().getParent() != null && buildables.iterator().next().getParent().getType() == Type.GARDEN) {
+			space = GARDEN_SIZE;
+		} else {
+			space = DEFAULT_SPACE;
+		}
+		
+		int width = 0;
+		int height = 0;
+		int newX = 0;
+		int newZ = 0;
+		
+		NavigableMap<Integer, Integer> corners = new TreeMap<Integer, Integer>();
+		corners.put(space, space);
+			
+		for(Buildable b : buildables) {
+			int bSizeX = b.getSizeX() + space;
+			int bSizeZ = b.getSizeZ() + space;
+			Boolean alreadyPlaced = false;
+			
+			for (Map.Entry<Integer, Integer> entry : corners.entrySet()) {
+				if(!alreadyPlaced) {
+				    int cornerX = entry.getKey();
+				    int cornerZ = entry.getValue();
+				    int nextCornerX = cornerX;
+				    int previousCornerX = cornerX;
+				    int previousCornerZ = cornerZ;
+					
+					if(corners.ceilingKey(cornerX + 1) != null) {
+						nextCornerX = corners.ceilingKey(cornerX + 1);
+					}
+					
+					if(corners.floorKey(cornerX - 1) != null) {
+						previousCornerX = corners.floorKey(cornerX - 1);
+						previousCornerZ = corners.get(previousCornerX);
+					}
+					
+					if(
+							cornerZ < previousCornerZ &&
+							Math.abs(nextCornerX - cornerX) >= bSizeX &&
+							Math.abs(height - cornerZ) >= bSizeZ
+					) {
+						newX = cornerX;
+				    	newZ = cornerZ;
+				    	
+				    	for(int i = corners.floorKey(newX) + 1; i < newX + bSizeX; i++) {
+				    		if(corners.get(i) != null && corners.get(i) > newZ) {
+				    			newZ = corners.get(i);
+				    		}
+				    	}
+				    	
+				    	if(newZ + b.getSizeZ() <= height)
+				    		alreadyPlaced = true;
+					} 
+				}
+			}
+			
+			if(!alreadyPlaced) {
+				for (Map.Entry<Integer, Integer> entry : corners.entrySet()) {
+					if(!alreadyPlaced) {
+					    int cornerX = entry.getKey();
+					    int cornerZ = entry.getValue();
+					    int nextCornerX = cornerX;				
+						
+						if(corners.ceilingKey(cornerX + 1) != null) {
+							nextCornerX = corners.ceilingKey(cornerX + 1);
+						}
+					
+						while(
+								corners.ceilingKey(nextCornerX + 1) != null &&
+								corners.get(corners.ceilingKey(nextCornerX + 1)) <= cornerZ )
+						{
+							nextCornerX = corners.ceilingKey(nextCornerX + 1);
+						}
+						
+						if(Math.abs(nextCornerX - cornerX) >= bSizeX && Math.abs(height - cornerZ) >= bSizeZ) {
+							newX = cornerX;
+					    	newZ = cornerZ;
+					    	
+					    	for(int i = corners.floorKey(newX) + 1; i < newX + bSizeX; i++) {
+					    		if(corners.get(i) != null && corners.get(i) > newZ) {
+					    			newZ = corners.get(i);
+					    		}
+					    	}
+					    	
+					    	if(newZ + b.getSizeZ() <= height)
+					    		alreadyPlaced = true;
+						}
+					}
+				}
+			}
+			
+			if(!alreadyPlaced) {
+				if(width > height) {
+			    	newX = space;
+			    	newZ = height + space;
+			    	if(bSizeX > width) width = bSizeX;
+			    	height += bSizeZ;
+			    } else {
+			    	newX = width + space;
+			    	newZ = space;
+			    	if(bSizeZ > height) height = bSizeZ;
+			    	width += bSizeX;
+			    }
+			}
+			
+			b.setPositionXR(newX);
+	    	b.setPositionZR(newZ);
+	    	
+	    	// Upper left and lower right
+	    	if(corners.get(newX) == null || corners.get(newX) < newZ + bSizeZ)
+	    		corners.put(newX, newZ + bSizeZ);
+	    	if (corners.get(newX + bSizeX) == null || corners.get(newX + bSizeX) < newZ)
+	    		corners.put(newX + bSizeX , newZ);
+	    	
+	    	Integer lastCornerZ = null;
+	    	
+	    	for(int i = corners.floorKey(newX) + 1; i < newX + bSizeX; i++) {
+	    		if(corners.get(i) != null) {
+	    			lastCornerZ = corners.get(i);
+	    		}
+	    	}
+	    	
+	    	for(int i = corners.floorKey(newX) + 1; i < newX + bSizeX; i++) {
+	    		if(corners.get(i) != null) {
+	    			corners.remove(i);
+	    		}
+	    	}
+	    	
+	    	if(lastCornerZ != null)
+	    		if(corners.get(newX + bSizeX) == null)
+	    			corners.put(newX + bSizeX , lastCornerZ);
+		}
+		
+		if(buildables.iterator().next().getParent() != null) {
+			Buildable parent = buildables.iterator().next().getParent();
+			parent.setSizeX(width + space);
+			parent.setSizeZ(height + space);
+		}
+		
+		return buildables;
+	}
+
+	public Collection<Buildable> placeVertical(Collection<Buildable> buildables) {
+		buildables = sortByWidthDescending(buildables);
+		List<House> houses = new ArrayList<>();
+		List<Buildable> gardens = new ArrayList<>();
+		
+		nextBuildable:
+		for(Buildable b : buildables) {
+			if(b.getType() == Type.GARDEN) {
+				placeVertical(Arrays.asList(b.getChildren()));
+				gardens.add(b);
+			} else if (b.getType() == Type.FLOOR) {
+				for(House h : houses) {
+					if(h.addFloor(b)) {
+						continue nextBuildable;
+					}
+				}
+				House house = new House(MIN_HEIGHT, MAX_HEIGHT);
+				house.addFloor(b);
+				houses.add(house);
+			} else if (b.getType() == Type.CELLAR) {
+				for(House h : houses) {
+					if(h.addCellar(b)) {
+						continue nextBuildable;
+					}
+				}
+				House house = new House(MIN_HEIGHT, MAX_HEIGHT);
+				house.addCellar(b);
+				houses.add(house);
+			}
+		}
+					
+		List<Object> temp = new ArrayList<>();
+		temp.addAll(houses);
+		temp.addAll(gardens);
+		placeHorizontalInGardens(temp);
+		
+		return buildables;
+	}
+	
+	private Collection<Buildable> sortByWidthDescending(Collection<Buildable> buildables) {
+		List<Buildable> result = new ArrayList<>();
+		result.addAll(buildables);
+		Collections.sort(result, new BuildableWidthComparator());
+		Collections.reverse(result);
+		return result;
+	}
+	
+	private void placeHorizontalInGardens(Collection<Object> housesAndGardens) {
+		List<House> houses = new ArrayList<>();
+		List<Buildable> objectsToPlace = new ArrayList<>();
+		Map<Buildable, Point> realSizes = new HashMap<Buildable, Point>();
+		
+		for(Object o : housesAndGardens) {
+			if(o.getClass() == House.class) {
+				House h = (House)o;
+				houses.add(h);
+				Buildable bottom = h.getBottom();
+				realSizes.put(bottom, new Point(bottom.getSizeX(), bottom.getSizeY(), bottom.getSizeZ()));
+				bottom.setSizeX(h.getSizeX());
+				bottom.setSizeZ(h.getSizeZ());
+				objectsToPlace.add(bottom);
+			} 
+			else if(o.getClass() == Buildable.class) {
+				Buildable b = (Buildable)o;
+				if(b.getType() == Type.GARDEN) {
+					objectsToPlace.add(b);
+				}
+			}
+		}
+		
+		placeHorizontal(objectsToPlace);
+		
+		for(House h : houses) {
+			for(Buildable b : h.getFloorsAndCellars()) {
+				placeFloorHorizontal(b, h.getBottom());
+			}
+			h.getBottom().setSizeX(realSizes.get(h.getBottom()).getX());
+			h.getBottom().setSizeZ(realSizes.get(h.getBottom()).getZ());
+			placeFloorHorizontal(h.getBottom(), h.getTop());
+		}	
+	}
+	
+	private void placeFloorHorizontal(Buildable floor, Buildable bottom) {
+		floor.setPositionXR(bottom.getPositionX() + bottom.getSizeX() / 2 - floor.getSizeX() / 2);
+    	floor.setPositionZR(bottom.getPositionZ() + bottom.getSizeZ() / 2 - floor.getSizeZ() / 2);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/index.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/index.html new file mode 100644 index 00000000..787191e9 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.placing.layout.tetris

codemetropolis.toolchain.placing.layout.tetris

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,256 of 1,2560%168 of 1680%104104239239202022
TetrisLayout1,0190%1360%76761831838811
House2370%320%28285656121211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/index.source.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/index.source.html new file mode 100644 index 00000000..29ca1f1c --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout.tetris/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.placing.layout.tetris

codemetropolis.toolchain.placing.layout.tetris

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,256 of 1,2560%168 of 1680%104104239239202022
TetrisLayout.java1,0190%1360%76761831838811
House.java2370%320%28285656121211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/Layout.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/Layout.html new file mode 100644 index 00000000..1c6cd972 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/Layout.html @@ -0,0 +1 @@ +Layout

Layout

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%2 of 20%336622
parse(String)200%20%225511
Layout()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/Layout.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/Layout.java.html new file mode 100644 index 00000000..5f6582c3 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/Layout.java.html @@ -0,0 +1,33 @@ +Layout.java

Layout.java

package codemetropolis.toolchain.placing.layout;
+
+import codemetropolis.toolchain.commons.cmxml.BuildableTree;
+import codemetropolis.toolchain.placing.exceptions.LayoutException;
+import codemetropolis.toolchain.placing.exceptions.NonExistentLayoutException;
+import codemetropolis.toolchain.placing.layout.pack.PackLayout;
+//import codemetropolis.toolchain.placing.layout.tetris.TetrisLayout;
+
+public abstract class Layout {
+
+	protected static final int GROUND_LEVEL = 60;
+	protected static final int MIN_HEIGHT = 10;
+	protected static final int MAX_HEIGHT = 200;
+	
+	public static Layout parse(String algorithm) throws NonExistentLayoutException {
+		try{
+			switch(LayoutAlgorithm.valueOf(algorithm.toUpperCase())) {
+				case PACK:
+					return new PackLayout();
+				//TODO tetris layout is out of date and needs to be updated
+				//case TETRIS:
+				//	return new TetrisLayout();
+			}	
+		} catch (IllegalArgumentException e) {
+			throw new NonExistentLayoutException(algorithm);
+		}
+		return null;
+	}
+	
+	public abstract void apply(BuildableTree buildables) throws LayoutException;
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/LayoutAlgorithm.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/LayoutAlgorithm.html new file mode 100644 index 00000000..7bca420a --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/LayoutAlgorithm.html @@ -0,0 +1 @@ +LayoutAlgorithm

LayoutAlgorithm

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total28 of 280%0 of 0n/a442244
static {...}140%n/a112211
valueOf(String)50%n/a111111
LayoutAlgorithm(String, int)50%n/a111111
values()40%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/LayoutAlgorithm.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/LayoutAlgorithm.java.html new file mode 100644 index 00000000..cf396051 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/LayoutAlgorithm.java.html @@ -0,0 +1,7 @@ +LayoutAlgorithm.java

LayoutAlgorithm.java

package codemetropolis.toolchain.placing.layout;
+
+public enum LayoutAlgorithm {
+	PACK,
+	//TETRIS
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/index.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/index.html new file mode 100644 index 00000000..c5e57f1e --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.placing.layout

codemetropolis.toolchain.placing.layout

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total63 of 630%2 of 20%88887733
LayoutAlgorithm280%n/a44224411
Layout230%20%33662211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/index.source.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/index.source.html new file mode 100644 index 00000000..4ee04b70 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing.layout/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.placing.layout

codemetropolis.toolchain.placing.layout

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total63 of 630%2 of 20%88887733
Layout.java350%20%44663322
LayoutAlgorithm.java280%n/a44224411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI$1.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI$1.html new file mode 100644 index 00000000..06e66744 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI$1.html @@ -0,0 +1 @@ +CityMapGUI.new WindowAdapter() {...}

CityMapGUI.new WindowAdapter() {...}

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total9 of 90%0 of 0n/a224422
{...}60%n/a112211
windowClosing(WindowEvent)30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI$CityMapCanvas.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI$CityMapCanvas.html new file mode 100644 index 00000000..4b5d5746 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI$CityMapCanvas.html @@ -0,0 +1 @@ +CityMapGUI.CityMapCanvas

CityMapGUI.CityMapCanvas

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total150 of 1500%13 of 130%1111262633
paint(Graphics)770%70%66131311
CityMapGUI.CityMapCanvas(CityMapGUI, BuildableTree)700%60%44121211
getPreferredSize()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI.html new file mode 100644 index 00000000..aea4d6b6 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI.html @@ -0,0 +1 @@ +CityMapGUI

CityMapGUI

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total41 of 410%0 of 0n/a119911
CityMapGUI(BuildableTree)410%n/a119911
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI.java.html new file mode 100644 index 00000000..4156eef2 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CityMapGUI.java.html @@ -0,0 +1,105 @@ +CityMapGUI.java

CityMapGUI.java

package codemetropolis.toolchain.placing;
+
+import java.awt.BorderLayout;
+import java.awt.Canvas;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.ScrollPane;
+import java.awt.event.WindowEvent;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.commons.cmxml.BuildableTree;
+
+public class CityMapGUI extends Frame {
+	
+	private static final long serialVersionUID = 1L;
+	
+	private static final int SCALE = 3;
+	private static final int WIDTH = 800;
+	private static final int HEIGHT = 600;
+	
+	public CityMapGUI(BuildableTree buildables) {
+
+		super("Map");
+		setSize(WIDTH, HEIGHT);
+		setLayout(new BorderLayout()); 
+
+		ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
+		scroller.add(new CityMapCanvas(buildables));
+		scroller.setSize(WIDTH, HEIGHT);
+
+		add("Center", scroller);
+		
+		addWindowListener(new java.awt.event.WindowAdapter() {
+			public void windowClosing(WindowEvent evt) {
+				System.exit(0);
+			}
+		});
+	}
+	
+	public class CityMapCanvas extends Canvas {
+		
+		private static final long serialVersionUID = 1L;
+
+		Dimension preferredSize;
+		
+		private BuildableTree buildables;
+		
+		public CityMapCanvas(BuildableTree buildables) {
+			super();
+			this.buildables = buildables;
+			
+			int mapWidth = 0;
+			int mapHeight = 0;
+			
+			for(Buildable b : buildables.getBuildables()) {
+				if( mapWidth < (b.getPositionX() + b.getSizeX()) * SCALE) 
+					mapWidth = (b.getPositionX() + b.getSizeX()) * SCALE;
+				if( mapHeight < (b.getPositionZ() + b.getSizeZ()) * SCALE) 
+					mapHeight = (b.getPositionZ() + b.getSizeZ()) * SCALE;	
+			}
+			
+			preferredSize = new Dimension(mapWidth + 10, mapHeight + 10);
+			
+		}
+
+		@Override
+	    public Dimension getPreferredSize() {
+	        return preferredSize;
+	    }
+		
+	    @Override
+	    public void paint(Graphics g) {
+	    	
+	    	Graphics2D g2d = (Graphics2D) g;
+	    	
+	    	for(Buildable b : buildables.getBuildables()) {
+	        	switch(b.getType()) {
+	        		case GROUND :
+	        			g2d.setColor(new Color(240, 180, 100)); //orange
+	        			break;
+	        		case GARDEN :
+	        			g2d.setColor(new Color(40, 80, 140)); //blue
+	        			break;
+	        		case FLOOR :
+	        			g2d.setColor(new Color(170, 200, 30)); //green
+	        			break;
+	        		case CELLAR :
+	        			g2d.setColor(new Color(230, 50, 40)); //red
+	        			break;
+	        		default:
+	        			break;
+	        	}
+	        	g2d.drawRect(b.getPositionX() * SCALE, b.getPositionZ() * SCALE, b.getSizeX() * SCALE, b.getSizeZ() * SCALE);
+	        }
+	    	
+	    }
+	      
+	}
+
+}
+
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CommandLineOptions.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CommandLineOptions.html new file mode 100644 index 00000000..b2bc8366 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CommandLineOptions.html @@ -0,0 +1 @@ +CommandLineOptions

CommandLineOptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total33 of 330%0 of 0n/a66111166
CommandLineOptions()180%n/a116611
showHelp()30%n/a111111
getInputFile()30%n/a111111
getOutputFile()30%n/a111111
getLayout()30%n/a111111
showMap()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CommandLineOptions.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CommandLineOptions.java.html new file mode 100644 index 00000000..d5d5227e --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/CommandLineOptions.java.html @@ -0,0 +1,43 @@ +CommandLineOptions.java

CommandLineOptions.java

package codemetropolis.toolchain.placing;
+
+import org.kohsuke.args4j.Option;
+
+public class CommandLineOptions {
+	
+	@Option(name="-h", aliases = { "--help" }, usage="shows basic info")
+	private boolean showHelp = false;
+	
+	@Option(name="-i", aliases = { "--input" }, usage="input from this file")
+	private String inputFile = null;
+
+	@Option(name="-o", aliases = { "--output" }, usage="output to this file")
+	private String outputFile = "placingToRendering.xml";
+	
+	@Option(name="-l", aliases = { "--layout" }, usage="layout algorithm")
+	private String layout = "pack";
+	 
+	@Option(name="-m", aliases = { "--map" }, usage="whether or not the map should be shown")
+	private boolean showMap = false;
+
+	public boolean showHelp() {
+		return showHelp;
+	}
+	
+	public String getInputFile() {
+		return inputFile;
+	}
+
+	public String getOutputFile() {
+		return outputFile;
+	}
+	
+	public String getLayout() {
+		return layout;
+	}
+
+	public boolean showMap() {
+		return showMap;
+	}
+	 
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/Main.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/Main.html new file mode 100644 index 00000000..dc9362cb --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/Main.html @@ -0,0 +1 @@ +Main

Main

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total82 of 820%6 of 60%55272722
main(String[])790%60%44262611
Main()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/Main.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/Main.java.html new file mode 100644 index 00000000..d3117e61 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/Main.java.html @@ -0,0 +1,51 @@ +Main.java

Main.java

package codemetropolis.toolchain.placing;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+
+import codemetropolis.toolchain.commons.util.FileLogger;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.commons.util.Settings;
+
+public class Main {
+
+	public static void main(String[] args) {
+		
+		FileLogger.load(Settings.get("placing_log_file"));
+		
+		CommandLineOptions options = new CommandLineOptions();
+	    CmdLineParser parser = new CmdLineParser(options);
+
+	    try {
+	        parser.parseArgument(args);
+	        if(options.getInputFile() == null && !options.showHelp())
+	        	throw new IllegalArgumentException();
+	    } catch (CmdLineException | IllegalArgumentException e) {
+	    	String message = Resources.get("command_line_error");
+	    	FileLogger.logError(message, e);
+	    	System.err.println(message);
+	    	System.err.println(Resources.get("placing_usage"));
+	    	return;
+	    }
+	    
+	    if(options.showHelp()) {
+	    	System.out.println(Resources.get("placing_introduction"));
+	    	System.out.println(Resources.get("placing_usage"));
+	    	return;
+	    }
+		
+		PlacingExecutor executor = new PlacingExecutor();
+	    executor.setPrefix(Resources.get("placing_prefix"));
+	    executor.setErrorPrefix(Resources.get("error_prefix"));
+		executor.execute(
+				new PlacingExecutorArgs(
+						options.getInputFile(),
+						options.getOutputFile(),
+						options.getLayout(),
+						options.showMap())
+				);
+		
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor$1.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor$1.html new file mode 100644 index 00000000..0d5ccfe7 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor$1.html @@ -0,0 +1 @@ +PlacingExecutor.new Runnable() {...}

PlacingExecutor.new Runnable() {...}

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total19 of 190%0 of 0n/a225522
run()100%n/a113311
{...}90%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor.html new file mode 100644 index 00000000..edab0635 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor.html @@ -0,0 +1 @@ +PlacingExecutor

PlacingExecutor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total150 of 1500%4 of 40%44383822
execute(ExecutorArgs)1470%40%33373711
PlacingExecutor()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor.java.html new file mode 100644 index 00000000..fc5dba4b --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutor.java.html @@ -0,0 +1,83 @@ +PlacingExecutor.java

PlacingExecutor.java

package codemetropolis.toolchain.placing;
+
+import java.awt.EventQueue;
+import java.io.IOException;
+
+import codemetropolis.toolchain.commons.cmxml.BuildableTree;
+import codemetropolis.toolchain.commons.cmxml.CmxmlValidator;
+import codemetropolis.toolchain.commons.cmxml.exceptions.CmxmlReaderException;
+import codemetropolis.toolchain.commons.cmxml.exceptions.CmxmlValidationFailedException;
+import codemetropolis.toolchain.commons.cmxml.exceptions.CmxmlWriterException;
+import codemetropolis.toolchain.commons.executor.AbstractExecutor;
+import codemetropolis.toolchain.commons.executor.ExecutorArgs;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.placing.exceptions.LayoutException;
+import codemetropolis.toolchain.placing.exceptions.NonExistentLayoutException;
+import codemetropolis.toolchain.placing.layout.Layout;
+
+public class PlacingExecutor extends AbstractExecutor {
+
+	@Override
+	public boolean execute(ExecutorArgs args) {
+		PlacingExecutorArgs placingArgs = (PlacingExecutorArgs)args;
+			
+		try {
+			boolean isValid = CmxmlValidator.validate(placingArgs.getInputFile());
+			if(!isValid) {
+				throw new CmxmlValidationFailedException();
+			}
+		} catch (IOException e) {
+			printError(e, Resources.get("missing_input_xml_error"));
+			return false;
+		} catch (CmxmlValidationFailedException e) {
+			printError(e, Resources.get("invalid_input_xml_error"));
+			return false;
+		}
+		
+		print(Resources.get("placing_reading_input"));
+		BuildableTree buildables = new BuildableTree();
+		try {
+			buildables.loadFromFile(placingArgs.getInputFile());
+		} catch (CmxmlReaderException e) {
+			printError(e, Resources.get("cmxml_reader_error"));
+			return false;
+		}
+		print(Resources.get("placing_reading_input_done"));
+		
+		print(Resources.get("calculating_size_and_pos"));
+		try {
+			Layout layout = Layout.parse(placingArgs.getLayout());
+			layout.apply(buildables);
+		} catch (NonExistentLayoutException e) {
+			printError(e, Resources.get("missing_layout_error"));
+			return false;
+		} catch (LayoutException e) {
+			printError(e, Resources.get("layout_error"));
+			return false;
+		}
+		print(Resources.get("calculating_size_and_pos_done"));
+
+		print(Resources.get("placing_printing_output"));
+		try {
+			buildables.writeToFile(placingArgs.getOutputFile(), "placing", "rendering", "1.0");
+		} catch (CmxmlWriterException e) {
+			printError(e, Resources.get("cmxml_writer_error"));
+			return false;
+		}
+		print(Resources.get("placing_printing_output_done"));
+		
+		if(placingArgs.showMap()) {
+			final BuildableTree b = buildables;
+			EventQueue.invokeLater(new Runnable() {
+				public void run() {
+					CityMapGUI map = new CityMapGUI(b);
+					map.setVisible(true);
+				}
+			});
+		}
+		
+		return true;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutorArgs.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutorArgs.html new file mode 100644 index 00000000..463c9575 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutorArgs.html @@ -0,0 +1 @@ +PlacingExecutorArgs

PlacingExecutorArgs

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total34 of 340%0 of 0n/a66121266
PlacingExecutorArgs(String, String, String, boolean)150%n/a116611
PlacingExecutorArgs(String, String)70%n/a112211
getInputFile()30%n/a111111
getOutputFile()30%n/a111111
getLayout()30%n/a111111
showMap()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutorArgs.java.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutorArgs.java.html new file mode 100644 index 00000000..a55ab30a --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/PlacingExecutorArgs.java.html @@ -0,0 +1,41 @@ +PlacingExecutorArgs.java

PlacingExecutorArgs.java

package codemetropolis.toolchain.placing;
+
+import codemetropolis.toolchain.commons.executor.ExecutorArgs;
+
+public class PlacingExecutorArgs extends ExecutorArgs {
+	
+	private String inputFile;
+	private String outputFile;
+	private String layout;
+	private boolean showMap;
+	
+	public PlacingExecutorArgs(String inputFile, String outputFile, String layout, boolean showMap) {
+		super();
+		this.inputFile = inputFile;
+		this.outputFile = outputFile;
+		this.layout = layout;
+		this.showMap = showMap;
+	}
+	
+	public PlacingExecutorArgs(String inputFile, String outputFile) {
+		this(inputFile, outputFile, "pack", false);
+	}
+
+	public String getInputFile() {
+		return inputFile;
+	}
+
+	public String getOutputFile() {
+		return outputFile;
+	}
+
+	public String getLayout() {
+		return layout;
+	}
+
+	public boolean showMap() {
+		return showMap;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/index.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/index.html new file mode 100644 index 00000000..f97be684 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.placing

codemetropolis.toolchain.placing

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total551 of 5510%23 of 230%3838130130252599
CityMapGUI.CityMapCanvas1500%130%111126263311
PlacingExecutor1500%40%4438382211
Main820%60%5527272211
CityMapGUI410%n/a11991111
PlacingExecutorArgs340%n/a6612126611
CommandLineOptions330%n/a6611116611
PlacingExecutor.new Runnable() {...}190%n/a22552211
CityMapGUI.new WindowAdapter() {...}90%n/a22442211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/index.source.html b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/index.source.html new file mode 100644 index 00000000..af325008 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/codemetropolis.toolchain.placing/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.placing

codemetropolis.toolchain.placing

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total551 of 5510%23 of 230%3838130130252599
CityMapGUI.java2330%130%151538387744
PlacingExecutor.java1690%40%6642424422
Main.java820%60%5527272211
PlacingExecutorArgs.java340%n/a6612126611
CommandLineOptions.java330%n/a6611116611
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-placing/src_main_java/index.html b/doc/codemetropolis-toolchain-placing/src_main_java/index.html new file mode 100644 index 00000000..27b097e0 --- /dev/null +++ b/doc/codemetropolis-toolchain-placing/src_main_java/index.html @@ -0,0 +1 @@ +src/main/java

src/main/java

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total3,912 of 3,9120%431 of 4310%3493497387381311312525
codemetropolis.toolchain.placing.layout.pack1,9730%2380%184184331331646488
codemetropolis.toolchain.placing.layout.tetris1,2560%1680%104104239239202022
codemetropolis.toolchain.placing5510%230%3838130130252599
codemetropolis.toolchain.placing.exceptions690%n/a15153030151533
codemetropolis.toolchain.placing.layout630%20%88887733
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/index.html b/doc/codemetropolis-toolchain-rendering/index.html new file mode 100644 index 00000000..b6691a4e --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/index.html @@ -0,0 +1 @@ +codemetropolis-toolchain-rendering

codemetropolis-toolchain-rendering

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total8,212 of 8,2120%239 of 2390%3253251,0871,0871851854444
src/main/java8,2120%2390%3253251,0871,0871851854444
src/main/resourcesn/an/a00000000
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/BuildPhase.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/BuildPhase.html new file mode 100644 index 00000000..66c7c2bc --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/BuildPhase.html @@ -0,0 +1 @@ +BuildPhase

BuildPhase

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total48 of 480%0 of 0n/a444444
static {...}340%n/a114411
valueOf(String)50%n/a111111
BuildPhase(String, int)50%n/a111111
values()40%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/BuildPhase.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/BuildPhase.java.html new file mode 100644 index 00000000..c85e9b35 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/BuildPhase.java.html @@ -0,0 +1,8 @@ +BuildPhase.java

BuildPhase.java

package codemetropolis.toolchain.rendering.control;
+
+public enum BuildPhase {
+	READING_INPUT_FILE,
+	GENERATING_BLOCKS,
+	PLACING_BLOCKS
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/WorldBuilder.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/WorldBuilder.html new file mode 100644 index 00000000..12bdc926 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/WorldBuilder.html @@ -0,0 +1 @@ +WorldBuilder

WorldBuilder

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total441 of 4410%29 of 290%262686861010
build(File)1420%160%99232311
createBuildings(String)1410%70%66333311
createBlocks(File, int)780%40%33111111
WorldBuilder(String)310%n/a118811
raiseProgressEvent(BuildPhase, long, long, long)260%20%224411
addEventListener(ProgressEventListener)60%n/a112211
removeEventListener(ProgressEventListener)60%n/a112211
getNumberOfBuildings()40%n/a111111
getTimeElapsedDuringLastPhase()40%n/a111111
getNumberOfBlocks()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/WorldBuilder.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/WorldBuilder.java.html new file mode 100644 index 00000000..e88f5b1a --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/WorldBuilder.java.html @@ -0,0 +1,170 @@ +WorldBuilder.java

WorldBuilder.java

package codemetropolis.toolchain.rendering.control;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.EventListener;
+import java.util.List;
+
+import org.apache.commons.lang3.time.StopWatch;
+
+import codemetropolis.blockmodifier.World;
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.commons.cmxml.BuildableTree;
+import codemetropolis.toolchain.commons.cmxml.exceptions.CmxmlReaderException;
+import codemetropolis.toolchain.rendering.events.ProgressEvent;
+import codemetropolis.toolchain.rendering.events.ProgressEventListener;
+import codemetropolis.toolchain.rendering.exceptions.BuildingTypeMismatchException;
+import codemetropolis.toolchain.rendering.exceptions.RenderingException;
+import codemetropolis.toolchain.rendering.exceptions.TooLongRenderDurationException;
+import codemetropolis.toolchain.rendering.model.building.*;
+import codemetropolis.toolchain.rendering.model.primitive.Boxel;
+
+public class WorldBuilder {
+
+	private static final int GROUND_LEVEL = 60;
+	
+	private World world;
+	private List<Building> buildings = new ArrayList<Building>();
+	private StopWatch stopWatch = new StopWatch();
+
+	private int count = 0;
+	private int total = 0;
+	
+	public WorldBuilder(String worldPath) {
+		world = new World(worldPath, GROUND_LEVEL);
+	}
+	
+	public void createBuildings(String inputPath) throws BuildingTypeMismatchException{
+		BuildableTree buildables = new BuildableTree();
+		try {
+			buildables.loadFromFile(inputPath);
+		} catch (CmxmlReaderException e) {
+			e.printStackTrace();
+			return;
+		}
+		
+		List<Floor> floors = new ArrayList<Floor>();
+		List<Cellar> cellars = new ArrayList<Cellar>();
+		List<Garden> gardens = new ArrayList<Garden>();
+		List<Ground> grounds = new ArrayList<Ground>();
+
+		for(Buildable b : buildables.getBuildables()) {
+			switch(b.getType()) {
+				case FLOOR: 
+					Floor floor = new Floor(b);
+					floors.add(floor);
+					total += floor.getNumberOfBlocks();
+					break;
+				case CELLAR: 
+					Cellar cellar = new Cellar(b);
+					cellars.add(cellar);
+					total += cellar.getNumberOfBlocks();
+					break;
+				case GARDEN: 
+					Garden garden = new Garden(b);
+					gardens.add(garden);
+					total += garden.getNumberOfBlocks();
+					break;
+				case GROUND:
+					Ground ground = new Ground(b);
+					grounds.add(ground);
+					total += ground.getNumberOfBlocks();
+					break;
+				case CONTAINER:
+					break;
+			}
+		}
+		
+		buildings.addAll(grounds);
+		buildings.addAll(gardens);
+		buildings.addAll(cellars);
+		buildings.addAll(floors);
+		
+		raiseProgressEvent(BuildPhase.READING_INPUT_FILE, 1, 1, -1);
+	}
+	
+	public void createBlocks(File directory, int maxTime) throws TooLongRenderDurationException {
+		raiseProgressEvent(BuildPhase.GENERATING_BLOCKS, 0, total, 0);
+		stopWatch.reset();
+		stopWatch.start();
+		for(Building b : buildings) {
+			count += b.toCSVFile(directory);
+			long timeElapsed = stopWatch.getTime();
+			int timeLeftInMinutes = (int) ((double)timeElapsed / count * (total - count)) / (1000 * 60);
+			if(timeLeftInMinutes > maxTime) throw new TooLongRenderDurationException(timeLeftInMinutes, maxTime);
+			raiseProgressEvent(BuildPhase.GENERATING_BLOCKS, count, total, timeElapsed);
+		}
+		stopWatch.stop();
+	}
+	
+	public void build(File sourceDirectory) throws RenderingException {
+		
+		if(!sourceDirectory.exists()) {
+			return;
+		}
+		
+		raiseProgressEvent(BuildPhase.PLACING_BLOCKS, 0, total, 0);
+        count = 0;
+        stopWatch.reset();
+		stopWatch.start();
+        
+        for(File f : sourceDirectory.listFiles()) {
+            if(f.getName().matches("blocks\\.-?[0-9]*\\.-?[0-9]*.csv")) {
+                try(BufferedReader reader = new BufferedReader(new FileReader(f))) {
+                	String blockString = reader.readLine();
+                	while(blockString != null) {
+                		Boxel boxel = Boxel.parseCSV(blockString);
+                		boxel.render(world);
+                		count++;
+                		blockString = reader.readLine();
+                	}
+                } catch (IOException e) {
+					throw new RenderingException(e);
+				}
+            }
+            long timeSpent = stopWatch.getTime();
+			raiseProgressEvent(BuildPhase.PLACING_BLOCKS, count, total, timeSpent);
+        }
+        
+        world.finish();
+        stopWatch.stop();
+        raiseProgressEvent(BuildPhase.PLACING_BLOCKS, total, total, stopWatch.getTime());
+	}
+	
+	public int getNumberOfBuildings() {
+		return buildings.size();
+	}
+	
+	public int getNumberOfBlocks() {
+		return total;
+	}
+	
+	public long getTimeElapsedDuringLastPhase() {
+		return stopWatch.getTime();
+	}
+	
+	//region PROGRESS EVENT
+	private List<EventListener> listeners = new ArrayList<EventListener>();
+	
+	public synchronized void addEventListener(ProgressEventListener listener)  {
+		listeners.add(listener);
+	}
+	
+	public synchronized void removeEventListener(ProgressEventListener listener)   {
+		listeners.remove(listener);
+	}
+	 
+	private synchronized void raiseProgressEvent(BuildPhase phase, long count, long total, long timeElapsedInMillis) {
+		ProgressEvent event = new ProgressEvent(this, phase, count, total, timeElapsedInMillis);
+		
+		for(EventListener listener : listeners) {
+			((ProgressEventListener) listener).onNextState(event);
+		}
+    }
+	//endregion
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/index.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/index.html new file mode 100644 index 00000000..525ded01 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.control

codemetropolis.toolchain.rendering.control

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total529 of 5290%29 of 290%31319090151533
WorldBuilder4410%290%26268686101011
BuildPhase480%n/a44444411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/index.source.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/index.source.html new file mode 100644 index 00000000..3af72270 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.control/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.control

codemetropolis.toolchain.rendering.control

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total529 of 5290%29 of 290%31319090151533
WorldBuilder.java4810%290%27278686111122
BuildPhase.java480%n/a44444411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/ProgressEvent.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/ProgressEvent.html new file mode 100644 index 00000000..b944533a --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/ProgressEvent.html @@ -0,0 +1 @@ +ProgressEvent

ProgressEvent

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total48 of 480%0 of 0n/a449944
ProgressEvent(Object, BuildPhase, long, long, long)160%n/a116611
getTimeLeftInMillis()160%n/a111111
getPercent()100%n/a111111
getTimeLeft()60%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/ProgressEvent.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/ProgressEvent.java.html new file mode 100644 index 00000000..b3aa21e5 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/ProgressEvent.java.html @@ -0,0 +1,38 @@ +ProgressEvent.java

ProgressEvent.java

package codemetropolis.toolchain.rendering.events;
+
+import java.util.EventObject;
+
+import codemetropolis.toolchain.commons.util.Time;
+import codemetropolis.toolchain.rendering.control.BuildPhase;
+
+public class ProgressEvent extends EventObject {
+	
+	private static final long serialVersionUID = 1L;
+	
+	public final BuildPhase PHASE;
+	public final long COUNT;
+	public final long TOTAL;
+	public final long TIME_ELAPSED_IN_MILLIS;
+
+	public ProgressEvent(Object source, BuildPhase phase, long count, long total, long timeElapsedInMillis) {
+		super(source);
+		this.PHASE = phase;
+		this.COUNT = count;
+		this.TOTAL = total;
+		this.TIME_ELAPSED_IN_MILLIS = timeElapsedInMillis;
+	}
+	
+	public double getPercent() {
+		return (double)COUNT / TOTAL * 100;
+	}
+	
+	public long getTimeLeftInMillis() {
+		return (long) ((double)TIME_ELAPSED_IN_MILLIS / COUNT * (TOTAL - COUNT));
+	}
+	
+	public Time getTimeLeft() {
+		return new Time(getTimeLeftInMillis());
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/index.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/index.html new file mode 100644 index 00000000..599c0a83 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.events

codemetropolis.toolchain.rendering.events

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total48 of 480%0 of 0n/a44994411
ProgressEvent480%n/a44994411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/index.source.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/index.source.html new file mode 100644 index 00000000..fa2c802c --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.events/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.events

codemetropolis.toolchain.rendering.events

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total48 of 480%0 of 0n/a44994411
ProgressEvent.java480%n/a44994411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/BuildingTypeMismatchException.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/BuildingTypeMismatchException.html new file mode 100644 index 00000000..86b0ea71 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/BuildingTypeMismatchException.html @@ -0,0 +1 @@ +BuildingTypeMismatchException

BuildingTypeMismatchException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total40 of 400%0 of 0n/a66121266
BuildingTypeMismatchException(Buildable.Type, Class)170%n/a112211
BuildingTypeMismatchException(String, Throwable, boolean, boolean)70%n/a112211
BuildingTypeMismatchException(String, Throwable)50%n/a112211
BuildingTypeMismatchException(String)40%n/a112211
BuildingTypeMismatchException(Throwable)40%n/a112211
BuildingTypeMismatchException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/BuildingTypeMismatchException.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/BuildingTypeMismatchException.java.html new file mode 100644 index 00000000..f7094104 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/BuildingTypeMismatchException.java.html @@ -0,0 +1,35 @@ +BuildingTypeMismatchException.java

BuildingTypeMismatchException.java

package codemetropolis.toolchain.rendering.exceptions;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable.Type;
+import codemetropolis.toolchain.rendering.model.building.Building;
+
+public class BuildingTypeMismatchException extends RenderingException {
+
+	private static final long serialVersionUID = 3337855398912743115L;
+
+	public BuildingTypeMismatchException() {
+		super();
+	}
+
+	public BuildingTypeMismatchException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public BuildingTypeMismatchException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public BuildingTypeMismatchException(String message) {
+		super(message);
+	}
+
+	public BuildingTypeMismatchException(Throwable cause) {
+		super(cause);
+	}
+	
+	public BuildingTypeMismatchException(Type buildableType, Class<? extends Building> buildingType) {
+		this(String.format("Buildable of type '%s' cannot be converted to '%s'", buildableType.name(), buildingType.getName()));
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/RenderingException.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/RenderingException.html new file mode 100644 index 00000000..10445e1a --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/RenderingException.html @@ -0,0 +1 @@ +RenderingException

RenderingException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%0 of 0n/a55101055
RenderingException(String, Throwable, boolean, boolean)70%n/a112211
RenderingException(String, Throwable)50%n/a112211
RenderingException(String)40%n/a112211
RenderingException(Throwable)40%n/a112211
RenderingException()30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/RenderingException.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/RenderingException.java.html new file mode 100644 index 00000000..e7cbfc31 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/RenderingException.java.html @@ -0,0 +1,30 @@ +RenderingException.java

RenderingException.java

package codemetropolis.toolchain.rendering.exceptions;
+
+import codemetropolis.toolchain.commons.exceptions.CodeMetropolisException;
+
+public class RenderingException extends CodeMetropolisException {
+
+	private static final long serialVersionUID = 7171725393210241725L;
+
+	public RenderingException() {
+		super();
+	}
+
+	public RenderingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+		super(message, cause, enableSuppression, writableStackTrace);
+	}
+
+	public RenderingException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public RenderingException(String message) {
+		super(message);
+	}
+
+	public RenderingException(Throwable cause) {
+		super(cause);
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/TooLongRenderDurationException.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/TooLongRenderDurationException.html new file mode 100644 index 00000000..5727e01c --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/TooLongRenderDurationException.html @@ -0,0 +1 @@ +TooLongRenderDurationException

TooLongRenderDurationException

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total15 of 150%0 of 0n/a336633
TooLongRenderDurationException(int, int)90%n/a114411
getEstimatedTime()30%n/a111111
getMaxTime()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/TooLongRenderDurationException.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/TooLongRenderDurationException.java.html new file mode 100644 index 00000000..1026dc09 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/TooLongRenderDurationException.java.html @@ -0,0 +1,25 @@ +TooLongRenderDurationException.java

TooLongRenderDurationException.java

package codemetropolis.toolchain.rendering.exceptions;
+
+public class TooLongRenderDurationException extends RenderingException {
+
+	private static final long serialVersionUID = -7647174616882103244L;
+
+	private int estimatedTime;
+	private int maxTime;
+	
+	public TooLongRenderDurationException(int estimatedTime, int maxTime) {
+		super();
+		this.estimatedTime = estimatedTime;
+		this.maxTime = maxTime;
+	}
+
+	public int getEstimatedTime() {
+		return estimatedTime;
+	}
+
+	public int getMaxTime() {
+		return maxTime;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/index.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/index.html new file mode 100644 index 00000000..a7577762 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.exceptions

codemetropolis.toolchain.rendering.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total78 of 780%0 of 0n/a14142828141433
BuildingTypeMismatchException400%n/a6612126611
RenderingException230%n/a5510105511
TooLongRenderDurationException150%n/a33663311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/index.source.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/index.source.html new file mode 100644 index 00000000..53dbde16 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.exceptions/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.exceptions

codemetropolis.toolchain.rendering.exceptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total78 of 780%0 of 0n/a14142828141433
BuildingTypeMismatchException.java400%n/a6612126611
RenderingException.java230%n/a5510105511
TooLongRenderDurationException.java150%n/a33663311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Building.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Building.html new file mode 100644 index 00000000..5c5dc272 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Building.html @@ -0,0 +1 @@ +Building

Building

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total140 of 1400%8 of 80%1212333388
Building(Buildable)670%n/a11171711
toCSVFile(File)250%20%225511
getNumberOfBlocks()210%20%224411
adjustSize(int)150%40%333311
getInnerBuildable()30%n/a111111
getPosition()30%n/a111111
getCenter()30%n/a111111
getSize()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Building.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Building.java.html new file mode 100644 index 00000000..922fa25a --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Building.java.html @@ -0,0 +1,85 @@ +Building.java

Building.java

package codemetropolis.toolchain.rendering.model.building;
+
+import java.io.File;
+import java.util.LinkedList;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.primitive.Primitive;
+import codemetropolis.toolchain.rendering.model.primitive.SignPost;
+
+public class Building {
+
+	private static final int MIN_SIZE = 9;
+
+	protected LinkedList<Primitive> primitives = new LinkedList<Primitive>();
+	protected LinkedList<SignPost> signs = new LinkedList<SignPost>();
+	protected Buildable innerBuildable;
+	
+	protected Point position;
+	protected Point center;
+	protected Point size;
+	
+	public Building( Buildable innerBuildable )
+	{
+		this.innerBuildable = innerBuildable;
+		
+		size = new Point(
+				adjustSize(innerBuildable.getSizeX()),
+				adjustSize(innerBuildable.getSizeY()),
+				adjustSize(innerBuildable.getSizeZ())
+				);
+		
+		position = new Point(
+				innerBuildable.getPositionX(),
+				innerBuildable.getPositionY(),
+				innerBuildable.getPositionZ()
+				);
+		
+		center = new Point(
+				(int)(size.getX() * 0.5),
+				(int)(size.getY() * 0.5),
+				(int)(size.getZ() * 0.5)
+				);
+	}
+	
+	private static int adjustSize( int x ) {
+		if(x < MIN_SIZE) return MIN_SIZE;
+		if(x % 2 == 0) return x + 1;
+		return x;
+	}
+	
+	public int toCSVFile(File directory) {
+		int count = 0;
+		for(Primitive primitive : primitives) {
+			primitive.toCSVFile(directory);
+			count += primitive.getNumberOfBlocks();
+		}
+		return count;
+	}
+	
+	public Buildable getInnerBuildable() {
+		return innerBuildable;
+	}
+
+	public Point getPosition() {
+		return position;
+	}
+
+	public Point getCenter() {
+		return center;
+	}
+
+	public Point getSize() {
+		return size;
+	}
+
+	public int getNumberOfBlocks() {
+		int result = 0;
+		for(Primitive p : primitives)
+			result += p.getNumberOfBlocks();
+		return result;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Cellar.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Cellar.html new file mode 100644 index 00000000..5aea0536 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Cellar.html @@ -0,0 +1 @@ +Cellar

Cellar

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total165 of 1650%2 of 20%22191911
Cellar(Buildable)1650%20%22191911
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Cellar.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Cellar.java.html new file mode 100644 index 00000000..48ec7220 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Cellar.java.html @@ -0,0 +1,39 @@ +Cellar.java

Cellar.java

package codemetropolis.toolchain.rendering.model.building;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.commons.cmxml.Buildable.Type;
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.exceptions.BuildingTypeMismatchException;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+import codemetropolis.toolchain.rendering.model.pattern.RepeationPattern;
+import codemetropolis.toolchain.rendering.model.primitive.SolidBox;
+import codemetropolis.toolchain.rendering.util.Orientation;
+
+public class Cellar extends Floor {
+
+	public Cellar(Buildable innerBuildable) throws BuildingTypeMismatchException {
+		super(innerBuildable);
+		
+		if ( innerBuildable.getType() != Type.CELLAR )
+			throw new BuildingTypeMismatchException(innerBuildable.getType(), getClass());
+		
+		primitives.add(
+				0,
+				new SolidBox(
+					position.translate( new Point( 1, 1, 1 ) ),
+					size.translate( new Point( -2, -2, -2 ) ),
+					new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air" ) } } } ),
+					new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air" ) } } } ),
+					Orientation.NearX ) );
+		
+		primitives.add(
+				new SolidBox(
+					position.translate( new Point( center.getX() - 3, size.getY() + 1, center.getZ() - 3 ) ),
+					new Point( 7, 1, 7 ),
+					new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air" ) } } } ),
+					new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air" ) } } } ),
+					Orientation.NearX ) );
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Floor.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Floor.html new file mode 100644 index 00000000..3195b4f6 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Floor.html @@ -0,0 +1 @@ +Floor

Floor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total2,817 of 2,8170%19 of 190%191924224277
prepareStairs()1,1180%n/a11606011
prepareDoor()5390%n/a11595911
prepareWalls()4070%60%44424211
prepareTorches()3690%20%22474711
prepareSigns()2530%n/a119911
createTorchPattern(int, int)1010%70%77161611
Floor(Buildable)300%40%339911
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Floor.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Floor.java.html new file mode 100644 index 00000000..badb188f --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Floor.java.html @@ -0,0 +1,347 @@ +Floor.java

Floor.java

package codemetropolis.toolchain.rendering.model.building;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.commons.cmxml.Buildable.Type;
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.exceptions.BuildingTypeMismatchException;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+import codemetropolis.toolchain.rendering.model.pattern.RandomPattern;
+import codemetropolis.toolchain.rendering.model.pattern.RepeationPattern;
+import codemetropolis.toolchain.rendering.model.primitive.Door;
+import codemetropolis.toolchain.rendering.model.primitive.EmptyBox;
+import codemetropolis.toolchain.rendering.model.primitive.Row;
+import codemetropolis.toolchain.rendering.model.primitive.SolidBox;
+import codemetropolis.toolchain.rendering.model.primitive.WallSign;
+import codemetropolis.toolchain.rendering.util.Character;
+import codemetropolis.toolchain.rendering.util.Orientation;
+
+public class Floor extends Building {
+
+	public Floor(Buildable innerBuildable) throws BuildingTypeMismatchException {
+		super(innerBuildable);
+		
+		if ( innerBuildable.getType()!= Type.FLOOR && innerBuildable.getType() != Type.CELLAR )
+			throw new BuildingTypeMismatchException(innerBuildable.getType(), getClass());
+
+		prepareWalls();
+		prepareStairs();
+		prepareDoor();
+		prepareSigns();
+		prepareTorches();
+	}
+	
+	protected void prepareDoor() {
+		BasicBlock _red = new BasicBlock( "minecraft:redstone_block" );
+		BasicBlock _lgt = new BasicBlock( "minecraft:lit_redstone_lamp" );
+		BasicBlock _rwl = new BasicBlock( "minecraft:wool", 14 );
+		BasicBlock _gwl = new BasicBlock( "minecraft:wool", 5 );
+		BasicBlock _bwl = new BasicBlock( "minecraft:wool", 3 );
+		BasicBlock _ywl = new BasicBlock( "minecraft:wool", 4 );
+		primitives.add(
+			new SolidBox(
+				position.translate( new Point( center.getX() - 1, 0, 0 ) ), new Point( 3, 4, 1 ),
+				new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air", 2 ) } } } ),
+				new RepeationPattern(
+					new BasicBlock[][][]
+					{
+						{
+							{ _rwl },
+							{ _lgt },
+							{ _red },
+							{ _rwl }
+						}
+					} ),
+				Orientation.NearX )
+			);
+		primitives.add(
+			new SolidBox(
+				position.translate( new Point( center.getX() - 1, 0, size.getZ() - 1 ) ), new Point( 3, 4, 1 ),
+				new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air", 2 ) } } } ),
+				new RepeationPattern(
+					new BasicBlock[][][]
+					{
+						{
+							{ _gwl },
+							{ _lgt },
+							{ _red },
+							{ _gwl }
+						}
+					} ),
+				Orientation.NearX )
+			);
+		primitives.add(
+			new SolidBox(
+				position.translate( new Point( 0, 0, center.getZ()-1 ) ), new Point( 1, 4, 3 ),
+				new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air", 2 ) } } } ),
+				new RepeationPattern(
+					new BasicBlock[][][]
+					{
+						{
+							{ _bwl },
+							{ _lgt },
+							{ _red },
+							{ _bwl }
+						}
+					} ),
+				Orientation.NearX )
+			);
+		primitives.add(
+			new SolidBox(
+				position.translate( new Point( size.getX()-1, 0, center.getZ() - 1 ) ), new Point( 1, 4, 3 ),
+				new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air", 2 ) } } } ),
+				new RepeationPattern(
+					new BasicBlock[][][]
+					{
+						{
+							{ _ywl },
+							{ _lgt },
+							{ _red },
+							{ _ywl }
+						}
+					} ),
+				Orientation.NearX )
+			);
+		
+		primitives.add(new Door(position.getX() + size.getX() / 2, position.getY() + 1, position.getZ(), Door.Orientation.SOUTH));
+		primitives.add(new Door(position.getX() + size.getX() / 2, position.getY() + 1, position.getZ()  + size.getZ() - 1, Door.Orientation.NORTH));
+		primitives.add(new Door(position.getX(), position.getY() + 1, position.getZ() + size.getZ() / 2, Door.Orientation.EAST));
+		primitives.add(new Door(position.getX() + size.getX() - 1, position.getY() + 1, position.getZ() + size.getZ() / 2, Door.Orientation.WEST));	
+	}
+	
+	protected void prepareStairs() {
+		BasicBlock _air = new BasicBlock( (short) 0 );
+		BasicBlock _str = new BasicBlock( (short) 1 );
+		BasicBlock _cre = new BasicBlock( (short) 85 );
+		primitives.add(
+			new SolidBox(
+				position.translate( new Point( center.getX() - 2, 0, center.getZ() - 2 ) ),
+				new Point( 5, size.getY() + 1, 5 ),
+				new RepeationPattern(
+					new BasicBlock[][][]
+					{
+						{
+							{ _air, _air, _air, _air, _air },
+							{ _air, _str, _air, _air, _air },
+							{ _air, _air, _cre, _air, _air },
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _air, _air, _air }
+						},
+						{
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _str, _air, _air },
+							{ _air, _air, _cre, _air, _air },
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _air, _air, _air }
+						},
+						{
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _air, _str, _air },
+							{ _air, _air, _cre, _air, _air },
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _air, _air, _air }
+						},
+						{
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _cre, _str, _air },
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _air, _air, _air }
+						},
+						{
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _cre, _air, _air },
+							{ _air, _air, _air, _str, _air },
+							{ _air, _air, _air, _air, _air }
+						},
+						{
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _cre, _air, _air },
+							{ _air, _air, _str, _air, _air },
+							{ _air, _air, _air, _air, _air }
+						},
+						{
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _cre, _air, _air },
+							{ _air, _str, _air, _air, _air },
+							{ _air, _air, _air, _air, _air }
+						},
+						{
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _air, _air, _air },
+							{ _air, _str, _cre, _air, _air },
+							{ _air, _air, _air, _air, _air },
+							{ _air, _air, _air, _air, _air }
+						}
+					} ),
+				new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:fence" ) } } } ),
+				Orientation.NearY ) );
+	}
+	
+	protected void prepareWalls() {
+		RepeationPattern _bottomFill;
+		RepeationPattern _topFill;
+		RandomPattern _sideFill;
+		RepeationPattern _stroke;
+		BasicBlock _sideBlock;
+		BasicBlock _strcBlock;
+		
+		if(innerBuildable.hasAttribute( "character" ))
+		{
+			Character character = Character.parse(innerBuildable.getAttributeValue("character"));
+			_sideBlock = character.getBlock();
+			_topFill = new RepeationPattern( new BasicBlock[][][] { { { character.getTopBlock() } } } );
+		} else {
+			_sideBlock = new BasicBlock( "minecraft:wool", 2 );
+			_topFill = new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:wool", 2 ) } } } );
+		}
+		
+		if(innerBuildable.hasAttribute( "external_character" ))
+		{
+			Character externalCharacter = Character.parse(innerBuildable.getAttributeValue("external_character"));
+			_bottomFill = new RepeationPattern( new BasicBlock[][][] { { { externalCharacter.getBlock() } } } );
+			_strcBlock = externalCharacter.getBlock();
+			_stroke = new RepeationPattern( new BasicBlock[][][] { { { externalCharacter.getBlock() } } } );
+		} else {
+			_bottomFill = new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:wool", 2 ) } } } );
+			_strcBlock = new BasicBlock( "minecraft:wool", 10 );
+			_stroke = new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:wool", 15 ) } } } );
+		}
+		
+		RandomPattern _fallbackPattern = new RandomPattern( new RepeationPattern( new BasicBlock[][][] { { { BasicBlock.NonBlock } } } ) );
+		_fallbackPattern.add( new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:fence" ) } } } ), .5 );
+		_sideFill = new RandomPattern( _fallbackPattern );
+		_sideFill.add(
+			new RepeationPattern(
+				new BasicBlock[][][]
+				{
+					{
+						{ _sideBlock, _sideBlock, _strcBlock, _sideBlock, _sideBlock },
+						{ _sideBlock, _sideBlock, _strcBlock, _sideBlock, _sideBlock },
+						{ _strcBlock, _strcBlock, _strcBlock, _strcBlock, _strcBlock },
+						{ _sideBlock, _sideBlock, _strcBlock, _sideBlock, _sideBlock },
+						{ _sideBlock, _sideBlock, _strcBlock, _sideBlock, _sideBlock }
+					}
+				} ),
+			innerBuildable.hasAttribute( "completeness" )
+				? Double.parseDouble( innerBuildable.getAttributeValue("completeness") )
+				: 1 );
+		primitives.add(
+			new EmptyBox(
+				position,
+				size,
+				_bottomFill,
+				_topFill,
+				_sideFill,
+				_stroke,
+				new Point( 1, 1, 1 ),
+				new Point( 1, 1, 1 ) )
+			);
+	}
+	
+	private void prepareSigns( ) {
+		//Wall signs outside
+		primitives.add(new WallSign(position.getX() + size.getX() / 2, position.getY() + 3, position.getZ() - 1, WallSign.Orientation.NORTH, innerBuildable.getName()));
+		primitives.add(new WallSign(position.getX() + size.getX() / 2, position.getY() + 3, position.getZ()  + size.getZ(), WallSign.Orientation.SOUTH, innerBuildable.getName()));
+		primitives.add(new WallSign(position.getX() - 1, position.getY() + 3, position.getZ() + size.getZ() / 2, WallSign.Orientation.WEST, innerBuildable.getName()));
+		primitives.add(new WallSign(position.getX() + size.getX(), position.getY() + 3, position.getZ() + size.getZ() / 2, WallSign.Orientation.EAST, innerBuildable.getName()));
+		//Wall signs inside
+		primitives.add(new WallSign(position.getX() + size.getX() / 2, position.getY() + 3, position.getZ() + 1, WallSign.Orientation.SOUTH, innerBuildable.getName()));
+		primitives.add(new WallSign(position.getX() + size.getX() / 2, position.getY() + 3, position.getZ()  + size.getZ() - 2, WallSign.Orientation.NORTH, innerBuildable.getName()));
+		primitives.add(new WallSign(position.getX() + 1, position.getY() + 3, position.getZ() + size.getZ() / 2, WallSign.Orientation.EAST, innerBuildable.getName()));
+		primitives.add(new WallSign(position.getX() + size.getX() - 2, position.getY() + 3, position.getZ() + size.getZ() / 2, WallSign.Orientation.WEST, innerBuildable.getName()));	
+	}
+	
+	private void prepareTorches( ) {
+		
+		if(!innerBuildable.hasAttribute( "torches" )) return;
+		
+		int numberOfTorches = Integer.parseInt(innerBuildable.getAttributeValue("torches"));
+		BasicBlock[] pattern;
+		
+		pattern = createTorchPattern(numberOfTorches, 3);
+		primitives.add(new Row(
+				new Point(position.getX() + size.getX() / 2 + 2, position.getY() + 2, position.getZ() + 1),
+				size.getX() / 2 - 2,
+				Row.Direction.WEST,
+				pattern));
+		
+		primitives.add(new Row(
+				new Point(position.getX() + size.getX() / 2 - 2, position.getY() + 2, position.getZ() + 1),
+				size.getX() / 2 - 2,
+				Row.Direction.EAST,
+				pattern));
+		
+		pattern = createTorchPattern(numberOfTorches, 4);
+		primitives.add(new Row(
+				new Point(position.getX() + size.getX() / 2 + 2, position.getY() + 2, position.getZ()  + size.getZ() - 2),
+				size.getX() / 2 - 2,
+				Row.Direction.WEST,
+				pattern));
+		
+		primitives.add(new Row(
+				new Point(position.getX() + size.getX() / 2 - 2, position.getY() + 2, position.getZ()  + size.getZ() - 2),
+				size.getX() / 2 - 2,
+				Row.Direction.EAST,
+				pattern));
+		
+		pattern = createTorchPattern(numberOfTorches, 1);
+		primitives.add(new Row(
+				new Point(position.getX() + 1, position.getY() + 2, position.getZ() + size.getZ() / 2 + 2),
+				size.getZ() / 2 - 2,
+				Row.Direction.NORTH,
+				pattern));
+		
+		primitives.add(new Row(
+				new Point(position.getX() + 1, position.getY() + 2, position.getZ() + size.getZ() / 2 - 2),
+				size.getZ() / 2 - 2,
+				Row.Direction.SOUTH,
+				pattern));
+		
+		pattern = createTorchPattern(numberOfTorches, 2);
+		primitives.add(new Row(
+				new Point(position.getX() + size.getX() - 2, position.getY() + 2, position.getZ() + size.getZ() / 2 + 2),
+				size.getZ() / 2 - 2,
+				Row.Direction.NORTH,
+				pattern));
+		
+		primitives.add(new Row(
+				new Point(position.getX() + size.getX() - 2, position.getY() + 2, position.getZ() + size.getZ() / 2 - 2),
+				size.getZ() / 2 - 2,
+				Row.Direction.SOUTH,
+				pattern));
+		
+	}
+	
+	private BasicBlock[] createTorchPattern(int number, int data) {
+		BasicBlock[] pattern = null;
+		BasicBlock torch = new BasicBlock((short) 50, data);
+		BasicBlock space = BasicBlock.NonBlock;
+		
+		switch(number) {
+			case 0:
+				pattern = new BasicBlock[] { space };
+				break;
+			case 1:
+				pattern = new BasicBlock[] { torch, space, space, space, space };
+				break;
+			case 2:
+				pattern = new BasicBlock[] { torch, space, space, space };
+				break;
+			case 3:
+				pattern = new BasicBlock[] { torch, space, space };
+				break;
+			case 4:
+				pattern = new BasicBlock[] { torch, space };
+				break;
+			case 5:
+				pattern = new BasicBlock[] { torch };
+				break;
+		}
+		return pattern;
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Garden.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Garden.html new file mode 100644 index 00000000..b13d7ed9 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Garden.html @@ -0,0 +1 @@ +Garden

Garden

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total804 of 8040%8 of 80%8810010044
prepareDoor()4220%n/a11545411
prepareBase()2470%60%44343411
prepareSigns()1130%n/a115511
Garden(Buildable)220%20%227711
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Garden.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Garden.java.html new file mode 100644 index 00000000..a1cdefb0 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Garden.java.html @@ -0,0 +1,149 @@ +Garden.java

Garden.java

package codemetropolis.toolchain.rendering.model.building;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.commons.cmxml.Buildable.Type;
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.exceptions.BuildingTypeMismatchException;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+import codemetropolis.toolchain.rendering.model.pattern.RandomPattern;
+import codemetropolis.toolchain.rendering.model.pattern.RepeationPattern;
+import codemetropolis.toolchain.rendering.model.pattern.YSplitPattern;
+import codemetropolis.toolchain.rendering.model.primitive.SignPost;
+import codemetropolis.toolchain.rendering.model.primitive.SolidBox;
+import codemetropolis.toolchain.rendering.util.Orientation;
+
+public class Garden extends Building {
+
+	public Garden(Buildable innerBuildable) throws BuildingTypeMismatchException {
+		super(innerBuildable);
+		
+		if ( innerBuildable.getType() != Type.GARDEN )
+			throw new BuildingTypeMismatchException(innerBuildable.getType(), getClass());
+
+		prepareBase();
+		prepareDoor();
+		prepareSigns();
+	}
+	
+	private void prepareBase( ) {
+		BasicBlock _fnc = new BasicBlock( "minecraft:fence" );
+		BasicBlock _sns = new BasicBlock( "minecraft:sandstone" );
+		RandomPattern _flowers = new RandomPattern( new RepeationPattern(  new BasicBlock[][][]{ { { BasicBlock.NonBlock } } } ) );
+		
+		RandomPattern _redOrYellow = new RandomPattern( new RepeationPattern(  new BasicBlock[][][]{ { { new BasicBlock( "minecraft:yellow_flower" ) } } } ) );
+		_redOrYellow.add(new RepeationPattern(  new BasicBlock[][][]{ { { new BasicBlock( "minecraft:red_flower" ) } } } ), 0.5);
+		_flowers.add(
+			_redOrYellow,
+			innerBuildable.hasAttribute( "flower-ratio" )
+				? Double.parseDouble( innerBuildable.getAttributeValue("flower-ratio") )
+				: 0 );
+		_flowers.add(
+			new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:brown_mushroom" ) } } } ),
+			innerBuildable.hasAttribute( "mushroom-ratio" )
+				? Double.parseDouble( innerBuildable.getAttributeValue("mushroom-ratio") )
+				: 0 );
+		_flowers.add(
+			new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:sapling" ) } } } ),
+			innerBuildable.hasAttribute( "tree-ratio" )
+				? Double.parseDouble( innerBuildable.getAttributeValue("tree-ratio") )
+				: 0 );
+		primitives.add(
+			new SolidBox(
+				position, new Point( size.getX(), 2, size.getZ() ),
+				new YSplitPattern(
+					0,
+					new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:grass" ) } } } ),
+					_flowers ),
+				new RepeationPattern(
+					new BasicBlock[][][]
+					{
+						{
+							{ _fnc },
+							{ _sns }
+						}
+					} ),
+				Orientation.NearX ) );
+	}
+	
+	protected void prepareDoor( )
+	{
+		BasicBlock _fnc = new BasicBlock( "minecraft:fence" );
+		BasicBlock _rwl = new BasicBlock( "minecraft:wool", 14 );
+		BasicBlock _gwl = new BasicBlock( "minecraft:wool", 5 );
+		BasicBlock _bwl = new BasicBlock( "minecraft:wool", 3 );
+		BasicBlock _ywl = new BasicBlock( "minecraft:wool", 4 );
+		primitives.add(
+			new SolidBox(
+				position.translate( new Point( center.getX() - 1, 0, 0 ) ), new Point( 3, 4, 1 ),
+				new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air", 2 ) } } } ),
+				new RepeationPattern(
+					new BasicBlock[][][]
+					{
+						{
+							{ _fnc },
+							{ _fnc },
+							{ _fnc },
+							{ _rwl }
+						}
+					} ),
+				Orientation.NearX )
+			);
+		primitives.add(
+			new SolidBox(
+				position.translate( new Point( center.getX() - 1, 0, size.getZ() - 1 ) ), new Point( 3, 4, 1 ),
+				new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air", 2 ) } } } ),
+				new RepeationPattern(
+					new BasicBlock[][][]
+					{
+						{
+							{ _fnc },
+							{ _fnc },
+							{ _fnc },
+							{ _gwl }
+						}
+					} ),
+				Orientation.NearX )
+			);
+		primitives.add(
+			new SolidBox(
+				position.translate( new Point( 0, 0, center.getZ()-1 ) ), new Point( 1, 4, 3 ),
+				new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air", 2 ) } } } ),
+				new RepeationPattern(
+					new BasicBlock[][][]
+					{
+						{
+							{ _fnc },
+							{ _fnc },
+							{ _fnc },
+							{ _bwl }
+						}
+					} ),
+				Orientation.NearX )
+			);
+		primitives.add(
+			new SolidBox(
+				position.translate( new Point( size.getX()-1, 0, center.getZ() - 1 ) ), new Point( 1, 4, 3 ),
+				new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air", 2 ) } } } ),
+				new RepeationPattern(
+					new BasicBlock[][][]
+					{
+						{
+							{ _fnc },
+							{ _fnc },
+							{ _fnc },
+							{ _ywl }
+						}
+					} ),
+				Orientation.NearX )
+			);
+	}
+	
+	private void prepareSigns( ) {
+		primitives.add(new SignPost(position.getX(), position.getY() + 2, position.getZ(), SignPost.Orientation.NORTHWEST, innerBuildable.getName()));
+		primitives.add(new SignPost(position.getX() + size.getX() - 1, position.getY() + 2, position.getZ(), SignPost.Orientation.NORTHEAST, innerBuildable.getName()));
+		primitives.add(new SignPost(position.getX(), position.getY() + 2, position.getZ() + size.getZ() - 1, SignPost.Orientation.SOUTHWEST, innerBuildable.getName()));
+		primitives.add(new SignPost(position.getX() + size.getX() - 1, position.getY() + 2, position.getZ() + size.getZ() - 1, SignPost.Orientation.SOUTHEAST, innerBuildable.getName()));
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Ground.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Ground.html new file mode 100644 index 00000000..31c52879 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Ground.html @@ -0,0 +1 @@ +Ground

Ground

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total198 of 1980%2 of 20%44191933
prepareSigns()1130%n/a115511
prepareBase()650%n/a118811
Ground(Buildable)200%20%226611
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Ground.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Ground.java.html new file mode 100644 index 00000000..8a6f3e76 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/Ground.java.html @@ -0,0 +1,43 @@ +Ground.java

Ground.java

package codemetropolis.toolchain.rendering.model.building;
+
+import codemetropolis.toolchain.commons.cmxml.Buildable;
+import codemetropolis.toolchain.commons.cmxml.Buildable.Type;
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.exceptions.BuildingTypeMismatchException;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+import codemetropolis.toolchain.rendering.model.pattern.RepeationPattern;
+import codemetropolis.toolchain.rendering.model.primitive.SignPost;
+import codemetropolis.toolchain.rendering.model.primitive.SolidBox;
+import codemetropolis.toolchain.rendering.util.Orientation;
+
+public class Ground extends Building {
+
+	public Ground(Buildable innerBuildable) throws BuildingTypeMismatchException {
+		super(innerBuildable);
+
+		if ( innerBuildable.getType() != Type.GROUND )
+			throw new BuildingTypeMismatchException(innerBuildable.getType(), getClass());
+
+		prepareBase();
+		prepareSigns();
+	}
+	
+	private void prepareBase( ) {
+		primitives.add(
+			new SolidBox(
+				position,
+				new Point( size.getX(), 1, size.getZ() ),
+				new RepeationPattern( new BasicBlock[][][]{ { { new BasicBlock( "minecraft:stone" ) } } } ),
+				new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:stonebrick" ) } } } ),
+				Orientation.NearX ) );
+	}
+	
+	private void prepareSigns( ) {
+		primitives.add(new SignPost(position.getX(), position.getY() + 1, position.getZ(), SignPost.Orientation.NORTHWEST, innerBuildable.getName()));
+		primitives.add(new SignPost(position.getX() + size.getX() - 1, position.getY() + 1, position.getZ(), SignPost.Orientation.NORTHEAST, innerBuildable.getName()));
+		primitives.add(new SignPost(position.getX(), position.getY() + 1, position.getZ() + size.getZ() - 1, SignPost.Orientation.SOUTHWEST, innerBuildable.getName()));
+		primitives.add(new SignPost(position.getX() + size.getX() - 1, position.getY() + 1, position.getZ() + size.getZ() - 1, SignPost.Orientation.SOUTHEAST, innerBuildable.getName()));
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/index.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/index.html new file mode 100644 index 00000000..e4355cf8 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.model.building

codemetropolis.toolchain.rendering.model.building

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total4,124 of 4,1240%39 of 390%4545413413232355
Floor2,8170%190%19192422427711
Garden8040%80%881001004411
Ground1980%20%4419193311
Cellar1650%20%2219191111
Building1400%80%121233338811
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/index.source.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/index.source.html new file mode 100644 index 00000000..f201c61d --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.building/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.model.building

codemetropolis.toolchain.rendering.model.building

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total4,124 of 4,1240%39 of 390%4545413413232355
Floor.java2,8170%190%19192422427711
Garden.java8040%80%881001004411
Ground.java1980%20%4419193311
Cellar.java1650%20%2219191111
Building.java1400%80%121233338811
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RandomPattern.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RandomPattern.html new file mode 100644 index 00000000..497d68aa --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RandomPattern.html @@ -0,0 +1 @@ +RandomPattern

RandomPattern

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total65 of 650%4 of 40%66131344
applyTo(Point, PositionModification)410%40%336611
RandomPattern(Pattern)110%n/a114411
add(Pattern, double)80%n/a112211
static {...}50%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RandomPattern.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RandomPattern.java.html new file mode 100644 index 00000000..5b6f9bfc --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RandomPattern.java.html @@ -0,0 +1,44 @@ +RandomPattern.java

RandomPattern.java

package codemetropolis.toolchain.rendering.model.pattern;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public class RandomPattern implements Pattern {
+	
+	private static Random random = new Random();
+	private Map<Pattern, Double> subPatterns = new HashMap<Pattern, Double>();
+	Pattern fallbackPattern;
+	
+	public void add(Pattern pattern, double probability) {
+		subPatterns.put(pattern, probability);
+	}
+
+	public RandomPattern( Pattern fallbackPattern ) {
+		this.fallbackPattern = fallbackPattern;
+	}
+
+	@Override
+	public BasicBlock applyTo(Point position, PositionModification positionModification) {
+		List<Pattern> mixedPatterns = new ArrayList<Pattern>(subPatterns.keySet());
+		Collections.shuffle(mixedPatterns);
+		
+		for( Pattern subPattern : mixedPatterns )
+		{
+			if ( random.nextDouble() < subPatterns.get(subPattern) )
+			{
+				return subPattern.applyTo( position, positionModification );
+			}
+		}
+		
+		return fallbackPattern.applyTo( position, positionModification );
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RepeationPattern.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RepeationPattern.html new file mode 100644 index 00000000..c3b5639b --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RepeationPattern.html @@ -0,0 +1 @@ +RepeationPattern

RepeationPattern

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total66 of 660%0 of 0n/a22121222
applyTo(Point, PositionModification)600%n/a119911
RepeationPattern(BasicBlock[][][])60%n/a113311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RepeationPattern.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RepeationPattern.java.html new file mode 100644 index 00000000..011a9583 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/RepeationPattern.java.html @@ -0,0 +1,30 @@ +RepeationPattern.java

RepeationPattern.java

package codemetropolis.toolchain.rendering.model.pattern;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public class RepeationPattern implements Pattern {
+
+	BasicBlock[][][] pattern;
+	
+	public RepeationPattern(BasicBlock[][][] pattern) {
+		super();
+		this.pattern = pattern;
+	}
+
+	@Override
+	public BasicBlock applyTo(Point position, PositionModification positionModification) {
+		Point size = new Point(
+				pattern.length,
+				pattern[0].length,
+				pattern[0][0].length
+				);
+		Point modifiedPosition = positionModification.apply(position, size);
+		return pattern
+				[size.getX() - 1 - modifiedPosition.getX() % size.getX()]
+				[size.getY() - 1 - modifiedPosition.getY() % size.getY()]
+				[size.getZ() - 1 - modifiedPosition.getZ() % size.getZ()];
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/SplitPattern.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/SplitPattern.html new file mode 100644 index 00000000..abacdca6 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/SplitPattern.html @@ -0,0 +1 @@ +SplitPattern

SplitPattern

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total21 of 210%0 of 0n/a448844
SplitPattern(int, Pattern, Pattern)120%n/a115511
getLimit()30%n/a111111
getNearPatter()30%n/a111111
getFarPattern()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/SplitPattern.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/SplitPattern.java.html new file mode 100644 index 00000000..db35a85a --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/SplitPattern.java.html @@ -0,0 +1,35 @@ +SplitPattern.java

SplitPattern.java

package codemetropolis.toolchain.rendering.model.pattern;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public abstract class SplitPattern implements Pattern {
+
+	protected int limit;
+	protected Pattern nearPattern;
+	protected Pattern farPattern;
+	
+	public SplitPattern(int limit, Pattern nearPattern, Pattern farPattern) {
+		super();
+		this.limit = limit;
+		this.nearPattern = nearPattern;
+		this.farPattern = farPattern;
+	}
+
+	@Override
+	public abstract BasicBlock applyTo(Point position, PositionModification positionModification);
+
+	public int getLimit() {
+		return limit;
+	}
+
+	public Pattern getNearPatter() {
+		return nearPattern;
+	}
+
+	public Pattern getFarPattern() {
+		return farPattern;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/XSplitPattern.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/XSplitPattern.html new file mode 100644 index 00000000..54baaa4e --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/XSplitPattern.html @@ -0,0 +1 @@ +XSplitPattern

XSplitPattern

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%2 of 20%335522
applyTo(Point, PositionModification)170%20%223311
XSplitPattern(int, Pattern, Pattern)60%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/XSplitPattern.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/XSplitPattern.java.html new file mode 100644 index 00000000..e3d384ca --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/XSplitPattern.java.html @@ -0,0 +1,22 @@ +XSplitPattern.java

XSplitPattern.java

package codemetropolis.toolchain.rendering.model.pattern;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public class XSplitPattern extends SplitPattern {
+
+	public XSplitPattern(int limit, Pattern nearPatter, Pattern farPattern) {
+		super(limit, nearPatter, farPattern);
+	}
+
+	@Override
+	public BasicBlock applyTo(Point position, PositionModification positionModification) {
+		if ( position.getX() > limit ) {
+			return farPattern.applyTo( position, positionModification );
+		} else {
+			return nearPattern.applyTo( position, positionModification );
+		}
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/YSplitPattern.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/YSplitPattern.html new file mode 100644 index 00000000..3c379441 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/YSplitPattern.html @@ -0,0 +1 @@ +YSplitPattern

YSplitPattern

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%2 of 20%335522
applyTo(Point, PositionModification)170%20%223311
YSplitPattern(int, Pattern, Pattern)60%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/YSplitPattern.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/YSplitPattern.java.html new file mode 100644 index 00000000..e98d00aa --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/YSplitPattern.java.html @@ -0,0 +1,22 @@ +YSplitPattern.java

YSplitPattern.java

package codemetropolis.toolchain.rendering.model.pattern;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public class YSplitPattern extends SplitPattern {
+
+	public YSplitPattern(int limit, Pattern nearPatter, Pattern farPattern) {
+		super(limit, nearPatter, farPattern);
+	}
+
+	@Override
+	public BasicBlock applyTo(Point position, PositionModification positionModification) {
+		if ( position.getY() > limit ) {
+			return farPattern.applyTo( position, positionModification );
+		} else {
+			return nearPattern.applyTo( position, positionModification );
+		}
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/ZSplitPattern.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/ZSplitPattern.html new file mode 100644 index 00000000..d1b9caf8 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/ZSplitPattern.html @@ -0,0 +1 @@ +ZSplitPattern

ZSplitPattern

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total23 of 230%2 of 20%335522
applyTo(Point, PositionModification)170%20%223311
ZSplitPattern(int, Pattern, Pattern)60%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/ZSplitPattern.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/ZSplitPattern.java.html new file mode 100644 index 00000000..4c93a682 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/ZSplitPattern.java.html @@ -0,0 +1,22 @@ +ZSplitPattern.java

ZSplitPattern.java

package codemetropolis.toolchain.rendering.model.pattern;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public class ZSplitPattern extends SplitPattern {
+
+	public ZSplitPattern(int limit, Pattern nearPatter, Pattern farPattern) {
+		super(limit, nearPatter, farPattern);
+	}
+
+	@Override
+	public BasicBlock applyTo(Point position, PositionModification positionModification) {
+		if ( position.getZ() > limit ) {
+			return farPattern.applyTo( position, positionModification );
+		} else {
+			return nearPattern.applyTo( position, positionModification );
+		}
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/index.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/index.html new file mode 100644 index 00000000..53f236f1 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.model.pattern

codemetropolis.toolchain.rendering.model.pattern

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total221 of 2210%10 of 100%21214848161666
RepeationPattern660%n/a2212122211
RandomPattern650%40%6613134411
YSplitPattern230%20%33552211
ZSplitPattern230%20%33552211
XSplitPattern230%20%33552211
SplitPattern210%n/a44884411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/index.source.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/index.source.html new file mode 100644 index 00000000..470a363f --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.pattern/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.model.pattern

codemetropolis.toolchain.rendering.model.pattern

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total221 of 2210%10 of 100%21214848161666
RepeationPattern.java660%n/a2212122211
RandomPattern.java650%40%6613134411
XSplitPattern.java230%20%33552211
ZSplitPattern.java230%20%33552211
YSplitPattern.java230%20%33552211
SplitPattern.java210%n/a44884411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner$Orientation.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner$Orientation.html new file mode 100644 index 00000000..4984c0ce --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner$Orientation.html @@ -0,0 +1 @@ +Banner.Orientation

Banner.Orientation

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total124 of 1240%0 of 0n/a55141455
static {...}920%n/a119911
values()160%n/a111111
Banner.Orientation(String, int, int)80%n/a113311
valueOf(String)50%n/a111111
getValue()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner.html new file mode 100644 index 00000000..6535c82e --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner.html @@ -0,0 +1 @@ +Banner

Banner

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total38 of 380%0 of 0n/a338833
toCSVFile(File)190%n/a112211
Banner(int, int, int, Banner.Orientation, String)170%n/a115511
getNumberOfBlocks()20%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner.java.html new file mode 100644 index 00000000..efcfc9fa --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Banner.java.html @@ -0,0 +1,53 @@ +Banner.java

Banner.java

package codemetropolis.toolchain.rendering.model.primitive;
+
+import java.io.File;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public class Banner implements Primitive {
+	
+	public enum Orientation {
+		SOUTH(0),
+		SOUTHWEST(2),
+		WEST(4),
+		NORTHWEST(6),
+		NORTH(8),
+		NORTHEAST(10),
+		EAST(12),
+		SOUTHEAST(14);
+		
+		private final int value;
+		
+		Orientation(int v) {
+			value = v;
+		}
+		
+		public int getValue() {
+			return value;
+		}
+	}
+	
+	private Point position;
+	private Orientation orientation;
+	private String color;
+
+	public Banner(int x, int y, int z, Orientation orientation, String color) {
+		super();
+		this.position = new Point(x, y, z);
+		this.orientation = orientation;
+		this.color = color;
+	}
+	
+	@Override
+	public int toCSVFile(File directory) {
+		new Boxel(new BasicBlock((short) 176, orientation.getValue()), position, color).toCSVFile(directory);
+		return 1;
+	}
+	@Override
+	public int getNumberOfBlocks() {
+		return 1;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Boxel.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Boxel.html new file mode 100644 index 00000000..b12c806f --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Boxel.html @@ -0,0 +1 @@ +Boxel

Boxel

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total306 of 3060%26 of 260%2121434377
toCSVFile(File)950%100%66131311
render(World)850%80%66101011
toCSV()620%60%442211
parseCSV(String)450%20%22101011
Boxel(BasicBlock, Point)90%n/a114411
Boxel(BasicBlock, Point, String)80%n/a113311
getNumberOfBlocks()20%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Boxel.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Boxel.java.html new file mode 100644 index 00000000..e8272fee --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Boxel.java.html @@ -0,0 +1,95 @@ +Boxel.java

Boxel.java

package codemetropolis.toolchain.rendering.model.primitive;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import codemetropolis.blockmodifier.World;
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public class Boxel implements Primitive {
+	
+	public BasicBlock block;
+	public Point position;
+	public String info;
+	
+	public Boxel(BasicBlock block, Point position) {
+		super();
+		this.block = block;
+		this.position = position;
+	}
+	
+	public Boxel(BasicBlock block, Point position, String info) {
+		this(block, position);
+		this.info = info;
+	}
+	
+	public void render(World world) {
+		if(position.getY() < 0 || position.getY() >= 255) return;
+		
+		switch(block.getId()) {
+			case 63:
+				world.setSignPost(position.getX(), position.getY(), position.getZ(), block.getData(), info);
+				break;
+			case 68:
+				world.setWallSign(position.getX(), position.getY(), position.getZ(), block.getData(), info);
+				break;
+			case 176:
+				world.setBanner(position.getX(), position.getY(), position.getZ(), block.getData(), World.BannerColor.valueOf(info.toUpperCase()));
+				break;
+			default:
+				world.setBlock(position.getX(), position.getY(), position.getZ(), block.getId(), block.getData());	
+		}
+	}
+	
+	public String toCSV() {
+		//if(block == BasicBlock.NonBlock) return null;
+		if(block.getId() == -1) return null;
+		return String.format("%d;%d;%d;%d;%d;%s", block.getId(), block.getData(), position.getX(), position.getY(), position.getZ(), (info == null || info.equals("") ? "NULL" : info));
+	}
+	
+	public static Boxel parseCSV(String csv) {
+		String[] parts = csv.split(";");
+		return new Boxel(
+			new BasicBlock(
+				Short.parseShort(parts[0]),
+				Integer.parseInt(parts[1])),
+			new Point(
+				Integer.parseInt(parts[2]),
+				Integer.parseInt(parts[3]),
+				Integer.parseInt(parts[4])),
+			(parts[5].equals("NULL") ? "" : parts[5])
+		);
+	}
+	
+	@Override
+	public int toCSVFile(File directory) {
+		int x = position.getX() >> 9;
+		int z = position.getZ() >> 9;
+		
+		directory.mkdirs();
+		String filename = String.format("blocks.%d.%d.csv", x, z);
+		File file = new File(directory, filename);
+		
+		try(PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(file, true)))) {	
+			String csv = toCSV();
+			if(csv != null) writer.println(csv);
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		} catch (IOException e1) {
+			e1.printStackTrace();
+		}
+		return 1;
+	}
+
+	@Override
+	public int getNumberOfBlocks() {
+		return 1;
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door$Orientation.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door$Orientation.html new file mode 100644 index 00000000..fde311ce --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door$Orientation.html @@ -0,0 +1 @@ +Door.Orientation

Door.Orientation

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total80 of 800%0 of 0n/a55101055
static {...}480%n/a115511
values()160%n/a111111
Door.Orientation(String, int, int)80%n/a113311
valueOf(String)50%n/a111111
getValue()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door.html new file mode 100644 index 00000000..2156d101 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door.html @@ -0,0 +1 @@ +Door

Door

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total58 of 580%0 of 0n/a338833
toCSVFile(File)420%n/a113311
Door(int, int, int, Door.Orientation)140%n/a114411
getNumberOfBlocks()20%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door.java.html new file mode 100644 index 00000000..a5761d7f --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Door.java.html @@ -0,0 +1,48 @@ +Door.java

Door.java

package codemetropolis.toolchain.rendering.model.primitive;
+
+import java.io.File;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public class Door implements Primitive {
+	
+	public enum Orientation {
+		NORTH(1),
+		SOUTH(3),
+		WEST(0),
+		EAST(2);
+		
+		private final int value;
+		
+		Orientation(int v) {
+			value = v;
+		}
+		
+		public int getValue() {
+			return value;
+		}
+	}
+	
+	private Point position;
+	private Orientation orientation;
+
+	public Door(int x, int y, int z, Orientation orientation) {
+		super();
+		this.position = new Point(x, y, z);
+		this.orientation = orientation;
+	}
+	
+	@Override
+	public int toCSVFile(File directory) {
+		new Boxel(new BasicBlock((short) 64, orientation.getValue()), position).toCSVFile(directory);
+		new Boxel(new BasicBlock((short) 64, 8), new Point(position.getX(), position.getY() + 1, position.getZ())).toCSVFile(directory);
+		return 2;
+	}
+	@Override
+	public int getNumberOfBlocks() {
+		return 2;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/EmptyBox.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/EmptyBox.html new file mode 100644 index 00000000..5f72ab06 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/EmptyBox.html @@ -0,0 +1 @@ +EmptyBox

EmptyBox

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total258 of 2580%4 of 40%99616177
EmptyBox(Point, Point, Pattern, Pattern, Pattern, Pattern, Point, Point)2030%n/a11494911
toCSVFile(File)220%20%224411
getNumberOfBlocks()210%20%224411
getNearSideWitdth()30%n/a111111
getFarSideWitdth()30%n/a111111
getBasePoint()30%n/a111111
getSize()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/EmptyBox.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/EmptyBox.java.html new file mode 100644 index 00000000..1476c312 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/EmptyBox.java.html @@ -0,0 +1,107 @@ +EmptyBox.java

EmptyBox.java

package codemetropolis.toolchain.rendering.model.primitive;
+
+import java.io.File;
+import java.util.LinkedList;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.pattern.Pattern;
+import codemetropolis.toolchain.rendering.util.Orientation;
+
+public class EmptyBox implements Primitive {
+
+	private LinkedList<SolidBox> sides = new LinkedList<SolidBox>( );
+
+	private Point nearSideWitdth;
+	private Point farSideWitdth;
+	private Point basePoint;
+	private Point size;
+	
+	public EmptyBox(Point basePoint, Point size, Pattern bottomFill, Pattern topFill, Pattern sideFill, Pattern stroke, Point nearSideWitdth, Point farSideWitdth ) {
+		super();
+		this.nearSideWitdth = nearSideWitdth;
+		this.farSideWitdth = farSideWitdth;
+		this.basePoint = basePoint;
+		this.size = size;
+		
+		sides.add(
+				new SolidBox(
+					new Point( basePoint.getX(), basePoint.getY(), basePoint.getZ() ),
+					new Point( nearSideWitdth.getX(), size.getY(), size.getZ() ),
+					sideFill,
+					stroke,
+					Orientation.NearX )
+				);
+		sides.add(
+				new SolidBox(
+					new Point( basePoint.getX() + size.getX()-1, basePoint.getY(), basePoint.getZ() ),
+					new Point( farSideWitdth.getX(), size.getY(), size.getZ() ),
+					sideFill,
+					stroke,
+					Orientation.FarX )
+				);
+
+		sides.add(
+				new SolidBox(
+					new Point( basePoint.getX(), basePoint.getY(), basePoint.getZ() ),
+					new Point( size.getX(), size.getY(), nearSideWitdth.getZ() ),
+					sideFill,
+					stroke,
+					Orientation.NearZ )
+				);
+		sides.add(
+				new SolidBox(
+					new Point( basePoint.getX(), basePoint.getY(), basePoint.getZ() + size.getZ() - 1 ),
+					new Point( size.getX(), size.getY(), farSideWitdth.getZ() ),
+					sideFill,
+					stroke,
+					Orientation.FarZ )
+				);
+
+		sides.add(
+				new SolidBox(
+					new Point( basePoint.getX(), basePoint.getY(), basePoint.getZ() ),
+					new Point( size.getX(), nearSideWitdth.getY(), size.getZ() ),
+					bottomFill,
+					stroke,
+					Orientation.NearY )
+				);
+		sides.add(
+				new SolidBox(
+					new Point( basePoint.getX(), basePoint.getY() + size.getY() - 1, basePoint.getZ() ),
+					new Point( size.getX(), farSideWitdth.getY(), size.getZ() ),
+					topFill,
+					stroke,
+					Orientation.FarY )
+				);
+	}
+	
+	public int toCSVFile(File directory) {
+		int count = 0;
+		for(SolidBox s : sides) {
+			count += s.toCSVFile(directory);
+		}
+		return count;
+	}
+	
+	public Point getNearSideWitdth() {
+		return nearSideWitdth;
+	}
+	public Point getFarSideWitdth() {
+		return farSideWitdth;
+	}
+	public Point getBasePoint() {
+		return basePoint;
+	}
+	public Point getSize() {
+		return size;
+	}
+
+	public int getNumberOfBlocks() {
+		int result = 0;
+		for(SolidBox s : sides)
+			result += s.getNumberOfBlocks();
+		return result;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row$Direction.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row$Direction.html new file mode 100644 index 00000000..16a6b920 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row$Direction.html @@ -0,0 +1 @@ +Row.Direction

Row.Direction

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total90 of 900%0 of 0n/a448844
static {...}640%n/a117711
values()160%n/a111111
Row.Direction(String, int)50%n/a111111
valueOf(String)50%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row.html new file mode 100644 index 00000000..751eadff --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row.html @@ -0,0 +1 @@ +Row

Row

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total155 of 1550%11 of 110%1111252533
toCSVFile(File)1370%110%99181811
Row(Point, int, Row.Direction, BasicBlock[])150%n/a116611
getNumberOfBlocks()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row.java.html new file mode 100644 index 00000000..1f62bb35 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/Row.java.html @@ -0,0 +1,70 @@ +Row.java

Row.java

package codemetropolis.toolchain.rendering.model.primitive;
+
+import java.io.File;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public class Row implements Primitive {
+	
+	public enum Direction {
+		UP,
+		DOWN,
+		NORTH,
+		SOUTH,
+		WEST,
+		EAST;
+	}
+	
+	private Point position;
+	private int length;
+	private Direction orientation;
+	private BasicBlock[] pattern;
+	
+	public Row(Point position, int length, Direction orientation, BasicBlock[] pattern) {
+		super();
+		this.position = position;
+		this.length = length;
+		this.orientation = orientation;
+		this.pattern = pattern;
+	}
+	
+	@Override
+	public int toCSVFile(File directory) {
+		int c = 0;
+		for(int i = 0; i < length; i++) {
+			Point blockPos = null;
+			switch(orientation) {
+				case UP:
+					blockPos = new Point(position.getX(), position.getY() + i, position.getZ());
+					break;
+				case DOWN:
+					blockPos = new Point(position.getX(), position.getY() - i, position.getZ());
+					break;
+				case NORTH:
+					blockPos = new Point(position.getX(), position.getY(), position.getZ() + i);
+					break;
+				case SOUTH:
+					blockPos = new Point(position.getX(), position.getY(), position.getZ() - i);
+					break;
+				case WEST:
+					blockPos = new Point(position.getX() + i, position.getY(), position.getZ());
+					break;
+				case EAST:
+					blockPos = new Point(position.getX() - i, position.getY(), position.getZ());
+					break;
+			}
+			
+			new Boxel(pattern[c], blockPos).toCSVFile(directory);
+			if(++c > pattern.length - 1) c = 0;
+		}
+		return length;
+	}
+	
+	@Override
+	public int getNumberOfBlocks() {
+		return length;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost$Orientation.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost$Orientation.html new file mode 100644 index 00000000..d9c0e84b --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost$Orientation.html @@ -0,0 +1 @@ +SignPost.Orientation

SignPost.Orientation

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total124 of 1240%0 of 0n/a55141455
static {...}920%n/a119911
values()160%n/a111111
SignPost.Orientation(String, int, int)80%n/a113311
valueOf(String)50%n/a111111
getValue()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost.html new file mode 100644 index 00000000..cd71314f --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost.html @@ -0,0 +1 @@ +SignPost

SignPost

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total38 of 380%0 of 0n/a338833
toCSVFile(File)190%n/a112211
SignPost(int, int, int, SignPost.Orientation, String)170%n/a115511
getNumberOfBlocks()20%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost.java.html new file mode 100644 index 00000000..f29221af --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SignPost.java.html @@ -0,0 +1,53 @@ +SignPost.java

SignPost.java

package codemetropolis.toolchain.rendering.model.primitive;
+
+import java.io.File;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public class SignPost implements Primitive {
+	
+	public enum Orientation {
+		SOUTH(0),
+		SOUTHWEST(2),
+		WEST(4),
+		NORTHWEST(6),
+		NORTH(8),
+		NORTHEAST(10),
+		EAST(12),
+		SOUTHEAST(14);
+		
+		private final int value;
+		
+		Orientation(int v) {
+			value = v;
+		}
+		
+		public int getValue() {
+			return value;
+		}
+	}
+	
+	private Point position;
+	private Orientation orientation;
+	private String text;
+
+	public SignPost(int x, int y, int z, Orientation orientation, String text) {
+		super();
+		this.position = new Point(x, y, z);
+		this.orientation = orientation;
+		this.text = text;
+	}
+	
+	@Override
+	public int toCSVFile(File directory) {
+		new Boxel(new BasicBlock((short) 63, orientation.getValue()), position, text).toCSVFile(directory);
+		return 1;
+	}
+	@Override
+	public int getNumberOfBlocks() {
+		return 1;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SolidBox.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SolidBox.html new file mode 100644 index 00000000..0f8a37e3 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SolidBox.html @@ -0,0 +1 @@ +SolidBox

SolidBox

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total280 of 2800%37 of 370%2828333377
toCSVFile(File)1610%300%1616161611
flipPattern(Point, Point)840%70%778811
SolidBox(Point, Point, Pattern, Pattern, Orientation)140%n/a115511
getNumberOfBlocks()120%n/a111111
getBasePoint()30%n/a111111
getSize()30%n/a111111
getOrientation()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SolidBox.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SolidBox.java.html new file mode 100644 index 00000000..cdfb88bf --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/SolidBox.java.html @@ -0,0 +1,84 @@ +SolidBox.java

SolidBox.java

package codemetropolis.toolchain.rendering.model.primitive;
+
+import java.io.File;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+import codemetropolis.toolchain.rendering.model.Paintable;
+import codemetropolis.toolchain.rendering.model.pattern.Pattern;
+import codemetropolis.toolchain.rendering.util.Orientation;
+
+public class SolidBox extends Paintable implements Primitive {
+
+	public Point basePoint;
+	public Point size;
+	public Orientation orientation;
+	
+	public SolidBox(Point basePoint, Point size, Pattern fill, Pattern stroke, Orientation orientation) {
+		super(fill, stroke);
+		this.basePoint = basePoint;
+		this.size = size;
+		this.orientation = orientation;
+	}
+	
+	private Point flipPattern(Point original, Point size) {
+		switch ( orientation ) {
+			case NearX:
+				return original;
+			case NearY:
+				return new Point( original.getY(), original.getX(), original.getZ() );
+			case NearZ:
+				return new Point( original.getZ(), original.getY(), original.getX() );
+			case FarX:
+				return new Point( ( size.getX() - 1 ) - ( original.getX() % size.getX() ), original.getY(), original.getZ() );
+			case FarY:
+				return new Point( ( size.getY() - 1 ) - ( original.getY() % size.getY() ), original.getX(), original.getZ() );
+			case FarZ:
+				return new Point( ( size.getZ() - 1 ) - ( original.getZ() % size.getZ() ), original.getY(), original.getX() );
+			default:
+				return null;
+		}
+	}
+	
+	public int toCSVFile(File directory) {
+		for ( int x = 0; x < size.getX(); x++ ) {
+			for ( int y = 0; y < size.getY(); y++ ) {
+				for ( int z = 0; z < size.getZ(); z++ ) {
+					if ( (( x == 0 || x == size.getX() - 1 ) && ( y == 0 || y == size.getY() - 1 )) ||
+					     (( x == 0 || x == size.getX() - 1 ) && ( z == 0 || z == size.getZ() - 1 )) ||
+					     (( y == 0 || y == size.getY() - 1 ) && ( z == 0 || z == size.getZ() - 1 )) )
+					{
+						new Boxel(
+							new BasicBlock( stroke.applyTo( new Point( x, y, z ), this::flipPattern ) ),
+							new Point( basePoint.getX() + x, basePoint.getY() + y, basePoint.getZ() + z ))
+						.toCSVFile(directory);
+					} else {
+						new Boxel(
+							new BasicBlock( fill.applyTo( new Point( x, y, z ), this::flipPattern ) ),
+							new Point( basePoint.getX() + x, basePoint.getY() + y, basePoint.getZ() + z ))
+						.toCSVFile(directory);
+					}
+				}
+			}
+		}
+		return getNumberOfBlocks();
+	}
+
+	public Point getBasePoint() {
+		return basePoint;
+	}
+
+	public Point getSize() {
+		return size;
+	}
+
+	public Orientation getOrientation() {
+		return orientation;
+	}
+
+	public int getNumberOfBlocks() {
+		return size.getX() * size.getY() * size.getZ();
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign$Orientation.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign$Orientation.html new file mode 100644 index 00000000..e297b45c --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign$Orientation.html @@ -0,0 +1 @@ +WallSign.Orientation

WallSign.Orientation

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total80 of 800%0 of 0n/a55101055
static {...}480%n/a115511
values()160%n/a111111
WallSign.Orientation(String, int, int)80%n/a113311
valueOf(String)50%n/a111111
getValue()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign.html new file mode 100644 index 00000000..95915e2a --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign.html @@ -0,0 +1 @@ +WallSign

WallSign

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total44 of 440%0 of 0n/a44101044
toCSVFile(File)190%n/a112211
WallSign(Point, WallSign.Orientation, String)120%n/a115511
WallSign(int, int, int, WallSign.Orientation, String)110%n/a112211
getNumberOfBlocks()20%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign.java.html new file mode 100644 index 00000000..5ed69cad --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/WallSign.java.html @@ -0,0 +1,53 @@ +WallSign.java

WallSign.java

package codemetropolis.toolchain.rendering.model.primitive;
+
+import java.io.File;
+
+import codemetropolis.toolchain.commons.cmxml.Point;
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public class WallSign implements Primitive {
+	
+	public enum Orientation {
+		NORTH(2),
+		SOUTH(3),
+		WEST(4),
+		EAST(5);
+		
+		private final int value;
+		
+		Orientation(int v) {
+			value = v;
+		}
+		
+		public int getValue() {
+			return value;
+		}
+	}
+	
+	private Point position;
+	private Orientation orientation;
+	private String text;
+
+	public WallSign(int x, int y, int z, Orientation orientation, String text) {
+		this(new Point(x,y,z), orientation, text);
+	}
+	
+	public WallSign(Point position, Orientation orientation, String text) {
+		super();
+		this.position = position;
+		this.orientation = orientation;
+		this.text = text;
+	}
+	
+	@Override
+	public int toCSVFile(File directory) {
+		new Boxel(new BasicBlock((short) 68, orientation.getValue()), position, text).toCSVFile(directory);
+		return 1;
+	}
+	@Override
+	public int getNumberOfBlocks() {
+		return 1;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/index.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/index.html new file mode 100644 index 00000000..35332dc3 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.model.primitive

codemetropolis.toolchain.rendering.model.primitive

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,769 of 1,7690%78 of 780%10810825225263631515
Boxel3060%260%212143437711
SolidBox2800%370%282833337711
EmptyBox2580%40%9961617711
Row1550%110%111125253311
SignPost.Orientation1240%n/a5514145511
Banner.Orientation1240%n/a5514145511
Row.Direction900%n/a44884411
WallSign.Orientation800%n/a5510105511
Door.Orientation800%n/a5510105511
Door580%n/a33883311
WallSign440%n/a4410104411
Banner380%n/a33883311
SignPost380%n/a33883311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/index.source.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/index.source.html new file mode 100644 index 00000000..b745bc48 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model.primitive/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.model.primitive

codemetropolis.toolchain.rendering.model.primitive

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1,769 of 1,7690%78 of 780%10810825225263631515
SolidBox.java3270%370%292933338822
Boxel.java3060%260%212143437711
Row.java2920%110%161633338833
EmptyBox.java2580%40%9961617711
SignPost.java1620%n/a8822228822
Banner.java1620%n/a8822228822
Door.java1380%n/a8818188822
WallSign.java1240%n/a9920209922
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/BasicBlock.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/BasicBlock.html new file mode 100644 index 00000000..b4c23527 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/BasicBlock.html @@ -0,0 +1 @@ +BasicBlock

BasicBlock

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total257 of 2570%22 of 220%242453531313
static {...}1220%100%66171711
equals(Object)350%100%66121211
hashCode()200%n/a115511
toString()170%20%221111
BasicBlock(BasicBlock)110%n/a114411
BasicBlock(short, int)90%n/a114411
BasicBlock(String)90%n/a112211
BasicBlock(String, int)90%n/a112211
getName()70%n/a111111
getHumanReadableName()70%n/a111111
BasicBlock(short)50%n/a112211
getId()30%n/a111111
getData()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/BasicBlock.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/BasicBlock.java.html new file mode 100644 index 00000000..10806270 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/BasicBlock.java.html @@ -0,0 +1,113 @@ +BasicBlock.java

BasicBlock.java

package codemetropolis.toolchain.rendering.model;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+import codemetropolis.toolchain.rendering.RenderingExecutor;
+
+public class BasicBlock {
+
+	public static final BasicBlock NonBlock;
+	public static final Map<Short, String> idToName;
+	public static final Map<Short, String> idToHumanReadableName;
+	public static final Map<String, Short> nameToId;
+	public static final Map<String, Short> humanReadableNameToId;
+	
+	static {
+		NonBlock = new BasicBlock((short)-1 );
+		idToName = new HashMap<Short,String>();
+		idToHumanReadableName = new HashMap<Short,String>();
+		nameToId = new HashMap<String,Short>();
+		humanReadableNameToId = new HashMap<String,Short>();
+		
+		InputStream csvStream = RenderingExecutor.class.getClassLoader().getResourceAsStream("blocks.csv");
+		try(BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(csvStream, "UTF-8"))) {
+			String line;
+			while ((line = bufferedReader.readLine()) != null) {
+				String[] blockInfo = line.split(",");
+				idToName.put(Short.parseShort(blockInfo[0]), blockInfo[1]);
+				idToHumanReadableName.put(Short.parseShort(blockInfo[0]), blockInfo[2]);
+				nameToId.put(blockInfo[1], Short.parseShort(blockInfo[0]));
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}	
+	}
+	
+	private short id;
+	private int data;
+	
+	public BasicBlock(short id) {
+		this(id, 0);
+	}
+
+	public BasicBlock(short id, int data) {
+		this.id = id;
+		this.data = data;
+	}
+	
+	public BasicBlock(String name) {
+		this(nameToId.get(name), 0);
+	}
+	
+	public BasicBlock(String name, int data) {
+		this(nameToId.get(name), data);
+	}
+	
+	public BasicBlock(BasicBlock original) {
+		this.id = original.id;
+		this.data = original.data;
+	}
+	
+	public String getName() {
+		return idToName.get(id);
+	}
+	
+	public String getHumanReadableName() {
+		return idToHumanReadableName.get(id);
+	}
+
+	public short getId() {
+		return id;
+	}
+
+	public int getData() {
+		return data;
+	}
+		
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + data;
+		result = prime * result + id;
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		BasicBlock other = (BasicBlock) obj;
+		if (data != other.data)
+			return false;
+		if (id != other.id)
+			return false;
+		return true;
+	}
+
+	@Override
+	public String toString() {
+		return getHumanReadableName() + (data != 0 ? data : "");
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/Paintable.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/Paintable.html new file mode 100644 index 00000000..637a6b17 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/Paintable.html @@ -0,0 +1 @@ +Paintable

Paintable

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total15 of 150%0 of 0n/a336633
Paintable(Pattern, Pattern)90%n/a114411
getFill()30%n/a111111
getStroke()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/Paintable.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/Paintable.java.html new file mode 100644 index 00000000..d97a679d --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/Paintable.java.html @@ -0,0 +1,24 @@ +Paintable.java

Paintable.java

package codemetropolis.toolchain.rendering.model;
+
+import codemetropolis.toolchain.rendering.model.pattern.Pattern;
+
+public class Paintable {
+
+	protected Pattern fill;
+	protected Pattern stroke;
+	
+	public Paintable(Pattern fill, Pattern stroke) {
+		this.fill = fill;
+		this.stroke = stroke;
+	}
+
+	public Pattern getFill() {
+		return fill;
+	}
+
+	public Pattern getStroke() {
+		return stroke;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/index.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/index.html new file mode 100644 index 00000000..08565e4a --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.model

codemetropolis.toolchain.rendering.model

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total272 of 2720%22 of 220%27275959161622
BasicBlock2570%220%24245353131311
Paintable150%n/a33663311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/index.source.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/index.source.html new file mode 100644 index 00000000..4f6d7e51 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.model/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.model

codemetropolis.toolchain.rendering.model

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total272 of 2720%22 of 220%27275959161622
BasicBlock.java2570%220%24245353131311
Paintable.java150%n/a33663311
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Character.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Character.html new file mode 100644 index 00000000..3a514761 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Character.html @@ -0,0 +1 @@ +Character

Character

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total386 of 3860%28 of 280%3131515177
static {...}2140%n/a11222211
getBlock()1200%220%2222232311
parse(String)250%40%333311
getTopBlock()130%20%223311
valueOf(String)50%n/a111111
Character(String, int)50%n/a111111
values()40%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Character.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Character.java.html new file mode 100644 index 00000000..9b854a58 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Character.java.html @@ -0,0 +1,75 @@ +Character.java

Character.java

package codemetropolis.toolchain.rendering.util;
+
+import codemetropolis.toolchain.rendering.model.BasicBlock;
+
+public enum Character {
+	
+	STONE,
+	COBBLESTONE,
+	MOSSY_STONE,
+	SANDSTONE,
+	OBSIDIAN,
+	WOOD,
+	DARK_WOOD,
+	BIRCH_WOOD,
+	PLANKS,
+	DARK_PLANKS,
+	METAL,
+	DIRT,
+	SAND,
+	RED_SAND,
+	BRICK,
+	STONE_BRICK,
+	DARK_BRICK,
+	GLASS,
+	GOLD,
+	DIAMOND,
+	UNDEFINED;
+	
+	public static Character parse(String str) {
+		for(Character c : Character.values()) {
+			if(c.toString().equalsIgnoreCase(str)) return c;
+		}
+		return Character.UNDEFINED;
+	}
+	
+	public BasicBlock getBlock() {
+		switch(this) {
+			case STONE: return new BasicBlock( "minecraft:stone" );
+			case COBBLESTONE: return new BasicBlock( "minecraft:cobblestone" );
+			case MOSSY_STONE: return new BasicBlock( "minecraft:mossy_cobblestone" );
+			case SANDSTONE: return new BasicBlock( "minecraft:sandstone" );
+			case OBSIDIAN: return new BasicBlock( "minecraft:obsidian" );
+			case WOOD: return new BasicBlock( "minecraft:log" );
+			case DARK_WOOD: return new BasicBlock( "minecraft:log", 1 );
+			case BIRCH_WOOD: return new BasicBlock( "minecraft:log", 2 );
+			case PLANKS: return new BasicBlock( "minecraft:planks" );
+			case DARK_PLANKS: return new BasicBlock( "minecraft:planks", 5 );
+			case METAL: return new BasicBlock( "minecraft:iron_block" );
+			case DIRT: return new BasicBlock( "minecraft:dirt" );
+			case SAND: return new BasicBlock( "minecraft:sandstone" , 2 );
+			case RED_SAND: return new BasicBlock( "minecraft:sand" );
+			case BRICK: return new BasicBlock( "minecraft:double_stone_slab", 4 );
+			case STONE_BRICK: return new BasicBlock( "minecraft:double_stone_slab", 5 );
+			case DARK_BRICK: return new BasicBlock( "minecraft:double_stone_slab", 6 );
+			case GLASS: return new BasicBlock( "minecraft:glass" );
+			case GOLD: return new BasicBlock( "minecraft:gold_block" );
+			case DIAMOND: return new BasicBlock( "minecraft:diamond_block" );
+			case UNDEFINED: return new BasicBlock( "minecraft:wool", 2 );
+			default: return null;
+		}
+	}
+	
+	public BasicBlock getTopBlock() {
+		switch(this) {
+			case WOOD:
+			case DARK_WOOD:
+			case BIRCH_WOOD:
+			case PLANKS:
+			case DARK_PLANKS:
+				return new BasicBlock( "minecraft:fence" );
+			default: return getBlock();
+		}
+	}
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Orientation.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Orientation.html new file mode 100644 index 00000000..c9de5921 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Orientation.html @@ -0,0 +1 @@ +Orientation

Orientation

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total78 of 780%0 of 0n/a447744
static {...}640%n/a117711
valueOf(String)50%n/a111111
Orientation(String, int)50%n/a111111
values()40%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Orientation.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Orientation.java.html new file mode 100644 index 00000000..92dc9a0f --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/Orientation.java.html @@ -0,0 +1,11 @@ +Orientation.java

Orientation.java

package codemetropolis.toolchain.rendering.util;
+
+public enum Orientation {
+	NearX,
+	NearY,
+	NearZ,
+	FarX,
+	FarY,
+	FarZ
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/index.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/index.html new file mode 100644 index 00000000..a6f153be --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.util

codemetropolis.toolchain.rendering.util

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total616 of 6160%28 of 280%36365858121233
Character3860%280%313151517711
Orientation780%n/a44774411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/index.source.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/index.source.html new file mode 100644 index 00000000..06c2e7c3 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering.util/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering.util

codemetropolis.toolchain.rendering.util

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total616 of 6160%28 of 280%36365858121233
Character.java5380%280%323251518822
Orientation.java780%n/a44774411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/CommandLineOptions.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/CommandLineOptions.html new file mode 100644 index 00000000..dd815e89 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/CommandLineOptions.html @@ -0,0 +1 @@ +CommandLineOptions

CommandLineOptions

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total27 of 270%0 of 0n/a559955
CommandLineOptions()150%n/a115511
showHelp()30%n/a111111
getInputFile()30%n/a111111
getWorld()30%n/a111111
overwriteSilently()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/CommandLineOptions.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/CommandLineOptions.java.html new file mode 100644 index 00000000..2df78ee8 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/CommandLineOptions.java.html @@ -0,0 +1,36 @@ +CommandLineOptions.java

CommandLineOptions.java

package codemetropolis.toolchain.rendering;
+
+import org.kohsuke.args4j.Option;
+
+public class CommandLineOptions {
+	
+	@Option(name="-h", aliases = { "--help" })
+	private boolean showHelp = false;
+	
+	@Option(name="-i", aliases = { "--input" })
+	private String inputFile = null;
+	
+	@Option(name="-w", aliases = { "-world", "--world" })
+	private String world = null;
+
+	@Option(name="-s", aliases = { "-ow", "--overwrite", "--silent" })
+	private boolean overwriteSilently = false;
+	
+	public boolean showHelp() {
+		return showHelp;
+	}
+	
+	public String getInputFile() {
+		return inputFile;
+	}
+
+	public String getWorld() {
+		return world;
+	}
+
+	public boolean overwriteSilently() {
+		return overwriteSilently;
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main$1.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main$1.html new file mode 100644 index 00000000..427de671 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main$1.html @@ -0,0 +1 @@ +Main.new ProgressEventListener() {...}

Main.new ProgressEventListener() {...}

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total72 of 720%7 of 70%77171733
printProgress(String, ProgressEvent)450%20%228811
onNextState(ProgressEvent)240%50%447711
{...}30%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main.html new file mode 100644 index 00000000..c06e01a4 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main.html @@ -0,0 +1 @@ +Main

Main

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total88 of 880%8 of 80%66272722
main(String[])850%80%55262611
Main()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main.java.html new file mode 100644 index 00000000..8d749da9 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/Main.java.html @@ -0,0 +1,83 @@ +Main.java

Main.java

package codemetropolis.toolchain.rendering;
+
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+
+import codemetropolis.toolchain.commons.util.FileLogger;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.commons.util.Settings;
+import codemetropolis.toolchain.rendering.events.ProgressEvent;
+import codemetropolis.toolchain.rendering.events.ProgressEventListener;
+
+public class Main {
+	
+	public static void main(String[] args) {
+		
+		FileLogger.load(Settings.get("rendering_log_file"));
+		
+		CommandLineOptions options = new CommandLineOptions();
+	    CmdLineParser parser = new CmdLineParser(options);
+
+	    try {
+	        parser.parseArgument(args);
+	        if((options.getInputFile()== null || options.getWorld() == null) && !options.showHelp())
+	        	throw new IllegalArgumentException();
+	    } catch (CmdLineException | IllegalArgumentException e) {
+	    	String message = Resources.get("command_line_error");
+	    	FileLogger.logError(message, e);
+	    	System.err.println(message);
+	    	System.err.println(Resources.get("rendering_usage"));
+	    	return;
+	    }
+	    
+	    if(options.showHelp()) {
+	    	System.out.println(Resources.get("rendering_introduction"));
+	    	System.out.println(Resources.get("rendering_usage"));
+	    	return;
+	    }
+	    
+	    RenderingExecutor executor = new RenderingExecutor();
+	    executor.addEventListener(new ProgressEventListener() {
+			
+	    	@Override
+			public void onNextState(ProgressEvent event) {
+				if(event.COUNT > 0) {
+					switch(event.PHASE){
+						case GENERATING_BLOCKS:
+							printProgress(Resources.get("creating_blocks_progress"), event);
+							break;
+						case PLACING_BLOCKS:
+							printProgress(Resources.get("placing_blocks_progress"), event);
+							break;
+						default:
+							break;
+					}
+				}
+			}
+			
+			private void printProgress(String message, ProgressEvent event) {
+				System.out.printf(
+						Resources.get("rendering_prefix") + message + "\r",
+						event.getPercent(),
+						event.getTimeLeft().getHours(),
+						event.getTimeLeft().getMinutes());
+				if(event.getPercent() >= 100) {
+					System.out.print("                                                                           \r");
+				}
+			}
+			
+		});
+	    
+	    executor.setPrefix(Resources.get("rendering_prefix"));
+	    executor.setErrorPrefix(Resources.get("error_prefix"));
+	    executor.execute(
+	    		new RenderingExecutorArgs(
+	    				options.getInputFile(),
+	    				options.getWorld(),
+	    				options.overwriteSilently())
+	    		);
+	    
+	}
+
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutor.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutor.html new file mode 100644 index 00000000..a0c0debb --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutor.html @@ -0,0 +1 @@ +RenderingExecutor

RenderingExecutor

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total309 of 3090%18 of 180%1313646444
execute(ExecutorArgs)2890%180%1010585811
RenderingExecutor()80%n/a112211
addEventListener(ProgressEventListener)60%n/a112211
removeEventListener(ProgressEventListener)60%n/a112211
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutor.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutor.java.html new file mode 100644 index 00000000..f6e68c49 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutor.java.html @@ -0,0 +1,122 @@ +RenderingExecutor.java

RenderingExecutor.java

package codemetropolis.toolchain.rendering;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.EventListener;
+import java.util.List;
+import java.util.Scanner;
+
+import codemetropolis.toolchain.commons.cmxml.CmxmlValidator;
+import codemetropolis.toolchain.commons.cmxml.exceptions.CmxmlValidationFailedException;
+import codemetropolis.toolchain.commons.executor.AbstractExecutor;
+import codemetropolis.toolchain.commons.executor.ExecutorArgs;
+import codemetropolis.toolchain.commons.util.FileUtils;
+import codemetropolis.toolchain.commons.util.Resources;
+import codemetropolis.toolchain.rendering.control.WorldBuilder;
+import codemetropolis.toolchain.rendering.events.ProgressEventListener;
+import codemetropolis.toolchain.rendering.exceptions.BuildingTypeMismatchException;
+import codemetropolis.toolchain.rendering.exceptions.RenderingException;
+import codemetropolis.toolchain.rendering.exceptions.TooLongRenderDurationException;
+
+public class RenderingExecutor extends AbstractExecutor {
+	
+	@Override
+	public boolean execute(ExecutorArgs args) {
+		RenderingExecutorArgs renderingArgs = (RenderingExecutorArgs)args;
+		
+		File worldDir = new File(renderingArgs.getWorldPath());
+		File tempDir = new File(worldDir, "TEMP");
+		tempDir.deleteOnExit();
+		boolean overwrite = renderingArgs.isSilentOverwriteEnabled();
+		
+		if(worldDir.exists() && worldDir.isDirectory()) {
+			if(!overwrite) {
+				print(false, Resources.get("world_already_exists"), tempDir.getAbsolutePath());
+				Scanner in = new Scanner(System.in);
+				String input = "";
+				while(!input.equalsIgnoreCase("Y") && !input.equalsIgnoreCase("N")) {
+					input = in.next();
+				}
+				in.close();
+				if(input.equalsIgnoreCase("Y")) {
+					overwrite = true;
+				} else {
+					print(Resources.get("render_interrupted"));
+					return false;
+				}
+			}
+			if(overwrite) {
+				FileUtils.deleteDirectory(worldDir);
+			}
+		}
+			
+		try {
+			boolean isValid = CmxmlValidator.validate(renderingArgs.getInputFile());
+			if(!isValid) {
+				throw new CmxmlValidationFailedException();
+			}
+		} catch (IOException e) {
+			printError(e, Resources.get("missing_input_xml_error"));
+			return false;
+		} catch (CmxmlValidationFailedException e) {
+			printError(e, Resources.get("invalid_input_xml_error"));
+			return false;
+		}
+		
+		WorldBuilder worldBuilder = new WorldBuilder(renderingArgs.getWorldPath());
+		for(EventListener listener : listeners) {
+			worldBuilder.addEventListener((ProgressEventListener) listener);
+		}
+		
+		print(Resources.get("rendering_reading_input"));
+		try {
+			worldBuilder.createBuildings(renderingArgs.getInputFile());
+		} catch (BuildingTypeMismatchException e) {
+			printError(e, Resources.get("building_creation_failed_error"));
+			return false;
+		}
+		print(Resources.get("rendering_reading_input_done"));
+		print(Resources.get("buildables_found"), worldBuilder.getNumberOfBuildings());
+		
+		print(Resources.get("creating_blocks"));
+		try {
+			worldBuilder.createBlocks(tempDir, renderingArgs.getMaxTime());
+		} catch (TooLongRenderDurationException e) {
+			printError(e, Resources.get("too_long_render_duration_error"), e.getMaxTime());
+			return false;
+		}
+		long elapsed = worldBuilder.getTimeElapsedDuringLastPhase();
+		int hours = (int) (elapsed / (1000 * 60 * 60));
+        int minutes = (int) (elapsed % (1000 * 60 * 60) / (1000 * 60));
+        print(Resources.get("creating_blocks_done"), worldBuilder.getNumberOfBlocks(), hours, minutes);
+		
+        print(Resources.get("placing_blocks"));
+		try {
+			worldBuilder.build(tempDir);
+		} catch (RenderingException e) {
+			printError(e, Resources.get("placing_blocks_failed_error"));
+			return false;
+		}
+		elapsed = worldBuilder.getTimeElapsedDuringLastPhase();
+		hours = (int) (elapsed / (1000 * 60 * 60));
+        minutes = (int) (elapsed % (1000 * 60 * 60) / (1000 * 60));
+        print(Resources.get("placing_blocks_done"), hours, minutes);
+        
+        return true;
+	}
+	
+	//region PROGRESS EVENT
+	private List<EventListener> listeners = new ArrayList<EventListener>();
+	
+	public synchronized void addEventListener(ProgressEventListener listener)  {
+		listeners.add(listener);
+	}
+	
+	public synchronized void removeEventListener(ProgressEventListener listener)   {
+		listeners.remove(listener);
+	}
+	//endregion
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutorArgs.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutorArgs.html new file mode 100644 index 00000000..5e337c87 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutorArgs.html @@ -0,0 +1 @@ +RenderingExecutorArgs

RenderingExecutorArgs

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total40 of 400%0 of 0n/a77141477
RenderingExecutorArgs(String, String, boolean, int)150%n/a116611
RenderingExecutorArgs(String, String, boolean)70%n/a112211
RenderingExecutorArgs(String, String)60%n/a112211
getInputFile()30%n/a111111
getWorldPath()30%n/a111111
isSilentOverwriteEnabled()30%n/a111111
getMaxTime()30%n/a111111
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutorArgs.java.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutorArgs.java.html new file mode 100644 index 00000000..6e0123b7 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/RenderingExecutorArgs.java.html @@ -0,0 +1,45 @@ +RenderingExecutorArgs.java

RenderingExecutorArgs.java

package codemetropolis.toolchain.rendering;
+
+import codemetropolis.toolchain.commons.executor.ExecutorArgs;
+
+public class RenderingExecutorArgs extends ExecutorArgs {
+	
+	private String inputFile;
+	private String worldPath;
+	private boolean overwriteSilently;
+	private int maxTime;
+	
+	public RenderingExecutorArgs(String inputFile, String worldPath) {
+		this(inputFile, worldPath, false);
+	}
+	
+	public RenderingExecutorArgs(String inputFile, String worldPath, boolean overwriteSilently) {
+		this(inputFile, worldPath, overwriteSilently, Integer.MAX_VALUE);
+	}
+	
+	public RenderingExecutorArgs(String inputFile, String worldPath, boolean overwriteSilently, int maxTime) {
+		super();
+		this.inputFile = inputFile;
+		this.worldPath = worldPath;
+		this.overwriteSilently = overwriteSilently;
+		this.maxTime = maxTime;
+	}
+
+	public String getInputFile() {
+		return inputFile;
+	}
+
+	public String getWorldPath() {
+		return worldPath;
+	}
+
+	public boolean isSilentOverwriteEnabled() {
+		return overwriteSilently;
+	}
+
+	public int getMaxTime() {
+		return maxTime;
+	}
+	
+}
+
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/index.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/index.html new file mode 100644 index 00000000..54a3c33d --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/index.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering

codemetropolis.toolchain.rendering

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total555 of 5550%33 of 330%3939130130222266
RenderingExecutor3090%180%131364644411
Main880%80%6627272211
Main.new ProgressEventListener() {...}720%70%7717173311
RenderingExecutorArgs400%n/a7714147711
CommandLineOptions270%n/a55995511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/index.source.html b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/index.source.html new file mode 100644 index 00000000..6e9398de --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/codemetropolis.toolchain.rendering/index.source.html @@ -0,0 +1 @@ +codemetropolis.toolchain.rendering

codemetropolis.toolchain.rendering

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total555 of 5550%33 of 330%3939130130222266
RenderingExecutor.java3090%180%131364644411
Main.java1790%150%141443436633
RenderingExecutorArgs.java400%n/a7714147711
CommandLineOptions.java270%n/a55995511
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_java/index.html b/doc/codemetropolis-toolchain-rendering/src_main_java/index.html new file mode 100644 index 00000000..958f2a5f --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_java/index.html @@ -0,0 +1 @@ +src/main/java

src/main/java

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total8,212 of 8,2120%239 of 2390%3253251,0871,0871851854444
codemetropolis.toolchain.rendering.model.building4,1240%390%4545413413232355
codemetropolis.toolchain.rendering.model.primitive1,7690%780%10810825225263631515
codemetropolis.toolchain.rendering.util6160%280%36365858121233
codemetropolis.toolchain.rendering5550%330%3939130130222266
codemetropolis.toolchain.rendering.control5290%290%31319090151533
codemetropolis.toolchain.rendering.model2720%220%27275959161622
codemetropolis.toolchain.rendering.model.pattern2210%100%21214848161666
codemetropolis.toolchain.rendering.exceptions780%n/a14142828141433
codemetropolis.toolchain.rendering.events480%n/a44994411
\ No newline at end of file diff --git a/doc/codemetropolis-toolchain-rendering/src_main_resources/index.html b/doc/codemetropolis-toolchain-rendering/src_main_resources/index.html new file mode 100644 index 00000000..985d0bc8 --- /dev/null +++ b/doc/codemetropolis-toolchain-rendering/src_main_resources/index.html @@ -0,0 +1 @@ +src/main/resources

src/main/resources

ElementMissed InstructionsCov.Missed BranchesCov.
Total0 of 0n/a0 of 0n/a
\ No newline at end of file diff --git a/doc/jacoco-resources/branchfc.gif b/doc/jacoco-resources/branchfc.gif new file mode 100644 index 0000000000000000000000000000000000000000..989b46d30469b56b014758f846ee6c5abfda16aa GIT binary patch literal 91 zcmZ?wbhEHb6=b<*h$V|V6X-NwhSNb literal 0 HcmV?d00001 diff --git a/doc/jacoco-resources/branchnc.gif b/doc/jacoco-resources/branchnc.gif new file mode 100644 index 0000000000000000000000000000000000000000..1933e07c376bb71bdd9aac91cf858da3fcdb0f1c GIT binary patch literal 91 zcmZ?wbhEHb6=b<*h$V|V6X-N9U38B literal 0 HcmV?d00001 diff --git a/doc/jacoco-resources/branchpc.gif b/doc/jacoco-resources/branchpc.gif new file mode 100644 index 0000000000000000000000000000000000000000..cbf711b7030929b733f22f7a0cf3dbf61fe7868f GIT binary patch literal 91 zcmZ?wbhEHbm$mi>nCYN#As;!%lJz1A{dHmlPuc literal 0 HcmV?d00001 diff --git a/doc/jacoco-resources/bundle.gif b/doc/jacoco-resources/bundle.gif new file mode 100644 index 0000000000000000000000000000000000000000..fca9c53e629a7a5c07186ac1e2a1e37d8d6e88f4 GIT binary patch literal 709 zcmZ?wbhEHb6krfwxXQrrpW*-7BK;o8CDEUD?$vun5^UNelT%D!ODhRsX(Ohwq+z^!{nkw1lu( zDPc2HV&`P7KEHX-jYA>R6T@ewM9fTyo0E0x)!k_2wz@P-Sk{|^LE{K>+|z);Vi!vF-J zIALI4-caAv+|t_C-oY&>$uA|y-ND80=rPrik*keM);A(7JS@bMXJ#`uzjsjN>eYc> zj1!vJoq|_~`Ugb%`8WwRvs$=Bx;h_qcXM-KZDthLjMNep5fPP;Q{vk%FCD3^prRsd zAfR@-Nl4k$GSW~(G16XNhoM=9$H>NPjk%o(&&DPp6ODz*?)|b>X&fF28jY>Ox-nZU Y5*r^bWMyL$kZ52~Skzz7#K>R`0G8r7i~s-t literal 0 HcmV?d00001 diff --git a/doc/jacoco-resources/down.gif b/doc/jacoco-resources/down.gif new file mode 100644 index 0000000000000000000000000000000000000000..440a14db74e76c2b6e854eacac1c44414b166271 GIT binary patch literal 67 zcmZ?wbhEHbZ%p}jXB Ub$^Lu-Ncq(ygK&ScM%3_0Po}%Qvd(} literal 0 HcmV?d00001 diff --git a/doc/jacoco-resources/greenbar.gif b/doc/jacoco-resources/greenbar.gif new file mode 100644 index 0000000000000000000000000000000000000000..0ba65672530ee09f086821a26156836d0c91bd74 GIT binary patch literal 91 zcmZ?wbhEHbWMtrCc+ADXzmZ>do2<@m9j_x^v8Q5duh#b5>RIq$!Lmoo);w9mu$BQ0 eDgI<(1nOeYVE_V<84N5O20cYWMlKB;4AuaIXBwOU literal 0 HcmV?d00001 diff --git a/doc/jacoco-resources/group.gif b/doc/jacoco-resources/group.gif new file mode 100644 index 0000000000000000000000000000000000000000..a4ea580d278fb727e4ae692838877fa63c4becf9 GIT binary patch literal 351 zcmZ?wbhEHb6krfwxXQpVwXtJrV`pb|Z&Bgo_>{Q`Df1G5Wa`}H^qKLgbHn221;#86 zie2Oyy23SVg;&(l)`=%9{nuIstg#PSrQx<&&vS#m*G7G>4W@o;CvAN*Y1^AgTVGGw z_ImEoPjiobns@ZmyknnMUi-Q7>W`Jzer$aB_t(pL-|kQQ|MAfO*PGv5?Ee3B$^ToO z|A8VGOaEW3eSEO?=BC06Ybq|Tt-P?N@;?|b;0205Sr{1@Oc``Qsz82XV5>PWtH47? zs^4Q~P@BxTjDV;&5*!R(s==>VnJe}-&SEIintfiq!@CwnVRxXubL!4|)qjO}gg>klxZ?TGXw~#-V zU_Y2&N}FX?r*L1YbYiM-aj|xBv2}#Mgo3?-guaA=wSS1Yfrz+)iMWB7#*ml2h^x<; ztIwFU(w+bR{{R30A^8LW0015UEC2ui01yBW000F(peK%GX`X1Rt}L1aL$Vf5mpMgx vG+WO#2NYmJDM}^)l;8n@L?90V%CN9pFcyU&MPO(u48jTlL$uClRtNw)MiWcq literal 0 HcmV?d00001 diff --git a/doc/jacoco-resources/package.gif b/doc/jacoco-resources/package.gif new file mode 100644 index 0000000000000000000000000000000000000000..131c28da405493661e3253ef79a68bd273039295 GIT binary patch literal 227 zcmZ?wbhEHb6krfwIKsg2^W*Nf7neOfxp04z;n8NJ+xzDotkS){bH@Hst%K#-*LO_c zo~yCDQ0v_4?v)A3lSAd#C95utQCbkGxF}NT_=2WF8}WGs5taT9|NsAIzy=h5vM@3* zNHFMtBtdpEuqG&|^`&Ia(}-MpBVo@mW@+b{B25<}cFdc?!Kkoc14n0vkh1`XOwU>7 z#al8o_@;D=?hdfkdC)D9Q@O@%Lfqp;ZBt~9C*29`GMF2XzQp8akWQVjDvMC75PzEx Mi%z;upCW@b03m@=3jhEB literal 0 HcmV?d00001 diff --git a/doc/jacoco-resources/prettify.css b/doc/jacoco-resources/prettify.css new file mode 100644 index 00000000..be5166e0 --- /dev/null +++ b/doc/jacoco-resources/prettify.css @@ -0,0 +1,13 @@ +/* Pretty printing styles. Used with prettify.js. */ + +.str { color: #2A00FF; } +.kwd { color: #7F0055; font-weight:bold; } +.com { color: #3F5FBF; } +.typ { color: #606; } +.lit { color: #066; } +.pun { color: #660; } +.pln { color: #000; } +.tag { color: #008; } +.atn { color: #606; } +.atv { color: #080; } +.dec { color: #606; } diff --git a/doc/jacoco-resources/prettify.js b/doc/jacoco-resources/prettify.js new file mode 100644 index 00000000..ab278821 --- /dev/null +++ b/doc/jacoco-resources/prettify.js @@ -0,0 +1,1510 @@ +// Copyright (C) 2006 Google Inc. +// +// 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. + + +/** + * @fileoverview + * some functions for browser-side pretty printing of code contained in html. + *

+ * + * For a fairly comprehensive set of languages see the + * README + * file that came with this source. At a minimum, the lexer should work on a + * number of languages including C and friends, Java, Python, Bash, SQL, HTML, + * XML, CSS, Javascript, and Makefiles. It works passably on Ruby, PHP and Awk + * and a subset of Perl, but, because of commenting conventions, doesn't work on + * Smalltalk, Lisp-like, or CAML-like languages without an explicit lang class. + *

+ * Usage:

    + *
  1. include this source file in an html page via + * {@code } + *
  2. define style rules. See the example page for examples. + *
  3. mark the {@code
    } and {@code } tags in your source with
    + *    {@code class=prettyprint.}
    + *    You can also use the (html deprecated) {@code } tag, but the pretty
    + *    printer needs to do more substantial DOM manipulations to support that, so
    + *    some css styles may not be preserved.
    + * </ol>
    + * That's it.  I wanted to keep the API as simple as possible, so there's no
    + * need to specify which language the code is in, but if you wish, you can add
    + * another class to the {@code <pre>} or {@code <code>} element to specify the
    + * language, as in {@code <pre class="prettyprint lang-java">}.  Any class that
    + * starts with "lang-" followed by a file extension, specifies the file type.
    + * See the "lang-*.js" files in this directory for code that implements
    + * per-language file handlers.
    + * <p>
    + * Change log:<br>
    + * cbeust, 2006/08/22
    + * <blockquote>
    + *   Java annotations (start with "@") are now captured as literals ("lit")
    + * </blockquote>
    + * @requires console
    + */
    +
    +// JSLint declarations
    +/*global console, document, navigator, setTimeout, window */
    +
    +/**
    + * Split {@code prettyPrint} into multiple timeouts so as not to interfere with
    + * UI events.
    + * If set to {@code false}, {@code prettyPrint()} is synchronous.
    + */
    +window['PR_SHOULD_USE_CONTINUATION'] = true;
    +
    +/** the number of characters between tab columns */
    +window['PR_TAB_WIDTH'] = 8;
    +
    +/** Walks the DOM returning a properly escaped version of innerHTML.
    +  * @param {Node} node
    +  * @param {Array.<string>} out output buffer that receives chunks of HTML.
    +  */
    +window['PR_normalizedHtml']
    +
    +/** Contains functions for creating and registering new language handlers.
    +  * @type {Object}
    +  */
    +  = window['PR']
    +
    +/** Pretty print a chunk of code.
    +  *
    +  * @param {string} sourceCodeHtml code as html
    +  * @return {string} code as html, but prettier
    +  */
    +  = window['prettyPrintOne']
    +/** Find all the {@code <pre>} and {@code <code>} tags in the DOM with
    +  * {@code class=prettyprint} and prettify them.
    +  * @param {Function?} opt_whenDone if specified, called when the last entry
    +  *     has been finished.
    +  */
    +  = window['prettyPrint'] = void 0;
    +
    +/** browser detection. @extern @returns false if not IE, otherwise the major version. */
    +window['_pr_isIE6'] = function () {
    +  var ieVersion = navigator && navigator.userAgent &&
    +      navigator.userAgent.match(/\bMSIE ([678])\./);
    +  ieVersion = ieVersion ? +ieVersion[1] : false;
    +  window['_pr_isIE6'] = function () { return ieVersion; };
    +  return ieVersion;
    +};
    +
    +
    +(function () {
    +  // Keyword lists for various languages.
    +  var FLOW_CONTROL_KEYWORDS =
    +      "break continue do else for if return while ";
    +  var C_KEYWORDS = FLOW_CONTROL_KEYWORDS + "auto case char const default " +
    +      "double enum extern float goto int long register short signed sizeof " +
    +      "static struct switch typedef union unsigned void volatile ";
    +  var COMMON_KEYWORDS = C_KEYWORDS + "catch class delete false import " +
    +      "new operator private protected public this throw true try typeof ";
    +  var CPP_KEYWORDS = COMMON_KEYWORDS + "alignof align_union asm axiom bool " +
    +      "concept concept_map const_cast constexpr decltype " +
    +      "dynamic_cast explicit export friend inline late_check " +
    +      "mutable namespace nullptr reinterpret_cast static_assert static_cast " +
    +      "template typeid typename using virtual wchar_t where ";
    +  var JAVA_KEYWORDS = COMMON_KEYWORDS +
    +      "abstract boolean byte extends final finally implements import " +
    +      "instanceof null native package strictfp super synchronized throws " +
    +      "transient ";
    +  var CSHARP_KEYWORDS = JAVA_KEYWORDS +
    +      "as base by checked decimal delegate descending event " +
    +      "fixed foreach from group implicit in interface internal into is lock " +
    +      "object out override orderby params partial readonly ref sbyte sealed " +
    +      "stackalloc string select uint ulong unchecked unsafe ushort var ";
    +  var JSCRIPT_KEYWORDS = COMMON_KEYWORDS +
    +      "debugger eval export function get null set undefined var with " +
    +      "Infinity NaN ";
    +  var PERL_KEYWORDS = "caller delete die do dump elsif eval exit foreach for " +
    +      "goto if import last local my next no our print package redo require " +
    +      "sub undef unless until use wantarray while BEGIN END ";
    +  var PYTHON_KEYWORDS = FLOW_CONTROL_KEYWORDS + "and as assert class def del " +
    +      "elif except exec finally from global import in is lambda " +
    +      "nonlocal not or pass print raise try with yield " +
    +      "False True None ";
    +  var RUBY_KEYWORDS = FLOW_CONTROL_KEYWORDS + "alias and begin case class def" +
    +      " defined elsif end ensure false in module next nil not or redo rescue " +
    +      "retry self super then true undef unless until when yield BEGIN END ";
    +  var SH_KEYWORDS = FLOW_CONTROL_KEYWORDS + "case done elif esac eval fi " +
    +      "function in local set then until ";
    +  var ALL_KEYWORDS = (
    +      CPP_KEYWORDS + CSHARP_KEYWORDS + JSCRIPT_KEYWORDS + PERL_KEYWORDS +
    +      PYTHON_KEYWORDS + RUBY_KEYWORDS + SH_KEYWORDS);
    +
    +  // token style names.  correspond to css classes
    +  /** token style for a string literal */
    +  var PR_STRING = 'str';
    +  /** token style for a keyword */
    +  var PR_KEYWORD = 'kwd';
    +  /** token style for a comment */
    +  var PR_COMMENT = 'com';
    +  /** token style for a type */
    +  var PR_TYPE = 'typ';
    +  /** token style for a literal value.  e.g. 1, null, true. */
    +  var PR_LITERAL = 'lit';
    +  /** token style for a punctuation string. */
    +  var PR_PUNCTUATION = 'pun';
    +  /** token style for a punctuation string. */
    +  var PR_PLAIN = 'pln';
    +
    +  /** token style for an sgml tag. */
    +  var PR_TAG = 'tag';
    +  /** token style for a markup declaration such as a DOCTYPE. */
    +  var PR_DECLARATION = 'dec';
    +  /** token style for embedded source. */
    +  var PR_SOURCE = 'src';
    +  /** token style for an sgml attribute name. */
    +  var PR_ATTRIB_NAME = 'atn';
    +  /** token style for an sgml attribute value. */
    +  var PR_ATTRIB_VALUE = 'atv';
    +
    +  /**
    +   * A class that indicates a section of markup that is not code, e.g. to allow
    +   * embedding of line numbers within code listings.
    +   */
    +  var PR_NOCODE = 'nocode';
    +
    +  /** A set of tokens that can precede a regular expression literal in
    +    * javascript.
    +    * http://www.mozilla.org/js/language/js20/rationale/syntax.html has the full
    +    * list, but I've removed ones that might be problematic when seen in
    +    * languages that don't support regular expression literals.
    +    *
    +    * <p>Specifically, I've removed any keywords that can't precede a regexp
    +    * literal in a syntactically legal javascript program, and I've removed the
    +    * "in" keyword since it's not a keyword in many languages, and might be used
    +    * as a count of inches.
    +    *
    +    * <p>The link a above does not accurately describe EcmaScript rules since
    +    * it fails to distinguish between (a=++/b/i) and (a++/b/i) but it works
    +    * very well in practice.
    +    *
    +    * @private
    +    */
    +  var REGEXP_PRECEDER_PATTERN = function () {
    +      var preceders = [
    +          "!", "!=", "!==", "#", "%", "%=", "&", "&&", "&&=",
    +          "&=", "(", "*", "*=", /* "+", */ "+=", ",", /* "-", */ "-=",
    +          "->", /*".", "..", "...", handled below */ "/", "/=", ":", "::", ";",
    +          "<", "<<", "<<=", "<=", "=", "==", "===", ">",
    +          ">=", ">>", ">>=", ">>>", ">>>=", "?", "@", "[",
    +          "^", "^=", "^^", "^^=", "{", "|", "|=", "||",
    +          "||=", "~" /* handles =~ and !~ */,
    +          "break", "case", "continue", "delete",
    +          "do", "else", "finally", "instanceof",
    +          "return", "throw", "try", "typeof"
    +          ];
    +      var pattern = '(?:^^|[+-]';
    +      for (var i = 0; i < preceders.length; ++i) {
    +        pattern += '|' + preceders[i].replace(/([^=<>:&a-z])/g, '\\$1');
    +      }
    +      pattern += ')\\s*';  // matches at end, and matches empty string
    +      return pattern;
    +      // CAVEAT: this does not properly handle the case where a regular
    +      // expression immediately follows another since a regular expression may
    +      // have flags for case-sensitivity and the like.  Having regexp tokens
    +      // adjacent is not valid in any language I'm aware of, so I'm punting.
    +      // TODO: maybe style special characters inside a regexp as punctuation.
    +    }();
    +
    +  // Define regexps here so that the interpreter doesn't have to create an
    +  // object each time the function containing them is called.
    +  // The language spec requires a new object created even if you don't access
    +  // the $1 members.
    +  var pr_amp = /&/g;
    +  var pr_lt = /</g;
    +  var pr_gt = />/g;
    +  var pr_quot = /\"/g;
    +  /** like textToHtml but escapes double quotes to be attribute safe. */
    +  function attribToHtml(str) {
    +    return str.replace(pr_amp, '&amp;')
    +        .replace(pr_lt, '&lt;')
    +        .replace(pr_gt, '&gt;')
    +        .replace(pr_quot, '&quot;');
    +  }
    +
    +  /** escapest html special characters to html. */
    +  function textToHtml(str) {
    +    return str.replace(pr_amp, '&amp;')
    +        .replace(pr_lt, '&lt;')
    +        .replace(pr_gt, '&gt;');
    +  }
    +
    +
    +  var pr_ltEnt = /&lt;/g;
    +  var pr_gtEnt = /&gt;/g;
    +  var pr_aposEnt = /&apos;/g;
    +  var pr_quotEnt = /&quot;/g;
    +  var pr_ampEnt = /&amp;/g;
    +  var pr_nbspEnt = /&nbsp;/g;
    +  /** unescapes html to plain text. */
    +  function htmlToText(html) {
    +    var pos = html.indexOf('&');
    +    if (pos < 0) { return html; }
    +    // Handle numeric entities specially.  We can't use functional substitution
    +    // since that doesn't work in older versions of Safari.
    +    // These should be rare since most browsers convert them to normal chars.
    +    for (--pos; (pos = html.indexOf('&#', pos + 1)) >= 0;) {
    +      var end = html.indexOf(';', pos);
    +      if (end >= 0) {
    +        var num = html.substring(pos + 3, end);
    +        var radix = 10;
    +        if (num && num.charAt(0) === 'x') {
    +          num = num.substring(1);
    +          radix = 16;
    +        }
    +        var codePoint = parseInt(num, radix);
    +        if (!isNaN(codePoint)) {
    +          html = (html.substring(0, pos) + String.fromCharCode(codePoint) +
    +                  html.substring(end + 1));
    +        }
    +      }
    +    }
    +
    +    return html.replace(pr_ltEnt, '<')
    +        .replace(pr_gtEnt, '>')
    +        .replace(pr_aposEnt, "'")
    +        .replace(pr_quotEnt, '"')
    +        .replace(pr_nbspEnt, ' ')
    +        .replace(pr_ampEnt, '&');
    +  }
    +
    +  /** is the given node's innerHTML normally unescaped? */
    +  function isRawContent(node) {
    +    return 'XMP' === node.tagName;
    +  }
    +
    +  var newlineRe = /[\r\n]/g;
    +  /**
    +   * Are newlines and adjacent spaces significant in the given node's innerHTML?
    +   */
    +  function isPreformatted(node, content) {
    +    // PRE means preformatted, and is a very common case, so don't create
    +    // unnecessary computed style objects.
    +    if ('PRE' === node.tagName) { return true; }
    +    if (!newlineRe.test(content)) { return true; }  // Don't care
    +    var whitespace = '';
    +    // For disconnected nodes, IE has no currentStyle.
    +    if (node.currentStyle) {
    +      whitespace = node.currentStyle.whiteSpace;
    +    } else if (window.getComputedStyle) {
    +      // Firefox makes a best guess if node is disconnected whereas Safari
    +      // returns the empty string.
    +      whitespace = window.getComputedStyle(node, null).whiteSpace;
    +    }
    +    return !whitespace || whitespace === 'pre';
    +  }
    +
    +  function normalizedHtml(node, out, opt_sortAttrs) {
    +    switch (node.nodeType) {
    +      case 1:  // an element
    +        var name = node.tagName.toLowerCase();
    +
    +        out.push('<', name);
    +        var attrs = node.attributes;
    +        var n = attrs.length;
    +        if (n) {
    +          if (opt_sortAttrs) {
    +            var sortedAttrs = [];
    +            for (var i = n; --i >= 0;) { sortedAttrs[i] = attrs[i]; }
    +            sortedAttrs.sort(function (a, b) {
    +                return (a.name < b.name) ? -1 : a.name === b.name ? 0 : 1;
    +              });
    +            attrs = sortedAttrs;
    +          }
    +          for (var i = 0; i < n; ++i) {
    +            var attr = attrs[i];
    +            if (!attr.specified) { continue; }
    +            out.push(' ', attr.name.toLowerCase(),
    +                     '="', attribToHtml(attr.value), '"');
    +          }
    +        }
    +        out.push('>');
    +        for (var child = node.firstChild; child; child = child.nextSibling) {
    +          normalizedHtml(child, out, opt_sortAttrs);
    +        }
    +        if (node.firstChild || !/^(?:br|link|img)$/.test(name)) {
    +          out.push('<\/', name, '>');
    +        }
    +        break;
    +      case 3: case 4: // text
    +        out.push(textToHtml(node.nodeValue));
    +        break;
    +    }
    +  }
    +
    +  /**
    +   * Given a group of {@link RegExp}s, returns a {@code RegExp} that globally
    +   * matches the union o the sets o strings matched d by the input RegExp.
    +   * Since it matches globally, if the input strings have a start-of-input
    +   * anchor (/^.../), it is ignored for the purposes of unioning.
    +   * @param {Array.<RegExp>} regexs non multiline, non-global regexs.
    +   * @return {RegExp} a global regex.
    +   */
    +  function combinePrefixPatterns(regexs) {
    +    var capturedGroupIndex = 0;
    +
    +    var needToFoldCase = false;
    +    var ignoreCase = false;
    +    for (var i = 0, n = regexs.length; i < n; ++i) {
    +      var regex = regexs[i];
    +      if (regex.ignoreCase) {
    +        ignoreCase = true;
    +      } else if (/[a-z]/i.test(regex.source.replace(
    +                     /\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ''))) {
    +        needToFoldCase = true;
    +        ignoreCase = false;
    +        break;
    +      }
    +    }
    +
    +    function decodeEscape(charsetPart) {
    +      if (charsetPart.charAt(0) !== '\\') { return charsetPart.charCodeAt(0); }
    +      switch (charsetPart.charAt(1)) {
    +        case 'b': return 8;
    +        case 't': return 9;
    +        case 'n': return 0xa;
    +        case 'v': return 0xb;
    +        case 'f': return 0xc;
    +        case 'r': return 0xd;
    +        case 'u': case 'x':
    +          return parseInt(charsetPart.substring(2), 16)
    +              || charsetPart.charCodeAt(1);
    +        case '0': case '1': case '2': case '3': case '4':
    +        case '5': case '6': case '7':
    +          return parseInt(charsetPart.substring(1), 8);
    +        default: return charsetPart.charCodeAt(1);
    +      }
    +    }
    +
    +    function encodeEscape(charCode) {
    +      if (charCode < 0x20) {
    +        return (charCode < 0x10 ? '\\x0' : '\\x') + charCode.toString(16);
    +      }
    +      var ch = String.fromCharCode(charCode);
    +      if (ch === '\\' || ch === '-' || ch === '[' || ch === ']') {
    +        ch = '\\' + ch;
    +      }
    +      return ch;
    +    }
    +
    +    function caseFoldCharset(charSet) {
    +      var charsetParts = charSet.substring(1, charSet.length - 1).match(
    +          new RegExp(
    +              '\\\\u[0-9A-Fa-f]{4}'
    +              + '|\\\\x[0-9A-Fa-f]{2}'
    +              + '|\\\\[0-3][0-7]{0,2}'
    +              + '|\\\\[0-7]{1,2}'
    +              + '|\\\\[\\s\\S]'
    +              + '|-'
    +              + '|[^-\\\\]',
    +              'g'));
    +      var groups = [];
    +      var ranges = [];
    +      var inverse = charsetParts[0] === '^';
    +      for (var i = inverse ? 1 : 0, n = charsetParts.length; i < n; ++i) {
    +        var p = charsetParts[i];
    +        switch (p) {
    +          case '\\B': case '\\b':
    +          case '\\D': case '\\d':
    +          case '\\S': case '\\s':
    +          case '\\W': case '\\w':
    +            groups.push(p);
    +            continue;
    +        }
    +        var start = decodeEscape(p);
    +        var end;
    +        if (i + 2 < n && '-' === charsetParts[i + 1]) {
    +          end = decodeEscape(charsetParts[i + 2]);
    +          i += 2;
    +        } else {
    +          end = start;
    +        }
    +        ranges.push([start, end]);
    +        // If the range might intersect letters, then expand it.
    +        if (!(end < 65 || start > 122)) {
    +          if (!(end < 65 || start > 90)) {
    +            ranges.push([Math.max(65, start) | 32, Math.min(end, 90) | 32]);
    +          }
    +          if (!(end < 97 || start > 122)) {
    +            ranges.push([Math.max(97, start) & ~32, Math.min(end, 122) & ~32]);
    +          }
    +        }
    +      }
    +
    +      // [[1, 10], [3, 4], [8, 12], [14, 14], [16, 16], [17, 17]]
    +      // -> [[1, 12], [14, 14], [16, 17]]
    +      ranges.sort(function (a, b) { return (a[0] - b[0]) || (b[1]  - a[1]); });
    +      var consolidatedRanges = [];
    +      var lastRange = [NaN, NaN];
    +      for (var i = 0; i < ranges.length; ++i) {
    +        var range = ranges[i];
    +        if (range[0] <= lastRange[1] + 1) {
    +          lastRange[1] = Math.max(lastRange[1], range[1]);
    +        } else {
    +          consolidatedRanges.push(lastRange = range);
    +        }
    +      }
    +
    +      var out = ['['];
    +      if (inverse) { out.push('^'); }
    +      out.push.apply(out, groups);
    +      for (var i = 0; i < consolidatedRanges.length; ++i) {
    +        var range = consolidatedRanges[i];
    +        out.push(encodeEscape(range[0]));
    +        if (range[1] > range[0]) {
    +          if (range[1] + 1 > range[0]) { out.push('-'); }
    +          out.push(encodeEscape(range[1]));
    +        }
    +      }
    +      out.push(']');
    +      return out.join('');
    +    }
    +
    +    function allowAnywhereFoldCaseAndRenumberGroups(regex) {
    +      // Split into character sets, escape sequences, punctuation strings
    +      // like ('(', '(?:', ')', '^'), and runs of characters that do not
    +      // include any of the above.
    +      var parts = regex.source.match(
    +          new RegExp(
    +              '(?:'
    +              + '\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]'  // a character set
    +              + '|\\\\u[A-Fa-f0-9]{4}'  // a unicode escape
    +              + '|\\\\x[A-Fa-f0-9]{2}'  // a hex escape
    +              + '|\\\\[0-9]+'  // a back-reference or octal escape
    +              + '|\\\\[^ux0-9]'  // other escape sequence
    +              + '|\\(\\?[:!=]'  // start of a non-capturing group
    +              + '|[\\(\\)\\^]'  // start/emd of a group, or line start
    +              + '|[^\\x5B\\x5C\\(\\)\\^]+'  // run of other characters
    +              + ')',
    +              'g'));
    +      var n = parts.length;
    +
    +      // Maps captured group numbers to the number they will occupy in
    +      // the output or to -1 if that has not been determined, or to
    +      // undefined if they need not be capturing in the output.
    +      var capturedGroups = [];
    +
    +      // Walk over and identify back references to build the capturedGroups
    +      // mapping.
    +      for (var i = 0, groupIndex = 0; i < n; ++i) {
    +        var p = parts[i];
    +        if (p === '(') {
    +          // groups are 1-indexed, so max group index is count of '('
    +          ++groupIndex;
    +        } else if ('\\' === p.charAt(0)) {
    +          var decimalValue = +p.substring(1);
    +          if (decimalValue && decimalValue <= groupIndex) {
    +            capturedGroups[decimalValue] = -1;
    +          }
    +        }
    +      }
    +
    +      // Renumber groups and reduce capturing groups to non-capturing groups
    +      // where possible.
    +      for (var i = 1; i < capturedGroups.length; ++i) {
    +        if (-1 === capturedGroups[i]) {
    +          capturedGroups[i] = ++capturedGroupIndex;
    +        }
    +      }
    +      for (var i = 0, groupIndex = 0; i < n; ++i) {
    +        var p = parts[i];
    +        if (p === '(') {
    +          ++groupIndex;
    +          if (capturedGroups[groupIndex] === undefined) {
    +            parts[i] = '(?:';
    +          }
    +        } else if ('\\' === p.charAt(0)) {
    +          var decimalValue = +p.substring(1);
    +          if (decimalValue && decimalValue <= groupIndex) {
    +            parts[i] = '\\' + capturedGroups[groupIndex];
    +          }
    +        }
    +      }
    +
    +      // Remove any prefix anchors so that the output will match anywhere.
    +      // ^^ really does mean an anchored match though.
    +      for (var i = 0, groupIndex = 0; i < n; ++i) {
    +        if ('^' === parts[i] && '^' !== parts[i + 1]) { parts[i] = ''; }
    +      }
    +
    +      // Expand letters to groupts to handle mixing of case-sensitive and
    +      // case-insensitive patterns if necessary.
    +      if (regex.ignoreCase && needToFoldCase) {
    +        for (var i = 0; i < n; ++i) {
    +          var p = parts[i];
    +          var ch0 = p.charAt(0);
    +          if (p.length >= 2 && ch0 === '[') {
    +            parts[i] = caseFoldCharset(p);
    +          } else if (ch0 !== '\\') {
    +            // TODO: handle letters in numeric escapes.
    +            parts[i] = p.replace(
    +                /[a-zA-Z]/g,
    +                function (ch) {
    +                  var cc = ch.charCodeAt(0);
    +                  return '[' + String.fromCharCode(cc & ~32, cc | 32) + ']';
    +                });
    +          }
    +        }
    +      }
    +
    +      return parts.join('');
    +    }
    +
    +    var rewritten = [];
    +    for (var i = 0, n = regexs.length; i < n; ++i) {
    +      var regex = regexs[i];
    +      if (regex.global || regex.multiline) { throw new Error('' + regex); }
    +      rewritten.push(
    +          '(?:' + allowAnywhereFoldCaseAndRenumberGroups(regex) + ')');
    +    }
    +
    +    return new RegExp(rewritten.join('|'), ignoreCase ? 'gi' : 'g');
    +  }
    +
    +  var PR_innerHtmlWorks = null;
    +  function getInnerHtml(node) {
    +    // inner html is hopelessly broken in Safari 2.0.4 when the content is
    +    // an html description of well formed XML and the containing tag is a PRE
    +    // tag, so we detect that case and emulate innerHTML.
    +    if (null === PR_innerHtmlWorks) {
    +      var testNode = document.createElement('PRE');
    +      testNode.appendChild(
    +          document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));
    +      PR_innerHtmlWorks = !/</.test(testNode.innerHTML);
    +    }
    +
    +    if (PR_innerHtmlWorks) {
    +      var content = node.innerHTML;
    +      // XMP tags contain unescaped entities so require special handling.
    +      if (isRawContent(node)) {
    +        content = textToHtml(content);
    +      } else if (!isPreformatted(node, content)) {
    +        content = content.replace(/(<br\s*\/?>)[\r\n]+/g, '$1')
    +            .replace(/(?:[\r\n]+[ \t]*)+/g, ' ');
    +      }
    +      return content;
    +    }
    +
    +    var out = [];
    +    for (var child = node.firstChild; child; child = child.nextSibling) {
    +      normalizedHtml(child, out);
    +    }
    +    return out.join('');
    +  }
    +
    +  /** returns a function that expand tabs to spaces.  This function can be fed
    +    * successive chunks of text, and will maintain its own internal state to
    +    * keep track of how tabs are expanded.
    +    * @return {function (string) : string} a function that takes
    +    *   plain text and return the text with tabs expanded.
    +    * @private
    +    */
    +  function makeTabExpander(tabWidth) {
    +    var SPACES = '                ';
    +    var charInLine = 0;
    +
    +    return function (plainText) {
    +      // walk over each character looking for tabs and newlines.
    +      // On tabs, expand them.  On newlines, reset charInLine.
    +      // Otherwise increment charInLine
    +      var out = null;
    +      var pos = 0;
    +      for (var i = 0, n = plainText.length; i < n; ++i) {
    +        var ch = plainText.charAt(i);
    +
    +        switch (ch) {
    +          case '\t':
    +            if (!out) { out = []; }
    +            out.push(plainText.substring(pos, i));
    +            // calculate how much space we need in front of this part
    +            // nSpaces is the amount of padding -- the number of spaces needed
    +            // to move us to the next column, where columns occur at factors of
    +            // tabWidth.
    +            var nSpaces = tabWidth - (charInLine % tabWidth);
    +            charInLine += nSpaces;
    +            for (; nSpaces >= 0; nSpaces -= SPACES.length) {
    +              out.push(SPACES.substring(0, nSpaces));
    +            }
    +            pos = i + 1;
    +            break;
    +          case '\n':
    +            charInLine = 0;
    +            break;
    +          default:
    +            ++charInLine;
    +        }
    +      }
    +      if (!out) { return plainText; }
    +      out.push(plainText.substring(pos));
    +      return out.join('');
    +    };
    +  }
    +
    +  var pr_chunkPattern = new RegExp(
    +      '[^<]+'  // A run of characters other than '<'
    +      + '|<\!--[\\s\\S]*?--\>'  // an HTML comment
    +      + '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>'  // a CDATA section
    +      // a probable tag that should not be highlighted
    +      + '|<\/?[a-zA-Z](?:[^>\"\']|\'[^\']*\'|\"[^\"]*\")*>'
    +      + '|<',  // A '<' that does not begin a larger chunk
    +      'g');
    +  var pr_commentPrefix = /^<\!--/;
    +  var pr_cdataPrefix = /^<!\[CDATA\[/;
    +  var pr_brPrefix = /^<br\b/i;
    +  var pr_tagNameRe = /^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/;
    +
    +  /** split markup into chunks of html tags (style null) and
    +    * plain text (style {@link #PR_PLAIN}), converting tags which are
    +    * significant for tokenization (<br>) into their textual equivalent.
    +    *
    +    * @param {string} s html where whitespace is considered significant.
    +    * @return {Object} source code and extracted tags.
    +    * @private
    +    */
    +  function extractTags(s) {
    +    // since the pattern has the 'g' modifier and defines no capturing groups,
    +    // this will return a list of all chunks which we then classify and wrap as
    +    // PR_Tokens
    +    var matches = s.match(pr_chunkPattern);
    +    var sourceBuf = [];
    +    var sourceBufLen = 0;
    +    var extractedTags = [];
    +    if (matches) {
    +      for (var i = 0, n = matches.length; i < n; ++i) {
    +        var match = matches[i];
    +        if (match.length > 1 && match.charAt(0) === '<') {
    +          if (pr_commentPrefix.test(match)) { continue; }
    +          if (pr_cdataPrefix.test(match)) {
    +            // strip CDATA prefix and suffix.  Don't unescape since it's CDATA
    +            sourceBuf.push(match.substring(9, match.length - 3));
    +            sourceBufLen += match.length - 12;
    +          } else if (pr_brPrefix.test(match)) {
    +            // <br> tags are lexically significant so convert them to text.
    +            // This is undone later.
    +            sourceBuf.push('\n');
    +            ++sourceBufLen;
    +          } else {
    +            if (match.indexOf(PR_NOCODE) >= 0 && isNoCodeTag(match)) {
    +              // A <span class="nocode"> will start a section that should be
    +              // ignored.  Continue walking the list until we see a matching end
    +              // tag.
    +              var name = match.match(pr_tagNameRe)[2];
    +              var depth = 1;
    +              var j;
    +              end_tag_loop:
    +              for (j = i + 1; j < n; ++j) {
    +                var name2 = matches[j].match(pr_tagNameRe);
    +                if (name2 && name2[2] === name) {
    +                  if (name2[1] === '/') {
    +                    if (--depth === 0) { break end_tag_loop; }
    +                  } else {
    +                    ++depth;
    +                  }
    +                }
    +              }
    +              if (j < n) {
    +                extractedTags.push(
    +                    sourceBufLen, matches.slice(i, j + 1).join(''));
    +                i = j;
    +              } else {  // Ignore unclosed sections.
    +                extractedTags.push(sourceBufLen, match);
    +              }
    +            } else {
    +              extractedTags.push(sourceBufLen, match);
    +            }
    +          }
    +        } else {
    +          var literalText = htmlToText(match);
    +          sourceBuf.push(literalText);
    +          sourceBufLen += literalText.length;
    +        }
    +      }
    +    }
    +    return { source: sourceBuf.join(''), tags: extractedTags };
    +  }
    +
    +  /** True if the given tag contains a class attribute with the nocode class. */
    +  function isNoCodeTag(tag) {
    +    return !!tag
    +        // First canonicalize the representation of attributes
    +        .replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,
    +                 ' $1="$2$3$4"')
    +        // Then look for the attribute we want.
    +        .match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/);
    +  }
    +
    +  /**
    +   * Apply the given language handler to sourceCode and add the resulting
    +   * decorations to out.
    +   * @param {number} basePos the index of sourceCode within the chunk of source
    +   *    whose decorations are already present on out.
    +   */
    +  function appendDecorations(basePos, sourceCode, langHandler, out) {
    +    if (!sourceCode) { return; }
    +    var job = {
    +      source: sourceCode,
    +      basePos: basePos
    +    };
    +    langHandler(job);
    +    out.push.apply(out, job.decorations);
    +  }
    +
    +  /** Given triples of [style, pattern, context] returns a lexing function,
    +    * The lexing function interprets the patterns to find token boundaries and
    +    * returns a decoration list of the form
    +    * [index_0, style_0, index_1, style_1, ..., index_n, style_n]
    +    * where index_n is an index into the sourceCode, and style_n is a style
    +    * constant like PR_PLAIN.  index_n-1 <= index_n, and style_n-1 applies to
    +    * all characters in sourceCode[index_n-1:index_n].
    +    *
    +    * The stylePatterns is a list whose elements have the form
    +    * [style : string, pattern : RegExp, DEPRECATED, shortcut : string].
    +    *
    +    * Style is a style constant like PR_PLAIN, or can be a string of the
    +    * form 'lang-FOO', where FOO is a language extension describing the
    +    * language of the portion of the token in $1 after pattern executes.
    +    * E.g., if style is 'lang-lisp', and group 1 contains the text
    +    * '(hello (world))', then that portion of the token will be passed to the
    +    * registered lisp handler for formatting.
    +    * The text before and after group 1 will be restyled using this decorator
    +    * so decorators should take care that this doesn't result in infinite
    +    * recursion.  For example, the HTML lexer rule for SCRIPT elements looks
    +    * something like ['lang-js', /<[s]cript>(.+?)<\/script>/].  This may match
    +    * '<script>foo()<\/script>', which would cause the current decorator to
    +    * be called with '<script>' which would not match the same rule since
    +    * group 1 must not be empty, so it would be instead styled as PR_TAG by
    +    * the generic tag rule.  The handler registered for the 'js' extension would
    +    * then be called with 'foo()', and finally, the current decorator would
    +    * be called with '<\/script>' which would not match the original rule and
    +    * so the generic tag rule would identify it as a tag.
    +    *
    +    * Pattern must only match prefixes, and if it matches a prefix, then that
    +    * match is considered a token with the same style.
    +    *
    +    * Context is applied to the last non-whitespace, non-comment token
    +    * recognized.
    +    *
    +    * Shortcut is an optional string of characters, any of which, if the first
    +    * character, gurantee that this pattern and only this pattern matches.
    +    *
    +    * @param {Array} shortcutStylePatterns patterns that always start with
    +    *   a known character.  Must have a shortcut string.
    +    * @param {Array} fallthroughStylePatterns patterns that will be tried in
    +    *   order if the shortcut ones fail.  May have shortcuts.
    +    *
    +    * @return {function (Object)} a
    +    *   function that takes source code and returns a list of decorations.
    +    */
    +  function createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns) {
    +    var shortcuts = {};
    +    var tokenizer;
    +    (function () {
    +      var allPatterns = shortcutStylePatterns.concat(fallthroughStylePatterns);
    +      var allRegexs = [];
    +      var regexKeys = {};
    +      for (var i = 0, n = allPatterns.length; i < n; ++i) {
    +        var patternParts = allPatterns[i];
    +        var shortcutChars = patternParts[3];
    +        if (shortcutChars) {
    +          for (var c = shortcutChars.length; --c >= 0;) {
    +            shortcuts[shortcutChars.charAt(c)] = patternParts;
    +          }
    +        }
    +        var regex = patternParts[1];
    +        var k = '' + regex;
    +        if (!regexKeys.hasOwnProperty(k)) {
    +          allRegexs.push(regex);
    +          regexKeys[k] = null;
    +        }
    +      }
    +      allRegexs.push(/[\0-\uffff]/);
    +      tokenizer = combinePrefixPatterns(allRegexs);
    +    })();
    +
    +    var nPatterns = fallthroughStylePatterns.length;
    +    var notWs = /\S/;
    +
    +    /**
    +     * Lexes job.source and produces an output array job.decorations of style
    +     * classes preceded by the position at which they start in job.source in
    +     * order.
    +     *
    +     * @param {Object} job an object like {@code
    +     *    source: {string} sourceText plain text,
    +     *    basePos: {int} position of job.source in the larger chunk of
    +     *        sourceCode.
    +     * }
    +     */
    +    var decorate = function (job) {
    +      var sourceCode = job.source, basePos = job.basePos;
    +      /** Even entries are positions in source in ascending order.  Odd enties
    +        * are style markers (e.g., PR_COMMENT) that run from that position until
    +        * the end.
    +        * @type {Array.<number|string>}
    +        */
    +      var decorations = [basePos, PR_PLAIN];
    +      var pos = 0;  // index into sourceCode
    +      var tokens = sourceCode.match(tokenizer) || [];
    +      var styleCache = {};
    +
    +      for (var ti = 0, nTokens = tokens.length; ti < nTokens; ++ti) {
    +        var token = tokens[ti];
    +        var style = styleCache[token];
    +        var match = void 0;
    +
    +        var isEmbedded;
    +        if (typeof style === 'string') {
    +          isEmbedded = false;
    +        } else {
    +          var patternParts = shortcuts[token.charAt(0)];
    +          if (patternParts) {
    +            match = token.match(patternParts[1]);
    +            style = patternParts[0];
    +          } else {
    +            for (var i = 0; i < nPatterns; ++i) {
    +              patternParts = fallthroughStylePatterns[i];
    +              match = token.match(patternParts[1]);
    +              if (match) {
    +                style = patternParts[0];
    +                break;
    +              }
    +            }
    +
    +            if (!match) {  // make sure that we make progress
    +              style = PR_PLAIN;
    +            }
    +          }
    +
    +          isEmbedded = style.length >= 5 && 'lang-' === style.substring(0, 5);
    +          if (isEmbedded && !(match && typeof match[1] === 'string')) {
    +            isEmbedded = false;
    +            style = PR_SOURCE;
    +          }
    +
    +          if (!isEmbedded) { styleCache[token] = style; }
    +        }
    +
    +        var tokenStart = pos;
    +        pos += token.length;
    +
    +        if (!isEmbedded) {
    +          decorations.push(basePos + tokenStart, style);
    +        } else {  // Treat group 1 as an embedded block of source code.
    +          var embeddedSource = match[1];
    +          var embeddedSourceStart = token.indexOf(embeddedSource);
    +          var embeddedSourceEnd = embeddedSourceStart + embeddedSource.length;
    +          if (match[2]) {
    +            // If embeddedSource can be blank, then it would match at the
    +            // beginning which would cause us to infinitely recurse on the
    +            // entire token, so we catch the right context in match[2].
    +            embeddedSourceEnd = token.length - match[2].length;
    +            embeddedSourceStart = embeddedSourceEnd - embeddedSource.length;
    +          }
    +          var lang = style.substring(5);
    +          // Decorate the left of the embedded source
    +          appendDecorations(
    +              basePos + tokenStart,
    +              token.substring(0, embeddedSourceStart),
    +              decorate, decorations);
    +          // Decorate the embedded source
    +          appendDecorations(
    +              basePos + tokenStart + embeddedSourceStart,
    +              embeddedSource,
    +              langHandlerForExtension(lang, embeddedSource),
    +              decorations);
    +          // Decorate the right of the embedded section
    +          appendDecorations(
    +              basePos + tokenStart + embeddedSourceEnd,
    +              token.substring(embeddedSourceEnd),
    +              decorate, decorations);
    +        }
    +      }
    +      job.decorations = decorations;
    +    };
    +    return decorate;
    +  }
    +
    +  /** returns a function that produces a list of decorations from source text.
    +    *
    +    * This code treats ", ', and ` as string delimiters, and \ as a string
    +    * escape.  It does not recognize perl's qq() style strings.
    +    * It has no special handling for double delimiter escapes as in basic, or
    +    * the tripled delimiters used in python, but should work on those regardless
    +    * although in those cases a single string literal may be broken up into
    +    * multiple adjacent string literals.
    +    *
    +    * It recognizes C, C++, and shell style comments.
    +    *
    +    * @param {Object} options a set of optional parameters.
    +    * @return {function (Object)} a function that examines the source code
    +    *     in the input job and builds the decoration list.
    +    */
    +  function sourceDecorator(options) {
    +    var shortcutStylePatterns = [], fallthroughStylePatterns = [];
    +    if (options['tripleQuotedStrings']) {
    +      // '''multi-line-string''', 'single-line-string', and double-quoted
    +      shortcutStylePatterns.push(
    +          [PR_STRING,  /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
    +           null, '\'"']);
    +    } else if (options['multiLineStrings']) {
    +      // 'multi-line-string', "multi-line-string"
    +      shortcutStylePatterns.push(
    +          [PR_STRING,  /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,
    +           null, '\'"`']);
    +    } else {
    +      // 'single-line-string', "single-line-string"
    +      shortcutStylePatterns.push(
    +          [PR_STRING,
    +           /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,
    +           null, '"\'']);
    +    }
    +    if (options['verbatimStrings']) {
    +      // verbatim-string-literal production from the C# grammar.  See issue 93.
    +      fallthroughStylePatterns.push(
    +          [PR_STRING, /^@\"(?:[^\"]|\"\")*(?:\"|$)/, null]);
    +    }
    +    if (options['hashComments']) {
    +      if (options['cStyleComments']) {
    +        // Stop C preprocessor declarations at an unclosed open comment
    +        shortcutStylePatterns.push(
    +            [PR_COMMENT, /^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,
    +             null, '#']);
    +        fallthroughStylePatterns.push(
    +            [PR_STRING,
    +             /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,
    +             null]);
    +      } else {
    +        shortcutStylePatterns.push([PR_COMMENT, /^#[^\r\n]*/, null, '#']);
    +      }
    +    }
    +    if (options['cStyleComments']) {
    +      fallthroughStylePatterns.push([PR_COMMENT, /^\/\/[^\r\n]*/, null]);
    +      fallthroughStylePatterns.push(
    +          [PR_COMMENT, /^\/\*[\s\S]*?(?:\*\/|$)/, null]);
    +    }
    +    if (options['regexLiterals']) {
    +      var REGEX_LITERAL = (
    +          // A regular expression literal starts with a slash that is
    +          // not followed by * or / so that it is not confused with
    +          // comments.
    +          '/(?=[^/*])'
    +          // and then contains any number of raw characters,
    +          + '(?:[^/\\x5B\\x5C]'
    +          // escape sequences (\x5C),
    +          +    '|\\x5C[\\s\\S]'
    +          // or non-nesting character sets (\x5B\x5D);
    +          +    '|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+'
    +          // finally closed by a /.
    +          + '/');
    +      fallthroughStylePatterns.push(
    +          ['lang-regex',
    +           new RegExp('^' + REGEXP_PRECEDER_PATTERN + '(' + REGEX_LITERAL + ')')
    +           ]);
    +    }
    +
    +    var keywords = options['keywords'].replace(/^\s+|\s+$/g, '');
    +    if (keywords.length) {
    +      fallthroughStylePatterns.push(
    +          [PR_KEYWORD,
    +           new RegExp('^(?:' + keywords.replace(/\s+/g, '|') + ')\\b'), null]);
    +    }
    +
    +    shortcutStylePatterns.push([PR_PLAIN,       /^\s+/, null, ' \r\n\t\xA0']);
    +    fallthroughStylePatterns.push(
    +        // TODO(mikesamuel): recognize non-latin letters and numerals in idents
    +        [PR_LITERAL,     /^@[a-z_$][a-z_$@0-9]*/i, null],
    +        [PR_TYPE,        /^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/, null],
    +        [PR_PLAIN,       /^[a-z_$][a-z_$@0-9]*/i, null],
    +        [PR_LITERAL,
    +         new RegExp(
    +             '^(?:'
    +             // A hex number
    +             + '0x[a-f0-9]+'
    +             // or an octal or decimal number,
    +             + '|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)'
    +             // possibly in scientific notation
    +             + '(?:e[+\\-]?\\d+)?'
    +             + ')'
    +             // with an optional modifier like UL for unsigned long
    +             + '[a-z]*', 'i'),
    +         null, '0123456789'],
    +        [PR_PUNCTUATION, /^.[^\s\w\.$@\'\"\`\/\#]*/, null]);
    +
    +    return createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns);
    +  }
    +
    +  var decorateSource = sourceDecorator({
    +        'keywords': ALL_KEYWORDS,
    +        'hashComments': true,
    +        'cStyleComments': true,
    +        'multiLineStrings': true,
    +        'regexLiterals': true
    +      });
    +
    +  /** Breaks {@code job.source} around style boundaries in
    +    * {@code job.decorations} while re-interleaving {@code job.extractedTags},
    +    * and leaves the result in {@code job.prettyPrintedHtml}.
    +    * @param {Object} job like {
    +    *    source: {string} source as plain text,
    +    *    extractedTags: {Array.<number|string>} extractedTags chunks of raw
    +    *                   html preceded by their position in {@code job.source}
    +    *                   in order
    +    *    decorations: {Array.<number|string} an array of style classes preceded
    +    *                 by the position at which they start in job.source in order
    +    * }
    +    * @private
    +    */
    +  function recombineTagsAndDecorations(job) {
    +    var sourceText = job.source;
    +    var extractedTags = job.extractedTags;
    +    var decorations = job.decorations;
    +
    +    var html = [];
    +    // index past the last char in sourceText written to html
    +    var outputIdx = 0;
    +
    +    var openDecoration = null;
    +    var currentDecoration = null;
    +    var tagPos = 0;  // index into extractedTags
    +    var decPos = 0;  // index into decorations
    +    var tabExpander = makeTabExpander(window['PR_TAB_WIDTH']);
    +
    +    var adjacentSpaceRe = /([\r\n ]) /g;
    +    var startOrSpaceRe = /(^| ) /gm;
    +    var newlineRe = /\r\n?|\n/g;
    +    var trailingSpaceRe = /[ \r\n]$/;
    +    var lastWasSpace = true;  // the last text chunk emitted ended with a space.
    +
    +    // See bug 71 and http://stackoverflow.com/questions/136443/why-doesnt-ie7-
    +    var isIE678 = window['_pr_isIE6']();
    +    var lineBreakHtml = (
    +        isIE678
    +        ? (job.sourceNode.tagName === 'PRE'
    +           // Use line feeds instead of <br>s so that copying and pasting works
    +           // on IE.
    +           // Doing this on other browsers breaks lots of stuff since \r\n is
    +           // treated as two newlines on Firefox.
    +           ? (isIE678 === 6 ? '&#160;\r\n' :
    +              isIE678 === 7 ? '&#160;<br>\r' : '&#160;\r')
    +           // IE collapses multiple adjacent <br>s into 1 line break.
    +           // Prefix every newline with '&#160;' to prevent such behavior.
    +           // &nbsp; is the same as &#160; but works in XML as well as HTML.
    +           : '&#160;<br />')
    +        : '<br />');
    +
    +    // Look for a class like linenums or linenums:<n> where <n> is the 1-indexed
    +    // number of the first line.
    +    var numberLines = job.sourceNode.className.match(/\blinenums\b(?::(\d+))?/);
    +    var lineBreaker;
    +    if (numberLines) {
    +      var lineBreaks = [];
    +      for (var i = 0; i < 10; ++i) {
    +        lineBreaks[i] = lineBreakHtml + '</li><li class="L' + i + '">';
    +      }
    +      var lineNum = numberLines[1] && numberLines[1].length 
    +          ? numberLines[1] - 1 : 0;  // Lines are 1-indexed
    +      html.push('<ol class="linenums"><li class="L', (lineNum) % 10, '"');
    +      if (lineNum) {
    +        html.push(' value="', lineNum + 1, '"');
    +      }
    +      html.push('>');
    +      lineBreaker = function () {
    +        var lb = lineBreaks[++lineNum % 10];
    +        // If a decoration is open, we need to close it before closing a list-item
    +        // and reopen it on the other side of the list item.
    +        return openDecoration
    +            ? ('</span>' + lb + '<span class="' + openDecoration + '">') : lb;
    +      };
    +    } else {
    +      lineBreaker = lineBreakHtml;
    +    }
    +
    +    // A helper function that is responsible for opening sections of decoration
    +    // and outputing properly escaped chunks of source
    +    function emitTextUpTo(sourceIdx) {
    +      if (sourceIdx > outputIdx) {
    +        if (openDecoration && openDecoration !== currentDecoration) {
    +          // Close the current decoration
    +          html.push('</span>');
    +          openDecoration = null;
    +        }
    +        if (!openDecoration && currentDecoration) {
    +          openDecoration = currentDecoration;
    +          html.push('<span class="', openDecoration, '">');
    +        }
    +        // This interacts badly with some wikis which introduces paragraph tags
    +        // into pre blocks for some strange reason.
    +        // It's necessary for IE though which seems to lose the preformattedness
    +        // of <pre> tags when their innerHTML is assigned.
    +        // http://stud3.tuwien.ac.at/~e0226430/innerHtmlQuirk.html
    +        // and it serves to undo the conversion of <br>s to newlines done in
    +        // chunkify.
    +        var htmlChunk = textToHtml(
    +            tabExpander(sourceText.substring(outputIdx, sourceIdx)))
    +            .replace(lastWasSpace
    +                     ? startOrSpaceRe
    +                     : adjacentSpaceRe, '$1&#160;');
    +        // Keep track of whether we need to escape space at the beginning of the
    +        // next chunk.
    +        lastWasSpace = trailingSpaceRe.test(htmlChunk);
    +        html.push(htmlChunk.replace(newlineRe, lineBreaker));
    +        outputIdx = sourceIdx;
    +      }
    +    }
    +
    +    while (true) {
    +      // Determine if we're going to consume a tag this time around.  Otherwise
    +      // we consume a decoration or exit.
    +      var outputTag;
    +      if (tagPos < extractedTags.length) {
    +        if (decPos < decorations.length) {
    +          // Pick one giving preference to extractedTags since we shouldn't open
    +          // a new style that we're going to have to immediately close in order
    +          // to output a tag.
    +          outputTag = extractedTags[tagPos] <= decorations[decPos];
    +        } else {
    +          outputTag = true;
    +        }
    +      } else {
    +        outputTag = false;
    +      }
    +      // Consume either a decoration or a tag or exit.
    +      if (outputTag) {
    +        emitTextUpTo(extractedTags[tagPos]);
    +        if (openDecoration) {
    +          // Close the current decoration
    +          html.push('</span>');
    +          openDecoration = null;
    +        }
    +        html.push(extractedTags[tagPos + 1]);
    +        tagPos += 2;
    +      } else if (decPos < decorations.length) {
    +        emitTextUpTo(decorations[decPos]);
    +        currentDecoration = decorations[decPos + 1];
    +        decPos += 2;
    +      } else {
    +        break;
    +      }
    +    }
    +    emitTextUpTo(sourceText.length);
    +    if (openDecoration) {
    +      html.push('</span>');
    +    }
    +    if (numberLines) { html.push('</li></ol>'); }
    +    job.prettyPrintedHtml = html.join('');
    +  }
    +
    +  /** Maps language-specific file extensions to handlers. */
    +  var langHandlerRegistry = {};
    +  /** Register a language handler for the given file extensions.
    +    * @param {function (Object)} handler a function from source code to a list
    +    *      of decorations.  Takes a single argument job which describes the
    +    *      state of the computation.   The single parameter has the form
    +    *      {@code {
    +    *        source: {string} as plain text.
    +    *        decorations: {Array.<number|string>} an array of style classes
    +    *                     preceded by the position at which they start in
    +    *                     job.source in order.
    +    *                     The language handler should assigned this field.
    +    *        basePos: {int} the position of source in the larger source chunk.
    +    *                 All positions in the output decorations array are relative
    +    *                 to the larger source chunk.
    +    *      } }
    +    * @param {Array.<string>} fileExtensions
    +    */
    +  function registerLangHandler(handler, fileExtensions) {
    +    for (var i = fileExtensions.length; --i >= 0;) {
    +      var ext = fileExtensions[i];
    +      if (!langHandlerRegistry.hasOwnProperty(ext)) {
    +        langHandlerRegistry[ext] = handler;
    +      } else if ('console' in window) {
    +        console['warn']('cannot override language handler %s', ext);
    +      }
    +    }
    +  }
    +  function langHandlerForExtension(extension, source) {
    +    if (!(extension && langHandlerRegistry.hasOwnProperty(extension))) {
    +      // Treat it as markup if the first non whitespace character is a < and
    +      // the last non-whitespace character is a >.
    +      extension = /^\s*</.test(source)
    +          ? 'default-markup'
    +          : 'default-code';
    +    }
    +    return langHandlerRegistry[extension];
    +  }
    +  registerLangHandler(decorateSource, ['default-code']);
    +  registerLangHandler(
    +      createSimpleLexer(
    +          [],
    +          [
    +           [PR_PLAIN,       /^[^<?]+/],
    +           [PR_DECLARATION, /^<!\w[^>]*(?:>|$)/],
    +           [PR_COMMENT,     /^<\!--[\s\S]*?(?:-\->|$)/],
    +           // Unescaped content in an unknown language
    +           ['lang-',        /^<\?([\s\S]+?)(?:\?>|$)/],
    +           ['lang-',        /^<%([\s\S]+?)(?:%>|$)/],
    +           [PR_PUNCTUATION, /^(?:<[%?]|[%?]>)/],
    +           ['lang-',        /^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],
    +           // Unescaped content in javascript.  (Or possibly vbscript).
    +           ['lang-js',      /^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],
    +           // Contains unescaped stylesheet content
    +           ['lang-css',     /^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],
    +           ['lang-in.tag',  /^(<\/?[a-z][^<>]*>)/i]
    +          ]),
    +      ['default-markup', 'htm', 'html', 'mxml', 'xhtml', 'xml', 'xsl']);
    +  registerLangHandler(
    +      createSimpleLexer(
    +          [
    +           [PR_PLAIN,        /^[\s]+/, null, ' \t\r\n'],
    +           [PR_ATTRIB_VALUE, /^(?:\"[^\"]*\"?|\'[^\']*\'?)/, null, '\"\'']
    +           ],
    +          [
    +           [PR_TAG,          /^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],
    +           [PR_ATTRIB_NAME,  /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],
    +           ['lang-uq.val',   /^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],
    +           [PR_PUNCTUATION,  /^[=<>\/]+/],
    +           ['lang-js',       /^on\w+\s*=\s*\"([^\"]+)\"/i],
    +           ['lang-js',       /^on\w+\s*=\s*\'([^\']+)\'/i],
    +           ['lang-js',       /^on\w+\s*=\s*([^\"\'>\s]+)/i],
    +           ['lang-css',      /^style\s*=\s*\"([^\"]+)\"/i],
    +           ['lang-css',      /^style\s*=\s*\'([^\']+)\'/i],
    +           ['lang-css',      /^style\s*=\s*([^\"\'>\s]+)/i]
    +           ]),
    +      ['in.tag']);
    +  registerLangHandler(
    +      createSimpleLexer([], [[PR_ATTRIB_VALUE, /^[\s\S]+/]]), ['uq.val']);
    +  registerLangHandler(sourceDecorator({
    +          'keywords': CPP_KEYWORDS,
    +          'hashComments': true,
    +          'cStyleComments': true
    +        }), ['c', 'cc', 'cpp', 'cxx', 'cyc', 'm']);
    +  registerLangHandler(sourceDecorator({
    +          'keywords': 'null true false'
    +        }), ['json']);
    +  registerLangHandler(sourceDecorator({
    +          'keywords': CSHARP_KEYWORDS,
    +          'hashComments': true,
    +          'cStyleComments': true,
    +          'verbatimStrings': true
    +        }), ['cs']);
    +  registerLangHandler(sourceDecorator({
    +          'keywords': JAVA_KEYWORDS,
    +          'cStyleComments': true
    +        }), ['java']);
    +  registerLangHandler(sourceDecorator({
    +          'keywords': SH_KEYWORDS,
    +          'hashComments': true,
    +          'multiLineStrings': true
    +        }), ['bsh', 'csh', 'sh']);
    +  registerLangHandler(sourceDecorator({
    +          'keywords': PYTHON_KEYWORDS,
    +          'hashComments': true,
    +          'multiLineStrings': true,
    +          'tripleQuotedStrings': true
    +        }), ['cv', 'py']);
    +  registerLangHandler(sourceDecorator({
    +          'keywords': PERL_KEYWORDS,
    +          'hashComments': true,
    +          'multiLineStrings': true,
    +          'regexLiterals': true
    +        }), ['perl', 'pl', 'pm']);
    +  registerLangHandler(sourceDecorator({
    +          'keywords': RUBY_KEYWORDS,
    +          'hashComments': true,
    +          'multiLineStrings': true,
    +          'regexLiterals': true
    +        }), ['rb']);
    +  registerLangHandler(sourceDecorator({
    +          'keywords': JSCRIPT_KEYWORDS,
    +          'cStyleComments': true,
    +          'regexLiterals': true
    +        }), ['js']);
    +  registerLangHandler(
    +      createSimpleLexer([], [[PR_STRING, /^[\s\S]+/]]), ['regex']);
    +
    +  function applyDecorator(job) {
    +    var sourceCodeHtml = job.sourceCodeHtml;
    +    var opt_langExtension = job.langExtension;
    +
    +    // Prepopulate output in case processing fails with an exception.
    +    job.prettyPrintedHtml = sourceCodeHtml;
    +
    +    try {
    +      // Extract tags, and convert the source code to plain text.
    +      var sourceAndExtractedTags = extractTags(sourceCodeHtml);
    +      /** Plain text. @type {string} */
    +      var source = sourceAndExtractedTags.source;
    +      job.source = source;
    +      job.basePos = 0;
    +
    +      /** Even entries are positions in source in ascending order.  Odd entries
    +        * are tags that were extracted at that position.
    +        * @type {Array.<number|string>}
    +        */
    +      job.extractedTags = sourceAndExtractedTags.tags;
    +
    +      // Apply the appropriate language handler
    +      langHandlerForExtension(opt_langExtension, source)(job);
    +      // Integrate the decorations and tags back into the source code to produce
    +      // a decorated html string which is left in job.prettyPrintedHtml.
    +      recombineTagsAndDecorations(job);
    +    } catch (e) {
    +      if ('console' in window) {
    +        console['log'](e && e['stack'] ? e['stack'] : e);
    +      }
    +    }
    +  }
    +
    +  function prettyPrintOne(sourceCodeHtml, opt_langExtension) {
    +    var job = {
    +      sourceCodeHtml: sourceCodeHtml,
    +      langExtension: opt_langExtension
    +    };
    +    applyDecorator(job);
    +    return job.prettyPrintedHtml;
    +  }
    +
    +  function prettyPrint(opt_whenDone) {
    +    function byTagName(tn) { return document.getElementsByTagName(tn); }
    +    // fetch a list of nodes to rewrite
    +    var codeSegments = [byTagName('pre'), byTagName('code'), byTagName('xmp')];
    +    var elements = [];
    +    for (var i = 0; i < codeSegments.length; ++i) {
    +      for (var j = 0, n = codeSegments[i].length; j < n; ++j) {
    +        elements.push(codeSegments[i][j]);
    +      }
    +    }
    +    codeSegments = null;
    +
    +    var clock = Date;
    +    if (!clock['now']) {
    +      clock = { 'now': function () { return (new Date).getTime(); } };
    +    }
    +
    +    // The loop is broken into a series of continuations to make sure that we
    +    // don't make the browser unresponsive when rewriting a large page.
    +    var k = 0;
    +    var prettyPrintingJob;
    +
    +    function doWork() {
    +      var endTime = (window['PR_SHOULD_USE_CONTINUATION'] ?
    +                     clock.now() + 250 /* ms */ :
    +                     Infinity);
    +      for (; k < elements.length && clock.now() < endTime; k++) {
    +        var cs = elements[k];
    +        // [JACOCO] 'prettyprint' -> 'source' 
    +        if (cs.className && cs.className.indexOf('source') >= 0) {
    +          // If the classes includes a language extensions, use it.
    +          // Language extensions can be specified like
    +          //     <pre class="prettyprint lang-cpp">
    +          // the language extension "cpp" is used to find a language handler as
    +          // passed to PR_registerLangHandler.
    +          var langExtension = cs.className.match(/\blang-(\w+)\b/);
    +          if (langExtension) { langExtension = langExtension[1]; }
    +
    +          // make sure this is not nested in an already prettified element
    +          var nested = false;
    +          for (var p = cs.parentNode; p; p = p.parentNode) {
    +            if ((p.tagName === 'pre' || p.tagName === 'code' ||
    +                 p.tagName === 'xmp') &&
    +                // [JACOCO] 'prettyprint' -> 'source' 
    +                p.className && p.className.indexOf('source') >= 0) {
    +              nested = true;
    +              break;
    +            }
    +          }
    +          if (!nested) {
    +            // fetch the content as a snippet of properly escaped HTML.
    +            // Firefox adds newlines at the end.
    +            var content = getInnerHtml(cs);
    +            content = content.replace(/(?:\r\n?|\n)$/, '');
    +
    +            // do the pretty printing
    +            prettyPrintingJob = {
    +              sourceCodeHtml: content,
    +              langExtension: langExtension,
    +              sourceNode: cs
    +            };
    +            applyDecorator(prettyPrintingJob);
    +            replaceWithPrettyPrintedHtml();
    +          }
    +        }
    +      }
    +      if (k < elements.length) {
    +        // finish up in a continuation
    +        setTimeout(doWork, 250);
    +      } else if (opt_whenDone) {
    +        opt_whenDone();
    +      }
    +    }
    +
    +    function replaceWithPrettyPrintedHtml() {
    +      var newContent = prettyPrintingJob.prettyPrintedHtml;
    +      if (!newContent) { return; }
    +      var cs = prettyPrintingJob.sourceNode;
    +
    +      // push the prettified html back into the tag.
    +      if (!isRawContent(cs)) {
    +        // just replace the old html with the new
    +        cs.innerHTML = newContent;
    +      } else {
    +        // we need to change the tag to a <pre> since <xmp>s do not allow
    +        // embedded tags such as the span tags used to attach styles to
    +        // sections of source code.
    +        var pre = document.createElement('PRE');
    +        for (var i = 0; i < cs.attributes.length; ++i) {
    +          var a = cs.attributes[i];
    +          if (a.specified) {
    +            var aname = a.name.toLowerCase();
    +            if (aname === 'class') {
    +              pre.className = a.value;  // For IE 6
    +            } else {
    +              pre.setAttribute(a.name, a.value);
    +            }
    +          }
    +        }
    +        pre.innerHTML = newContent;
    +
    +        // remove the old
    +        cs.parentNode.replaceChild(pre, cs);
    +        cs = pre;
    +      }
    +    }
    +
    +    doWork();
    +  }
    +
    +  window['PR_normalizedHtml'] = normalizedHtml;
    +  window['prettyPrintOne'] = prettyPrintOne;
    +  window['prettyPrint'] = prettyPrint;
    +  window['PR'] = {
    +        'combinePrefixPatterns': combinePrefixPatterns,
    +        'createSimpleLexer': createSimpleLexer,
    +        'registerLangHandler': registerLangHandler,
    +        'sourceDecorator': sourceDecorator,
    +        'PR_ATTRIB_NAME': PR_ATTRIB_NAME,
    +        'PR_ATTRIB_VALUE': PR_ATTRIB_VALUE,
    +        'PR_COMMENT': PR_COMMENT,
    +        'PR_DECLARATION': PR_DECLARATION,
    +        'PR_KEYWORD': PR_KEYWORD,
    +        'PR_LITERAL': PR_LITERAL,
    +        'PR_NOCODE': PR_NOCODE,
    +        'PR_PLAIN': PR_PLAIN,
    +        'PR_PUNCTUATION': PR_PUNCTUATION,
    +        'PR_SOURCE': PR_SOURCE,
    +        'PR_STRING': PR_STRING,
    +        'PR_TAG': PR_TAG,
    +        'PR_TYPE': PR_TYPE
    +      };
    +})();
    diff --git a/doc/jacoco-resources/redbar.gif b/doc/jacoco-resources/redbar.gif
    new file mode 100644
    index 0000000000000000000000000000000000000000..c2f71469ba995289439d86ea39b1b33edb03388c
    GIT binary patch
    literal 91
    zcmZ?wbhEHbWMtrCc+AD{pP&D~tn7aso&R25|6^nS*Vg{;>G{84!T)8;{;yfXu$BQ0
    fDgI<(<YM4w&|v@qkQodt90ol_LPjnP91PX~3&9+X
    
    literal 0
    HcmV?d00001
    
    diff --git a/doc/jacoco-resources/report.css b/doc/jacoco-resources/report.css
    new file mode 100644
    index 00000000..08eba792
    --- /dev/null
    +++ b/doc/jacoco-resources/report.css
    @@ -0,0 +1,243 @@
    +body, td {
    +  font-family:sans-serif;
    +  font-size:10pt;
    +}
    +
    +h1 {
    +  font-weight:bold;
    +  font-size:18pt;
    +}
    +
    +.breadcrumb {
    +  border:#d6d3ce 1px solid;
    +  padding:2px 4px 2px 4px;
    +}
    +
    +.breadcrumb .info {
    +  float:right;
    +}
    +
    +.breadcrumb .info a {
    +  margin-left:8px;
    +}
    +
    +.el_report {
    +  padding-left:18px;
    +  background-image:url(report.gif);
    +  background-position:left center;
    +  background-repeat:no-repeat;
    +}
    +
    +.el_group {
    +  padding-left:18px;
    +  background-image:url(group.gif);
    +  background-position:left center;
    +  background-repeat:no-repeat;
    +}
    +
    +.el_bundle {
    +  padding-left:18px;
    +  background-image:url(bundle.gif);
    +  background-position:left center;
    +  background-repeat:no-repeat;
    +}
    +
    +.el_package {
    +  padding-left:18px;
    +  background-image:url(package.gif);
    +  background-position:left center;
    +  background-repeat:no-repeat;
    +}
    +
    +.el_class {
    +  padding-left:18px;
    +  background-image:url(class.gif);
    +  background-position:left center;
    +  background-repeat:no-repeat;
    +}
    +
    +.el_source {
    +  padding-left:18px;
    +  background-image:url(source.gif);
    +  background-position:left center;
    +  background-repeat:no-repeat;
    +}
    +
    +.el_method {
    +  padding-left:18px;
    +  background-image:url(method.gif);
    +  background-position:left center;
    +  background-repeat:no-repeat;
    +}
    +
    +.el_session {
    +  padding-left:18px;
    +  background-image:url(session.gif);
    +  background-position:left center;
    +  background-repeat:no-repeat;
    +}
    +
    +pre.source {
    +  border:#d6d3ce 1px solid;
    +  font-family:monospace;
    +}
    +
    +pre.source ol {
    +  margin-bottom: 0px;
    +  margin-top: 0px;
    +}
    +
    +pre.source li {
    +  border-left: 1px solid #D6D3CE;
    +  color: #A0A0A0;
    +  padding-left: 0px;
    +}
    +
    +pre.source span.fc {
    +  background-color:#ccffcc;
    +}
    +
    +pre.source span.nc {
    +  background-color:#ffaaaa;
    +}
    +
    +pre.source span.pc {
    +  background-color:#ffffcc;
    +}
    +
    +pre.source span.bfc {
    +  background-image: url(branchfc.gif);
    +  background-repeat: no-repeat;
    +  background-position: 2px center;
    +}
    +
    +pre.source span.bfc:hover {
    +  background-color:#80ff80;
    +}
    +
    +pre.source span.bnc {
    +  background-image: url(branchnc.gif);
    +  background-repeat: no-repeat;
    +  background-position: 2px center;
    +}
    +
    +pre.source span.bnc:hover {
    +  background-color:#ff8080;
    +}
    +
    +pre.source span.bpc {
    +  background-image: url(branchpc.gif);
    +  background-repeat: no-repeat;
    +  background-position: 2px center;
    +}
    +
    +pre.source span.bpc:hover {
    +  background-color:#ffff80;
    +}
    +
    +table.coverage {
    +  empty-cells:show;
    +  border-collapse:collapse; 
    +}
    +
    +table.coverage thead {
    +  background-color:#e0e0e0;
    +}
    +
    +table.coverage thead td {
    +  white-space:nowrap;
    +  padding:2px 14px 0px 6px;
    +  border-bottom:#b0b0b0 1px solid;
    +}
    +
    +table.coverage thead td.bar {
    +  border-left:#cccccc 1px solid;
    +}
    +
    +table.coverage thead td.ctr1 {
    +  text-align:right;
    +  border-left:#cccccc 1px solid;
    +}
    +
    +table.coverage thead td.ctr2 {
    +  text-align:right;
    +  padding-left:2px;
    +}
    +
    +table.coverage thead td.sortable {
    +  cursor:pointer;
    +  background-image:url(sort.gif);
    +  background-position:right center;
    +  background-repeat:no-repeat;
    +}
    +
    +table.coverage thead td.up {
    +  background-image:url(up.gif);
    +}
    +
    +table.coverage thead td.down {
    +  background-image:url(down.gif);
    +}
    +
    +table.coverage tbody td {
    +  white-space:nowrap;
    +  padding:2px 6px 2px 6px;
    +  border-bottom:#d6d3ce 1px solid;
    +}
    +
    +table.coverage tbody tr:hover { 
    +  background: #f0f0d0 !important;
    +}
    +
    +table.coverage tbody td.bar {
    +  border-left:#e8e8e8 1px solid;
    +}
    +
    +table.coverage tbody td.ctr1 {
    +  text-align:right;
    +  padding-right:14px;
    +  border-left:#e8e8e8 1px solid;
    +}
    +
    +table.coverage tbody td.ctr2 {
    +  text-align:right;
    +  padding-right:14px;
    +  padding-left:2px;
    +}
    +
    +table.coverage tfoot td {
    +  white-space:nowrap;
    +  padding:2px 6px 2px 6px;
    +}
    +
    +table.coverage tfoot td.bar {
    +  border-left:#e8e8e8 1px solid;
    +}
    +
    +table.coverage tfoot td.ctr1 {
    +  text-align:right;
    +  padding-right:14px;
    +  border-left:#e8e8e8 1px solid;
    +}
    +
    +table.coverage tfoot td.ctr2 {
    +  text-align:right;
    +  padding-right:14px;
    +  padding-left:2px;
    +}
    +
    +.footer {
    +  margin-top:20px;
    +  border-top:#d6d3ce 1px solid;
    +  padding-top:2px;
    +  font-size:8pt;
    +  color:#a0a0a0;
    +}
    +
    +.footer a {
    +  color:#a0a0a0;
    +}
    +
    +.right {
    +  float:right;
    +}
    diff --git a/doc/jacoco-resources/report.gif b/doc/jacoco-resources/report.gif
    new file mode 100644
    index 0000000000000000000000000000000000000000..8547be50bf3e97e725920927b5aa4cdb031f4823
    GIT binary patch
    literal 363
    zcmZ?wbhEHb6krfwSZc{In}J~s1H&!`1_uX+xVSjMb&S>db~X8S)dhAn1$OlXwvB~0
    zO@%hC#Wq5_7&^+V`^qgRRa;E2HJ?*&DsqWoev|2fCetO&CQDmPR<;_iXfs~ZZnVC`
    za8s8-+pK*(^AAm4c5K#~(^ocST-lU)byMc8y)_R`^xu2&{oaco_g{R!|Ki8Pmp>lA
    z{_*VHkC*R%zWMa)!{^_hzyAL8?f2(zzrTL}{q@K1Z$Ey2|M}<VuRs5>0mYvzj9d)%
    z3_1)z0P+(9TgQR<1s*zF)+bahX*_u_??Pbv&V#KE^V2&`bhGjjR;*MxC8EFO_3_}<
    zH?w9WrJ7AX`tJM8r525X{~8+WorLsRL^?W{nR=L*odosT`KItOGtTI963}JgV_m??
    z%&>&9-=1G*^3>@wm-A|~FmK+nbvd`DhNhP0UUhXIS1vYAPL5-o?Ce}VXI&i`tO1G(
    BvdRDe
    
    literal 0
    HcmV?d00001
    
    diff --git a/doc/jacoco-resources/session.gif b/doc/jacoco-resources/session.gif
    new file mode 100644
    index 0000000000000000000000000000000000000000..0151bad8a001e5cc5cc7723a608185f746b7f8c1
    GIT binary patch
    literal 213
    zcmZ?wbhEHb6krfwXc1xPS$gU4xw~t2pG#?5#^Be>V3WrXI-S9<hrzA(|Nr^_@5k?-
    zZ~y=IhyVNSXZ04}pKqV%t9oe5k~tY+Ar=Pzi2#Z}Sr{1@<Qa4rfB<AC18dL&^}dwM
    zX_r*ys<8N;e6mS?i^dP8jVmAd@U^}&$uv>xc~m$hYN?d{@xrG~CzZCfhpBIRC}Q>I
    kiQ?_Ai=3VZEOFW9fBwaksdwMK(Err)E%VcVRYeAC06w^MK>z>%
    
    literal 0
    HcmV?d00001
    
    diff --git a/doc/jacoco-resources/sort.gif b/doc/jacoco-resources/sort.gif
    new file mode 100644
    index 0000000000000000000000000000000000000000..6757c2c32b57d768f3c12c4ae99a28bc32c9cbd7
    GIT binary patch
    literal 58
    zcmZ?wbhEHb<YC}qXkcX6uwldh|Nj+#vM_QnFf!;c00|xjP6h@h!JfpGjC*fB>i!bx
    N`t(%z_h<$NYXI&b5{m!;
    
    literal 0
    HcmV?d00001
    
    diff --git a/doc/jacoco-resources/sort.js b/doc/jacoco-resources/sort.js
    new file mode 100644
    index 00000000..26668cc3
    --- /dev/null
    +++ b/doc/jacoco-resources/sort.js
    @@ -0,0 +1,147 @@
    +/*******************************************************************************
    + * Copyright (c) 2009, 2017 Mountainminds GmbH & Co. KG and Contributors
    + * All rights reserved. This program and the accompanying materials
    + * are made available under the terms of the Eclipse Public License v1.0
    + * which accompanies this distribution, and is available at
    + * http://www.eclipse.org/legal/epl-v10.html
    + *
    + * Contributors:
    + *    Marc R. Hoffmann - initial API and implementation
    + *    
    + *******************************************************************************/
    +
    +(function () {
    +
    +  /**
    +   * Sets the initial sorting derived from the hash.
    +   *
    +   * @param linkelementids
    +   *          list of element ids to search for links to add sort inidcator
    +   *          hash links   
    +   */  
    +  function initialSort(linkelementids) {
    +    window.linkelementids = linkelementids;
    +    var hash = window.location.hash;
    +    if (hash) {
    +      var m = hash.match(/up-./);
    +      if (m) {
    +        var header = window.document.getElementById(m[0].charAt(3));
    +        if (header) {
    +          sortColumn(header, true);
    +        }
    +        return;
    +      }
    +      var m = hash.match(/dn-./);
    +      if (m) {
    +        var header = window.document.getElementById(m[0].charAt(3));
    +        if (header) {
    +          sortColumn(header, false);
    +        }
    +        return
    +      }
    +    }
    +  }
    +
    +  /**
    +   * Sorts the columns with the given header dependening on the current sort state.
    +   */  
    +  function toggleSort(header) {
    +    var sortup = header.className.indexOf('down ') == 0;
    +    sortColumn(header, sortup);
    +  }
    +
    +  /**
    +   * Sorts the columns with the given header in the given direction.
    +   */  
    +  function sortColumn(header, sortup) {
    +    var table = header.parentNode.parentNode.parentNode;
    +    var body = table.tBodies[0];
    +    var colidx = getNodePosition(header);
    +    
    +    resetSortedStyle(table);
    +    
    +    var rows = body.rows;
    +    var sortedrows = [];
    +    for (var i = 0; i < rows.length; i++) {
    +      r = rows[i];
    +      sortedrows[parseInt(r.childNodes[colidx].id.slice(1))] = r;
    +    }
    +    
    +    var hash;
    +    
    +    if (sortup) {
    +      for (var i = sortedrows.length - 1; i >= 0; i--) {
    +        body.appendChild(sortedrows[i]);
    +      }
    +      header.className = 'up ' + header.className;
    +      hash = 'up-' + header.id;
    +    } else {
    +      for (var i = 0; i < sortedrows.length; i++) {
    +        body.appendChild(sortedrows[i]);
    +      }
    +      header.className = 'down ' + header.className;
    +      hash = 'dn-' + header.id;
    +    }
    +    
    +    setHash(hash);
    +  }
    +
    +  /**
    +   * Adds the sort indicator as a hash to the document URL and all links.
    +   */
    +  function setHash(hash) {
    +    window.document.location.hash = hash;
    +    ids = window.linkelementids;
    +    for (var i = 0; i < ids.length; i++) {
    +        setHashOnAllLinks(document.getElementById(ids[i]), hash);
    +    }
    +  }
    +
    +  /**
    +   * Extend all links within the given tag with the given hash.
    +   */
    +  function setHashOnAllLinks(tag, hash) {
    +    links = tag.getElementsByTagName("a");
    +    for (var i = 0; i < links.length; i++) {
    +        var a = links[i];
    +        var href = a.href;
    +        var hashpos = href.indexOf("#");
    +        if (hashpos != -1) {
    +            href = href.substring(0, hashpos);
    +        } 
    +        a.href = href + "#" + hash;
    +    }
    +  }
    +
    +  /**
    +   * Calculates the position of a element within its parent.
    +   */  
    +  function getNodePosition(element) {
    +    var pos = -1;
    +    while (element) {
    +      element = element.previousSibling;
    +      pos++;
    +    }
    +    return pos;
    +  }
    +
    +  /**
    +   * Remove the sorting indicator style from all headers.
    +   */
    +  function resetSortedStyle(table) {
    +    for (var c = table.tHead.firstChild.firstChild; c; c = c.nextSibling) {
    +      if (c.className) {
    +        if (c.className.indexOf('down ') == 0) {
    +          c.className = c.className.slice(5);
    +        }
    +        if (c.className.indexOf('up ') == 0) {
    +          c.className = c.className.slice(3);
    +        }
    +      }
    +    }
    +  }
    +  
    +  window['initialSort'] = initialSort;
    +  window['toggleSort'] = toggleSort;
    +
    +})();
    \ No newline at end of file
    diff --git a/doc/jacoco-resources/source.gif b/doc/jacoco-resources/source.gif
    new file mode 100644
    index 0000000000000000000000000000000000000000..b226e41c5276581db33d71525298ef572cc5d7ce
    GIT binary patch
    literal 354
    zcmZ?wbhEHb6krfwxXQrr`Rnf=KmWY@^y|~t-#>r-`SJ62+pK*(^ACOa@_X{KW3$$r
    zUbOlAiXE5N?74dH#gDtszu$lH{mGl3&)@xg`{~!`Z@=#VMPB~6_u~7*S3h2T`1$R}
    z?`Q9Re)#(P)3@JWfBgRb^LKTLe^s%6bxA;7sb4jaQ5?`-<<ng5TVLWgvEHM%)~l!1
    zYi_IS^d`3r{dQ}59F})EE$?<()ZzT#ME{lvwpTV~T-lU)Yj4ffO_~4y|7XAeia%Kx
    z85k@XbU-p7KQXY?ADC0%p(B)eLgkXi62W-^(!DQ#v2a~Gz-z9%&!+3h!38t#X02Ds
    zad;WPFvUVOY)YY2k84HG1kp%gVW!3wVI5ap$%?8ZHc4GqO=+PiQzvV>Y72H(vk7Xs
    us!1$fvP8{QU92ZrK%7tARasP&f6JDw8m_8J3W|I7DyXXX9C3DJum%7=h^`F)
    
    literal 0
    HcmV?d00001
    
    diff --git a/doc/jacoco-resources/up.gif b/doc/jacoco-resources/up.gif
    new file mode 100644
    index 0000000000000000000000000000000000000000..58ed21660ec467736a4d2af17d91341f7cfb556c
    GIT binary patch
    literal 67
    zcmZ?wbhEHb<YC}qSjfcSX{EDa!-oH0p!k!8k&A(eL5G2Xk%5PSlYxOrWJ=;nroA^G
    Ub$^Kz-Nct)ygK&ScM%3_0PmU?SpWb4
    
    literal 0
    HcmV?d00001
    
    diff --git a/doc/jacoco-sessions.html b/doc/jacoco-sessions.html
    new file mode 100644
    index 00000000..18480b99
    --- /dev/null
    +++ b/doc/jacoco-sessions.html
    @@ -0,0 +1 @@
    +<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="jacoco-resources/report.gif" type="image/gif"/><title>Sessions</title></head><body><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="jacoco-sessions.html" class="el_session">Sessions</a></span><a href="index.html" class="el_report">Merged (Apr 21, 2018 5:41:32 PM)</a> &gt; <span class="el_session">Sessions</span></div><h1>Sessions</h1><p>This coverage report is based on execution data from the following sessions:</p><table class="coverage" cellspacing="0"><thead><tr><td>Session</td><td>Start Time</td><td>Dump Time</td></tr></thead><tbody><tr><td><span class="el_session">DESKTOP-FAVRCKB-98ce663c</span></td><td>Apr 21, 2018 5:38:08 PM</td><td>Apr 21, 2018 5:38:09 PM</td></tr><tr><td><span class="el_session">DESKTOP-FAVRCKB-4c8afdbd</span></td><td>Apr 21, 2018 5:39:15 PM</td><td>Apr 21, 2018 5:39:16 PM</td></tr><tr><td><span class="el_session">DESKTOP-FAVRCKB-9abea9c6</span></td><td>Apr 21, 2018 5:40:27 PM</td><td>Apr 21, 2018 5:40:28 PM</td></tr><tr><td><span class="el_session">DESKTOP-FAVRCKB-60d2472d</span></td><td>Apr 21, 2018 5:41:24 PM</td><td>Apr 21, 2018 5:41:24 PM</td></tr></tbody></table><p>Execution data for the following classes is considered in this report:</p><table class="coverage" cellspacing="0"><thead><tr><td>Class</td><td>Id</td></tr></thead><tbody><tr><td><a href="codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfElement.html" class="el_class">codemetropolis.toolchain.commons.cdf.CdfElement</a></td><td><code>bf3c92ec94b02ec2</code></td></tr><tr><td><a href="codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty.html" class="el_class">codemetropolis.toolchain.commons.cdf.CdfProperty</a></td><td><code>1ed9487d37f75af8</code></td></tr><tr><td><a href="codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfProperty$Type.html" class="el_class">codemetropolis.toolchain.commons.cdf.CdfProperty.Type</a></td><td><code>28ecd0740c647ff1</code></td></tr><tr><td><a href="codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf/CdfTree.html" class="el_class">codemetropolis.toolchain.commons.cdf.CdfTree</a></td><td><code>7bbb9049bd258c8f</code></td></tr><tr><td><a href="codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cdf.converter/CdfConverter.html" class="el_class">codemetropolis.toolchain.commons.cdf.converter.CdfConverter</a></td><td><code>b714575a0abec7c7</code></td></tr><tr><td><a href="codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable.html" class="el_class">codemetropolis.toolchain.commons.cmxml.Buildable</a></td><td><code>8dd9fcf83b798084</code></td></tr><tr><td><a href="codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Buildable$Type.html" class="el_class">codemetropolis.toolchain.commons.cmxml.Buildable.Type</a></td><td><code>a340d5dbd346950d</code></td></tr><tr><td><a href="codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.cmxml/Point.html" class="el_class">codemetropolis.toolchain.commons.cmxml.Point</a></td><td><code>ad8717ecf2bd20cd</code></td></tr><tr><td><a href="codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.exceptions/CodeMetropolisException.html" class="el_class">codemetropolis.toolchain.commons.exceptions.CodeMetropolisException</a></td><td><code>e3231a9442b3fc1a</code></td></tr><tr><td><a href="codemetropolis-toolchain-commons/src_main_java/codemetropolis.toolchain.commons.util/Resources.html" class="el_class">codemetropolis.toolchain.commons.util.Resources</a></td><td><code>91ed5b7ffac731a5</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory/BrowsingHistoryConverter.html" class="el_class">codemetropolis.toolchain.converter.browsinghistory.BrowsingHistoryConverter</a></td><td><code>aa4a0371e2f801a9</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.browsinghistory.test/BrowsingHistoryConverterTests.html" class="el_class">codemetropolis.toolchain.converter.browsinghistory.test.BrowsingHistoryConverterTests</a></td><td><code>44d27302719a0313</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector/GitInspectorConverter.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.GitInspectorConverter</a></td><td><code>dfacc35a8e115c0b</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateDocumentFromSourceTest.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.test.CreateDocumentFromSourceTest</a></td><td><code>e977352247423c5a</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateElementsTest.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.test.CreateElementsTest</a></td><td><code>ac2caa2ffa78803a</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/CreateRootelemenTest.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.test.CreateRootelemenTest</a></td><td><code>73175cbf0c64d59c</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/DownscalePossibleLargeNumericValueTest.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.test.DownscalePossibleLargeNumericValueTest</a></td><td><code>4948fd9d21e95f4a</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GetMetricsFromFirstAuthorElementNodeTest.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.test.GetMetricsFromFirstAuthorElementNodeTest</a></td><td><code>86cb6a9f1a9b61c5</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/GitInspectorConverterTest.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.test.GitInspectorConverterTest</a></td><td><code>bd16f37f2113f025</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/ResetMetricsTest.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.test.ResetMetricsTest</a></td><td><code>410957dd24ec185c</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TestHelper.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.test.TestHelper</a></td><td><code>8a97c3ef4fd38eeb</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/TraverseNodesFromDocumentTest.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.test.TraverseNodesFromDocumentTest</a></td><td><code>60b30549cf508c4a</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsFromSecondAuthorElementNodeTest.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.test.UpdateMetricsFromSecondAuthorElementNodeTest</a></td><td><code>740d4b358aa3b47f</code></td></tr><tr><td><a href="codemetropolis-toolchain-converter/src_main_java/codemetropolis.toolchain.converter.gitinspector.test/UpdateMetricsTest.html" class="el_class">codemetropolis.toolchain.converter.gitinspector.test.UpdateMetricsTest</a></td><td><code>aed5eaebc6eb637f</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/CodeMetropolisGUI.html" class="el_class">codemetropolis.toolchain.gui.CodeMetropolisGUI</a></td><td><code>f9d71bc68478489e</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.gui.CodeMetropolisGUITest</span></td><td><code>3ca404ca36993278</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog.html" class="el_class">codemetropolis.toolchain.gui.MappingFileEditorDialog</a></td><td><code>4aeca497ec08a60c</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui/MappingFileEditorDialog$AssignResult.html" class="el_class">codemetropolis.toolchain.gui.MappingFileEditorDialog.AssignResult</a></td><td><code>2b5406de81763c20</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.beans/QuantizationInformation.html" class="el_class">codemetropolis.toolchain.gui.beans.QuantizationInformation</a></td><td><code>66cffd3debedda70</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/Conversion.html" class="el_class">codemetropolis.toolchain.gui.conversions.Conversion</a></td><td><code>328f2bbf84abdf3d</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.conversions/EmptyConversion.html" class="el_class">codemetropolis.toolchain.gui.conversions.EmptyConversion</a></td><td><code>8761ddaf97673e55</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/BuildableSettings.html" class="el_class">codemetropolis.toolchain.gui.utils.BuildableSettings</a></td><td><code>df3c276fbea903d1</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.gui.utils.BuildableSettingsTest</span></td><td><code>620477fe1508d3f3</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/ExeFileFilter.html" class="el_class">codemetropolis.toolchain.gui.utils.ExeFileFilter</a></td><td><code>fda7caa794f510cf</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.gui.utils.ExeFileFilterTest</span></td><td><code>fe5962ddcd9fa990</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/GuiUtils.html" class="el_class">codemetropolis.toolchain.gui.utils.GuiUtils</a></td><td><code>bb479541d00bcdfb</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.gui.utils.GuiUtilsTest</span></td><td><code>ba50d1efb779d811</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/Property.html" class="el_class">codemetropolis.toolchain.gui.utils.Property</a></td><td><code>619ebf8ac47496c2</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/PropertyCollector.html" class="el_class">codemetropolis.toolchain.gui.utils.PropertyCollector</a></td><td><code>3911f5f3818f1e5e</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.gui.utils.PropertyCollectorTest</span></td><td><code>be1da8cb991d7663</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.gui.utils.QuantizationInformationTest</span></td><td><code>361f5175e76316e0</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/TransferHelper.html" class="el_class">codemetropolis.toolchain.gui.utils.TransferHelper</a></td><td><code>21319c0db08c0e2f</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.gui.utils.TransferHelperTest</span></td><td><code>1bdbe6b27e77ee97</code></td></tr><tr><td><a href="codemetropolis-toolchain-gui/src_main_java/codemetropolis.toolchain.gui.utils/XmlFileFilter.html" class="el_class">codemetropolis.toolchain.gui.utils.XmlFileFilter</a></td><td><code>b4f0eadee45dcae8</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.gui.utils.XmlFileFilterTest</span></td><td><code>7a95a95ac2bd4283</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/LimitController.html" class="el_class">codemetropolis.toolchain.mapping.control.LimitController</a></td><td><code>a968b0fb5c7aaed6</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.control/MappingController.html" class="el_class">codemetropolis.toolchain.mapping.control.MappingController</a></td><td><code>7bc5852a676a937f</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/Conversion.html" class="el_class">codemetropolis.toolchain.mapping.conversions.Conversion</a></td><td><code>a8a5c8dbe9d43fd9</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter.html" class="el_class">codemetropolis.toolchain.mapping.conversions.ConversionAdapter</a></td><td><code>d889aa7cc5319052</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/ConversionAdapter$AdaptedConversion.html" class="el_class">codemetropolis.toolchain.mapping.conversions.ConversionAdapter.AdaptedConversion</a></td><td><code>46969296e83fc6d5</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.mapping.conversions.ConversionTest</span></td><td><code>dc6369b38c440d52</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/MultiplyConversion.html" class="el_class">codemetropolis.toolchain.mapping.conversions.MultiplyConversion</a></td><td><code>1d3f08999bc8be55</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/NormalizeConversion.html" class="el_class">codemetropolis.toolchain.mapping.conversions.NormalizeConversion</a></td><td><code>884c78bdca562a28</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.conversions/QuantizationConversion.html" class="el_class">codemetropolis.toolchain.mapping.conversions.QuantizationConversion</a></td><td><code>20338a0eeed01b2b</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/MappingException.html" class="el_class">codemetropolis.toolchain.mapping.exceptions.MappingException</a></td><td><code>2aed21d4d703e9d6</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.exceptions/NotSupportedLinkingException.html" class="el_class">codemetropolis.toolchain.mapping.exceptions.NotSupportedLinkingException</a></td><td><code>6ed8472090b0544b</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Binding.html" class="el_class">codemetropolis.toolchain.mapping.model.Binding</a></td><td><code>303ec8852f106d45</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Constant.html" class="el_class">codemetropolis.toolchain.mapping.model.Constant</a></td><td><code>6d4f1c31516832c6</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Limit.html" class="el_class">codemetropolis.toolchain.mapping.model.Limit</a></td><td><code>f1314679ca164c69</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Linking.html" class="el_class">codemetropolis.toolchain.mapping.model.Linking</a></td><td><code>631bcc0a6e7b53af</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.mapping.model.LinkingTest</span></td><td><code>6c04365cca235242</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Mapping.html" class="el_class">codemetropolis.toolchain.mapping.model.Mapping</a></td><td><code>a09411c2798fe8db</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.mapping.model.MappingControllerTest</span></td><td><code>efc1ce1a939e24f0</code></td></tr><tr><td><span class="el_class">codemetropolis.toolchain.mapping.model.MappingTest</span></td><td><code>20978fa3d5db78ae</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.model/Parameter.html" class="el_class">codemetropolis.toolchain.mapping.model.Parameter</a></td><td><code>bdcf39903b5f36e4</code></td></tr><tr><td><a href="codemetropolis-toolchain-mapping/src_main_java/codemetropolis.toolchain.mapping.test/MappingModelTests.html" class="el_class">codemetropolis.toolchain.mapping.test.MappingModelTests</a></td><td><code>57351ae99a9a8cd9</code></td></tr><tr><td><span class="el_class">org.apache.commons.collections4.keyvalue.MultiKey</span></td><td><code>a4e344d471fd8826</code></td></tr><tr><td><span class="el_class">org.apache.commons.collections4.map.AbstractHashedMap</span></td><td><code>5aa5b75a7a6c592e</code></td></tr><tr><td><span class="el_class">org.apache.commons.collections4.map.AbstractHashedMap.HashEntry</span></td><td><code>1daa23ef53c79309</code></td></tr><tr><td><span class="el_class">org.apache.commons.collections4.map.AbstractIterableMap</span></td><td><code>dbf34d8d3be82135</code></td></tr><tr><td><span class="el_class">org.apache.commons.collections4.map.AbstractMapDecorator</span></td><td><code>93c3f015ca3b2cc8</code></td></tr><tr><td><span class="el_class">org.apache.commons.collections4.map.HashedMap</span></td><td><code>8f2bffee0f2d6342</code></td></tr><tr><td><span class="el_class">org.apache.commons.collections4.map.MultiKeyMap</span></td><td><code>1806dc14de5bdc8f</code></td></tr><tr><td><span class="el_class">org.apache.commons.lang3.ArrayUtils</span></td><td><code>ea0686b852a914a2</code></td></tr><tr><td><span class="el_class">org.apache.commons.lang3.ObjectUtils</span></td><td><code>0d0a39c5ae06c957</code></td></tr><tr><td><span class="el_class">org.apache.commons.lang3.ObjectUtils.Null</span></td><td><code>952f52ebd8ac68d0</code></td></tr><tr><td><span class="el_class">org.apache.commons.lang3.builder.EqualsBuilder</span></td><td><code>bb1615386a8e6585</code></td></tr><tr><td><span class="el_class">org.apache.commons.lang3.builder.IDKey</span></td><td><code>5777c74a841892f7</code></td></tr><tr><td><span class="el_class">org.apache.commons.lang3.tuple.ImmutablePair</span></td><td><code>498c7563b77e8df5</code></td></tr><tr><td><span class="el_class">org.apache.commons.lang3.tuple.Pair</span></td><td><code>745217e90eede92b</code></td></tr><tr><td><span class="el_class">org.eclipse.jdt.internal.junit.runner.DefaultClassifier</span></td><td><code>6529b18d989020de</code></td></tr><tr><td><span class="el_class">org.eclipse.jdt.internal.junit.runner.FirstRunExecutionListener</span></td><td><code>41ffbcd55db5bce1</code></td></tr><tr><td><span class="el_class">org.eclipse.jdt.internal.junit.runner.RemoteTestRunner</span></td><td><code>6c6d6f4086844a9e</code></td></tr><tr><td><span class="el_class">org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.ReaderThread</span></td><td><code>1b724ac5c56b44df</code></td></tr><tr><td><span class="el_class">org.eclipse.jdt.internal.junit.runner.TestExecution</span></td><td><code>e652a18f68b6d4d4</code></td></tr><tr><td><span class="el_class">org.eclipse.jdt.internal.junit.runner.TestIdMap</span></td><td><code>92a1552568c37473</code></td></tr><tr><td><span class="el_class">org.eclipse.jdt.internal.junit4.runner.JUnit4Identifier</span></td><td><code>4cdc0d200898da37</code></td></tr><tr><td><span class="el_class">org.eclipse.jdt.internal.junit4.runner.JUnit4TestListener</span></td><td><code>2a7658cee04f69e3</code></td></tr><tr><td><span class="el_class">org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader</span></td><td><code>8714a0a1faadcb4e</code></td></tr><tr><td><span class="el_class">org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference</span></td><td><code>45e26b503b973c56</code></td></tr><tr><td><span class="el_class">org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.1</span></td><td><code>5cb1946e627d5daf</code></td></tr><tr><td><span class="el_class">org.junit.Assert</span></td><td><code>e2bac9fc5ef3a4be</code></td></tr><tr><td><span class="el_class">org.junit.internal.MethodSorter</span></td><td><code>e7c1106d3801ff54</code></td></tr><tr><td><span class="el_class">org.junit.internal.MethodSorter.1</span></td><td><code>81fdc65e8fe19b52</code></td></tr><tr><td><span class="el_class">org.junit.internal.MethodSorter.2</span></td><td><code>bfe6560dc3722ab0</code></td></tr><tr><td><span class="el_class">org.junit.internal.builders.AllDefaultPossibilitiesBuilder</span></td><td><code>84f7fffb8cd30ad9</code></td></tr><tr><td><span class="el_class">org.junit.internal.builders.AnnotatedBuilder</span></td><td><code>0faf353d180c9332</code></td></tr><tr><td><span class="el_class">org.junit.internal.builders.IgnoredBuilder</span></td><td><code>e152f333c53967a6</code></td></tr><tr><td><span class="el_class">org.junit.internal.builders.JUnit3Builder</span></td><td><code>4a2cc8e608e1275e</code></td></tr><tr><td><span class="el_class">org.junit.internal.builders.JUnit4Builder</span></td><td><code>5902b7da0403f55c</code></td></tr><tr><td><span class="el_class">org.junit.internal.builders.SuiteMethodBuilder</span></td><td><code>1df136431e07e393</code></td></tr><tr><td><span class="el_class">org.junit.internal.requests.ClassRequest</span></td><td><code>f1e703dd2591ce5c</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.model.EachTestNotifier</span></td><td><code>0cb318e674165ac8</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.model.ReflectiveCallable</span></td><td><code>d591724635588bcb</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.rules.RuleMemberValidator</span></td><td><code>95b5ee2068ec6875</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.rules.RuleMemberValidator.Builder</span></td><td><code>f24845fa6fd065af</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.rules.RuleMemberValidator.DeclaringClassMustBePublic</span></td><td><code>1de994463c748d89</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.rules.RuleMemberValidator.FieldMustBeARule</span></td><td><code>e24e9f59de6fe5b7</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.rules.RuleMemberValidator.FieldMustBeATestRule</span></td><td><code>690823bd2992f52e</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.rules.RuleMemberValidator.MemberMustBeNonStaticOrAlsoClassRule</span></td><td><code>1e703fb3e7f4e533</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.rules.RuleMemberValidator.MemberMustBePublic</span></td><td><code>806c174eb921b478</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.rules.RuleMemberValidator.MemberMustBeStatic</span></td><td><code>ac28a03dd36b2b5a</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.rules.RuleMemberValidator.MethodMustBeARule</span></td><td><code>88ea4a2237de2b8b</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.rules.RuleMemberValidator.MethodMustBeATestRule</span></td><td><code>9f4dd18a26005c18</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.statements.InvokeMethod</span></td><td><code>05a7aa636afa2c39</code></td></tr><tr><td><span class="el_class">org.junit.internal.runners.statements.RunBefores</span></td><td><code>0701ea1d8962a22f</code></td></tr><tr><td><span class="el_class">org.junit.runner.Description</span></td><td><code>c7f1b09126c24b2b</code></td></tr><tr><td><span class="el_class">org.junit.runner.Request</span></td><td><code>4f785af929bd628a</code></td></tr><tr><td><span class="el_class">org.junit.runner.Result</span></td><td><code>3a364b299d905039</code></td></tr><tr><td><span class="el_class">org.junit.runner.Result.Listener</span></td><td><code>bbae11d09f5b5a09</code></td></tr><tr><td><span class="el_class">org.junit.runner.Runner</span></td><td><code>f5abacc70e2e08a4</code></td></tr><tr><td><span class="el_class">org.junit.runner.notification.RunListener</span></td><td><code>a740fd873cf92a63</code></td></tr><tr><td><span class="el_class">org.junit.runner.notification.RunNotifier</span></td><td><code>ba709a76760379c2</code></td></tr><tr><td><span class="el_class">org.junit.runner.notification.RunNotifier.1</span></td><td><code>6eb5e06975b1ea02</code></td></tr><tr><td><span class="el_class">org.junit.runner.notification.RunNotifier.2</span></td><td><code>dc4db4223d160c08</code></td></tr><tr><td><span class="el_class">org.junit.runner.notification.RunNotifier.3</span></td><td><code>7a903d9d1caf7673</code></td></tr><tr><td><span class="el_class">org.junit.runner.notification.RunNotifier.7</span></td><td><code>304ecd1b313cb650</code></td></tr><tr><td><span class="el_class">org.junit.runner.notification.RunNotifier.SafeNotifier</span></td><td><code>3b3dc2f2fc8cfc56</code></td></tr><tr><td><span class="el_class">org.junit.runner.notification.SynchronizedRunListener</span></td><td><code>0f89c0c6a77088e5</code></td></tr><tr><td><span class="el_class">org.junit.runners.BlockJUnit4ClassRunner</span></td><td><code>673d2df2f68a9490</code></td></tr><tr><td><span class="el_class">org.junit.runners.BlockJUnit4ClassRunner.1</span></td><td><code>b3af68717b17ffc6</code></td></tr><tr><td><span class="el_class">org.junit.runners.ParentRunner</span></td><td><code>df303f19df248a10</code></td></tr><tr><td><span class="el_class">org.junit.runners.ParentRunner.1</span></td><td><code>89f115a2214a3636</code></td></tr><tr><td><span class="el_class">org.junit.runners.ParentRunner.2</span></td><td><code>0fc04165488ae7c7</code></td></tr><tr><td><span class="el_class">org.junit.runners.ParentRunner.3</span></td><td><code>65f7d637ed11f8f4</code></td></tr><tr><td><span class="el_class">org.junit.runners.model.FrameworkField</span></td><td><code>d6d3c27befd6f49d</code></td></tr><tr><td><span class="el_class">org.junit.runners.model.FrameworkMember</span></td><td><code>83f9d72bb2731cf1</code></td></tr><tr><td><span class="el_class">org.junit.runners.model.FrameworkMethod</span></td><td><code>b9c1cccbfa624e4a</code></td></tr><tr><td><span class="el_class">org.junit.runners.model.FrameworkMethod.1</span></td><td><code>87d2600c48ade534</code></td></tr><tr><td><span class="el_class">org.junit.runners.model.RunnerBuilder</span></td><td><code>0281d51b4f8328d4</code></td></tr><tr><td><span class="el_class">org.junit.runners.model.Statement</span></td><td><code>9a75aa5de27bf4d5</code></td></tr><tr><td><span class="el_class">org.junit.runners.model.TestClass</span></td><td><code>90136128a3e4d163</code></td></tr><tr><td><span class="el_class">org.junit.runners.model.TestClass.FieldComparator</span></td><td><code>261449f31a730808</code></td></tr><tr><td><span class="el_class">org.junit.runners.model.TestClass.MethodComparator</span></td><td><code>5a734d8eaadb6011</code></td></tr><tr><td><span class="el_class">org.junit.validator.AnnotationValidatorFactory</span></td><td><code>e736331fde301341</code></td></tr><tr><td><span class="el_class">org.junit.validator.AnnotationsValidator</span></td><td><code>51f829810937d72f</code></td></tr><tr><td><span class="el_class">org.junit.validator.AnnotationsValidator.AnnotatableValidator</span></td><td><code>d211a963f22be103</code></td></tr><tr><td><span class="el_class">org.junit.validator.AnnotationsValidator.ClassValidator</span></td><td><code>1b463c4e6642e880</code></td></tr><tr><td><span class="el_class">org.junit.validator.AnnotationsValidator.FieldValidator</span></td><td><code>64068b954dc56a31</code></td></tr><tr><td><span class="el_class">org.junit.validator.AnnotationsValidator.MethodValidator</span></td><td><code>f16b57f17c787036</code></td></tr><tr><td><span class="el_class">org.junit.validator.PublicClassValidator</span></td><td><code>3bac248cf06b18e4</code></td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.7.9.201702052155</span>Merged (Apr 21, 2018 5:41:32 PM)</div></body></html>
    \ No newline at end of file
    
    From 493c0cd8ffe653ea46c273cf75f9576c78a034bc Mon Sep 17 00:00:00 2001
    From: Viktor Meszaros <h665772@stud.u-szeged.hu>
    Date: Sat, 28 Apr 2018 12:40:46 +0200
    Subject: [PATCH 57/58] Big list of bugfixes and improvements (see below for
     details).
    
    - Fixing the error of the drag 'n drop feature.
    - Using TableModelListener for setting/updating conversions.
    - Creating a custom table class, which can store the conversions related to it (CMTable.java).
    - New way to store conversions instead of the silly method of class hierarchy. Conversions are stored as Objects from now.
    - Removed unnecessary conversion classes. The class QuantizationConversion has got a setter method for its list attribute.
    - Rewriting from scratch the whole dialog class which is responsible for setting the parameters (levels) of a quantization conversion.
    - Removing unnecessary and/or compex code snippets.
    - Added new translations for the gui.
    ---
     .../gui/MappingFileEditorDialog.java          | 191 ++++++---------
     .../toolchain/gui/QuantizationDialog.java     | 219 ++++++++++++++++++
     .../gui/QuantizationSetterDialog.java         | 128 ----------
     .../toolchain/gui/components/CMTable.java     |  63 +++++
     .../toolchain/gui/conversions/Conversion.java |  10 -
     .../gui/conversions/EmptyConversion.java      |  10 -
     .../gui/conversions/NormalizeConversion.java  |  10 -
     .../conversions/QuantizationConversion.java   |   6 +-
     .../gui/conversions/ToDoubleConversion.java   |   9 -
     .../gui/conversions/ToIntConversion.java      |   9 -
     .../toolchain/gui/utils/TransferHelper.java   |  62 ++---
     .../main/resources/buildableProperties.cmcfg  |   4 +-
     .../main/resources/translations.properties    |   7 +-
     13 files changed, 378 insertions(+), 350 deletions(-)
     create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationDialog.java
     delete mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java
     create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMTable.java
     delete mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/Conversion.java
     delete mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java
     delete mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormalizeConversion.java
     delete mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java
     delete mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java
    
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java
    index 944d1a43..7c69f24b 100644
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java
    @@ -7,7 +7,6 @@
     import java.awt.event.ActionListener;
     import java.awt.Rectangle;
     import java.io.FileNotFoundException;
    -import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.HashMap;
     import java.util.List;
    @@ -25,17 +24,21 @@
     import javax.swing.JTextField;
     import javax.swing.ListModel;
     import javax.swing.ListSelectionModel;
    +import javax.swing.event.TableModelEvent;
    +import javax.swing.event.TableModelListener;
     import javax.swing.filechooser.FileFilter;
    +import javax.swing.table.DefaultTableModel;
    +import javax.swing.table.TableModel;
     
     import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException;
    -import codemetropolis.toolchain.gui.beans.QuantizationInformation;
    +
     import codemetropolis.toolchain.gui.components.CMButton;
     import codemetropolis.toolchain.gui.components.CMCheckBox;
     import codemetropolis.toolchain.gui.components.CMLabel;
     import codemetropolis.toolchain.gui.components.CMScrollPane;
    +import codemetropolis.toolchain.gui.components.CMTable;
     import codemetropolis.toolchain.gui.components.CMTextField;
     import codemetropolis.toolchain.gui.components.listeners.BrowseListener;
    -import codemetropolis.toolchain.gui.conversions.Conversion;
     import codemetropolis.toolchain.gui.conversions.QuantizationConversion;
     import codemetropolis.toolchain.gui.utils.BuildableSettings;
     import codemetropolis.toolchain.gui.utils.Property;
    @@ -53,14 +56,6 @@ public class MappingFileEditorDialog extends JDialog {
     	private static final long serialVersionUID = 1L;
     	
     	private static final FileFilter XML_FILTER;
    -
    -	static public List<Conversion> cellarConversion;
    -	static public List<Conversion> gardenConversion;
    -	static public List<Conversion> floorConversion;
    -
    -	static public Map<QuantizationInformation, QuantizationConversion> cellarQuant;
    -	static public Map<QuantizationInformation, QuantizationConversion> gardenQuant;
    -	static public Map<QuantizationInformation, QuantizationConversion> floorQuant;
     	
     	/**
     	 * Contains the possible results of assigning a metric to a property of a buildable type.
    @@ -72,14 +67,6 @@ public enum AssignResult {CANNOT_ASSIGN, NO_CONVERSION, TO_INT, TO_DOUBLE, NORMA
     	static {
     		XML_FILTER = new XmlFileFilter();
     
    -		cellarConversion = new ArrayList<Conversion>();
    -		gardenConversion = new ArrayList<Conversion>();
    -		floorConversion = new ArrayList<Conversion>();
    -
    -		cellarQuant = new HashMap<QuantizationInformation, QuantizationConversion>();
    -		gardenQuant = new HashMap<QuantizationInformation, QuantizationConversion>();
    -		floorQuant = new HashMap<QuantizationInformation, QuantizationConversion>();
    -
     		ASSIGN_RESULT_MATRIX = new HashMap<String, Map<String, AssignResult>>();
     		
     		ASSIGN_RESULT_MATRIX.put("int", new HashMap<String, AssignResult>());
    @@ -112,9 +99,9 @@ public enum AssignResult {CANNOT_ASSIGN, NO_CONVERSION, TO_INT, TO_DOUBLE, NORMA
     	private JPanel floorPanel;
     	private JPanel gardenPanel;
     	private JPanel groundPanel;
    -	private static JTable cellarTable;
    -	private static JTable floorTable;
    -	private static JTable gardenTable;
    +	private CMTable cellarTable;	
    +	private CMTable floorTable;	
    +	private CMTable gardenTable;
     	
     	//ListModel and JList for the buildables: cellar, floor, garden
     	private ListModel<String> cellarListmodel;
    @@ -139,8 +126,7 @@ public enum AssignResult {CANNOT_ASSIGN, NO_CONVERSION, TO_INT, TO_DOUBLE, NORMA
     	private void loadDisplayedInfo(String cdfFilePath) {
     		try {
     			BuildableSettings settings = new BuildableSettings();
    -			displayedBuildableAttributes = settings.readSettings();
    -						
    +			displayedBuildableAttributes = settings.readSettings();						
     		}
     		catch(BadConfigFileFomatException e) {
     			JOptionPane.showMessageDialog(
    @@ -166,13 +152,11 @@ private void loadDisplayedInfo(String cdfFilePath) {
     		}
     		catch(FileNotFoundException e) {
     			e.printStackTrace();
    -		}
    -		
    +		}		
     	}
     	
     	 /**
     	  * Instantiates the Mapping file editor dialog.
    -	  *
     	  * @param cdfFilePath The path of the input cdf xml file.
     	  * @param cmGui The parent window of the dialog.
     	  */
    @@ -184,7 +168,6 @@ public MappingFileEditorDialog(String cdfFilePath, CodeMetropolisGUI cmGui) {
     		addResourceOptions(panel);
     		addSaveOptions(panel);
     		addBuildableTabs(panel);
    -		addConversionOptions(panel);
     		
     		this.setResizable(false);
     	    this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
    @@ -348,8 +331,7 @@ private void addBuildableTabs(JPanel panel) {
     		buildableTabbedPane.setFont(new Font("Source Sans Pro", Font.PLAIN, 16));
     		buildableTabbedPane.setBounds(10, 175, 780, 300);
     		
    -		panel.add(buildableTabbedPane);
    -		
    +		panel.add(buildableTabbedPane);		
     	}
     	
     	/**
    @@ -496,18 +478,70 @@ private void createGroundTab() {
     	 * @param buildableType The type of the buildable (method, attribute, etc.).
     	 * @return The JTable contains the buildable attributes.
     	 */
    -	private JTable setUpBuildableTable(String buildableType) {
    +	private CMTable setUpBuildableTable(String buildableType) {
    +		CMTable table = new CMTable();
    +		
     		String[] displayedProperties = displayedBuildableAttributes.get(buildableType);
     	    
    -		Object[] columnNames = new String[] {Translations.t("gui_t_attribute"), Translations.t("gui_t_assigned_propery")};
    +		Object[] header = new String[] {Translations.t("gui_t_attribute"), Translations.t("gui_t_assigned_propery")};
     	    Object[][] initData = new Object[displayedProperties.length][2];
     	    
     	    for(int i = 0; i < displayedProperties.length; i++) {
     	    	initData[i][0] = displayedProperties[i] + ": " + BuildableSettings.BUILDABLE_ATTRIBUTE_TYPES.get(displayedProperties[i]);
     	    	initData[i][1] = null;
     	    }
    +	    
    +	    TableModel tModel = new DefaultTableModel(initData, header);
    +	    table.setModel(tModel);
    +	    
    +	    MappingFileEditorDialog self = this;
    +	    //For listening changes in the table.
    +	    table.getModel().addTableModelListener(new TableModelListener() {
    +
    +			@Override
    +			public void tableChanged(TableModelEvent e) {
    +				int row = e.getFirstRow();
    +				String buildableAttribute = (String) table.getValueAt(row , 0);
    +				String assignedMetric = (String) table.getValueAt(row, 1);
    +				
    +				String buildableAttributeType = buildableAttribute.split(": ")[1];
    +				String assignedMetricType = assignedMetric.split(": ")[1];
    +				
    +				AssignResult cell = MappingFileEditorDialog.ASSIGN_RESULT_MATRIX.get(buildableAttributeType).get(assignedMetricType);
    +				switch (cell) {
    +				// We don't have to examine the case when there's no conversion allowed, because it was examined in the checkType method of the TransferHelper class.
    +			    	case NO_CONVERSION:
    +			    		table.getConversionList().set(row, null);
    +			    		System.out.println("null");
    +			    		break;
    +			    	case TO_INT:
    +			    		Object o = "toInt";
    +			    		table.getConversionList().set(row, o);
    +			    		System.out.println(o.toString());
    +			    		break;
    +			    	case TO_DOUBLE:
    +			    		Object o1 = "toDouble";
    +			    		table.getConversionList().set(row, o1);
    +			    		System.out.println(o1.toString());
    +			    		break;
    +			    	case NORMALIZE:
    +			    		Object o2 = "normalize";
    +			    		table.getConversionList().set(row, o2);
    +			    		System.out.println(o2.toString());
    +			    		break;
    +			    	case QUANTIZATON:
    +			    		QuantizationConversion qConv = new QuantizationConversion();
    +			    		table.getConversionList().set(row, qConv);
    +			    		System.out.println(qConv.toString());
    +			    		new QuantizationDialog(self, qConv, buildableAttributeType);
    +			    		break;
    +			    	default:
    +			    		break;
    +		    	}
    +			}
    +	    	
    +	    });
     
    -	    JTable table = new JTable(initData, columnNames);
     	    table.setFont(new Font("Source Sans Pro", Font.PLAIN, 14));
     	    table.setRowHeight(30);
     	    table.setBounds(15, 50, 480, displayedProperties.length * 30);
    @@ -536,93 +570,4 @@ public ListModel<String> initializeListModel(String sourceCodeElementType) {
     		
     		return model;
     	}
    -	
    -	/**
    -	 * Adds the conversion options to the {@code panel}.
    -	 * @param panel The {@link JPanel} to which the options will be added to.
    -	 */
    -	private void addConversionOptions(JPanel panel) {
    -		CMButton conversionButton = new CMButton(Translations.t("gui_b_conversions"), 10, 490, 150, 30);
    -		panel.add(conversionButton);
    -		
    -		MappingFileEditorDialog self = this;
    -		conversionButton.addActionListener(new ActionListener() {
    -			@Override
    -			public void actionPerformed(ActionEvent arg0) {
    -				int index;
    -				String buildableAttribute;
    -				String metric;
    -
    -				for (Conversion element :  cellarConversion) {
    -					if ( element instanceof QuantizationConversion ) {
    -						QuantizationInformation cellar = new QuantizationInformation();
    -
    -						index = cellarConversion.indexOf(element);
    -						buildableAttribute = (String) cellarTable.getModel().getValueAt(index, 0);
    -						metric = (String) cellarTable.getModel().getValueAt(index, 1);
    -
    -						cellar.setIndex(index);
    -						cellar.setBuildableAttribute(buildableAttribute);
    -						cellar.setMetric(metric);
    -
    -						cellarQuant.put(cellar, new QuantizationConversion());
    -					}
    -				}
    -				for (Conversion element :  gardenConversion) {
    -					if ( element instanceof QuantizationConversion ) {
    -						QuantizationInformation garden = new QuantizationInformation();
    -
    -						index = gardenConversion.indexOf(element);
    -						buildableAttribute = (String) gardenTable.getModel().getValueAt(index, 0);
    -						metric = (String) gardenTable.getModel().getValueAt(index, 1);
    -
    -						garden.setIndex(index);
    -						garden.setBuildableAttribute(buildableAttribute);
    -						garden.setMetric(metric);
    -
    -						gardenQuant.put(garden, new QuantizationConversion());
    -					}
    -				}
    -				for (Conversion element :  floorConversion) {
    -					if ( element instanceof QuantizationConversion ) {
    -						QuantizationInformation floor = new QuantizationInformation();
    -
    -						index = floorConversion.indexOf(element);
    -						buildableAttribute = (String) floorTable.getModel().getValueAt(index, 0);
    -						metric = (String) floorTable.getModel().getValueAt(index, 1);
    -
    -						floor.setIndex(index);
    -						floor.setBuildableAttribute(buildableAttribute);
    -						floor.setMetric(metric);
    -
    -						floorQuant.put(floor, new QuantizationConversion());
    -					}
    -				}
    -				QuantizationSetterDialog dialog = new QuantizationSetterDialog(self);
    -				dialog.setVisible(true);
    -				
    -			}
    -		});
    -	}
    -
    -    /**
    -     * @return floorTable
    -     */
    -    public static JTable getFloorTable() {
    -    	return floorTable;
    -    }
    -
    -    /**
    -     * @return gardenTable
    -     */
    -    public static JTable getGardenTable() {
    -        return gardenTable;
    -    }
    -
    -    /**
    -     * @return cellarTable
    -     */
    -    public static JTable getCellarTable() {
    -        return cellarTable;
    -	}
    -}
    +}
    \ No newline at end of file
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationDialog.java
    new file mode 100644
    index 00000000..70a3ce26
    --- /dev/null
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationDialog.java
    @@ -0,0 +1,219 @@
    +package codemetropolis.toolchain.gui;
    +
    +import java.awt.Dimension;
    +import java.awt.Font;
    +import java.awt.event.ActionEvent;
    +import java.awt.event.ActionListener;
    +import java.util.Arrays;
    +import java.util.List;
    +
    +import javax.swing.JDialog;
    +import javax.swing.JOptionPane;
    +import javax.swing.JPanel;
    +import javax.swing.JScrollPane;
    +import javax.swing.JTable;
    +import javax.swing.table.DefaultTableModel;
    +
    +import codemetropolis.toolchain.gui.components.CMButton;
    +import codemetropolis.toolchain.gui.components.CMTextField;
    +import codemetropolis.toolchain.gui.conversions.QuantizationConversion;
    +import codemetropolis.toolchain.gui.utils.BuildableSettings;
    +import codemetropolis.toolchain.gui.utils.Translations;
    +
    +/**
    + * Class for setting the levels and their corresponding values of a quantization conversion.
    + * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
    + * @author Tamas Keri {@literal <KETWAAT.SZE>}
    + */
    +public class QuantizationDialog extends JDialog {
    +	
    +	private static final long serialVersionUID = 1L;
    +	
    +	private JPanel contentPanel;
    +	private CMTextField addLevelField;
    +	private CMButton addLevelButton;
    +	private CMButton clearLevelButton;
    +	private CMButton okButton;
    +	private JTable levelsTable;
    +	private DefaultTableModel levelsTableModel;
    +	
    +	private static String[] header = new String[] {
    +			"Level", "Value"
    +	};
    +	
    +	/**
    +	 * Its value can be set as "int(0 to 5)" or "string". In the first case numbers between 1-5 will be accepted. In the other case the possible values
    +	 * of the "character" and "external_character" buildable attributes (stone, wood, ...).
    +	 */
    +	private String levelType;
    +	
    +	/**
    +	 * Reference of the conversion whose levels will be set in this dialog.
    +	 */
    +	private QuantizationConversion conversionToSet;
    +	
    +	/**
    +	 * Instantiates the quantization setter dialog.
    +	 * @param conversionToSet The {@link QuantizationConversion} object, whose levels are going to be set.
    +	 * @param levelType The type of the accepted level values. It can be an integer with range 0-5 or a string which must be a valid "(external_)character" value.
    +	 */
    +	public QuantizationDialog(MappingFileEditorDialog parent, QuantizationConversion conversionToSet, String levelType) {
    +		this.conversionToSet = conversionToSet;		
    +		if(levelType.equals("int(0 to 5)") || levelType.equals("string")) {
    +			this.levelType = levelType;
    +		}
    +		else {
    +			this.levelType = "string";
    +		}
    +		
    +		this.setTitle(Translations.t("gui_set_quant_parameters_title"));
    +		
    +		setContentPanel();
    +		
    +		this.pack();
    +		this.setLocationRelativeTo(parent);
    +		this.setModal(true);
    +		this.setVisible(true);
    +	}
    +	
    +	/**
    +	 * Sets the main (content) panel of the dialog.
    +	 */
    +	private void setContentPanel() {
    +		contentPanel = new JPanel();
    +		contentPanel.setLayout(null);
    +		
    +		Dimension size = new Dimension(350, 250);
    +		contentPanel.setMinimumSize(size);
    +	    contentPanel.setPreferredSize(size);
    +	    contentPanel.setMaximumSize(size);
    +	    
    +		setTable();
    +		setTextField();
    +		setButtons();
    +		addActionListeners();
    +		
    +		this.add(contentPanel);
    +	}
    +	
    +	/**
    +	 * Sets the table of the dialog storing the level values.
    +	 */
    +	private void setTable() {
    +		levelsTable = new JTable();
    +		
    +		levelsTableModel = new DefaultTableModel();
    +		levelsTableModel.setColumnIdentifiers(header);
    +		
    +		levelsTable.setModel(levelsTableModel);
    +		
    +		levelsTable.setBounds(10, 50, 200, 150);
    +		
    +		JScrollPane scrollPane = new JScrollPane(levelsTable);
    +		scrollPane.setBounds(10, 50, 200, 150);
    +		
    +		contentPanel.add(scrollPane);
    +	}
    +	
    +	/**
    +	 * Sets the input text field of the dialog.
    +	 */
    +	private void setTextField() {
    +		addLevelField = new CMTextField(10, 10, 100, 30);
    +		contentPanel.add(addLevelField);
    +	}
    +	
    +	/**
    +	 * Sets the buttons of the dialog.
    +	 */
    +	private void setButtons() {
    +		addLevelButton = new CMButton(Translations.t("gui_b_add_level"), 120, 10, 100, 30);
    +		addLevelButton.setFont(new Font("Source Sans Pro", Font.PLAIN, 13));
    +		clearLevelButton = new CMButton(Translations.t("gui_b_clear_levels"), 230, 10, 100, 30);
    +		clearLevelButton.setFont(new Font("Source Sans Pro", Font.PLAIN, 13));
    +		okButton = new CMButton(Translations.t("gui_b_ok"), 10, 210, 100, 30);
    +		okButton.setFont(new Font("Source Sans Pro", Font.PLAIN, 13));
    +		contentPanel.add(addLevelButton);
    +		contentPanel.add(clearLevelButton);
    +		contentPanel.add(okButton);
    +	}
    +	
    +	/**
    +	 * Adds action listeners to the dialog buttons.
    +	 */
    +	private void addActionListeners() {
    +		QuantizationDialog self = this;
    +		
    +		addLevelButton.addActionListener(new ActionListener() {
    +
    +			@Override
    +			public void actionPerformed(ActionEvent e) {
    +				String levelValue = addLevelField.getText();
    +				int levelIndex = levelsTable.getRowCount();
    +				if (validateLevelValue(levelValue)) {
    +					levelsTableModel.addRow(new Object[] { levelIndex, levelValue });
    +				}
    +				else {
    +					JOptionPane.showMessageDialog(
    +							null,
    +							Translations.t("gui_err_invalid_level_value"),
    +							Translations.t("gui_err_title"),
    +							JOptionPane.ERROR_MESSAGE);
    +				}
    +			}
    +			
    +		});
    +		clearLevelButton.addActionListener(new ActionListener() {
    +
    +			@Override
    +			public void actionPerformed(ActionEvent e) {
    +				levelsTableModel.setRowCount(0);
    +			}
    +			
    +		});
    +		okButton.addActionListener(new ActionListener() {
    +
    +			@Override
    +			public void actionPerformed(ActionEvent e) {
    +				int rowCount = levelsTable.getRowCount();
    +				if(rowCount == 0) {
    +					JOptionPane.showMessageDialog(
    +							null,
    +							Translations.t("gui_err_no_level_declared"),
    +							Translations.t("gui_err_title"),
    +							JOptionPane.ERROR_MESSAGE);
    +				}
    +				else {
    +					String[] levelValues = new String[rowCount];
    +					for(int i = 0; i < rowCount; i++) {
    +						levelValues[i] = (String) levelsTable.getValueAt(i, 1);
    +					}
    +					List<String> quantizationLevelValues = Arrays.asList(levelValues);
    +					conversionToSet.setLevels(quantizationLevelValues);
    +					self.setVisible(false);
    +				}
    +			}
    +			
    +		});
    +	}
    +	
    +	/**
    +	 * Validates, if the entered value for the current level is valid or not.
    +	 * @param levelValue The entered value for the current level.
    +	 * @return The entered value is valid or not.
    +	 */
    +	private boolean validateLevelValue(String levelValue) {
    +		boolean valueIsOK = false;
    +		if(levelType.equals("int(0 to 5)")) {
    +			if(levelValue.matches("[0-5]")) {
    +				valueIsOK = true;
    +			}
    +		}
    +		if(levelType.equals("string")) {
    +			if(BuildableSettings.VALID_CHARACTER_TYPES.contains(levelValue)) {
    +				valueIsOK = true;
    +			}
    +		}
    +		return valueIsOK;
    +	}	
    +}
    \ No newline at end of file
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java
    deleted file mode 100644
    index 2ffd26f8..00000000
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/QuantizationSetterDialog.java
    +++ /dev/null
    @@ -1,128 +0,0 @@
    -package codemetropolis.toolchain.gui;
    -
    -import java.awt.Dimension;
    -import java.util.Set;
    -
    -import javax.swing.JDialog;
    -import javax.swing.JPanel;
    -
    -import codemetropolis.toolchain.gui.beans.QuantizationInformation;
    -import codemetropolis.toolchain.gui.components.CMButton;
    -import codemetropolis.toolchain.gui.components.CMComboBox;
    -import codemetropolis.toolchain.gui.components.CMLabel;
    -import codemetropolis.toolchain.gui.components.CMTextField;
    -import codemetropolis.toolchain.gui.utils.BuildableSettings;
    -import codemetropolis.toolchain.gui.utils.Translations;
    -
    -/**
    - * This class is define the view of
    - * quantization dialog.
    - *
    - * @author Tamas Keri {@literal <KETWAAT.SZE>}
    - * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
    - */
    -public class QuantizationSetterDialog extends JDialog {
    -
    -	private static final long serialVersionUID = 1L;
    -
    -	MappingFileEditorDialog parent;
    -
    -	CMTextField gardenTextField;
    -	CMTextField cellarTextField;
    -	CMTextField floorTextField;
    -
    -	CMButton gardenButton;
    -	CMButton cellarButton;
    -	CMButton floorButton;
    -
    -	CMComboBox<QuantizationInformation> gardenComboBox;
    -	CMComboBox<QuantizationInformation> cellarComboBox;
    -	CMComboBox<QuantizationInformation> floorComboBox;
    -
    -	public QuantizationSetterDialog(MappingFileEditorDialog parent) {
    -		this.parent = parent;
    -		JPanel panel = createBasePanel();
    -		addCellarComponents(panel);
    -		addFloorComponents(panel);
    -		addGardenComponents(panel);
    -		addSaveComponents(panel);
    -		
    -		this.setResizable(false);
    -	    this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
    -	    this.setContentPane(panel);
    -	    this.pack();
    -	    this.setLocationRelativeTo(parent);
    -	}
    -	
    -	private JPanel createBasePanel() {
    -		JPanel panel = new JPanel();
    -	    panel.setLayout(null);
    -	    panel.setBounds(0, 0, 300, 500);
    -
    -	    Dimension size = new Dimension(300, 500);
    -	    panel.setMinimumSize(size);
    -	    panel.setPreferredSize(size);
    -	    panel.setMaximumSize(size);
    -
    -	    return panel;
    -	}
    -	
    -	private void addCellarComponents(JPanel panel) {
    -		CMLabel forCellarLabel = new CMLabel(Translations.t("gui_buildable_cellar"), 0, 0, 120, 30);
    -		cellarComboBox = new CMComboBox<QuantizationInformation>(fillComboBox("CELLAR"), 0, 40, 250, 30);
    -		cellarTextField = new CMTextField(0, 80, 160, 30);
    -		cellarButton = new CMButton(Translations.t("gui_b_add_level_value"), 170, 120, 80, 30);
    -		panel.add(forCellarLabel);
    -		panel.add(cellarComboBox);
    -		panel.add(cellarTextField);
    -		panel.add(cellarButton);
    -	}
    -	
    -	private void addFloorComponents(JPanel panel) {
    -		CMLabel forFloorLabel = new CMLabel(Translations.t("gui_buildable_floor"), 0, 180, 120, 30);
    -		floorComboBox = new CMComboBox<QuantizationInformation>(fillComboBox("FLOOR"), 0, 220, 250, 30);
    -		floorTextField = new CMTextField(0, 260, 160, 30);
    -		floorButton = new CMButton(Translations.t("gui_b_add_level_value"), 170, 300, 80, 30);
    -		panel.add(forFloorLabel);
    -		panel.add(floorComboBox);
    -		panel.add(floorTextField);
    -		panel.add(floorButton);
    -	}
    -	
    -	private void addGardenComponents(JPanel panel) {
    -		CMLabel forGardenLabel = new CMLabel(Translations.t("gui_buildable_garden"), 0, 340, 120, 30);
    -		gardenComboBox = new CMComboBox<QuantizationInformation>(fillComboBox("GARDEN"), 0, 380, 250, 30);
    -		gardenTextField = new CMTextField(0, 80, 160, 30);
    -		gardenButton = new CMButton(Translations.t("gui_b_add_level_value"), 170, 420, 80, 30);
    -		panel.add(forGardenLabel);
    -		panel.add(gardenComboBox);
    -		panel.add(gardenTextField);
    -		panel.add(gardenButton);
    -	}
    -	
    -	private void addSaveComponents(JPanel panel) {
    -		CMButton saveButton = new CMButton(Translations.t("gui_b_save_settings"), 0, 460, 100, 30);
    -		panel.add(saveButton);
    -	}
    -	
    -	private QuantizationInformation[] fillComboBox(String buildableType) {		
    -		Set<String> acceptedTypes = BuildableSettings.DEFAULT_SETTINGS.keySet();
    -		String inputType = buildableType.toUpperCase();
    -		if (acceptedTypes.contains(inputType)) {
    -			Set<QuantizationInformation> set = null;
    -			if(inputType.equals("CELLAR")) {
    -				set = MappingFileEditorDialog.cellarQuant.keySet();
    -			}
    -			if(inputType.equals("FLOOR")) {
    -				set = MappingFileEditorDialog.floorQuant.keySet();
    -			}
    -			if(inputType.equals("GARDEN")) {
    -				set = MappingFileEditorDialog.gardenQuant.keySet();
    -			}			 
    -			QuantizationInformation[] boxItems = new QuantizationInformation[set.size()];
    -			boxItems = set.toArray(boxItems);
    -			return boxItems;
    -		}
    -		else return null;
    -	}
    -}
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMTable.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMTable.java
    new file mode 100644
    index 00000000..36c33859
    --- /dev/null
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMTable.java
    @@ -0,0 +1,63 @@
    +package codemetropolis.toolchain.gui.components;
    +
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +import javax.swing.JTable;
    +import javax.swing.table.TableModel;
    +
    +/**
    + * Custom table class for using in the Mapping file editor dialog.
    + * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
    + */
    +public class CMTable extends JTable {
    +	
    +	private static final long serialVersionUID = 1L;
    +	private static final int LIST_MAX_SIZE = 10;
    +
    +	private List<Object> conversionList;
    +	
    +	/**
    +	 * @see javax.swing.JTable#JTable()
    +	 */
    +	public CMTable() {
    +		super();
    +		conversionList = new ArrayList<Object>(10);
    +		setUpConversionList(LIST_MAX_SIZE);
    +	}
    +	
    +	/**
    +	 * @see javax.swing.JTable#JTable(Object[][], Object[])
    +	 */
    +	public CMTable(Object[][] rowData, Object[] columnNames) {
    +		super(rowData, columnNames);
    +		conversionList = new ArrayList<Object>();
    +		setUpConversionList(LIST_MAX_SIZE);
    +	}
    +	
    +	/**
    +	 * @see javax.swing.JTable#JTable(TableModel)
    +	 */
    +	public CMTable(TableModel model) {
    +		super(model);
    +		conversionList = new ArrayList<Object>();
    +		setUpConversionList(LIST_MAX_SIZE);
    +	}
    +	
    +	/**
    +	 * Returns with the {@link List} storing the conversions.
    +	 * @return The {@link List} storing the conversions.
    +	 */
    +	public List<Object> getConversionList() {
    +		return conversionList;
    +	}
    +	
    +	/**
    +	 * Fills up the list storing the conversions with dummy data in purpose of avoiding {@link IndexOutOfBoundsException} when setting values.
    +	 */
    +	private void setUpConversionList(int size) {
    +		for(int i = 0; i < size; i++) {
    +			conversionList.add(null);
    +		}
    +	}
    +}
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/Conversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/Conversion.java
    deleted file mode 100644
    index 25bfd83a..00000000
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/Conversion.java
    +++ /dev/null
    @@ -1,10 +0,0 @@
    -package codemetropolis.toolchain.gui.conversions;
    -
    -/**
    - * Abstract base class for representing the various types of conversions.
    - * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
    - *
    - */
    -public abstract class Conversion {
    -
    -}
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java
    deleted file mode 100644
    index 2763a5e9..00000000
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/EmptyConversion.java
    +++ /dev/null
    @@ -1,10 +0,0 @@
    -package codemetropolis.toolchain.gui.conversions;
    -
    -/**
    - * Class for representing an empty conversion (when there is no conversion needed).
    - * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
    - *
    - */
    -public class EmptyConversion extends Conversion {
    -
    -}
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormalizeConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormalizeConversion.java
    deleted file mode 100644
    index e9d14bb1..00000000
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/NormalizeConversion.java
    +++ /dev/null
    @@ -1,10 +0,0 @@
    -package codemetropolis.toolchain.gui.conversions;
    -
    -/**
    - * Class for representing a normalize conversion.
    - * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
    - *
    - */
    -public class NormalizeConversion extends Conversion {
    -
    -}
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java
    index b05a6b1e..cb0e95bc 100644
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/QuantizationConversion.java
    @@ -7,7 +7,7 @@
      * Class for representing a quantization conversion.
      * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
      */
    -public class QuantizationConversion extends Conversion {
    +public class QuantizationConversion{
     	private List<String> levels;
     	
     	public QuantizationConversion() {
    @@ -17,4 +17,8 @@ public QuantizationConversion() {
     	public List<String> getLevels(){
     		return levels;
     	}
    +	
    +	public void setLevels(List<String> levels) {
    +		this.levels = levels;
    +	}
     }
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java
    deleted file mode 100644
    index b17ccbce..00000000
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToDoubleConversion.java
    +++ /dev/null
    @@ -1,9 +0,0 @@
    -package codemetropolis.toolchain.gui.conversions;
    -
    -/**
    - * Class for representing a toDouble conversion.
    - * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
    - */
    -public class ToDoubleConversion extends Conversion{
    -
    -}
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java
    deleted file mode 100644
    index b54cf56a..00000000
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/conversions/ToIntConversion.java
    +++ /dev/null
    @@ -1,9 +0,0 @@
    -package codemetropolis.toolchain.gui.conversions;
    -
    -/**
    - * Class for representing a toInt conversion.
    - * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
    - */
    -public class ToIntConversion extends Conversion {
    -
    -}
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java
    index 8b5f5d19..d637803a 100644
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/utils/TransferHelper.java
    @@ -6,15 +6,12 @@
     import java.awt.datatransfer.UnsupportedFlavorException;
     import java.awt.Point;
     import java.io.IOException;
    -import java.util.List;
    -
     import javax.swing.JComponent;
     import javax.swing.JTable;
     import javax.swing.TransferHandler;
     
     import codemetropolis.toolchain.gui.MappingFileEditorDialog;
     import codemetropolis.toolchain.gui.MappingFileEditorDialog.AssignResult;
    -import codemetropolis.toolchain.gui.conversions.*;
     
     /**
      * This class is used to handle the transfer of
    @@ -40,7 +37,7 @@ public TransferHelper() {
          * @return boolean available dropping
          */
         public boolean typeChecker (Object obj, JTable target, int row, int col) {
    -    	int currCol = col -1;
    +    	int currCol = col - 1;
     
         	if (col == 0) {	return false; }
     
    @@ -48,24 +45,6 @@ public boolean typeChecker (Object obj, JTable target, int row, int col) {
         	String dragValue = obj.toString();
         	String dropValue = value.toString();
     
    -    	JTable currGardenTable = MappingFileEditorDialog.getGardenTable();
    -    	JTable currFloorTable = MappingFileEditorDialog.getFloorTable();
    -    	JTable currCellarTable = MappingFileEditorDialog.getCellarTable();
    -
    -    	List<Conversion> conversionList = MappingFileEditorDialog.gardenConversion;
    -
    -    	if (target == currGardenTable) {
    -    		conversionList = MappingFileEditorDialog.gardenConversion;
    -    	}
    -
    -    	if (target == currFloorTable) {
    -    		conversionList = MappingFileEditorDialog.floorConversion;
    -    	}
    -
    -		if (target == currCellarTable) {
    -			conversionList = MappingFileEditorDialog.cellarConversion;
    -		}
    -
         	dragValue = dragValue.split(": ")[1];
         	dropValue = dropValue.split(": ")[1];
         	
    @@ -81,31 +60,20 @@ public boolean typeChecker (Object obj, JTable target, int row, int col) {
         	}
         	    	
         	switch (cell) {
    -    	case CANNOT_ASSIGN:
    -    		return false;
    -
    -    	case NO_CONVERSION:
    -    		conversionList.add(row, new EmptyConversion());
    -    		return true;
    -
    -    	case TO_INT:
    -    		conversionList.add(row, new ToIntConversion());
    -    		return true;
    -
    -    	case TO_DOUBLE:
    -    		conversionList.add(row, new ToDoubleConversion());
    -    		return true;
    -
    -    	case NORMALIZE:
    -    		conversionList.add(row, new NormalizeConversion());
    -    		return true;
    -
    -    	case QUANTIZATON:
    -    		conversionList.add(row, new QuantizationConversion());
    -    		return true;
    -
    -    	default:
    -    		return true;
    +	    	case CANNOT_ASSIGN:
    +	    		return false;
    +	    	case NO_CONVERSION:
    +	    		return true;
    +	    	case TO_INT:
    +	    		return true;
    +	    	case TO_DOUBLE:
    +	    		return true;
    +	    	case NORMALIZE:
    +	    		return true;
    +	    	case QUANTIZATON:
    +	    		return true;
    +	    	default:
    +	    		return true;
         	}
         }
     
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg b/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg
    index 05d9382c..042d4176 100644
    --- a/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg
    +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/buildableProperties.cmcfg
    @@ -1,5 +1,5 @@
    -FLOOR=width,height,length,character,external_character
    -CELLAR=width,height,length,character,external_character
    +FLOOR=width,height,length,character,external_character,torches
    +CELLAR=width,height,length,character,external_character,torches
     GARDEN=tree-ratio,mushroom-ratio,flower-ratio
     GROUND=
     
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties
    index 48adc1e8..2c375210 100644
    --- a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties
    +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties
    @@ -50,9 +50,12 @@ gui_exec_title = Execution output
     # Mapping file editor dialog
     gui_add_resource_title = Add new resource...
     gui_mapping_editor_title = Mapping file editor
    +gui_set_quant_parameters_title = Set quantization parameters...
     gui_b_add = Add
    -gui_b_add_level_value = Add level value
    +gui_b_add_level = Add level
    +gui_b_clear_levels = Clear levels
     gui_b_conversions = Conversions...
    +gui_b_ok = OK
     gui_b_remove = Remove
     gui_b_specify_path = Specify path
     gui_b_save_mapping_file = Save mapping file
    @@ -84,12 +87,14 @@ gui_err_config_file_not_found = Config file not found! All buildable attributes
     gui_err_graph_not_found = SourceMeter graph file not found at the expected location!
     gui_err_invaild_config_file_format = Invalid config file format! All buildable attributes will be displayed.
     gui_err_invalid_converter = Invalid converter type!
    +gui_err_invalid_level_value = The specified value to this level is invalid!
     gui_err_invalid_mapping_xml = Invalid mapping xml file!
     gui_err_invalid_mc_root = Invalid minecraft root!
     gui_err_invalid_project_name = Invalid project name!
     gui_err_invalid_project_root = Invalid project root!
     gui_err_invalid_sm_exe = Invalid SourceMeter exe file!
     gui_err_resources_empty_no_selected = The list of the resources is empty or there is no resource selected!
    +gui_err_no_level_declared = You must specify at least one level!
     gui_err_missing_cdf_file = There is no file existing on the path specified!
     gui_err_mkdir_project_failed = Failed to create project folder under minecraft root!
     gui_err_mkdir_sm_failed = Failed to create SourceMeter results folder!
    
    From 3d1a6ac559ff5aea5cba5804e3d7e09ce5c7ac24 Mon Sep 17 00:00:00 2001
    From: Viktor Meszaros <h665772@stud.u-szeged.hu>
    Date: Sun, 29 Apr 2018 15:55:30 +0200
    Subject: [PATCH 58/58] Further improvements and fixes (see below for details).
    
    - Fix typo in javadoc comment in CodeMetropolisGUI.java
    - Listener actions of the mapping fie editor dialog moved to seperate listener classes.
    - Removed unnecessary GUI components from the mapping file editor dialog.
    - Extend CMTable class with 'source' and 'target' attributes.
    - Extend BrowseListener.java with new constructor.
    - New GUI translations, removed unnecessary ones.
    - Added listener class for creating the output mapping file.
    - ISSUE: you cannot specify the path for the output trough the GUI. You have to specify it in the code!
    ---
     .../CodeMetropolis_toolchain.log.1            |  69 ++++++++
     .../CodeMetropolis_toolchain.log.2            |  39 +++++
     .../CodeMetropolis_toolchain.log.3            |  21 +++
     .../toolchain/gui/CodeMetropolisGUI.java      |   2 +-
     .../gui/MappingFileEditorDialog.java          | 153 +++--------------
     .../toolchain/gui/components/CMTable.java     |  30 ++++
     .../listeners/AddResourceListener.java        |  78 +++++++++
     .../components/listeners/BrowseListener.java  |  22 +++
     .../listeners/NewAssigninmentListener.java    |  96 +++++++++++
     .../listeners/RemoveResourceListener.java     |  72 ++++++++
     .../listeners/SaveMappingListener.java        | 160 ++++++++++++++++++
     .../main/resources/translations.properties    |   6 +-
     12 files changed, 612 insertions(+), 136 deletions(-)
     create mode 100644 sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.1
     create mode 100644 sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.2
     create mode 100644 sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.3
     create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/AddResourceListener.java
     create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/NewAssigninmentListener.java
     create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/RemoveResourceListener.java
     create mode 100644 sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/SaveMappingListener.java
    
    diff --git a/sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.1 b/sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.1
    new file mode 100644
    index 00000000..de5817b8
    --- /dev/null
    +++ b/sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.1
    @@ -0,0 +1,69 @@
    +ápr. 29, 2018 12:36:05 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Mapping: Reading map file...
    +
    +ápr. 29, 2018 12:36:05 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Mapping: Reading map file done.
    +
    +ápr. 29, 2018 12:36:05 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Mapping: Validating mapping...
    +
    +ápr. 29, 2018 12:36:05 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Mapping: Validating mapping done.
    +
    +ápr. 29, 2018 12:36:05 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Mapping: Reading CDF file...
    +
    +ápr. 29, 2018 12:36:06 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Mapping: Reading CDF file done.
    +
    +ápr. 29, 2018 12:36:06 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Mapping: Linking metrics to buildables...
    +
    +ápr. 29, 2018 12:36:06 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Mapping: Linking metrics to buildables done.
    +
    +ápr. 29, 2018 12:36:06 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Mapping: Generating input for placing...
    +
    +ápr. 29, 2018 12:36:06 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Mapping: Generating input for placing done.
    +
    +ápr. 29, 2018 12:36:06 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Reading input file...
    +
    +ápr. 29, 2018 12:36:06 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Reading input file done.
    +
    +ápr. 29, 2018 12:36:06 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Calculating building sizes and positions...
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Calculating building sizes and positions done.
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Generating input for rendering...
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Generating input for rendering done.
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Reading input file...
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Reading input file done.
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: 232 buildables were found.
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Generating blocks...
    +
    +ápr. 29, 2018 1:13:47 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Generating blocks done. 459118 blocks were generated in 0 hours and 37 minutes.
    +
    +ápr. 29, 2018 1:13:47 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Placing blocks...
    +
    +ápr. 29, 2018 1:13:49 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Placing blocks done in 0 hours and 0 minutes.
    +
    diff --git a/sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.2 b/sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.2
    new file mode 100644
    index 00000000..d78e5cea
    --- /dev/null
    +++ b/sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.2
    @@ -0,0 +1,39 @@
    +ápr. 29, 2018 12:36:06 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Reading input file...
    +
    +ápr. 29, 2018 12:36:06 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Reading input file done.
    +
    +ápr. 29, 2018 12:36:06 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Calculating building sizes and positions...
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Calculating building sizes and positions done.
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Generating input for rendering...
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Placing: Generating input for rendering done.
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Reading input file...
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Reading input file done.
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: 232 buildables were found.
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Generating blocks...
    +
    +ápr. 29, 2018 1:13:47 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Generating blocks done. 459118 blocks were generated in 0 hours and 37 minutes.
    +
    +ápr. 29, 2018 1:13:47 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Placing blocks...
    +
    +ápr. 29, 2018 1:13:49 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Placing blocks done in 0 hours and 0 minutes.
    +
    diff --git a/sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.3 b/sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.3
    new file mode 100644
    index 00000000..64a1ca7c
    --- /dev/null
    +++ b/sources/codemetropolis-toolchain-gui/CodeMetropolis_toolchain.log.3
    @@ -0,0 +1,21 @@
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Reading input file...
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Reading input file done.
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: 232 buildables were found.
    +
    +ápr. 29, 2018 12:36:07 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Generating blocks...
    +
    +ápr. 29, 2018 1:13:47 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Generating blocks done. 459118 blocks were generated in 0 hours and 37 minutes.
    +
    +ápr. 29, 2018 1:13:47 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Placing blocks...
    +
    +ápr. 29, 2018 1:13:49 DU codemetropolis.toolchain.commons.util.FileLogger logInfo
    +INFO: Rendering: Placing blocks done in 0 hours and 0 minutes.
    +
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java
    index 9efcd6fb..de165bbb 100644
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/CodeMetropolisGUI.java
    @@ -318,7 +318,7 @@ public void actionPerformed(ActionEvent event) {
       }
       
       /**
    -   * Chacks if the input cdf file does exist or not.
    +   * Checks if the input cdf file does exist or not.
        * @param cdfPath The path of the cdf file.
        * @return The cdf file exists or not.
        */
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java
    index 7c69f24b..ad08da2d 100644
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/MappingFileEditorDialog.java
    @@ -2,9 +2,6 @@
     
     import java.awt.Dimension;
     import java.awt.Font;
    -import java.awt.GridLayout;
    -import java.awt.event.ActionEvent;
    -import java.awt.event.ActionListener;
     import java.awt.Rectangle;
     import java.io.FileNotFoundException;
     import java.util.Arrays;
    @@ -15,17 +12,13 @@
     import javax.swing.DropMode;
     import javax.swing.JDialog;
     import javax.swing.JFileChooser;
    -import javax.swing.JLabel;
     import javax.swing.JList;
     import javax.swing.JOptionPane;
     import javax.swing.JPanel;
     import javax.swing.JTabbedPane;
     import javax.swing.JTable;
    -import javax.swing.JTextField;
     import javax.swing.ListModel;
     import javax.swing.ListSelectionModel;
    -import javax.swing.event.TableModelEvent;
    -import javax.swing.event.TableModelListener;
     import javax.swing.filechooser.FileFilter;
     import javax.swing.table.DefaultTableModel;
     import javax.swing.table.TableModel;
    @@ -33,13 +26,15 @@
     import codemetropolis.toolchain.gui.beans.BadConfigFileFomatException;
     
     import codemetropolis.toolchain.gui.components.CMButton;
    -import codemetropolis.toolchain.gui.components.CMCheckBox;
     import codemetropolis.toolchain.gui.components.CMLabel;
     import codemetropolis.toolchain.gui.components.CMScrollPane;
     import codemetropolis.toolchain.gui.components.CMTable;
     import codemetropolis.toolchain.gui.components.CMTextField;
    +import codemetropolis.toolchain.gui.components.listeners.AddResourceListener;
     import codemetropolis.toolchain.gui.components.listeners.BrowseListener;
    -import codemetropolis.toolchain.gui.conversions.QuantizationConversion;
    +import codemetropolis.toolchain.gui.components.listeners.NewAssigninmentListener;
    +import codemetropolis.toolchain.gui.components.listeners.RemoveResourceListener;
    +import codemetropolis.toolchain.gui.components.listeners.SaveMappingListener;
     import codemetropolis.toolchain.gui.utils.BuildableSettings;
     import codemetropolis.toolchain.gui.utils.Property;
     import codemetropolis.toolchain.gui.utils.PropertyCollector;
    @@ -115,7 +110,6 @@ public enum AssignResult {CANNOT_ASSIGN, NO_CONVERSION, TO_INT, TO_DOUBLE, NORMA
     	private ListModel<String> resourcesListmodel;
     	private JList<String> resourcesList;
     	
    -	private CMCheckBox useMappingCheckBox;
     	private CMTextField pathField;
     	
     	/**
    @@ -165,9 +159,10 @@ public MappingFileEditorDialog(String cdfFilePath, CodeMetropolisGUI cmGui) {
     		loadDisplayedInfo(cdfFilePath);
     		
     		JPanel panel = createBasePanel();
    +		addBuildableTabs(panel);
     		addResourceOptions(panel);
     		addSaveOptions(panel);
    -		addBuildableTabs(panel);
    +		
     		
     		this.setResizable(false);
     	    this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
    @@ -208,79 +203,14 @@ private void addResourceOptions(JPanel panel) {
     	    resourcesList.setVisibleRowCount(-1);
     		CMScrollPane resourcesScrollPane = new CMScrollPane(resourcesList, 10, 35, 240, 120);
     		
    +		List<JList<String>> lists = Arrays.asList(resourcesList, cellarList, floorList, gardenList);
    +		List<JTable> tables = Arrays.asList(cellarTable, floorTable, gardenTable);
    +		
     		CMButton resourcesAddButton = new CMButton(Translations.t("gui_b_add"), 265, 35, 120, 30);
    -		resourcesAddButton.addActionListener(new ActionListener() {
    -			
    -			@Override
    -			public void actionPerformed(ActionEvent e) {
    -				JTextField nameField = new JTextField();
    -				JTextField valueField = new JTextField();
    +		resourcesAddButton.addActionListener(new AddResourceListener(lists));
     				
    -				JPanel addResourcePanel = new JPanel();
    -				addResourcePanel.setLayout(new GridLayout(4, 2));
    -				addResourcePanel.add(new JLabel("Resource name:"));
    -				addResourcePanel.add(nameField);
    -				addResourcePanel.add(new JLabel("Resource value:"));
    -				addResourcePanel.add(valueField);
    -				
    -				int result = JOptionPane.showConfirmDialog(null, addResourcePanel, Translations.t("gui_add_resource_title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
    -				if(result == JOptionPane.OK_OPTION) {
    -					if (nameField.getText().matches("[a-zA-Z0-9]+") &&
    -						(valueField.getText().matches("[0-9]+(.[0-9]+)?")) ||  BuildableSettings.VALID_CHARACTER_TYPES.contains(valueField.getText())) {
    -						//Produce the resource string from the text fields...
    -						String resourceToAdd = nameField.getText() + ": " + valueField.getText();
    -						//Add the newly defined resource to the property lists of the buildables and to the resource list (on top left of the window).
    -						List<JList<String>> lists = Arrays.asList(resourcesList, cellarList, floorList, gardenList);
    -						for (JList<String> list : lists) {
    -							DefaultListModel<String> listModel = (DefaultListModel<String>) list.getModel();
    -							listModel.addElement(resourceToAdd);
    -						} 
    -					}
    -					else {
    -						JOptionPane.showMessageDialog(
    -								null,
    -								Translations.t("gui_err_name_value_not_valid"),
    -								Translations.t("gui_err_title"),
    -								JOptionPane.ERROR_MESSAGE);
    -					}
    -				}
    -			}
    -		});
     		CMButton resourcesRemoveButton = new CMButton(Translations.t("gui_b_remove"), 265, 80, 120, 30);
    -		resourcesRemoveButton.addActionListener(new ActionListener() {
    -			
    -			@Override
    -			public void actionPerformed(ActionEvent e) {
    -				int indexToRemove = resourcesList.getSelectedIndex();
    -				if(indexToRemove == -1) {
    -					JOptionPane.showMessageDialog(
    -							null,
    -							Translations.t("gui_err_resources_empty_no_selected"),
    -							Translations.t("gui_err_title"),
    -							JOptionPane.ERROR_MESSAGE);
    -				}
    -				else {
    -					String resourceToRemove = resourcesList.getModel().getElementAt(indexToRemove);
    -					List<JList<String>> lists = Arrays.asList(resourcesList, cellarList, floorList, gardenList);
    -					List<JTable> tables = Arrays.asList(cellarTable, floorTable, gardenTable);
    -					for(JList<String> list : lists) {
    -						DefaultListModel<String> listModel = (DefaultListModel<String>) list.getModel();
    -						listModel.removeElement(resourceToRemove);
    -					}
    -					for(JTable table : tables) {
    -						int rows = table.getRowCount();
    -						int columns = table.getColumnCount();
    -						for(int i = 0; i < rows; i++)
    -							for(int j = 0; j < columns; j++) {
    -								String cellValue = (String) table.getValueAt(i, j);
    -								if(resourceToRemove.equals(cellValue)) {
    -									table.setValueAt(null, i, j);
    -								}
    -							}
    -					}
    -				}				
    -			}
    -		});
    +		resourcesRemoveButton.addActionListener(new RemoveResourceListener(resourcesList, lists, tables));
     		
     		panel.add(resourcesLabel);
     		panel.add(resourcesScrollPane);
    @@ -296,18 +226,17 @@ private void addSaveOptions(JPanel panel) {
     		CMLabel saveSettingsLabel = new CMLabel(Translations.t("gui_l_save_settings"), 415, 0, 120, 30);
     		CMLabel pathLabel = new CMLabel(Translations.t("gui_l_path"), 415, 35, 60, 30);
     		pathField = new CMTextField(475, 35, 270, 30);
    +		pathField.setEditable(false);
     		CMButton specifyPathButton = new CMButton(Translations.t("gui_b_specify_path"), 415, 80, 120, 30);
    -		useMappingCheckBox = new CMCheckBox(550, 80, 30, 30);
    -		CMLabel useMappingLabel = new CMLabel(Translations.t("gui_l_use_mapping_file"),575, 80, 180, 30);
     		CMButton saveMappingFileButton = new CMButton(Translations.t("gui_b_save_mapping_file"), 415, 120, 165, 30);
    -		specifyPathButton.addActionListener(new BrowseListener(pathField, JFileChooser.FILES_ONLY, XML_FILTER));
    +		specifyPathButton.addActionListener(new BrowseListener(pathField, Translations.t("gui_save_filechooser_title"), JFileChooser.FILES_ONLY, XML_FILTER));
    +		List<CMTable> tables = Arrays.asList(cellarTable, floorTable, gardenTable);
    +		saveMappingFileButton.addActionListener(new SaveMappingListener(pathField.getText(), tables, resourcesList));
     		
     		panel.add(saveSettingsLabel);
     		panel.add(pathLabel);
     		panel.add(pathField);
     		panel.add(specifyPathButton);
    -		panel.add(useMappingCheckBox);
    -		panel.add(useMappingLabel);
     		panel.add(saveMappingFileButton);
     	}
     	
    @@ -352,6 +281,8 @@ private void createCellarTab() {
     	    CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30);
     	    
     	    cellarTable = setUpBuildableTable("CELLAR");
    +	    cellarTable.setTarget("cellar");
    +	    cellarTable.setSource("attribute");
     	    Rectangle bounds = cellarTable.getBounds();
     	    CMScrollPane scrollPane = new CMScrollPane(cellarTable, bounds.x, bounds.y, bounds.width, bounds.height + 30);
     	    
    @@ -391,6 +322,8 @@ private void createFloorTab() {
     	    CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30);		
     	    
     	    floorTable = setUpBuildableTable("FLOOR");
    +	    floorTable.setTarget("floor");
    +	    floorTable.setSource("method");
     	    Rectangle bounds = floorTable.getBounds();
     	    CMScrollPane scrollPane = new CMScrollPane(floorTable, bounds.x, bounds.y, bounds.width, bounds.height + 30);
     	    
    @@ -430,6 +363,8 @@ private void createGardenTab() {
     	    CMLabel propertiesLabel = new CMLabel(Translations.t("gui_l_properties"), 525, 15, 120, 30);
     	    
     	    gardenTable = setUpBuildableTable("GARDEN");
    +	    gardenTable.setTarget("garden");
    +	    gardenTable.setSource("class");
     	    Rectangle bounds = gardenTable.getBounds();
     	    CMScrollPane scrollPane = new CMScrollPane(gardenTable, bounds.x, bounds.y, bounds.width, bounds.height + 30);
     	    
    @@ -496,51 +431,7 @@ private CMTable setUpBuildableTable(String buildableType) {
     	    
     	    MappingFileEditorDialog self = this;
     	    //For listening changes in the table.
    -	    table.getModel().addTableModelListener(new TableModelListener() {
    -
    -			@Override
    -			public void tableChanged(TableModelEvent e) {
    -				int row = e.getFirstRow();
    -				String buildableAttribute = (String) table.getValueAt(row , 0);
    -				String assignedMetric = (String) table.getValueAt(row, 1);
    -				
    -				String buildableAttributeType = buildableAttribute.split(": ")[1];
    -				String assignedMetricType = assignedMetric.split(": ")[1];
    -				
    -				AssignResult cell = MappingFileEditorDialog.ASSIGN_RESULT_MATRIX.get(buildableAttributeType).get(assignedMetricType);
    -				switch (cell) {
    -				// We don't have to examine the case when there's no conversion allowed, because it was examined in the checkType method of the TransferHelper class.
    -			    	case NO_CONVERSION:
    -			    		table.getConversionList().set(row, null);
    -			    		System.out.println("null");
    -			    		break;
    -			    	case TO_INT:
    -			    		Object o = "toInt";
    -			    		table.getConversionList().set(row, o);
    -			    		System.out.println(o.toString());
    -			    		break;
    -			    	case TO_DOUBLE:
    -			    		Object o1 = "toDouble";
    -			    		table.getConversionList().set(row, o1);
    -			    		System.out.println(o1.toString());
    -			    		break;
    -			    	case NORMALIZE:
    -			    		Object o2 = "normalize";
    -			    		table.getConversionList().set(row, o2);
    -			    		System.out.println(o2.toString());
    -			    		break;
    -			    	case QUANTIZATON:
    -			    		QuantizationConversion qConv = new QuantizationConversion();
    -			    		table.getConversionList().set(row, qConv);
    -			    		System.out.println(qConv.toString());
    -			    		new QuantizationDialog(self, qConv, buildableAttributeType);
    -			    		break;
    -			    	default:
    -			    		break;
    -		    	}
    -			}
    -	    	
    -	    });
    +	    table.getModel().addTableModelListener(new NewAssigninmentListener(table, self));
     
     	    table.setFont(new Font("Source Sans Pro", Font.PLAIN, 14));
     	    table.setRowHeight(30);
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMTable.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMTable.java
    index 36c33859..ac546555 100644
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMTable.java
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/CMTable.java
    @@ -16,6 +16,8 @@ public class CMTable extends JTable {
     	private static final int LIST_MAX_SIZE = 10;
     
     	private List<Object> conversionList;
    +	private String target;
    +	private String source;
     	
     	/**
     	 * @see javax.swing.JTable#JTable()
    @@ -60,4 +62,32 @@ private void setUpConversionList(int size) {
     			conversionList.add(null);
     		}
     	}
    +	
    +	/**
    +	 * Getter for the {@code target} attribute.
    +	 */
    +	public String getTarget() {
    +		return target;
    +	}
    +
    +	/**
    +	 * Setter for the {@code target} attribute.
    +	 */
    +	public void setTarget(String target) {
    +		this.target = target;
    +	}
    +
    +	/**
    +	 * Getter for the {@code source} attribute.
    +	 */
    +	public String getSource() {
    +		return source;
    +	}
    +
    +	/**
    +	 * Setter for the {@code source} attribute.
    +	 */
    +	public void setSource(String source) {
    +		this.source = source;
    +	}
     }
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/AddResourceListener.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/AddResourceListener.java
    new file mode 100644
    index 00000000..353aa72c
    --- /dev/null
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/AddResourceListener.java
    @@ -0,0 +1,78 @@
    +package codemetropolis.toolchain.gui.components.listeners;
    +
    +import java.awt.GridLayout;
    +import java.awt.event.ActionEvent;
    +import java.awt.event.ActionListener;
    +import java.util.List;
    +
    +import javax.swing.DefaultListModel;
    +import javax.swing.JLabel;
    +import javax.swing.JList;
    +import javax.swing.JOptionPane;
    +import javax.swing.JPanel;
    +import javax.swing.JTextField;
    +
    +import codemetropolis.toolchain.gui.utils.BuildableSettings;
    +import codemetropolis.toolchain.gui.utils.Translations;
    +
    +/**
    + * Listener class for handling adding resources.
    + * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
    + */
    +public class AddResourceListener implements ActionListener {
    +	
    +	private List<JList<String>> lists;
    +	
    +	/**
    +	 *  Creates a new instance of {@link AddResourceListener} class.
    +	 */
    +	public AddResourceListener() {}
    +	
    +	/**
    +	 * Creates a new instance of {@link AddResourceListener} class with the given parameters.
    +	 * @param lists The lists to which we want to add the new resource as an element.
    +	 */
    +	public AddResourceListener(List<JList<String>> lists) {
    +		this.lists = lists;
    +	}
    +	
    +	@Override
    +	public void actionPerformed(ActionEvent e) {
    +		JTextField nameField = new JTextField();
    +		JTextField valueField = new JTextField();
    +		
    +		JPanel addResourcePanel = new JPanel();
    +		addResourcePanel.setLayout(new GridLayout(4, 2));
    +		addResourcePanel.add(new JLabel("Resource name:"));
    +		addResourcePanel.add(nameField);
    +		addResourcePanel.add(new JLabel("Resource value:"));
    +		addResourcePanel.add(valueField);
    +		
    +		int result = JOptionPane.showConfirmDialog(
    +				null,
    +				addResourcePanel,
    +				Translations.t("gui_add_resource_title"),
    +				JOptionPane.OK_CANCEL_OPTION,
    +				JOptionPane.INFORMATION_MESSAGE);
    +		if(result == JOptionPane.OK_OPTION) {
    +			if (nameField.getText().matches("[a-zA-Z0-9_]+") &&
    +				(valueField.getText().matches("[0-9]+(.[0-9]+)?")) ||  BuildableSettings.VALID_CHARACTER_TYPES.contains(valueField.getText())) {
    +				//Produce the resource string from the text fields...
    +				String resourceToAdd = nameField.getText() + ": " + valueField.getText();
    +				//Add the newly defined resource to the property lists of the buildables and to the resource list (on top left of the window).
    +				for (JList<String> list : lists) {
    +					DefaultListModel<String> listModel = (DefaultListModel<String>) list.getModel();
    +					listModel.addElement(resourceToAdd);
    +				} 
    +			}
    +			else {
    +				JOptionPane.showMessageDialog(
    +						null,
    +						Translations.t("gui_err_name_value_not_valid"),
    +						Translations.t("gui_err_title"),
    +						JOptionPane.ERROR_MESSAGE);
    +			}
    +		}
    +	}
    +
    +}
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/BrowseListener.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/BrowseListener.java
    index 9e4776d7..940ad475 100644
    --- a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/BrowseListener.java
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/BrowseListener.java
    @@ -7,6 +7,7 @@
     import javax.swing.filechooser.FileFilter;
     
     import codemetropolis.toolchain.gui.components.CMTextField;
    +import codemetropolis.toolchain.gui.utils.Translations;
     
     /**
      * Listener class to handle file and directory browsing.
    @@ -35,6 +36,27 @@ public BrowseListener(CMTextField fileNameTextField, int fileSelectionMode, File
           this.fileChooser.setFileFilter(filter);
         }
       }
    +  
    +  /**
    +   * Constructs a {@link BrowseListener} instance with the given parameters.
    +   *
    +   * @param fileNameTextField The {@link CMTextField} instance that will contain the path for the selected file.
    +   * @param title The text what will be displayed in the title bar.
    +   * @param fileSelectionMode The file selection mode for the {@link JFileChooser}. See
    +   *   {@link JFileChooser#setFileSelectionMode(int)} for details.
    +   * @param filter Optional. If provided, it will be used for the {@link JFileChooser} to filter the visible entities.
    +   */
    +  public BrowseListener(CMTextField fileNameTextField, String title, int fileSelectionMode, FileFilter filter) {
    +	    this.fileNameTextField = fileNameTextField;
    +
    +	    this.fileChooser = new JFileChooser();
    +	    this.fileChooser.setFileSelectionMode(fileSelectionMode);
    +	    this.fileChooser.setDialogTitle(title);
    +	    this.fileChooser.setApproveButtonText(Translations.t("gui_b_ok"));
    +	    if (filter != null) {
    +	      this.fileChooser.setFileFilter(filter);
    +	    }
    +  }
     
       @Override
       public void actionPerformed(ActionEvent event) {
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/NewAssigninmentListener.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/NewAssigninmentListener.java
    new file mode 100644
    index 00000000..f608291b
    --- /dev/null
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/NewAssigninmentListener.java
    @@ -0,0 +1,96 @@
    +package codemetropolis.toolchain.gui.components.listeners;
    +
    +import javax.swing.event.TableModelEvent;
    +import javax.swing.event.TableModelListener;
    +
    +import codemetropolis.toolchain.gui.MappingFileEditorDialog;
    +import codemetropolis.toolchain.gui.QuantizationDialog;
    +import codemetropolis.toolchain.gui.components.CMTable;
    +import codemetropolis.toolchain.gui.MappingFileEditorDialog.AssignResult;
    +import codemetropolis.toolchain.gui.conversions.QuantizationConversion;
    +
    +/**
    + * Listener class for handling changes in the buildable tables.
    + * @author Viktor Meszaros {@literal <MEVXAAT.SZE>}
    + */
    +public class NewAssigninmentListener implements TableModelListener {
    +	
    +	private CMTable changedTable;
    +	private MappingFileEditorDialog editorDialog;
    +	
    +	/**
    +	 * Constructs a {@link NewAssigninmentListener} instance.
    +	 */
    +	public NewAssigninmentListener() {}
    +	
    +	/**
    +	 * Constructs a {@link NewAssigninmentListener} instance with the given parameters.
    +	 * @param changedTable The table in which the change happened.
    +	 * @param editorDialog The mapping file editor dialog .
    +	 */
    +	public NewAssigninmentListener(CMTable changedTable, MappingFileEditorDialog editorDialog) {
    +		this.changedTable = changedTable;
    +		this.editorDialog = editorDialog;
    +	}
    +	
    +	@Override
    +	public void tableChanged(TableModelEvent e) {
    +		int row = e.getFirstRow();
    +		String buildableAttribute = (String) changedTable.getValueAt(row , 0);
    +		String assignedMetric = (String) changedTable.getValueAt(row, 1);
    +		
    +		/* The reason why we are checking this condition:
    +		 * When we are trying to remove a resource, the resource value will be deleted even from the the tables which store the various bindings.
    +		 * Because of that this event also will be fired. The value of the changed cell will be null in this case --> we will try to call split on null!
    +		 * So if the cell value changes to null, just don't do anything.  
    +		 */
    +		if (assignedMetric != null) {
    +			String buildableAttributeType = buildableAttribute.split(": ")[1];
    +			String assignedMetricType = assignedMetric.split(": ")[1];
    +			AssignResult cell = MappingFileEditorDialog.ASSIGN_RESULT_MATRIX.get(buildableAttributeType)
    +					.get(assignedMetricType);
    +			
    +			if(cell == null) {
    +				//We are trying to drag a resource... specify its type.
    +	    		if(assignedMetricType.matches("[0-9]+")) assignedMetricType = "int";
    +	    		else if(assignedMetricType.matches("[0-9]+.[0-9]+")) assignedMetricType = "float";
    +	    		else{
    +	    			assignedMetricType = "string";
    +	    		}
    +	    		cell = MappingFileEditorDialog.ASSIGN_RESULT_MATRIX.get(assignedMetricType).get(assignedMetricType);
    +			}
    +			
    +			switch (cell) {
    +				// We don't have to examine the case when there's no conversion allowed, because it was examined in the checkType method of the TransferHelper class.
    +				case NO_CONVERSION:
    +					changedTable.getConversionList().set(row, null);
    +					//System.out.println("null");
    +					break;
    +				case TO_INT:
    +					Object o = "to_int";
    +					changedTable.getConversionList().set(row, o);
    +					//System.out.println(o.toString());
    +					break;
    +				case TO_DOUBLE:
    +					Object o1 = "to_double";
    +					changedTable.getConversionList().set(row, o1);
    +					//System.out.println(o1.toString());
    +					break;
    +				case NORMALIZE:
    +					Object o2 = "normalize";
    +					changedTable.getConversionList().set(row, o2);
    +					//System.out.println(o2.toString());
    +					break;
    +				case QUANTIZATON:
    +					QuantizationConversion qConv = new QuantizationConversion();
    +					changedTable.getConversionList().set(row, qConv);
    +					//System.out.println(qConv.toString());
    +					new QuantizationDialog(editorDialog, qConv, buildableAttributeType);
    +					break;
    +				default:
    +					break;
    +			}
    +		}
    +	}
    +
    +}
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/RemoveResourceListener.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/RemoveResourceListener.java
    new file mode 100644
    index 00000000..cc89e2f7
    --- /dev/null
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/RemoveResourceListener.java
    @@ -0,0 +1,72 @@
    +package codemetropolis.toolchain.gui.components.listeners;
    +
    +import java.awt.event.ActionEvent;
    +import java.awt.event.ActionListener;
    +import java.util.List;
    +
    +import javax.swing.DefaultListModel;
    +import javax.swing.JList;
    +import javax.swing.JOptionPane;
    +import javax.swing.JTable;
    +
    +import codemetropolis.toolchain.gui.utils.Translations;
    +
    +/**
    + * Listener class for handling removing resources.
    + * @author Viktor Meszaros {@link <MEVXAAT.SZE>}
    + */
    +public class RemoveResourceListener implements ActionListener {
    +
    +	private JList<String> resourcesList;
    +	private List<JList<String>> lists;
    +	private List<JTable> tables;
    +	
    +	/**
    +	 * Creates a @link {@link RemoveResourceListener} instance
    +	 */
    +	public RemoveResourceListener() {}
    +	
    +	/**
    +	 * Creates a @link {@link RemoveResourceListener} instance with the given parameters.
    +	 * @param resourcesList The {@link JList} containing the list of resources.
    +	 * @param lists The list of lists from which we want to delete the resource.
    +	 * @param tables The list of tables from which we want to delete the resource if it's already assigned to something.
    +	 */
    +	public RemoveResourceListener(JList<String> resourcesList, List<JList<String>> lists, List<JTable> tables) {
    +		this.resourcesList = resourcesList;
    +		this.lists = lists;
    +		this.tables = tables;
    +	}
    +	
    +	@Override
    +	public void actionPerformed(ActionEvent e) {
    +		int indexToRemove = resourcesList.getSelectedIndex();
    +		if(indexToRemove == -1) {
    +			JOptionPane.showMessageDialog(
    +					null,
    +					Translations.t("gui_err_resources_empty_no_selected"),
    +					Translations.t("gui_err_title"),
    +					JOptionPane.ERROR_MESSAGE);
    +		}
    +		else {
    +			String resourceToRemove = resourcesList.getModel().getElementAt(indexToRemove);
    +			for(JList<String> list : lists) {
    +				DefaultListModel<String> listModel = (DefaultListModel<String>) list.getModel();
    +				listModel.removeElement(resourceToRemove);
    +			}
    +			for(JTable table : tables) {
    +				int rows = table.getRowCount();
    +				int columns = table.getColumnCount();
    +				for(int i = 0; i < rows; i++) {
    +					for(int j = 0; j < columns; j++) {
    +						String cellValue = (String) table.getValueAt(i, j);
    +						if(resourceToRemove.equals(cellValue)) {
    +							table.setValueAt(null, i, j);
    +						}
    +					}
    +				}
    +			}
    +		}
    +	}
    +	
    +}
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/SaveMappingListener.java b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/SaveMappingListener.java
    new file mode 100644
    index 00000000..8a083895
    --- /dev/null
    +++ b/sources/codemetropolis-toolchain-gui/src/main/java/codemetropolis/toolchain/gui/components/listeners/SaveMappingListener.java
    @@ -0,0 +1,160 @@
    +package codemetropolis.toolchain.gui.components.listeners;
    +
    +import java.awt.event.ActionEvent;
    +import java.awt.event.ActionListener;
    +import java.util.List;
    +
    +import javax.swing.JList;
    +import javax.swing.ListModel;
    +
    +import codemetropolis.toolchain.gui.components.CMTable;
    +import codemetropolis.toolchain.mapping.conversions.Conversion;
    +import codemetropolis.toolchain.mapping.exceptions.MappingWriterException;
    +import codemetropolis.toolchain.mapping.model.Binding;
    +import codemetropolis.toolchain.mapping.model.Constant;
    +import codemetropolis.toolchain.mapping.model.Linking;
    +import codemetropolis.toolchain.mapping.model.Mapping;
    +import codemetropolis.toolchain.mapping.model.Parameter;
    +
    +public class SaveMappingListener implements ActionListener {
    +	
    +	//private String savePath;	
    +	private List<CMTable> tables;
    +	private JList<String> resources;
    +	
    +	/**
    +	 * Creates a new instance of the {@link SaveMappingListener} class.
    +	 */
    +	public SaveMappingListener() {}
    +	
    +	/**
    +	 * Creates a new instance of the {@link SaveMappingListener} class with the given parameters.
    +	 * @param savePath The path where we want to save the mapping file.
    +	 * @param tables The list of tables which contain every necessary information to create linkings, bindings and conversions.
    +	 * @param resources The list of resources defined by the user.
    +	 */
    +	public SaveMappingListener(String savePath, List<CMTable> tables, JList<String> resources) {
    +		//this.savePath = savePath;
    +		//savePath.replace("\\", "/"); Didn't work...
    +		this.tables = tables;
    +		this.resources = resources;
    +	}
    +
    +	@Override
    +	public void actionPerformed(ActionEvent e) {
    +		Mapping mapping = new Mapping();
    +		mapping.setVersion("2.0");
    +		
    +		addResources(mapping);
    +		addLinkings(mapping);
    +		
    +		try {
    +			//!!!!
    +			mapping.writeToXML("C:\\Users\\Viktor\\Documents\\output_mappingX.xml");
    +		} catch (MappingWriterException ex) {
    +			ex.printStackTrace();
    +		}
    +	}
    +	
    +	/**
    +	 * Adds the list of resources to a {@link Mapping} instance.
    +	 * @param mapping The {@link Mapping} instance to which we want to add the list of resources.
    +	 */
    +	private void addResources(Mapping mapping) {
    +		ListModel<String> model = resources.getModel();
    +		
    +		for(int i = 0; i < model.getSize(); i++) {
    +			String id = model.getElementAt(i).split(": ")[0];
    +			String value = model.getElementAt(i).split(": ")[1];
    +			
    +			Constant resourceToAdd = new Constant(id, value);
    +			
    +			mapping.addResource(resourceToAdd);
    +		}
    +	}
    +	
    +	/**
    +	 * Adds the list of linkings to the {@link Mapping} object.
    +	 * @param mapping The {@link Mapping} object to which we want to add the linkings.
    +	 */
    +	private void addLinkings(Mapping mapping) {
    +		mapping.addLinking(new Linking("package", "ground"));
    +		for(CMTable table : tables) {			
    +			Linking linking = new Linking();
    +			linking.setTarget(table.getTarget());
    +			linking.setSource(table.getSource());
    +			addBindings(linking, table);
    +			mapping.addLinking(linking);
    +		}
    +	}
    +
    +	/**
    +	 * Adds the list of bindings to the {@link Linking} given as the parameter.
    +	 * @param linking The {@link Linking} to which we want to add the list of bindings.
    +	 * @param table The {@link CMTable} which holds the binding information. A row of the table represents a binding.
    +	 */
    +	private void addBindings(Linking linking, CMTable table) {
    +		//Iteration through the rows of the table - every row represents a possible binding.
    +		for(int i = 0; i < table.getRowCount(); i++) {
    +			Object assignedProperty = table.getValueAt(i, 1);
    +			if(assignedProperty != null) {
    +				Binding binding = new Binding();
    +				
    +				String to = ((String) table.getValueAt(i, 0)).split(": ")[0];
    +				String from = null;
    +				//Deciding that the assigned property is a resource or a metric.
    +				String var = (String) table.getValueAt(i, 1);
    +				if(!isResource(var)) {
    +					from = var.split(": ")[0];
    +				}
    +				else {
    +					//Apply "resource/constant" formatting...
    +					from = "${" + var.split(": ")[0] + "}";
    +				}
    +				
    +				binding.setFrom(from);
    +				binding.setTo(to);
    +				
    +				//Check if we have to use a conversion or not. In the second case we add it to the binding.
    +				Object conversion = table.getConversionList().get(i);
    +				Conversion conversionToAdd = null;
    +				if(conversion != null) {
    +					if(conversion instanceof String) {
    +						//Possible types: to_int, to_double, normalize
    +						//No need to set parameters(?)
    +						conversionToAdd = Conversion.createFromName((String) conversion);
    +					}
    +					if(conversion instanceof codemetropolis.toolchain.gui.conversions.QuantizationConversion) {
    +						//If in the table stored conversion is a quantization, then we instantiate a QuantizationConversion, then load its parameters...
    +						conversionToAdd = new codemetropolis.toolchain.mapping.conversions.QuantizationConversion();
    +						
    +						List<String> quantizationLevels = ((codemetropolis.toolchain.gui.conversions.QuantizationConversion) conversion).getLevels();
    +						for(int j = 0; j < quantizationLevels.size(); j++) {
    +							String name = "level" + j; // "level2", "level4", ...
    +							String value = quantizationLevels.get(j);
    +							Parameter param = new Parameter(name, value);
    +							conversionToAdd.addParameter(param);
    +						}
    +					}
    +					binding.addConversion(conversionToAdd);
    +				}
    +				
    +				linking.addBinding(binding);
    +			}
    +		}
    +	}
    +	
    +	/**
    +	 * Returns if property is a resource or not.
    +	 * @param var The cell value we want to examine.
    +	 * @return The property is a resource or not.
    +	 */
    +	private boolean isResource(String var) {
    +		String varType = var.split(": ")[1];
    +		if(varType.equals("int") || varType.equals("float") || varType.equals("string")) {
    +			return false;
    +		}
    +		return true;
    +	}
    +
    +}
    diff --git a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties
    index 2c375210..dd97beb0 100644
    --- a/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties
    +++ b/sources/codemetropolis-toolchain-gui/src/main/resources/translations.properties
    @@ -60,20 +60,17 @@ gui_b_remove = Remove
     gui_b_specify_path = Specify path
     gui_b_save_mapping_file = Save mapping file
     gui_b_save_settings = Save settings
    -gui_buildable_cellar = Buildable 'cellar':
    -gui_buildable_floor = Buildable 'floor':
    -gui_buildable_garden = Buildable 'garden':
     gui_l_assigned_to = Assigned to the source code element:
     gui_l_attribute = attribute
     gui_l_class = class
     gui_l_method = method
     gui_l_no_attributes = There is no buildable attribute to adjust.
     gui_l_package = package
    -gui_l_use_mapping_file = I want to use this file now
     gui_l_resources = Resources:
     gui_l_save_settings = Save settings:
     gui_l_path = Path:
     gui_l_properties = Properties:
    +gui_save_filechooser_title = Save to...
     gui_t_attribute = Attribute
     gui_t_assigned_propery = Assigned property
     gui_tab_cellar = Cellar
    @@ -92,6 +89,7 @@ gui_err_invalid_mapping_xml = Invalid mapping xml file!
     gui_err_invalid_mc_root = Invalid minecraft root!
     gui_err_invalid_project_name = Invalid project name!
     gui_err_invalid_project_root = Invalid project root!
    +gui_err_invalid_save_path = Invalid save path or the file does already exist!
     gui_err_invalid_sm_exe = Invalid SourceMeter exe file!
     gui_err_resources_empty_no_selected = The list of the resources is empty or there is no resource selected!
     gui_err_no_level_declared = You must specify at least one level!