コード例 #1
0
        public override object Execute(object[] Parameters)
        {
            string       lib    = (Parameters[0] as Character).Get();
            string       obj    = (Parameters[1] as Character).Get();
            FixedDecimal length = (Parameters[2] as FixedDecimal);
            Character    data   = (Parameters[3] as Character);

            string output = DataQueue.Pop(lib.Trim() + obj.Trim());

            length.Set(output.Length);
            data.Set(output);

            return(null);
        }
コード例 #2
0
        private string Format(/*Number*/ object numberObject, double number)
        {
            // If no pattern was applied, return the formatted number.
            if (msgPattern == null || msgPattern.CountParts() == 0)
            {
                return(numberFormat.Format(numberObject));
            }

            // Get the appropriate sub-message.
            // Select it based on the formatted number-offset.
            double numberMinusOffset = number - offset;
            string numberString;

            if (offset == 0)
            {
                numberString = numberFormat.Format(numberObject);  // could be BigDecimal etc.
            }
            else
            {
                numberString = numberFormat.Format(numberMinusOffset);
            }
#pragma warning disable 612, 618
            IFixedDecimal dec;
            // ICU4N TODO:
            //if (numberFormat is DecimalFormat)
            //{
            //    dec = ((DecimalFormat)numberFormat).GetFixedDecimal(numberMinusOffset);
            //}
            //else
            //{
            dec = new FixedDecimal(numberMinusOffset);
#pragma warning restore 612, 618
            //}
            int partIndex = FindSubMessage(msgPattern, 0, pluralRulesWrapper, dec, number);
            // Replace syntactic # signs in the top level of this sub-message
            // (not in nested arguments) with the formatted number-offset.
            StringBuilder result    = null;
            int           prevIndex = msgPattern.GetPart(partIndex).Limit;
            for (; ;)
            {
                MessagePatternPart     part = msgPattern.GetPart(++partIndex);
                MessagePatternPartType type = part.Type;
                int index = part.Index;
                if (type == MessagePatternPartType.MsgLimit)
                {
                    if (result == null)
                    {
                        return(pattern.Substring(prevIndex, index - prevIndex)); // ICU4N: Corrected 2nd arg
                    }
                    else
                    {
                        return(result.Append(pattern, prevIndex, index).ToString());
                    }
                }
                else if (type == MessagePatternPartType.ReplaceNumber ||
                         // JDK compatibility mode: Remove SKIP_SYNTAX.
                         (type == MessagePatternPartType.SkipSyntax && msgPattern.JdkAposMode))
                {
                    if (result == null)
                    {
                        result = new StringBuilder();
                    }
                    result.Append(pattern, prevIndex, index);
                    if (type == MessagePatternPartType.ReplaceNumber)
                    {
                        result.Append(numberString);
                    }
                    prevIndex = part.Limit;
                }
                else if (type == MessagePatternPartType.ArgStart)
                {
                    if (result == null)
                    {
                        result = new StringBuilder();
                    }
                    result.Append(pattern, prevIndex, index);
                    prevIndex = index;
                    partIndex = msgPattern.GetLimitPartIndex(partIndex);
                    index     = msgPattern.GetPart(partIndex).Limit;
                    MessagePattern.AppendReducedApostrophes(pattern, prevIndex, index, result);
                    prevIndex = index;
                }
            }
        }
コード例 #3
0
ファイル: DataSet.cs プロジェクト: Parveen-as400/NetRPG
        public DataValue ToDataValue()
        {
            DataValue result = null;

            switch (this._Type)
            {
            case Types.Ind:
                result = new Ind(this._Name, (string)this._InitialValue);
                break;

            case Types.Character:
                result = new Character(this._Name, this._Length, (string)this._InitialValue);
                break;

            case Types.Int8:
            case Types.Int16:
            case Types.Int32:
            case Types.Int64:
                result = new Int(this._Name, this._Type, Convert.ToInt32(this._InitialValue));
                break;

            case Types.Structure:
                result = new Structure(this._Name, this._Qualified);
                break;

            case Types.FixedDecimal:     //Packed / Zoned
                result = new FixedDecimal(this._Name, this._Type, this._Precision, Convert.ToDouble(this._InitialValue));
                break;

            case Types.Float:
            case Types.Double:
                result = new Float(this._Name, this._Type, Convert.ToDouble(this._InitialValue));
                break;

            case Types.Timestamp:
                result = new Timestamp(this._Name, Convert.ToInt32(this._InitialValue));
                break;

            case Types.File:
                if (this._WorkStation)
                {
                    result = new Typing.Files.Display(this._Name, this._File, this._UserOpen);
                }
                else
                {
                    result = new Typing.Files.Table(this._Name, this._File, this._UserOpen);
                }
                break;

            default:
                Error.ThrowRuntimeError("DataSet.ToDataValue", this._Type.ToString() + " is not a ready data type.");
                break;
            }

            if (this._DataArea != null)
            {
                result.SetDataAreaName(this._DataArea);
            }
            if (IsArray())
            {
                result.SetArray(this._Dimentions);
            }
            if (this._Type == Types.Structure && _Subfields != null)
            {
                result.SetSubfields(_Subfields.ToArray()); //Must be run after array size has been set
            }
            return(result);
        }