Compare commits
8 Commits
284cd73b24
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
f193a27d5f
|
|||
|
666faa9559
|
|||
|
db56ede58e
|
|||
|
46a6c01be8
|
|||
|
25a70331f5
|
|||
|
d5fb7b4521
|
|||
|
abf61f5395
|
|||
|
2dfd645577
|
2
.mvn/maven.config
Normal file
2
.mvn/maven.config
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
-Dstyle.color=always
|
||||||
|
-T1C
|
||||||
21
README.md
21
README.md
@@ -1,23 +1,15 @@
|
|||||||
# JavaClasses
|
# JavaClasses
|
||||||
|
|
||||||
|
[](https://sonarqube.mattrixwv.com/dashboard?id=JavaClasses)
|
||||||
|
|
||||||
This is a set of classes and functions, not part of the standard library, that I have found it helpful to keep around.
|
This is a set of classes and functions, not part of the standard library, that I have found it helpful to keep around.
|
||||||
|
|
||||||
# Installation
|
## Stopwatch
|
||||||
In order to use these in a program they need to be installed with maven. I normally use `mvn clean package install`. From there you can import them into a maven project using
|
|
||||||
```XML
|
|
||||||
<dependency>
|
|
||||||
<groupId>mattrixwv</groupId>
|
|
||||||
<artifactId>myClasses</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
```
|
|
||||||
Then import them into a program by `import mattrixwv.Algorithms;` or `import mattrixwv.Stopwatch;`.
|
|
||||||
|
|
||||||
# Stopwatch
|
|
||||||
This is a class that allows you to determine the execution time of an algorithm.
|
This is a class that allows you to determine the execution time of an algorithm.
|
||||||
You can get specific resolutions of time through their own get functions, all of which return double.
|
You can get specific resolutions of time through their own get functions, all of which return double.
|
||||||
However I have built it a function, getStr(), that automatically chooses the best resolution and returns both the number and resolution as a string.
|
However I have built it a function, getStr(), that automatically chooses the best resolution and returns both the number and resolution as a string.
|
||||||
|
|
||||||
Example of usage:
|
|
||||||
```Java
|
```Java
|
||||||
Stopwatch timer = new Stopwatch();
|
Stopwatch timer = new Stopwatch();
|
||||||
timer.start();
|
timer.start();
|
||||||
@@ -28,6 +20,7 @@ Example of usage:
|
|||||||
System.out.printf("It took %f milliseconds to run this algorithm", timer.getMilli());
|
System.out.printf("It took %f milliseconds to run this algorithm", timer.getMilli());
|
||||||
```
|
```
|
||||||
|
|
||||||
# Algorithms
|
## Algorithms
|
||||||
This is a class that contains many different algorithms that I have found it useful to keep around. This is used extensively in my ProjectEuler code found at https://bitbucket.org/Mattrixwv/ProjectEuler
|
|
||||||
|
This is a class that contains many different algorithms that I have found it useful to keep around. This is used extensively in my [Project Euler](https://git.mattrixwv.com/ProjectEuler/ProjectEulerJava) project.
|
||||||
All methods are overloaded to allow for using Integer, Long, and BigInteger types.
|
All methods are overloaded to allow for using Integer, Long, and BigInteger types.
|
||||||
|
|||||||
26
pom.xml
26
pom.xml
@@ -15,19 +15,19 @@
|
|||||||
<developer>
|
<developer>
|
||||||
<name>Matthew Ellison</name>
|
<name>Matthew Ellison</name>
|
||||||
<email>m_ellison@ymail.com</email>
|
<email>m_ellison@ymail.com</email>
|
||||||
<url>https://bitbucket.org/Mattrixwv</url>
|
<url>https://git.mattrixwv.com/matthew</url>
|
||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:git:git://bitbucket.org/Mattrixwv/JavaClasses.git</connection>
|
<connection>scm:git:git://git.mattrixwv.com/BaseLibraries/JavaClasses.git</connection>
|
||||||
<developerConnection>scm:git:ssh://bitbucket.org:Mattrixwv/JavaClasses.git</developerConnection>
|
<developerConnection>scm:git:ssh://git.mattrixwv.com/BaseLibraries/JavaClasses.git</developerConnection>
|
||||||
<url>https://bitbucket.org/Mattrixwv/JavaClasses/src</url>
|
<url>https://git.mattrixwv.com/BaseLibraries/JavaClasses</url>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<groupId>com.mattrixwv</groupId>
|
<groupId>com.mattrixwv</groupId>
|
||||||
<artifactId>myClasses</artifactId>
|
<artifactId>myClasses</artifactId>
|
||||||
<version>1.3.10-SNAPSHOT</version>
|
<version>1.4.2-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>myClasses</name>
|
<name>myClasses</name>
|
||||||
<description>A grouping of functions that I've found useful</description>
|
<description>A grouping of functions that I've found useful</description>
|
||||||
@@ -77,7 +77,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.owasp</groupId>
|
<groupId>org.owasp</groupId>
|
||||||
<artifactId>dependency-check-maven</artifactId>
|
<artifactId>dependency-check-maven</artifactId>
|
||||||
<version>12.1.9</version>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>dependency-check</id>
|
<id>dependency-check</id>
|
||||||
@@ -90,6 +89,10 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!--Deployment-->
|
<!--Deployment-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.sonatype.central</groupId>
|
||||||
|
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
@@ -252,7 +255,7 @@
|
|||||||
</formats>
|
</formats>
|
||||||
<nvdApiServerId>nvd</nvdApiServerId>
|
<nvdApiServerId>nvd</nvdApiServerId>
|
||||||
<failBuildOnCVSS>7</failBuildOnCVSS>
|
<failBuildOnCVSS>7</failBuildOnCVSS>
|
||||||
<ossIndexServerId>ossrh</ossIndexServerId>
|
<ossIndexServerId>ossindex</ossIndexServerId>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
@@ -309,15 +312,6 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
<version>3.2.8</version>
|
<version>3.2.8</version>
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>sign-artifacts</id>
|
|
||||||
<phase>verify</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>sign</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
|
|||||||
@@ -1,28 +1,7 @@
|
|||||||
//JavaClasses/src/test/java/com/mattrixwv/TestTriple.java
|
|
||||||
//Mattrixwv
|
|
||||||
// Created: 08-20-22
|
|
||||||
//Modified: 04-13-23
|
|
||||||
/*
|
|
||||||
Copyright (C) 2023 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.mattrixwv;
|
package com.mattrixwv;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@@ -40,6 +19,8 @@ public class TestTriple{
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConstructor(){
|
public void testConstructor(){
|
||||||
|
triple = new Triple<>(1L, 2L, 3L);
|
||||||
|
|
||||||
assertEquals(1L, triple.getA());
|
assertEquals(1L, triple.getA());
|
||||||
assertEquals(2L, triple.getB());
|
assertEquals(2L, triple.getB());
|
||||||
assertEquals(3L, triple.getC());
|
assertEquals(3L, triple.getC());
|
||||||
|
|||||||
Reference in New Issue
Block a user