コード例 #1
0
        public void beforTest()
        {
            ARelation r3 = new ComplexRelation();
            ARelation r4 = new ComplexRelation(Relator.Binary.AND);
            ARelation r5 = new ComplexRelation(r4);
            ARelation r6 = new ComplexRelation(Relator.Binary.AND, r4);

            rArray = new ARelation[4] { r3, r4, r5, r6 };
        }
コード例 #2
0
        public void beforTest()
        {
            ARelation r5 = new Between_Int(1, 2, "a", "b");
            ARelation r6 = new Between_String("a", "b", "c", "d");
            ARelation r3 = new IntSearch(1234, "a", "b");
            ARelation r4 = new EndingAttributeSearch(Ending.Attribute.Cold, "a", "b");
            ARelation r1 = new StringSearch("a", "b", "c");
            ARelation r2 = new ComplexRelation();

            rArray = new ARelation[4] { r1, r2, r3, r4 };
        }
コード例 #3
0
ファイル: SearchTask.cs プロジェクト: bjornebjornson/Gema2008
        /// <summary>
        /// Aetzend!
        /// </summary>
        /// <param name="job"></param>
        /// <returns></returns>
        /// <remarks>
        /// Wozu diese Konvertierung? Davon abgesehen das ARelation lange vor(!) ISearchItemDto da war...
        /// </remarks>
        public ARelation job2Relation(ISearchJobDto job)
        {
            ComplexRelation relation = new ComplexRelation(job.BinaryRelator);

            foreach(ASearchItemDto item in job.SearchItemList) {
                if(item.HasNoSearchPhrase) { continue; }

                if( item is SearchItem_Between_Dto)
                    relation.addRelata(this.convert(item as SearchItem_Between_Dto));
                else
                    relation.addRelata(this.convert(item as SearchItem_Like_Dto));
            }
            return relation;
        }
コード例 #4
0
        /// @todo Naming.
        public static ComplexRelation combine(Relator.Binary binaryRelator, ASimpleRelation s1, ASimpleRelation s2)
        {
            Check.Require(s1 != null && s2 != null, "No null arguments!");

            ComplexRelation s1_s2;

            if(binaryRelator == Relator.Binary.AND)
                s1_s2 = new ComplexRelation();
            else
                s1_s2 = new ComplexRelation(Relator.Binary.OR);

            s1_s2.addRelata(s1, s2);

            return s1_s2;
        }
コード例 #5
0
        public void runBeforTest()
        {
            titel = "Love";
            autor = "Hill";

            TITEL = new StringSearch(titel, Track.Property.Titel.ToString(), Titel.Property.Name.ToString());
            AUTOR = new StringSearch(autor, Track.Property.Autor.ToString(), Autor.Property.Name.ToString());

            AND = new ComplexRelation();
            OR = new ComplexRelation(Relator.Binary.OR);
        }
コード例 #6
0
        public void can_search_Titel_or_Bpm2()
        {
            int bpm = 100;

            ASimpleRelation BPM = new IntSearch(bpm, Track.Property.Bpm.ToString(), Bpm.Property.Value.ToString());
            ComplexRelation cr = new ComplexRelation(Relator.Binary.OR, BPM, this.TITEL);

            IList<Track> tracks = TrackSearch_Service.getTrackListing(cr);
            IList<Track> tracksTITEL = TrackSearch_Service.getTrackListing(this.TITEL);

            foreach(Track track in tracks)
                Assert.IsTrue(
                    (track.Bpm ?? new Bpm(0)).Value == bpm ||
                    Regex.IsMatch(track.Titel.Name, this.titel, RegexOptions.IgnoreCase)
                    );

            Assert.IsTrue(tracks.Count >= tracksTITEL.Count);
        }
コード例 #7
0
        public void can_search_Bpm_or_Year()
        {
            Bpm bpm = new Bpm(140);
            Year year = new Year(8);

            ASimpleRelation BPM = new IntSearch(140, Track.Property.Bpm.ToString(), Bpm.Property.Value.ToString());
            ASimpleRelation YEAR = new IntSearch(2008, Track.Property.Year.ToString(), Year.Property.Value.ToString());

            ComplexRelation cr = new ComplexRelation(Relator.Binary.OR, BPM, YEAR);

            IList<Track> tracks = TrackSearch_Service.getTrackListing(cr);

            foreach(Track track in tracks)
                Assert.IsTrue(track.Bpm.Value == bpm.Value || track.Year.Value == year.Value);
        }
コード例 #8
0
        public void can_getTrackListing_by_Titel_by_ComplexRelation_and_Autor_by_ComplexRelation()
        {
            ComplexRelation searchPattern = new ComplexRelation();
            ComplexRelation complex1 = new ComplexRelation();
            ComplexRelation complex2 = new ComplexRelation();

            complex1.addRelata(this.TITEL);
            searchPattern.addRelata(complex1);
            complex2.addRelata(this.AUTOR);
            searchPattern.addRelata(complex2);

            IList<Track> trackListing = TrackSearch_Service.getTrackListing(searchPattern);

            this.showResult(trackListing);
            this.showCount(trackListing);

            foreach(Track track in trackListing) {
                Assert.IsTrue(Regex.IsMatch(track.Titel.Name, titel, RegexOptions.IgnoreCase));
                Assert.IsTrue(Regex.IsMatch(track.Autor.Name, autor, RegexOptions.IgnoreCase));
            }
        }
コード例 #9
0
        public void can_getTrackListing_by_Titel_and_Autor_AND_Titel_or_Autor()
        {
            AND.addRelata(TITEL, AUTOR);
            OR.addRelata(TITEL, AUTOR);

            ComplexRelation root = new ComplexRelation();
            root.addRelata(AND, OR);

            IList<Track> trackListing = TrackSearch_Service.getTrackListing(root);

            this.showResult(trackListing);
            this.showCount(trackListing);

            foreach(Track track in trackListing) {
                Assert.IsTrue(
                    (
                        Regex.IsMatch(track.Titel.Name, titel, RegexOptions.IgnoreCase) &&
                        Regex.IsMatch(track.Autor.Name, autor, RegexOptions.IgnoreCase)
                    )
                    &&
                    (
                        Regex.IsMatch(track.Titel.Name, titel, RegexOptions.IgnoreCase) ||
                        Regex.IsMatch(track.Autor.Name, autor, RegexOptions.IgnoreCase)
                    )
                );
            }
        }