Ejemplo n.º 1
0
 /// <summary>
 /// For each header.SourceFieldName, this assigned the appropriate header.Name and data type
 /// of the ultimate attribute column to be created.  AttribColIndex is assigned later, when 
 /// the actual attrib cols are created.
 /// </summary>
 internal void TranslateNodeHeaderNames(IList<HeaderField> nodeHeaders, IKnownHeaderNamesReaderHelper writerHelper)
 {
     HeaderMatch match = null;
     foreach (var header in nodeHeaders)
     {
         match = writerHelper.GetKnownNodeHeader(header.SourceFieldName);
         if (match != null)
         {
             header.AttribColName = match.NameToUse ?? header.AttribColName;
             header.AttribColumnType = match.DataType;
         }
         else
         {
             header.AttribColName = header.SourceFieldName;
             header.AttribColumnType = typeof(string);
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a series of columns in <paramref name="edgeAttribs"/> based on the names in <paramref name="edgeHeaders"/>.
        /// </summary>
        /// <param name="edgeAttribs">An IEdgeAttributes object</param>
        /// <param name="edgeHeaders">The edge header names read in from the file, (items are assumed to be unique).</param>
        /// <param name="writerHelper">An IKnownHeaderNamesHelper object to help</param>
        internal void CreateEdgeAttribs_XXX(IEdgeAttributes edgeAttribs, List<HeaderField> edgeHeaders, IKnownHeaderNamesReaderHelper writerHelper)
        {
            // Assumes nodeHeaders has unique entries

            // for each entry in headHeaderNames
            //  check if it is a known entry
            //  if it is
            //      create an attrib of that type
            //  else
            //      create an attrib of type string (defaut)
            HeaderMatch match = null;
            int attribColIndex = -1;
            foreach (var header in edgeHeaders)
            {
                match = writerHelper.GetKnownEdgeHeader(header.AttribColName);
                if (match != null)
                {
                    attribColIndex = edgeAttribs.EdgeData.AddColumn(match.NameToUse ?? header.AttribColName, match.DataType);
                }
                else
                {
                    attribColIndex = edgeAttribs.EdgeData.AddColumn(header.AttribColName, typeof(string));
                }
                header.AttribColumnIndex = attribColIndex;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a series of columns in <paramref name="nodeAttribs"/> based on the names in <paramref name="nodeHeaders"/>.
        /// </summary>
        /// <param name="nodeAttribs">An INodeAttributes object</param>
        /// <param name="nodeHeaders">The node header names read in from the file, (items are assumed to be unique).</param>
        /// <param name="writerHelper">An IKnownHeaderNamesHelper object to help</param>
        internal void CreateNodeAttribs_XXX(INodeAttributes nodeAttribs, IList<HeaderField> nodeHeaders, IKnownHeaderNamesReaderHelper writerHeloper)
        {
            // Assumes nodeHeaders has unique entries

            // for each entry in headHeaderNames
            //  check if it is a known entry
            //  if it is
            //      create an attrib of that type
            //  else
            //      create an attrib of type string (defaut)
            foreach (var header in nodeHeaders)
            {
                header.AttribColumnIndex = nodeAttribs.NodeData.AddColumn(header.AttribColName, header.AttribColumnType);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a series of columns in <paramref name="nodeAttribs"/> based on the names in <paramref name="headerFields"/>.
        /// </summary>
        /// <param name="nodeAttribs">An INodeAttributes object</param>
        /// <param name="headerFields">The node header names read in from the file, (items are assumed to be unique).</param>
        /// <param name="writerHelper">An IKnownHeaderNamesHelper object to help</param>
        internal void CreateNodeAttribs(INodeAttributes nodeAttribs, IList<HeaderField> headerFields, IKnownHeaderNamesReaderHelper writerHelper)
        {
            // Assumes nodeHeaders has unique entries

            // for each entry in headHeaderNames
            //  check if it is a known entry
            //  if it is
            //      create an attrib of that type
            //  else
            //      create an attrib of type string (defaut)
            HeaderMatch match = null;
            bool nodeSizeColFound = false;
            int attribColIndex = -1;
            foreach (var header in headerFields)
            {
                match = writerHelper.GetKnownNodeHeader(header.Name);
                if (match != null)
                {
                    attribColIndex = nodeAttribs.NodeData.AddColumn(match.NameToUse ?? header.Name, match.DataType);
                    // check for the special case of node size
                    nodeSizeColFound |= string.Compare(match.Name, "size", true, CultureInfo.InvariantCulture) == 0;
                }
                else
                {
                    attribColIndex = nodeAttribs.NodeData.AddColumn(header.Name, typeof(string));
                }
                header.IndexOfTargetAttribColumn = attribColIndex;
            }

            // Now handle special cases (eg node size)
            if (nodeSizeColFound)
                DealWithSpecialCaseOfNodeSizeHeader(nodeAttribs);
        }