org.nuiton.wikitty.query
Class WikittyQueryResult<T>

java.lang.Object
  extended by org.nuiton.wikitty.query.WikittyQueryResult<T>
All Implemented Interfaces:
Serializable, Iterable<T>

public class WikittyQueryResult<T>
extends Object
implements Serializable, Iterable<T>

Represente un resultat de requete WikittyQuery. Pour caster les valeurs dans une autre representation vous pouvez utiliser la methode WikittyClient#cast(org.nuiton.wikitty.query.WikittyQueryResult, java.lang.Class)

Since:
3.3 Last update: $Date$ by : $Author$
Version:
$Revision$
Author:
poussin
See Also:
Serialized Form

Field Summary
protected  Map<String,List<FacetTopic>> facets
          facet asked or null if no facet
protected  Map<String,Map<String,FacetTopic>> facetsAsMap
          facet asked of null if no facet, FacetTopic are put in map with key topic name, To use this variable, you must used getter, because, this variable is lazy loaded from facets variable.
protected  int first
          indice of first result in global search result
protected  String queryName
          nom du critere qui a ete uitilise (peut-etre null) si le critete n'avait pas de nom
protected  String queryString
          query really executed (internal representation depend of search engine used
protected  List<T> results
          list of result in the wanted interval
protected  int totalResult
          total number of result if we call the query for all possible result
 
Constructor Summary
WikittyQueryResult(String queryName, int first, int totalResult, String queryString, Map<String,List<FacetTopic>> facets, List<T> results)
          Init paged result.
 
Method Summary
 T get(int i)
          Return element at index.
 List<T> getAll()
          Return unmodifiable list of all result.
 Collection<String> getFacetNames()
          Return name of all facet used in query.
 Map<String,List<FacetTopic>> getFacets()
          Get map represent facets.
 Map<String,Map<String,FacetTopic>> getFacetsAsMap()
           
 int getFirst()
           
 String getQueryName()
           
 String getQueryString()
           
 List<FacetTopic> getTopic(String facetName)
          Return all topic for the specified facet.
 FacetTopic getTopic(String facetName, String topicName)
          Return topic for the specified facet and topic name.
 int getTopicCount(String facetName, String topicName)
          Return topic count for the specified facet and topic name.
 int getTotalResult()
           
 Iterator<T> iterator()
          Iterate on result, same as getAll().iterator().
 T peek()
          Return the first element in result Can throw an exception if no element available
 int size()
          Return the number of result in this object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

queryName

protected String queryName
nom du critere qui a ete uitilise (peut-etre null) si le critete n'avait pas de nom


first

protected int first
indice of first result in global search result


totalResult

protected int totalResult
total number of result if we call the query for all possible result


queryString

protected String queryString
query really executed (internal representation depend of search engine used


results

protected List<T> results
list of result in the wanted interval


facets

protected Map<String,List<FacetTopic>> facets
facet asked or null if no facet


facetsAsMap

protected Map<String,Map<String,FacetTopic>> facetsAsMap
facet asked of null if no facet, FacetTopic are put in map with key topic name, To use this variable, you must used getter, because, this variable is lazy loaded from facets variable.

Constructor Detail

WikittyQueryResult

public WikittyQueryResult(String queryName,
                          int first,
                          int totalResult,
                          String queryString,
                          Map<String,List<FacetTopic>> facets,
                          List<T> results)
Init paged result. we don't initialize securityToken

Parameters:
first - indice element in global search result
totalResult - total number of result if we call the query for all possible result
queryString - query really executed
facets - facet asked or null if no facet
results - list of result in the wanted interval
Method Detail

getQueryName

public String getQueryName()

getFirst

public int getFirst()

getTotalResult

public int getTotalResult()

getQueryString

public String getQueryString()

getFacetNames

public Collection<String> getFacetNames()
Return name of all facet used in query.

Returns:
result's facets names

getTopic

public List<FacetTopic> getTopic(String facetName)
Return all topic for the specified facet.

Parameters:
facetName - name of the wanted facet
Returns:
facet's topics

getTopic

public FacetTopic getTopic(String facetName,
                           String topicName)
Return topic for the specified facet and topic name.

Parameters:
facetName - name of the wanted facet
topicName - name of the wanted topic
Returns:
topic

getTopicCount

public int getTopicCount(String facetName,
                         String topicName)
Return topic count for the specified facet and topic name. If facet or topic don't exist, return 0.

Parameters:
facetName - name of the wanted facet
topicName - name of the wanted topic
Returns:
topic count or 0

getFacets

public Map<String,List<FacetTopic>> getFacets()
Get map represent facets.

Returns:
all facets

getFacetsAsMap

public Map<String,Map<String,FacetTopic>> getFacetsAsMap()

peek

public T peek()
Return the first element in result Can throw an exception if no element available

Returns:
first element

get

public T get(int i)
Return element at index.

Parameters:
i - index
Returns:
element at index

getAll

public List<T> getAll()
Return unmodifiable list of all result.

Returns:
all results

size

public int size()
Return the number of result in this object.

Returns:
result number

iterator

public Iterator<T> iterator()
Iterate on result, same as getAll().iterator().

Specified by:
iterator in interface Iterable<T>
Returns:

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2012 CodeLutin. All Rights Reserved.