public interface PrologProvider
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. |
PrologTerm |
falseReference()
Create a prolog object reference term that hold the Java false object
i.e.
|
<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.
|
<K> PrologConverter<K> |
getConverter()
Get a prolog converter instance to map the abstract prolog data types to
under-laying prolog implementations data types.
|
PrologJavaConverter |
getJavaConverter()
Get a Java to Prolog converter instance to map the abstract prolog data types
to Java types.
|
PrologLogger |
getLogger()
Get the prolog system logger instance to report any errors or exceptions
|
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.
|
boolean |
isCompliant()
True if wrapped engine implement ISO Prolog and false in other case
|
PrologAtom |
newAtom(String functor)
Create a prolog atom term setting like atom value the given string.
|
PrologDouble |
newDouble()
Create a prolog double number instance with 0.0 value.
|
PrologDouble |
newDouble(Number value)
Create a prolog double number instance with the given value.
|
PrologEngine |
newEngine()
Create a new prolog engine instance ready to be operate.
|
PrologEngine |
newEngine(String file)
Create a new prolog engine instance ready to be operate.
|
PrologTerm |
newEntry(Object key,
Object value)
Create a new PrologEntry using key-value pair of Java object type.The given
objects are converted to PrologTerm before entry creation.
|
PrologTerm |
newEntry(PrologTerm key,
PrologTerm value)
Create a new PrologEntry using key-value pair of PrologTerm type.
|
PrologFloat |
newFloat()
Create a prolog float number instance with 0.0 value.
|
PrologFloat |
newFloat(Number value)
Create a prolog float number instance with 0.0 value.
|
PrologInteger |
newInteger()
Create a prolog integer number instance with 0 value.
|
PrologInteger |
newInteger(Number value)
Create a prolog integer number instance with the given value.
|
PrologList |
newList()
Create an empty prolog list term.
|
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.
|
PrologList |
newList(PrologTerm[] arguments)
Create a prolog list from prolog terms arguments array and the tail item is
an empty list.
|
PrologList |
newList(PrologTerm[] arguments,
PrologTerm tail)
Create a prolog list from prolog terms arguments array and the tail item is
the given prolog term.
|
PrologList |
newList(PrologTerm head,
PrologTerm tail)
Create a prolog list with two terms items [head | tail].
|
PrologLong |
newLong()
Create a prolog long number instance with 0 value.
|
PrologLong |
newLong(Number value)
Create a prolog long number instance with the given value.
|
PrologTerm |
newMap()
Constructs an empty
PrologMap with the default initial capacity (16). |
PrologTerm |
newMap(int initialCapacity)
Constructs an empty
PrologMap with the specified initial capacity. |
PrologTerm |
newMap(Map<PrologTerm,PrologTerm> map)
Constructs a new
PrologMap with the same mappings as the specified
Map of PrologTerm keys and values. |
PrologTerm |
newReference(Object object)
Create a prolog object reference term that hold the given object.
|
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(PrologTerm left,
String operator,
PrologTerm 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.
|
PrologStructure |
newStructure(String functor,
PrologTerm... arguments)
Create a prolog structure with the functor (structure name) and prolog terms
arguments array.
|
PrologVariable |
newVariable(int position)
Create an anonymous variable instance with associated index.
|
PrologVariable |
newVariable(String name,
int position)
Create an named variable instance with associated index.
|
PrologTerm |
nullReference()
Create a prolog object reference term that hold the Java null object
i.e.
|
PrologClause |
parseClause(String clause)
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.
|
PrologTerm |
prologCut()
Get the prolog term that represent the prolog cut built-in.
|
PrologTerm |
prologEmpty()
Get the prolog empty list term.
|
PrologTerm |
prologFail()
Get the prolog fail term that represent fail built-in.
|
PrologTerm |
prologFalse()
Get the prolog false term that represent false built-in.
|
PrologTerm |
prologInclude(String file)
Get the prolog term representing the directive use by under-laying prolog
implementation for file inclusion.
|
PrologTerm |
prologNil()
Get the prolog nil term representing the null data type for prolog data type
system.
|
PrologTerm |
prologTrue()
Get the prolog true term that represent true built-in.
|
<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[] objects,
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[][] objects,
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.
|
PrologTerm |
trueReference()
Create a prolog object reference term that hold the Java true object
i.e.
|
PrologTerm |
voidReference()
Create a prolog object reference term that hold the Java void object
i.e.
|
boolean isCompliant()
PrologTerm prologNil()
PrologTerm prologCut()
PrologTerm prologFail()
PrologTerm prologTrue()
PrologTerm prologFalse()
PrologTerm prologEmpty()
PrologTerm prologInclude(String file)
file
- file path to be includePrologEngine newEngine()
PrologEngine newEngine(String file)
newEngine().consult(file);
file
- file path to be consultedPrologAtom newAtom(String functor)
functor
- string value for the atomPrologFloat newFloat()
PrologFloat newFloat(Number value)
value
- numeric valuePrologDouble newDouble()
PrologDouble newDouble(Number value)
value
- numeric valuePrologInteger newInteger()
PrologInteger newInteger(Number value)
value
- numeric valuePrologLong newLong()
PrologLong newLong(Number value)
value
- numeric valuePrologVariable newVariable(int position)
position
- Position of its Structure where the variable is first time
declared.IllegalArgumentException
- if position is a negative numberPrologVariable newVariable(String name, int position)
name
- variable name (upper case beginning)position
- Position of its Structure where the variable is first time
declared.IllegalArgumentException
- if position is a negative numberPrologList newList()
PrologList newList(PrologTerm head)
head
- term item to be include in the prolog listPrologList newList(PrologTerm[] arguments)
arguments
- prolog terms arguments array.PrologList newList(PrologTerm head, PrologTerm tail)
head
- term item to be include like head in the prolog list.tail
- term item to be include like tail in the prolog list.PrologList newList(PrologTerm[] arguments, PrologTerm tail)
arguments
- prolog terms arguments array.tail
- prolog term to be the tail item.PrologList newList(Object head)
head
- object item to be include in the prolog listPrologList newList(Object[] arguments)
arguments
- java objects arguments array.PrologList newList(Object head, Object tail)
head
- object item to be include like head in the prolog list.tail
- object item to be include like tail in the prolog list.PrologList newList(Object[] arguments, Object tail)
arguments
- java objects arguments array.tail
- java object to be the tail item.PrologStructure newStructure(String functor, PrologTerm... arguments)
PrologAtom bob = provider.newAtom("bob"); PrologAtom tom = provider.newAtom("tom"); PrologStructure parent = provider.newStructure("parent", tom, bob); System.out.println(parent);
functor
- structure name.arguments
- prolog terms arguments array.PrologTerm newStructure(String functor, Object... arguments)
PrologStructure parent = provider.newStructure("parent", "tom", "bob"); System.out.println(parent);
functor
- structure name.arguments
- java objects arguments array.PrologTerm newStructure(PrologTerm left, String operator, PrologTerm right)
PrologVariable x = provider.newVariable("X", 0); PrologDouble pi = provider.newDouble(Math.PI); PrologStructure plusExp = provider.newStructure(x, "+", pi); System.out.println(plusExp);
left
- left hand operandoperator
- infix operandright
- right hand operandPrologTerm newStructure(Object left, String operator, Object right)
PrologVariable x = provider.newVariable("X", 0); PrologDouble pi = provider.newDouble(Math.PI); PrologStructure plusExp = provider.newStructure(x, "+", pi); System.out.println(plusExp);
left
- left hand operandoperator
- infix operandright
- right hand operandPrologTerm newMap(Map<PrologTerm,PrologTerm> map)
PrologMap
with the same mappings as the specified
Map
of PrologTerm
keys and values. The PrologMap
is
created with an initial capacity sufficient to hold the mappings in the
specified Map
. The resulting term is an implementation of Map
and PrologTerm
.map
- the map whose mappings are to be placed in this mapPrologTerm newEntry(PrologTerm key, PrologTerm value)
PrologEntry
and
PrologTerm
.key
- key of the entryvalue
- value of the entryPrologTerm newEntry(Object key, Object value)
PrologEntry
and PrologTerm
.key
- key of the entryvalue
- value of the entryPrologTerm newMap(int initialCapacity)
PrologMap
with the specified initial capacity.
The resulting term is an implementation of Map
and
PrologTerm
.initialCapacity
- the initial capacity.PrologTerm newMap()
PrologMap
with the default initial capacity (16).
The resulting term is an implementation of Map
and
PrologTerm
.PrologTerm newReference(Object object)
PrologTerm.getObject()
.object
- object to be referencedPrologTerm falseReference()
PrologTerm trueReference()
PrologTerm nullReference()
PrologTerm voidReference()
<T extends PrologTerm> T cast(PrologTerm term)
Class
object.term
- the object to be castClassCastException
- if the object is not null and is not assignable to
the type T.PrologJavaConverter getJavaConverter()
<K> PrologConverter<K> getConverter()
K
- under-laying prolog data typesio.github.prolobjectlink.prolog.PrologParser getParser()
PrologLogger getLogger()
String getVersion()
String getName()
PrologTerm parseTerm(String term)
term
- prolog term in string format.PrologTerm[] parseTerms(String stringTerms)
stringTerms
- comma separate terms with prolog syntaxPrologList parseList(String stringList)
stringList
- prolog term in string format.PrologStructure parseStructure(String stringStructure)
stringStructure
- prolog term in string format.PrologClause parseClause(String clause)
clause
- prolog clause in string format.Set<PrologClause> parseProgram(String file)
file
- file path to be parsed.Set<PrologClause> parseProgram(File in)
in
- file to be parsed.<K extends PrologTerm,V> Map<String,PrologTerm>[] toTermMapArray(Map<String,V>[] map, Class<K> from)
K
- generic type that extends from PrologTerm
V
- 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 term<K extends PrologTerm,V> Map<String,PrologTerm> toTermMap(Map<String,V> map, Class<K> from)
K
- generic type that extends from PrologTerm
V
- 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 term<K extends PrologTerm> K[][] toTermMatrix(Object[][] objects, Class<K[][]> from)
K
- generic type that extends from PrologTerm
objects
- native terms matrix representation to be convertedfrom
- class to be cast the result Prolog term<K extends PrologTerm> K[] toTermArray(Object[] objects, Class<K[]> from)
K
- generic type that extends from PrologTerm
objects
- native terms array representation to be convertedfrom
- class to be cast the result Prolog term<K extends PrologTerm> K toTerm(Object o, Class<K> from)
K
- generic type that extends from PrologTerm
o
- native term representation to be convertedfrom
- class to be cast the result Prolog term<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 term<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 term<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 termCopyright © 2020–2024 Prolobjectlink Project. All rights reserved.