Exemplo n.º 1
0
 public void GetKnownNodeHeader_Returns_Header_For_Patterned_Matches(string inputName, HeaderMatchType expectedType)
 {
     var writerHelper = new KnownHeaderNamesReaderHelper();
     var result = writerHelper.GetKnownNodeHeader(inputName);
     Assert.NotNull(result);
     Assert.Equal(result.MatchType, expectedType);
 }
Exemplo n.º 2
0
 public void GetKnownNodeHeader_Returns_Header(string inputName, HeaderMatchType expectedType)
 {
     var writerHelper = new KnownHeaderNamesReaderHelper();
     var result = writerHelper.GetKnownNodeHeader(inputName);
     Assert.NotNull(result);
     Assert.Equal(result.SourceName, inputName.ToLower());
     Assert.Equal(result.MatchType, expectedType);
 }
Exemplo n.º 3
0
        internal IBasicAdjList InitializeNetwork(int nodeCount, int edgeCount)
        {
            // check for and remove duplicates before data attrib tables are created
            RemoveDuplicatesFromSecondList(NodeDataHeaders, NodePropertyHeaders);
            RemoveDuplicatesFromSecondList(EdgeDataHeaders, EdgePropertyHeaders);
            //----
            var helper = new KnownHeaderNamesReaderHelper();
            if(DisableDataConversions)
            {
                TranslateHeadersToStrings(NodeDataHeaders);
                TranslateHeadersToStrings(NodePropertyHeaders);
                TranslateHeadersToStrings(EdgeDataHeaders);
                TranslateHeadersToStrings(EdgePropertyHeaders);
            }
            else
            {
                TranslateNodeHeaderNames(NodeDataHeaders, helper);
                TranslateNodeHeaderNames(NodePropertyHeaders, helper);
                TranslateEdgeHeaderNames(EdgeDataHeaders, helper);
                TranslateEdgeHeaderNames(EdgePropertyHeaders, helper);
                CheckForAndManageNodeSizeCase(NodePropertyHeaders);
            }

            IBasicAdjList net = null;
            using (var p = new NetworkFactoryProvider())
            {
                using (var fac = p.Create<IBasicAdjList>())
                {
                    fac.EnableNodeDataAttributes = true;
                    fac.EnableEdgeDataAttributes = true;
                    fac.NetworkName = Path.GetFileNameWithoutExtension(File);
                    net = fac.CreateNetwork(Guid.NewGuid(), nodeCount) as IBasicAdjList;
                }
            }

            CreateNodeAttribs(net, NodeDataHeaders);
            CreateNodeAttribs(net, NodePropertyHeaders);
            CreateEdgeAttribs(net, EdgeDataHeaders);
            CreateEdgeAttribs(net, EdgePropertyHeaders);

            return net;
        }