Beispiel #1
0
        public override pScoringRuleType pGetScoringRule()
        {
            pScoringRuleType returnValue;
            string name = "unknown scoring rule";
            pActorType unit = null;
            pActorType objectID;
            string newState;
            string from;

            try
            {
                reader.Read();
                name = pGetString();
                unit = pGetActor();
                if ("Object" != reader.Name)
                {
                    returnValue = new pScoringRuleType(name, unit);
                }
                else
                {
                    objectID = pGetActor();
                    newState = pGetString();
                    if ("From" != reader.Name)
                    {

                        returnValue = new pScoringRuleType(name, unit, objectID, newState);

                    }
                    else
                    {
                        from = pGetString();
                        returnValue = new pScoringRuleType(name, unit, objectID, newState, from);
                    }

                }
                returnValue.Increment = pGetDouble();
                reader.ReadEndElement();
                return returnValue;

            }
            catch (SystemException e)
            {

                throw new ApplicationException("Failed to read scoring rule named " + name, e);
            }

        }
Beispiel #2
0
        public ScoringRuleType(pScoringRuleType s)
        {
            this.name = s.Name;
            this.unit = new ActorType(s.Unit);
            this.objectID = null;
             this.condition = new ScoringDB.ConditionInfo(ScoringDB.ConditionInfo.ConditionType.ObjectExists, null, null);
 

            if (null != s.ObjectID)
            {
                this.objectID = new ActorType(s.ObjectID);
                this.condition = new ScoringDB.ConditionInfo( ScoringDB.ConditionInfo.ConditionType.StateChange,s.From,s.NewState);
            }

            this.newState = s.NewState;
            this.from = s.From;
            this.increment = s.Increment;
        }