<commit_before>/*
 * Copyright 2017, <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.fkeglevich.rawdumper.camera.feature;

import com.fkeglevich.rawdumper.camera.async.CameraContext;
import com.fkeglevich.rawdumper.camera.data.CaptureSize;
import com.fkeglevich.rawdumper.camera.data.Ev;
import com.fkeglevich.rawdumper.camera.data.Flash;
import com.fkeglevich.rawdumper.camera.data.Iso;
import com.fkeglevich.rawdumper.camera.data.ShutterSpeed;
import com.fkeglevich.rawdumper.camera.parameter.ParameterCollection;
import com.fkeglevich.rawdumper.util.Nullable;

import java.util.ArrayList;
import java.util.List;

/**
 * TODO: Add class header
 * <p>
 * Created by <NAME> on 04/10/17.
 */

public class FeatureRecyclerFactory
{
    private final List<Feature> registeredFeatures = new ArrayList<>();
    private final CameraContext cameraContext;
    private final ParameterCollection parameterCollection;

    public FeatureRecyclerFactory(CameraContext cameraContext, ParameterCollection parameterCollection)
    {
        this.cameraContext = cameraContext;
        this.parameterCollection = parameterCollection;
    }

    private void registerFeature(Feature feature)
    {
        registeredFeatures.add(feature);
    }

    public void cleanUpAllFeatures()
    {
        for (Feature feature : registeredFeatures)
            Feature.clearEventDispatchers(feature);

        registeredFeatures.clear();
    }

    public WritableFeature<Iso, List<Iso>> createIsoFeature()
    {
        IsoFeature result = IsoFeature.create(cameraContext.getCameraInfo().getExposure(), parameterCollection);
        registerFeature(result);
        return result;
    }

    public Feature<Nullable<Iso>> createIsoMeteringFeature()
    {
        IsoMeteringFeature result = new IsoMeteringFeature(parameterCollection);
        registerFeature(result);
        return result;
    }

    public WritableFeature<ShutterSpeed, List<ShutterSpeed>> createShutterSpeedFeature()
    {
        ShutterSpeedFeature result = ShutterSpeedFeature.create(cameraContext.getCameraInfo().getExposure(), parameterCollection);
        registerFeature(result);
        return result;
    }

    public Feature<Nullable<ShutterSpeed>> createSSMeteringFeature()
    {
        SSMeteringFeature result = new SSMeteringFeature(parameterCollection);
        registerFeature(result);
        return result;
    }

    public WritableFeature<Ev, List<Ev>> createEVFeature()
    {
        EvFeature result = EvFeature.create(parameterCollection);
        registerFeature(result);
        return result;
    }

    public WritableFeature<Flash, List<Flash>> createFlashFeature()
    {
        FlashFeature result = new FlashFeature(parameterCollection);
        registerFeature(result);
        return result;
    }

    public Feature<CaptureSize> createPreviewFeature()
    {
        PreviewFeature result = new PreviewFeature(parameterCollection);
        registerFeature(result);
        return result;
    }
}
<commit_msg>Updated the feature factory with the camera actions<commit_after>/*
 * Copyright 2017, <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.fkeglevich.rawdumper.camera.feature;

import com.fkeglevich.rawdumper.camera.action.CameraActions;
import com.fkeglevich.rawdumper.camera.async.CameraContext;
import com.fkeglevich.rawdumper.camera.data.CaptureSize;
import com.fkeglevich.rawdumper.camera.data.Ev;
import com.fkeglevich.rawdumper.camera.data.Flash;
import com.fkeglevich.rawdumper.camera.data.Iso;
import com.fkeglevich.rawdumper.camera.data.ShutterSpeed;
import com.fkeglevich.rawdumper.camera.parameter.ParameterCollection;
import com.fkeglevich.rawdumper.util.Nullable;

import java.util.ArrayList;
import java.util.List;

/**
 * TODO: Add class header
 * <p>
 * Created by <NAME> on 04/10/17.
 */

public class FeatureRecyclerFactory
{
    private final List<Feature> registeredFeatures = new ArrayList<>();
    private final CameraContext cameraContext;
    private final ParameterCollection parameterCollection;
    private final CameraActions cameraActions;

    public FeatureRecyclerFactory(CameraContext cameraContext,
                                  ParameterCollection parameterCollection,
                                  CameraActions cameraActions)
    {
        this.cameraContext = cameraContext;
        this.parameterCollection = parameterCollection;
        this.cameraActions = cameraActions;
    }

    private void registerFeature(Feature feature)
    {
        registeredFeatures.add(feature);
    }

    public void cleanUpAllFeatures()
    {
        for (Feature feature : registeredFeatures)
            Feature.clearEventDispatchers(feature);

        registeredFeatures.clear();
    }

    public WritableFeature<Iso, List<Iso>> createIsoFeature()
    {
        IsoFeature result = IsoFeature.create(cameraContext.getCameraInfo().getExposure(), parameterCollection);
        registerFeature(result);
        return result;
    }

    public Feature<Nullable<Iso>> createIsoMeteringFeature()
    {
        IsoMeteringFeature result = new IsoMeteringFeature(parameterCollection);
        registerFeature(result);
        return result;
    }

    public WritableFeature<ShutterSpeed, List<ShutterSpeed>> createShutterSpeedFeature()
    {
        ShutterSpeedFeature result = ShutterSpeedFeature.create(cameraContext.getCameraInfo().getExposure(), parameterCollection);
        registerFeature(result);
        return result;
    }

    public Feature<Nullable<ShutterSpeed>> createSSMeteringFeature()
    {
        SSMeteringFeature result = new SSMeteringFeature(parameterCollection);
        registerFeature(result);
        return result;
    }

    public WritableFeature<Ev, List<Ev>> createEVFeature()
    {
        EvFeature result = EvFeature.create(parameterCollection);
        registerFeature(result);
        return result;
    }

    public WritableFeature<Flash, List<Flash>> createFlashFeature()
    {
        FlashFeature result = new FlashFeature(parameterCollection);
        registerFeature(result);
        return result;
    }

    public Feature<CaptureSize> createPreviewFeature()
    {
        PreviewFeature result = new PreviewFeature(parameterCollection);
        registerFeature(result);
        return result;
    }

    public FocusFeature createFocusFeature()
    {
        FocusFeature result = new FocusFeature(parameterCollection, cameraActions);
        registerFeature(result);
        return result;
    }
}

{'fraction_non_alphanumeric': 0.0822826808228268, 'fraction_numerical': 0.0037159920371599205, 'mean_word_length': 3.5672727272727274, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1797330', 'n_tokens_mistral': 2017, 'n_tokens_neox': 1957, 'n_words': 482}