LightJason - AgentSpeak(L++)
org.lightjason.agentspeak.common.CCommon Class Reference

class for any helper calls More...

+ Collaboration diagram for org.lightjason.agentspeak.common.CCommon:

Classes

class  CUTF8Control
 class to read UTF-8 encoded property file More...
 

Static Public Member Functions

static Stream< IActionactionsFromAgentClass ( @Nonnull final Class<?>... p_class)
 returns actions by a class More...
 
static Stream< IActionactionsFromPackage ( @Nullable final String... p_package)
 get all classes within an Java package as action More...
 
static URL concaturl (final URL p_base, final String p_string) throws MalformedURLException, URISyntaxException
 concats an URL with a path More...
 
static ResourceBundle configuration ()
 returns the property data of the package More...
 
static ResourceBundle languagebundle ()
 returns the language bundle More...
 
static String [] languages ()
 list of usable languages More...
 
static< T > String languagestring (final T p_source, final String p_label, final Object... p_parameter)
 returns the language depend string on any object More...
 
static String languagestring (final Class<?> p_class, final String p_label, final Object... p_parameter)
 returns a string of the resource file More...
 
static Logger logger (final Class<?> p_class)
 returns a logger instance More...
 
static URL resourceurl ()
 returns root path of the resource More...
 
static URL resourceurl (final String p_file) throws URISyntaxException, MalformedURLException
 returns a file from a resource e.g. More...
 

Static Public Attributes

static final String PACKAGEROOT = "org.lightjason.agentspeak"
 package name More...
 

Private Member Functions

 CCommon ()
 private ctor - avoid instantiation More...
 

Static Private Member Functions

static boolean actionusable (final IAction p_action)
 checks if an action is usable More...
 
static Pair< Boolean, IAgentAction.EAccess > isActionClass (final Class<?> p_class)
 filter of a class to use it as action More...
 
static boolean isActionFiltered (final Method p_method, final Class<?> p_class)
 class filter of an action to use it More...
 
static String languagelabel (final Class<?> p_class, final String p_label)
 returns the label of a class and string to get access to the resource More...
 
static Stream< Method > methods (final Class<?> p_class)
 reads all methods by the action-annotations for building agent-actions More...
 
static URL resourceurl (final File p_file) throws URISyntaxException, MalformedURLException
 returns a file from a resource e.g. More...
 

Static Private Attributes

static final ResourceBundle LANGUAGE
 language resource bundle More...
 
static final Logger LOGGER = CCommon.logger( CCommon.class )
 logger More...
 
static final ResourceBundle PROPERTIES
 properties of the package More...
 

Detailed Description

Definition at line 65 of file common/CCommon.java.

Constructor & Destructor Documentation

◆ CCommon()

org.lightjason.agentspeak.common.CCommon.CCommon ( )
private

Definition at line 96 of file common/CCommon.java.

Member Function Documentation

◆ actionsFromAgentClass()

static Stream<IAction> org.lightjason.agentspeak.common.CCommon.actionsFromAgentClass ( @Nonnull final Class<?>...  p_class)
static
Note
class must be an inheritance of the IAgent interface
Parameters
p_classclass list
Returns
action stream

Definition at line 206 of file common/CCommon.java.

References org.lightjason.agentspeak.common.CCommon.actionusable(), org.lightjason.agentspeak.common.CCommon.languagestring(), and org.lightjason.agentspeak.common.CCommon.methods().

Referenced by org.lightjason.agentspeak.action.builtin.TestCActionBinding.classbinding(), org.lightjason.agentspeak.action.builtin.TestCActionBinding.methodblacklist(), org.lightjason.agentspeak.action.builtin.TestCActionBinding.methoddefault(), and org.lightjason.agentspeak.action.builtin.TestCActionBinding.methodwhitelist().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ actionsFromPackage()

static Stream<IAction> org.lightjason.agentspeak.common.CCommon.actionsFromPackage ( @Nullable final String...  p_package)
static
Parameters
p_packagefull-qualified package name or empty for default package
Returns
action stream

Definition at line 153 of file common/CCommon.java.

References org.lightjason.agentspeak.common.CCommon.actionusable(), and org.lightjason.agentspeak.common.CCommon.languagestring().

Referenced by org.lightjason.agentspeak.agent.TestCAgentExecution.CGenerator.CGenerator(), org.lightjason.agentspeak.agent.TestCHanoiTowers.CGenerator.CGenerator(), and org.lightjason.agentspeak.agent.TestCAgent.testASLDefault().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ actionusable()

static boolean org.lightjason.agentspeak.common.CCommon.actionusable ( final IAction  p_action)
staticprivate
Parameters
p_actionaction object
Returns
boolean usable flag

Definition at line 240 of file common/CCommon.java.

References org.lightjason.agentspeak.common.IPath.empty(), org.lightjason.agentspeak.common.IPath.get(), org.lightjason.agentspeak.common.CCommon.languagestring(), and org.lightjason.agentspeak.action.IAction.name().

Referenced by org.lightjason.agentspeak.common.CCommon.actionsFromAgentClass(), and org.lightjason.agentspeak.common.CCommon.actionsFromPackage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ concaturl()

static URL org.lightjason.agentspeak.common.CCommon.concaturl ( final URL  p_base,
final String  p_string 
) throws MalformedURLException, URISyntaxException
static
Parameters
p_basebase URL
p_stringadditional path
Returns
new URL
Exceptions
URISyntaxExceptionthrown on syntax error
MalformedURLExceptionthrown on malformat

Definition at line 352 of file common/CCommon.java.

◆ configuration()

static ResourceBundle org.lightjason.agentspeak.common.CCommon.configuration ( )
static
Returns
bundle object

Definition at line 139 of file common/CCommon.java.

References org.lightjason.agentspeak.common.CCommon.PROPERTIES.

Referenced by org.lightjason.agentspeak.action.builtin.web.IBaseWeb.header(), and org.lightjason.agentspeak.TestCLanguageLabels.testTranslation().

+ Here is the caller graph for this function:

◆ isActionClass()

static Pair<Boolean, IAgentAction.EAccess> org.lightjason.agentspeak.common.CCommon.isActionClass ( final Class<?>  p_class)
staticprivate
Parameters
p_classclass for checking
Returns
boolean flag of check result

Definition at line 304 of file common/CCommon.java.

References org.lightjason.agentspeak.action.binding.IAgentAction.access(), org.lightjason.agentspeak.action.binding.IAgentAction.EAccess.BLACKLIST, and org.lightjason.agentspeak.action.binding.IAgentAction.classes().

Referenced by org.lightjason.agentspeak.common.CCommon.methods().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isActionFiltered()

static boolean org.lightjason.agentspeak.common.CCommon.isActionFiltered ( final Method  p_method,
final Class<?>  p_class 
)
staticprivate
Parameters
p_methodmethod for checking
p_classclass
Returns
boolean flag of check result

Definition at line 327 of file common/CCommon.java.

Referenced by org.lightjason.agentspeak.common.CCommon.methods().

+ Here is the caller graph for this function:

◆ languagebundle()

static ResourceBundle org.lightjason.agentspeak.common.CCommon.languagebundle ( )
static
Returns
bundle

Definition at line 128 of file common/CCommon.java.

References org.lightjason.agentspeak.common.CCommon.LANGUAGE.

◆ languagelabel()

static String org.lightjason.agentspeak.common.CCommon.languagelabel ( final Class<?>  p_class,
final String  p_label 
)
staticprivate
Parameters
p_classclass for static calls
p_labellabel name of the object
Returns
label name

Definition at line 451 of file common/CCommon.java.

Referenced by org.lightjason.agentspeak.common.CCommon.languagestring().

+ Here is the caller graph for this function:

◆ languages()

static String [] org.lightjason.agentspeak.common.CCommon.languages ( )
static
Returns
list of language pattern

Definition at line 117 of file common/CCommon.java.

◆ languagestring() [1/2]

static <T> String org.lightjason.agentspeak.common.CCommon.languagestring ( final T  p_source,
final String  p_label,
final Object...  p_parameter 
)
static
Parameters
p_sourceany object
p_labellabel name
p_parameterparameter
Returns
translated string
Template Parameters
Tobject type

Definition at line 417 of file common/CCommon.java.

Referenced by org.lightjason.agentspeak.common.CCommon.actionsFromAgentClass(), org.lightjason.agentspeak.common.CCommon.actionsFromPackage(), org.lightjason.agentspeak.common.CCommon.actionusable(), org.lightjason.agentspeak.beliefbase.IBeliefbaseOnDemand< T extends IAgent<?>.add(), org.lightjason.agentspeak.beliefbase.view.CView.add(), org.lightjason.agentspeak.language.execution.expressionbinary.EOperator.apply(), org.lightjason.agentspeak.language.execution.action.CProxyAction.CActionWrapper.CActionWrapper(), org.lightjason.agentspeak.language.execution.expression.numerical.CAdditive.CAdditive(), org.lightjason.agentspeak.language.execution.expression.logical.CBinary.CBinary(), org.lightjason.agentspeak.language.execution.expression.numerical.CComparable.CComparable(), org.lightjason.agentspeak.language.execution.action.unify.CDefaultUnify.CDefaultUnify(), org.lightjason.agentspeak.language.fuzzy.CFuzzyValue< T >.CFuzzyValue(), org.lightjason.agentspeak.language.fuzzy.CFuzzyValueMutable< T >.CFuzzyValueMutable(), org.lightjason.agentspeak.language.execution.expression.numerical.CMultiplicative.CMultiplicative(), org.lightjason.agentspeak.common.CPath.CPath(), org.lightjason.agentspeak.language.execution.expression.numerical.CPower.CPower(), org.lightjason.agentspeak.grammar.CCommon.createLogicalBinaryExpression(), org.lightjason.agentspeak.language.execution.expression.numerical.CRelational.CRelational(), org.lightjason.agentspeak.language.execution.expression.logical.CUnary.CUnary(), org.lightjason.agentspeak.beliefbase.view.CView.CView(), org.lightjason.agentspeak.language.execution.action.CBeliefAction.execute(), org.lightjason.agentspeak.language.execution.expression.IBaseBinary.executearguments(), org.lightjason.agentspeak.language.execution.expressionbinary.EOperator.from(), org.lightjason.agentspeak.language.instantiable.plan.trigger.ITrigger.EType.from(), org.lightjason.agentspeak.language.fuzzy.CFuzzyValueMutable< T >.fuzzy(), org.lightjason.agentspeak.action.builtin.math.statistic.CCreateStatistic.EType.generate(), org.lightjason.agentspeak.action.builtin.crypto.EAlgorithm.generateKey(), org.lightjason.agentspeak.action.builtin.graph.CCreate.EGraphTypes.get(), org.lightjason.agentspeak.action.builtin.math.interpolate.CCreate.EType.get(), org.lightjason.agentspeak.action.builtin.math.statistic.CCreateDistribution.EDistribution.get(), org.lightjason.agentspeak.action.builtin.math.statistic.CCreateDistribution.EGenerator.get(), org.lightjason.agentspeak.language.CCommon.ECompression.get(), org.lightjason.agentspeak.action.builtin.math.linearprogram.IConstraint.getRelation(), org.lightjason.agentspeak.consistency.CConsistency.EAlgorithm.getStationaryDistribution(), org.lightjason.agentspeak.language.execution.expression.IBaseBinary.IBaseBinary(), org.lightjason.agentspeak.language.execution.expression.IBaseUnary.IBaseUnary(), org.lightjason.agentspeak.grammar.CASTVisitorType.numericonstant(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.numericonstant(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.numericonstant(), org.lightjason.agentspeak.beliefbase.IBeliefbaseOnDemand< T extends IAgent<?>.remove(), org.lightjason.agentspeak.language.CCommon.replaceFromContext(), org.lightjason.agentspeak.common.CCommon.resourceurl(), org.lightjason.agentspeak.common.CPath.separator(), org.lightjason.agentspeak.language.variable.CConstant< T >.set(), org.lightjason.agentspeak.grammar.CErrorListener.syntaxError(), org.lightjason.agentspeak.language.variable.CVariable< T >.thrownotallocated(), org.lightjason.agentspeak.language.CRawTerm< T >.thrownotallocated(), org.lightjason.agentspeak.language.instantiable.plan.annotation.IBaseAnnotation< T >.throwvaluenotassignableto(), org.lightjason.agentspeak.language.fuzzy.CFuzzyValue< T >.throwvaluenotassignableto(), org.lightjason.agentspeak.language.fuzzy.CFuzzyValueMutable< T >.throwvaluenotassignableto(), org.lightjason.agentspeak.language.variable.CVariable< T >.throwvaluenotassignableto(), org.lightjason.agentspeak.language.CRawTerm< T >.throwvaluenotassignableto(), org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.trigger(), org.lightjason.agentspeak.action.builtin.math.statistic.EStatisticValue.value(), org.lightjason.agentspeak.beliefbase.IBeliefbaseOnDemand< T extends IAgent<?>.view(), org.lightjason.agentspeak.beliefbase.IBeliefbaseOnDemand< T extends IAgent<?>.viewOrDefault(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitAchievement_goal_action(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitAchievement_goal_action(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitAnnotation_atom(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitAnnotation_atom(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitAnnotation_value_literal(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitAnnotation_value_literal(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitBelief_action(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitBelief_action(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitExecutable_rule(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitExecutable_rule(), org.lightjason.agentspeak.grammar.CASTVisitorType.visitExecutable_term(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitExecutable_term(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitExecutable_term(), org.lightjason.agentspeak.grammar.CASTVisitorType.visitExpression_logical_element(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitExpression_logical_element(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitExpression_logical_element(), org.lightjason.agentspeak.grammar.CASTVisitorType.visitExpression_logical_xor(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitExpression_logical_xor(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitExpression_logical_xor(), org.lightjason.agentspeak.grammar.CASTVisitorType.visitExpression_numeric(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitExpression_numeric(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitExpression_numeric(), org.lightjason.agentspeak.grammar.CASTVisitorType.visitExpression_numeric_additive(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitExpression_numeric_additive(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitExpression_numeric_additive(), org.lightjason.agentspeak.grammar.CASTVisitorType.visitExpression_numeric_element(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitExpression_numeric_element(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitExpression_numeric_element(), org.lightjason.agentspeak.grammar.CASTVisitorType.visitExpression_numeric_multiplicative(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitExpression_numeric_multiplicative(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitExpression_numeric_multiplicative(), org.lightjason.agentspeak.grammar.CASTVisitorType.visitExpression_numeric_relation(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitExpression_numeric_relation(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitExpression_numeric_relation(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitLambda_initialization(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitLambda_initialization(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitPlan_belief_trigger(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitPlan_belief_trigger(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitPlan_goal_trigger(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitPlan_goal_trigger(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitRepair_formula(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitRepair_formula(), org.lightjason.agentspeak.grammar.CASTVisitorType.visitTerm(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitTerm(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitTerm(), org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.visitUnary_expression(), and org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitUnary_expression().

+ Here is the caller graph for this function:

◆ languagestring() [2/2]

static String org.lightjason.agentspeak.common.CCommon.languagestring ( final Class<?>  p_class,
final String  p_label,
final Object...  p_parameter 
)
static
Parameters
p_classclass for static calls
p_labellabel name of the object
p_parameterobject array with substitutions
Returns
resource string

Definition at line 431 of file common/CCommon.java.

References org.lightjason.agentspeak.common.CCommon.languagelabel().

+ Here is the call graph for this function:

◆ logger()

static Logger org.lightjason.agentspeak.common.CCommon.logger ( final Class<?>  p_class)
static
Parameters
p_classclass type
Returns
logger

Definition at line 106 of file common/CCommon.java.

◆ methods()

static Stream<Method> org.lightjason.agentspeak.common.CCommon.methods ( final Class<?>  p_class)
staticprivate
Parameters
p_classclass
Returns
stream of all methods with inheritance

Definition at line 272 of file common/CCommon.java.

References org.lightjason.agentspeak.common.CCommon.isActionClass(), org.lightjason.agentspeak.common.CCommon.isActionFiltered(), and org.lightjason.agentspeak.action.binding.IAgentAction.EAccess.WHITELIST.

Referenced by org.lightjason.agentspeak.common.CCommon.actionsFromAgentClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resourceurl() [1/3]

static URL org.lightjason.agentspeak.common.CCommon.resourceurl ( )
static
Returns
URL of file or null

Definition at line 363 of file common/CCommon.java.

Referenced by org.lightjason.agentspeak.common.CCommon.resourceurl().

+ Here is the caller graph for this function:

◆ resourceurl() [2/3]

static URL org.lightjason.agentspeak.common.CCommon.resourceurl ( final String  p_file) throws URISyntaxException, MalformedURLException
static

Jar file

Parameters
p_filefile
Returns
URL of file or null
Exceptions
URISyntaxExceptionthrown on syntax error
MalformedURLExceptionthrown on malformat

Definition at line 378 of file common/CCommon.java.

References org.lightjason.agentspeak.common.CCommon.resourceurl().

+ Here is the call graph for this function:

◆ resourceurl() [3/3]

static URL org.lightjason.agentspeak.common.CCommon.resourceurl ( final File  p_file) throws URISyntaxException, MalformedURLException
staticprivate

Jar file

Parameters
p_filefile relative to the CMain
Returns
URL of file or null
Exceptions
URISyntaxExceptionis thrown on URI errors
MalformedURLExceptionis thrown on malformat

Definition at line 393 of file common/CCommon.java.

References org.lightjason.agentspeak.common.CCommon.languagestring().

+ Here is the call graph for this function:

Member Data Documentation

◆ LANGUAGE

final ResourceBundle org.lightjason.agentspeak.common.CCommon.LANGUAGE
staticprivate
Initial value:
= ResourceBundle.getBundle(
MessageFormat.format( "{0}.{1}", PACKAGEROOT, "language" ),
Locale.getDefault(),
new CUTF8Control()
)

Definition at line 78 of file common/CCommon.java.

Referenced by org.lightjason.agentspeak.common.CCommon.languagebundle().

◆ LOGGER

final Logger org.lightjason.agentspeak.common.CCommon.LOGGER = CCommon.logger( CCommon.class )
staticprivate

Definition at line 74 of file common/CCommon.java.

◆ PACKAGEROOT

final String org.lightjason.agentspeak.common.CCommon.PACKAGEROOT = "org.lightjason.agentspeak"
static

◆ PROPERTIES

final ResourceBundle org.lightjason.agentspeak.common.CCommon.PROPERTIES
staticprivate
Initial value:
= ResourceBundle.getBundle(
MessageFormat.format( "{0}.{1}", PACKAGEROOT, "configuration" ),
Locale.getDefault(),
new CUTF8Control()
)

Definition at line 86 of file common/CCommon.java.

Referenced by org.lightjason.agentspeak.common.CCommon.configuration().