Package com.projity.pm.time

Examples of com.projity.pm.time.MutableInterval


  private transient static BarClosure barClosureInstance = new BarClosure();

  public void consumeIntervals(IntervalConsumer consumer) {
    barClosureInstance.initialize(consumer,this);
    boolean inProgress = getPercentComplete() > 0.0D;
    MutableInterval bounds = null;
    if (inProgress) {
      bounds = new MutableInterval(getStart(),getStop());
      barClosureInstance.setBounds(bounds);
    }
    forEachWorkingInterval(barClosureInstance,true,getEffectiveWorkCalendar());
    if (inProgress) {
//      barClosureInstance.initCount();
      bounds.setStart(bounds.getEnd()); // shift for second half
      bounds.setEnd(getEnd());

      forEachWorkingInterval(barClosureInstance,true,getEffectiveWorkCalendar());
    }
    barClosureInstance.setBounds(null);
  }
View Full Code Here


    }

    if (startOffset >=endOffset) // this prevents moving a completed interval
      return;
    boolean firstBar = (cal.compare(getStart(),start,false) == 0);
    MutableInterval range = getRangeThatIntervalCanBeMoved(start,startOffset,endOffset);
    if (firstBar)
      range.setStart(range.getStart() - calcTotalDelay());
    if (shiftDuration > 0)
      shiftDuration = Math.min(shiftDuration,range.getEnd() - endOffset); // don't allow to shift more than possible
    else {
      shiftDuration = Math.max(shiftDuration,range.getStart() /*+ (firstBar ? -calcTotalDelay() : 0)*/ - startOffset); // don't allow to shift more than possible
    }
    if (firstBar) {
      setTotalDelay(calcTotalDelay() + shiftDuration);
    } else {
      newDetail().shift(startOffset,endOffset,shiftDuration);
View Full Code Here

      newDetail().shift(startOffset,endOffset,shiftDuration);
    }
  }

  private MutableInterval getRangeThatIntervalCanBeMoved(long start, long startOffset, long endOffset) {
    MutableInterval range = getRangeThatIntervalCanBeMoved(startOffset,endOffset);
    if (getEffectiveWorkCalendar().compare(getStart(),start,false) == 0)
      range.setStart(range.getStart() - calcTotalDelay());
    return range;

  }
View Full Code Here

 
  public void setTimeBased(boolean timeBased) {
    if (timeBased) {
      // initialize interval treatment
      context = new FieldContext();
      interval = new MutableInterval(0, 0);
      context.setInterval(interval);
    }
   
  }
View Full Code Here

      if (bucket.getUnits() == 0)
        endConstraint = end + bucket.getDuration();
      else
        endConstraint = end;
    }
    return new MutableInterval(startConstraint,endConstraint);

  }
View Full Code Here

  public AbstractContour extendBefore(long startOffset, long extendDuration) {
    return this;
  }
 
  public MutableInterval getRangeThatIntervalCanBeMoved(long start, long end) {
    return new MutableInterval(start,Long.MAX_VALUE); // by default unbounded
 
View Full Code Here

        }
//      }
//      else makeServerReservationAsync(idCount);
    }
   
    MutableInterval interval;
    long id=-1;
    int size=0;
    synchronized(serverIntervals){
      for (Iterator i=serverIntervals.iterator();i.hasNext();){
        interval=(MutableInterval)i.next();
        if (id==-1){
          id=interval.getStart();
          interval.setStart(id+1);
          if (interval.getStart()>interval.getEnd()){
            i.remove();
            continue;
          }
        }
        size+=interval.getEnd()-interval.getStart()+1;
      }
    }
    if (size<getMinIdCount()) makeServerReservationAsync(idCount-size,session);
//    long r=(id==-1&&!onlyGlobal)?getLocalId():id;
//    return r;
View Full Code Here

  }
 
  protected void makeServerReservation(final int count,Session session) throws Exception{
    System.out.println("ID reservation...");
    lastIdReservation=System.currentTimeMillis();
    MutableInterval interval=(MutableInterval)SessionFactory.call(session,"bookUIDInterval",new Class[]{int.class},new Object[]{count});
    synchronized(serverIntervals){serverIntervals.add(interval);}
    System.out.println("ID reservation, new pool: "+dump());
  }
View Full Code Here

  public String dump(){
    StringBuffer buf=new StringBuffer();
    buf.append('{');
    synchronized(serverIntervals){
      for (Iterator i=serverIntervals.iterator();i.hasNext();){
        MutableInterval interval=(MutableInterval)i.next();
        buf.append('[').append(interval.getStart()).append(',').append(interval.getEnd()).append(']');
        if (i.hasNext()) buf.append(',');
      }
    }
    buf.append('}');
    return buf.toString();
View Full Code Here

TOP

Related Classes of com.projity.pm.time.MutableInterval

Copyright © 2018 www.massapicom. 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.