Gets a script or reorder code from its string representation.
@return the script/reorder code, or
-1 if not recognized
506263
public static int getReorderCode(String word) {
        for(int i = 0; i < gSpecialReorderCodes.length; ++i) {
            if(word.equalsIgnoreCase(gSpecialReorderCodes[i])) {
                return Collator.ReorderCodes.FIRST + i;
            }
        }
        try {
            int script = UCharacter.getPropertyValueEnum(UProperty.SCRIPT, word);
            if(script >= 0) {
                return script;
            }
        } catch (IllegalIcuArgumentException e) {
            // fall through
        }
        if(word.equalsIgnoreCase("others")) {
            return Collator.ReorderCodes.OTHERS;  // same as Zzzz = USCRIPT_UNKNOWN 
        }
        return -1;
    }
258569
public static Function2<String, String, String> getFencedCodeBlockFormatter() {
		return (languageName, content) -> {
			/*final StringBuilder result = new StringBuilder();
			result.append("<div class=\\\"highlight"); //$NON-NLS-1$
			if (!Strings.isNullOrEmpty(languageName)) {
				result.append(" highlight-").append(languageName); //$NON-NLS-1$
			}
			result.append("\"><pre>\n").append(content).append("</pre></div>\n"); //$NON-NLS-1$ //$NON-NLS-2$
			return result.toString();*/
			return "```" + Strings.nullToEmpty(languageName).toLowerCase() + "\n" //$NON-NLS-1$ //$NON-NLS-2$
					+ content
					+ "```\n"; //$NON-NLS-1$
		};
	}
337034
public String getDisplayScript(Locale locale) {
        String scriptCode = baseLocale.getScript();
        if (scriptCode.isEmpty()) {
            return "";
        }

        String result = ICU.getDisplayScript(this, locale);
        if (result == null) { // TODO: do we need to do this, or does ICU do it for us?
            result = ICU.getDisplayScript(this, Locale.getDefault());
        }

        return result;

    }
917547
public String getOid()
    {
        String ret = null;
        if (isValid()) {
            ret = getType().getId() + "." + getId();
        }
        return ret;
    }
1061420
public static final int getScript(int codepoint){
        if (codepoint >= UCharacter.MIN_VALUE & codepoint <= UCharacter.MAX_VALUE) {
            int scriptX=UCharacterProperty.INSTANCE.getAdditional(codepoint, 0)&UCharacterProperty.SCRIPT_X_MASK;
            if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) {
                return scriptX;
            } else if(scriptX<UCharacterProperty.SCRIPT_X_WITH_INHERITED) {
                return UScript.COMMON;
            } else if(scriptX<UCharacterProperty.SCRIPT_X_WITH_OTHER) {
                return UScript.INHERITED;
            } else {
                return UCharacterProperty.INSTANCE.m_scriptExtensions_[scriptX&UCharacterProperty.SCRIPT_MASK_];
            }
        }else{
            throw new IllegalArgumentException(Integer.toString(codepoint));
        }
    }
2277
public java.lang.String getHandle() {
    java.lang.Object ref = handle_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      handle_ = s;
      return s;
    }
  }
142750
public static int indexOfSourceStart( String code ) {
		int state = 0;

		int indexLineStart = 0;
		char previous = 0;
		boolean justEntered = false;

		StringBuilder buffer = new StringBuilder(1024);

		for (int i = 0; i < code.length(); i++) {
			char c = code.charAt(i);

			if( state == 1 ) {
				if( justEntered ) {
					justEntered = false;
					if( c == '*' ) {
						return indexLineStart;
					}
				}
				if( previous == '*' && c == '/') {
					state = 0;
				}
			} else if( state == 0 ){
				if( previous == '/' && c == '/' ) {
					state = 2;
				} else if( previous == '/' && c == '*') {
					state = 1;
					justEntered = true;
				} else {
					buffer.append(c);
				}
			}

			if( c == '\n' ) {
				if( buffer.toString().contains("class")) {
					return indexLineStart;
				}
				buffer.delete(0,buffer.length());
				indexLineStart = i+1;
				if( state == 2 ) {
					state = 0;
				}
			}

			previous = c;
		}
		if( buffer.toString().contains("class")) {
			return indexLineStart;
		} else{
			return 0;
		}
	}
589470
public final String getProxyScript() {
        StringBuilder buf = new StringBuilder("makeStaplerProxy('").append(getURL()).append("','").append(
                WebApp.getCurrent().getCrumbIssuer().issueCrumb()
        ).append("',[");

        boolean first=true;
        for (Method m : getTarget().getClass().getMethods()) {
            Collection<String> names;
            if (m.getName().startsWith("js")) {
                names = Collections.singleton(camelize(m.getName().substring(2)));
            } else {
                JavaScriptMethod a = m.getAnnotation(JavaScriptMethod.class);
                if (a!=null) {
                    names = Arrays.asList(a.name());
                    if (names.isEmpty())
                        names = Collections.singleton(m.getName());
                } else
                    continue;
            }

            for (String n : names) {
                if (first)  first = false;
                else        buf.append(',');
                buf.append('\'').append(n).append('\'');
            }
        }
        buf.append("])");
        
        return buf.toString();
    }
642824
public String getSortOrder() {
        // if we have a toggled sort in our state, use it
        final String result = (String) getStateHelper().eval(PropertyKeys.sortOrder, SortOrder.ASCENDING.toString());
        return result;
    }
674143
public static String getValueFromScript(String scriptEngine, String code) {
        try {
            ScriptEngine engine = new ScriptEngineManager().getEngineByName(scriptEngine);
            
            if (engine == null) {
                throw new CitrusRuntimeException("Unable to find script engine with name '" + scriptEngine + "'");
            }
            
            return engine.eval(code).toString();
        } catch (ScriptException e) {
            throw new CitrusRuntimeException("Failed to evaluate " + scriptEngine + " script", e);
        }
    }
1256015
public int
getValue(String str) {
	str = sanitize(str);
	Integer value = (Integer) strings.get(str);
	if (value != null) {
		return value.intValue();
	}
	if (prefix != null) {
		if (str.startsWith(prefix)) {
			int val = parseNumeric(str.substring(prefix.length()));
			if (val >= 0) {
				return val;
			}
		}
	}
	if (numericok) {
		return parseNumeric(str);
	}
	return -1;
}
39920
public final String decompileScript(Script script, int indent)
    {
        NativeFunction scriptImpl = (NativeFunction) script;
        return scriptImpl.decompile(indent, 0);
    }
1352101
protected Script getCompiledSetScript() {
        if (setScript == null) {
            GroovyShell shell = new GroovyShell();
            setScript = shell.parse(getExpression() + " = value");
        }
        return setScript;
    }
769067
public String getQuandlCode() {
    try {
      String dataSourceField = getString(DATA_SOURCE_FIELD);
      String codeField = getString(CODE_FIELD);
      // if either not present, will throw an exception.
      return dataSourceField + "/" + codeField;
    } catch (RuntimeException ex) {
      return null;
    }
  }
959669
public java.lang.String getScriptPath() {
    java.lang.Object ref = scriptPath_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      scriptPath_ = s;
      return s;
    }
  }
805774
public int getExitCode() {
		int exitCode = 0;
		for (ExitCodeGenerator generator : this.generators) {
			try {
				int value = generator.getExitCode();
				if (value > 0 && value > exitCode || value < 0 && value < exitCode) {
					exitCode = value;
				}
			}
			catch (Exception ex) {
				exitCode = (exitCode != 0) ? exitCode : 1;
				ex.printStackTrace();
			}
		}
		return exitCode;
	}
1251968
public static int translateScriptProtect(String strScriptProtect) {
	strScriptProtect = strScriptProtect.toLowerCase().trim();

	if ("none".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_NONE;
	if ("no".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_NONE;
	if ("false".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_NONE;

	if ("all".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_ALL;
	if ("true".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_ALL;
	if ("yes".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_ALL;

	String[] arr = ListUtil.listToStringArray(strScriptProtect, ',');
	String item;
	int scriptProtect = 0;
	for (int i = 0; i < arr.length; i++) {
	    item = arr[i].trim();
	    if ("cgi".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_CGI) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_CGI;
	    else if ("cookie".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_COOKIE) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_COOKIE;
	    else if ("form".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_FORM) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_FORM;
	    else if ("url".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_URL) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_URL;
	}
	return scriptProtect;
    }