示例#1
0
        public SetValue Function(StringValue name, ArgumentsValue args)
        {
            var set = new SetValue(name.Value, null, false);

            int iArgs = 1; //First is "name"

            foreach (var arg in args)
            {
                iArgs++;
                if (arg is MatrixValue)
                {
                    set.AddElements((arg as MatrixValue).ToArray());
                }
                else if (arg is StringValue)
                {
                    set.Set.Add((arg as StringValue).Value);
                }
                else if (arg is NumericValue)
                {
                    set.Set.Add(arg as NumericValue);
                }
                else
                {
                    throw new YAMPArgumentInvalidException("Element is not ScalarValue, StringValue or MatrixValue", iArgs);
                }
            }
            return(set);
        }
示例#2
0
        public SetValue Function(SetValue set1, Value id)
        {
            if (id is MatrixValue)
            {
                set1.AddElements((id as MatrixValue).ToArray());
            }
            else
            {
                set1.Set.Add(new SetValue.ValueWrap(id));
            }

            return(set1);
        }
示例#3
0
            public SetValue Function(Value id)
            {
                SetValue set = @this as SetValue;

                if (ReferenceEquals(set, null))
                {
                    throw new YAMPSetsFunctionNotMemberException("SetAdd");
                }

                if (id is MatrixValue)
                {
                    set.AddElements((id as MatrixValue).ToArray());
                }
                else
                {
                    set.Set.Add(new SetValue.ValueWrap(id));
                }
                return(set);
            }