IBeliefbaseOnDemand.java

  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. package org.lightjason.agentspeak.beliefbase;

  24. import org.lightjason.agentspeak.agent.IAgent;
  25. import org.lightjason.agentspeak.beliefbase.view.IView;
  26. import org.lightjason.agentspeak.common.CCommon;
  27. import org.lightjason.agentspeak.error.CIllegalStateException;
  28. import org.lightjason.agentspeak.language.ILiteral;

  29. import javax.annotation.Nonnull;
  30. import java.util.Collection;
  31. import java.util.Collections;
  32. import java.util.stream.Stream;


  33. /**
  34.  * on-demand beliefbase for creating trigger-events
  35.  * without any percistency
  36.  */
  37. public abstract class IBeliefbaseOnDemand<T extends IAgent<?>> extends IBaseBeliefbase
  38. {

  39.     @Override
  40.     public boolean empty()
  41.     {
  42.         return true;
  43.     }

  44.     @Override
  45.     public int size()
  46.     {
  47.         return 0;
  48.     }

  49.     @Nonnull
  50.     @Override
  51.     public Stream<ILiteral> streamLiteral()
  52.     {
  53.         return Stream.empty();
  54.     }

  55.     @Nonnull
  56.     @Override
  57.     public ILiteral add( @Nonnull final ILiteral p_literal )
  58.     {
  59.         return super.add( p_literal );
  60.     }

  61.     @Nonnull
  62.     @Override
  63.     public ILiteral remove( @Nonnull final ILiteral p_literal )
  64.     {
  65.         return super.remove( p_literal );
  66.     }

  67.     @Override
  68.     public boolean containsLiteral( @Nonnull final String p_key )
  69.     {
  70.         return false;
  71.     }

  72.     @Nonnull
  73.     @Override
  74.     public Collection<ILiteral> literal( @Nonnull final String p_key )
  75.     {
  76.         return Collections.<ILiteral>emptySet();
  77.     }

  78.     @Nonnull
  79.     @Override
  80.     public final IView view( @Nonnull final String p_key )
  81.     {
  82.         throw new CIllegalStateException( CCommon.languagestring( IBeliefbaseOnDemand.class, "nostorage", this, p_key ) );
  83.     }

  84.     @Override
  85.     public final IView viewOrDefault( @Nonnull final String p_key, final IView p_default )
  86.     {
  87.         throw new CIllegalStateException( CCommon.languagestring( IBeliefbaseOnDemand.class, "nostorage", this, p_key ) );
  88.     }

  89.     @Nonnull
  90.     @Override
  91.     public final Stream<IView> streamView()
  92.     {
  93.         return Stream.empty();
  94.     }

  95.     @Nonnull
  96.     @Override
  97.     public final IBeliefbase clear()
  98.     {
  99.         return this;
  100.     }

  101.     @Nonnull
  102.     @Override
  103.     public final IView add( @Nonnull final IView p_view )
  104.     {
  105.         throw new CIllegalStateException( CCommon.languagestring( IBeliefbaseOnDemand.class, "nostorage", this, p_view.name() ) );
  106.     }

  107.     @Nonnull
  108.     @Override
  109.     public final IView remove( @Nonnull final IView p_view )
  110.     {
  111.         throw new CIllegalStateException( CCommon.languagestring( IBeliefbaseOnDemand.class, "nostorage", this, p_view.name() ) );
  112.     }

  113.     @Override
  114.     public final boolean containsView( @Nonnull final String p_key )
  115.     {
  116.         return false;
  117.     }

  118. }