prioritizer
Class Pairwise.ComparisonList

java.lang.Object
  extended byprioritizer.Pairwise.ComparisonList
Enclosing class:
Pairwise

class Pairwise.ComparisonList
extends java.lang.Object

Represents the list containing the comparisons.

The comparison between two requirements are represented in an array that we call a row, each row contains information about the two requirements and the value of the prioritization between them. A row has the format: row[index1][req1][index2][req2][value] where

  • index1 - is the position of the first Requirement in the RequirementList
  • req1 - is the first Requirement
  • index2 - is the position of the second Requirement in the RequirementList
  • req2 - is the second Requirement
  • value - is the value of the prioritization between req1 and req2


    Field Summary
    private  java.util.LinkedList theList
               
     
    Constructor Summary
    Pairwise.ComparisonList()
              Creates a new ComparisonList.
     
    Method Summary
     void addRow(int index1, Requirement req1, int index2, Requirement req2, double value)
              Sets a row/array that represents a pair of requirements to be compared.
     void addRow(java.lang.Object[] row)
              Adds an element (row/array of elements) that represents one comparison, to the list.
     int getLength()
              Gets the number of elements in the list.
     java.lang.Object[] getRow(int i)
              Gets the element at the specified position in the list
     java.lang.Object[] removeRow(int i)
              Removes the element at the specified position in the list
     boolean rowExists(Requirement r1, Requirement r2)
              Checks if a comparison between the two specified requirements exists in the list
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    theList

    private java.util.LinkedList theList
    Constructor Detail

    Pairwise.ComparisonList

    public Pairwise.ComparisonList()
    Creates a new ComparisonList.

    Method Detail

    addRow

    public void addRow(int index1,
                       Requirement req1,
                       int index2,
                       Requirement req2,
                       double value)
    Sets a row/array that represents a pair of requirements to be compared.

    Parameters:
    index1 - the RequirementList index of the first Requirement
    req1 - the first Requirement
    index2 - the RequirementList index of the second Requirement
    req2 - the second Requirement
    value - the result of the comparison. Will always be 0.0 here since no comparisons have been done yet.

    addRow

    public void addRow(java.lang.Object[] row)
    Adds an element (row/array of elements) that represents one comparison, to the list.


    getLength

    public int getLength()
    Gets the number of elements in the list.

    Returns:
    the number of elements in the list

    getRow

    public java.lang.Object[] getRow(int i)
    Gets the element at the specified position in the list

    Parameters:
    i - the index of the element to return
    Returns:
    the element representing the given comparison

    removeRow

    public java.lang.Object[] removeRow(int i)
    Removes the element at the specified position in the list

    Parameters:
    i - the index of the element to remove
    Returns:
    the removed element

    rowExists

    public boolean rowExists(Requirement r1,
                             Requirement r2)
    Checks if a comparison between the two specified requirements exists in the list

    Parameters:
    r1 - the first requirement
    r2 - the second requirement
    Returns:
    true if the comparison exists, false if not