mirror of
https://github.com/Noratrieb/UselessClasses.git
synced 2026-01-14 16:45:09 +01:00
JavaDoc (great JavaDoc)
This commit is contained in:
parent
80815cbc30
commit
1b2781b527
7 changed files with 234 additions and 7 deletions
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
|
|
@ -0,0 +1,124 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -7,5 +7,14 @@
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/19.0.0/annotations-19.0.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
@ -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 {
|
public class DecimalNumber {
|
||||||
|
|
||||||
long integerPart;
|
long integerPart;
|
||||||
long decimalPart;
|
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){
|
public DecimalNumber(double n){
|
||||||
String s = String.valueOf(n);
|
String s = String.valueOf(n);
|
||||||
String[] ss = s.split("\\.");
|
String[] ss = s.split("\\.");
|
||||||
integerPart = Long.parseLong(ss[0]);
|
System.out.println(ss[0]);
|
||||||
decimalPart = Long.parseLong(ss[1]);
|
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(){
|
public double getValue(){
|
||||||
return Double.parseDouble(integerPart + "." + decimalPart);
|
return Double.parseDouble(integerPart + "." + decimalPart);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,41 @@
|
||||||
|
/**
|
||||||
|
* When you need a way to store negative numbers
|
||||||
|
*/
|
||||||
public class SignedInteger {
|
public class SignedInteger {
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
boolean isNegative;
|
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){
|
public SignedInteger(int n){
|
||||||
isNegative = n < 0;
|
isNegative = n < 0;
|
||||||
this.n = Math.abs(n);
|
this.n = Math.abs(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value as an int
|
||||||
|
* @return The value
|
||||||
|
*/
|
||||||
int getValue(){
|
int getValue(){
|
||||||
return isNegative ? -n : n;
|
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){
|
void setValue(int n){
|
||||||
isNegative = n < 0;
|
isNegative = n < 0;
|
||||||
this.n = Math.abs(n);
|
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){
|
void addValue(int n){
|
||||||
this.n += isNegative ? -n : n;
|
this.n += isNegative ? -n : n;
|
||||||
if(this.n < 0){
|
if(this.n < 0){
|
||||||
|
|
|
||||||
|
|
@ -7,35 +7,63 @@ public class StringOfChars {
|
||||||
|
|
||||||
private char[] string;
|
private char[] string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new StringOfChars from lots of tiny cute chars (also called an 'array')
|
||||||
|
* @param letters
|
||||||
|
*/
|
||||||
public StringOfChars(char ... letters){
|
public StringOfChars(char ... letters){
|
||||||
this.string = 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(){
|
public String toString(){
|
||||||
return new String(string);
|
return new String(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the char array itself
|
||||||
|
* @return The char array
|
||||||
|
*/
|
||||||
public char[] toCharArray(){
|
public char[] toCharArray(){
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The length of the char array
|
||||||
|
* @return The length as an integer
|
||||||
|
*/
|
||||||
public int length(){
|
public int length(){
|
||||||
return string.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];
|
return string[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append another char array
|
||||||
|
* @param chars The char array that should be appended
|
||||||
|
*/
|
||||||
public void append(char ... chars){
|
public void append(char ... chars){
|
||||||
append(new StringOfChars(chars));
|
append(new StringOfChars(chars));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append another StringOfChars
|
||||||
|
* @param string2 The StringOfChars
|
||||||
|
*/
|
||||||
public void append(StringOfChars string2){
|
public void append(StringOfChars string2){
|
||||||
char[] newString = new char[this.length() + string2.length()];
|
char[] newString = new char[this.length() + string2.length()];
|
||||||
|
|
||||||
System.arraycopy(string, 0, newString, 0, this.length());
|
System.arraycopy(string, 0, newString, 0, this.length());
|
||||||
|
|
||||||
System.arraycopy(string2.toCharArray(), 0, newString, this.length(), string2.toString().length());
|
System.arraycopy(string2.toCharArray(), 0, newString, this.length(), string2.toString().length());
|
||||||
|
|
||||||
string = newString;
|
string = newString;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,14 @@ public class TestClass {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
StringOfChars s = new StringOfChars('h', 'a');
|
StringOfChars s = new StringOfChars('h', 'a');
|
||||||
s.append(new StringOfChars('l', 'l', 'o'));
|
s.append('l', 'l', 'o');
|
||||||
System.out.println(s.toString());
|
System.out.println(s.toString());
|
||||||
|
|
||||||
|
DecimalNumber dd = new DecimalNumber(2.4);
|
||||||
|
try{
|
||||||
|
DecimalNumber d = new DecimalNumber("schaffen");
|
||||||
|
} catch (ValueShouldProbablyActuallyBeANumberAndNotSomeWeirdGibberishDumbProgrammerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue