Skip to content

Commit

Permalink
added missing files for testcases; removed lib directory; using only …
Browse files Browse the repository at this point in the history
…maven dependencies now
  • Loading branch information
wiwie committed Aug 15, 2016
1 parent 2d5f360 commit 79c65d9
Show file tree
Hide file tree
Showing 25 changed files with 751 additions and 98 deletions.
18 changes: 18 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Wiutils</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>auto,full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/Makejar.launch</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Binary file removed lib/junit-addons-1.4.jar
Binary file not shown.
Binary file removed lib/logback/slf4j-api-1.6.4-sources.jar
Binary file not shown.
Binary file removed lib/logback/slf4j-api-1.6.4.jar
Binary file not shown.
Binary file removed lib/pcolt/parallelcolt-0.9.4-doc.zip
Binary file not shown.
Binary file removed lib/pcolt/parallelcolt-0.9.4-src.zip
Binary file not shown.
Binary file removed lib/pcolt/parallelcolt-0.9.4.jar
Binary file not shown.
99 changes: 99 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.wiwie</groupId>
<artifactId>Wiutils</artifactId>
<version>1.1</version>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>


<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.9</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.0.9</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
<version>1.0.9</version>
</dependency>

<dependency>
<groupId>net.sourceforge.parallelcolt</groupId>
<artifactId>parallelcolt</artifactId>
<version>0.10.1</version>
</dependency>


</dependencies>

<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>

</build>
<repositories>
<repository>
<id>compbio_maven</id>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
</releases>
<name>CompBio Maven Repository</name>
<url>http://maven.compbio.sdu.dk/repository/snapshots/</url>
</repository>
<repository>
<id>central_maven</id>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
</releases>
<name>Central Maven</name>
<url>http://central.maven.org/</url>
</repository>
</repositories>

<distributionManagement>
<repository>
<uniqueVersion>true</uniqueVersion>
<id>archiva.snapshots</id>
<name>Snapshots</name>
<url>http://maven.compbio.sdu.dk/repository/snapshots/</url>
<layout>default</layout>
</repository>
</distributionManagement>




</project>
26 changes: 21 additions & 5 deletions src/de/wiwie/wiutils/utils/DoubleArray2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public DoubleArray2D(final int rows, final int columns) {
this(rows, columns, false);
}

public DoubleArray2D(final int rows, final int columns,
final boolean isSymmetric) {
public DoubleArray2D(final int rows, final int columns, final boolean isSymmetric) {
super(isSymmetric);
if (isSymmetric) {
this.array = new double[rows][];
Expand All @@ -27,8 +26,26 @@ public DoubleArray2D(final int rows, final int columns,
for (int i = 0; i < rows; i++) {
this.array[i] = new double[i + 1];
}
} else
} else {
this.array = new double[rows][columns];
}
for (int i = 0; i < this.array.length; i++) {
for (int j = 0; j < this.array[i].length; j++) {
this.array[i][j] = Double.NaN;
}
}
}

/*
* (non-Javadoc)
*
* @see de.wiwie.wiutils.utils.NumberArray2D#isSet(int, int)
*/
@Override
public boolean isSet(int x, int y) {
if (this.isSymmetric && x < y)
return !Double.isNaN(this.array[y][x]);
return !Double.isNaN(this.array[x][y]);
}

/*
Expand Down Expand Up @@ -91,7 +108,6 @@ public boolean equals(Object o) {
return false;

DoubleArray2D other = (DoubleArray2D) o;
return this.isSymmetric == other.isSymmetric
&& Arrays.deepEquals(this.array, other.array);
return this.isSymmetric == other.isSymmetric && Arrays.deepEquals(this.array, other.array);
}
}
15 changes: 15 additions & 0 deletions src/de/wiwie/wiutils/utils/FloatArray2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ public FloatArray2D(final int rows, final int columns,
}
} else
this.array = new float[rows][columns];
for (int i = 0; i < this.array.length; i++) {
for (int j = 0; j < this.array[i].length; j++) {
this.array[i][j] = Float.NaN;
}
}
}

/* (non-Javadoc)
* @see de.wiwie.wiutils.utils.NumberArray2D#isSet(int, int)
*/
@Override
public boolean isSet(int x, int y) {
if (this.isSymmetric && x < y)
return !Float.isNaN(this.array[y][x]);
return !Float.isNaN(this.array[x][y]);
}

/*
Expand Down
2 changes: 2 additions & 0 deletions src/de/wiwie/wiutils/utils/NumberArray2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public NumberArray2D(final boolean isSymmetric) {
public abstract double get(int x, int y);

public abstract void set(int x, int y, double val);

public abstract boolean isSet(int x, int y);

@Override
public abstract boolean equals(Object o);
Expand Down
7 changes: 4 additions & 3 deletions src/de/wiwie/wiutils/utils/Pair.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public Pair(final T el1, final U el2) {
public boolean equals(final Object p) {
if (p instanceof Pair) {
final Pair<T, U> other = (Pair<T, U>) p;
return other.e1.equals(this.e1) && other.e2.equals(this.e2);
return ((this.e1 == null && other.e1 == null) || (other.e1.equals(this.e1)))
&& ((this.e2 == null && other.e2 == null) || (other.e2.equals(this.e2)));
}
return false;
}
Expand All @@ -54,12 +55,12 @@ public void setSecond(final U newSecond) {

@Override
public int hashCode() {
return this.e1.hashCode() + this.e2.hashCode();
return (this.e1 != null ? this.e1.hashCode() : 0) + (this.e2 != null ? this.e2.hashCode() : 0);
}

@Override
public String toString() {
return "(" + this.e1.toString() + "\t" + this.e2.toString() + ")";
return "(" + (this.e1 != null ? this.e1.toString() : "null") + "\t" + (this.e2 != null ? this.e2.toString() : "null") + ")";
}

/**
Expand Down
23 changes: 19 additions & 4 deletions src/de/wiwie/wiutils/utils/ShortArray2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public ShortArray2D(final int rows, final int columns) {
this(rows, columns, false);
}

public ShortArray2D(final int rows, final int columns,
final boolean isSymmetric) {
public ShortArray2D(final int rows, final int columns, final boolean isSymmetric) {
super(isSymmetric);
if (isSymmetric) {
this.array = new short[rows][];
Expand All @@ -29,6 +28,23 @@ public ShortArray2D(final int rows, final int columns,
}
} else
this.array = new short[rows][columns];
for (int i = 0; i < this.array.length; i++) {
for (int j = 0; j < this.array[i].length; j++) {
this.array[i][j] = Short.MIN_VALUE;
}
}
}

/*
* (non-Javadoc)
*
* @see de.wiwie.wiutils.utils.NumberArray2D#isSet(int, int)
*/
@Override
public boolean isSet(int x, int y) {
if (this.isSymmetric && x < y)
return this.array[y][x] != Short.MIN_VALUE;
return this.array[x][y] != Short.MIN_VALUE;
}

/*
Expand Down Expand Up @@ -91,7 +107,6 @@ public boolean equals(Object o) {
return false;

ShortArray2D other = (ShortArray2D) o;
return this.isSymmetric == other.isSymmetric
&& Arrays.deepEquals(this.array, other.array);
return this.isSymmetric == other.isSymmetric && Arrays.deepEquals(this.array, other.array);
}
}
Loading

0 comments on commit 79c65d9

Please sign in to comment.