コード例 #1
0
ファイル: ParamBagPersister.cs プロジェクト: BgRva/Blob1
 public override void PersistBag(IParamBag target, System.Xml.XmlWriter writer)
 {
     IRandomNetGenParamBag bag = (IRandomNetGenParamBag)target;
     if (bag.NodeCountValue != bag.NodeCountDefault)
     {
         writer.WriteElementString("NodeCount", bag.NodeCountValue.ToString());
     }
     if (bag.EdgeCountValue != bag.EdgeCountDefault)
     {
         writer.WriteElementString("EdgeCount", bag.EdgeCountValue.ToString());
     }
     if (bag.IsDirectedValue != bag.IsDirectedDefault)
     {
         writer.WriteElementString("IsDirected", bag.IsDirectedValue.ToString());
     }
     if (bag.NetworkNameValue != bag.NetworkNameDefault)
     {
         writer.WriteElementString("NetworkName", bag.NetworkNameValue.ToString());
     }
     if (bag.AllowCyclesValue != bag.AllowCyclesDefault)
     {
         writer.WriteElementString("AllowCycles", bag.AllowCyclesValue.ToString());
     }
     if (bag.AllowSelfLoopsValue != bag.AllowSelfLoopsDefault)
     {
         writer.WriteElementString("AllowSelfLoops", bag.AllowSelfLoopsValue.ToString());
     }
     if (bag.AllowMultiEdgesValue != bag.AllowMultiEdgesDefault)
     {
         writer.WriteElementString("AllowMultiEdges", bag.AllowMultiEdgesValue.ToString());
     }
 }
コード例 #2
0
ファイル: ParamBagDepersister.cs プロジェクト: BgRva/Blob1
        public override void UnpersistBag(IParamBag target, System.Xml.XmlReader reader)
        {
            // Assumes reader has started the read of elements which contain actual param values and is at their level
            IRandomNetGenParamBag bag = (IRandomNetGenParamBag)target;

            bool loopAgain = false;
            int ctr = 0;
            do
            {
                if (reader.Name == "NodeCount")
                {
                    bag.NodeCountValue = UnpersistNodeCount(reader);
                    ctr++;
                    loopAgain = true;
                }
                else if (reader.Name == "EdgeCount")
                {
                    bag.EdgeCountValue = UnpersistEdgeCount(reader);
                    ctr++;
                    loopAgain = true;
                }
                else if (reader.Name == "IsDirected")
                {
                    bag.IsDirectedValue = UnpersistIsDirected(reader);
                    ctr++;
                    loopAgain = true;
                }
                else if (reader.Name == "NetworkName")
                {
                    bag.NetworkNameValue = UnpersistNetworkName(reader);
                    ctr++;
                    loopAgain = true;
                }
                else if (reader.Name == "AllowCycles")
                {
                    bag.AllowCyclesValue = UnpersistAllowCycles(reader);
                    ctr++;
                    loopAgain = true;
                }
                else if (reader.Name == "AllowSelfLoops")
                {
                    bag.AllowSelfLoopsValue = UnpersistAllowSelfLoops(reader);
                    ctr++;
                    loopAgain = true;
                }
                else if (reader.Name == "AllowMultiEdges")
                {
                    bag.AllowMultiEdgesValue = UnpersistAllowMultiEdges(reader);
                    ctr++;
                    loopAgain = true;
                }
                else
                    loopAgain = false;
            } while (loopAgain && (ctr < (bag.Count + 1)));  // get out after each

            if (reader.IsStartElement() && !reader.IsEmptyElement)
            {
                reader.Read();
            }
        }
コード例 #3
0
ファイル: EmptyParamsCtrl.cs プロジェクト: BgRva/Blob1
 public EmptyParamsCtrl(Guid ownerId, IParamBag bag)
 {
     InitializeComponent();
     Id = Guid.NewGuid();
     ElementOwnerId = ownerId;
     EditingEnabled = true;
 }
コード例 #4
0
ファイル: ParamBagPersister.cs プロジェクト: BgRva/Blob1
 public override void PersistBag(IParamBag target, System.Xml.XmlWriter writer)
 {
     IExtractKthCoreParamBag bag = (IExtractKthCoreParamBag)target;
     if (bag.K != bag.KDefault)
     {
         writer.WriteElementString("K", bag.K.ToString());
     }
 }
コード例 #5
0
ファイル: ParamBagDepersister.cs プロジェクト: BgRva/Blob1
        public override void UnpersistBag(IParamBag target, System.Xml.XmlReader reader)
        {
            // Assumes reader has started the read of elements which contain actual param values
            IExtractKthCoreParamBag bag = (IExtractKthCoreParamBag)target;

            if (reader.Name == "K")
            {
                bag.K = UnpersistK(reader);
            }

            if (reader.IsStartElement() && !reader.IsEmptyElement)
            {
                reader.Read();
            }
        }
コード例 #6
0
ファイル: ParamBagPersister.cs プロジェクト: BgRva/Blob1
 public override void PersistBag(IParamBag target, System.Xml.XmlWriter writer)
 {
     var bag = (IImportNetworkParamBag)target;
     if (bag.FileName != bag.FileNameDefault)
     {
         writer.WriteElementString(bag.FileName_ParamName, bag.FileName);
     }
     if (bag.FileType != bag.FileTypeDefault)
     {
         writer.WriteElementString(bag.FileType_ParamName, bag.FileType.ToString());
     }
     if (bag.DisableDataConversions != bag.DisableDataConversionsDefault)
     {
         writer.WriteElementString(bag.DisableDataConversions_ParamName, bag.DisableDataConversions.ToString());
     }
 }
コード例 #7
0
ファイル: ParamBagUnpersister.cs プロジェクト: BgRva/Blob1
        public override void UnpersistBag(IParamBag target, System.Xml.XmlReader reader)
        {
            // Assumes reader has started the read of elements which contain actual param values
            IExportNetworkParamBag bag = (IExportNetworkParamBag)target;

            bool loopAgain = false;
            int ctr = 0;
            do
            {
                if (reader.Name == bag.FileName_ParamName)
                {
                    bag.FileName = UnpersistFileName(reader);
                    ctr++;
                    loopAgain = true;
                }
                else if (reader.Name == bag.ExportNodeAttributes_ParamName)
                {
                    bag.ExportNodeAttributes = UnpersistExportNodeAttributes(reader);
                    ctr++;
                    loopAgain = true;
                }
                else if (reader.Name == bag.ExportEdgeAttributes_ParamName)
                {
                    bag.ExportEdgeAttributes = UnpersistExportEdgeAttributes(reader);
                    ctr++;
                    loopAgain = true;
                }
                else if (reader.Name == bag.FileType_ParamName)
                {
                    bag.FileType = UnpersistFileType(reader);
                    ctr++;
                    loopAgain = true;
                }
                else
                    loopAgain = false;
            } while (loopAgain && (ctr < (bag.Count + 1)));  // get out after each

            if (reader.IsStartElement() && !reader.IsEmptyElement)
            {
                reader.Read();
            }
        }
コード例 #8
0
ファイル: ParamBagPersister.cs プロジェクト: BgRva/Blob1
 public override void PersistBag(IParamBag target, System.Xml.XmlWriter writer)
 {
     IExportNetworkParamBag bag = (IExportNetworkParamBag)target;
     if (bag.FileName != bag.FileNameDefault)
     {
         writer.WriteElementString(bag.FileName_ParamName, bag.FileName);
     }
     if (bag.ExportNodeAttributes != bag.ExportNodeAttributesDefault)
     {
         writer.WriteElementString(bag.ExportNodeAttributes_ParamName, XmlConvert.ToString(bag.ExportNodeAttributes));
     }
     if (bag.ExportEdgeAttributes != bag.ExportEdgeAttributesDefault)
     {
         writer.WriteElementString(bag.ExportEdgeAttributes_ParamName, XmlConvert.ToString(bag.ExportEdgeAttributes));
     }
     if (bag.FileType != bag.FileTypeDefault)
     {
         writer.WriteElementString(bag.FileType_ParamName, bag.FileType.ToString());
     }
 }
コード例 #9
0
ファイル: BaseParamBagUnpersist.cs プロジェクト: BgRva/Blob1
 /// <summary>
 /// This method should be overriden by the inheriting class. This method is responsible 
 /// for un-persisting each paramerter in the <paramref name="target"/>
 /// bag.  It is assumed that <paramref name="target"/> is appropriate Type for this element.
 /// </summary>
 /// <param name="target">The IParamBag object to which the parameters will be un-persisted.</param>
 /// <param name="reader">The XmlReader from which the parameter values are un-persisted.</param>
 public virtual void UnpersistBag(IParamBag target, System.Xml.XmlReader reader)
 {
     // do nothing
 }
コード例 #10
0
 public NetworkPropertiesElementParamMgr(IParamBag bag, IParamVarMapper varMap)
     : base(Guid.Empty, bag, varMap)
 {
 }
コード例 #11
0
 public NetworkPropertiesElementParamMgr(Guid id, IParamBag bag, IParamVarMapper varMap)
     : base(id, bag, varMap)
 {
     Bag = bag;
     ParamVarMapper = varMap;
 }
コード例 #12
0
ファイル: BaseParamBagPersist.cs プロジェクト: BgRva/Blob1
 /// <summary>
 /// This method should be overriden by the inheriting class. This method is responsible 
 /// for persisting each paramerter in the <paramref name="target"/>
 /// bag.  It is assumed that <paramref name="target"/> is appropriate Type for this element.
 /// </summary>
 /// <param name="target">The IParamBag object for which the parameters will be persisted.</param>
 /// <param name="writer">The XmlWriter to which the parameter values are persisted.</param>
 public virtual void PersistBag(IParamBag target, System.Xml.XmlWriter writer)
 {
     // do nothing
 }
コード例 #13
0
ファイル: BaseParamMgr.cs プロジェクト: BgRva/Blob1
 public BaseParamMgr(IParamBag bag, IParamVarMapper varMap)
     : this(Guid.Empty, bag, varMap)
 {
 }
コード例 #14
0
ファイル: BaseParamMgr.cs プロジェクト: BgRva/Blob1
 public BaseParamMgr(Guid id, IParamBag bag, IParamVarMapper varMap)
 {
     Id = id;
     Bag = bag;
     ParamVarMapper = varMap;
 }
コード例 #15
0
ファイル: ExportNetworkParamMgr.cs プロジェクト: BgRva/Blob1
 public ExportNetworkParamMgr(Guid id, IParamBag bag, IParamVarMapper varMap)
     : base(id)
 {
     Bag = bag;
     ParamVarMapper = varMap;
 }