Exemplo n.º 1
0
        /**
         * subElement.getName_propertyName
         * @see uk.ac.ebi.pride.jmztab.model.MetadataSubElement#getName()
         */
        public static MetadataProperty FindProperty(MetadataSubElement subElement, string propertyName)
        {
            if (subElement == null || propertyName == null){
                return null;
            }

            MetadataProperty property = null;
            try{
                if (All.Any(x => x.SubElement != null)){
                    property =
                        All.FirstOrDefault(
                            x =>
                            x.SubElement != null && x.SubElement.Name.Equals(subElement.Name) &&
                            x.Name.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
                }
            }
            catch (ArgumentNullException){
                property = null;
            }
            catch (InvalidOperationException){
                property = null;
            }
            return property;
        }
Exemplo n.º 2
0
 private MetadataProperty(MetadataElement element, string name)
 {
     _element = element;
     _subElement = null;
     _name = name;
 }
Exemplo n.º 3
0
 private MetadataProperty(MetadataSubElement subElement, string name)
 {
     _element = subElement.Element;
     _subElement = subElement;
     _name = name;
 }
Exemplo n.º 4
0
        private MetadataProperty checkProperty(MetadataSubElement subElement, string propertyName)
        {
            if (string.IsNullOrEmpty(propertyName)){
                return null;
            }

            MetadataProperty property = MetadataProperty.FindProperty(subElement, propertyName);
            if (property == null){
                MZTabError error = new MZTabError(FormatErrorType.MTDDefineLabel, _lineNumber,
                                                  subElement.Name + "-" + propertyName);
                throw new MZTabException(error);
            }

            return property;
        }