Class ComparisonQueue

java.lang.Object
com._1c.g5.v8.dt.internal.compare.queue.ComparisonQueue

public class ComparisonQueue extends Object
DT project comparison queue used in the comparison process for comparing model nodes. It organizes comparison tasks represented by identifiers of model nodes to be compared by scheduling new tasks, gathering next tasks to be executed, and prioritizing existing tasks on request.
  • Constructor Details

    • ComparisonQueue

      public ComparisonQueue(ComparisonSession comparisonSession)
      Constructs a comparison queue.
      Parameters:
      comparisonSession - the comparison session of the queue
  • Method Details

    • comparisonFinished

      public void comparisonFinished(Long id)
      Confirms the comparison process completion of a task with the specified id.
      Parameters:
      id - the completed task id, not null
    • gather

      public Long gather()
      Gathers a new task to be executed.
      Returns:
      a new task id, may be null if the queue is empty or no tasks are currently available
    • getTotalTopObjects

      public int getTotalTopObjects()
      Returns the total number of top objects in the queue.
      Returns:
      the total number of top objects in the queue
    • isFinished

      public boolean isFinished()
      Checks if the queue is currently finished, that is, it has no pending or currently executed tasks.
      Returns:
      true if the queue is currently finished, and false otherwise
    • isScheduled

      public boolean isScheduled(Long id)
      Checks if the task is already scheduled but not processed yet.
      Parameters:
      id - The comparison node to check.
      Returns:
      True of the task is already scheduled. False otherwise.
    • prioritize

      public void prioritize(List<Long> nodeIds)
      Adds the specified nodes to the list of priority tasks. This also includes recursive adding of all tasks that represent the children of these nodes to the priority list.
      Parameters:
      nodeIds - the ids of the nodes to be added to priority tasks, not null
    • rescheduleFailedComparison

      public void rescheduleFailedComparison(Long id)
      Reschedules the task at the end of the queue that failed to compare by some reason.
      Parameters:
      id - the task id to reschedule, not null
    • rescheduleFailedComparison

      public void rescheduleFailedComparison(Long id, boolean heavy)
    • schedule

      public void schedule(long nodeId)
      Schedules the comparison of the specified node.
      Parameters:
      nodeId - the scheduled node identifier