/** * generates internally a new XML document and clears also the IgnoreList and * the mappings for the Read/Write-Methods * * @throws Exception if something goes wrong */ public void clear() throws Exception { m_Document = new XMLDocument(); m_Document.setValidating(true); m_Document.newDocument(DOCTYPE, ROOT_NODE); m_Properties = new PropertyHandler(); m_CustomMethods = new XMLSerializationMethodHandler(this); m_ClassnameOverride = new Hashtable<Class<?>, String>(); // java.io.File is sometimes represented as another class: // - Win32: sun.awt.shell.Win32ShellFolder2 // - Linux: sun.awt.shell.DefaultShellFolder // -> we set it to "java.io.File" m_ClassnameOverride.put(java.io.File.class, java.io.File.class.getName()); setVersion(Version.VERSION); m_CurrentNode = null; }
/** * generates the XML structure for the header */ protected void headerToXML() { Element root; Element node; Element child; int i; root = m_Document.getDocumentElement(); root.setAttribute(ATT_NAME, validContent(m_Instances.relationName())); root.setAttribute(ATT_VERSION, Version.VERSION); // create "header" node node = m_Document.createElement(TAG_HEADER); root.appendChild(node); // add all attributes child = m_Document.createElement(TAG_ATTRIBUTES); node.appendChild(child); for (i = 0; i < m_Instances.numAttributes(); i++) { addAttribute(child, m_Instances.attribute(i)); } }
/** * Generates a comment header. * * @return the header */ protected String matlabHeader() { StringBuffer result; int i; result = new StringBuffer(); result.append("% Relation: " + getInstances().relationName() + "\n"); result.append("% Generated on: " + new Date() + "\n"); result.append("% Generated by: WEKA " + Version.VERSION + "\n"); result.append("%\n"); result.append("% "); for (i = 0; i < getInstances().numAttributes(); i++) { if (i > 0) { result.append((m_UseTabs ? "\t " : " ")); } result.append(Utils.padRight(getInstances().attribute(i).name(), (m_UseDouble ? 16 : 8) + 5)); } return result.toString(); }
/** * generates internally a new XML document and clears also the IgnoreList and * the mappings for the Read/Write-Methods * * @throws Exception if something goes wrong */ public void clear() throws Exception { m_Document = new XMLDocument(); m_Document.setValidating(true); m_Document.newDocument(DOCTYPE, ROOT_NODE); m_Properties = new PropertyHandler(); m_CustomMethods = new XMLSerializationMethodHandler(this); m_ClassnameOverride = new Hashtable<Class,String>(); // java.io.File is sometimes represented as another class: // - Win32: sun.awt.shell.Win32ShellFolder2 // - Linux: sun.awt.shell.DefaultShellFolder // -> we set it to "java.io.File" m_ClassnameOverride.put(java.io.File.class, java.io.File.class.getName()); setVersion(Version.VERSION); m_CurrentNode = null; }
/** * generates the XML structure for the header */ protected void headerToXML() { Element root; Element node; Element child; int i; root = m_Document.getDocumentElement(); root.setAttribute(ATT_NAME, validContent(m_Instances.relationName())); root.setAttribute(ATT_VERSION, Version.VERSION); // create "header" node node = m_Document.createElement(TAG_HEADER); root.appendChild(node); // add all attributes child = m_Document.createElement(TAG_ATTRIBUTES); node.appendChild(child); for (i = 0; i < m_Instances.numAttributes(); i++) addAttribute(child, m_Instances.attribute(i)); }
/** * Generates a comment header. * * @return the header */ protected String matlabHeader() { StringBuffer result; int i; result = new StringBuffer(); result.append("% Relation: " + getInstances().relationName() + "\n"); result.append("% Generated on: " + new Date() + "\n"); result.append("% Generated by: WEKA " + Version.VERSION + "\n"); result.append("%\n"); result.append("% "); for (i = 0; i < getInstances().numAttributes(); i++) { if (i > 0) result.append((m_UseTabs ? "\t " : " ")); result.append(Utils.padRight(getInstances().attribute(i).name(), (m_UseDouble ? 16 : 8) + 5)); } return result.toString(); }
/** * generates internally a new XML document and clears also the IgnoreList and * the mappings for the Read/Write-Methods * * @throws Exception if something goes wrong */ public void clear() throws Exception { m_Document = new XMLDocument(); m_Document.setValidating(true); m_Document.newDocument(DOCTYPE, ROOT_NODE); m_Properties = new PropertyHandler(); m_CustomMethods = new XMLSerializationMethodHandler(this); m_ClassnameOverride = new Hashtable(); // java.io.File is sometimes represented as another class: // - Win32: sun.awt.shell.Win32ShellFolder2 // - Linux: sun.awt.shell.DefaultShellFolder // -> we set it to "java.io.File" m_ClassnameOverride.put(java.io.File.class, java.io.File.class.getName()); setVersion(Version.VERSION); m_CurrentNode = null; }
/** * Checks if the Weka version is recent enough to run MOA. * For example, if the Weka version is not recent, there may be problems * due to the fact that <code>Instance</code> was a class before 3.7.1 and * now is an interface. * * @return true if the Weka version is recent. */ public static boolean isWekaVersionOK() { try { Class.forName("weka.core.Version"); Version version = new Version(); if (version.isOlder("3.7.1")) { System.err.println(); System.err.println(Globals.getWorkbenchInfoString()); System.err.println(); System.err.print("Weka 3.7.1 or higher is required to run MOA. "); System.err.println("Weka version " + Version.VERSION + " found"); return false; } else { return true; } } catch (ClassNotFoundException exception) { // It is not available return true; } }
/** * Performs the actual printing of the header. */ protected void doPrintHeader() { append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); append("\n"); append(DTD + "\n\n"); append("<" + TAG_PREDICTIONS + " " + ATT_VERSION + "=\"" + Version.VERSION + "\"" + " " + ATT_NAME + "=\"" + sanitize(m_Header.relationName()) + "\">\n"); }
/** * Initializes a PMML object with header information. * * @return an initialized PMML object */ public static PMML initPMML() { PMML pmml = new PMML(); pmml.setVersion(PMML_VERSION); Header header = new Header(); header.setCopyright("WEKA"); header.setApplication(new Application("WEKA", Version.VERSION)); pmml.setHeader(header); return pmml; }
/** * creates and displays the title. * * @param title the additional part of the title */ protected void createTitle(String title) { String newTitle; newTitle = "Weka " + new Version(); if (title.length() != 0) { newTitle += " - " + title; } setTitle(newTitle); }
/** * creates and displays the title. * * @param title the additional part of the title */ protected void createTitle(String title) { String newTitle; newTitle = "Weka " + new Version(); if (title.length() != 0) newTitle += " - " + title; setTitle(newTitle); }
/** * creates and displays the title. * * @param title the additional part of the title */ protected void createTitle(String title) { String newTitle; newTitle = Messages.getInstance().getString("GUIChooser_CreateTitle_Text_Front") + new Version(); if (title.length() != 0) { newTitle += Messages.getInstance().getString("GUIChooser_CreateTitle_Text_End") + title; } setTitle(newTitle); }
/** * creates and displays the title. * * @param title the additional part of the title */ protected void createTitle(String title) { String newTitle; newTitle = Messages.getInstance().getString( "Main_CreateTitle_NewTitle_Text") + new Version(); if (title.length() != 0) { newTitle += " - " + title; } setTitle(newTitle); }
/** * Checks if the Weka version is recent enough to run MOA. * For example, if the Weka version is not recent, there may be problems * due to the fact that <code>Instance</code> was a class before 3.7.1 and * now is an interface. * * @return true if the Weka version is recent. */ public static boolean isWekaVersionOK() { Version version = new Version(); if (version.isOlder("3.7.1")) { System.err.println(); System.err.println(Globals.getWorkbenchInfoString()); System.err.println(); System.err.print("Weka 3.7.1 or higher is required to run MOA. "); System.err.println("Weka version " + Version.VERSION + " found"); return false; } else { return true; } }