Test the list of TimephasedWork instances to see
if any of them have been modified.

@param list list of TimephasedWork instances
@return boolean flag
485909
public boolean getWorkModified(List<TimephasedWork> list)
   {
      boolean result = false;
      for (TimephasedWork assignment : list)
      {
         result = assignment.getModified();
         if (result)
         {
            break;
         }
      }
      return result;
   }
1269735
public static <T> boolean listContainsDuplicates(List<T> list) {
        return list.size() != new HashSet<>(list).size();
    }
1105681
public final boolean hasFreshData(InternalClock t) {
    if (nextRefreshTime >= DATA_VALID) {
      return true;
    }
    if (needsTimeCheck()) {
      return t.millis() < -nextRefreshTime;
    }
    return false;
  }
21626
private static boolean isRpcTimeout(Annotation[] annotations) {
		for (Annotation annotation : annotations) {
			if (annotation.annotationType().equals(RpcTimeout.class)) {
				return true;
			}
		}

		return false;
	}
1112053
public static <T> List<T> emptyToNull(final List<T> list) {
        if (isEmpty(list)) {
            return null;
        } else {
            return list;
        }
    }
295001
private List<TimephasedCost> getTimephasedCostSingleRate(List<TimephasedWork> standardWorkList, List<TimephasedWork> overtimeWorkList)
   {
      List<TimephasedCost> result = new LinkedList<TimephasedCost>();

      //just return an empty list if there is no timephased work passed in
      if (standardWorkList == null)
      {
         return result;
      }

      //takes care of the situation where there is no timephased overtime work
      Iterator<TimephasedWork> overtimeIterator = overtimeWorkList == null ? java.util.Collections.<TimephasedWork> emptyList().iterator() : overtimeWorkList.iterator();

      for (TimephasedWork standardWork : standardWorkList)
      {
         CostRateTableEntry rate = getCostRateTableEntry(standardWork.getStart());
         double standardRateValue = rate.getStandardRate().getAmount();
         TimeUnit standardRateUnits = rate.getStandardRate().getUnits();
         double overtimeRateValue = 0;
         TimeUnit overtimeRateUnits = standardRateUnits;

         if (rate.getOvertimeRate() != null)
         {
            overtimeRateValue = rate.getOvertimeRate().getAmount();
            overtimeRateUnits = rate.getOvertimeRate().getUnits();
         }

         TimephasedWork overtimeWork = overtimeIterator.hasNext() ? overtimeIterator.next() : null;

         Duration standardWorkPerDay = standardWork.getAmountPerDay();
         if (standardWorkPerDay.getUnits() != standardRateUnits)
         {
            standardWorkPerDay = standardWorkPerDay.convertUnits(standardRateUnits, getParentFile().getProjectProperties());
         }

         Duration totalStandardWork = standardWork.getTotalAmount();
         if (totalStandardWork.getUnits() != standardRateUnits)
         {
            totalStandardWork = totalStandardWork.convertUnits(standardRateUnits, getParentFile().getProjectProperties());
         }

         Duration overtimeWorkPerDay;
         Duration totalOvertimeWork;

         if (overtimeWork == null || overtimeWork.getTotalAmount().getDuration() == 0)
         {
            overtimeWorkPerDay = Duration.getInstance(0, standardWorkPerDay.getUnits());
            totalOvertimeWork = Duration.getInstance(0, standardWorkPerDay.getUnits());
         }
         else
         {
            overtimeWorkPerDay = overtimeWork.getAmountPerDay();
            if (overtimeWorkPerDay.getUnits() != overtimeRateUnits)
            {
               overtimeWorkPerDay = overtimeWorkPerDay.convertUnits(overtimeRateUnits, getParentFile().getProjectProperties());
            }

            totalOvertimeWork = overtimeWork.getTotalAmount();
            if (totalOvertimeWork.getUnits() != overtimeRateUnits)
            {
               totalOvertimeWork = totalOvertimeWork.convertUnits(overtimeRateUnits, getParentFile().getProjectProperties());
            }
         }

         double costPerDay = (standardWorkPerDay.getDuration() * standardRateValue) + (overtimeWorkPerDay.getDuration() * overtimeRateValue);
         double totalCost = (totalStandardWork.getDuration() * standardRateValue) + (totalOvertimeWork.getDuration() * overtimeRateValue);

         //if the overtime work does not span the same number of days as the work,
         //then we have to split this into two TimephasedCost values
         if (overtimeWork == null || (overtimeWork.getFinish().equals(standardWork.getFinish())))
         {
            //normal way
            TimephasedCost cost = new TimephasedCost();
            cost.setStart(standardWork.getStart());
            cost.setFinish(standardWork.getFinish());
            cost.setModified(standardWork.getModified());
            cost.setAmountPerDay(Double.valueOf(costPerDay));
            cost.setTotalAmount(Double.valueOf(totalCost));
            result.add(cost);

         }
         else
         {
            //prorated way
            result.addAll(splitCostProrated(getCalendar(), totalCost, costPerDay, standardWork.getStart()));
         }

      }

      return result;
   }
102828
protected void mergeSameWork(LinkedList<TimephasedWork> list)
   {
      LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>();

      TimephasedWork previousAssignment = null;
      for (TimephasedWork assignment : list)
      {
         if (previousAssignment == null)
         {
            assignment.setAmountPerDay(assignment.getTotalAmount());
            result.add(assignment);
         }
         else
         {
            Duration previousAssignmentWork = previousAssignment.getAmountPerDay();
            Duration assignmentWork = assignment.getTotalAmount();

            if (NumberHelper.equals(previousAssignmentWork.getDuration(), assignmentWork.getDuration(), 0.01))
            {
               Date assignmentStart = previousAssignment.getStart();
               Date assignmentFinish = assignment.getFinish();
               double total = previousAssignment.getTotalAmount().getDuration();
               total += assignmentWork.getDuration();
               Duration totalWork = Duration.getInstance(total, TimeUnit.MINUTES);

               TimephasedWork merged = new TimephasedWork();
               merged.setStart(assignmentStart);
               merged.setFinish(assignmentFinish);
               merged.setAmountPerDay(assignmentWork);
               merged.setTotalAmount(totalWork);

               result.removeLast();
               assignment = merged;
            }
            else
            {
               assignment.setAmountPerDay(assignment.getTotalAmount());
            }
            result.add(assignment);
         }

         previousAssignment = assignment;
      }

      list.clear();
      list.addAll(result);
   }
771767
private void mergeSameDay(ProjectCalendar calendar, LinkedList<TimephasedWork> list)
   {
      LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>();

      TimephasedWork previousAssignment = null;
      for (TimephasedWork assignment : list)
      {
         if (previousAssignment == null)
         {
            assignment.setAmountPerDay(assignment.getTotalAmount());
            result.add(assignment);
         }
         else
         {
            Date previousAssignmentStart = previousAssignment.getStart();
            Date previousAssignmentStartDay = DateHelper.getDayStartDate(previousAssignmentStart);
            Date assignmentStart = assignment.getStart();
            Date assignmentStartDay = DateHelper.getDayStartDate(assignmentStart);

            if (previousAssignmentStartDay.getTime() == assignmentStartDay.getTime())
            {
               Duration previousAssignmentWork = previousAssignment.getTotalAmount();
               Duration assignmentWork = assignment.getTotalAmount();

               if (previousAssignmentWork.getDuration() != 0 && assignmentWork.getDuration() == 0)
               {
                  continue;
               }

               result.removeLast();

               if (previousAssignmentWork.getDuration() != 0 && assignmentWork.getDuration() != 0)
               {
                  double work = previousAssignment.getTotalAmount().getDuration();
                  work += assignment.getTotalAmount().getDuration();
                  Duration totalWork = Duration.getInstance(work, TimeUnit.MINUTES);

                  TimephasedWork merged = new TimephasedWork();
                  merged.setStart(previousAssignment.getStart());
                  merged.setFinish(assignment.getFinish());
                  merged.setTotalAmount(totalWork);
                  assignment = merged;
               }
               else
               {
                  if (assignmentWork.getDuration() == 0)
                  {
                     assignment = previousAssignment;
                  }
               }
            }

            assignment.setAmountPerDay(assignment.getTotalAmount());
            result.add(assignment);
         }

         Duration calendarWork = calendar.getWork(assignment.getStart(), assignment.getFinish(), TimeUnit.MINUTES);
         Duration assignmentWork = assignment.getTotalAmount();
         if (calendarWork.getDuration() == 0 && assignmentWork.getDuration() == 0)
         {
            result.removeLast();
         }
         else
         {
            previousAssignment = assignment;
         }
      }

      list.clear();
      list.addAll(result);
   }
597843
public static <T> List<T> synchronizedList(List<T> list) {
		return Collections.synchronizedList(list);
	}
1250447
public static <T> boolean listEquals(List<T> left, List<T> right) {
        if (left == null) {
            return right == null;
        } else {
            if (right == null) {
                return false;
            }
            if (left.size() != right.size()) {
                return false;
            }

            List<T> ltmp = new ArrayList<T>(left);
            List<T> rtmp = new ArrayList<T>(right);
            for (T t : ltmp) {
                rtmp.remove(t);
            }
            return rtmp.isEmpty();
        }
    }
513351
private LinkedList<TimephasedWork> readTimephasedAssignment(ProjectCalendar calendar, Project.Assignments.Assignment assignment, int type)
   {
      LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>();

      for (TimephasedDataType item : assignment.getTimephasedData())
      {
         if (NumberHelper.getInt(item.getType()) != type)
         {
            continue;
         }

         Date startDate = item.getStart();
         Date finishDate = item.getFinish();

         // Exclude ranges which don't have a start and end date.
         // These seem to be generated by Synchro and have a zero duration.
         if (startDate == null && finishDate == null)
         {
            continue;
         }

         Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.MINUTES, item.getValue());
         if (work == null)
         {
            work = Duration.getInstance(0, TimeUnit.MINUTES);
         }
         else
         {
            work = Duration.getInstance(NumberHelper.round(work.getDuration(), 2), TimeUnit.MINUTES);
         }

         TimephasedWork tra = new TimephasedWork();
         tra.setStart(startDate);
         tra.setFinish(finishDate);
         tra.setTotalAmount(work);

         result.add(tra);
      }

      return result;
   }
404136
protected void mergeSameCost(LinkedList<TimephasedCost> list)
   {
      LinkedList<TimephasedCost> result = new LinkedList<TimephasedCost>();

      TimephasedCost previousAssignment = null;
      for (TimephasedCost assignment : list)
      {
         if (previousAssignment == null)
         {
            assignment.setAmountPerDay(assignment.getTotalAmount());
            result.add(assignment);
         }
         else
         {
            Number previousAssignmentCost = previousAssignment.getAmountPerDay();
            Number assignmentCost = assignment.getTotalAmount();

            if (NumberHelper.equals(previousAssignmentCost.doubleValue(), assignmentCost.doubleValue(), 0.01))
            {
               Date assignmentStart = previousAssignment.getStart();
               Date assignmentFinish = assignment.getFinish();
               double total = previousAssignment.getTotalAmount().doubleValue();
               total += assignmentCost.doubleValue();

               TimephasedCost merged = new TimephasedCost();
               merged.setStart(assignmentStart);
               merged.setFinish(assignmentFinish);
               merged.setAmountPerDay(assignmentCost);
               merged.setTotalAmount(Double.valueOf(total));

               result.removeLast();
               assignment = merged;
            }
            else
            {
               assignment.setAmountPerDay(assignment.getTotalAmount());
            }
            result.add(assignment);
         }

         previousAssignment = assignment;
      }

      list.clear();
      list.addAll(result);
   }
95057
public boolean hasNoTime(Statement o) {	 
        if (o instanceof HasTime) return false;
        if (o instanceof Activity) return false;
        return true;
        /* OLD Definition
         return (o instanceof WasDerivedFrom) 
        	 || (o instanceof ActedOnBehalfOf)
                 || (o instanceof WasInformedBy)
                 || (o instanceof WasAttributedTo)
                 || (o instanceof WasAssociatedWith)
                 || (o instanceof WasInfluencedBy)
                 || (o instanceof SpecializationOf)
                 || (o instanceof AlternateOf)
                 || (o instanceof MentionOf)
                 || (o instanceof HadMember);
         */
    }
513295
public final boolean isRemoveFromList(final LinkOwner list)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isRemoveFromList");

        LinkOwner myList = getLink().getOwningStreamLink();
        boolean is = (myList == list);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isRemoveFromList", Boolean.valueOf(is));
        return is;
    }
469629
private static void listTimephasedWork(ResourceAssignment assignment)
   {
      Task task = assignment.getTask();
      int days = (int) ((task.getFinish().getTime() - task.getStart().getTime()) / (1000 * 60 * 60 * 24)) + 1;
      if (days > 1)
      {
         SimpleDateFormat df = new SimpleDateFormat("dd/MM/yy");

         TimescaleUtility timescale = new TimescaleUtility();
         ArrayList<DateRange> dates = timescale.createTimescale(task.getStart(), TimescaleUnits.DAYS, days);
         TimephasedUtility timephased = new TimephasedUtility();

         ArrayList<Duration> durations = timephased.segmentWork(assignment.getCalendar(), assignment.getTimephasedWork(), TimescaleUnits.DAYS, dates);
         for (DateRange range : dates)
         {
            System.out.print(df.format(range.getStart()) + "\t");
         }
         System.out.println();
         for (Duration duration : durations)
         {
            System.out.print(duration.toString() + "        ".substring(0, 7) + "\t");
         }
         System.out.println();
      }
   }
307866
protected boolean isCacheValid(final Long lastModified) {
        return (lastModified != null && lastModified <= this.lastModifiedTime) ||
                (lastModified == null && (this.lastModifiedTime + this.noLastModifiedReloadPeriod) <= System.currentTimeMillis());
    }
677807
private static void assertAllOneTimePasses(List<PassFactory> passes) {
    for (PassFactory pass : passes) {
      checkState(pass.isOneTimePass());
    }
  }