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.castTo(java.lang.Class, org.nuiton.wikitty.query.WikittyQueryResult)

Since:
3.3 Last update: $Date: 2012-04-05 17:31:15 +0200 (Thu, 05 Apr 2012) $ by : $Author: maven-release $
Version:
$Revision: 1462 $
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 offset
          indice of offset 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  long timeConvertion
          temps (nanoseconde) de transformation des resultats bruts en un autre type(calcul cote client)
protected  long timeQuery
          temps (nanoseconde) mis pour faire la requete (calcul cote serveur)
protected  int totalResult
          total number of result if we call the query for all possible result
 
Constructor Summary
WikittyQueryResult(String queryName, int offset, int totalResult, String queryString, Map<String,List<FacetTopic>> facets, List<T> results, long timeQuery, long timeConvertion)
          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()
          Deprecated. since 3.5 use getOffset()
 int getOffset()
           
 String getQueryName()
           
 String getQueryString()
           
 long getTimeConvertion()
          temps (nanoseconde) de transformation des resultats bruts en un autre type(calcul cote client)
 long getTimeQuery()
          temps (nanoseconde) mis pour faire la requete (calcul cote serveur)
 List<FacetTopic> getTopic(Element facetName)
          Return all topic for the specified facet.
 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 offset element in result Can throw an exception if no element available
 void setTimeConvertion(long timeConvertion)
          temps (nanoseconde) de transformation des resultats bruts en un autre type(calcul cote client)
 void setTimeQuery(long timeQuery)
          temps (nanoseconde) mis pour faire la requete (calcul cote serveur)
 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


offset

protected int offset
indice of offset 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.


timeQuery

protected long timeQuery
temps (nanoseconde) mis pour faire la requete (calcul cote serveur)


timeConvertion

protected long timeConvertion
temps (nanoseconde) de transformation des resultats bruts en un autre type(calcul cote client)

Constructor Detail

WikittyQueryResult

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

Parameters:
offset - 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

@Deprecated
public int getFirst()
Deprecated. since 3.5 use getOffset()


getOffset

public int getOffset()

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 List<FacetTopic> getTopic(Element facetName)
Return all topic for the specified facet.

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

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 offset element in result Can throw an exception if no element available

Returns:
offset 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

getTimeQuery

public long getTimeQuery()
temps (nanoseconde) mis pour faire la requete (calcul cote serveur)


setTimeQuery

public void setTimeQuery(long timeQuery)
temps (nanoseconde) mis pour faire la requete (calcul cote serveur)


getTimeConvertion

public long getTimeConvertion()
temps (nanoseconde) de transformation des resultats bruts en un autre type(calcul cote client)


setTimeConvertion

public void setTimeConvertion(long timeConvertion)
temps (nanoseconde) de transformation des resultats bruts en un autre type(calcul cote client)


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.