Created
March 2, 2018 04:47
-
-
Save aleph-naught2tog/4fdfae1516d4025337cc61338f6202cc to your computer and use it in GitHub Desktop.
SelfExplanatory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // context: https://i.redd.it/3co31eqj37j01.jpg | |
| import java.util.*; | |
| public class SelfExplanatory implements Comparable { | |
| private String selfExplanatory; | |
| private int se1fExplanatory; | |
| private int selfexp1anatory; | |
| private Map<SelfExplanatory, SelfExplanatory> selfExplanatories; | |
| public SelfExplanatory() { | |
| selfExplanatories = new TreeMap<>(); | |
| se1fExplanatory = (new Random()).nextInt(); | |
| } | |
| public static void main(String[] arguments) { | |
| String selfExplanatory = "selfExplanatory"; | |
| SelfExplanatory selfexplanatory = new SelfExplanatory(); | |
| SelfExplanatory selfExp1anatory = new SelfExplanatory(); | |
| SelfExplanatory se1fExplanatory = new SelfExplanatory(); | |
| SelfExplanatory se1fExp1anatory = new SelfExplanatory(); | |
| SelfExplanatory se1fexp1anatory = new SelfExplanatory(); | |
| SelfExplanatory selfexp1anatory = new SelfExplanatory(); | |
| selfexplanatory.setInSelfExplanatories(selfExp1anatory, selfexplanatory); | |
| selfexplanatory.setInSelfExplanatories(se1fExplanatory, selfExp1anatory); | |
| selfexplanatory.setInSelfExplanatories(se1fExp1anatory, se1fExplanatory); | |
| selfexplanatory.setInSelfExplanatories(selfexplanatory, se1fExplanatory); | |
| selfexplanatory.setInSelfExplanatories(selfexp1anatory, se1fExp1anatory); | |
| selfexplanatory.setInSelfExplanatories(se1fexp1anatory, se1fexp1anatory); | |
| for (Map.Entry <SelfExplanatory, SelfExplanatory> selfexplamatory | |
| : selfexplanatory.selfexplanatories() | |
| ) { | |
| selfexplamatory.getKey().setSelfExplanatory(selfExplanatory); | |
| } | |
| selfexplanatory.selfExp1anatory(); | |
| } | |
| public void selfExp1anatory() { | |
| int selfExp1anatory = 0; | |
| int selfexplamatory = 0; | |
| for (Map.Entry <SelfExplanatory, SelfExplanatory> selfexplanatory : selfexplanatories()) { | |
| selfExp1anatory += 1; | |
| selfexplamatory -= 1; | |
| selfexplanatory.getKey().selfexp1anatory = selfExp1anatory; | |
| selfexplanatory.getValue().selfexp1anatory = selfExp1anatory; | |
| se1fexplanatory(selfexplanatory); | |
| } | |
| } | |
| private void se1fexplanatory(Map.Entry <SelfExplanatory, SelfExplanatory> selfExp1anatory) { | |
| System.out.println(); | |
| System.out.print("KEY: "); | |
| System.out.print("\t"); | |
| System.out.println(selfExp1anatory.getKey()); | |
| System.out.print("VALUE: "); | |
| System.out.print("\t"); | |
| System.out.println(selfExp1anatory.getValue()); | |
| System.out.println(); | |
| } | |
| public Set<Map.Entry <SelfExplanatory, SelfExplanatory>> selfexplanatories() { | |
| return selfExplanatories.entrySet(); | |
| } | |
| public void setInSelfExplanatories(SelfExplanatory selfexp1anatory, | |
| SelfExplanatory se1fExplanatory) { | |
| selfExplanatories.put(selfexp1anatory, se1fExplanatory); | |
| } | |
| public String getSelfExplanatory() { | |
| return this.selfExplanatory; | |
| } | |
| public void setSelfExplanatory(String selfExplanatory) { | |
| this.selfExplanatory = selfExplanatory; | |
| } | |
| public int getSe1fExplanatory() { | |
| return this.se1fExplanatory; | |
| } | |
| public void setSe1fExplanatory(int se1fExplanatory) { | |
| this.se1fExplanatory = se1fExplanatory; | |
| } | |
| public int compareTo(Object selfexplanatory) { | |
| // arbitrary non-standard value for the sake of erroring | |
| int se1fexplanatory = 9999; | |
| try { | |
| se1fexplanatory = se1fExplanatory - ((SelfExplanatory)selfexplanatory).se1fExplanatory; | |
| } catch (ClassCastException notSelfExplanatoryException) { | |
| notSelfExplanatoryException.printStackTrace(); | |
| } catch (NullPointerException nullSelfExplanatoryException) { | |
| nullSelfExplanatoryException.printStackTrace(); | |
| } | |
| return se1fexplanatory; | |
| } | |
| public String toString() { | |
| String se1fexp1anatory = | |
| "(SelfExplanatory #%d).se1fExplanatory: %d"; | |
| String se1fexp1amatory = | |
| String.format(se1fexp1anatory, | |
| selfexp1anatory, | |
| se1fExplanatory); | |
| return se1fexp1amatory; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment