diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/RetardedClasses.iml b/RetardedClasses.iml
index c90834f..92a93a0 100644
--- a/RetardedClasses.iml
+++ b/RetardedClasses.iml
@@ -7,5 +7,14 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/DecimalNumber.java b/src/DecimalNumber.java
index a5401c5..03b9f92 100644
--- a/src/DecimalNumber.java
+++ b/src/DecimalNumber.java
@@ -1,15 +1,47 @@
+/**
+ * While being a very useful class, SingedInteger has a very big problem. It can't store decimal numbers.
+ * That's why this class exists.
+ */
public class DecimalNumber {
long integerPart;
long decimalPart;
+ /**
+ * Create a new DecimalNumber from a d**ble
+ * A double, you ask? Shut the fuck up, I say.
+ * @param n The d**ble
+ */
public DecimalNumber(double n){
- String s = String.valueOf(n);
- String[] ss = s.split("\\.");
- integerPart = Long.parseLong(ss[0]);
- decimalPart = Long.parseLong(ss[1]);
+ String s = String.valueOf(n);
+ String[] ss = s.split("\\.");
+ System.out.println(ss[0]);
+ System.out.println(ss[1]);
+ integerPart = Long.parseLong(ss[0]);
+ decimalPart = Long.parseLong(ss[1]);
}
+ /**
+ * Create a new DecimalNumber directly from a String. No more stupid parsing, just stupid exceptions!
+ * @param s The string
+ * @throws ValueShouldProbablyActuallyBeANumberAndNotSomeWeirdGibberishDumbProgrammerException yeah it does actually throw that good luck catching it
+ */
+ public DecimalNumber(String s) throws ValueShouldProbablyActuallyBeANumberAndNotSomeWeirdGibberishDumbProgrammerException {
+ try {
+ String[] ss = s.split("\\.");
+ System.out.println(ss[0]);
+ System.out.println(ss[1]);
+ integerPart = Long.parseLong(ss[0]);
+ decimalPart = Long.parseLong(ss[1]);
+ } catch (NumberFormatException e){
+ throw new ValueShouldProbablyActuallyBeANumberAndNotSomeWeirdGibberishDumbProgrammerException();
+ }
+ }
+
+ /**
+ * Get the value as a d**ble
+ * @return The value as a d**ble
+ */
public double getValue(){
return Double.parseDouble(integerPart + "." + decimalPart);
}
diff --git a/src/SignedInteger.java b/src/SignedInteger.java
index 5c32f28..b71c374 100644
--- a/src/SignedInteger.java
+++ b/src/SignedInteger.java
@@ -1,22 +1,41 @@
+/**
+ * When you need a way to store negative numbers
+ */
public class SignedInteger {
int n;
boolean isNegative;
+ /**
+ * Create a new SignedInteger form an int (why you should do this? Why not.)
+ * @param n The i n t
+ */
public SignedInteger(int n){
isNegative = n < 0;
this.n = Math.abs(n);
}
+ /**
+ * Get the value as an int
+ * @return The value
+ */
int getValue(){
return isNegative ? -n : n;
}
+ /**
+ * Set the value. Saves memory. Because the programs this is used in are so huge
+ * @param n The new value
+ */
void setValue(int n){
isNegative = n < 0;
this.n = Math.abs(n);
}
+ /**
+ * Add a new value. Can also be used to subtract something if the Parameter is negative.
+ * @param n The number to be added. Can be negative to subtract.
+ */
void addValue(int n){
this.n += isNegative ? -n : n;
if(this.n < 0){
diff --git a/src/StringOfChars.java b/src/StringOfChars.java
index 1b3c7b0..181f360 100644
--- a/src/StringOfChars.java
+++ b/src/StringOfChars.java
@@ -7,35 +7,63 @@ public class StringOfChars {
private char[] string;
+ /**
+ * Create a new StringOfChars from lots of tiny cute chars (also called an 'array')
+ * @param letters
+ */
public StringOfChars(char ... letters){
this.string = letters;
}
+ /**
+ * If you want to actually use the StringOfChars for anything (which you don't want to)
+ * @return The S T R I N G
+ */
public String toString(){
return new String(string);
}
+ /**
+ * Get the char array itself
+ * @return The char array
+ */
public char[] toCharArray(){
return string;
}
+ /**
+ * The length of the char array
+ * @return The length as an integer
+ */
public int length(){
return string.length;
}
- public char get(int i){
+ /**
+ * Get a single char at an index i
+ * @param i The index
+ * @return The Char
+ */
+ public char atIndex(int i){
return string[i];
}
+ /**
+ * Append another char array
+ * @param chars The char array that should be appended
+ */
public void append(char ... chars){
append(new StringOfChars(chars));
}
+ /**
+ * Append another StringOfChars
+ * @param string2 The StringOfChars
+ */
public void append(StringOfChars string2){
char[] newString = new char[this.length() + string2.length()];
System.arraycopy(string, 0, newString, 0, this.length());
-
System.arraycopy(string2.toCharArray(), 0, newString, this.length(), string2.toString().length());
string = newString;
diff --git a/src/TestClass.java b/src/TestClass.java
index 945c476..02b574c 100644
--- a/src/TestClass.java
+++ b/src/TestClass.java
@@ -2,7 +2,14 @@ public class TestClass {
public static void main(String[] args) {
StringOfChars s = new StringOfChars('h', 'a');
- s.append(new StringOfChars('l', 'l', 'o'));
+ s.append('l', 'l', 'o');
System.out.println(s.toString());
+
+ DecimalNumber dd = new DecimalNumber(2.4);
+ try{
+ DecimalNumber d = new DecimalNumber("schaffen");
+ } catch (ValueShouldProbablyActuallyBeANumberAndNotSomeWeirdGibberishDumbProgrammerException e) {
+ e.printStackTrace();
+ }
}
}
diff --git a/src/ValueShouldProbablyActuallyBeANumberAndNotSomeWeirdGibberishDumbProgrammerException.java b/src/ValueShouldProbablyActuallyBeANumberAndNotSomeWeirdGibberishDumbProgrammerException.java
new file mode 100644
index 0000000..4b77ece
--- /dev/null
+++ b/src/ValueShouldProbablyActuallyBeANumberAndNotSomeWeirdGibberishDumbProgrammerException.java
@@ -0,0 +1,8 @@
+public class ValueShouldProbablyActuallyBeANumberAndNotSomeWeirdGibberishDumbProgrammerException extends Exception{
+ @Override
+ public void printStackTrace() {
+ System.err.println("Holy fuck how can you be such a useless and dumb programmer wtf.");
+ System.err.println("Maybe don't fucking enter something that is not even a number. And in the end you're going to blame it on the end user. Pathetic.");
+ super.printStackTrace();
+ }
+}