24 package org.lightjason.agentspeak.language.variable;
34 import javax.annotation.Nonnull;
35 import java.text.MessageFormat;
36 import java.util.Collections;
37 import java.util.List;
38 import java.util.stream.Stream;
66 this( p_variable, Collections.<
ITerm>emptyList() );
77 m_variable = p_variable;
78 m_parameter = Collections.unmodifiableList( p_parameter );
85 return m_variable.
mutex();
93 if ( !l_variable.allocated() )
97 if ( l_variable.valueassignableto( String.class ) )
98 return this.
fromString( l_variable.raw(), p_context );
100 if ( m_variable.valueassignableto(
ILiteral.class ) )
101 return this.
fromLiteral( l_variable.raw(), p_context );
110 return Stream.concat(
111 Stream.of( m_variable ),
112 m_parameter.parallelStream()
122 return m_variable.hashCode();
126 public final boolean equals(
final Object p_object )
134 return MessageFormat.format(
"{0}{1}", m_variable, m_parameter.isEmpty() ?
"" :
m_parameter );
141 return m_variable.functor();
148 return m_variable.functorpath();
155 return m_variable.fqnfunctor();
167 return m_variable.raw();
174 return m_variable.deepcopy( p_prefix );
181 return m_variable.deepcopysuffix();
211 return m_parameter.isEmpty()
212 ? p_literal.
unify( p_context )
218 ).unify( p_context );
Stream< IVariable<?> > variables()
returns a stream with all used variables
final List< ITerm > m_parameter
optional parameter list
CVariableEvaluate( @Nonnull final IVariable<?> p_variable, @Nonnull final List< ITerm > p_parameter)
ctor
ILiteral fromLiteral(final ILiteral p_literal, final IContext p_context)
creates the result literal from an input literal
static final long serialVersionUID
serial id
ILiteral fromString(final String p_value, final IContext p_context)
creates the result literal from an input string
common structure for execution definition
final boolean equals(final Object p_object)
ILiteral unify( @Nonnull final IContext p_context)
unifies variables if exists
IPath fqnfunctor()
returns the full-qualified functor with path and name
final String functor()
returns the functor without path
execution context with local data
final ITerm deepcopy(final IPath... p_prefix)
final boolean hasVariable()
checks if the literal has variables
final int structurehash()
returns a hash value which defines a hash ove rthe structure
final ILiteral evaluate(final IContext p_context)
evaluates the content of the variable
final IPath functorpath()
returns the path of the functor
boolean mutex()
flag to check if variable has is concurrency- / thread-safe
default< T extends ITerm > T term()
casts the object to a term-type
final< T > T raw()
cast to any raw value type
final boolean mutex()
returns mutex flag
boolean negated()
getter of the literal for the negation
default generic literal class for agent beliefs a literal consists of a functor, an optional list of ...
final IVariable<?> m_variable
content variable with a string or literal
structure for creating evaluate variables
final ITerm deepcopysuffix()
final IPath fqnfunctor()
returns the full-qualified functor with path and name
class for any helper calls
CVariableEvaluate( @Nonnull final IVariable<?> p_variable)
ctor
static ILiteral from( @Nonnull final String p_functor, @Nullable final ITerm... p_values)
factory
interface for evaluate variables
boolean hasAt()
returns if the literal has an @ prefix