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


C# Shape.Freeze方法代码示例

本文整理汇总了C#中Shape.Freeze方法的典型用法代码示例。如果您正苦于以下问题:C# Shape.Freeze方法的具体用法?C# Shape.Freeze怎么用?C# Shape.Freeze使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shape的用法示例。


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

示例1: Segments

 public Segments(CharacterDefinitionTable table, string representation, Shape shape)
 {
     _representation = representation;
     _table = table;
     _shape = shape;
     _shape.Freeze();
 }
开发者ID:sillsdev,项目名称:hermitcrab,代码行数:7,代码来源:Segments.cs

示例2: Segmenter

        public Segmenter(SpanFactory<ShapeNode> spanFactory)
        {
            _spanFactory = spanFactory;
            _vowels = new SymbolCollection();
            _vowels.CollectionChanged += SymbolCollectionChanged;
            _consonants = new SymbolCollection();
            _consonants.CollectionChanged += SymbolCollectionChanged;
            _modifiers = new SymbolCollection();
            _modifiers.CollectionChanged += SymbolCollectionChanged;
            _joiners = new SymbolCollection();
            _joiners.CollectionChanged += SymbolCollectionChanged;
            _toneLetters = new SymbolCollection();
            _toneLetters.CollectionChanged += SymbolCollectionChanged;
            _boundaries = new SymbolCollection();
            _boundaries.CollectionChanged += SymbolCollectionChanged;

            _emptyShape = new Shape(_spanFactory, begin => new ShapeNode(_spanFactory, FeatureStruct.New().Symbol(CogFeatureSystem.AnchorType).Feature(CogFeatureSystem.StrRep).EqualTo("#").Value));
            _emptyShape.Freeze();
        }
开发者ID:rmunn,项目名称:cog,代码行数:19,代码来源:Segmenter.cs

示例3: TrySegment

        public bool TrySegment(string str, out Shape shape)
        {
            if (string.IsNullOrEmpty(str))
            {
                shape = _emptyShape;
                return true;
            }

            shape = new Shape(_spanFactory, begin => new ShapeNode(_spanFactory, FeatureStruct.New().Symbol(CogFeatureSystem.AnchorType).Feature(CogFeatureSystem.StrRep).EqualTo("#").Value));

            if (SegmentString(shape, str))
            {
                shape.Freeze();
                return true;
            }

            shape = null;
            return false;
        }
开发者ID:rmunn,项目名称:cog,代码行数:19,代码来源:Segmenter.cs

示例4: Segment

        public void Segment(Word word)
        {
            if (string.IsNullOrEmpty(word.StrRep))
            {
                word.Shape = _emptyShape;
                return;
            }

            var shape = new Shape(_spanFactory, begin => new ShapeNode(_spanFactory, FeatureStruct.New().Symbol(CogFeatureSystem.AnchorType).Feature(CogFeatureSystem.StrRep).EqualTo("#").Value));

            string prefix = word.StrRep.Substring(0, word.StemIndex);
            ShapeNode start = shape.Begin;
            if (!string.IsNullOrEmpty(prefix))
            {
                if (SegmentString(shape, prefix))
                {
                    shape.Annotations.Add(start.Next, shape.Last, FeatureStruct.New().Symbol(CogFeatureSystem.PrefixType).Value);
                    start = shape.Last;
                }
                else
                {
                    word.Shape = _emptyShape;
                    return;
                }
            }

            string stem = word.StrRep.Substring(word.StemIndex, word.StemLength);
            if (SegmentString(shape, stem))
            {
                shape.Annotations.Add(start.Next, shape.Last, FeatureStruct.New().Symbol(CogFeatureSystem.StemType).Value);
                start = shape.Last;
            }
            else
            {
                word.Shape = _emptyShape;
                return;
            }

            string suffix = word.StrRep.Substring(word.StemIndex + word.StemLength);
            if (!string.IsNullOrEmpty(suffix))
            {
                if (SegmentString(shape, suffix))
                {
                    shape.Annotations.Add(start.Next, shape.Last, FeatureStruct.New().Symbol(CogFeatureSystem.SuffixType).Value);
                }
                else
                {
                    word.Shape = _emptyShape;
                    return;
                }
            }

            shape.Freeze();
            word.Shape = shape;
        }
开发者ID:rmunn,项目名称:cog,代码行数:55,代码来源:Segmenter.cs


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