<commit_before>/*******************************************************************************
 * This file is part of TERMINAL RECALL
 * Copyright (c) 2016 <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.ext.tr;

import org.jtrfp.trcl.core.Feature;
import org.jtrfp.trcl.core.FeatureFactory;
import org.jtrfp.trcl.core.Features;
import org.jtrfp.trcl.core.TRFactory.TR;
import org.jtrfp.trcl.core.ThreadManager;
import org.jtrfp.trcl.ext.tr.ThreadManagerFactory.ThreadManagerFeature;
import org.jtrfp.trcl.gpu.GPU;
import org.jtrfp.trcl.gui.ReporterFactory.Reporter;
import org.jtrfp.trcl.gui.RootWindowFactory.RootWindow;
import org.springframework.stereotype.Component;

@Component
public class GPUFactory implements FeatureFactory<TR> {
 public static class GPUFeature extends GPU implements Feature<TR> {

    public GPUFeature() {
	super();
    }

    @Override
    public void apply(TR target) {
	final RootWindow rootWindow = Features.get(target, RootWindow.class);
	final ThreadManager threadManager = Features.get(target, ThreadManagerFeature.class);
	setReporter(Features.get(target, Reporter.class));
	setThreadManager(threadManager);
	setGlExecutor(threadManager);
	setCanvas(rootWindow.getCanvas());
	setUncaughtExceptionHandler(target);
	setWorld(target.getWorld());
	setExecutorService(threadManager.threadPool);
	initialize();
    }//end apply(...)

    @Override
    public void destruct(TR target) {
	// TODO Auto-generated method stub
	
    }
 }//end GPUFeature

@Override
public Feature<TR> newInstance(TR target) {
    return new GPUFeature();
}//end newInstance(target)

@Override
public Class<TR> getTargetClass() {
    return TR.class;
}

@Override
public Class<? extends Feature> getFeatureClass() {
    return GPUFeature.class;
}
}//end GPUFactory<commit_msg>⎘Poss. dependency loop in GPUFactory.<commit_after>/*******************************************************************************
 * This file is part of TERMINAL RECALL
 * Copyright (c) 2016 <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.ext.tr;

import javax.media.opengl.awt.GLCanvas;

import org.jtrfp.trcl.core.Feature;
import org.jtrfp.trcl.core.FeatureFactory;
import org.jtrfp.trcl.core.Features;
import org.jtrfp.trcl.core.TRFactory.TR;
import org.jtrfp.trcl.core.ThreadManager;
import org.jtrfp.trcl.ext.tr.ThreadManagerFactory.ThreadManagerFeature;
import org.jtrfp.trcl.gpu.GPU;
import org.jtrfp.trcl.gui.ReporterFactory.Reporter;
import org.jtrfp.trcl.gui.RootWindowFactory.RootWindow;
import org.springframework.stereotype.Component;

@Component
public class GPUFactory implements FeatureFactory<TR> {
 public static class GPUFeature extends GPU implements Feature<TR> {

    public GPUFeature() {
	super();
    }

    @Override
    public void apply(TR target) {
	final RootWindow rootWindow = Features.get(target, RootWindow.class);
	final GLCanvas canvas = rootWindow.getCanvas();
	assert canvas != null;
	setCanvas(canvas);
	final ThreadManager threadManager = Features.get(target, ThreadManagerFeature.class);
	setThreadManager(threadManager);
	setGlExecutor(threadManager);
	setUncaughtExceptionHandler(target);
	setWorld(target.getWorld());
	setExecutorService(threadManager.threadPool);
	setReporter(Features.get(target, Reporter.class));
	initialize();
    }//end apply(...)

    @Override
    public void destruct(TR target) {
	// TODO Auto-generated method stub
	
    }
 }//end GPUFeature

@Override
public Feature<TR> newInstance(TR target) {
    return new GPUFeature();
}//end newInstance(target)

@Override
public Class<TR> getTargetClass() {
    return TR.class;
}

@Override
public Class<? extends Feature> getFeatureClass() {
    return GPUFeature.class;
}
}//end GPUFactory
{'fraction_non_alphanumeric': 0.16829702089817697, 'fraction_numerical': 0.0026678523788350376, 'mean_word_length': 5.171467764060357, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '1080911', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1273, 'n_words': 322}