Conditions for other to satisfy before add/sub.
978189
def _validate_other_add_sub(self, other):
        """"""
        if not isinstance(other, self.__class__):
            raise exceptions.IncompatibleSources(
                'Can only operate on {0}.'.format(self.__class__.__name__))
522319
def overlapping(self, other):
        """"""
        return (
            other.start in self.ref_range) or (
            self.start in other.ref_range)
1316388
function addIfNotExist(set, item) {
  if (set.has(item)) return true;
  set.add(item);
  return false;
}
501348
public void insertBetween(Instruction _prev, Instruction _next, Instruction _newOne) {
      _newOne.setNextExpr(null);
      _newOne.setPrevExpr(null);
      if (_prev == null) {
         // this is the new head
         if (_next == null) {
            head = tail = _newOne;
         } else {
            _newOne.setNextExpr(head);
            head.setPrevExpr(_newOne);
            head = _newOne;
         }
      } else if (_next == null) {
         _newOne.setPrevExpr(tail);
         tail.setNextExpr(_newOne);
         tail = _newOne;
      } else {
         _newOne.setNextExpr(_prev.getNextExpr());
         _newOne.setPrevExpr(_next.getPrevExpr());
         _prev.setNextExpr(_newOne);
         _next.setPrevExpr(_newOne);
      }

   }
917700
def _add_dep(self, dep):
        
        if dep in self._deps:
            self._deps[dep] += 1
        else:
            self._deps[dep] = 1
            dep._dependents[self] = None
815111
private void simpleIncrement(TensorBase other, double multiplier) {
    Preconditions.checkArgument(Arrays.equals(other.getDimensionNumbers(), getDimensionNumbers()));
    if (other instanceof DenseTensorBase) {
      double[] otherTensorValues = ((DenseTensorBase) other).values;
      Preconditions.checkArgument(otherTensorValues.length == values.length);
      int length = values.length;
      for (int i = 0; i < length; i++) {
        values[i] += otherTensorValues[i] * multiplier;
      }
    } else {
      int otherSize = other.size();
      for (int i = 0; i < otherSize; i++) {
        long keyNum = other.indexToKeyNum(i);
        double value = other.getByIndex(i);
        values[keyNumToIndex(keyNum)] += value * multiplier;
      }
    }
  }
244751
def insert(to_add, after: nil, before: nil)
      if after && before || !after && !before
        raise ArgumentError, 'either :after or :before keys should be passed'
      end
      matcher = after || before
      matcher_proc = if matcher.is_a?(Proc)
                       __to_matcher(&matcher)
                     else
                       __to_matcher(matcher)
                     end
      node = each_node.find(&matcher_proc)
      return unless node
      new_node = after ? insert_after_node(to_add, node) : insert_before_node(to_add, node)
      new_node.data
    end
111235
public void elemSubtract(VTensor other) {
        checkEqualSize(this, other);
        for (int c = 0; c < this.size(); c++) {
            subtractValue(c, other.getValue(c));
        }
    }
733724
def +(other)
      case other
      when LinExpr
        # Add the terms of two expressions
        # For now, this assumes variables are not duplicated
        LinExpr.new(@terms.merge(other.terms) { |_, c1, c2| c1 + c2 })
      when Variable
        # Add the variable to the expression
        self + other * 1.0
      else
        fail TypeError
      end
    end
843488
def coerce(self, other, is_positive=True):
        
        if hasattr(other, 'get_domain') and hasattr(other, 'lower') and hasattr(other, 'upper'):
            if self.is_domain_equal(other):
                return other
            else:
                msg = "Cannot merge partial orders with different domains!"
                raise CellConstructionFailure(msg)
        if isinstance(other, LinearOrderedCell):
            # convert other's domain to a chain/dag
            # first ensure domain has same size and elements
            raise NotImplemented("Please Implement me!")
        domain = self.get_domain()
        if other in domain:
            c = self.__class__()
            if not is_positive:
                # add value to lower (negative example)
                c.lower = set([other])
                c.upper = set()
            else:
                # add value to upper (positive example)
                c.upper = set([other])
                c.lower = set()
            return c
        else:       
            raise CellConstructionFailure("Could not coerce value that is"+
                    " outside order's domain . (Other = %s) " % (str(other),))
1189993
def insert_check(self, index, check_item):
        """"""
        self.checks.insert(index, check_item)
        for other in self.others:
            other.insert_check(index, check_item)
823742
def addValue(self, source, value):
    """"""
    if self.source is None or self.fn(self.value, value):
      self.value = value
      self.source = source
1102166
public boolean properSubsetOf(org.odmg.DSet otherSet)
    {
        return (this.size() > 0 && this.size() < otherSet.size() && this.subsetOf(otherSet));
    }
933027
public CompensatedSum add(CompensatedSum other) {
		double correctedSum = other.value() + (delta + other.delta());
		double updatedValue = value + correctedSum;
		double updatedDelta = correctedSum - (updatedValue - value);
		return new CompensatedSum(updatedValue, updatedDelta);
	}
160539
def add_check(self, check_item):
        """"""
        self.checks.append(check_item)
        for other in self.others:
            other.add_check(check_item)
469901
def _subtitlesAdded(self, path, subNos):
        """"""
        def action(current, count, model, row):
            _setSubNo(current + count, model, row)

        def count(current, nos):
            ret = 0
            for no in nos:
                if current >= no:
                    ret += 1
                    # consider: current = 0, nos = [0, 1, 2, 3]
                    # in that case, current should be prepended by all nos
                    current += 1
            return ret

        self._changeSubNos(path, subNos, count, action)
977527
def logical_or(self, other):
        """"""
        return self.operation(other, lambda x, y: int(x or y))