Skip to content

Instantly share code, notes, and snippets.

@brasilikum
Created May 17, 2013 13:52
Show Gist options
  • Save brasilikum/5599151 to your computer and use it in GitHub Desktop.
Save brasilikum/5599151 to your computer and use it in GitHub Desktop.
Teil eines Meilensteins OOaD an der Hoschschule Osnabrueck
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="ProjectKey">
<option name="state" value="project://e2804f05-5315-4fc6-a121-c522a6c26470" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Politiker.iml" filepath="$PROJECT_DIR$/Politiker.iml" />
</modules>
</component>
</project>
<template>
<input-field default="com.company">IJ_BASE_PACKAGE</input-field>
</template>
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
<?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>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>
����32
  
  ! "#&*$SwitchMap$com$gmh$verhaltenBeiUnternehmen[I<clinit>()VCodeLineNumberTableLocalVariableTableexLjava/lang/NoSuchFieldError; StackMapTable
SourceFilePolitiker.javaEnclosingMethod'( )* +, -.java/lang/NoSuchFieldError /, 0, 1,com/gmh/Politiker$1 InnerClassesjava/lang/Objectcom/gmh/Politikercom/gmh/verhaltenBeiUnternehmenvalues$()[Lcom/gmh/verhaltenBeiUnternehmen;NEUTRAL!Lcom/gmh/verhaltenBeiUnternehmen;ordinal()I REHABILITIERTERGEBENHOERIG
  �F���
����O�K���O�K���O�K���O�K� #&'256AD5*'6EWMMM%
 
����3�
#D "E "F GH "I JK "L JM GN GO
"P
"Q $R
JS JT JU JV WXY
Z[\]
D
^_
`ab
cdefghij InnerClassesistAktivZ istProtegiertverhaltenInParteiLcom/gmh/verhaltenInPartei;verhaltenBeiUnternehmen!Lcom/gmh/verhaltenBeiUnternehmen;<init>()VCodeLineNumberTableLocalVariableTablethisLcom/gmh/Politiker;aktiv()ZinAufsichtsrat StackMapTable parteilob parteitadelwirtschaftslobwirtschatskritikerwischt statusmeldungstatusLjava/lang/String;k
SourceFilePolitiker.java ./ '( )(l m+ *+n o- ,- p- q+ r+ </ >/ st uv w- x- y-z {|Politiker ist politisch inaktiv} ~Der Politiker ist politisch java/lang/StringBuilder ��aktiv ��und protegiert
. Verhalten in der Partei: ��#
Verhalten gegenueber Unternehmen:  inaktiv. $
Der Politiker sitzt im Aufsichtsrat
com/gmh/Politikerjava/lang/Objectcom/gmh/Politiker$1java/lang/Stringcom/gmh/verhaltenInParteiLOYALcom/gmh/verhaltenBeiUnternehmenERGEBEN AUFSICHTSRAT
REBELLISCH KRIECHEND*$SwitchMap$com$gmh$verhaltenBeiUnternehmen[Iordinal()I REHABILITIERTHOERIGNEUTRALjava/lang/SystemoutLjava/io/PrintStream;java/io/PrintStreamprintln(Ljava/lang/String;)Vappend-(Ljava/lang/String;)Ljava/lang/StringBuilder;toString()Ljava/lang/String;-(Ljava/lang/Object;)Ljava/lang/StringBuilder;!"#'()(*+,- ./0[*�*�*�*��*���1 2 34560/*��12 34760I*�����1
 2 348 9/0�;*�� � *���%*��� *�
��*��
�*� *� �1"#
$%&('2(6*:+2 ;348 :/0U*�� �
*� �*� �1.
/122 348;/0�a� *��.�Q,6@*��*��(*���*���*��*�*�*� �16 5(7/8497;><A>H?KARBWC\F`G2 a348( </0[*��*��*�*� �1JKLNO2 348=/0@*����1RS T2 34>/0�L*��\�Y�+���L*���Y�+���L�Y�+��*���*���L�5�Y�+���L*����Y�+� ��L��Y�+�!����1. WX
YZ%[9]c_w`�a�d�e2�34�?@8
�9A)1BC&
$"
����3V
+
,-
+ .
/ 012
345 06
7
8
9
:
;
<
=>
0?@
+ApolliLcom/gmh/Politiker;<init>()VCodeLineNumberTableLocalVariableTablethisLcom/gmh/Steuerung;dialogeingabeI StackMapTablemain([Ljava/lang/String;)Vargs[Ljava/lang/String;
SourceFileSteuerung.java  !com/gmh/Politiker  BCD EF�Welches nächste Ereignis?
(0) Lob von der eigenen Partei
(1) Tadel von der eigenen Partei
(2) Lob von der Wirtschaft
(3) ErwischtG HIjava/util/Scanner JK L MN O P Q R SC(Welches nächste Ereignis?
(3) Erwischt TUcom/gmh/Steuerungjava/lang/Objectaktiv()Zjava/lang/SystemoutLjava/io/PrintStream;java/io/PrintStreamprintln(Ljava/lang/String;)VinLjava/io/InputStream;(Ljava/io/InputStream;)VnextInt()I parteilob parteitadelwirtschaftsloberwischtinAufsichtsratexit(I)V!; *�*��
     !?�<*�Y��*���`�� �
Y� � � <�C(2<*���*���*���
*�����*���,�� �
Y� � � <���*�����бV -LSV]` g!j#q$t'~(�*�+�,�-�0� �"#$ � > 2 %&7 �Y�W�
34  '()*
����3= -
./0
1
2
3 4 5 6 7 89 AUFSICHTSRAT!Lcom/gmh/verhaltenBeiUnternehmen;HOERIGERGEBEN REHABILITIERTNEUTRAL$VALUES"[Lcom/gmh/verhaltenBeiUnternehmen;values$()[Lcom/gmh/verhaltenBeiUnternehmen;CodeLineNumberTablevalueOf5(Ljava/lang/String;)Lcom/gmh/verhaltenBeiUnternehmen;LocalVariableTablenameLjava/lang/String;<init>(Ljava/lang/String;I)Vthis Signature()V<clinit>3Ljava/lang/Enum<Lcom/gmh/verhaltenBeiUnternehmen;>;
SourceFileverhaltenBeiUnternehmen.java  :;com/gmh/verhaltenBeiUnternehmen < $% $%     java/lang/Enumclone()Ljava/lang/Object;5(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;@1@@@@@ "
����
 5 *���
!  "#$%1*+��
! &'()(�g�Y�� �Y
�� �Y �� �Y���Y���Y� SY� SY� SY�SY�S��
 A
'*+,
����35 '
()*
+
,
- . / 01
REBELLISCHLcom/gmh/verhaltenInPartei;LOYAL KRIECHEND$VALUES[Lcom/gmh/verhaltenInPartei;values()[Lcom/gmh/verhaltenInPartei;CodeLineNumberTablevalueOf/(Ljava/lang/String;)Lcom/gmh/verhaltenInPartei;LocalVariableTablenameLjava/lang/String;<init>(Ljava/lang/String;I)Vthis Signature()V<clinit>-Ljava/lang/Enum<Lcom/gmh/verhaltenInPartei;>;
SourceFileverhaltenInPartei.java  23com/gmh/verhaltenInPartei 4     java/lang/Enumclone()Ljava/lang/Object;5(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;@1@@@ "
����
5 *���
  1*+��
  !"#"]A�Y�� �Y
�� �Y �� �Y� SY� SY� S��
 '
!$%&
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
package com.gmh;
/**
* Created with IntelliJ IDEA.
* User: Georg
* Date: 13.05.13
* Time: 11:22
* To change this template use File | Settings | File Templates.
*/
public class Politiker {
private boolean istAktiv;
private boolean istProtegiert;
private verhaltenInPartei verhaltenInPartei;
private verhaltenBeiUnternehmen verhaltenBeiUnternehmen;
public Politiker(){
istAktiv = true;
istProtegiert = true;
verhaltenInPartei = com.gmh.verhaltenInPartei.LOYAL;
verhaltenBeiUnternehmen = com.gmh.verhaltenBeiUnternehmen.ERGEBEN;
}
public boolean aktiv(){
return this.istAktiv;
}
public boolean inAufsichtsrat(){
if(this.verhaltenBeiUnternehmen == com.gmh.verhaltenBeiUnternehmen.AUFSICHTSRAT){
return true;
}
return false;
}
public void parteilob(){
if(this.verhaltenInPartei == com.gmh.verhaltenInPartei.REBELLISCH){
this.verhaltenInPartei = com.gmh.verhaltenInPartei.LOYAL;
}else if(this.verhaltenInPartei == com.gmh.verhaltenInPartei.LOYAL){
this.verhaltenInPartei = com.gmh.verhaltenInPartei.KRIECHEND;
}else if(this.verhaltenInPartei == com.gmh.verhaltenInPartei.KRIECHEND){
this.wirtschatskritik();
}
this.statusmeldung();
}
public void parteitadel(){
if(this.verhaltenInPartei != com.gmh.verhaltenInPartei.REBELLISCH){ //Uerberpruefung aktuell Unnoetig
this.verhaltenInPartei = com.gmh.verhaltenInPartei.REBELLISCH;
}
this.statusmeldung();
}
public void wirtschaftslob(){
switch (this.verhaltenBeiUnternehmen){
case NEUTRAL:
this.verhaltenBeiUnternehmen = com.gmh.verhaltenBeiUnternehmen.REHABILITIERT;
this.istProtegiert = true;
break;
case REHABILITIERT:
this.verhaltenBeiUnternehmen = com.gmh.verhaltenBeiUnternehmen.ERGEBEN;
break;
case ERGEBEN:
this.verhaltenBeiUnternehmen = com.gmh.verhaltenBeiUnternehmen.HOERIG;
break;
case HOERIG:
this.verhaltenBeiUnternehmen = com.gmh.verhaltenBeiUnternehmen.AUFSICHTSRAT;
this.istAktiv = false;
this.istProtegiert = false;
}
this.statusmeldung();
}
private void wirtschatskritik(){
if(this.istProtegiert){
this.verhaltenBeiUnternehmen = com.gmh.verhaltenBeiUnternehmen.NEUTRAL;
this.istProtegiert = false;
}
this.statusmeldung();
}
public void erwischt(){
this.istAktiv = false;
System.out.println("Politiker ist politisch inaktiv");
}
private void statusmeldung(){
String status = "Der Politiker ist politisch ";
if(this.istAktiv){
status = status + "aktiv ";
if(istProtegiert){
status = status + "und protegiert";
}
status = status + "\n. Verhalten in der Partei: " + this.verhaltenInPartei + "\nVerhalten gegenueber Unternehmen: "+ this.verhaltenBeiUnternehmen;
}else{
status = status + "inaktiv. ";
if(this.verhaltenBeiUnternehmen == com.gmh.verhaltenBeiUnternehmen.AUFSICHTSRAT){
status = status + "\nDer Politiker sitzt im Aufsichtsrat";
}
}
System.out.println(status + "\n");
}
}
package com.gmh;
import java.util.Scanner;
import static java.lang.System.exit;
public class Steuerung {
private Politiker polli;
public Steuerung(){
dialog();
}
public void dialog(){
int eingabe = -1;
polli=new Politiker();
while(polli.aktiv()){
System.out.println("Welches nächste Ereignis?\n"
+" (0) Lob von der eigenen Partei\n"
+" (1) Tadel von der eigenen Partei\n"
+" (2) Lob von der Wirtschaft\n"
+" (3) Erwischt");
eingabe=new Scanner(System.in).nextInt();
switch(eingabe){
case 0:
polli.parteilob();
break;
case 1:
polli.parteitadel();
break;
case 2:
polli.wirtschaftslob();
break;
case 3:
polli.erwischt();
break;
}
}
while (polli.inAufsichtsrat()){
System.out.println("Welches nächste Ereignis?\n"
+" (3) Erwischt");
eingabe=new Scanner(System.in).nextInt();
if(eingabe==3){
polli.erwischt();
exit(0);
}
}
}
public static void main(String[] args) {
new Steuerung();
}
}
package com.gmh;
/**
* Created with IntelliJ IDEA.
* User: Georg
* Date: 13.05.13
* Time: 15:28
* To change this template use File | Settings | File Templates.
*/
public enum verhaltenBeiUnternehmen {
AUFSICHTSRAT, HOERIG, ERGEBEN, REHABILITIERT, NEUTRAL
}
package com.gmh;
/**
* Created with IntelliJ IDEA.
* User: Georg
* Date: 13.05.13
* Time: 15:25
* To change this template use File | Settings | File Templates.
*/
public enum verhaltenInPartei {
REBELLISCH, LOYAL, KRIECHEND
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment