Union() public method

현재 집합과 지정된 배열의 값들을 요소로 가지는 집합의 합집합을 만든다.
public Union ( ) : PascalSet
return PascalSet
コード例 #1
0
        public void Initialize()
        {
            var set = new PascalSet(0, 9);

            _pascalSet1 = set.Union(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
            _pascalSet2 = set.Union(1, 3, 5, 7, 9);
            _pascalSet3 = set.Union(0, 2, 4, 6, 8);
        }
コード例 #2
0
        public void UnionTest()
        {
            var union = _pascalSet2.Union(_pascalSet3);

            Assert.IsTrue(_pascalSet1.IsSubset(union));

            union = _pascalSet2 | _pascalSet3;
            Assert.IsTrue(_pascalSet1.IsSubset(union));

            if (IsDebugEnabled)
            {
                log.Debug(union.ToString());
            }
        }
コード例 #3
0
        public void CharacterCountTest()
        {
            // alphabet 만
            var alphabetSet = new PascalSet('A', 'z'); // asciiSet.Union(chars.ToArray());
            // 모음
            var vowels = alphabetSet.Union('A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u');
            // 자음
            var consonants = vowels.Complement();

            const string contents = "Hey, realweb members. make money please.";

            int contentLength  = contents.Length;
            int vowelCount     = 0;
            int consonantCount = 0;
            int otherCount     = 0;

            for (int i = 0; i < contentLength; i++)
            {
                char c = contents[i];

                if (vowels.ContainsElement(c))
                {
                    vowelCount++;
                }
                else if (consonants.ContainsElement(c))
                {
                    consonantCount++;
                }
                else
                {
                    otherCount++;
                }
            }

            if (IsDebugEnabled)
            {
                log.Debug("Contents: " + contents);
                log.Debug("주어진 문장에는 {0}개의 모음, {1}개의 자음, {2}개의 비 알파벳 문자가 있습니다.", vowelCount, consonantCount, otherCount);
                log.Debug("모음 : " + vowels);
                log.Debug("자음 : " + consonants);
            }
        }
コード例 #4
0
ファイル: PascalSetFixture.cs プロジェクト: debop/NFramework
 public void Initialize() {
     var set = new PascalSet(0, 9);
     _pascalSet1 = set.Union(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
     _pascalSet2 = set.Union(1, 3, 5, 7, 9);
     _pascalSet3 = set.Union(0, 2, 4, 6, 8);
 }
コード例 #5
0
ファイル: PascalSetFixture.cs プロジェクト: debop/NFramework
        public void CharacterCountTest() {
            // alphabet 만
            var alphabetSet = new PascalSet('A', 'z'); // asciiSet.Union(chars.ToArray());
            // 모음
            var vowels = alphabetSet.Union('A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u');
            // 자음
            var consonants = vowels.Complement();

            const string contents = "Hey, realweb members. make money please.";

            int contentLength = contents.Length;
            int vowelCount = 0;
            int consonantCount = 0;
            int otherCount = 0;

            for(int i = 0; i < contentLength; i++) {
                char c = contents[i];

                if(vowels.ContainsElement(c))
                    vowelCount++;
                else if(consonants.ContainsElement(c))
                    consonantCount++;
                else
                    otherCount++;
            }

            if(IsDebugEnabled) {
                log.Debug("Contents: " + contents);
                log.Debug("주어진 문장에는 {0}개의 모음, {1}개의 자음, {2}개의 비 알파벳 문자가 있습니다.", vowelCount, consonantCount, otherCount);
                log.Debug("모음 : " + vowels);
                log.Debug("자음 : " + consonants);
            }
        }