    public TvBookmarkMatch match(TvProgramme programme) {
        TvBookmarkMatch result = TvBookmarkMatch.FullMatch;
        boolean should = false;
        if (title == null)
            return TvBookmarkMatch.NoMatch;
        if (!title.equalsIgnoreCase(programme.getTitle())) {
            if (channelId != null && !programme.getChannel().isSameChannel(channelId))
                return TvBookmarkMatch.NoMatch;
            should = true;
            result = TvBookmarkMatch.ShouldMatch;
        } else {
            if (channelId != null && !programme.getChannel().isSameChannel(channelId))
                return TvBookmarkMatch.TitleMatch;
        }
        int start = getTimeOfDay(programme.getStart());
        int stop = getTimeOfDay(programme.getStop());
        int dayOfWeekMask = this.dayOfWeekMask;
        if (anyTime) {
            if (result == TvBookmarkMatch.ShouldMatch)
                return TvBookmarkMatch.NoMatch;
        } else if (startTime < stopTime) {
            if (start < startTime) {
                if (stop > startTime)
                    result = TvBookmarkMatch.Underrun;
                else
                    result = TvBookmarkMatch.TitleMatch;
            } else if (start >= stopTime) {
                result = TvBookmarkMatch.TitleMatch;
            } else if (stop < startTime || stop > stopTime) {
                result = TvBookmarkMatch.Overrun;
            }
        } else {
            if (start >= stopTime && start < startTime) {
                if (stop > startTime || stop <= stopTime)
                    result = TvBookmarkMatch.Underrun;
                else if (stop >= stopTime && stop < start)
                    result = TvBookmarkMatch.Underrun;
                else
                    result = TvBookmarkMatch.TitleMatch;
            } else if (start < stopTime) {
                dayOfWeekMask = ((dayOfWeekMask << 1) |
                                 (dayOfWeekMask >> 6)) & 0xFE;
                if (stop > stopTime)
                    result = TvBookmarkMatch.Overrun;
            } else {
                if (stop > stopTime && stop < startTime)
                    result = TvBookmarkMatch.Overrun;
            }
        }
        int weekday = programme.getStart().get(Calendar.DAY_OF_WEEK);
        if (weekday == Calendar.SUNDAY)
            weekday = 7;
        else
            weekday = weekday - 1;
        if ((dayOfWeekMask & (1 << weekday)) == 0)
            result = TvBookmarkMatch.TitleMatch;
        if (should && (result == TvBookmarkMatch.Underrun || result == TvBookmarkMatch.Overrun))
            result = TvBookmarkMatch.ShouldMatch;
        if (should && result != TvBookmarkMatch.ShouldMatch)
            result = TvBookmarkMatch.NoMatch;
        if (!onAir && result == TvBookmarkMatch.ShouldMatch)
            result = TvBookmarkMatch.NoMatch;
        if (seasons != null && result != TvBookmarkMatch.ShouldMatch &&
                result != TvBookmarkMatch.NoMatch) {
            int season = programme.getSeason();
            int index;
            if (season != 0) {
                for (index = 0; index < seasons.size(); ++index) {
                    if (season >= seasons.get(index).first &&
                            season <= seasons.get(index).last)
                        break;
                }
                if (index >= seasons.size())
                    result = TvBookmarkMatch.NoMatch;
            } else {
                for (index = 0; index < seasons.size(); ++index) {
                    if (seasons.get(index).last == Range.INFINITE)
                        break;
                }
                if (index >= seasons.size())
                    result = TvBookmarkMatch.NoMatch;
            }
        }
        if (years != null && result != TvBookmarkMatch.ShouldMatch &&
                result != TvBookmarkMatch.NoMatch) {
            int year = programme.getYear();
            int index;
            if (year != 0) {
                for (index = 0; index < years.size(); ++index) {
                    if (year >= years.get(index).first &&
                            year <= years.get(index).last)
                        break;
                }
                if (index >= years.size())
                    result = TvBookmarkMatch.NoMatch;
            } else {
                for (index = 0; index < years.size(); ++index) {
                    if (years.get(index).last == Range.INFINITE)
                        break;
                }
                if (index >= years.size())
                    result = TvBookmarkMatch.NoMatch;
            }
        }
        return result;
    }

    public TvBookmarkMatch match(TvProgramme programme) {
        TvBookmarkMatch result = TvBookmarkMatch.FullMatch;
        boolean should = false;
        if (title == null)
            return TvBookmarkMatch.NoMatch;
        if (!title.equalsIgnoreCase(programme.getTitle())) {
            if (channelId != null && !programme.getChannel().isSameChannel(channelId))
                return TvBookmarkMatch.NoMatch;
            should = true;
            result = TvBookmarkMatch.ShouldMatch;
        } else {
            if (channelId != null && !programme.getChannel().isSameChannel(channelId))
                result = TvBookmarkMatch.TitleMatch;
        }
        int start = getTimeOfDay(programme.getStart());
        int stop = getTimeOfDay(programme.getStop());
        int dayOfWeekMask = this.dayOfWeekMask;
        if (anyTime) {
            if (result == TvBookmarkMatch.ShouldMatch)
                return TvBookmarkMatch.NoMatch;
        } else if (startTime < stopTime) {
            if (start < startTime) {
                if (stop > startTime)
                    result = TvBookmarkMatch.Underrun;
                else
                    result = TvBookmarkMatch.TitleMatch;
            } else if (start >= stopTime) {
                result = TvBookmarkMatch.TitleMatch;
            } else if (stop < startTime || stop > stopTime) {
                result = TvBookmarkMatch.Overrun;
            }
        } else {
            if (start >= stopTime && start < startTime) {
                if (stop > startTime || stop <= stopTime)
                    result = TvBookmarkMatch.Underrun;
                else if (stop >= stopTime && stop < start)
                    result = TvBookmarkMatch.Underrun;
                else
                    result = TvBookmarkMatch.TitleMatch;
            } else if (start < stopTime) {
                dayOfWeekMask = ((dayOfWeekMask << 1) |
                                 (dayOfWeekMask >> 6)) & 0xFE;
                if (stop > stopTime)
                    result = TvBookmarkMatch.Overrun;
            } else {
                if (stop > stopTime && stop < startTime)
                    result = TvBookmarkMatch.Overrun;
            }
        }
        int weekday = programme.getStart().get(Calendar.DAY_OF_WEEK);
        if (weekday == Calendar.SUNDAY)
            weekday = 7;
        else
            weekday = weekday - 1;
        if ((dayOfWeekMask & (1 << weekday)) == 0)
            result = TvBookmarkMatch.TitleMatch;
        if (should && (result == TvBookmarkMatch.Underrun || result == TvBookmarkMatch.Overrun))
            result = TvBookmarkMatch.ShouldMatch;
        if (should && result != TvBookmarkMatch.ShouldMatch)
            result = TvBookmarkMatch.NoMatch;
        if (!onAir && result == TvBookmarkMatch.ShouldMatch)
            result = TvBookmarkMatch.NoMatch;
        if (seasons != null && result != TvBookmarkMatch.ShouldMatch &&
                result != TvBookmarkMatch.NoMatch) {
            int season = programme.getSeason();
            int index;
            if (season != 0) {
                for (index = 0; index < seasons.size(); ++index) {
                    if (season >= seasons.get(index).first &&
                            season <= seasons.get(index).last)
                        break;
                }
                if (index >= seasons.size())
                    result = TvBookmarkMatch.NoMatch;
            } else {
                for (index = 0; index < seasons.size(); ++index) {
                    if (seasons.get(index).last == Range.INFINITE)
                        break;
                }
                if (index >= seasons.size())
                    result = TvBookmarkMatch.NoMatch;
            }
        }
        if (years != null && result != TvBookmarkMatch.ShouldMatch &&
                result != TvBookmarkMatch.NoMatch) {
            int year = programme.getYear();
            int index;
            if (year != 0) {
                for (index = 0; index < years.size(); ++index) {
                    if (year >= years.get(index).first &&
                            year <= years.get(index).last)
                        break;
                }
                if (index >= years.size())
                    result = TvBookmarkMatch.NoMatch;
            } else {
                for (index = 0; index < years.size(); ++index) {
                    if (years.get(index).last == Range.INFINITE)
                        break;
                }
                if (index >= years.size())
                    result = TvBookmarkMatch.NoMatch;
            }
        }
        return result;
    }
