Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (obj is ASymbol)
            {
                ASymbol other = (ASymbol)obj;
                return(this.symbolName == other.symbolName);
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// AArray generated by type and shape with Reshape dyadic nonscalar function.
        /// If shape list is null, we give back the filler elemenet.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="shape"></param>
        internal static AType FillElement(ATypes type, AType shape = null)
        {
            AType filler = null;

            switch (type)
            {
            case ATypes.ABox:
            case ATypes.AFunc:
                filler = ABox.Create(ANull());
                break;

            case ATypes.AChar:
                filler = AChar.Create(' ');
                break;

            case ATypes.AFloat:
                filler = AFloat.Create(0);
                break;

            case ATypes.AInteger:
                filler = AInteger.Create(0);
                break;

            case ATypes.ASymbol:
                filler = ASymbol.Create("");
                break;

            default:
                throw new NotImplementedException("Invalid use-case");
            }

            if (shape != null)
            {
                return(AplusCore.Runtime.Function.Dyadic.DyadicFunctionInstance.Reshape.Execute(filler, shape));
            }
            else
            {
                return(filler);
            }
        }
Ejemplo n.º 3
0
 public AType ExecutePrimitive(ASymbol rightArgument, ASymbol leftArgument)
 {
     int number = (leftArgument.asString != rightArgument.asString) ? 1 : 0;
     return AInteger.Create(number);
 }
Ejemplo n.º 4
0
 public AType ExecutePrimitive(ASymbol rightArgument, ASymbol leftArgument)
 {
     string result = rightArgument.asString.Contains(".") ? rightArgument.asString : leftArgument.asString + "." + rightArgument.asString;
     return ASymbol.Create(result);
 }
Ejemplo n.º 5
0
 public AType ExecutePrimitive(ASymbol rightArgument, ASymbol leftArgument)
 {
     int result = String.Compare(leftArgument.asString, rightArgument.asString) == 1 ? 1 : 0;
     return AInteger.Create(result);
 }
Ejemplo n.º 6
0
 public AType ExecutePrimitive(AFloat rightArgument, ASymbol leftArgument)
 {
     int casenumber = ConvertSymbolName(leftArgument.asString);
     return Calculate(rightArgument.asFloat, casenumber);
 }
Ejemplo n.º 7
0
 public override AType ExecutePrimitive(ASymbol argument, Aplus environment = null)
 {
     return ASymbol.Create(argument.asString);
 }
Ejemplo n.º 8
0
 public virtual AType ExecutePrimitive(ASymbol argument, Aplus environment = null)
 {
     throw new NotImplementedException("Invalid use-case");
 }