OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
com.mapd.tests.DateTimeTest.DateDiffUnit Enum Reference
+ Collaboration diagram for com.mapd.tests.DateTimeTest.DateDiffUnit:

Public Attributes

 daYEAR
 
 daQUARTER
 
 daMONTH
 
 daDAY
 
 daHOUR
 
 daMINUTE
 
 daSECOND
 
 daMILLISECOND
 
 daMICROSECOND
 
 daNANOSECOND
 
 daWEEK
 

Private Member Functions

 DateDiffUnit (String token, Function< Pair< LocalDateTime, LocalDateTime >, Long > diff)
 

Private Attributes

String sqlToken
 
Function< Pair< LocalDateTime,
LocalDateTime >, Long > 
diff
 

Detailed Description

Definition at line 341 of file DateTimeTest.java.

Constructor & Destructor Documentation

com.mapd.tests.DateTimeTest.DateDiffUnit.DateDiffUnit ( String  token,
Function< Pair< LocalDateTime, LocalDateTime >, Long >  diff 
)
inlineprivate

Definition at line 443 of file DateTimeTest.java.

444  {
445  this.sqlToken = token;
446  this.diff = diff;
447  }
Function< Pair< LocalDateTime, LocalDateTime >, Long > diff

Member Data Documentation

com.mapd.tests.DateTimeTest.DateDiffUnit.daDAY
Initial value:
public Long apply(Pair<LocalDateTime, LocalDateTime> d) {
return d.getFirst().until(d.getSecond(), ChronoUnit.DAYS);
}
})

Definition at line 381 of file DateTimeTest.java.

com.mapd.tests.DateTimeTest.DateDiffUnit.daHOUR
Initial value:
public Long apply(Pair<LocalDateTime, LocalDateTime> d) {
return d.getFirst().until(d.getSecond(), ChronoUnit.HOURS);
}
})

Definition at line 386 of file DateTimeTest.java.

com.mapd.tests.DateTimeTest.DateDiffUnit.daMICROSECOND
Initial value:
=(
"MICROSECOND", new Function<Pair<LocalDateTime, LocalDateTime>, Long>() {
public Long apply(Pair<LocalDateTime, LocalDateTime> d) {
return d.getFirst().until(d.getSecond(), ChronoUnit.MICROS);
}
})

Definition at line 410 of file DateTimeTest.java.

com.mapd.tests.DateTimeTest.DateDiffUnit.daMILLISECOND
Initial value:
=(
"MILLISECOND", new Function<Pair<LocalDateTime, LocalDateTime>, Long>() {
public Long apply(Pair<LocalDateTime, LocalDateTime> d) {
return d.getFirst().until(d.getSecond(), ChronoUnit.MILLIS);
}
})

Definition at line 404 of file DateTimeTest.java.

com.mapd.tests.DateTimeTest.DateDiffUnit.daMINUTE
Initial value:
public Long apply(Pair<LocalDateTime, LocalDateTime> d) {
return d.getFirst().until(d.getSecond(), ChronoUnit.MINUTES);
}
})

Definition at line 391 of file DateTimeTest.java.

com.mapd.tests.DateTimeTest.DateDiffUnit.daMONTH
Initial value:
public Long apply(Pair<LocalDateTime, LocalDateTime> d) {
return d.getFirst().until(d.getSecond(), ChronoUnit.MONTHS);
}
})

Definition at line 376 of file DateTimeTest.java.

com.mapd.tests.DateTimeTest.DateDiffUnit.daNANOSECOND
Initial value:
=("NANOSECOND", new Function<Pair<LocalDateTime, LocalDateTime>, Long>() {
public Long apply(Pair<LocalDateTime, LocalDateTime> d) {
return d.getFirst().until(d.getSecond(), ChronoUnit.NANOS);
}
})

Definition at line 416 of file DateTimeTest.java.

com.mapd.tests.DateTimeTest.DateDiffUnit.daQUARTER
Initial value:
private Long applyCorrect(Pair<LocalDateTime, LocalDateTime> d) {
LocalDateTime start = d.getFirst();
LocalDateTime end = d.getSecond();
int delta = 1;
if (start.compareTo(end) > 0) {
delta = -1;
start = end;
end = d.getFirst();
}
start = DateTruncUnit.dtQUARTER.trunc.apply(start);
long rc = 0;
while (start.compareTo(end) <= 0) {
rc += delta;
start = start.plusMonths(3);
}
return rc;
}
public Long apply(Pair<LocalDateTime, LocalDateTime> d) {
return d.getFirst().until(d.getSecond(), ChronoUnit.MONTHS) / 3;
}
})

Definition at line 347 of file DateTimeTest.java.

com.mapd.tests.DateTimeTest.DateDiffUnit.daSECOND
Initial value:
public Long apply(Pair<LocalDateTime, LocalDateTime> d) {
return d.getFirst().until(d.getSecond(), ChronoUnit.SECONDS);
}
})

Definition at line 396 of file DateTimeTest.java.

com.mapd.tests.DateTimeTest.DateDiffUnit.daWEEK
Initial value:
public Long apply(Pair<LocalDateTime, LocalDateTime> d) {
return d.getFirst().until(d.getSecond(), ChronoUnit.WEEKS);
}
})

Definition at line 421 of file DateTimeTest.java.

com.mapd.tests.DateTimeTest.DateDiffUnit.daYEAR
Initial value:
public Long apply(Pair<LocalDateTime, LocalDateTime> d) {
return d.getFirst().until(d.getSecond(), ChronoUnit.YEARS);
}
})

Definition at line 342 of file DateTimeTest.java.

Function<Pair<LocalDateTime, LocalDateTime>, Long> com.mapd.tests.DateTimeTest.DateDiffUnit.diff
private

Definition at line 441 of file DateTimeTest.java.

String com.mapd.tests.DateTimeTest.DateDiffUnit.sqlToken
private

Definition at line 440 of file DateTimeTest.java.


The documentation for this enum was generated from the following file: