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

@@ -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);