com.atlassian.confluence.search.contentnames
Class FloatArrayDocumentResultScores

java.lang.Object
  extended by com.atlassian.confluence.search.contentnames.FloatArrayDocumentResultScores
All Implemented Interfaces:
DocumentResultScores

public class FloatArrayDocumentResultScores
extends Object
implements DocumentResultScores

A DocumentScores implementation which will keep each score in a float array where the position in the array matches the docId for each document.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.confluence.search.contentnames.DocumentResultScores
DocumentResultScores.Block
 
Constructor Summary
FloatArrayDocumentResultScores(int size)
           
 
Method Summary
 void each(DocumentResultScores.Block block)
          Iterates through all docId and score pairs where the score is greater than zero and then executes the block against each pair.
 float getScore(int docId)
          Retrieve the score for the specified docId.
 float incrementScore(int docId, byte increment)
          Increments the score for docId.
 float multiplyScore(int docId, float factor)
          Multiply the score of the specified document by the supplied factor.
 void setScore(int docId, float score)
          Override any existing score for the specified document and replace with the new supplied score.
 long size()
          Returns the number of scores.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FloatArrayDocumentResultScores

public FloatArrayDocumentResultScores(int size)
Parameters:
size - size of the underlying byte array
Method Detail

incrementScore

public float incrementScore(int docId,
                            byte increment)
Increments the score for docId. If this score exceeds Byte.MAX_VALUE the score is left at the max value.

Specified by:
incrementScore in interface DocumentResultScores
Parameters:
docId - the document id
increment - how much to increment the score by. Must be greater than 0.
Returns:
the score for docId after incrementing.

multiplyScore

public float multiplyScore(int docId,
                           float factor)
Description copied from interface: DocumentResultScores
Multiply the score of the specified document by the supplied factor.

Specified by:
multiplyScore in interface DocumentResultScores
Parameters:
docId - the document Id to change the score of
factor - the factor to multiple the document's current score by.
Returns:
the new score for the document.

getScore

public float getScore(int docId)
Description copied from interface: DocumentResultScores
Retrieve the score for the specified docId.

Specified by:
getScore in interface DocumentResultScores
Parameters:
docId - the document id
Returns:
the score for the specified docId

setScore

public void setScore(int docId,
                     float score)
Description copied from interface: DocumentResultScores
Override any existing score for the specified document and replace with the new supplied score.

Specified by:
setScore in interface DocumentResultScores
Parameters:
docId - the document Id to set the score for.
score - the new score for this document.

each

public void each(DocumentResultScores.Block block)
Description copied from interface: DocumentResultScores
Iterates through all docId and score pairs where the score is greater than zero and then executes the block against each pair.

Specified by:
each in interface DocumentResultScores
Parameters:
block - the block to run against each document id and score pair.

size

public long size()
Description copied from interface: DocumentResultScores
Returns the number of scores.

Specified by:
size in interface DocumentResultScores


Copyright © 2003–2015 Atlassian. All rights reserved.