public RleSetAmount(RawNode node, IContext context)
            : base(node, context)
        {
            _random = PathUtil.GetModelPath(GetContext(), node.GetString("random"), null).GetSelf <Random>();
            var rows = node.GetNode("elements").array;

            foreach (var obj in rows)
            {
                var pair = (List <object>)obj;
                var arr  = new [] { Convert.ToInt32(pair[0]), Convert.ToInt32(pair[1]) };
                _list.Add(arr);
            }

            foreach (var pair in _list)
            {
                _length += pair[1];
            }
        }
Ejemplo n.º 2
0
        //按照深度优先的方式搜索所有节点
        private void DFS_Node(LinkType linkType, RawNode node, int[] visitedNodes, List <RawNode> nodeList)
        {
            visitedNodes[node.UrlId] = 1;
            nodeList.Add(node);

            for (int i = 0; i < NodeArray.Length; i++)
            {
                //访问该顶点互联的其他顶点(不能是vpx端点,且端点没被访问过)
                if ((NodeArray[i].Type != EndType.VPX) && (visitedNodes[NodeArray[i].UrlId] == 0))
                {
                    RawLink gLink = GetLinkValue(linkType, node.UrlId, i);
                    if (gLink != null)
                    {
                        DFS_Node(linkType, NodeArray[i], visitedNodes, nodeList);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public Game(RawNode knivesSettings, RawNode settings)
        {
            m_rnd            = new Random();
            m_settings       = settings;
            m_knivesSettings = knivesSettings;

            m_knife = new Knife();
            m_knife.throwSuccess += OnKnifeThrowSuccess;

            m_score = 0;
            m_perfectFlipCounter = 0;
            m_knifeMode          = KnifeMode.Medium;

            m_stepAwardCalculator = new StepAwardCalculator(
                requiredScore: m_settings.GetIntArray("flips_bonus_flips"),
                awards: m_settings.GetIntArray("flips_bonus_gold")
                );
        }
Ejemplo n.º 4
0
        public void EnsureEntityShouldNotBeRollbackedAfterCommitedAndViceVersa()
        {
            InvalidOperationException exception = Assert.Throws <InvalidOperationException>(() =>
            {
                using (Transaction.Begin(true))
                {
                    // Let us try to create an entity
                    Transaction.RunningTransaction.Run("CREATE (n:SampleEntity { name: 'Address', title: 'Developer' })");

                    RawResult result = Transaction.RunningTransaction.Run("Match (n:SampleEntity) Return n");
                    RawRecord record = result.FirstOrDefault();
                    RawNode loaded   = record["n"].As <RawNode>();

                    Assert.AreEqual(loaded.Properties["name"], "Address");
                    Assert.AreEqual(loaded.Properties["title"], "Developer");

                    Transaction.Commit();
                    Transaction.Rollback();
                }
            });

            Assert.That(exception.Message, Contains.Substring("The transaction was already committed or rolled back."));

            InvalidOperationException exception2 = Assert.Throws <InvalidOperationException>(() =>
            {
                using (Transaction.Begin(true))
                {
                    // Let us try to create an entity
                    Transaction.RunningTransaction.Run("CREATE (n:SampleEntity { name: 'Address', title: 'Developer' })");

                    RawResult result = Transaction.RunningTransaction.Run("Match (n:SampleEntity) Return n");
                    RawRecord record = result.FirstOrDefault();
                    RawNode loaded   = record["n"].As <RawNode>();

                    Assert.AreEqual(loaded.Properties["name"], "Address");
                    Assert.AreEqual(loaded.Properties["title"], "Developer");

                    Transaction.Rollback();
                    Transaction.Commit();
                }
            });

            Assert.That(exception2.Message, Contains.Substring("The transaction was already committed or rolled back."));
        }
Ejemplo n.º 5
0
        public static KnifeMode[] GetSupportedModes(RawNode knifeNode)
        {
            var modesNode      = knifeNode.GetNode("modes");
            var supportedModes = new KnifeMode[AllKnifeModes.Length];

            int count = 0;

            foreach (var mode in AllKnifeModes)
            {
                var key = GetKnifeModeKey(mode);
                if (modesNode.CheckKey(key))
                {
                    supportedModes[count++] = mode;
                }
            }

            Array.Resize(ref supportedModes, count);
            return(supportedModes);
        }
Ejemplo n.º 6
0
        public SomeModel(RawNode initNode, SomeModelCategories categories, SomeModelDescription description, IContext context) : base(initNode, categories, description, context)
        {
            int value = description.amount.Number();

            var result  = description.reward.Calculate();
            var s       = result.Serialize();
            var sResult = FactoryManager.Build <RewardResult>(new RawNode(s), context);

            description.reward.Award(sResult);

            description.reward.Award();
            description.reward.Award();
            description.reward.Award();
            description.reward.Award();

            if (description.requirement.Check())
            {
                description.price.Pay();
            }
        }
Ejemplo n.º 7
0
        public static ModelsPath GetModelPath(IContext context, RawNode node)
        {
            string path;
            Random random = null;

            if (node.IsDictionary() && node.CheckKey("path"))
            {
                path = node.GetString("path");

                if (node.CheckKey("random"))
                {
                    random = GetModelPath(context, node.GetString("random"), null).GetSelf <Random>();
                }
            }
            else
            {
                path = node.ToString();
            }

            return(GetResult(context, path, random));
        }
Ejemplo n.º 8
0
        public void EnsureEntityIsFlushedAfterTransaction()
        {
            using (Transaction.Begin(true))
            {
                Transaction.RunningTransaction.Run("CREATE (n:SampleEntity { name: 'Address', title: 'Developer' })");
                RawResult result = Transaction.RunningTransaction.Run("Match (n:SampleEntity) Return n");
                RawRecord record = result.FirstOrDefault();

                RawNode loaded = record["n"].As <RawNode>();
                Assert.AreEqual(loaded.Properties["name"], "Address");
                Assert.AreEqual(loaded.Properties["title"], "Developer");

                Transaction.Flush();
            }

            using (Transaction.Begin())
            {
                RawResult result = Transaction.RunningTransaction.Run("Match (n:SampleEntity) Return n");
                RawRecord record = result.FirstOrDefault();
                Assert.IsNull(record);
            }
        }
Ejemplo n.º 9
0
        public void EnsureEntityIsCreatedRegardlessAnExceptionIsThrown()
        {
            Assert.Throws <Exception>(() =>
            {
                using (Transaction.Begin())
                {
                    // Let us try to create an entity
                    Transaction.RunningTransaction.Run("CREATE (n:SampleEntity { name: 'Address', title: 'Developer' })");
                    throw new Exception();
                }
            });

            using (Transaction.Begin())
            {
                RawResult result = Transaction.RunningTransaction.Run("Match (n:SampleEntity) Return n");
                RawRecord record = result.FirstOrDefault();
                RawNode   loaded = record["n"].As <RawNode>();

                Assert.AreEqual(loaded.Properties["name"], "Address");
                Assert.AreEqual(loaded.Properties["title"], "Developer");
            }
        }
Ejemplo n.º 10
0
        public override void Load(OGM item)
        {
            Transaction trans = Transaction.RunningTransaction;

            string returnStatement = " RETURN node";
            string match           = string.Format("MATCH (node:{0}) WHERE node.{1} = {{key}}", item.GetEntity().Label.Name, item.GetEntity().Key.Name);
            Dictionary <string, object?> parameters = new Dictionary <string, object?>();

            parameters.Add("key", item.GetKey());

            Dictionary <string, object?>?customState = null;
            var args = item.GetEntity().RaiseOnNodeLoading(trans, item, match + returnStatement, parameters, ref customState);

            var result = trans.Run(args.Cypher, args.Parameters);

            RawRecord record = result.FirstOrDefault();

            if (record == null)
            {
                item.PersistenceState = PersistenceState.DoesntExist;
                return;
            }

            RawNode loaded = record["node"].As <RawNode>();

            args.Id     = loaded.Id;
            args.Labels = loaded.Labels;
            // HACK: To make it faster we do not copy/replicate the Dictionary here, but it means someone
            //       could be changing the INode content from within an event. Possibly dangerous, but
            //       turns out the Neo4j driver can deal with it ... for now ...
            args = item.GetEntity().RaiseOnNodeLoaded(trans, args, loaded.Id, loaded.Labels, (Dictionary <string, object?>)loaded.Properties);

            if (item.PersistenceState == PersistenceState.HasUid || item.PersistenceState == PersistenceState.Loaded)
            {
                item.SetData(args.Properties !);
                item.PersistenceState = PersistenceState.Loaded;
            }
        }
Ejemplo n.º 11
0
        public void EnsureEntityShouldNotBeAddedAfterRollback()
        {
            using (Transaction.Begin(true))
            {
                // Let us try to create an entity
                Transaction.RunningTransaction.Run("CREATE (n:SampleEntity { name: 'Address', title: 'Developer' })");

                RawResult result = Transaction.RunningTransaction.Run("Match (n:SampleEntity) Return n");
                RawRecord record = result.FirstOrDefault();
                RawNode   loaded = record["n"].As <RawNode>();

                Assert.AreEqual(loaded.Properties["name"], "Address");
                Assert.AreEqual(loaded.Properties["title"], "Developer");

                Transaction.Rollback();
            }

            using (Transaction.Begin())
            {
                RawResult result = Transaction.RunningTransaction.Run("Match (n:SampleEntity) Return n");
                RawRecord record = result.FirstOrDefault();
                Assert.IsNull(record);
            }
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            /*
             * int[] r = new int[20];
             * for (int j = 0; j < 10; j++)
             * {
             *  var rnd = new FastRandom2(j);
             *  for (int i = 0; i < 100000000; i++)
             *  {
             *      int result = rnd.Range(1, 20);
             *      r[result]++;
             *  }
             * }
             *
             * for (int i = 0; i < r.Length; i++)
             * {
             *  Console.WriteLine(i + " -> " + r[i]);
             * }*/

            FactoryManager.SetDefaultFactory(new DefaultFactory());

            FactoryManager.AddFactory(typeof(IRandomImplementation), new Factory())
            .AddVariant("fast", typeof(FastRandom));

            FactoryManager.AddFactory(typeof(Price), new Factory())
            .AddVariant("simple-resource", typeof(SimpleResourcePrice))

            .AddVariant("simple", typeof(SimpleResourcePrice))
            .AddVariant("composite", typeof(CompositeReward));

            FactoryManager.AddFactory(typeof(PathChoice), new Factory())
            .AddVariant("rle", typeof(RleSetPathChoice))
            .AddVariant("simple", typeof(SimplePathChoice));

            FactoryManager.AddFactory(typeof(Reward), new Factory())
            .AddVariant("simple-resource", typeof(SimpleResourceReward))
            .AddVariant("composite", typeof(CompositeReward))
            .AddVariant("random", typeof(RandomReward));

            FactoryManager.AddFactory(typeof(RewardResult), new Factory())
            .AddVariant("simple-resource", typeof(SimpleResourceRewardResult))
            .AddVariant("composite", typeof(CompositeRewardResult));

            FactoryManager.AddFactory(typeof(Requirement), new Factory())
            .AddVariant("simple-resource", typeof(SimpleResourceRequirement))
            .AddVariant("and", typeof(AndRequirement))
            .AddVariant("not", typeof(NotRequirement))
            .AddVariant("or", typeof(OrRequirement))
            .AddVariant("composite", typeof(CompositeRequirement))
            .AddVariant("false", typeof(FalseRequirement))
            .AddVariant("city", typeof(CityRequirement))
            .AddVariant("building", typeof(BuildingRequirement));

            FactoryManager.AddFactory(typeof(Amount), new Factory())
            .AddVariant("simple", typeof(SimpleAmount))
            .AddVariant("set", typeof(SetAmount))
            .AddVariant("rle", typeof(RleSetAmount))
            .AddVariant("range", typeof(RangeAmount))
            .AddVariant("critical", typeof(CriticalAmount));


            var mockNode = new RawNode(JSON.Instance.Parse(File.ReadAllText("mock.json")));

            var simpleResourceNode = JSON.Instance.Parse(File.ReadAllText("simple-resources.json"));
            var randomNode         = JSON.Instance.Parse(File.ReadAllText("random.json"));
            var objectsNode        = JSON.Instance.Parse(File.ReadAllText("objects.json"));
            var dealsNode          = JSON.Instance.Parse(File.ReadAllText("deals.json"));

            var citiesNode = JSON.Instance.Parse(File.ReadAllText("cities.json"));

            var dict = SerializeUtil.Dict().SetArgs("simple-resources", simpleResourceNode, "objects", objectsNode, "random",
                                                    randomNode, "deals", dealsNode, "cities", citiesNode);

            var player = new Player(mockNode, new RawNode(dict));

            var territories = new Territories("territories", new TerritoryCategory(), player);

            territories.Attach(territories.category.tank.fire, OnTerritories);
            territories["0"].Attach(territories.category.tank.fire, OnTerritory);
            territories["0"].tanks.Attach(territories.category.tank.fire, OnTanks);
            territories["0"].tanks["0"].Attach(territories.category.tank.fire, OnTank);
            territories["0"].tanks["0"].Fire();

            var cities = player.GetChild <CityCollection>("cities");
            var model  = cities["0"];

            cities.Attach(cities.categories.buildings.complete, Handler);
            model.buildings["0"].Complete();

            Console.ReadKey();
        }
Ejemplo n.º 13
0
        public override void Insert(OGM item)
        {
            Transaction trans  = Transaction.RunningTransaction;
            Entity      entity = item.GetEntity();

            string labels = string.Join(":", entity.GetBaseTypesAndSelf().Where(x => x.IsVirtual == false).Select(x => x.Label.Name));

            if (entity.RowVersion != null)
            {
                item.SetRowVersion(trans.TransactionDate);
            }

            IDictionary <string, object?> node = item.GetData();

            string create = string.Format("CREATE (inserted:{0} {{node}}) Return inserted", labels);

            if (entity.FunctionalId != null)
            {
                object?key = item.GetKey();
                if (key is null)
                {
                    string nextKey = string.Format("CALL blueprint41.functionalid.next('{0}') YIELD value as key", entity.FunctionalId.Label);
                    if (entity.FunctionalId.Format == IdFormat.Numeric)
                    {
                        nextKey = string.Format("CALL blueprint41.functionalid.nextNumeric('{0}') YIELD value as key", entity.FunctionalId.Label);
                    }

                    create = nextKey + "\r\n" + string.Format("CREATE (inserted:{0} {{node}}) SET inserted.{1} = key Return inserted", labels, entity.Key.Name);

                    node.Remove(entity.Key.Name);
                }
                else
                {
                    entity.FunctionalId.SeenUid(key.ToString() !);
                }
            }

            Dictionary <string, object?> parameters = new Dictionary <string, object?>();

            parameters.Add("node", node);

            Dictionary <string, object?>?customState = null;
            var args = entity.RaiseOnNodeCreate(trans, item, create, parameters, ref customState);

            var       result = trans.Run(args.Cypher, args.Parameters);
            RawRecord record = result.FirstOrDefault();

            if (record == null)
            {
                throw new InvalidOperationException($"Due to an unexpected state of the neo4j transaction, it seems impossible to insert the {entity.Name} at this time.");
            }

            RawNode inserted = record["inserted"].As <RawNode>();

            args.Id     = inserted.Id;
            args.Labels = inserted.Labels;
            // HACK: To make it faster we do not copy/replicate the Dictionary here, but it means someone
            //       could be changing the INode content from within an event. Possibly dangerous, but
            //       turns out the Neo4j driver can deal with it ... for now ...
            args.Properties = (Dictionary <string, object?>)inserted.Properties;
            args            = entity.RaiseOnNodeCreated(trans, args, inserted.Id, inserted.Labels, (Dictionary <string, object?>)inserted.Properties);

            item.SetData(args.Properties !);
            item.PersistenceState = PersistenceState.Persisted;
            Transaction.RunningTransaction.Register(entity.Name, item, true);
        }
Ejemplo n.º 14
0
 private static bool HasDeflection(RawNode config, string name)
 {
     return(config.CheckKey(name) || config.CheckKey(name + "_left") || config.CheckKey(name + "_right"));
 }
 public CityCollection(RawNode initNode, CityCategories categories, IContext context, IDescription dataSource) : base(initNode, categories, context, dataSource)
 {
 }
 public BuildingDescription(RawNode node, IContext context = null) : base(node, context)
 {
 }
Ejemplo n.º 17
0
 public LimitedResourcePrice(RawNode node, IContext context) : base(node, context)
 {
     resource = GetPath().GetSelf <LimitedResource>();
 }
Ejemplo n.º 18
0
 public DealDescription(RawNode node, IContext context) : base(node, context)
 {
 }
Ejemplo n.º 19
0
 protected override SomeModel Factory(RawNode initNode, SomeModelDescription description)
 {
     return(new SomeModel(initNode, categories, description, GetContext()));
 }
Ejemplo n.º 20
0
        private Maybe <ILineNode> ParseStatement(MergeableGenerator <Token> tokens, ImmutableStack <Closure> scopes)
        {
            while (ExpandIdentifier(tokens, scopes))
            {
            }
            head = tokens.Current;
            tokens.MoveNext();
            //TODO: Replace with real raw information, and error if not valid.
            IList <IParamNode> parameters;

            //TODO: Make intelligent to reject malformed parameters.
            //TODO: Parse parameters after checking code validity.
            if (tokens.Current.Type != TokenType.NEWLINE && tokens.Current.Type != TokenType.SEMICOLON)
            {
                parameters = ParseParamList(tokens, scopes);
            }
            else
            {
                parameters = new List <IParamNode>();
                tokens.MoveNext();
            }

            string upperCodeIdentifier = head.Content.ToUpperInvariant();

            if (SpecialCodes.Contains(upperCodeIdentifier))
            {
                switch (upperCodeIdentifier)
                {
                case "ORG":
                    if (parameters.Count != 1)
                    {
                        Error(head.Location, "Incorrect number of parameters in ORG: " + parameters.Count);
                    }
                    else
                    {
                        parameters[0].AsAtom().IfJust(
                            (IAtomNode atom) => atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); }).IfJust(
                                (int temp) =>
                        {
                            if (temp > 0x2000000)
                            {
                                Error(parameters[0].MyLocation, "Tried to set offset to 0x" + temp.ToString("X"));
                            }
                            else
                            {
                                CurrentOffset = temp;
                            }
                        }),
                            () => { Error(parameters[0].MyLocation, "Expected atomic param to ORG."); }
                            );
                    }
                    break;

                case "PUSH":
                    if (parameters.Count != 0)
                    {
                        Error(head.Location, "Incorrect number of parameters in PUSH: " + parameters.Count);
                    }
                    else
                    {
                        pastOffsets.Push(new Tuple <int, bool>(CurrentOffset, offsetInitialized));
                    }
                    break;

                case "POP":
                    if (parameters.Count != 0)
                    {
                        Error(head.Location, "Incorrect number of parameters in POP: " + parameters.Count);
                    }
                    else if (pastOffsets.Count == 0)
                    {
                        Error(head.Location, "POP without matching PUSH.");
                    }
                    else
                    {
                        Tuple <int, bool> tuple = pastOffsets.Pop();

                        CurrentOffset     = tuple.Item1;
                        offsetInitialized = tuple.Item2;
                    }
                    break;

                case "MESSAGE":
                    Message(head.Location, PrettyPrintParams(parameters));
                    break;

                case "WARNING":
                    Warning(head.Location, PrettyPrintParams(parameters));
                    break;

                case "ERROR":
                    Error(head.Location, PrettyPrintParams(parameters));
                    break;

                case "ASSERT":
                    if (parameters.Count != 1)
                    {
                        Error(head.Location, "Incorrect number of parameters in ASSERT: " + parameters.Count);
                    }
                    else
                    {
                        parameters[0].AsAtom().IfJust(
                            (IAtomNode atom) =>
                        {
                            atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); }).IfJust(
                                (int temp) =>
                            {
                                if (temp < 0)
                                {
                                    Error(parameters[0].MyLocation, "Assertion error: " + temp);
                                }
                            });
                        },
                            () => { Error(parameters[0].MyLocation, "Expected atomic param to ASSERT."); }
                            );
                    }
                    break;

                case "PROTECT":
                    if (parameters.Count == 1)
                    {
                        parameters[0].AsAtom().IfJust(
                            (IAtomNode atom) => atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); }).IfJust(
                                (int temp) =>
                        {
                            protectedRegions.Add(new Tuple <int, int, Location>(temp, 4, head.Location));
                        }),
                            () => { Error(parameters[0].MyLocation, "Expected atomic param to PROTECT"); });
                    }
                    else if (parameters.Count == 2)
                    {
                        int  start = 0, end = 0;
                        bool errorOccurred = false;
                        parameters[0].AsAtom().IfJust(
                            (IAtomNode atom) => atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); errorOccurred = true; }).IfJust(
                                (int temp) =>
                        {
                            start = temp;
                        }),
                            () => { Error(parameters[0].MyLocation, "Expected atomic param to PROTECT"); errorOccurred = true; });
                        parameters[1].AsAtom().IfJust(
                            (IAtomNode atom) => atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); errorOccurred = true; }).IfJust(
                                (int temp) =>
                        {
                            end = temp;
                        }),
                            () => { Error(parameters[0].MyLocation, "Expected atomic param to PROTECT"); errorOccurred = true; });
                        if (!errorOccurred)
                        {
                            int length = end - start;
                            if (length > 0)
                            {
                                protectedRegions.Add(new Tuple <int, int, Location>(start, length, head.Location));
                            }
                            else
                            {
                                Warning(head.Location, "Protected region not valid (end offset not after start offset). No region protected.");
                            }
                        }
                    }
                    else
                    {
                        Error(head.Location, "Incorrect number of parameters in PROTECT: " + parameters.Count);
                    }
                    break;

                case "ALIGN":
                    if (parameters.Count != 1)
                    {
                        Error(head.Location, "Incorrect number of parameters in ALIGN: " + parameters.Count);
                    }
                    else
                    {
                        parameters[0].AsAtom().IfJust(
                            (IAtomNode atom) => atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); }).IfJust(
                                (int temp) =>
                        {
                            CurrentOffset = CurrentOffset % temp != 0 ? CurrentOffset + temp - CurrentOffset % temp : CurrentOffset;
                        }),
                            () => { Error(parameters[0].MyLocation, "Expected atomic param to ALIGN"); }
                            );
                    }
                    break;

                case "FILL":
                    if (parameters.Count > 2 || parameters.Count == 0)
                    {
                        Error(head.Location, "Incorrect number of parameters in FILL: " + parameters.Count);
                    }
                    else
                    {
                        // FILL <amount> [value]

                        int amount = 0;
                        int value  = 0;

                        if (parameters.Count == 2)
                        {
                            // param 2 (if given) is fill value

                            parameters[1].AsAtom().IfJust(
                                (IAtomNode atom) => atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); }).IfJust(
                                    (int val) => { value = val; }),
                                () => { Error(parameters[0].MyLocation, "Expected atomic param to FILL"); });
                        }

                        // param 1 is amount of bytes to fill
                        parameters[0].AsAtom().IfJust(
                            (IAtomNode atom) => atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); }).IfJust(
                                (int val) => { amount = val; }),
                            () => { Error(parameters[0].MyLocation, "Expected atomic param to FILL"); });

                        var data = new byte[amount];

                        for (int i = 0; i < amount; ++i)
                        {
                            data[i] = (byte)value;
                        }

                        var node = new DataNode(CurrentOffset, data);

                        CheckDataWrite(amount);
                        CurrentOffset += amount;

                        return(new Just <ILineNode>(node));
                    }

                    break;
                }
                return(new Nothing <ILineNode>());
            }
            else if (Raws.ContainsKey(upperCodeIdentifier))
            {
                //TODO: Check for matches. Currently should type error.
                foreach (Raw r in Raws[upperCodeIdentifier])
                {
                    if (r.Fits(parameters))
                    {
                        if ((CurrentOffset % r.Alignment) != 0)
                        {
                            Error(head.Location, string.Format("Bad code alignment (offset: {0:X8})", CurrentOffset));
                        }
                        StatementNode temp = new RawNode(r, head, CurrentOffset, parameters);

                        CheckDataWrite(temp.Size);
                        CurrentOffset += temp.Size; //TODO: more efficient spacewise to just have contiguous writing and not an offset with every line?

                        return(new Just <ILineNode>(temp));
                    }
                }
                //TODO: Better error message (a la EA's ATOM ATOM [ATOM,ATOM])
                Error(head.Location, "Incorrect parameters in raw " + head.Content + '.');
                IgnoreRestOfStatement(tokens);
                return(new Nothing <ILineNode>());
            }
            else //TODO: Move outside of this else.
            {
                Error(head.Location, "Unrecognized code: " + head.Content);
                return(new Nothing <ILineNode>());
            }
        }
Ejemplo n.º 21
0
 public LazyDictionary(RawNode node, IContext context = null) : base(node, context)
 {
 }
Ejemplo n.º 22
0
 public void Transform(RawNode item)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 23
0
 public SomeModelCollection(RawNode initNode, SomeModelCategories categories, IContext context, IDescription dataSource) : base(initNode, categories, context, dataSource)
 {
 }
Ejemplo n.º 24
0
 protected override CityDescription Factory(RawNode partialNode)
 {
     return(new CityDescription(partialNode, GetContext()));
 }
 public FalseRequirement(RawNode node, IContext context)
     : base(node, context)
 {
 }
Ejemplo n.º 26
0
 public CityDescriptionDataSource(RawNode node, IContext context = null) : base(node, context)
 {
 }
Ejemplo n.º 27
0
 protected WrappedRequirement(RawNode node, IContext context) : base(node, context)
 {
     innerRequirement = FactoryManager.Build <Requirement>(node.GetNode("requirement"), context);
 }
 public SomeModelDescription(RawNode node, IContext context = null) : base(node, context)
 {
 }
Ejemplo n.º 29
0
 public LazyArray(RawNode descriptionNode, IContext context = null) : base(descriptionNode, context)
 {
 }
 protected override City Factory(RawNode initNode, CityDescription description)
 {
     return(new City(initNode, categories, description, GetContext()));
 }