1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-11-17 16:09:32 -08:00

Add registering documentation to plugins.

This commit is contained in:
Danila Fedorin 2017-08-08 13:49:04 -07:00
parent fdcf2b5c6d
commit 9d92d0eebb

View File

@ -1,5 +1,7 @@
package org.nwapw.abacus.plugin;
import org.nwapw.abacus.function.Documentation;
import org.nwapw.abacus.function.DocumentationType;
import org.nwapw.abacus.function.Function;
import org.nwapw.abacus.function.Operator;
import org.nwapw.abacus.number.NumberInterface;
@ -94,6 +96,15 @@ public abstract class Plugin {
manager.registerNumberImplementation(name, implementation);
}
/**
* To be used in load(). Registers a documentation instance
* used to explain some element of the plugin to the user.
* @param documentation the documentation instance.
*/
protected final void registerDocumentation(Documentation documentation){
manager.registerDocumentation(documentation);
}
/**
* Searches the PluginManager for the given function name.
* This can be used by the plugins internally in order to call functions
@ -130,6 +141,17 @@ public abstract class Plugin {
return manager.numberImplementationFor(name);
}
/**
* Searches the PluginManager for the given documentation name and type.
*
* @param name the name for which to search.
* @param type the type of documentation to search for.
* @return the found documentation, or null if none was found.
*/
protected final Documentation documentationFor(String name, DocumentationType type){
return manager.documentationFor(name, type);
}
/**
* Searches the plugin manager for a Pi value for the given number implementation.
* This is done so that number implementations with various degrees of precision