rainbowie
Class RequirementList

java.lang.Object
  extended byrainbowie.RequirementList

public class RequirementList
extends java.lang.Object

Defines a list of requirements.

Author:
Mikael Jönsson & Per Klingnäs

Field Summary
static int DOLLAR
           
private  int lastSortColumn
           
static int PAIR_WISE
           
static int PLANNING_GAME
           
private  java.lang.String prioCriteria1
           
private  java.lang.String prioCriteria2
           
private  int prioMethod
           
private  boolean sortInvert
           
private  java.util.LinkedList theList
           
 
Constructor Summary
RequirementList()
          Constructs an empty requirement list
 
Method Summary
 void addRequirement(Requirement req)
          Adds a requirement to the last posistion in the list
private  boolean aSmallerThanB(double a, double b)
          Checks if a shall be considered smaller than b depending on the sort order
private  boolean aSmallerThanB(int a, int b)
          Checks if a shall be considered smaller than b depending on the sort order
private  boolean aSmallerThanB(java.lang.String a, java.lang.String b)
          Checks if a shall be considered smaller than b depending on the sort order
 RequirementList getClampedCopy()
          Returns a copy of the list where requirements that miss requirement numbers are removed
 int getIndexOf(Requirement req)
          Returns the position whithin the list where the specified requirement can be found
 int getLength()
          Returns the number of requirements in the list
 java.lang.String getPrioCriteria1()
          Returns the first prioritization criteria
 java.lang.String getPrioCriteria2()
          Returns the second prioritization criteria
 int getPrioMethod()
          Returns the prioritization method used
 Requirement getReq(int i)
          Returns the requirement at the specified position in the list
 Requirement getReq(java.lang.String reqNbr)
          Returns the requirement, if any, with the given requirement number
 java.lang.String[][] getReqList(boolean complete)
          Returns the list in a matrix format where each row defines a requirement as:
{requirement number, requirement description, release number, (first priority, second priority) }
 RequirementList getSortedList(int k)
          Sorts and returns the list
 void removeReq(Requirement req)
          Removes the specified requirement from the list
 void setPrioCriteria1(java.lang.String prioCriteria1)
          Sets the first prioritization criteria
 void setPrioCriteria2(java.lang.String prioCriteria2)
          Sets the second prioritization criteria
 void setPrioMethod(int prioMethod)
          Sets the prioritization method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLANNING_GAME

public static final int PLANNING_GAME
See Also:
Constant Field Values

PAIR_WISE

public static final int PAIR_WISE
See Also:
Constant Field Values

DOLLAR

public static final int DOLLAR
See Also:
Constant Field Values

theList

private java.util.LinkedList theList

prioMethod

private int prioMethod

sortInvert

private boolean sortInvert

lastSortColumn

private int lastSortColumn

prioCriteria1

private java.lang.String prioCriteria1

prioCriteria2

private java.lang.String prioCriteria2
Constructor Detail

RequirementList

public RequirementList()
Constructs an empty requirement list

Method Detail

addRequirement

public void addRequirement(Requirement req)
Adds a requirement to the last posistion in the list

Parameters:
req - the requirement to add

getReq

public Requirement getReq(java.lang.String reqNbr)
Returns the requirement, if any, with the given requirement number

Parameters:
reqNbr - the requirement number to find in the list
Returns:
the requirement if it is found in the list, null if not

getReq

public Requirement getReq(int i)
Returns the requirement at the specified position in the list

Parameters:
i - the position in the list with i=0 as the first position
Returns:
the requirement if the given position is within the list, null if not

getIndexOf

public int getIndexOf(Requirement req)
Returns the position whithin the list where the specified requirement can be found

Parameters:
req - a reference to the requirement to find
Returns:
the position of the specified requirement if it is founs, -1 if not

getReqList

public java.lang.String[][] getReqList(boolean complete)
Returns the list in a matrix format where each row defines a requirement as:
{requirement number, requirement description, release number, (first priority, second priority) }

Parameters:
complete - true if priorities shall be included
Returns:
the requirement matrix

removeReq

public void removeReq(Requirement req)
Removes the specified requirement from the list

Parameters:
req - a reference to the requirement to remove

getClampedCopy

public RequirementList getClampedCopy()
Returns a copy of the list where requirements that miss requirement numbers are removed

Returns:
the clamped copy

getLength

public int getLength()
Returns the number of requirements in the list

Returns:
the number of requirements in the list

getPrioCriteria1

public java.lang.String getPrioCriteria1()
Returns the first prioritization criteria

Returns:
the first prioritization criteria.

setPrioCriteria1

public void setPrioCriteria1(java.lang.String prioCriteria1)
Sets the first prioritization criteria

Parameters:
prioCriteria1 - the first prioritization criteria to set.

getPrioCriteria2

public java.lang.String getPrioCriteria2()
Returns the second prioritization criteria

Returns:
the second prioritization criteria.

setPrioCriteria2

public void setPrioCriteria2(java.lang.String prioCriteria2)
Sets the second prioritization criteria

Parameters:
prioCriteria2 - the second prioritization criteria to set.

getPrioMethod

public int getPrioMethod()
Returns the prioritization method used

Returns:
the prioritization method.

setPrioMethod

public void setPrioMethod(int prioMethod)
Sets the prioritization method

Parameters:
prioMethod - prioritization method to set.

getSortedList

public RequirementList getSortedList(int k)
Sorts and returns the list

Parameters:
k - decides the sort criteria:
k=0 -> Requirement number
k=1 -> Requirement description
k=2 -> Release number
k=3 -> first prioritization criteria
k=4 -> second prioritization criteria
Returns:
the sorted RequirementList

aSmallerThanB

private boolean aSmallerThanB(int a,
                              int b)
Checks if a shall be considered smaller than b depending on the sort order

Parameters:
a - first int
b - second int
Returns:
true if a is smaller than b and normal sort is done

aSmallerThanB

private boolean aSmallerThanB(double a,
                              double b)
Checks if a shall be considered smaller than b depending on the sort order

Parameters:
a - first double
b - secod double
Returns:
true if a is smaller than b and normal sort is done

aSmallerThanB

private boolean aSmallerThanB(java.lang.String a,
                              java.lang.String b)
Checks if a shall be considered smaller than b depending on the sort order

Parameters:
a - first String
b - second String
Returns:
true if a is smaller than b and normal sort is done