<commit_before>package org.moe.runtime

import scala.collection.mutable.HashMap

class MoeObject {

    private val id : Integer = System.identityHashCode( this )
    private val data = new HashMap[ String, MoeObject ]()

    private var klass : MoeClass = _    

    def this ( k : MoeClass ) = {
        this()
        klass = k
    }

    def getID              (): Integer  = id
    def getAssociatedClass (): MoeClass = klass
    def hasAssociatedClass (): Boolean  = klass != null

    def setAssociatedClass ( k : MoeClass ): Unit = klass = k

    def hasValue ( name : String ): Boolean   = data.contains( name )
    def getValue ( name : String ): MoeObject = {
        if ( !hasValue( name ) ) throw new Runtime.Errors.InstanceValueNotFound( name )
        data( name )
    }

    def setValue ( name : String, value : MoeObject ): Unit = data.put( name, value )

    def callMethod ( method : String ): MoeObject = callMethod( method, List() )
    def callMethod ( method : String, args : List[ MoeObject ] ): MoeObject = {
        if ( klass == null ) throw new Runtime.Errors.MissingClass( toString )
        klass.getMethod( method ).execute( this, args )
    }

    override def toString (): String = {
        var out = "{ #instance(" + id + ")"
        if ( hasAssociatedClass ) {
            out += " " + klass.toString() 
        }
        out + " }"
    }
}<commit_msg>add predicates<commit_after>package org.moe.runtime

import scala.collection.mutable.HashMap

class MoeObject {

    private val id : Integer = System.identityHashCode( this )
    private val data = new HashMap[ String, MoeObject ]()

    private var klass : MoeClass = _    

    def this ( k : MoeClass ) = {
        this()
        klass = k
    }

    def getID              (): Integer  = id
    def getAssociatedClass (): MoeClass = klass
    def hasAssociatedClass (): Boolean  = klass != null

    def setAssociatedClass ( k : MoeClass ): Unit = klass = k

    def hasValue ( name : String ): Boolean   = data.contains( name )
    def getValue ( name : String ): MoeObject = {
        if ( !hasValue( name ) ) throw new Runtime.Errors.InstanceValueNotFound( name )
        data( name )
    }

    def setValue ( name : String, value : MoeObject ): Unit = data.put( name, value )

    def callMethod ( method : String ): MoeObject = callMethod( method, List() )
    def callMethod ( method : String, args : List[ MoeObject ] ): MoeObject = {
        if ( klass == null ) throw new Runtime.Errors.MissingClass( toString )
        klass.getMethod( method ).execute( this, args )
    }

    def isTrue  (): Boolean = !isFalse()
    def isFalse (): Boolean = false
    def isUndef (): Boolean = false

    override def toString (): String = {
        var out = "{ #instance(" + id + ")"
        if ( hasAssociatedClass ) {
            out += " " + klass.toString() 
        }
        out + " }"
    }
}
{'fraction_non_alphanumeric': 0.1144141030072589, 'fraction_numerical': 0.0, 'mean_word_length': 2.296127562642369, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '126204', 'n_tokens_mistral': 853, 'n_tokens_neox': 851, 'n_words': 257}