24 package org.lightjason.agentspeak.language.variable;
26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
34 import javax.annotation.Nonnull;
35 import javax.annotation.Nullable;
36 import java.text.MessageFormat;
37 import java.util.Arrays;
38 import java.util.Objects;
81 public CVariable( @Nonnull
final String p_functor, @Nullable
final T p_value )
93 this( p_functor, null );
102 @SuppressFBWarnings(
"EC_UNRELATED_CLASS_AND_INTERFACE" )
105 m_any = p_functor.empty() || p_functor.
equals(
"_" );
106 m_functor = p_functor;
124 public final boolean any()
148 return Objects.isNull(
m_value ) || Arrays.stream( p_class ).anyMatch( i -> i.isAssignableFrom(
m_value.getClass() ) );
168 public final boolean equals(
final Object p_object )
207 @SuppressWarnings(
"unchecked" )
217 return ( Objects.isNull( p_prefix ) ) || ( p_prefix.length == 0 )
234 ( Objects.isNull( p_prefix ) ) || ( p_prefix.length == 0 )
260 @SuppressWarnings(
"unchecked" )
static final long serialVersionUID
serial id
final String functor()
returns the functor without path
IPath subpath(final int p_fromindex)
creates a path of the start index until the end
final boolean hasVariable()
checks if the literal has variables
final boolean m_any
boolean flag, that defines an variable which matchs always
final boolean equals(final Object p_object)
illegal argument exception
IVariable< T > thrownotallocated()
throws an illegal state exception iif the variable is not allocated
ITerm deepcopy(final IPath... p_prefix)
boolean valueassignableto( @Nonnull final Class<?>... p_class)
checkes assignable of the value
common structure for execution definition
IVariable< T > shallowcopy(final IPath... p_prefix)
static IPath from( @Nonnull final String p_string)
factor method to build path
static< T > String languagestring(final T p_source, final String p_label, final Object... p_parameter)
returns the language depend string on any object
class to create a path structure
final int structurehash()
returns a hash value which defines a hash ove rthe structure
CVariable( @Nonnull final String p_functor, @Nullable final T p_value)
ctor
T m_value
value of the variable
final IPath m_functor
variable / functor name
final IPath functorpath()
returns the path of the functor
final IPath fqnfunctor()
returns the full-qualified functor with path and name
IVariable< T > internalset(final T p_value)
internel set for avoid any exception throwing
final boolean any()
flag to define a "any variable"
IVariable< T > shallowcopysuffix()
clones the object (shallow-copy) without full-qualified path, only suffix is used ...
< T > T raw()
cast to any raw value type
class for any helper calls
static< T > T deepclone( @Nullable final T p_object)
creates a deep-clone of an object
default variable definition
IPath append( @Nonnull final IPath p_path)
appends a path at the current and returns a new object
String suffix()
returns the last part of the path
CVariable( @Nonnull final String p_functor)
ctor
IVariable< T > throwvaluenotassignableto( @Nonnull final Class<?>... p_class)
throws an illegal argument exception iif the value is not assignable to the class ...
CVariable( @Nonnull final IPath p_functor)
ctor
boolean mutex()
flag to check if variable has is concurrency- / thread-safe
int size()
returns the number of path elements
boolean allocated()
returns allocated state
public< N > N raw()
cast to any raw value type