当前位置: 首页>>代码示例>>C#>>正文


C# Pattern类代码示例

本文整理汇总了C#中Pattern的典型用法代码示例。如果您正苦于以下问题:C# Pattern类的具体用法?C# Pattern怎么用?C# Pattern使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Pattern类属于命名空间,在下文中一共展示了Pattern类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsosTri90Tess

        /// <summary>
        /// Customize this child
        /// </summary>
        public IsosTri90Tess()
        {
            InitializeComponent();
            double size = 40d;
            double temp = Math.Tan(Math.PI / 4d) * (size / 2);
            Pattern pat = new Pattern(size, temp * 2d, 0);
            List<DoublePoint> tri1 = new List<DoublePoint>();
            List<DoublePoint> tri2 = new List<DoublePoint>();
            List<DoublePoint> tri3 = new List<DoublePoint>();
            List<DoublePoint> tri4 = new List<DoublePoint>();
            addStartZone(new Point(0, 0), new Point((int)size, 0));
            setShapeHeight(temp);

            tri1.Add(new DoublePoint(0, 0));
            tri1.Add(new DoublePoint(size / 2, temp));
            tri1.Add(new DoublePoint(0, temp*2));

            tri2.Add(new DoublePoint(0, 0));
            tri2.Add(new DoublePoint(size, 0));
            tri2.Add(new DoublePoint(size / 2, temp));

            tri3.Add(new DoublePoint(size, temp * 2));
            tri3.Add(new DoublePoint(0, temp * 2));
            tri3.Add(new DoublePoint(size / 2, temp));

            tri4.Add(new DoublePoint(size, temp * 2));
            tri4.Add(new DoublePoint(size, 0));
            tri4.Add(new DoublePoint(size / 2, temp));

            pat.addPattern(tri1);
            pat.addPattern(tri2);
            pat.addPattern(tri3);
            pat.addPattern(tri4);
            setPattern(pat);
        }
开发者ID:jrpavoncello,项目名称:OrbitMapper,代码行数:38,代码来源:IsosTri90Tess.cs

示例2: RectTess

        /// <summary>
        /// Customize this child
        /// </summary>
        public RectTess(double ratio)
        {
            InitializeComponent();

            double patBase = 30;
            // ratioOver1 is used to scale down the rectangle
            double ratioOver1 = ratio - 1;
            if (ratioOver1 > 0)
            {
                // If the ratioOver1 is over 1, the scale down will be much to small, so we will make 1 the max.
                if (ratioOver1 > 1d)
                    ratioOver1 = 1d;
                patBase /= ratioOver1 + 1;
            }
            double heightRatio = ratio;
            double patHeight = patBase * heightRatio;
            double patWidth = patBase;
            addStartZone(new Point(0, 0), new Point((int)patWidth, 0));
            setShapeHeight(patHeight);

            Pattern pat = new Pattern(patWidth, patHeight, 0d);
            List<DoublePoint> tri1 = new List<DoublePoint>();

            tri1.Add(new DoublePoint(0, 0));
            tri1.Add(new DoublePoint(0, patHeight));
            tri1.Add(new DoublePoint(patWidth, patHeight));
            tri1.Add(new DoublePoint(patWidth, 0));

            pat.addPattern(tri1);
            setPattern(pat);
        }
开发者ID:jrpavoncello,项目名称:OrbitMapper,代码行数:34,代码来源:RectTess.cs

示例3: SchematronValidationEventArgs

        /// <summary>
        ///   Creates a new instance of the <see cref="SchematronValidationEventArgs"/>.
        /// </summary>
        /// <param name="schematron">The <see cref="SchematronDocument"/> that detected the event.</param>
        /// <param name="queryEngine">The <see cref="IQueryLanguage"/> that detected the event.</param>
        /// <param name="pattern">The active <see cref="Pattern"/>.</param>
        /// <param name="rule">The <see cref="Sepia.Schematron.Rule"/> that caused the event to be raised.</param>
        /// <param name="assertion">The <see cref="Sepia.Schematron.Assertion"/> that caused the event to be raised.</param>
        /// <param name="context">An <see cref="object"/> that provides the context for the <paramref name="rule"/> and <paramref name="assertion"/>.</param>
        /// <param name="instance">An <see cref="XPathNavigator"/> to the document node that cause the event to be raised.</param>
        public SchematronValidationEventArgs(SchematronDocument schematron, IQueryLanguage queryEngine, Pattern pattern, Rule rule, Assertion assertion, object context, XPathNavigator instance)
        {
            this.schematron = schematron;
             this.queryEngine = queryEngine;
             this.pattern = pattern;
             this.rule = rule;
             this.assertion = assertion;
             this.instance = instance.Clone();

             if (assertion == null)
             {
            message = "A schematron validation event occured.";
             }
             else
             {
            message = assertion.Message.ToString(instance, context);
             }

             List<string> diagnostics = new List<string>();
             if (assertion != null && !string.IsNullOrEmpty(assertion.Diagnostics))
             {
            foreach (string id in assertion.Diagnostics.Split(' '))
            {
               Diagnostic diagnostic = schematron.Diagnostics[id];
               diagnostics.Add(diagnostic.Message.ToString(instance, context));
            }
             }
             this.diagnostics = diagnostics.ToArray();
        }
开发者ID:richardschneider,项目名称:sepia,代码行数:39,代码来源:ValidationFramework.cs

示例4: MatchResult

 public MatchResult(Pattern pattern, int x, int y, E_BlockType type)
 {
     this.pattern = pattern;
     this.x = x;
     this.y = y;
     this.type = type;
 }
开发者ID:pb0,项目名称:ID0_Test,代码行数:7,代码来源:Solver.cs

示例5: PlayTact

 public static void PlayTact(Note root, Pattern pattern, OutputDevice outputDevice)
 {
     PlayAccord(root, pattern, Direction.Down, outputDevice);
     Thread.Sleep(400);
     PlayAccord(root, pattern, Direction.Down, outputDevice);
     Thread.Sleep(150);
     PlayAccord(root, pattern, Direction.Up, outputDevice);
     Thread.Sleep(400);
     PlayAccord(root, pattern, Direction.Up, outputDevice);
     Thread.Sleep(200);
     PlayAccord(root, pattern, Direction.Down, outputDevice);
     Thread.Sleep(150);
     PlayAccord(root, pattern, Direction.Up, outputDevice);
     Thread.Sleep(200);
     PlayAccord(root, pattern, Direction.Down, outputDevice);
     Thread.Sleep(400);
     PlayAccord(root, pattern, Direction.Down, outputDevice);
     Thread.Sleep(150);
     PlayAccord(root, pattern, Direction.Up, outputDevice);
     Thread.Sleep(400);
     PlayAccord(root, pattern, Direction.Up, outputDevice);
     Thread.Sleep(200);
     PlayAccord(root, pattern, Direction.Down, outputDevice);
     //Thread.Sleep(150);
     //PlayAccord(root, pattern, Direction.Up, outputDevice);
     Thread.Sleep(400);
 }
开发者ID:Robertorob,项目名称:GuitarMaster,代码行数:27,代码来源:Accompaniment.cs

示例6: GeneratePattern

    private void GeneratePattern()
    {
        Pattern pattern = new Pattern();

        int count = Random.Range(GameController.instance.minPatternSize_, GameController.instance.maxPatternSize_ + 1);

        var node = nodes_.Last;
        for (int index = Random.Range(0, nodes_.Count); index > 0; --index, node = node.Previous) ;

        node.Value.isActive = false;
        pattern.pattern.AddLast(node.Value);

        for (int i = 0; i < count; ++i) {
            LinkedList<PatternNode> adjacentNodes = node.Value.GetActiveAdjacentNodes();

            if (adjacentNodes.Count < 0) {
                break;
            }

            var adjacentNode = adjacentNodes.Last;
            for (int index = Random.Range(0, adjacentNodes.Count); index > 0; --index, adjacentNode = adjacentNode.Previous) ;

            pattern.pattern.AddLast(adjacentNode.Value);
            node = nodes_.Find(adjacentNode.Value);
            node.Value.isActive = false;
        }

        GameController.instance.RegisterPattern(pattern);
        for (node = nodes_.First; node != null; node.Value.isActive = true, node = node.Next) ;
    }
开发者ID:mpmitchell,项目名称:JamToday2015,代码行数:30,代码来源:PatternGenerator.cs

示例7: DragAndDrop

 /// <summary>
 /// This Method Performs Drag and Drop an element from scrolllist to Workfield by Sikuli4net
 /// </summary>
 /// <param name="scrollElement">Scroll Element class</param>
 public void DragAndDrop(ScrollElement scrollElement)
 {
     Pattern pattern_Drag = new Pattern(Configuration.PathToImgs()+scrollElement.GetImageDragPatern());
     Pattern pattern_Drop = new Pattern(Configuration.PathToImgs() + "wrk.png",0.5f);
     Screen scrn = new Screen();
     scrn.DragDrop(pattern_Drag,pattern_Drop);
 }
开发者ID:MixolydianBY,项目名称:AutomationDemo,代码行数:11,代码来源:MainForm.cs

示例8: Init

        public override void Init(ParsingContext context, ParseTreeNode parseNode)
        {
            base.Init(context, parseNode);

            foreach (var node in parseNode.ChildNodes)
            {
                if (node.AstNode is Pattern)
                {
                    Pattern = node.AstNode as Pattern;
                }
                else if (node.AstNode is AuxiliaryNode)
                {
                    var nodes = (node.AstNode as AuxiliaryNode).ChildNodes;
                    Conditions = nodes.OfType<Conditions>().FirstOrDefault();
                    Expression = nodes.OfType<Expression>().FirstOrDefault();
                }
            }

            foreach (var astNode in new AstNode[] { Pattern, Conditions, Expression })
            {
                if (astNode != null)
                {
                    astNode.Parent = this;
                }
            }

            AsString = "match";
        }
开发者ID:MarcusTheBold,项目名称:Irony,代码行数:28,代码来源:Sentence.cs

示例9: Captcha

 public Captcha(int pattern, int leftOperand, int operatorValue, int rightOperand)
 {
     this.leftOperand = leftOperand;
     this.rightOperand = rightOperand;
     this.operatorValue = operatorValue;
     this.pattern = (Pattern)pattern;
 }
开发者ID:wirachai,项目名称:CaptchaService,代码行数:7,代码来源:Captcha.cs

示例10: ParseMatcher

        public static Pattern ParseMatcher(string feature, bool applyToMembers)
        {
            Match m = Parser.Match(feature);
            if (!m.Success)
            {
                DLog.Warning(DContext.CompilerStart, "pattern parsing error :" + feature);
                return null;
            }

            Pattern match = new Pattern();
            if (m.Groups[1].Success) match.TypeMatcher = m.Groups[1].Value;
            if (m.Groups[2].Success) match.TypeInheritanceKeyword = m.Groups[2].Value;
            if (m.Groups[3].Success) match.TypeInheritanceName = m.Groups[3].Value;
            if (m.Groups[4].Success) match.MemberMatcher = m.Groups[4].Value;
            if (m.Groups[5].Success) match.MembersPublicOnly = true;
            if (m.Groups[6].Success) match.Attributes.Add(m.Groups[6].Value);
            if (m.Groups[7].Success)
                foreach (Capture cap in m.Groups[7].Captures)
                    match.Attributes.Add(cap.Value);

            match.ApplyToMembers = applyToMembers;

            if (match.TypeMatcher == null && match.MemberMatcher == null)
            {
                DLog.Warning(DContext.CompilerStart, "either type or member matcher should be specified: " + feature);
                return match;
            }
            return match;
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:29,代码来源:PatternParser.cs

示例11: Main

        public static void Main(string[] args)
        {
            string inputname = args[0];
            string outputname = args[1];

            string[] lines = File.ReadAllLines(inputname);

            int ncases = int.Parse(lines[0]);
            int nline = 0;
            IList<string> results = new List<string>();

            for (int k = 0; k < ncases; k++)
            {
                Console.WriteLine(string.Format("Solving Case #{0}", k + 1));
                nline++;
                string[] numbers = lines[nline].Split(' ');
                int height = int.Parse(numbers[0]);
                int width = int.Parse(numbers[1]);
                Pattern pattern = new Pattern(width, height);

                for (int j = 0; j < height; j++)
                {
                    nline++;
                    pattern.SetRow(j, lines[nline]);
                    Console.WriteLine(lines[nline]);
                }

                results.Add(string.Format("Case #{0}: {1}", k+1, pattern.HasSolution() ? "YES" : "NO"));
            }

            File.WriteAllLines(outputname, results.ToArray());
        }
开发者ID:ajlopez,项目名称:TddRocks,代码行数:32,代码来源:Program.cs

示例12: CreateEnvironmentPattern

 private static Pattern<Word, ShapeNode> CreateEnvironmentPattern(Pattern<Word, ShapeNode> env)
 {
     Pattern<Word, ShapeNode> pattern = null;
     if (!env.IsEmpty)
         pattern = new Pattern<Word, ShapeNode>(env.Children.DeepCloneExceptBoundaries());
     return pattern;
 }
开发者ID:sillsdev,项目名称:hermitcrab,代码行数:7,代码来源:AnalysisRewriteSubruleSpec.cs

示例13: SynthesisRewriteRuleSpec

        public SynthesisRewriteRuleSpec(SpanFactory<ShapeNode> spanFactory, MatcherSettings<ShapeNode> matcherSettings, bool isIterative, Pattern<Word, ShapeNode> lhs,
			IEnumerable<RewriteSubrule> subrules)
            : base(lhs.IsEmpty)
        {
            Pattern.Acceptable = match => CheckTarget(match, lhs);

            if (lhs.IsEmpty)
            {
                Pattern.Children.Add(new Constraint<Word, ShapeNode>(FeatureStruct.New().Symbol(HCFeatureSystem.Segment, HCFeatureSystem.Anchor).Value));
            }
            else
            {
                foreach (Constraint<Word, ShapeNode> constraint in lhs.Children.Cast<Constraint<Word, ShapeNode>>())
                {
                    var newConstraint = constraint.DeepClone();
                    if (isIterative)
                        newConstraint.FeatureStruct.AddValue(HCFeatureSystem.Modified, HCFeatureSystem.Clean);
                    Pattern.Children.Add(newConstraint);
                }
            }
            Pattern.Freeze();

            int i = 0;
            foreach (RewriteSubrule subrule in subrules)
            {
                if (lhs.Children.Count == subrule.Rhs.Children.Count)
                    SubruleSpecs.Add(new FeatureSynthesisRewriteSubruleSpec(spanFactory, matcherSettings, isIterative, subrule, i));
                else if (lhs.Children.Count > subrule.Rhs.Children.Count)
                    SubruleSpecs.Add(new NarrowSynthesisRewriteSubruleSpec(spanFactory, matcherSettings, isIterative, lhs.Children.Count, subrule, i));
                else if (lhs.Children.Count == 0)
                    SubruleSpecs.Add(new EpenthesisSynthesisRewriteSubruleSpec(spanFactory, matcherSettings, isIterative, subrule, i));
                i++;
            }
        }
开发者ID:sillsdev,项目名称:hermitcrab,代码行数:34,代码来源:SynthesisRewriteRuleSpec.cs

示例14: Init

    public void Init(string s)
    {
        animation = GetComponent<VillagerAnimation>();
		animation.Init (s);

        skinMaterial = GetComponentInChildren<MeshRenderer>().material;
        origColor = skinMaterial.color;

        // music stuff
        musicToggle = GetComponent<ToggleSuspend>();
        musicPattern = GetComponent<Pattern>();
        SetMusicPattern();
        musicSample = GetComponent<Sampler>();
        SetMusicSample();

		keyboardPosition = transform.localPosition;

        textMesh = GetComponentInChildren<TextMesh>();

        letter = s;
        textMesh.text = s;

		currentState = State.Idle;
		timeSinceLastDanced = Time.time;
    }
开发者ID:tylerjhutchison,项目名称:RitualVillage,代码行数:25,代码来源:Villager.cs

示例15: TwoColumns

 public static Pattern TwoColumns()
 {
     var pattern = new Pattern();
     pattern.WholeColumns.Add(-1);
     pattern.WholeColumns.Add(-2);
     return pattern;
 }
开发者ID:sucineri,项目名称:Battle-Project,代码行数:7,代码来源:Pattern.cs


注:本文中的Pattern类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。