Class PrintDayTotals

java.lang.Object
com.globalmentor.application.AbstractApplication
com.globalmentor.application.BaseCliApplication
com.globalmentor.calendar.calculator.PrintDayTotals
All Implemented Interfaces:
com.globalmentor.application.Application, com.globalmentor.model.Named<String>, io.clogr.Clogged, Runnable

public class PrintDayTotals extends com.globalmentor.application.BaseCliApplication
A console application to print the totals of days overlapping some ranges. This is useful, for example, in calculating the number of days in a country for compliance with visa restrictions.

Ranges are in the form from,to, e.g.:

2010-01-02,2010-01-05
2010-03-10,2010-04-04

Output has five or six columns, depending on whether a maximum number of days was indicated: positive-count-flag,date,count,run-total,window-total,difference, e.g.:

*,2013-02-18,1,1,136,44
*,2013-02-19,1,2,136,44
*,2013-02-20,,,135,45

If no historyCount is given, the value will default to windowSize.

Examples:

Print totals from 2010-02-04 to 2011-02-03 from the file ranges.txt:

PrintDayTotals 2011-02-03 365 < ranges.txt

Print totals from 2010-02-04 to 2011-02-03 from the file ranges.txt, indicating the difference of each from 180:

PrintDayTotals 2011-02-03 365 180 < ranges.txt
Author:
Garret Wilson
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Whether a range bound should be included in the totals.

    Nested classes/interfaces inherited from class com.globalmentor.application.BaseCliApplication

    com.globalmentor.application.BaseCliApplication.MetadataProvider
  • Field Summary

    Fields inherited from class com.globalmentor.application.BaseCliApplication

    CONFIG_KEY_NAME, CONFIG_KEY_VERSION, DEFAULT_TERMINAL_WIDTH

    Fields inherited from interface com.globalmentor.application.Application

    EXIT_CODE_CONTINUE, EXIT_CODE_OK, EXIT_CODE_SOFTWARE, EXIT_CODE_USAGE, NO_ARGUMENTS
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    main(String[] args)
    Main program entry method.
    void
    run()
     

    Methods inherited from class com.globalmentor.application.BaseCliApplication

    cleanup, execute, getName, getVersion, initialize, isDebug, isQuiet, isVerbose, logAppInfo, onExit, reportError, reportError, reportError, setDebug, setQuiet, setTrace, setVerbose, updateLogLevel

    Methods inherited from class com.globalmentor.application.AbstractApplication

    canEnd, canStart, end, exit, findShutdownDelay, getArgs, getAuthenticator, getExpirationDate, getPreferences, isShuttingDown, onShutdown, setAuthenticator, setExpirationDate, setShutdownDelay, start, toErrorMessage

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.globalmentor.application.Application

    end

    Methods inherited from interface io.clogr.Clogged

    getLogger
  • Constructor Details

    • PrintDayTotals

      public PrintDayTotals(@Nonnull String[] args)
      Constructor.
      Parameters:
      args - The command line arguments.
  • Method Details

    • main

      public static void main(@Nonnull String[] args)
      Main program entry method.
      Parameters:
      args - Program arguments.
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class com.globalmentor.application.BaseCliApplication