Approximates Eureka zones from a host name. This method approximates the zone to be
everything after the first "." in the host name.
@param host The host name to extract the host name from
@return The approximate zone
514975
public static String extractApproximateZone(String host) {
		String[] split = StringUtils.split(host, ".");
		return split == null ? host : split[1];
	}
70159
@Override
  public Iterator<Zone> iterateByName(final String name) {
    final Iterator<HostedZone> delegate = api.listHostedZonesByName(name).iterator();
    return new PeekingIterator<Zone>() {
      @Override
      protected Zone computeNext() {
        if (delegate.hasNext()) {
          HostedZone next = delegate.next();
          if (next.name.equals(name)) {
            return zipWithSOA(next);
          }
        }
        return endOfData();
      }
    };
  }
486141
public static String stripDomain(String hostname)
    {
        String ret = hostname;
        int pos = hostname.indexOf(".");
        if(pos != -1)
            ret = hostname.substring(0,pos);
        return ret;
    }
1343526
public void setHttpsProxy(String host) {
    setProxyValue(HTTPS_SERVER, host);
    setProxyValue(USE_HTTPS, host != null);
  }
650448
public static boolean isIpv4(String hostName) {
		int periodCount = 0;
		int numberCount = 0;
		int lowerCount = 0;
		int upperCount = 0;
		int otherCount = 0;
		
		for(int i = 0; i < hostName.length(); i++ ) {
			char myChar = hostName.charAt(i);
			if (myChar=='.') {
				periodCount++;
			} else if (myChar >= '0' && myChar <= '9') {
				numberCount++;
			} else if (myChar >= 'a' & myChar <= 'z') {
				lowerCount++;
			} else if (myChar >= 'A' & myChar <= 'Z') {
				upperCount++;
			} else {
				otherCount++;
			}
		}
		
		if (periodCount==3 && numberCount >= 4 && lowerCount==0 && upperCount==0 && otherCount==0) {
			return true;
		} else {
			return false;
		}
	}
975319
private boolean netscapeDomainMatches(final String domain, final String host) {
        if (domain == null || host == null) {
            return false;
        }

        // if there's no embedded dot in domain and domain is not .local
        boolean isLocalDomain = ".local".equalsIgnoreCase(domain);
        int embeddedDotInDomain = domain.indexOf('.');
        if (embeddedDotInDomain == 0) {
            embeddedDotInDomain = domain.indexOf('.', 1);
        }
        if (!isLocalDomain && (embeddedDotInDomain == -1 || embeddedDotInDomain == domain.length() - 1)) {
            return false;
        }

        // if the host name contains no dot and the domain name is .local
        int firstDotInHost = host.indexOf('.');
        if (firstDotInHost == -1 && isLocalDomain) {
            return true;
        }

        int domainLength = domain.length();
        int lengthDiff = host.length() - domainLength;
        if (lengthDiff == 0) {
            // if the host name and the domain name are just string-compare euqal
            return host.equalsIgnoreCase(domain);
        }
        else if (lengthDiff > 0) {
            // need to check H & D component
            String H = host.substring(0, lengthDiff);
            String D = host.substring(lengthDiff);

            return (D.equalsIgnoreCase(domain));
        }
        else if (lengthDiff == -1) {
            // if domain is actually .host
            return (domain.charAt(0) == '.' &&
                    host.equalsIgnoreCase(domain.substring(1)));
        }

        return false;
    }
954183
@Override
  public HostStatus getHostStatus(final String host) {
    final ZooKeeperClient client = provider.get("getHostStatus");

    if (!ZooKeeperRegistrarUtil.isHostRegistered(client, host)) {
      log.warn("Host {} isn't registered in ZooKeeper.", host);
      return null;
    }

    final boolean up = checkHostUp(client, host);
    final HostInfo hostInfo = getHostInfo(client, host);
    final AgentInfo agentInfo = getAgentInfo(client, host);
    final Map<JobId, Deployment> tasks = getTasks(client, host);
    final Map<JobId, TaskStatus> statuses = getTaskStatuses(client, host);
    final Map<String, String> environment = getEnvironment(client, host);
    final Map<String, String> labels = getLabels(client, host);

    return HostStatus.newBuilder()
        .setJobs(tasks)
        .setStatuses(fromNullable(statuses).or(EMPTY_STATUSES))
        .setHostInfo(hostInfo)
        .setAgentInfo(agentInfo)
        .setStatus(up ? UP : DOWN)
        .setEnvironment(environment)
        .setLabels(labels)
        .build();
  }
192763
def __get_hosts(self, pattern):
        

        (name, enumeration_details) = self._enumeration_info(pattern)
        hpat = self._hosts_in_unenumerated_pattern(name)
        hpat = sorted(hpat, key=lambda x: x.name)

        return set(self._apply_ranges(pattern, hpat))
504407
private void addToRing(String host) {
		Cell newCell = new Cell();
		newCell.m_hostName = host;
		if (m_cellRing == null) {
			newCell.next = newCell;
		} else {
			newCell.next = m_cellRing.next;
			m_cellRing.next = newCell;
		}
		m_cellRing = newCell;
	}
1128611
public static String extractPort(final String host) {
        if (containsPort(host)) {
            return host.substring(host.indexOf(":") + 1, host.length());
        } else {
            return null;
        }
    }
850016
public void setHttpProxy(String host) {
    setProxyValue(HTTP_SERVER, host);
    setProxyValue(USE_HTTP, host != null);
  }
763730
private synchronized static boolean isWorkingHost(String host) {
        if (workerHost == null) {
            workerHost = host;
            return true;
        } else {
            return host.equals(workerHost);
        }
    }
369209
public static String encodeHost(String host, String encoding) throws UnsupportedEncodingException {
		return HierarchicalUriComponents.encodeUriComponent(host, encoding, HierarchicalUriComponents.Type.HOST_IPV4);
	}
1266168
@Deprecated
  DatanodeDescriptor getDatanodeByHost(String host) {
    if (host==null) {
      return null;
    }
      
    hostmapLock.readLock().lock();
    try {
      DatanodeDescriptor[] nodes = map.get(host);
      // no entry
      if (nodes== null) {
        return null;
      }
      // one node
      if (nodes.length == 1) {
        return nodes[0];
      }
      // more than one node
      return nodes[r.nextInt(nodes.length)];
    } finally {
      hostmapLock.readLock().unlock();
    }
  }
859427
public Proxy setHost( String host )
    {
        if ( this.host.equals( host ) || ( host == null && this.host.length() <= 0 ) )
        {
            return this;
        }
        return new Proxy( type, host, port, auth );
    }
690914
HtmlGenerator appendHost(final HostInfo host) {
        appendHtmlConstant("<th class='cellTableHeader'>");
        if (host.isController()) {
            appendIcon(ConsoleIcons.INSTANCE.star(), "Domain Controller");
        }
        startLine().appendEscaped(host.getName()).endLine();
        startLine().appendHtmlConstant("Domain: ").appendHtmlConstant(host.isController() ? "Controller" : "Member")
                .endLine();
        html.appendHtmlConstant("</th>");
        return this;
    }
281378
public final void setHost(final String host) throws UnknownHostException {
        this.host = host;
        final InetAddress[] inetAddresses = InetAddress.getAllByName(host);

        for (InetAddress address: inetAddresses) {
            final AddressHostMatcher matcher = new AddressHostMatcher();
            matcher.setIp(address.getHostAddress());
            this.matchersForHost.add(matcher);
        }
    }