--------------------------
 <state> switchport private-vlan trunk allowed vlan <range>
 Note that range is handled as a string because the entire range is
 replaced instead of individually adding or removing vlans from the range.
516539
def switchport_pvlan_trunk_allowed_vlan
      return nil if switchport_mode == :disabled
      vlans = config_get('interface', 'switchport_pvlan_trunk_allowed_vlan',
                         name: @name)
      vlans = vlans.join(',') if vlans.is_a?(Array)
      vlans = Utils.normalize_range_array(vlans, :string) unless vlans == 'none'
      vlans
    end
467758
function(protocol, name, host, opt) {
		var noOffline = typeof opt === 'boolean'? opt : null, // for backward compat
			opts = Object.assign({
				noOffline : false,
				root      : 'root',
				pathI18n  : 'folderId',
				folders   : true
			}, (noOffline === null? (opt || {}) : {noOffline : noOffline})),
			addFolders = function(fm, bro, folders) {
				var self = this,
					cnt  = Object.keys($.isPlainObject(folders)? folders : {}).length,
					select;
				
				bro.next().remove();
				if (cnt) {
					select = $('<select class="ui-corner-all elfinder-tabstop" style="max-width:200px;">').append(
						$($.map(folders, function(n,i){return '<option value="'+fm.escape((i+'').trim())+'">'+fm.escape(n)+'</option>';}).join(''))
					).on('change click', function(e){
						var node = $(this),
							path = node.val(),
							spn;
						self.inputs.path.val(path);
						if (opts.folders && (e.type === 'change' || node.data('current') !== path)) {
							node.next().remove();
							node.data('current', path);
							if (path != opts.root) {
								spn = spinner();
								if (xhr && xhr.state() === 'pending') {
									fm.abortXHR(xhr, { quiet: true , abort: true });
								}
								node.after(spn);
								xhr = fm.request({
									data : {cmd : 'netmount', protocol: protocol, host: host, user: 'init', path: path, pass: 'folders'},
									preventDefault : true
								}).done(function(data){
									addFolders.call(self, fm, node, data.folders);
								}).always(function() {
									fm.abortXHR(xhr, { quiet: true });
									spn.remove();
								}).xhr;
							}
						}
					});
					bro.after($('<div/>').append(select))
						.closest('.ui-dialog').trigger('tabstopsInit');
					select.trigger('focus');
				}
			},
			spinner = function() {
				return $('<div class="elfinder-netmount-spinner"/>').append('<span class="elfinder-info-spinner"/>');
			},
			xhr;
		return {
			vars : {},
			name : name,
			inputs: {
				offline  : $('<input type="checkbox"/>').on('change', function() {
					$(this).parents('table.elfinder-netmount-tb').find('select:first').trigger('change', 'reset');
				}),
				host     : $('<span><span class="elfinder-info-spinner"/></span><input type="hidden"/>'),
				path     : $('<input type="text" value="'+opts.root+'"/>'),
				user     : $('<input type="hidden"/>'),
				pass     : $('<input type="hidden"/>')
			},
			select: function(fm, ev, d){
				var f = this.inputs,
					oline = f.offline,
					f0 = $(f.host[0]),
					data = d || null;
				this.vars.mbtn = f.host.closest('.ui-dialog').children('.ui-dialog-buttonpane:first').find('button.elfinder-btncnt-0');
				if (! f0.data('inrequest')
						&& (f0.find('span.elfinder-info-spinner').length
							|| data === 'reset'
							|| (data === 'winfocus' && ! f0.siblings('span.elfinder-button-icon-reload').length))
							)
				{
					if (oline.parent().children().length === 1) {
						f.path.parent().prev().html(fm.i18n(opts.pathI18n));
						oline.attr('title', fm.i18n('offlineAccess'));
						oline.uniqueId().after($('<label/>').attr('for', oline.attr('id')).html(' '+fm.i18n('offlineAccess')));
					}
					f0.data('inrequest', true).empty().addClass('elfinder-info-spinner')
						.parent().find('span.elfinder-button-icon').remove();
					fm.request({
						data : {cmd : 'netmount', protocol: protocol, host: host, user: 'init', options: {id: fm.id, offline: oline.prop('checked')? 1:0, pass: f.host[1].value}},
						preventDefault : true
					}).done(function(data){
						f0.removeClass("elfinder-info-spinner").html(data.body.replace(/\{msg:([^}]+)\}/g, function(whole,s1){return fm.i18n(s1, host);}));
					});
					opts.noOffline && oline.closest('tr').hide();
				} else {
					oline.closest('tr')[(opts.noOffline || f.user.val())? 'hide':'show']();
					f0.data('funcexpup') && f0.data('funcexpup')();
				}
				this.vars.mbtn[$(f.host[1]).val()? 'show':'hide']();
			},
			done: function(fm, data){
				var f = this.inputs,
					p = this.protocol,
					f0 = $(f.host[0]),
					f1 = $(f.host[1]),
					expires = '&nbsp;';
				
				opts.noOffline && f.offline.closest('tr').hide();
				if (data.mode == 'makebtn') {
					f0.removeClass('elfinder-info-spinner').removeData('expires').removeData('funcexpup');
					f.host.find('input').on('mouseenter mouseleave', function(){$(this).toggleClass('ui-state-hover');});
					f1.val('');
					f.path.val(opts.root).next().remove();
					f.user.val('');
					f.pass.val('');
					! opts.noOffline && f.offline.closest('tr').show();
					this.vars.mbtn.hide();
				} else if (data.mode == 'folders') {
					if (data.folders) {
						addFolders.call(this, fm, f.path.nextAll(':last'), data.folders);
					}
				} else {
					if (data.expires) {
						expires = '()';
						f0.data('expires', data.expires);
					}
					f0.html(host + expires).removeClass('elfinder-info-spinner');
					if (data.expires) {
						f0.data('funcexpup', function() {
							var rem = Math.floor((f0.data('expires') - (+new Date()) / 1000) / 60);
							if (rem < 3) {
								f0.parent().children('.elfinder-button-icon-reload').click();
							} else {
								f0.text(f0.text().replace(/\(.*\)/, '('+fm.i18n(['minsLeft', rem])+')'));
								setTimeout(function() {
									if (f0.is(':visible')) {
										f0.data('funcexpup')();
									}
								}, 60000);
							}
						});
						f0.data('funcexpup')();
					}
					if (data.reset) {
						p.trigger('change', 'reset');
						return;
					}
					f0.parent().append($('<span class="elfinder-button-icon elfinder-button-icon-reload" title="'+fm.i18n('reAuth')+'">')
						.on('click', function() {
							f1.val('reauth');
							p.trigger('change', 'reset');
						}));
					f1.val(protocol);
					this.vars.mbtn.show();
					if (data.folders) {
						addFolders.call(this, fm, f.path, data.folders);
					}
					f.user.val('done');
					f.pass.val('done');
					f.offline.closest('tr').hide();
				}
				f0.removeData('inrequest');
			},
			fail: function(fm, err){
				$(this.inputs.host[0]).removeData('inrequest');
				this.protocol.trigger('change', 'reset');
			},
			integrateInfo: opts.integrate
		};
	}
1140433
public static boolean portAvailable(int port) {
        if (port < MIN_PORT || port > MAX_PORT) {
            throw new InvalidArgument("port is out of range");
        }

        ServerSocket ss = null;
        DatagramSocket ds = null;
        try {
            ss = new ServerSocket(port);
            ss.setReuseAddress(true);
            ds = new DatagramSocket(port);
            ds.setReuseAddress(true);
            return true;
        } catch (IOException e) {
            // Do nothing
        } finally {
            if (ds != null) {
                ds.close();
            }

            if (ss != null) {
                try {
                    ss.close();
                } catch (IOException e) {
                    /* should not be thrown */
                }
            }
        }

        return false;
    }
939078
function isLegalPort(port: number) : boolean {
  if (typeof port === 'string' && port.trim() === '') {
    return false;
  }
  return +port === (port >>> 0) && port >= 0 && port <= 0xFFFF;
}
19613
@Override
  public void exitMaven_range(VersionParser.Maven_rangeContext ctx) {

    // This could be a version set
    if (ctx.getChildCount() == 3) {
      VersionSet set = new VersionSet();
      if (!"-".equals(ctx.getChild(1).getText())) {
        SemanticVersion v1 = (SemanticVersion) stack.pop();
        set.add(v1);
      }
      stack.push(set);
      return;
    }

    // Possibly an empty set
    if (ctx.getChildCount() == 2) {
      VersionSet set = new VersionSet();
      stack.push(set);
      return;
    }

    // Otherwise it is a range. Load the tokens first.
    int index = 0;
    String open = ctx.getChild(index).getText();
    index++;
    SemanticVersion v1 = null;
    SemanticVersion v2 = null;
    String text = ctx.getChild(index).getText();
    if (!",".equals(text)) {
      v1 = (SemanticVersion) stack.pop();
      index++;
    }
    index++;
    String close = null;
    text = ctx.getChild(index).getText();
    if ("]".equals(text) || ")".equals(text)) {
      close = text;
    }
    else {
      v2 = (SemanticVersion) stack.pop();
      index++;
      close = ctx.getChild(index).getText();
    }

    // We need to swap the values, cause they are peeled of the stack in reverse order
    if (v1 != null && v2 != null) {
      SemanticVersion tmp = v1;
      v1 = v2;
      v2 = tmp;
    }

    // Figure out what the range endpoints are
    IVersionRange r1 = null;
    if (v1 != null) {
      switch (open) {
        case "(":
          r1 = new VersionRange(">", v1);
          break;
        case "[":
          r1 = new VersionRange(">=", v1);
          break;
      }
    }

    IVersionRange r2 = null;
    if (v2 != null) {
      switch (close) {
        case ")":
          r2 = new VersionRange("<", v2);
          break;
        case "]":
          r2 = new VersionRange("<=", v2);
          break;
      }
    }

    // Now assemble the range
    if (r1 != null) {
      if (r2 != null) {
        IVersionRange andRange = new AndRange(r1, r2);
        andRange.setType("maven");
        stack.push(andRange);
      }
      else {
        stack.push(r1);
        r1.setType("maven");
      }
    }
    else {
      stack.push(r2);
      r2.setType("maven");
    }
  }
902174
public static Range<IPv6> cidrRange(String cidr) {
        try {
            MoreInetAddresses.CidrInfo cidrInfo = parseCIDR(cidr);
            if (cidrInfo.getNetwork() instanceof Inet6Address &&
                    cidrInfo.getBroadcast() instanceof Inet6Address) {

                return closed(new IPv6((Inet6Address) cidrInfo.getNetwork()),
                        new IPv6((Inet6Address) cidrInfo.getBroadcast()));
            }

        } catch (Exception ignored) {}

        throw new IllegalArgumentException(format("Invalid IPv6 cidr representation %s", cidr));
    }
529269
function setOffsetToRangeLinesForSwitch(
                baseAndStartLine,
                endLine,
                switchStatementNode
            ) {
                /**
                 * Find evaluate token of SwitchCase body from the given line.
                 * @param {number} line The line no to set.
                 * @returns {Token} The evaluate token of SwitchCase.
                 */
                function findSwitchCaseBodyInfoAtLineStart(line) {
                    const index = sourceCode.getIndexFromLoc({
                        line,
                        column: 0,
                    })

                    let switchCaseNode = sourceCode.getNodeByRangeIndex(index)
                    if (
                        !switchCaseNode ||
                        switchCaseNode.type === "SwitchStatement"
                    ) {
                        switchCaseNode = switchStatementNode.cases.find(
                            (_token, i) => {
                                const next = switchStatementNode.cases[i + 1]
                                if (!next || index < next.range[0]) {
                                    return true
                                }
                                return false
                            }
                        )
                    }
                    if (
                        !switchCaseNode ||
                        switchCaseNode.type !== "SwitchCase"
                    ) {
                        // not SwitchCase
                        return null
                    }

                    if (switchCaseNode.test) {
                        if (index < switchCaseNode.test.range[1]) {
                            // not body
                            return null
                        }
                    } else {
                        // default:
                        const fToken = sourceCode.getFirstToken(switchCaseNode)
                        const colon = sourceCode.getTokenAfter(
                            fToken,
                            t => t.type === "Punctuator" && t.value === ":"
                        )
                        if (index < colon.range[1]) {
                            // not body
                            return null
                        }
                    }
                    if (
                        !equalsLocation(
                            switchCaseNode.parent,
                            switchStatementNode
                        )
                    ) {
                        // not target
                        return null
                    }
                    const casesIndex = switchStatementNode.cases.findIndex(c =>
                        equalsLocation(c, switchCaseNode)
                    )
                    const evaluate = evaluates.find(
                        e =>
                            e.range[0] <= switchCaseNode.range[0] &&
                            switchCaseNode.range[0] < e.range[1]
                    )
                    return {
                        evaluate,
                        casesIndex,
                        node: switchCaseNode,
                    }
                }

                const switchStatementLine = baseAndStartLine
                // const switchStatementLineOffset = getBaseLineOffset(
                //     switchStatementLine
                // )

                for (
                    let lineNo = baseAndStartLine + 1;
                    lineNo <= endLine;
                    lineNo++
                ) {
                    const switchCaseInfo = findSwitchCaseBodyInfoAtLineStart(
                        lineNo
                    )
                    if (!switchCaseInfo) {
                        continue
                    }
                    const baseLine = switchCaseInfo.evaluate.loc.start.line

                    const offset = offsets.get(lineNo)
                    if (offset) {
                        if (offset.baseline <= baseLine) {
                            offset.baseline = switchStatementLine
                            offset.offset = 1
                        }
                    } else {
                        setOffsetToLine(lineNo, 1, switchStatementLine)
                    }
                }
            }
934610
function isLegalPort (port) {
  if ((typeof port !== 'number' && typeof port !== 'string') ||
      (typeof port === 'string' && port.trim().length === 0)) {
    return false
  }
  return +port === (+port >>> 0) && port <= 0xFFFF
}
479916
def switchport_pvlan_trunk_association=(should)
      pvlan_enable

      # Handle single-level arrays if found: [pri, sec] -> [[pri,sec]]
      should = [should] if !should.empty? && (Utils.depth(should) == 1)

      is = switchport_pvlan_trunk_association
      pvlan_trunk_association_delta(is, should)
    end
345776
def switchport_pvlan_mapping_remove?(should_primary)
      is_primary, is_range = switchport_pvlan_mapping

      if (is_primary != should_primary) && !is_primary.nil?
        cli_error_check(
          config_set('interface', 'switchport_pvlan_mapping',
                     name: @name, state: 'no', primary: '', vlan: ''))
        is_range = []
      end
      is_range
    end
545664
public static boolean isInRangeV4(byte[] network,byte[] subnet,byte[] ipAddress)
    {
    	if(network.length!=4 || subnet.length!=4 || ipAddress.length!=4)
    		return false;    	
    	
    	return compareByteValues(network,subnet,ipAddress);
    }
116210
def switchport_pvlan_host_association=(pri_and_sec)
      pvlan_enable

      state = pri_and_sec.empty? ? 'no' : ''
      pri, sec = pri_and_sec
      cli_error_check(
        config_set('interface', 'switchport_pvlan_host_association',
                   name: @name, state: state, pri: pri, sec: sec))
    end
447086
def parse_vmnet_range(start, end):
    

    class Range(argparse.Action):

        def __call__(self, parser, args, values, option_string=None):
            if len(values) != 2:
                raise argparse.ArgumentTypeError("vmnet range must consist of 2 numbers")
            if not start <= values[0] or not values[1] <= end:
                raise argparse.ArgumentTypeError("vmnet range must be between {} and {}".format(start, end))
            setattr(args, self.dest, values)
    return Range
516391
function findWindowsPortRange() {
  var deferredRange = promise.defer();
  // First, check if we're running on XP.  If this initial command fails,
  // we just fallback on the default IANA range.
  return execute('cmd.exe /c ver').then(function(stdout) {
    if (/Windows XP/.test(stdout)) {
      // TODO: Try to read these values from the registry.
      return {min: 1025, max: 5000};
    } else {
      return execute('netsh int ipv4 show dynamicport tcp').
          then(function(stdout) {
            /* > netsh int ipv4 show dynamicport tcp
              Protocol tcp Dynamic Port Range
              ---------------------------------
              Start Port : 49152
              Number of Ports : 16384
             */
            var range = stdout.split(/\n/).filter(function(line) {
              return /.*:\s*\d+/.test(line);
            }).map(function(line) {
              return Number(line.split(/:\s*/)[1]);
            });

            return {
              min: range[0],
              max: range[0] + range[1]
            };
          });
    }
  });
}
178296
@Override
    public boolean isSendAllowed()
    {
        if (tc.isEntryEnabled())
            SibTr.entry(tc, "isSendAllowed");

        boolean isSendAllowed = true;

        // We check first whether send is disallowed at the bus definition level. A 
        // setting at the bus level overrides a setting on the Foreign Destination
        // Definition.
        if (_sendAllowedOnTargetForeignBus != null)
            isSendAllowed = _sendAllowedOnTargetForeignBus.booleanValue();

        // If allowed at the bus level, check at the foreign dest def level
        if (isSendAllowed)
            isSendAllowed = _definition.isSendAllowed();

        if (tc.isEntryEnabled())
            SibTr.exit(tc, "isSendAllowed", new Boolean(isSendAllowed));

        return isSendAllowed;
    }
647532
@Override
    public void setState(RelayState state) {

        // apply the new pin state
        switch(state) {
            case OPEN: {
                if(!isOpen()) {
                    pin.setState(openState);
                }
                break;
            }
            case CLOSED: {
                if(!isClosed()) {
                    pin.setState(closedState);
                }
                break;
            }
            default: {
                throw new UnsupportedOperationException("Cannot set power state: " + state.toString());
            }
        }
    }
778050
function encode_range(cs/*:CellAddrSpec|Range*/,ce/*:?CellAddrSpec*/)/*:string*/ {
	if(typeof ce === 'undefined' || typeof ce === 'number') {
/*:: if(!(cs instanceof Range)) throw "unreachable"; */
		return encode_range(cs.s, cs.e);
	}
/*:: if((cs instanceof Range)) throw "unreachable"; */
	if(typeof cs !== 'string') cs = encode_cell((cs/*:any*/));
	if(typeof ce !== 'string') ce = encode_cell((ce/*:any*/));
/*:: if(typeof cs !== 'string') throw "unreachable"; */
/*:: if(typeof ce !== 'string') throw "unreachable"; */
	return cs == ce ? cs : cs + ":" + ce;
}