Applied-Energistics-2-tiler.../src/main/java/appeng/util/ISlimReadableNumberConverter.java
thatsIch cc29230ce5 Fixes #1256: Using new size logic to determine the abbreviation for a stack size
Removes the usage of the old methods, since they were pretty, but not applicable for our use case. The displayed strings are determined by the size of the to be rendered string. Now the algorithm tries to use as much width as possible before trying to trim it down.

Added tests to reflect the changes and expected behaviour. Also using specific interfaces for the corresponding behaviour to shield from potential calls to the underlying enum singleton implementation.
2015-04-13 14:59:44 +02:00

32 lines
804 B
Java

package appeng.util;
import javax.annotation.Nonnegative;
/**
* Limits a number converter to a char width of at max 3 characters.
* This is generally used for players, who activated the large font extension.
*
* @author thatsIch
* @version rv2
* @since rv2
*/
public interface ISlimReadableNumberConverter
{
/**
* Converts a number into a human readable form. It will not round the number, but down it.
* Will try to cut the number down 1 decimal later, but rarely because of the 3 width limitation.
* Can only handle non negative numbers
*
* Example:
* 10000L -> 10K
* 9999L -> 9K, not 9.9K cause 4 width
*
* @param number to be converted number
*
* @return String in SI format cut down as far as possible
*/
String toSlimReadableForm( @Nonnegative long number );
}