private void SaveToGlobalSheet(int id, AnalyzeOptionInfo info, Object value)
        {
            Worksheet sheet = null;
            if (globalSheetIndex == 0)
            {
                sheet = GetNextWorksheet();
                globalSheetIndex = sheet.Index;
            }
            else
            {
                sheet = (Worksheet)workbook.Sheets[globalSheetIndex];
            }
            sheet.Name = "Globals";
            sheet.Columns[1].ColumnWidth = 30;
            sheet.Columns[2].ColumnWidth = 20;
            sheet.Columns.HorizontalAlignment = XlHAlign.xlHAlignLeft;
            if (globalsSheetLastRow == 0)
                globalsSheetLastRow = sheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell).Row;

            sheet.Cells[globalsSheetLastRow, 1] = info.FullName;
            sheet.Cells[globalsSheetLastRow, 2] = value.ToString();
            ++globalsSheetLastRow;
        }
        private void SaveValueListSheet(int id, AnalyzeOptionInfo info, Object value)
        {
            Worksheet sheet = GetNextWorksheet();
            sheet.Name = info.FullName;
            sheet.Columns[1].ColumnWidth = 20;
            sheet.Columns.HorizontalAlignment = XlHAlign.xlHAlignLeft;
            int lastRow = sheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell).Row;

            Debug.Assert(value is List<Double>);
            List<Double> l = value as List<Double>;
            foreach (Double d in l)
            {
                sheet.Cells[lastRow, 1] = d;
                ++lastRow;
            }
        }
 private void SaveCentralitySheet(int id, AnalyzeOptionInfo info, Object value)
 {
     Debug.Assert(value is List<Double>);
     List<Double> l = value as List<Double>;
     int s = l.Count();
     Worksheet sheet = null;
     if (centralitySheetIndex == 0)
     {
         sheet = GetNextWorksheet();
         centralitySheetIndex = sheet.Index;
         sheet.Name = "Centrality";
         sheet.Columns[1].ColumnWidth = 10;
         sheet.Columns.HorizontalAlignment = XlHAlign.xlHAlignLeft;
         sheet.Cells[1, 1] = "Vertex";
         sheet.Cells[1, 1].EntireRow.Font.Bold = true;
         for (int i = 2; i <= s + 1; ++i)
             sheet.Cells[i, 1] = i - 2;
     }
     else
     {
         sheet = (Worksheet)workbook.Sheets[centralitySheetIndex];
     }
     sheet.Columns[centralitySheetLastColumn].ColumnWidth = 20;
     sheet.Cells[1, centralitySheetLastColumn] = info.FullName;
     for (int i = 2; i <= s + 1; ++i)
         sheet.Cells[i, centralitySheetLastColumn] = l[i - 2].ToString();
     ++centralitySheetLastColumn;
 }
        private void SaveDistributionSheet(int id, AnalyzeOptionInfo info, Object value)
        {
            int length = (info.FullName.Length > 31) ? 30 : info.FullName.Length;
            Worksheet sheet = GetNextWorksheet();
            sheet.Name = info.FullName.Substring(0, length);
            sheet.Columns[1].ColumnWidth = 20;
            sheet.Columns[2].ColumnWidth = 20;
            sheet.Columns.HorizontalAlignment = XlHAlign.xlHAlignLeft;
            int lastRow = sheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell).Row;

            sheet.Cells[lastRow, 1] = info.XAxisName;
            sheet.Cells[lastRow, 1].EntireRow.Font.Bold = true;
            sheet.Cells[lastRow, 2] = info.YAxisName;
            sheet.Cells[lastRow, 2].EntireRow.Font.Bold = true;
            ++lastRow;

            Debug.Assert(value is SortedDictionary<Double, Double>);
            SortedDictionary<Double, Double> l = value as SortedDictionary<Double, Double>;
            foreach (Double d in l.Keys)
            {
                sheet.Cells[lastRow, 1] = d;
                sheet.Cells[lastRow, 2] = l[d];
                ++lastRow;
            }
        }
        private Object LoadDistribution(Workbook book, AnalyzeOptionInfo info)
        {
            int length = (info.FullName.Length > 31) ? 30 : info.FullName.Length;
            Worksheet sheet = FindSheetInBook(book, info.FullName.Substring(0, length));
            if (sheet == null)
                return null;

            Range range = sheet.UsedRange;
            SortedDictionary<Double, Double> d = new SortedDictionary<Double, Double>();
            for (int i = 2; i <= range.Rows.Count; ++i)
            {
                Range r = range.Rows[i];
                d.Add(r.Cells[1].Value, r.Cells[2].Value);
            }
            return d;
        }
        private Object LoadValueList(Workbook book, AnalyzeOptionInfo info)
        {
            int length = (info.FullName.Length > 31) ? 30 : info.FullName.Length;
            Worksheet sheet = FindSheetInBook(book, info.FullName.Substring(0, length));
            if (sheet == null)
                return null;

            List<Double> valueList = new List<Double>();
            Range r = sheet.UsedRange;
            foreach (Range c in r)
            {
                valueList.Add(c.Value);
            }
            return valueList;
        }
        private void SaveDistributionSheet(AnalyzeOptionInfo info, Object value)
        {
            /*int length = (info.FullName.Length > 31) ? 30 : info.FullName.Length;
            ISheet distributionSheet = workbook.CreateSheet(info.FullName.Substring(0, length));
            distributionSheet.SetDefaultColumnStyle(0, style);
            distributionSheet.SetDefaultColumnStyle(1, style);
            distributionSheet.SetColumnWidth(0, 20 * 256);
            distributionSheet.SetColumnWidth(1, 20 * 256);

            IRow headerRow = distributionSheet.CreateRow(0);
            headerRow.CreateCell(0).SetCellValue(info.XAxisName);
            headerRow.CreateCell(1).SetCellValue(info.YAxixName);

            int i = 1;
            if (info.EnsembleResultType.Equals(typeof(SortedDictionary<Double, Double>)))
            {
                SortedDictionary<Double, Double> l = value as SortedDictionary<Double, Double>;
                foreach (Double d in l.Keys)
                {
                    IRow row = distributionSheet.CreateRow(i);
                    row.CreateCell(0).SetCellValue(d);
                    row.CreateCell(1).SetCellValue(l[d]);
                    ++i;
                }
            }
            else if (info.EnsembleResultType.Equals(typeof(SortedDictionary<UInt32, Double>)))
            {
                SortedDictionary<UInt32, Double> l = value as SortedDictionary<UInt32, Double>;
                foreach (UInt32 d in l.Keys)
                {
                    IRow row = distributionSheet.CreateRow(i);
                    row.CreateCell(0).SetCellValue(d);
                    row.CreateCell(1).SetCellValue(l[d]);
                    ++i;
                }
            }
            else if (info.EnsembleResultType.Equals(typeof(SortedDictionary<UInt16, Double>)))
            {
                SortedDictionary<UInt16, Double> l = value as SortedDictionary<UInt16, Double>;
                foreach (UInt16 d in l.Keys)
                {
                    IRow row = distributionSheet.CreateRow(i);
                    row.CreateCell(0).SetCellValue(d);
                    row.CreateCell(1).SetCellValue(l[d]);
                    ++i;
                }
            }*/
        }
        private void SaveValueListSheet(AnalyzeOptionInfo info, Object value)
        {
            /*if (info.EnsembleResultType.Equals(typeof(List<Double>)))
            {
                ISheet valueListSheet = workbook.CreateSheet(info.FullName);
                valueListSheet.SetDefaultColumnStyle(0, style);
                valueListSheet.SetColumnWidth(0, 20 * 256);

                List<Double> l = value as List<Double>;
                int i = 0;
                foreach (Double d in l)
                {
                    IRow r = valueListSheet.CreateRow(i);
                    r.CreateCell(0).SetCellValue(d);
                    ++i;
                }
            }*/
        }
 private void SaveDistribution(AnalyzeOptionInfo info, Object value)
 {
     Debug.Assert(value is SortedDictionary<Double, Double>);
     SortedDictionary<Double, Double> l = value as SortedDictionary<Double, Double>;
     foreach (Double d in l.Keys)
     {
         writer.WriteStartElement("pair");
         writer.WriteAttributeString(info.XAxisName, d.ToString());
         writer.WriteAttributeString(info.YAxisName, l[d].ToString());
         writer.WriteEndElement();
     }
 }
Ejemplo n.º 10
0
 private void SaveValueList(AnalyzeOptionInfo info, Object value)
 {
     if (info.EnsembleResultType.Equals(typeof(List<Double>)))
     {
         List<Double> l = value as List<Double>;
         foreach (Double d in l)
             writer.WriteElementString("Value", d.ToString());
     }
 }
Ejemplo n.º 11
0
 private void SaveDistribution(AnalyzeOptionInfo info, Object value)
 {
     if (info.EnsembleResultType.Equals(typeof(SortedDictionary<Double, Double>)))
     {
         SortedDictionary<Double, Double> l = value as SortedDictionary<Double, Double>;
         foreach (Double d in l.Keys)
         {
             writer.WriteStartElement("pair");
             writer.WriteAttributeString(info.XAxisName, d.ToString());
             writer.WriteAttributeString(info.YAxixName, l[d].ToString());
             writer.WriteEndElement();
         }
     }
     else if (info.EnsembleResultType.Equals(typeof(SortedDictionary<UInt32, Double>)))
     {
         SortedDictionary<UInt32, Double> l = value as SortedDictionary<UInt32, Double>;
         foreach (UInt32 d in l.Keys)
         {
             writer.WriteStartElement("pair");
             writer.WriteAttributeString(info.XAxisName, d.ToString());
             writer.WriteAttributeString(info.YAxixName, l[d].ToString());
             writer.WriteEndElement();
         }
     }
     else if (info.EnsembleResultType.Equals(typeof(SortedDictionary<UInt16, Double>)))
     {
         SortedDictionary<UInt16, Double> l = value as SortedDictionary<UInt16, Double>;
         foreach (UInt16 d in l.Keys)
         {
             writer.WriteStartElement("pair");
             writer.WriteAttributeString(info.XAxisName, d.ToString());
             writer.WriteAttributeString(info.YAxixName, l[d].ToString());
             writer.WriteEndElement();
         }
     }
 }
Ejemplo n.º 12
0
        private Object LoadValueList(AnalyzeOptionInfo info)
        {
            if (info.EnsembleResultType.Equals(typeof(List<Double>)))
            {
                List<Double> valueList = new List<Double>();
                reader.Read();
                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    valueList.Add(Double.Parse(reader.ReadElementString()));
                }
                return valueList;
            }

            return null;
        }
Ejemplo n.º 13
0
        private Object LoadDistribution(AnalyzeOptionInfo info)
        {
            if (info.EnsembleResultType.Equals(typeof(SortedDictionary<Double, Double>)))
            {
                SortedDictionary<Double, Double> d = new SortedDictionary<Double, Double>();
                double first, second;
                while (reader.Read() && reader.NodeType != XmlNodeType.EndElement)
                {
                    reader.MoveToFirstAttribute();
                    first = Double.Parse(reader.Value);
                    reader.MoveToNextAttribute();
                    second = Double.Parse(reader.Value);
                    d.Add(first, second);
                }
                return d;
            }
            else if (info.EnsembleResultType.Equals(typeof(SortedDictionary<UInt32, Double>)))
            {
                SortedDictionary<UInt32, Double> d = new SortedDictionary<UInt32, Double>();
                UInt32 first;
                double second;
                while (reader.Read() && reader.NodeType != XmlNodeType.EndElement)
                {
                    reader.MoveToFirstAttribute();
                    first = UInt32.Parse(reader.Value);
                    reader.MoveToNextAttribute();
                    second = Double.Parse(reader.Value);
                    d.Add(first, second);
                }
                return d;
            }
            else if (info.EnsembleResultType.Equals(typeof(SortedDictionary<UInt16, Double>)))
            {
                SortedDictionary<UInt16, Double> d = new SortedDictionary<UInt16, Double>();
                UInt16 first;
                double second;
                while (reader.Read() && reader.NodeType != XmlNodeType.EndElement)
                {
                    reader.MoveToFirstAttribute();
                    first = UInt16.Parse(reader.Value);
                    reader.MoveToNextAttribute();
                    second = Double.Parse(reader.Value);
                    d.Add(first, second);
                }
                return d;
            }

            return null;
        }