Skip to content

ferrymo/UtilityCode-java8

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UtilityCode

Build Status Codacy Badge Maven Central

Selection of java utility methods used in almost all projects.

Maven, Gradle, Ivy

	<dependencies>
		<dependency>
			<groupId>dev.brachtendorf</groupId>
			<artifactId>UtilityCode</artifactId>
			<version>2.0.1</version>
		</dependency>
	</dependencies>

Examples

//Restart JVM
MiscUtil.restartApp();

//Enum hashcode
int enumHashcode = MiscUtil.consistentHashCode(Weekday.Monday);

//Array methods
int[] values = {1,2,1,4,5,7,3,4,3,2};

ArrayUtil.median(values);
ArrayUtil.average(values);
ArrayUtil.add(values,5);

...

Content

Package Description
MiscUtil Get OS info/ Restart Java VM
Require Input assertions similar to Objects.requireNonNull()
NetworkUtil Resolve Network adapter and socket helper
Mutable Mutable Wrapper for boxed primitives
StringUtil Center text, get length of numeric string representation. Multiy strings
Graphics Color Utilities, Distance, Average Color, Palettes, Efficient RGB HSC YCrCB (*10 faster than JDK)
ArrayUtil Fill, search, compute sorted indices validation, deep clone, scalar operation on arrays
CryptoUtil AES en- and decryption
MathUtil clamping, fractional part, double compare, log to base x, trangular number
clustering small selection of cluster algorithms. KMeans KMeans++ DBScan, see cluster branch for more. WIP
... Non daemon thread factory, circular hashmap, rescaling images, ...

Changelog

2.0.1 - 17.06.2021

Added

  • Support a wider range of image objects for ImageUtil methods
    • InterpolateColor for BufferedImage
    • dominantColor for BufferedImage
    • meanColor for BufferedImage

Changed

  • getRGB doesn't use inlined code anymore
  • getRGB now correctly returns opacity replaced colors

2.0.0 - 15.06.2021

Changed

  • rename packages from com.github.kilianB to dev.brachtendorf

1.0.0 Major update. rename group id and deploy on maven central - 15.06.2021

Added

  • FastPixel now support replacement of opaque pixels

Changed

  • Updated javafx dependency version to point to stable v11 release
  • update build dependencies and pom in preparation for maven central deployment
  • build target java 11

v 1.5.10 - SNAPSHOT

changed

  • small coding style fixed to please codacay

v 1.5.9 - 13.04.2019

added

  • retrieval of public facing ip address

v 1.5.8 - 22.03.2019

added

  • support for 1d blue red and green retrieval
  • Require exact value

v 1.5.4 - 26.12.2018

[added]

  • Pair data structure
  • codacy badge

[changed]

  • removed unused imports. A tiny bit cleanup
  • bump javadoc version to html 5

v1.5.3 - 25.12.2018

[changed]

  • use ImageTypeSpecifier to create a compatible buffered image during resizing operation in image utils. This allows support for buffered image with type custom.
  • increased named thread factory test case exception timeout to make test more robust

v1.5.2 - 25.12.2018

[added]

  • Require oddValue,evenValue, greaterThan, lessThan, negativeValue
  • default fallback for fastpixel if no faster implementation is available

[changed]

  • CountHashCollection now also returns the mapped object in the toString method
  • move some of fastpixels implementation methods to default methods

v1.5.1 - 30.11.2018

[fixed]

  • perform mcn:clean before deploying to exclude test dependencies from final build.

v1.5.0 - 29.11.2018

[added]

  • getSetAverageGrayScale
  • utility toString methods for arrays
  • getLuma 1D version
  • getLowerShiftBitMask to MathUtil
  • getConsistentHashcode for Enums in the misc package

[fixed]

  • getLuma now correctly accesses red green and blue values based on BGR byte array offsets instead of RGB.

[changed]

  • refactored FastPixel to use base class and support multiple different image types

v1.4.5 - (intermediate internal version)

[added]

  • bulk set operation for FastPixel class

[fixed]

  • setRed,setBlue,setGreen on FastPixel now access the correct offset

v1.4.4 - 19.11.2018 (intermediate internal version)

[added]

  • pairwise array math (add subtract multiply divide)
  • fillArray overloaded now available with function parameter passing the index to a supplier method
  • getSortedIndex. Calculate the sorted indices of an array in ascending or descending order.

[changed]

  • make constructor of circular hashset private. Class was not ever meant to be initialized

v.1.4.2

[fixed]

  • getScaledInstance of images not correctly uses drawImage to rescale rather than falling back to the awt getScaledInstance call. 600 fold increase in performance

v.1.4.1 - 15.11.2018

[added]

  • triangular number

v 1.4.0 - 14.11.2018

[fixed]

  • javadoc get hue is in range of [0-360]° not [0-255]

[added]

  • getContrastColor for awt images
  • getLuma for awt and fxImages
  • log(base,value) calculate log of an arbitrary base
  • plain autocloseable (AutoCloseable without throwing an exception)
  • get maximum and minimum as well as maximum and minimum Index for primitive numeric arrays
  • scalar multiplication, addition, subtraction and division for primitive numeric arrays.
  • Clustering. KMeans, KMeans++, DBScan, CURE, DistanceMeasures, Euclidiean Jaccard Manhattan
  • StringUtils fillStringBeginning

v 1.3.1 - 2.11.2018

[added]

  • getLuma() array method

v 1.3.0 - 2.11.2018

[added]

  • FastPixel utility to read rgb/hsv/YCrCb data from an image + tests
  • MathUtil.isNumeric() + tests

[fixed]

  • added @Nested tag to isDoubleEquals class in MathUtil test

v 1.2.0 - 23.10.2018

[added]:

  • fillArrayMulti in ArrayUtils allows multi dimensional arrays to be recursively filled with a value

  • test for ArrayUtil

  • Mutable wrappers now extend Number if applicable

  • Mutable now implement increment, decrement setValue for primitive values.

  • test for mutable

v 1.1.0 - 19.10.2018

[added]:

  • CountHashCollection + test A hash collection with O(1) specialized on keeping track how many times equal object were added and removed
  • Circular Hashset
  • Circular Queue
  • Require.inRange for collections

[changed]:

  • replace DaemonThreadFactory by NamedThreadFactory since no external repo is currently depending on this source only bump minor version

About

Selection of java utility methods

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%