MinieLibrary/src/main/java/com/jme3/bullet/animation/RagUtils.java
/**
     * Validate a Skeleton for use with DynamicAnimControl.
     *
     * @param skeleton the Skeleton to validate (not null, unaffected)
     */
Validate a Skeleton for use with DynamicAnimControl.

@param skeleton the Skeleton to validate (not null, unaffected)
Validate a Skeleton for use with DynamicAnimControl . @param skeleton the Skeleton to validate ( not null unaffected )
public static void validate(Skeleton skeleton) {
        int numBones = skeleton.getBoneCount();
        if (numBones < 0) {
            throw new IllegalArgumentException("Bone count is negative!");
        }
        Set<String> nameSet = new TreeSet<>();
        for (int boneIndex = 0; boneIndex < numBones; ++boneIndex) {
            Bone bone = skeleton.getBone(boneIndex);
            if (bone == null) {
                String msg = String.format("Bone %d in skeleton is null!",
                        boneIndex);
                throw new IllegalArgumentException(msg);
            }
            String boneName = bone.getName();
            if (boneName == null) {
                String msg = String.format("Bone %d in skeleton has null name!",
                        boneIndex);
                throw new IllegalArgumentException(msg);
            } else if (boneName.equals(DynamicAnimControl.torsoName)) {
                String msg = String.format(
                        "Bone %d in skeleton has a reserved name!",
                        boneIndex);
                throw new IllegalArgumentException(msg);
            } else if (nameSet.contains(boneName)) {
                String msg = "Duplicate bone name in skeleton: "
                        + MyString.quote(boneName);
                throw new IllegalArgumentException(msg);
            }
            nameSet.add(boneName);
        }
    }
public static void validate ( Skeleton skeleton ) { int numBones = skeleton . getBoneCount ( ) ; if ( numBones < 0 ) { throw new IllegalArgumentException ( "Bone count is negative!" ) ; } Set < String > nameSet = new TreeSet < > ( ) ; for ( int boneIndex = 0 ; boneIndex < numBones ; ++ boneIndex ) { Bone bone = skeleton . getBone ( boneIndex ) ; if ( bone == null ) { String msg = String . format ( "Bone %d in skeleton is null!" , boneIndex ) ; throw new IllegalArgumentException ( msg ) ; } String boneName = bone . getName ( ) ; if ( boneName == null ) { String msg = String . format ( "Bone %d in skeleton has null name!" , boneIndex ) ; throw new IllegalArgumentException ( msg ) ; } else if ( boneName . equals ( DynamicAnimControl . torsoName ) ) { String msg = String . format ( "Bone %d in skeleton has a reserved name!" , boneIndex ) ; throw new IllegalArgumentException ( msg ) ; } else if ( nameSet . contains ( boneName ) ) { String msg = "Duplicate bone name in skeleton: " + MyString . quote ( boneName ) ; throw new IllegalArgumentException ( msg ) ; } nameSet . add ( boneName ) ; } }
Validate a Skeleton for use with DynamicAnimControl.
Validate a Skeleton for use with DynamicAnimControl .