Example usage for java.time Year now

List of usage examples for java.time Year now

Introduction

In this page you can find the example usage for java.time Year now.

Prototype

public static Year now() 

Source Link

Document

Obtains the current year from the system clock in the default time-zone.

Usage

From source file:daylightchart.sunchart.chart.SunChart.java

/**
 * Create an empty chart, just to get the default chart options.
 */// w  w w  .  j  a  va 2  s  .co  m
public SunChart() {
    this(SunChartUtility.createSunChartYear(null, Year.now().getValue()));
    setTitle("");
}

From source file:daylightchart.daylightchart.chart.DaylightChart.java

/**
 * Create an empty chart, just to get the default chart options.
 *//*from   ww  w.jav a 2  s  . c om*/
public DaylightChart() {
    this(RiseSetUtility.createRiseSetYear(null, Year.now().getValue(), new Options()), new Options());
    setTitle("");
}

From source file:br.ufac.sion.service.InscricaoService.java

private String geraNumeroInscricao(Inscricao inscricao) {
    return Year.now() + "" + inscricao.getCargoConcurso().getConcurso().getId() + "" + inscricao.getId();
}

From source file:daylightchart.daylightchart.calculation.RiseSetUtility.java

/**
 * Debug calculations./*from  w w w.ja  v  a  2  s.com*/
 *
 * @param writer
 *        Writer to write to
 * @param location
 *        Location to debug
 * @param daylightBandType
 *        Types of band type to write to
 */
@SuppressWarnings("boxing")
private static void writeCalculations(final Writer writer, final Location location, final TwilightType twilight,
        final DaylightBandType... daylightBandType) {
    if (writer == null || location == null) {
        return;
    }

    final DecimalFormat format = new DecimalFormat("00.000");
    format.setMaximumFractionDigits(3);

    final int year = Year.now().getValue();
    final Options options = new Options();
    options.setTwilightType(twilight);
    final RiseSetYearData riseSetYear = createRiseSetYear(location, year, options);

    final PrintWriter printWriter = new PrintWriter(writer, true);
    // Header
    printWriter.printf("Location\t%s%nDate\t%s%n%n", location, year);
    // Bands
    final List<DaylightBand> bands = riseSetYear.getBands();
    for (final Iterator<DaylightBand> iterator = bands.iterator(); iterator.hasNext();) {
        final DaylightBand band = iterator.next();
        if (!ArrayUtils.contains(daylightBandType, band.getDaylightBandType())) {
            iterator.remove();
        }
    }
    printWriter.printf("\t\t\t");
    if (ArrayUtils.contains(daylightBandType, DaylightBandType.twilight)) {
        printWriter.printf("\t\t");
    }
    for (final DaylightBand band : bands) {
        printWriter.printf("Band\t%s\t", band.getName());
    }
    printWriter.println();
    // Data rows
    printWriter.print("Date\tSunrise\tSunset");
    if (ArrayUtils.contains(daylightBandType, DaylightBandType.twilight)) {
        printWriter.println("\tTwilight Rise\tTwilight Set");
    } else {
        printWriter.println();
    }
    final List<RawRiseSet> rawRiseSets = riseSetYear.getRawRiseSets();
    final List<RawRiseSet> rawTwilights = riseSetYear.getRawTwilights();
    for (int i = 0; i < rawRiseSets.size(); i++) {
        final RawRiseSet rawRiseSet = rawRiseSets.get(i);
        printWriter.printf("%s\t%s\t%s", rawRiseSet.getDate(), format.format(rawRiseSet.getSunrise()),
                format.format(rawRiseSet.getSunset()));
        if (ArrayUtils.contains(daylightBandType, DaylightBandType.twilight)) {
            final RawRiseSet rawTwilight = rawTwilights.get(i);
            printWriter.printf("\t%s\t%s", format.format(rawTwilight.getSunrise()),
                    format.format(rawTwilight.getSunset()));
        }
        for (final DaylightBand band : bands) {
            final RiseSet riseSet = band.get(rawRiseSet.getDate());
            if (riseSet == null) {
                printWriter.print("\t\t");
            } else {
                printWriter.printf("\t%s\t%s",
                        riseSet.getSunrise().toLocalTime().format(DateTimeFormatter.ofPattern("HH:mm:ss")),
                        riseSet.getSunset().toLocalTime().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
            }
        }
        printWriter.println();
    }
}

From source file:pt.ist.fenixedu.integration.domain.cgd.NumberObfuscationAdaptor.java

@Override
public boolean isAllowedAccessToMember(final Person person) {
    if (person == null) {
        return false;
    }//from   w w w  .j  a v  a  2 s  .co  m
    final User user = person.getUser();
    if (user != null) {
        final int year = Year.now().getValue();
        for (final CgdCard card : user.getCgdCardSet()) {
            if (card.getAllowSendDetails() && (card.getCgdCardCounter().getYear() == year
                    || card.getCgdCardCounter().getYear() == (year - 1))) {
                return true;
            }
        }
    }
    return false;
}