コード例 #1
0
        public Labor Get(string key)
        {
            Labor result = null;

            Labors.TryGet(key, out result);
            return(result);
        }
コード例 #2
0
 public void AddEvoker(Labor Recipient)
 {
     EvokersIn.Add(new NoteEvoker(Labor, Recipient, new List <Labor>()
     {
         Labor
     }));
 }
コード例 #3
0
 /// <summary>
 /// The AddRecipient.
 /// </summary>
 /// <param name="key">The key<see cref="string"/>.</param>
 /// <param name="noteBox">The noteBox<see cref="NoteBox"/>.</param>
 public void AddRecipient(string key, NoteBox noteBox)
 {
     if (noteBox != null)
     {
         if (noteBox.Labor != null)
         {
             Labor objv = noteBox.Labor;
             Put(noteBox.RecipientName, noteBox);
         }
         else
         {
             List <Labor> objvl = Scope.Subjects.AsCards().Where(m => m.Value.Labors.ContainsKey(key)).SelectMany(os => os.Value.Labors.AsCards().Select(o => o.Value)).ToList();
             if (objvl.Any())
             {
                 Labor objv = objvl.First();
                 noteBox.Labor = objv;
                 Put(key, noteBox);
             }
         }
     }
     else
     {
         List <Labor> objvl = Scope.Subjects.AsCards().Where(m => m.Value.Labors.ContainsKey(key)).SelectMany(os => os.Value.Labors.AsCards().Select(o => o.Value)).ToList();
         if (objvl.Any())
         {
             Labor   objv  = objvl.First();
             NoteBox iobox = new NoteBox(objv.Laborer.LaborerName);
             iobox.Labor = objv;
             Put(key, iobox);
         }
     }
 }
コード例 #4
0
 /// <summary>
 /// The Send.
 /// </summary>
 /// <param name="parameters">The parameters<see cref="Note"/>.</param>
 public void Send(Note parameters)
 {
     if (parameters.RecipientName != null && parameters.SenderName != null)
     {
         if (ContainsKey(parameters.RecipientName))
         {
             NoteBox iobox = Get(parameters.RecipientName);
             if (iobox != null)
             {
                 iobox.AddNote(parameters);
             }
         }
         else if (parameters.Recipient != null)
         {
             Labor   objv  = parameters.Recipient;
             NoteBox iobox = new NoteBox(objv.Laborer.LaborerName);
             iobox.Labor = objv;
             iobox.AddNote(parameters);
             SetRecipient(iobox);
         }
         else if (Scope != null)
         {
             List <Labor> objvl = Scope.Subjects.AsCards().Where(m => m.Value.Labors.ContainsKey(parameters.RecipientName)).SelectMany(os => os.Value.Labors.AsCards().Select(o => o.Value)).ToList();
             if (objvl.Any())
             {
                 Labor   objv  = objvl.First();
                 NoteBox iobox = new NoteBox(objv.Laborer.LaborerName);
                 iobox.Labor = objv;
                 iobox.AddNote(parameters);
                 SetRecipient(iobox);
             }
         }
     }
 }
コード例 #5
0
 public NoteEvoker this[Labor objective]
 {
     get
     {
         return(this.AsValues().Where(c => c.RelationLabors.Where(ro => ReferenceEquals(ro, objective)).Any()).First());
     }
 }
コード例 #6
0
        public void Add(IDeputy value)
        {
            Labor obj = new Labor($"{value.Info.Name}", value);

            obj.Scope   = Scope;
            obj.Subject = this;
            Labors.Put(obj.Laborer.LaborerName, obj);
        }
コード例 #7
0
 public void AddRange(IList <IDeputy> value)
 {
     foreach (IDeputy obj in value)
     {
         Labor oj = new Labor($"{obj.Info.Name}", obj);
         oj.Scope   = Scope;
         oj.Subject = this;
         Labors.Put($"{obj.Info.Name}", oj);
     }
 }
コード例 #8
0
 public Subject(string Name, IList <IDeputy> MethodList)
 {
     SubjectName = Name;
     foreach (IDeputy method in MethodList)
     {
         Labor objective = new Labor($"{method.Info.Name}", method);
         objective.Scope   = Scope;
         objective.Subject = this;
         Labors.Put($"{method.Info.Name}", objective);
     }
     LaborersCount = 1;
 }
コード例 #9
0
        /// <summary>
        /// The QualifyToEvoke.
        /// </summary>
        public void QualifyToEvoke()
        {
            List <NoteEvoker> toEvoke = new List <NoteEvoker>();

            foreach (NoteEvoker relay in Evokers.AsValues())
            {
                if (relay.RelationNames.All(r => ContainsKey(r)))
                {
                    if (relay.RelationNames.All(r => this[r].AsValues().Any()))
                    {
                        toEvoke.Add(relay);
                    }
                }
            }

            if (toEvoke.Any())
            {
                foreach (NoteEvoker evoke in toEvoke)
                {
                    if (MeetsRequirements(evoke.RelationNames))
                    {
                        List <Note> antios = TakeOut(evoke.RelationNames);

                        if (antios.All(a => a != null))
                        {
                            object[] parameters = new object[0];
                            object   begin      = Labor.Laborer.Input;
                            if (begin != null)
                            {
                                parameters = parameters.Concat((object[])begin).ToArray();
                            }
                            foreach (Note antio in antios)
                            {
                                if (antio.Parameters.GetType().IsArray)
                                {
                                    parameters = parameters.Concat(antio.Parameters.SelectMany(a => (object[])a).ToArray()).ToArray();
                                }
                                else
                                {
                                    parameters = parameters.Concat(antio.Parameters).ToArray();
                                }
                            }

                            Labor.Execute(parameters);
                        }
                    }
                }
            }
        }
コード例 #10
0
 public Labor this[string key]
 {
     get
     {
         Labor result = null;
         Labors.TryGet(key, out result);
         return(result);
     }
     set
     {
         value.Scope   = Scope;
         value.Subject = this;
         Labors.Put(key, value);
     }
 }
コード例 #11
0
 /// <summary>
 /// The SetRecipient.
 /// </summary>
 /// <param name="value">The value<see cref="NoteBox"/>.</param>
 public void SetRecipient(NoteBox value)
 {
     if (value != null)
     {
         if (value.Labor != null)
         {
             Labor objv = value.Labor;
             Put(value.RecipientName, value);
         }
         else
         {
             List <Labor> objvl = Scope.Subjects.AsCards().Where(m => m.Value.Labors.ContainsKey(value.RecipientName)).SelectMany(os => os.Value.Labors.AsCards().Select(o => o.Value)).ToList();
             if (objvl.Any())
             {
                 Labor objv = objvl.First();
                 value.Labor = objv;
                 Put(value.RecipientName, value);
             }
         }
     }
 }
コード例 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Note"/> class.
        /// </summary>
        /// <param name="sender">The sender<see cref="Labor"/>.</param>
        /// <param name="recipient">The recipient<see cref="Labor"/>.</param>
        /// <param name="Out">The Out<see cref="NoteEvoker"/>.</param>
        /// <param name="In">The In<see cref="NoteEvokers"/>.</param>
        /// <param name="Params">The Params<see cref="object[]"/>.</param>
        public Note(Labor sender, Labor recipient, NoteEvoker Out, NoteEvokers In, params object[] Params)
        {
            Parameters = Params;

            if (recipient != null)
            {
                Recipient     = recipient;
                RecipientName = Recipient.Laborer.LaborerName;
            }

            Sender     = sender;
            SenderName = Sender.Laborer.LaborerName;

            if (Out != null)
            {
                EvokerOut = Out;
            }

            if (In != null)
            {
                EvokersIn = In;
            }
        }
コード例 #13
0
 public void Add(Labor value)
 {
     value.Scope   = Scope;
     value.Subject = this;
     Labors.Put(value.Laborer.LaborerName, value);
 }
コード例 #14
0
 public void AddEvoker(Labor Recipient, List <Labor> RelationLabors)
 {
     EvokersIn.Add(new NoteEvoker(Labor, Recipient, RelationLabors));
 }