Example #1
0
        public static bool MatchObjects(Object obj1, Object obj2, bool required, bool assigning)
        {
            var chains   = new Hash <string, MessagePath>();
            var bindings = new AutoHash <string, Value>
            {
                Default      = DefaultType.Value,
                DefaultValue = ""
            };
            var repeating = false;
            int comparison;

            while (true)
            {
                comparison = obj1.Compare(obj2, chains, new MessagePath(), bindings, ref repeating);
                if (comparison == 0)
                {
                    foreach (var item in chains)
                    {
                        Regions.SetBinding(item.Key, item.Value.Invoke(obj1).Resolve(), assigning);
                    }
                    foreach (var item in bindings)
                    {
                        Regions.SetBinding(item.Key, item.Value.Resolve(), assigning);
                    }

                    return(returnMatched(comparison == 0, required, null));
                }

                if (!repeating)
                {
                    break;
                }
            }

            return(comparison == 0);
        }
Example #2
0
 public Value Max() => stop.Compare(start) > 0 ? stop : start;
Example #3
0
 public Value Min() => start.Compare(stop) < 0 ? start : stop;