예제 #1
0
        private PurchaseOrderLine[][] GetAllPremutations(IRequirement requirement, IList <Stock> stocks)
        {
            var vendors      = new PurchaseOrderLine[stocks.Count][];
            var maxAvailable = 0;

            for (int i = 0; i < stocks.Count; i++)
            {
                vendors[i]    = GetLines(requirement.Quantity, stocks[i]);
                maxAvailable += stocks[i].Quantity;
            }
            if (maxAvailable == 0)
            {
                return(new PurchaseOrderLine[0][]);
            }
            var premuter = new Premuting <PurchaseOrderLine>(vendors);
            var result   = new List <PurchaseOrderLine[]>();
            var target   = Math.Min(maxAvailable, requirement.Quantity);

            premuter.Premute((x, y, z) =>
            {
                if (IsValidCombination(x, target))
                {
                    result.Add(x.Where(y => y.Quantity > 0).ToArray());
                }
            });
            return(result.ToArray());
        }
 public RequirementDeficiency(IRequirement requirement, eDeficiencyStatusEnum status, IAgent waivedBy, DateTime?waivedOn)
 {
     Requirement = requirement ?? throw new ArgumentNullException("requirement");
     Status      = status;
     WaivedBy    = waivedBy;
     WaivedOn    = waivedOn;
 }
        public static IRequirement[] Decomposite(IRequirement requirement, List <IRequirement> requirements = null)
        {
            if (requirements == null)
            {
                requirements = new List <IRequirement>();
            }

            var wr = requirement as WrappedRequirement;

            if (wr != null)
            {
                Decomposite(wr.innerRequirement, requirements);
            }
            else
            {
                var cr = requirement as CompositeRequirement;

                if (cr != null)
                {
                    foreach (var r in cr.requirements)
                    {
                        Decomposite(r.Value, requirements);
                    }
                }
                else
                {
                    requirements.Add(requirement);
                }
            }

            return(requirements.ToArray());
        }
예제 #4
0
 public void EnsureIsMet(IRequirement requirement)
 {
     if (!requirement.IsMet())
     {
         requirement.Meet();
     }
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="colorSettings">
        /// The color settings data.
        /// </param>
        /// <param name="requirements">
        /// The requirement dictionary.
        /// </param>
        /// <param name="undoRedoManager">
        /// The undo/redo manager.
        /// </param>
        /// <param name="undoableFactory">
        /// A factory for creating undoable actions.
        /// </param>
        /// <param name="alternativeFactory">
        /// An Autofac factory for creating alternative requirements.
        /// </param>
        /// <param name="alwaysDisplayFactory">
        /// An Autofac factory for creating always display dungeon items requirements.
        /// </param>
        /// <param name="dungeon">
        /// The dungeon whose small keys are to be represented.
        /// </param>
        public SmallKeySmallItemVM(
            IColorSettings colorSettings, IRequirementDictionary requirements,
            IUndoRedoManager undoRedoManager, IUndoableFactory undoableFactory,
            AlternativeRequirement.Factory alternativeFactory,
            AlwaysDisplayDungeonItemsRequirement.Factory alwaysDisplayFactory, IDungeon dungeon)
        {
            _colorSettings   = colorSettings;
            _undoRedoManager = undoRedoManager;
            _undoableFactory = undoableFactory;

            _item = dungeon.SmallKeyItem;

            _spacerRequirement = alternativeFactory(new List <IRequirement>
            {
                alwaysDisplayFactory(true),
                requirements[RequirementType.SmallKeyShuffleOn]
            });

            _requirement = dungeon.ID == LocationID.EasternPalace ?
                           requirements[RequirementType.KeyDropShuffleOn] :
                           requirements[RequirementType.NoRequirement];

            HandleClick = ReactiveCommand.Create <PointerReleasedEventArgs>(HandleClickImpl);

            _colorSettings.PropertyChanged     += OnColorsChanged;
            _item.PropertyChanged              += OnItemChanged;
            _requirement.PropertyChanged       += OnRequirementChanged;
            _spacerRequirement.PropertyChanged += OnRequirementChanged;
        }
예제 #6
0
파일: ITask.cs 프로젝트: mullidan/SweProj
 public Task(IRequirement parent, ITaskType type)
 {
     Parent      = parent;
     Type        = type;
     Siblings    = new List <ITask>();
     Attachments = new List <IAttachment>();
 }
예제 #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="bigKeyLocations">
 /// The list of dungeon item IDs that can contain the big key.
 /// </param>
 /// <param name="children">
 /// The list of child key layouts, if this layout is possible.
 /// </param>
 /// <param name="requirement">
 /// The requirement for this key layout to be valid.
 /// </param>
 public BigKeyLayout(
     List <DungeonItemID> bigKeyLocations, List <IKeyLayout> children,
     IRequirement requirement)
 {
     _bigKeyLocations = bigKeyLocations;
     _children        = children;
     _requirement     = requirement;
 }
예제 #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="bigKeyLocations">
 /// The list of dungeon item IDs that can contain the big key.
 /// </param>
 /// <param name="children">
 /// The list of child key layouts, if this layout is possible.
 /// </param>
 /// <param name="requirement">
 /// The requirement for this key layout to be valid.
 /// </param>
 public BigKeyLayout(
     List <DungeonItemID> bigKeyLocations, List <IKeyLayout> children,
     IRequirement requirement = null)
 {
     _bigKeyLocations = bigKeyLocations ?? throw new ArgumentNullException(nameof(bigKeyLocations));
     _children        = children ?? throw new ArgumentNullException(nameof(children));
     _requirement     = requirement ?? RequirementDictionary.Instance[RequirementType.NoRequirement];
 }
예제 #9
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="bossPlacement">
        /// The boss section to which the boss belongs.
        /// </param>
        public BossSmallItemVM(IBossPlacement bossPlacement)
        {
            _bossPlacement = bossPlacement ?? throw new ArgumentNullException(nameof(bossPlacement));
            _requirement   = RequirementDictionary.Instance[RequirementType.BossShuffleOn];
            BossSelect     = BossSelectVMFactory.GetBossSelectPopupVM(_bossPlacement);

            _bossPlacement.PropertyChanged += OnBossChanged;
            _requirement.PropertyChanged   += OnRequirementChanged;
        }
예제 #10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="map">
 /// The map identity on which the location is represented.
 /// </param>
 /// <param name="x">
 /// The X coordinate of the map location.
 /// </param>
 /// <param name="y">
 /// The Y coordinate of the map location.
 /// </param>
 /// <param name="location">
 /// The location parent class.
 /// </param>
 /// <param name="requirement">
 /// The mode requirement for displaying this map location.
 /// </param>
 public MapLocation(
     MapID map, double x, double y, ILocation location, IRequirement requirement)
 {
     Map         = map;
     X           = x;
     Y           = y;
     Location    = location;
     Requirement = requirement;
 }
예제 #11
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="requirements">
        /// The requirement dictionary.
        /// </param>
        /// <param name="fromNode">
        /// The node from which the connection originates.
        /// </param>
        public EntryNodeConnection(
            IRequirementDictionary requirements, IRequirementNode fromNode)
        {
            _fromNode = fromNode;

            Requirement = requirements[RequirementType.NoRequirement];

            _fromNode.PropertyChanged += OnNodeChanged;
        }
예제 #12
0
        public static IRequirement GetRequirement(int id)
        {
            var          requirements = GetRequirements();
            IRequirement requirement  = null;

            requirement = requirements.Where(x => x.Id == id).ToList().ElementAtOrDefault(0);

            return(requirement);
        }
        public void ClearDeficiency(IProcessExecutionContext executionContext, IRequirement requirement)
        {
            var deficiency = GetCurrentRequirementDeficiency(requirement);

            if (deficiency.Status != eDeficiencyStatusEnum.Waived)
            {
                DataConnector.UpdateDeficiencyRecordStatus(executionContext.DataService, deficiency, eDeficiencyStatusEnum.Cleared);
                base.Remove(deficiency);
            }
        }
예제 #14
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="imageSourceBase">
        /// A string representing the image source base.
        /// </param>
        /// <param name="item">
        /// An item that is to be represented by this control.
        /// </param>
        public SmallKeyLargeItemVM(string imageSourceBase, IItem item)
        {
            _item            = item ?? throw new ArgumentNullException(nameof(item));
            _imageSourceBase = imageSourceBase ??
                               throw new ArgumentNullException(nameof(imageSourceBase));
            _requirement = RequirementDictionary.Instance[RequirementType.GenericKeys];

            _item.PropertyChanged        += OnItemChanged;
            _requirement.PropertyChanged += OnRequirementChanged;
        }
예제 #15
0
파일: Choice.cs 프로젝트: weichx/SpaceGame
        public void AddRequirement(IRequirement <T> requirement)
        {
            if (requirementCount >= requirements.Length)
            {
                Array.Resize(ref requirements, requirementCount * 2);
            }

            requirements[requirementCount] = requirement;
            requirementCount++;
        }
예제 #16
0
        public Conditions(IRequirement requirement = null)
        {
            if (requirement == null)
            {
                Requirement = new Requirement();
                return;
            }

            Requirement = requirement;
        }
예제 #17
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="imageSourceBase">
        /// A string representing the base image source.
        /// </param>
        /// <param name="item">
        /// The item of the key to be represented.
        /// </param>
        /// <param name="requirement">
        /// The requirement for displaying the control.
        /// </param>
        public SmallItemVM(string imageSourceBase, IItem item, IRequirement requirement)
        {
            _imageSourceBase = imageSourceBase ??
                               throw new ArgumentNullException(nameof(imageSourceBase));
            _item        = item ?? throw new ArgumentNullException(nameof(item));
            _requirement = requirement ?? throw new ArgumentNullException(nameof(requirement));

            _item.PropertyChanged        += OnItemChanged;
            _requirement.PropertyChanged += OnRequirementChanged;
        }
예제 #18
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="location">
        /// The location parent class.
        /// </param>
        /// <param name="map">
        /// The map identity on which the location is represented.
        /// </param>
        /// <param name="x">
        /// The X coordinate of the map location.
        /// </param>
        /// <param name="y">
        /// The Y coordinate of the map location.
        /// </param>
        /// <param name="requirement">
        /// The mode requirement for displaying this map location.
        /// </param>
        public MapLocation(
            LocationID locationID, MapID map, double x, double y, IRequirement requirement = null)
        {
            _locationID = locationID;
            Map         = map;
            X           = x;
            Y           = y;
            Requirement = requirement ?? RequirementDictionary.Instance[RequirementType.NoRequirement];

            LocationDictionary.Instance.LocationCreated += OnLocationCreated;
        }
예제 #19
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="count">
 /// A 32-bit signed integer representing the number of keys that must be contained in the
 /// list of locations.
 /// </param>
 /// <param name="smallKeyLocations">
 /// The list of dungeon item IDs that the number of small keys must be contained in.
 /// </param>
 /// <param name="bigKeyInLocations">
 /// AS boolean representing whether the big key is contained in the list of locations.
 /// </param>
 /// <param name="children">
 /// The list of child key layouts, if this layout is possible.
 /// </param>
 /// <param name="dungeon">
 /// The dungeon parent class.
 /// </param>
 /// <param name="requirement">
 /// The requirement for this key layout to be valid.
 /// </param>
 public SmallKeyLayout(
     IMode mode, int count, List <DungeonItemID> smallKeyLocations, bool bigKeyInLocations,
     List <IKeyLayout> children, IDungeon dungeon, IRequirement requirement)
 {
     _mode              = mode;
     _count             = count;
     _smallKeyLocations = smallKeyLocations;
     _bigKeyInLocations = bigKeyInLocations;
     _children          = children;
     _dungeon           = dungeon;
     _requirement       = requirement;
 }
예제 #20
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="count">
 /// A 32-bit signed integer representing the number of keys that must be contained in the
 /// list of locations.
 /// </param>
 /// <param name="smallKeyLocations">
 /// The list of dungeon item IDs that the number of small keys must be contained in.
 /// </param>
 /// <param name="bigKeyInLocations">
 /// AS boolean representing whether the big key is contained in the list of locations.
 /// </param>
 /// <param name="children">
 /// The list of child key layouts, if this layout is possible.
 /// </param>
 /// <param name="dungeon">
 /// The dungeon parent class.
 /// </param>
 /// <param name="requirement">
 /// The requirement for this key layout to be valid.
 /// </param>
 public SmallKeyLayout(
     int count, List <DungeonItemID> smallKeyLocations, bool bigKeyInLocations,
     List <IKeyLayout> children, IDungeon dungeon, IRequirement requirement = null)
 {
     _count             = count;
     _smallKeyLocations = smallKeyLocations ??
                          throw new ArgumentNullException(nameof(smallKeyLocations));
     _bigKeyInLocations = bigKeyInLocations;
     _children          = children ?? throw new ArgumentNullException(nameof(children));
     _dungeon           = dungeon ?? throw new ArgumentNullException(nameof(dungeon));
     _requirement       = requirement ?? RequirementDictionary.Instance[RequirementType.NoRequirement];
 }
예제 #21
0
        public IModelObject SatisfyRequirement(Guid requirementGuid)
        {
            IRequirement tgtRqmt = (IRequirement)m_requirements[requirementGuid];

            if (!tgtRqmt.IsMet())
            {
                return((IModelObject)tgtRqmt.Meet());
            }
            else
            {
                return(null);
            }
        }
예제 #22
0
        public void AddRequirement(IRequirement requirement)
        {
            if (requirement == null)
            {
                throw new ArgumentException("requirement cannot be null");
            }

            if (_requirements.Any(x => x.Equals(requirement)))
            {
                throw new InvalidOperationException("requirement already exists");
            }

            _requirements.Add(requirement);
        }
예제 #23
0
        /// <summary>
        /// Combines this instance with an argument into single requirement.
        /// Performs argument-not-null check and throws ArgumentNullExcpetion if it is so.
        /// </summary>
        /// <param name="requirement">Requirement to combine the instance with.</param>
        /// <returns>Combined requirement instance whose is based on subrequirements evaluations</returns>
        public ICombinedRequirement <TChecked> Combine(IRequirement <TChecked> requirementToCombine)
        {
            if (requirementToCombine == null)
            {
                throw new ArgumentNullException(nameof(requirementToCombine));
            }

            var combinedRequirementsList = requirements.ToList();

            combinedRequirementsList.Add(requirementToCombine);

            var combinedRequirement = CreateCombinedRequirement(combinedRequirementsList);

            return(combinedRequirement);
        }
예제 #24
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="requirements">
        /// The requirements dictionary.
        /// </param>
        /// <param name="undoRedoManager">
        /// The undo/redo manager.
        /// </param>
        /// <param name="undoableFactory">
        /// A factory for creating undoable actions.
        /// </param>
        /// <param name="imageSourceBase">
        /// A string representing the image source base.
        /// </param>
        /// <param name="item">
        /// An item that is to be represented by this control.
        /// </param>
        public SmallKeyLargeItemVM(
            IRequirementDictionary requirements, IUndoRedoManager undoRedoManager, IUndoableFactory undoableFactory,
            IItem item, string imageSourceBase)
        {
            _undoRedoManager = undoRedoManager;
            _undoableFactory = undoableFactory;

            _item            = item;
            _requirement     = requirements[RequirementType.GenericKeys];
            _imageSourceBase = imageSourceBase;

            HandleClick = ReactiveCommand.Create <PointerReleasedEventArgs>(HandleClickImpl);

            _item.PropertyChanged        += OnItemChanged;
            _requirement.PropertyChanged += OnRequirementChanged;
        }
        public void GetRequirementTest()
        {
            IRequirement requirement  = Repository.GetRequirement(102);
            int          id           = requirement.Id;
            string       name         = requirement.Name;
            int          credits      = requirement.Credits;
            int          minimumMarks = requirement.MinimumMark;

            int[] courses = requirement.Courses;

            Assert.AreEqual(102, id);
            Assert.AreEqual("Science", name);
            Assert.AreEqual(1, credits);
            Assert.AreEqual(50, minimumMarks);
            Assert.AreEqual(2, courses.ElementAt(0));
        }
예제 #26
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="undoRedoManager">
        /// The undo/redo manager.
        /// </param>
        /// <param name="undoableFactory">
        /// A factory for creating undoable actions.
        /// </param>
        /// <param name="imageSourceBase">
        /// A string representing the base image source.
        /// </param>
        /// <param name="item">
        /// The item of the key to be represented.
        /// </param>
        /// <param name="requirement">
        /// The requirement for displaying the control.
        /// </param>
        public SmallItemVM(
            IUndoRedoManager undoRedoManager, IUndoableFactory undoableFactory, IItem item, IRequirement requirement,
            string imageSourceBase)
        {
            _undoRedoManager = undoRedoManager;
            _undoableFactory = undoableFactory;

            _imageSourceBase = imageSourceBase;
            _item            = item;
            _requirement     = requirement;

            HandleClick = ReactiveCommand.Create <PointerReleasedEventArgs>(HandleClickImpl);

            _item.PropertyChanged        += OnItemChanged;
            _requirement.PropertyChanged += OnRequirementChanged;
        }
예제 #27
0
        public List <ITask> Solve(IRequirement requirement)
        {
            List <ITask> solutions = new List <ITask> ();

            foreach (Type taskType in taskTypes)
            {
                if ((bool)taskType.GetMethod("Handles").Invoke(null, new IRequirement[1] {
                    requirement
                }))
                {
                    solutions.Add((ITask)taskType.GetMethod("CreateTask").Invoke(null, new IRequirement[1] {
                        requirement
                    }));
                }
            }

            return(solutions);
        }
예제 #28
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="undoRedoManager">
        /// The undo/redo manager.
        /// </param>
        /// <param name="undoableFactory">
        /// A factory for creating undoable actions.
        /// </param>
        /// <param name="dungeon">
        /// The dungeon whose big keys are to be represented.
        /// </param>
        /// <param name="requirement">
        /// The requirement for the control to be visible.
        /// </param>
        /// <param name="spacerRequirement">
        /// The requirement for the control to take reserve space.
        /// </param>
        public BigKeySmallItemVM(
            IUndoRedoManager undoRedoManager, IUndoableFactory undoableFactory, IDungeon dungeon,
            IRequirement requirement, IRequirement spacerRequirement)
        {
            _undoRedoManager = undoRedoManager;
            _undoableFactory = undoableFactory;

            _item = dungeon.BigKeyItem ??
                    throw new ArgumentOutOfRangeException(nameof(dungeon));
            _requirement       = requirement;
            _spacerRequirement = spacerRequirement;

            HandleClick = ReactiveCommand.Create <PointerReleasedEventArgs>(HandleClickImpl);

            _item.PropertyChanged              += OnItemChanged;
            _requirement.PropertyChanged       += OnRequirementChanged;
            _spacerRequirement.PropertyChanged += OnRequirementChanged;
        }
예제 #29
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="name">
        /// A string representing the name of the section.
        /// </param>
        /// <param name="bossPlacement">
        /// The boss placement of this section.
        /// </param>
        /// <param name="prizePlacement">
        /// The prize placement of this section.
        /// </param>
        /// <param name="autoTrackValue">
        /// The section autotrack value.
        /// </param>
        /// <param name="requirement">
        /// The requirement for this section to be visible.
        /// </param>
        /// <param name="alwaysClearable">
        /// A boolean representing whether the section is always clearable (used for GT final).
        /// </param>
        public PrizeSection(
            string name, IBossPlacement bossPlacement, IPrizePlacement prizePlacement,
            IAutoTrackValue?autoTrackValue, IRequirement requirement,
            bool alwaysClearable = false) : base(name, bossPlacement, requirement)
        {
            _alwaysClearable = alwaysClearable;
            _autoTrackValue  = autoTrackValue;
            PrizePlacement   = prizePlacement ??
                               throw new ArgumentNullException(nameof(prizePlacement));

            PropertyChanged += OnPropertyChanged;
            PrizePlacement.PropertyChanging += OnPrizeChanging;
            PrizePlacement.PropertyChanged  += OnPrizeChanged;

            if (_autoTrackValue != null)
            {
                _autoTrackValue.PropertyChanged += OnAutoTrackValueChanged;
            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="condition">
        /// The condition for determining which value to use.
        /// </param>
        /// <param name="trueValue">
        /// The value to be presented, if the condition is met.
        /// </param>
        /// <param name="falseValue">
        /// The value to be presented, if the condition is not met.
        /// </param>
        public AutoTrackConditionalValue(
            IRequirement condition, IAutoTrackValue?trueValue, IAutoTrackValue?falseValue)
        {
            _condition  = condition;
            _trueValue  = trueValue;
            _falseValue = falseValue;

            _condition.PropertyChanged += OnRequirementChanged;

            if (_trueValue != null)
            {
                _trueValue.PropertyChanged += OnValueChanged;
            }

            if (_falseValue != null)
            {
                _falseValue.PropertyChanged += OnValueChanged;
            }
        }
예제 #31
0
 public void AddRequirement(IRequirement requirement)
 {
     _requirements.Add(requirement);
     _requirements = _requirements.OrderBy(r => r.DeweySequence).ToList();
 }
        //---------------------------------------------------------------------

        void IStandRankingMethod.AddRequirement(IRequirement requirement)
        {
            requirements.Add(requirement);
        }
예제 #33
0
 public void RemoveRequirement(IRequirement requirement)
 {
     _requirements.Remove(requirement);
 }