mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Cfg: Add more implementation for cfg_cache and pub / sub
This commit is contained in:
@@ -40,6 +40,17 @@ public class Bool_ {
|
||||
return false;
|
||||
throw Err_.new_parse_type(boolean.class, raw);
|
||||
}
|
||||
public static boolean Parse_or(String raw, boolean or) {
|
||||
if ( String_.Eq(raw, True_str)
|
||||
|| String_.Eq(raw, "True") // needed for Store_Wtr(){boolVal.toString();}
|
||||
)
|
||||
return true;
|
||||
else if ( String_.Eq(raw, False_str)
|
||||
|| String_.Eq(raw, "False")
|
||||
)
|
||||
return false;
|
||||
return or;
|
||||
}
|
||||
public static int Compare(boolean lhs, boolean rhs) {
|
||||
if ( lhs == rhs) return CompareAble_.Same;
|
||||
else if (!lhs && rhs) return CompareAble_.Less;
|
||||
|
||||
@@ -17,7 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx;
|
||||
public class Char_ {
|
||||
public static final Class<?> Cls_ref_type = Character.class;
|
||||
public static final String Cls_val_name = "char";
|
||||
public static final Class<?> Cls_ref_type = Character.class;
|
||||
public static final char Null = '\0', NewLine = '\n';
|
||||
public static boolean IsCaseLower(char c) {return Character.isLowerCase(c);}
|
||||
public static boolean IsLetterOrDigit(char c) {return Character.isLetterOrDigit(c);}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.text.NumberFormat;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.Locale;
|
||||
public class Decimal_adp_ {
|
||||
public static final String Cls_val_name = "decimal";
|
||||
|
||||
@@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx;
|
||||
public class Double_ {
|
||||
public static final String Cls_val_name = "double";
|
||||
public static final Class<?> Cls_ref_type = Double.class;
|
||||
public static final Class<?> Cls_ref_type = Double.class;
|
||||
public static final double
|
||||
MinValue = Double.MIN_VALUE
|
||||
, NaN = Double.NaN
|
||||
, Inf_pos = Double.POSITIVE_INFINITY
|
||||
;
|
||||
public static final byte[]
|
||||
public static final byte[]
|
||||
NaN_bry = Bry_.new_a7("NaN")
|
||||
, Inf_pos_bry = Bry_.new_a7("INF")
|
||||
;
|
||||
|
||||
@@ -17,7 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx;
|
||||
public class Short_ {
|
||||
public static final Class<?> Cls_ref_type = Short.class;
|
||||
public static final String Cls_val_name = "short";
|
||||
public static final Class<?> Cls_ref_type = Short.class;
|
||||
public static short cast(Object obj) {try {return (Short)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, short.class, obj);}}
|
||||
public static short By_int(int v) {return (short)v;}
|
||||
}
|
||||
|
||||
@@ -62,20 +62,35 @@ public class Type_adp_ {
|
||||
else if (Type_adp_.Eq(type, Char_.Cls_ref_type)) return Tid__char;
|
||||
else return Tid__obj;
|
||||
}
|
||||
public static int To_tid(String name) {
|
||||
if (String_.Eq(name, Int_.Cls_val_name)) return Tid__int;
|
||||
else if (String_.Eq(name, String_.Cls_val_name)) return Tid__str;
|
||||
else if (String_.Eq(name, Bry_.Cls_val_name)) return Tid__bry;
|
||||
else if (String_.Eq(name, Bool_.Cls_val_name)) return Tid__bool;
|
||||
else if (String_.Eq(name, Byte_.Cls_val_name)) return Tid__byte;
|
||||
else if (String_.Eq(name, Long_.Cls_val_name)) return Tid__long;
|
||||
else if (String_.Eq(name, Double_.Cls_val_name)) return Tid__double;
|
||||
else if (String_.Eq(name, Decimal_adp_.Cls_val_name)) return Tid__decimal;
|
||||
else if (String_.Eq(name, DateAdp_.Cls_ref_name)) return Tid__date;
|
||||
else if (String_.Eq(name, Float_.Cls_val_name)) return Tid__float;
|
||||
else if (String_.Eq(name, Short_.Cls_val_name)) return Tid__short;
|
||||
else if (String_.Eq(name, Char_.Cls_val_name)) return Tid__char;
|
||||
else return Tid__obj;
|
||||
}
|
||||
public static final int
|
||||
Tid__obj = 0
|
||||
, Tid__null = 1
|
||||
, Tid__bool = 2
|
||||
, Tid__byte = 3
|
||||
, Tid__short = 4
|
||||
, Tid__int = 5
|
||||
, Tid__long = 6
|
||||
, Tid__float = 7
|
||||
, Tid__double = 8
|
||||
, Tid__char = 9
|
||||
, Tid__str = 10
|
||||
, Tid__bry = 11
|
||||
, Tid__date = 12
|
||||
, Tid__decimal = 13
|
||||
Tid__obj = 0
|
||||
, Tid__null = 1
|
||||
, Tid__bool = 2
|
||||
, Tid__byte = 3
|
||||
, Tid__short = 4
|
||||
, Tid__int = 5
|
||||
, Tid__long = 6
|
||||
, Tid__float = 7
|
||||
, Tid__double = 8
|
||||
, Tid__char = 9
|
||||
, Tid__str = 10
|
||||
, Tid__bry = 11
|
||||
, Tid__date = 12
|
||||
, Tid__decimal = 13
|
||||
;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user