<commit_before>package com.threerings.presents.dobj {

import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;

import com.threerings.util.StringBuilder;

/**
 * An attribute changed event is dispatched when a single attribute of a
 * distributed object has changed. It can also be constructed to request
 * an attribute change on an object and posted to the dobjmgr.
 *
 * @see DObjectManager#postEvent
 */
public class AttributeChangedEvent extends NamedEvent
{
    /**
     * Returns the new value of the attribute.
     */
    public function getValue () :Object
    {
        return _value;
    }

    /**
     * Returns the value of the attribute prior to the application of this
     * event.
     */
    public function getOldValue () :Object
    {
        return _oldValue;
    }

    /**
     * Applies this attribute change to the object.
     */
    public override function applyToObject (target :DObject) :Boolean
        //throws ObjectAccessException
    {
        // if we have no old value, that means we're not running on the
        // master server and we have not already applied this attribute
        // change to the object, so we must grab the previous value and
        // actually apply the attribute change
        if (_oldValue === UNSET_OLD_ENTRY) {
            _oldValue = target[_name]; // fucking wack-ass language
        }
        target[_name] = _value;
        return true;
    }

    /**
     * Constructs a new attribute changed event on the specified target
     * object with the supplied attribute name and value. <em>Do not
     * construct these objects by hand.</em> Use {@link
     * DObject#changeAttribute} instead.
     *
     * @param targetOid the object id of the object whose attribute has
     * changed.
     * @param name the name of the attribute (data member) that has
     * changed.
     * @param value the new value of the attribute (in the case of
     * primitive types, the reflection-defined object-alternative is
     * used).
     */
    public function AttributeChangedEvent (
            targetOid :int = 0, name :String = null, value :Object = null,<commit_msg>Unwrap integers before assigning properties. God, I wish I could just autotranslate at the network layer.<commit_after>package com.threerings.presents.dobj {

import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;

import com.threerings.util.Integer;
import com.threerings.util.StringBuilder;

/**
 * An attribute changed event is dispatched when a single attribute of a
 * distributed object has changed. It can also be constructed to request
 * an attribute change on an object and posted to the dobjmgr.
 *
 * @see DObjectManager#postEvent
 */
public class AttributeChangedEvent extends NamedEvent
{
    /**
     * Returns the new value of the attribute.
     */
    public function getValue () :Object
    {
        return _value;
    }

    /**
     * Returns the value of the attribute prior to the application of this
     * event.
     */
    public function getOldValue () :Object
    {
        return _oldValue;
    }

    /**
     * Applies this attribute change to the object.
     */
    public override function applyToObject (target :DObject) :Boolean
        //throws ObjectAccessException
    {
        // if we have no old value, that means we're not running on the
        // master server and we have not already applied this attribute
        // change to the object, so we must grab the previous value and
        // actually apply the attribute change
        if (_oldValue === UNSET_OLD_ENTRY) {
            _oldValue = target[_name]; // fucking wack-ass language
        }

        // possibly convert the value
        var v :Object = _value;
        if (v is Integer) {
            v = (v as Integer).value

        } else {
            // TODO: more!
        }

        target[_name] = v;
        return true;
    }

    /**
     * Constructs a new attribute changed event on the specified target
     * object with the supplied attribute name and value. <em>Do not
     * construct these objects by hand.</em> Use {@link
     * DObject#changeAttribute} instead.
     *
     * @param targetOid the object id of the object whose attribute has
     * changed.
     * @param name the name of the attribute (data member) that has
     * changed.
     * @param value the new value of the attribute (in the case of
     * primitive types, the reflection-defined object-alternative is
     * used).
     */
    public function AttributeChangedEvent (
            targetOid :int = 0, name :String = null, value :Object = null,
{'fraction_non_alphanumeric': 0.0736275565123789, 'fraction_numerical': 0.0004305705059203445, 'mean_word_length': 2.431314623338257, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '935464', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1195, 'n_words': 501}