Skip to content

Commit

Permalink
adding the rest
Browse files Browse the repository at this point in the history
  • Loading branch information
seninp committed Feb 23, 2015
1 parent 83eee75 commit 403c064
Show file tree
Hide file tree
Showing 11 changed files with 676 additions and 85 deletions.
339 changes: 339 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions build.xml
@@ -0,0 +1,98 @@
<project name="build" default="compile">
<description>
The basic build file for the GrammarViz system. I have collected tasks from other files in here because
Travis CI runs only "ant test"
</description>

<!-- Always make environment variables available with the "env." prefix. -->
<property environment="env" />

<!-- Make sure we're running a Java 7 or better. -->
<condition property="java.7.available">
<or>
<contains string="${java.version}" substring="1.7" />
<contains string="${java.version}" substring="1.8" />
</or>
</condition>
<fail message="This package requires Java 7+." unless="java.7.available" />

<!-- Make sure we're running Ant 1.8. -->
<condition property="ant.1.8.available">
<contains string="${ant.version}" substring="1.8" />
</condition>
<condition property="ant.available" value="yes">
<isset property="ant.1.8.available" />
</condition>
<fail message="This package requires Ant 1.8." unless="ant.available" />

<!-- Basic properties for this system. -->
<property name="system.name" value="grammarviz" />
<property name="majorVersionNumber" value="2" />
<property name="minorVersionNumber" value="0" />
<tstamp>
<format property="DAYSTAMP" pattern="Mdd" />
</tstamp>
<property name="version" value="${majorVersionNumber}.${minorVersionNumber}.${DAYSTAMP}" />

<!-- Basic directory structure. -->
<property name="src.dir" location="${basedir}/src" />
<property name="lib.dir" location="${basedir}/lib" />
<property name="build.dir" location="${basedir}/build" />
<property name="junit.dir" location="${build.dir}/junit" />


<!-- The compile classpath -->
<path id="compile.classpath">
<fileset file="${lib.dir}/junit/junit-4.10.jar" />
<fileset dir="${lib.dir}/time" />
<fileset dir="${lib.dir}/logger" />
</path>

<!-- The Travis CI-specific system test, so far I have only JUnit here. -->
<target name="test" depends="junit.tool" description="Run JUnit tests.">
<fail if="junit.failed">JUnit test case(s) failed.</fail>
</target>

<!-- This is how we roll tests -->
<target name="junit.tool" depends="compile" description="Run JUnit tests.">
<mkdir dir="${junit.dir}" />
<!-- Run the tests, which are all classes whose name starts with 'Test'. -->
<!-- Note that emma is forking in its JUnit as well. -->
<junit printsummary="withOutAndErr" haltonfailure="${junit.haltonfailure}" fork="yes" failureproperty="junit.failed">
<classpath>
<pathelement location="${build.dir}/classes" />
<path refid="compile.classpath" />
</classpath>
<sysproperty key="user.dir" value="${basedir}" />
<formatter type="xml" />
<batchtest todir="${junit.dir}">
<fileset dir="${src.dir}" includes="**/Test*.java" />
</batchtest>
</junit>
</target>

<!-- The source code compilation -->
<target name="compile" description="Compiles the code.">
<!-- Now compile the code into build/classes -->
<mkdir dir="${build.dir}/classes" />
<javac srcdir="${src.dir}" destdir="${build.dir}/classes" source="1.7" target="1.7" debug="on" includeAntRuntime="no">
<classpath refid="compile.classpath" />
<compilerarg value="-Xlint:all" />
<!-- <compilerarg value="-Werror" /> -->
</javac>
</target>

<!-- Cleans-up the thing -->
<target name="clean" description="Delete build/ directory and top-level jar files.">
<delete>
<fileset dir="${basedir}" includes="*.jar" />
</delete>
<delete dir="${build.dir}" />
</target>

<!-- The windowZ specific task -->
<target name="convertLineEndings" description="Makes line endings compatible with host platform.">
<fixcrlf srcdir="${basedir}" includes="*.build.xml" />
</target>

</project>
37 changes: 37 additions & 0 deletions findbugs.build.xml
@@ -0,0 +1,37 @@
<project name="findbugs" default="findbugs">
<description>
Provides the FindBugs tool and the Hackystat FindBugs sensor.
</description>

<import file="build.xml" />
<property environment="env" />
<property name="findbugs.dir" location="${build.dir}/findbugs" />

<target name="findbugs" depends="findbugs.tool, findbugs.report" description="Runs the FindBugs tool, report, and sensor." />

<target name="findbugs.tool" depends="compile" description="Runs FindBugs over the byte code to check for problems.">
<!-- Fail this target if FindBugs is not installed. -->
<available file="${env.FINDBUGS_HOME}/lib/findbugs.jar" property="findbugs.available" />
<fail unless="findbugs.available" message="Error: FINDBUGS_HOME not set or findbugs.jar not found." />
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${env.FINDBUGS_HOME}/lib/findbugs-ant.jar" />

<!-- Run FindBugs. -->
<mkdir dir="${findbugs.dir}" />
<findbugs home="${env.FINDBUGS_HOME}" failOnError="${findbugs.failOnError}" warningsProperty="findbugs.warningsfound" output="xml:withMessages" outputFile="${findbugs.dir}/findbugs.xml" excludeFilter="${basedir}/lib/findbugs/hackystat.findbugs.exclude.xml">
<auxClasspath>
<path refid="compile.classpath" />
</auxClasspath>
<sourcePath>
<fileset dir="${src.dir}">
<include name="**/*.java" />
</fileset>
</sourcePath>
<class location="${build.dir}/classes" />
</findbugs>
</target>

<target name="findbugs.report" depends="findbugs.tool" description="Generate an HTML report on FindBugs.">
<xslt in="${findbugs.dir}/findbugs.xml" style="${env.FINDBUGS_HOME}/src/xsl/default.xsl" out="${findbugs.dir}/findbugs-default.html" />
</target>

</project>
71 changes: 71 additions & 0 deletions jacoco.build.xml
@@ -0,0 +1,71 @@
<project name="emma" default="jacoco" xmlns:jacoco="antlib:org.jacoco.ant">

<description>
Provides the Jacoco tool.
</description>

<import file="build.xml" />
<property environment="env" />
<!-- <property name="build.dir" location="${basedir}/build" /> -->
<property name="jacoco.dir" location="${build.dir}/jacoco" />
<property name="jacoco.report.dir" location="${jacoco.dir}/report" />
<property name="jacoco.exec.file" location="${jacoco.dir}/jacoco.exec" />


<!-- Step 1: Import JaCoCo Ant tasks -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${lib.dir}/jacoco/jacocoant.jar" />
</taskdef>

<target name="jacoco" depends="jacoco.tool, jacoco.report" description="Runs Jacoco." />

<!-- Step 2: Wrap test execution with the JaCoCo coverage task -->
<target name="jacoco.tool" depends="clean, compile" description="Cleans, compiles, collects coverage.">
<mkdir dir="${jacoco.dir}" />

<jacoco:coverage destfile="${jacoco.exec.file}" excludes="**/Test*.java">
<junit maxmemory="512M" printsummary="withOutAndErr" haltonfailure="${junit.haltonfailure}" fork="yes">
<classpath>
<pathelement location="${build.dir}/classes" />
<path refid="compile.classpath" />
</classpath>
<batchtest todir="{build.dir}/classes">
<fileset dir="${src.dir}" includes="**/Test*.java" />
</batchtest>
</junit>
</jacoco:coverage>
</target>

<target name="jacoco.report" depends="jacoco.tool">

<!-- Step 3: Create coverage report -->
<jacoco:report>

<!-- This task needs the collected execution data and ... -->
<executiondata>
<file file="${jacoco.exec.file}" />
</executiondata>

<!-- the class files and optional source files ... -->
<structure name="JaCoCo Ant Example">
<classfiles>
<fileset dir="${build.dir}/classes">
<exclude name="**/*Test*.class" />
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}" />
</sourcefiles>
</structure>

<!-- to produce reports in different formats. -->
<html destdir="${jacoco.report.dir}" />
<csv destfile="${jacoco.report.dir}/report.csv" />
<xml destfile="${jacoco.report.dir}/report.xml" />
</jacoco:report>
</target>

</project>



41 changes: 41 additions & 0 deletions jar.build.xml
@@ -0,0 +1,41 @@
<project name="jar" default="jar">
<description>
Provides the target for building a jar file.
</description>

<import file="build.xml" />
<property name="tmp.dir" location="${basedir}/tmp" />

<target name="jar" depends="clean, compile" description="Create the sax-vsm-classic.jar.">

<!-- make sure to include dependencies into dep.jar -->
<delete dir="${tmp.dir}" />
<mkdir dir="${tmp.dir}" />

<!-- Define the directories and distribution name -->
<mkdir dir="${tmp.dir}" />
<copy todir="${tmp.dir}">
<fileset dir="${basedir}/build/classes/">
<include name="edu/hawaii/jmotif/**" />
</fileset>
</copy>

<unjar src="${lib.dir}/logger/logback-classic-1.1.2.jar" dest="${tmp.dir}" />
<unjar src="${lib.dir}/logger/logback-core-1.1.2.jar" dest="${tmp.dir}" />
<unjar src="${lib.dir}/logger/slf4j-api-1.7.7.jar" dest="${tmp.dir}" />
<unjar src="${lib.dir}/time/joda-time-2.1.jar" dest="${tmp.dir}" />

<jar destfile="${basedir}/sax-vsm-g${majorVersionNumber}${minorVersionNumber}.jar" basedir="${tmp.dir}">
<manifest>
<attribute name="Implementation-Title" value="SAX-VSM Classic" />
<attribute name="Implementation-Version" value="${version}" />
<attribute name="Implementation-Vendor" value="Collaborative Software Development Laboratory, University of Hawaii" />
<attribute name="Main-Class" value="edu.hawaii.jmotif.direct.DirectSampler" />
</manifest>
</jar>
<delete dir="${tmp.dir}" />

</target>

</project>

42 changes: 42 additions & 0 deletions junit.build.xml
@@ -0,0 +1,42 @@
<project name="junit" default="junit">
<description>
Provides the full JUnit task.
</description>

<import file="build.xml" />
<property name="junit.dir" location="${build.dir}/junit" />

<target name="junit" depends="junit.tool, junit.report" description="Runs JUnit, JunitReport">
<fail if="junit.failed">JUnit test case(s) failed.</fail>
</target>

<target name="junit.tool" depends="compile" description="Run JUnit tests.">
<mkdir dir="${junit.dir}" />
<!-- Run the tests, which are all classes whose name starts with 'Test'. -->
<!-- Fork is on until I can figure out how to stop the sensorbase and unbind the port. -->
<!-- Note that emma is forking in its JUnit as well. -->
<junit printsummary="withOutAndErr" haltonfailure="${junit.haltonfailure}" fork="yes" failureproperty="junit.failed">
<classpath>
<pathelement location="${build.dir}/classes" />
<path refid="compile.classpath" />
</classpath>
<sysproperty key="user.dir" value="${basedir}" />
<formatter type="xml" />
<batchtest todir="${junit.dir}">
<fileset dir="${src.dir}" includes="**/Test*.java" />
</batchtest>
</junit>
</target>

<target name="junit.report" description="Generates an HTML report for JUnit.">
<taskdef name="junitreport" classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator" />
<junitreport todir="${junit.dir}">
<fileset dir="${junit.dir}" includes="TEST-*.xml" />
<report format="frames" todir="${junit.dir}" />
</junitreport>
</target>

</project>



42 changes: 42 additions & 0 deletions pmd.build.xml
@@ -0,0 +1,42 @@
<project name="pmd" default="pmd">
<description>
Provides the PMD tool and the Hackystat PMD sensor.

Note: If you download a different version (say, 3.8), then you can override the default version (3.7) as follows:
ant -Dpmd.version=3.8 -f pmd.build.xml pmd.tool
</description>

<import file="build.xml" />
<property environment="env" />
<property name="pmd.dir" location="${build.dir}/pmd" />
<property name="pmd.version" value="5.1.2" />
<property name="pmd.jar" value="pmd-${pmd.version}.jar" />

<target name="pmd" depends="pmd.tool, pmd.report" description="Runs the PMD tool and report." />

<target name="pmd.tool" description="Runs PMD over the source code to check for problems.">
<!-- Fail this target if PMD is not installed. -->
<available file="${env.PMD_HOME}/lib/${pmd.jar}" property="pmd.available" />
<fail unless="pmd.available" message="Error: PMD_HOME not set or ${pmd.jar} not found." />
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
<classpath>
<fileset dir="${env.PMD_HOME}/lib" includes="*.jar" />
</classpath>
</taskdef>

<!-- Run PMD -->
<mkdir dir="${pmd.dir}" />
<pmd shortFilenames="false" failonerror="${pmd.failonerror}" failOnRuleViolation="${pmd.failonerror}">
<ruleset>${basedir}/lib/pmd/hackystat.pmd.xml</ruleset>
<formatter type="xml" toFile="${pmd.dir}/pmd.xml" />
<formatter type="text" toConsole="true" />
<fileset dir="${src.dir}" includes="**/*.java" excludes="**/sequitur/**,**/webexample/**,**/*TelemetryAlphabet**" />
</pmd>
</target>

<target name="pmd.report" description="Generates HTML reports on the PMD output.">
<xslt in="${pmd.dir}/pmd.xml" style="${env.PMD_HOME}/etc/xslt/pmd-report-per-class.xslt" out="${pmd.dir}/pmd-report-per-class.html" />
</target>

</project>

8 changes: 4 additions & 4 deletions src/edu/hawaii/jmotif/algorithm/MatrixFactory.java
Expand Up @@ -86,7 +86,7 @@ public static double[][] transpose(double[][] a) {
}

/**
* Mimics Matlab function for reshape: returns the m-by-n matrix B whose elements are taken
* Returns the m-by-n matrix B whose elements are taken
* column-wise from A. An error results if A does not have m*n elements.
*
* @param a the source matrix.
Expand All @@ -96,15 +96,15 @@ public static double[][] transpose(double[][] a) {
* @return reshaped matrix.
*/
public static double[][] reshape(double[][] a, int n, int m) {
int cEl = 0;
int currentElement = 0;
int aRows = a.length;

double[][] res = new double[n][m];

for (int j = 0; j < m; j++) {
for (int i = 0; i < n; i++) {
res[i][j] = a[cEl % aRows][cEl / aRows];
cEl++;
res[i][j] = a[currentElement % aRows][currentElement / aRows];
currentElement++;
}
}

Expand Down
26 changes: 0 additions & 26 deletions src/edu/hawaii/jmotif/algorithm/TestVector.java

This file was deleted.

0 comments on commit 403c064

Please sign in to comment.