Skip to content

Commit

Permalink
added some haracter properties and some additional rules
Browse files Browse the repository at this point in the history
  • Loading branch information
UrsZeidler committed Feb 27, 2015
1 parent e02ee48 commit 71c91d6
Show file tree
Hide file tree
Showing 29 changed files with 1,311 additions and 141 deletions.
5 changes: 5 additions & 0 deletions de.urszeidler.shr5.management.model.edit/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -545,3 +545,8 @@ _UI_ContractPayment_payed_feature = Payed
_UI_CharacterChange_change_feature = Change
_UI_DiaryEntry_message_description = The message of these diary entry.
_UI_SumToTenGenerator_type = Sum To Ten Generator
_UI_ManagedCharacter_height_feature = Height
_UI_ManagedCharacter_dateofbirth_feature = Dateofbirth
_UI_ManagedCharacter_weight_feature = Weight
_UI_ManagedCharacter_age_feature = Age
_UI_PlayerCharacter_age_feature = Age
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
addPublicAwarenessPropertyDescriptor(object);
addKarmaGaintPropertyDescriptor(object);
addCurrentKarmaPropertyDescriptor(object);
addHeightPropertyDescriptor(object);
addDateofbirthPropertyDescriptor(object);
addWeightPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
Expand Down Expand Up @@ -314,6 +317,72 @@ protected void addCurrentKarmaPropertyDescriptor(Object object) {
null));
}

/**
* This adds a property descriptor for the Height feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addHeightPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_ManagedCharacter_height_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_ManagedCharacter_height_feature", "_UI_ManagedCharacter_type"),
Shr5managementPackage.Literals.MANAGED_CHARACTER__HEIGHT,
true,
false,
false,
ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
null,
null));
}

/**
* This adds a property descriptor for the Dateofbirth feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDateofbirthPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_ManagedCharacter_dateofbirth_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_ManagedCharacter_dateofbirth_feature", "_UI_ManagedCharacter_type"),
Shr5managementPackage.Literals.MANAGED_CHARACTER__DATEOFBIRTH,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}

/**
* This adds a property descriptor for the Weight feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addWeightPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_ManagedCharacter_weight_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_ManagedCharacter_weight_feature", "_UI_ManagedCharacter_type"),
Shr5managementPackage.Literals.MANAGED_CHARACTER__WEIGHT,
true,
false,
false,
ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
null,
null));
}

/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
Expand Down Expand Up @@ -384,6 +453,9 @@ public void notifyChanged(Notification notification) {
case Shr5managementPackage.MANAGED_CHARACTER__PUBLIC_AWARENESS:
case Shr5managementPackage.MANAGED_CHARACTER__KARMA_GAINT:
case Shr5managementPackage.MANAGED_CHARACTER__CURRENT_KARMA:
case Shr5managementPackage.MANAGED_CHARACTER__HEIGHT:
case Shr5managementPackage.MANAGED_CHARACTER__DATEOFBIRTH:
case Shr5managementPackage.MANAGED_CHARACTER__WEIGHT:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case Shr5managementPackage.MANAGED_CHARACTER__PERSONA:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import de.urszeidler.eclipse.shr5Management.ManagedCharacter;
import de.urszeidler.eclipse.shr5Management.PlayerCharacter;
Expand Down Expand Up @@ -46,11 +47,34 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);

addAgePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}

/**
* This adds a property descriptor for the Age feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addAgePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_PlayerCharacter_age_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_PlayerCharacter_age_feature", "_UI_PlayerCharacter_type"),
Shr5managementPackage.Literals.PLAYER_CHARACTER__AGE,
false,
false,
false,
ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
null,
null));
}

/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
Expand Down Expand Up @@ -136,6 +160,9 @@ public void notifyChanged(Notification notification) {
updateChildren(notification);

switch (notification.getFeatureID(PlayerCharacter.class)) {
case Shr5managementPackage.PLAYER_CHARACTER__AGE:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case Shr5managementPackage.PLAYER_CHARACTER__DIARY:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
package de.urszeidler.eclipse.shr5Management.tests;

import java.util.Calendar;
import junit.framework.TestCase;
import de.urszeidler.eclipse.shr5Management.KarmaGaint;
import de.urszeidler.eclipse.shr5Management.ManagedCharacter;
Expand Down Expand Up @@ -161,5 +162,4 @@ public void testGetCurrentKarma() {


}

} //ManagedCharacterTest
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
*/
package de.urszeidler.eclipse.shr5Management.tests;

import java.util.Calendar;

import junit.textui.TestRunner;
import de.urszeidler.eclipse.shr5Management.CharacterDiary;
import de.urszeidler.eclipse.shr5Management.PlayerCharacter;
import de.urszeidler.eclipse.shr5Management.Shr5managementFactory;

/**
* <!-- begin-user-doc -->
* A test case for the model object '<em><b>Player Character</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are tested:
* <ul>
* <li>{@link de.urszeidler.eclipse.shr5Management.PlayerCharacter#getAge() <em>Age</em>}</li>
* </ul>
* </p>
* @generated
*/
public class PlayerCharacterTest extends ManagedCharacterTest {
Expand Down Expand Up @@ -67,4 +76,27 @@ protected void tearDown() throws Exception {
setFixture(null);
}


/**
* Tests the '{@link de.urszeidler.eclipse.shr5Management.ManagedCharacter#getAge() <em>Age</em>}' feature getter.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see de.urszeidler.eclipse.shr5Management.ManagedCharacter#getAge()
* @generated not
*/
public void testGetAge() {
Calendar birth = Calendar.getInstance();
getFixture().setDateofbirth(birth.getTime());

CharacterDiary diary = Shr5managementFactory.eINSTANCE.createCharacterDiary();
birth.add(Calendar.YEAR, 20);
diary.setCharacterDate(birth.getTime());
getFixture().setDiary(diary);

assertEquals(20, getFixture().getAge());


}


} //PlayerCharacterTest
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,26 @@ public void testHasSpendAllSpecialPoints__DiagnosticChain_Map() {
// TODO
}

/**
* Tests the '{@link de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasBasicViolations(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Has Basic Violations</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasBasicViolations(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated not
*/
public void testHasBasicViolations__DiagnosticChain_Map() {
createBasicCategories();
Spezies spezies = Shr5Factory.eINSTANCE.createSpezies();
getFixture().getMetaType().setChoosableTypes(spezies);
PlayerCharacter character = PriorityCategorieTest.createMudanCharacter();
getFixture().setCharacter(character);
character.getPersona().setSpezies(spezies);
assertEquals("is true", true, getFixture().hasBasicViolations(diagnostics, context));
character.getPersona().setSpezies(Shr5Factory.eINSTANCE.createSpezies());
assertEquals("is false", false, getFixture().hasBasicViolations(diagnostics, context));
}


/**
* Tests the '
* {@link de.urszeidler.eclipse.shr5Management.Shr5Generator#hasSpendAllSpecialTypePoints(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import de.urszeidler.eclipse.shr5.AttributModifikatorWert;
import de.urszeidler.eclipse.shr5.Fertigkeit;
import de.urszeidler.eclipse.shr5.Gegenstand;
import de.urszeidler.eclipse.shr5.KiAdept;
import de.urszeidler.eclipse.shr5.KiKraft;
import de.urszeidler.eclipse.shr5.KoerperPersona;
import de.urszeidler.eclipse.shr5.PersonaEigenschaft;
import de.urszeidler.eclipse.shr5.PersonaFertigkeit;
Expand Down Expand Up @@ -47,6 +49,8 @@
* <li>{@link de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasNoConstrainVoilation(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Has No Constrain Voilation</em>}</li>
* <li>{@link de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasLifestyleChoosen(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Has Lifestyle Choosen</em>}</li>
* <li>{@link de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasOnlyAllowedSources(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Has Only Allowed Sources</em>}</li>
* <li>{@link de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasKiPowerOverLimit(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Has Ki Power Over Limit</em>}</li>
* <li>{@link de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasBasicViolations(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Has Basic Violations</em>}</li>
* </ul>
* </p>
* @generated
Expand Down Expand Up @@ -378,6 +382,44 @@ public void testHasOnlyAllowedSources__DiagnosticChain_Map() {

}

/**
* Tests the '{@link de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasKiPowerOverLimit(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Has Ki Power Over Limit</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasKiPowerOverLimit(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated not
*/
public void testHasKiPowerOverLimit__DiagnosticChain_Map() {
PlayerCharacter adeptCharacter = PriorityCategorieTest.createAdeptCharacter();
getFixture().setCharacter(adeptCharacter);

KiAdept persona = (KiAdept)adeptCharacter.getPersona();
persona.setMagieBasis(2);
assertTrue(getFixture().hasKiPowerOverLimit(diagnostics, context));
KiKraft kipower= Shr5Factory.eINSTANCE.createKiKraft();
kipower.setKraftpunkte(-201);
persona.getKikraft().add(kipower);
assertFalse(getFixture().hasKiPowerOverLimit(diagnostics, context));
persona.setMagieBasis(3);
assertTrue(getFixture().hasKiPowerOverLimit(diagnostics, context));
kipower.setKraftpunkte(-300);
assertTrue(getFixture().hasKiPowerOverLimit(diagnostics, context));
kipower.setKraftpunkte(-301);
assertFalse(getFixture().hasKiPowerOverLimit(diagnostics, context));


}

/**
* Tests the '{@link de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasBasicViolations(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Has Basic Violations</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasBasicViolations(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated not
*/
public void testHasBasicViolations__DiagnosticChain_Map() {
}

/**
* Tests the '{@link de.urszeidler.eclipse.shr5Management.Shr5RuleGenerator#hasLifestyleChoosen(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Has Lifestyle Choosen</em>}' operation.
* <!-- begin-user-doc -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import java.util.Collections;
import java.util.Map;

import junit.textui.TestRunner;

import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;

import de.urszeidler.eclipse.shr5Management.Shr5System;
import de.urszeidler.eclipse.shr5Management.Shr5managementFactory;
import de.urszeidler.eclipse.shr5Management.SumToTenGenerator;
import junit.textui.TestRunner;

/**
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -62,7 +63,7 @@ protected SumToTenGenerator getFixture() {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#setUp()
* @generated
* @generated not
*/
@Override
protected void setUp() throws Exception {
Expand Down
15 changes: 15 additions & 0 deletions de.urszeidler.shr5.management.model/model/Shr5managementXMI.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@
<xsd:attribute name="sex" type="shr5mngt:Sex" use="required"/>
<xsd:attribute name="notorietyBasic" type="xsd:int"/>
<xsd:attribute name="publicAwareness" type="xsd:int"/>
<xsd:attribute name="height" type="xsd:int">
<xsd:annotation>
<xsd:documentation>The height in cm.</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="dateofbirth" type="xsd:string">
<xsd:annotation>
<xsd:documentation>The date of the birth.</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="weight" type="xsd:int">
<xsd:annotation>
<xsd:documentation>The weight in kg.</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="chracterSource" type="xsd:string">
<xsd:annotation>
<xsd:documentation>Refers the generator.</xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@
<nested inputs="shr5Management.ecore#//ManagedCharacter/sex" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=1"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/notorietyBasic" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=2"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/publicAwareness" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=3"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/height" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=4"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/dateofbirth" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=5"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/weight" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=6"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/persona" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDParticle/XSDModelGroup/XSDParticle"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/changes" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDParticle/XSDModelGroup/XSDParticle=1"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/chracterSource" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=4"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/chracterSource" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=7"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/chracterSource" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDParticle/XSDModelGroup/XSDParticle=2"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/inventar" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDParticle/XSDModelGroup/XSDParticle=3"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/contracts" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDParticle/XSDModelGroup/XSDParticle=4"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/connections" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDParticle/XSDModelGroup/XSDParticle=5"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/vehicels" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDParticle/XSDModelGroup/XSDParticle=6"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/choosenLifestyle" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=5"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/choosenLifestyle" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=8"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/choosenLifestyle" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDParticle/XSDModelGroup/XSDParticle=7"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/nativeLanguage" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=6"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/nativeLanguage" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDAttributeUse=9"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/nativeLanguage" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDParticle/XSDModelGroup/XSDParticle=8"/>
<nested inputs="shr5Management.ecore#//ManagedCharacter/generatorSrc" outputs="Shr5managementXMI.xsd#//ManagedCharacter;XSDComplexTypeDefinition/XSDParticle/XSDModelGroup/XSDParticle=9"/>
</nested>
Expand Down
Loading

0 comments on commit 71c91d6

Please sign in to comment.