Sets an element to the given value

@param i the index
@param newValue the new value
@return the old value
198552
public int set(int i, int newValue) {
        while (true) {
            try {
                updateLock.lock();
                try {
                    return store.get().set(i, newValue);
                } finally {
                    updateLock.unlock();
                }
            } catch (PaletteFullException pfe) {
                resizeLock.lock();
                try {
                    try {
                        return store.get().set(i, newValue);
                    } catch (PaletteFullException pfe2) {
                        if (store.get().isPaletteMaxSize()) {
                            store.set(new AtomicShortIntDirectBackingArray(store.get()));
                        } else {
                            store.set(new AtomicShortIntPaletteBackingArray(store.get(), true));
                        }
                    }
                } finally {
                    resizeLock.unlock();
                }
            }
        }
    }
202987
private void setValue(Object newValue) {
        try {
            if (this.type == null)
                value = newValue;
            else if (this.type.equals("java.lang.String"))
                value = newValue;
            else if (this.type.equals("java.lang.Boolean"))
                value = Boolean.valueOf((String) newValue);
            else if (this.type.equals("java.lang.Integer"))
                value = new Integer(((String) newValue));
            else if (this.type.equals("java.lang.Double"))
                value = new Double(((String) newValue));
            else if (this.type.equals("java.lang.Byte"))
                value = new Byte(((String) newValue));
            else if (this.type.equals("java.lang.Short"))
                value = new Short(((String) newValue));
            else if (this.type.equals("java.lang.Long"))
                value = new Long(((String) newValue));
            else if (this.type.equals("java.lang.Float"))
                value = new Float(((String) newValue));
            else if (this.type.equals("java.lang.Character")) 
                value = Character.valueOf(((String) newValue).charAt(0)); 
            else
                value = newValue;

        } catch (NumberFormatException nfe) {
            Tr.warning(tc, "INCOMPATIBLE_PROPERTY_TYPE_J2CA0207", new Object[] { name, type, newValue });
        }

    }
711019
public ModelNode set(final String newValue) {
        if (newValue == null) {
            throw new IllegalArgumentException("newValue is null");
        }
        checkProtect();
        value = new StringModelValue(newValue);
        return this;
    }
1028975
public Object set(int index, Object element)
    {
        checkElement(element);
        return super.set(index, element);
    }
25236
public int setInt(
        @DoNotSub final int index,
        final int element)
    {
        checkIndex(index);

        final int previous = elements[index];
        elements[index] = element;

        return previous;
    }
201002
@NonNull
    @Override
    public MutableArray insertValue(int index, Object value) {
        synchronized (lock) {
            if (!internalArray.insert(index, Fleece.toCBLObject(value))) { throwRangeException(index); }
            return this;
        }
    }
914920
public void setValue(int n, ValueType value) {
        if (VERIFY_INTEGRITY && value == null) {
            throw new IllegalArgumentException();
        }
        if (!isValid()) {
            throw new IllegalStateException("accessing top or bottom frame");
        }
        slotList.set(n, value);
    }
1202456
public T set(int index, T element)
    {
        switch (index)
        {
            case 0:
                T previousElement1 = this.element1;
                this.element1 = element;
                return previousElement1;
            case 1:
                T previousElement2 = this.element2;
                this.element2 = element;
                return previousElement2;
            default:
                throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + this.size());
        }
    }
805109
public void set1Value(int index, String newValue) {
        try {
            value.set( index, newValue );
        }
        catch (IndexOutOfBoundsException e) {
            Log.e(TAG, "X3D MFString set1Value(int index, ...) out of bounds." + e);
        }
        catch (Exception e) {
            Log.e(TAG, "X3D MFString set1Value(int index, ...)  exception " + e);
        }
    }
251376
public AtomicValue<byte[]>   trySet(final byte[] newValue) throws Exception
    {
        MutableAtomicValue<byte[]>  result = new MutableAtomicValue<byte[]>(null, null, false);

        MakeValue                   makeValue = new MakeValue()
        {
            @Override
            public byte[] makeFrom(byte[] previous)
            {
                return newValue;
            }
        };
        tryOptimistic(result, makeValue);
        if ( !result.succeeded() && (mutex != null) )
        {
            tryWithMutex(result, makeValue);
        }

        return result;
    }
881301
public void setValue(int newValue) {
		setValue(newValue, true, true);
		spinner.setValue(new Integer(value));
	}
310755
public ValueGraphElement getElement(int i) {
		if((i < 0) || (i >= values.length)) {
			throw new NoSuchElementException();
		}
		int minHeight = config.valueMinHeight;
		
		// normalize height to value between 0 and 1:
		float value = ((float) values[i]) / ((float) maxValue);
		float usableHeight = height - minHeight;
		int valueHeight = (int) (usableHeight * value) + minHeight;
		
		int elX = Graph.xlateX(width, values.length, i);
		int elW = Graph.xlateX(width, values.length, i+1) - elX;
		int elY = height - valueHeight;
		boolean hot = i == highlightValue;
		return new ValueGraphElement(x + elX, y + elY, elW, valueHeight, hot, config);
	}
369968
public T put(final int key, final T value) {
		int index = ((key & 0x7FFFFFFF) % elementKeys.length);
		T oldvalue = null;

		long entry = elementKeys[index];
		if (entry == Integer.MIN_VALUE) {
			++elementCount;
		} else {
			oldvalue = elementValues[index];
			collisions++;
		}
		elementKeys[index] = key;
		elementValues[index] = value;
		return oldvalue;
	}
3738
public void setValueOn(String newValue, @Nullable String newName) {
        if (isChecked()) { // refining on valueOn: facetRefinement needs an update
            searcher.updateFacetRefinement(attribute, valueOn, false)
                    .updateFacetRefinement(newName != null ? newName : attribute, newValue, true)
                    .search();
        }
        this.valueOn = newValue;
        applyEventualNewAttribute(newName);
    }
1124243
public void setValue(Object newValue) {
        synchronized (lock) {
            // Allow only once.
            if (ready) {
                return;
            }

            result = newValue;
            ready = true;
            if (waiters > 0) {
                lock.notifyAll();
            }
        }

        notifyListeners();
    }
586712
public void add(T newValue) {
		if (this.isSet) {
			if (!this.isMultiple
					&& newValue != this.object && (newValue == null || !newValue.equals(this.object))) {
				this.isMultiple = true;
				this.object = null;
			}
		} else {
			this.object = newValue;
			this.isSet = true;
			this.isMultiple = false;
		}
	}
1185217
public void setUnchecked(T newValue) throws InterruptedException {
    try {
      set(newValue);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }