示例#1
0
        public static void Compare(IFacet facet1, IFacet facet2, string specName)
        {
            Compare(facet1.Specification.Identifier, facet2.Specification.Identifier, specName);
            Compare(facet1.FacetType, facet2.FacetType, specName);
            Compare(facet1.GetType(), facet2.GetType(), specName);
            Compare(facet1.IsNoOp, facet2.IsNoOp, specName);
            Compare(facet1.CanAlwaysReplace, facet2.CanAlwaysReplace, specName);

            CompareReflectively(facet1, facet2, facet1.GetType() + " : " + specName);
        }
示例#2
0
        void setFacet()
        {
            int   n = facet.ParametersCount;
            Panel p = panelMaterialParameters;

            p.Controls.Clear();
            facetCombo.Clear();
            int y = 20;

            for (int i = 0; i < n; i++)
            {
                Label  l    = new Label();
                object type = facet.GetType(i);
                string tn   = " (" + Measurement.GetTypeName(type) + ")";
                l.Text  = ResourceService.Resources.GetControlResource("Parameter", Motion6D.UI.Utils.ControlUtilites.Resources) + " " + (i + 1) + tn;
                l.Left  = 10;
                l.Top   = y;
                l.Width = 400;
                p.Controls.Add(l);
                ComboBox cb = new ComboBox();
                facetCombo.Add(cb);
                cb.Top   = l.Bottom + 5;
                cb.Left  = l.Left + 50;
                cb.Width = p.Width - cb.Left - 20;
                p.Controls.Add(cb);
                IList <string> list = consumer.GetAliases(type);
                cb.FillCombo(list);
                y = cb.Bottom + 5;
            }
            fillFacet();
        }
        static JToken Build(IFacet facet)
        {
            if (facet is StatisticalFacet)
            {
                return(Build((StatisticalFacet)facet));
            }

            if (facet is TermsStatsFacet)
            {
                return(Build((TermsStatsFacet)facet));
            }

            if (facet is TermsFacet)
            {
                return(Build((TermsFacet)facet));
            }

            if (facet is FilterFacet)
            {
                return(new JObject());
            }

            throw new InvalidOperationException(
                      $"Unknown implementation of IFacet '{facet.GetType().Name}' can not be formatted");
        }
示例#4
0
        public static string OrderString(this IFacet facet)
        {
            if (facet == null)
            {
                return("");
            }

            if (facet is ActionInvocationFacetViaMethod)
            {
                var f = (ActionInvocationFacetViaMethod)facet;
                return($"{f.GetType()}/{f.ActionMethod.Name}/{f.ActionMethod.DeclaringType?.FullName}");
            }

            if (facet.GetType() == typeof(INamedFacet))
            {
                var f = (INamedFacet)facet;
                return($"{f.GetType()}/{f.NaturalName}");
            }


            return(facet.GetType().ToString());
        }
        static JToken Build(IFacet facet)
        {
            if (facet is StatisticalFacet)
                return Build((StatisticalFacet)facet);

            if (facet is TermsStatsFacet)
                return Build((TermsStatsFacet)facet);

            if (facet is TermsFacet)
                return Build((TermsFacet)facet);

            if (facet is FilterFacet)
                return new JObject();

            throw new InvalidOperationException(string.Format("Unknown implementation of IFacet '{0}' can not be formatted", facet.GetType().Name));
        }
        protected JToken Build(IFacet facet)
        {
            if (facet == null)
            {
                throw new ArgumentNullException("facet", "Facet must be referenced.");
            }

            throw new NotImplementedException(string.Format("The given facet is not managed by this builder, type: {0}", facet.GetType().FullName));
        }
 public bool Accept(IFacet facet) {
     return superClass.IsAssignableFrom(facet.GetType());
 }