<commit_before>
;
var DEBUG = function() { console.log(arguments[0]); }

var oop = (function(oop) {
    ;

    var Accessor = {
        Public: "public",
        Private: "private"
    };

    var getProperties = function(clazz) {
        var type = (clazz instanceof Object) ? clazz : clazz;
        var propList = [];
        for(var p in type) {
            if (!type.hasOwnProperty(p)) continue;
            propList.push(p);
        }
        return propList;
    };

    var Class = function(classInfo) {

        //parent = parent || {};
        //clazz  = clazz | function() { };

        return (function() {
            var self = this;
            var type = this.constructor;

            (function() {
            })();

            return self;
        });
    
    };

    oop = {
        extend: function(parent, clazz) {
            for(var p in clazz) {
                if (parent.hasOwnProperty(p)) {
                    clazz[p] = parent[p];
                    console.log(p);
                };

                var extend_proxy            = function() {};
                extend_proxy.prototype      = parent.prototype;
                clazz.prototype             = new extend_proxy();
                clazz.prototype.constructor = clazz;
            }
        },
        class: function(classInfo) { 
            return new Class(classInfo); 
        },
        getset: function(get, set) {
            this.get = get;
            this.set = set;
        },
        get: function() { },
        set: function(value) { }

    };

    Object.defineProperty(oop, "public", {
        get: function() { return oop; }
    });

/*
    function IProgram() { 
        console.log("IProgram.IProgram");
        this.name = "POWERUMC";
        IProgram.prototype.func = function() { console.log("base.func"); };
    }

    var Program = (function(type) {
        oop.extend(type, Program);

        var self = this;
        var base = type.prototype;

        function Program() {
            console.log("Program.Program");
            type.apply(this, arguments)
        }

        Program.prototype.func = function() {
            console.log("Program.func");
            type.prototype.func.apply(this, arguments);
        }

        return Program;
    })(IProgram);

*/

/*
    var Program = oop.public.class({
        Program: function() { },
        static: {

        },
        Id: oop.getset(function() { return _id; },
                       function(value) { _id = value; })
    });
*/

    return oop;

})(oop);

var Program = oop.public.class({
    Program: function() { },
    Init: function() { },
    static: {
        Version: "1.0.0",
        Date: "2014-10-27"
    },
    A: "A"
});

DEBUG("---------------");
DEBUG("program");
DEBUG(new Program());
<commit_msg>test for Class<commit_after>
;
var DEBUG = function() { console.log(arguments[0]); }

var oop = (function(oop) {
    ;

    var Accessor = {
        Public: "public",
        Private: "private"
    };

    function isObject(obj) {
        return typeof obj === "object" && obj.constructor.name !== "Array";
    }

    function isProperty(obj) {
        return isObject(obj) && obj.get && obj.set;
    }

    function isFunction(obj) {
        return typeof obj === "function";
    }

    function isArray(obj) {
        return typeof obj === "object" && obj.constructor.name === "Array";
    }

    function isStatic(obj) {
        
    }

    var getProperties = function(clazz) {
        DEBUG("----------- getProperties ---------");
        var type = clazz[0];
        var propList = [];
        for(var p in type) {
            if (!type.hasOwnProperty(p)) continue;
            DEBUG( "name:" + p + "   object:" + type[p] );
            propList.push({ "name":p, "object":type[p] });
        }
        DEBUG(propList);
        return propList;
    };

    var Class = function(parents, classInfo) {
        DEBUG("Class -------------");
        
        classInfo      = Array.prototype.slice.apply(arguments, [-1]);
        var arrParents = Array.prototype.slice.apply(arguments, [0, arguments.length-1]);
        if (arrParents && arrParents.length <= 1) { parents = undefined; }
        DEBUG("parents: " + parents);
        DEBUG("classInfo: " + classInfo);

        if (classInfo === undefined) { 
            DEBUG("classInfo === undefined");
            classInfo = parents; 
            parents = undefined;
        }
        

        return (function() {
                DEBUG(parents);
                if (parents) oop.extend(parents, this);

                var self  = this;
                var type  = this.constructor;
                var props = getProperties(classInfo);
                

                /*
                for(var i=0; i<props.length; i++) {
                    if (props[i].name == "static") {
                        type[props[i].name] = props[i].object[props[i.name]];
                    } else {
                        DEBUG("COPY " + props[i].name);
                        type.prototype[props[i].name] = props[i].object;
                    }
                }*/
                for(var p in props) {
                    if (!props.hasOwnProperty(p)) continue;
                    if (props[p].name == "static") {
                        var static_object = props[p].object;
                        for(var pp in static_object) {
                            type[pp] = static_object[pp];
                        }
                    } else {
                        DEBUG("COPY " + props[p].name);
                        type.prototype[props[p].name] = props[p].object;   
                    }
                }


                (function() {
                    DEBUG("call constructor...");
                    if (parents) {
                        DEBUG("call constructor...parent...");
                        DEBUG(parents);
                        parents.apply(this, arguments);
                    }
                    // if (self.init) { 
                    //     DEBUG("call constructor...self...");
                    //     self.init.apply(this, arguments);
                    // }
                })();

                return this;
        });
    };

    oop = {
        extend: function(parent, clazz) {
            DEBUG("oop.extend...");
            for(var p in parent) if (parent.hasOwnProperty(p)) clazz[p] = parent[p];

            var extend_proxy            = function() { };
            extend_proxy.prototype      = parent.prototype;
            clazz.prototype             = new extend_proxy();
            clazz.prototype.constructor = clazz;
        },
        class: function(parents, classInfo) { 
            return Class.apply(this, arguments);
        },
        getset: function(get, set) {
            this.get = get;
            this.set = set;
        },
        get: function() { },
        set: function(value) { }

    };

    Object.defineProperty(oop, "public", {
        get: function() { return oop; }
    });

    return oop;

})(oop);

/*
var IProgram = oop.public.class({
    interface1: function() { console.log("IProgram.prototype.interface1();"); }
});

var Program = oop.public.class({
    init: function() { console.log("Program.prototype.init()"); },
    say: function(msg) { console.log("Hello " + msg); },
    static: {
        Version: "1.0.0",
        Date: "2014-10-27"
    },
    Name: "<NAME>"
});
*/

function IProgram() { 
    console.log("IProgram.IProgram");
    this.name = "POWERUMC";
    IProgram.prototype.func = function() { console.log("base.func"); };
}

var Program = (function(type) {
    oop.extend(type, Program);

    var self = this;
    var base = type.prototype;

    function Program() {
        console.log("Program.Program");
        type.apply(this, arguments)
    }

    Program.prototype.func = function() {
        console.log("Program.func");
        type.prototype.func.apply(this, arguments);
    }

    return Program;
})(IProgram);
var p = new Program();
DEBUG("Program ------------------");
DEBUG(p);

// var Program = oop.public.class({
//     Program: function() { },
//     static: {

//     },
//     Id: oop.getset(function() { return _id; },
//                    function(value) { _id = value; })
// });

function IIProgram() { 
    console.log("call IIProgram");
    this.user = "POWERUMC";
    IIProgram.prototype.func = function() { console.log("base.func"); };
}

var ProgramImpl = oop.public.class(IIProgram, {
    interface2: function() { console.log("ProgramImpl.prototype.interface2"); },
    interface3: function() { console.log("ProgramImpl.prototype.interface3"); },
    interface4: function() { console.log("ProgramImpl.prototype.interface3"); },
    static: {
        Name: "POWERUMC",
        getName: function() { return this.Name; }
    },
    prop1 : {
        get: function() { return this._name; },
        set: function(value) { this._name = value; }
    }
});

DEBUG("pimpl ---------------");
var pimpl = new ProgramImpl();
DEBUG(pimpl);
{'fraction_non_alphanumeric': 0.1562950637825846, 'fraction_numerical': 0.004326123128119801, 'mean_word_length': 1.5254901960784313, 'pattern_counts': {'":': 2, '<': 6, '<?xml version=': 0, '>': 4, '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': '451938', 'n_tokens_mistral': 2587, 'n_tokens_neox': 2474, 'n_words': 510}