org.jfree.data.time.Hour.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中org.jfree.data.time.Hour.<init>()方法的一些代码示例,展示了Hour.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hour.<init>()方法的具体详情如下:
包路径:org.jfree.data.time.Hour
类名称:Hour
方法名:<init>

Hour.<init>介绍

[英]Constructs a new Hour, based on the system date/time.
[中]根据系统日期/时间构造新的小时。

代码示例

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

  1. /**
  2. * Returns the hour.
  3. *
  4. * @return The hour (never <code>null</code>).
  5. */
  6. public Hour getHour() {
  7. return new Hour(this.hour, this.day);
  8. }

代码示例来源:origin: jfree/jfreechart

  1. /**
  2. * Returns the hour.
  3. *
  4. * @return The hour (never {@code null}).
  5. */
  6. public Hour getHour() {
  7. return new Hour(this.hour, this.day);
  8. }

代码示例来源:origin: jfree/jfreechart

  1. /**
  2. * Returns the minute.
  3. *
  4. * @return The minute (never {@code null}).
  5. */
  6. public Minute getMinute() {
  7. return new Minute(this.minute, new Hour(this.hour, this.day));
  8. }

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

  1. /**
  2. * Returns the minute.
  3. *
  4. * @return The minute (never <code>null</code>).
  5. */
  6. public Minute getMinute() {
  7. return new Minute(this.minute, new Hour(this.hour, this.day));
  8. }

代码示例来源:origin: jfree/jfreechart

  1. /**
  2. * Returns the hour following this one.
  3. *
  4. * @return The hour following this one.
  5. */
  6. @Override
  7. public RegularTimePeriod next() {
  8. Hour result;
  9. if (this.hour != LAST_HOUR_IN_DAY) {
  10. result = new Hour(this.hour + 1, this.day);
  11. }
  12. else { // we are at the last hour in the day...
  13. Day nextDay = (Day) this.day.next();
  14. if (nextDay != null) {
  15. result = new Hour(FIRST_HOUR_IN_DAY, nextDay);
  16. }
  17. else {
  18. result = null;
  19. }
  20. }
  21. return result;
  22. }

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

  1. /**
  2. * Returns the hour preceding this one.
  3. *
  4. * @return The hour preceding this one.
  5. */
  6. public RegularTimePeriod previous() {
  7. Hour result;
  8. if (this.hour != FIRST_HOUR_IN_DAY) {
  9. result = new Hour(this.hour - 1, this.day);
  10. }
  11. else { // we are at the first hour in the day...
  12. Day prevDay = (Day) this.day.previous();
  13. if (prevDay != null) {
  14. result = new Hour(LAST_HOUR_IN_DAY, prevDay);
  15. }
  16. else {
  17. result = null;
  18. }
  19. }
  20. return result;
  21. }

代码示例来源:origin: jfree/jfreechart

  1. /**
  2. * Returns the hour preceding this one.
  3. *
  4. * @return The hour preceding this one.
  5. */
  6. @Override
  7. public RegularTimePeriod previous() {
  8. Hour result;
  9. if (this.hour != FIRST_HOUR_IN_DAY) {
  10. result = new Hour(this.hour - 1, this.day);
  11. }
  12. else { // we are at the first hour in the day...
  13. Day prevDay = (Day) this.day.previous();
  14. if (prevDay != null) {
  15. result = new Hour(LAST_HOUR_IN_DAY, prevDay);
  16. }
  17. else {
  18. result = null;
  19. }
  20. }
  21. return result;
  22. }

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

  1. /**
  2. * Returns the hour following this one.
  3. *
  4. * @return The hour following this one.
  5. */
  6. public RegularTimePeriod next() {
  7. Hour result;
  8. if (this.hour != LAST_HOUR_IN_DAY) {
  9. result = new Hour(this.hour + 1, this.day);
  10. }
  11. else { // we are at the last hour in the day...
  12. Day nextDay = (Day) this.day.next();
  13. if (nextDay != null) {
  14. result = new Hour(FIRST_HOUR_IN_DAY, nextDay);
  15. }
  16. else {
  17. result = null;
  18. }
  19. }
  20. return result;
  21. }

代码示例来源:origin: org.openfuxml/ofx-chart

  1. protected RegularTimePeriod getRtp(Date d)
  2. {
  3. RegularTimePeriod rtp;
  4. switch(ofxTimePeriod)
  5. {
  6. case Hour: rtp = new Hour(d);break;
  7. case Day: rtp = new Day(d);break;
  8. case Month: rtp = new Month(d);break;
  9. default: rtp = new Hour(d);break;
  10. }
  11. return rtp;
  12. }

代码示例来源:origin: org.openfuxml/ofx-chart

  1. protected RegularTimePeriod getRtp(Date d)
  2. {
  3. RegularTimePeriod rtp;
  4. switch(ofxTimePeriod)
  5. {
  6. case Hour: rtp = new Hour(d);break;
  7. case Day: rtp = new Day(d);break;
  8. case Month: rtp = new Month(d);break;
  9. default: rtp = new Hour(d);break;
  10. }
  11. return rtp;
  12. }

代码示例来源:origin: org.openfuxml/ofx-chart

  1. public synchronized static RegularTimePeriod getRtp(OfxChartTimePeriod ofxTimePeriod, Date d)
  2. {
  3. RegularTimePeriod rtp;
  4. switch(ofxTimePeriod)
  5. {
  6. case Hour: rtp = new Hour(d);break;
  7. case Day: rtp = new Day(d);break;
  8. case Month: rtp = new Month(d);break;
  9. default: rtp = new Hour(d);break;
  10. }
  11. return rtp;
  12. }

代码示例来源:origin: jfree/jfreechart

  1. /**
  2. * Creates an Hour instance by parsing a string. The string is assumed to
  3. * be in the format "YYYY-MM-DD HH", perhaps with leading or trailing
  4. * whitespace.
  5. *
  6. * @param s the hour string to parse.
  7. *
  8. * @return {@code null} if the string is not parseable, the hour
  9. * otherwise.
  10. */
  11. public static Hour parseHour(String s) {
  12. Hour result = null;
  13. s = s.trim();
  14. String daystr = s.substring(0, Math.min(10, s.length()));
  15. Day day = Day.parseDay(daystr);
  16. if (day != null) {
  17. String hourstr = s.substring(
  18. Math.min(daystr.length() + 1, s.length()), s.length()
  19. );
  20. hourstr = hourstr.trim();
  21. int hour = Integer.parseInt(hourstr);
  22. // if the hour is 0 - 23 then create an hour
  23. if ((hour >= FIRST_HOUR_IN_DAY) && (hour <= LAST_HOUR_IN_DAY)) {
  24. result = new Hour(hour, day);
  25. }
  26. }
  27. return result;
  28. }

代码示例来源:origin: jfree/jfreechart

  1. int minute = Integer.parseInt(minstr);
  2. if ((minute >= 0) && (minute <= 59)) {
  3. result = new Minute(minute, new Hour(hour, day));

代码示例来源:origin: jfree/jfreechart

  1. /**
  2. * Creates a new minute.
  3. *
  4. * @param minute the minute (0-59).
  5. * @param hour the hour (0-23).
  6. * @param day the day (1-31).
  7. * @param month the month (1-12).
  8. * @param year the year (1900-9999).
  9. */
  10. public Minute(int minute, int hour, int day, int month, int year) {
  11. this(minute, new Hour(hour, new Day(day, month, year)));
  12. }

代码示例来源:origin: jfree/jfreechart

  1. if ((minute >= 0) && (minute <= 59)) {
  2. Minute m = new Minute(minute, new Hour(hour, day));
  3. int second = Integer.parseInt(secstr);
  4. if ((second >= 0) && (second <= 59)) {

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

  1. /**
  2. * Creates a new minute.
  3. *
  4. * @param minute the minute (0-59).
  5. * @param hour the hour (0-23).
  6. * @param day the day (1-31).
  7. * @param month the month (1-12).
  8. * @param year the year (1900-9999).
  9. */
  10. public Minute(int minute, int hour, int day, int month, int year) {
  11. this(minute, new Hour(hour, new Day(day, month, year)));
  12. }

代码示例来源:origin: org.n52.series-api/io

  1. private RegularTimePeriod determineTimeInterval(Date date, StyleProperties styleProperties) {
  2. if (styleProperties.getProperties()
  3. .containsKey(Style.PARAMETER_INTERVAL)) {
  4. String interval = styleProperties.getProperties()
  5. .get(Style.PARAMETER_INTERVAL);
  6. if (interval.equals(Style.VALUE_INTERVAL_BY_HOUR)) {
  7. return new Hour(date);
  8. } else if (interval.equals(Style.VALUE_INTERVAL_BY_DAY)) {
  9. return new Day(date);
  10. } else if (interval.equals(Style.VALUE_INTERVAL_BY_MONTH)) {
  11. return new Month(date);
  12. }
  13. }
  14. return new Week(date);
  15. }

代码示例来源:origin: org.n52.sensorweb/timeseries-io

  1. private RegularTimePeriod determineTimeInterval(Date date, StyleProperties styleProperties) {
  2. if (styleProperties.getProperties().containsKey("interval")) {
  3. String interval = styleProperties.getProperties().get("interval");
  4. if (interval.equals("byHour")) {
  5. return new Hour(date);
  6. }
  7. else if (interval.equals("byDay")) {
  8. return new Day(date);
  9. }
  10. else if (interval.equals("byMonth")) {
  11. return new Month(date);
  12. }
  13. }
  14. return new Week(date);
  15. }

代码示例来源:origin: jasperreports/jasperreports

  1. Minute m0 = new Minute(0, new Hour(i, today));
  2. Minute m1 = new Minute(15, new Hour(i, today));
  3. Minute m2 = new Minute(30, new Hour(i, today));
  4. Minute m3 = new Minute(45, new Hour(i, today));
  5. Minute m4 = new Minute(0, new Hour(i + 1, today));
  6. series1.add(new SimpleTimePeriod(m0.getStart(), m1.getStart()), Math.random());
  7. series2.add(new SimpleTimePeriod(m1.getStart(), m2.getStart()), Math.random());

代码示例来源:origin: org.openfuxml/ofx-chart

  1. private IntervalXYDataset createDataset(List<DataSet> lContainer)
  2. {
  3. TimeSeriesCollection dataset = new TimeSeriesCollection();
  4. for(DataSet container : lContainer)
  5. {
  6. TimeSeries ts = new TimeSeries(container.getLabel());
  7. for(Data data : container.getData())
  8. {
  9. Date d = DateUtil.getDateFromInt(data.getRecord().getYear(), data.getRecord().getMonth(), data.getRecord().getDay());
  10. ts.addOrUpdate(new Hour(d), data.getY());
  11. }
  12. dataset.addSeries(ts);
  13. }
  14. return dataset;
  15. }
  16. }

相关文章