/* IRedisSortedSet commands
179553
@Override public synchronized Long zadd(final String key, final ZsetPair scoremember, final ZsetPair ... scoresmembers) throws WrongTypeException {
        checkType(key, "zset");
        Long count = 0L;
        if (!zsetCache.exists(key) || !zsetCache.get(key).contains(scoremember.member)) {
            ++count;
        }
        zsetCache.set(key, scoremember.member, scoremember.score);
        for (ZsetPair sms : scoresmembers) {
            if (sms == null) {
                continue;
            }
            if (!zsetCache.get(key).contains(sms.member)) {
                ++count;
            }
            zsetCache.set(key, sms.member, sms.score);
        }
        return count;
    }
596543
def lset(self, name, index, value):
        ""
        return self.execute_command('LSET', name, index, value)
42261
@Inline(value="$2.$3unmodifiableSet($1)", imported=Collections.class)
	public static <T> Set<T> unmodifiableView(Set<? extends T> set) {
		return Collections.unmodifiableSet(set);
	}
1205138
function setToPairs(set) {
    var index = -1,
        result = Array(set.size);

    set.forEach(function(value) {
      result[++index] = [value, value];
    });
    return result;
  }
29979
public static <T> Set<T> immutableSetView(Set<T> set) {
        if (set instanceof ImmutableSet<?>) {
            return set;
        }
        return Collections.unmodifiableSet(set);
    }
297520
private static <T> void shrinkSet(final Set<T> set, int newSize) {
    if (!(set instanceof LinkedHashSet))
      throw new IllegalStateException("Cannot shrink a set which is not of type LinkedHashSet");
    if (newSize > set.size())
      throw new IllegalStateException("Cannot shrink a set of size " + set.size() + " to new size " + newSize);
    Iterator<T> entryIterator = set.iterator();
    int count = 0;
    while (count < newSize) {
      entryIterator.next();
      count++;
    }
    while (entryIterator.hasNext()) {
      entryIterator.next();
      entryIterator.remove();
    }
  }
716773
public BaseRedisQueue<ID, DATA> setRedisSortedSetName(String redisSortedSetName) {
        _redisSortedSetName = redisSortedSetName;
        this.redisSortedSetName = _redisSortedSetName.getBytes(QueueUtils.UTF8);
        return this;
    }
1150530
public static <T> Set<T> unmodifiableSet(Set<? extends T> s) {
		return Collections.unmodifiableSet(s);
	}
1299560
public Set<T> internAll(Set<T> s) {
    synchronized(mutex) {
      return delegate.internAll(s);
    }
  }
704317
function set(cb, num, mymuted) {
    cancel();
    get(function (err, cur, muted) {
      // OS X BUG
      // The lowest volume setting is 0 < x < 1, but it reads as 0
      // Thus it's not possible to tell muted vs
      num = parseInt(num, 10);
      // TODO make this an error
      if (isNaN(num)) {
        num = cur;
      }
      if ('undefined' !== typeof mymuted) {
        muted = mymuted;
      }
      setRaw(cb, num, muted);
    });
  }
1176961
function supportsMapAndSet() {
  if (typeof Symbol === 'undefined' || typeof Map === 'undefined' || typeof Set === 'undefined') {
    return false;
  }
  var prop = Object.getOwnPropertyDescriptor(Map, Symbol.species);
  return prop && 'get' in prop && Map[Symbol.species] === Map;
}
1063213
private int processSet(String regex, int i, StringBuilder result, UnicodeSet temp, ParsePosition pos) {
        try {
            pos.setIndex(i);
            UnicodeSet x = temp.clear().applyPattern(regex, pos, symbolTable, 0);
            x.complement().complement(); // hack to fix toPattern
            result.append(x.toPattern(false));
            i = pos.getIndex() - 1; // allow for the loop increment
            return i;
        } catch (Exception e) {
            throw (IllegalArgumentException) new IllegalArgumentException("Error in " + regex).initCause(e);
        }
    }
771346
function setPathSet(
    value, path, depth, root, parent, node,
    requestedPaths, optimizedPaths, requestedPath, optimizedPath,
    version, expired, lru, comparator, errorSelector, replacedPaths) {

    var note = {};
    var branch = depth < path.length - 1;
    var keySet = path[depth];
    var key = iterateKeySet(keySet, note);
    var optimizedIndex = optimizedPath.index;

    do {

        requestedPath.depth = depth;

        var results = setNode(
            root, parent, node, key, value,
            branch, false, requestedPath, optimizedPath,
            version, expired, lru, comparator, errorSelector, replacedPaths
        );
        requestedPath[depth] = key;
        requestedPath.index = depth;
        optimizedPath[optimizedPath.index++] = key;
        var nextNode = results[0];
        var nextParent = results[1];
        if (nextNode) {
            if (branch) {
                setPathSet(
                    value, path, depth + 1,
                    root, nextParent, nextNode,
                    requestedPaths, optimizedPaths, requestedPath, optimizedPath,
                    version, expired, lru, comparator, errorSelector
                );
            } else {
                requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));
                optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));
            }
        }
        key = iterateKeySet(keySet, note);
        if (note.done) {
            break;
        }
        optimizedPath.index = optimizedIndex;
    } while (true);
}
687866
def delete_set(set=None, family='ipv4'):
    '''
    
    '''

    if not set:
        return 'Error: Set needs to be specified'

    cmd = '{0} destroy {1}'.format(_ipset_cmd(), set)
    out = __salt__['cmd.run'](cmd, python_shell=False)

    if not out:
        out = True
    return out
1309857
function ruleset(toks, i, n, handler) {
    // toks[s:e] are the selector tokens including internal whitespace.
    var s = i, e = selector(toks, i, n, true);
    if (e < 0) {
      // Skip malformed content per selector calling convention.
      e = ~e;
      // Make sure we skip at least one token.
      return e === s ? e+1 : e;
    }
    var tok = toks[e];
    if (tok !== '{') {
      // Make sure we skip at least one token.
      return e === s ? e+1 : e;
    }
    i = e+1;  // Skip over '{'
    // Don't include any trailing space in the selector slice.
    if (e > s && toks[e-1] === ' ') { --e; }
    if (handler['startRuleset']) {
      handler['startRuleset'](toks.slice(s, e));
    }
    while (i < n) {
      tok = toks[i];
      if (tok === '}') {
        ++i;
        break;
      }
      if (tok === ' ') {
        i = i+1;
      } else {
        i = declaration(toks, i, n, handler);
      }
    }
    if (handler['endRuleset']) {
      handler['endRuleset']();
    }
    return i;
  }
914565
public ORole checkIfAllowed(final String iResource, final int iOperation) {
		for (ORole r : roles)
			if (r.allow(iResource, iOperation))
				return r;

		return null;
	}
24813
def _find_set_members(set):
    '''
    
    '''

    cmd = '{0} list {1}'.format(_ipset_cmd(), set)
    out = __salt__['cmd.run_all'](cmd, python_shell=False)

    if out['retcode'] > 0:
        # Set doesn't exist return false
        return False

    _tmp = out['stdout'].split('\n')
    members = []
    startMembers = False
    for i in _tmp:
        if startMembers:
            members.append(i)
        if 'Members:' in i:
            startMembers = True
    return members