mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.7.3.1
This commit is contained in:
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GfuiAlign_ implements ParseAble {
|
||||
public static GfuiAlign as_(Object obj) {return obj instanceof GfuiAlign ? (GfuiAlign)obj : null;}
|
||||
public static GfuiAlign cast_(Object obj) {try {return (GfuiAlign)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, GfuiAlign.class, obj);}}
|
||||
public static GfuiAlign cast_(Object obj) {try {return (GfuiAlign)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiAlign.class, obj);}}
|
||||
public static final GfuiAlign
|
||||
Null = new_(0, "nil")
|
||||
, Lo = new_(1, "lo")
|
||||
@@ -55,7 +55,7 @@ public class GfuiAlign_ implements ParseAble {
|
||||
else if (posEnm == GfuiAlign_.Lo.Val()) rv = 0;
|
||||
else if (posEnm == GfuiAlign_.Mid.Val()) rv = (outerSize - innerSize) / 2;
|
||||
else if (posEnm == GfuiAlign_.Hi.Val()) rv = outerSize - innerSize;
|
||||
else throw Exc_.new_unhandled(posEnm);
|
||||
else throw Err_.new_unhandled(posEnm);
|
||||
if (rv < 0) rv = 0;
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class GfuiBorderEdge_ {
|
||||
else if (val == GfuiBorderEdge.Top.Val()) return Top_raw;
|
||||
else if (val == GfuiBorderEdge.Bot.Val()) return Bot_raw;
|
||||
else if (val == GfuiBorderEdge.All.Val()) return All_raw;
|
||||
else throw Exc_.new_unhandled(edge);
|
||||
else throw Err_.new_unhandled(edge);
|
||||
}
|
||||
public static GfuiBorderEdge parse_(String raw) {
|
||||
if (String_.Eq(raw, Left_raw)) return GfuiBorderEdge.Left;
|
||||
@@ -45,7 +45,7 @@ class GfuiBorderEdge_ {
|
||||
else if (String_.Eq(raw, Top_raw)) return GfuiBorderEdge.Top;
|
||||
else if (String_.Eq(raw, Bot_raw)) return GfuiBorderEdge.Bot;
|
||||
else if (String_.Eq(raw, All_raw)) return GfuiBorderEdge.All;
|
||||
else throw Exc_.new_unhandled(raw);
|
||||
else throw Err_.new_unhandled(raw);
|
||||
}
|
||||
public static final String
|
||||
All_raw = "all"
|
||||
|
||||
@@ -20,13 +20,13 @@ public class PointAdp_ {
|
||||
public static final PointAdp Null = new PointAdp(Int_.MinValue, Int_.MinValue);
|
||||
public static final PointAdp Zero = new PointAdp(0, 0);
|
||||
public static PointAdp as_(Object obj) {return obj instanceof PointAdp ? (PointAdp)obj : null;}
|
||||
public static PointAdp cast_(Object obj) {try {return (PointAdp)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, PointAdp.class, obj);}}
|
||||
public static PointAdp cast_(Object obj) {try {return (PointAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, PointAdp.class, obj);}}
|
||||
public static PointAdp new_(int x, int y) {return new PointAdp(x, y);}
|
||||
public static PointAdp coerce_(Object o) {PointAdp rv = PointAdp_.as_(o); return (rv == null) ? parse_((String)o) : rv;}
|
||||
public static PointAdp parse_(String raw) {
|
||||
try {
|
||||
String[] ary = String_.Split(raw, ",");
|
||||
return new PointAdp(Int_.parse_(ary[0]), Int_.parse_(ary[1]));
|
||||
} catch (Exception exc) {throw Exc_.new_parse_exc(exc, PointAdp.class, raw);}
|
||||
} catch (Exception exc) {throw Err_.new_parse_exc(exc, PointAdp.class, raw);}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class RectAdp_ {
|
||||
try {
|
||||
String[] ary = String_.Split(raw, ",");
|
||||
return RectAdp_.new_(Int_.parse_(ary[0]), Int_.parse_(ary[1]), Int_.parse_(ary[2]), Int_.parse_(ary[3]));
|
||||
} catch(Exception exc) {throw Exc_.new_parse_exc(exc, RectAdp.class, raw);}
|
||||
} catch(Exception exc) {throw Err_.new_parse_exc(exc, RectAdp.class, raw);}
|
||||
}
|
||||
public static String Xto_str(RectAdp rect) {return String_.Format("{0},{1},{2},{3}", rect.X(), rect.Y(), rect.Width(), rect.Height());}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ public class SizeAdpF_ {
|
||||
public static SizeAdpF coerce_(Object obj) {SizeAdpF rv = as_(obj); return rv == null ? parse_((String)obj) : rv;}
|
||||
public static SizeAdpF parse_(String s) {
|
||||
try {
|
||||
String[] ary = String_.Split(s, ","); if (ary.length != 2) throw Exc_.new_("SizeAdf should only have 2 numbers separated by 1 comma");
|
||||
String[] ary = String_.Split(s, ","); if (ary.length != 2) throw Err_.new_wo_type("SizeAdf should only have 2 numbers separated by 1 comma");
|
||||
float val1 = Float_.parse_(ary[0]);
|
||||
float val2 = Float_.parse_(ary[1]);
|
||||
return new_(val1, val2);
|
||||
} catch (Exception e) {throw Exc_.new_parse_exc(e, SizeAdpF.class, s);}
|
||||
} catch (Exception e) {throw Err_.new_parse_exc(e, SizeAdpF.class, s);}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class SizeAdp_ {
|
||||
public static final SizeAdp Null = new SizeAdp(Int_.MinValue, Int_.MinValue);
|
||||
public static final SizeAdp Zero = new SizeAdp(0, 0);
|
||||
public static final SizeAdp[] Ary_empty = new SizeAdp[0];
|
||||
public static SizeAdp cast_(Object obj) {try {return (SizeAdp)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, SizeAdp.class, obj);}}
|
||||
public static SizeAdp cast_(Object obj) {try {return (SizeAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, SizeAdp.class, obj);}}
|
||||
public static SizeAdp new_(int width, int height) {return new SizeAdp(width, height);}
|
||||
public static SizeAdp parse_(String raw) {return parse_or_(raw, SizeAdp_.Null);}
|
||||
public static SizeAdp parse_or_(String raw, SizeAdp or) {
|
||||
|
||||
Reference in New Issue
Block a user