LightJason - AgentSpeak(L++)
org.lightjason.agentspeak.language.CLiteral Class Reference

default generic literal class for agent beliefs a literal consists of a functor, an optional list of values e.g. More...

+ Inheritance diagram for org.lightjason.agentspeak.language.CLiteral:
+ Collaboration diagram for org.lightjason.agentspeak.language.CLiteral:

Classes

class  CParser
 literal parser More...
 

Public Member Functions

 CLiteral (final boolean p_at, final boolean p_negated, @Nonnull final IPath p_functor, @Nonnull final Collection< ITerm > p_values)
 ctor More...
 
final ILiteral allocate ( @Nonnull final IContext p_context)
 allocate all variables with the current context More...
 
final int compareTo ( @Nonnull final ILiteral p_literal)
 
final synchronized ITerm deepcopy ( @Nullable final IPath... p_prefix)
 
final synchronized ITerm deepcopysuffix ()
 
final boolean emptyValues ()
 check for empty values More...
 
final boolean equals (final Object p_object)
 
final IPath fqnfunctor ()
 returns the full-qualified functor with path and name More...
 
final String functor ()
 returns the functor without path More...
 
final IPath functorpath ()
 returns the path of the functor More...
 
final boolean hasAt ()
 returns if the literal has an @ prefix More...
 
final int hashCode ()
 
final boolean hasVariable ()
 checks if the literal has variables More...
 
final boolean negated ()
 getter of the literal for the negation More...
 
final Stream< ITermorderedvalues ( @Nullable final IPath... p_path)
 returns a stream over the ordered values in sequential ordering More...
 
final< T > T raw ()
 cast to any raw value type More...
 
final ILiteral shallowcopy ( @Nullable final IPath... p_prefix)
 
final ILiteral shallowcopysuffix ()
 
final int structurehash ()
 returns a hash value which defines a hash ove rthe structure More...
 
final String toString ()
 
final ILiteral unify ( @Nonnull final IContext p_context)
 unifies variables if exists More...
 
final Stream< ITermvalues ( @Nullable final IPath... p_path)
 
- Public Member Functions inherited from org.lightjason.agentspeak.language.ILiteral
Stream< ITermvalues (final IPath... p_path)
 returns a stream over value items More...
 
- Public Member Functions inherited from org.lightjason.agentspeak.language.ITerm
default< T extends ITerm > T term ()
 casts the object to a term-type More...
 
- Public Member Functions inherited from org.lightjason.agentspeak.language.IDeepCopy< ITerm >
deepcopy (@Nullable final IPath... p_prefix)
 clones the object (shallow-copy) More...
 
deepcopysuffix ()
 clones the object (shallow-copy) without full-qualified path, only suffix is used More...
 
- Public Member Functions inherited from org.lightjason.agentspeak.language.IShallowCopy< ILiteral >
shallowcopy (@Nullable final IPath... p_prefix)
 clones the object (shallow-copy) More...
 
shallowcopysuffix ()
 clones the object (shallow-copy) without full-qualified path, only suffix is used More...
 

Static Public Member Functions

static ILiteral from ( @Nonnull final String p_functor, @Nullable final ITerm... p_values)
 factory More...
 
static ILiteral from ( @Nonnull final String p_functor, @Nonnull final Collection< ITerm > p_values)
 factory More...
 
static ILiteral from ( @Nonnull final String p_functor, @Nonnull final Stream< ITerm > p_values)
 stream factory More...
 
static ILiteral from ( @Nonnull final IPath p_functor, @Nullable final ITerm... p_values)
 factory More...
 
static ILiteral from ( @Nonnull final IPath p_functor, @Nonnull final Stream< ITerm > p_values)
 factory More...
 
static ILiteral from (final boolean p_at, final boolean p_negated, @Nonnull final IPath p_functor, @Nullable final ITerm... p_values)
 factory More...
 
static ILiteral from (final boolean p_at, final boolean p_negated, @Nonnull final IPath p_functor, @Nonnull final Stream< ITerm > p_values)
 factory More...
 
static ILiteral parse ( @Nonnull final String p_literal) throws Exception
 factory More...
 

Private Attributes

final boolean m_at
 @ prefix is set More...
 
final IPath m_functor
 literals functor More...
 
final int m_hash
 hash code More...
 
final boolean m_negated
 negated option More...
 
final List< ITermm_orderedvalues
 literal values as list More...
 
final int m_structurehash
 hash of the structure More...
 
final ImmutableMultimap< IPath, ITermm_values
 literal values More...
 

Static Private Attributes

static final String AT = "@"
 at symbol More...
 
static final String NEGATION = "~"
 negation symbol More...
 
static final long serialVersionUID = -3253396471300120109L
 serial id More...
 

Additional Inherited Members

- Public Attributes inherited from org.lightjason.agentspeak.language.ILiteral
ILiteral EMPTY
 empty literal More...
 
- Public Attributes inherited from org.lightjason.agentspeak.language.ITerm
ITerm EMPTY
 empty term More...
 
long serialVersionUID = -3640918490398129717L
 serial id More...
 
- Public Attributes inherited from org.lightjason.agentspeak.language.IStructureHash
Comparator< IStructureHashCOMPARATOR = Comparator.comparingInt( IStructureHash::structurehash )
 comparator More...
 

Detailed Description

velocity(50)

Definition at line 64 of file CLiteral.java.

Constructor & Destructor Documentation

◆ CLiteral()

org.lightjason.agentspeak.language.CLiteral.CLiteral ( final boolean  p_at,
final boolean  p_negated,
@Nonnull final IPath  p_functor,
@Nonnull final Collection< ITerm p_values 
)
Parameters
p_at@ prefix is set
p_negatednegated flag
p_functorfunctor of the literal
p_valuesinitial list of values

Definition at line 117 of file CLiteral.java.

Referenced by org.lightjason.agentspeak.language.CLiteral.allocate(), org.lightjason.agentspeak.language.CLiteral.deepcopy(), org.lightjason.agentspeak.language.CLiteral.deepcopysuffix(), org.lightjason.agentspeak.language.CLiteral.from(), org.lightjason.agentspeak.language.CLiteral.shallowcopy(), org.lightjason.agentspeak.language.CLiteral.shallowcopysuffix(), and org.lightjason.agentspeak.language.CLiteral.unify().

+ Here is the caller graph for this function:

Member Function Documentation

◆ allocate()

final ILiteral org.lightjason.agentspeak.language.CLiteral.allocate ( @Nonnull final IContext  p_context)
Parameters
p_contextcurrent execution context
Returns
literal with replaced variable

Implements org.lightjason.agentspeak.language.ILiteral.

Definition at line 350 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.CLiteral(), org.lightjason.agentspeak.language.CRawTerm< T >.EMPTY, and org.lightjason.agentspeak.common.IPath.stream().

+ Here is the call graph for this function:

◆ compareTo()

final int org.lightjason.agentspeak.language.CLiteral.compareTo ( @Nonnull final ILiteral  p_literal)

Definition at line 449 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.hashCode().

+ Here is the call graph for this function:

◆ deepcopy()

final synchronized ITerm org.lightjason.agentspeak.language.CLiteral.deepcopy ( @Nullable final IPath...  p_prefix)

Definition at line 456 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.CLiteral(), org.lightjason.agentspeak.language.CLiteral.m_at, org.lightjason.agentspeak.language.CLiteral.m_functor, org.lightjason.agentspeak.language.CLiteral.m_negated, and org.lightjason.agentspeak.language.CLiteral.m_values.

+ Here is the call graph for this function:

◆ deepcopysuffix()

final synchronized ITerm org.lightjason.agentspeak.language.CLiteral.deepcopysuffix ( )

◆ emptyValues()

final boolean org.lightjason.agentspeak.language.CLiteral.emptyValues ( )
Returns
empty flag

Implements org.lightjason.agentspeak.language.ILiteral.

Definition at line 295 of file CLiteral.java.

◆ equals()

final boolean org.lightjason.agentspeak.language.CLiteral.equals ( final Object  p_object)

Definition at line 410 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.hashCode().

+ Here is the call graph for this function:

◆ fqnfunctor()

final IPath org.lightjason.agentspeak.language.CLiteral.fqnfunctor ( )
Returns
fqn functor

Implements org.lightjason.agentspeak.language.ITerm.

Definition at line 390 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.m_functor.

◆ from() [1/7]

static ILiteral org.lightjason.agentspeak.language.CLiteral.from ( @Nonnull final String  p_functor,
@Nullable final ITerm...  p_values 
)
static
Parameters
p_functorfunctor string
p_valuesvalue term
Returns
literal

Definition at line 161 of file CLiteral.java.

Referenced by org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.active(), org.lightjason.agentspeak.action.builtin.TestCActionAgent.addplan(), org.lightjason.agentspeak.action.builtin.web.IBaseWeb.baseliteral(), org.lightjason.agentspeak.beliefbase.TestCPropertyBeliefbase.belieflist(), org.lightjason.agentspeak.action.builtin.TestCActionAgent.belieflist(), org.lightjason.agentspeak.action.builtin.TestCActionAgent.clearbeliefbase(), org.lightjason.agentspeak.action.builtin.TestCActionGenericType.createliteral(), org.lightjason.agentspeak.action.builtin.web.rest.CXMLObject.execute(), org.lightjason.agentspeak.action.builtin.web.rest.CJsonObject.execute(), org.lightjason.agentspeak.action.builtin.web.rest.CJsonList.execute(), org.lightjason.agentspeak.action.builtin.generic.type.CCreateLiteral.execute(), org.lightjason.agentspeak.action.builtin.web.graphql.IBaseGraphQL.execute(), org.lightjason.agentspeak.action.builtin.web.IBaseWeb.flatmap(), org.lightjason.agentspeak.language.CLiteral.from(), org.lightjason.agentspeak.language.variable.CVariableEvaluate.fromString(), org.lightjason.agentspeak.action.builtin.TestCActionAgent.getplan(), org.lightjason.agentspeak.consistency.TestCMetric.initialize(), org.lightjason.agentspeak.action.builtin.TestCActionStorage.initialize(), org.lightjason.agentspeak.action.builtin.TestCActionAgent.initialize(), org.lightjason.agentspeak.language.TestCTermVariablesConstant.literal(), org.lightjason.agentspeak.beliefbase.storage.CClassStorage< M >.literal(), org.lightjason.agentspeak.beliefbase.view.CViewMap.CWrapperBeliefbase.literal(), org.lightjason.agentspeak.agent.TestCUnifier.literalvaluesequentialtraversing(), org.lightjason.agentspeak.agent.TestCUnifier.literalvaluetraversing(), org.lightjason.agentspeak.action.builtin.TestCActionGenericType.parseliteral(), org.lightjason.agentspeak.action.builtin.TestCActionAgent.planlist(), org.lightjason.agentspeak.action.builtin.TestCActionWebGraphQL.queryliteral(), org.lightjason.agentspeak.action.builtin.TestCActionWebGraphQL.querymanual(), org.lightjason.agentspeak.action.builtin.TestCActionAgent.removeplan(), org.lightjason.agentspeak.beliefbase.TestCViewMap.stream(), org.lightjason.agentspeak.beliefbase.view.CViewMap.CWrapperBeliefbase.streamLiteral(), org.lightjason.agentspeak.consistency.TestCMetric.symmetricweightinequality(), org.lightjason.agentspeak.beliefbase.TestCView.testManual(), org.lightjason.agentspeak.beliefbase.TestCView.testTree(), org.lightjason.agentspeak.beliefbase.view.CViewMap.CWrapperBeliefbase.toterm(), org.lightjason.agentspeak.grammar.CASTVisitorAgent.visitInitial_goal(), and org.lightjason.agentspeak.consistency.TestCMetric.weightinequality().

+ Here is the caller graph for this function:

◆ from() [2/7]

static ILiteral org.lightjason.agentspeak.language.CLiteral.from ( @Nonnull final String  p_functor,
@Nonnull final Collection< ITerm p_values 
)
static
Parameters
p_functorfunctor string
p_valuesvalue term
Returns
literal

Definition at line 178 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.CLiteral(), and org.lightjason.agentspeak.common.CPath.from().

+ Here is the call graph for this function:

◆ from() [3/7]

static ILiteral org.lightjason.agentspeak.language.CLiteral.from ( @Nonnull final String  p_functor,
@Nonnull final Stream< ITerm p_values 
)
static
Parameters
p_functorfunctor
p_valuesvalue stream
Returns
literal

Definition at line 193 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.from().

+ Here is the call graph for this function:

◆ from() [4/7]

static ILiteral org.lightjason.agentspeak.language.CLiteral.from ( @Nonnull final IPath  p_functor,
@Nullable final ITerm...  p_values 
)
static
Parameters
p_functorfunctor path
p_valuesvalues
Returns
literal

Definition at line 205 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.from().

+ Here is the call graph for this function:

◆ from() [5/7]

static ILiteral org.lightjason.agentspeak.language.CLiteral.from ( @Nonnull final IPath  p_functor,
@Nonnull final Stream< ITerm p_values 
)
static
Parameters
p_functorfunctor path
p_valuesvalues
Returns
literal

Definition at line 217 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.from().

+ Here is the call graph for this function:

◆ from() [6/7]

static ILiteral org.lightjason.agentspeak.language.CLiteral.from ( final boolean  p_at,
final boolean  p_negated,
@Nonnull final IPath  p_functor,
@Nullable final ITerm...  p_values 
)
static
Parameters
p_atat
p_negatednegation
p_functorfunctor path
p_valuesvales
Returns
literal

Definition at line 231 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.from().

+ Here is the call graph for this function:

◆ from() [7/7]

static ILiteral org.lightjason.agentspeak.language.CLiteral.from ( final boolean  p_at,
final boolean  p_negated,
@Nonnull final IPath  p_functor,
@Nonnull final Stream< ITerm p_values 
)
static
Parameters
p_atat
p_negatednegation
p_functorfunctor path
p_valuesvales
Returns
literal

Definition at line 245 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.CLiteral().

+ Here is the call graph for this function:

◆ functor()

final String org.lightjason.agentspeak.language.CLiteral.functor ( )
Returns
functor

Implements org.lightjason.agentspeak.language.ITerm.

Definition at line 376 of file CLiteral.java.

References org.lightjason.agentspeak.common.IPath.suffix().

+ Here is the call graph for this function:

◆ functorpath()

final IPath org.lightjason.agentspeak.language.CLiteral.functorpath ( )
Returns
path

Implements org.lightjason.agentspeak.language.ITerm.

Definition at line 383 of file CLiteral.java.

References org.lightjason.agentspeak.common.IPath.size(), and org.lightjason.agentspeak.common.IPath.subpath().

+ Here is the call graph for this function:

◆ hasAt()

final boolean org.lightjason.agentspeak.language.CLiteral.hasAt ( )
Returns
prefix is set

Implements org.lightjason.agentspeak.language.ILiteral.

Definition at line 313 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.m_at.

◆ hashCode()

final int org.lightjason.agentspeak.language.CLiteral.hashCode ( )

Definition at line 404 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.m_hash.

Referenced by org.lightjason.agentspeak.language.CLiteral.compareTo(), and org.lightjason.agentspeak.language.CLiteral.equals().

+ Here is the caller graph for this function:

◆ hasVariable()

final boolean org.lightjason.agentspeak.language.CLiteral.hasVariable ( )
Returns
variable flag

Implements org.lightjason.agentspeak.language.ITerm.

Definition at line 319 of file CLiteral.java.

References org.lightjason.agentspeak.language.ITerm.hasVariable().

+ Here is the call graph for this function:

◆ negated()

final boolean org.lightjason.agentspeak.language.CLiteral.negated ( )
Returns
negated flag

Implements org.lightjason.agentspeak.language.ILiteral.

Definition at line 307 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.m_negated.

◆ orderedvalues()

final Stream<ITerm> org.lightjason.agentspeak.language.CLiteral.orderedvalues ( @Nullable final IPath...  p_path)
Returns
term stream

Implements org.lightjason.agentspeak.language.ILiteral.

Definition at line 279 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.raw().

+ Here is the call graph for this function:

◆ parse()

static ILiteral org.lightjason.agentspeak.language.CLiteral.parse ( @Nonnull final String  p_literal) throws Exception
static
Parameters
p_literalliteral string
Returns
literal
Exceptions
Exceptionparsing and stream exception

Definition at line 259 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.CParser.parse().

Referenced by org.lightjason.agentspeak.agent.TestCUnifier.literalvaluesequentialtraversing(), org.lightjason.agentspeak.agent.TestCUnifier.literalvaluetraversing(), org.lightjason.agentspeak.action.builtin.generic.type.CParseLiteral.parse(), org.lightjason.agentspeak.action.builtin.agent.CGetPlan.query(), org.lightjason.agentspeak.action.builtin.agent.CRemovePlan.remove(), and org.lightjason.agentspeak.agent.TestCUnifier.structurehash().

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

◆ raw()

final<T> T org.lightjason.agentspeak.language.CLiteral.raw ( )
Template Parameters
rawtype
Returns
any type

Implements org.lightjason.agentspeak.language.ITerm.

Definition at line 398 of file CLiteral.java.

Referenced by org.lightjason.agentspeak.language.CLiteral.orderedvalues().

+ Here is the caller graph for this function:

◆ shallowcopy()

final ILiteral org.lightjason.agentspeak.language.CLiteral.shallowcopy ( @Nullable final IPath...  p_prefix)

Definition at line 417 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.CLiteral(), org.lightjason.agentspeak.language.CLiteral.m_at, org.lightjason.agentspeak.language.CLiteral.m_functor, org.lightjason.agentspeak.language.CLiteral.m_negated, and org.lightjason.agentspeak.language.CLiteral.m_values.

+ Here is the call graph for this function:

◆ shallowcopysuffix()

final ILiteral org.lightjason.agentspeak.language.CLiteral.shallowcopysuffix ( )

◆ structurehash()

final int org.lightjason.agentspeak.language.CLiteral.structurehash ( )
Returns
structure hash value

Implements org.lightjason.agentspeak.language.IStructureHash.

Definition at line 301 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.m_structurehash.

◆ toString()

◆ unify()

final ILiteral org.lightjason.agentspeak.language.CLiteral.unify ( @Nonnull final IContext  p_context)
Parameters
p_contextcurrent execution context
Returns
new literal instance with unified variables
Note
un-unifyable variables passwd into the result literal

Implements org.lightjason.agentspeak.language.ILiteral.

Definition at line 326 of file CLiteral.java.

References org.lightjason.agentspeak.language.CLiteral.CLiteral(), org.lightjason.agentspeak.language.CRawTerm< T >.from(), and org.lightjason.agentspeak.common.IPath.stream().

+ Here is the call graph for this function:

◆ values()

final Stream<ITerm> org.lightjason.agentspeak.language.CLiteral.values ( @Nullable final IPath...  p_path)

Definition at line 266 of file CLiteral.java.

Member Data Documentation

◆ AT

final String org.lightjason.agentspeak.language.CLiteral.AT = "@"
staticprivate

Definition at line 77 of file CLiteral.java.

Referenced by org.lightjason.agentspeak.language.CLiteral.toString().

◆ m_at

◆ m_functor

◆ m_hash

final int org.lightjason.agentspeak.language.CLiteral.m_hash
private

Definition at line 101 of file CLiteral.java.

Referenced by org.lightjason.agentspeak.language.CLiteral.hashCode().

◆ m_negated

◆ m_orderedvalues

final List<ITerm> org.lightjason.agentspeak.language.CLiteral.m_orderedvalues
private

Definition at line 85 of file CLiteral.java.

Referenced by org.lightjason.agentspeak.language.CLiteral.toString().

◆ m_structurehash

final int org.lightjason.agentspeak.language.CLiteral.m_structurehash
private

◆ m_values

◆ NEGATION

final String org.lightjason.agentspeak.language.CLiteral.NEGATION = "~"
staticprivate

Definition at line 73 of file CLiteral.java.

Referenced by org.lightjason.agentspeak.language.CLiteral.toString().

◆ serialVersionUID

final long org.lightjason.agentspeak.language.CLiteral.serialVersionUID = -3253396471300120109L
staticprivate

Definition at line 69 of file CLiteral.java.