25 package org.lightjason.agentspeak.language.instantiable.plan.statistic;
27 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
32 import javax.annotation.Nonnegative;
33 import javax.annotation.Nonnull;
34 import java.text.MessageFormat;
35 import java.util.concurrent.atomic.AtomicLong;
36 import java.util.stream.Stream;
55 private final AtomicLong
m_fail =
new AtomicLong();
79 return m_fail.get() + m_successful.get();
86 return m_successful.get();
93 final double l_sum = m_successful.get() + m_fail.get();
96 : m_successful.get() / l_sum;
109 final double l_sum = m_successful.get() + m_fail.get();
112 : m_fail.get() / l_sum;
119 m_successful.incrementAndGet();
127 m_fail.incrementAndGet();
136 new CConstant<>(
"PlanSuccessful", m_successful.get() ),
138 new CConstant<>(
"PlanRuns", m_successful.get() + m_fail.get() ),
149 return m_plan.hashCode();
153 @SuppressFBWarnings(
"EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS" )
154 public final
boolean equals( final Object p_object )
157 && ( this.
hashCode() == p_object.hashCode() );
182 return Integer.compare( this.
hashCode(), p_other.hashCode() );
final IPlanStatistic incrementfail()
increments the failed executions
plan statistic to count execution values
static IPlanStatistic from( @Nonnull final IPlan p_plan)
factory
final long fail()
returns number of failed execution
final IPlanStatistic incrementsuccessful()
increments the successful executions
final boolean equals(final Object p_object)
CPlanStatistic( @Nonnull final IPlan p_plan)
ctor
final Stream< IVariable<?> > variables()
returns a stream with variables of the internal data
final IPlan m_plan
plan reference
final int compareTo( @Nonnull final IPlanStatistic p_other)
final double failratio()
returns the ratio of failed executions
final double successfulratio()
returns the ratio of successful execution
final AtomicLong m_fail
count of fail exeuctions
final IPlan plan()
plan reference
final long count()
returns the number of executions
final long successful()
returns number of successful execution
final AtomicLong m_successful
count of successful exeuctions