Package com.projity.datatype

Examples of com.projity.datatype.Rate


  private boolean isAssignmentListEmpty() {
    return (assignments == null) || assignments.size() == 0;
  }
 
  public Rate getRate() {
    Rate commonValue = (Rate) Assignment.getRateField().getCommonValue(assignments,false,false);
    if (commonValue == null) {
      if (isAssignmentListEmpty()) {
        if (getResource().isLabor())
          return ClassUtils.defaultRate;
        else
View Full Code Here


      }
    }
   
    double percent = 1.0D;
    Resource resource = (Resource)(parameters.isLeftAssociation() ? found : parameters.getThisObject());
    Rate rate = null;
    if (matcher.group(2) != null) { // if text was empty use default
      if (!getParameters().isAllowDetailsEntry())
        throw new ParseException(Messages.getString("Message.cannotEnterUnits"),0);
      RateFormat format = resource.getRateFormat();
      rate = (Rate) format.parseObject(matcher.group(2));
      percent = rate.getValue();
//      Number percentNumber;
//      if (resource.isLabor())
//        percentNumber = percentFormat.parse(matcher.group(2)+ Settings.PERCENT); // force a percent sign at the end for labor.  If there are two, it is ignored
//      else //TODO allow parsing values like 3/d for material resources
//        percentNumber = NumberFormat.getInstance().parse(matcher.group(2));
//     
//      if (percentNumber == null)
//        throw new ParseException(getErrorMessage(string), pos.getIndex());
//      percent = percentNumber.doubleValue();
    } else if (resource.isMaterial()) {
      rate = new Rate(1,TimeUnit.NON_TEMPORAL);
    }
    Assignment ass = Assignment.getInstance((Task) (parameters.isLeftAssociation() ? parameters.getThisObject() : found),
                    resource,
                      percent,
                    0);
View Full Code Here

* @param from Assignment to copy from
*/
  public void usePropertiesOf(Assignment from) {
    boolean compatibleTypes = isLabor() == from.isLabor();
    double units = getUnits();
    Rate r = getRate();
    Resource resource = getResource();
    detail = (AssignmentDetail) from.detail.clone();
      detail.replaceResourceAndUnits(units,resource);

    if (!compatibleTypes) // don't want to set units if not compatible
View Full Code Here

        value = NumberFormat.getInstance().parseObject(editor.getTextField().getText());
    } catch (ParseException e) {
      return null;
    }
    if (field.isRate())
      value = new Rate(((Number)value).doubleValue());
    return value;
  }
View Full Code Here

    boolean oldIsLabor = isLabor();
    this.resourceType = resourceType;

    // if resource type changes to/from labor, then initialize rates
    if (oldIsLabor != isLabor()) {
      setStandardRate(new Rate());
      setOvertimeRate(new Rate());

      if (!isLabor()) { // Non labor resources have no time unit
        getStandardRate().setTimeUnit(TimeUnit.NON_TEMPORAL);
        getOvertimeRate().setTimeUnit(TimeUnit.NON_TEMPORAL);
      }
View Full Code Here

TOP

Related Classes of com.projity.datatype.Rate

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.