public static Stella_Object mappedValueOf(Stella_Object self, KeyValueMap mapping, boolean createskolemP) {
    { Stella_Object value = ((mapping != null) ? mapping.lookup(self) : ((Stella_Object)(null)));

      if (value != null) {
        return (value);
      }
      if ((((QueryIterator)(Logic.$QUERYITERATOR$.get())) != null) &&
          ((!Logic.variableP(self)) ||
           (((PatternVariable)(self)).boundToOffset != Stella.NULL_INTEGER))) {
        value = Logic.argumentBoundTo(self);
      }
      else {
        {
          value = Logic.valueOf(self);
          if (Logic.variableP(self)) {
            value = null;
          }
        }
      }
      if ((mapping != null) &&
          (value != null)) {
        if (!(Stella_Object.isaP(self, Logic.SGT_LOGIC_PROPOSITION))) {
          mapping.insertAt(self, value);
        }
        return (value);
      }
      if (createskolemP) {
        return (PatternVariable.createSkolemForUnmappedVariable(((PatternVariable)(self)), mapping));
      }
      else {
        return (null);
      }
    }
  }