2 |
26 Feb 07 |
jari |
1 |
package org.tigr.microarray.mev.r; |
2 |
26 Feb 07 |
jari |
2 |
|
2 |
26 Feb 07 |
jari |
/** small class encapsulating packets from/to Rserv |
2 |
26 Feb 07 |
jari |
@version $Id$ |
2 |
26 Feb 07 |
jari |
5 |
*/ |
2 |
26 Feb 07 |
jari |
6 |
public class Rpacket { |
2 |
26 Feb 07 |
jari |
7 |
int cmd; |
2 |
26 Feb 07 |
jari |
8 |
byte[] cont; |
2 |
26 Feb 07 |
jari |
9 |
|
2 |
26 Feb 07 |
jari |
/** construct new packet |
2 |
26 Feb 07 |
jari |
@param Rcmd command |
2 |
26 Feb 07 |
jari |
@param Rcont content */ |
2 |
26 Feb 07 |
jari |
13 |
public Rpacket(int Rcmd, byte[] Rcont) { |
2 |
26 Feb 07 |
jari |
14 |
cmd=Rcmd; cont=Rcont; |
2 |
26 Feb 07 |
jari |
15 |
} |
2 |
26 Feb 07 |
jari |
16 |
|
2 |
26 Feb 07 |
jari |
/** get command |
2 |
26 Feb 07 |
jari |
@return command */ |
2 |
26 Feb 07 |
jari |
19 |
public int getCmd() { return cmd; } |
2 |
26 Feb 07 |
jari |
20 |
|
2 |
26 Feb 07 |
jari |
/** check last response for RESP_OK |
2 |
26 Feb 07 |
jari |
@return <code>true</code> if last response was OK */ |
2 |
26 Feb 07 |
jari |
23 |
public boolean isOk() { return ((cmd&15)==1); } |
2 |
26 Feb 07 |
jari |
24 |
|
2 |
26 Feb 07 |
jari |
/** check last response for RESP_ERR |
2 |
26 Feb 07 |
jari |
@return <code>true</code> if last response was ERROR */ |
2 |
26 Feb 07 |
jari |
27 |
public boolean isError() { return ((cmd&15)==2); } |
2 |
26 Feb 07 |
jari |
28 |
|
2 |
26 Feb 07 |
jari |
/** get status code of last response |
2 |
26 Feb 07 |
jari |
@return status code returned on last response */ |
2 |
26 Feb 07 |
jari |
31 |
public int getStat() { return ((cmd>>24)&127); } |
2 |
26 Feb 07 |
jari |
32 |
|
2 |
26 Feb 07 |
jari |
/** get content |
2 |
26 Feb 07 |
jari |
@return inner package content */ |
2 |
26 Feb 07 |
jari |
35 |
public byte[] getCont() { return cont; } |
2 |
26 Feb 07 |
jari |
36 |
} |