LightJason - AgentSpeak(L++)
ILiteral.java
Go to the documentation of this file.
1 /*
2  * @cond LICENSE
3  * ######################################################################################
4  * # LGPL License #
5  * # #
6  * # This file is part of the LightJason AgentSpeak(L++) #
7  * # Copyright (c) 2015-19, LightJason (info@lightjason.org) #
8  * # This program is free software: you can redistribute it and/or modify #
9  * # it under the terms of the GNU Lesser General Public License as #
10  * # published by the Free Software Foundation, either version 3 of the #
11  * # License, or (at your option) any later version. #
12  * # #
13  * # This program is distributed in the hope that it will be useful, #
14  * # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15  * # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16  * # GNU Lesser General Public License for more details. #
17  * # #
18  * # You should have received a copy of the GNU Lesser General Public License #
19  * # along with this program. If not, see http://www.gnu.org/licenses/ #
20  * ######################################################################################
21  * @endcond
22  */
23 
24 package org.lightjason.agentspeak.language;
25 
28 
29 import javax.annotation.Nonnull;
30 import javax.annotation.Nullable;
31 import java.util.stream.Stream;
32 
33 
39 public interface ILiteral extends ITerm, IShallowCopy<ILiteral>, Comparable<ILiteral>
40 {
45  {
49  private static final long serialVersionUID = -3396471300120317809L;
50 
51  @Nonnull
52  @Override
53  public final Stream<ITerm> values( @Nullable final IPath... p_path )
54  {
55  return Stream.empty();
56  }
57 
58  @Nonnull
59  @Override
60  public final Stream<ITerm> orderedvalues( @Nullable final IPath... p_path )
61  {
62  return Stream.empty();
63  }
64 
65  @Override
66  public final boolean emptyValues()
67  {
68  return true;
69  }
70 
71  @Override
72  public boolean negated()
73  {
74  return false;
75  }
76 
77  @Override
78  public final boolean hasAt()
79  {
80  return false;
81  }
82 
83  @Nonnull
84  @Override
85  public final ILiteral unify( @Nonnull final IContext p_context )
86  {
87  return this;
88  }
89 
90  @Nonnull
91  @Override
92  public final ILiteral allocate( @Nonnull final IContext p_context )
93  {
94  return this;
95  }
96 
97  @Override
98  public final int compareTo( @Nonnull final ILiteral p_literal )
99  {
100  return Integer.compare( p_literal.hashCode(), this.hashCode() );
101  }
102 
103  @Nonnull
104  @Override
105  public final String functor()
106  {
107  return "";
108  }
109 
110  @Nonnull
111  @Override
112  public IPath functorpath()
113  {
114  return IPath.EMPTY;
115  }
116 
117  @Nonnull
118  @Override
119  public IPath fqnfunctor()
120  {
121  return IPath.EMPTY;
122  }
123 
124  @Override
125  public boolean hasVariable()
126  {
127  return false;
128  }
129 
130  @Nonnull
131  @Override
132  @SuppressWarnings( "unchecked" )
133  public final <T> T raw()
134  {
135  return (T) this;
136  }
137 
138  @Nonnull
139  @Override
140  public final ITerm deepcopy( @Nullable final IPath... p_prefix )
141  {
142  return this;
143  }
144 
145  @Nonnull
146  @Override
147  public final ITerm deepcopysuffix()
148  {
149  return this;
150  }
151 
152  @Nonnull
153  @Override
154  public final ILiteral shallowcopy( @Nullable final IPath... p_prefix )
155  {
156  return this;
157  }
158 
159  @Nonnull
160  @Override
161  public final ILiteral shallowcopysuffix()
162  {
163  return this;
164  }
165 
166  @Override
167  public final int structurehash()
168  {
169  return 0;
170  }
171 
172  @Override
173  public final int hashCode()
174  {
175  return 0;
176  }
177 
178  @Override
179  public final boolean equals( final Object p_object )
180  {
181  return ( p_object instanceof ILiteral ) && ( this.hashCode() == p_object.hashCode() );
182  }
183  };
184 
192  @Nonnull
193  Stream<ITerm> values( final IPath... p_path );
194 
201  @Nonnull
202  Stream<ITerm> orderedvalues( @Nullable final IPath... p_path );
203 
209  boolean emptyValues();
210 
216  boolean negated();
217 
223  boolean hasAt();
224 
233  @Nonnull
234  ILiteral unify( @Nonnull final IContext p_context );
235 
242  @Nonnull
243  ILiteral allocate( @Nonnull final IContext p_context );
244 
245 }
ILiteral allocate( @Nonnull final IContext p_context)
allocate all variables with the current context
T shallowcopysuffix()
clones the object (shallow-copy) without full-qualified path, only suffix is used ...
IPath functorpath()
returns the path of the functor
interface to create shallow-copy of objects
Stream< ITerm > orderedvalues( @Nullable final IPath... p_path)
returns a stream over the ordered values in sequential ordering
Stream< ITerm > values(final IPath... p_path)
returns a stream over value items
ILiteral unify( @Nonnull final IContext p_context)
unifies variables if exists
IPath fqnfunctor()
returns the full-qualified functor with path and name
execution context with local data
Definition: IContext.java:42
boolean emptyValues()
check for empty values
int structurehash()
returns a hash value which defines a hash ove rthe structure
String functor()
returns the functor without path
boolean negated()
getter of the literal for the negation
< T > T raw()
cast to any raw value type
T deepcopysuffix()
clones the object (shallow-copy) without full-qualified path, only suffix is used ...
T deepcopy(@Nullable final IPath... p_prefix)
clones the object (shallow-copy)
T shallowcopy(@Nullable final IPath... p_prefix)
clones the object (shallow-copy)
boolean hasVariable()
checks if the literal has variables
boolean hasAt()
returns if the literal has an @ prefix