Exemple #1
0
        public override Metadata Clone()
        {
            var clone = new ComponentTemplateMetadata();

            clone.CopyFrom(this);
            return(clone);
        }
        public Benchmark(ExperimentInfo experimentInfo, ComponentTemplateMetadata componentTemplate)
        {
            if (experimentInfo == null)
                throw new ArgumentNullException("benchmarkInfo");
            if (String.IsNullOrEmpty(experimentInfo.FilePath))
                throw new ArgumentException("Benchmark file path cannot be null or empty.");
            if (componentTemplate == null)
                throw new ArgumentNullException("componentTemplate");

            BenchmarkInfo = new BenchmarkInfo(experimentInfo);
            ComponentTemplate = componentTemplate;
            IsOnlineContest = false;
        }
Exemple #3
0
        protected override void CopyFrom(Metadata other)
        {
            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            base.CopyFrom(other);

            ComponentTemplateMetadata metadata = (ComponentTemplateMetadata)other;

            m_IOSpec = metadata.m_IOSpec.Clone();

            HasDeserializationError = metadata.HasDeserializationError;
            if (HasDeserializationError)
            {
                DeserializationErrorMessage = metadata.DeserializationErrorMessage;
            }
        }
        private static ComponentTemplateMetadata FindTemplateComponentMetadata(XPathNavigator nav)
        {
            ComponentTemplateMetadata template = null;

            //search for all references for template components metadata
            string templateType = typeof(ComponentTemplateMetadata).ToString();
            XPathExpression expression = nav.Compile("//Metadata[starts-with(@type, '" + templateType + "')]");
            XPathNavigator templateXmlNode = nav.SelectSingleNode(expression);

            if (templateXmlNode != null)
            {
                string label = templateXmlNode.GetAttribute("Label", String.Empty);
                IOSpec ioSpec = new IOSpec();
                XPathNavigator ioSpecNav = templateXmlNode.SelectSingleNode("IOSpec");
                ioSpec.ReadXml(ioSpecNav.ReadSubtree());

                template = new ComponentTemplateMetadata(ioSpec, label);
            }
            return template;
        }
 public override Metadata Clone()
 {
     var clone = new ComponentTemplateMetadata();
     clone.CopyFrom(this);
     return clone;
 }