System.Collections.Generic.HashSet.Contains(Waypoint)

Here are the examples of the csharp api System.Collections.Generic.HashSet.Contains(Waypoint) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

19 Source : CacheRepositioningManager.cs
with GNU General Public License v3.0
from merschformann

protected override RepositioningMove GetRepositioningMove(Bot robot)
        {
            // Prepare hot zones
            if (_chacheStorageLocations == null)
            {
                // Ensure valid zones
                Instance.SharedControlElements.StorageParreplacedioner.CreateOrEnsureZones(_config.ZoningConfiguration);
                // Store zones for fast access
                _chacheStorageLocations = Instance.SharedControlElements.StorageParreplacedioner.CacheParreplacedions;
                foreach (var station in _chacheStorageLocations.Keys)
                    foreach (var storageLocation in _chacheStorageLocations[station])
                        _stationsOfStorageLocations[storageLocation] = station;
                _regularStorageLocations = Instance.Waypoints.Except(_chacheStorageLocations.SelectMany(c => c.Value)).ToHashSet();
            }
            // Init
            if (_bestCandidateSelectorClear == null)
            {
                _bestCandidateSelectorClear = new BestCandidateSelector(false,
                    // First try to keep the move on the same tier as the robot
                    () => { return _currentPod.Tier == robot.Tier && _currentStorageLocation.Tier == robot.Tier ? 0 : 1; },
                    // Then try to find a pod useless for the station
                    () =>
                    {
                        // Check the number of potential picks possible with the pod (given by station orders' demand)
                        int potentialPicks = Instance.ResourceManager.GetExtractRequestsOfStation(_currentStation)
                            .Concat(Instance.ResourceManager.GetQueuedExtractRequestsOfStation(_currentStation))
                            .GroupBy(r => r.Item).Sum(g => Math.Min(_currentPod.CountContained(g.Key), g.Count()));
                        // Use negative potential picks to mark useless pod
                        return potentialPicks;
                    },
                    // Then try to find a pod useless overall
                    () =>
                    {
                        // Check the number of potential picks possible with the pod (given by all orders' demand)
                        int potentialPicks = _currentPod.ItemDescriptionsContained.Sum(i => Math.Min(_currentPod.CountContained(i),
                                Instance.ResourceManager.GetDemandreplacedigned(i) +
                                Instance.ResourceManager.GetDemandQueued(i) +
                                (_config.UselessConsiderBacklog ? Instance.ResourceManager.GetDemandBacklog(i) : 0)));
                        // Use negative potential picks to mark useless pod
                        return potentialPicks;
                    },
                    // Then try to use an empty pod
                    () => { return _currentPod.CapacityInUse; },
                    // Then try to get a destination location most near to the input-stations (if pod is considered empty) or the shortest move distance (if pod still has sufficient content)
                    () =>
                    {
                        return (_currentPod.CapacityInUse / _currentPod.Capacity < _config.PodEmptyThreshold) ?
                            _currentStorageLocation.ShortestPodPathDistanceToNextInputStation :
                            Distances.CalculateShortestPathPodSafe(_currentPod.Waypoint, _currentStorageLocation, Instance);
                    },
                    // Then try to make a move with the pod most near to an output-station
                    () => { return _currentPod.Waypoint.ShortestPodPathDistanceToNextOutputStation; });
            }
            if (_bestCandidateSelectorFill == null)
            {
                _bestCandidateSelectorFill = new BestCandidateSelector(false,
                    // First try to keep the move on the same tier as the robot
                    () => { return _currentPod.Tier == robot.Tier && _currentStorageLocation.Tier == robot.Tier ? 0 : 1; },
                    // Then try to find a pod useful for the station
                    () =>
                    {
                        // Check the number of potential picks possible with the pod (given by station orders' demand)
                        int potentialPicks = Instance.ResourceManager.GetExtractRequestsOfStation(_currentStation)
                            .Concat(Instance.ResourceManager.GetQueuedExtractRequestsOfStation(_currentStation))
                            .GroupBy(r => r.Item).Sum(g => Math.Min(_currentPod.CountContained(g.Key), g.Count()));
                        // Use negative potential picks to mark useless pod
                        return -potentialPicks;
                    },
                    // Then try to find a pod useful overall
                    () =>
                    {
                        // Check the number of potential picks possible with the pod (given by all orders' demand)
                        int potentialPicks = _currentPod.ItemDescriptionsContained.Sum(i => Math.Min(_currentPod.CountContained(i),
                                Instance.ResourceManager.GetDemandreplacedigned(i) +
                                Instance.ResourceManager.GetDemandQueued(i) +
                                (_config.UselessConsiderBacklog ? Instance.ResourceManager.GetDemandBacklog(i) : 0)));
                        // Use negative potential picks to mark useless pod
                        return -potentialPicks;
                    },
                    // Then try to use a full pod
                    () => { return -_currentPod.CapacityInUse; },
                    // Then try to do a short move
                    () => { return Distances.CalculateShortestPathPodSafe(_currentPod.Waypoint, _currentStorageLocation, Instance); });
            }

            // Init
            Pod bestPod = null;
            Waypoint bestStorageLocation = null;

            // Check whether any cache has too many pods
            if (Instance.OutputStations.Any(s => NeedsClearingRepositioning(s)))
            {
                // Clear potential old results
                _bestCandidateSelectorClear.Recycle();
                // Check all stations
                foreach (var station in Instance.OutputStations.Where(s => NeedsClearingRepositioning(s)))
                {
                    // Update current candidate to replacedess
                    _currentStation = station;
                    // Check occupied storage locations of cache of station
                    foreach (var from in _chacheStorageLocations[station].Where(w => w.Pod != null && !Instance.ResourceManager.IsPodClaimed(w.Pod)))
                    {
                        // Check unoccupied storage locations not in a cache
                        foreach (var to in Instance.ResourceManager.UnusedPodStorageLocations.Where(w => _regularStorageLocations.Contains(w)))
                        {
                            // Update current candidate to replacedess
                            _currentPod = from.Pod;
                            _currentStorageLocation = to;
                            // Check whether the current combination is better
                            if (_bestCandidateSelectorClear.Rereplacedess())
                            {
                                // Update best candidate
                                bestPod = _currentPod;
                                bestStorageLocation = _currentStorageLocation;
                            }
                        }
                    }
                }
            }
            // Check whether any cache has too few pods
            if (Instance.OutputStations.Any(s => NeedsFillingRepositioning(s)))
            {
                // Clear potential old results
                _bestCandidateSelectorFill.Recycle();
                // Check all stations
                foreach (var station in Instance.OutputStations.Where(s => NeedsFillingRepositioning(s)))
                {
                    // Update current candidate to replacedess
                    _currentStation = station;
                    // Check unused pods
                    foreach (var pod in Instance.ResourceManager.UnusedPods.Where(p => _regularStorageLocations.Contains(p.Waypoint)))
                    {
                        // Check unoccupied storage locations of cache of station
                        foreach (var to in _chacheStorageLocations[station].Where(w => !Instance.ResourceManager.IsStorageLocationClaimed(w)))
                        {
                            // Update current candidate to replacedess
                            _currentPod = pod;
                            _currentStorageLocation = to;
                            // Check whether the current combination is better
                            if (_bestCandidateSelectorFill.Rereplacedess())
                            {
                                // Update best candidate
                                bestPod = _currentPod;
                                bestStorageLocation = _currentStorageLocation;
                            }
                        }
                    }
                }
            }

            // Check whether a move was obtained
            if (bestPod != null)
            {
                // Return the move
                return new RepositioningMove() { Pod = bestPod, StorageLocation = bestStorageLocation };
            }
            else
            {
                // No move available - block calls for a while
                GlobalTimeout = Instance.Controller.CurrentTime + _config.GlobalTimeout;
                return null;
            }
        }

19 Source : ResourceManager.cs
with GNU General Public License v3.0
from merschformann

public bool IsStorageLocationClaimed(Waypoint wp) { return _usedPodStorageLocations.Contains(wp); }

19 Source : ResourceManager.cs
with GNU General Public License v3.0
from merschformann

public bool IsRestingLocationAvailable(Waypoint waypoint) { return _unusedPodStorageLocations.Contains(waypoint); }

19 Source : Elevator.cs
with GNU General Public License v3.0
from merschformann

public void SetTiming(Waypoint from, Waypoint to, double time)
        {
            // Check waypoints validness
            if (from == to) throw new ArgumentException("Cannot connect a WP to itself!");
            if (!_connectedPoints.Contains(from) || !_connectedPoints.Contains(to)) throw new ArgumentException("Unknown waypoints!");
            // Set custom timing for the connection
            _timings[from][to] = time;
        }