text:
extern ENUM_REFESH_ATTR_TYPE CalcRefeshAttrType(Obj_Character *pSour, Obj_Character *pTarget );

Packet *Obj_Pet::CreateNewObjPacket( VOID )
{
__ENTER_FUNCTION

    if ( getScene() != NULL )
    {
        if( !IsAlive() )
        {//尸体
            GCNewPet_Death *pPacket = (GCNewPet_Death*)(getScene()->m_pPacket_NewPet_Death);
            pPacket->setObjID( GetID() );
            pPacket->setWorldPos( *(getWorldPos()) );
            pPacket->setDir( getDir() );
            pPacket->setMoveSpeed( GetMoveSpeed() ) ;
            return pPacket;
        }
        else if( IsMoving() )
        {
            GCNewPet_Move *pPacket = (GCNewPet_Move*)(getScene()->m_pPacket_NewPet_Move);
            pPacket->setObjID( GetID() ) ;
            pPacket->setHandleID( GetLogicCount() ) ;
            pPacket->setWorldPos( *getWorldPos() ) ;
            pPacket->setTargetPos( *GetFinalTarPos() ) ;
            pPacket->setMoveSpeed( GetMoveSpeed() ) ;
            return pPacket;
        }
        else
        {
            GCNewPet *pPacket = (GCNewPet*)(getScene()->m_pPacket_NewPet);
            pPacket->setObjID( GetID() ) ;
            pPacket->setWorldPos( *(getWorldPos()) ) ;
            pPacket->setDir( getDir() );
            pPacket->setMoveSpeed( GetMoveSpeed() ) ;
            return pPacket;
        }
    }
    else
    {
        Assert( getScene() != NULL && "Obj_Pet::CreateNewObjPacket" );
        return NULL;
    }

__LEAVE_FUNCTION

    return NULL;
}

VOID Obj_Pet::DestroyNewObjPacket( Packet *pPacket )
{
}

VOID Obj_Pet::InitBackupAttr()
{
__ENTER_FUNCTION
    m_AttrBackUp.m_bNameModified        = FALSE;
    m_AttrBackUp.m_bTitleModified        = FALSE;
    m_AttrBackUp.m_SpouseGUID            = GetSpouseGUID();
    m_AttrBackUp.m_nAIType                = GetAIType();
    m_AttrBackUp.m_Level                = GetLevel();
    m_AttrBackUp.m_nStealthLevel        = GetStealthLevel();
    m_AttrBackUp.m_HP                    = GetHP();
    m_AttrBackUp.m_MP                    = GetMP();
    const _CAMP_DATA *pCampData = GetCampData();
    if ( pCampData != NULL )
        m_AttrBackUp.m_CampData            = *pCampData;
    m_AttrBackUp.m_nOwnerID                = GetOwnerID();
    m_AttrBackUp.m_MaxHp                = GetMaxHP();
    m_AttrBackUp.m_MaxMp                = GetMaxMP();
    m_AttrBackUp.m_MoveSpeed            = GetMoveSpeed();

    m_AttrBackUp.m_GUID                    = GetPetGUID();
    m_AttrBackUp.m_nLife                = GetLife();
    m_AttrBackUp.m_byGeneration            = GetGeneration();
    m_AttrBackUp.m_byHappiness            = GetHappiness();

    m_AttrBackUp.m_nAtt_Physics            = Attr_VerifyGeneralAttack(GetAttackPhysics());
    m_AttrBackUp.m_nAtt_Magic            = Attr_VerifyGeneralAttack(GetAttackMagic());
    m_AttrBackUp.m_nDef_Physics            = Attr_VerifyDefence(GetDefencePhysics());
    m_AttrBackUp.m_nDef_Magic            = Attr_VerifyDefence(GetDefenceMagic());
    m_AttrBackUp.m_nHit                    = GetHit();
    m_AttrBackUp.m_nMiss                = GetMiss();

    m_AttrBackUp.m_nExp                    = GetExp();

    m_AttrBackUp.m_nDataID                = GetDataID();
    m_AttrBackUp.m_nModelID                = GetModelID();
    m_AttrBackUp.m_nMountID                = GetMountID();

    m_AttrBackUp.m_StrPerception        = GetStrPerception();
    m_AttrBackUp.m_ConPerception        = GetConPerception();
    m_AttrBackUp.m_DexPerception        = GetDexPerception();
    m_AttrBackUp.m_SprPerception        = GetSprPerception();
    m_AttrBackUp.m_IntPerception        = GetIntPerception();

    m_AttrBackUp.m_Str                    = GetStr();
    m_AttrBackUp.m_Con                    = GetCon();
    m_AttrBackUp.m_Dex                    = GetDex();
    m_AttrBackUp.m_Spr                    = GetSpr();
    m_AttrBackUp.m_Int                    = GetInt();

    m_AttrBackUp.m_nRemainPoint            = GetRemainPoint();
    //m_AttrBackUp.m_nCampType            = m_nCampType;
__LEAVE_FUNCTION
}

VOID Obj_Pet::SendMsg_RefeshAttrib( VOID )
{
__ENTER_FUNCTION
    INT nAttr = 0;

    BOOL bPublicAttrModified, bProtectedAttrModified, bLevelModified, bDetailAttrModified;
    bPublicAttrModified        = FALSE;
    bProtectedAttrModified    = FALSE;
    bLevelModified            = FALSE;
    bDetailAttrModified        = FALSE;

    GCCharBaseAttrib msgPublicAttr, msgPublicAttrAndLevel, msgProtectedAttr;
    GCDetailAttrib_Pet msgDetail;

    msgDetail.SetObjID( GetID() );
    msgDetail.SetGUID( GetPetGUID() );
    msgPublicAttr.setObjID( GetID() );
    msgPublicAttrAndLevel.setObjID( GetID() );
    msgProtectedAttr.setObjID( GetID() );

    if ( m_AttrBackUp.m_bNameModified )
    {
        bPublicAttrModified = TRUE;

        msgPublicAttr.setName( GetName() );
        msgPublicAttrAndLevel.setName( GetName() );
        msgProtectedAttr.setName( GetName() );
        msgDetail.SetName( GetName() );
        m_AttrBackUp.m_bNameModified = FALSE;
    }

    if ( m_AttrBackUp.m_bTitleModified )
    {
        bPublicAttrModified = TRUE;

        msgPublicAttr.setTitle( GetTitle() );
        msgPublicAttrAndLevel.setTitle( GetTitle() );
        msgProtectedAttr.setTitle( GetTitle() );
        m_AttrBackUp.m_bTitleModified = FALSE;
    }

    if(m_AttrBackUp.m_HP != GetHP())
    {
        bPublicAttrModified = TRUE;
        m_AttrBackUp.m_HP = GetHP();

        BYTE yHPPercent = (GetMaxHP())?((BYTE)((GetHP()*100 + GetMaxHP() - 1)/GetMaxHP())):(0);
        msgPublicAttr.setHPPercent( yHPPercent );
        msgPublicAttrAndLevel.setHPPercent( yHPPercent );
        msgProtectedAttr.setHPPercent( yHPPercent );
        msgDetail.SetHP( GetHP() );
    }

    if(m_AttrBackUp.m_MaxHp != GetMaxHP())
    {
        bPublicAttrModified = TRUE;
        m_AttrBackUp.m_MaxHp = GetMaxHP();

        BYTE yHPPercent = (GetMaxHP())?((BYTE)((GetHP()*100 + GetMaxHP() - 1)/GetMaxHP())):(0);
        msgPublicAttr.setHPPercent( yHPPercent );
        msgPublicAttrAndLevel.setHPPercent( yHPPercent );
        msgProtectedAttr.setHPPercent( yHPPercent );
        msgDetail.SetHPMax( GetMaxHP());
    }

    if(fabs(m_AttrBackUp.m_MoveSpeed-GetMoveSpeed()) > 0.001f)
    {
        bPublicAttrModified = TRUE;
        m_AttrBackUp.m_MoveSpeed = GetMoveSpeed();

        msgPublicAttr.setMoveSpeed( GetMoveSpeed() );
        msgPublicAttrAndLevel.setMoveSpeed( GetMoveSpeed() );
        msgProtectedAttr.setMoveSpeed( GetMoveSpeed() );
    }

    const _CAMP_DATA *pCampData = GetCampData();
    if ( pCampData != NULL )
    {
        if(m_AttrBackUp.m_CampData != *pCampData)
        {
            m_AttrBackUp.m_CampData = *pCampData;

            Obj_Character* pOwner = GetOwner();
            if( pOwner && pOwner->GetCampData() )
            {
                //if( pOwner->GetCampData()->m_nCampID == CAMP_1 )
                //    m_nCampType = CAMP1_PET;
                //else if( pOwner->GetCampData()->m_nCampID == CAMP_2 )
                //    m_nCampType = CAMP2_PET;

                bPublicAttrModified = TRUE;
                msgPublicAttr.setCampData( pOwner->GetCampData() );
                msgPublicAttrAndLevel.setCampData( pOwner->GetCampData() );
                msgProtectedAttr.setCampData( pOwner->GetCampData() );
            }
        }
    }

    if(m_AttrBackUp.m_nOwnerID != GetOwnerID())
    {
        bPublicAttrModified = TRUE;
        m_AttrBackUp.m_nOwnerID = GetOwnerID();

        msgPublicAttr.setOwnerID( GetOwnerID() );
        msgPublicAttrAndLevel.setOwnerID( GetOwnerID() );
        msgProtectedAttr.setOwnerID( GetOwnerID() );
    }

    if(m_AttrBackUp.m_nDataID != GetDataID())
    {
        bPublicAttrModified = TRUE;
        m_AttrBackUp.m_nDataID = GetDataID();

        msgPublicAttr.setDataID( GetDataID() );
        msgPublicAttrAndLevel.setDataID( GetDataID() );
        msgProtectedAttr.setDataID( GetDataID() );
        msgDetail.SetDataID(GetDataID());
    }

    if(m_AttrBackUp.m_nModelID != GetModelID())
    {
        bPublicAttrModified = TRUE;

        msgPublicAttr.setModelID( GetModelID() );
        msgPublicAttrAndLevel.setModelID( GetModelID() );
        msgProtectedAttr.setModelID( GetModelID() );
        msgDetail.SetModelID(GetModelID());
    }

    if(m_AttrBackUp.m_nMountID != GetMountID())
    {
        bPublicAttrModified = TRUE;

        msgPublicAttr.setMountID( GetMountID() );
        msgPublicAttrAndLevel.setMountID( GetMountID() );
        msgProtectedAttr.setMountID( GetMountID() );
        msgDetail.SetMountID(GetMountID());
    }

    if(m_AttrBackUp.m_nStealthLevel != GetStealthLevel())
    {
        bPublicAttrModified = TRUE;
        m_AttrBackUp.m_nStealthLevel = GetStealthLevel();

        msgPublicAttr.setStealthLevel( GetStealthLevel() );
        msgPublicAttrAndLevel.setStealthLevel( GetStealthLevel() );
        msgProtectedAttr.setStealthLevel( GetStealthLevel() );
    }

    if(m_AttrBackUp.m_Level != GetLevel())
    {
        bLevelModified = TRUE;
        m_AttrBackUp.m_Level = GetLevel();

        msgPublicAttrAndLevel.setLevel( GetLevel() );
        msgProtectedAttr.setLevel( GetLevel() );
        msgDetail.SetLevel( GetLevel() );
    }

    if( m_AttrBackUp.m_GUID != GetPetGUID() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_GUID= GetPetGUID();
        msgDetail.SetGUID( m_AttrBackUp.m_GUID );
    }

    if( m_AttrBackUp.m_SpouseGUID != GetSpouseGUID() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_SpouseGUID= GetSpouseGUID();
        msgDetail.SetSpouseGUID( GetSpouseGUID() );
    }

    if( m_AttrBackUp.m_nAIType != GetAIType() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_nAIType= GetAIType();
        msgDetail.SetAIType( GetAIType() );
    }

    if( m_AttrBackUp.m_nLife != GetLife() )
    {
        //if (GetLife()%30 == 0 || abs(m_AttrBackUp.m_nLife - GetLife()) >= 30)
        {
            bDetailAttrModified = TRUE;
            m_AttrBackUp.m_nLife= GetLife();
            msgDetail.SetLife( m_AttrBackUp.m_nLife );
        }
    }

    if( m_AttrBackUp.m_byGeneration != GetGeneration() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_byGeneration= GetGeneration();
        msgDetail.SetGeneration( m_AttrBackUp.m_byGeneration );
    }

    if( m_AttrBackUp.m_byHappiness != GetHappiness() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_byHappiness= GetHappiness();
        msgDetail.SetHappiness( m_AttrBackUp.m_byHappiness );
    }

    nAttr = Attr_VerifyGeneralAttack(GetAttackPhysics());
    if( m_AttrBackUp.m_nAtt_Physics != nAttr)
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_nAtt_Physics= nAttr;
        msgDetail.SetAtt_Physics(nAttr);
    }

    nAttr = Attr_VerifyGeneralAttack(GetAttackMagic());
    if( m_AttrBackUp.m_nAtt_Magic != nAttr)
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_nAtt_Magic= nAttr;
        msgDetail.SetAtt_Magic(nAttr);
    }

    nAttr = Attr_VerifyDefence(GetDefencePhysics());
    if( m_AttrBackUp.m_nDef_Physics != nAttr)
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_nDef_Physics= nAttr;
        msgDetail.SetDef_Physics(nAttr);
    }

    nAttr = Attr_VerifyDefence(GetDefenceMagic());
    if( m_AttrBackUp.m_nDef_Magic != nAttr)
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_nDef_Magic= nAttr;
        msgDetail.SetDef_Magic(nAttr);
    }
    nAttr = Attr_VerifyHitMiss(GetHit());
    if( m_AttrBackUp.m_nHit != nAttr)
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_nHit= nAttr;
        msgDetail.SetHit(nAttr);
    }
    nAttr = Attr_VerifyHitMiss(GetMiss());
    if( m_AttrBackUp.m_nMiss !=nAttr)
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_nMiss= nAttr;
        msgDetail.SetMiss(nAttr);
    }
    nAttr = Attr_VerifyCritical(GetCritical());
    if (m_AttrBackUp.m_nCritical != nAttr)
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_nCritical = nAttr;
        msgDetail.SetCritical(nAttr);
    }

    if( m_AttrBackUp.m_nExp != GetExp() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_nExp= GetExp();
        msgDetail.SetExp( m_AttrBackUp.m_nExp );
    }

    if( m_AttrBackUp.m_StrPerception != GetStrPerception() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_StrPerception= GetStrPerception();
        msgDetail.SetStrPerception( m_AttrBackUp.m_StrPerception );
    }

    if( m_AttrBackUp.m_ConPerception != GetConPerception() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_ConPerception= GetConPerception();
        msgDetail.SetConPerception( m_AttrBackUp.m_ConPerception );
    }

    if( m_AttrBackUp.m_DexPerception != GetDexPerception() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_DexPerception= GetDexPerception();
        msgDetail.SetDexPerception( m_AttrBackUp.m_DexPerception );
    }

    if( m_AttrBackUp.m_SprPerception != GetSprPerception() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_SprPerception= GetSprPerception();
        msgDetail.SetSprPerception( m_AttrBackUp.m_SprPerception );
    }

    if( m_AttrBackUp.m_IntPerception != GetIntPerception() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_IntPerception= GetIntPerception();
        msgDetail.SetIntPerception( m_AttrBackUp.m_IntPerception );
    }

    if( m_AttrBackUp.m_Str != GetStr())
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_Str= GetStr();
        msgDetail.SetStr( m_AttrBackUp.m_Str );
    }

    if( m_AttrBackUp.m_Con != GetCon() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_Con= GetCon();
        msgDetail.SetCon( m_AttrBackUp.m_Con );
    }

    if( m_AttrBackUp.m_Dex != GetDex() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_Dex= GetDex();
        msgDetail.SetDex( m_AttrBackUp.m_Dex );
    }

    if( m_AttrBackUp.m_Spr != GetSpr())
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_Spr= GetSpr();
        msgDetail.SetSpr( m_AttrBackUp.m_Spr );
    }

    if( m_AttrBackUp.m_Int != GetInt())
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_Int= GetInt();
        msgDetail.SetInt( m_AttrBackUp.m_Int );
    }

    if( m_AttrBackUp.m_GenGu != GetGenGu())
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_GenGu= GetGenGu();
        msgDetail.SetGenGu( m_AttrBackUp.m_GenGu );
    }

    if( m_AttrBackUp.m_nRemainPoint != GetRemainPoint() )
    {
        bDetailAttrModified = TRUE;
        m_AttrBackUp.m_nRemainPoint= GetRemainPoint();
        msgDetail.SetRemainPoint( m_AttrBackUp.m_nRemainPoint );
    }

    if ( bPublicAttrModified || bProtectedAttrModified || bLevelModified )
    {
        bDetailAttrModified = TRUE;

        if ( bPublicAttrModified || bLevelModified )
        {
            m_PublicAttrVersion++;
        }

        if ( bPublicAttrModified || bLevelModified || m_ProtectedAttrVersion )
        {
            m_ProtectedAttrVersion++;
        }

        HUMANLIST listHuman;
        getScene()->ScanHuman( getZoneID(), MAX_REFESH_OBJ_ZONE_RADIUS, &(listHuman) );

        BOOL bSendPublicMsg                = bPublicAttrModified;
        BOOL bSendPublicAndLevelMsg        = (BOOL)(bPublicAttrModified || bLevelModified);
        BOOL bSendProtectedMsg            = (BOOL)(bPublicAttrModified || bLevelModified || m_ProtectedAttrVersion);
        BYTE i;
        for ( i = 0; i < listHuman.m_Count; i++ )
        {
            Obj_Human *pTargetHuman = listHuman.m_aHuman[i];
            if ( IsCanViewMe( pTargetHuman ) )
            {
                ENUM_REFESH_ATTR_TYPE eType = CalcRefeshAttrType( this, pTargetHuman );
                switch( eType )
                {
                case REFESH_ATTR_TYPE_NONE:
                    break;
                case REFESH_ATTR_TYPE_PUBLIC:
                    if ( bSendPublicMsg )
                    {
                        pTargetHuman->GetPlayer()->SendPacket( &msgPublicAttr );
                    }
                    break;
                case REFESH_ATTR_TYPE_PUBLIC_AND_LEVEL:
                    if ( bSendPublicAndLevelMsg )
                    {
                        pTargetHuman->GetPlayer()->SendPacket( &msgPublicAttrAndLevel );
                    }
                    break;
                case REFESH_ATTR_TYPE_PROTECTED:
                    if ( bSendProtectedMsg )
                    {
                        pTargetHuman->GetPlayer()->SendPacket( &msgProtectedAttr );
                    }
                    break;
                default:
                    break;
                }
            }
        }
    }

    bDetailAttrModified |= bPublicAttrModified | bProtectedAttrModified | bLevelModified;
    if ( bDetailAttrModified )
    {
        Obj_Human *pOwner = (Obj_Human*)(GetOwner());
        if (pOwner && pOwner->GetObjType() == Obj::OBJ_TYPE_HUMAN )
            pOwner->GetPlayer()->SendPacket( &msgDetail );
    }

__LEAVE_FUNCTION
}

VOID Obj_Pet::AskMsg_BaseAttrib( Obj_Human *pTargetHuman )
{
__ENTER_FUNCTION

    if ( IsCanViewMe( pTargetHuman ) )
    {
        GCCharBaseAttrib msgAttr;

        BYTE yHPPercent = (GetMaxHP())?((BYTE)((GetHP()*100 + GetMaxHP() - 1)/GetMaxHP())):(0);
        BYTE yMPPercent = (GetMaxMP())?((BYTE)((GetMP()*100 + GetMaxMP() - 1)/GetMaxMP())):(0);
        Obj_Character* pOwner = GetOwner();
        INT nObjectCampType = INVALID_CAMP;

        msgAttr.setObjID( GetID() );
        msgAttr.setDataID( (WORD)GetDataID() );
        msgAttr.setLevel(GetLevel());
        msgAttr.setName( GetName() );
        msgAttr.setHPPercent( yHPPercent );
        msgAttr.setMPPercent( yMPPercent );
        msgAttr.setRage( GetRage() );
        msgAttr.setDataID(GetDataID());
        msgAttr.setStealthLevel( GetStealthLevel() );
        msgAttr.setCampData( GetCampData() );
        msgAttr.setOwnerID( GetOwnerID() );
        msgAttr.setModelID( GetModelID() );
        msgAttr.setMountID(GetMountID());
        msgAttr.setMoveSpeed(GetMoveSpeed());
        msgAttr.setAttackSpeed((FLOAT)GetAttackSpeed());

        ENUM_REFESH_ATTR_TYPE eType = CalcRefeshAttrType( this, pTargetHuman );
        switch( eType )
        {
        case REFESH_ATTR_TYPE_NONE:
            break;
        case REFESH_ATTR_TYPE_PUBLIC:
            {
            }
            break;
        case REFESH_ATTR_TYPE_PUBLIC_AND_LEVEL:
            {
                msgAttr.setLevel( GetLevel() );
            }
            break;
        case REFESH_ATTR_TYPE_PROTECTED:
            {
                msgAttr.setLevel( GetLevel() );
            }
            break;
        default:
            break;
        }
        pTargetHuman->GetPlayer()->SendPacket( &msgAttr );
        //在发送属性数据的同时发送角色的效果列表数据
        GCCharImpactListUpdate ImpactListUpdate;
        ImpactListUpdate.SetOwnerID(GetID());
        ImpactListUpdate.SetImpactList(Impact_GetImpactList());
        pTargetHuman->GetPlayer()->SendPacket(&ImpactListUpdate);
    }

__LEAVE_FUNCTION
}

VOID Obj_Pet::AskMsg_DetailAttrib( Obj_Human *pTargetHuman )
{
__ENTER_FUNCTION

    //
    if ( pTargetHuman == GetOwner() )
    {
        GCDetailAttrib_Pet msgDetail;

        msgDetail.SetGUID( GetPetGUID() );

        msgDetail.SetObjID( GetID() );
        msgDetail.SetDataID( GetDataID() );
        msgDetail.SetName( GetName() );
        msgDetail.SetHP( GetHP() );
        msgDetail.SetHPMax(GetMaxHP());
        msgDetail.SetAIType( GetAIType() );
        msgDetail.SetSpouseGUID( GetSpouseGUID() );
        msgDetail.SetLevel( GetLevel() );
        msgDetail.SetDataID(GetDataID());
        msgDetail.SetModelID( GetModelID() );
        msgDetail.SetMountID(GetMountID());
        msgDetail.SetLife( GetLife() );
        msgDetail.SetGeneration( GetGeneration() );
        msgDetail.SetHappiness( GetHappiness() );
        msgDetail.SetAtt_Physics(Attr_VerifyGeneralAttack(GetAttackPhysics()));
        msgDetail.SetAtt_Magic(Attr_VerifyGeneralAttack(GetAttackMagic()));
        msgDetail.SetDef_Physics(Attr_VerifyDefence(GetDefencePhysics()));
        msgDetail.SetDef_Magic(Attr_VerifyDefence(GetDefenceMagic()));
        msgDetail.SetHit(GetHit());
        msgDetail.SetMiss(GetMiss());
        msgDetail.SetCritical(GetCritical());
        msgDetail.SetExp(GetExp());
        msgDetail.SetStrPerception(GetStrPerception());
        msgDetail.SetConPerception(GetConPerception());
        msgDetail.SetDexPerception(GetDexPerception());
        msgDetail.SetSprPerception(GetSprPerception());
        msgDetail.SetIntPerception(GetIntPerception());
        msgDetail.SetStr(GetStr());
        msgDetail.SetCon(GetCon());
        msgDetail.SetDex(GetDex());
        msgDetail.SetSpr(GetSpr());
        msgDetail.SetInt(GetInt());
        msgDetail.SetGenGu(GetGenGu());
        msgDetail.SetRemainPoint(GetRemainPoint());
        pTargetHuman->GetPlayer()->SendPacket(&msgDetail);
        //在发送详细属性数据的同时发送角色宠物的效果列表详细数据
        GCDetailImpactListUpdate ImpactListUpdate;
        ImpactListUpdate.SetOwnerID(GetID());
        ImpactListUpdate.SetImpactList(Impact_GetImpactList());
        pTargetHuman->GetPlayer()->SendPacket(&ImpactListUpdate);
    }
__LEAVE_FUNCTION
}


text:
package org.neo4j.kernel.impl.api;

import org.neo4j.function.Function;
import org.neo4j.graphdb.index.IndexImplementation;
import org.neo4j.kernel.impl.transaction.command.CommandHandler;

/**
 * Looks up a {@link LegacyIndexApplier} given a provider name.
 */
public interface LegacyIndexApplierLookup
{
    CommandHandler newApplier( String providerName, boolean recovery );

    /**
     * Looks up an {@link IndexImplementation} and calls {@link IndexImplementation#newApplier(boolean)} on it.
     */
    class Direct implements LegacyIndexApplierLookup
    {
        private final Function<String,IndexImplementation> providerLookup;

        public Direct( Function<String,IndexImplementation> providerLookup )
        {
            this.providerLookup = providerLookup;
        }

        @Override
        public CommandHandler newApplier( String providerName, boolean recovery )
        {
            return providerLookup.apply( providerName ).newApplier( recovery );
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef TI_KROLL_NATIVE_OBJECT_H
#define TI_KROLL_NATIVE_OBJECT_H

#include <assert.h>
#include <jni.h>

#include "EventEmitter.h"
#include "NativeObject.h"

namespace titanium {

// Provides an interface between a JavaScript object
// and a Java object instance. This class is also responsible
// for mangaging the lifetime of the Java object reference
// so that it is properly collected once becoming unreachable
// from the JavaScript code.
class JavaObject : public EventEmitter
{
public:
	// Creates a new instance and attaching
	// to the given Java object.
	JavaObject(jobject javaObject);

	// Delete this object once the Java object has been finalized.
	virtual ~JavaObject();

  // Test if the JavaScript object wraps a Java object.
	static bool isJavaObject(v8::Handle<v8::Object> jsObject)
	{
		if (jsObject->InternalFieldCount() > 0) {
			return true;
		}
		return false;
	}

	// Wrap the given JavaScript object which provides
	// bindings to this Java object.
	void wrap(v8::Handle<v8::Object> jsObject);

	// Attach to the given Java object. A reference
	// to this object will be held until it is detached.
	// You may only call this method once with a Java object.
	// Future calls are only allowed by passing NULL for javaObject
	// to trigger a re-attachment.
	void attach(jobject javaObject);

	// Unreference the Java object so it may be collected.
	// Called automatically when the associated JavaScript object
	// has no more references from user code.
	void detach();

	// Check if this instance is detached from a Java object.
	bool isDetached();

	// When useGlobalRefs is false, you MUST DeleteLocalRef()
	// the returned jobject when you are done using it.
	// This is guaranteed to return a valid reference.
	jobject getJavaObject();

	// True when we use global refs for the wrapped jobject.
	// This is false for the emulator since it has a low limit
	// of how many global refs you can hold. Instead we use an internal
	// hash map for holding onto references to avoid this limit.
	static bool useGlobalRefs;
private:
	jobject javaObject_;
	jint refTableKey_;
	bool isWeakRef_;

	void newGlobalRef();
	void weakGlobalRef();
	void deleteGlobalRef();
};

} // namespace titanium

#endif


text:
.styleSans228.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 228.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans790.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 790.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 12pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans204.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 204.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 5.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans247.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 247.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans594.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 594.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans791.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 791.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 8.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans67.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 67.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 6.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans287.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 287.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans49.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 49.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans65.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 65.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans475.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 475.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans70.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 70.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans35.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 35.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans13.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 13.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans488.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 488.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans81.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 81.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans134.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 134.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans260.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 260.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans12.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 12.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans632.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 632.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans83.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 83.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 11.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 10.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 1.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans29.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 29.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 9.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 7.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans21.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 21.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans184.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 184.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans697.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 697.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans48.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 48.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans2.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 2.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans299.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 299.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans186.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 186.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans162.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 162.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans577.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 577.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans755.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 755.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans122.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 122.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans75.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 75.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans216.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 216.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans30.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 30.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans24.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 24.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans185.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 185.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 4.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans16.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 16.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans17.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 17.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans27.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 27.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans71.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 71.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans14.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 14.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans385.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 385.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans540.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 540.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans714.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 714.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans573.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 573.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans662.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 662.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans563.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 563.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans597.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 597.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans733.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 733.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans732.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 732.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans641.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 641.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans62.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 62.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans693.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 693.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans218.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 218.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans28.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 28.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans213.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 213.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans3.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 3.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans197.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 197.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans665.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 665.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans702.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 702.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans194.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 194.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}


text:
/*
 * atlpin.h
 *
 * Created: 3/23/2017 3:31:54 PM
 *  Author: Vadim Zabavnov
 */

#ifndef ATLPIN_H_
#define ATLPIN_H_

#include <atlport.h>
#include <atlexpr.h>

namespace atl
{
template <typename TDigitalPort, int pin>
struct DigitalPinDirection {
	typedef TDigitalPort DigitalPortType;
	typedef typename DigitalPortType::DataType DataType;
	typedef typename DigitalPortType::DataDirectionPortType DataDirectionPortType;
	typedef typename DigitalPortType::DataPortType DataPortType;

	const DataType Mask = DataType(1) << pin;
private:
	const DataDirectionPortType _direction = DataDirectionPortType();
	const DataPortType _port = DataPortType();
public:
	void inline operator = (const DirectionMode mode) const {
		switch(mode) {
			case Input:
			AsInput();
			break;
			case PullUp:
			AsPullUp();
			break;
			default:
			AsOutput();
		}
	}

	void inline AsInput() const {
		_direction = _direction & ~Mask;
		_port = _port & ~Mask;
	}

	void inline AsPullUp() const {
		_direction = _direction & ~Mask;
		_port = _port | Mask;
	}

	void inline AsOutput() const {
		_direction = _direction | Mask;
	}
};

template <typename TPort, int pin>
struct DigitalPin {
	typedef TPort DigitalPortType;
	typedef typename DigitalPortType::DataType DataType;
	typedef typename DigitalPortType::DataDirectionPortType DataDirectionPortType;
private:
	const DigitalPortType _port = DigitalPortType();
public:
	const DataType Mask = DataType(1) << pin;

	const DataDirectionPortType Direction = DataDirectionPortType();

	void inline Set() const {
		_port = _port | Mask;
	}

	void inline Clear() const {
		_port = _port & ~Mask;
	}

	void inline Flip() const {
		_port = _port ^ Mask;
	}
};

}

#endif /* ATLPIN_H_ */


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title>Collections Framework Overview</title>
<link rel="stylesheet" type="text/css" href="../../../technotes/css/guide.css" />

Documentation Contents

Collections Framework Overview

Introduction

The Java platform includes a collections framework. A
collection is an object that represents a group of objects
(such as the classic Vector class). A
collections framework is a unified architecture for representing
and manipulating collections, enabling collections to be
manipulated independently of implementation details.

The primary advantages of a collections framework are that
it:

Reduces programming effort by providing data
structures and algorithms so you don't have to write them
yourself.

Increases performance by providing
high-performance implementations of data structures and algorithms.
Because the various implementations of each interface are
interchangeable, programs can be tuned by switching
implementations.

Provides interoperability between unrelated
APIs by establishing a common language to pass collections
back and forth.

Reduces the effort required to learn APIs by
requiring you to learn multiple ad hoc collection APIs.

Reduces the effort required to design and implement
APIs by not requiring you to produce ad hoc collections
APIs.

Fosters software reuse by providing a standard
interface for collections and algorithms with which to manipulate
them.

The collections framework consists of:

Collection interfaces. Represent different
types of collections, such as sets, lists, and maps. These
interfaces form the basis of the framework.

General-purpose implementations. Primary
implementations of the collection interfaces.

Legacy implementations. The collection classes
from earlier releases, <tt>Vector</tt> and <tt>Hashtable</tt>, were
retrofitted to implement the collection interfaces.

Special-purpose implementations.
Implementations designed for use in special situations. These
implementations display nonstandard performance characteristics,
usage restrictions, or behavior.

Concurrent implementations. Implementations
designed for highly concurrent use.

Wrapper implementations. Add functionality,
such as synchronization, to other implementations.

Convenience implementations. High-performance
"mini-implementations" of the collection interfaces.

Abstract implementations. Partial
implementations of the collection interfaces to facilitate custom
implementations.

Algorithms. Static methods that perform useful
functions on collections, such as sorting a list.

Infrastructure. Interfaces that provide
essential support for the collection interfaces.

Array Utilities. Utility functions for arrays
of primitive types and reference objects. Not, strictly speaking, a
part of the collections framework, this feature was added to the
Java platform at the same time as the collections framework and
relies on some of the same infrastructure.

Collection Interfaces

The collection interfaces are divided into two groups.
The most basic interface, <tt>java.util.Collection</tt>,
has the following descendants:

<tt>java.util.Set</tt>

<tt>java.util.SortedSet</tt>

<tt>java.util.NavigableSet</tt>

<tt>java.util.Queue</tt>

<tt>java.util.concurrent.BlockingQueue</tt>

<tt>java.util.concurrent.TransferQueue</tt>

<tt>java.util.Deque</tt>

<tt>java.util.concurrent.BlockingDeque</tt>

The other collection interfaces are based on <tt>java.util.Map</tt> and are
not true collections. However, these interfaces contain
collection-view operations, which enable them to be
manipulated as collections. <tt>Map</tt> has the following
offspring:

<tt>java.util.SortedMap</tt>

<tt>java.util.NavigableMap</tt>

<tt>java.util.concurrent.ConcurrentMap</tt>

<tt>java.util.concurrent.ConcurrentNavigableMap</tt>

Many of the modification methods in the collection interfaces
are labeled optional. Implementations are permitted to not
perform one or more of these operations, throwing a runtime
exception (<tt>UnsupportedOperationException</tt>) if they are
attempted. The documentation for each implementation must specify
which optional operations are supported. Several terms are
introduced to aid in this specification:

Collections that do not support modification operations (such
as <tt>add</tt>, <tt>remove</tt> and <tt>clear</tt>) are referred
to as unmodifiable. Collections that are not unmodifiable
are modifiable.

Collections that additionally guarantee that no change in the
<tt>Collection</tt> object will be visible are referred to as
immutable. Collections that are not immutable are
mutable.

Lists that guarantee that their size remains constant even
though the elements can change are referred to as
fixed-size. Lists that are not fixed-size are referred to as
variable-size.

Lists that support fast (generally constant time) indexed
element access are known as random access lists. Lists that
do not support fast indexed element access are known as
sequential access lists. The <tt>RandomAccess</tt>
marker interface enables lists to advertise the fact that they
support random access. This enables generic algorithms to change
their behavior to provide good performance when applied to either
random or sequential access lists.

Some implementations restrict what elements (or in the case of
<tt>Maps</tt>, keys and values) can be stored. Possible
restrictions include requiring elements to:

Be of a particular type.

Be not null.

Obey some arbitrary predicate.

Attempting to add an element that violates an implementation's
restrictions results in a runtime exception, typically a
<tt>ClassCastException</tt>, an <tt>IllegalArgumentException</tt>,
or a <tt>NullPointerException</tt>. Attempting to remove or test
for the presence of an element that violates an implementation's
restrictions can result in an exception. Some restricted
collections permit this usage.

Collection Implementations

Classes that implement the collection interfaces typically have
names in the form of
<Implementation-style><Interface>.
The general purpose implementations are summarized in the following
table:

Interface
Hash Table
Resizable Array
Balanced Tree
Linked List
Hash Table + Linked List

Set
<tt>HashSet</tt>

<tt>TreeSet</tt>

<tt>LinkedHashSet</tt>

List

<tt>ArrayList</tt>

<tt>LinkedList</tt>

Deque

<tt>ArrayDeque</tt>

<tt>LinkedList</tt>

Map
<tt>HashMap</tt>

<tt>TreeMap</tt>

<tt>LinkedHashMap</tt>

The general-purpose implementations support all of the
optional operations in the collection interfaces and have no
restrictions on the elements they may contain. They are
unsynchronized, but the <tt>Collections</tt> class contains static
factories called
synchronization wrappers that can be used to add
synchronization to many unsynchronized collections. All of the new
implementations have fail-fast iterators, which detect
invalid concurrent modification, and fail quickly and cleanly
(rather than behaving erratically).

The <tt>AbstractCollection</tt>, <tt>AbstractSet</tt>,
<tt>AbstractList</tt>, <tt>AbstractSequentialList</tt> and
<tt>AbstractMap</tt> classes provide basic implementations of the
core collection interfaces, to minimize the effort required to
implement them. The API documentation for these classes describes
precisely how each method is implemented so the implementer knows
which methods must be overridden, given the performance of the
basic operations of a specific implementation.

Concurrent Collections

Applications that use collections from more than one thread must
be carefully programmed. In general, this is known as concurrent
programming. The Java platform includes extensive support for
concurrent programming. See Java Concurrency
Utilities for details.

Collections are so frequently used that various concurrent
friendly interfaces and implementations of collections are included
in the APIs. These types go beyond the synchronization wrappers
discussed previously to provide features that are frequently needed
in concurrent programming.

These concurrent-aware interfaces are available:

<tt>BlockingQueue</tt>

<tt>TransferQueue</tt>

<tt>BlockingDeque</tt>

<tt>ConcurrentMap</tt>

<tt>ConcurrentNavigableMap</tt>

The following concurrent-aware implementation classes are
available. See the API documentation for the correct usage of these
implementations.

<tt>LinkedBlockingQueue</tt>

<tt>ArrayBlockingQueue</tt>

<tt>PriorityBlockingQueue</tt>

<tt>DelayQueue</tt>

<tt>SynchronousQueue</tt>

<tt>LinkedBlockingDeque</tt>

<tt>LinkedTransferQueue</tt>

<tt>CopyOnWriteArrayList</tt>

<tt>CopyOnWriteArraySet</tt>

<tt>ConcurrentSkipListSet</tt>

<tt>ConcurrentHashMap</tt>

<tt>ConcurrentSkipListMap</tt>

Design Goals

The main design goal was to produce an API that was small in
size and, more importantly, in "conceptual weight." It
was critical that the new functionality not seem too different to
current Java programmers; it had to augment current facilities,
rather than replace them. At the same time, the new API had to be
powerful enough to provide all the advantages described
previously.

To keep the number of core interfaces small, the interfaces do
not attempt to capture such subtle distinctions as mutability,
modifiability, and resizability. Instead, certain calls in the core
interfaces are optional, enabling implementations to throw
an <tt>UnsupportedOperationException</tt> to indicate that they do
not support a specified optional operation. Collection implementers
must clearly document which optional operations are supported by an
implementation.

To keep the number of methods in each core interface small, an
interface contains a method only if either:

It is a truly fundamental operation: a basic operations
in terms of which others could be reasonably defined,

There is a compelling performance reason why an important
implementation would want to override it.

It was critical that all reasonable representations of
collections interoperate well. This included arrays, which cannot
be made to implement the <tt>Collection</tt> interface directly
without changing the language. Thus, the framework includes methods
to enable collections to be moved into arrays, arrays to be viewed
as collections, and maps to be viewed as collections.

Copyright
© 1993, 2015, Oracle and/or its affiliates. All rights
reserved.

Contact
Us


text:
package com.computation.common.concurrent.search;

import com.computation.common.Point2D;
import com.computation.common.Reference;

import java.util.List;
import java.util.concurrent.ExecutorService;

/**
 * Created by mwkurian on 11/20/2014.
 */
public class ForkedMaxBottomLeft extends ForkableSearch<Point2D, List<Point2D>> {

    /**
     * @param executorService
     * @param availableThreads
     * @param data
     * @return
     */
    public static Reference find(ExecutorService executorService, int availableThreads, List<Point2D> data) {
        return (Reference) new ForkedMaxBottomLeft(executorService, availableThreads, data).find();
    }

    /**
     * Implementation
     */

    public class Reference extends com.computation.common.Reference<Point2D> {

        private volatile int index = -1;

        public Reference(Point2D point2D) {
            super(point2D);
        }

        private void setIndex(int index) {
            this.index = index;
        }

        public int getIndex() {
            return index;
        }
    }

    protected ForkedMaxBottomLeft(ExecutorService executorService, int availableThreads, List<Point2D> data) {
        super(executorService, availableThreads, data);
    }

    @Override
    protected Reference getReferenceInstance() {
        return new Reference(null);
    }

    private int comparePoints(Point2D p1, Point2D p2) {
        if (p2.y == p1.y) {
            return p1.x - p2.x;
        }

        return p2.y - p1.y;
    }

    @Override
    protected void onSearch(int start, int end, com.computation.common.Reference<Point2D> ref) {
        Point2D min = null;
        int minIndex = 0;

        for (int i = start; i < end; i++) {
            Point2D curr = data.get(i);
            if (min == null) {
                min = curr;
                minIndex = i;
                continue;
            }
            if (comparePoints(min, curr) > 0) {
                min = curr;
                minIndex = i;
            }
        }

        synchronized (ref) {
            Point2D last = ref.get();
            if (last == null) {
                ref.update(min);
                ((Reference) ref).setIndex(minIndex);
            } else if (comparePoints(last, min) > 0) {
                    ref.update(min);
                    ((Reference) ref).setIndex(minIndex);
            }
        }
    }
}


text:
from django.core.validators import ValidationError

def is_ascii(text):
    try:
        text.encode('ascii')
    except UnicodeEncodeError:
        return False
    else:
        return True

def validate_ascii_text(text):
    "Check if text is a text with ASCII-only characters."

    if not is_ascii(text):
        raise ValidationError(
            'Please use only ASCII (Latin) letters.',
            code='invalid',
            params={'text': text},
        )


text:
<?php

namespace Phalcon\Test;

use Phalcon\Escaper as PhEscaper;
use Phalcon\Mvc\Dispatcher as PhDispatcher;
use Phalcon\Mvc\Application as PhApplication;

abstract class FunctionalTestCase extends ModelTestCase
{

    protected $application;

    /**
     * Sets the test up by loading the DI container and other stuff
     *
     * @param  \Phalcon\DiInterface $di
     * @param  \Phalcon\Config      $config
     * @return void
     */
    protected function setUp(\Phalcon\DiInterface $di = null, \Phalcon\Config $config = null)
    {
        parent::setUp($di, $config);

        // Set the dispatcher
        $this->di->setShared(
            'dispatcher',
            function () {
                $dispatcher = new PhDispatcher();
                $dispatcher->setControllerName('test');
                $dispatcher->setActionName('empty');
                $dispatcher->setParams(array());

                return $dispatcher;
            }
        );

        $this->di->set(
            'escaper',
            function () {
                return new PhEscaper();
            }
        );

        if ($this->di instanceof \Phalcon\DiInterface) {
            $this->application = new PhApplication($this->di);
        }

    }

    /**
     * Ensures that each test has it's own DI and all globals are purged
     *
     * @return void
     */
    protected function tearDown()
    {
        $this->di->reset();
        $this->application = null;

        $_SESSION = array();
        $_GET = array();
        $_POST = array();
        $_COOKIE = array();
    }

    /**
     * Dispatches a given url and sets the response object accordingly
     *
     * @param  string $url The request url
     * @return void
     */
    protected function dispatch($url)
    {
        $this->di->setShared('response', $this->application->handle($url));
    }

    /**
     * Assert that the last dispatched controller matches the given controller class name
     *
     * @param  string                                        $expected The expected controller name
     * @throws \PHPUnit_Framework_ExpectationFailedException
     */
    public function assertController($expected)
    {
        $actual = $this->di->getShared('dispatcher')->getControllerName();
        if ($actual != $expected) {
            throw new \PHPUnit_Framework_ExpectationFailedException(
                sprintf(
                    'Failed asserting Controller name "%s", actual Controller name is "%s"',
                    $expected,
                    $actual
                )
            );
        }

        $this->assertEquals($expected, $actual);
    }

    /**
     * Assert that the last dispatched action matches the given action name
     *
     * @param  string                                        $expected The expected action name
     * @throws \PHPUnit_Framework_ExpectationFailedException
     */
    public function assertAction($expected)
    {
        $actual = $this->di->getShared('dispatcher')->getActionName();
        if ($actual != $expected) {
            throw new \PHPUnit_Framework_ExpectationFailedException(
                sprintf(
                    'Failed asserting Action name "%s", actual Action name is "%s"',
                    $expected,
                    $actual
                )
            );
        }
        $this->assertEquals($expected, $actual);
    }

    /**
     * Assert that the response headers contains the given array
     * <code>
     * $expected = array('Content-Type' => 'application/json')
     * </code>
     *
     * @param  array                                         $expected The expected headers
     * @throws \PHPUnit_Framework_ExpectationFailedException
     */
    public function assertHeader(array $expected)
    {
        foreach ($expected as $expectedField => $expectedValue) {
            $actualValue = $this->di->getShared('response')->getHeaders()->get($expectedField);
            if ($actualValue != $expectedValue) {
                throw new \PHPUnit_Framework_ExpectationFailedException(
                    sprintf(
                        'Failed asserting "%s" has a value of "%s", actual "%s" header value is "%s"',
                        $expectedField,
                        $expectedValue,
                        $expectedField,
                        $actualValue
                    )
                );
            }
            $this->assertEquals($expectedValue, $actualValue);
        }
    }

    /**
     * Asserts that the response code matches the given one
     *
     * @param  string                                        $expected the expected response code
     * @throws \PHPUnit_Framework_ExpectationFailedException
     */
    public function assertResponseCode($expected)
    {
        // convert to string if int
        if (is_integer($expected)) {
            $expected = (string) $expected;
        }

        $actualValue = $this->di->getShared('response')->getHeaders()->get('Status');

        if (empty($actualValue) || stristr($actualValue, $expected) === false) {
            throw new \PHPUnit_Framework_ExpectationFailedException(
                sprintf(
                    'Failed asserting response code is "%s", actual response status is "%s"',
                    $expected,
                    $actualValue
                )
            );
        }

        $this->assertContains($expected, $actualValue);
    }

    /**
     * Asserts that the dispatch is forwarded
     *
     * @throws \PHPUnit_Framework_ExpectationFailedException
     */
    public function assertDispatchIsForwarded()
    {
        /* @var $dispatcher \Phalcon\Mvc\Dispatcher */
        $dispatcher = $this->di->getShared('dispatcher');
        $actual = $dispatcher->wasForwarded();

        if (!$actual) {
            throw new \PHPUnit_Framework_ExpectationFailedException('Failed asserting dispatch was forwarded');
        }

        $this->assertTrue($actual);
    }

    /**
     * Assert location redirect
     *
     * @param  string                                        $location
     * @throws \PHPUnit_Framework_ExpectationFailedException
     */
    public function assertRedirectTo($location)
    {
        $actualLocation = $this->di->getShared('response')->getHeaders()->get('Location');

        if (!$actualLocation) {
            throw new \PHPUnit_Framework_ExpectationFailedException('Failed asserting response caused a redirect');
        }

        if ($actualLocation !== $location) {
            throw new \PHPUnit_Framework_ExpectationFailedException(sprintf(
                'Failed asserting response redirects to "%s". It redirects to "%s".',
                $location,
                $actualLocation
            ));
        }

        $this->assertEquals($location, $actualLocation);
    }

    /**
     * Convenience method to retrieve response content
     *
     * @return string
     */
    public function getContent()
    {
        return $this->di->getShared('response')->getContent();
    }

    /**
     * Assert response content contains string
     *
     * @param string $string
     */
    public function assertResponseContentContains($string)
    {
        $this->assertContains($string, $this->getContent());
    }
}


text:
import React, {Component, PropTypes} from 'react';
import {browserHistory} from 'react-router';
import * as colors from 'material-ui/styles/colors';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import Header from './Header';
import Snackbar from 'material-ui/Snackbar';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import Navigation from './Navigation';
import '../../sass/app.scss';

const muiTheme = getMuiTheme({
  palette: {
    primary2Color: colors.blue800,
    primary1Color: colors.lightBlueA400,
    primary3Color: colors.cyan500,
    accent1Color: colors.cyan500
  }
});

class App extends Component {

  static propTypes = {
    children: PropTypes.element,
    location: PropTypes.object,
    snackbar: PropTypes.object,
    snackbarActions: PropTypes.shape({
      hideSnackbar: PropTypes.func.isRequired
    })
  };

  constructor (props) {
    super(props);

    this.handleClickConnection = this.handleClickConnection.bind(this);
  }

  handleClickConnection (evt) {
    evt.preventDefault();
    browserHistory.push('/login');
  }

  render () {
    const {
      snackbar,
      snackbarActions: {
        hideSnackbar
      }
    } = this.props;

    const onSnackbarRequestClose = () => {
      hideSnackbar(0);
    };

    return (
      <MuiThemeProvider muiTheme={muiTheme}>
        <div className='App'>
          <Header onClickConnection={this.handleClickConnection} />
          <Navigation location={this.props.location} />
          {this.props.children}
          {snackbar.visible && <Snackbar
            open
            message={snackbar.message}
            autoHideDuration={4000}
            onRequestClose={onSnackbarRequestClose}
          />}
        </div>
      </MuiThemeProvider>
    );
  }

}

export default App;


text:
package textinput

import (
	"context"
	"strings"
	"sync"
	"time"
	"unicode"

	"github.com/atotto/clipboard"
	tea "github.com/charmbracelet/bubbletea"
	"github.com/charmbracelet/lipgloss"
	rw "github.com/mattn/go-runewidth"
)

const defaultBlinkSpeed = time.Millisecond * 530

// Internal ID management for text inputs. Necessary for blink integrity when
// multiple text inputs are involved.
var (
	lastID int
	idMtx  sync.Mutex
)

// Return the next ID we should use on the Model.
func nextID() int {
	idMtx.Lock()
	defer idMtx.Unlock()
	lastID++
	return lastID
}

// initialBlinkMsg initializes cursor blinking.
type initialBlinkMsg struct{}

// blinkMsg signals that the cursor should blink. It contains metadata that
// allows us to tell if the blink message is the one we're expecting.
type blinkMsg struct {
	id  int
	tag int
}

// blinkCanceled is sent when a blink operation is canceled.
type blinkCanceled struct{}

// Internal messages for clipboard operations.
type pasteMsg string
type pasteErrMsg struct{ error }

// EchoMode sets the input behavior of the text input field.
type EchoMode int

const (
	// EchoNormal displays text as is. This is the default behavior.
	EchoNormal EchoMode = iota

	// EchoPassword displays the EchoCharacter mask instead of actual
	// characters.  This is commonly used for password fields.
	EchoPassword

	// EchoNone displays nothing as characters are entered. This is commonly
	// seen for password fields on the command line.
	EchoNone

	// EchoOnEdit.
)

// blinkCtx manages cursor blinking.
type blinkCtx struct {
	ctx    context.Context
	cancel context.CancelFunc
}

// CursorMode describes the behavior of the cursor.
type CursorMode int

// Available cursor modes.
const (
	CursorBlink CursorMode = iota
	CursorStatic
	CursorHide
)

// String returns a the cursor mode in a human-readable format. This method is
// provisional and for informational purposes only.
func (c CursorMode) String() string {
	return [...]string{
		"blink",
		"static",
		"hidden",
	}[c]
}

// ValidateFunc is a function that returns an error if the input is invalid.
type ValidateFunc func(string) error

// Model is the Bubble Tea model for this text input element.
type Model struct {
	Err error

	// General settings.
	Prompt        string
	Placeholder   string
	BlinkSpeed    time.Duration
	EchoMode      EchoMode
	EchoCharacter rune

	// Styles. These will be applied as inline styles.
	//
	// For an introduction to styling with Lip Gloss see:
	// https://github.com/charmbracelet/lipgloss
	PromptStyle      lipgloss.Style
	TextStyle        lipgloss.Style
	BackgroundStyle  lipgloss.Style
	PlaceholderStyle lipgloss.Style
	CursorStyle      lipgloss.Style

	// CharLimit is the maximum amount of characters this input element will
	// accept. If 0 or less, there's no limit.
	CharLimit int

	// Width is the maximum number of characters that can be displayed at once.
	// It essentially treats the text field like a horizontally scrolling
	// viewport. If 0 or less this setting is ignored.
	Width int

	// The ID of this Model as it relates to other textinput Models.
	id int

	// The ID of the blink message we're expecting to receive.
	blinkTag int

	// Underlying text value.
	value []rune

	// focus indicates whether user input focus should be on this input
	// component. When false, ignore keyboard input and hide the cursor.
	focus bool

	// Cursor blink state.
	blink bool

	// Cursor position.
	pos int

	// Used to emulate a viewport when width is set and the content is
	// overflowing.
	offset      int
	offsetRight int

	// Used to manage cursor blink
	blinkCtx *blinkCtx

	// cursorMode determines the behavior of the cursor
	cursorMode CursorMode

	// Validate is a function that checks whether or not the text within the
	// input is valid. If it is not valid, the `Err` field will be set to the
	// error returned by the function. If the function is not defined, all
	// input is considered valid.
	Validate ValidateFunc
}

// New creates a new model with default settings.
func New() Model {
	return Model{
		Prompt:           "> ",
		BlinkSpeed:       defaultBlinkSpeed,
		EchoCharacter:    '*',
		CharLimit:        0,
		PlaceholderStyle: lipgloss.NewStyle().Foreground(lipgloss.Color("240")),

		id:         nextID(),
		value:      nil,
		focus:      false,
		blink:      true,
		pos:        0,
		cursorMode: CursorBlink,

		blinkCtx: &blinkCtx{
			ctx: context.Background(),
		},
	}
}

// NewModel creates a new model with default settings.
//
// Deprecated. Use New instead.
var NewModel = New

// SetValue sets the value of the text input.
func (m *Model) SetValue(s string) {
	if m.Validate != nil {
		if err := m.Validate(s); err != nil {
			m.Err = err
			return
		}
	}

	m.Err = nil

	runes := []rune(s)
	if m.CharLimit > 0 && len(runes) > m.CharLimit {
		m.value = runes[:m.CharLimit]
	} else {
		m.value = runes
	}
	if m.pos == 0 || m.pos > len(m.value) {
		m.setCursor(len(m.value))
	}
	m.handleOverflow()
}

// Value returns the value of the text input.
func (m Model) Value() string {
	return string(m.value)
}

// Cursor returns the cursor position.
func (m Model) Cursor() int {
	return m.pos
}

// Blink returns whether or not to draw the cursor.
func (m Model) Blink() bool {
	return m.blink
}

// SetCursor moves the cursor to the given position. If the position is
// out of bounds the cursor will be moved to the start or end accordingly.
func (m *Model) SetCursor(pos int) {
	m.setCursor(pos)
}

// setCursor moves the cursor to the given position and returns whether or not
// the cursor blink should be reset. If the position is out of bounds the
// cursor will be moved to the start or end accordingly.
func (m *Model) setCursor(pos int) bool {
	m.pos = clamp(pos, 0, len(m.value))
	m.handleOverflow()

	// Show the cursor unless it's been explicitly hidden
	m.blink = m.cursorMode == CursorHide

	// Reset cursor blink if necessary
	return m.cursorMode == CursorBlink
}

// CursorStart moves the cursor to the start of the input field.
func (m *Model) CursorStart() {
	m.cursorStart()
}

// cursorStart moves the cursor to the start of the input field and returns
// whether or not the curosr blink should be reset.
func (m *Model) cursorStart() bool {
	return m.setCursor(0)
}

// CursorEnd moves the cursor to the end of the input field.
func (m *Model) CursorEnd() {
	m.cursorEnd()
}

// CursorMode returns the model's cursor mode. For available cursor modes, see
// type CursorMode.
func (m Model) CursorMode() CursorMode {
	return m.cursorMode
}

// SetCursorMode sets the model's cursor mode. This method returns a command.
//
// For available cursor modes, see type CursorMode.
func (m *Model) SetCursorMode(mode CursorMode) tea.Cmd {
	m.cursorMode = mode
	m.blink = m.cursorMode == CursorHide || !m.focus
	if mode == CursorBlink {
		return Blink
	}
	return nil
}

// cursorEnd moves the cursor to the end of the input field and returns whether
// the cursor should blink should reset.
func (m *Model) cursorEnd() bool {
	return m.setCursor(len(m.value))
}

// Focused returns the focus state on the model.
func (m Model) Focused() bool {
	return m.focus
}

// Focus sets the focus state on the model. When the model is in focus it can
// receive keyboard input and the cursor will be hidden.
func (m *Model) Focus() tea.Cmd {
	m.focus = true
	m.blink = m.cursorMode == CursorHide // show the cursor unless we've explicitly hidden it

	if m.cursorMode == CursorBlink && m.focus {
		return m.blinkCmd()
	}
	return nil
}

// Blur removes the focus state on the model.  When the model is blurred it can
// not receive keyboard input and the cursor will be hidden.
func (m *Model) Blur() {
	m.focus = false
	m.blink = true
}

// Reset sets the input to its default state with no input. Returns whether
// or not the cursor blink should reset.
func (m *Model) Reset() bool {
	m.value = nil
	return m.setCursor(0)
}

// handle a clipboard paste event, if supported. Returns whether or not the
// cursor blink should reset.
func (m *Model) handlePaste(v string) bool {
	paste := []rune(v)

	var availSpace int
	if m.CharLimit > 0 {
		availSpace = m.CharLimit - len(m.value)
	}

	// If the char limit's been reached cancel
	if m.CharLimit > 0 && availSpace <= 0 {
		return false
	}

	// If there's not enough space to paste the whole thing cut the pasted
	// runes down so they'll fit
	if m.CharLimit > 0 && availSpace < len(paste) {
		paste = paste[:len(paste)-availSpace]
	}

	// Stuff before and after the cursor
	head := m.value[:m.pos]
	tailSrc := m.value[m.pos:]
	tail := make([]rune, len(tailSrc))
	copy(tail, tailSrc)

	oldPos := m.pos

	// Insert pasted runes
	for _, r := range paste {
		head = append(head, r)
		m.pos++
		if m.CharLimit > 0 {
			availSpace--
			if availSpace <= 0 {
				break
			}
		}
	}

	// Put it all back together
	value := append(head, tail...)
	m.SetValue(string(value))

	if m.Err != nil {
		m.pos = oldPos
	}

	// Reset blink state if necessary and run overflow checks
	return m.setCursor(m.pos)
}

// If a max width is defined, perform some logic to treat the visible area
// as a horizontally scrolling viewport.
func (m *Model) handleOverflow() {
	if m.Width <= 0 || rw.StringWidth(string(m.value)) <= m.Width {
		m.offset = 0
		m.offsetRight = len(m.value)
		return
	}

	// Correct right offset if we've deleted characters
	m.offsetRight = min(m.offsetRight, len(m.value))

	if m.pos < m.offset {
		m.offset = m.pos

		w := 0
		i := 0
		runes := m.value[m.offset:]

		for i < len(runes) && w <= m.Width {
			w += rw.RuneWidth(runes[i])
			if w <= m.Width+1 {
				i++
			}
		}

		m.offsetRight = m.offset + i
	} else if m.pos >= m.offsetRight {
		m.offsetRight = m.pos

		w := 0
		runes := m.value[:m.offsetRight]
		i := len(runes) - 1

		for i > 0 && w < m.Width {
			w += rw.RuneWidth(runes[i])
			if w <= m.Width {
				i--
			}
		}

		m.offset = m.offsetRight - (len(runes) - 1 - i)
	}
}

// deleteBeforeCursor deletes all text before the cursor. Returns whether or
// not the cursor blink should be reset.
func (m *Model) deleteBeforeCursor() bool {
	m.value = m.value[m.pos:]
	m.offset = 0
	return m.setCursor(0)
}

// deleteAfterCursor deletes all text after the cursor. Returns whether or not
// the cursor blink should be reset. If input is masked delete everything after
// the cursor so as not to reveal word breaks in the masked input.
func (m *Model) deleteAfterCursor() bool {
	m.value = m.value[:m.pos]
	return m.setCursor(len(m.value))
}

// deleteWordLeft deletes the word left to the cursor. Returns whether or not
// the cursor blink should be reset.
func (m *Model) deleteWordLeft() bool {
	if m.pos == 0 || len(m.value) == 0 {
		return false
	}

	if m.EchoMode != EchoNormal {
		return m.deleteBeforeCursor()
	}

	// Linter note: it's critical that we acquire the initial cursor position
	// here prior to altering it via SetCursor() below. As such, moving this
	// call into the corresponding if clause does not apply here.
	oldPos := m.pos //nolint:ifshort

	blink := m.setCursor(m.pos - 1)
	for unicode.IsSpace(m.value[m.pos]) {
		if m.pos <= 0 {
			break
		}
		// ignore series of whitespace before cursor
		blink = m.setCursor(m.pos - 1)
	}

	for m.pos > 0 {
		if !unicode.IsSpace(m.value[m.pos]) {
			blink = m.setCursor(m.pos - 1)
		} else {
			if m.pos > 0 {
				// keep the previous space
				blink = m.setCursor(m.pos + 1)
			}
			break
		}
	}

	if oldPos > len(m.value) {
		m.value = m.value[:m.pos]
	} else {
		m.value = append(m.value[:m.pos], m.value[oldPos:]...)
	}

	return blink
}

// deleteWordRight deletes the word right to the cursor. Returns whether or not
// the cursor blink should be reset. If input is masked delete everything after
// the cursor so as not to reveal word breaks in the masked input.
func (m *Model) deleteWordRight() bool {
	if m.pos >= len(m.value) || len(m.value) == 0 {
		return false
	}

	if m.EchoMode != EchoNormal {
		return m.deleteAfterCursor()
	}

	oldPos := m.pos
	m.setCursor(m.pos + 1)
	for unicode.IsSpace(m.value[m.pos]) {
		// ignore series of whitespace after cursor
		m.setCursor(m.pos + 1)

		if m.pos >= len(m.value) {
			break
		}
	}

	for m.pos < len(m.value) {
		if !unicode.IsSpace(m.value[m.pos]) {
			m.setCursor(m.pos + 1)
		} else {
			break
		}
	}

	if m.pos > len(m.value) {
		m.value = m.value[:oldPos]
	} else {
		m.value = append(m.value[:oldPos], m.value[m.pos:]...)
	}

	return m.setCursor(oldPos)
}

// wordLeft moves the cursor one word to the left. Returns whether or not the
// cursor blink should be reset. If input is masked, move input to the start
// so as not to reveal word breaks in the masked input.
func (m *Model) wordLeft() bool {
	if m.pos == 0 || len(m.value) == 0 {
		return false
	}

	if m.EchoMode != EchoNormal {
		return m.cursorStart()
	}

	blink := false
	i := m.pos - 1
	for i >= 0 {
		if unicode.IsSpace(m.value[i]) {
			blink = m.setCursor(m.pos - 1)
			i--
		} else {
			break
		}
	}

	for i >= 0 {
		if !unicode.IsSpace(m.value[i]) {
			blink = m.setCursor(m.pos - 1)
			i--
		} else {
			break
		}
	}

	return blink
}

// wordRight moves the cursor one word to the right. Returns whether or not the
// cursor blink should be reset. If the input is masked, move input to the end
// so as not to reveal word breaks in the masked input.
func (m *Model) wordRight() bool {
	if m.pos >= len(m.value) || len(m.value) == 0 {
		return false
	}

	if m.EchoMode != EchoNormal {
		return m.cursorEnd()
	}

	blink := false
	i := m.pos
	for i < len(m.value) {
		if unicode.IsSpace(m.value[i]) {
			blink = m.setCursor(m.pos + 1)
			i++
		} else {
			break
		}
	}

	for i < len(m.value) {
		if !unicode.IsSpace(m.value[i]) {
			blink = m.setCursor(m.pos + 1)
			i++
		} else {
			break
		}
	}

	return blink
}

func (m Model) echoTransform(v string) string {
	switch m.EchoMode {
	case EchoPassword:
		return strings.Repeat(string(m.EchoCharacter), rw.StringWidth(v))
	case EchoNone:
		return ""

	default:
		return v
	}
}

// Update is the Bubble Tea update loop.
func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
	if !m.focus {
		m.blink = true
		return m, nil
	}

	var resetBlink bool

	switch msg := msg.(type) {
	case tea.KeyMsg:
		switch msg.Type {
		case tea.KeyBackspace: // delete character before cursor
			m.Err = nil

			if msg.Alt {
				resetBlink = m.deleteWordLeft()
			} else {
				if len(m.value) > 0 {
					m.value = append(m.value[:max(0, m.pos-1)], m.value[m.pos:]...)
					if m.pos > 0 {
						resetBlink = m.setCursor(m.pos - 1)
					}
				}
			}
		case tea.KeyLeft, tea.KeyCtrlB:
			if msg.Alt { // alt+left arrow, back one word
				resetBlink = m.wordLeft()
				break
			}
			if m.pos > 0 { // left arrow, ^F, back one character
				resetBlink = m.setCursor(m.pos - 1)
			}
		case tea.KeyRight, tea.KeyCtrlF:
			if msg.Alt { // alt+right arrow, forward one word
				resetBlink = m.wordRight()
				break
			}
			if m.pos < len(m.value) { // right arrow, ^F, forward one character
				resetBlink = m.setCursor(m.pos + 1)
			}
		case tea.KeyCtrlW: // ^W, delete word left of cursor
			resetBlink = m.deleteWordLeft()
		case tea.KeyHome, tea.KeyCtrlA: // ^A, go to beginning
			resetBlink = m.cursorStart()
		case tea.KeyDelete, tea.KeyCtrlD: // ^D, delete char under cursor
			if len(m.value) > 0 && m.pos < len(m.value) {
				m.value = append(m.value[:m.pos], m.value[m.pos+1:]...)
			}
		case tea.KeyCtrlE, tea.KeyEnd: // ^E, go to end
			resetBlink = m.cursorEnd()
		case tea.KeyCtrlK: // ^K, kill text after cursor
			resetBlink = m.deleteAfterCursor()
		case tea.KeyCtrlU: // ^U, kill text before cursor
			resetBlink = m.deleteBeforeCursor()
		case tea.KeyCtrlV: // ^V paste
			return m, Paste
		case tea.KeyRunes, tea.KeySpace: // input regular characters
			if msg.Alt && len(msg.Runes) == 1 {
				if msg.Runes[0] == 'd' { // alt+d, delete word right of cursor
					resetBlink = m.deleteWordRight()
					break
				}
				if msg.Runes[0] == 'b' { // alt+b, back one word
					resetBlink = m.wordLeft()
					break
				}
				if msg.Runes[0] == 'f' { // alt+f, forward one word
					resetBlink = m.wordRight()
					break
				}
			}

			// Input a regular character
			if m.CharLimit <= 0 || len(m.value) < m.CharLimit {
				runes := msg.Runes

				value := make([]rune, len(m.value))
				copy(value, m.value)
				value = append(value[:m.pos], append(runes, value[m.pos:]...)...)
				m.SetValue(string(value))
				if m.Err == nil {
					resetBlink = m.setCursor(m.pos + len(runes))
				}
			}
		}

	case initialBlinkMsg:
		// We accept all initialBlinkMsgs genrated by the Blink command.

		if m.cursorMode != CursorBlink || !m.focus {
			return m, nil
		}

		cmd := m.blinkCmd()
		return m, cmd

	case blinkMsg:
		// We're choosy about whether to accept blinkMsgs so that our cursor
		// only exactly when it should.

		// Is this model blinkable?
		if m.cursorMode != CursorBlink || !m.focus {
			return m, nil
		}

		// Were we expecting this blink message?
		if msg.id != m.id || msg.tag != m.blinkTag {
			return m, nil
		}

		var cmd tea.Cmd
		if m.cursorMode == CursorBlink {
			m.blink = !m.blink
			cmd = m.blinkCmd()
		}
		return m, cmd

	case blinkCanceled: // no-op
		return m, nil

	case pasteMsg:
		resetBlink = m.handlePaste(string(msg))

	case pasteErrMsg:
		m.Err = msg
	}

	var cmd tea.Cmd
	if resetBlink {
		cmd = m.blinkCmd()
	}

	m.handleOverflow()
	return m, cmd
}

// View renders the textinput in its current state.
func (m Model) View() string {
	// Placeholder text
	if len(m.value) == 0 && m.Placeholder != "" {
		return m.placeholderView()
	}

	styleText := m.TextStyle.Inline(true).Render

	value := m.value[m.offset:m.offsetRight]
	pos := max(0, m.pos-m.offset)
	v := styleText(m.echoTransform(string(value[:pos])))

	if pos < len(value) {
		v += m.cursorView(m.echoTransform(string(value[pos]))) // cursor and text under it
		v += styleText(m.echoTransform(string(value[pos+1:]))) // text after cursor
	} else {
		v += m.cursorView(" ")
	}

	// If a max width and background color were set fill the empty spaces with
	// the background color.
	valWidth := rw.StringWidth(string(value))
	if m.Width > 0 && valWidth <= m.Width {
		padding := max(0, m.Width-valWidth)
		if valWidth+padding <= m.Width && pos < len(value) {
			padding++
		}
		v += styleText(strings.Repeat(" ", padding))
	}

	return m.PromptStyle.Render(m.Prompt) + v
}

// placeholderView returns the prompt and placeholder view, if any.
func (m Model) placeholderView() string {
	var (
		v     string
		p     = m.Placeholder
		style = m.PlaceholderStyle.Inline(true).Render
	)

	// Cursor
	if m.blink {
		v += m.cursorView(style(p[:1]))
	} else {
		v += m.cursorView(p[:1])
	}

	// The rest of the placeholder text
	v += style(p[1:])

	return m.PromptStyle.Render(m.Prompt) + v
}

// cursorView styles the cursor.
func (m Model) cursorView(v string) string {
	if m.blink {
		return m.TextStyle.Render(v)
	}
	return m.CursorStyle.Inline(true).Reverse(true).Render(v)
}

// blinkCmd is an internal command used to manage cursor blinking.
func (m *Model) blinkCmd() tea.Cmd {
	if m.cursorMode != CursorBlink {
		return nil
	}

	if m.blinkCtx != nil && m.blinkCtx.cancel != nil {
		m.blinkCtx.cancel()
	}

	ctx, cancel := context.WithTimeout(m.blinkCtx.ctx, m.BlinkSpeed)
	m.blinkCtx.cancel = cancel

	m.blinkTag++

	return func() tea.Msg {
		defer cancel()
		<-ctx.Done()
		if ctx.Err() == context.DeadlineExceeded {
			return blinkMsg{id: m.id, tag: m.blinkTag}
		}
		return blinkCanceled{}
	}
}

// Blink is a command used to initialize cursor blinking.
func Blink() tea.Msg {
	return initialBlinkMsg{}
}

// Paste is a command for pasting from the clipboard into the text input.
func Paste() tea.Msg {
	str, err := clipboard.ReadAll()
	if err != nil {
		return pasteErrMsg{err}
	}
	return pasteMsg(str)
}

func clamp(v, low, high int) int {
	if high < low {
		low, high = high, low
	}
	return min(high, max(low, v))
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


text:
<decorators defaultdir="/decorators">
    <excludes>
        <pattern>/resources/*</pattern>
    </excludes>
    <decorator name="medium_onecolumn" page="medium_onecolumn.jsp">
        <pattern>/*</pattern>
    </decorator>
    <decorator name="medium_twocolumn" page="medium_twocolumn.jsp">
        <pattern>/editOptionValue.*</pattern>
    </decorator>
    <decorator name="default" page="default.jsp">
        <pattern>/someotherpattern</pattern>
    </decorator>
</decorators>


text:
package com.netflix.spectator.controllers.model;

import com.netflix.spectator.api.Measurement;
import com.netflix.spectator.api.Tag;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
 * A collection of DataPoint instances for a common set of Tags.
 *
 * This is only public for testing purposes so implements equals but not hash.
 */
public class TaggedDataPoints {
  private static class JacksonableTag implements Tag {
    private final String key;
    private final String value;

    JacksonableTag(Tag tag) {
      key = tag.key();
      value = tag.value();
    }

    @Override public String key() {
      return key;
    }
    @Override public String value() {
      return value;
    }
    public String getKey() {
      return key;
    }
    public String getValue() {
      return value;
    }

    @Override public int hashCode() {
      return Objects.hash(key, value);
    }

    @Override public boolean equals(Object obj) {
      if (obj == this) return true;
      if (!(obj instanceof Tag)) return false;

      Tag tag = (Tag) obj;
      return key.equals(tag.key()) && value.equals(tag.value());
    }

    @Override public String toString() {
      return key + "=" + value;
    }

    static List<Tag> convertTags(Iterable<Tag> iterable) {
      ArrayList<Tag> result = new ArrayList<>();
      for (Tag tag : iterable) {
        result.add(new JacksonableTag(tag));
      }
      return result;
    }
  }

  /**
   * The tag bindings for the values.
   */
  public Iterable<Tag> getTags() {
    return tags;
  }

  /**
   * The current values.
   */
  public Iterable<DataPoint> getValues() {
    return dataPoints;
  }

  /**
   * Constructor from a single measurement data point.
   */
  public TaggedDataPoints(Measurement measurement) {
    tags = JacksonableTag.convertTags(measurement.id().tags());
    dataPoints = Collections.singletonList(DataPoint.make(measurement));
  }

  /**
   * Constructor from a list of data points (for testing).
   */
  public TaggedDataPoints(Iterable<Tag> tags, List<DataPoint> dataPoints) {
    this.tags = JacksonableTag.convertTags(tags);
    this.dataPoints = dataPoints;
  }

  @Override
  public String toString() {
    return String.format("{TAGS={%s} DATA={%s}", tags, dataPoints);
  }

  @Override
  public boolean equals(Object obj) {
    if (!(obj instanceof TaggedDataPoints)) return false;
    TaggedDataPoints other = (TaggedDataPoints) obj;
    return tags.equals(other.tags) && dataPoints.equals(other.dataPoints);
  }

  @Override
  public int hashCode() {
    return Objects.hash(tags, dataPoints);
  }

  private final List<Tag> tags;
  private final List<DataPoint> dataPoints;
}


text:
namespace znajdzwc.Geocode
{
	public class Geometry
	{
		public Bounds bounds { get; set; }
		public Location location { get; set; }
		public string location_type { get; set; }
		public Viewport viewport { get; set; }
	}
}


text:
package net.lospi.juno.estimation.proposal.ccp.delete;

import net.lospi.juno.elements.Chain;
import net.lospi.juno.estimation.proposal.ChainSegment;
import net.lospi.juno.estimation.proposal.ChainSegmentDeepCopier;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@Test(groups="unit")
public class CcpDeletionChainSegmentReplacementGeneratorTest {
    private ChainSegmentDeepCopier chainSegmentDeepCopier;
    private ChainSegment replacement, expected;
    private Chain state;
    private int start, end;

    @BeforeMethod
    public void setUp() throws Exception {
        chainSegmentDeepCopier = mock(ChainSegmentDeepCopier.class);
        replacement = mock(ChainSegment.class);
        expected = mock(ChainSegment.class);
        state = mock(Chain.class);
        start = 4;
        end = 8;

        when(state.segment(start + 1, end - 1)).thenReturn(replacement);
        when(chainSegmentDeepCopier.copy(replacement)).thenReturn(expected);
    }

    public void testGenerate() throws Exception {
        CcpDeletionChainSegmentReplacementGenerator generator = new CcpDeletionChainSegmentReplacementGenerator(chainSegmentDeepCopier);
        ChainSegment result = generator.generate(state, start, end);
        assertThat(result).isEqualTo(expected);
    }

    @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Your indices must preserve ordering \\(end > start\\).")
    public void throwsWhenIndicesSame() throws Exception {
        CcpDeletionChainSegmentReplacementGenerator generator = new CcpDeletionChainSegmentReplacementGenerator(chainSegmentDeepCopier);
        generator.generate(state, 2, 2);
    }

    @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Your indices must preserve ordering \\(end > start\\).")
    public void throwsWhenIndicesNotOrdered() throws Exception {
        CcpDeletionChainSegmentReplacementGenerator generator = new CcpDeletionChainSegmentReplacementGenerator(chainSegmentDeepCopier);
        generator.generate(state, 3, 2);
    }
}


text:
/*
 * Copyright (c) 2003, Arjuna Technologies Limited.
 *
 * $Id: TestSystemExceptionBusinessActivityTerminator.java,v 1.3.20.1 2005/11/22 10:37:40 kconner Exp $
 */

package com.arjuna.wst.tests;

import com.arjuna.wst11.BusinessActivityTerminator;
import com.arjuna.wst.SystemException;
import com.arjuna.wst.TransactionRolledBackException;
import com.arjuna.wst.UnknownTransactionException;

import javax.xml.ws.wsaddressing.W3CEndpointReference;

public class TestSystemExceptionBusinessActivityTerminator implements BusinessActivityTerminator
{
    public TestSystemExceptionBusinessActivityTerminator(W3CEndpointReference endpointReference)
    {
        this.endpointReference = endpointReference;
    }

    public void close ()
        throws TransactionRolledBackException, UnknownTransactionException, SystemException
    {
        throw new SystemException();
    }

    public void cancel ()
        throws UnknownTransactionException, SystemException
    {
        throw new SystemException();
    }

    public void complete ()
        throws UnknownTransactionException, SystemException
    {
        throw new SystemException();
    }

    public W3CEndpointReference getEndpoint() {
        return endpointReference;
    }

    private W3CEndpointReference endpointReference;
}


text:
require 'spec_helper'
require 'lol/dynamic_model'

include Lol

describe DynamicModel do
  shared_examples 'enables date parsing' do
    let(:timestamp_value) { 1423243755000 }
    subject { DynamicModel.new attribute => timestamp_value}
    let(:attribute_value) { subject.send attribute }

    it 'and casts the value to Time' do
      expect(attribute_value).to be_a Time
    end

    it 'and divides the number by 1000' do
      expect(attribute_value.to_i).to eq timestamp_value / 1000
    end

    it 'and ignores casting when the value is not an integer' do
      subject = DynamicModel.new attribute => 'foo bar'
      expect(subject.send attribute).not_to be_a Time
    end
  end

  context 'when is not initialized with an hash' do
    subject { DynamicModel.new 'not enumerable data' }

    it 'raises an argument error' do
      expect{ subject }.to raise_error ArgumentError, 'An hash is required as parameter'
    end
  end

  context 'when initialized with hash' do
    subject { DynamicModel.new key: 'value' }

    it 'does not raise error' do
      expect { subject }.not_to raise_error
    end

    it 'defines a method per each argument key' do
      expect(subject).to respond_to(:key)
    end
  end

  %w(date at).each do |attr_name|
    context "when an hash key is called '#{attr_name}'" do
      it_behaves_like 'enables date parsing' do
        let(:attribute) { attr_name }
      end
    end

    context "when an hash key ends with '_#{attr_name}'" do
      it_behaves_like 'enables date parsing' do
        let(:attribute) { "a2342_#{attr_name}"}
      end
    end
  end

  context "when an hash value is an array" do
    it 'preserves the array' do
      subject = DynamicModel.new foo: ['foo']
      expect(subject.foo).to eq ['foo']
    end

    context 'and one or more array items are hashes' do
      subject { DynamicModel.new foo: [{}] }

      it 'casts each hash to another DynamicModel instance' do
        expect(subject.foo.map(&:class).uniq).to eq [DynamicModel]
      end
    end
  end
end