gdxapp4d/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/Gê̄ldGetậlÅtHebrew.java

71 lines
2.5 KiB
Java
Raw Normal View History

2022-01-30 21:00:16 +00:00
package love.distributedrebirth.numberxd;
2022-01-28 10:24:54 +00:00
2022-02-04 17:00:03 +00:00
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.numberxd.base2t.part.T03PartTrit;
import love.distributedrebirth.numberxd.base2t.part.T08PartOctal;
import love.distributedrebirth.numberxd.base2t.type.V009Tyte;
2022-01-28 10:24:54 +00:00
2022-02-04 17:00:03 +00:00
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
2022-01-31 18:06:09 +00:00
public class Gê̄ldGetậlÅtHebrew {
2022-01-28 10:24:54 +00:00
private static final double NUMERATOR_ONE = 1d;
private static final int FRACTION_POWER = 10;
2022-01-31 18:06:09 +00:00
private Gê̄ldGetậlÅtHebrewLetter letter;
private Gê̄ldGetậlÅtHebrewVowel vowel;
2022-01-28 10:24:54 +00:00
2022-01-31 18:06:09 +00:00
public Gê̄ldGetậlÅtHebrew() {
this.letter = Gê̄ldGetậlÅtHebrewLetter.NONE;
this.vowel = Gê̄ldGetậlÅtHebrewVowel.NONE;
2022-01-28 10:24:54 +00:00
}
2022-01-31 18:06:09 +00:00
public Gê̄ldGetậlÅtHebrew(Gê̄ldGetậlÅtHebrewLetter letter) {
2022-01-28 10:24:54 +00:00
this.letter = letter;
2022-01-31 18:06:09 +00:00
this.vowel = Gê̄ldGetậlÅtHebrewVowel.NONE;
2022-01-28 10:24:54 +00:00
}
2022-01-31 18:06:09 +00:00
public Gê̄ldGetậlÅtHebrew(V009Tyte tyte) {
2022-01-28 10:24:54 +00:00
int value0 = tyte.getValue(T03PartTrit.PART_1).getValue().ordinalOf(T08PartOctal.PART_1);
int value1 = tyte.getValue(T03PartTrit.PART_2).getValue().ordinalOf(T08PartOctal.PART_2);
int value2 = tyte.getValue(T03PartTrit.PART_3).getValue().ordinalOf(T08PartOctal.PART_3);
int combinedValue = value0 + value1 + value2;
2022-01-31 18:06:09 +00:00
letter = Gê̄ldGetậlÅtHebrewLetter.indexOf(combinedValue);
vowel = Gê̄ldGetậlÅtHebrewVowel.indexOf(combinedValue >> Gê̄ldGetậlÅtHebrewLetter.SHIFT_5);
2022-01-28 10:24:54 +00:00
}
public V009Tyte toTyte() {
2022-01-31 18:06:09 +00:00
int combinedValue = letter.ordinal() + (vowel.ordinal() << Gê̄ldGetậlÅtHebrewLetter.SHIFT_5);
2022-01-28 10:24:54 +00:00
T08PartOctal value0 = T08PartOctal.indexOf(T08PartOctal.PART_1, combinedValue);
T08PartOctal value1 = T08PartOctal.indexOf(T08PartOctal.PART_2, combinedValue);
T08PartOctal value2 = T08PartOctal.indexOf(T08PartOctal.PART_3, combinedValue);
return new V009Tyte(value0, value1, value2);
}
public double toDecimalValue(boolean firstChar) {
double fraction = letter.getDecimal();
if (firstChar) {
return fraction; // use full value
}
2022-01-31 18:06:09 +00:00
if (!Gê̄ldGetậlÅtHebrewVowel.NONE.equals(vowel)) {
2022-01-28 10:24:54 +00:00
fraction = fraction * Math.pow(FRACTION_POWER, vowel.getFractionOffset());
}
double result = NUMERATOR_ONE/fraction;
return result;
}
2022-01-31 18:06:09 +00:00
public Gê̄ldGetậlÅtHebrewLetter getLetter() {
2022-01-28 10:24:54 +00:00
return letter;
}
2022-01-31 18:06:09 +00:00
public void setLetter(Gê̄ldGetậlÅtHebrewLetter letter) {
2022-01-28 10:24:54 +00:00
this.letter = letter;
}
2022-01-31 18:06:09 +00:00
public Gê̄ldGetậlÅtHebrewVowel getVowel() {
2022-01-28 10:24:54 +00:00
return vowel;
}
2022-01-31 18:06:09 +00:00
public void setVowel(Gê̄ldGetậlÅtHebrewVowel vowel) {
2022-01-28 10:24:54 +00:00
this.vowel = vowel;
}
}