View Javadoc

1   /*
2    * #%L
3    * prolobjectlink-jpi-jpl7-swi7
4    * %%
5    * Copyright (C) 2019 Prolobjectlink Project
6    * %%
7    * Redistribution and use in source and binary forms, with or without modification,
8    * are permitted provided that the following conditions are met:
9    * 
10   * 1. Redistributions of source code must retain the above copyright notice, this
11   *    list of conditions and the following disclaimer.
12   * 
13   * 2. Redistributions in binary form must reproduce the above copyright notice,
14   *    this list of conditions and the following disclaimer in the documentation
15   *    and/or other materials provided with the distribution.
16   * 
17   * 3. Neither the name of the Prolobjectlink Project nor the names of its contributors
18   *    may be used to endorse or promote products derived from this software without
19   *    specific prior written permission.
20   * 
21   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23   * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24   * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26   * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28   * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
29   * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30   * OF THE POSSIBILITY OF SUCH DAMAGE.
31   * #L%
32   */
33  package io.github.prolobjectlink.prolog.jpl7.swi7;
34  
35  import org.jpl7.Term;
36  
37  import io.github.prolobjectlink.prolog.PrologConverter;
38  import io.github.prolobjectlink.prolog.PrologEngine;
39  import io.github.prolobjectlink.prolog.PrologJavaConverter;
40  import io.github.prolobjectlink.prolog.PrologProvider;
41  import io.github.prolobjectlink.prolog.jpl7.JplProvider;
42  
43  /**
44   * 
45   * @author Jose Zalacain
46   * @since 1.0
47   */
48  public class SwiProlog7 extends JplProvider implements PrologProvider {
49  
50  	public SwiProlog7() {
51  		super(new SwiProlog7Converter());
52  	}
53  
54  	public SwiProlog7(PrologConverter<Term> converter) {
55  		super(converter);
56  	}
57  
58  	public PrologJavaConverter getJavaConverter() {
59  		return new SwiProlog7JavaConverter(this);
60  	}
61  
62  	public PrologEngine newEngine() {
63  		return new SwiProlog7Engine(this);
64  	}
65  
66  	public PrologEngine newEngine(String path) {
67  		PrologEngine engine = newEngine();
68  		engine.consult(path);
69  		return engine;
70  	}
71  
72  	@Override
73  	public String toString() {
74  		return "SwiProlog7 [converter=" + converter + "]";
75  	}
76  
77  }