Examples of HashSet


Examples of java.util.HashSet

  /***
  Use this for getting months, when the user gives it to you 1 based, but java wants it 0 based.
  ***/
  private HashSet getNumberSetHoldTheEvil(String list, int low, int high, String key)
  {
    HashSet old = getNumberSet(list, low, high, key);
    HashSet result = new HashSet();

    for ( Iterator it = old.iterator();it.hasNext(); ){
      result.add( new Integer( ((Integer)it.next()).intValue()-1 ) );
    }

    return result;

  }
View Full Code Here

Examples of java.util.HashSet

  /***
  split a list into validated ByDay objects
  ***/
  private HashSet getWeekDaySet(String list)
  {
    HashSet result = new HashSet();
    StringTokenizer stk = new StringTokenizer(list,",");
    while ( stk.hasMoreTokens() ){
      ByDay bd = new ByDay(stk.nextToken());
      if ( bd.count != 0 &&
           !( "MONTHLY".equals(freq) || "YEARLY".equals(freq) ) ) {
        throw new IllegalArgumentException("  ERROR: You can only specify a number with a week day in the YEARLY or MONTHLY frequencies.");
      }
      result.add( bd );
    }
    return result;
  }
View Full Code Here

Examples of java.util.HashSet

  @return true iff the date is part of the meta set
  ***/
  private boolean isDateInMetaSet(Calendar curProtoDate , int unit , HashSet metaSet)
  {
    Integer cur = new Integer( curProtoDate.get(unit) );
    HashSet locallyValidSet = (HashSet)metaSet.clone();

    int localMax = curProtoDate.getActualMaximum(unit);
    int modVal;

    for ( Iterator it = locallyValidSet.iterator() ; it.hasNext() ; ){
      modVal = ((Integer)it.next()).intValue();
      if ( modVal<0 ){
        //-1 implies the last item in the group, so the +1 makes it all work out.
        locallyValidSet.add( new Integer( modVal+localMax+1 ) );
      }
    }

    if ( !locallyValidSet.contains(cur) ){
      return false;
    }

    return true;
  }
View Full Code Here

Examples of java.util.HashSet

  {
    if ( metaSet==null || metaSet.size()==0 ) {
      return origSet;
    }

    HashSet result = new HashSet();

    for ( Iterator oit = origSet.iterator() ; oit.hasNext() ; ){
      Calendar curProtoDate = (Calendar)oit.next();

      int localMax = curProtoDate.getActualMaximum(unit);
      int modVal;

      for ( Iterator it = metaSet.iterator() ; it.hasNext() ; ){
        modVal = ((Integer)it.next()).intValue();
        if ( modVal<0 ){
          //-1 implies the last item in the group, so the +1 makes it all work out.
          modVal = modVal+localMax+1;
        }
        Calendar newDate = (Calendar)curProtoDate.clone();
        newDate.set(unit,modVal);
        result.add(newDate);
      }
    }

    return result;
  }
View Full Code Here

Examples of java.util.HashSet

    if ( "YEARLY".equals(freq) ){
      unit = Calendar.YEAR;
    }
    println("in bwdms: unit = "+unit);

    HashSet result = new HashSet();

    for ( Iterator oit = origSet.iterator() ; oit.hasNext() ; ){
      Calendar curProtoDate = (Calendar)oit.next();

      for ( Iterator it = metaSet.iterator() ; it.hasNext() ; ){
        ByDay bd  = (ByDay)it.next();

        if ( bd.count==0 ){
          println("in bwdms: finding all");
          // they want all occurrences
          ByDay localbd = new ByDay(1,bd.weekday);


          Calendar str = Calendar.getInstance();
          str.setTime(start);
          Calendar hunter = huntDayOfWeek( str , localbd);

          // some of the other BYxyz commands may limit the scope of this breeding.
          // figure that out here
          int localUnit = unit;
          boolean needSameMonth = false;
          boolean needSameWeek = false;
          boolean needSameDay = false;
          if ( foundByMonth || "MONTHLY".equals(freq) ) needSameMonth = true;
          //if ( foundByMonthDay || foundByWeekNo || foundByYearDay || "WEEKLY".equals(freq) ) needSameWeek = true;
          if ( foundByWeekNo || "WEEKLY".equals(freq) ) needSameWeek = true;
          if ( foundByMonthDay || foundByYearDay || "DAILY".equals(freq) ) needSameDay = true;

          println("nsm "+needSameMonth);
          println("nsw "+needSameWeek);
          println("nsd "+needSameDay);

          while ( hunter.getTime().before(end) ){               //JJHNOTE
            if ( hunter.get(Calendar.YEAR) == curProtoDate.get(Calendar.YEAR) ){
              if ( !needSameMonth || ( needSameMonth && hunter.get(Calendar.MONTH) == curProtoDate.get(Calendar.MONTH) ) ){
                if ( !needSameWeek || ( needSameWeek && hunter.get(Calendar.WEEK_OF_YEAR) == curProtoDate.get(Calendar.WEEK_OF_YEAR)) ){
                  if ( !needSameDay || ( needSameDay && hunter.get(Calendar.DAY_OF_YEAR) == curProtoDate.get(Calendar.DAY_OF_YEAR)) ){
                    result.add( hunter.clone() );
                  }
                }
              }
            }
            hunter.add( Calendar.WEEK_OF_YEAR, 1);
          }

        }
        else{
          println("in bwdms: finding specific");
          // they want a specific count
          result.add( huntDayOfWeek(curProtoDate, bd) );
        }
      }
    }

    return result;
View Full Code Here

Examples of java.util.HashSet

public class ProcessHandler extends BaseAbstractHandler implements Handler {
   
    public ProcessHandler() {
        if ( (this.validParents == null) && (this.validPeers == null) ) {
            this.validParents = new HashSet();
            this.validParents.add( null );

            this.validPeers = new HashSet();
            this.validPeers.add( null );

            this.allowNesting = false;
        }
    }
View Full Code Here

Examples of java.util.HashSet

import org.xml.sax.SAXParseException;

public class ConnectionHandler extends BaseAbstractHandler implements Handler {
  public ConnectionHandler() {
    if ((this.validParents == null) && (this.validPeers == null)) {
      this.validParents = new HashSet();
      this.validParents.add(NodeContainer.class);

      this.validPeers = new HashSet();
      this.validPeers.add(null);
      this.validPeers.add(Connection.class);

      this.allowNesting = false;
    }
View Full Code Here

Examples of java.util.HashSet

public class InPortHandler extends BaseAbstractHandler
    implements
    Handler {
    public InPortHandler() {
        if ( (this.validParents == null) && (this.validPeers == null) ) {
            this.validParents = new HashSet();
            this.validParents.add( CompositeNode.class );

            this.validPeers = new HashSet();        
            this.validPeers.add( null );

            this.allowNesting = false;
        }
    }
View Full Code Here

Examples of java.util.HashSet

public class MetaDataHandler extends BaseAbstractHandler
    implements
    Handler {
    public MetaDataHandler() {
        if ( (this.validParents == null) && (this.validPeers == null) ) {
            this.validParents = new HashSet();
            this.validParents.add( Node.class );

            this.validPeers = new HashSet();        
            this.validPeers.add( null );

            this.allowNesting = false;
        }
    }
View Full Code Here

Examples of java.util.HashSet

public class WorkHandler extends BaseAbstractHandler implements Handler {
   
    public WorkHandler() {
        if ((this.validParents == null) && (this.validPeers == null)) {
            this.validParents = new HashSet();
            this.validParents.add(WorkItemNode.class);

            this.validPeers = new HashSet();
            this.validPeers.add(null);

            this.allowNesting = false;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.