-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introducing the concept of 'Quantity' to facility unit conversion bet…
…ter. (WIP)
- Loading branch information
Showing
28 changed files
with
219 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
-Dfile.encoding=UTF-8 -Djava.awt.headless=true -Duser.language=da -ea | ||
-Dfile.encoding=UTF-8 -ea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
mihxil-math/src/main/java/org/meeuw/math/ReflectionUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.meeuw.math; | ||
|
||
import lombok.extern.java.Log; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Modifier; | ||
import java.util.function.Consumer; | ||
|
||
@Log | ||
public class ReflectionUtils { | ||
|
||
private ReflectionUtils() { | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public static <C, D> void forConstants(Class<C> clazz, Class<D> constantClass, Consumer<D> consumer) { | ||
for (Field f : clazz.getDeclaredFields()) { | ||
if (Modifier.isPublic(f.getModifiers()) && | ||
Modifier.isStatic(f.getModifiers()) && | ||
constantClass.isAssignableFrom(f.getType())) { | ||
try { | ||
consumer.accept((D) f.get(null)); | ||
} catch (IllegalAccessException e) { | ||
log.warning(e.getMessage()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public static <C> void forConstants(Class<C> clazz, Consumer<C> consumer) { | ||
forConstants(clazz, clazz, consumer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 15 additions & 1 deletion
16
mihxil-physics/src/main/java/org/meeuw/physics/BaseUnit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.