<commit_before>/*******************************************************************************
 * This file is part of TERMINAL RECALL
 * Copyright (c) 2012-2014 <NAME>
 * Part of the jTRFP.org project
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     chuck - initial API and implementation
 ******************************************************************************/
package org.jtrfp.trcl.beh;

import java.lang.ref.WeakReference;

import org.jtrfp.trcl.AbstractSubmitter;
import org.jtrfp.trcl.Submitter;
import org.jtrfp.trcl.core.TR;
import org.jtrfp.trcl.obj.DEFObject;
import org.jtrfp.trcl.obj.WorldObject;

public class CollidesWithDEFObjects extends Behavior implements CollisionBehavior {
    private final double boundingRadius;
    private WeakReference<DEFObject> otherDEF;
    public CollidesWithDEFObjects(double boundingRadius){
	this.boundingRadius=boundingRadius;
    }
    @Override
    public void proposeCollision(WorldObject other){
	if(other instanceof DEFObject){
	    final double distance=TR.twosComplimentDistance(
		    other.getPositionWithOffset(), 
		    getParent().getPositionWithOffset());
	    otherDEF=new WeakReference<DEFObject>((DEFObject)other);
	    if(distance<(boundingRadius+otherDEF.get().getModel().getTriangleList().getMaximumVertexValue())){
		getParent().probeForBehaviors(sub, DEFObjectCollisionListener.class);
	    }
	}//end if(DEFObject)
    }//end _proposeCollision()
    <commit_msg>Refactor to use Model.getMaximumVertexValue(). Affects #119.<commit_after>/*******************************************************************************
 * This file is part of TERMINAL RECALL
 * Copyright (c) 2012-2014 <NAME>
 * Part of the jTRFP.org project
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     chuck - initial API and implementation
 ******************************************************************************/
package org.jtrfp.trcl.beh;

import java.lang.ref.WeakReference;

import org.jtrfp.trcl.AbstractSubmitter;
import org.jtrfp.trcl.Submitter;
import org.jtrfp.trcl.core.TR;
import org.jtrfp.trcl.obj.DEFObject;
import org.jtrfp.trcl.obj.WorldObject;

public class CollidesWithDEFObjects extends Behavior implements CollisionBehavior {
    private final double boundingRadius;
    private WeakReference<DEFObject> otherDEF;
    public CollidesWithDEFObjects(double boundingRadius){
	this.boundingRadius=boundingRadius;
    }
    @Override
    public void proposeCollision(WorldObject other){
	if(other instanceof DEFObject){
	    final double distance=TR.twosComplimentDistance(
		    other.getPositionWithOffset(), 
		    getParent().getPositionWithOffset());
	    otherDEF=new WeakReference<DEFObject>((DEFObject)other);
	    final double maxVtx = otherDEF.get().getModel().getMaximumVertexValue();
	    if(distance<(boundingRadius+maxVtx)){
		getParent().probeForBehaviors(sub, DEFObjectCollisionListener.class);
	    }
	}//end if(DEFObject)
    }//end _proposeCollision()
    
{'fraction_non_alphanumeric': 0.1794795978710822, 'fraction_numerical': 0.006800709639266706, 'mean_word_length': 5.21875, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3520749', 'n_tokens_mistral': 980, 'n_tokens_neox': 907, 'n_words': 223}