Skip to content

Commit

Permalink
- 去掉点作为持续时间的表达
Browse files Browse the repository at this point in the history
- 清理部分代码
  • Loading branch information
du00cs committed Apr 23, 2024
1 parent e472572 commit 413393e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
@State(Scope.Benchmark)
public class DateTimeBenchmark {
Context context = new Context(ZonedDateTime.of(LocalDateTime.of(2016, 12, 8, 11, 30, 30), Types.ZoneCN()), Locale.CHINA);
final Types.Options option = new Types.Options(Sets.newHashSet("time", "duration"), false);
final Types.Options option = new Types.Options(Sets.newHashSet("Time", "Duration"), false);
final Random rand = new Random();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ trait Rules extends DimRules {
name = "intersect",
// 左右边均不能是中午/下午,避免与<dim time> <part-of-day>冲突
pattern = List(
and(isDimension(Time), isNotLatent, isNotHint(Hint.Season)).predicate,
and(isDimension(Time), isNotLatent, isNotHint(Hint.Season, Hint.FinalRule)).predicate,
// "一日"单独是latent,但是可以参与组合
and(isDimension(Time), or(and(or(isNotLatent, isLatent0oClockOfDay), not(isAPartOfDay)), isADayOfMonth)).predicate
),
Expand Down Expand Up @@ -345,7 +345,7 @@ trait Rules extends DimRules {
val predicate = SequencePredicate(
List(td, TimeData(TimeOpenIntervalPredicate(intervalDirection), timeGrain = Grain.NoGrain))
)
tt(TimeData(timePred = predicate, timeGrain = td.timeGrain))
tt(TimeData(timePred = predicate, timeGrain = td.timeGrain, hint = Hint.FinalRule))
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ trait Rules extends DimRules {
val grains = List(
("second (grain)", "秒钟?", Second),
("minute (grain)", "分(?!贝)钟?", Minute),
("hour (grain)", "(小时|钟头|钟|点)", Hour),
("hour (grain)", "(小时|钟头|钟)", Hour),
("day (grain)", "(天(?!气(?!温))|日(?![元本]))", Day),
("week (grain)", WeekPattern, Week),
("month (grain)", "", Month),
("quarter (grain)", "季度", Quarter),
("year (grain)", "", Year)
)

val latentExpr = Set("", "", "")
val latentExpr = Set("", "")

override def dimRules: List[Rule] = grains.map {
case (name, regexPattern, grain) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ object predicates {
case Token(Time | Date, td: TimeData) => hints.contains(td.hint)
}

val isNotHint: Hint => Predicate = (hint: Hint) => {
case Token(Time | Date, td: TimeData) => td.hint != hint
def isNotHint(hints: Hint*): Predicate = {
case Token(Time | Date, td: TimeData) => !hints.contains(td.hint)
}

val is24oClockOfDay: Predicate = {
Expand Down

0 comments on commit 413393e

Please sign in to comment.