Check data type and call super.add to add data - synchronized in super
487139
public boolean add(SpdData data) {
        if (data == null)
            return false;
        if (data instanceof SpdLong) {
            return super.add(data);
        } else {
            return false;
        }
    }
1277009
private void checkType(BtrpOperand e) {
        if (!(e instanceof BtrpNumber)) {
            throw new UnsupportedOperationException(e + " must be a '" + prettyType() + "' instead of a '" + e.prettyType() + "'");
        }
    }
1320473
private void applyDataUpdate(final M data) {
        this.data = data;
        CompletableFutureLite<M> currentSyncFuture = null;
        Future<M> currentSyncTask = null;

        // Check if sync is in process.
        synchronized (syncMonitor) {
            if (syncFuture != null) {
                currentSyncFuture = syncFuture;
                currentSyncTask = syncTask;
                syncFuture = null;
                syncTask = null;
            }
        }

        if (currentSyncFuture != null) {
            currentSyncFuture.complete(data);
        }

        if (currentSyncTask != null && !currentSyncTask.isDone()) {
            currentSyncTask.cancel(false);
        }

        setConnectionState(CONNECTED);

        // Notify data update
        try {
            notifyPrioritizedObservers(data);
        } catch (CouldNotPerformException ex) {
            ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update!", ex), logger);
        }

        try {
            dataObservable.notifyObservers(data);
        } catch (CouldNotPerformException ex) {
            ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update to all observer!", ex), logger);
        }
    }
1016306
private Description checkSubtype(ClassTree tree, VisitorState state) {
    ClassSymbol sym = ASTHelpers.getSymbol(tree);
    if (sym == null) {
      return NO_MATCH;
    }
    Type superType = immutableSupertype(sym, state);
    if (superType == null) {
      return NO_MATCH;
    }
    String message =
        String.format(
            "Class extends @Immutable type %s, but is not annotated as immutable", superType);
    Fix fix =
        SuggestedFix.builder()
            .prefixWith(tree, "@Immutable ")
            .addImport(Immutable.class.getName())
            .build();
    return buildDescription(tree).setMessage(message).addFix(fix).build();
  }
68384
def _add(a, b, relicAdd):
    
    # Check types, create a result object of the same type, and call the relic
    # function.
    assertSameType(a,b)
    result = type(a)()
    relicAdd(byref(result), byref(a), byref(b))
    return result
377107
function createPrimaryTypeChecker(type) {

    return createChainableChecker(function (data, dataName, componentName, fullDataName) {

        var dataValue = data[dataName];
        var dataType = getDataType(dataValue);

        if (dataType !== type) {
            throw new Error('[SAN ERROR] '
                + 'Invalid ' + componentName + ' data `' + fullDataName + '` of type'
                + '(' + dataType + ' supplied to ' + componentName + ', '
                + 'expected ' + type + ')'
            );
        }

    });

}
304483
@Override
	protected synchronized void checkDataMaps() throws IOException {
		if (lastUpdateCheck == 0 || lastUpdateCheck < System.currentTimeMillis() - updateInterval) {
			String versionOnServer = getVersionFromServer();
			if (currentVersion == null || versionOnServer.compareTo(currentVersion) > 0) {
				loadDataFromInternet();
				currentVersion = versionOnServer;
			}
			lastUpdateCheck = System.currentTimeMillis();
		}
	}
1179557
void add(final byte type, final Object value) {
    final int w = write.getAndIncrement();

    if (w < size) {
      writeAt(w, type, value);
    }

    // countdown could wrap around, however we check the state of finished in here.
    // MUST be called after write to make sure that results and states are synchronized.
    final int c = countdown.decrementAndGet();

    if (c < 0) {
      throw new IllegalStateException("already finished (countdown)");
    }

    // if this thread is not the last thread to check-in, do nothing..
    if (c != 0) {
      return;
    }

    // make sure this can only happen once.
    // This protects against countdown, and write wrapping around which should very rarely
    // happen.
    if (!done.compareAndSet(false, true)) {
      throw new IllegalStateException("already finished");
    }

    done(collect());
  }
893733
def synchronized(func):  # pylint: disable=invalid-name
  """"""
  @functools.wraps(func)
  def synchronized_method(self, *args, **kwargs):
    """Wrapper to return."""
    if not hasattr(self, '_lock'):
      if func.__name__ in type(self).__dict__:
        hint = ''
      else:
        hint = (' Might be missing call to super in %s.__init__?' %
                type(self).__name__)
      raise RuntimeError('Can\'t synchronize method `%s` of %s without '
                         'attribute `_lock`.%s' %
                         (func.__name__, type(self).__name__, hint))
    with self._lock:  # pylint: disable=protected-access
      return func(self, *args, **kwargs)
  return synchronized_method
877661
def __add_callback(self, type_, func, serialised_if_crud=True):
        """"""
        Validation.callable_check(func)
        with self.__callbacks:
            self.__callbacks[type_].append((func, serialised_if_crud))
260786
function onData( addend ) {
		/**
		* FUNCTION: onData( newVal, encoding, clbk )
		*	Data event handler. Performs addition.
		*
		* @private
		* @param {Number} newVal - streamed data value
		* @param {String} encoding
		* @param {Function} clbk - callback to invoke after performing addition. Function accepts two arguments: [ error, chunk ].
		*/
		return function onData( newVal, encoding, clbk ) {
			clbk( null, newVal+addend );
		}; // end FUNCTION onData()
	}
60770
public boolean add(E o) {
    	if(o!=null && !contains(o)){
    		return super.add(o);
    	}
    	return false;
    }
1126383
@Override
  public void add(Object data, Class<?>... typeSpecs) {
    //    if (data == null) return;
    //
    //    typeSpecs = determineTypeSpecs(data, typeSpecs);
    //    if (this.getDefaultDataType() == null) this.setDefaultDataType(typeSpecs);
    //
    //    mReps.put(this.getSpecsAsString(typeSpecs), data);
    Representation representation = new Representation(data, typeSpecs);
    mReps.put(representation.getTypeSpecsString(), representation);
  }
464975
public void addExtends(String superType) {
		if (!Strings.isEmpty(superType)
				&& !Capacity.class.getName().equals(superType)) {
			JvmParameterizedTypeReference superTypeRef = newTypeRef(this.sarlCapacity, superType);
			JvmTypeReference baseTypeRef = findType(this.sarlCapacity, Capacity.class.getCanonicalName());
			if (isSubTypeOf(this.sarlCapacity, superTypeRef, baseTypeRef)) {
				this.sarlCapacity.getExtends().add(superTypeRef);
				return;
			}
		}
	}
389277
public void addDatatype(String pluralDatatype, String datatype) {
		pluralDatatype = Utils.noSpaces(Utils.stripAndTrim(pluralDatatype, " "), "-");
		datatype = Utils.noSpaces(Utils.stripAndTrim(datatype, " "), "-");
		if (StringUtils.isBlank(pluralDatatype) || StringUtils.isBlank(datatype)) {
			return;
		}
		if (getDatatypes().size() >= Config.MAX_DATATYPES_PER_APP) {
			LoggerFactory.getLogger(App.class).warn("Maximum number of types per app reached - {}.",
					Config.MAX_DATATYPES_PER_APP);
			return;
		}
		if (!getDatatypes().containsKey(pluralDatatype) && !getDatatypes().containsValue(datatype) &&
					!ParaObjectUtils.getCoreTypes().containsKey(pluralDatatype)) {
			getDatatypes().put(pluralDatatype, datatype);
		}
	}
812946
def record_add_types(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/addTypes' % object_id, input_params, always_retry=always_retry, **kwargs)
1010320
def sync(obj, engine):
    """"""
    snapshot = Condition()
    # Only expect values (or lack of a value) for columns that have been explicitly set
    for column in sorted(_obj_tracking[obj]["marked"], key=lambda col: col.dynamo_name):
        value = getattr(obj, column.name, None)
        value = engine._dump(column.typedef, value)
        condition = column == value
        # The renderer shouldn't try to dump the value again.
        # We're dumping immediately in case the value is mutable,
        # such as a set or (many) custom data types.
        condition.dumped = True
        snapshot &= condition
    _obj_tracking[obj]["snapshot"] = snapshot