1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Refactor: Refactor Dbmeta classes; Rename methods of list and hash classes

This commit is contained in:
gnosygnu
2021-12-01 07:49:25 -05:00
parent 231e10bc19
commit 197e0aa863
846 changed files with 8560 additions and 8513 deletions

View File

@@ -13,20 +13,20 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import gplx.core.texts.*; /*CharStream*/
package gplx.gfml; import gplx.*;
import gplx.core.texts.*; /*CharStream*/
public interface GfmlLxr extends Gfo_evt_itm {
String Key();
String[] Hooks();
GfmlTkn CmdTkn();
void CmdTkn_set(GfmlTkn val); // needed for lxr pragma
GfmlTkn MakeTkn(CharStream stream, int hookLength);
GfmlLxr SubLxr();
void SubLxr_Add(GfmlLxr... lexer);
}
class GfmlLxrRegy {
public int Count() {return hash.Count();}
public void Add(GfmlLxr lxr) {hash.Add(lxr.Key(), lxr);}
public GfmlLxr Get_by(String key) {return (GfmlLxr)hash.Get_by(key);}
Hash_adp hash = Hash_adp_.New();
}
String Key();
String[] Hooks();
GfmlTkn CmdTkn();
void CmdTkn_set(GfmlTkn val); // needed for lxr pragma
GfmlTkn MakeTkn(CharStream stream, int hookLength);
GfmlLxr SubLxr();
void SubLxr_Add(GfmlLxr... lexer);
}
class GfmlLxrRegy {
public int Count() {return hash.Len();}
public void Add(GfmlLxr lxr) {hash.Add(lxr.Key(), lxr);}
public GfmlLxr Get_by(String key) {return (GfmlLxr)hash.GetByOrNull(key);}
Hash_adp hash = Hash_adp_.New();
}

View File

@@ -29,8 +29,8 @@ public class GfmlTkn_ {
@gplx.Internal protected static GfmlTkn singleton_(String tknType, String raw, String val, GfmlBldrCmd cmd) {return new GfmlTkn_singleton().ctor_GfmlTkn_base(tknType, raw, val, cmd);}
@gplx.Internal protected static GfmlTkn composite_(String tknType, GfmlTkn[] ary) {return new GfmlTkn_composite(tknType, ary);}
@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++)
GfmlTkn[] ary = new GfmlTkn[list.Len()];
for (int i = 0; i < list.Len(); i++)
ary[i] = (GfmlTkn)list.Get_at(i);
return GfmlTkn_.composite_(tknType, ary);
}

View File

@@ -1,23 +1,23 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import gplx.core.texts.*; /*CharStream*/
public class GfmlTrie {
public String[] Symbols() {
String[] rv = new String[symbols.Count()];
String[] rv = new String[symbols.Len()];
for (int i = 0; i < rv.length; i++)
rv[i] = String_.cast(symbols.Get_at(i));
return rv;
@@ -77,7 +77,7 @@ public class GfmlTrie {
curLink = foundAsLink;
}
}
symbols.Add_if_dupe_use_nth(symbol, symbol);
symbols.AddIfDupeUseNth(symbol, symbol);
}
public void Del(String symbol) {
char[] ary = String_.XtoCharAry(symbol); int lastIndex = ary.length - 1;

View File

@@ -13,20 +13,20 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml; import gplx.*;
public class GfmlFldList {
public int Count() {return hash.Count();}
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_wo_type("fld name cannot be null");
if (hash.Has(fld.Name())) throw Err_.new_wo_type("key already exists", "key", fld.Name()); // FIXME: commented out to allow multiple types with same name; need "_type:invk"
hash.Add_if_dupe_use_nth(fld.Name(), fld);
}
public void Del(GfmlFld fld) {
hash.Del(fld);
hash.Del(fld.Name());
}
Ordered_hash hash = Ordered_hash_.New();
public static GfmlFldList new_() {return new GfmlFldList();} GfmlFldList() {}
}
public int Count() {return hash.Len();}
public GfmlFld Get_at(int index) {return (GfmlFld)hash.Get_at(index);}
public GfmlFld Get_by(String id) {return (GfmlFld)hash.GetByOrNull(id);}
public void Add(GfmlFld fld) {
if (String_.Len_eq_0(fld.Name())) throw Err_.new_wo_type("fld name cannot be null");
if (hash.Has(fld.Name())) throw Err_.new_wo_type("key already exists", "key", fld.Name()); // FIXME: commented out to allow multiple types with same name; need "_type:invk"
hash.AddIfDupeUseNth(fld.Name(), fld);
}
public void Del(GfmlFld fld) {
hash.Del(fld);
hash.Del(fld.Name());
}
Ordered_hash hash = Ordered_hash_.New();
public static GfmlFldList new_() {return new GfmlFldList();} GfmlFldList() {}
}

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
class GfmlTypeCompiler {
@gplx.Internal protected static GfmlType Compile(GfmlNde nde, GfmlType owner, GfmlTypRegy typeRegy, Ordered_hash results) {return Compile(nde, owner, true, typeRegy, results);}
@@ -63,7 +63,7 @@ class GfmlTypeCompiler {
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.Get_by(rv.Key()); // look for type in current pragma's results
rv = (GfmlType)results.GetByOrNull(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);

View File

@@ -1,21 +1,21 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
class GfmlTypeHash {
public GfmlType Get_by(String key) {return (GfmlType)hash.Get_by(key);}
class GfmlTypeHash {
public GfmlType Get_by(String key) {return (GfmlType)hash.GetByOrNull(key);}
public void Add(GfmlType type) {
if (type.IsTypeNull()) throw Err_.new_wo_type("cannot add null type to GfmlTypeHash");
if (hash.Has(type.Key())) throw Err_.new_wo_type("type key already exists", "key", type.Key());
@@ -24,7 +24,7 @@ class GfmlTypeHash {
Hash_adp hash = Hash_adp_.New();
public static GfmlTypeHash new_() {return new GfmlTypeHash();} GfmlTypeHash() {}
}
class GfmlTypRegy {
class GfmlTypRegy {
public boolean Has(String typeKey) {return hash.Has(typeKey);}
public GfmlType FetchOrNull(String typeKey) {return FetchOrNull(typeKey, GfmlDocPos_.Root);}
public GfmlType FetchOrNull(String typeKey, GfmlDocPos pos) {

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
class GfmlTypeMakr {
public GfmlType Owner() {return owner;}
@@ -37,7 +37,7 @@ class GfmlTypeMakr {
}
public void AddSubFld(GfmlFld subFld) {AddSubFld_imp(owner, subFld);}
public GfmlType[] Xto_bry() {
GfmlType[] rv = (GfmlType[])list.To_ary(GfmlType.class);
GfmlType[] rv = (GfmlType[])list.ToAry(GfmlType.class);
list.Clear();
owner = null;
return rv;

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import gplx.core.lists.*;/*StackAdp*/
class GfmlTypeMgr {
@@ -101,20 +101,20 @@ class GfmlTypeMgr {
StackAdp stack = StackAdp_.new_(), ownerNdeStack = StackAdp_.new_();
public static GfmlTypeMgr new_() {return new GfmlTypeMgr();} GfmlTypeMgr() {}
}
class GfmlFldPool {
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;
if (keyedRegy.Len() == 0) return GfmlFld.Null;
GfmlFld rv = (GfmlFld)keyedRegy.Get_at(0);
keyedRegy.Del(rv.Name());
return rv;
}
public GfmlFld Keyed_PopByKey(String key) {
GfmlFld rv = (GfmlFld)keyedRegy.Get_by(key); if (rv == null) return GfmlFld.Null;
GfmlFld rv = (GfmlFld)keyedRegy.GetByOrNull(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 int Keyd_Count() {return keyedRegy.Len();}
@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;

View File

@@ -1,26 +1,26 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
public class GfmlAtr implements GfmlItm {
public class GfmlAtr implements GfmlItm {
public int ObjType() {return GfmlObj_.Type_atr;}
public GfmlTkn KeyTkn() {return keyTkn;} GfmlTkn keyTkn; public String Key() {return keyTkn.Val();}
public GfmlTkn DatTkn() {return datTkn;} GfmlTkn datTkn;
public GfmlType Type() {return type;} GfmlType type;
public boolean KeyedSubObj() {return true;}
public int SubObjs_Count() {return subObjs.Count();}
public int SubObjs_Count() {return subObjs.Len();}
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 To_str() {return String_.Concat(this.Key(), "=", this.DatTkn().Val());}
@@ -41,13 +41,13 @@ public class GfmlAtr implements GfmlItm {
int idx = GetTknIdx(oldTkn);
GfmlTkn tkn = MakeTkn(oldTkn, s);
if (idx != -1)
subObjs.Del_at(idx);
subObjs.DelAt(idx);
if (idx == -1) idx = 0;
subObjs.Add_at(tkn, idx);
return tkn;
}
int GetTknIdx(GfmlTkn t) {
for (int i = 0; i < subObjs.Count(); i++) {
for (int i = 0; i < subObjs.Len(); i++) {
GfmlObj obj = (GfmlObj)subObjs.Get_at(i);
if (obj == t) return i;
}

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
public class GfmlDoc_ {
public static GfmlDoc parse_any_eol_(String raw) {return parse(String_.Replace(raw, String_.CrLf, String_.Lf));}
@@ -35,7 +35,7 @@ class GfmlUsrMsgs {
}
public static Err gfmlParseError(GfmlBldr bldr) {
Err rv = Err_.new_wo_type("gfml parse error");
for (int i = 0; i < bldr.Doc().UsrMsgs().Count(); i++) {
for (int i = 0; i < bldr.Doc().UsrMsgs().Len(); i++) {
UsrMsg um = (UsrMsg)bldr.Doc().UsrMsgs().Get_at(i);
rv.Args_add("err" + Int_.To_str(i), um.To_str());
}

View File

@@ -13,10 +13,10 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml; import gplx.*;
public class GfmlItmHnds {
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() {}
}
public int Count() {return list.Len();} 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

@@ -15,10 +15,10 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
public class GfmlItmKeys {
public int Count() {return list.Count();}
public int Count() {return list.Len();}
public boolean Has(String key) {return hash.Has(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 GfmlItm Get_by(String key) {return (GfmlItm)hash.GetByOrNull(key);}
public String FetchDataOr(String key, String or) {
GfmlAtr atr = FetchAtr(key);
return (atr == null) ? or : atr.DatTkn().Val();
@@ -52,7 +52,7 @@ public class GfmlItmKeys {
}
if (toDel != null) list.Del(toDel);
}
GfmlAtr FetchAtr(String key) {return GfmlAtr.as_(hash.Get_by(key));}
GfmlAtr FetchAtr(String key) {return GfmlAtr.as_(hash.GetByOrNull(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

@@ -1,27 +1,27 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
public class GfmlNde implements GfmlItm {
public class GfmlNde implements GfmlItm {
public static final int OBJ_TYPE = GfmlObj_.Type_nde;
public int ObjType() {return objType;} int objType = GfmlObj_.Type_nde;
public GfmlTkn KeyTkn() {return keyTkn;} public String Key() {return keyTkn.Val();} GfmlTkn keyTkn = GfmlTkn_.Null;
public GfmlType Type() {return type;} GfmlType type;
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 int SubObjs_Count() {return subObjs.Len();} GfmlObjList subObjs = GfmlObjList.new_();
public GfmlObj SubObjs_GetAt(int i) {return (GfmlObj)subObjs.Get_at(i);}
public void SubObjs_Add(GfmlObj gobj) {
subObjs.Add(gobj);
@@ -61,8 +61,8 @@ public class GfmlNde implements GfmlItm {
// a:{} -> a:{b:{}}
}
int PosOf(boolean fwd, String... find) {
int bgn = fwd ? 0 : subObjs.Count() - 1;
int end = fwd ? subObjs.Count() : 0;
int bgn = fwd ? 0 : subObjs.Len() - 1;
int end = fwd ? subObjs.Len() : 0;
int dif = fwd ? 1 : -1;
for (int i = bgn; i != end; i+=dif) {
GfmlObj subObj = (GfmlObj)subObjs.Get_at(i);

View File

@@ -1,26 +1,26 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
interface GfmlScopeItm {
interface GfmlScopeItm {
String Key();
GfmlDocPos DocPos();
}
class GfmlScopeRegy {
public boolean Has(String key) {
GfmlScopeList list = (GfmlScopeList)hash.Get_by(key); if (list == null) return false;
GfmlScopeList list = (GfmlScopeList)hash.GetByOrNull(key); if (list == null) return false;
return list.Count() > 0;
}
public void Add(GfmlScopeItm itm) {
@@ -28,16 +28,16 @@ class GfmlScopeRegy {
list.Add(itm);
}
public void Del(GfmlScopeItm itm) {
GfmlScopeList list = (GfmlScopeList)hash.Get_by(itm.Key()); if (list == null) return;
GfmlScopeList list = (GfmlScopeList)hash.GetByOrNull(itm.Key()); if (list == null) return;
list.Del(itm);
if (list.Count() == 0) hash.Del(itm.Key());
}
public GfmlScopeItm Get_by(String key, GfmlDocPos pos) {
GfmlScopeList list = (GfmlScopeList)hash.Get_by(key); if (list == null) return null;
GfmlScopeList list = (GfmlScopeList)hash.GetByOrNull(key); if (list == null) return null;
return list.Get_by(pos);
}
GfmlScopeList ItmOrNew(String key) {
GfmlScopeList rv = (GfmlScopeList)hash.Get_by(key);
GfmlScopeList rv = (GfmlScopeList)hash.GetByOrNull(key);
if (rv == null) {
rv = GfmlScopeList.new_(key);
hash.Add(key, rv);
@@ -49,11 +49,11 @@ class GfmlScopeRegy {
}
class GfmlScopeList {
public String Key() {return key;} private String key;
public int Count() {return list.Count();}
public int Count() {return list.Len();}
public void Add(GfmlScopeItm itm) {list.Add(itm);}
public void Del(GfmlScopeItm itm) {list.Del(itm);}
public GfmlScopeItm Get_by(GfmlDocPos pos) {
if (list.Count() == 0) return null;
if (list.Len() == 0) return null;
GfmlScopeItm rv = null;
for (Object itemObj : list) {
GfmlScopeItm itm = (GfmlScopeItm)itemObj;

View File

@@ -1,30 +1,30 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import gplx.core.lists.*;/*Hash_adp_list*/
interface GfmlPragma {
interface GfmlPragma {
String KeyOfPragma();
void Exec(GfmlBldr bldr, GfmlNde pragmaNde);
GfmlType[] MakePragmaTypes(GfmlTypeMakr typeMakr);
}
class GfmlPragmaMgr {
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.Get_by(ndeName); if (cmd == null) return false;
if (pragmas.Len() == 0) return false;
GfmlPragma cmd = (GfmlPragma)pragmas.GetByOrNull(ndeName); if (cmd == null) return false;
GfmlNde pragmaNde = bldr.CurNde();
pragmaNde.ObjType_set_pragma();
cmd.Exec(bldr, pragmaNde);
@@ -37,8 +37,8 @@ class GfmlPragmaMgr {
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, Hash_adp_list cmds) {
List_adp list = cmds.Get_by(pos.Path()); if (list == null) return;
for (int i = 0; i < list.Count(); i++) {
List_adp list = cmds.GetByOrNull(pos.Path()); if (list == null) return;
for (int i = 0; i < list.Len(); i++) {
GfmlBldrCmd cmd = (GfmlBldrCmd)list.Get_at(i);
cmd.Exec(bldr, GfmlTkn_.Null);
}

View File

@@ -16,10 +16,10 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
package gplx.gfml; import gplx.*;
class GfmlVarCtx {
public String Key() {return key;} private String key;
public void Add_if_dupe_use_nth(GfmlVarItm itm) {hash.Add_if_dupe_use_nth(itm.Key(), itm);}
public void Add_if_dupe_use_nth(GfmlVarItm itm) {hash.AddIfDupeUseNth(itm.Key(), itm);}
public void Del(String key) {hash.Del(key);}
public String Fetch_Val(String key) {
GfmlVarItm itm = (GfmlVarItm)hash.Get_by(key); if (itm == null) return null;
GfmlVarItm itm = (GfmlVarItm)hash.GetByOrNull(key); if (itm == null) return null;
return itm.TknVal();
}
Hash_adp hash = Hash_adp_.New();
@@ -32,7 +32,7 @@ class GfmlVarCtx {
class GfmlVarCtx_ {
public static GfmlVarCtx FetchFromCacheOrNew(Hash_adp cache, String ctxKey) {
Hash_adp ctxRegy = FetchRegyOrNew(cache);
GfmlVarCtx rv = (GfmlVarCtx)ctxRegy.Get_by(ctxKey);
GfmlVarCtx rv = (GfmlVarCtx)ctxRegy.GetByOrNull(ctxKey);
if (rv == null) {
rv = (String_.Eq(ctxKey, DefaultKey))
? default_(ctxKey)
@@ -49,7 +49,7 @@ class GfmlVarCtx_ {
}
static Hash_adp FetchRegyOrNew(Hash_adp cache) {
String key = "gfml.cacheKeys.ctxRegy";
Hash_adp rv = (Hash_adp)cache.Get_by(key);
Hash_adp rv = (Hash_adp)cache.GetByOrNull(key);
if (rv == null) {
rv = Hash_adp_.New();
cache.Add(key, rv);

View File

@@ -1,21 +1,21 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import gplx.core.texts.*; /*CharStream*/
public class GfmlBldr {
public class GfmlBldr {
@gplx.Internal protected GfmlDoc Doc() {return gdoc;} GfmlDoc gdoc = GfmlDoc.new_();
@gplx.Internal protected GfmlFrame CurFrame() {return curFrame;} GfmlFrame curFrame;
@gplx.Internal protected GfmlFrame_nde CurNdeFrame() {return curNdeFrame;} GfmlFrame_nde curNdeFrame;
@@ -39,7 +39,7 @@ public class GfmlBldr {
curNdeFrame.Build_end(this, GfmlFrame_nde_.OwnerRoot_);
if (frameStack.Count() > 0) UsrMsgs_fail(GfmlUsrMsgs.fail_Frame_danglingBgn());
}
if (throwErrors && gdoc.UsrMsgs().Count() > 0) throw GfmlUsrMsgs.gfmlParseError(this);
if (throwErrors && gdoc.UsrMsgs().Len() > 0) throw GfmlUsrMsgs.gfmlParseError(this);
raw = "";
return gdoc;
}

View File

@@ -27,7 +27,7 @@ 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.Get_by_or_fail(key);}
public GfmlBldrCmd GetOrFail(String key) {return (GfmlBldrCmd)hash.GetByOrFail(key);}
Hash_adp hash = Hash_adp_.New();
public static GfmlBldrCmdRegy new_() {
GfmlBldrCmdRegy rv = new GfmlBldrCmdRegy();

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
class GfmlBldrCmd_pendingTkns_add implements GfmlBldrCmd {
public String Key() {return "gfml.pendingTkns_add";}
@@ -111,12 +111,12 @@ class GfmlBldrCmd_frameEnd implements GfmlBldrCmd {
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.Get_at(bldr.CurNdeFrame().waitingTkns.Count() - 1);
if (bldr.CurNdeFrame().waitingTkns.Len() > 0) {
GfmlObj t = (GfmlObj)bldr.CurNdeFrame().waitingTkns.Get_at(bldr.CurNdeFrame().waitingTkns.Len() - 1);
if (t.ObjType() == GfmlObj_.Type_nde)
bldr.CurNdeFrame().IdxNdeBgn_set(bldr.CurNdeFrame().WaitingTkns().Count() + 1);
bldr.CurNdeFrame().IdxNdeBgn_set(bldr.CurNdeFrame().WaitingTkns().Len() + 1);
}
if (bldr.CurFrame().WaitingTkns().Count() == 0) {
if (bldr.CurFrame().WaitingTkns().Len() == 0) {
bldr.CurNde().SubObjs_Add(tkn); // if curFrame begins with whitespace, add directly to node (whitespace should not belong to atr)
}
else

View File

@@ -1,19 +1,19 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml;
class GfmlFrame_nde extends GfmlFrame_base {
@Override public int FrameType() {return GfmlFrame_.Type_nde;}
public GfmlNde CurNde() {return nde;} GfmlNde nde;
@@ -105,7 +105,7 @@ class GfmlFrame_nde extends GfmlFrame_base {
if (!frmHasParens) {
bldr.Frames_end();
GfmlFrame_nde frm = bldr.CurNdeFrame(); // get the current frm after all popped
int idx = frm.waitingTkns.Count(); // NOTE: reset idxs b/c endFrame will automatically set to 0, and should be objCount
int idx = frm.waitingTkns.Len(); // NOTE: reset idxs b/c endFrame will automatically set to 0, and should be objCount
frm.tknMgr.IdxAtrBgn_setHack(idx);
frm.tknMgr.IdxNdeBgn_set(idx);
frm.nullArea = false; // NOTE: endFrame automatically sets nullArea to true; set to false
@@ -114,7 +114,7 @@ class GfmlFrame_nde extends GfmlFrame_base {
public void NdeProp_bgn(GfmlTkn symTkn) { // EX: < [ >
int oldNdeBgn = tknMgr.IdxNdeBgn(); // get oldNdeBgn; needed for header atrs; EX: < a:b [d] > ndeBgn = 0 (a pos), but will start keyNde at 5 ([ pos)
GfmlTkn keyTkn = tknMgr.KeyTkn_pop(); boolean keyTknExists = keyTkn != GfmlTkn_.Null;
int newNdeBgn = keyTknExists ? tknMgr.IdxAtrBgn() : waitingTkns.Count(); // if there is a key, set ndeBgn end atrBgn (EX: a=[); else set end curIdx
int newNdeBgn = keyTknExists ? tknMgr.IdxAtrBgn() : waitingTkns.Len(); // if there is a key, set ndeBgn end atrBgn (EX: a=[); else set end curIdx
tknMgr.IdxNdeBgn_set(newNdeBgn);
WaitingTkns_AddSym(symTkn, GfmlNdeSymType.PrpBgn);
tknMgr.ConsumeWaitingDatTkn(nde);// NEEDED for KeydDefault
@@ -156,7 +156,7 @@ class GfmlFrame_nde extends GfmlFrame_base {
}
else if (ndeType == GfmlNdeStartType.Prop) {}
else {
ownerNdeFrame.tknMgr.IdxNdeBgn_set(ownerNdeFrame.waitingTkns.Count());
ownerNdeFrame.tknMgr.IdxNdeBgn_set(ownerNdeFrame.waitingTkns.Len());
ownerNdeFrame.nullArea = true; // reset
}
}
@@ -204,20 +204,20 @@ class GfmlFrame_nde_ {
@gplx.Internal protected static GfmlFrame_nde root_(GfmlBldr bldr, GfmlNde newNde, GfmlLxr newLxr) {return GfmlFrame_nde.new_(bldr, newNde, newLxr);}
@gplx.Internal protected static final GfmlFrame_nde OwnerRoot_ = null;
@gplx.Internal protected static void TransferToNde(GfmlObjList waitingTkns, GfmlNde nde, int bgn) {
int end = waitingTkns.Count();
int end = waitingTkns.Len();
for (int i = bgn; i < end; i++) {
GfmlObj tkn = waitingTkns.Get_at(i);
nde.SubObjs_Add(tkn);
}
if (bgn != end) // ignore if bgn == end
waitingTkns.Del_range(bgn, end - 1);
waitingTkns.DelRange(bgn, end - 1);
}
@gplx.Internal protected static void TransferToAtr(GfmlObjList src, GfmlAtr trg, int bgn, int end) {
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.Get_at(i + bgn));
src.Del_range(bgn, end - 1);
src.DelRange(bgn, end - 1);
}
}
class GfmlNdeStartType {

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
class GfmlFrame_ndeTknMgr {
public int IdxAtrBgn() {return idxAtrBgn;} int idxAtrBgn, idxAtrEnd;
@@ -47,14 +47,14 @@ class GfmlFrame_ndeTknMgr {
@gplx.Internal protected GfmlTkn DatTkn_pop() {GfmlTkn rv = datTkn; datTkn = GfmlTkn_.Null; return rv;} GfmlTkn datTkn = GfmlTkn_.Null;
@gplx.Internal protected void DatTkn_set(GfmlTkn tkn) {
this.ConsumeWaitingDatTkn(frame.CurNde());
idxAtrBgn = frame.waitingTkns.Count();
idxAtrBgn = frame.waitingTkns.Len();
idxAtrEnd = idxAtrBgn + 1;
frame.waitingTkns.Add(tkn);
datTkn = tkn;
}
@gplx.Internal protected void ExecMakeAtr(GfmlTkn itmKeyTkn, GfmlTkn valTkn) {
frame.waitingTkns.Add(valTkn);
idxAtrEnd = frame.waitingTkns.Count();
idxAtrEnd = frame.waitingTkns.Len();
this.MakeAtr(itmKeyTkn, valTkn);
}
@gplx.Internal protected void ExecXferTkns_ndeAll(GfmlNde nde) {ExecXferTkns(nde, 0);}

View File

@@ -32,8 +32,8 @@ class GfmlStringHighlighter {
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.Idx_last();
for (int i = 0; i < marks.Count(); i++) {
int rawBfrBgn = -1, marksLastIdx = marks.IdxLast();
for (int i = 0; i < marks.Len(); i++) {
GfmlStringHighlighterMarker curMark = (GfmlStringHighlighterMarker)marks.Get_at(i);
GfmlStringHighlighterMarker nxtMark = i == marksLastIdx ? GfmlStringHighlighterMarker.Null : (GfmlStringHighlighterMarker)marks.Get_at(i + 1);
// bgnPos
@@ -81,11 +81,11 @@ class GfmlStringHighlighter {
rv.Add(posBfr.To_str());
rv.Add(rawBfr.To_str());
rv.Add(symBfr.To_str());
if (symList.Count() > 0)
if (symList.Len() > 0)
rv.Add("");
for (int i = 0; i < symList.Count(); i++)
for (int i = 0; i < symList.Len(); i++)
rv.Add((String)symList.Get_at(i));
return rv.To_str_ary();
return rv.ToStrAry();
}
List_adp marks = List_adp_.New();
public static GfmlStringHighlighter new_() {

View File

@@ -1,20 +1,20 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import gplx.core.strings.*; import gplx.core.criterias.*;
import gplx.core.strings.*;
public class SqlDoc {
public static GfmlDoc XtoDoc(String raw) {
GfmlBldr bldr = GfmlBldr_.new_();
@@ -76,7 +76,7 @@ class SqlCmd_quote_end implements GfmlBldrCmd {
public void Exec(GfmlBldr bldr, GfmlTkn tkn) {
String_bldr sb = String_bldr_.new_();
GfmlObjList list = bldr.CurFrame().WaitingTkns();
for (int i = 0; i < list.Count(); i++) {
for (int i = 0; i < list.Len(); i++) {
GfmlTkn pnd = (GfmlTkn)list.Get_at(i);
sb.Add(pnd.Val());
}

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
class GfmlParse_fxt {
public GfmlNde_mok nde_() {return GfmlNde_mok.new_();}
@@ -49,7 +49,7 @@ class GfmlParse_fxt {
bldr.ThrowErrors_set(false);
GfmlDoc actlDoc = bldr.XtoGfmlDoc(raw);
List_adp expd = List_adp_.New(), actl = actlDoc.UsrMsgs();
expd.Add_many((Object[])expdErrs);
expd.AddMany((Object[])expdErrs);
TfdsTstr_fxt tstr = TfdsTstr_fxt.new_();
int max = tstr.List_Max(expd, actl);
for (int i = 0; i < max; i++) {
@@ -57,15 +57,15 @@ class GfmlParse_fxt {
UsrMsg actlUm = (UsrMsg)tstr.List_FetchAtOrNull(actl, i);
UsrMsg_mok actlUmm = UsrMsg_mok.new_(actlUm);
tstr.Eq_str(expdUm.Main(), actlUmm.Main(), "main");
for (int j = 0; j < expdUm.Args().Count(); j++) {
for (int j = 0; j < expdUm.Args().Len(); j++) {
Keyval expdKv = (Keyval)expdUm.Args().Get_at(j);
Keyval actlKv = (Keyval)actlUmm.Args().Get_by(expdKv.Key());
Keyval actlKv = (Keyval)actlUmm.Args().GetByOrNull(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++) {
for (int j = 0; j < expdUm.Required().Len(); j++) {
String expdKv = (String)expdUm.Required().Get_at(j);
Keyval actlKv = (Keyval)actlUmm.Args().Get_by(expdKv);
Keyval actlKv = (Keyval)actlUmm.Args().GetByOrNull(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

@@ -51,7 +51,7 @@ class GfmlNde_mok implements GfmlItm_mok {
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_.To_str(subs.Count()));
sb.Add_kv("key=", key).Add_kv("hnd=", hnd).Add_kv("typ=", typ).Add_kv("subs=", Int_.To_str(subs.Len()));
return sb.To_str();
}
public GfmlNde_mok Subs_(GfmlItm_mok... ary) {
@@ -75,7 +75,7 @@ class GfmlNde_mok implements GfmlItm_mok {
rv.ChainId_(ownerMok.chainId);
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++) {
for (int i = 0; i < ownerMok.subs.Len(); i++) {
GfmlItm_mok itm = (GfmlItm_mok)ownerMok.subs.Get_at(i);
if (itm.ObjType() == GfmlObj_.Type_nde) {
GfmlNde_mok itmMok = (GfmlNde_mok)itm;

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
class GfmlFld_mok {
public String Name() {return name;} public GfmlFld_mok Name_(String v) {name = v; return this;} private String name;
@@ -54,7 +54,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++) {
for (int i = 0; i < subFlds.Len(); i++) {
GfmlFld_mok fld = (GfmlFld_mok)subFlds.Get_at(i);
rv.SubFlds().Add(fld.XtoGfmlFld());
}

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
class UsrMsg_mok {
public String Main() {return main;} public UsrMsg_mok Main_(String v) {main = v; return this;} private String main;
@@ -24,7 +24,7 @@ class UsrMsg_mok {
UsrMsg_mok rv = new UsrMsg_mok();
if (um != null) {
rv.main = um.Hdr();
for (int i = 0; i < um.Args().Count(); i++) {
for (int i = 0; i < um.Args().Len(); i++) {
Keyval kv = (Keyval)um.Args().Get_at(i);
rv.Add_(kv.Key(), kv.Val());
}

View File

@@ -59,7 +59,7 @@ public class z091_GfmlLxr_basic_tst {
if (tkn == GfmlTkn_.EndOfStream) break;
list.Add(tkn.Raw());
}
String[] actl = (String[])list.To_ary(String.class);
String[] actl = (String[])list.ToAry(String.class);
Tfds.Eq_ary(expd, actl);
return tkn;
}

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
class GfmlDefaultItem_fxt {
@gplx.Internal protected GfmlDefaultItem make_(String typeKey, String key, GfmlTkn val) {return GfmlDefaultItem.new_(typeKey, key, val);}
@@ -29,7 +29,7 @@ class GfmlDefaultItem_fxt {
GfmlDefaultItem expd = expdAry[i];
tst_Item(actl, expd);
}
Tfds.Eq(expdAry.length, list.Count());
Tfds.Eq(expdAry.length, list.Len());
}
String Val_to_str_or_null(GfmlObj gobj) {
GfmlTkn tkn = GfmlTkn_.as_(gobj);

View File

@@ -115,7 +115,7 @@ class GfmlUpdateFx {
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++) {
for (int i = 0; i < cmds.Len(); i++) {
GfmlUpdateCmd cmd = (GfmlUpdateCmd)cmds.Get_at(i);
cmd.Exec(actlDoc);
}

View File

@@ -42,7 +42,7 @@ public class z811_useCase_GfmlIoSql_tst {
GfmlAtr atr = (GfmlAtr)nde.SubObjs_GetAt(i);
list.Add(atr.Key() + "=" + atr.DatTkn().Raw());
}
return list.To_str_ary();
return list.ToStrAry();
}
GfmlNdeWrapper nde_(String name) {return GfmlNdeWrapper.new_().Name_(name);}
}