]> rtime.felk.cvut.cz Git - orte.git/blob - orte/java/src/org/ocera/orte/tools/CheckType.java
a9a7d1f010d08597742ba8513279782a7057a62f
[orte.git] / orte / java / src / org / ocera / orte / tools / CheckType.java
1 /* CheckType.java */
2
3 /**
4  * Class CheckType checks the boundry of the types, which
5  * substitutes the 'unsigned' types from C sources, because 
6  * the types used in Java source code are longer than the 
7  * unsigned types in C source code. For example type 'long'
8  * [64bit] substitutes the type 'uint32_t' [32bit].
9  * 
10  *
11  * @author Lukas Pokorny (lukas_pokorny@centrum.cz)
12  * @author CTU FEE Prague - Department of Control Engineering (dce.felk.cvut.cz)
13  * @author Project ORTE - OCERA Real Time Ethernet (www.ocera.org)
14  * @author dedication to Kj
15  * @version 0.1
16  *
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  */
29
30 package org.ocera.orte.tools;
31
32
33 public class CheckType {
34
35  /** constants - max and min boundry values of the unsigned integer32 */ 
36    final static long UINT32MAX = (2^32 - 1);   
37    final static long UINT32MIN = 0;
38
39
40  /**
41    * checkUINT_32 - check the boundry of the unsigned int32 type and 
42    * return the bool value if the condition comes true or false
43    *
44    * @param number the value which will be checked
45    * @return boolean value - true if the number is within the range of the unsigned int32 type
46    */
47
48
49     public static 
50     boolean uint_32(long number) 
51     {
52      if (number >= UINT32MIN && number <= UINT32MAX) return(true);
53      return(false);
54     }
55
56 }
57