tauZaman
v0.1

tauzaman.io
Class IOMultiplexer

java.lang.Object
  |
  +--tauzaman.io.IOMultiplexer

public class IOMultiplexer
extends java.lang.Object

IOMultiplexer, abbreviation for Input/Output Multiplexer, class classifies behaviours of different temporal data types using their parsed Fields. Fields sits between timestamp, Granule, and temporal constant, String.

Status:
design complete, implementation complete

Field Summary
private  CalendricSystem calendricSystem
          A handle to CalendricSystem, which will be used in Input/Output multiplexing
private  PropertyManager propertyManager
          A handle to PropertyManager, which will be used in Input/Output multiplexing
 
Constructor Summary
protected IOMultiplexer(CalendricSystem calendricSystem, PropertyManager propertyManager)
          Constructs a IOMultiplexer object ready to serve.
 
Method Summary
private  Granule fieldsToGranule(Fields fields)
          Returns corresponding Granule of Fields.
protected  void fillFields(Granule[] granules, Fields fields)
          Fills the values of Fields, which was formed by an output Property, according to the information in Granule.
private  void fillIndeterminateInstantFields(Granule granule, Fields fields)
           
private  void fillInstantFields(Granule granule, Fields fields)
           
private  void fillIntervalFields(Granule granule, Fields fields)
           
private  void fillNowRelativeInstantFields(Granule granule, Fields fields)
           
private  void fillPeriodFields(Granule[] granules, Fields fields)
           
protected  Granule[] getGranule(Fields fields)
          Returns an array of Granule, which is formed by using given Fields.
private  Granule getIndeterminateInstantGranule(Fields fields)
          Returns a Granule, which corresponds to an IndeterminateInstant, by using Fields.
private  Granule getInstantGranule(Fields fields)
          Returns a Granule, which corresponds to an Instant, by using Fields.
private  Granule getIntervalGranule(Fields fields)
          Returns a Granule, which corresponds to an Interval, by using Fields.
private  Granule getNowRelativeInstantGranule(Fields fields)
          Returns a Granule, which corresponds to an NowRelativeInstant, by using Fields.
private  Calendar[] getOrderedCalendars()
          Returns an array of Calendars, which are in order to call for temporal constant or timestamp parsing.
private  Granule[] getPeriodGranule(Fields fields)
          Returns an array of Granule, which corresponds to an Period, by using Fields.
private  void granuleToFields(Granule granule, Fields fields)
          Fills given Fields's Field objects according to information in Granule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

calendricSystem

private CalendricSystem calendricSystem
A handle to CalendricSystem, which will be used in Input/Output multiplexing


propertyManager

private PropertyManager propertyManager
A handle to PropertyManager, which will be used in Input/Output multiplexing

Constructor Detail

IOMultiplexer

protected IOMultiplexer(CalendricSystem calendricSystem,
                        PropertyManager propertyManager)
Constructs a IOMultiplexer object ready to serve.

Parameters:
calendricSystem - CalendricSystem, which will be used in Input/Output multiplexing
propertyManager - PropertyManager, which will be used in Input/Output multiplexing
Method Detail

getOrderedCalendars

private Calendar[] getOrderedCalendars()
                                throws IOException
Returns an array of Calendars, which are in order to call for temporal constant or timestamp parsing.

Returns:
an array of ordered Calendars
Throws:
IOException - if any abnormal condition occurs when getting ordered Calendars

fieldsToGranule

private Granule fieldsToGranule(Fields fields)
                         throws IOException
Returns corresponding Granule of Fields.

Parameters:
fields - Fields to be converted into Granule
Throws:
IOException - if any abnormal condition occurs when converting Fields to its corresponding Granule

granuleToFields

private void granuleToFields(Granule granule,
                             Fields fields)
                      throws IOException
Fills given Fields's Field objects according to information in Granule.

Parameters:
granule - Granule containing information to fill fields
fields - Fields to be filled
Throws:
IOException - if any abnormal condition occurs when filling Fields in according to information in Granule

fillFields

protected void fillFields(Granule[] granules,
                          Fields fields)
                   throws IOException
Fills the values of Fields, which was formed by an output Property, according to the information in Granule. This filled Fields will be used to form a temporal constant, that corresponds to Granule.

Parameters:
granules - an array of Granule objects, which will be used to fill fields
fields - Fields to be filled
Throws:
IOException - if any abnormal condition occurs when filling the Fields

fillInstantFields

private void fillInstantFields(Granule granule,
                               Fields fields)
                        throws IOException
IOException

fillIntervalFields

private void fillIntervalFields(Granule granule,
                                Fields fields)
                         throws IOException
IOException

fillNowRelativeInstantFields

private void fillNowRelativeInstantFields(Granule granule,
                                          Fields fields)
                                   throws IOException
IOException

fillPeriodFields

private void fillPeriodFields(Granule[] granules,
                              Fields fields)
                       throws IOException
IOException

fillIndeterminateInstantFields

private void fillIndeterminateInstantFields(Granule granule,
                                            Fields fields)
                                     throws IOException
IOException

getGranule

protected Granule[] getGranule(Fields fields)
                        throws IOException
Returns an array of Granule, which is formed by using given Fields.

Parameters:
fields - Fields, which represents temporal constant
Returns:
an array of Granule objects. Other than PeriodInputFormat only one Granule will be returned
Throws:
IOException - if any abnormal condition occurs when converting Fields to Granules

getInstantGranule

private Granule getInstantGranule(Fields fields)
                           throws IOException
Returns a Granule, which corresponds to an Instant, by using Fields.

Parameters:
fields - Fields to be converted to Granule
Returns:
a Granule, which corresponds to an Instant
Throws:
IOException - if any abnormal condition occurs when converting Fields to Granule

getIntervalGranule

private Granule getIntervalGranule(Fields fields)
                            throws IOException
Returns a Granule, which corresponds to an Interval, by using Fields.

Parameters:
fields - Fields to be converted to Granule
Returns:
a Granule, which corresponds to an Interval
Throws:
IOException - if any abnormal condition occurs when converting Fields to Granule

getNowRelativeInstantGranule

private Granule getNowRelativeInstantGranule(Fields fields)
                                      throws IOException
Returns a Granule, which corresponds to an NowRelativeInstant, by using Fields.

Parameters:
fields - Fields to be converted to Granule
Returns:
a Granule, which corresponds to a NowRelativeInstant
Throws:
IOException - if any abnormal condition occurs when converting Fields to Granule

getPeriodGranule

private Granule[] getPeriodGranule(Fields fields)
                            throws IOException
Returns an array of Granule, which corresponds to an Period, by using Fields.

Parameters:
fields - Fields to be converted to Granule
Returns:
a Granule, which corresponds to a Period
Throws:
IOException - if any abnormal condition occurs when converting Fields to Granule(s)

getIndeterminateInstantGranule

private Granule getIndeterminateInstantGranule(Fields fields)
                                        throws IOException
Returns a Granule, which corresponds to an IndeterminateInstant, by using Fields.

Parameters:
fields - Fields to be converted to Granule
Returns:
a Granule, which corresponds to a IndeterminateInstant
Throws:
IOException - if any abnormal condition occurs when converting Fields to Granule

tauZaman
v0.1

Submit a bug or feature

tauZaman is an open-source, publicly avaliable project