LightJason - AgentSpeak(L++)
ITerm.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 
27 
28 import javax.annotation.Nonnull;
29 import javax.annotation.Nullable;
30 import java.io.Serializable;
31 
32 
36 public interface ITerm extends Serializable, IStructureHash, IDeepCopy<ITerm>
37 {
41  long serialVersionUID = -3640918490398129717L;
42 
46  ITerm EMPTY = new ITerm()
47  {
51  private static final long serialVersionUID = -3396420174718981909L;
52 
53  @Nonnull
54  @Override
55  public final String functor()
56  {
57  return "";
58  }
59 
60  @Nonnull
61  @Override
62  public final IPath functorpath()
63  {
64  return IPath.EMPTY;
65  }
66 
67  @Nonnull
68  @Override
69  public final IPath fqnfunctor()
70  {
71  return IPath.EMPTY;
72  }
73 
74  @Override
75  public final boolean hasVariable()
76  {
77  return false;
78  }
79 
80  @Nullable
81  @Override
82  public final <T> T raw()
83  {
84  return null;
85  }
86 
87  @Nonnull
88  @Override
89  public final ITerm deepcopy( @Nullable final IPath... p_prefix )
90  {
91  return this;
92  }
93 
94  @Nonnull
95  @Override
96  public final ITerm deepcopysuffix()
97  {
98  return this;
99  }
100 
101  @Override
102  public final int structurehash()
103  {
104  return 0;
105  }
106  };
107 
113  @Nonnull
114  String functor();
115 
121  @Nonnull
122  IPath functorpath();
123 
130  @Nonnull
131  IPath fqnfunctor();
132 
138  boolean hasVariable();
139 
146  @Nullable
147  <T> T raw();
148 
156  @Nonnull
157  @SuppressWarnings( "unchecked" )
158  default <T extends ITerm> T term()
159  {
160  return (T) this;
161  }
162 
163 }
IPath functorpath()
returns the path of the functor
interface to create deep-copy of objects
Definition: IDeepCopy.java:37
IPath fqnfunctor()
returns the full-qualified functor with path and name
default< T extends ITerm > T term()
casts the object to a term-type
Definition: ITerm.java:158
int structurehash()
returns a hash value which defines a hash ove rthe structure
String functor()
returns the functor without path
< 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)
boolean hasVariable()
checks if the literal has variables