set a new variable, on the highest block hierarchy or global if no
hierarchy exists.

@param key
name of the variable
@param value
value of the variable
@return true if at least one local block hierarchy exists else false
7860
public boolean setNewVariable(Object key, Object value) {
		boolean success = false;

		success = setLocalVariable(key, value);

		if (!success) {
			setGlobalVariable(key, value);
			success = true;
		}

		return success;
	}
704380
public void setInt(String key, int value)
    {
        checkKeyIsUniform(key);
        NativeShaderData.setInt(getNative(), key, value);
    }
329908
@Override
    public <O> void set(String key, O value) {
        set(key,value,null,false);
    }
59249
public final void put(long key, long value) {
		if (!isLeaf) {
			throw DBLogger.newFatalInternal("Tree inconsistency.");
		}

		//in any case, check whether the key(+value) already exists
        int pos = binarySearch(0, nEntries, key, value);
        //key found? -> pos >=0
        if (pos >= 0) {
        	//check if values changes
            if (value != values[pos]) {
                markPageDirtyAndClone();
                values[pos] = value;
            }
            return;
        } 

        if (nEntries < ind.maxLeafN) {
            //okay so we add it locally
            pos = -(pos+1);
            markPageDirtyAndClone();
            if (pos < nEntries) {
                System.arraycopy(keys, pos, keys, pos+1, nEntries-pos);
                System.arraycopy(values, pos, values, pos+1, nEntries-pos);
            }
            keys[pos] = key;
            values[pos] = value;
            nEntries++;
            return;
		} else {
			//treat page overflow
			LLIndexPage newP;
			boolean isNew = false;
			boolean isPrev = false;
			//use ind.maxLeafN -1 to avoid pretty much pointless copying (and possible endless 
			//loops, see iterator tests)
			LLIndexPage next = (LLIndexPage) parent.getNextLeafPage(this);
			if (next != null && next.nEntries < ind.maxLeafN-1) {
				//merge
				newP = next;
				newP.markPageDirtyAndClone();
				isPrev = false;
			} else {
				//Merging with prev is not make a big difference, maybe we should remove it...
				LLIndexPage prev = (LLIndexPage) parent.getPrevLeafPage(this);
				if (prev != null && prev.nEntries < ind.maxLeafN-1) {
					//merge
					newP = prev;
					newP.markPageDirtyAndClone();
					isPrev = true;
				} else {
					newP = new LLIndexPage(ind, parent, true);
					isNew = true;
				}
			}
			
			markPageDirtyAndClone();
			int nEntriesToKeep = (nEntries + newP.nEntries) >> 1;
			if (isNew) {
				if (ind.isUnique()) {
					//This is an optimization for indices that add increasing unique numbers 
					//such as OIDs. For these, it increases the average fill-size.
					//find split point such that pages can be completely full
					int pos2 = binarySearch(0, nEntries, keys[0] + ind.maxLeafN, value);
					if (pos2 < 0) {
						pos2 = -(pos2+1);
					}
					if (pos2 > nEntriesToKeep) {
						nEntriesToKeep = pos2;
					}
				} else {
					//non-unique: we assume ascending keys.
					//If they are not ascending, merging with subsequent page sorts it out.
					nEntriesToKeep = (int) (ind.maxLeafN * 0.9);
				}
			}
			int nEntriesToCopy = nEntries - nEntriesToKeep;
			if (isNew) {
				//works only if new page follows current page
				System.arraycopy(keys, nEntriesToKeep, newP.keys, 0, nEntriesToCopy);
				System.arraycopy(values, nEntriesToKeep, newP.values, 0, nEntriesToCopy);
			} else if (isPrev) {
				//copy element to previous page
				System.arraycopy(keys, 0, newP.keys, newP.nEntries, nEntriesToCopy);
				System.arraycopy(values, 0, newP.values, newP.nEntries, nEntriesToCopy);
				//move element forward to beginning of page
				System.arraycopy(keys, nEntriesToCopy, keys, 0, nEntries-nEntriesToCopy);
				System.arraycopy(values, nEntriesToCopy, values, 0, nEntries-nEntriesToCopy);
			} else {
				//make space on next page
				System.arraycopy(newP.keys, 0, newP.keys, nEntriesToCopy, newP.nEntries);
				System.arraycopy(newP.values, 0, newP.values, nEntriesToCopy, newP.nEntries);
				//insert element in next page
				System.arraycopy(keys, nEntriesToKeep, newP.keys, 0, nEntriesToCopy);
				System.arraycopy(values, nEntriesToKeep, newP.values, 0, nEntriesToCopy);
			}
			nEntries = (short) nEntriesToKeep;
			newP.nEntries = (short) (nEntriesToCopy + newP.nEntries);
			//New page and min key
			if (isNew || !isPrev) {
				if (ind.isUnique()) {
					if (newP.keys[0] > key) {
						put(key, value);
					} else {
						newP.put(key, value);
					}
				} else {
					//why doesn't this work??? Because addSubPage needs the new keys already in the 
					//page
	//				parent.addSubPage(newP, newP.keys[0], newP.values[0]);
	//				locatePageForKey(key, value, false).put(key, value);
					if (newP.keys[0] > key || (newP.keys[0]==key && newP.values[0] > value)) {
						put(key, value);
					} else {
						newP.put(key, value);
					}
				}
			} else {
				if (ind.isUnique()) {
					if (keys[0] > key) {
						newP.put(key, value);
					} else {
						put(key, value);
					}
				} else {
					if (keys[0] > key || (keys[0]==key && values[0] > value)) {
						newP.put(key, value);
					} else {
						put(key, value);
					}
				}
			}
			if (isNew) {
				parent.addSubPage(newP, newP.keys[0], newP.values[0]);
			} else {
				//TODO probably not necessary
				newP.parent.updateKey(newP, newP.keys[0], newP.values[0]);
			}
			parent.updateKey(this, keys[0], values[0]);
		}
	}
547654
def set(self, block, name, value):
        
        self._kvs.set(self._key(block, name), value)
88765
@Nonnull
  public PreprocessorContext setGlobalVariable(@Nonnull final String name, @Nonnull final Value value) {
    assertNotNull("Variable name is null", name);

    final String normalizedName = assertNotNull(PreprocessorUtils.normalizeVariableName(name));

    if (normalizedName.isEmpty()) {
      throw makeException("Name is empty", null);
    }

    assertNotNull("Value is null", value);

    if (mapVariableNameToSpecialVarProcessor.containsKey(normalizedName)) {
      mapVariableNameToSpecialVarProcessor.get(normalizedName).setVariable(normalizedName, value, this);
    } else {
      if (isVerbose()) {
        final String valueAsStr = value.toString();
        if (globalVarTable.containsKey(normalizedName)) {
          logForVerbose("Replacing global variable [" + normalizedName + '=' + valueAsStr + ']');
        } else {
          logForVerbose("Defining new global variable [" + normalizedName + '=' + valueAsStr + ']');
        }
      }
      globalVarTable.put(normalizedName, value);
    }
    return this;
  }
1183076
public void put(K[] key, V value) {
        Node child = root.get(key[0]);
        if (child == null) {
            child = new Node(key[0]);
            root.put(key[0], child);
        }
        child.addChild(key, value, 1);
    }
69607
function setGlobalVariable(key, value) {
        return _execute('PUT', '/variables', {
            key: key,
            value: value
        }, 'Could not add or update variable key [' + key + ' with value [' + value + ']');
    }
1334977
public void set(String key, Object value) {
		if (globalVar == null) globalVar = new HashMap<String, Object>();
		globalVar.put(key, value);
	}
1216974
public final V put(K key, V value) {
	BinTreeNode<K,V> prev = null;
	BinTreeNode<K,V> node = root;
	int key_hash_code = key.hashCode();

	while(node != null) {
	    prev = node;
	    if(key_hash_code < node.keyHashCode) {
		node = node.left;
	    }
	    else {
		if((key_hash_code > node.keyHashCode) || !node.key.equals(key)) {
		    node = node.right;
		}
		else {
		    cachedHashCode -= node.hashCode();
		    V temp = node.value;
		    node.value = value;
		    cachedHashCode += node.hashCode();
		    return temp;
		}
	    }
	}

	size++;

	BinTreeNode<K,V> new_node = new BinTreeNode<K,V>(key, value);
	cachedHashCode += new_node.hashCode(); // invalidate the cached hash code

	if(prev == null) {
	    root = new_node;
	    return null;
	}

	if(key_hash_code < prev.keyHashCode) {
	    prev.left = new_node;
	}
	else {
	    prev.right = new_node;
	}

	return null;
    }
195661
public boolean setNextKeyValue(Text key, Row value)
            throws IOException {
        if (!_rows.hasNext()) {
            Closeables.close(this, true);
            return false;
        }

        try {
            Map<String, Object> content = _rows.next();
            key.set(Coordinate.fromJson(content).toString());
            value.set(content);
            _rowsRead += 1;
        } catch (Exception e) {
            for (Throwable cause : Throwables.getCausalChain(e)) {
                Throwables.propagateIfInstanceOf(cause, IOException.class);
            }
            throw new IOException("Failed to read next row", e);
        }
        return true;
    }
429788
protected void setVariable(String variableName, Object value, ExecutionEntity sourceExecution, boolean fetchAllVariables) {

    if (fetchAllVariables == true) {

      // If it's in the cache, it's more recent
      if (usedVariablesCache.containsKey(variableName)) {
        updateVariableInstance(usedVariablesCache.get(variableName), value, sourceExecution);
      }

      // If the variable exists on this scope, replace it
      if (hasVariableLocal(variableName)) {
        setVariableLocal(variableName, value, sourceExecution, true);
        return;
      }

      // Otherwise, go up the hierarchy (we're trying to put it as high as possible)
      VariableScopeImpl parentVariableScope = getParentVariableScope();
      if (parentVariableScope != null) {
        if (sourceExecution == null) {
          parentVariableScope.setVariable(variableName, value);
        } else {
          parentVariableScope.setVariable(variableName, value, sourceExecution, true);
        }
        return;
      }

      // We're as high as possible and the variable doesn't exist yet, so
      // we're creating it
      if (sourceExecution != null) {
        createVariableLocal(variableName, value, sourceExecution);
      } else {
        createVariableLocal(variableName, value);
      }

    } else {

      // Check local cache first
      if (usedVariablesCache.containsKey(variableName)) {

        updateVariableInstance(usedVariablesCache.get(variableName), value, sourceExecution);

      } else if (variableInstances != null && variableInstances.containsKey(variableName)) {

        updateVariableInstance(variableInstances.get(variableName), value, sourceExecution);

      } else {

        // Not in local cache, check if defined on this scope
        // Create it if it doesn't exist yet
        VariableInstanceEntity variable = getSpecificVariable(variableName);
        if (variable != null) {
          updateVariableInstance(variable, value, sourceExecution);
          usedVariablesCache.put(variableName, variable);
        } else {

          VariableScopeImpl parent = getParentVariableScope();
          if (parent != null) {
            if (sourceExecution == null) {
              parent.setVariable(variableName, value, fetchAllVariables);
            } else {
              parent.setVariable(variableName, value, sourceExecution, fetchAllVariables);
            }

            return;
          }

          variable = createVariableInstance(variableName, value, sourceExecution);
          usedVariablesCache.put(variableName, variable);

        }

      }

    }

  }
1026351
@Override
    public void setTessVariable(String key, String value) {
        prop.setProperty(key, value);
    }
1151109
public static void setLocalProperty(final String key, final String value) {
        if (null == key) {
            LOGGER.log(Level.WARN, "local.props can not set null key");

            return;
        }
        if (null == value) {
            LOGGER.log(Level.WARN, "local.props can not set null value");

            return;
        }

        localProps.setProperty(key, value);
    }
1255959
@Override
    public void addVariable(String varName, Object value) {
        synchronized (mGlobalVariables) {
            mGlobalVariables.put(varName, value);
        }
        refreshGlobalBindings();
    }
1077286
public ObjectErrorBuilder variables(final String key, final Object value) {
        this.variables.put(key, value);
        return this;
    }
606424
public boolean next(K key, U value) throws IOException {
    if (hasNext()) {
      WritableUtils.cloneInto(key, khead);
      WritableUtils.cloneInto(value, vhead);
      next();
      return true;
    }
    return false;
  }