Exemplo n.º 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;
            }
Exemplo n.º 2
0
 public static Option <R> Map <T, R>
     (this NoneType _, Func <T, R> f)
 => None;
Exemplo n.º 3
0
 public override object Visit(NoneType that, object value)
 {
     var result = (System.Text.StringBuilder) value;
     result.Append('n');         // 'n' for none.
     return null;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates an optional value whose state is unset.
 /// </summary>
 public Optional(NoneType none)
 {
     _value = default(T);
     _isSet = false;
 }
Exemplo n.º 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;
        }
Exemplo n.º 7
0
 public Node(NoneType type, UInt32 x, UInt32 y)
 {
     Type = type;
     X    = x;
     Y    = y;
 }
Exemplo n.º 8
0
 public override object Visit(NoneType that, object value = null)
 {
     return null;
 }
Exemplo n.º 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());
        }
Exemplo n.º 10
0
 public virtual object Visit(NoneType that, object value)
 {
     throw new System.NotImplementedException();
 }