Exemplo n.º 1
0
    private bool CompetenceElementsHandler(CompetenceElement competenceElement)
    {
        int numSensesNeeded = 0;

        foreach (Sense sense in competenceElement.Senses)
        {
            numSensesNeeded = CheckSense(numSensesNeeded, sense);
        }
        if (numSensesNeeded == competenceElement.Senses.Count)
        {
            ABOD3_Bridge.GetInstance().AletForElement(botNumber, competenceElement.Name, "CE");

            PlanElement elementToBeTriggered = competenceElement.TriggerableElement;
            if (elementToBeTriggered is Competence)
            {
                CompetenceHandler((Competence)elementToBeTriggered);
            }
            else if (elementToBeTriggered is ActionPattern)
            {
                ActionPatternHandler((ActionPattern)elementToBeTriggered);
            }
            else
            {
                TriggerAction((Action)elementToBeTriggered);
            }
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 2
0
 private void DriveElementsHandler(List <DriveElement> driveElements)
 {
     foreach (DriveElement driveElement in driveElements)
     {
         if (Time.time >= driveElement.NextCheck)
         {
             driveElement.UpdateNextCheck();
             int numSensesNeeded = 0;
             foreach (Sense trigger in driveElement.Senses)
             {
                 numSensesNeeded = CheckSense(numSensesNeeded, trigger);
             }
             if (numSensesNeeded == driveElement.Senses.Count)
             {
                 ABOD3_Bridge.GetInstance().AletForElement(botNumber, driveElement.Name, "DE");
                 PlanElement elementToBeTriggered = driveElement.TriggerableElement;
                 if (elementToBeTriggered is Competence)
                 {
                     CompetenceHandler((Competence)elementToBeTriggered);
                 }
                 else if (elementToBeTriggered is ActionPattern)
                 {
                     ActionPatternHandler((ActionPattern)elementToBeTriggered);
                 }
                 else if (elementToBeTriggered is Action)
                 {
                     TriggerAction((Action)elementToBeTriggered);
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 public void Subscribe(object p)
 {
     if (p is PlanElement)
     {
         PlanElement pE = p as PlanElement;
         pE.FireEvent += new FireHandler(Listen);
     }
 }
Exemplo n.º 4
0
        public override SpawnType Execute(string userId, PlanElementEventArg arg, SpawnElement se, ProgramAttributeData pad)
        {
            PlanElement value     = HandlePlanElementActivation(PlanUtils, arg, se);
            var         spawnType = new SpawnType {
                Type = _elementType.ToString()
            };

            return(spawnType);
        }
Exemplo n.º 5
0
 public void SubscribeToListeners(PlanElement p, EventType evType)
 {
     foreach (IListener listener in _listeners)
     {
         if (listener.ListensFor(evType))
         {
             listener.Subscribe(p);
         }
     }
 }
Exemplo n.º 6
0
 protected PlanElement HandlePlanElementActivation(IPlanElementUtils planUtils, PlanElementEventArg e, SpawnElement rse)
 {
     try
     {
         PlanElement pe = planUtils.ActivatePlanElement(rse.ElementId, e.Program);
         return(pe);
     }
     catch (Exception ex)
     {
         throw new Exception("AD:StepPlanProcessor:HandlePlanElementActivation()::" + ex.Message,
                             ex.InnerException);
     }
 }
Exemplo n.º 7
0
    public CompetenceElement(string name, List <Sense> senses, PlanElement triggerableElement)
    {
        this.name = name;

        if (senses != null)
        {
            this.senses = senses;
        }
        else
        {
            this.senses = new List <Sense>();
        }

        this.triggerableElement = triggerableElement;
    }
Exemplo n.º 8
0
    public DriveElement(string name, List <Sense> senses, PlanElement triggerableElement, float checkTime) : base(name)
    {
        if (senses != null)
        {
            this.senses = senses;
        }
        else
        {
            this.senses = new List <Sense>();
        }

        this.triggerableElement = triggerableElement;

        this.checkTime = checkTime;
        this.nextCheck = this.checkTime;
    }
Exemplo n.º 9
0
 public void HandlePlanElementActivation(PlanElementEventArg e, SpawnElement rse)
 {
     try
     {
         PlanElement pe = PEUtils.ActivatePlanElement(rse.ElementId, e.Program);
         if (pe != null)
         {
             OnProcessIdEvent(pe);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("AD:StepPlanProcessor:HandlePlanElementActivation()::" + ex.Message,
                             ex.InnerException);
     }
 }
Exemplo n.º 10
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Coverage;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Issuer != null)
            {
                dest.Issuer = (Hl7.Fhir.Model.ResourceReference)Issuer.DeepCopy();
            }
            if (Bin != null)
            {
                dest.Bin = (Hl7.Fhir.Model.Identifier)Bin.DeepCopy();
            }
            if (Period != null)
            {
                dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy();
            }
            if (Type != null)
            {
                dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopy();
            }
            if (SubscriberId != null)
            {
                dest.SubscriberId = (Hl7.Fhir.Model.Identifier)SubscriberId.DeepCopy();
            }
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (GroupElement != null)
            {
                dest.GroupElement = (Hl7.Fhir.Model.FhirString)GroupElement.DeepCopy();
            }
            if (PlanElement != null)
            {
                dest.PlanElement = (Hl7.Fhir.Model.FhirString)PlanElement.DeepCopy();
            }
            if (SubPlanElement != null)
            {
                dest.SubPlanElement = (Hl7.Fhir.Model.FhirString)SubPlanElement.DeepCopy();
            }
            if (DependentElement != null)
            {
                dest.DependentElement = (Hl7.Fhir.Model.PositiveInt)DependentElement.DeepCopy();
            }
            if (SequenceElement != null)
            {
                dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopy();
            }
            if (Subscriber != null)
            {
                dest.Subscriber = (Hl7.Fhir.Model.ResourceReference)Subscriber.DeepCopy();
            }
            if (Network != null)
            {
                dest.Network = (Hl7.Fhir.Model.Identifier)Network.DeepCopy();
            }
            if (Contract != null)
            {
                dest.Contract = new List <Hl7.Fhir.Model.ResourceReference>(Contract.DeepCopy());
            }
            return(dest);
        }
Exemplo n.º 11
0
 public List <DTO.SpawnElementDetail> GetSpawnElement(PlanElement a)
 {
     return(new List <DTO.SpawnElementDetail>());
 }
Exemplo n.º 12
0
 public void ProcessPlanElementChanges(PlanElements planElems, PlanElement samplePe, PlanElement fPe, string userId)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 13
0
 public bool UpdatePlanElementAttributes(DTO.Program pg, PlanElement planElement, string userId, PlanElements planElems)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 14
0
 public PlanElement InitializePlanElementSettings(PlanElement pe, PlanElement p, DTO.Program program)
 {
     throw new NotImplementedException();
 }