Set the preferred address.
324633
def set_preferred(self, preferred_addr, addr_1, addr_2):
        ''''''
        if addr_1 > addr_2:
            addr_1, addr_2 = addr_2, addr_1

        self._cache[(addr_1, addr_2)] = preferred_addr
934064
private static InetAddress chooseAddress(String preferred) throws UnknownHostException {
        Set<InetAddress> addresses = getAddresses();
        if (preferred != null && !preferred.isEmpty()) {
            //Favor preferred address if exists
            try {
                InetAddress preferredAddress = InetAddress.getByName(preferred);
                if (addresses != null && addresses.contains(preferredAddress)) {
                    LOG.info("preferred address is " + preferredAddress.getHostAddress() + " for host " + preferredAddress.getHostName());
                    return preferredAddress;
                }
            } catch (UnknownHostException e) {
                //noop
            }
            for (InetAddress address : addresses) {
                if (preferred.equals(address.getHostName())) {
                    return address;
                }
            }
            StringBuffer hostNameBuffer = new StringBuffer();
            for (InetAddress address : addresses) {
                if (hostNameBuffer.length() > 0) {
                    hostNameBuffer.append(", ");
                }
                hostNameBuffer.append(address.getHostName() + "/" + address.getHostAddress());
            }
            LOG.warn("Could not find network address for preferred '" + preferred + "' when the addresses were: " + hostNameBuffer);
        }
        if (addresses.contains(InetAddress.getLocalHost())) {
            //Then if local host address is not bound to a loop-back interface, use it.
            return InetAddress.getLocalHost();
        } else if (addresses != null && !addresses.isEmpty()) {
            //else return the first available addrress
            return addresses.toArray(new InetAddress[addresses.size()])[0];
        } else {
            //else we are forcedt to use the localhost address.
            return InetAddress.getLocalHost();
        }
    }
520998
public void setInetAddress(final String address) {
        try {
            this.inetAddress = InetAddress.getByName(address);
        } catch (final UnknownHostException e) {
            throw new RuntimeException("Invalid address " + address);
        }
    }
1137980
public function setAddress(Address $address)
    {
        $address->setContext(Moip::SUBSCRIPTION);
        $this->data->address = $address->getData();

        return $this;
    }
941436
def get_preferred(self, addr_1, addr_2):
        ''''''
        if addr_1 > addr_2:
            addr_1, addr_2 = addr_2, addr_1

        return self._cache.get((addr_1, addr_2))
1316307
private void setAddress(Address address, RolodexContract rolodex) {
        if (rolodex != null) {
            address.setStreet1(rolodex.getAddressLine1());
            address.setStreet2(rolodex.getAddressLine2());
            address.setCity(checkNull(rolodex.getCity()));
            address.setCounty(rolodex.getCounty());
            address.setState(rolodex.getState());
            address.setZipCode(rolodex.getPostalCode());
            if (rolodex.getCountryCode() != null) {
                CountryCodeType.Enum country = CountryCodeType.Enum.forString(rolodex.getCountryCode());
                address.setCountry(country);
            }
        }else {
            address.setStreet1("");
            address.setCity("");
        }
    }
584353
public synchronized void setInetAddrPort(InetAddrPort address)
    {
        if (_address != null && _address.equals(address)) return;

        if (isStarted()) log.warn(this + " is started");

        _address = address;
    }
838973
protected function setAddress(Address $address, $addressKey)
    {
        if (!$address->id) {
            $addressResource = $this->client
                ->addresses()
                ->create($address->asArray());

            if ($addressResource) {
                $address = $addressResource;
            }
        }

        $this->updateParams["{$addressKey}Id"] = $address->id;
    }
272007
public function setAddress1($address1)
	{
		if ( $address1 == $this->getAddress1() ) { return; }

		$this->_values['address1'] = (string) $address1;
		$this->setModified();
	}
1239850
def move_to_next_address(self, size_of_current):
        """"""
        self._size_of_current_register_address = size_of_current
        self._current_address = self.next_address()
        self.mark_address(self._current_address, size_of_current)
771511
def set(self, val):
        """"""
        msg = ExtendedSend(
            address=self._address,
            commandtuple=COMMAND_THERMOSTAT_SET_COOL_SETPOINT_0X6C_NONE,
            cmd2=int(val * 2),
            userdata=Userdata())
        msg.set_checksum()
        self._send_method(msg, self._set_cool_point_ack)
902993
@UiHandler("m_addressField")
    void onAddressSelection(SelectionEvent<SuggestOracle.Suggestion> event) {

        m_controller.onAddressChange(event.getSelectedItem());
    }
366259
public SingleServerConfig setAddress(String address) {
        if (address != null) {
            this.address = URIBuilder.create(address);
        }
        return this;
    }
889172
public static void setAddress(JobConf conf, String key,
      InetSocketAddress address) {
    if (address == null) {
      conf.unset(key);
      return;
    }
    String addrStr = address.getHostName() + ":" + address.getPort();
    conf.set(key, addrStr);
  }
817944
public void setTargetAddress(String targetAddress)
    {
        try
        {
            this.JOB.setDialstring(targetAddress);
        }
        catch(Exception exception)
        {
            throw new FaxException("Error while setting job target address.",exception);
        }
    }
598710
def set_address(addr):
    """"""
    # Send DNLOAD with first byte=0x21 and page address
    buf = struct.pack("<BI", 0x21, addr)
    __dev.ctrl_transfer(0x21, __DFU_DNLOAD, 0, __DFU_INTERFACE, buf, __TIMEOUT)

    # Execute last command
    if get_status() != __DFU_STATE_DFU_DOWNLOAD_BUSY:
        raise Exception("DFU: set address failed")

    # Check command state
    if get_status() != __DFU_STATE_DFU_DOWNLOAD_IDLE:
        raise Exception("DFU: set address failed")
908401
def set_input(self, input_id):
        """"""
        req_url = ENDPOINTS["setInput"].format(self.ip_address, self.zone_id)
        params = {"input": input_id}
        return request(req_url, params=params)