com.anrisoftware.fractions.mod3.Mod3FractionsModule Maven / Gradle / Ivy
/*
* Copyright 2012-2015 Erwin Müller
*
* This file is part of fractions-integer.
*
* fractions-integer is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* fractions-integer is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* fractions-integer. If not, see .
*/
package com.anrisoftware.fractions.mod3;
import com.anrisoftware.fractions.core.ContinuedFraction;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
/**
* Installs the mod3 continued fraction factory. The factory is used with Guice.
*
*
* injector = Guice.createInjector(new Mod3FractionsModule());
* factory = injector.getInstance(Mod3FractionFactory.class);
* fraction = factory.fromValue(value, 9);
*
*
* @see Mod3FractionFactory
*
* @author Erwin Mueller, [email protected]
* @since 2.0
*/
public class Mod3FractionsModule extends AbstractModule {
@Override
protected void configure() {
install(new FactoryModuleBuilder().implement(ContinuedFraction.class,
Mod3Fraction.class).build(Mod3FractionFactory.class));
}
}