com.atlassian.greenhopper.service.lexorank.balance
Class LexoRankBalanceOperation

java.lang.Object
  extended by com.atlassian.greenhopper.service.lexorank.balance.LexoRankBalanceOperation

public class LexoRankBalanceOperation
extends java.lang.Object

Encapsulates a single balance operation in a command pattern.

Balancing the rank values for a rank field is required when the range of potential rank values is exhausted.

A balance operation will move a single rank row between buckets. There are 3 buckets in which a rank row can be placed:

- Bucket 0 - Bucket 1 - Bucket 2

A rank row can be moved from one bucket to another to facilitate a balancing of the distribution of rank values for a certain rank field.

The possible transition between buckets is :

- Bucket 0 -> Bucket 1 - Bucket 1 -> Bucket 2 - Bucket 2 -> Bucket 0

In order to move a rank row between buckets, a lock needs to be acquired on the rank row to be moved and the rows it is to be ranked between. These rows where the rank row being balance will be placed in between are the maximum marker row and the previous row when ranking to a greater bucket, and the minimum marker row and the next rank row if moving from the largest bucket ot the smallest bucket.

To start the rebalancing of rank rows for a certain rank custom field, one would move the maximum or minimum marker row to the next bucket to create an imbalance. This imbalance is then used by subsequent LexoRankOperation's op type MOVE_NEXT to find the next rank row to migrate to the next bucket. Once all rank rows are in the new bucket, the rebalancing of a rank custom field is considered complete.


Nested Class Summary
static class LexoRankBalanceOperation.BalanceOperationType
           
static interface LexoRankBalanceOperation.BucketToMigrateTo
           
static interface LexoRankBalanceOperation.CompleteBalanceOperation
           
static interface LexoRankBalanceOperation.FieldToBalance
           
static interface LexoRankBalanceOperation.TypeOfBalanceOperation
           
 
Method Summary
static LexoRankBalanceOperation.FieldToBalance builder(LexoRankDao lexoRankDao, LexoRankStatisticsAgent lexoRankStatisticsAgent)
           
 LexoRankOperationOutcome<LexoRankBalanceChange> execute()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

builder

public static LexoRankBalanceOperation.FieldToBalance builder(LexoRankDao lexoRankDao,
                                                              LexoRankStatisticsAgent lexoRankStatisticsAgent)

execute

public LexoRankOperationOutcome<LexoRankBalanceChange> execute()


Copyright © 2007-2014 Atlassian. All Rights Reserved.