OmniSciDB  2e3a973ef4
com.mapd.tests.DateTimeTest.DateTruncUnit Enum Reference
+ Collaboration diagram for com.mapd.tests.DateTimeTest.DateTruncUnit:

Public Attributes

 dtYEAR
 
 dtQUARTER
 
 dtMONTH
 
 dtDAY
 
 dtHOUR
 
 dtMINUTE
 
 dtSECOND
 
 dtCENTURY
 
 dtDECADE
 
 dtMILLISECOND
 
 dtMICROSECOND
 
 dtNANOSECOND
 
 dtWEEK
 
Function< LocalDateTime, LocalDateTime > trunc
 

Private Member Functions

 DateTruncUnit (String token, Function< LocalDateTime, LocalDateTime > trunc)
 

Private Attributes

String sqlToken
 

Detailed Description

Definition at line 22 of file DateTimeTest.java.

Constructor & Destructor Documentation

◆ DateTruncUnit()

com.mapd.tests.DateTimeTest.DateTruncUnit.DateTruncUnit ( String  token,
Function< LocalDateTime, LocalDateTime >  trunc 
)
inlineprivate

Definition at line 196 of file DateTimeTest.java.

196  {
197  this.sqlToken = token;
198  this.trunc = trunc;
199  }
Function< LocalDateTime, LocalDateTime > trunc

Member Data Documentation

◆ dtCENTURY

com.mapd.tests.DateTimeTest.DateTruncUnit.dtCENTURY
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
int year = t.getYear();
int range = 100;
int diff = year % range;
if (diff == 0) {
diff = range;
}
year -= diff;
t = t.withYear(year + 1);
t = t.withMonth(1);
t = t.withDayOfMonth(1);
t = t.truncatedTo(ChronoUnit.DAYS);
return t;
}
})

Definition at line 118 of file DateTimeTest.java.

◆ dtDAY

com.mapd.tests.DateTimeTest.DateTruncUnit.dtDAY
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
t = t.truncatedTo(ChronoUnit.DAYS);
return t;
}
})

Definition at line 73 of file DateTimeTest.java.

◆ dtDECADE

com.mapd.tests.DateTimeTest.DateTruncUnit.dtDECADE
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
int year = t.getYear();
int range = 10;
int diff = year % range;
year -= diff;
t = t.withYear(year);
t = t.withMonth(1);
t = t.withDayOfMonth(1);
t = t.truncatedTo(ChronoUnit.DAYS);
return t;
}
})

Definition at line 136 of file DateTimeTest.java.

◆ dtHOUR

com.mapd.tests.DateTimeTest.DateTruncUnit.dtHOUR
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
t = t.truncatedTo(ChronoUnit.HOURS);
return t;
}
})

Definition at line 80 of file DateTimeTest.java.

◆ dtMICROSECOND

com.mapd.tests.DateTimeTest.DateTruncUnit.dtMICROSECOND
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
t = t.truncatedTo(ChronoUnit.MICROS);
return t;
}
})

Definition at line 157 of file DateTimeTest.java.

◆ dtMILLISECOND

com.mapd.tests.DateTimeTest.DateTruncUnit.dtMILLISECOND
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
t = t.truncatedTo(ChronoUnit.MILLIS);
return t;
}
})

Definition at line 150 of file DateTimeTest.java.

◆ dtMINUTE

com.mapd.tests.DateTimeTest.DateTruncUnit.dtMINUTE
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
t = t.truncatedTo(ChronoUnit.MINUTES);
return t;
}
})

Definition at line 87 of file DateTimeTest.java.

◆ dtMONTH

com.mapd.tests.DateTimeTest.DateTruncUnit.dtMONTH
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
t = t.withDayOfMonth(1);
t = t.truncatedTo(ChronoUnit.DAYS);
return t;
}
})

Definition at line 65 of file DateTimeTest.java.

◆ dtNANOSECOND

com.mapd.tests.DateTimeTest.DateTruncUnit.dtNANOSECOND
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
t = t.truncatedTo(ChronoUnit.NANOS);
return t;
}
})

Definition at line 164 of file DateTimeTest.java.

◆ dtQUARTER

com.mapd.tests.DateTimeTest.DateTruncUnit.dtQUARTER

Definition at line 32 of file DateTimeTest.java.

◆ dtSECOND

com.mapd.tests.DateTimeTest.DateTruncUnit.dtSECOND
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
t = t.truncatedTo(ChronoUnit.SECONDS);
return t;
}
})

Definition at line 94 of file DateTimeTest.java.

◆ dtWEEK

com.mapd.tests.DateTimeTest.DateTruncUnit.dtWEEK
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
t = t.with(ChronoField.DAY_OF_WEEK, 1);
t = t.truncatedTo(ChronoUnit.DAYS);
return t;
}
})

Definition at line 171 of file DateTimeTest.java.

◆ dtYEAR

com.mapd.tests.DateTimeTest.DateTruncUnit.dtYEAR
Initial value:
@Override
public LocalDateTime apply(LocalDateTime t) {
t = t.withMonth(1);
t = t.withDayOfMonth(1);
t = t.truncatedTo(ChronoUnit.DAYS);
return t;
}
})

Definition at line 23 of file DateTimeTest.java.

◆ sqlToken

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

Definition at line 193 of file DateTimeTest.java.

◆ trunc

Function<LocalDateTime, LocalDateTime> com.mapd.tests.DateTimeTest.DateTruncUnit.trunc

Definition at line 194 of file DateTimeTest.java.


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