MutableContext (Apache OpenNLP Tools 1.9.5 API)
Date: 2026-06-18

opennlp.tools.ml.model

## Class MutableContext

- java.lang.Object
- - opennlp.tools.ml.model.Context
  - - opennlp.tools.ml.model.MutableContext

-     public class MutableContext
      extends Context

  Class used to store parameters or expected values associated with this context which can be updated or assigned.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MutableContext(int[] outcomePattern, double[] parameters)` Creates a new parameters object with the specified parameters associated with the specified outcome pattern.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(int outcome)`
    `void` | `setParameter(int outcomeIndex, double value)` Assigns the parameter or expected value at the specified outcomeIndex the specified value.
    `void` | `updateParameter(int outcomeIndex, double value)` Updated the parameter or expected value at the specified outcomeIndex by adding the specified value to its current value.

    - ### Methods inherited from class opennlp.tools.ml.model.Context

      `equals, getOutcomes, getParameters, hashCode`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MutableContext

          public MutableContext(int[] outcomePattern,
                                double[] parameters)

      Creates a new parameters object with the specified parameters associated with the specified outcome pattern.
      Parameters:
        `outcomePattern` - Array of outcomes for which parameters exists for this context.
        `parameters` - Parameters for the outcomes specified.

  - ### Method Detail

    - #### setParameter

          public void setParameter(int outcomeIndex,
                                   double value)

      Assigns the parameter or expected value at the specified outcomeIndex the specified value.
      Parameters:
        `outcomeIndex` - The index of the parameter or expected value to be updated.
        `value` - The value to be assigned.

    - #### updateParameter

          public void updateParameter(int outcomeIndex,
                                      double value)

      Updated the parameter or expected value at the specified outcomeIndex by adding the specified value to its current value.
      Parameters:
        `outcomeIndex` - The index of the parameter or expected value to be updated.
        `value` - The value to be added.

    - #### contains

          public boolean contains(int outcome)

Copyright © 2026 The Apache Software Foundation. All rights reserved.