本文整理汇总了Java中java.time.chrono.HijrahChronology类的典型用法代码示例。如果您正苦于以下问题:Java HijrahChronology类的具体用法?Java HijrahChronology怎么用?Java HijrahChronology使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HijrahChronology类属于java.time.chrono包,在下文中一共展示了HijrahChronology类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: provider_reducedWithChrono
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@DataProvider(name="ReducedWithChrono")
Object[][] provider_reducedWithChrono() {
LocalDate baseYear = LocalDate.of(2000, 1, 1);
return new Object[][] {
{IsoChronology.INSTANCE.date(baseYear)},
{IsoChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
{IsoChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
{HijrahChronology.INSTANCE.date(baseYear)},
{HijrahChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
{HijrahChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
{JapaneseChronology.INSTANCE.date(baseYear)},
{JapaneseChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
{JapaneseChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
{MinguoChronology.INSTANCE.date(baseYear)},
{MinguoChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
{MinguoChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
{ThaiBuddhistChronology.INSTANCE.date(baseYear)},
{ThaiBuddhistChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
{ThaiBuddhistChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
};
}
示例2: Test_UmmAlQuraChronoRange
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@Test
public void Test_UmmAlQuraChronoRange() {
HijrahChronology chrono = HijrahChronology.INSTANCE;
ValueRange year = chrono.range(YEAR);
assertEquals(year.getMinimum(), 1300, "Minimum year");
assertEquals(year.getLargestMinimum(), 1300, "Largest minimum year");
assertEquals(year.getMaximum(), 1600, "Largest year");
assertEquals(year.getSmallestMaximum(), 1600, "Smallest Maximum year");
ValueRange month = chrono.range(MONTH_OF_YEAR);
assertEquals(month.getMinimum(), 1, "Minimum month");
assertEquals(month.getLargestMinimum(), 1, "Largest minimum month");
assertEquals(month.getMaximum(), 12, "Largest month");
assertEquals(month.getSmallestMaximum(), 12, "Smallest Maximum month");
ValueRange day = chrono.range(DAY_OF_MONTH);
assertEquals(day.getMinimum(), 1, "Minimum day");
assertEquals(day.getLargestMinimum(), 1, "Largest minimum day");
assertEquals(day.getMaximum(), 30, "Largest day");
assertEquals(day.getSmallestMaximum(), 29, "Smallest Maximum day");
}
示例3: test_chronologyGetAvailablePerf
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@Test
public void test_chronologyGetAvailablePerf() {
long start = System.nanoTime();
Set<Chronology> chronos = Chronology.getAvailableChronologies();
long end = System.nanoTime();
Duration d = Duration.of(end - start, ChronoUnit.NANOS);
System.out.printf(" Cold Duration of Chronology.getAvailableChronologies(): %s%n", d);
start = System.nanoTime();
chronos = Chronology.getAvailableChronologies();
end = System.nanoTime();
d = Duration.of(end - start, ChronoUnit.NANOS);
System.out.printf(" Warm Duration of Chronology.getAvailableChronologies(): %s%n", d);
start = System.nanoTime();
HijrahChronology.INSTANCE.date(1434, 1, 1);
end = System.nanoTime();
d = Duration.of(end - start, ChronoUnit.NANOS);
System.out.printf(" Warm Duration of HijrahDate.date(1434, 1, 1): %s%n", d);
}
示例4: data_epochSecond
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@DataProvider(name = "epochSecond_dataProvider")
Object[][] data_epochSecond() {
return new Object[][] {
{JapaneseChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
{JapaneseChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
{JapaneseChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
{HijrahChronology.INSTANCE, 1434, 9, 7, 1, 2, 2, OFFSET_P0100},
{MinguoChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
{MinguoChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
{MinguoChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
{ThaiBuddhistChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
{ThaiBuddhistChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
{ThaiBuddhistChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
{IsoChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
{IsoChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
{IsoChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
};
}
示例5: data_era_epochSecond
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@DataProvider(name = "era_epochSecond_dataProvider")
Object[][] data_era_epochSecond() {
return new Object[][] {
{JapaneseChronology.INSTANCE, JapaneseEra.MEIJI, 1873 - YDIFF_MEIJI, 9, 7, 1, 2, 2, OFFSET_P0100},
{JapaneseChronology.INSTANCE, JapaneseEra.SHOWA, 1928 - YDIFF_SHOWA, 2, 28, 1, 2, 2, OFFSET_M0100},
{JapaneseChronology.INSTANCE, JapaneseEra.HEISEI, 1989 - YDIFF_HEISEI, 1, 8, 1, 2, 2, OFFSET_P0100},
{HijrahChronology.INSTANCE, HijrahEra.AH, 1434, 9, 7, 1, 2, 2, OFFSET_P0100},
{MinguoChronology.INSTANCE, MinguoEra.BEFORE_ROC, 1873 - YDIFF_MINGUO, 9, 7, 1, 2, 2, OFFSET_P0100},
{MinguoChronology.INSTANCE, MinguoEra.ROC, 1928 - YDIFF_MINGUO, 2, 28, 1, 2, 2, OFFSET_M0100},
{MinguoChronology.INSTANCE, MinguoEra.ROC, 1989 - YDIFF_MINGUO, 1, 8, 1, 2, 2, OFFSET_P0100},
{ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1873 + YDIFF_THAIBUDDHIST, 9, 7, 1, 2, 2, OFFSET_P0100},
{ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1928 + YDIFF_THAIBUDDHIST, 2, 28, 1, 2, 2, OFFSET_M0100},
{ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1989 + YDIFF_THAIBUDDHIST, 1, 8, 1, 2, 2, OFFSET_P0100},
{IsoChronology.INSTANCE, IsoEra.CE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
{IsoChronology.INSTANCE, IsoEra.CE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
{IsoChronology.INSTANCE, IsoEra.CE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
};
}
示例6: test_dateNow
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@Test
public void test_dateNow(){
assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now()) ;
assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(ZoneId.systemDefault())) ;
assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(Clock.systemDefaultZone())) ;
assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(Clock.systemDefaultZone().getZone())) ;
assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(ZoneId.systemDefault())) ;
assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(Clock.systemDefaultZone())) ;
assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(Clock.systemDefaultZone().getZone())) ;
ZoneId zoneId = ZoneId.of("Europe/Paris");
assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahChronology.INSTANCE.dateNow(Clock.system(zoneId))) ;
assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahChronology.INSTANCE.dateNow(Clock.system(zoneId).getZone())) ;
assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahDate.now(Clock.system(zoneId))) ;
assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahDate.now(Clock.system(zoneId).getZone())) ;
assertEquals(HijrahChronology.INSTANCE.dateNow(ZoneId.of(ZoneOffset.UTC.getId())), HijrahChronology.INSTANCE.dateNow(Clock.systemUTC())) ;
}
示例7: data_CalendarType
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@DataProvider(name = "calendarsystemtype")
Object[][] data_CalendarType() {
return new Object[][] {
{HijrahChronology.INSTANCE, "islamic-umalqura"},
{IsoChronology.INSTANCE, "iso8601"},
{JapaneseChronology.INSTANCE, "japanese"},
{MinguoChronology.INSTANCE, "roc"},
{ThaiBuddhistChronology.INSTANCE, "buddhist"},
};
}
示例8: test_HijrahChronology_dateYearDay
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@Test
public void test_HijrahChronology_dateYearDay() {
Chronology chrono = Chronology.of("Hijrah");
ChronoLocalDate date1 = chrono.dateYearDay(HijrahEra.AH, 1434, 178);
ChronoLocalDate date2 = chrono.date(HijrahEra.AH, 1434, 7, 1);
assertEquals(date1, HijrahChronology.INSTANCE.dateYearDay(HijrahEra.AH, 1434, 178));
assertEquals(date2, HijrahChronology.INSTANCE.dateYearDay(HijrahEra.AH, 1434, 178));
}
示例9: main
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
System.setSecurityManager(new SecurityManager());
DateFormatSymbols syms = DateFormatSymbols.getInstance(Locale.GERMAN);
if (!"Oktober".equals(syms.getMonths()[Calendar.OCTOBER])) {
throw new RuntimeException("Test failed (FormatData)");
}
String s = HijrahChronology.INSTANCE.getDisplayName(TextStyle.FULL, Locale.GERMAN);
if (!s.contains("Islamischer Kalender")) {
throw new RuntimeException("Test failed (JavaTimeSupplementary)");
}
}
示例10: test_valueOf
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@Test(dataProvider="HijrahEras")
public void test_valueOf(HijrahEra era , String eraName, int eraValue) {
assertEquals(era.getValue(), eraValue);
assertEquals(HijrahChronology.INSTANCE.eraOf(eraValue), era);
assertEquals(HijrahEra.of(eraValue), era);
assertEquals(HijrahEra.valueOf(eraName), era);
}
示例11: data_of_calendars
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@DataProvider(name = "calendars")
Chronology[][] data_of_calendars() {
return new Chronology[][]{
{HijrahChronology.INSTANCE},
{IsoChronology.INSTANCE},
{JapaneseChronology.INSTANCE},
{MinguoChronology.INSTANCE},
{ThaiBuddhistChronology.INSTANCE},
};
}
示例12: test_chrono_byName
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@Test
public void test_chrono_byName() {
Chronology c = HijrahChronology.INSTANCE;
Chronology test = Chronology.of("Hijrah-umalqura");
Assert.assertNotNull(test, "The Hijrah-umalqura calendar could not be found by name");
Assert.assertEquals(test.getId(), "Hijrah-umalqura", "ID mismatch");
Assert.assertEquals(test.getCalendarType(), "islamic-umalqura", "Type mismatch");
Assert.assertEquals(test, c);
}
示例13: test_Instant_zonedDateTime
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@Test
public void test_Instant_zonedDateTime() {
OffsetDateTime offsetDateTime = OffsetDateTime.of(2012, 2, 29, 2, 7, 1, 1, OFFSET_PTWO);
ZonedDateTime zonedDateTime = ZonedDateTime.of(2012, 2, 29, 2, 7, 1, 1, ZONE_RIYADH);
ChronoZonedDateTime<HijrahDate> result = HijrahChronology.INSTANCE.zonedDateTime(offsetDateTime.toInstant(), offsetDateTime.getOffset());
assertEquals(result.toLocalDate(), HijrahChronology.INSTANCE.date(1433, 4, 7));
assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1));
result = HijrahChronology.INSTANCE.zonedDateTime(zonedDateTime.toInstant(), zonedDateTime.getOffset());
assertEquals(result.toLocalDate(), HijrahChronology.INSTANCE.date(1433, 4, 7));
assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1));
}
示例14: test_resolve_yearOfEra_eraOnly_valid
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@Test(dataProvider = "resolve_styleByEra")
public void test_resolve_yearOfEra_eraOnly_valid(ResolverStyle style, HijrahEra era) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
fieldValues.put(ChronoField.ERA, (long) era.getValue());
HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
assertEquals(date, null);
assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue());
assertEquals(fieldValues.size(), 1);
}
示例15: test_resolve_yearOfEra_eraAndYearOfEraOnly_valid
import java.time.chrono.HijrahChronology; //导入依赖的package包/类
@Test(dataProvider = "resolve_styleByEra")
public void test_resolve_yearOfEra_eraAndYearOfEraOnly_valid(ResolverStyle style, HijrahEra era) {
Map<TemporalField, Long> fieldValues = new HashMap<>();
fieldValues.put(ChronoField.ERA, (long) era.getValue());
fieldValues.put(ChronoField.YEAR_OF_ERA, 1343L);
HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
assertEquals(date, null);
assertEquals(fieldValues.get(ChronoField.ERA), null);
assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), null);
assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1343L);
assertEquals(fieldValues.size(), 1);
}