1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-05-24 22:43:55 -04:00
parent 6eec99a713
commit 51e6188c1e
1577 changed files with 11555 additions and 10080 deletions

View File

@@ -81,15 +81,15 @@ public class IptArg_ {
class IptMacro {
public void Reg(String prefix, String alias, IptArg arg) {
if (regy == null) Init();
OrderedHash list = (OrderedHash)regy.Fetch(prefix);
Ordered_hash list = (Ordered_hash)regy.Get_by(prefix);
if (list == null) {
list = OrderedHash_.new_();
list = Ordered_hash_.new_();
regy.Add(prefix, list);
}
list.AddReplace(alias, arg);
list.Add_if_dupe_use_nth(alias, arg);
}
void Init() {
regy = OrderedHash_.new_();
regy = Ordered_hash_.new_();
Reg("mod", "c", IptKey_.add_(IptKey_.Ctrl));
Reg("mod", "a", IptKey_.add_(IptKey_.Alt));
Reg("mod", "s", IptKey_.add_(IptKey_.Shift));
@@ -103,16 +103,16 @@ class IptMacro {
String[] plusAry = String_.Split(raw, "+");
String[] dotAry = String_.Split(plusAry[0], ".");
String bgn = dotAry[0], end = dotAry[1];
OrderedHash list = (OrderedHash)regy.Fetch(bgn);
Ordered_hash list = (Ordered_hash)regy.Get_by(bgn);
if (list == null) throw parse_err(raw, "list not found").Add("list", bgn);
IptKey rv = (IptKey)list.Fetch(end);
IptKey rv = (IptKey)list.Get_by(end);
if (rv == null) throw parse_err(raw, "arg not found").Add("arg", end);
for (int i = 1; i < plusAry.length; i++) {
rv = rv.Add((IptKey)IptKey_.parse_(plusAry[i]));
}
return rv;
}
OrderedHash regy;
Ordered_hash regy;
static Err parse_err(String raw, String loc) {return Err_.new_key_("gfui", "could not parse IptArg").Add("raw", raw).Add("loc", loc);}
public static final IptMacro _ = new IptMacro(); IptMacro() {}
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public interface IptBnd extends SrlAble {
String Key();
ListAdp Ipts();
List_adp Ipts();
IptEventType EventTypes();
void Exec(IptEventData iptData);
}

View File

@@ -27,22 +27,22 @@ public class IptBndMgr implements SrlAble {
if (IptEventType_.Has(bnd.EventTypes(), list.EventType()))
list.Add(bnd);
for (int i = 0; i < bnd.Ipts().Count(); i++) {
IptArg arg = (IptArg)bnd.Ipts().FetchAt(i);
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
chainMgr.Add(arg);
}
}
@gplx.Internal protected ListAdp Cfgs() {return cfgs;} ListAdp cfgs = ListAdp_.new_();
@gplx.Internal protected List_adp Cfgs() {return cfgs;} List_adp cfgs = List_adp_.new_();
@gplx.Internal protected void Cfgs_delAll() {
ListAdp del = ListAdp_.new_();
List_adp del = List_adp_.new_();
for (int i = 0; i < cfgs.Count(); i++) {
IptCfgPtr ptr = (IptCfgPtr)cfgs.FetchAt(i);
IptCfgPtr ptr = (IptCfgPtr)cfgs.Get_at(i);
IptCfg cfg = IptCfgRegy._.GetOrNew(ptr.CfgKey());
cfg.Owners_del(ptr.CfgKey());
for (IptBndHash list : regy) {
for (int j = 0; j < list.Count(); j++) {
IptBndListItm itmList = list.Get_at(j);
for (int k = 0; k < itmList.Count(); k++) {
IptBnd bnd = itmList.FetchAt(k);
IptBnd bnd = itmList.Get_at(k);
if (String_.Eq(ptr.BndKey(), bnd.Key())) {
list.Del(bnd);
}
@@ -52,7 +52,7 @@ public class IptBndMgr implements SrlAble {
del.Add(cfg);
}
for (int i = 0; i < del.Count(); i++) {
IptCfg cfg = (IptCfg)del.FetchAt(i);
IptCfg cfg = (IptCfg)del.Get_at(i);
cfgs.Del(cfg);
}
}
@@ -62,7 +62,7 @@ public class IptBndMgr implements SrlAble {
for (int j = 0; j < list.Count(); j++) {
IptBndListItm itmList = list.Get_at(j);
for (int i = 0; i < itmList.Count(); i++) {
IptBnd bnd = itmList.FetchAt(i);
IptBnd bnd = itmList.Get_at(i);
if (String_.Eq(key, bnd.Key())) {
old = bnd;
break;
@@ -74,7 +74,7 @@ public class IptBndMgr implements SrlAble {
this.Del(old);
old.Ipts().Clear();
if (ary == IptArg_.Ary_empty) return; // "unbind"; exit after deleting; DATE:2014-05-13
old.Ipts().AddMany((Object[])ary);
old.Ipts().Add_many((Object[])ary);
this.Add(old);
}
public void Del_by_key(String key) {Del_by(true, key);}
@@ -84,7 +84,7 @@ public class IptBndMgr implements SrlAble {
}
private void Del_by(boolean del_by_key, String del_key) {
int regy_len = regy.length;
ListAdp deleted = ListAdp_.new_();
List_adp deleted = List_adp_.new_();
for (int i = 0; i < regy_len; i++) {
IptBndHash list = regy[i];
int list_len = list.Count();
@@ -92,7 +92,7 @@ public class IptBndMgr implements SrlAble {
IptBndListItm bnds = list.Get_at(j);
int bnds_len = bnds.Count();
for (int k = 0; k < bnds_len; k++) {
IptBnd itm_bnd = bnds.FetchAt(k);
IptBnd itm_bnd = bnds.Get_at(k);
if (del_by_key) {
if (String_.Eq(del_key, itm_bnd.Key())) {
deleted.Add(itm_bnd);
@@ -100,7 +100,7 @@ public class IptBndMgr implements SrlAble {
}
else {
if (itm_bnd.Ipts().Count() != 1) continue; // only delete if bnd has 1 ipt; should only be called by xowa which does 1 bnd per ipt
IptArg itm_ipt = (IptArg)itm_bnd.Ipts().FetchAt(0);
IptArg itm_ipt = (IptArg)itm_bnd.Ipts().Get_at(0);
if (String_.Eq(del_key, itm_ipt.Key()))
deleted.Add(itm_bnd);
}
@@ -109,7 +109,7 @@ public class IptBndMgr implements SrlAble {
}
int deleted_len = deleted.Count();
for (int i = 0; i < deleted_len; i++) {
IptBnd bnd = (IptBnd)deleted.FetchAt(i);
IptBnd bnd = (IptBnd)deleted.Get_at(i);
this.Del(bnd);
bnd.Ipts().Clear();
}
@@ -121,7 +121,7 @@ public class IptBndMgr implements SrlAble {
}
}
for (int i = 0; i < bnd.Ipts().Count(); i++) {
IptArg arg = (IptArg)bnd.Ipts().FetchAt(i);
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
chainMgr.Del(arg);
}
}
@@ -144,11 +144,11 @@ public class IptBndMgr implements SrlAble {
public Object Srl(GfoMsg owner) {
GfoMsg m = GfoMsg_.srl_(owner, "mgr");
for (int i = 0; i < hash.Count(); i++)
((IptBnd)hash.FetchAt(i)).Srl(m);
((IptBnd)hash.Get_at(i)).Srl(m);
return this;
}
IptArgChainMgr chainMgr = new IptArgChainMgr();
OrderedHash hash = OrderedHash_.new_(); IptEventType curTypes = IptEventType_.None;
Ordered_hash hash = Ordered_hash_.new_(); IptEventType curTypes = IptEventType_.None;
public static IptBndMgr new_() {return new IptBndMgr();}
IptBndHash[] regy = new IptBndHash[8];
IptBndMgr() {ClearLists();}
@@ -173,18 +173,18 @@ class IptBndHash implements SrlAble {
private IptBndListItm wildcard_list;
public IptEventType EventType() {return eventType;} IptEventType eventType;
public int Count() {return hash.Count();}
public IptBndListItm Get_by(String key) {return wildcard_list == null ? (IptBndListItm)hash.Fetch(key) : wildcard_list;}
public IptBndListItm Get_at(int i) {return (IptBndListItm)hash.FetchAt(i);}
public IptBndListItm Get_by(String key) {return wildcard_list == null ? (IptBndListItm)hash.Get_by(key) : wildcard_list;}
public IptBndListItm Get_at(int i) {return (IptBndListItm)hash.Get_at(i);}
public void Add(IptBnd bnd) {
for (int i = 0; i < bnd.Ipts().Count(); i++) {
IptArg arg = (IptArg)bnd.Ipts().FetchAt(i);
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
if (!IptArg_.EventType_match(arg, eventType)) continue; // bnd may have multiple ipts of different evTypes; only add bnd if evType matches
if (String_.Eq(arg.Key(), IptArg_.Wildcard_key)) {
if (wildcard_list == null) wildcard_list = new IptBndListItm(IptArg_.Wildcard_key);
wildcard_list.Add(bnd);
}
else {
IptBndListItm itm = (IptBndListItm)hash.Fetch(arg.Key());
IptBndListItm itm = (IptBndListItm)hash.Get_by(arg.Key());
if (itm == null) {
itm = new IptBndListItm(arg.Key());
hash.Add(arg.Key(), itm);
@@ -195,7 +195,7 @@ class IptBndHash implements SrlAble {
}
public void Del(IptBnd bnd) {
for (int i = 0; i < bnd.Ipts().Count(); i++) {
IptArg arg = (IptArg)bnd.Ipts().FetchAt(i);
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
if (!IptArg_.EventType_match(arg, eventType)) continue; // bnd may have multiple ipts of different evTypes; only add bnd if evType matches
hash.Del(arg.Key());
}
@@ -203,20 +203,20 @@ class IptBndHash implements SrlAble {
public Object Srl(GfoMsg owner) {
GfoMsg m = GfoMsg_.srl_(owner, "list").Add("eventType", eventType.Name());
for (int i = 0; i < hash.Count(); i++)
((IptBndListItm)hash.FetchAt(i)).Srl(m);
((IptBndListItm)hash.Get_at(i)).Srl(m);
return this;
}
OrderedHash hash = OrderedHash_.new_();
Ordered_hash hash = Ordered_hash_.new_();
public IptBndHash(IptEventType eventType) {this.eventType = eventType;}
}
class IptBndListItm implements SrlAble {
public String IptKey() {return iptKey;} private String iptKey;
public int Count() {return list.Count();}
public IptBnd FetchAt(int i) {return (IptBnd)list.FetchAt(i);}
public void Add(IptBnd bnd) {list.AddAt(0, bnd);}
public IptBnd Get_at(int i) {return (IptBnd)list.Get_at(i);}
public void Add(IptBnd bnd) {list.Add_at(0, bnd);}
public boolean Exec(IptEventData evData) {
for (int i = 0; i < list.Count(); i++) {
IptBnd bnd = (IptBnd)list.FetchAt(i);
IptBnd bnd = (IptBnd)list.Get_at(i);
try {bnd.Exec(evData);}
catch (Exception exc) {
UsrDlg_._.Stop(UsrMsg.new_("Error while processing event").Add("bnd", SrlAble_.XtoStr(bnd)).Add("exc", Err_.Message_lang(exc)));
@@ -229,17 +229,17 @@ class IptBndListItm implements SrlAble {
public Object Srl(GfoMsg owner) {
GfoMsg m = GfoMsg_.srl_(owner, "itm").Add("iptKey", iptKey);
for (int i = 0; i < list.Count(); i++)
((IptBnd)list.FetchAt(i)).Srl(m);
((IptBnd)list.Get_at(i)).Srl(m);
return this;
}
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
public IptBndListItm(String iptKey) {this.iptKey = iptKey;}
}
class IptArgChainMgr {
public void Clear() {regy.Clear();}
public String Process(IptArg arg) {
// if (String_.Eq(arg.Key(), "key_7")) return "";
HashAdp hash = (HashAdp)active.Fetch(arg.Key());
Hash_adp hash = (Hash_adp)active.Get_by(arg.Key());
if (hash == null) {
active = regy;
String r = activeKey;
@@ -254,7 +254,7 @@ class IptArgChainMgr {
public String ActiveKey() {return activeKey;}
String activeKey = "";
public IptArgChainMgr() {active = regy;}
HashAdp active;
Hash_adp active;
public void Add(IptArg arg) {
if (arg.getClass() != IptKeyChain.class) return;
IptKeyChain chain = (IptKeyChain)arg;
@@ -265,23 +265,23 @@ class IptArgChainMgr {
IptKeyChain chain = (IptKeyChain)arg;
Del_recur(regy, chain.Chained(), 0);
}
void Add_recur(HashAdp cur, IptArg[] ary, int i) {
void Add_recur(Hash_adp cur, IptArg[] ary, int i) {
if (i == ary.length - 1) return; // -1 b/c last should not be registered; ex: key.a,key.b should register key.a only
IptArg ipt = ary[i];
HashAdp next = (HashAdp)cur.Fetch(ipt.Key());
Hash_adp next = (Hash_adp)cur.Get_by(ipt.Key());
if (next == null) {
next = HashAdp_.new_();
next = Hash_adp_.new_();
cur.Add(ipt.Key(), next);
}
Add_recur(next, ary, i + 1);
}// a,b,c
void Del_recur(HashAdp cur, IptArg[] ary, int i) {
void Del_recur(Hash_adp cur, IptArg[] ary, int i) {
IptArg ipt = ary[i];
if (i == ary.length - 1) {
cur.Del(ipt.Key());
return; // -1 b/c last should not be registered; ex: key.a,key.b should register key.a only
}
HashAdp next = (HashAdp)cur.Fetch(ipt.Key());
Hash_adp next = (Hash_adp)cur.Get_by(ipt.Key());
if (next == null) {
return;
}
@@ -289,5 +289,5 @@ class IptArgChainMgr {
if (cur.Count() == 1)
cur.Clear();
}
HashAdp regy = HashAdp_.new_();
Hash_adp regy = Hash_adp_.new_();
}

View File

@@ -36,7 +36,7 @@ public class IptBndMgr_tst {
public IptBndMgr_fx ini_Clear() {under.Clear(); return this;}
public IptBndMgr_fx run_Add(String raw) {
IptArg[] args = IptArg_.parse_ary_(raw);
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
for (IptArg arg : args)
list.Add(arg);
@@ -61,7 +61,7 @@ public class IptBndMgr_tst {
}
class IptBnd_mok implements IptBnd {
public String Key() {return key;} public IptBnd_mok Key_(String v) {key = v; return this;} private String key;
public ListAdp Ipts() {return args;} public IptBnd_mok Ipts_(ListAdp v) {args = v; return this;} ListAdp args;
public List_adp Ipts() {return args;} public IptBnd_mok Ipts_(List_adp v) {args = v; return this;} List_adp args;
public IptEventType EventTypes() {return eventTypes;} public IptBnd_mok EventTypes_(IptEventType v) {eventTypes = v; return this;} IptEventType eventTypes;
public Object Srl(GfoMsg owner) {return this;}
public void Exec(IptEventData iptData) {

View File

@@ -34,16 +34,16 @@ public class IptBnd_ {
box.IptBnds().Add(bnd);
}
public static Object Srl(GfoMsg owner, IptBnd bnd) {GfoMsg_.srl_(owner, "bnd").Add("key", bnd.Key()).Add("ipt", AryXtoStr(bnd.Ipts())); return bnd;}
static String AryXtoStr(ListAdp ary) {
static String AryXtoStr(List_adp ary) {
String_bldr sb = String_bldr_.new_();
for (int i = 0; i < ary.Count(); i++)
sb.Add_spr_unless_first(((IptArg)ary.FetchAt(i)).Key(), "|", i);
sb.Add_spr_unless_first(((IptArg)ary.Get_at(i)).Key(), "|", i);
return sb.XtoStr();
}
}
class IptBnd_invk implements IptBnd {
public String Key() {return key;} private String key;
public ListAdp Ipts() {return ipts;} ListAdp ipts;
public List_adp Ipts() {return ipts;} List_adp ipts;
public IptEventType EventTypes() {return eventTypes;} IptEventType eventTypes;
public void Exec(IptEventData iptData) {
GfoMsg newMsg = m.CloneNew();

View File

@@ -25,9 +25,9 @@ public interface IptCfg extends NewAble, GfoInvkAble {
class IptCfg_base implements IptCfg {
public String CfgKey() {return cfgKey;} private String cfgKey;
public IptCfgItm GetOrDefaultArgs(String bndKey, GfoMsg defaultMsg, IptArg[] defaultArgs) {
IptCfgItm rv = (IptCfgItm)hash.Fetch(bndKey);
IptCfgItm rv = (IptCfgItm)hash.Get_by(bndKey);
if (rv == null) { // no cfg
rv = IptCfgItm.new_().Key_(bndKey).Ipt_(ListAdp_.many_((Object[])defaultArgs)).Msg_(defaultMsg);
rv = IptCfgItm.new_().Key_(bndKey).Ipt_(List_adp_.many_((Object[])defaultArgs)).Msg_(defaultMsg);
hash.Add(bndKey, rv);
}
else { // cfg exists
@@ -39,38 +39,38 @@ class IptCfg_base implements IptCfg {
IptCfgItm rv = GetOrDefaultArgs(bndKey, m, argAry);
rv.Msg_(m); // always overwrite msg
if (Dif(rv.Ipt(), argAry)) {
rv.Ipt_(ListAdp_.many_((Object[])argAry));
rv.Ipt_(List_adp_.many_((Object[])argAry));
this.Change(bndKey, argAry);
}
return rv;
}
boolean Dif(ListAdp lhs, IptArg[] rhs) {
boolean Dif(List_adp lhs, IptArg[] rhs) {
if (lhs.Count() != rhs.length) return true;
for (int i = 0; i < rhs.length; i++) {
IptArg lhsArg = (IptArg)lhs.FetchAt(i);
IptArg lhsArg = (IptArg)lhs.Get_at(i);
IptArg rhsArg = rhs[i];
if (!lhsArg.Eq(rhsArg)) return true;
}
return false;
}
void Change(String bndKey, IptArg[] ary) {
ListAdp list = (ListAdp)owners.Fetch(bndKey);
List_adp list = (List_adp)owners.Get_by(bndKey);
if (list == null) return;
for (int i = 0; i < list.Count(); i++) {
IptBndsOwner owner = (IptBndsOwner)list.FetchAt(i);
IptBndsOwner owner = (IptBndsOwner)list.Get_at(i);
owner.IptBnds().Change(bndKey, ary);
}
}
public void Owners_del(String bndKey) {owners.Del(bndKey);}
public void Owners_add(String bndKey, IptBndsOwner owner) {
ListAdp list = (ListAdp)owners.Fetch(bndKey);
List_adp list = (List_adp)owners.Get_by(bndKey);
if (list == null) {
list = ListAdp_.new_();
list = List_adp_.new_();
owners.Add(bndKey, list);
}
list.Add(owner);
owner.IptBnds().Cfgs().Add(new IptCfgPtr(cfgKey, bndKey));
} OrderedHash owners = OrderedHash_.new_();
} Ordered_hash owners = Ordered_hash_.new_();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.MatchIn(k, Invk_Add, Invk_set)) {
String bndKey = m.ReadStr("bndKey");
@@ -82,7 +82,7 @@ class IptCfg_base implements IptCfg {
return this;
} public static final String Invk_Add = "Add", Invk_set = "set";
public IptCfg_base(String cfgKey) {this.cfgKey = cfgKey;}
OrderedHash hash = OrderedHash_.new_();
Ordered_hash hash = Ordered_hash_.new_();
public Object NewByKey(Object o) {return new IptCfg_base((String)o);} @gplx.Internal protected static final IptCfg HashProto = new IptCfg_base(); @gplx.Internal protected IptCfg_base() {}
}
class IptCfgPtr {

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public class IptCfgItm {
public String Key() {return key;} public IptCfgItm Key_(String v) {key = v; return this;} private String key;
public ListAdp Ipt() {return ipt;} public IptCfgItm Ipt_(ListAdp v) {ipt = v; return this;} ListAdp ipt;
public List_adp Ipt() {return ipt;} public IptCfgItm Ipt_(List_adp v) {ipt = v; return this;} List_adp ipt;
public GfoMsg Msg() {return msg;} public IptCfgItm Msg_(GfoMsg v) {msg = v; return this;} GfoMsg msg;
public static IptCfgItm new_() {return new IptCfgItm();} IptCfgItm() {}
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public class IptCfgRegy implements GfoInvkAble {
public void Clear() {hash.Clear();}
public IptCfg GetOrNew(String k) {return (IptCfg)hash.FetchOrNew(k, IptCfg_base.HashProto);}
public IptCfg GetOrNew(String k) {return (IptCfg)hash.Get_by_or_new(k, IptCfg_base.HashProto);}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.MatchIn(k, Invk_Get, Invk_get)) {
String key = m.ReadStr("key");
@@ -27,7 +27,7 @@ public class IptCfgRegy implements GfoInvkAble {
}
return this;
} public static final String Invk_Get = "Get", Invk_get = "get";
OrderedHash hash = OrderedHash_.new_();
Ordered_hash hash = Ordered_hash_.new_();
public static final IptCfgRegy _ = new IptCfgRegy();
public IptCfgRegy() {}
}

View File

@@ -22,7 +22,7 @@ public class IptCfg_ {
}
class IptCfg_null implements IptCfg {
public String CfgKey() {return "<<NULL KEY>>";}
public IptCfgItm GetOrDefaultArgs(String bndKey, GfoMsg m, IptArg[] argAry) {return IptCfgItm.new_().Key_(bndKey).Ipt_(ListAdp_.many_((Object[])argAry)).Msg_(m);}
public IptCfgItm GetOrDefaultArgs(String bndKey, GfoMsg m, IptArg[] argAry) {return IptCfgItm.new_().Key_(bndKey).Ipt_(List_adp_.many_((Object[])argAry)).Msg_(m);}
public void Owners_add(String key, IptBndsOwner owner) {}
public void Owners_del(String key) {}
public Object NewByKey(Object o) {return this;}

View File

@@ -24,16 +24,16 @@ class IptKeyStrMgr {
}
public String XtoStr(IptKey key) {
if (literals == null) Init();
Object rv = literals.Fetch(key.Val());
Object rv = literals.Get_by(key.Val());
return rv == null ? String_.Empty : (String)rv;
}
public void XtoIptKeyAry(ListAdp list) {
public void XtoIptKeyAry(List_adp list) {
if (literals == null) Init();
for (int i = 0; i < keys.Count(); i++)
list.Add((IptKey)keys.FetchAt(i));
list.Add((IptKey)keys.Get_at(i));
}
void Init() {// default to US style keyboard
literals = HashAdp_.new_();
literals = Hash_adp_.new_();
charKeys = new IptKey[256];
RegLtr(IptKey_.A, 'a'); RegLtr(IptKey_.B, 'b'); RegLtr(IptKey_.C, 'c'); RegLtr(IptKey_.D, 'd'); RegLtr(IptKey_.E, 'e');
RegLtr(IptKey_.F, 'f'); RegLtr(IptKey_.G, 'g'); RegLtr(IptKey_.H, 'h'); RegLtr(IptKey_.I, 'i'); RegLtr(IptKey_.J, 'j');
@@ -70,6 +70,6 @@ class IptKeyStrMgr {
charKeys[charVal] = k;
}
IptKey[] charKeys;
HashAdp literals; OrderedHash keys = OrderedHash_.new_();
Hash_adp literals; Ordered_hash keys = Ordered_hash_.new_();
public static final IptKeyStrMgr _ = new IptKeyStrMgr(); IptKeyStrMgr() {}
}

View File

@@ -40,8 +40,8 @@ public class IptKey_ {
String val = rdr.ReadStrOr(key, ""); // NOTE: "" cannot be null, b/c nullRdr returns String.empty
return (String_.Eq(val, "")) ? or : parse_(val);
}
public static ListAdp printableKeys2_(IptKey[] add, IptKey[] del) {
ListAdp list = ListAdp_.new_();
public static List_adp printableKeys2_(IptKey[] add, IptKey[] del) {
List_adp list = List_adp_.new_();
for (IptKey key : add)
list.Add(key);
IptKeyStrMgr._.XtoIptKeyAry(list);
@@ -50,13 +50,13 @@ public class IptKey_ {
return list;
}
public static IptKey[] printableKeys_(IptKey[] add, IptKey[] del) {
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
for (IptKey key : add)
list.Add(key);
IptKeyStrMgr._.XtoIptKeyAry(list);
for (IptKey key : del)
list.Del(key);
return (IptKey[])list.Xto_ary(IptKey.class);
return (IptKey[])list.To_ary(IptKey.class);
}
private static IptKey get_or_new_(int val) {
IptKey rv = (IptKey)enm_mgr.Get(val);
@@ -102,10 +102,10 @@ public class IptKey_ {
, Shift = new_(KeyCode_Shift, "shift"), Ctrl = new_(KeyCode_Ctrl, "ctrl"), Alt = new_(KeyCode_Alt, "alt")
, Keypad_enter = new_(16777296, "keypad_enter")
;
private static OrderedHash ui_str_hash;
public static OrderedHash Ui_str_hash() {
private static Ordered_hash ui_str_hash;
public static Ordered_hash Ui_str_hash() {
if (ui_str_hash == null) {
ui_str_hash = OrderedHash_.new_();
ui_str_hash = Ordered_hash_.new_();
All_add(ui_str_hash
, IptKey_.Back, IptKey_.Tab, IptKey_.Clear, IptKey_.Enter
, IptKey_.Pause, IptKey_.CapsLock, IptKey_.Escape, IptKey_.Space
@@ -129,11 +129,11 @@ public class IptKey_ {
}
return ui_str_hash;
}
private static void All_add(OrderedHash hash, IptKey... ary) {
private static void All_add(Ordered_hash hash, IptKey... ary) {
int len = ary.length;
for (int i = 0; i < len; ++i) {
IptKey key = ary[i];
hash.AddReplace(Int_obj_ref.new_(key.Val()), key);
hash.Add_if_dupe_use_nth(Int_obj_ref.new_(key.Val()), key);
}
}
public static String To_str(int val) {
@@ -146,7 +146,7 @@ public class IptKey_ {
if (val == 0) return rv; // handle modifiers only, like "mod.cs"; else will be "mod.cs+key.#0"
rv += "+";
}
IptKey key = (IptKey)IptKey_.Ui_str_hash().Fetch(Int_obj_ref.new_(val));
IptKey key = (IptKey)IptKey_.Ui_str_hash().Get_by(Int_obj_ref.new_(val));
String key_str = key == null ? "key.#" + Int_.Xto_str(val) : key.Key();
return rv + key_str;
}