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

Refactor: Clean up Type_ classes

This commit is contained in:
gnosygnu
2017-10-08 18:24:59 -04:00
parent 209601744e
commit d270cce881
67 changed files with 364 additions and 334 deletions

View File

@@ -1132,7 +1132,7 @@ public class XomwMessage {
* @return array Array with the parameter type (either "before" or "after") and the value.
*/
private void extractParam(XomwMessageVal rv, Object param, int format) {
if (Type_adp_.Implements_intf_obj(param, XomwMessagePrm.class)) {
if (Type_.Is_assignable_from_by_obj(param, XomwMessagePrm.class)) {
XomwMessagePrm prm = (XomwMessagePrm)param;
switch (prm.Tid()) {
case XomwMessagePrm.Tid__raw:

View File

@@ -35,7 +35,7 @@ public class XomwSanitizer {
private static Btrie_slim_mgr invalid_idn_trie;
public XomwSanitizer() {
if (regex_url_char == null) {
synchronized (Type_adp_.ClassOf_obj(this)) {
synchronized (Type_.Type_by_obj(this)) {
regex_url_char = new Xomw_regex_url_char();
// Characters that will be ignored in IDNs.
@@ -81,7 +81,7 @@ public class XomwSanitizer {
// assert static structs
if (html_entities == null) {
synchronized (Type_adp_.ClassOf_obj(this)) {
synchronized (Type_.Type_by_obj(this)) {
html_entities = Html_entities_new();
}
}

View File

@@ -261,7 +261,7 @@ public abstract class XomwAbstractContent implements XomwContent {
// break;
// }
// // Redirects to some special pages are not permitted
// if (Type_adp_.Eq_typeSafe(newtitle, typeof(XomwTitle)) && newtitle.isValidRedirectTarget()) {
// if (Type_.Eq_by_obj(newtitle, typeof(XomwTitle)) && newtitle.isValidRedirectTarget()) {
// // The new title passes the checks, so make that our current
// // title so that further recursion can be checked
// title = newtitle;

View File

@@ -148,7 +148,7 @@ public class XomwInterwikiLookupAdapter implements XomwInterwikiLookup {
String interwiki = (String)hash.Get_at(i);
String url = site.getPageUrl();
String path = null;
if (Type_adp_.Eq_typeSafe(site, XomwMediaWikiSite.class)) {
if (Type_.Eq_by_obj(site, XomwMediaWikiSite.class)) {
path = ((XomwMediaWikiSite)site).getFileUrl("api.php");
} else {
path = "";

View File

@@ -112,7 +112,7 @@ public abstract class XomwGenericArrayObject extends XomwArrayObject { /**
*/
protected boolean hasValidType(Object val) {
Class<?> cls = this.getObjectType();
return Type_adp_.Eq_typeSafe(val, cls);
return Type_.Eq_by_obj(val, cls);
}
/**
@@ -134,8 +134,8 @@ public abstract class XomwGenericArrayObject extends XomwArrayObject { /**
protected void setElement(int index, Object val) {
if (!this.hasValidType(val)) {
throw new XophpInvalidArgumentException(
"Can only add " + Type_adp_.FullNameOf_type(this.getObjectType()) + " implementing objects to "
+ Type_adp_.ClassOf_obj(this) + "."
"Can only add " + Type_.Canonical_name(this.getObjectType()) + " implementing objects to "
+ Type_.Type_by_obj(this) + "."
);
}

View File

@@ -203,7 +203,7 @@ public class XomwBlockLevelPass {
// XO.STATIC
if (block_chars_ary == null) {
synchronized (Type_adp_.ClassOf_obj(this)) {
synchronized (Type_.Type_by_obj(this)) {
block_chars_ary = Block_chars_ary__new();
openMatchTrie = Btrie_slim_mgr.ci_a7().Add_many_str
( "<table", "<h1", "<h2", "<h3", "<h4", "<h5", "<h6", "<pre", "<tr"

View File

@@ -315,7 +315,7 @@ public class XomwParser implements XomwParserIface {
private static byte[] Atr__rel;
public XomwParser(XomwEnv env) {
if (regex_space == null) {
synchronized (Type_adp_.ClassOf_obj(this)) {
synchronized (Type_.Type_by_obj(this)) {
regex_space = new Xomw_regex_space();
regex_boundary = new Xomw_regex_boundary(regex_space);
regex_url = new Xomw_regex_url(regex_space);

View File

@@ -37,7 +37,7 @@ public class Xomw_lnke_wkr {// THREAD.UNSAFE: caching for repeated calls
this.sanitizer = sanitizer;
if (angle_entities_trie == null) {
synchronized (Type_adp_.ClassOf_obj(this)) {
synchronized (Type_.Type_by_obj(this)) {
Link_type__free = Bry_.new_a7("free");
Link_type__text = Bry_.new_a7("text");
Link_type__autonumber = Bry_.new_a7("autonumber");

View File

@@ -46,7 +46,7 @@ public class Xomw_magiclinks_wkr {
.To_ary();
if (Tag__anch__rhs == null) {
synchronized (Type_adp_.ClassOf_obj(this)) {
synchronized (Type_.Type_by_obj(this)) {
Tag__anch__rhs = Bry_.new_a7("</a>");
regex_link_interrupt = new Xomw_regex_link_interrupt();
}