View Javadoc

1   /*
2    * #%L
3    * prolobjectlink-jpi-jpl-yap
4    * %%
5    * Copyright (C) 2019 Prolobjectlink Project
6    * %%
7    * This program is free software: you can redistribute it and/or modify
8    * it under the terms of the GNU Lesser General Public License as
9    * published by the Free Software Foundation, either version 2.1 of the
10   * License, or (at your option) any later version.
11   * 
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Lesser Public License for more details.
16   * 
17   * You should have received a copy of the GNU General Lesser Public
18   * License along with this program.  If not, see
19   * <http://www.gnu.org/licenses/lgpl-2.1.html>.
20   * #L%
21   */
22  package io.github.prolobjectlink.prolog.jpl.yap;
23  
24  import io.github.prolobjectlink.prolog.PrologConverter;
25  import io.github.prolobjectlink.prolog.PrologEngine;
26  import io.github.prolobjectlink.prolog.PrologJavaConverter;
27  import io.github.prolobjectlink.prolog.PrologProvider;
28  import io.github.prolobjectlink.prolog.jpl.JplProvider;
29  import jpl.Term;
30  
31  /**
32   * 
33   * @author Jose Zalacain
34   * @since 1.0
35   */
36  public class YapProlog extends JplProvider implements PrologProvider {
37  
38  	public YapProlog() {
39  		super(new YapPrologConverter());
40  	}
41  
42  	YapProlog(PrologConverter<Term> converter) {
43  		super(converter);
44  	}
45  
46  	public PrologJavaConverter getJavaConverter() {
47  		return new YapPrologJavaConverter(this);
48  	}
49  
50  	public PrologEngine newEngine() {
51  		return new YapPrologEngine(this);
52  	}
53  
54  	public PrologEngine newEngine(String path) {
55  		PrologEngine engine = newEngine();
56  		engine.consult(path);
57  		return engine;
58  	}
59  
60  	@Override
61  	public String toString() {
62  		return "YapProlog [converter=" + converter + "]";
63  	}
64  
65  }