All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.expleague.ml.io.JoinedBinClassModelConversionPack Maven / Gradle / Ivy

There is a newer version: 1.4.9
Show newest version
package com.expleague.ml.io;

import com.expleague.commons.func.types.ConversionPack;
import com.expleague.commons.func.types.ConversionDependant;
import com.expleague.commons.func.types.ConversionRepository;
import com.expleague.commons.func.types.TypeConverter;
import com.expleague.ml.func.FuncJoin;
import com.expleague.ml.models.multiclass.JoinedBinClassModel;

/**
 * User: qdeee
 * Date: 03.04.15
 */
public class JoinedBinClassModelConversionPack implements ConversionPack {
  public static class To implements TypeConverter, ConversionDependant {
    private ConversionRepository repository;

    @Override
    public CharSequence convert(final JoinedBinClassModel from) {
      final FuncJoin internModel = from.getInternModel();
      return repository.convert(internModel, CharSequence.class);
    }

    @Override
    public void setConversionRepository(final ConversionRepository repository) {
      this.repository = repository;
    }

  }
  public static class From implements TypeConverter, ConversionDependant {
    private ConversionRepository repository;

    @Override
    public JoinedBinClassModel convert(final CharSequence from) {
      final FuncJoin internModel = repository.convert(from, FuncJoin.class);
      return new JoinedBinClassModel(internModel);
    }

    @Override
    public void setConversionRepository(final ConversionRepository repository) {
      this.repository = repository;
    }
  }

  @Override
  public Class to() {
    return To.class;
  }

  @Override
  public Class from() {
    return From.class;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy