summaryrefslogtreecommitdiff
path: root/src/api/java/cvc5/Stat.java
blob: 964f4025c08a33c4d438b1759bc63bcd559fc4eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/******************************************************************************
 * Top contributors (to current version):
 *   Aina Niemetz, Andrew Reynolds, Abdalrhman Mohamed, Mudathir Mohamed
 *
 * This file is part of the cvc5 project.
 *
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
 * in the top-level source directory and their institutional affiliations.
 * All rights reserved.  See the file COPYING in the top-level source
 * directory for licensing information.
 * ****************************************************************************
 *
 * The cvc5 java API.
 */

package cvc5;

import java.util.Map;

/**
 * Represents a snapshot of a single statistic value.
 * A value can be of type `long`, `double`, `String` or a histogram
 * (`Map<String, Long>`).
 * The value type can be queried (using `isInt()`, `isDouble()`, etc.) and
 * the stored value can be accessed (using `getInt()`, `getDouble()`, etc.).
 * It is possible to query whether this statistic is an expert statistic by
 * `isExpert()` and whether its value is the default value by `isDefault()`.
 */
public class Stat extends AbstractPointer
{
   // region construction and destruction
   Stat(Solver solver, long pointer)
   {
     super(solver, pointer);
   }

   protected static native void deletePointer(long pointer);

   public long getPointer()
   {
     return pointer;
   }

   @Override
   public void finalize()
   {
     deletePointer(pointer);
   }

   // endregion

  /**
   * @return a string representation of this Stat
   */
  protected native String toString(long pointer);

  /**
   * Is this value intended for experts only?
   * @return Whether this is an expert statistic.
   */
  public boolean isExpert()
  {
    return isExpert(pointer);
  }

  private native boolean isExpert(long pointer);

  /**
   * Does this value hold the default value?
   * @return Whether this is a defaulted statistic.
   */
  public boolean isDefault()
  {
    return isDefault(pointer);
  }

  private native boolean isDefault(long pointer);

  /**
   * Is this value an integer?
   * @return Whether the value is an integer.
   */
  public boolean isInt()
  {
    return isInt(pointer);
  }

  private native boolean isInt(long pointer);

  /**
   * Return the integer value.
   * @return The integer value.
   */
  public long getInt()
  {
    return getInt(pointer);
  }

  private native long getInt(long pointer);

  /**
   * Is this value a double?
   * @return Whether the value is a double.
   */
  public boolean isDouble()
  {
    return isDouble(pointer);
  }

  private native boolean isDouble(long pointer);

  /**
   * Return the double value.
   * @return The double value.
   */
  public double getDouble()
  {
    return getDouble(pointer);
  }

  private native double getDouble(long pointer);

  /**
   * Is this value a string?
   * @return Whether the value is a string.
   */
  public boolean isString()
  {
    return isString(pointer);
  }

  private native boolean isString(long pointer);

  /**
   * Return the string value.
   * @return The string value.
   */
  public String getString()
  {
    return getString(pointer);
  }

  private native String getString(long pointer);

  /**
   * Is this value a histogram?
   * @return Whether the value is a histogram.
   */
  public boolean isHistogram()
  {
    return isHistogram(pointer);
  }

  private native boolean isHistogram(long pointer);

  /**
   * Return the histogram value.
   * @return The histogram value.
   */
  public Map<String, Long> getHistogram()
  {
      return getHistogram(pointer);
  }

  private native Map<String, Long> getHistogram(long pointer);
};
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback