text:
/* Shared styles */
.x-slider {
    zoom: 1;
}

.x-slider-inner {
    position: relative;
    left: 0;
    top: 0;
    overflow: visible;
    zoom: 1;
}

.x-slider-focus {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    line-height: 1px;
    font-size: 1px;
    -moz-outline: 0 none;
    outline: 0 none;
    -moz-user-select: none;
    -khtml-user-select: none;
    -webkit-user-select: ignore;
}

/* Horizontal styles */
.x-slider-horz {
    padding-left: 7px;
    background: transparent url(../images/default/slider/slider-bg.png) no-repeat 0 -22px;
}

.x-slider-horz .x-slider-end {
    padding-right: 7px;
    zoom: 1;
    background: transparent url(../images/default/slider/slider-bg.png) no-repeat right -44px;
}

.x-slider-horz .x-slider-inner {
    background: transparent url(../images/default/slider/slider-bg.png) repeat-x 0 0;
    height: 22px;
}

.x-slider-horz .x-slider-thumb {
    width: 14px;
    height: 15px;
    position: absolute;
    left: 0;
    top: 3px;
    background: transparent url(../images/default/slider/slider-thumb.png) no-repeat 0 0;
}

.x-slider-horz .x-slider-thumb-over {
    background-position: -14px -15px;
}

.x-slider-horz .x-slider-thumb-drag {
    background-position: -28px -30px;
}

/* Vertical styles */
.x-slider-vert {
    padding-top: 7px;
    background: transparent url(../images/default/slider/slider-v-bg.png) no-repeat -44px 0;
    width: 22px;
}

.x-slider-vert .x-slider-end {
    padding-bottom: 7px;
    zoom: 1;
    background: transparent url(../images/default/slider/slider-v-bg.png) no-repeat -22px bottom;
}

.x-slider-vert .x-slider-inner {
    background: transparent url(../images/default/slider/slider-v-bg.png) repeat-y 0 0;
}

.x-slider-vert .x-slider-thumb {
    width: 15px;
    height: 14px;
    position: absolute;
    left: 3px;
    bottom: 0;
    background: transparent url(../images/default/slider/slider-v-thumb.png) no-repeat 0 0;
}

.x-slider-vert .x-slider-thumb-over {
    background-position: -15px -14px;
}

.x-slider-vert .x-slider-thumb-drag {
    background-position: -30px -28px;
}


text:
using System.Net.Http;
using System.Web.Http;
using Linky;
using PolyglotHeaven.Contracts.Commands;

namespace PolyglotHeaven.Web.Api
{
    [RoutePrefix("api/order")]
    public class OrderEndpointController : BasePostEndpoint<PlaceOrder>
    {
        [Route]
        [LinksFrom(typeof(IndexModel), "placeorder")]
        public override HttpResponseMessage Post(PlaceOrder command)
        {
            return Execute(command);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.cedarsoftware.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddressUtilities
{
    private static final Logger LOG = LoggerFactory.getLogger(InetAddressUtilities.class);

    private InetAddressUtilities() {
        super();
    }

    public static InetAddress getLocalHost() throws UnknownHostException {
        return InetAddress.getLocalHost();
    }

    public static byte[] getIpAddress() {
        try
        {
            return getLocalHost().getAddress();
        }
        catch (Exception e)
        {
            LOG.warn("Failed to obtain computer's IP address", e);
            return new byte[] {0,0,0,0};
        }
    }

    public static String getHostName()
    {
        try
        {
            return getLocalHost().getHostName();
        }
        catch (Exception e)
        {
            LOG.warn("Unable to fetch 'hostname'", e);
            return "localhost";
        }
    }

}


text:
package exercise.task1_listyIterator.commands;

import exercise.task1_listyIterator.commands.executables.CreateCommand;
import exercise.task1_listyIterator.commands.executables.HasNextCommand;
import exercise.task1_listyIterator.commands.executables.MoveCommand;
import exercise.task1_listyIterator.commands.executables.PrintCommand;

public class CommandFactory {

    public static Executable getCommand(String commandName){
        switch (commandName){
            case "Create": return new CreateCommand();
            case "Move": return new MoveCommand();
            case "Print": return new PrintCommand();
            case "HasNext": return new HasNextCommand();
        }
        return null;
    }
}


text:
package com.pinhuba.web.controller.action;

import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.List;
import java.util.zip.ZipInputStream;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.activiti.engine.ManagementService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.io.FilenameUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.pinhuba.common.activiti.HistoryProcessInstanceDiagramCmd;
import com.pinhuba.common.activiti.WorkflowUtils;
import com.pinhuba.common.util.ConstWords;
import com.pinhuba.common.util.file.properties.SystemConfig;

@Controller
public class ProcessAction {
	@Resource
	private RepositoryService repositoryService;
	@Resource
	private ManagementService managementService;

	/**
	 * 流程部署
	 *
	 * @throws IOException
	 */
	@RequestMapping(value = "/processDeploy.do", method = RequestMethod.POST)
	public String processDeploy(HttpServletRequest request, ModelMap model) throws IOException {
		String fileName = null;
		String exportDir = SystemConfig.getParam("erp.workflow.path");
		InputStream fileInputStream = null;

		// 文件上传处理工厂
		FileItemFactory factory = new DiskFileItemFactory();

		// 创建文件上传处理器
		ServletFileUpload upload = new ServletFileUpload(factory);

		// 开始解析请求信息
		List items = null;
		try {
			items = upload.parseRequest(request);
		} catch (FileUploadException e) {
			e.printStackTrace();
		}

		// 对所有请求信息进行判断
		Iterator iter = items.iterator();
		while (iter.hasNext()) {
			FileItem item = (FileItem) iter.next();
			// 信息为普通的格式
			if (!item.isFormField()) {
				fileName = item.getName();
				int index = fileName.lastIndexOf("\\");
				fileName = fileName.substring(index + 1);
				fileInputStream = item.getInputStream();
			}
		}

		try {
			Deployment deployment = null;

			String extension = FilenameUtils.getExtension(fileName);
			if (extension.equals("zip") || extension.equals("bar")) {
				ZipInputStream zip = new ZipInputStream(fileInputStream);
				deployment = repositoryService.createDeployment().addZipInputStream(zip).deploy();
			} else {
				deployment = repositoryService.createDeployment().addInputStream(fileName, fileInputStream).deploy();
			}

			List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();

			for (ProcessDefinition processDefinition : list) {
				WorkflowUtils.exportDiagramToFile(repositoryService, processDefinition, exportDir);
			}

		} catch (Exception e) {
			e.printStackTrace();
			request.setAttribute(ConstWords.TempStringMsg, "部署流程失败!请检查流程定义文件!");
			return "/erp/system_set/process_add.jsp";
		}
		return "/erp/system_set/process.jsp";
	}

	/**
	 * 资源查看
	 *
	 * @throws IOException
	 */
	@RequestMapping(value = "/processResource.do", method = RequestMethod.GET)
	public void processResource(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws IOException {
		String resourceType = request.getParameter("type");
		String processDefinitionId = request.getParameter("pid");

		ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
		String resourceName = "";
		if (resourceType.equals("image")) {
			resourceName = processDefinition.getDiagramResourceName();
		} else if (resourceType.equals("xml")) {
			resourceName = processDefinition.getResourceName();
		}
		InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
		byte[] b = new byte[1024];
		int len = -1;
		while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
			response.getOutputStream().write(b, 0, len);
		}
	}

	/**
	 * 流程追踪
	 *
	 * @throws IOException
	 */
	@RequestMapping(value = "/processTrace.do", method = RequestMethod.GET)
	public void processTrace(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws IOException {
		String processInstanceId = request.getParameter("id");
		Command<InputStream> cmd = new HistoryProcessInstanceDiagramCmd(processInstanceId);
		InputStream is = managementService.executeCommand(cmd);
		response.setContentType("image/png");

		int len = 0;
		byte[] b = new byte[1024];

		while ((len = is.read(b, 0, 1024)) != -1) {
			response.getOutputStream().write(b, 0, len);
		}
	}

}


text:
using std::min;
using std::max;
using std::swap;
using std::reverse;

#include <iomanip>
using std::setprecision;

#include <iostream>
using std::ostream;
using std::cout;
using std::endl;

#include <map>
using std::map;
using std::multimap;

#include <set>
using std::set;
using std::multiset;

#include <vector>
using std::vector;

#include "base/logging.h"
#include "base/macros.h"
#include "base/scoped_ptr.h"
#include "s2.h"
#include "s2cellid.h"
#include "s2polygon.h"
#include "util/math/matrix3x3-inl.h"

void S2PolygonBuilderOptions::set_undirected_edges(bool undirected_edges) {
  undirected_edges_ = undirected_edges;
}

void S2PolygonBuilderOptions::set_xor_edges(bool xor_edges) {
  xor_edges_ = xor_edges;
}

void S2PolygonBuilderOptions::set_validate(bool validate) {
  validate_ = validate;
}

void S2PolygonBuilderOptions::set_vertex_merge_radius(S1Angle const& angle) {
  vertex_merge_radius_ = angle;
}

void S2PolygonBuilderOptions::set_edge_splice_fraction(double fraction) {
  CHECK(fraction < sqrt(3) / 2);
  edge_splice_fraction_ = fraction;
}

S2PolygonBuilder::S2PolygonBuilder(S2PolygonBuilderOptions const& options)
  : options_(options), edges_(new EdgeSet) {
}

S2PolygonBuilder::~S2PolygonBuilder() {
}

bool S2PolygonBuilder::HasEdge(S2Point const& v0, S2Point const& v1) {
  EdgeSet::const_iterator candidates = edges_->find(v0);
  return (candidates != edges_->end() &&
          candidates->second.find(v1) != candidates->second.end());
}

bool S2PolygonBuilder::AddEdge(S2Point const& v0, S2Point const& v1) {
  // If xor_edges is true, we look for an existing edge in the opposite
  // direction.  We either delete that edge or insert a new one.

  if (v0 == v1) return false;
  if (options_.xor_edges() && HasEdge(v1, v0)) {
    EraseEdge(v1, v0);
    return false;
  }
  if (edges_->find(v0) == edges_->end()) starting_vertices_.push_back(v0);
  (*edges_)[v0].insert(v1);
  if (options_.undirected_edges()) {
    if (edges_->find(v1) == edges_->end()) starting_vertices_.push_back(v1);
    (*edges_)[v1].insert(v0);
  }
  return true;
}

void S2PolygonBuilder::AddLoop(S2Loop const* loop) {
  int sign = loop->sign();
  for (int i = loop->num_vertices(); i > 0; --i) {
    // Vertex indices need to be in the range [0, 2*num_vertices()-1].
    AddEdge(loop->vertex(i), loop->vertex(i + sign));
  }
}

void S2PolygonBuilder::AddPolygon(S2Polygon const* polygon) {
  for (int i = 0; i < polygon->num_loops(); ++i) {
    AddLoop(polygon->loop(i));
  }
}

void S2PolygonBuilder::EraseEdge(S2Point const& v0, S2Point const& v1) {
  // Note that there may be more than one copy of an edge if we are not XORing
  // them, so a VertexSet is a multiset.

  VertexSet* vset = &(*edges_)[v0];
  DCHECK(vset->find(v1) != vset->end());
  vset->erase(vset->find(v1));
  if (vset->empty()) edges_->erase(v0);

  if (options_.undirected_edges()) {
    vset = &(*edges_)[v1];
    DCHECK(vset->find(v0) != vset->end());
    vset->erase(vset->find(v0));
    if (vset->empty()) edges_->erase(v1);
  }
}

void S2PolygonBuilder::set_debug_matrix(Matrix3x3_d const& m) {
  debug_matrix_.reset(new Matrix3x3_d(m));
}

void S2PolygonBuilder::DumpVertex(S2Point const& v) const {
  if (debug_matrix_.get()) {
    // For orthonormal matrices, Inverse() == Transpose().
    cout << S2LatLng(debug_matrix_->Transpose() * v);
  } else {
    cout << setprecision(17) << v << setprecision(6);
  }
}

void S2PolygonBuilder::DumpEdges(S2Point const& v0) const {
  DumpVertex(v0);
  cout << ":\n";
  EdgeSet::const_iterator candidates = edges_->find(v0);
  if (candidates != edges_->end()) {
    VertexSet const& vset = candidates->second;
    for (VertexSet::const_iterator i = vset.begin(); i != vset.end(); ++i) {
      cout << "    ";
      DumpVertex(*i);
      cout << "\n";
    }
  }
}

void S2PolygonBuilder::Dump() const {
  for (EdgeSet::const_iterator i = edges_->begin(); i != edges_->end(); ++i) {
    DumpEdges(i->first);
  }
}

void S2PolygonBuilder::EraseLoop(S2Point const* v, int n) {
  for (int i = n - 1, j = 0; j < n; i = j++) {
    EraseEdge(v[i], v[j]);
  }
}

void S2PolygonBuilder::RejectLoop(S2Point const* v, int n,
                                  EdgeList* unused_edges) {
  for (int i = n - 1, j = 0; j < n; i = j++) {
    unused_edges->push_back(make_pair(v[i], v[j]));
  }
}

S2Loop* S2PolygonBuilder::AssembleLoop(S2Point const& v0, S2Point const& v1,
                                       EdgeList* unused_edges) {
  // We start at the given edge and assemble a loop taking left turns
  // whenever possible.  We stop the loop as soon as we encounter any
  // vertex that we have seen before *except* for the first vertex (v0).
  // This ensures that only CCW loops are constructed when possible.

  vector<S2Point> path;          // The path so far.
  hash_map<S2Point, int> index;  // Maps a vertex to its index in "path".
  path.push_back(v0);
  path.push_back(v1);
  index[v1] = 1;
  while (path.size() >= 2) {
    // Note that "v0" and "v1" become invalid if "path" is modified.
    S2Point const& v0 = path.end()[-2];
    S2Point const& v1 = path.end()[-1];
    S2Point v2;
    bool v2_found = false;
    EdgeSet::const_iterator candidates = edges_->find(v1);
    if (candidates != edges_->end()) {
      VertexSet const& vset = candidates->second;
      for (VertexSet::const_iterator i = vset.begin(); i != vset.end(); ++i) {
        // We prefer the leftmost outgoing edge, ignoring any reverse edges.
        if (*i == v0) continue;
        if (!v2_found || S2::OrderedCCW(v0, v2, *i, v1)) { v2 = *i; }
        v2_found = true;
      }
    }
    if (!v2_found) {
      // We've hit a dead end.  Remove this edge and backtrack.
      unused_edges->push_back(make_pair(v0, v1));
      EraseEdge(v0, v1);
      index.erase(v1);
      path.pop_back();
    } else if (index.insert(make_pair(v2, path.size())).second) {
      // This is the first time we've visited this vertex.
      path.push_back(v2);
    } else {
      // We've completed a loop.  Throw away any initial vertices that
      // are not part of the loop.
      path.erase(path.begin(), path.begin() + index[v2]);

      // In the case of undirected edges, we may have assembled a clockwise
      // loop while trying to assemble a CCW loop.  To fix this, we assemble
      // a new loop starting with an arbitrary edge in the reverse direction.
      // This is guaranteed to assemble a loop that is interior to the previous
      // one and will therefore eventually terminate.

      S2Loop* loop = new S2Loop(path);
      if (options_.validate() && !loop->IsValid()) {
        // We've constructed a loop that crosses itself, which can only
        // happen if there is bad input data.  Throw away the whole loop.
        RejectLoop(&path[0], path.size(), unused_edges);
        EraseLoop(&path[0], path.size());
        delete loop;
        return NULL;
      }

      if (options_.undirected_edges() && !loop->IsNormalized()) {
        scoped_ptr<S2Loop> deleter(loop);  // XXX for debugging
        return AssembleLoop(path[1], path[0], unused_edges);
      }
      return loop;
    }
  }
  return NULL;
}

class S2PolygonBuilder::PointIndex {
  // A PointIndex is a cheap spatial index to help us find mergeable
  // vertices.  Given a set of points, it can efficiently find all of the
  // points within a given search radius of an arbitrary query location.
  // It is essentially just a hash map from cell ids at a given fixed level to
  // the set of points contained by that cell id.
  //
  // This class is not suitable for general use because it only supports
  // fixed-radius queries and has various special-purpose operations to avoid
  // the need for additional data structures.

 private:
  typedef multimap<S2CellId, S2Point> Map;
  Map map_;

  double vertex_radius_;
  double edge_fraction_;
  int level_;
  vector<S2CellId> ids_;  // Allocated here for efficiency.

 public:
  PointIndex(double vertex_radius, double edge_fraction)
    : vertex_radius_(vertex_radius),
      edge_fraction_(edge_fraction),
      // We compute an S2CellId level such that the vertex neighbors at that
      // level of any point A are a covering for spherical cap (i.e. "disc")
      // of the given search radius centered at A.  This requires that the
      // minimum cell width at that level must be twice the search radius.
      level_(min(S2::kMinWidth.GetMaxLevel(2 * vertex_radius),
                 S2CellId::kMaxLevel - 1)) {
    // We insert a sentinel so that we don't need to test for map_.end().
    map_.insert(make_pair(S2CellId::Sentinel(), S2Point()));
  }

  void Insert(S2Point const& p) {
    S2CellId::FromPoint(p).AppendVertexNeighbors(level_, &ids_);
    for (int i = ids_.size(); --i >= 0; ) {
      map_.insert(make_pair(ids_[i], p));
    }
    ids_.clear();
  }

  void Erase(S2Point const& p) {
    S2CellId::FromPoint(p).AppendVertexNeighbors(level_, &ids_);
    for (int i = ids_.size(); --i >= 0; ) {
      Map::iterator j = map_.lower_bound(ids_[i]);
      for (; j->second != p; ++j) {
        DCHECK_EQ(ids_[i], j->first);
      }
      map_.erase(j);
    }
    ids_.clear();
  }

  void QueryCap(S2Point const& axis, vector<S2Point>* output) {
    // Return the set the points whose distance to "axis" is less than
    // vertex_radius_.

    output->clear();
    S2CellId id = S2CellId::FromPoint(axis).parent(level_);
    for (Map::const_iterator i = map_.lower_bound(id); i->first == id; ++i) {
      S2Point const& p = i->second;
      if (axis.Angle(p) < vertex_radius_) {
        output->push_back(p);
      }
    }
  }

  bool FindNearbyPoint(S2Point const& v0, S2Point const& v1,
                       S2Point* nearby) {
    // Return a point whose distance from the edge (v0,v1) is less than
    // vertex_radius_, and which is not equal to v0 or v1.  The current
    // implementation returns the closest such point.
    //
    // Strategy: we compute a very cheap covering by approximating the edge as
    // two spherical caps, one around each endpoint, and then computing a
    // 4-cell covering of each one.  We could improve the quality of the
    // covering by using some intermediate points along the edge as well.

    double length = v0.Angle(v1);
    S2Point normal = S2::RobustCrossProd(v0, v1);
    int level = min(level_, S2::kMinWidth.GetMaxLevel(length));
    S2CellId::FromPoint(v0).AppendVertexNeighbors(level, &ids_);
    S2CellId::FromPoint(v1).AppendVertexNeighbors(level, &ids_);

    // Sort the cell ids so that we can skip duplicates in the loop below.
    sort(ids_.begin(), ids_.end());

    double best_dist = 2 * vertex_radius_;
    for (int i = ids_.size(); --i >= 0; ) {
      if (i > 0 && ids_[i-1] == ids_[i]) continue;  // Skip duplicates.

      S2CellId const& max_id = ids_[i].range_max();
      for (Map::const_iterator j = map_.lower_bound(ids_[i].range_min());
           j->first <= max_id; ++j) {
        S2Point const& p = j->second;
        if (p == v0 || p == v1) continue;
        double dist = S2EdgeUtil::GetDistance(p, v0, v1, normal).radians();
        if (dist < best_dist) {
          best_dist = dist;
          *nearby = p;
        }
      }
    }
    ids_.clear();
    return (best_dist < edge_fraction_ * vertex_radius_);
  }

 private:
  DISALLOW_EVIL_CONSTRUCTORS(PointIndex);
};

void S2PolygonBuilder::BuildMergeMap(PointIndex* index, MergeMap* merge_map) {
  // The overall strategy is to start from each vertex and grow a maximal
  // cluster of mergeable vertices.  In graph theoretic terms, we find the
  // connected components of the undirected graph whose edges connect pairs of
  // vertices that are separated by at most vertex_merge_radius().
  //
  // We then choose a single representative vertex for each cluster, and
  // update "merge_map" appropriately.  We choose an arbitrary existing
  // vertex rather than computing the centroid of all the vertices to avoid
  // creating new vertex pairs that need to be merged.  (We guarantee that all
  // vertex pairs are separated by at least the merge radius in the output.)

  // First, we build the set of all the distinct vertices in the input.
  // We need to include the source and destination of every edge.
  hash_set<S2Point> vertices;
  for (EdgeSet::const_iterator i = edges_->begin(); i != edges_->end(); ++i) {
    vertices.insert(i->first);
    VertexSet const& vset = i->second;
    for (VertexSet::const_iterator j = vset.begin(); j != vset.end(); ++j)
      vertices.insert(*j);
  }

  // Build a spatial index containing all the distinct vertices.
  for (hash_set<S2Point>::const_iterator i = vertices.begin();
       i != vertices.end(); ++i) {
    index->Insert(*i);
  }

  // Next, we loop through all the vertices and attempt to grow a maximial
  // mergeable group starting from each vertex.
  vector<S2Point> frontier, mergeable;
  for (hash_set<S2Point>::const_iterator vstart = vertices.begin();
       vstart != vertices.end(); ++vstart) {
    // Skip any vertices that have already been merged with another vertex.
    if (merge_map->find(*vstart) != merge_map->end()) continue;

    // Grow a maximal mergeable component starting from "vstart", the
    // canonical representative of the mergeable group.
    frontier.push_back(*vstart);
    while (!frontier.empty()) {
      index->QueryCap(frontier.back(), &mergeable);
      frontier.pop_back();  // Do this before entering the loop below.
      for (int j = mergeable.size(); --j >= 0; ) {
        S2Point const& v1 = mergeable[j];
        if (v1 != *vstart) {
          // Erase from the index any vertices that will be merged.  This
          // ensures that we won't try to merge the same vertex twice.
          index->Erase(v1);
          frontier.push_back(v1);
          (*merge_map)[v1] = *vstart;
        }
      }
    }
  }
}

void S2PolygonBuilder::MoveVertices(MergeMap const& merge_map) {
  if (merge_map.empty()) return;

  // We need to copy the set of edges affected by the move, since
  // edges_ could be reallocated when we start modifying it.
  vector<pair<S2Point, S2Point> > edges;
  for (EdgeSet::const_iterator i = edges_->begin(); i != edges_->end(); ++i) {
    S2Point const& v0 = i->first;
    VertexSet const& vset = i->second;
    for (VertexSet::const_iterator j = vset.begin(); j != vset.end(); ++j) {
      S2Point const& v1 = *j;
      if (merge_map.find(v0) != merge_map.end() ||
          merge_map.find(v1) != merge_map.end()) {
        // We only need to modify one copy of each undirected edge.
        if (!options_.undirected_edges() || v0 < v1) {
          edges.push_back(make_pair(v0, v1));
        }
      }
    }
  }

  // Now erase all the old edges, and add all the new edges.  This will
  // automatically take care of any XORing that needs to be done, because
  // EraseEdge also erases the sibling of undirected edges.
  for (int i = 0; i < edges.size(); ++i) {
    S2Point v0 = edges[i].first;
    S2Point v1 = edges[i].second;
    EraseEdge(v0, v1);
    MergeMap::const_iterator new0 = merge_map.find(v0);
    if (new0 != merge_map.end()) v0 = new0->second;
    MergeMap::const_iterator new1 = merge_map.find(v1);
    if (new1 != merge_map.end()) v1 = new1->second;
    AddEdge(v0, v1);
  }
}

void S2PolygonBuilder::SpliceEdges(PointIndex* index) {
  // We keep a stack of unprocessed edges.  Initially all edges are
  // pushed onto the stack.
  vector<pair<S2Point, S2Point> > edges;
  for (EdgeSet::const_iterator i = edges_->begin(); i != edges_->end(); ++i) {
    S2Point const& v0 = i->first;
    VertexSet const& vset = i->second;
    for (VertexSet::const_iterator j = vset.begin(); j != vset.end(); ++j) {
      S2Point const& v1 = *j;
      // We only need to modify one copy of each undirected edge.
      if (!options_.undirected_edges() || v0 < v1) {
        edges.push_back(make_pair(v0, v1));
      }
    }
  }

  // For each edge, we check whether there are any nearby vertices that should
  // be spliced into it.  If there are, we choose one such vertex, split
  // the edge into two pieces, and iterate on each piece.
  while (!edges.empty()) {
    S2Point v0 = edges.back().first;
    S2Point v1 = edges.back().second;
    edges.pop_back();  // Do this before pushing new edges.

    // If we are xoring, edges may be erased before we get to them.
    if (options_.xor_edges() && !HasEdge(v0, v1)) continue;

    S2Point vmid;
    if (!index->FindNearbyPoint(v0, v1, &vmid)) continue;

    EraseEdge(v0, v1);
    if (AddEdge(v0, vmid)) edges.push_back(make_pair(v0, vmid));
    if (AddEdge(vmid, v1)) edges.push_back(make_pair(vmid, v1));
  }
}

bool S2PolygonBuilder::AssembleLoops(vector<S2Loop*>* loops,
                                     EdgeList* unused_edges) {
  if (options_.vertex_merge_radius().radians() > 0) {
    PointIndex index(options_.vertex_merge_radius().radians(),
                     options_.edge_splice_fraction());
    MergeMap merge_map;
    BuildMergeMap(&index, &merge_map);
    MoveVertices(merge_map);
    if (options_.edge_splice_fraction() > 0) {
      SpliceEdges(&index);
    }
  }

  EdgeList dummy_unused_edges;
  if (unused_edges == NULL) unused_edges = &dummy_unused_edges;

  // We repeatedly choose an edge and attempt to assemble a loop
  // starting from that edge.  (This is always possible unless the
  // input includes extra edges that are not part of any loop.)  To
  // maintain a consistent scanning order over edges_ between
  // different machine architectures (e.g. 'clovertown' vs. 'opteron'),
  // we follow the order they were added to the builder.
  unused_edges->clear();
  for (int i = 0; i < starting_vertices_.size(); ) {
    S2Point const& v0 = starting_vertices_[i];
    EdgeSet::const_iterator candidates = edges_->find(v0);
    if (candidates == edges_->end()) {
      ++i;
      continue;
    }
    // NOTE(user): If we have such two S2Points a, b that:
    //
    //   a.x = b.x, a.y = b.y and
    //   -- a.z = b.z if CPU is Intel
    //   -- a.z <> b.z if CPU is AMD
    //
    // then the order of points picked up as v1 on the following line
    // can be inconsistent between different machine architectures.
    //
    // As of b/3088321 and of cl/17847332, it's not clear if such
    // input really exists in our input and probably it's O.K. not to
    // address it in favor of the speed.
    S2Point const& v1 = *(candidates->second.begin());
    S2Loop* loop = AssembleLoop(v0, v1, unused_edges);
    if (loop != NULL) {
      loops->push_back(loop);
      EraseLoop(&loop->vertex(0), loop->num_vertices());
    }
  }
  return unused_edges->empty();
}

bool S2PolygonBuilder::AssemblePolygon(S2Polygon* polygon,
                                       EdgeList* unused_edges) {
  vector<S2Loop*> loops;
  bool success = AssembleLoops(&loops, unused_edges);

  // If edges are undirected, then all loops are already CCW.  Otherwise we
  // need to make sure the loops are normalized.
  if (!options_.undirected_edges()) {
    for (int i = 0; i < loops.size(); ++i) {
      loops[i]->Normalize();
    }
  }
  if (options_.validate() && !S2Polygon::IsValid(loops)) {
    if (unused_edges != NULL) {
      for (int i = 0; i < loops.size(); ++i) {
        RejectLoop(&loops[i]->vertex(0), loops[i]->num_vertices(),
                   unused_edges);
      }
    }

    for (int i = 0; i < loops.size(); ++i) {
      delete loops[i];
    }
    loops.clear();
    return false;
  }
  polygon->Init(&loops);
  return success;
}


text:
<!--
  Copyright 2013 Google Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<resources>
    <integer name="max_width_short_month_label_dp">240</integer>
    <integer name="max_height_mini_view_dp">180</integer>
    <integer name="max_height_mini_view_1_row_dp">120</integer>
</resources>


text:
package org.oasis.names.tc.saml.assertion;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;

/**
 *
Java class for DoNotCacheConditionType complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="DoNotCacheConditionType">
 *   <complexContent>
 *     <extension base="{urn:oasis:names:tc:SAML:1.0:assertion}ConditionAbstractType">
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DoNotCacheConditionType")
public class DoNotCacheConditionType
    extends ConditionAbstractType
    implements Serializable, Equals, HashCode, ToString
{

    public String toString() {
        final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
        final StringBuilder buffer = new StringBuilder();
        append(null, buffer, strategy);
        return buffer.toString();
    }

    public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
        strategy.appendStart(locator, this, buffer);
        appendFields(locator, buffer, strategy);
        strategy.appendEnd(locator, this, buffer);
        return buffer;
    }

    public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
        super.appendFields(locator, buffer, strategy);
        return buffer;
    }

    public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
        int currentHashCode = super.hashCode(locator, strategy);
        return currentHashCode;
    }

    public int hashCode() {
        final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
        return this.hashCode(null, strategy);
    }

    public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
        if (!(object instanceof DoNotCacheConditionType)) {
            return false;
        }
        if (this == object) {
            return true;
        }
        if (!super.equals(thisLocator, thatLocator, object, strategy)) {
            return false;
        }
        return true;
    }

    public boolean equals(Object object) {
        final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE;
        return equals(null, null, object, strategy);
    }

}


text:
/*
 *
 * ClockInPage reducer
 *
 */

import {
  DEFAULT_ACTION,
  GET_PROJECTS_SUCCESS_ACTION,
  GET_TASKS_SUCCESS_ACTION,
  TASK_CHANGE_ACTION,
  PROJECT_CHANGE_ACTION,
} from './constants';

export const initialState = {
  projects: [],
  tasks: [],
};

function clockInPageReducer(state = initialState, action) {
  switch (action.type) {
    case DEFAULT_ACTION:
      return state;
    case GET_PROJECTS_SUCCESS_ACTION:
      return { ...state, projects: action.projects };
    case GET_TASKS_SUCCESS_ACTION:
      return { ...state, tasks: action.tasks };
    case TASK_CHANGE_ACTION:
      return { ...state, taskId: action.id };
    case PROJECT_CHANGE_ACTION:
      return { ...state, taskId: action.id };
    default:
      return state;
  }
}

export default clockInPageReducer;


text:
// tipsy, facebook style tooltips for jquery
// version 1.3.1
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
// released under the MIT license
//
// Modified by Atlassian
// https://github.com/atlassian/tipsy

(function($) {
    var liveBindingWarning =
        "To be compatible with jQuery 1.9 and higher," +
        " You must pass a selector to tipsy's live argument." +
        " For instance, `$(document).tipsy({live: 'a.live'});`";

    function maybeCall(thing, ctx) {
        return typeof thing == "function" ? thing.call(ctx) : thing;
    }

    function isElementInDOM(ele) {
        var el = ele && ele.jquery ? ele.get(0) : ele;
        return $.contains(document.documentElement, el);
    }

    var tipsyIDcounter = 0;
    function tipsyID() {
        var tipsyID = tipsyIDcounter++;
        return "tipsyuid" + tipsyID;
    }

    function Tipsy(element, options) {
        this.$element = $(element);
        this.options = options;
        this.enabled = true;
        this.fixTitle();
    }

    Tipsy.prototype = {
        show: function() {
            // if element is not in the DOM then don't show the Tipsy and return early
            if (!isElementInDOM(this.$element)) {
                return;
            }

            var title = this.getTitle();
            if (!title || !this.enabled) {
                return;
            }

            var $tip = this.tip();

            $tip.find(".tipsy-inner")[this.options.html ? "html" : "text"](
                title
            );
            $tip[0].className = "tipsy"; // reset classname in case of dynamic gravity
            $tip.remove()
                .css({
                    top: 0,
                    left: 0,
                    visibility: "hidden",
                    display: "block"
                })
                .appendTo(document.body);

            var that = this;
            function tipOver() {
                that.hoverTooltip = true;
            }
            function tipOut() {
                if (that.hoverState == "in") return; // If field is still focused.
                that.hoverTooltip = false;
                if (that.options.trigger != "manual") {
                    var eventOut =
                        that.options.trigger == "hover"
                            ? "mouseleave.tipsy"
                            : "blur.tipsy";
                    that.$element.trigger(eventOut);
                }
            }

            if (this.options.hoverable) {
                $tip.hover(tipOver, tipOut);
            }

            if (this.options.className) {
                $tip.addClass(
                    maybeCall(this.options.className, this.$element[0])
                );
            }

            var pos = $.extend({}, this.$element.offset(), {
                width: this.$element[0].getBoundingClientRect().width,
                height: this.$element[0].getBoundingClientRect().height
            });

            var tipCss = {};
            var actualWidth = $tip[0].offsetWidth,
                actualHeight = $tip[0].offsetHeight;
            var gravity = maybeCall(this.options.gravity, this.$element[0]);

            if (gravity.length === 2) {
                if (gravity.charAt(1) === "w") {
                    tipCss.left = pos.left + pos.width / 2 - 15;
                } else {
                    tipCss.left =
                        pos.left + pos.width / 2 - actualWidth + 15;
                }
            }

            switch (gravity.charAt(0)) {
                case "n":
                    // left could already be set if gravity is 'nw' or 'ne'
                    if (typeof tipCss.left === "undefined") {
                        tipCss.left =
                            pos.left + pos.width / 2 - actualWidth / 2;
                    }
                    tipCss.top = pos.top + pos.height + this.options.offset;
                    break;
                case "s":
                    // left could already be set if gravity is 'sw' or 'se'
                    if (typeof tipCss.left === "undefined") {
                        tipCss.left =
                            pos.left + pos.width / 2 - actualWidth / 2;

                        // We need to apply the left positioning and then recalculate the tooltip height
                        // If the tooltip is positioned close to the right edge of the window, it could cause
                        // the tooltip text to overflow and change height.
                        $tip.css(tipCss);
                        actualHeight = $tip[0].offsetHeight;
                    }
                    tipCss.top =
                        pos.top - actualHeight - this.options.offset;
                    break;
                case "e":
                    tipCss.left =
                        pos.left - actualWidth - this.options.offset;
                    tipCss.top =
                        pos.top + pos.height / 2 - actualHeight / 2;
                    break;
                case "w":
                    tipCss.left =
                        pos.left + pos.width + this.options.offset;
                    tipCss.top =
                        pos.top + pos.height / 2 - actualHeight / 2;
                    break;
            }

            $tip.css(tipCss).addClass("tipsy-" + gravity);
            $tip.find(".tipsy-arrow")[0].className =
                "tipsy-arrow tipsy-arrow-" + gravity.charAt(0);

            if (this.options.fade) {
                $tip.stop()
                    .css({
                        opacity: 0,
                        display: "block",
                        visibility: "visible"
                    })
                    .animate({ opacity: this.options.opacity });
            } else {
                $tip.css({
                    visibility: "visible",
                    opacity: this.options.opacity
                });
            }

            if (this.options.aria) {
                var $tipID = tipsyID();
                $tip.attr("id", $tipID);
                this.$element.attr("aria-describedby", $tipID);
            }
        },

        destroy: function() {
            this.$element.removeData("tipsy");

            this.unbindHandlers();
            this.hide();
        },

        unbindHandlers: function() {
            if (this.options.live) {
                $(document).off(".tipsy", this.options.live);
            } else {
                this.$element.off(".tipsy");
            }
        },

        hide: function() {
            if (this.options.fade) {
                this.tip()
                    .stop()
                    .fadeOut(function() {
                        $(this).remove();
                    });
            } else {
                this.tip().remove();
            }
            if (this.options.aria) {
                this.$element.removeAttr("aria-describedby");
            }
        },

        fixTitle: function() {
            var $e = this.$element;
            if (
                $e.attr("title") ||
                typeof $e.attr("original-title") != "string"
            ) {
                $e.attr("original-title", $e.attr("title") || "").removeAttr(
                    "title"
                );
            }
        },

        getTitle: function() {
            var title,
                $e = this.$element,
                o = this.options;
            this.fixTitle();
            var title,
                o = this.options;
            if (typeof o.title == "string") {
                title = $e.attr(
                    o.title == "title" ? "original-title" : o.title
                );
            } else if (typeof o.title == "function") {
                title = o.title.call($e[0]);
            }
            title = ("" + title).replace(/(^\s*|\s*$)/, "");
            return title || o.fallback;
        },

        tip: function() {
            if (!this.$tip) {
                this.$tip = $('

')
                    .html(
                        '

'
                    )
                    .attr("role", "tooltip");
                this.$tip.data("tipsy-pointee", this.$element[0]);
            }
            return this.$tip;
        },

        validate: function() {
            if (!this.$element[0].parentNode) {
                this.hide();
                this.$element = null;
                this.options = null;
            }
        },

        enable: function() {
            this.enabled = true;
        },
        disable: function() {
            this.enabled = false;
        },
        toggleEnabled: function() {
            this.enabled = !this.enabled;
        }
    };

    $.fn.tipsy = function(options) {
        if (options === true) {
            return this.data("tipsy");
        } else if (typeof options == "string") {
            var tipsy = this.data("tipsy");
            if (tipsy) tipsy[options]();
            return this;
        }

        options = $.extend({}, $.fn.tipsy.defaults, options);
        if (options.hoverable) {
            options.delayOut = options.delayOut || 20;
        }

        // Check for jQuery support and patch live binding for jQuery 3 compat.
        if (options.live === true) {
            if (!this.selector) {
                // No more jQuery support!
                throw new Error(liveBindingWarning);
            } else {
                // Deprecated behaviour
                console && console.warn && console.warn(liveBindingWarning);
                options.live = this.selector;
            }
        }

        function get(ele) {
            var tipsy = $.data(ele, "tipsy");
            if (!tipsy) {
                tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
                $.data(ele, "tipsy", tipsy);
            }
            return tipsy;
        }

        function enter() {
            var tipsy = get(this);
            tipsy.hoverState = "in";
            if (options.delayIn == 0) {
                tipsy.show();
            } else {
                tipsy.fixTitle();
                setTimeout(function() {
                    if (
                        tipsy.hoverState == "in" &&
                        isElementInDOM(tipsy.$element)
                    ) {
                        tipsy.show();
                    }
                }, options.delayIn);
            }
        }

        function leave() {
            var tipsy = get(this);
            tipsy.hoverState = "out";
            if (options.delayOut == 0) {
                tipsy.hide();
            } else {
                setTimeout(function() {
                    if (tipsy.hoverState == "out" && !tipsy.hoverTooltip) {
                        tipsy.hide();
                    }
                }, options.delayOut);
            }
        }

        // create a tipsy object for every selected element,
        // even when the events are delegated.
        // this allows destruction to occur.
        this.each(function() {
            get(this);
        });

        if (options.trigger != "manual") {
            var eventIn =
                    options.trigger == "hover"
                        ? "mouseenter.tipsy focus.tipsy"
                        : "focus.tipsy",
                eventOut =
                    options.trigger == "hover"
                        ? "mouseleave.tipsy blur.tipsy"
                        : "blur.tipsy";
            if (options.live) {
                $(document)
                    .on(eventIn, options.live, enter)
                    .on(eventOut, options.live, leave);
            } else {
                this.on(eventIn, enter).on(eventOut, leave);
            }
        }

        return this;
    };

    $.fn.tipsy.defaults = {
        aria: false,
        className: null,
        delayIn: 0,
        delayOut: 0,
        fade: false,
        fallback: "",
        gravity: "n",
        html: false,
        live: false,
        hoverable: false,
        offset: 0,
        opacity: 0.8,
        title: "title",
        trigger: "hover"
    };

    $.fn.tipsy.revalidate = function() {
        $(".tipsy").each(function() {
            var pointee = $.data(this, "tipsy-pointee");
            if (!pointee || !isElementInDOM(pointee)) {
                $(this).remove();
            }
        });
    };

    // Overwrite this method to provide options on a per-element basis.
    // For example, you could store the gravity in a 'tipsy-gravity' attribute:
    // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
    // (remember - do not modify 'options' in place!)
    $.fn.tipsy.elementOptions = function(ele, options) {
        return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
    };

    $.fn.tipsy.autoNS = function() {
        return $(this).offset().top >
            $(document).scrollTop() + $(window).height() / 2
            ? "s"
            : "n";
    };

    $.fn.tipsy.autoWE = function() {
        return $(this).offset().left >
            $(document).scrollLeft() + $(window).width() / 2
            ? "e"
            : "w";
    };

    /**
     * yields a closure of the supplied parameters, producing a function that takes
     * no arguments and is suitable for use as an autogravity function like so:
     *
     * @param margin (int) - distance from the viewable region edge that an
     *        element should be before setting its tooltip's gravity to be away
     *        from that edge.
     * @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
     *        if there are no viewable region edges effecting the tooltip's
     *        gravity. It will try to vary from this minimally, for example,
     *        if 'sw' is preferred and an element is near the right viewable
     *        region edge, but not the top edge, it will set the gravity for
     *        that element's tooltip to be 'se', preserving the southern
     *        component.
     */
    $.fn.tipsy.autoBounds = function(margin, prefer) {
        return function() {
            var dir = {
                    ns: prefer[0],
                    ew: prefer.length > 1 ? prefer[1] : false
                },
                boundTop = $(document).scrollTop() + margin,
                boundLeft = $(document).scrollLeft() + margin,
                $this = $(this);

            if ($this.offset().top < boundTop) dir.ns = "n";
            if ($this.offset().left < boundLeft) dir.ew = "w";
            if (
                $(window).width() +
                    $(document).scrollLeft() -
                    $this.offset().left <
                margin
            )
                dir.ew = "e";
            if (
                $(window).height() +
                    $(document).scrollTop() -
                    $this.offset().top <
                margin
            )
                dir.ns = "s";

            return dir.ns + (dir.ew ? dir.ew : "");
        };
    };
})(jQuery);


text:
# -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*-

require 'pathname'
require 'fileutils'
require 'rdoc/erbio'

require 'rdoc/generator/markup'

##
# Darkfish RDoc HTML Generator
#
# $Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $
#
# == Author/s
# * Michael Granger (ged@FaerieMUD.org)
#
# == Contributors
# * Mahlon E. Smith (mahlon@martini.nu)
# * Eric Hodel (drbrain@segment7.net)
#
# == License
#
# Copyright (c) 2007, 2008, Michael Granger. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
#   this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
#   this list of conditions and the following disclaimer in the documentation
#   and/or other materials provided with the distribution.
#
# * Neither the name of the author/s, nor the names of the project's
#   contributors may be used to endorse or promote products derived from this
#   software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

class RDoc::Generator::Darkfish

  RDoc::RDoc.add_generator self

  include ERB::Util

  # Path to this file's parent directory. Used to find templates and other
  # resources.

  GENERATOR_DIR = File.join 'rdoc', 'generator'

  ##
  # Release Version

  VERSION = '2'

  ##
  # Description of this generator

  DESCRIPTION = 'HTML generator, written by Michael Granger'

  ##
  # Initialize a few instance variables before we start

  def initialize options
    @options = options

    @template_dir = Pathname.new options.template_dir
    @template_cache = {}

    @files      = nil
    @classes    = nil

    @basedir = Pathname.pwd.expand_path
  end

  ##
  # The output directory

  attr_reader :outputdir

  ##
  # Output progress information if debugging is enabled

  def debug_msg *msg
    return unless $DEBUG_RDOC
    $stderr.puts(*msg)
  end

  ##
  # Directory where generated class HTML files live relative to the output
  # dir.

  def class_dir
    nil
  end

  ##
  # Directory where generated class HTML files live relative to the output
  # dir.

  def file_dir
    nil
  end

  ##
  # Create the directories the generated docs will live in if they don't
  # already exist.

  def gen_sub_directories
    @outputdir.mkpath
  end

  ##
  # Copy over the stylesheet into the appropriate place in the output
  # directory.

  def write_style_sheet
    debug_msg "Copying static files"
    options = { :verbose => $DEBUG_RDOC, :noop => @options.dry_run }

    FileUtils.cp @template_dir + 'rdoc.css', '.', options

    Dir[(@template_dir + "{js,images}/**/*").to_s].each do |path|
      next if File.directory? path
      next if File.basename(path) =~ /^\./

        dst = Pathname.new(path).relative_path_from @template_dir

      # I suck at glob
      dst_dir = dst.dirname
      FileUtils.mkdir_p dst_dir, options unless File.exist? dst_dir

      FileUtils.cp @template_dir + path, dst, options
    end
  end

  ##
  # Build the initial indices and output objects based on an array of TopLevel
  # objects containing the extracted information.

  def generate top_levels
    @outputdir = Pathname.new(@options.op_dir).expand_path(@basedir)

    @files = top_levels.sort
    @classes = RDoc::TopLevel.all_classes_and_modules.sort
    @methods = @classes.map { |m| m.method_list }.flatten.sort
    @modsort = get_sorted_module_list(@classes)

    # Now actually write the output
    write_style_sheet
    generate_index
    generate_class_files
    generate_file_files

  rescue => e
    debug_msg "%s: %s\n  %s" % [
      e.class.name, e.message, e.backtrace.join("\n  ")
    ]

    raise
  end

  protected

  ##
  # Return a list of the documented modules sorted by salience first, then
  # by name.

  def get_sorted_module_list(classes)
    nscounts = classes.inject({}) do |counthash, klass|
      top_level = klass.full_name.gsub(/::.*/, '')
      counthash[top_level] ||= 0
      counthash[top_level] += 1

      counthash
    end

    # Sort based on how often the top level namespace occurs, and then on the
    # name of the module -- this works for projects that put their stuff into
    # a namespace, of course, but doesn't hurt if they don't.
    classes.sort_by do |klass|
      top_level = klass.full_name.gsub( /::.*/, '' )
      [nscounts[top_level] * -1, klass.full_name]
    end.select do |klass|
      klass.display?
    end
  end

  ##
  # Generate an index page which lists all the classes which are documented.

  def generate_index
    template_file = @template_dir + 'index.rhtml'
    return unless template_file.exist?

    debug_msg "Rendering the index page..."

    out_file = @basedir + @options.op_dir + 'index.html'

    render_template template_file, out_file do |io| binding end
  rescue => e
    error = RDoc::Error.new \
      "error generating index.html: #{e.message} (#{e.class})"
    error.set_backtrace e.backtrace

    raise error
  end

  ##
  # Generate a documentation file for each class

  def generate_class_files
    template_file = @template_dir + 'classpage.rhtml'
    return unless template_file.exist?
    debug_msg "Generating class documentation in #{@outputdir}"

    current = nil

    @classes.each do |klass|
      current = klass
      debug_msg "  working on %s (%s)" % [klass.full_name, klass.path]
      out_file   = @outputdir + klass.path
      # suppress 1.9.3 warning
      rel_prefix = rel_prefix = @outputdir.relative_path_from(out_file.dirname)
      svninfo    = svninfo    = self.get_svninfo(klass)

      debug_msg "  rendering #{out_file}"
      render_template template_file, out_file do |io| binding end
    end
  rescue => e
    error = RDoc::Error.new \
      "error generating #{current.path}: #{e.message} (#{e.class})"
    error.set_backtrace e.backtrace

    raise error
  end

  ##
  # Generate a documentation file for each file

  def generate_file_files
    template_file = @template_dir + 'filepage.rhtml'
    return unless template_file.exist?
    debug_msg "Generating file documentation in #{@outputdir}"

    out_file = nil

    @files.each do |file|
      out_file     = @outputdir + file.path
      debug_msg "  working on %s (%s)" % [file.full_name, out_file]
      # suppress 1.9.3 warning
      rel_prefix = rel_prefix  = @outputdir.relative_path_from(out_file.dirname)

      debug_msg "  rendering #{out_file}"
      render_template template_file, out_file do |io| binding end
    end
  rescue => e
    error =
      RDoc::Error.new "error generating #{out_file}: #{e.message} (#{e.class})"
    error.set_backtrace e.backtrace

    raise error
  end

  ##
  # Return a string describing the amount of time in the given number of
  # seconds in terms a human can understand easily.

  def time_delta_string seconds
    return 'less than a minute'          if seconds < 60
    return "#{seconds / 60} minute#{seconds / 60 == 1 ? '' : 's'}" if
                                            seconds < 3000     # 50 minutes
    return 'about one hour'              if seconds < 5400     # 90 minutes
    return "#{seconds / 3600} hours"     if seconds < 64800    # 18 hours
    return 'one day'                     if seconds < 86400    #  1 day
    return 'about one day'               if seconds < 172800   #  2 days
    return "#{seconds / 86400} days"     if seconds < 604800   #  1 week
    return 'about one week'              if seconds < 1209600  #  2 week
    return "#{seconds / 604800} weeks"   if seconds < 7257600  #  3 months
    return "#{seconds / 2419200} months" if seconds < 31536000 #  1 year
    return "#{seconds / 31536000} years"
  end

  # %q$Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $"
  SVNID_PATTERN = /
    \$Id:\s
    (\S+)\s                # filename
    (\d+)\s                # rev
    (\d{4}-\d{2}-\d{2})\s  # Date (YYYY-MM-DD)
    (\d{2}:\d{2}:\d{2}Z)\s # Time (HH:MM:SSZ)
    (\w+)\s                # committer
    \$$
  /x

  ##
  # Try to extract Subversion information out of the first constant whose
  # value looks like a subversion Id tag. If no matching constant is found,
  # and empty hash is returned.

  def get_svninfo klass
    constants = klass.constants or return {}

    constants.find { |c| c.value =~ SVNID_PATTERN } or return {}

    filename, rev, date, time, committer = $~.captures
    commitdate = Time.parse "#{date} #{time}"

    return {
      :filename    => filename,
      :rev         => Integer(rev),
      :commitdate  => commitdate,
      :commitdelta => time_delta_string(Time.now - commitdate),
      :committer   => committer,
    }
  end

  ##
  # Load and render the erb template in the given +template_file+ and write
  # it out to +out_file+.
  #
  # Both +template_file+ and +out_file+ should be Pathname-like objects.
  #
  # An io will be yielded which must be captured by binding in the caller.

  def render_template template_file, out_file # :yield: io
    template = template_for template_file

    unless @options.dry_run then
      debug_msg "Outputting to %s" % [out_file.expand_path]

      out_file.dirname.mkpath
      out_file.open 'w', 0644 do |io|
        io.set_encoding @options.encoding if Object.const_defined? :Encoding

        context = yield io

        template_result template, context, template_file
      end
    else
      context = yield nil

      output = template_result template, context, template_file

      debug_msg "  would have written %d characters to %s" % [
        output.length, out_file.expand_path
      ]
    end
  end

  ##
  # Creates the result for +template+ with +context+.  If an error is raised a
  # Pathname +template_file+ will indicate the file where the error occurred.

  def template_result template, context, template_file
    template.filename = template_file.to_s
    template.result context
  rescue NoMethodError => e
    raise RDoc::Error, "Error while evaluating %s: %s" % [
      template_file.expand_path,
      e.message,
    ], e.backtrace
  end

  ##
  # Retrieves a cache template for +file+, if present, or fills the cache.

  def template_for file
    template = @template_cache[file]

    return template if template

    klass = @options.dry_run ? ERB : RDoc::ERBIO

    template = klass.new file.read, nil, '<>'
    @template_cache[file] = template
    template
  end

end


text: Personal Landing Page


text:
<p id="charbonneau_amanda" data-toggle="tooltip" title="">
    Amanda Charbonneau
    is a Genetics grad student at Michigan State University. Her PhD
    project uses genomics to look for genetic differences between
    weedy plants and their presumed ancestors, to see what genes are
    important in becoming invasive. When she isn't working, you can
    find her teaching high school students science or wrangling birds
    of prey, generally not at the same time.


text:
module Hastings
  module FS
    # {AbsolutePaths} forces absolute paths to be used instead of relative paths
    # when instantiating StringIO objects. It is included in {Hastings::File}
    # and {Hastings::Dir}
    module AbsolutePaths
      # Proxy for StringIO based objects to use absolute paths instead of
      # relative paths so that they still work if we change directories
      # @param args [Array] the first argument is assumed to be a path
      # @return the object with an absolute path
      def initialize(*args)
        args.first.replace(File.absolute_path args.first)
        super(*args)
      end
    end
  end
end


text:
package org.apache.eagle.hadoop.queue;

import com.typesafe.config.ConfigFactory;
import org.junit.Test;

public class HadoopQueueRunningAppTest {
    @Test
    public void testRun(){
        new HadoopQueueRunningApp().run(ConfigFactory.load());
    }
}


text:
package org.smartdata.metrics;

/**
 * This interface aims to collect file access event through different ways.
 */
public interface FileAccessEventSource {
  /**
   * Get a collector what will produce events from this file access event source.
   */
  FileAccessEventCollector getCollector();

  /**
   * Insert events generated from the Smart client so that the collector can consume.
   * The actual implementation of FileAccessEventSource doesn't have to support this.
   * @param event The event that generated from Smart client
   */
  void insertEventFromSmartClient(FileAccessEvent event);

  /**
   * Close the source, release resources if necessary.
   */
  void close();
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Proc. Calif. Acad. Sci. , Ser. 3, Bot. 1: 267 (1899)

#### Original name
Pseudohydnotrya carnea Harkn.

### Remarks
null