Java Code Examples for java.time.LocalDate#MAX

The following examples show how to use java.time.LocalDate#MAX . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TCKLocalDate.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@BeforeMethod
public void setUp() {
    TEST_2007_07_15 = LocalDate.of(2007, 7, 15);

    LocalDate max = LocalDate.MAX;
    LocalDate min = LocalDate.MIN;
    MAX_VALID_EPOCHDAYS = max.toEpochDay();
    MIN_VALID_EPOCHDAYS = min.toEpochDay();
    MAX_DATE = max;
    MIN_DATE = min;
    MAX_INSTANT = max.atStartOfDay(ZoneOffset.UTC).toInstant();
    MIN_INSTANT = min.atStartOfDay(ZoneOffset.UTC).toInstant();
}
 
Example 2
Source File: TCKLocalDate.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@BeforeMethod
public void setUp() {
    TEST_2007_07_15 = LocalDate.of(2007, 7, 15);

    LocalDate max = LocalDate.MAX;
    LocalDate min = LocalDate.MIN;
    MAX_VALID_EPOCHDAYS = max.toEpochDay();
    MIN_VALID_EPOCHDAYS = min.toEpochDay();
    MAX_DATE = max;
    MIN_DATE = min;
    MAX_INSTANT = max.atStartOfDay(ZoneOffset.UTC).toInstant();
    MIN_INSTANT = min.atStartOfDay(ZoneOffset.UTC).toInstant();
}
 
Example 3
Source File: PartnerServiceImpl.java    From axelor-open-suite with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Search for the sale price list for the current date in the partner.
 *
 * @param partner
 * @return the sale price list for the partner null if no active price list has been found
 */
@Override
public PriceList getSalePriceList(Partner partner) {
  PartnerPriceList partnerPriceList = partner.getSalePartnerPriceList();
  if (partnerPriceList == null) {
    return null;
  }
  Set<PriceList> priceListSet = partnerPriceList.getPriceListSet();
  if (priceListSet == null) {
    return null;
  }
  LocalDate today = Beans.get(AppBaseService.class).getTodayDate();
  List<PriceList> candidatePriceListList = new ArrayList<>();
  for (PriceList priceList : priceListSet) {
    LocalDate beginDate =
        priceList.getApplicationBeginDate() != null
            ? priceList.getApplicationBeginDate()
            : LocalDate.MIN;
    LocalDate endDate =
        priceList.getApplicationEndDate() != null
            ? priceList.getApplicationEndDate()
            : LocalDate.MAX;
    if (beginDate.compareTo(today) <= 0 && today.compareTo(endDate) <= 0) {
      candidatePriceListList.add(priceList);
    }
  }

  // if we found multiple price list, then the user will have to select one
  if (candidatePriceListList.size() == 1) {
    return candidatePriceListList.get(0);
  } else {
    return null;
  }
}
 
Example 4
Source File: TCKLocalDate.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@BeforeMethod
public void setUp() {
    TEST_2007_07_15 = LocalDate.of(2007, 7, 15);

    LocalDate max = LocalDate.MAX;
    LocalDate min = LocalDate.MIN;
    MAX_VALID_EPOCHDAYS = max.toEpochDay();
    MIN_VALID_EPOCHDAYS = min.toEpochDay();
    MAX_DATE = max;
    MIN_DATE = min;
    MAX_INSTANT = max.atStartOfDay(ZoneOffset.UTC).toInstant();
    MIN_INSTANT = min.atStartOfDay(ZoneOffset.UTC).toInstant();
}
 
Example 5
Source File: Events_DataFusion_Main.java    From winter with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws XPathExpressionException,
			ParserConfigurationException, SAXException, IOException,
			TransformerException {

		char separator = '+';
		DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE;
		boolean filterFrom = false;
		boolean filterTo = false;
		boolean applyKeywordSearch = false;
		LocalDate fromDate = LocalDate.MIN;
		LocalDate toDate = LocalDate.MAX;
		String keyword = "";

		// Load the Data into FusableDataSet
		FusibleDataSet<Event, Attribute> fusibleDataSetD = new FusibleHashedDataSet<>();
//		fusibleDataSetD.loadFromTSV(new File("WDI/usecase/event/input/dbpedia-1_s.tsv"),
//				new EventFactory(dateTimeFormatter, filterFrom, fromDate, filterTo, toDate, applyKeywordSearch, keyword), "events/event", separator, dateTimeFormatter, false, fromDate, false, toDate, true, keyword);


		FusibleDataSet<Event, Attribute> fusibleDataSetY = new FusibleHashedDataSet<>();
//		fusibleDataSetY.loadFromTSV(new File("WDI/usecase/event/input/yago-1_s.tsv"),
//				new EventFactory(dateTimeFormatter, filterFrom, fromDate, filterTo, toDate, applyKeywordSearch, keyword), "events/event", separator, dateTimeFormatter, false, fromDate, false, toDate, true, keyword);


		runDataFusion(fusibleDataSetD,
				fusibleDataSetY,
				//null,
				separator, dateTimeFormatter, filterFrom, fromDate, filterTo, toDate, applyKeywordSearch, keyword);

	}
 
Example 6
Source File: TCKLocalDate.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@BeforeMethod
public void setUp() {
    TEST_2007_07_15 = LocalDate.of(2007, 7, 15);

    LocalDate max = LocalDate.MAX;
    LocalDate min = LocalDate.MIN;
    MAX_VALID_EPOCHDAYS = max.toEpochDay();
    MIN_VALID_EPOCHDAYS = min.toEpochDay();
    MAX_DATE = max;
    MIN_DATE = min;
    MAX_INSTANT = max.atStartOfDay(ZoneOffset.UTC).toInstant();
    MIN_INSTANT = min.atStartOfDay(ZoneOffset.UTC).toInstant();
}
 
Example 7
Source File: TCKLocalDate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@BeforeMethod
public void setUp() {
    TEST_2007_07_15 = LocalDate.of(2007, 7, 15);

    LocalDate max = LocalDate.MAX;
    LocalDate min = LocalDate.MIN;
    MAX_VALID_EPOCHDAYS = max.toEpochDay();
    MIN_VALID_EPOCHDAYS = min.toEpochDay();
    MAX_DATE = max;
    MIN_DATE = min;
    MAX_INSTANT = max.atStartOfDay(ZoneOffset.UTC).toInstant();
    MIN_INSTANT = min.atStartOfDay(ZoneOffset.UTC).toInstant();
}
 
Example 8
Source File: TCKLocalDate.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@BeforeMethod
public void setUp() {
    TEST_2007_07_15 = LocalDate.of(2007, 7, 15);

    LocalDate max = LocalDate.MAX;
    LocalDate min = LocalDate.MIN;
    MAX_VALID_EPOCHDAYS = max.toEpochDay();
    MIN_VALID_EPOCHDAYS = min.toEpochDay();
    MAX_DATE = max;
    MIN_DATE = min;
    MAX_INSTANT = max.atStartOfDay(ZoneOffset.UTC).toInstant();
    MIN_INSTANT = min.atStartOfDay(ZoneOffset.UTC).toInstant();
}
 
Example 9
Source File: TCKLocalDate.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {TEST_2007_07_15, LocalDate.MAX, LocalDate.MIN, };
    return Arrays.asList(array);
}
 
Example 10
Source File: QuoteTests.java    From morpheus-core with Apache License 2.0 4 votes vote down vote up
@Test()
public void testCrossSectionalReturns() throws Exception {
    LocalDate startDate = LocalDate.MIN;
    LocalDate endDate = LocalDate.MAX;
    final Index<LocalDate> rowKeys = Index.of(LocalDate.class, 100);
    final Index<String> tickers = Index.of("BLK", "CSCO", "SPY", "YHOO", "VNQI", "VGLT", "VCLT");
    final DataFrame<LocalDate,String> closePrices = DataFrame.ofDoubles(rowKeys, tickers);
    for (String ticker : tickers) {
        System.out.println("Loading data for ticker " + ticker);
        final DataFrame<LocalDate,String> quotes = TestDataFrames.getQuotes(ticker);
        quotes.tail(10).out().print();
        closePrices.rows().addAll(quotes.rows().keyArray());
        final LocalDate firstKey = quotes.rows().firstKey().get();
        final LocalDate lastKey = quotes.rows().lastKey().get();
        startDate = firstKey.isAfter(startDate) ? firstKey : startDate;
        endDate = lastKey.isBefore(endDate) ? lastKey : endDate;
        quotes.rows().forEach(row -> {
            final LocalDate date = row.key();
            final double price = row.getDouble("Adj Close");
            closePrices.data().setDouble(date, ticker, price);
        });
    }

    final Set<LocalDate> nanDates = new HashSet<>();
    closePrices.rows().forEach(row -> row.forEachValue(v -> {
        final double value = v.getDouble();
        if (Double.isNaN(value)) {
            final LocalDate rowKey = row.key();
            nanDates.add(rowKey);
            if (rowKey.getYear() == 2014) {
                System.out.println(rowKey);
            }
        }
    }));

    final DataFrame<LocalDate,String> selection = closePrices.rows().select(row -> !nanDates.contains(row.key()));
    final DataFrame<LocalDate,String> sorted = selection.rows().sort((row1, row2) -> row1.key().compareTo(row2.key()));
    final DataFrame<LocalDate,String> returns = sorted.calc().percentChanges();
    returns.rows().first().get().applyDoubles(v -> 0d);
    returns.head(10).out().print();
    returns.cols().stats().correlation().out().print();
}
 
Example 11
Source File: TCKLocalDate.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {TEST_2007_07_15, LocalDate.MAX, LocalDate.MIN, };
    return Arrays.asList(array);
}
 
Example 12
Source File: TCKLocalDate.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {TEST_2007_07_15, LocalDate.MAX, LocalDate.MIN, };
    return Arrays.asList(array);
}
 
Example 13
Source File: TCKLocalDate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {TEST_2007_07_15, LocalDate.MAX, LocalDate.MIN, };
    return Arrays.asList(array);
}
 
Example 14
Source File: LocalDateRangeRandomizer.java    From easy-random with MIT License 4 votes vote down vote up
@Override
protected LocalDate getDefaultMaxValue() {
    return LocalDate.MAX;
}
 
Example 15
Source File: BinaryGenerator.java    From pgadba with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * parses a LocalDate to a byte array.
 *
 * @param input the LocalDate to convert
 * @return a byte array
 */
public static byte[] fromLocalDateArray(Object input) {
  if (input == null) {
    return new byte[]{};
  }

  if (input instanceof LocalDate[]) {
    LocalDate[] in = (LocalDate[]) input;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    try {
      baos.write('{');
      for (int i = 0; i < in.length; i++) {
        if (i != 0) {
          baos.write(',');
        }

        if (in[i] == null) {
          baos.write("NULL".getBytes(StandardCharsets.UTF_8));
          continue;
        }

        if (in[i] == LocalDate.MAX) {
          baos.write("infinity".getBytes(StandardCharsets.UTF_8));
          continue;
        } else if (in[i] == LocalDate.MIN) {
          baos.write("-infinity".getBytes(StandardCharsets.UTF_8));
          continue;
        }

        baos.write(in[i].format(localDateFormatter).getBytes(StandardCharsets.UTF_8));

        if (in[i].getYear() < 0) {
          baos.write(" BC".getBytes(StandardCharsets.UTF_8));
        }
      }
      baos.write('}');
    } catch (IOException e) {
      throw new IllegalArgumentException("couldn't parse input to byte array", e);
    }
    return baos.toByteArray();
  }

  throw new RuntimeException(input.getClass().getName() + " can't be converted to byte[] to send as a LocalDate[] to server");
}
 
Example 16
Source File: TCKLocalDate.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {TEST_2007_07_15, LocalDate.MAX, LocalDate.MIN, };
    return Arrays.asList(array);
}
 
Example 17
Source File: TCKLocalDate.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {TEST_2007_07_15, LocalDate.MAX, LocalDate.MIN, };
    return Arrays.asList(array);
}
 
Example 18
Source File: TCKLocalDate.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {TEST_2007_07_15, LocalDate.MAX, LocalDate.MIN, };
    return Arrays.asList(array);
}
 
Example 19
Source File: TCKLocalDate.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {TEST_2007_07_15, LocalDate.MAX, LocalDate.MIN, };
    return Arrays.asList(array);
}
 
Example 20
Source File: LocalDateRangeRandomizerTest.java    From easy-random with MIT License 4 votes vote down vote up
@BeforeEach
void setUp() {
    minDate = LocalDate.MIN;
    maxDate = LocalDate.MAX;
    randomizer = aNewLocalDateRangeRandomizer(minDate, maxDate);
}