Java SortedSet fillOutHourly(SortedSet hours)

Here you can find the source of fillOutHourly(SortedSet hours)

Description

Fill the set of hours to be hourly

License

Open Source License

Declaration


public static SortedSet fillOutHourly(SortedSet hours) 

Method Source Code

//package com.java2s;
/*/*  w  w w .  j a v a  2  s. c o  m*/
**    Copyright (C) 2003-2012 Institute for Systems Biology 
**                            Seattle, Washington, USA. 
**
**    This library is free software; you can redistribute it and/or
**    modify it under the terms of the GNU Lesser General Public
**    License as published by the Free Software Foundation; either
**    version 2.1 of the License, or (at your option) any later version.
**
**    This library is distributed in the hope that it will be useful,
**    but WITHOUT ANY WARRANTY; without even the implied warranty of
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
**    Lesser General Public License for more details.
**
**    You should have received a copy of the GNU Lesser General Public
**    License along with this library; if not, write to the Free Software
**    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

import java.util.SortedSet;

import java.util.TreeSet;

public class Main {
    /***************************************************************************
    **
    ** Fill the set of hours to be hourly
    */

    public static SortedSet fillOutHourly(SortedSet hours) {
        TreeSet retval = new TreeSet(hours);
        if (hours.isEmpty() || (hours.size() == 1)) {
            return (retval);
        }

        int minTime = ((Integer) hours.first()).intValue() + 1;
        int maxTime = ((Integer) hours.last()).intValue() - 1;
        for (int i = minTime; i <= maxTime; i++) {
            retval.add(new Integer(i));
        }
        return (retval);
    }
}

Related

  1. computeGraphCauselessFromGraphLmms( List>>> causesByDepByNameList)
  2. computeGraphCauselessFromGraphMms( SortedMap>> causesByDepByName)
  3. copyAndClearSet(SortedSet sourceSet)
  4. doubleForDescreteStartAndEnds(SortedSet hours)
  5. entriesSortedByValues( Map map)
  6. getEntryOrEmptySet(K key, Map> map)
  7. getFlatItems(Map> linkedWorkItemIDsMap)
  8. getSortedIntersectionValues(Collection colection1, Collection colection2)
  9. getSortedTypes(Class[] types)