/// <summary> /// Create property objects according to string properties /// </summary> public PropertyFactory(StringProperties properties, UnicodeRangeDatabase unicodeDb, UnicodeRange expectedRange) { bidiProperty = null; combiningMarksProperty = null; eudcProperty = null; lineBreakProperty = null; numberProperty = null; surrogatePairProperty = null; textNormalizationProperty = null; textSegmentationProperty = null; minNumOfCodePoint = 0; propertyDictionary = new Dictionary <PropertyFactory.PropertyName, IStringProperty>(); CreateProperties(properties, unicodeDb, expectedRange); }
private void CreateProperties(StringProperties properties, UnicodeRangeDatabase unicodeDb, UnicodeRange expectedRange) { if (null != properties.HasNumbers) { if ((bool)properties.HasNumbers) { numberProperty = new NumberProperty(unicodeDb, expectedRange); minNumOfCodePoint += NumberProperty.MINNUMOFCODEPOINT; propertyDictionary.Add(PropertyName.Number, numberProperty); } } if (null != properties.IsBidirectional) { if ((bool)properties.IsBidirectional) { bidiProperty = new BidiProperty(unicodeDb, expectedRange); minNumOfCodePoint += BidiProperty.MINNUMOFCODEPOINT; propertyDictionary.Add(PropertyName.Bidi, bidiProperty); } } if (null != properties.NormalizationForm) { textNormalizationProperty = new TextNormalizationProperty(unicodeDb, expectedRange); minNumOfCodePoint += TextNormalizationProperty.MINNUMOFCODEPOINT; propertyDictionary.Add(PropertyName.TextNormalization, textNormalizationProperty); } if (null != properties.MinNumberOfCombiningMarks) { if (0 != properties.MinNumberOfCombiningMarks) { combiningMarksProperty = new CombiningMarksProperty(unicodeDb, expectedRange); minNumOfCodePoint += CombiningMarksProperty.MINNUMOFCODEPOINT * (int)properties.MinNumberOfCombiningMarks; propertyDictionary.Add(PropertyName.CombiningMarks, combiningMarksProperty); } } if (null != properties.MinNumberOfEndUserDefinedCodePoints) { if (0 != properties.MinNumberOfEndUserDefinedCodePoints) { eudcProperty = new EudcProperty(unicodeDb, expectedRange); minNumOfCodePoint += EudcProperty.MINNUMOFCODEPOINT * (int)properties.MinNumberOfEndUserDefinedCodePoints; propertyDictionary.Add(PropertyName.Eudc, eudcProperty); } } if (null != properties.MinNumberOfLineBreaks) { if (0 != properties.MinNumberOfLineBreaks) { lineBreakProperty = new LineBreakProperty(expectedRange); minNumOfCodePoint += LineBreakProperty.MINNUMOFCODEPOINT * (int)properties.MinNumberOfLineBreaks; propertyDictionary.Add(PropertyName.LineBreak, lineBreakProperty); } } if (null != properties.MinNumberOfSurrogatePairs) { if (0 != properties.MinNumberOfSurrogatePairs) { surrogatePairProperty = new SurrogatePairProperty(unicodeDb, expectedRange); minNumOfCodePoint += SurrogatePairProperty.MINNUMOFCODEPOINT * (int)properties.MinNumberOfSurrogatePairs; propertyDictionary.Add(PropertyName.Surrogate, surrogatePairProperty); } } if (null != properties.MinNumberOfTextSegmentationCodePoints) { if (0 != properties.MinNumberOfTextSegmentationCodePoints) { textSegmentationProperty = new TextSegmentationProperty(unicodeDb, expectedRange); minNumOfCodePoint += TextSegmentationProperty.MINNUMOFCODEPOINT * (int)properties.MinNumberOfTextSegmentationCodePoints; propertyDictionary.Add(PropertyName.TextSegmentation, textSegmentationProperty); } } }