Example #1
0
            protected override void OnExecute(Tangle <T> tangle, out NoneType result)
            {
                var keys = Keys;

                var count = GetCountFast(Keys);

                if (!count.HasValue)
                {
                    var array = Keys.ToArray();
                    keys  = array;
                    count = array.Length;
                }

                Parallel.ForEach(
                    keys, (rawKey) => {
                    T value;
                    if (tangle.InternalGet(KeyConverter(rawKey), out value))
                    {
                        Function(rawKey, value);
                    }
                }
                    );

                result = NoneType.None;
            }
 public static Option <R> Map <T, R>
     (this NoneType _, Func <T, R> f)
 => None;
 public override object Visit(NoneType that, object value)
 {
     var result = (System.Text.StringBuilder) value;
     result.Append('n');         // 'n' for none.
     return null;
 }
Example #4
0
 /// <summary>
 /// Creates an optional value whose state is unset.
 /// </summary>
 public Optional(NoneType none)
 {
     _value = default(T);
     _isSet = false;
 }
Example #5
0
 public override object Visit(NoneType that, object value)
 {
     _writer.Write("none");
     return null;
 }
        public override object Visit(NoneType that, object value = null)
        {
            PrintPrologue(that);
            _writer.WriteLine("TypeKind = {0}", that.TypeKind.ToString());
            PrintEpilogue(that);

            return null;
        }
Example #7
0
 public Node(NoneType type, UInt32 x, UInt32 y)
 {
     Type = type;
     X    = x;
     Y    = y;
 }
 public override object Visit(NoneType that, object value = null)
 {
     return null;
 }
Example #9
0
        /** Parses a profile aka a parameter list and the optional return type. */
        private Profile ParseProfile()
        {
            Token start = _matcher.Match(TokenKind.ParenthesisBegin);

            // parse parameter list
            var parameters = new List<Parameter>();
            while (_matcher.This.Kind != TokenKind.ParenthesisClose)
            {
                Parameter parameter = ParseParameter();
                parameters.Add(parameter);

                if (_matcher.This.Kind != TokenKind.Comma)
                    break;
                _matcher.Match(TokenKind.Comma);
                _matcher.Match(TokenKind.Space);
            }
            _matcher.Match(TokenKind.ParenthesisClose);

            // Parse optional return type.
            Type type;
            if (_matcher.This.Kind == TokenKind.Colon)
                type = new NoneType(_matcher.This.Cursor);
            else
            {
                _matcher.Match(TokenKind.Space);
                _matcher.Match(TokenKind.Keyword_Is);
                _matcher.Match(TokenKind.Space);
                type = ParseType();
            }

            return new Profile(start.Cursor, type, parameters.ToArray());
        }
Example #10
0
 public virtual object Visit(NoneType that, object value)
 {
     throw new System.NotImplementedException();
 }