Exemplo n.º 1
0
        public QueryResult <IFireHazardBehaviour> GetFireHazardBehaviour()
        {
            var consumptionState = ConsumptionState.GetZoneConsumption();
            IFireHazardBehaviour FireHazardBehaviour = null;

            if (consumptionState is ZoneClusterMemberConsumption)
            {
                FireHazardBehaviour =
                    (consumptionState as ZoneClusterMemberConsumption).ParentBaseZoneClusterConsumption.FireHazardBehaviour;
            }
            return(QueryResult <IFireHazardBehaviour> .Create(FireHazardBehaviour));
        }
Exemplo n.º 2
0
        public QueryResult <ICrimeBehaviour> GetCrimeBehaviour()
        {
            var             consumptionState = ConsumptionState.GetZoneConsumption();
            ICrimeBehaviour crimeBehaviour   = null;

            if (consumptionState is ZoneClusterMemberConsumption)
            {
                crimeBehaviour =
                    (consumptionState as ZoneClusterMemberConsumption).ParentBaseZoneClusterConsumption.CrimeBehaviour;
            }
            return(QueryResult <ICrimeBehaviour> .Create(crimeBehaviour));
        }
Exemplo n.º 3
0
        public QueryResult <TNetworkZoneConsumption> GetNetworkZoneConsumption <TNetworkZoneConsumption>()
            where TNetworkZoneConsumption : BaseNetworkZoneConsumption
        {
            var consumption = ConsumptionState.GetZoneConsumption();

            if (consumption is TNetworkZoneConsumption)
            {
                return(QueryResult <TNetworkZoneConsumption> .Create(consumption as TNetworkZoneConsumption));
            }

            if (consumption is IntersectingZoneConsumption)
            {
                return(QueryResult <TNetworkZoneConsumption> .Create((consumption as IntersectingZoneConsumption)
                                                                     .GetIntersectingZoneConsumptions()
                                                                     .OfType <TNetworkZoneConsumption>()
                                                                     .SingleOrDefault()
                                                                     ));
            }
            return(QueryResult <TNetworkZoneConsumption> .Create());
        }
Exemplo n.º 4
0
 public ZoneInfoSnapshot TakeSnapshot()
 {
     return(ConsumptionState
            .GetZoneConsumption()
            .Pipe(consumption =>
     {
         return new ZoneInfoSnapshot(
             point: Point,
             areaZoneConsumption: consumption,
             getNorthEastSouthWestFunc:  GetNorthEastSouthWest,
             trafficDensity: (consumption as RoadZoneConsumption)
             .ToQueryResult()
             .WithResultIfHasMatch(x => x.GetTrafficDensity(),
                                   (consumption as IntersectingZoneConsumption)
                                   .ToQueryResult()
                                   .WithResultIfHasMatch(x => x.GetTrafficDensity()
                                                         )
                                   )
             );
     }));
 }
Exemplo n.º 5
0
        public QueryResult <IPollutionBehaviour> GetPollutionBehaviour()
        {
            var consumptionState = ConsumptionState.GetZoneConsumption();
            IPollutionBehaviour pollutionBehaviour = null;

            if (consumptionState is ZoneClusterMemberConsumption)
            {
                pollutionBehaviour = (consumptionState as ZoneClusterMemberConsumption).ParentBaseZoneClusterConsumption
                                     .PollutionBehaviour;
            }
            else if (consumptionState is ISingleZoneConsumptionWithPollutionBehaviour)
            {
                pollutionBehaviour = (consumptionState as ISingleZoneConsumptionWithPollutionBehaviour).PollutionBehaviour;
            }
            else
            {
                ConsumptionState.WithNetworkMember <RoadZoneConsumption>(roadZoneConsumption => pollutionBehaviour = roadZoneConsumption.PollutionBehaviour);
            }

            return(QueryResult <IPollutionBehaviour> .Create(pollutionBehaviour));
        }
Exemplo n.º 6
0
 public int GetDistanceScoreBasedOnConsumption()
 {
     return(ConsumptionState.GetIsRailroadNetworkMember() || ConsumptionState.GetIsPowerGridMember()
         ? 1
         : 3);
 }