[DEV] normalyze with MAVEN
This commit is contained in:
parent
810b7a9b72
commit
b766394b6b
18
.classpath
18
.classpath
@ -1,31 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<classpathentry kind="src" output="out/maven/classes" path="src">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="out/eclipse/classes-test" path="test/src">
|
||||
<classpathentry kind="src" output="out/maven/test-classes" path="test/src">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="lib/spotbugs-annotations-4.2.2.jar">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
|
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-reggol">
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="out/eclipse/classes"/>
|
||||
<classpathentry kind="output" path="out/maven/classes"/>
|
||||
</classpath>
|
||||
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="net.sf.eclipsecs.core.CheckstyleBuilder"/>
|
||||
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||
</launchConfiguration>
|
13
.project
13
.project
@ -12,12 +12,23 @@
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
|
||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>LaunchConfigHandle</key>
|
||||
<value><project>/.externalToolBuilders/net.sf.eclipsecs.core.CheckstyleBuilder.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>
|
||||
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
|
||||
</natures>
|
||||
|
Binary file not shown.
124
pom.xml
Normal file
124
pom.xml
Normal file
@ -0,0 +1,124 @@
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>jatria-soft</groupId>
|
||||
<artifactId>etk</artifactId>
|
||||
<version>0.1.0</version>
|
||||
<properties>
|
||||
<maven.compiler.version>3.1</maven.compiler.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
|
||||
<maven.dependency.version>3.1.1</maven.dependency.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.atria-soft.org/api/packages/jatria-soft/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.atria-soft.org/api/packages/jatria-soft/maven</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.atria-soft.org/api/packages/jatria-soft/maven</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>2.0.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-annotations</artifactId>
|
||||
<version>4.7.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.9.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<testSourceDirectory>test/src</testSourceDirectory>
|
||||
<directory>${project.basedir}/out/maven/</directory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven.compiler.version}</version>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
<!--<encoding>${project.build.sourceEncoding}</encoding>-->
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Create the source bundle -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- junit results -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>fully.qualified.MainClass</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Java-doc generation for stand-alone site -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<show>private</show>
|
||||
<nohelp>true</nohelp>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<!-- Generate Java-docs As Part Of Project Reports -->
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
</project>
|
@ -7,6 +7,6 @@ open module org.atriasoft.etk {
|
||||
exports org.atriasoft.etk.math;
|
||||
exports org.atriasoft.etk.util;
|
||||
|
||||
requires transitive org.atriasoft.reggol;
|
||||
requires transitive org.slf4j;
|
||||
requires com.github.spotbugs.annotations;
|
||||
}
|
||||
|
@ -3,7 +3,8 @@ package org.atriasoft.etk;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
@ -12,6 +13,7 @@ import org.atriasoft.etk.internal.Log;
|
||||
*/
|
||||
|
||||
public class ConfigFont {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(ConfigFont.class);
|
||||
private final Map<String, Uri> fonts = new HashMap<>();
|
||||
private String name = "FreeSans";
|
||||
private int size = 12;
|
||||
@ -23,7 +25,7 @@ public class ConfigFont {
|
||||
public Uri getFontUri(final String fontName) {
|
||||
Uri out = this.fonts.get(fontName);
|
||||
if (out == null) {
|
||||
Log.warning(" try to get unexistant font : " + fontName);
|
||||
LOGGER.warn(" try to get unexistant font : " + fontName);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@ -52,7 +54,7 @@ public class ConfigFont {
|
||||
public void set(final String fontName, final int size) {
|
||||
this.name = fontName;
|
||||
this.size = size;
|
||||
Log.debug("Set default Font : '" + this.name + "' size=" + this.size);
|
||||
LOGGER.trace("Set default Font : '" + this.name + "' size=" + this.size);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +63,7 @@ public class ConfigFont {
|
||||
*/
|
||||
public void setName(final String fontName) {
|
||||
this.name = fontName;
|
||||
Log.debug("Set default Font : '" + this.name + "' size=" + this.size + " (change name only)");
|
||||
LOGGER.trace("Set default Font : '" + this.name + "' size=" + this.size + " (change name only)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,6 +72,6 @@ public class ConfigFont {
|
||||
*/
|
||||
public void setSize(final int size) {
|
||||
this.size = size;
|
||||
Log.debug("Set default Font : '" + this.name + "' size=" + this.size + " (change size only)");
|
||||
LOGGER.trace("Set default Font : '" + this.name + "' size=" + this.size + " (change size only)");
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
package org.atriasoft.etk;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Configs {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Configs.class);
|
||||
private static ConfigFont fonts = new ConfigFont();
|
||||
|
||||
public static ConfigFont getConfigFonts() {
|
||||
|
@ -5,7 +5,8 @@
|
||||
*/
|
||||
package org.atriasoft.etk;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* in the dimension class we store the data as the more usefull unit (pixel)
|
||||
@ -14,6 +15,7 @@ import org.atriasoft.etk.internal.Log;
|
||||
public record Dimension1f(
|
||||
float size,
|
||||
Distance type) {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Dimension1f.class);
|
||||
|
||||
private static final float BASIC_RATIO = 72.0f / 25.4f;
|
||||
public static final Dimension1f ZERO = new Dimension1f(0);
|
||||
@ -99,13 +101,11 @@ public record Dimension1f(
|
||||
final Distance type = Distance.parseEndSmallString(config);
|
||||
config = type.removeEndString(config);
|
||||
if (type == Distance.UNKNOW) {
|
||||
Log.critical("Can not parse dimension : '" + config + "'");
|
||||
LOGGER.error("FATAL: Can not parse dimension : '" + config + "'");
|
||||
return null;
|
||||
}
|
||||
final float tmp = Float.valueOf(config);
|
||||
final Dimension1f ret = new Dimension1f(tmp, type);
|
||||
Log.verbose(" config dimension : '" + config + "' == > " + ret.toString());
|
||||
return ret;
|
||||
return new Dimension1f(tmp, type);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,9 +5,10 @@
|
||||
*/
|
||||
package org.atriasoft.etk;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector2i;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* in the dimension class we store the data as the more usefull unit (pixel)
|
||||
@ -16,6 +17,7 @@ import org.atriasoft.etk.math.Vector2i;
|
||||
public record Dimension2f(
|
||||
Vector2f size,
|
||||
Distance type) {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Dimension2f.class);
|
||||
|
||||
public static final Dimension2f ZERO = new Dimension2f(Vector2f.ZERO, Distance.PIXEL);
|
||||
private static Vector2f ratio = new Vector2f(9999999, 888888);
|
||||
@ -76,12 +78,12 @@ public record Dimension2f(
|
||||
* @note: same as @ref setPixelPerInch (internal manage convention)
|
||||
*/
|
||||
public static void setPixelRatio(final Vector2f ratio, final Distance type) {
|
||||
Log.info("Set a new screen ratio for the screen : ratio=" + ratio + " type=" + type);
|
||||
LOGGER.info("Set a new screen ratio for the screen : ratio=" + ratio + " type=" + type);
|
||||
final Dimension2f conversion = new Dimension2f(ratio, type);
|
||||
Log.info(" == > " + conversion);
|
||||
LOGGER.info(" == > " + conversion);
|
||||
Dimension2f.ratio = conversion.getMillimeter();
|
||||
invRatio = new Vector2f(1.0f / Dimension2f.ratio.x(), 1.0f / Dimension2f.ratio.y());
|
||||
Log.info("Set a new screen ratio for the screen : ratioMm=" + Dimension2f.ratio);
|
||||
LOGGER.info("Set a new screen ratio for the screen : ratioMm=" + Dimension2f.ratio);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +92,6 @@ public record Dimension2f(
|
||||
*/
|
||||
public static void setPixelWindowsSize(final Vector2f size) {
|
||||
windowsSize = new Dimension2f(size);
|
||||
Log.verbose("Set a new Windows property size " + windowsSize + "px");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,7 +132,7 @@ public record Dimension2f(
|
||||
case ELEMENT -> throw new UnsupportedOperationException("Unimplemented case: " + type);
|
||||
case EX -> throw new UnsupportedOperationException("Unimplemented case: " + type);
|
||||
case PC -> {
|
||||
Log.error("Does not support other than Px and % type of dimention : " + type + " automaticly convert with {72,72} pixel/inch");
|
||||
LOGGER.error("Does not support other than Px and % type of dimention : " + type + " automaticly convert with {72,72} pixel/inch");
|
||||
yield null;
|
||||
}
|
||||
case POINT -> throw new UnsupportedOperationException("Unimplemented case: " + type);
|
||||
@ -252,12 +253,11 @@ public record Dimension2f(
|
||||
final Distance type = Distance.parseEndSmallString(config);
|
||||
config = type.removeEndString(config);
|
||||
if (type == Distance.UNKNOW) {
|
||||
Log.critical("Can not parse dimension : '" + config + "'");
|
||||
LOGGER.error("Can not parse dimension : '" + config + "'");
|
||||
return null;
|
||||
}
|
||||
final Vector2f tmp = Vector2f.valueOf(config);
|
||||
final Dimension2f ret = new Dimension2f(tmp, type);
|
||||
Log.verbose(" config dimension : '" + config + "' == > " + ret.toString());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,10 @@
|
||||
*/
|
||||
package org.atriasoft.etk;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.atriasoft.etk.math.Vector2i;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* in the dimension class we store the data as the more usefull unit (pixel)
|
||||
@ -16,6 +17,7 @@ import org.atriasoft.etk.math.Vector3f;
|
||||
public record Dimension3f(
|
||||
Vector3f size,
|
||||
Distance type) {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Dimension3f.class);
|
||||
|
||||
public static final Dimension3f ZERO = new Dimension3f(Vector3f.ZERO, Distance.PIXEL);
|
||||
private static Vector3f ratio = new Vector3f(9999999, 888888, 7777777);
|
||||
@ -68,12 +70,12 @@ public record Dimension3f(
|
||||
* @note: same as @ref setPixelPerInch (internal manage convertion)
|
||||
*/
|
||||
public static void setPixelRatio(final Vector3f ratio, final Distance type) {
|
||||
Log.info("Set a new screen ratio for the screen : ratio=" + ratio + " type=" + type);
|
||||
LOGGER.info("Set a new screen ratio for the screen : ratio=" + ratio + " type=" + type);
|
||||
final Dimension3f conversion = new Dimension3f(ratio, type);
|
||||
Log.info(" == > " + conversion);
|
||||
LOGGER.info(" == > " + conversion);
|
||||
Dimension3f.ratio = conversion.getMillimeter();
|
||||
invRatio = new Vector3f(1.0f / Dimension3f.ratio.x(), 1.0f / Dimension3f.ratio.y(), 1.0f / Dimension3f.ratio.z());
|
||||
Log.info("Set a new screen ratio for the screen : ratioMm=" + Dimension3f.ratio);
|
||||
LOGGER.info("Set a new screen ratio for the screen : ratioMm=" + Dimension3f.ratio);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +84,6 @@ public record Dimension3f(
|
||||
*/
|
||||
public static void setPixelWindowsSize(final Vector3f size) {
|
||||
windowsSize = new Dimension3f(size);
|
||||
Log.verbose("Set a new Windows property size " + windowsSize + "px");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,7 +124,7 @@ public record Dimension3f(
|
||||
case ELEMENT -> throw new UnsupportedOperationException("Unimplemented case: " + type);
|
||||
case EX -> throw new UnsupportedOperationException("Unimplemented case: " + type);
|
||||
case PC -> {
|
||||
Log.error("Does not support other than Px and % type of dimention : " + type + " automaticly convert with {72,72} pixel/inch");
|
||||
LOGGER.error("Does not support other than Px and % type of dimention : " + type + " automaticly convert with {72,72} pixel/inch");
|
||||
yield null;
|
||||
}
|
||||
case POINT -> throw new UnsupportedOperationException("Unimplemented case: " + type);
|
||||
@ -244,12 +245,11 @@ public record Dimension3f(
|
||||
final Distance type = Distance.parseEndSmallString(config);
|
||||
config = type.removeEndString(config);
|
||||
if (type == Distance.UNKNOW) {
|
||||
Log.critical("Can not parse dimension : '" + config + "'");
|
||||
LOGGER.error("Can not parse dimension : '" + config + "'");
|
||||
return null;
|
||||
}
|
||||
final Vector3f tmp = Vector3f.valueOf(config);
|
||||
final Dimension3f ret = new Dimension3f(tmp, type);
|
||||
Log.verbose(" config dimension : '" + config + "' == > " + ret.toString());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.atriasoft.etk;
|
||||
|
||||
|
||||
public enum Distance {
|
||||
UNKNOW, //!< "%"
|
||||
POURCENT, //!< "%"
|
||||
|
@ -5,9 +5,12 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class NativeLoader {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(NativeLoader.class);
|
||||
private NativeLoader() {}
|
||||
|
||||
/**
|
||||
@ -16,7 +19,7 @@ public class NativeLoader {
|
||||
* @throws IOException the library can not be loaded...
|
||||
*/
|
||||
public static void load(final Uri fileToLoad) throws IOException {
|
||||
Log.error("Start load library native ...");
|
||||
LOGGER.error("Start load library native ...");
|
||||
// in java the loading of .so need to be externalized to be loaded by the system as native library. then we copy in an external temporary folder and remove it when application close.
|
||||
try {
|
||||
InputStream is = Uri.getStream(fileToLoad);
|
||||
|
@ -1,10 +1,13 @@
|
||||
package org.atriasoft.etk;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.CheckReturnValue;
|
||||
|
||||
public class Platform {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Platform.class);
|
||||
private Platform() {}
|
||||
/**
|
||||
* Get the current OS we are running:
|
||||
@ -67,7 +70,7 @@ public class Platform {
|
||||
} else if (osArch.startsWith("arm")) {
|
||||
osArch = "arm";
|
||||
} else {
|
||||
Log.warning("Maybe unknowx system... osArch=" + osArch + " abiType=" + abiType + " libPath=" + libPath);
|
||||
LOGGER.warn("Maybe unknowx system... osArch=" + osArch + " abiType=" + abiType + " libPath=" + libPath);
|
||||
}
|
||||
return System.getProperty("org.atriasoft.etk.platform.arch", osArch);
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
package org.atriasoft.etk;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public abstract class ThreadAbstract {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(ThreadAbstract.class);
|
||||
// thread section:
|
||||
private boolean threadStopRequested = false;
|
||||
private Thread threadInstance = null;
|
||||
|
@ -5,10 +5,13 @@ import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
|
||||
import org.atriasoft.etk.util.FilePos;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Tools {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Tools.class);
|
||||
|
||||
/**
|
||||
* Add indentation of the string input.
|
||||
@ -131,11 +134,11 @@ public class Tools {
|
||||
*/
|
||||
public static void drawElementParsed(final Character val, final FilePos filePos) {
|
||||
// if (val == '\n') {
|
||||
// Log.error(filePos + " parse '\\n'");
|
||||
// LOGGER.error(filePos + " parse '\\n'");
|
||||
// } else if (val == '\t') {
|
||||
// Log.error(filePos + " parse '\\t'");
|
||||
// LOGGER.error(filePos + " parse '\\t'");
|
||||
// } else {
|
||||
// Log.error(filePos + " parse '" + val + "'");
|
||||
// LOGGER.error(filePos + " parse '" + val + "'");
|
||||
// }
|
||||
}
|
||||
|
||||
@ -191,7 +194,7 @@ public class Tools {
|
||||
}
|
||||
val *= 2;
|
||||
}
|
||||
Log.critical("impossible CASE....");
|
||||
LOGGER.error("impossible CASE....");
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,12 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
|
||||
public class Uri {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Uri.class);
|
||||
private record LibraryElement(
|
||||
Class<?> klass,
|
||||
String basePath) {}
|
||||
@ -35,7 +37,7 @@ public class Uri {
|
||||
}
|
||||
|
||||
public static void addLibrary(final String libName, final Class<?> classHandle, String basePath) {
|
||||
Log.verbose("Add library reference: lib={} ==> {} base path={}", libName, classHandle.getCanonicalName(), basePath);
|
||||
LOGGER.trace("Add library reference: lib={} ==> {} base path={}", libName, classHandle.getCanonicalName(), basePath);
|
||||
if (basePath == null || basePath.isEmpty()) {
|
||||
basePath = "/";
|
||||
}
|
||||
@ -108,11 +110,11 @@ public class Uri {
|
||||
}
|
||||
|
||||
public static InputStream getStream(final Uri uri) {
|
||||
Log.verbose("Load resource: {}", uri);
|
||||
LOGGER.trace("Load resource: {}", uri);
|
||||
String offsetGroup = "";
|
||||
if (uri.group != null) {
|
||||
if (uri.group.equals("FILE")) {
|
||||
Log.verbose("Load resource direct file: {}", uri);
|
||||
LOGGER.trace("Load resource direct file: {}", uri);
|
||||
try {
|
||||
return new FileInputStream(new File(uri.getPath()));
|
||||
} catch (final FileNotFoundException e) {
|
||||
@ -121,32 +123,32 @@ public class Uri {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Log.verbose(" find group: {}", uri.group);
|
||||
LOGGER.trace(" find group: {}", uri.group);
|
||||
final String ret = Uri.genericMap.get(uri.group);
|
||||
if (ret != null) {
|
||||
Log.verbose(" ==> {}", ret);
|
||||
LOGGER.trace(" ==> {}", ret);
|
||||
offsetGroup = ret;
|
||||
}
|
||||
}
|
||||
InputStream out = null;
|
||||
if (Uri.applicationClass == null) {
|
||||
Log.verbose(" !! Application data class is not defined ...");
|
||||
LOGGER.trace(" !! Application data class is not defined ...");
|
||||
} else {
|
||||
String tmpPath = Uri.applicationBasePath + offsetGroup + uri.path;
|
||||
tmpPath = tmpPath.replace("//", "/");
|
||||
Log.verbose("(appl) Try to load '{}' in {}", tmpPath, Uri.applicationClass.getCanonicalName());// + " ==> " + applicationClass.getProtectionDomain().getCodeSource().getLocation().getPath());
|
||||
LOGGER.trace("(appl) Try to load '{}' in {}", tmpPath, Uri.applicationClass.getCanonicalName());// + " ==> " + applicationClass.getProtectionDomain().getCodeSource().getLocation().getPath());
|
||||
final URL realFileName = Uri.applicationClass.getClassLoader().getResource(tmpPath);
|
||||
if (realFileName != null) {
|
||||
Log.verbose("(appl) >>> {}", realFileName.getFile());
|
||||
LOGGER.trace("(appl) >>> {}", realFileName.getFile());
|
||||
} else {
|
||||
Log.verbose("(appl) ??? base folder: {}", Uri.applicationClass.getProtectionDomain().getCodeSource().getLocation().getPath() + Uri.applicationBasePath + offsetGroup + uri.path);
|
||||
LOGGER.trace("(appl) ??? base folder: {}", Uri.applicationClass.getProtectionDomain().getCodeSource().getLocation().getPath() + Uri.applicationBasePath + offsetGroup + uri.path);
|
||||
}
|
||||
out = Uri.applicationClass.getResourceAsStream(tmpPath);
|
||||
|
||||
if (out == null) {
|
||||
Log.verbose("(appl) ==> element does not exist ...");
|
||||
LOGGER.trace("(appl) ==> element does not exist ...");
|
||||
// try {
|
||||
// Log.warning("elements: " + getResourceFiles(applicationClass, applicationBasePath + offsetGroup + "/*.*"));
|
||||
// LOGGER.warn("elements: " + getResourceFiles(applicationClass, applicationBasePath + offsetGroup + "/*.*"));
|
||||
// } catch (IOException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
@ -156,46 +158,46 @@ public class Uri {
|
||||
if (out == null) {
|
||||
// search in the libraries ...
|
||||
if (uri.properties.get("lib") == null) {
|
||||
Log.verbose(" !! No library specified");
|
||||
LOGGER.trace(" !! No library specified");
|
||||
return null;
|
||||
}
|
||||
final LibraryElement libraryElement = Uri.libraries.get(uri.properties.get("lib"));
|
||||
if (libraryElement == null) {
|
||||
Log.verbose(" Can not get element in library");
|
||||
LOGGER.trace(" Can not get element in library");
|
||||
return null;
|
||||
}
|
||||
// try {
|
||||
// Log.warning("elements: " + getResourceFiles(libraryElement.klass, libraryElement.basePath + offsetGroup + "/"));
|
||||
// LOGGER.warn("elements: " + getResourceFiles(libraryElement.klass, libraryElement.basePath + offsetGroup + "/"));
|
||||
// } catch (IOException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
String tmpPath = libraryElement.basePath + offsetGroup + uri.path;
|
||||
tmpPath = tmpPath.replace("//", "/");
|
||||
Log.verbose("(lib) Try to load '{}' in {}", tmpPath, libraryElement.klass.getCanonicalName());
|
||||
LOGGER.trace("(lib) Try to load '{}' in {}", tmpPath, libraryElement.klass.getCanonicalName());
|
||||
final URL realFileName = libraryElement.klass.getClassLoader().getResource(tmpPath);
|
||||
if (realFileName != null) {
|
||||
Log.verbose("(lib) >>> {}", realFileName.getFile());
|
||||
LOGGER.trace("(lib) >>> {}", realFileName.getFile());
|
||||
} else {
|
||||
Log.verbose("(lib) ??? base folder: {}", libraryElement.klass.getProtectionDomain().getCodeSource().getLocation().getPath() + libraryElement.basePath + offsetGroup + uri.path);
|
||||
LOGGER.trace("(lib) ??? base folder: {}", libraryElement.klass.getProtectionDomain().getCodeSource().getLocation().getPath() + libraryElement.basePath + offsetGroup + uri.path);
|
||||
}
|
||||
out = libraryElement.klass.getResourceAsStream(tmpPath);
|
||||
if (out == null) {
|
||||
Log.verbose("(lib) ==> element does not exist ...");
|
||||
LOGGER.trace("(lib) ==> element does not exist ...");
|
||||
}
|
||||
}
|
||||
|
||||
if (out == null) {
|
||||
Log.error("Can not load resource: '" + uri + "'");
|
||||
LOGGER.error("Can not load resource: '" + uri + "'");
|
||||
} else {
|
||||
Log.verbose(" =====> DATA LOADED <====== ");
|
||||
LOGGER.trace(" =====> DATA LOADED <====== ");
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
public static List<Uri> listRecursive(final Uri uri) {
|
||||
final List<Uri> out = new ArrayList<>();
|
||||
Log.todo("not implemented function ...");
|
||||
LOGGER.error("TODO: not implemented function ...");
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -204,7 +206,7 @@ public class Uri {
|
||||
}
|
||||
|
||||
public static void setApplication(final Class<?> classHandle, String basePath) {
|
||||
Log.info("Set application reference : {} base path={}", classHandle.getCanonicalName(), basePath);
|
||||
LOGGER.info ("Set application reference : {} base path={}", classHandle.getCanonicalName(), basePath);
|
||||
Uri.applicationClass = classHandle;
|
||||
if (basePath == null || basePath.isEmpty()) {
|
||||
basePath = "/";
|
||||
@ -219,7 +221,7 @@ public class Uri {
|
||||
}
|
||||
|
||||
public static void setGroup(final String groupName, String basePath) {
|
||||
Log.info("Set Group : {} base path={}", groupName, basePath);
|
||||
LOGGER.info ("Set Group : {} base path={}", groupName, basePath);
|
||||
if (basePath == null || basePath.isEmpty()) {
|
||||
basePath = "/";
|
||||
}
|
||||
@ -270,7 +272,7 @@ public class Uri {
|
||||
out = new BufferedWriter(fstream);
|
||||
out.write(data);
|
||||
} catch (final IOException e) {
|
||||
Log.error("Error: {}", e.getMessage());
|
||||
LOGGER.error("Error: {}", e.getMessage());
|
||||
throw e;
|
||||
} finally {
|
||||
if (out != null) {
|
||||
@ -278,7 +280,7 @@ public class Uri {
|
||||
out.close();
|
||||
} catch (final IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
Log.error("Error: ", e);
|
||||
LOGGER.error("Error: ", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -292,14 +294,14 @@ public class Uri {
|
||||
out = new BufferedWriter(fstream);
|
||||
out.write(data);
|
||||
} catch (final IOException e) {
|
||||
Log.error("Error: " + e.getMessage());
|
||||
LOGGER.error("Error: " + e.getMessage());
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (final IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
Log.error("Error: ", e);
|
||||
LOGGER.error("Error: ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,76 +0,0 @@
|
||||
package org.atriasoft.etk.internal;
|
||||
|
||||
import org.atriasoft.reggol.LogLevel;
|
||||
import org.atriasoft.reggol.Logger;
|
||||
|
||||
public class Log {
|
||||
private static final boolean FORCE_ALL = false;
|
||||
private static final String LIB_NAME = "etk";
|
||||
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
|
||||
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL);
|
||||
private static final boolean PRINT_ERROR = Logger.getNeedPrint(LIB_NAME, LogLevel.ERROR);
|
||||
private static final boolean PRINT_WARNING = Logger.getNeedPrint(LIB_NAME, LogLevel.WARNING);
|
||||
private static final boolean PRINT_INFO = Logger.getNeedPrint(LIB_NAME, LogLevel.INFO);
|
||||
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
|
||||
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LIB_NAME, LogLevel.VERBOSE);
|
||||
private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO);
|
||||
private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT);
|
||||
|
||||
public static void critical(final Exception e, final String data) {
|
||||
e.printStackTrace();
|
||||
if (PRINT_CRITICAL || FORCE_ALL) {
|
||||
Logger.critical(LIB_NAME_DRAW, data + " : " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void critical(final String data, final Object... objects) {
|
||||
if (PRINT_CRITICAL || FORCE_ALL) {
|
||||
Logger.critical(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void debug(final String data, final Object... objects) {
|
||||
if (PRINT_DEBUG || FORCE_ALL) {
|
||||
Logger.debug(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void error(final String data, final Object... objects) {
|
||||
if (PRINT_ERROR || FORCE_ALL) {
|
||||
Logger.error(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void info(final String data, final Object... objects) {
|
||||
if (PRINT_INFO || FORCE_ALL) {
|
||||
Logger.info(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void print(final String data, final Object... objects) {
|
||||
if (PRINT_PRINT || FORCE_ALL) {
|
||||
Logger.print(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void todo(final String data, final Object... objects) {
|
||||
if (PRINT_TODO || FORCE_ALL) {
|
||||
Logger.todo(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void verbose(final String data, final Object... objects) {
|
||||
if (PRINT_VERBOSE || FORCE_ALL) {
|
||||
Logger.verbose(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void warning(final String data, final Object... objects) {
|
||||
if (PRINT_WARNING || FORCE_ALL) {
|
||||
Logger.warning(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
private Log() {}
|
||||
|
||||
}
|
@ -2,9 +2,12 @@ package org.atriasoft.etk.math;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.atriasoft.etk.Uri;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class FMath {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(FMath.class);
|
||||
public static final float PI = (float) Math.PI;
|
||||
|
||||
public static float abs(final float a) {
|
||||
@ -202,7 +205,7 @@ public class FMath {
|
||||
}
|
||||
val *= 2;
|
||||
}
|
||||
Log.critical("impossible CASE....");
|
||||
LOGGER.error("impossible CASE....");
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ public record Quaternion(
|
||||
float w) {
|
||||
// a * diff = b
|
||||
public static Quaternion diff(final Quaternion a, final Quaternion b) {
|
||||
// Log.info("diff " + a + " " + b);
|
||||
// LOGGER.info("diff " + a + " " + b);
|
||||
final Quaternion inv = a.inverse();
|
||||
return inv.multiply(b);
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package org.atriasoft.etk.math;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.atriasoft.etk.Uri;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.CheckReturnValue;
|
||||
|
||||
@ -8,6 +11,7 @@ import edu.umd.cs.findbugs.annotations.CheckReturnValue;
|
||||
public record Vector2b(
|
||||
boolean x,
|
||||
boolean y) {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Vector2b.class);
|
||||
public static Vector2b valueOf(String value) {
|
||||
boolean val1 = false;
|
||||
boolean val2 = false;
|
||||
@ -20,7 +24,7 @@ public record Vector2b(
|
||||
}
|
||||
final String[] values = value.split(",| ");
|
||||
if (values.length > 2) {
|
||||
Log.error("Can not parse Vector2f with more than 2 values: '" + value + "'");
|
||||
LOGGER.error("Can not parse Vector2f with more than 2 values: '" + value + "'");
|
||||
}
|
||||
if (values.length == 1) {
|
||||
// no coma ...
|
||||
|
@ -1,12 +1,16 @@
|
||||
package org.atriasoft.etk.math;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.atriasoft.etk.Uri;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.CheckReturnValue;
|
||||
|
||||
public record Vector2f(
|
||||
float x,
|
||||
float y) {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Vector2f.class);
|
||||
public static Vector2f valueOf(String value) {
|
||||
float val1 = 0;
|
||||
float val2 = 0;
|
||||
@ -19,7 +23,7 @@ public record Vector2f(
|
||||
}
|
||||
final String[] values = value.split(",| ");
|
||||
if (values.length > 2) {
|
||||
Log.error("Can not parse Vector2f with more than 2 values: '" + value + "'");
|
||||
LOGGER.error("Can not parse Vector2f with more than 2 values: '" + value + "'");
|
||||
}
|
||||
if (values.length == 1) {
|
||||
// no coma ...
|
||||
|
@ -1,6 +1,9 @@
|
||||
package org.atriasoft.etk.math;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.atriasoft.etk.Uri;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.CheckReturnValue;
|
||||
|
||||
@ -8,6 +11,7 @@ import edu.umd.cs.findbugs.annotations.CheckReturnValue;
|
||||
public record Vector2i(
|
||||
int x,
|
||||
int y) {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Vector2i.class);
|
||||
|
||||
public static Vector2i valueOf(String value) throws NumberFormatException {
|
||||
int val1 = 0;
|
||||
@ -21,7 +25,7 @@ public record Vector2i(
|
||||
}
|
||||
final String[] values = value.split(",| ");
|
||||
if (values.length > 2) {
|
||||
Log.error("Can not parse Vector2i with more than 2 values: '" + value + "'");
|
||||
LOGGER.error("Can not parse Vector2i with more than 2 values: '" + value + "'");
|
||||
}
|
||||
if (values.length == 1) {
|
||||
// no coma ...
|
||||
|
@ -1,6 +1,9 @@
|
||||
package org.atriasoft.etk.math;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.atriasoft.etk.Uri;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.CheckReturnValue;
|
||||
|
||||
@ -9,6 +12,7 @@ public record Vector3b(
|
||||
boolean x,
|
||||
boolean y,
|
||||
boolean z) {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Vector3b.class);
|
||||
public static Vector3b valueOf(String value) {
|
||||
boolean val1 = false;
|
||||
boolean val2 = false;
|
||||
@ -22,7 +26,7 @@ public record Vector3b(
|
||||
}
|
||||
final String[] values = value.split(",| ");
|
||||
if (values.length > 3) {
|
||||
Log.error("Can not parse Vector3b with more than 3 values: '" + value + "'");
|
||||
LOGGER.error("Can not parse Vector3b with more than 3 values: '" + value + "'");
|
||||
}
|
||||
if (values.length == 1) {
|
||||
// no coma ...
|
||||
|
@ -1,6 +1,9 @@
|
||||
package org.atriasoft.etk.math;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.atriasoft.etk.Uri;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.CheckReturnValue;
|
||||
|
||||
@ -8,6 +11,7 @@ public record Vector3f(
|
||||
float x,
|
||||
float y,
|
||||
float z) {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Vector3f.class);
|
||||
/**
|
||||
* Get the length square between the 2 vectors
|
||||
* @param start First vector
|
||||
@ -36,7 +40,7 @@ public record Vector3f(
|
||||
}
|
||||
final String[] values = value.split(",| ");
|
||||
if (values.length > 3) {
|
||||
Log.error("Can not parse Vector3f with more than 3 values: '" + value + "'");
|
||||
LOGGER.error("Can not parse Vector3f with more than 3 values: '" + value + "'");
|
||||
}
|
||||
if (values.length == 1) {
|
||||
// no coma ...
|
||||
|
@ -1,6 +1,9 @@
|
||||
package org.atriasoft.etk.math;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.atriasoft.etk.Uri;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.CheckReturnValue;
|
||||
|
||||
@ -8,6 +11,7 @@ public record Vector3i(
|
||||
int x,
|
||||
int y,
|
||||
int z) {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Vector3i.class);
|
||||
public static Vector3i valueOf(String value) {
|
||||
int val1 = 0;
|
||||
int val2 = 0;
|
||||
@ -21,7 +25,7 @@ public record Vector3i(
|
||||
}
|
||||
final String[] values = value.split(",| ");
|
||||
if (values.length > 3) {
|
||||
Log.error("Can not parse Vector3i with more than 3 values: '" + value + "'");
|
||||
LOGGER.error("Can not parse Vector3i with more than 3 values: '" + value + "'");
|
||||
}
|
||||
if (values.length == 1) {
|
||||
// no coma ...
|
||||
|
@ -1,7 +1,10 @@
|
||||
|
||||
package org.atriasoft.etk.math;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.atriasoft.etk.Uri;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.CheckReturnValue;
|
||||
|
||||
@ -10,6 +13,7 @@ public record Vector4f(
|
||||
float y,
|
||||
float z,
|
||||
float w) {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Vector4f.class);
|
||||
/**
|
||||
* Get the length square between the 2 vectors
|
||||
* @param start First vector
|
||||
@ -38,7 +42,7 @@ public record Vector4f(
|
||||
}
|
||||
final String[] values = value.split(",| ");
|
||||
if (values.length > 3) {
|
||||
Log.error("Can not parse Vector4f with more than 3 values: '" + value + "'");
|
||||
LOGGER.error("Can not parse Vector4f with more than 3 values: '" + value + "'");
|
||||
}
|
||||
if (values.length == 1) {
|
||||
// no coma ...
|
||||
|
@ -5,9 +5,13 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.atriasoft.etk.internal.Log;
|
||||
import org.atriasoft.etk.Uri;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Theme {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(Theme.class);
|
||||
private static Map<String, Path> globalListTheme = new HashMap<>();
|
||||
private static Map<String, Path> globalListThemeDefault = new HashMap<>();
|
||||
|
||||
@ -50,7 +54,7 @@ public class Theme {
|
||||
* @param folderName The associated folder of the Theme (like "myTheme/folder/folder2/")
|
||||
*/
|
||||
public static void setName(final String refName, final Path folderName) {
|
||||
Log.warning("Change theme : '" + refName + "' : '" + folderName + "'");
|
||||
LOGGER.warn("Change theme : '" + refName + "' : '" + folderName + "'");
|
||||
globalListTheme.put(refName, folderName);
|
||||
updateProvider(refName);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package org.atriasoft.etk.util;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ArraysTools {
|
||||
public static <T> void fill(final T[] buffer, final T value) {
|
||||
if (buffer == null) {
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
package org.atriasoft.etk.util;
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
|
@ -1,59 +0,0 @@
|
||||
package test.atriasoft.etk;
|
||||
|
||||
import org.atriasoft.reggol.LogLevel;
|
||||
import org.atriasoft.reggol.Logger;
|
||||
|
||||
public class Log {
|
||||
private static final String LIB_NAME = "etk-test";
|
||||
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
|
||||
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL);
|
||||
private static final boolean PRINT_ERROR = Logger.getNeedPrint(LIB_NAME, LogLevel.ERROR);
|
||||
private static final boolean PRINT_WARNING = Logger.getNeedPrint(LIB_NAME, LogLevel.WARNING);
|
||||
private static final boolean PRINT_INFO = Logger.getNeedPrint(LIB_NAME, LogLevel.INFO);
|
||||
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
|
||||
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LIB_NAME, LogLevel.VERBOSE);
|
||||
private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO);
|
||||
private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT);
|
||||
|
||||
private Log() {}
|
||||
|
||||
public static void print(String data) {
|
||||
if (PRINT_PRINT)
|
||||
Logger.print(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void critical(String data) {
|
||||
if (PRINT_CRITICAL)
|
||||
Logger.critical(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void error(String data) {
|
||||
if (PRINT_ERROR)
|
||||
Logger.error(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void warning(String data) {
|
||||
if (PRINT_WARNING)
|
||||
Logger.warning(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void info(String data) {
|
||||
if (PRINT_INFO)
|
||||
Logger.info(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void debug(String data) {
|
||||
if (PRINT_DEBUG)
|
||||
Logger.debug(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void verbose(String data) {
|
||||
if (PRINT_VERBOSE)
|
||||
Logger.verbose(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void todo(String data) {
|
||||
if (PRINT_TODO)
|
||||
Logger.todo(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package test.atriasoft.etk;
|
||||
|
||||
import org.atriasoft.reggol.LogLevel;
|
||||
import org.atriasoft.reggol.Logger;
|
||||
|
||||
public class Log2 {
|
||||
private static final String LIB_NAME = "etk-test-2";
|
||||
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
|
||||
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
|
||||
|
||||
private Log2() {}
|
||||
|
||||
public static void debug(String data) {
|
||||
if (PRINT_DEBUG)
|
||||
Logger.debug(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* Contributors:
|
||||
* Edouard DUPIN - initial API and implementation
|
||||
******************************************************************************/
|
||||
package test.atriasoft.etk;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.atriasoft.reggol.Logger;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
|
||||
@TestMethodOrder(OrderAnnotation.class)
|
||||
public class TestBasicLog {
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void aaFirstInitialisation() {
|
||||
List<String> args = new ArrayList<>();
|
||||
args.add("--log-level=999");
|
||||
args.add("--log-level=1");
|
||||
args.add("--log-no-color");
|
||||
args.add("--log-color");
|
||||
args.add("--log-lib=sc-log-test+6");
|
||||
args.add("--log-lib=sc-log-test/6");
|
||||
args.add("--log-lib=sc-log-test:6");
|
||||
args.add("--log-lib=sc-log-test:verbose");
|
||||
args.add("--log-lib=sc-log-test2+3");
|
||||
args.add("--log-lib=sc-log-test");
|
||||
args.add("--log-with-stupid-parameter=sdkfjsqdlkf");
|
||||
args.add("--help");
|
||||
Logger.init(args);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
public void bbSecondInitialisation() {
|
||||
List<String> args = new ArrayList<>();
|
||||
Logger.init(args);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
public void ccBasicLogCall() {
|
||||
Log.print("Simple print");
|
||||
Log.todo("Simple todo");
|
||||
Log.error("Simple error");
|
||||
Log.warning("Simple warning");
|
||||
Log.info("Simple info");
|
||||
Log.debug("Simple debug");
|
||||
Log.verbose("Simple verbose");
|
||||
}
|
||||
|
||||
// TODO REFACTO REMOVE this and set it in the Test of the logger.
|
||||
public static String getAAAAAAA(int dfsdf) {
|
||||
int hhh = 0;
|
||||
for (int kkk = 0; kkk < dfsdf; kkk++)
|
||||
for (int iii = 0; iii < 10000; iii++)
|
||||
for (int jjj = 0; jjj < 100000; jjj++)
|
||||
for (int lll = 0; lll < 100000; lll++)
|
||||
hhh++;
|
||||
return "kkk" + hhh;
|
||||
}
|
||||
|
||||
public static void testLog() {
|
||||
Log.print("test direct [START]");
|
||||
// test de 10 secondes contre 0.0?? second quand le niveau n'est pas assez grand ...
|
||||
long timeStart = System.currentTimeMillis();
|
||||
for (int iii = 0; iii < 100000000; iii++)
|
||||
Log2.debug("test direct");
|
||||
long timeStop = System.currentTimeMillis();
|
||||
Log.print("test direct [END] : " + timeStart + " to " + timeStop + " ==> delta=" + (timeStop - timeStart));
|
||||
Log.print("test concat [START]");
|
||||
// C'est très long dans les 2 cas ...
|
||||
timeStart = System.currentTimeMillis();
|
||||
for (int iii = 0; iii < 6; iii++)
|
||||
Log2.debug("test concat: non fonctionnel, il applelle le get a chaque log ... " + getAAAAAAA(iii));
|
||||
timeStop = System.currentTimeMillis();
|
||||
Log.print("test concat [END] : " + timeStart + " to " + timeStop + " ==> delta=" + (timeStop - timeStart));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
public void ddTestSimpleLog() {
|
||||
testLog();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
public void eeUsage() {
|
||||
Logger.usage();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user