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

@@ -29,6 +29,6 @@ public interface GfmlLxr extends GfoEvObj {
class GfmlLxrRegy {
public int Count() {return hash.Count();}
public void Add(GfmlLxr lxr) {hash.Add(lxr.Key(), lxr);}
public GfmlLxr Fetch(String key) {return (GfmlLxr)hash.Fetch(key);}
HashAdp hash = HashAdp_.new_();
public GfmlLxr Get_by(String key) {return (GfmlLxr)hash.Get_by(key);}
Hash_adp hash = Hash_adp_.new_();
}

View File

@@ -16,10 +16,10 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.gfml; import gplx.*;
public class GfmlObjList extends ListAdp_base {
@gplx.New public GfmlObj FetchAt(int idx) {return (GfmlObj)FetchAt_base(idx);}
public class GfmlObjList extends List_adp_base {
@gplx.New public GfmlObj Get_at(int idx) {return (GfmlObj)Get_at_base(idx);}
public void Add(GfmlObj tkn) {Add_base(tkn);}
public void AddAt(GfmlObj tkn, int idx) {super.AddAt_base(idx, tkn);}
public void Add_at(GfmlObj tkn, int idx) {super.AddAt_base(idx, tkn);}
public void Del(GfmlObj tkn) {Del_base(tkn);}
public static GfmlObjList new_() {return new GfmlObjList();} GfmlObjList() {}
}

View File

@@ -33,7 +33,7 @@ public class GfmlTkn_ {
@gplx.Internal protected static GfmlTkn composite_list_(String tknType, GfmlObjList list) {
GfmlTkn[] ary = new GfmlTkn[list.Count()];
for (int i = 0; i < list.Count(); i++)
ary[i] = (GfmlTkn)list.FetchAt(i);
ary[i] = (GfmlTkn)list.Get_at(i);
return GfmlTkn_.composite_(tknType, ary);
}
}

View File

@@ -21,15 +21,15 @@ public class GfmlTrie {
public String[] Symbols() {
String[] rv = new String[symbols.Count()];
for (int i = 0; i < rv.length; i++)
rv[i] = String_.cast_(symbols.FetchAt(i));
rv[i] = String_.cast_(symbols.Get_at(i));
return rv;
} OrderedHash symbols = OrderedHash_.new_();
} Ordered_hash symbols = Ordered_hash_.new_();
public int LastMatchCount; // PERF: prop is faster than method
public Object FindMatch(CharStream stream) {
Object result = null; int moveCount = 0; LastMatchCount = 0;
IntObjHash_base link = rootLink;
while (stream.AtMid()) {
Object found = link.Fetch(stream.Cur());
Object found = link.Get_by(stream.Cur());
if (found == null) break; // found is null; can happen for false matches; ex: <!-- reg, and <!-* is cur; goes to <!- before exit
LastMatchCount++;
IntObjHash_base foundAsLink = IntObjHash_base_.as_(found);
@@ -54,7 +54,7 @@ public class GfmlTrie {
IntObjHash_base curLink = rootLink;
for (int i = 0; i < ary.length; i++) {
char c = ary[i];
Object found = curLink.Fetch(c);
Object found = curLink.Get_by(c);
IntObjHash_base foundAsLink = IntObjHash_base_.as_(found);
if (i == lastIndex) { // lastChar
if (found != null) { // slot is occupied
@@ -79,7 +79,7 @@ public class GfmlTrie {
curLink = foundAsLink;
}
}
symbols.AddReplace(symbol, symbol);
symbols.Add_if_dupe_use_nth(symbol, symbol);
}
public void Del(String symbol) {
char[] ary = String_.XtoCharAry(symbol); int lastIndex = ary.length - 1;
@@ -88,7 +88,7 @@ public class GfmlTrie {
for (int i = 0; i < ary.length; i++) {
char c = ary[i];
linkAry[i] = link;
link = IntObjHash_base_.as_(link.Fetch(c));
link = IntObjHash_base_.as_(link.Get_by(c));
if (link == null) break; // c does not have nextHash; break
}
@@ -96,7 +96,7 @@ public class GfmlTrie {
for (int i = lastIndex; i >= 0; i--) { // remove each char from hashes; must move backwards
char c = ary[i];
IntObjHash_base curLink = linkAry[i];
Object found = curLink.Fetch(c);
Object found = curLink.Get_by(c);
IntObjHash_base foundAsLink = IntObjHash_base_.as_(found);
if (nextHash != null && nextHash.Bay() != null) // occurs when long is dropped; ex: '<-' and '<'; '<-' dropped; <'s .Bay in '<-' chain must be transplanted to '<' .Bay
curLink.Set(c, nextHash.Bay());

View File

@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfml; import gplx.*;
class IntObjHash_base {
public int Count() {return count;} int count;
public boolean Has(int key) {return Fetch(key) != null;}
public Object Fetch(int key) {
public boolean Has(int key) {return Get_by(key) != null;}
public Object Get_by(int key) {
if (key < 0) throw Err_.new_("key must be >= 0").Add("key", key);
if (key > maxKey) return null;
Object[] subAry = FetchSubAry(key);

View File

@@ -18,17 +18,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfml; import gplx.*;
public class GfmlFldList {
public int Count() {return hash.Count();}
public GfmlFld FetchAt(int index) {return (GfmlFld)hash.FetchAt(index);}
public GfmlFld Fetch(String id) {return (GfmlFld)hash.Fetch(id);}
public GfmlFld Get_at(int index) {return (GfmlFld)hash.Get_at(index);}
public GfmlFld Get_by(String id) {return (GfmlFld)hash.Get_by(id);}
public void Add(GfmlFld fld) {
if (String_.Len_eq_0(fld.Name())) throw Err_.new_("fld name cannot be null");
if (hash.Has(fld.Name())) throw Err_.new_("key already exists").Add("key", fld.Name()); // FIXME: commented out to allow multiple types with same name; need "_type:invk"
hash.AddReplace(fld.Name(), fld);
hash.Add_if_dupe_use_nth(fld.Name(), fld);
}
public void Del(GfmlFld fld) {
hash.Del(fld);
hash.Del(fld.Name());
}
OrderedHash hash = OrderedHash_.new_();
Ordered_hash hash = Ordered_hash_.new_();
public static GfmlFldList new_() {return new GfmlFldList();} GfmlFldList() {}
}

View File

@@ -24,7 +24,7 @@ public class GfmlType implements GfmlScopeItm {
public GfmlType Clone() {
GfmlType rv = new GfmlType().ctor_GfmlType_(key, ndeName).DocPos_(docPos.NewClone());
for (int i = 0; i < subFlds.Count(); i++) {
GfmlFld subFld = (GfmlFld)subFlds.FetchAt(i);
GfmlFld subFld = (GfmlFld)subFlds.Get_at(i);
rv.subFlds.Add(subFld.Clone());
}
return rv;

View File

@@ -17,19 +17,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.gfml; import gplx.*;
class GfmlTypeCompiler {
@gplx.Internal protected static GfmlType Compile(GfmlNde nde, GfmlType owner, GfmlTypRegy typeRegy, OrderedHash results) {return Compile(nde, owner, true, typeRegy, results);}
static GfmlType Compile(GfmlNde nde, GfmlType owner, boolean isTopLevel, GfmlTypRegy typeRegy, OrderedHash results) {
@gplx.Internal protected static GfmlType Compile(GfmlNde nde, GfmlType owner, GfmlTypRegy typeRegy, Ordered_hash results) {return Compile(nde, owner, true, typeRegy, results);}
static GfmlType Compile(GfmlNde nde, GfmlType owner, boolean isTopLevel, GfmlTypRegy typeRegy, Ordered_hash results) {
String name = nde.SubKeys().FetchDataOrFail("name");
String typeKey = FetchTypeKey(nde, owner, isTopLevel, name);
GfmlType rv = FetchTypeOrNew(name, typeKey, typeRegy, results);
for (int i = 0; i < nde.SubHnds().Count(); i++) {
GfmlNde subNde = (GfmlNde)nde.SubHnds().FetchAt(i);
GfmlNde subNde = (GfmlNde)nde.SubHnds().Get_at(i);
GfmlFld fld = CompileFld(subNde, rv, typeRegy, results);
rv.SubFlds().Add(fld);
}
return rv;
}
static GfmlFld CompileFld(GfmlNde nde, GfmlType ownerType, GfmlTypRegy typeRegy, OrderedHash results) {
static GfmlFld CompileFld(GfmlNde nde, GfmlType ownerType, GfmlTypRegy typeRegy, Ordered_hash results) {
String name = nde.SubKeys().FetchDataOrFail("name");
String typeKey = nde.SubKeys().FetchDataOrNull("type");
GfmlObj defaultTkn = FetchDefaultTkn(nde, name); boolean isDefaultTknNde = defaultTkn.ObjType() == GfmlObj_.Type_nde;
@@ -62,10 +62,10 @@ class GfmlTypeCompiler {
}
return typeKey;
}
static GfmlType FetchTypeOrNew(String name, String typeKey, GfmlTypRegy typeRegy, OrderedHash results) {
static GfmlType FetchTypeOrNew(String name, String typeKey, GfmlTypRegy typeRegy, Ordered_hash results) {
GfmlType rv = typeRegy.FetchOrNull(typeKey); // look for type in regy to see if it was declared earlier
if (rv == GfmlType_.Null) {
rv = (GfmlType)results.Fetch(rv.Key()); // look for type in current pragma's results
rv = (GfmlType)results.Get_by(rv.Key()); // look for type in current pragma's results
if (rv == null) { // nothing found; create and add
rv = GfmlType_.new_(typeKey, name);
results.Add(typeKey, rv);
@@ -74,7 +74,7 @@ class GfmlTypeCompiler {
return rv;
}
static GfmlObj FetchDefaultTkn(GfmlNde nde, String name) {
GfmlItm defaultTkn = nde.SubKeys().Fetch("default"); if (defaultTkn == null) return GfmlTkn_.Null;
GfmlItm defaultTkn = nde.SubKeys().Get_by("default"); if (defaultTkn == null) return GfmlTkn_.Null;
GfmlItm itm = GfmlItm_.as_(defaultTkn); if (itm.ObjType() == GfmlObj_.Type_atr) return GfmlAtr.as_(itm).DatTkn();
GfmlNde rv = GfmlNde.new_(GfmlTkn_.val_(name), GfmlType_.new_any_(), true);
for (int i = 0; i < itm.SubObjs_Count(); i++) {
@@ -86,7 +86,7 @@ class GfmlTypeCompiler {
@gplx.Internal protected static void AddDefaultAtrs(GfmlNde nde, GfmlType type, GfmlTypRegy regy) {
if (type.IsTypeAny()) return;
for (int i = 0; i < type.SubFlds().Count(); i++) {
GfmlFld subFld = (GfmlFld)type.SubFlds().FetchAt(i);
GfmlFld subFld = (GfmlFld)type.SubFlds().Get_at(i);
if (subFld.DefaultTkn() == GfmlTkn_.Null) continue;
if (nde.SubKeys().Has(subFld.Name())) continue;
GfmlNde defaultNde = GfmlNde.as_(subFld.DefaultTkn());

View File

@@ -17,13 +17,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.gfml; import gplx.*;
class GfmlTypeHash {
public GfmlType Fetch(String key) {return (GfmlType)hash.Fetch(key);}
public GfmlType Get_by(String key) {return (GfmlType)hash.Get_by(key);}
public void Add(GfmlType type) {
if (type.IsTypeNull()) throw Err_.new_("cannot add null type to GfmlTypeHash");
if (hash.Has(type.Key())) throw Err_.new_("type key already exists").Add("key", type.Key());
hash.Add(type.Key(), type);
}
HashAdp hash = HashAdp_.new_();
Hash_adp hash = Hash_adp_.new_();
public static GfmlTypeHash new_() {return new GfmlTypeHash();} GfmlTypeHash() {}
}
class GfmlTypRegy {
@@ -31,7 +31,7 @@ class GfmlTypRegy {
public GfmlType FetchOrNull(String typeKey) {return FetchOrNull(typeKey, GfmlDocPos_.Root);}
public GfmlType FetchOrNull(String typeKey, GfmlDocPos pos) {
if (typeKey == null) throw Err_.new_("typeKey cannot be null when added to typRegy");
GfmlType rv = (GfmlType)hash.Fetch(typeKey, pos);
GfmlType rv = (GfmlType)hash.Get_by(typeKey, pos);
return rv == null ? GfmlType_.Null : rv;
}
public GfmlTypRegy Add(GfmlType type) {

View File

@@ -39,7 +39,7 @@ class GfmlTypeMakr {
}
public void AddSubFld(GfmlFld subFld) {AddSubFld_imp(owner, subFld);}
public GfmlType[] Xto_bry() {
GfmlType[] rv = (GfmlType[])list.Xto_ary(GfmlType.class);
GfmlType[] rv = (GfmlType[])list.To_ary(GfmlType.class);
list.Clear();
owner = null;
return rv;
@@ -62,6 +62,6 @@ class GfmlTypeMakr {
void AddSubFld_imp(GfmlType ownerType, GfmlFld subFld) {ownerType.SubFlds().Add(subFld);}
GfmlType owner;
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
public static GfmlTypeMakr new_() {return new GfmlTypeMakr();}
}

View File

@@ -107,23 +107,23 @@ class GfmlFldPool {
public GfmlTkn Keyed_PopNextAsTkn() {return GfmlTkn_.val_(Keyed_PopNext().Name());} // helper method for GfmlFrame_nde
public GfmlFld Keyed_PopNext() {
if (keyedRegy.Count() == 0) return GfmlFld.Null;
GfmlFld rv = (GfmlFld)keyedRegy.FetchAt(0);
GfmlFld rv = (GfmlFld)keyedRegy.Get_at(0);
keyedRegy.Del(rv.Name());
return rv;
}
public GfmlFld Keyed_PopByKey(String key) {
GfmlFld rv = (GfmlFld)keyedRegy.Fetch(key); if (rv == null) return GfmlFld.Null;
GfmlFld rv = (GfmlFld)keyedRegy.Get_by(key); if (rv == null) return GfmlFld.Null;
keyedRegy.Del(rv.Name());
return rv;
}
@gplx.Internal protected int Keyd_Count() {return keyedRegy.Count();}
@gplx.Internal protected GfmlFld Keyd_FetchAt(int i) {return (GfmlFld)keyedRegy.FetchAt(i);}
@gplx.Internal protected GfmlFld Keyd_FetchAt(int i) {return (GfmlFld)keyedRegy.Get_at(i);}
public GfmlFld DefaultMember() {return defaultMember;} GfmlFld defaultMember = GfmlFld.Null;
@gplx.Internal protected GfmlType Type() {return type;} GfmlType type = GfmlType_.Null;
void InitByType(GfmlType type) {
this.type = type;
for (int i = 0; i < type.SubFlds().Count(); i++) {
GfmlFld fld = (GfmlFld)type.SubFlds().FetchAt(i);
GfmlFld fld = (GfmlFld)type.SubFlds().Get_at(i);
if (fld.Name_isKey())
keyedRegy.Add(fld.Name(), fld);
else {
@@ -131,7 +131,7 @@ class GfmlFldPool {
}
}
}
OrderedHash keyedRegy = OrderedHash_.new_();
Ordered_hash keyedRegy = Ordered_hash_.new_();
public static GfmlFldPool new_(GfmlType type) {
GfmlFldPool rv = new GfmlFldPool();
rv.InitByType(type);

View File

@@ -23,7 +23,7 @@ public class GfmlAtr implements GfmlItm {
public GfmlType Type() {return type;} GfmlType type;
public boolean KeyedSubObj() {return true;}
public int SubObjs_Count() {return subObjs.Count();}
public GfmlObj SubObjs_GetAt(int i) {return (GfmlObj)subObjs.FetchAt(i);} GfmlObjList subObjs = GfmlObjList.new_(); // PERF?: make capacity 3 instead of 8
public GfmlObj SubObjs_GetAt(int i) {return (GfmlObj)subObjs.Get_at(i);} GfmlObjList subObjs = GfmlObjList.new_(); // PERF?: make capacity 3 instead of 8
public void SubObjs_Add(GfmlObj o) {subObjs.Add(o);}
public String XtoStr() {return String_.Concat(this.Key(), "=", this.DatTkn().Val());}
@gplx.Internal protected void Key_set(String v) {keyTkn = GfmlTkn_.val_(v);} // used for 1 test
@@ -43,14 +43,14 @@ public class GfmlAtr implements GfmlItm {
int idx = GetTknIdx(oldTkn);
GfmlTkn tkn = MakeTkn(oldTkn, s);
if (idx != -1)
subObjs.DelAt(idx);
subObjs.Del_at(idx);
if (idx == -1) idx = 0;
subObjs.AddAt(tkn, idx);
subObjs.Add_at(tkn, idx);
return tkn;
}
int GetTknIdx(GfmlTkn t) {
for (int i = 0; i < subObjs.Count(); i++) {
GfmlObj obj = (GfmlObj)subObjs.FetchAt(i);
GfmlObj obj = (GfmlObj)subObjs.Get_at(i);
if (obj == t) return i;
}
return -1;

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfml; import gplx.*;
public class GfmlDoc {
public GfmlNde RootNde() {return rootNde;} GfmlNde rootNde;
@gplx.Internal protected ListAdp UsrMsgs() {return usrMsgs;} ListAdp usrMsgs = ListAdp_.new_();
@gplx.Internal protected List_adp UsrMsgs() {return usrMsgs;} List_adp usrMsgs = List_adp_.new_();
@gplx.Internal protected GfmlLxrRegy LxrRegy() {return lxrRegy;} GfmlLxrRegy lxrRegy = new GfmlLxrRegy();
@gplx.Internal protected GfmlBldrCmdRegy CmdRegy() {return cmdRegy;} GfmlBldrCmdRegy cmdRegy = GfmlBldrCmdRegy.new_();
@gplx.Internal protected GfmlPragmaMgr PragmaMgr() {return pragmaMgr;} GfmlPragmaMgr pragmaMgr = GfmlPragmaMgr.new_();

View File

@@ -38,7 +38,7 @@ class GfmlUsrMsgs {
public static Err gfmlParseError(GfmlBldr bldr) {
Err rv = Err_.new_("gfml parse error");
for (int i = 0; i < bldr.Doc().UsrMsgs().Count(); i++) {
UsrMsg um = (UsrMsg)bldr.Doc().UsrMsgs().FetchAt(i);
UsrMsg um = (UsrMsg)bldr.Doc().UsrMsgs().Get_at(i);
rv.Add("err" + Int_.Xto_str(i), um.XtoStr());
}
return rv;

View File

@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.gfml; import gplx.*;
public class GfmlItmHnds {
public int Count() {return list.Count();} ListAdp list = ListAdp_.new_();
public GfmlNde FetchAt(int idx) {return (GfmlNde)list.FetchAt(idx);}
public int Count() {return list.Count();} List_adp list = List_adp_.new_();
public GfmlNde Get_at(int idx) {return (GfmlNde)list.Get_at(idx);}
public void Add(GfmlNde nde) {list.Add(nde);}
public static GfmlItmHnds new_() {return new GfmlItmHnds();} GfmlItmHnds() {}
}

View File

@@ -19,8 +19,8 @@ package gplx.gfml; import gplx.*;
public class GfmlItmKeys {
public int Count() {return list.Count();}
public boolean Has(String key) {return hash.Has(key);}
public GfmlItm FetchAt(int i) {return (GfmlItm)list.FetchAt(i);}
public GfmlItm Fetch(String key) {return (GfmlItm)hash.Fetch(key);}
public GfmlItm Get_at(int i) {return (GfmlItm)list.Get_at(i);}
public GfmlItm Get_by(String key) {return (GfmlItm)hash.Get_by(key);}
public String FetchDataOr(String key, String or) {
GfmlAtr atr = FetchAtr(key);
return (atr == null) ? or : atr.DatTkn().Val();
@@ -54,8 +54,8 @@ public class GfmlItmKeys {
}
if (toDel != null) list.Del(toDel);
}
GfmlAtr FetchAtr(String key) {return GfmlAtr.as_(hash.Fetch(key));}
ListAdp list = ListAdp_.new_(); HashAdp hash = HashAdp_.new_();
GfmlAtr FetchAtr(String key) {return GfmlAtr.as_(hash.Get_by(key));}
List_adp list = List_adp_.new_(); Hash_adp hash = Hash_adp_.new_();
public static GfmlItmKeys new_() {return new GfmlItmKeys();} GfmlItmKeys() {}
@gplx.Internal protected static final String NullKey = "";
}

View File

@@ -24,7 +24,7 @@ public class GfmlNde implements GfmlItm {
public boolean KeyedSubObj() {return keyedSubObj;} public GfmlNde KeyedSubObj_(boolean v) {keyedSubObj = v; return this;} private boolean keyedSubObj;
public int ChainId() {return chainId;} public GfmlNde ChainId_(int v) {chainId = v; return this;} int chainId; // can use boolean chainHead, but this is easier for debugging
public int SubObjs_Count() {return subObjs.Count();} GfmlObjList subObjs = GfmlObjList.new_();
public GfmlObj SubObjs_GetAt(int i) {return (GfmlObj)subObjs.FetchAt(i);}
public GfmlObj SubObjs_GetAt(int i) {return (GfmlObj)subObjs.Get_at(i);}
public void SubObjs_Add(GfmlObj gobj) {
subObjs.Add(gobj);
GfmlItm subItm = GfmlItm_.as_(gobj);
@@ -43,7 +43,7 @@ public class GfmlNde implements GfmlItm {
public String XtoStr() {return GfmlDocWtr_.xtoStr_(this);}
public void UpdateNde(String hnd) {
for (int i = 0; i < subHnds.Count(); i++) {
GfmlNde nde = (GfmlNde)subHnds.FetchAt(i);
GfmlNde nde = (GfmlNde)subHnds.Get_at(i);
if (String_.Eq(nde.hndTkn.Raw(), hnd)) return;
}
int endAtrPos = PosOf(false, ";", "}");
@@ -58,7 +58,7 @@ public class GfmlNde implements GfmlItm {
subNde.SubObjs_Add(endParen);
subNde.SubObjs_Add(bgnBrace);
subNde.SubObjs_Add(endBrace);
subObjs.AddAt(subNde, endAtrPos);
subObjs.Add_at(subNde, endAtrPos);
// a(){b(){}}
// a:{} -> a:{b:{}}
}
@@ -67,7 +67,7 @@ public class GfmlNde implements GfmlItm {
int end = fwd ? subObjs.Count() : 0;
int dif = fwd ? 1 : -1;
for (int i = bgn; i != end; i+=dif) {
GfmlObj subObj = (GfmlObj)subObjs.FetchAt(i);
GfmlObj subObj = (GfmlObj)subObjs.Get_at(i);
GfmlTkn subTkn = GfmlTkn_.as_(subObj);
if (subTkn == null) continue;
if (String_.In(subTkn.Raw(), find)) {
@@ -77,7 +77,7 @@ public class GfmlNde implements GfmlItm {
return -1;
}
public void UpdateAtr(String key, String val) {
GfmlAtr atr = (GfmlAtr)subKeys.Fetch(key);
GfmlAtr atr = (GfmlAtr)subKeys.Get_by(key);
if (atr != null) {atr.UpdateAtr(key, val); return;}
val = String_.Replace(val, "'", "''");
GfmlTkn quote = GfmlTkn_.new_("'", "");
@@ -90,10 +90,10 @@ public class GfmlNde implements GfmlItm {
atr.SubObjs_Add(valTkn);
int endAtrPos = PosOf(true, ";", "{");
if (subKeys.Count() != 0) {
subObjs.AddAt(GfmlTkn_.new_(" ", ""), endAtrPos);
subObjs.Add_at(GfmlTkn_.new_(" ", ""), endAtrPos);
endAtrPos++;
}
subObjs.AddAt(atr, endAtrPos);
subObjs.Add_at(atr, endAtrPos);
}
@gplx.Internal protected void ObjType_set_pragma() {objType = GfmlObj_.Type_prg;}

View File

@@ -22,7 +22,7 @@ interface GfmlScopeItm {
}
class GfmlScopeRegy {
public boolean Has(String key) {
GfmlScopeList list = (GfmlScopeList)hash.Fetch(key); if (list == null) return false;
GfmlScopeList list = (GfmlScopeList)hash.Get_by(key); if (list == null) return false;
return list.Count() > 0;
}
public void Add(GfmlScopeItm itm) {
@@ -30,23 +30,23 @@ class GfmlScopeRegy {
list.Add(itm);
}
public void Del(GfmlScopeItm itm) {
GfmlScopeList list = (GfmlScopeList)hash.Fetch(itm.Key()); if (list == null) return;
GfmlScopeList list = (GfmlScopeList)hash.Get_by(itm.Key()); if (list == null) return;
list.Del(itm);
if (list.Count() == 0) hash.Del(itm.Key());
}
public GfmlScopeItm Fetch(String key, GfmlDocPos pos) {
GfmlScopeList list = (GfmlScopeList)hash.Fetch(key); if (list == null) return null;
return list.Fetch(pos);
public GfmlScopeItm Get_by(String key, GfmlDocPos pos) {
GfmlScopeList list = (GfmlScopeList)hash.Get_by(key); if (list == null) return null;
return list.Get_by(pos);
}
GfmlScopeList ItmOrNew(String key) {
GfmlScopeList rv = (GfmlScopeList)hash.Fetch(key);
GfmlScopeList rv = (GfmlScopeList)hash.Get_by(key);
if (rv == null) {
rv = GfmlScopeList.new_(key);
hash.Add(key, rv);
}
return rv;
}
HashAdp hash = HashAdp_.new_();
Hash_adp hash = Hash_adp_.new_();
public static GfmlScopeRegy new_() {return new GfmlScopeRegy();}
}
class GfmlScopeList {
@@ -54,7 +54,7 @@ class GfmlScopeList {
public int Count() {return list.Count();}
public void Add(GfmlScopeItm itm) {list.Add(itm);}
public void Del(GfmlScopeItm itm) {list.Del(itm);}
public GfmlScopeItm Fetch(GfmlDocPos pos) {
public GfmlScopeItm Get_by(GfmlDocPos pos) {
if (list.Count() == 0) return null;
GfmlScopeItm rv = null;
for (Object itemObj : list) {
@@ -66,7 +66,7 @@ class GfmlScopeList {
}
return rv;
}
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
public static GfmlScopeList new_(String key) {
GfmlScopeList rv = new GfmlScopeList(); rv.key = key; return rv;
} GfmlScopeList() {}

View File

@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.gfml; import gplx.*;
import gplx.lists.*;/*HashAdp_list*/
import gplx.lists.*;/*Hash_adp_list*/
interface GfmlPragma {
String KeyOfPragma();
void Exec(GfmlBldr bldr, GfmlNde pragmaNde);
@@ -26,7 +26,7 @@ class GfmlPragmaMgr {
public void Pragmas_add(GfmlPragma cmd) {pragmas.Add(cmd.KeyOfPragma(), cmd);}
public boolean Pragmas_compile(String ndeName, GfmlBldr bldr) {
if (pragmas.Count() == 0) return false;
GfmlPragma cmd = (GfmlPragma)pragmas.Fetch(ndeName); if (cmd == null) return false;
GfmlPragma cmd = (GfmlPragma)pragmas.Get_by(ndeName); if (cmd == null) return false;
GfmlNde pragmaNde = bldr.CurNde();
pragmaNde.ObjType_set_pragma();
cmd.Exec(bldr, pragmaNde);
@@ -38,13 +38,13 @@ class GfmlPragmaMgr {
public void EndCmds_add(GfmlDocPos pos, GfmlBldrCmd cmd) {endCmds.AddInList(pos.Path(), cmd);}
public void EndCmds_del(GfmlDocPos pos, GfmlBldrCmd cmd) {endCmds.DelInList(pos.Path(), cmd);}
public void EndCmds_exec(GfmlDocPos pos, GfmlBldr bldr) {Exec(pos, bldr, endCmds);}
static void Exec(GfmlDocPos pos, GfmlBldr bldr, HashAdp_list cmds) {
ListAdp list = cmds.Fetch(pos.Path()); if (list == null) return;
static void Exec(GfmlDocPos pos, GfmlBldr bldr, Hash_adp_list cmds) {
List_adp list = cmds.Get_by(pos.Path()); if (list == null) return;
for (int i = 0; i < list.Count(); i++) {
GfmlBldrCmd cmd = (GfmlBldrCmd)list.FetchAt(i);
GfmlBldrCmd cmd = (GfmlBldrCmd)list.Get_at(i);
cmd.Exec(bldr, GfmlTkn_.Null);
}
}
HashAdp pragmas = HashAdp_.new_(); HashAdp_list bgnCmds = HashAdp_list.new_(), endCmds = HashAdp_list.new_();
Hash_adp pragmas = Hash_adp_.new_(); Hash_adp_list bgnCmds = Hash_adp_list.new_(), endCmds = Hash_adp_list.new_();
public static GfmlPragmaMgr new_() {return new GfmlPragmaMgr();} GfmlPragmaMgr() {}
}

View File

@@ -19,22 +19,22 @@ package gplx.gfml; import gplx.*;
class GfmlPragmaDefault implements GfmlPragma {
public String KeyOfPragma() {return "_default";}
public void Exec(GfmlBldr bldr, GfmlNde pragmaNde) {
ListAdp list = Compile(pragmaNde);
List_adp list = Compile(pragmaNde);
GfmlDefaultPragma_bgnCmd.ExecList(bldr.TypeMgr().TypeRegy(), bldr.CurNdeFrame().CurDocPos(), list);
// bldr.PragmaMgr.EndCmds_add(GfmlDocPos_.up_(bldr.CurNdeFrame.DocPos), GfmlDefaultPragma_endCmd.new_(list));
}
@gplx.Internal protected ListAdp Compile(GfmlNde pragmaNde) {
ListAdp list = ListAdp_.new_();
@gplx.Internal protected List_adp Compile(GfmlNde pragmaNde) {
List_adp list = List_adp_.new_();
for (int i = 0; i < pragmaNde.SubHnds().Count(); i++) {
GfmlNde subNde = (GfmlNde)pragmaNde.SubHnds().FetchAt(i);
GfmlNde subNde = (GfmlNde)pragmaNde.SubHnds().Get_at(i);
CompileSubNde(subNde, list);
}
return list;
}
@gplx.Internal protected void CompileSubNde(GfmlNde nde, ListAdp list) {
@gplx.Internal protected void CompileSubNde(GfmlNde nde, List_adp list) {
String typeKey = nde.SubKeys().FetchDataOrNull("typeKey"); if (typeKey == null) throw Err_.missing_key_("typeKey");
for (int i = 0; i < nde.SubHnds().Count(); i++) {
GfmlNde subNde = (GfmlNde)nde.SubHnds().FetchAt(i);
GfmlNde subNde = (GfmlNde)nde.SubHnds().Get_at(i);
GfmlDefaultItem item = CompileItem(subNde, typeKey);
list.Add(item);
}
@@ -60,7 +60,7 @@ class GfmlDefaultItem {
public GfmlObj ValPrev() {return valPrev;} @gplx.Internal protected GfmlDefaultItem ValPrev_(GfmlObj tkn) {valPrev = tkn; return this;} GfmlObj valPrev;
public void Exec_bgn(GfmlType type) {
GfmlFld fld = type.SubFlds().Fetch(key);
GfmlFld fld = type.SubFlds().Get_by(key);
if (fld == null) { // no default defined; create
valPrev = GfmlPragmaDefault.Default_none;
fld = GfmlFld.new_(true, key, GfmlType_.StringKey).DefaultTkn_(val);
@@ -72,7 +72,7 @@ class GfmlDefaultItem {
}
}
public void Exec_end(GfmlType type) {
GfmlFld fld = type.SubFlds().Fetch(key); if (fld == null) return;
GfmlFld fld = type.SubFlds().Get_by(key); if (fld == null) return;
// if (fld == null) throw Err_.arg_range_msg_("fatal: could not find fld; typeKey={0} fld={1}", typeKey, key);
if (valPrev == GfmlPragmaDefault.Default_none) // drop default; (had been created by pragma)
type.SubFlds().Del(fld);
@@ -90,7 +90,7 @@ class GfmlDefaultItem {
class GfmlDefaultPragma_bgnCmd implements GfmlBldrCmd {
public String Key() {return "pragma:gfml.default.bgnCmd";}
public void Exec(GfmlBldr bldr, GfmlTkn tkn) {ExecList(bldr.TypeMgr().TypeRegy(), bldr.CurNdeFrame().CurDocPos(), list);}
@gplx.Internal protected static void ExecList(GfmlTypRegy regy, GfmlDocPos pos, ListAdp list) {
@gplx.Internal protected static void ExecList(GfmlTypRegy regy, GfmlDocPos pos, List_adp list) {
GfmlType type = GfmlType_.Null;
for (Object itemObj : list) {
GfmlDefaultItem item = (GfmlDefaultItem)itemObj;
@@ -103,8 +103,8 @@ class GfmlDefaultPragma_bgnCmd implements GfmlBldrCmd {
item.Exec_bgn(type);
}
}
ListAdp list;
public static GfmlDefaultPragma_bgnCmd new_(ListAdp list) {
List_adp list;
public static GfmlDefaultPragma_bgnCmd new_(List_adp list) {
GfmlDefaultPragma_bgnCmd rv = new GfmlDefaultPragma_bgnCmd();
rv.list = list;
return rv;
@@ -113,7 +113,7 @@ class GfmlDefaultPragma_bgnCmd implements GfmlBldrCmd {
class GfmlDefaultPragma_endCmd implements GfmlBldrCmd {
public String Key() {return "pragma:gfml.default.endCmd";}
public void Exec(GfmlBldr bldr, GfmlTkn tkn) {ExecList(bldr.TypeMgr().TypeRegy(), list);}
public static void ExecList(GfmlTypRegy regy, ListAdp list) {
public static void ExecList(GfmlTypRegy regy, List_adp list) {
GfmlType type = GfmlType_.Null;
for (Object itemObj : list) {
GfmlDefaultItem item = (GfmlDefaultItem)itemObj;
@@ -124,8 +124,8 @@ class GfmlDefaultPragma_endCmd implements GfmlBldrCmd {
item.Exec_end(type);
}
}
ListAdp list;
public static GfmlDefaultPragma_endCmd new_(ListAdp list) {
List_adp list;
public static GfmlDefaultPragma_endCmd new_(List_adp list) {
GfmlDefaultPragma_endCmd rv = new GfmlDefaultPragma_endCmd();
rv.list = list;
return rv;

View File

@@ -28,7 +28,7 @@ class GfmlPragmaLxrFrm implements GfmlPragma {
String end = ownerNde.SubKeys().FetchDataOrFail("end");
GfmlFrame frame = String_.Eq(type, "comment") ? GfmlFrame_.comment_() : GfmlFrame_.quote_();
GfmlLxr lxr = bldr.Doc().LxrRegy().Fetch(key);
GfmlLxr lxr = bldr.Doc().LxrRegy().Get_by(key);
if (lxr == null) {
lxr = GfmlLxr_.frame_(key, frame, bgn, end);
bldr.Doc().LxrRegy().Add(lxr);
@@ -48,7 +48,7 @@ class GfmlPragmaLxrFrm implements GfmlPragma {
}
}
for (int i = 0; i < ownerNde.SubHnds().Count(); i++) {
GfmlNde subNde = (GfmlNde)ownerNde.SubHnds().FetchAt(i);
GfmlNde subNde = (GfmlNde)ownerNde.SubHnds().Get_at(i);
GfmlLxr subLxr = null;
if (String_.Eq(subNde.Hnd(), "sym"))
subLxr = GfmlPragmaLxrSym.Compile(bldr, subNde);

View File

@@ -28,7 +28,7 @@ class GfmlPragmaLxrSym implements GfmlPragma {
GfmlTkn cmdTkn = ownerNde.SubKeys().FetchDataTknOrNull("cmd");
GfmlBldrCmd cmd = bldr.Doc().CmdRegy().GetOrFail(cmdTkn.Val());
GfmlLxr lxr = bldr.Doc().LxrRegy().Fetch(key);
GfmlLxr lxr = bldr.Doc().LxrRegy().Get_by(key);
if (lxr == null) {
lxr = GfmlLxr_.symbol_(key, raw, val, cmd);
bldr.Doc().LxrRegy().Add(lxr);

View File

@@ -20,9 +20,9 @@ import gplx.lists.*;
class GfmlPragmaType implements GfmlPragma {
public String KeyOfPragma() {return pragmaKey;} private String pragmaKey = "_type";
public void Exec(GfmlBldr bldr, GfmlNde pragmaNde) {
OrderedHash list = OrderedHash_.new_(); ListAdp replaced = ListAdp_.new_();
Ordered_hash list = Ordered_hash_.new_(); List_adp replaced = List_adp_.new_();
for (int i = 0 ; i < pragmaNde.SubHnds().Count(); i++) {
GfmlNde typNde = pragmaNde.SubHnds().FetchAt(i);
GfmlNde typNde = pragmaNde.SubHnds().Get_at(i);
GfmlType type = GfmlTypeCompiler.Compile(typNde, GfmlType_.Root, bldr.TypeMgr().TypeRegy(), list);
if (i == 0) {
GfmlFrame_nde topFrame = GfmlFrame_nde_.as_(bldr.CurFrame());
@@ -48,7 +48,7 @@ class GfmlPragmaType implements GfmlPragma {
return makr.Xto_bry();
}
public static final String CacheLog_key = "log:type";
@gplx.Internal protected static void ExecList(GfmlTypRegy regy, OrderedHash list, ListAdp replaced) {
@gplx.Internal protected static void ExecList(GfmlTypRegy regy, Ordered_hash list, List_adp replaced) {
for (Object typeObj : list) {
GfmlType type = (GfmlType)typeObj;
if (regy.Has(type.Key()))
@@ -60,7 +60,7 @@ class GfmlPragmaType implements GfmlPragma {
class GfmlPragmaType_endCmd implements GfmlBldrCmd {
public String Key() {return "cmd.gfml.type.end";}
public void Exec(GfmlBldr bldr, GfmlTkn tkn) {ExecList(bldr.TypeMgr().TypeRegy(), list, replaced);}
@gplx.Internal protected static void ExecList(GfmlTypRegy regy, OrderedHash list, ListAdp replaced) {
@gplx.Internal protected static void ExecList(GfmlTypRegy regy, Ordered_hash list, List_adp replaced) {
for (Object typeObj : list) {
GfmlType type = (GfmlType)typeObj;
regy.Del(type);
@@ -70,8 +70,8 @@ class GfmlPragmaType_endCmd implements GfmlBldrCmd {
regy.Add(type);
}
}
OrderedHash list; ListAdp replaced;
public static GfmlPragmaType_endCmd new_(OrderedHash list, ListAdp replaced) {
Ordered_hash list; List_adp replaced;
public static GfmlPragmaType_endCmd new_(Ordered_hash list, List_adp replaced) {
GfmlPragmaType_endCmd rv = new GfmlPragmaType_endCmd();
rv.list = list; rv.replaced = replaced;
return rv;

View File

@@ -19,14 +19,14 @@ package gplx.gfml; import gplx.*;
class GfmlPragmaVar implements GfmlPragma {
public String KeyOfPragma() {return pragmaKey;} public void PragmaKey_set(String v) {pragmaKey = v;} private String pragmaKey = "_var";
public void Exec(GfmlBldr bldr, GfmlNde pragmaNde) {
ListAdp list = Compile(pragmaNde);
List_adp list = Compile(pragmaNde);
ExecList(bldr.Vars(), list);
bldr.Doc().PragmaMgr().EndCmds_add(bldr.CurNdeFrame().CurDocPos().NewUp(), GfmlPragmaVar_scopeEndCmd.new_(list));
}
@gplx.Internal protected ListAdp Compile(GfmlNde pragmaNde) {
ListAdp list = ListAdp_.new_();
@gplx.Internal protected List_adp Compile(GfmlNde pragmaNde) {
List_adp list = List_adp_.new_();
for (int i = 0; i < pragmaNde.SubHnds().Count(); i++) {
GfmlNde subNde = (GfmlNde)pragmaNde.SubHnds().FetchAt(i);
GfmlNde subNde = (GfmlNde)pragmaNde.SubHnds().Get_at(i);
GfmlVarItm itm = CompileItmNde(subNde);
list.Add(itm);
}
@@ -34,7 +34,7 @@ class GfmlPragmaVar implements GfmlPragma {
}
@gplx.Internal protected GfmlVarItm CompileItmNde(GfmlNde subNde) {
String key = subNde.SubKeys().FetchDataOrFail("key");
GfmlAtr valAtr = (GfmlAtr)subNde.SubKeys().Fetch("val");
GfmlAtr valAtr = (GfmlAtr)subNde.SubKeys().Get_by("val");
String ctx = subNde.SubKeys().FetchDataOrNull("ctx"); if (ctx == null) ctx = GfmlVarCtx_.DefaultKey;
return GfmlVarItm.new_(key, valAtr.DatTkn(), ctx);
}
@@ -43,7 +43,7 @@ class GfmlPragmaVar implements GfmlPragma {
makr.MakeSubType ( "text", "key", "val", "ctx");
return makr.Xto_bry();
}
void ExecList(HashAdp cache, ListAdp list) {
void ExecList(Hash_adp cache, List_adp list) {
GfmlVarCtx ctx = null;
for (Object varObj : list) {
GfmlVarItm var = (GfmlVarItm)varObj;
@@ -52,7 +52,7 @@ class GfmlPragmaVar implements GfmlPragma {
}
}
public static GfmlPragmaVar new_() {return new GfmlPragmaVar();} GfmlPragmaVar() {}
public static GfmlVarCtx FetchIfNew(GfmlVarCtx ctx, GfmlVarItm var, HashAdp cache) {// reused in two procs
public static GfmlVarCtx FetchIfNew(GfmlVarCtx ctx, GfmlVarItm var, Hash_adp cache) {// reused in two procs
if (ctx == null || !String_.Eq(ctx.Key(), var.CtxKey()))
ctx = GfmlVarCtx_.FetchFromCacheOrNew(cache, var.CtxKey());
return ctx;
@@ -61,7 +61,7 @@ class GfmlPragmaVar implements GfmlPragma {
class GfmlPragmaVar_scopeEndCmd implements GfmlBldrCmd {
public String Key() {return "cmd:gfml.var.expire";}
public void Exec(GfmlBldr bldr, GfmlTkn tkn) {
HashAdp cache = bldr.Vars();
Hash_adp cache = bldr.Vars();
GfmlVarCtx ctx = null;
for (Object varObj : list) {
GfmlVarItm var = (GfmlVarItm)varObj;
@@ -69,8 +69,8 @@ class GfmlPragmaVar_scopeEndCmd implements GfmlBldrCmd {
var.Scope_end(ctx);
}
}
ListAdp list;
public static GfmlPragmaVar_scopeEndCmd new_(ListAdp list) {
List_adp list;
public static GfmlPragmaVar_scopeEndCmd new_(List_adp list) {
GfmlPragmaVar_scopeEndCmd rv = new GfmlPragmaVar_scopeEndCmd();
rv.list = list;
return rv;

View File

@@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfml; import gplx.*;
class GfmlVarCtx {
public String Key() {return key;} private String key;
public void AddReplace(GfmlVarItm itm) {hash.AddReplace(itm.Key(), itm);}
public void Add_if_dupe_use_nth(GfmlVarItm itm) {hash.Add_if_dupe_use_nth(itm.Key(), itm);}
public void Del(String key) {hash.Del(key);}
public String Fetch_Val(String key) {
GfmlVarItm itm = (GfmlVarItm)hash.Fetch(key); if (itm == null) return null;
GfmlVarItm itm = (GfmlVarItm)hash.Get_by(key); if (itm == null) return null;
return itm.TknVal();
}
HashAdp hash = HashAdp_.new_();
Hash_adp hash = Hash_adp_.new_();
public static GfmlVarCtx new_(String key) {
GfmlVarCtx rv = new GfmlVarCtx();
rv.key = key;
@@ -32,9 +32,9 @@ class GfmlVarCtx {
}
}
class GfmlVarCtx_ {
public static GfmlVarCtx FetchFromCacheOrNew(HashAdp cache, String ctxKey) {
HashAdp ctxRegy = FetchRegyOrNew(cache);
GfmlVarCtx rv = (GfmlVarCtx)ctxRegy.Fetch(ctxKey);
public static GfmlVarCtx FetchFromCacheOrNew(Hash_adp cache, String ctxKey) {
Hash_adp ctxRegy = FetchRegyOrNew(cache);
GfmlVarCtx rv = (GfmlVarCtx)ctxRegy.Get_by(ctxKey);
if (rv == null) {
rv = (String_.Eq(ctxKey, DefaultKey))
? default_(ctxKey)
@@ -45,15 +45,15 @@ class GfmlVarCtx_ {
}
static GfmlVarCtx default_(String ctxKey) {
GfmlVarCtx rv = GfmlVarCtx.new_(ctxKey);
rv.AddReplace(GfmlVarItm.new_("t", GfmlTkn_.raw_("\t"), GfmlVarCtx_.DefaultKey));
rv.AddReplace(GfmlVarItm.new_("n", GfmlTkn_.raw_(String_.CrLf), GfmlVarCtx_.DefaultKey));
rv.Add_if_dupe_use_nth(GfmlVarItm.new_("t", GfmlTkn_.raw_("\t"), GfmlVarCtx_.DefaultKey));
rv.Add_if_dupe_use_nth(GfmlVarItm.new_("n", GfmlTkn_.raw_(String_.CrLf), GfmlVarCtx_.DefaultKey));
return rv;
}
static HashAdp FetchRegyOrNew(HashAdp cache) {
static Hash_adp FetchRegyOrNew(Hash_adp cache) {
String key = "gfml.cacheKeys.ctxRegy";
HashAdp rv = (HashAdp)cache.Fetch(key);
Hash_adp rv = (Hash_adp)cache.Get_by(key);
if (rv == null) {
rv = HashAdp_.new_();
rv = Hash_adp_.new_();
cache.Add(key, rv);
}
return rv;

View File

@@ -22,7 +22,7 @@ class GfmlVarItm implements GfmlScopeItm {
public GfmlTkn Tkn() {return tkn;} public void Tkn_set(GfmlTkn v) {tkn = v;} GfmlTkn tkn;
public String TknVal() {return tkn.Val();}
public String CtxKey() {return ctxKey;} private String ctxKey;
@gplx.Internal protected void Scope_bgn(GfmlVarCtx ctx) {ctx.AddReplace(this);}
@gplx.Internal protected void Scope_bgn(GfmlVarCtx ctx) {ctx.Add_if_dupe_use_nth(this);}
@gplx.Internal protected void Scope_end(GfmlVarCtx ctx) {ctx.Del(key);}
public static GfmlVarItm new_(String key, GfmlTkn tkn, String ctxKey) {
GfmlVarItm rv = new GfmlVarItm();

View File

@@ -23,7 +23,7 @@ public class GfmlBldr {
@gplx.Internal protected GfmlFrame_nde CurNdeFrame() {return curNdeFrame;} GfmlFrame_nde curNdeFrame;
@gplx.Internal protected GfmlNde CurNde() {return curNdeFrame.CurNde();}
@gplx.Internal protected GfmlTypeMgr TypeMgr() {return typeMgr;} GfmlTypeMgr typeMgr = GfmlTypeMgr.new_();
@gplx.Internal protected HashAdp Vars() {return vars;} HashAdp vars = HashAdp_.new_();
@gplx.Internal protected Hash_adp Vars() {return vars;} Hash_adp vars = Hash_adp_.new_();
@gplx.Internal protected int StreamPos() {return streamPos;} int streamPos;
@gplx.Internal protected void ThrowErrors_set(boolean v) {throwErrors = v;} private boolean throwErrors = true;
@gplx.Internal protected int PrvSymType() {return prvSymType;} @gplx.Internal protected void PrvSymType_set(int v) {prvSymType = v;} int prvSymType = GfmlNdeSymType.Null;

View File

@@ -29,8 +29,8 @@ class GfmlBldrCmd_null implements GfmlBldrCmd {
}
class GfmlBldrCmdRegy {
public void Add(GfmlBldrCmd cmd) {hash.Add(cmd.Key(), cmd);}
public GfmlBldrCmd GetOrFail(String key) {return (GfmlBldrCmd)hash.FetchOrFail(key);}
HashAdp hash = HashAdp_.new_();
public GfmlBldrCmd GetOrFail(String key) {return (GfmlBldrCmd)hash.Get_by_or_fail(key);}
Hash_adp hash = Hash_adp_.new_();
public static GfmlBldrCmdRegy new_() {
GfmlBldrCmdRegy rv = new GfmlBldrCmdRegy();
rv.Add(GfmlBldrCmd_elemKey_set._);

View File

@@ -114,7 +114,7 @@ class GfmlBldrCmd_whitespace implements GfmlBldrCmd {
public String Key() {return "gfml.whitespace_exec";}
public void Exec(GfmlBldr bldr, GfmlTkn tkn) {
if (bldr.CurNdeFrame().waitingTkns.Count() > 0) {
GfmlObj t = (GfmlObj)bldr.CurNdeFrame().waitingTkns.FetchAt(bldr.CurNdeFrame().waitingTkns.Count() - 1);
GfmlObj t = (GfmlObj)bldr.CurNdeFrame().waitingTkns.Get_at(bldr.CurNdeFrame().waitingTkns.Count() - 1);
if (t.ObjType() == GfmlObj_.Type_nde)
bldr.CurNdeFrame().IdxNdeBgn_set(bldr.CurNdeFrame().WaitingTkns().Count() + 1);
}

View File

@@ -208,7 +208,7 @@ class GfmlFrame_nde_ {
@gplx.Internal protected static void TransferToNde(GfmlObjList waitingTkns, GfmlNde nde, int bgn) {
int end = waitingTkns.Count();
for (int i = bgn; i < end; i++) {
GfmlObj tkn = waitingTkns.FetchAt(i);
GfmlObj tkn = waitingTkns.Get_at(i);
nde.SubObjs_Add(tkn);
}
if (bgn != end) // ignore if bgn == end
@@ -218,7 +218,7 @@ class GfmlFrame_nde_ {
int len = end - bgn;
if (len <= 0 || end == -1) return; // -1 b/c calling proc passes end - 1, and end may be 0
for (int i = 0; i < len; i++)
trg.SubObjs_Add(src.FetchAt(i + bgn));
trg.SubObjs_Add(src.Get_at(i + bgn));
src.Del_range(bgn, end - 1);
}
}

View File

@@ -78,7 +78,7 @@ class GfmlFrame_ndeTknMgr {
k = bldr.TypeMgr().FldPool().Keyed_PopNextAsTkn();
GfmlAtr atr = GfmlAtr.string_(k, v);
GfmlFrame_nde_.TransferToAtr(frame.waitingTkns, atr, idxAtrBgn, idxAtrEnd);
frame.waitingTkns.AddAt(atr, idxAtrBgn);
frame.waitingTkns.Add_at(atr, idxAtrBgn);
this.IdxAtr_clear();
}
GfmlFrame_nde frame; GfmlBldr bldr;

View File

@@ -31,13 +31,13 @@ class GfmlStringHighlighter {
}
public String[] Gen() {
String_bldr posBfr = String_bldr_.new_(), rawBfr = String_bldr_.new_(), symBfr = String_bldr_.new_();
ListAdp symList = ListAdp_.new_();
List_adp symList = List_adp_.new_();
int bgnPos = 0, endPos = 0;
int rawLen = String_.Len(raw); int rawLenDigits = Int_.DigitCount(rawLen);
int rawBfrBgn = -1, marksLastIdx = marks.LastIndex();
int rawBfrBgn = -1, marksLastIdx = marks.Idx_last();
for (int i = 0; i < marks.Count(); i++) {
GfmlStringHighlighterMarker curMark = (GfmlStringHighlighterMarker)marks.FetchAt(i);
GfmlStringHighlighterMarker nxtMark = i == marksLastIdx ? GfmlStringHighlighterMarker.Null : (GfmlStringHighlighterMarker)marks.FetchAt(i + 1);
GfmlStringHighlighterMarker curMark = (GfmlStringHighlighterMarker)marks.Get_at(i);
GfmlStringHighlighterMarker nxtMark = i == marksLastIdx ? GfmlStringHighlighterMarker.Null : (GfmlStringHighlighterMarker)marks.Get_at(i + 1);
// bgnPos
bgnPos = XtoBgnPos(curMark.Pos(), endPos);
if (i == 0) rawBfrBgn = bgnPos;
@@ -79,17 +79,17 @@ class GfmlStringHighlighter {
rawBfr.Add_at(0, " ");
symBfr.Add_at(0, " ");
}
ListAdp rv = ListAdp_.new_();
List_adp rv = List_adp_.new_();
rv.Add(posBfr.XtoStr());
rv.Add(rawBfr.XtoStr());
rv.Add(symBfr.XtoStr());
if (symList.Count() > 0)
rv.Add("");
for (int i = 0; i < symList.Count(); i++)
rv.Add((String)symList.FetchAt(i));
return rv.XtoStrAry();
rv.Add((String)symList.Get_at(i));
return rv.To_str_ary();
}
ListAdp marks = ListAdp_.new_();
List_adp marks = List_adp_.new_();
public static GfmlStringHighlighter new_() {
GfmlStringHighlighter rv = new GfmlStringHighlighter();
return rv;

View File

@@ -55,7 +55,7 @@ public class GfmlDataNde {
String msgKey = String_.Coalesce(gnde.Key(), gnde.Hnd());
GfoMsg msg = GfoMsg_.new_parse_(msgKey);
for (int i = 0; i < gnde.SubKeys().Count(); i++) {
GfmlItm subItm = (GfmlItm)gnde.SubKeys().FetchAt(i);
GfmlItm subItm = (GfmlItm)gnde.SubKeys().Get_at(i);
if (subItm.ObjType() == GfmlObj_.Type_atr) {
GfmlAtr subAtr = (GfmlAtr)subItm;
String subAtrKey = String_.Len_eq_0(subAtr.Key()) ? "" : subAtr.Key(); // NOTE: needs to be "" or else will fail in GfoConsole; key will be evaluated against NullKey in GfsCtx
@@ -68,7 +68,7 @@ public class GfmlDataNde {
}
}
for (int i = 0; i < gnde.SubHnds().Count(); i++) {
GfmlItm subItm = (GfmlItm)gnde.SubHnds().FetchAt(i);
GfmlItm subItm = (GfmlItm)gnde.SubHnds().Get_at(i);
GfmlNde subNde = (GfmlNde)subItm;
GfoMsg subMsg = XtoMsg(subNde);
msg.Subs_add(subMsg);
@@ -81,7 +81,7 @@ class GfmlDataWtr2 extends DataWtr_base implements DataWtr {
GfmlTkn nameTkn = GfmlTkn_.raw_(name);
GfmlTkn valTkn = GfmlTkn_.raw_(XtoStr(val));
GfmlAtr atr = GfmlAtr.new_(nameTkn, valTkn, GfmlType_.String);
GfmlNde nde = gdoc.RootNde().SubHnds().FetchAt(0);
GfmlNde nde = gdoc.RootNde().SubHnds().Get_at(0);
nde.SubKeys().Add(atr);
}
public void InitWtr(String key, Object val) {}

View File

@@ -21,7 +21,7 @@ public class GfmlDataRdr extends GfmlDataRdr_base {
GfmlDoc gdoc = GfmlDoc_.parse_any_eol_(raw);
GfmlDataRdr rv = new GfmlDataRdr();
rv.Parse_set(true);
rv.SetNode(gdoc.RootNde().SubHnds().FetchAt(0));
rv.SetNode(gdoc.RootNde().SubHnds().Get_at(0));
return rv;
}
public static DataRdr raw_list_(String raw) {

View File

@@ -20,13 +20,13 @@ import gplx.stores.*; /*DataRdr_base*/
public abstract class GfmlDataRdr_base extends DataRdr_base implements DataRdr {
@Override public String NameOfNode() {return curNde.Hnd();}
@Override public int FieldCount() {return curNde.SubKeys().Count();}
@Override public String KeyAt(int idx) {return curNde.SubKeys().FetchAt(idx).KeyTkn().Val();}
@Override public Object ReadAt(int idx) {return GfmlAtr.as_(curNde.SubKeys().FetchAt(idx)).DatTkn().Val();}
@Override public String KeyAt(int idx) {return curNde.SubKeys().Get_at(idx).KeyTkn().Val();}
@Override public Object ReadAt(int idx) {return GfmlAtr.as_(curNde.SubKeys().Get_at(idx)).DatTkn().Val();}
@Override public Object Read(String name) {return curNde.SubKeys().FetchDataOrNull(name);}
public boolean MoveNextPeer() {
pos += 1;
if (list == null || pos >= list.Count()) return false; // TODO_9: makeCurNde null; invalidate FieldAt, etc?
curNde = list.FetchAt(pos);
curNde = list.Get_at(pos);
return true;
}
@Override public DataRdr Subs() {
@@ -43,7 +43,7 @@ public abstract class GfmlDataRdr_base extends DataRdr_base implements DataRdr {
rv.list = GfmlItmHnds.new_();
if (curNde == null) return rv;
for (int i = 0; i < curNde.SubHnds().Count(); i++) {
GfmlNde sub = (GfmlNde)curNde.SubHnds().FetchAt(i);
GfmlNde sub = (GfmlNde)curNde.SubHnds().Get_at(i);
String typeName = sub.Type().NdeName();
if ( sub.Type().IsTypeAny()) // isAnyType b/c match may not be exact; ex: type can be defined as item:key name; but actlNde may be item:key name size;
//|| sub.Type().IsTypeNull())

View File

@@ -79,7 +79,7 @@ class SqlCmd_quote_end implements GfmlBldrCmd {
String_bldr sb = String_bldr_.new_();
GfmlObjList list = bldr.CurFrame().WaitingTkns();
for (int i = 0; i < list.Count(); i++) {
GfmlTkn pnd = (GfmlTkn)list.FetchAt(i);
GfmlTkn pnd = (GfmlTkn)list.Get_at(i);
sb.Add(pnd.Val());
}
//Int_.Xto_str(bldr.CurNdeFrame().Nde().SubTkns().length)

View File

@@ -50,8 +50,8 @@ class GfmlParse_fxt {
public void tst_Err(String raw, UsrMsg_mok... expdErrs) {
bldr.ThrowErrors_set(false);
GfmlDoc actlDoc = bldr.XtoGfmlDoc(raw);
ListAdp expd = ListAdp_.new_(), actl = actlDoc.UsrMsgs();
expd.AddMany((Object[])expdErrs);
List_adp expd = List_adp_.new_(), actl = actlDoc.UsrMsgs();
expd.Add_many((Object[])expdErrs);
TfdsTstr_fxt tstr = TfdsTstr_fxt.new_();
int max = tstr.List_Max(expd, actl);
for (int i = 0; i < max; i++) {
@@ -60,14 +60,14 @@ class GfmlParse_fxt {
UsrMsg_mok actlUmm = UsrMsg_mok.new_(actlUm);
tstr.Eq_str(expdUm.Main(), actlUmm.Main(), "main");
for (int j = 0; j < expdUm.Args().Count(); j++) {
KeyVal expdKv = (KeyVal)expdUm.Args().FetchAt(j);
KeyVal actlKv = (KeyVal)actlUmm.Args().Fetch(expdKv.Key());
KeyVal expdKv = (KeyVal)expdUm.Args().Get_at(j);
KeyVal actlKv = (KeyVal)actlUmm.Args().Get_by(expdKv.Key());
Object actlVal = actlKv == null ? String_.Null_mark : actlKv.Val();
tstr.Eq_str(expdKv.Val(), actlVal, expdKv.Key());
}
for (int j = 0; j < expdUm.Required().Count(); j++) {
String expdKv = (String)expdUm.Required().FetchAt(j);
KeyVal actlKv = (KeyVal)actlUmm.Args().Fetch(expdKv);
String expdKv = (String)expdUm.Required().Get_at(j);
KeyVal actlKv = (KeyVal)actlUmm.Args().Get_by(expdKv);
Object actlVal = actlKv == null ? String_.Null_mark : actlKv.Val();
Object actlValV = actlKv == null ? "<<REQD>>" : actlKv.Val();
tstr.Eq_str(actlValV, actlVal, expdKv);

View File

@@ -21,7 +21,7 @@ class GfmlTypeCompiler_fxt {
public GfmlNde_mok nde_() {return GfmlNde_mok.new_();}
public GfmlFld_mok fld_() {return GfmlFld_mok.new_();}
public GfmlTypRegy Regy() {return typBldr.TypeRegy();}
public void ini_Typ(ListAdp typs, GfmlTyp_mok typ) {typs.Add(typ);}
public void ini_Typ(List_adp typs, GfmlTyp_mok typ) {typs.Add(typ);}
@gplx.Internal protected void run_InitPragma(GfmlTypRegy regy, GfmlPragma pragma) {
GfmlTypeMakr makr = GfmlTypeMakr.new_();
GfmlType[] typeAry = pragma.MakePragmaTypes(makr);
@@ -34,7 +34,7 @@ class GfmlTypeCompiler_fxt {
}
public void tst_Compile(GfmlNde_mok nde, GfmlTyp_mok expd) {
GfmlNde gnde = run_Resolve(this.Regy(), "_type/type", nde);
OrderedHash list = OrderedHash_.new_();
Ordered_hash list = Ordered_hash_.new_();
GfmlType actlType = GfmlTypeCompiler.Compile(gnde, GfmlType_.Root, this.Regy(), list);
GfmlTyp_mok actl = GfmlTyp_mok.type_(actlType);
TfdsTstr_fxt tstr = TfdsTstr_fxt.new_();

View File

@@ -50,7 +50,7 @@ class GfmlNde_mok implements GfmlItm_mok {
public boolean KeyedSubObj() {return keyed;}
public GfmlNde_mok KeyedSubObj_() {return KeyedSubObj_(true);}
public GfmlNde_mok KeyedSubObj_(boolean v) {keyed = v; return this;} private boolean keyed;
public ListAdp Subs() {return subs;}
public List_adp Subs() {return subs;}
public String XtoStrStub() {
String_bldr sb = String_bldr_.new_();
sb.Add_kv("key=", key).Add_kv("hnd=", hnd).Add_kv("typ=", typ).Add_kv("subs=", Int_.Xto_str(subs.Count()));
@@ -60,7 +60,7 @@ class GfmlNde_mok implements GfmlItm_mok {
for (GfmlItm_mok itm : ary)
subs.Add(itm);
return this;
} ListAdp subs = ListAdp_.new_();
} List_adp subs = List_adp_.new_();
public GfmlNde_mok Atrk_(String k, String v) {subs.Add(GfmlAtr_mok.new_(k, v)); return this;}
public GfmlNde_mok Atru_(String v) {subs.Add(GfmlAtr_mok.new_(GfmlTkn_.NullVal, v)); return this;}
@@ -78,7 +78,7 @@ class GfmlNde_mok implements GfmlItm_mok {
if (ownerMok.keyed) rv.KeyedSubObj_(ownerMok.keyed);
if (ownerMok.key != null) rv.KeyTkn_set(GfmlTkn_.val_(ownerMok.key));
for (int i = 0; i < ownerMok.subs.Count(); i++) {
GfmlItm_mok itm = (GfmlItm_mok)ownerMok.subs.FetchAt(i);
GfmlItm_mok itm = (GfmlItm_mok)ownerMok.subs.Get_at(i);
if (itm.ObjType() == GfmlObj_.Type_nde) {
GfmlNde_mok itmMok = (GfmlNde_mok)itm;
rv.SubObjs_Add(itmMok.XtoGfmlItm(regy));
@@ -103,7 +103,7 @@ class GfmlNde_mok implements GfmlItm_mok {
rv.chainId = nde.ChainId();
if (nde.Key() != null) rv.key = nde.Key();
for (int i = 0; i < nde.SubKeys().Count(); i++) {
GfmlItm subItm = (GfmlItm)nde.SubKeys().FetchAt(i);
GfmlItm subItm = (GfmlItm)nde.SubKeys().Get_at(i);
if (subItm.ObjType() == GfmlObj_.Type_atr) {
GfmlAtr subAtr = (GfmlAtr)subItm;
GfmlAtr_mok mokAtr = GfmlAtr_mok.new_(subAtr.Key(), subAtr.DatTkn().Val());
@@ -117,7 +117,7 @@ class GfmlNde_mok implements GfmlItm_mok {
}
}
for (int i = 0; i < nde.SubHnds().Count(); i++) {
GfmlNde subNde = (GfmlNde)nde.SubHnds().FetchAt(i);
GfmlNde subNde = (GfmlNde)nde.SubHnds().Get_at(i);
GfmlNde_mok mokNde = InitNde(subNde);
rv.subs.Add(mokNde);
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfml; import gplx.*;
class GfmlTkn_mok {
public String Raw() {return raw;} public GfmlTkn_mok Raw_(String v) {raw = v; return this;} private String raw;
public ListAdp Subs() {return list;} ListAdp list = ListAdp_.new_();
public List_adp Subs() {return list;} List_adp list = List_adp_.new_();
public GfmlTkn_mok Subs_(GfmlTkn_mok... ary) {
for (GfmlTkn_mok itm : ary)
list.Add(itm);

View File

@@ -43,7 +43,7 @@ class GfmlFld_mok {
class GfmlTyp_mok {
public String Name() {return name;} public GfmlTyp_mok Name_(String v) {name = v; return this;} private String name;
public String Key() {return key;} public GfmlTyp_mok Key_(String v) {key = v; return this;} private String key;
public ListAdp Subs() {return subFlds;} ListAdp subFlds = ListAdp_.new_();
public List_adp Subs() {return subFlds;} List_adp subFlds = List_adp_.new_();
public GfmlTyp_mok Atrs_(String... ary) {
for (String itm : ary)
subFlds.Add(GfmlFld_mok.new_().ini_atr_(itm));
@@ -57,7 +57,7 @@ class GfmlTyp_mok {
public GfmlType XtoGfmlType() {
GfmlType rv = GfmlType_.new_(key, name); // all types in tests are top-level
for (int i = 0; i < subFlds.Count(); i++) {
GfmlFld_mok fld = (GfmlFld_mok)subFlds.FetchAt(i);
GfmlFld_mok fld = (GfmlFld_mok)subFlds.Get_at(i);
rv.SubFlds().Add(fld.XtoGfmlFld());
}
return rv;
@@ -74,7 +74,7 @@ class GfmlTyp_mok {
GfmlTyp_mok rv = new GfmlTyp_mok();
rv.key = typ.Key(); rv.name = typ.NdeName();
for (int i = 0; i < typ.SubFlds().Count(); i++) {
GfmlFld fld = (GfmlFld)typ.SubFlds().FetchAt(i);
GfmlFld fld = (GfmlFld)typ.SubFlds().Get_at(i);
GfmlFld_mok mkFld = GfmlFld_mok.new_().ini_ndk_(fld.Name(), fld.TypeKey()).DefaultTkn_(fld.DefaultTkn());
rv.subFlds.Add(mkFld);
}

View File

@@ -20,14 +20,14 @@ class UsrMsg_mok {
public String Main() {return main;} public UsrMsg_mok Main_(String v) {main = v; return this;} private String main;
public UsrMsg_mok Add_(String k, Object o) {hash.Add(k, KeyVal_.new_(k, o)); return this;}
public UsrMsg_mok Require_(String k) {required.Add(k, k); return this;}
public OrderedHash Args() {return hash;} OrderedHash hash = OrderedHash_.new_();
public OrderedHash Required() {return required;} OrderedHash required = OrderedHash_.new_();
public Ordered_hash Args() {return hash;} Ordered_hash hash = Ordered_hash_.new_();
public Ordered_hash Required() {return required;} Ordered_hash required = Ordered_hash_.new_();
public static UsrMsg_mok new_(UsrMsg um) {
UsrMsg_mok rv = new UsrMsg_mok();
if (um != null) {
rv.main = um.Hdr();
for (int i = 0; i < um.Args().Count(); i++) {
KeyVal kv = (KeyVal)um.Args().FetchAt(i);
KeyVal kv = (KeyVal)um.Args().Get_at(i);
rv.Add_(kv.Key(), kv.Val());
}
}

View File

@@ -58,6 +58,6 @@ public class z011_IntObjHash_tst {
tst_Fetch(17, null); // works
tst_Fetch(16, null); // used to fail
}
void tst_Fetch(int key, Object expd) {Tfds.Eq(expd, hash.Fetch(key));}
void tst_Fetch(int key, Object expd) {Tfds.Eq(expd, hash.Get_by(key));}
void tst_Count(int expd) {Tfds.Eq(expd, hash.Count());}
}

View File

@@ -48,7 +48,7 @@ public class z016_GfmlScopeList_tst {
list.Add(itm);
}
void tst_Itm(GfmlScopeList list, GfmlDocPos pos, String expd) {
GfmlVarItm itm = (GfmlVarItm)list.Fetch(pos);
GfmlVarItm itm = (GfmlVarItm)list.Get_by(pos);
String actl = itm == null ? null : itm.TknVal();
Tfds.Eq(expd, actl);
}

View File

@@ -54,14 +54,14 @@ public class z091_GfmlLxr_basic_tst {
}
GfmlTkn tst_Fetch(String raw, String... expd) {
CharStream stream = CharStream.pos0_(raw);
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
GfmlTkn tkn = null;
while (true) {
tkn = rootLxr.MakeTkn(stream, 0);
if (tkn == GfmlTkn_.EndOfStream) break;
list.Add(tkn.Raw());
}
String[] actl = (String[])list.Xto_ary(String.class);
String[] actl = (String[])list.To_ary(String.class);
Tfds.Eq_ary(expd, actl);
return tkn;
}

View File

@@ -25,9 +25,9 @@ class GfmlDefaultItem_fxt {
Tfds.Eq(GfmlFld_mok.XtoRaw(expd.Val()), GfmlFld_mok.XtoRaw(actl.Val()));
Tfds.Eq(Val_to_str_or_null(expd.ValPrev()), Val_to_str_or_null(actl.ValPrev()));
}
@gplx.Internal protected void tst_List(ListAdp list, GfmlDefaultItem... expdAry) {
@gplx.Internal protected void tst_List(List_adp list, GfmlDefaultItem... expdAry) {
for (int i = 0; i < expdAry.length; i++) {
GfmlDefaultItem actl = (GfmlDefaultItem)list.FetchAt(i);
GfmlDefaultItem actl = (GfmlDefaultItem)list.Get_at(i);
GfmlDefaultItem expd = expdAry[i];
tst_Item(actl, expd);
}

View File

@@ -36,7 +36,7 @@ public class z451_dflts_compile_tst {
( fx_typ.nde_().Atrs_("x", "10")
, fx_typ.nde_().Atrs_("y", "20")
));
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
pragma.CompileSubNde(gnde, list);
fx.tst_List(list
, fx.make_("point", "x", "10")

View File

@@ -67,23 +67,23 @@ public class z452_dflts_exec_tst {
GfmlVarCtx evalContext = GfmlVarCtx.new_("testContext");
GfmlTkn valTkn = GfmlTkn_.raw_(text);
GfmlVarItm varItem = GfmlVarItm.new_("varKey", valTkn, "testContext");
evalContext.AddReplace(varItem);
evalContext.Add_if_dupe_use_nth(varItem);
GfmlVarTkn rv = new GfmlVarTkn("eval", GfmlTknAry_.ary_(valTkn), evalContext, "varKey");
return new Object[] {rv, varItem};
}
void ini_SubFldDefault_add(GfmlType type, String subFldKey, String defaultVal) {
GfmlFld subFld = type.SubFlds().Fetch(subFldKey);
GfmlFld subFld = type.SubFlds().Get_by(subFldKey);
GfmlTkn defaultTkn = GfmlTkn_.raw_(defaultVal);;
subFld.DefaultTkn_(defaultTkn);
}
void tst_SubFldDefault(GfmlType type, String subFldKey, String expdDefaultVal) {
GfmlFld subFld = type.SubFlds().Fetch(subFldKey);
GfmlFld subFld = type.SubFlds().Get_by(subFldKey);
GfmlTkn defaultTkn = GfmlTkn_.as_(subFld.DefaultTkn());
String actlDefaultVal = defaultTkn == null || defaultTkn == GfmlTkn_.Null ? null : defaultTkn.Val();
Tfds.Eq(expdDefaultVal, actlDefaultVal);
}
void tst_SubFldExists(GfmlType type, String subFldKey, boolean expd) {
GfmlFld subFld = type.SubFlds().Fetch(subFldKey);
GfmlFld subFld = type.SubFlds().Get_by(subFldKey);
Tfds.Eq(expd, subFld != null);
}
GfmlType make_(String key, String name, String... atrs) {

View File

@@ -30,7 +30,7 @@ public class z455_dflts_scope_tst {
tst_FetchOrNullByPos(regy, "point", rootPos, "point", "x", "y");
tst_FetchOrNullByPos(regy, "point", currPos, "point", "x", "y");
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
list.Add(GfmlDefaultItem.new_("point", "z", GfmlTkn_.raw_("0")));
GfmlDefaultPragma_bgnCmd.ExecList(regy, currPos, list);
@@ -42,7 +42,7 @@ public class z455_dflts_scope_tst {
Tfds.Eq(expdTypeKey, actl.Key());
String[] actlSubs = new String[actl.SubFlds().Count()];
for (int i = 0; i < actlSubs.length; i++)
actlSubs[i] = actl.SubFlds().FetchAt(i).Name();
actlSubs[i] = actl.SubFlds().Get_at(i).Name();
Tfds.Eq_ary(expdSubs, actlSubs);
return actl;
}

View File

@@ -59,7 +59,7 @@ public class z601_edit_atr_tst {
fx .Raw_("a='1';").Update_(fx.atr_().NdeIdxs_(0).Atr_("b", "2"))
.tst_("a='1' b='2';");
}
@Test public void AddMany() {
@Test public void Add_many() {
fx .Raw_("a='1';").Update_(fx.atr_().NdeIdxs_(0).Atr_("b", "2")).Update_(fx.atr_().NdeIdxs_(0).Atr_("c", "3"))
.tst_("a='1' b='2' c='3';");
}
@@ -86,7 +86,7 @@ class GfmlUpdateCmd_atr implements GfmlUpdateCmd {
public void Exec(GfmlDoc gdoc) {
GfmlNde nde = GetNde(ndeIdxs, gdoc.RootNde());
nde.UpdateAtr(atrKey, atrVal);
// GfmlAtr atr = atrIdx != -1 ? GfmlAtr.as_(nde.SubKeys().FetchAt(atrIdx)) : GfmlAtr.as_(nde.SubKeys().Fetch(atrKey));
// GfmlAtr atr = atrIdx != -1 ? GfmlAtr.as_(nde.SubKeys().Get_at(atrIdx)) : GfmlAtr.as_(nde.SubKeys().Get_by(atrKey));
// atr.UpdateAtr(atrKey, atrVal);
atrKey = ""; atrVal = "";//atrIdx = -1;
}
@@ -94,7 +94,7 @@ class GfmlUpdateCmd_atr implements GfmlUpdateCmd {
GfmlNde nde = owner;
for (int i = 0; i < ndeIdxs.length; i++) {
int ndeIdx = ndeIdxs[i];
nde = (GfmlNde)owner.SubHnds().FetchAt(ndeIdx);
nde = (GfmlNde)owner.SubHnds().Get_at(ndeIdx);
}
return nde;
}
@@ -114,11 +114,11 @@ class GfmlUpdateFx {
public GfmlUpdateCmd_atr atr_() {return GfmlUpdateCmd_atr.new_();}
public GfmlUpdateCmd_nde nde_() {return GfmlUpdateCmd_nde.new_();}
public String Raw() {return raw;} public GfmlUpdateFx Raw_(String v) {raw = v; return this;} private String raw;
public GfmlUpdateFx Update_(GfmlUpdateCmd cmd) {cmds.Add(cmd); return this;} ListAdp cmds = ListAdp_.new_();
public GfmlUpdateFx Update_(GfmlUpdateCmd cmd) {cmds.Add(cmd); return this;} List_adp cmds = List_adp_.new_();
public GfmlUpdateFx tst_(String expd) {
GfmlDoc actlDoc = GfmlDataNde.new_any_eol_(raw).Doc();
for (int i = 0; i < cmds.Count(); i++) {
GfmlUpdateCmd cmd = (GfmlUpdateCmd)cmds.FetchAt(i);
GfmlUpdateCmd cmd = (GfmlUpdateCmd)cmds.Get_at(i);
cmd.Exec(actlDoc);
}
String actl = actlDoc.RootNde().XtoStr();

View File

@@ -56,7 +56,7 @@ public class z803_useCase_KbdKeyboard_tst {
}
@Test public void Load_Smoke() {
Io_url url = Tfds.RscDir.GenSubFil_nest("110_gfml", "cfgs_archive", "gfui-keyboard-ui.cfg.gfml");
raw = Io_mgr._.LoadFilStr(url);
raw = Io_mgr.I.LoadFilStr(url);
gdoc = GfmlDoc_.parse_any_eol_(raw);
// Tfds.Write(gdoc.RootNde().XtoStr());
}

View File

@@ -39,12 +39,12 @@ public class z811_useCase_GfmlIoSql_tst {
Tfds.Eq_ary_str(XtoStr(expd.Nde()), XtoStr(actl));
}
String[] XtoStr(GfmlNde nde) {
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
for (int i = 0; i < nde.SubObjs_Count(); i++) {
GfmlAtr atr = (GfmlAtr)nde.SubObjs_GetAt(i);
list.Add(atr.Key() + "=" + atr.DatTkn().Raw());
}
return list.XtoStrAry();
return list.To_str_ary();
}
GfmlNdeWrapper nde_(String name) {return GfmlNdeWrapper.new_().Name_(name);}
}

View File

@@ -23,7 +23,7 @@ public class z901_perf_tst {
// @Test
public void Long() {
// String longText = String_.Repeat("a", 30 * 1000 * 1000);
String longText = Io_mgr._.LoadFilStr(Io_url_.new_any_("C:\\core_weekly.temp.gfio"));
String longText = Io_mgr.I.LoadFilStr(Io_url_.new_any_("C:\\core_weekly.temp.gfio"));
// String_bldr sbXml = String_bldr_.new_();
// sbXml.Add("<");
// sbXml.Add(longText);