Beispiel #1
0
        private static Int32 parseIntArray(Int32 eox, Int32 offset, ref Byte[] buffer, ref Rexp x)
        {
            Int32 Count = (eox - offset) / 4;

            Int32[] values = new Int32[Count];

            for (int i = 0; i < Count; i++)
            {
                values[i] = BitConverter.ToInt32(buffer, offset);
                offset   += 4;
            }

            if (offset != eox)
            {
                //throw new RconnectionException("Warning: int array SEXP size mismatch");
                offset = eox;
            }
            x.Data = values;

            if (x.Attrib != null)
            {
                if ((x.Attrib.Xtype == Xpression.XT_LIST) && (x.Attrib.Data != null) &&
                    (((Rlist)x.Attrib.Data).Head != null) &&
                    (((Rlist)x.Attrib.Data).Body != null) &&
                    (((Rlist)x.Attrib.Data).Head.Data != null) &&
                    (((Rlist)x.Attrib.Data).Body.Data != null) &&
                    (((Rlist)x.Attrib.Data).Head.Xtype == Xpression.XT_VECTOR) &&
                    (((Rlist)x.Attrib.Data).Body.Xtype == Xpression.XT_LIST) &&
                    (((Rlist)((Rlist)x.Attrib.Data).Body.Data).Head != null) &&
                    (((Rlist)((Rlist)x.Attrib.Data).Body.Data).Head.Xtype == Xpression.XT_STR) &&
                    ((String)((Rlist)((Rlist)x.Attrib.Data).Body.Data).Head.Data).Equals("factor"))
                {
                    Rfactor f = new Rfactor(values, (List <Rexp>)((Rlist)x.Attrib.Data).Head.Data);
                    x.Data   = f;
                    x.Xtype  = Xpression.XT_FACTOR;
                    x.Attrib = null;
                }
            }

            return(offset);
        }
Beispiel #2
0
        private static Int32 parseIntArray(Int32 eox, Int32 offset, ref Byte[] buffer, ref Rexp x)
        {
            Int32 Count = (eox - offset) / 4;
            Int32[] values = new Int32[Count];

            for (int i = 0; i < Count; i++)
            {
                values[i] = BitConverter.ToInt32(buffer, offset);
                offset += 4;
            }

            if (offset != eox)
            {
                //throw new RconnectionException("Warning: int array SEXP size mismatch");
                offset = eox;
            }
            x.Data = values;

            if (x.Attrib != null)
            {
                if ((x.Attrib.Xtype == Xpression.XT_LIST) && (x.Attrib.Data != null) &&
                    (((Rlist)x.Attrib.Data).Head != null) &&
                    (((Rlist)x.Attrib.Data).Body != null) &&
                    (((Rlist)x.Attrib.Data).Head.Data != null) &&
                    (((Rlist)x.Attrib.Data).Body.Data != null) &&
                    (((Rlist)x.Attrib.Data).Head.Xtype == Xpression.XT_VECTOR) &&
                    (((Rlist)x.Attrib.Data).Body.Xtype == Xpression.XT_LIST) &&
                    (((Rlist)((Rlist)x.Attrib.Data).Body.Data).Head != null) &&
                    (((Rlist)((Rlist)x.Attrib.Data).Body.Data).Head.Xtype == Xpression.XT_STR) &&
                    ((String)((Rlist)((Rlist)x.Attrib.Data).Body.Data).Head.Data).Equals("factor"))
                {
                    Rfactor f = new Rfactor(values, (List<Rexp>)((Rlist)x.Attrib.Data).Head.Data);
                    x.Data = f;
                    x.Xtype = Xpression.XT_FACTOR;
                    x.Attrib = null;
                }
            }

            return offset;
        }