public abstract class AbstractProvider extends Object implements PrologProvider
PrologProvider| Modifier and Type | Field and Description |
|---|---|
protected PrologConverter<?> |
converter |
| Constructor and Description |
|---|
AbstractProvider(PrologConverter<?> converter) |
| Modifier and Type | Method and Description |
|---|---|
<T extends PrologTerm> |
cast(PrologTerm term)
Casts a PrologTerm to the class or interface represented by this
Class object. |
protected <T extends PrologTerm> |
cast(PrologTerm term,
Class<T> type)
Casts a PrologTerm to the class or interface represented by this
Class object. |
boolean |
equals(Object object) |
<K> K |
fromTerm(PrologTerm term,
Class<K> to)
Create a native rule representation term from given head and body and cast
this native term to some specific given class.
|
<K> K |
fromTerm(PrologTerm head,
PrologTerm[] body,
Class<K> to)
Create a native rule representation term from given head and body and cast
this native term to some specific given class.
|
<K> K[] |
fromTermArray(PrologTerm[] terms,
Class<K[]> to)
Create a native term array representation from given Prolog term array and
cast this native term array to some specific given array class.
|
PrologConverter<?> |
getConverter()
Get a prolog converter instance to map the abstract prolog data types to
under-laying prolog implementations data types.
|
String |
getName()
Name of the wrapped engine.
|
io.github.prolobjectlink.prolog.PrologParser |
getParser()
Get a prolog parser instance to parser the strings with prolog syntax.
|
String |
getVersion()
Version of the wrapped engine.
|
int |
hashCode() |
boolean |
isCompliant()
True if wrapped engine implement ISO Prolog and false in other case
|
PrologDouble |
newDouble()
Create a prolog double number instance with 0.0 value.
|
PrologFloat |
newFloat()
Create a prolog float number instance with 0.0 value.
|
PrologInteger |
newInteger()
Create a prolog integer number instance with 0 value.
|
PrologList |
newList(Object head)
Create a prolog list with one object item.
|
PrologList |
newList(Object[] arguments)
Create a prolog list from java objects arguments array and the tail item is
an empty list.
|
PrologList |
newList(Object[] arguments,
Object tail)
Create a prolog list from java objects arguments array and the tail item is
the given java object.
|
PrologList |
newList(Object head,
Object tail)
Create a prolog list with two java objects items [head | tail].
|
PrologList |
newList(PrologTerm head)
Create a prolog list with one term item.
|
PrologLong |
newLong()
Create a prolog long number instance with 0 value.
|
PrologTerm |
newStructure(Object left,
String operator,
Object right)
Create a prolog structure that represent an expression defined by your left
and right operands separated by infix operator.
|
PrologTerm |
newStructure(String functor,
Object... arguments)
Create a prolog structure with the functor (structure name) and java objects
arguments array.
|
PrologClause |
parseClause(String stringClause)
Parse the string with Prolog syntax and create an equivalent Prolog clause
instance.
|
PrologList |
parseList(String stringList)
Parse the string with Prolog syntax and create an equivalent Prolog list term
instance.
|
Set<PrologClause> |
parseProgram(File in)
Parse the Prolog text contained at specific file and return a Prolog clause
set found in the file.
|
Set<PrologClause> |
parseProgram(String file)
Parse the Prolog text contained at specific file path and return a Prolog
clause set found in the file.
|
PrologStructure |
parseStructure(String stringStructure)
Parse the string with Prolog syntax and create an equivalent Prolog structure
term instance.
|
PrologTerm |
parseTerm(String term)
Parse the string with Prolog syntax and create an equivalent Prolog term
instance.
|
PrologTerm[] |
parseTerms(String stringTerms)
Parse the comma separate terms in the given string with prolog syntax and
return an array of terms formed by the comma separate terms.
|
protected String |
removeQuoted(String functor) |
abstract String |
toString() |
<K extends PrologTerm> |
toTerm(Object o,
Class<K> from)
Create an equivalent Prolog term using the given native term representation
and cast this Prolog term to some specific given class.
|
<K extends PrologTerm> |
toTermArray(Object[] os,
Class<K[]> from)
Create an equivalent Prolog terms array using the given native terms array
representation and cast this Prolog term array to some specific array
component class.
|
<K extends PrologTerm,V> |
toTermMap(Map<String,V> map,
Class<K> from)
Create an equivalent Prolog terms map using the given native terms map
representation and cast every Prolog term to some specific given class.
|
<K extends PrologTerm,V> |
toTermMapArray(Map<String,V>[] map,
Class<K> from)
Create an equivalent Prolog terms map array using the given native terms map
array representation and cast every Prolog term to some specific given class.
|
<K extends PrologTerm> |
toTermMatrix(Object[][] oss,
Class<K[][]> from)
Create an equivalent Prolog terms matrix using the given native terms matrix
representation and cast every Prolog terms matrix to some specific matrix
component class.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitfalseReference, getJavaConverter, getLogger, newAtom, newDouble, newEngine, newEngine, newEntry, newEntry, newFloat, newInteger, newList, newList, newList, newList, newLong, newMap, newMap, newMap, newReference, newStructure, newStructure, newVariable, newVariable, nullReference, prologCut, prologEmpty, prologFail, prologFalse, prologInclude, prologNil, prologTrue, trueReference, voidReferenceprotected final PrologConverter<?> converter
public AbstractProvider(PrologConverter<?> converter)
public final boolean isCompliant()
PrologProviderisCompliant in interface PrologProviderpublic final PrologList parseList(String stringList)
stringList - prolog term in string format.public final PrologClause parseClause(String stringClause)
stringClause - prolog clause in string format.public final PrologStructure parseStructure(String stringStructure)
stringStructure - prolog term in string format.public final Set<PrologClause> parseProgram(String file)
file - file path to be parsed.public final Set<PrologClause> parseProgram(File in)
in - file to be parsed.public final PrologFloat newFloat()
PrologProvidernewFloat in interface PrologProviderpublic final PrologDouble newDouble()
PrologProvidernewDouble in interface PrologProviderpublic final PrologInteger newInteger()
PrologProvidernewInteger in interface PrologProviderpublic final PrologLong newLong()
PrologProvidernewLong in interface PrologProviderpublic final PrologList newList(PrologTerm head)
PrologProvidernewList in interface PrologProviderhead - term item to be include in the prolog listpublic final PrologList newList(Object head)
PrologProvidernewList in interface PrologProviderhead - object item to be include in the prolog listpublic final PrologList newList(Object[] arguments)
PrologProvidernewList in interface PrologProviderarguments - java objects arguments array.public final PrologList newList(Object head, Object tail)
PrologProvidernewList in interface PrologProviderhead - object item to be include like head in the prolog list.tail - object item to be include like tail in the prolog list.public final PrologList newList(Object[] arguments, Object tail)
PrologProvidernewList in interface PrologProviderarguments - java objects arguments array.tail - java object to be the tail item.public final PrologTerm newStructure(String functor, Object... arguments)
PrologProvider
PrologStructure parent = provider.newStructure("parent", "tom", "bob");
System.out.println(parent);
newStructure in interface PrologProviderfunctor - structure name.arguments - java objects arguments array.public final PrologTerm newStructure(Object left, String operator, Object right)
PrologProvider
PrologVariable x = provider.newVariable("X", 0);
PrologDouble pi = provider.newDouble(Math.PI);
PrologStructure plusExp = provider.newStructure(x, "+", pi);
System.out.println(plusExp);
newStructure in interface PrologProviderleft - left hand operandoperator - infix operandright - right hand operandprotected final <T extends PrologTerm> T cast(PrologTerm term, Class<T> type)
Class object.term - the object to be casttype - the class or interface to be castedClassCastException - if the object is not null and is not assignable to
the type T.public final <T extends PrologTerm> T cast(PrologTerm term)
PrologProviderClass object.cast in interface PrologProviderterm - the object to be castpublic final <K extends PrologTerm> K toTerm(Object o, Class<K> from)
K - generic type that extends from PrologTermo - native term representation to be convertedfrom - class to be cast the result Prolog termpublic final <K extends PrologTerm> K[] toTermArray(Object[] os, Class<K[]> from)
K - generic type that extends from PrologTermos - native terms array representation to be convertedfrom - class to be cast the result Prolog termpublic final <K extends PrologTerm> K[][] toTermMatrix(Object[][] oss, Class<K[][]> from)
K - generic type that extends from PrologTermoss - native terms matrix representation to be convertedfrom - class to be cast the result Prolog termpublic final <K extends PrologTerm,V> Map<String,PrologTerm> toTermMap(Map<String,V> map, Class<K> from)
K - generic type that extends from PrologTermV - generic type that extends from Object representing a
native prolog term.map - native terms map representation to be convertedfrom - class to be cast the result Prolog termpublic final <K extends PrologTerm,V> Map<String,PrologTerm>[] toTermMapArray(Map<String,V>[] map, Class<K> from)
K - generic type that extends from PrologTermV - generic type that extends from Object representing a
native prolog term.map - native terms map array to be converted in Prolog terms map array.from - class to be cast the result Prolog termpublic final PrologConverter<?> getConverter()
PrologProvidergetConverter in interface PrologProviderpublic final <K> K fromTerm(PrologTerm term, Class<K> to)
K - generic type that represent native prolog typeterm - Prolog term to be converted to native term.to - class to be cast the result native termpublic final <K> K[] fromTermArray(PrologTerm[] terms, Class<K[]> to)
K - generic type that represent native prolog typeterms - Prolog term array to be converted to native array.to - class to be cast the result native termpublic final <K> K fromTerm(PrologTerm head, PrologTerm[] body, Class<K> to)
K - generic type that represent native prolog typehead - rule headbody - rule bodyto - class to be cast the result native termpublic final io.github.prolobjectlink.prolog.PrologParser getParser()
PrologProvidergetParser in interface PrologProviderpublic final String getVersion()
PrologProvidergetVersion in interface PrologProviderpublic final String getName()
PrologProvidergetName in interface PrologProviderpublic PrologTerm parseTerm(String term)
term - prolog term in string format.public PrologTerm[] parseTerms(String stringTerms)
stringTerms - comma separate terms with prolog syntaxCopyright © 2020–2024 Prolobjectlink Project. All rights reserved.