Ejemplo n.º 1
0
 public RectChangeState(ITileWorld parent, Rect affectedRect, IFeatureResolver applicableFeatures) : base(parent)
 {
     AffectedRect       = affectedRect;
     ApplicableFeatures = applicableFeatures;
     _data    = new int[affectedRect.Height, affectedRect.Width];
     _changed = new bool[affectedRect.Height, affectedRect.Width];
 }
Ejemplo n.º 2
0
 public WorldUpdateInterface(TileWorld world, IFeatureResolver biome, IFeatureResolver landform, BetterTileMap biomeTileMap, BetterTileMap landformTileMap) : base(world)
 {
     _biomeResolver    = biome;
     _landformResolver = landform;
     _biomeTileMap     = biomeTileMap;
     _landformTileMap  = landformTileMap;
 }
Ejemplo n.º 3
0
 public DataIdentifier(IFeatureResolver resolver, IFeature feature, int index, int bits, WorldType worldTypes)
 {
     Resolver   = resolver;
     Feature    = feature;
     Index      = index;
     Bits       = bits;
     WorldTypes = worldTypes;
 }
Ejemplo n.º 4
0
 public FeatureValueCollection(ICacheProvider cacheProvider, IFeatureResolver featureResolver, string applicationName)
 {
     _valueCollection = new ValueCollection <bool>((s) =>
     {
         var key = $"Feature{applicationName}{s}";
         return(cacheProvider.GetValue(key, () => featureResolver.Resolve(s, applicationName)));
     });
 }
Ejemplo n.º 5
0
        public void Setup()
        {
            _featureResolver = Substitute.For <IFeatureResolver>();
            _featureResolver.Resolve("UseTestFunctionality", Arg.Any <string>()).Returns(true);
            _featureResolver.Resolve("Test1", Arg.Any <string>()).Returns(false);
            _featureResolver.Resolve("Test2", Arg.Any <string>()).Returns(false);

            Configuration.FeatureResolver = _featureResolver;
            Configuration.CacheProvider   = new DefaultCacheProvider(new DefaultRetryPolicy(3), 0.0);
        }
Ejemplo n.º 6
0
        public void Setup()
        {
            _featureResolver = Substitute.For<IFeatureResolver>();
            _featureResolver.Resolve("UseTestFunctionality", Arg.Any<string>()).Returns(true);
            _featureResolver.Resolve("Test1", Arg.Any<string>()).Returns(false);
            _featureResolver.Resolve("Test2", Arg.Any<string>()).Returns(false);

            Configuration.FeatureResolver = _featureResolver;
            Configuration.CacheProvider = new DefaultCacheProvider(new DefaultRetryPolicy(3), 0.0);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates a new instance of FeatureEvaluator.
        /// </summary>
        /// <param name="resolver">The underlying feature resolver.</param>
        /// <param name="sharedData">Any data that should be added to all features.</param>
        public FeatureEvaluator(IFeatureResolver resolver, IEnumerable <ISharedFeatureData> sharedData = null)
        {
            _resolver = resolver ?? throw new ArgumentNullException(nameof(resolver));
            var sharedFeatureData = sharedData ?? Enumerable.Empty <ISharedFeatureData>();

            _allData = new ConcurrentDictionary <string, object>();

            foreach (var data in sharedFeatureData)
            {
                PopulateAllDataFrom(data);
            }
        }
Ejemplo n.º 8
0
 public DataIdentifier(IFeatureResolver resolver, int index, int bits, WorldType worldTypes) : this(resolver, null, index, bits, worldTypes)
 {
 }
 public void Register(IFeatureResolver resolver)
 {
     _features.Add(resolver);
 }