net.tinyos.tinydb
Class QueryResult

java.lang.Object
  |
  +--net.tinyos.tinydb.QueryResult

public class QueryResult
extends java.lang.Object

QueryResult accepts a query result in the form of an array of bytes read off the network (and a query) and parses the results and provides a number of utility routines to read the values back.


Constructor Summary
QueryResult(net.tinyos.tinydb.TinyDBQuery q, net.tinyos.tinydb.QueryResultMsg m)
          Constructor -- parse the specified result assuming it is a result for query q
 
Method Summary
static net.tinyos.tinydb.QueryResultMsg generateDataMessage(byte queryNo, char msgIdx, short epochNo, byte nwSize, byte timeRem)
          Generate a data message that a local node can use to send out a query result.
 int getRecipient()
           
 int getSender()
           
static int numFields(net.tinyos.tinydb.QueryResultMsg m)
           
static byte queryId(net.tinyos.tinydb.QueryResultMsg m)
          Given a query result message, return the query id it belongs to
 java.util.Vector resultVector()
          Return a vector of strings corresponding to the result tuple for this query result.
 java.lang.String toString()
          Convert this query result to an (ugly looking) string representation
static int unsign(byte b)
           
static int unsign(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryResult

public QueryResult(net.tinyos.tinydb.TinyDBQuery q,
                   net.tinyos.tinydb.QueryResultMsg m)
Constructor -- parse the specified result assuming it is a result for query q

Method Detail

generateDataMessage

public static net.tinyos.tinydb.QueryResultMsg generateDataMessage(byte queryNo,
                                                                   char msgIdx,
                                                                   short epochNo,
                                                                   byte nwSize,
                                                                   byte timeRem)
Generate a data message that a local node can use to send out a query result. Message has specified query id, network size information message index, and epoch number


queryId

public static byte queryId(net.tinyos.tinydb.QueryResultMsg m)
Given a query result message, return the query id it belongs to


numFields

public static int numFields(net.tinyos.tinydb.QueryResultMsg m)

resultVector

public java.util.Vector resultVector()
Return a vector of strings corresponding to the result tuple for this query result. Always includes epoch number as the first field. The names of the result fields can be obtained from TinyDBQuery.getColumnHeadings


toString

public java.lang.String toString()
Convert this query result to an (ugly looking) string representation

Overrides:
toString in class java.lang.Object

getRecipient

public int getRecipient()

getSender

public int getSender()

unsign

public static int unsign(byte b)

unsign

public static int unsign(int b)