Package org.jruby

Examples of org.jruby.RubyObject$Data


   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build basics
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info").setColumn(4));
    form.addElement("basic.name", RubyForm.getString("Name", "@name", act));
    form.addElement("basic.class", new FormDBComboBox("Klasse", project, Type.CLASS, act, "@class_id", false));
    form.addElement("basic.image", new FormGraphEle(I18N.t("Bild"), project, RTP.CHARACTER, act, "@character_name", "@character_hue"));
    form.addElement("basic.battler", new FormGraphEle(I18N.t("Battler"), project, RTP.BATTLERS, act, "@battler_name", "@battler_hue"));

    // add level
    form.addHeader("skill", new FormHeader(RGSS1Helper.getName(Type.SKILL), RGSS1Helper.getIcon(Type.SKILL)).setColumn(8));
    form.addElement("skill.lvli", RubyForm.getNumber(I18N.t("Level"), act, "@initial_level").setMinMax(1, 99, 1));
    form.addElement("skill.lvlif", RubyForm.getNumber("-", act, "@final_level").setMinMax(1, 99, 1));
    form.addElement("skill.expb", RubyForm.getNumber("EXP-Basis", act, "@exp_basis"));
    form.addElement("skill.expi", RubyForm.getNumber("EXP-Inflation", act, "@exp_inflation"));

    // add items
    form.addHeader("item", new FormHeader(RGSS1Voc.item(project), "armor_weapon").setColumn(8));
    form.addElement("item.weapon", new FormDBComboBox(RGSS1Voc.weapon(project), project, Type.WEAPON, act, "@weapon_id", true));
    form.addElement("item.weaponfix", RubyForm.getBoolean(I18N.t("Fix"), act, "@weapon_fix"));
    form.addElement("item.armor1", new FormDBComboBox(RGSS1Voc.shield(project), project, Type.ARMOR, act, "@armor1_id", true));
    form.addElement("item.armor1fix", RubyForm.getBoolean(I18N.t("Fix"), act, "@armor1_fix"));
    form.addElement("item.armor2", new FormDBComboBox(RGSS1Voc.helm(project), project, Type.ARMOR, act, "@armor2_id", true));
    form.addElement("item.armor2fix", RubyForm.getBoolean(I18N.t("Fix"), act, "@armor2_fix"));
    form.addElement("item.armor3", new FormDBComboBox(RGSS1Voc.armor(project), project, Type.ARMOR, act, "@armor3_id", true));
    form.addElement("item.armor3fix", RubyForm.getBoolean(I18N.t("Fix"), act, "@armor3_fix"));
    form.addElement("item.armor4", new FormDBComboBox(RGSS1Voc.acc(project), project, Type.ARMOR, act, "@armor4_id", true));
    form.addElement("item.armor4fix", RubyForm.getBoolean(I18N.t("Fix"), act, "@armor4_fix"));

    // build parameters
    form.addHeader("parameters", new FormHeader(I18N.t("Parameters"), "error").setColumn(14).setCollapsed(true).setSorting(2));
    String hp = RGSS1Voc.hp(project), sp = RGSS1Voc.sp(project), str = RGSS1Voc.str(project), dex = RGSS1Voc.dex(project), agi = RGSS1Voc
        .agi(project), inte = RGSS1Voc.inte(project);
    IRubyObject table = act.getInstanceVariable("@parameters");

    for (int i = 1; i <= 99; i++) {
      form.addElement("parameters." + i, new FormInfo("", I18N.t("Level {0}", i)).setSorting(i));
      form.addElement("parameters." + i + "hp", new FormTable(hp, table, 0, i).setSorting(i));
      form.addElement("parameters." + i + "sp", new FormTable(sp, table, 1, i).setSorting(i));
View Full Code Here


     * @return the value in simple Java object to which the specified key is mapped, or
     *         {@code null} if this map contains no mapping for the key
     */
    public V get(Object receiver, Object key) {
        checkKey(key);
        RubyObject robj = getReceiverObject(receiver);
        // attemps to retrieve global variables
        if (lazy) VariableInterceptor.tryLazyRetrieval(provider.getLocalVariableBehavior(), this, robj, key);
        BiVariable var = getVariable(robj, (String)key);
        if (var == null) return null;
        else return (V) var.getJavaObject();
View Full Code Here

     * @return the previous value associated with <tt>key</tt>, or
     *         <tt>null</tt> if there was no mapping for <tt>key</tt>.
     */
    public V put (Object receiver, K key, V value) {
        checkKey(key);
        RubyObject robj = getReceiverObject(receiver);
        String name = ((String)key).intern();
        BiVariable v = getVariable(robj, name);
        Object oldValue = null;
        if (v != null) {
            // updates
            oldValue = v.getJavaObject();
            v.setJavaObject(robj.getRuntime(), value);
        } else {
            // creates new value
            v = VariableInterceptor.getVariableInstance(provider.getLocalVariableBehavior(), robj, name, value);
            if (v != null) {
                update(name, v);
View Full Code Here

    void inject(ManyVarsDynamicScope scope, int depth, IRubyObject receiver) {
        VariableInterceptor.inject(this, provider.getRuntime(), scope, depth, receiver);
    }

    void retrieve(IRubyObject receiver) {
        RubyObject robj = getReceiverObject(receiver);
        VariableInterceptor.retrieve(provider.getLocalVariableBehavior(), this, robj);
    }
View Full Code Here

     * @return the previous value associated with <tt>key</tt>, or
     *         <tt>null</tt> if there was no mapping for <tt>key</tt>.
     */
    public V remove(Object receiver, Object key) {
        checkKey(key);
        RubyObject robj = getReceiverObject(receiver);
        String name = ((String)key).intern();
        for (int i=0; i<varNames.size(); i++) {
            if (name.equals(varNames.get(i))) {
                BiVariable var = variables.get(i);
                if (var.getReceiver() == robj) {
View Full Code Here

    }

    private static final BigInteger UINT64_BASE = BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE);

    public static long ull2inum(Ruby runtime, long l) {
        RubyObject n = l < 0
                    ? RubyBignum.newBignum(runtime, BigInteger.valueOf(l & 0x7fffffffffffffffL).add(UINT64_BASE))
                    : runtime.newFixnum(l);

        Handle h = GC.lookup(n);
        if (h != null) {
View Full Code Here

            return;
        }
        if (!name.startsWith("$")) {
            name = "$".concat(name);
        }
        RubyObject receiver = (RubyObject)container.getProvider().getRuntime().getTopSelf();
        BiVariable v =
            VariableInterceptor.getVariableInstance(LocalVariableBehavior.BSF,receiver, name, bean.bean, bean.type);
        container.getVarMap().setVariable(receiver, v);
    }
View Full Code Here

    private <T> T call(MethodType type, Class<T> returnType, Object receiver, String methodName, Block block, EmbedEvalUnit unit, Object... args) {
        if (methodName == null || methodName.length()==0) {
            return null;
        }
        Ruby runtime = container.getProvider().getRuntime();
        RubyObject rubyReceiver = getReceiverObject(runtime, receiver);
       
        boolean sharing_variables = true;
        Object obj = container.getAttribute(AttributeName.SHARING_VARIABLES);
        if (obj != null && obj instanceof Boolean && ((Boolean) obj) == false) {
            sharing_variables = false;
View Full Code Here

            } else if (type == Short.class) {
                return Short.valueOf(number.shortValue());
            }
        }
        if (isDuckTypeConvertable(argument.getClass(), parameterType)) {
            RubyObject rubyObject = (RubyObject) argument;
            if (!rubyObject.respondsTo("java_object")) {
                return convertProcToInterface(runtime.getCurrentContext(), rubyObject, parameterType);
            }
        }
        return argument;
    }
View Full Code Here

    }

    @Deprecated
    public static Object coerceOtherToType(ThreadContext context, IRubyObject arg, Class target) {
        if (isDuckTypeConvertable(arg.getClass(), target)) {
            RubyObject rubyObject = (RubyObject) arg;
            if (!rubyObject.respondsTo("java_object")) {
                return convertProcToInterface(context, rubyObject, target);
            }
        }

        // it's either as converted as we can make it via above logic or it's
View Full Code Here

TOP

Related Classes of org.jruby.RubyObject$Data

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.