Пример #1
0
 public Flowsheet AddDocumentation(DocumentationElement unit)
 {
     if (!Documentation.Contains(unit))
     {
         Documentation.Add(unit);
     }
     else
     {
         throw new InvalidOperationException("Documentation " + unit.Name + " already included in flowsheet");
     }
     return(this);
 }
Пример #2
0
 public override SummaryDocumentationElement GetSummary(AssemblyDeclaration assembly)
 => DocumentationElement.Summary(
     DocumentationElement.Paragraph(
         DocumentationElement.Text(
             assembly
             .Attributes
             .Single(attribute => attribute.Type == typeof(AssemblyDescriptionAttribute))
             .PositionalParameters
             .Single()
             .Value
             .ToString()
             )
         )
     );
Пример #3
0
 public override RemarksDocumentationElement GetRemarks(AssemblyDeclaration assembly)
 => DocumentationElement.Remarks(
     DocumentationElement.Paragraph(
         DocumentationElement.Text("The library has a few core types that make it work: "),
         DocumentationElement.Hyperlink("Mup.IMarkupParser.html", "IMarkupParser"),
         DocumentationElement.Text(" "),
         DocumentationElement.Hyperlink("Mup.Elements.ParseTreeRootElement.html", "ParseTreeRootElement"),
         DocumentationElement.Text(" and "),
         DocumentationElement.Hyperlink("Mup.ParseTreeVisitor.html", "ParseTreeVisitor"),
         DocumentationElement.Text(".")
         ),
     DocumentationElement.Paragraph(
         DocumentationElement.Text("Each parser (currently just Creole) implements the IMarkupParser interface which exposes a number of methods that allow parsing a "),
         DocumentationElement.Hyperlink("https://docs.microsoft.com/dotnet/api/system.string?view=netstandard-1.0", "string"),
         DocumentationElement.Text(" or text from a "),
         DocumentationElement.Hyperlink("https://docs.microsoft.com/dotnet/api/system.io.textreader?view=netstandard-1.0", "TextReader"),
         DocumentationElement.Text(". Each parser supports both synchronous and asynchronous models allowing its users to consume the API any way they want.")
         ),
     DocumentationElement.Paragraph(
         DocumentationElement.Text("The result of any parse method is ultimately a "),
         DocumentationElement.Hyperlink("Mup.Elements.ParseTreeRootElement.html", "ParseTreeRootElement"),
         DocumentationElement.Text(". Surprisingly or not, this interface does not expose something like a root node or anything related to what one would expect when seeing the word \"tree\".")
         ),
     DocumentationElement.Paragraph(
         DocumentationElement.Text("This is because trees can have different representations. For instance, we can have the usual example where we have a root node which exposes a property containing a number of nodes that are in fact child nodes, each child node also exposes such a property that contains their child nodes and so on. A different representation can be a flat one where the entire tree is stored as a list of elements that mark the beginning and end of each node.")
         ),
     DocumentationElement.Paragraph(
         DocumentationElement.Text("Regardless of how we represent a parse tree, we need to be able to traverse it in order to generate a specific output, say HTML. This is where a "),
         DocumentationElement.Hyperlink("Mup.ParseTreeVisitor.html", "ParseTreeVisitor"),
         DocumentationElement.Text(" comes into play. Any "),
         DocumentationElement.Hyperlink("Mup.Elements.ParseTreeRootElement.html", "ParseTreeRootElement"),
         DocumentationElement.Text(" exposes methods that accept a "),
         DocumentationElement.Hyperlink("Mup.ParseTreeVisitor.html", "ParseTreeVisitor"),
         DocumentationElement.Text(", the entire logic for traversing the tree is encapsulated inside itself. Each time a node is being visited, a specific method for that node is called on the visitor. This helps keep the interface clean and completely decouple the language that is being parsed from the desired output format. Any new markup parser will work with existing visitors and any new visitor will work with any existing parser.")
         ),
     DocumentationElement.Paragraph(
         DocumentationElement.Text("The one common rule for all parse trees is that they are all traversed in pre-order (see "),
         DocumentationElement.Hyperlink("https://en.wikipedia.org/wiki/Tree_traversal", "Tree Traversal (Wikipedia)"),
         DocumentationElement.Text(" for more about this topic).")
         )
     );
Пример #4
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as ParameterDefinition;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (NameElement != null)
            {
                dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopy();
            }
            if (UseElement != null)
            {
                dest.UseElement = (Code <Hl7.Fhir.Model.OperationParameterUse>)UseElement.DeepCopy();
            }
            if (MinElement != null)
            {
                dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopy();
            }
            if (MaxElement != null)
            {
                dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopy();
            }
            if (DocumentationElement != null)
            {
                dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopy();
            }
            if (TypeElement != null)
            {
                dest.TypeElement = (Code <Hl7.Fhir.Model.FHIRAllTypes>)TypeElement.DeepCopy();
            }
            if (ProfileElement != null)
            {
                dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopy();
            }
            return(dest);
        }
Пример #5
0
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as ResourceComponent;

                if (dest == null)
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }

                base.CopyTo(dest);
                if (CodeElement != null)
                {
                    dest.CodeElement = (Code <Hl7.Fhir.Model.ResourceType>)CodeElement.DeepCopy();
                }
                if (ParamElement != null)
                {
                    dest.ParamElement = new List <Hl7.Fhir.Model.FhirString>(ParamElement.DeepCopy());
                }
                if (DocumentationElement != null)
                {
                    dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopy();
                }
                return(dest);
            }
Пример #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="reader"></param>
 /// <returns></returns>
 private void HandleDocumentationElement(XmlReader reader)
 {
     Documentation = new DocumentationElement(this);
     Documentation.Parse(reader);
 }
Пример #7
0
 public override SummaryDocumentationElement GetSummary(NamespaceDeclaration @namespace)
 => DocumentationElement.Summary(
     DocumentationElement.Paragraph(
         DocumentationElement.Text("Contains the base Mup types and implemented parsers.")
         )
     );
Пример #8
0
        public static VisualUnit Create(DocumentationElement element, FlowsheetIcon icon)
        {
            switch (icon.IconType)
            {
            case IconTypes.Text:
            {
                var newItem = new VisualUnit();
                newItem.Name        = "Label01";
                newItem.Type        = "Text";
                newItem.X           = icon.X;
                newItem.Y           = icon.Y;
                newItem.Height      = icon.Height;
                newItem.Width       = icon.Width;
                newItem.DisplayIcon = IconTypes.Text;
                newItem.FillColor   = icon.FillColor;
                newItem.BorderColor = icon.BorderColor;
                newItem.Model       = element;
                return(newItem);
            }

            case IconTypes.StreamTable:
            {
                var newItem = new VisualUnit();
                newItem.Name        = "Table01";
                newItem.Type        = "StreamTable";
                newItem.X           = icon.X;
                newItem.Y           = icon.Y;
                newItem.Height      = icon.Height;
                newItem.Width       = icon.Width;
                newItem.DisplayIcon = IconTypes.StreamTable;
                newItem.FillColor   = icon.FillColor;
                newItem.BorderColor = icon.BorderColor;
                newItem.Model       = element;
                return(newItem);
            }

            case IconTypes.Spreadsheet:
            {
                var newItem = new VisualUnit();
                newItem.Name        = "Sheet01";
                newItem.Type        = "Spreadsheet";
                newItem.X           = icon.X;
                newItem.Y           = icon.Y;
                newItem.Height      = icon.Height;
                newItem.Width       = icon.Width;
                newItem.DisplayIcon = IconTypes.Spreadsheet;
                newItem.FillColor   = icon.FillColor;
                newItem.BorderColor = icon.BorderColor;
                newItem.Model       = element;
                return(newItem);
            }

            default:
            {
                var newItem = new VisualUnit();
                newItem.Name        = "U01";
                newItem.X           = icon.X;
                newItem.Y           = icon.Y;
                newItem.Height      = 60;
                newItem.Width       = 60;
                newItem.DisplayIcon = IconTypes.Block;
                return(newItem);
            }
            }
        }
Пример #9
0
 protected virtual void WriteElements(XmlWriter writer)
 {
     Extensions.ForEach(x => x.Write(writer));
     DocumentationElement?.WriteTo(writer);
 }
 private static Documentation ConvertToDocumentation(DocumentationElement element)
 {
     return(element.MetadataDocumentation);
 }
 public override SummaryDocumentationElement GetSummary(NamespaceDeclaration @namespace)
 => DocumentationElement.Summary(
     DocumentationElement.Paragraph(
         DocumentationElement.Text("Contains the parse nodes representing a mark-up document.")
         )
     );