text
stringlengths 2
1.04M
| meta
dict |
---|---|
import addCommas from 'add-commas';
import { standardize, Candidate, primaries2016Candidates, primaries2016Dates } from 'election-utils';
import slugify from 'underscore.string/slugify';
import orderBy from 'lodash.orderby';
function candidateRow(candidate, index, totalVoteCount, party, NUMBER_TO_PRIORITIZE) {
const first = candidate.hasOwnProperty('first') ? candidate.first : '';
const last = candidate.hasOwnProperty('last') ? candidate.last : '';
const voteCount = candidate.hasOwnProperty('voteCount') ? candidate.voteCount : 0;
const percent = totalVoteCount > 0 ? candidate.voteCount/totalVoteCount : 0;
const displayPct = standardize.percent(percent);
const winnerTag = Candidate.isWinner(candidate) ? '<span class="winner">✔</span>' : '';
const image = primaries2016Candidates.find(c => c.last === last.toLowerCase())
? `${last.toLowerCase().replace("'", "")}.jpg`
: 'placeholder.png';
const fancy = `
<div class='candidate-row fancy'>
<div class='photo'><img alt='' src="assets/img/${image}" /></div>
<div class='two-rows'>
<div class='name-and-pct'>
<div class='name'>${winnerTag}<span class='first epsilon'>${first}</span> <span class='last epsilon'>${last}</span></div>
<div class='pct'><span class='epsilon'>${displayPct}%</span></div>
</div>
<div class='bar-and-votes'>
<div class='bar'><span class='iota wrapper'><span style='width: ${displayPct}%'> </span></span></div>
<div class='votes'><span class='iota'>${addCommas(voteCount)} votes</span></div>
</div>
</div>
</div>
`;
const lite = `
<div class='candidate-row lite'>
<div class='name-and-votes-and-pct'>
<span class='name first eta'>${first}</span> <span class='name last eta'>${last}</span> <span class='votes iota'>${addCommas(voteCount)} votes</span> <span class='pct theta'>${displayPct}%</span>
</div>
</div>
`;
return index < NUMBER_TO_PRIORITIZE ? fancy : lite;
}
export default function stateResultsSmallTable({results, NUMBER_TO_PRIORITIZE, MAX_NUMBER_TO_DISPLAY}) {
// get state-level reporting unit
const stateRU = results.reportingUnits.filter(x => x.level === 'state')[0];
// filter out not real candidates
const filtered = stateRU.candidates.filter(c => {
return primaries2016Candidates.find(c1 => c1.last === c.last.toLowerCase());
});
const withSuspended = filtered.map(c1 => {
const c2 = primaries2016Candidates.find(c3 => c3.last === c1.last.toLowerCase());
const active = c2.suspendedDate ? 0 : 1;
c1.active = active;
return c1;
});
withSuspended.sort((a,b) => a.ballotOrder - b.ballotOrder);
withSuspended.sort((a,b) => b.active - a.active);
// sort candidates by vote count and ballot order
const candidates = orderBy(withSuspended, ['voteCount'], ['desc']);
// get the total vote count
const totalVoteCount = candidates
.map(x => x.voteCount)
.reduce((x, y) => x + y);
const partyAbbr = results.party;
const party = standardize.expandParty(partyAbbr);
const stateAbbr = stateRU.statePostal;
const state = standardize.expandState(stateAbbr);
const raceType = standardize.raceType(results.raceType);
const raceInfo = primaries2016Dates.find(d => {
const sameState = d.stateAbbr === stateAbbr.toUpperCase();
const sameParty = d.party.toLowerCase() === party.toLowerCase();
return sameState && sameParty;
});
const note = raceInfo.resultsNote ? `<div class="results-note">Note: ${raceInfo.resultsNote}</div>` : '';
return `
<div class='title-and-updater ${party}'>
<div class='title'><span class='iota'>${state} ${party} ${raceType}</span></div>
</div>
<div class='results ${party}'>
${candidates.slice(0, MAX_NUMBER_TO_DISPLAY).map((x, i) => candidateRow(x, i, totalVoteCount, party, NUMBER_TO_PRIORITIZE)).join('')}
</div>
${note}
<div class='precincts-and-more'>
<div class='precincts'><span class='iota'>${+stateRU.precinctsReportingPct}% <span class='extra'>precincts</span> reporting</span></div>
</div>
`;
}
| {
"content_hash": "b0d40fe5ba7d4fe21c2f22162c81f8f8",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 198,
"avg_line_length": 36.11818181818182,
"alnum_prop": 0.6821042033727662,
"repo_name": "BostonGlobe/2016_primaries_smt",
"id": "e099369ab5f6be0351e7f0a53a8f6a4bc6cef59a",
"size": "3975",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/js/state-results-small-table.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6858"
},
{
"name": "HTML",
"bytes": "6205"
},
{
"name": "JavaScript",
"bytes": "15126"
},
{
"name": "Makefile",
"bytes": "50"
}
],
"symlink_target": ""
} |
package wrapper;
import org.uma.jmetal.algorithm.Algorithm;
import org.uma.jmetal.algorithm.multiobjective.nsgaii.NSGAIIBuilder;
import org.uma.jmetal.operator.CrossoverOperator;
import org.uma.jmetal.operator.MutationOperator;
import org.uma.jmetal.operator.SelectionOperator;
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection;
import org.uma.jmetal.util.AlgorithmRunner;
import entities.Employee;
import entities.Feature;
import entities.parameters.IterationParameters;
import logic.NextReleaseProblem;
import logic.PlanningSolution;
import logic.PopulationFilter;
import logic.comparators.PlanningSolutionDominanceComparator;
import logic.operators.PlanningCrossoverOperator;
import logic.operators.PlanningMutationOperator;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
public class SolverNRP {
public PlanningSolution executeNRP(int nbWeeks, Number hoursPerweek, List<Feature> features, List<Employee> employees){
NextReleaseProblem problem = new NextReleaseProblem(features, employees, new IterationParameters(nbWeeks, hoursPerweek.doubleValue()));
Algorithm<List<PlanningSolution>> algorithm;
CrossoverOperator<PlanningSolution> crossover;
MutationOperator<PlanningSolution> mutation;
SelectionOperator<List<PlanningSolution>, PlanningSolution> selection;
crossover = new PlanningCrossoverOperator(problem);
mutation = new PlanningMutationOperator(problem);
selection = new BinaryTournamentSelection<>(new PlanningSolutionDominanceComparator());
algorithm = new NSGAIIBuilder<PlanningSolution>(problem, crossover, mutation)
.setSelectionOperator(selection)
.setMaxIterations(500)
.setPopulationSize(100)
.build();
new AlgorithmRunner.Executor(algorithm).execute();
List<PlanningSolution> population = algorithm.getResult();
return PopulationFilter.getBestSolution(population);
}
public static void printPopulation(Collection<PlanningSolution> population) {
int solutionCpt = 1;
Iterator<PlanningSolution> iterator = population.iterator();
while (iterator.hasNext()) {
PlanningSolution currentSolution = iterator.next();
System.out.println("Solution " + solutionCpt++ + ": " + currentSolution);
}
}
}
| {
"content_hash": "3072ffb4cdcefb4d479def1fe329166f",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 143,
"avg_line_length": 34.04225352112676,
"alnum_prop": 0.7513446421183285,
"repo_name": "elena20ruiz/ApiNRP",
"id": "a59d44b03dcf42e8c120e01f31827631b7550759",
"size": "2417",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/wrapper/SolverNRP.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "100491"
}
],
"symlink_target": ""
} |
using System;
using System.Runtime.InteropServices;
namespace LightningDB.Native
{
internal class MarshalMultipleValueStructure : IDisposable
{
private bool _shouldDispose;
private byte[][] _values;
private ValueStructure[] _structures;
public MarshalMultipleValueStructure(byte[][] values)
{
if (values == null)
throw new ArgumentNullException("values");
_shouldDispose = false;
_values = values;
this.ValueInitialized = false;
}
public bool ValueInitialized { get; private set; }
private int GetSize()
{
if (_values.Length == 0 || _values[0] == null || _values[0].Length == 0)
return 0;
return _values[0].Length;
}
private int GetCount()
{
return _values.Length;
}
//Lazy initialization prevents possible leak.
//If initialization was in ctor, Dispose could never be called
//due to possible exception thrown by Marshal.Copy
public ValueStructure[] ValueStructures
{
get
{
if (!this.ValueInitialized)
{
var size = GetSize();
var count = GetCount();
var totalLength = size * count;
_structures = new []
{
new ValueStructure
{
size = new IntPtr(size),
data = Marshal.AllocHGlobal(totalLength)
},
new ValueStructure
{
size = new IntPtr(count )
}
};
_shouldDispose = true;
try
{
var baseAddress = _structures[0].data.ToInt64();
for (var i = 0; i < count; i++)
{
if (_values[i].Length != size)
throw new InvalidOperationException("all data items should be of the same length");
var address = new IntPtr(baseAddress + i * size);
Marshal.Copy(_values[i], 0, address, size);
}
}
catch
{
this.Dispose();
}
this.ValueInitialized = true;
}
return _structures;
}
}
protected virtual void Dispose(bool shouldDispose)
{
if (!shouldDispose)
return;
try
{
Marshal.FreeHGlobal(_structures[0].data);
}
catch { }
}
public void Dispose()
{
this.Dispose(_shouldDispose);
_shouldDispose = false;
}
}
}
| {
"content_hash": "225cbade5c126e7605d0b37268b2eed0",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 115,
"avg_line_length": 28.745454545454546,
"alnum_prop": 0.4117647058823529,
"repo_name": "bradserbu/mylonite-net",
"id": "72cadbe8da330417225f7ef00f20254b83572993",
"size": "3164",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/lightning.net/src/LightningDB/Native/MarshalMultipleValueStructure.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "292221"
},
{
"name": "PowerShell",
"bytes": "394"
},
{
"name": "Ruby",
"bytes": "2572"
}
],
"symlink_target": ""
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>W28635_text</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div style="margin-left: auto; margin-right: auto; width: 800px; overflow: hidden;">
<div style="float: left;">
<a href="page20.html">«</a>
</div>
<div style="float: right;">
</div>
</div>
<hr/>
<div style="position: absolute; margin-left: 1264px; margin-top: 0px;">
<p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 329px; margin-top: 246px;">
<p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 191px; margin-top: 274px;">
<p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 219px; margin-top: 439px;">
<p class="styleSans47.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Oasis Petroleum Well Summary Chalmers 5300 21-19 7T2 Sec. 19 T153N R100W McKenzie County, North Dakota <br/>INTERMEDIATE CASING AND CEMENT DESIGN <br/> <br/>Intermediate Casin . Desi - n <br/> Make-u Tome rubs mmmmmmm <br/> <br/>0' - 6000' “Snacial Drifi <br/> </p>
</div>
<div style="position: absolute; margin-left: 0px; margin-top: 1539px;">
<p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 301px; margin-top: 2253px;">
<p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Lead Slurry: </p>
</div>
<div style="position: absolute; margin-left: 301px; margin-top: 2446px;">
<p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Tail Slurry: </p>
</div>
<div style="position: absolute; margin-left: 1869px; margin-top: 0px;">
<p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 274px; margin-top: 1182px;">
<p class="styleSans43.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">“Special Drift <br/>Im- Collapse m Tension —_ (psi) b <1oooms>c 0‘ - 6000' 9-5/8", 4o#, HCL—80, LTC, 8rd 3090/ 3.96‘ 5750/ 1.23 837/ 2.75 <br/>AM Rating 8. ngey Factor <br/>d) Collapse pressure based on 115pr fluid on backside and Qppg fluid inside of casing. e) Burst pressure calculated from a gas kick coming from the production zone (Bakken Pool) at 9,000psi and a subsequent breakdown at the 9-5/8" shoe, based on a 13.5#/ft fracture gradient, <br/> <br/> <br/>Backup of 9 ppg fluid. f) Tension based on string weight in 10 ppg fluid, (217k lbs buoyed weight) plus 100k lbs overpuli. <br/>Cement volumes are estimates based on 9-5/8" casing set in an 12-1/4" hole with 10% excess in OH and 0% excess inside surface casing. TOC at surface. <br/>Pre-flush (Spacer): 20 bbls Chem wash </p>
</div>
<div style="position: absolute; margin-left: 769px; margin-top: 2226px;">
<p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">540 sks (280 bbls) Conventional system with 75 lb/sk cement, 0.5lblsk lost circulation, 10% expanding agent, 2% extender, 2% CaCI2, 0.2% anti foam, and 0.4% fluid loss </p>
</div>
<div style="position: absolute; margin-left: 769px; margin-top: 2419px;">
<p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">373 sks (77 bbls) Conventional system with 94 lblsk oement, 0.3% anti—settling agent, 03% fluid loss agent, 0.3 lblsk lost circulation control agent, 0.2% anti foam, and 0.1% retarder </p>
</div>
</body>
</html>
| {
"content_hash": "07be1940321f83470b51e8a6943244a6",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 920,
"avg_line_length": 68,
"alnum_prop": 0.6911764705882353,
"repo_name": "datamade/elpc_bakken",
"id": "4a6736582bb01434b8a4dbbe4d646e9396d59374",
"size": "4315",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ocr_extracted/W28635_text/page21.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "17512999"
},
{
"name": "HTML",
"bytes": "421900941"
},
{
"name": "Makefile",
"bytes": "991"
},
{
"name": "Python",
"bytes": "7186"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>compcert-32: 25 m 53 s 🏆</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.9.1 / compcert-32 - 3.9</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
compcert-32
<small>
3.9
<span class="label label-success">25 m 53 s 🏆</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-17 13:17:37 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-17 13:17:37 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.9.1 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.08.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.08.1 Official release 4.08.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
authors: "Xavier Leroy <[email protected]>"
maintainer: "Jacques-Henri Jourdan <[email protected]>"
homepage: "http://compcert.inria.fr/"
dev-repo: "git+https://github.com/AbsInt/CompCert.git"
bug-reports: "https://github.com/AbsInt/CompCert/issues"
license: "INRIA Non-Commercial License Agreement"
available: os != "macos"
build: [
["./configure"
"ia32-linux" {os = "linux"}
"ia32-cygwin" {os = "cygwin"}
# This is for building a MinGW CompCert with cygwin host and cygwin target
"ia32-cygwin" {os = "win32" & os-distribution = "cygwinports"}
# This is for building a 32 bit CompCert on 64 bit MinGW with cygwin build host
"-toolprefix" {os = "win32" & os-distribution = "cygwinports" & arch = "x86_64"}
"i686-pc-cygwin-" {os = "win32" & os-distribution = "cygwinports" & arch = "x86_64"}
# The 32 bit CompCert is a variant which is installed in a non standard folder
"-prefix" "%{prefix}%/variants/compcert32"
"-install-coqdev"
"-clightgen"
"-use-external-Flocq"
"-use-external-MenhirLib"
"-coqdevdir" "%{lib}%/coq-variant/compcert32/compcert"
"-ignore-coq-version"]
[make "-j%{jobs}%" {ocaml:version >= "4.06"}]
]
install: [
[make "install"]
]
depends: [
"coq" {>= "8.9.0" & < "8.15~"}
"menhir" {>= "20190626" }
"ocaml" {>= "4.05.0"}
"coq-flocq" {>= "3.1.0" & < "4~"}
"coq-menhirlib" {>= "20190626"}
]
synopsis: "The CompCert C compiler (32 bit)"
description: "This package installs the 32 bit version of CompCert.
For coexistence with the 64 bit version, the files are installed in:
%{prefix}%/variants/compcert32/bin (ccomp and clightgen binaries)
%{prefix}%/variants/compcert32/lib/compcert (C library)
%{lib}%/coq-variant/compcert32/compcert (Coq library)
Please note that the coq module path is compcert and not compcert32,
so the files cannot be directly Required as compcert32.
Instead -Q or -R options must be used to bind the compcert32 folder
to the module path compcert. This is more convenient if one development
supports both 32 and 64 bit versions. Otherwise all files would have to
be duplicated with module paths compcert and compcert32.
Please also note that the binary folder is usually not in the path."
tags: [
"category:Computer Science/Semantics and Compilation/Compilation"
"category:Computer Science/Semantics and Compilation/Semantics"
"keyword:C"
"keyword:compiler"
"logpath:compcert32"
"date:2021-05-10"
]
url {
src: "https://github.com/AbsInt/CompCert/archive/v3.9.tar.gz"
checksum: "sha512=485cbed95284c93124ecdea536e6fb9ea6a05a72477584204c8c3930759d27b0949041ae567044eda9b716a33bba4315665a8d3860deebf851e10c9a4ef88684"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-compcert-32.3.9 coq.8.9.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-compcert-32.3.9 coq.8.9.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>12 m 28 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-compcert-32.3.9 coq.8.9.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>25 m 53 s</dd>
</dl>
<h2>Installation size</h2>
<p>Total: 93 M</p>
<ul>
<li>11 M <code>../ocaml-base-compiler.4.08.1/variants/compcert32/bin/ccomp</code></li>
<li>10 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cparser/Parser.vo</code></li>
<li>7 M <code>../ocaml-base-compiler.4.08.1/variants/compcert32/bin/clightgen</code></li>
<li>4 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/SelectOp.vo</code></li>
<li>4 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/SelectLong.vo</code></li>
<li>4 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/SimplExprproof.vo</code></li>
<li>3 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/ValueDomain.vo</code></li>
<li>2 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/Op.vo</code></li>
<li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Cminorgenproof.vo</code></li>
<li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Cexec.vo</code></li>
<li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Ctyping.vo</code></li>
<li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Allocproof.vo</code></li>
<li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/Asmgenproof1.vo</code></li>
<li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/Machregs.vo</code></li>
<li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Cstrategy.vo</code></li>
<li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Allocation.vo</code></li>
<li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/SimplLocalsproof.vo</code></li>
<li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/RTLgenproof.vo</code></li>
<li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Selectionproof.vo</code></li>
<li>1018 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/CombineOp.vo</code></li>
<li>966 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/SplitLong.vo</code></li>
<li>960 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Cshmgenproof.vo</code></li>
<li>832 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/SelectOpproof.vo</code></li>
<li>826 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Memory.vo</code></li>
<li>773 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Integers.vo</code></li>
<li>726 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/ConstpropOp.vo</code></li>
<li>717 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Values.vo</code></li>
<li>698 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Cop.vo</code></li>
<li>698 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Events.vo</code></li>
<li>676 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/FSetAVLplus.vo</code></li>
<li>653 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/Asmgenproof.vo</code></li>
<li>650 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/Asm.vo</code></li>
<li>642 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Inliningproof.vo</code></li>
<li>589 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Ctypes.vo</code></li>
<li>559 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Stackingproof.vo</code></li>
<li>557 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Cminor.vo</code></li>
<li>552 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Initializersproof.vo</code></li>
<li>533 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/SimplExprspec.vo</code></li>
<li>517 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/ValueAnalysis.vo</code></li>
<li>487 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Linking.vo</code></li>
<li>472 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/SplitLongproof.vo</code></li>
<li>469 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Smallstep.vo</code></li>
<li>467 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/IEEE754_extra.vo</code></li>
<li>464 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/SelectLongproof.vo</code></li>
<li>458 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Selection.vo</code></li>
<li>450 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/CSEproof.vo</code></li>
<li>447 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Unusedglobproof.vo</code></li>
<li>438 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Bounds.vo</code></li>
<li>427 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Deadcodeproof.vo</code></li>
<li>426 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/RTLgenspec.vo</code></li>
<li>412 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Linearize.vo</code></li>
<li>411 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/SimplLocals.vo</code></li>
<li>404 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Heaps.vo</code></li>
<li>398 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Unusedglob.vo</code></li>
<li>393 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Globalenvs.vo</code></li>
<li>387 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/ConstpropOpproof.vo</code></li>
<li>387 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Registers.vo</code></li>
<li>384 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/CleanupLabels.vo</code></li>
<li>381 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/ValueAOp.vo</code></li>
<li>379 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Constpropproof.vo</code></li>
<li>379 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Cminortyping.vo</code></li>
<li>371 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/AST.vo</code></li>
<li>358 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Maps.vo</code></li>
<li>347 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/RTLtyping.vo</code></li>
<li>338 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Parmov.vo</code></li>
<li>314 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Tunnelingproof.vo</code></li>
<li>308 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/NeedDomain.vo</code></li>
<li>301 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Inliningspec.vo</code></li>
<li>299 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Asmgenproof0.vo</code></li>
<li>286 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Linearizeproof.vo</code></li>
<li>284 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Tailcallproof.vo</code></li>
<li>284 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Memdata.vo</code></li>
<li>282 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/SelectDivproof.vo</code></li>
<li>263 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Kildall.vo</code></li>
<li>261 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/NeedOp.vo</code></li>
<li>253 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Builtins0.vo</code></li>
<li>235 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Coqlib.vo</code></li>
<li>234 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/ClightBigstep.vo</code></li>
<li>232 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Debugvarproof.vo</code></li>
<li>226 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Floats.vo</code></li>
<li>221 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Separation.vo</code></li>
<li>218 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Debugvar.vo</code></li>
<li>215 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/Asmgen.vo</code></li>
<li>208 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/exportclight/Clightdefs.vo</code></li>
<li>206 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Csem.vo</code></li>
<li>201 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Clight.vo</code></li>
<li>192 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/driver/Compiler.vo</code></li>
<li>192 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/CleanupLabelsproof.vo</code></li>
<li>188 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Behaviors.vo</code></li>
<li>186 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Determinism.vo</code></li>
<li>180 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Zbits.vo</code></li>
<li>171 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Mach.vo</code></li>
<li>167 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/SimplExpr.vo</code></li>
<li>164 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Deadcode.vo</code></li>
<li>163 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Unityping.vo</code></li>
<li>163 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/CminorSel.vo</code></li>
<li>156 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Lineartyping.vo</code></li>
<li>156 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/RTL.vo</code></li>
<li>152 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/IntvSets.vo</code></li>
<li>148 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Locations.vo</code></li>
<li>145 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Lattice.vo</code></li>
<li>138 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/RTLgen.vo</code></li>
<li>137 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/CombineOpproof.vo</code></li>
<li>136 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Cshmgen.vo</code></li>
<li>126 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Switch.vo</code></li>
<li>126 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Renumberproof.vo</code></li>
<li>123 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/driver/Complements.vo</code></li>
<li>120 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Memtype.vo</code></li>
<li>114 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Intv.vo</code></li>
<li>114 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Postorder.vo</code></li>
<li>111 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Csharpminor.vo</code></li>
<li>109 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Inlining.vo</code></li>
<li>107 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/UnionFind.vo</code></li>
<li>104 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Initializers.vo</code></li>
<li>101 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Tunneling.vo</code></li>
<li>100 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/CSE.vo</code></li>
<li>98 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/Conventions1.vo</code></li>
<li>97 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/SelectDiv.vo</code></li>
<li>88 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Linear.vo</code></li>
<li>87 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/LTL.vo</code></li>
<li>86 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/CSEdomain.vo</code></li>
<li>84 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Cminorgen.vo</code></li>
<li>80 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Constprop.vo</code></li>
<li>78 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/Stacklayout.vo</code></li>
<li>76 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Liveness.vo</code></li>
<li>75 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Ordered.vo</code></li>
<li>74 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Conventions.vo</code></li>
<li>72 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cparser/Cabs.vo</code></li>
<li>70 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/cfrontend/Csyntax.vo</code></li>
<li>70 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Stacking.vo</code></li>
<li>64 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Decidableplus.vo</code></li>
<li>61 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Tailcall.vo</code></li>
<li>60 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/backend/Renumber.vo</code></li>
<li>59 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Iteration.vo</code></li>
<li>58 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Errors.vo</code></li>
<li>50 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/common/Builtins.vo</code></li>
<li>48 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86/Builtins1.vo</code></li>
<li>47 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/BoolEqual.vo</code></li>
<li>43 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/x86_32/Archi.vo</code></li>
<li>15 K <code>../ocaml-base-compiler.4.08.1/variants/compcert32/share/man/man1/ccomp.1</code></li>
<li>13 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Wfsimpl.vo</code></li>
<li>12 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/lib/Axioms.vo</code></li>
<li>11 K <code>../ocaml-base-compiler.4.08.1/variants/compcert32/lib/compcert/libcompcert.a</code></li>
<li>4 K <code>../ocaml-base-compiler.4.08.1/variants/compcert32/lib/compcert/include/stddef.h</code></li>
<li>3 K <code>../ocaml-base-compiler.4.08.1/variants/compcert32/lib/compcert/include/float.h</code></li>
<li>3 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/driver/Compopts.vo</code></li>
<li>2 K <code>../ocaml-base-compiler.4.08.1/variants/compcert32/lib/compcert/include/stdarg.h</code></li>
<li>2 K <code>../ocaml-base-compiler.4.08.1/variants/compcert32/lib/compcert/include/stdalign.h</code></li>
<li>2 K <code>../ocaml-base-compiler.4.08.1/variants/compcert32/lib/compcert/include/stdbool.h</code></li>
<li>2 K <code>../ocaml-base-compiler.4.08.1/variants/compcert32/lib/compcert/include/varargs.h</code></li>
<li>2 K <code>../ocaml-base-compiler.4.08.1/variants/compcert32/lib/compcert/include/stdnoreturn.h</code></li>
<li>1 K <code>../ocaml-base-compiler.4.08.1/variants/compcert32/share/compcert.ini</code></li>
<li>1 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/compcert.config</code></li>
<li>1 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/README</code></li>
<li>1 K <code>../ocaml-base-compiler.4.08.1/lib/coq-variant/compcert32/compcert/VERSION</code></li>
</ul>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq-compcert-32.3.9</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "bb730acebda61af18cd28ed0da579f7d",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 159,
"avg_line_length": 80.82670454545455,
"alnum_prop": 0.6376577273206566,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "2e4cb1787767aa4b1f70d0592b8233616fc7ba21",
"size": "28476",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.08.1-2.0.5/released/8.9.1/compcert-32/3.9.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([FTIAppDelegate class]));
}
}
| {
"content_hash": "43c59abf4c581050687bbf73e9934eee",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 93,
"avg_line_length": 26.833333333333332,
"alnum_prop": 0.6645962732919255,
"repo_name": "52inc/learn-ios",
"id": "ee1ec339e7ddd11ec21007e14dd7b1a4f612144d",
"size": "337",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Workshop 1 - An Introduction To Table Views/Alliance/main.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "166070"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_144) on Tue Jul 03 11:45:08 CDT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ArrayStrings</title>
<meta name="date" content="2018-07-03">
<meta name="keywords" content="edu.umn.biomedicus.common.dictionary.ArrayStrings class">
<meta name="keywords" content="getTerm()">
<meta name="keywords" content="mappingIterator()">
<meta name="keywords" content="size()">
<meta name="keywords" content="close()">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ArrayStrings";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../edu/umn/biomedicus/common/dictionary/AbstractStrings.html" title="class in edu.umn.biomedicus.common.dictionary"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../edu/umn/biomedicus/common/dictionary/BidirectionalDictionary.html" title="interface in edu.umn.biomedicus.common.dictionary"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?edu/umn/biomedicus/common/dictionary/ArrayStrings.html" target="_top">Frames</a></li>
<li><a href="ArrayStrings.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">edu.umn.biomedicus.common.dictionary</div>
<h2 title="Class ArrayStrings" class="title">Class ArrayStrings</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>AbstractStrings</li>
<li>
<ul class="inheritance">
<li>edu.umn.biomedicus.common.dictionary.ArrayStrings</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../edu/umn/biomedicus/common/dictionary/BidirectionalDictionary.Strings.html" title="interface in edu.umn.biomedicus.common.dictionary">BidirectionalDictionary.Strings</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">ArrayStrings</span>
extends AbstractStrings</pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../edu/umn/biomedicus/common/dictionary/ArrayStrings.html#close--">close</a></span>()</code> </td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../edu/umn/biomedicus/common/dictionary/ArrayStrings.html#getTerm--">getTerm</a></span>()</code> </td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../../../../edu/umn/biomedicus/common/dictionary/MappingIterator.html" title="type parameter in MappingIterator">MappingIterator</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../edu/umn/biomedicus/common/dictionary/ArrayStrings.html#mappingIterator--">mappingIterator</a></span>()</code> </td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../edu/umn/biomedicus/common/dictionary/ArrayStrings.html#size--">size</a></span>()</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.edu.umn.biomedicus.common.dictionary.AbstractStrings">
<!-- -->
</a>
<h3>Methods inherited from class edu.umn.biomedicus.common.dictionary.<a href="../../../../../edu/umn/biomedicus/common/dictionary/AbstractStrings.html" title="class in edu.umn.biomedicus.common.dictionary">AbstractStrings</a></h3>
<code><a href="../../../../../edu/umn/biomedicus/common/dictionary/AbstractStrings.html#getTerm--">getTerm</a>, <a href="../../../../../edu/umn/biomedicus/common/dictionary/AbstractStrings.html#getTerm--">getTerm</a>, <a href="../../../../../edu/umn/biomedicus/common/dictionary/AbstractStrings.html#getTerms--">getTerms</a>, <a href="../../../../../edu/umn/biomedicus/common/dictionary/AbstractStrings.html#getTerms--">getTerms</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.edu.umn.biomedicus.common.dictionary.BidirectionalDictionary.Strings">
<!-- -->
</a>
<h3>Methods inherited from interface edu.umn.biomedicus.common.dictionary.<a href="../../../../../edu/umn/biomedicus/common/dictionary/BidirectionalDictionary.Strings.html" title="interface in edu.umn.biomedicus.common.dictionary">BidirectionalDictionary.Strings</a></h3>
<code><a href="../../../../../edu/umn/biomedicus/common/dictionary/BidirectionalDictionary.Strings.html#getTerm--">getTerm</a>, <a href="../../../../../edu/umn/biomedicus/common/dictionary/BidirectionalDictionary.Strings.html#getTerms--">getTerms</a>, <a href="../../../../../edu/umn/biomedicus/common/dictionary/BidirectionalDictionary.Strings.html#getTerms--">getTerms</a>, <a href="../../../../../edu/umn/biomedicus/common/dictionary/BidirectionalDictionary.Strings.html#mappingIterator--">mappingIterator</a>, <a href="../../../../../edu/umn/biomedicus/common/dictionary/BidirectionalDictionary.Strings.html#size--">size</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getTerm--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTerm</h4>
<pre>public java.lang.String getTerm()</pre>
</li>
</ul>
<a name="mappingIterator--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>mappingIterator</h4>
<pre>public <a href="../../../../../edu/umn/biomedicus/common/dictionary/MappingIterator.html" title="type parameter in MappingIterator">MappingIterator</a> mappingIterator()</pre>
</li>
</ul>
<a name="size--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>size</h4>
<pre>public int size()</pre>
</li>
</ul>
<a name="close--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>close</h4>
<pre>public void close()</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../edu/umn/biomedicus/common/dictionary/AbstractStrings.html" title="class in edu.umn.biomedicus.common.dictionary"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../edu/umn/biomedicus/common/dictionary/BidirectionalDictionary.html" title="interface in edu.umn.biomedicus.common.dictionary"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?edu/umn/biomedicus/common/dictionary/ArrayStrings.html" target="_top">Frames</a></li>
<li><a href="ArrayStrings.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "0eebeee61b72c4430d9ef37e247dd27f",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 640,
"avg_line_length": 40.75945017182131,
"alnum_prop": 0.6503667481662592,
"repo_name": "NLPIE/BioMedICUS",
"id": "63d1b758262974f7bb9d1441c2700162b5d0def5",
"size": "11861",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/javadoc/biomedicus-core/edu/umn/biomedicus/common/dictionary/ArrayStrings.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1158577"
},
{
"name": "Shell",
"bytes": "1548"
}
],
"symlink_target": ""
} |
package com.example.haotianzhu.noname;
import android.app.Activity;
import android.test.ActivityInstrumentationTestCase2;
import android.view.Display;
import com.robotium.solo.Solo;
import android.app.Activity;
import android.test.ActivityInstrumentationTestCase2;
import android.view.Display;
import android.widget.EditText;
import android.widget.ListView;
import com.robotium.solo.Solo;
public class AddHabitEventTest extends ActivityInstrumentationTestCase2<LoginActivity> {
private Solo solo;
public AddHabitEventTest() {
super(LoginActivity.class);
}
@Override
public void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
private void swipeToRight() {
Display display = solo.getCurrentActivity().getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
float xStart = 0;
float xEnd = width / 2;
solo.drag(xStart, xEnd, height / 2, height / 2, 1);
}
public void testStart() throws Exception {
Activity activity = getActivity();
}
public void testAdding() {
//Login begin
solo.assertCurrentActivity("Wrong Activity", LoginActivity.class);
solo.enterText((EditText) solo.getView(R.id.user_id), "1");
solo.clickOnButton("LOG IN");
//Todolist begin
solo.assertCurrentActivity("Wrong Activity", ToDoActivity.class);
swipeToRight();
solo.clickOnView(solo.getText("Event"));
solo.clickOnView(solo.getView(R.id.addEvent ));
//Add cancel
solo.clickOnView(solo.getView(R.id.cancel ));
solo.assertCurrentActivity("Wrong Activity",MainEventActivity.class);
//Add begin d
solo.clickOnView(solo.getView(R.id.addEvent ));
solo.assertCurrentActivity("Wrong Activity", AddEventActivity.class);
solo.enterText((EditText) solo.getView(R.id.eventTitle), "testTitle1");
solo.enterText((EditText) solo.getView(R.id.eventComment), "testComment1");
solo.clickOnView(solo.getView(R.id.habitType ));
solo.assertCurrentActivity("Wrong Activity",ChooseHabitTypeActivity.class);
solo.clickOnView(solo.getView(R.id.cancel ));
solo.assertCurrentActivity("Wrong Activity", AddEventActivity.class);
solo.clickOnView(solo.getView(R.id.habitType ));
solo.sleep(1000);
ChooseHabitTypeActivity activity = (ChooseHabitTypeActivity) solo.getCurrentActivity();
final ListView habitType = activity.getHabittype();
solo.clickInList(0);
solo.clickOnView(solo.getView(R.id.done ));
solo.assertCurrentActivity("Wrong Activity", AddEventActivity.class);
solo.clickOnView(solo.getView(R.id.done ));
solo.assertCurrentActivity("Wrong Activity",MainEventActivity.class);
}
}
| {
"content_hash": "1f9950d711b303b259163caabf7c2d3a",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 104,
"avg_line_length": 44.52,
"alnum_prop": 0.6019766397124887,
"repo_name": "CMPUT301F17T31/NoName",
"id": "6905303021344a2be027e68eed21ad11d151f2ed",
"size": "3339",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "NoName/app/src/androidTest/java/com/example/haotianzhu/noname/AddHabitEventTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "157765"
}
],
"symlink_target": ""
} |
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.psi;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyPolyVariantReference;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeArgumentList;
/**
* @author ven
*/
public interface GrReferenceElement<Q extends PsiElement> extends GroovyPsiElement, GroovyPolyVariantReference, GrQualifiedReference<Q> {
@Override
@Nullable
String getReferenceName();
@Nullable
String getQualifiedReferenceName();
@Nullable
@Override
default PsiElement resolve() {
return advancedResolve().getElement();
}
@NotNull
PsiType[] getTypeArguments();
@Nullable
GrTypeArgumentList getTypeArgumentList();
@NotNull
String getClassNameText();
}
| {
"content_hash": "8c4d0ff80f6af94fceb6bca245fd7f80",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 140,
"avg_line_length": 27.324324324324323,
"alnum_prop": 0.781404549950544,
"repo_name": "ThiagoGarciaAlves/intellij-community",
"id": "f8a1a5c518207b2f57f2ec894f5e95219e7a7e78",
"size": "1011",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/GrReferenceElement.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "20665"
},
{
"name": "AspectJ",
"bytes": "182"
},
{
"name": "Batchfile",
"bytes": "63518"
},
{
"name": "C",
"bytes": "214180"
},
{
"name": "C#",
"bytes": "1538"
},
{
"name": "C++",
"bytes": "190028"
},
{
"name": "CSS",
"bytes": "111474"
},
{
"name": "CoffeeScript",
"bytes": "1759"
},
{
"name": "Cucumber",
"bytes": "14382"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "FLUX",
"bytes": "57"
},
{
"name": "Groff",
"bytes": "35232"
},
{
"name": "Groovy",
"bytes": "2194261"
},
{
"name": "HTML",
"bytes": "1726130"
},
{
"name": "J",
"bytes": "5050"
},
{
"name": "Java",
"bytes": "148273590"
},
{
"name": "JavaScript",
"bytes": "125292"
},
{
"name": "Kotlin",
"bytes": "454154"
},
{
"name": "Lex",
"bytes": "166177"
},
{
"name": "Makefile",
"bytes": "2352"
},
{
"name": "NSIS",
"bytes": "85969"
},
{
"name": "Objective-C",
"bytes": "28634"
},
{
"name": "Perl6",
"bytes": "26"
},
{
"name": "Protocol Buffer",
"bytes": "6570"
},
{
"name": "Python",
"bytes": "21460459"
},
{
"name": "Ruby",
"bytes": "1213"
},
{
"name": "Scala",
"bytes": "11698"
},
{
"name": "Shell",
"bytes": "63190"
},
{
"name": "Smalltalk",
"bytes": "64"
},
{
"name": "TeX",
"bytes": "60798"
},
{
"name": "TypeScript",
"bytes": "6152"
},
{
"name": "XSLT",
"bytes": "113040"
}
],
"symlink_target": ""
} |
using JetBrains.Annotations;
namespace Pharmatechnik.Nav.Language;
sealed partial class ExitConnectionPointReferenceSymbol: Symbol, IExitConnectionPointReferenceSymbol {
// ReSharper disable once NotNullMemberIsNotInitialized ExitTransition wird definitiv im Ctor der ExitTransition gesetzt
public ExitConnectionPointReferenceSymbol(SyntaxTree syntaxTree, string name, [NotNull] Location location, IExitConnectionPointSymbol connectionPoint)
: base(name, location) {
SyntaxTree = syntaxTree;
Declaration = connectionPoint;
}
public override SyntaxTree SyntaxTree { get; }
public IExitConnectionPointSymbol Declaration { get; }
public IExitTransition ExitTransition { get; internal set; }
} | {
"content_hash": "bb471de8af0b381873b3eb294711b470",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 154,
"avg_line_length": 39.94736842105263,
"alnum_prop": 0.7707509881422925,
"repo_name": "IInspectable/Nav.Language.Extensions",
"id": "250783e75d967caac33e4cdd27d7a2422d6289f7",
"size": "759",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Nav.Language/SemanticModel/ExitConnectionPointReferenceSymbol.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ANTLR",
"bytes": "9305"
},
{
"name": "Batchfile",
"bytes": "1433"
},
{
"name": "C#",
"bytes": "1874397"
},
{
"name": "PowerShell",
"bytes": "5905"
},
{
"name": "Smalltalk",
"bytes": "3"
}
],
"symlink_target": ""
} |
module dojox.widget{
export class Loader extends dijit._Widget {
templateString : String;
templatePath : String;
widgetsInTemplate : bool;
_skipNodeCache : bool;
_earlyTemplatedStartup : bool;
_attachPoints : any;
_attachEvents : any[];
declaredClass : any;
_startupWidgets : Object;
_supportingWidgets : Object;
_templateCache : Object;
_stringRepl (tmpl:any) : any;
_fillContent (source:HTMLElement) : any;
_attachTemplateNodes (rootNode:HTMLElement,getAttrFunc?:Function) : any;
getCachedTemplate (templatePath:String,templateString?:String,alwaysUseString?:any) : any;
loadIcon : String;
loadMessage : String;
hasVisuals : bool;
attachToPointer : Object;
duration : number;
_offset : number;
_pointerConnect : Object;
_xhrStart : Object;
_xhrEnd : Object;
_setMessage (message:String) : any;
_putLoader (e:any) : any;
_show () : any;
_hide () : any;
}
}
| {
"content_hash": "b9169a826ed4ff6c1a5410d77fe51afa",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 90,
"avg_line_length": 26.8125,
"alnum_prop": 0.7482517482517482,
"repo_name": "stopyoukid/DojoToTypescriptConverter",
"id": "85d284b5faaf2a5dad8a804abc19e64727f6a6a7",
"size": "986",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "out/separate/dojox.widget.Loader.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "29092"
}
],
"symlink_target": ""
} |
<?php
namespace Zeeye\Util\Session\Adapter;
use Zeeye\Util\Session\SessionAdapterException;
/**
* Exceptions for the ApcSession class
*
* @author Nicolas Hervé <[email protected]>
* @license http://opensource.org/licenses/mit-license.php
*/
class ApcSessionException extends SessionAdapterException {} | {
"content_hash": "7215ece5d5d14bc7de08ec2e0c10d9f0",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 61,
"avg_line_length": 29.454545454545453,
"alnum_prop": 0.7376543209876543,
"repo_name": "nicolasherve/Zeeye",
"id": "10bbfbeb7ef525abdd4f0cf368f146b13c2fa7ba",
"size": "325",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Zeeye/Util/Session/Adapter/ApcSessionException.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "388868"
}
],
"symlink_target": ""
} |
import React from 'react'
import PropTypes from 'prop-types'
const Counter = (props) => {
const {
count, increment, decrement, asyncIncrement,
} = props
return (
<div>
<h2>This is a Counter!</h2>
<span>count: {count}</span>
<button onClick={increment}>PLUS</button>
<button onClick={decrement}>MINUS</button>
<button onClick={asyncIncrement}>ASYNC PLUS</button>
</div>
)
}
Counter.propTypes = {
count: PropTypes.number.isRequired,
increment: PropTypes.func.isRequired,
decrement: PropTypes.func.isRequired,
asyncIncrement: PropTypes.func.isRequired,
}
export default Counter
| {
"content_hash": "9b159608096ade21e13b16b5f3720b97",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 58,
"avg_line_length": 24.46153846153846,
"alnum_prop": 0.6823899371069182,
"repo_name": "erwaiyang/website-starter-kit",
"id": "ea77b0fdb82910177c114d5bf50e66f6abe58a47",
"size": "636",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/components/Counter.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "145"
},
{
"name": "HTML",
"bytes": "274"
},
{
"name": "JavaScript",
"bytes": "9797"
}
],
"symlink_target": ""
} |
package com.google.cloud.genomics.dataflow.pipelines;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.io.BufferedReader;
/**
* This integration test will read and write to Cloud Storage, and call the Genomics API.
*
* The following environment variables are required:
* - a Google Cloud API key in GOOGLE_API_KEY,
* - a Google Cloud project name in TEST_PROJECT,
* - a Cloud Storage folder path in TEST_OUTPUT_GCS_FOLDER to store temporary test outputs,
* - a Cloud Storage folder path in TEST_STAGING_GCS_FOLDER to store temporary files,
*
* Cloud Storage folder paths should be of the form "gs://bucket/folder/"
*
* When doing e.g. mvn install, you can skip integration tests using:
* mvn install -DskipITs
*
* To run one test:
* mvn -Dit.test=CountReadsITCase#testLocal verify
*
* See also http://maven.apache.org/surefire/maven-failsafe-plugin/examples/single-test.html
*/
@RunWith(JUnit4.class)
public class CountReadsITCase {
// This file shouldn't move.
static final String TEST_BAM_FNAME = "gs://genomics-public-data/ftp-trace.ncbi.nih.gov/1000genomes/ftp/pilot_data/data/NA06985/alignment/NA06985.454.MOSAIK.SRP000033.2009_11.bam";
// This is the Readgroupset ID of the same file, in ReadStore. It also shouldn't move.
static final String TEST_READGROUPSET = "CMvnhpKTFhDvp9zAvYj66AY";
// The region where we're counting reads.
static final String TEST_CONTIG = "1:550000:560000";
// How many reads are in that region.
static final long TEST_EXPECTED = 685;
// In this file there are no unmapped reads, so expecting the same number.
static final long TEST_EXPECTED_WITH_UNMAPPED = TEST_EXPECTED;
// Same as the above variables, but for the NA12877_S1 dataset.
static final String NA12877_S1_BAM_FILENAME = "gs://genomics-public-data/platinum-genomes/bam/NA12877_S1.bam";
static final String NA12877_S1_READGROUPSET = "CMvnhpKTFhD3he72j4KZuyc";
static final String NA12877_S1_CONTIG = "chr17:41196311:41277499";
static final long NA12877_S1_EXPECTED = 45081;
// How many reads are in that region if we take unmapped ones too
static final long NA12877_S1_EXPECTED_WITH_UNMAPPED = 45142;
static IntegrationTestHelper helper;
@BeforeClass
public static void setUpBeforeClass() {
helper = new IntegrationTestHelper();
}
private void testLocalBase(String outputFilename, String contig, String bamFilename, long expectedCount,
boolean includeUnmapped) throws Exception {
final String OUTPUT = helper.getTestOutputGcsFolder()+ outputFilename;
String[] ARGS = {
"--project=" + helper.getTestProject(),
"--output=" + OUTPUT,
"--references=" + contig,
"--includeUnmapped=" + includeUnmapped,
"--BAMFilePath=" + bamFilename,
};
try {
helper.touchOutput(OUTPUT);
CountReads.main(ARGS);
BufferedReader reader = helper.openOutput(OUTPUT);
long got = Long.parseLong(reader.readLine());
Assert.assertEquals(expectedCount, got);
} finally {
helper.deleteOutput(OUTPUT);
}
}
/**
* CountReads running on the client's machine.
*/
@Test
public void testLocal() throws Exception {
testLocalBase("CountReadsITCase-testLocal-output.txt",
TEST_CONTIG, TEST_BAM_FNAME, TEST_EXPECTED, false);
}
@Test
public void testLocalUnmapped() throws Exception {
testLocalBase("CountReadsITCase-testLocal-output.txt",
TEST_CONTIG, TEST_BAM_FNAME, TEST_EXPECTED_WITH_UNMAPPED, true);
}
@Test
public void testLocalNA12877_S1() throws Exception {
testLocalBase("CountReadsITCase-testLocal-NA12877_S1-output.txt",
NA12877_S1_CONTIG, NA12877_S1_BAM_FILENAME, NA12877_S1_EXPECTED, false);
}
@Test
public void testLocalNA12877_S1_UNMAPPED() throws Exception {
testLocalBase("CountReadsITCase-testLocal-NA12877_S1-output.txt",
NA12877_S1_CONTIG, NA12877_S1_BAM_FILENAME,
NA12877_S1_EXPECTED_WITH_UNMAPPED, true);
}
private void testCloudBase(String outputFilename, String contig, String bamFilename, long expectedCount) throws Exception {
final String OUTPUT = helper.getTestOutputGcsFolder() + outputFilename;
String[] ARGS = {
"--project=" + helper.getTestProject(),
"--output=" + OUTPUT,
"--numWorkers=2",
"--runner=DataflowRunner",
"--wait=true",
"--stagingLocation=" + helper.getTestStagingGcsFolder(),
"--references=" + contig,
"--BAMFilePath=" + bamFilename
};
try {
helper.touchOutput(OUTPUT);
CountReads.main(ARGS);
BufferedReader reader = helper.openOutput(OUTPUT);
long got = Long.parseLong(reader.readLine());
Assert.assertEquals(expectedCount, got);
} finally {
helper.deleteOutput(OUTPUT);
}
}
/**
* CountReads running on Dataflow.
*/
@Test
public void testCloud() throws Exception {
testCloudBase("CountReadsITCase-testCloud-output.txt",
TEST_CONTIG, TEST_BAM_FNAME, TEST_EXPECTED);
}
@Test
public void testCloudNA12877_S1() throws Exception {
testCloudBase("CountReadsITCase-testCloud-NA12877_S1-output.txt",
NA12877_S1_CONTIG, NA12877_S1_BAM_FILENAME, NA12877_S1_EXPECTED);
}
public void testCloudWithAPIBase(String outputFilename, String contig, String readGroupSetId, long expectedCount) throws Exception {
final String OUTPUT = helper.getTestOutputGcsFolder() + outputFilename;
String[] ARGS = {
"--project=" + helper.getTestProject(),
"--output=" + OUTPUT,
"--numWorkers=2",
"--runner=DataflowRunner",
"--wait=true",
"--stagingLocation=" + helper.getTestStagingGcsFolder(),
"--references=" + contig,
"--readGroupSetId=" + readGroupSetId
};
try {
helper.touchOutput(OUTPUT);
CountReads.main(ARGS);
BufferedReader reader = helper.openOutput(OUTPUT);
long got = Long.parseLong(reader.readLine());
Assert.assertEquals(expectedCount, got);
} finally {
helper.deleteOutput(OUTPUT);
}
}
/**
* CountReads running on Dataflow with API input.
*/
@Test
public void testCloudWithAPI() throws Exception {
testCloudWithAPIBase("CountReadsITCase-testCloudWithAPI-output.txt",
TEST_CONTIG, TEST_READGROUPSET, TEST_EXPECTED);
}
@Test
public void testCloudWithAPI_NA12877_S1() throws Exception {
testCloudWithAPIBase("CountReadsITCase-testCloudWithAPI-NA12877_S1-output.txt",
NA12877_S1_CONTIG, NA12877_S1_READGROUPSET, NA12877_S1_EXPECTED);
}
} | {
"content_hash": "713449b4a94f51271dbdae2ebe3b8215",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 181,
"avg_line_length": 33.994897959183675,
"alnum_prop": 0.6992345790184602,
"repo_name": "deflaux/dataflow-java",
"id": "abb011cad22527200a701514c7c0d26fce31746c",
"size": "7257",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/test/java/com/google/cloud/genomics/dataflow/pipelines/CountReadsITCase.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "533553"
},
{
"name": "R",
"bytes": "756"
},
{
"name": "Shell",
"bytes": "856"
}
],
"symlink_target": ""
} |
class MockExtensionInstallPromptDelegate
: public ExtensionInstallPrompt::Delegate {
public:
MockExtensionInstallPromptDelegate()
: proceed_count_(0),
abort_count_(0) {}
// ExtensionInstallPrompt::Delegate overrides.
virtual void InstallUIProceed() OVERRIDE;
virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
int proceed_count() { return proceed_count_; }
int abort_count() { return abort_count_; }
protected:
int proceed_count_;
int abort_count_;
};
void MockExtensionInstallPromptDelegate::InstallUIProceed() {
++proceed_count_;
}
void MockExtensionInstallPromptDelegate::InstallUIAbort(bool user_initiated) {
++abort_count_;
}
// This lets us construct the parent for the prompt we're constructing in our
// tests.
class MockExtensionInstallPrompt : public ExtensionInstallPrompt {
public:
explicit MockExtensionInstallPrompt(content::WebContents* web_contents)
: ExtensionInstallPrompt(web_contents), prompt_(NULL) {}
virtual ~MockExtensionInstallPrompt() {}
void set_prompt(ExtensionInstallPrompt::Prompt* prompt) {
prompt_ = prompt;
}
ExtensionInstallPrompt::Prompt* get_prompt() {
return prompt_;
}
private:
ExtensionInstallPrompt::Prompt* prompt_;
};
class ScrollbarTest : public ExtensionBrowserTest {
protected:
ScrollbarTest();
virtual ~ScrollbarTest() {}
virtual void SetUpOnMainThread() OVERRIDE;
void SetPromptPermissions(std::vector<base::string16> permissions);
void SetPromptDetails(std::vector<base::string16> details);
void SetPromptRetainedFiles(std::vector<base::FilePath> files);
bool IsScrollbarVisible();
private:
const extensions::Extension* extension_;
MockExtensionInstallPrompt* install_prompt_;
scoped_refptr<ExtensionInstallPrompt::Prompt> prompt_;
content::WebContents* web_contents_;
};
ScrollbarTest::ScrollbarTest() :
extension_(NULL),
install_prompt_(NULL),
prompt_(new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::PERMISSIONS_PROMPT)),
web_contents_(NULL) {}
void ScrollbarTest::SetUpOnMainThread() {
ExtensionBrowserTest::SetUpOnMainThread();
extension_ = ExtensionBrowserTest::LoadExtension(test_data_dir_.AppendASCII(
"install_prompt/permissions_scrollbar_regression"));
web_contents_ = browser()->tab_strip_model()->GetWebContentsAt(0);
install_prompt_ = new MockExtensionInstallPrompt(web_contents_);
install_prompt_->set_prompt(prompt_);
prompt_->set_experiment(ExtensionInstallPromptExperiment::ControlGroup());
prompt_->set_extension(extension_);
scoped_ptr<ExtensionIconManager> icon_manager(new ExtensionIconManager());
const SkBitmap icon_bitmap = icon_manager->GetIcon(extension_->id());
gfx::Image icon = gfx::Image::CreateFrom1xBitmap(icon_bitmap);
prompt_->set_icon(icon);
this->SetPromptPermissions(std::vector<base::string16>());
this->SetPromptDetails(std::vector<base::string16>());
this->SetPromptRetainedFiles(std::vector<base::FilePath>());
}
void ScrollbarTest::SetPromptPermissions(
std::vector<base::string16> permissions) {
prompt_->SetPermissions(permissions);
}
void ScrollbarTest::SetPromptDetails(
std::vector<base::string16> details) {
prompt_->SetPermissionsDetails(details);
}
void ScrollbarTest::SetPromptRetainedFiles(
std::vector<base::FilePath> files) {
prompt_->set_retained_files(files);
}
bool ScrollbarTest::IsScrollbarVisible() {
ExtensionInstallPrompt::ShowParams show_params(web_contents_);
MockExtensionInstallPromptDelegate delegate;
ExtensionInstallDialogView* dialog =
new ExtensionInstallDialogView(show_params.navigator, &delegate, prompt_);
// Create the modal view around the install dialog view.
views::Widget* modal =
CreateBrowserModalDialogViews(dialog, show_params.parent_window);
modal->Show();
content::BrowserThread::GetBlockingPool()->FlushForTesting();
base::RunLoop().RunUntilIdle();
// Check if the vertical scrollbar is visible.
return dialog->scroll_view()->vertical_scroll_bar()->visible();
}
// Tests that a scrollbar _is_ shown for an excessively long extension
// install prompt.
IN_PROC_BROWSER_TEST_F(ScrollbarTest, LongPromptScrollbar) {
base::string16 permission_string(base::ASCIIToUTF16("Test"));
std::vector<base::string16> permissions;
std::vector<base::string16> details;
for (int i = 0; i < 20; i++) {
permissions.push_back(permission_string);
details.push_back(base::string16());
}
this->SetPromptPermissions(permissions);
this->SetPromptDetails(details);
ASSERT_TRUE(IsScrollbarVisible()) << "Scrollbar is not visible";
}
// Tests that a scrollbar isn't shown for this regression case.
// See crbug.com/385570 for details.
IN_PROC_BROWSER_TEST_F(ScrollbarTest, ScrollbarRegression) {
base::string16 permission_string(base::ASCIIToUTF16(
"Read and modify your data on *.facebook.com"));
std::vector<base::string16> permissions;
permissions.push_back(permission_string);
this->SetPromptPermissions(permissions);
std::vector<base::string16> details;
details.push_back(base::string16());
this->SetPromptDetails(details);
ASSERT_FALSE(IsScrollbarVisible()) << "Scrollbar is visible";
}
| {
"content_hash": "805b1d69912527377a7140c94d3a715b",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 80,
"avg_line_length": 33.65584415584416,
"alnum_prop": 0.7476365039552383,
"repo_name": "bright-sparks/chromium-spacewalk",
"id": "2d5bf67a0a5acecea2cb48e01b1f679aabf57c69",
"size": "6474",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "chrome/browser/ui/views/extensions/extension_install_dialog_view_browsertest.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "35318"
},
{
"name": "Batchfile",
"bytes": "7621"
},
{
"name": "C",
"bytes": "8695871"
},
{
"name": "C++",
"bytes": "206827052"
},
{
"name": "CSS",
"bytes": "871444"
},
{
"name": "HTML",
"bytes": "24541148"
},
{
"name": "Java",
"bytes": "5463539"
},
{
"name": "JavaScript",
"bytes": "17790298"
},
{
"name": "Makefile",
"bytes": "92563"
},
{
"name": "Objective-C",
"bytes": "1140820"
},
{
"name": "Objective-C++",
"bytes": "7095881"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "PLpgSQL",
"bytes": "218379"
},
{
"name": "Perl",
"bytes": "69392"
},
{
"name": "Protocol Buffer",
"bytes": "387183"
},
{
"name": "Python",
"bytes": "6929545"
},
{
"name": "Shell",
"bytes": "473581"
},
{
"name": "Standard ML",
"bytes": "4131"
},
{
"name": "XSLT",
"bytes": "418"
},
{
"name": "nesC",
"bytes": "15206"
}
],
"symlink_target": ""
} |
import hammerhead from '../deps/hammerhead';
import * as domUtils from './dom';
import * as contentEditable from './content-editable';
import * as eventUtils from './event';
var browserUtils = hammerhead.utils.browser;
var selectionSandbox = hammerhead.eventSandbox.selection;
//NOTE: we can't determine selection direction in ie from dom api. Therefore we should listen selection changes,
// and calculate direction using it.
const BACKWARD_SELECTION_DIRECTION = 'backward';
const FORWARD_SELECTION_DIRECTION = 'forward';
const NONE_SELECTION_DIRECTION = 'none';
var selectionDirection = NONE_SELECTION_DIRECTION;
var initialLeft = 0;
var initialTop = 0;
var lastSelectionHeight = 0;
var lastSelectionLeft = 0;
var lastSelectionLength = 0;
var lastSelectionTop = 0;
function stateChanged (left, top, height, width, selectionLength) {
if (!selectionLength) {
initialLeft = left;
initialTop = top;
selectionDirection = NONE_SELECTION_DIRECTION;
}
else {
switch (selectionDirection) {
case NONE_SELECTION_DIRECTION:
if (top === lastSelectionTop && (left === lastSelectionLeft || height > lastSelectionHeight))
selectionDirection = FORWARD_SELECTION_DIRECTION;
else if (left < lastSelectionLeft || top < lastSelectionTop)
selectionDirection = BACKWARD_SELECTION_DIRECTION;
break;
case FORWARD_SELECTION_DIRECTION:
if (left === lastSelectionLeft && top === lastSelectionTop ||
left < lastSelectionLeft && height > lastSelectionHeight ||
top === lastSelectionTop && height === lastSelectionHeight &&
selectionLength > lastSelectionLength &&
left + width !== initialLeft)
break;
else if (left < lastSelectionLeft || top < lastSelectionTop)
selectionDirection = BACKWARD_SELECTION_DIRECTION;
break;
case BACKWARD_SELECTION_DIRECTION:
if ((left < lastSelectionLeft || top < lastSelectionTop) && selectionLength > lastSelectionLength)
break;
else if (top === initialTop && (left >= initialLeft || height > lastSelectionHeight))
selectionDirection = FORWARD_SELECTION_DIRECTION;
break;
}
}
lastSelectionHeight = height;
lastSelectionLeft = left;
lastSelectionLength = selectionLength;
lastSelectionTop = top;
}
function onSelectionChange () {
var activeElement = null;
var endSelection = null;
var range = null;
var rect = null;
var startSelection = null;
try {
if (this.selection)
range = this.selection.createRange();
else {
//HACK: we need do this for IE11 because otherwise we can not get TextRange properties
activeElement = this.activeElement;
if (!activeElement || !domUtils.isTextEditableElement(activeElement)) {
selectionDirection = NONE_SELECTION_DIRECTION;
return;
}
startSelection = getSelectionStart(activeElement);
endSelection = getSelectionEnd(activeElement);
if (activeElement.createTextRange) {
range = activeElement.createTextRange();
range.collapse(true);
range.moveStart('character', startSelection);
range.moveEnd('character', endSelection - startSelection);
}
else if (document.createRange) {
//NOTE: for MSEdge
range = document.createRange();
var textNode = activeElement.firstChild;
range.setStart(textNode, startSelection);
range.setEnd(textNode, endSelection);
rect = range.getBoundingClientRect();
}
}
}
catch (e) {
//NOTE: in ie it raises error when there are not a real selection
selectionDirection = NONE_SELECTION_DIRECTION;
return;
}
var rangeLeft = rect ? Math.ceil(rect.left) : range.offsetLeft;
var rangeTop = rect ? Math.ceil(rect.top) : range.offsetTop;
var rangeHeight = rect ? Math.ceil(rect.height) : range.boundingHeight;
var rangeWidth = rect ? Math.ceil(rect.width) : range.boundingWidth;
var rangeHTMLTextLength = range.htmlText ? range.htmlText.length : 0;
var rangeTextLength = rect ? range.toString().length : rangeHTMLTextLength;
stateChanged(rangeLeft, rangeTop, rangeHeight, rangeWidth, rangeTextLength);
}
if (browserUtils.isIE)
eventUtils.bind(document, 'selectionchange', onSelectionChange, true);
//utils for contentEditable
function selectContentEditable (el, from, to, needFocus) {
var endPosition = null;
var firstTextNodeChild = null;
var latestTextNodeChild = null;
var startPosition = null;
var temp = null;
var inverse = false;
if (typeof from !== 'undefined' && typeof to !== 'undefined' && from > to) {
temp = from;
from = to;
to = temp;
inverse = true;
}
if (typeof from === 'undefined') {
firstTextNodeChild = contentEditable.getFirstVisibleTextNode(el);
startPosition = {
node: firstTextNodeChild || el,
offset: firstTextNodeChild && firstTextNodeChild.nodeValue ?
contentEditable.getFirstNonWhitespaceSymbolIndex(firstTextNodeChild.nodeValue) : 0
};
}
if (typeof to === 'undefined') {
latestTextNodeChild = contentEditable.getLastTextNode(el, true);
endPosition = {
node: latestTextNodeChild || el,
offset: latestTextNodeChild && latestTextNodeChild.nodeValue ?
contentEditable.getLastNonWhitespaceSymbolIndex(latestTextNodeChild.nodeValue) : 0
};
}
startPosition = startPosition || contentEditable.calculateNodeAndOffsetByPosition(el, from);
endPosition = endPosition || contentEditable.calculateNodeAndOffsetByPosition(el, to);
if (!startPosition.node || !endPosition.node)
return;
if (inverse)
selectByNodesAndOffsets(endPosition, startPosition, needFocus);
else
selectByNodesAndOffsets(startPosition, endPosition, needFocus);
}
function correctContentEditableSelectionBeforeDelete (el) {
var selection = getSelectionByElement(el);
var startNode = selection.anchorNode;
var endNode = selection.focusNode;
var startOffset = selection.anchorOffset;
var endOffset = selection.focusOffset;
var startNodeFirstNonWhitespaceSymbol = contentEditable.getFirstNonWhitespaceSymbolIndex(startNode.nodeValue);
var startNodeLastNonWhitespaceSymbol = contentEditable.getLastNonWhitespaceSymbolIndex(startNode.nodeValue);
var endNodeFirstNonWhitespaceSymbol = contentEditable.getFirstNonWhitespaceSymbolIndex(endNode.nodeValue);
var endNodeLastNonWhitespaceSymbol = contentEditable.getLastNonWhitespaceSymbolIndex(endNode.nodeValue);
var newStartOffset = null;
var newEndOffset = null;
if (domUtils.isTextNode(startNode)) {
if (startOffset < startNodeFirstNonWhitespaceSymbol && startOffset !== 0)
newStartOffset = 0;
else if (startOffset !== startNode.nodeValue.length &&
(contentEditable.isInvisibleTextNode(startNode) && startOffset !== 0 ||
startOffset > startNodeLastNonWhitespaceSymbol))
newStartOffset = startNode.nodeValue.length;
}
if (domUtils.isTextNode(endNode)) {
if (endOffset < endNodeFirstNonWhitespaceSymbol && endOffset !== 0)
newEndOffset = 0;
else if (endOffset !== endNode.nodeValue.length &&
(contentEditable.isInvisibleTextNode(endNode) && endOffset !== 0 ||
endOffset > endNodeLastNonWhitespaceSymbol))
newEndOffset = endNode.nodeValue.length;
}
if (browserUtils.isWebKit || browserUtils.isIE && browserUtils.version > 11) {
if (newStartOffset !== null) {
if (newStartOffset === 0)
startNode.nodeValue = startNode.nodeValue.substring(startNodeFirstNonWhitespaceSymbol);
else
startNode.nodeValue = startNode.nodeValue.substring(0, startNodeLastNonWhitespaceSymbol);
}
if (newEndOffset !== null) {
if (newEndOffset === 0)
endNode.nodeValue = endNode.nodeValue.substring(endNodeFirstNonWhitespaceSymbol);
else
endNode.nodeValue = endNode.nodeValue.substring(0, endNodeLastNonWhitespaceSymbol);
}
}
if (newStartOffset !== null || newEndOffset !== null) {
if (newStartOffset !== null)
newStartOffset = newStartOffset === 0 ? newStartOffset : startNode.nodeValue.length;
else
newStartOffset = startOffset;
if (newEndOffset !== null)
newEndOffset = newEndOffset === 0 ? newEndOffset : endNode.nodeValue.length;
else
newEndOffset = endOffset;
var startPos = { node: startNode, offset: newStartOffset };
var endPos = { node: endNode, offset: newEndOffset };
selectByNodesAndOffsets(startPos, endPos);
}
}
//API
export function hasInverseSelectionContentEditable (el) {
var curDocument = el ? domUtils.findDocument(el) : document;
var selection = curDocument.getSelection();
var range = null;
var backward = false;
if (selection) {
if (!selection.isCollapsed) {
range = curDocument.createRange();
range.setStart(selection.anchorNode, selection.anchorOffset);
range.setEnd(selection.focusNode, selection.focusOffset);
backward = range.collapsed;
range.detach();
}
}
return backward;
}
export function isInverseSelectionContentEditable (element, startPos, endPos) {
var startPosition = contentEditable.calculatePositionByNodeAndOffset(element, startPos);
var endPosition = contentEditable.calculatePositionByNodeAndOffset(element, endPos);
return startPosition > endPosition;
}
export function getSelectionStart (el) {
var selection = null;
if (!domUtils.isContentEditableElement(el))
return selectionSandbox.getSelection(el).start;
if (hasElementContainsSelection(el)) {
selection = getSelectionByElement(el);
return contentEditable.getSelectionStartPosition(el, selection, hasInverseSelectionContentEditable(el));
}
return 0;
}
export function getSelectionEnd (el) {
var selection = null;
if (!domUtils.isContentEditableElement(el))
return selectionSandbox.getSelection(el).end;
if (hasElementContainsSelection(el)) {
selection = getSelectionByElement(el);
return contentEditable.getSelectionEndPosition(el, selection, hasInverseSelectionContentEditable(el));
}
return 0;
}
export function hasInverseSelection (el) {
if (domUtils.isContentEditableElement(el))
return hasInverseSelectionContentEditable(el);
return (selectionSandbox.getSelection(el).direction || selectionDirection) === BACKWARD_SELECTION_DIRECTION;
}
export function getSelectionByElement (el) {
var currentDocument = domUtils.findDocument(el);
return currentDocument ? currentDocument.getSelection() : window.getSelection();
}
export function select (el, from, to) {
if (domUtils.isContentEditableElement(el)) {
selectContentEditable(el, from, to, true);
return;
}
var start = from || 0;
var end = typeof to === 'undefined' ? el.value.length : to;
var inverse = false;
var temp = null;
if (start > end) {
temp = start;
start = end;
end = temp;
inverse = true;
}
selectionSandbox.setSelection(el, start, end, inverse ? BACKWARD_SELECTION_DIRECTION : FORWARD_SELECTION_DIRECTION);
if (from === to)
selectionDirection = NONE_SELECTION_DIRECTION;
else
selectionDirection = inverse ? BACKWARD_SELECTION_DIRECTION : FORWARD_SELECTION_DIRECTION;
}
export function selectByNodesAndOffsets (startPos, endPos, needFocus) {
var startNode = startPos.node;
var endNode = endPos.node;
var startNodeLength = startNode.nodeValue ? startNode.length : 0;
var endNodeLength = endNode.nodeValue ? endNode.length : 0;
var startOffset = Math.min(startNodeLength, startPos.offset);
var endOffset = Math.min(endNodeLength, endPos.offset);
var parentElement = contentEditable.findContentEditableParent(startNode);
var inverse = isInverseSelectionContentEditable(parentElement, startPos, endPos);
var selection = getSelectionByElement(parentElement);
var curDocument = domUtils.findDocument(parentElement);
var range = curDocument.createRange();
var selectionSetter = function () {
selection.removeAllRanges();
//NOTE: For IE we can't create inverse selection
if (!inverse) {
range.setStart(startNode, startOffset);
range.setEnd(endNode, endOffset);
selection.addRange(range);
}
else if (browserUtils.isIE) {
range.setStart(endNode, endOffset);
range.setEnd(startNode, startOffset);
selection.addRange(range);
}
else {
range.setStart(startNode, startOffset);
range.setEnd(startNode, startOffset);
selection.addRange(range);
if (browserUtils.isWebKit && contentEditable.isInvisibleTextNode(endNode)) {
try {
selection.extend(endNode, Math.min(endOffset, 1));
}
catch (err) {
selection.extend(endNode, 0);
}
}
else
selection.extend(endNode, endOffset);
}
};
selectionSandbox.wrapSetterSelection(parentElement, selectionSetter, needFocus, true);
}
function deleteSelectionRanges (el) {
var selection = getSelectionByElement(el);
var rangeCount = selection.rangeCount;
if (!rangeCount)
return;
for (var i = 0; i < rangeCount; i++)
selection.getRangeAt(i).deleteContents();
}
export function deleteSelectionContents (el, selectAll) {
var startSelection = getSelectionStart(el);
var endSelection = getSelectionEnd(el);
if (selectAll)
selectContentEditable(el);
if (startSelection === endSelection)
return;
// NOTE: If selection is not contain initial and final invisible symbols
//we should select its
correctContentEditableSelectionBeforeDelete(el);
deleteSelectionRanges(el);
var selection = getSelectionByElement(el);
var range = null;
//NOTE: We should try to do selection collapsed
if (selection.rangeCount && !selection.getRangeAt(0).collapsed) {
range = selection.getRangeAt(0);
range.collapse(true);
}
}
export function setCursorToLastVisiblePosition (el) {
var position = contentEditable.getLastVisiblePosition(el);
selectContentEditable(el, position, position);
}
export function hasElementContainsSelection (el) {
var selection = getSelectionByElement(el);
return selection.anchorNode && selection.focusNode ?
domUtils.isElementContainsNode(el, selection.anchorNode) &&
domUtils.isElementContainsNode(el, selection.focusNode) :
false;
}
| {
"content_hash": "e116426a5ff238c9df1f3b048d4b3889",
"timestamp": "",
"source": "github",
"line_count": 448,
"max_line_length": 120,
"avg_line_length": 35.294642857142854,
"alnum_prop": 0.6463445484442196,
"repo_name": "helen-dikareva/testcafe-phoenix",
"id": "74305d8af21f40233cfaa05a7effd159a5ac7c8e",
"size": "15812",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/client/core/utils/text-selection.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "12879"
},
{
"name": "HTML",
"bytes": "113954"
},
{
"name": "JavaScript",
"bytes": "1908190"
}
],
"symlink_target": ""
} |
package com.amazonaws.services.waf.model;
import java.io.Serializable;
/**
*
*/
public class GetChangeTokenResult implements Serializable, Cloneable {
/**
* <p>
* The <code>ChangeToken</code> that you used in the request. Use this value
* in a <code>GetChangeTokenStatus</code> request to get the current status
* of the request.
* </p>
*/
private String changeToken;
/**
* <p>
* The <code>ChangeToken</code> that you used in the request. Use this value
* in a <code>GetChangeTokenStatus</code> request to get the current status
* of the request.
* </p>
*
* @param changeToken
* The <code>ChangeToken</code> that you used in the request. Use
* this value in a <code>GetChangeTokenStatus</code> request to get
* the current status of the request.
*/
public void setChangeToken(String changeToken) {
this.changeToken = changeToken;
}
/**
* <p>
* The <code>ChangeToken</code> that you used in the request. Use this value
* in a <code>GetChangeTokenStatus</code> request to get the current status
* of the request.
* </p>
*
* @return The <code>ChangeToken</code> that you used in the request. Use
* this value in a <code>GetChangeTokenStatus</code> request to get
* the current status of the request.
*/
public String getChangeToken() {
return this.changeToken;
}
/**
* <p>
* The <code>ChangeToken</code> that you used in the request. Use this value
* in a <code>GetChangeTokenStatus</code> request to get the current status
* of the request.
* </p>
*
* @param changeToken
* The <code>ChangeToken</code> that you used in the request. Use
* this value in a <code>GetChangeTokenStatus</code> request to get
* the current status of the request.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public GetChangeTokenResult withChangeToken(String changeToken) {
setChangeToken(changeToken);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getChangeToken() != null)
sb.append("ChangeToken: " + getChangeToken());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GetChangeTokenResult == false)
return false;
GetChangeTokenResult other = (GetChangeTokenResult) obj;
if (other.getChangeToken() == null ^ this.getChangeToken() == null)
return false;
if (other.getChangeToken() != null
&& other.getChangeToken().equals(this.getChangeToken()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime
* hashCode
+ ((getChangeToken() == null) ? 0 : getChangeToken().hashCode());
return hashCode;
}
@Override
public GetChangeTokenResult clone() {
try {
return (GetChangeTokenResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}
| {
"content_hash": "97e4d8162509584b6be9b384188018b0",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 81,
"avg_line_length": 30.015267175572518,
"alnum_prop": 0.5859613428280773,
"repo_name": "dump247/aws-sdk-java",
"id": "9908af77920f78ee2f5f18e3395926cbca37aa85",
"size": "4519",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "aws-java-sdk-waf/src/main/java/com/amazonaws/services/waf/model/GetChangeTokenResult.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "FreeMarker",
"bytes": "117958"
},
{
"name": "Java",
"bytes": "104374753"
},
{
"name": "Scilab",
"bytes": "3375"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.grizzlytech</groupId>
<artifactId>protoxml</artifactId>
<version>1.0</version>
<!-- Output to jar format -->
<packaging>jar</packaging>
<properties>
<jdk.version>1.8</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.organization.name>grizzlytech.org</project.organization.name>
<project.inceptionYear>2017</project.inceptionYear>
<license.licenseName>mit</license.licenseName>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.24</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.24</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.12</version>
</dependency>
</dependencies>
<!-- See https://maven.apache.org/plugins/maven-compiler-plugin/plugins.html -->
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<!-- Set a JDK compiler level -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<compilerArgs>
<arg>-XDignore.symbol.file</arg>
</compilerArgs>
<fork>true</fork>
</configuration>
</plugin>
<!-- Make this jar executable -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<!-- Jar file entry point -->
<mainClass>org.grizzly.protoxml.main.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project> | {
"content_hash": "3c8c2c06baba2c4b2904e26454efa0e3",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 108,
"avg_line_length": 36.235955056179776,
"alnum_prop": 0.537984496124031,
"repo_name": "grizzly100/protoxml",
"id": "39de1ddf3a23ab941e11a06745c10ffbd3907659",
"size": "3225",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pom.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1017"
},
{
"name": "Java",
"bytes": "444386"
}
],
"symlink_target": ""
} |
pyfarm.agent.utility module
===========================
.. automodule:: pyfarm.agent.utility
:members:
:undoc-members:
:show-inheritance:
| {
"content_hash": "ec7a5cf31799643d64eb1c523e081165",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 36,
"avg_line_length": 21.571428571428573,
"alnum_prop": 0.5695364238410596,
"repo_name": "pyfarm/pyfarm-agent",
"id": "be714cc90b3416ee5ff9317dbfa6038325539927",
"size": "151",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/source/modules/pyfarm.agent.utility.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1842"
},
{
"name": "CSS",
"bytes": "728"
},
{
"name": "HTML",
"bytes": "10958"
},
{
"name": "Python",
"bytes": "698671"
},
{
"name": "Shell",
"bytes": "833"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!--
-->
<resources>
<!-- ### SLIDER ============================================================================ -->
<!-- Base style for SeekBar widget of ColorSliderLayout. -->
<style name="Dialog.Base.Widget.SeekBar.ColorSlider" parent="Ui.Widget.SeekBar">
<item name="android:paddingLeft">?attr/dialogSpacingTertiary</item>
<item name="android:paddingRight">?attr/dialogSpacingTertiary</item>
</style>
</resources> | {
"content_hash": "e574867d866472f4022dfcf44ddace4c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 100,
"avg_line_length": 35.142857142857146,
"alnum_prop": 0.5528455284552846,
"repo_name": "albedinsky/android_dialogs",
"id": "615cfb7b1f95b5a22234d5e66a4273e3df1c636e",
"size": "1602",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "library/src/picker/color/res/values/dialog_styles_base_color.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1283224"
}
],
"symlink_target": ""
} |
namespace YAF.Core
{
#region Using
using System.Collections.Generic;
using System.Linq;
using YAF.Types;
using YAF.Types.Interfaces;
#endregion
/// <summary>
/// The standard module manager.
/// </summary>
/// <typeparam name="TModule">
/// The module type based on IBaseModule.
/// </typeparam>
public class StandardModuleManager<TModule> : IModuleManager<TModule>
where TModule : IModuleDefinition
{
#region Constants and Fields
/// <summary>
/// The _modules.
/// </summary>
private readonly IList<TModule> _modules;
#endregion
#region Constructors and Destructors
/// <summary>
/// Initializes a new instance of the <see cref="StandardModuleManager{TModule}"/> class.
/// </summary>
/// <param name="modules">
/// The modules.
/// </param>
public StandardModuleManager([NotNull] IEnumerable<TModule> modules)
{
CodeContracts.VerifyNotNull(modules, "modules");
this._modules = modules.ToList();
}
#endregion
#region Implemented Interfaces
#region IModuleManager<TModule>
/// <summary>
/// Get all instances of modules available.
/// </summary>
/// <param name="getInactive">
/// The get Inactive.
/// </param>
/// <returns>
/// </returns>
public IEnumerable<TModule> GetAll(bool getInactive)
{
return !getInactive ? this._modules.Where(m => m.Active) : this._modules;
}
/// <summary>
/// Get an instance of a module (based on it's id).
/// </summary>
/// <param name="id">
/// The id.
/// </param>
/// <param name="getInactive">
/// The get Inactive.
/// </param>
/// <returns>
/// Instance of TModule or null if not found.
/// </returns>
public TModule GetBy([NotNull] string id, bool getInactive)
{
CodeContracts.VerifyNotNull(id, "id");
return !getInactive
? this._modules.SingleOrDefault(e => e.ModuleId.Equals(id) && e.Active)
: this._modules.SingleOrDefault(e => e.ModuleId.Equals(id));
}
/// <summary>
/// Get an instance of a module (based on it's id).
/// </summary>
/// <param name="id">
/// The id.
/// </param>
/// <returns>
/// Instance of TModule or null if not found.
/// </returns>
public TModule GetBy([NotNull] string id)
{
CodeContracts.VerifyNotNull(id, "id");
return this._modules.SingleOrDefault(e => e.ModuleId.Equals(id));
}
#endregion
#endregion
}
} | {
"content_hash": "ce6956a8e3bec772b42ef9a5dfd1816f",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 91,
"avg_line_length": 22.39252336448598,
"alnum_prop": 0.6318864774624374,
"repo_name": "unstab1e/sitecoreyaf8",
"id": "c2120ceef3251707b14ab6d8aed6b67eac769bc3",
"size": "3382",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "yafsrc/YAF.Core/BaseModules/StandardModuleManager.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "911712"
},
{
"name": "Batchfile",
"bytes": "3635"
},
{
"name": "C#",
"bytes": "9520407"
},
{
"name": "CSS",
"bytes": "1261085"
},
{
"name": "HTML",
"bytes": "3720"
},
{
"name": "JavaScript",
"bytes": "3674741"
},
{
"name": "SQLPL",
"bytes": "1474"
}
],
"symlink_target": ""
} |
<template name="postItem">
<div class="post">
<div class="post-content">
<h3><a href="{{url}}">{{title}}</a><span>{{domain}}</span></h3>
<p>
submitted by {{author}},
<a href="{{pathFor 'postPage'}}">{{commentsCount}} comments</a>
{{#if ownPost}}<a href="{{pathFor 'postEdit'}}">Edit</a>{{/if}}
</p>
</div>
<a href="{{pathFor 'postPage' }}" class="discuss btn btn-default">Discuss</a>
</div>
</template>
| {
"content_hash": "1a479781ccba51376e4ec651f436fcb1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 81,
"avg_line_length": 33.84615384615385,
"alnum_prop": 0.5613636363636364,
"repo_name": "codingquark/microscope",
"id": "f8ce8f6c5bf98b4cf4310f395442e4164ef010f3",
"size": "440",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "client/templates/posts/post_item.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3252"
},
{
"name": "HTML",
"bytes": "5764"
},
{
"name": "JavaScript",
"bytes": "11254"
}
],
"symlink_target": ""
} |
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document.predicate;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* @author <a href="mailto:[email protected]">Magnar Nedland</a>
*/
public class RangeEdgePartitionTest {
@Test
void requireThatRangeEdgePartitionIsAValue() {
assertTrue(PredicateValue.class.isAssignableFrom(RangeEdgePartition.class));
}
@Test
void requireThatConstructorsWork() {
RangeEdgePartition part = new RangeEdgePartition("foo=10", 10, 0, -1);
assertEquals("foo=10", part.getLabel());
assertEquals(0, part.getLowerBound());
assertEquals(-1, part.getUpperBound());
}
@Test
void requireThatCloneIsImplemented() throws CloneNotSupportedException {
RangeEdgePartition node1 = new RangeEdgePartition("foo=10", 10, 0, 0);
RangeEdgePartition node2 = node1.clone();
assertEquals(node1, node2);
assertNotSame(node1, node2);
}
@Test
void requireThatHashCodeIsImplemented() {
assertEquals(new RangeEdgePartition("foo=-10", 10, 2, 3).hashCode(),
new RangeEdgePartition("foo=-10", 10, 2, 3).hashCode());
}
@Test
void requireThatEqualsIsImplemented() {
RangeEdgePartition lhs = new RangeEdgePartition("foo=10", 10, 5, 10);
assertEquals(lhs, lhs);
assertNotEquals(lhs, new Object());
RangeEdgePartition rhs = new RangeEdgePartition("foo=20", 20, 0, 0);
assertNotEquals(lhs, rhs);
rhs = new RangeEdgePartition("foo=10", 10, 5, 10);
assertEquals(lhs, rhs);
assertNotEquals(lhs, new RangeEdgePartition("foo=10", 10, 5, 11));
assertNotEquals(lhs, new RangeEdgePartition("foo=10", 10, 6, 10));
assertNotEquals(lhs, new RangeEdgePartition("foo=10", 11, 5, 10));
assertNotEquals(lhs, new RangeEdgePartition("foo=11", 10, 5, 10));
}
@Test
void requireThatKeyIsEscapedInToString() {
assertEquals("foo=10+[2..3]", new RangeEdgePartition("foo=10", 10, 2, 3).toString());
assertEquals("'\\foo=10'+[2..3]", new RangeEdgePartition("\foo=10", 10, 2, 3).toString());
assertEquals("'\\x27foo\\x27=10'+[2..3]", new RangeEdgePartition("'foo'=10", 10, 2, 3).toString());
}}
| {
"content_hash": "744ea2649bf790c26f1516787fa9ae54",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 107,
"avg_line_length": 38.91803278688525,
"alnum_prop": 0.6541701769165965,
"repo_name": "vespa-engine/vespa",
"id": "00a25e4dc49dda6cc61cd03365bac2e1d3a6d054",
"size": "2374",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "predicate-search-core/src/test/java/com/yahoo/document/predicate/RangeEdgePartitionTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "8130"
},
{
"name": "C",
"bytes": "60315"
},
{
"name": "C++",
"bytes": "29580035"
},
{
"name": "CMake",
"bytes": "593981"
},
{
"name": "Emacs Lisp",
"bytes": "91"
},
{
"name": "GAP",
"bytes": "3312"
},
{
"name": "Go",
"bytes": "560664"
},
{
"name": "HTML",
"bytes": "54520"
},
{
"name": "Java",
"bytes": "40814190"
},
{
"name": "JavaScript",
"bytes": "73436"
},
{
"name": "LLVM",
"bytes": "6152"
},
{
"name": "Lex",
"bytes": "11499"
},
{
"name": "Makefile",
"bytes": "5553"
},
{
"name": "Objective-C",
"bytes": "12369"
},
{
"name": "Perl",
"bytes": "23134"
},
{
"name": "Python",
"bytes": "52392"
},
{
"name": "Roff",
"bytes": "17506"
},
{
"name": "Ruby",
"bytes": "10690"
},
{
"name": "Shell",
"bytes": "268737"
},
{
"name": "Yacc",
"bytes": "14735"
}
],
"symlink_target": ""
} |
/* */
"use strict";
var not_1 = require('../util/not');
var filter_1 = require('./filter');
function partition(predicate, thisArg) {
return [filter_1.filter.call(this, predicate, thisArg), filter_1.filter.call(this, not_1.not(predicate, thisArg))];
}
exports.partition = partition;
| {
"content_hash": "04318e3166ec4f49e3626f4e67d6107f",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 117,
"avg_line_length": 35.625,
"alnum_prop": 0.6947368421052632,
"repo_name": "poste9/crud",
"id": "96ff9a191f7c1aa1179d2b1ae3bf5c3bb97c61cd",
"size": "285",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "deps/npm/[email protected]/operator/partition.js",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "27882"
},
{
"name": "HTML",
"bytes": "4272"
},
{
"name": "JavaScript",
"bytes": "63509"
},
{
"name": "TypeScript",
"bytes": "23792"
}
],
"symlink_target": ""
} |
<?php
namespace Neurologia\UserBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/hello/Fabien');
$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
}
}
| {
"content_hash": "24c36e4a338aa717b9cca6958a48a65a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 90,
"avg_line_length": 23.764705882352942,
"alnum_prop": 0.6782178217821783,
"repo_name": "jnllerenas/Servicio-de-Neurologia---TTPS",
"id": "0ece13732f4ad2d9cbe2779eec5e097747659af1",
"size": "404",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Neurologia/UserBundle/Tests/Controller/DefaultControllerTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3073"
},
{
"name": "Batchfile",
"bytes": "188"
},
{
"name": "CSS",
"bytes": "662298"
},
{
"name": "HTML",
"bytes": "192002"
},
{
"name": "JavaScript",
"bytes": "283424"
},
{
"name": "PHP",
"bytes": "388655"
},
{
"name": "Shell",
"bytes": "1643"
}
],
"symlink_target": ""
} |
import math
from collections import defaultdict
from olymap.utilities import get_oid, get_name, get_subkind, to_oid, loop_here2, get_ship_damage
from olypy.db import loop_here
from olymap.utilities import calc_ship_pct_loaded
from olymap.storm import build_basic_storm_dict
from olymap.char import build_basic_char_dict
def get_complete(v):
effort_given = int(v.get('SL', {}).get('eg', [0])[0])
effort_required = int(v.get('SL', {}).get('er', [0])[0])
if effort_required > 0:
complete = (effort_given / effort_required) * 100
elif effort_required == 0 and effort_given == 0:
complete = 100
else:
complete = 0
return complete
def get_load(k, v, data):
return calc_ship_pct_loaded(data, k, v)
def get_defense(v):
return v.get('SL', {}).get('de', [0])
def build_loc_dict(v, data):
loc_id = v['LI']['wh'][0]
loc_rec = data[loc_id]
loc_dict = {'id': loc_id,
'oid': get_oid(loc_id),
'name': get_name(loc_rec),
'subkind': get_subkind(loc_rec, data)}
return loc_dict
def get_owner(v):
owner_id = v.get('LI', {}).get('hl', [None])[0]
if owner_id is not None:
return owner_id
return None
def build_owner_dict(v, data):
if get_owner(v) is not None:
owner_id = get_owner(v)
owner_rec = data[owner_id]
owner_dict = {'id': owner_id,
'oid': get_oid(owner_id),
'name': get_name(owner_rec)}
else:
owner_dict = None
return owner_dict
def get_bound_storm(v):
return v.get('SL', {}).get('bs', [None])[0]
def build_storm_dict(v, data):
if get_bound_storm(v) is not None:
storm_id = get_bound_storm(v)
storm_rec = data[storm_id]
storm_dict = build_basic_storm_dict(storm_id, storm_rec, data)
else:
storm_dict = None
return storm_dict
def build_seenhere_dict(k, v, data, instance, pledge_chain, prisoner_chain):
stack_list = []
stack_list = loop_here2(data, k)
# print (stack_list)
seen_here = []
# here_list = v.get('LI', {}).get('hl', [None])
if len(stack_list) > 0:
for characters in stack_list:
char_rec = data[characters[0]]
seen_entry = build_basic_char_dict(characters[0], char_rec, data, True)
seen_entry.update({'level': characters[1]})
seen_here.append(seen_entry)
return seen_here
def build_non_prominent_items_dict(k, v, data):
npi_list = []
seen_here_list = loop_here(data, k, False, True)
list_length = len(seen_here_list)
if list_length > 1:
for un in seen_here_list:
unit_rec = data[un]
if 'il' in unit_rec:
item_list = unit_rec['il']
for items in range(0, len(item_list), 2):
item_rec = data[item_list[items]]
if 'IT' in item_rec and 'pr' in item_rec['IT'] and item_rec['IT']['pr'][0] == '1':
pass
else:
if int(item_list[items + 1]) > 0:
weight = 0
qty = int(item_list[items + 1])
if 'wt' in item_rec['IT']:
weight = int(item_rec['IT']['wt'][0])
total_weight = int(qty * weight)
if total_weight > 0:
npi_entry = {'possessor_oid': to_oid(un),
'possessor_name': unit_rec['na'][0],
'item_oid': to_oid(item_list[items]),
'item_name': item_rec['na'][0],
'qty': qty,
'weight': total_weight}
npi_list.append(npi_entry)
return npi_list
def build_basic_ship_dict(k, v, data):
ship_dict = {'oid': get_oid(k),
'name': get_name(v),
'subkind': get_subkind(v, data),
'kind': 'ship',
'complete': get_complete(v),
'load': get_load(k, v, data),
'defense': get_defense(v)[0],
'damage': get_ship_damage(v),
'owner': build_owner_dict(v, data),
'storm': build_storm_dict(v, data),
'loc': build_loc_dict(v, data)}
return ship_dict
def build_complete_ship_dict(k, v, data, instance, pledge_chain, prisoner_chain):
ship_dict = {'oid': get_oid(k),
'name': get_name(v),
'subkind': get_subkind(v, data),
'kind': 'kind',
'complete': get_complete(v),
'load': get_load(k, v, data),
'defense': get_defense(v)[0],
'damage': get_ship_damage(v),
'owner': build_owner_dict(v, data),
'storm': build_storm_dict(v, data),
'seen_here': build_seenhere_dict(k, v, data, instance, pledge_chain, prisoner_chain),
'non_prominent_items': build_non_prominent_items_dict(k, v, data),
'loc': build_loc_dict(v, data)}
return ship_dict
| {
"content_hash": "54dda084964c49525c8e20bb58fe3a5a",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 102,
"avg_line_length": 35.630872483221474,
"alnum_prop": 0.4925598041062347,
"repo_name": "olympiag3/olypy",
"id": "7a5d33e37b83803e86f99f09330935b477f10b87",
"size": "5327",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "olymap/ship.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "776"
},
{
"name": "HTML",
"bytes": "75745"
},
{
"name": "JavaScript",
"bytes": "17372"
},
{
"name": "Makefile",
"bytes": "2045"
},
{
"name": "Python",
"bytes": "486509"
},
{
"name": "Shell",
"bytes": "1630"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Mirrored from medialoot.com/preview/piccolo/features.htm by HTTrack Website Copier/3.x [XR&CO'2014], Sun, 23 Nov 2014 11:48:29 GMT -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Piccolo Theme</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- CSS
================================================== -->
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/bootstrap-responsive.css">
<link rel="stylesheet" href="css/flexslider.css" />
<link rel="stylesheet" href="css/custom-styles.css">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<link rel="stylesheet" href="css/style-ie.css"/>
<![endif]-->
<!-- Favicons
================================================== -->
<link rel="shortcut icon" href="img/favicon.ico">
<link rel="apple-touch-icon" href="img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/apple-touch-icon-114x114.png">
<!-- JS
================================================== -->
<script src="../../../code.jquery.com/jquery-latest.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/jquery.flexslider.js"></script>
<script src="js/jquery.custom.js"></script>
<script type="text/javascript">
$(window).load(function(){
$('.flexslider').flexslider({
animation: "slide",
slideshow: true,
start: function(slider){
$('body').removeClass('loading');
}
});
});
</script>
</head>
<body>
<div class="color-bar-1"></div>
<div class="color-bar-2 color-bg"></div>
<div class="container main-container">
<div class="row header"><!-- Begin Header -->
<!-- Logo
================================================== -->
<div class="span5 logo">
<a href="index.html"><img src="img/piccolo-logo.png" alt="" /></a>
<h5>Big Things... Small Packages</h5>
</div>
<!-- Main Navigation
================================================== -->
<div class="span7 navigation">
<div class="navbar hidden-phone">
<ul class="nav">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="index.html">Home <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="index.html">Full Page</a></li>
<li><a href="index-gallery.html">Gallery Only</a></li>
<li><a href="index-slider.html">Slider Only</a></li>
</ul>
</li>
<li class="active"><a href="features.html">Features</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="page-full-width.html">Pages <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="page-full-width.html">Full Width</a></li>
<li><a href="page-right-sidebar.html">Right Sidebar</a></li>
<li><a href="page-left-sidebar.html">Left Sidebar</a></li>
<li><a href="page-double-sidebar.html">Double Sidebar</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="gallery-4col.html">Gallery <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="gallery-3col.html">Gallery 3 Column</a></li>
<li><a href="gallery-4col.html">Gallery 4 Column</a></li>
<li><a href="gallery-6col.html">Gallery 6 Column</a></li>
<li><a href="gallery-4col-circle.html">Gallery 4 Round</a></li>
<li><a href="gallery-single.html">Gallery Single</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="blog-style1.html">Blog <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="blog-style1.html">Blog Style 1</a></li>
<li><a href="blog-style2.html">Blog Style 2</a></li>
<li><a href="blog-style3.html">Blog Style 3</a></li>
<li><a href="blog-style4.html">Blog Style 4</a></li>
<li><a href="blog-single.html">Blog Single</a></li>
</ul>
</li>
<li><a href="page-contact.html">Contact</a></li>
</ul>
</div>
<!-- Mobile Nav
================================================== -->
<form action="#" id="mobile-nav" class="visible-phone">
<div class="mobile-nav-select">
<select onchange="window.open(this.options[this.selectedIndex].value,'_top')">
<option value="">Navigate...</option>
<option value="index.html">Home</option>
<option value="index.html">- Full Page</option>
<option value="index-gallery.html">- Gallery Only</option>
<option value="index-slider.html">- Slider Only</option>
<option value="features.html">Features</option>
<option value="page-full-width.html">Pages</option>
<option value="page-full-width.html">- Full Width</option>
<option value="page-right-sidebar.html">- Right Sidebar</option>
<option value="page-left-sidebar.html">- Left Sidebar</option>
<option value="page-double-sidebar.html">- Double Sidebar</option>
<option value="gallery-4col.html">Gallery</option>
<option value="gallery-3col.html">- 3 Column</option>
<option value="gallery-4col.html">- 4 Column</option>
<option value="gallery-6col.html">- 6 Column</option>
<option value="gallery-4col-circle.html">- Gallery 4 Col Round</option>
<option value="gallery-single.html">- Gallery Single</option>
<option value="blog-style1.html">Blog</option>
<option value="blog-style1.html">- Blog Style 1</option>
<option value="blog-style2.html">- Blog Style 2</option>
<option value="blog-style3.html">- Blog Style 3</option>
<option value="blog-style4.html">- Blog Style 4</option>
<option value="blog-single.html">- Blog Single</option>
<option value="page-contact.html">Contact</option>
</select>
</div>
</form>
</div>
</div><!-- End Header -->
<!-- Page Content
================================================== -->
<!-- Title Header -->
<div class="row">
<div class="span12">
<h2>Examples of CSS Elements and jQuery Components</h2>
<p class="lead">Piccolo is a minimal style theme built using Bootstrap. Bootstrap is a sleek, intuitive, and powerful front-end framework for faster and easier web development. Below are some examples of CSS and typography elements available within Piccolo. For more on Bootstrap, check out <a href="http://twitter.github.com/bootstrap/index.html" target="_blank">the official site</a>.</p>
</div>
<div class="span4">
<h5>3 Column Layout</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla iaculis mattis lorem, quis gravida nunc iaculis ac. Proin tristique tellus in est vulputate luctus fermentum ipsum molestie. Vivamus tincidunt sem eu magna varius elementum. Maecenas felis tellus, fermentum vitae laoreet vitae, volutpat et urna. Nulla faucibus ligula eget ante varius ac euismod odio placerat. Nam sit amet felis non lorem faucibus rhoncus vitae id dui.</p>
</div>
<div class="span4">
<h5>3 Column Layout</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla iaculis mattis lorem, quis gravida nunc iaculis ac. Proin tristique tellus in est vulputate luctus fermentum ipsum molestie. Vivamus tincidunt sem eu magna varius elementum. Maecenas felis tellus, fermentum vitae laoreet vitae, volutpat et urna. Nulla faucibus ligula eget ante varius ac euismod odio placerat. Nam sit amet felis non lorem faucibus rhoncus vitae id dui.</p>
</div>
<div class="span4">
<h5>3 Column Layout</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla iaculis mattis lorem, quis gravida nunc iaculis ac. Proin tristique tellus in est vulputate luctus fermentum ipsum molestie. Vivamus tincidunt sem eu magna varius elementum. Maecenas felis tellus, fermentum vitae laoreet vitae, volutpat et urna. Nulla faucibus ligula eget ante varius ac euismod odio placerat. Nam sit amet felis non lorem faucibus rhoncus vitae id dui.</p>
</div>
<div class="span3">
<h5>4 Column Layout</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla iaculis mattis lorem, quis gravida nunc iaculis ac. Proin tristique tellus in est vulputate luctus fermentum ipsum molestie. Vivamus tincidunt sem eu magna varius elementum. Maecenas felis tellus, fermentum vitae laoreet vitae, volutpat et urna. Nulla faucibus ligula eget ante varius ac euismod odio placerat. Nam sit amet felis non lorem faucibus rhoncus vitae id dui.</p>
</div>
<div class="span3">
<h5>4 Column Layout</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla iaculis mattis lorem, quis gravida nunc iaculis ac. Proin tristique tellus in est vulputate luctus fermentum ipsum molestie. Vivamus tincidunt sem eu magna varius elementum. Maecenas felis tellus, fermentum vitae laoreet vitae, volutpat et urna. Nulla faucibus ligula eget ante varius ac euismod odio placerat. Nam sit amet felis non lorem faucibus rhoncus vitae id dui.</p>
</div>
<div class="span3">
<h5>4 Column Layout</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla iaculis mattis lorem, quis gravida nunc iaculis ac. Proin tristique tellus in est vulputate luctus fermentum ipsum molestie. Vivamus tincidunt sem eu magna varius elementum. Maecenas felis tellus, fermentum vitae laoreet vitae, volutpat et urna. Nulla faucibus ligula eget ante varius ac euismod odio placerat. Nam sit amet felis non lorem faucibus rhoncus vitae id dui.</p>
</div>
<div class="span3">
<h5>4 Column Layout</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla iaculis mattis lorem, quis gravida nunc iaculis ac. Proin tristique tellus in est vulputate luctus fermentum ipsum molestie. Vivamus tincidunt sem eu magna varius elementum. Maecenas felis tellus, fermentum vitae laoreet vitae, volutpat et urna. Nulla faucibus ligula eget ante varius ac euismod odio placerat. Nam sit amet felis non lorem faucibus rhoncus vitae id dui.</p>
</div>
</div>
<!-- Grid Example
================================================== -->
<div class="row">
<div class="span12"><h6 class="title-bg">12 Column:<small> Responsive Grid Layout</small></h6>
The responsive Bootstrap grid system utilizes 12 columns. The grid adapts to be 724px and 1170px wide depending on your viewport. Below 767px viewports, the columns become fluid and stack vertically.</div>
</div>
<div class="row the-grid">
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
</div>
<div class="row the-grid">
<div class="span4">4</div>
<div class="span4">4</div>
<div class="span4">4</div>
</div>
<div class="row the-grid">
<div class="span4">4</div>
<div class="span8">8</div>
</div>
<div class="row the-grid">
<div class="span6">6</div>
<div class="span6">6</div>
</div>
<div class="row the-grid">
<div class="span12">12</div>
</div>
<!-- Typography
================================================== -->
<div class="row no-margin">
<div class="span6"><h6 class="title-bg">Typography: <small>Headings and Dividers</small></h6></div>
<div class="span6"><h6 class="title-bg">Lead Copy: <small>Start a page in style</small></h6></div>
</div>
<div class="row">
<div class="span3">
<h1 class="title-bg">h1. Heading 1</h1>
<h2 class="title-bg">h2. Heading 2</h2>
<h3 class="title-bg">h3. Heading 3</h3>
<h4 class="title-bg">h4. Heading 4</h4>
<h5 class="title-bg">h5. Heading 5</h5>
<h6 class="title-bg">h6. Heading 6</h6>
</div>
<div class="span3">
<h1>h1. Heading 1</h1>
<h2>h2. Heading 2</h2>
<h3>h3. Heading 3</h3>
<h4>h4. Heading 4</h4>
<h5>h5. Heading 5</h5>
<h6>h6. Heading 6</h6>
</div>
<div class="span6">
<p class="lead">
Lead body copy. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus. Cras rutrum, massa non blandit convallis, est lacus gravida enim, eu fermentum ligula orci et tortor. In sit amet nisl ac leo pulvinar molestie. Morbi blandit ultricies ultrices. Vivamus nec lectus sed orci molestie molestie.
</p>
<p>
Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus. Cras rutrum, massa non blandit convallis, est lacus gravida enim, eu fermentum ligula orci et tortor. In sit amet nisl ac leo pulvinar molestie. Morbi blandit ultricies ultrices. Vivamus nec lectus sed orci molestie molestie. Etiam mattis neque eu orci rutrum aliquam.
</p>
<p class="well">In sit amet nisl ac leo pulvinar molestie. Morbi blandit ultricies ultrices. Vivamus nec lectus sed orci molestie molestie. Etiam mattis neque eu orci rutrum aliquam.</p>
<p><button class="btn btn-inverse" type="button">Read more</button></p>
</div>
</div>
<!-- Carousel
================================================== -->
<div class="row">
<div class="span6">
<h6 class="title-bg">Carousel: <small>Add a Slideshow to Any Page</small></h6>
<div class="flexslider">
<ul class="slides">
<li><a href="gallery-single.html"><img src="img/gallery/slider-img-1.jpg" alt="slider" /></a></li>
<li><a href="gallery-single.html"><img src="img/gallery/slider-img-1.jpg" alt="slider" /></a></li>
<li><a href="gallery-single.html"><img src="img/gallery/slider-img-1.jpg" alt="slider" /></a></li>
<li><a href="gallery-single.html"><img src="img/gallery/slider-img-1.jpg" alt="slider" /></a></li>
<li><a href="gallery-single.html"><img src="img/gallery/slider-img-1.jpg" alt="slider" /></a></li>
</ul>
</div>
</div>
<!-- Thumbnail Grid
================================================== -->
<div class="span6">
<h6 class="title-bg">Thumbnails: <small>Easily create a grid of thumbnails</small></h6>
<ul class="thumbnails">
<li class="span3"><img src="img/gallery/thumbnail-270x300.jpg" alt="Thumbnail" class="thumbnail" /></li>
<li class="span3"><img src="img/gallery/thumbnail-270x130.jpg" alt="Thumbnail" class="thumbnail" /></li>
<li class="span3"><img src="img/gallery/thumbnail-270x130.jpg" alt="Thumbnail" class="thumbnail" /></li>
</ul>
</div>
</div>
<!-- Accordian (Collapse)
================================================== -->
<div class="row">
<div class="span6">
<h6 class="title-bg">Accordian: <small>Allows for Collapsed Content</small></h6>
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1
</a>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
Collapsible Group Item #2
</a>
</div>
<div id="collapseTwo" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseThree">
Collapsible Group Item #3
</a>
</div>
<div id="collapseThree" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
</div>
<!-- Tabs
================================================== -->
<div class="span6">
<h6 class="title-bg">Tabs: <small>Allows for Tabbed Content</small></h6>
<ul class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
<li><a href="#profile" data-toggle="tab">Profile</a></li>
<li><a href="#messages" data-toggle="tab">Messages</a></li>
<li><a href="#settings" data-toggle="tab">Settings</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="home">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
<div class="tab-pane" id="profile">
Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
<div class="tab-pane" id="messages">
Enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo.
</div>
<div class="tab-pane" id="settings">
Cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et.
</div>
</div>
</div>
</div>
<!-- Modal
================================================== -->
<div class="row">
<div class="span4">
<h6 class="title-bg">Modal: <small>Click below for an example</small></h6>
<div class="well">
<a href="#myModal" role="button" class="btn btn-inverse" data-toggle="modal">Example Modal Window</a>
</div>
</div>
<!-- Modal -->
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h5 id="myModalLabel">Modal header</h5>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-inverse">Save changes</button>
</div>
</div>
<!-- Tooltip
================================================== -->
<div class="span4">
<h6 class="title-bg">Tooltip: <small>Hover below for an example</small></h6>
<div class="well">
Tight pants next level <a href="#" rel="tooltip" title="default tooltip">keffiyeh</a> you probably haven't heard of them. Photo booth beard raw denim letterpress.
</div>
</div>
<!-- Popover
================================================== -->
<div class="span4">
<h6 class="title-bg">Popover: <small>Hover below for an example</small></h6>
<div class="well">
<a href="#" class="btn btn btn-inverse" rel="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?" data-animation="true">Hover to Toggle Popover</a>
</div>
</div>
</div>
<!-- Form Elements
================================================== -->
<div class="row form-examples">
<div class="span12">
<h6 class="title-bg">Form Elements: <small>Extending form controls</small></h6>
</div>
<div class="span4">
<div class="input-prepend">
<span class="add-on">@</span><input class="span2" id="prependedInput" size="16" type="text" placeholder="Username">
</div>
<div class="input-prepend input-append">
<span class="add-on">$</span><input class="span2" id="appendedPrependedInput" size="16" type="text"><span class="add-on">.00</span>
</div>
</div>
<div class="span4">
<div class="input-append">
<input class="span2" id="appendedInputButton" size="16" type="text"><button class="btn" type="button">Go!</button>
</div>
<div class="input-append">
<input class="span2" id="appendedInputButtons" size="16" type="text"><button class="btn" type="button">Search</button><button class="btn" type="button">Options</button>
</div>
</div>
<div class="span4">
<form class="form-search">
<div class="input-append">
<input type="text" class="span2 search-query">
<button type="submit" class="btn">Search</button>
</div>
<div class="input-prepend">
<button type="submit" class="btn">Search</button>
<input type="text" class="span2 search-query">
</div>
</form>
</div>
</div>
<!-- Buttons
================================================== -->
<div class="row">
<div class="span4">
<h6 class="title-bg">Buttons: <small>Small, Medium and Large</small></h6>
<h6>Large Button</h6>
<p><button class="btn btn-large" type="button">Default</button>
<button class="btn btn-large btn-warning" type="button">Info</button>
<button class="btn btn-large btn-inverse" type="button">Inverse</button></p>
<h6>Default Button</h6>
<p><button class="btn" type="button">Default</button>
<button class="btn btn-warning" type="button">Info</button>
<button class="btn btn-inverse" type="button">Inverse</button></p>
<h6>Small Button</h6>
<p><button class="btn btn-small" type="button">Default</button>
<button class="btn btn-small btn-warning" type="button">Info</button>
<button class="btn btn-small btn-inverse" type="button">Inverse</button></p>
<h6>Mini Button</h6>
<p><button class="btn btn-mini" type="button">Default</button>
<button class="btn btn-mini btn-warning" type="button">Info</button>
<button class="btn btn-mini btn-inverse" type="button">Inverse</button></p>
</div>
<!-- Alerts
================================================== -->
<div class="span4">
<h6 class="title-bg">Alerts: <small>Provide user feedback</small></h6>
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Oh snap!</strong> Change a few things and try again.
</div>
<div class="alert alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Warning!</strong> Best check yo self, you're not...
</div>
<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Well done!</strong> You successfully read this alert message.
</div>
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Heads up!</strong> This alert is not super important.
</div>
</div>
<!-- Progress Bars
================================================== -->
<div class="span4">
<h6 class="title-bg">Progress Bars: <small>Keep track</small></h6>
<div class="progress progress-info progress-striped">
<div class="bar" style="width: 20%"></div>
</div>
<div class="progress progress-success progress-striped">
<div class="bar" style="width: 40%"></div>
</div>
<div class="progress progress-warning progress-striped">
<div class="bar" style="width: 60%"></div>
</div>
<div class="progress progress-danger progress-striped">
<div class="bar" style="width: 80%"></div>
</div>
</div>
</div>
<!-- Icons
================================================== -->
<div class="row">
<div class="span12"><h6 class="title-bg">Icons: <small>provided by Glyphicons</small></h6></div>
<div class="span12">
<ul class="the-icons">
<li><i class="icon-glass"></i> icon-glass</li>
<li><i class="icon-music"></i> icon-music</li>
<li><i class="icon-search"></i> icon-search</li>
<li><i class="icon-envelope"></i> icon-envelope</li>
<li><i class="icon-heart"></i> icon-heart</li>
<li><i class="icon-star"></i> icon-star</li>
<li><i class="icon-star-empty"></i> icon-star-empty</li>
<li><i class="icon-user"></i> icon-user</li>
<li><i class="icon-film"></i> icon-film</li>
<li><i class="icon-th-large"></i> icon-th-large</li>
<li><i class="icon-th"></i> icon-th</li>
<li><i class="icon-th-list"></i> icon-th-list</li>
<li><i class="icon-ok"></i> icon-ok</li>
<li><i class="icon-remove"></i> icon-remove</li>
<li><i class="icon-zoom-in"></i> icon-zoom-in</li>
<li><i class="icon-zoom-out"></i> icon-zoom-out</li>
<li><i class="icon-off"></i> icon-off</li>
<li><i class="icon-signal"></i> icon-signal</li>
<li><i class="icon-cog"></i> icon-cog</li>
<li><i class="icon-trash"></i> icon-trash</li>
<li><i class="icon-home"></i> icon-home</li>
<li><i class="icon-file"></i> icon-file</li>
<li><i class="icon-time"></i> icon-time</li>
<li><i class="icon-road"></i> icon-road</li>
<li><i class="icon-download-alt"></i> icon-download-alt</li>
<li><i class="icon-download"></i> icon-download</li>
<li><i class="icon-upload"></i> icon-upload</li>
<li><i class="icon-inbox"></i> icon-inbox</li>
<li><i class="icon-play-circle"></i> icon-play-circle</li>
<li><i class="icon-repeat"></i> icon-repeat</li>
<li><i class="icon-refresh"></i> icon-refresh</li>
<li><i class="icon-list-alt"></i> icon-list-alt</li>
<li><i class="icon-lock"></i> icon-lock</li>
<li><i class="icon-flag"></i> icon-flag</li>
<li><i class="icon-headphones"></i> icon-headphones</li>
<li><i class="icon-volume-off"></i> icon-volume-off</li>
<li><i class="icon-volume-down"></i> icon-volume-down</li>
<li><i class="icon-volume-up"></i> icon-volume-up</li>
<li><i class="icon-qrcode"></i> icon-qrcode</li>
<li><i class="icon-barcode"></i> icon-barcode</li>
<li><i class="icon-tag"></i> icon-tag</li>
<li><i class="icon-tags"></i> icon-tags</li>
<li><i class="icon-book"></i> icon-book</li>
<li><i class="icon-bookmark"></i> icon-bookmark</li>
<li><i class="icon-print"></i> icon-print</li>
<li><i class="icon-camera"></i> icon-camera</li>
<li><i class="icon-font"></i> icon-font</li>
<li><i class="icon-bold"></i> icon-bold</li>
<li><i class="icon-italic"></i> icon-italic</li>
<li><i class="icon-text-height"></i> icon-text-height</li>
<li><i class="icon-text-width"></i> icon-text-width</li>
<li><i class="icon-align-left"></i> icon-align-left</li>
<li><i class="icon-align-center"></i> icon-align-center</li>
<li><i class="icon-align-right"></i> icon-align-right</li>
<li><i class="icon-align-justify"></i> icon-align-justify</li>
<li><i class="icon-list"></i> icon-list</li>
<li><i class="icon-indent-left"></i> icon-indent-left</li>
<li><i class="icon-indent-right"></i> icon-indent-right</li>
<li><i class="icon-facetime-video"></i> icon-facetime-video</li>
<li><i class="icon-picture"></i> icon-picture</li>
<li><i class="icon-pencil"></i> icon-pencil</li>
<li><i class="icon-map-marker"></i> icon-map-marker</li>
<li><i class="icon-adjust"></i> icon-adjust</li>
<li><i class="icon-tint"></i> icon-tint</li>
<li><i class="icon-edit"></i> icon-edit</li>
<li><i class="icon-share"></i> icon-share</li>
<li><i class="icon-check"></i> icon-check</li>
<li><i class="icon-move"></i> icon-move</li>
<li><i class="icon-step-backward"></i> icon-step-backward</li>
<li><i class="icon-fast-backward"></i> icon-fast-backward</li>
<li><i class="icon-backward"></i> icon-backward</li>
<li><i class="icon-play"></i> icon-play</li>
<li><i class="icon-pause"></i> icon-pause</li>
<li><i class="icon-stop"></i> icon-stop</li>
<li><i class="icon-forward"></i> icon-forward</li>
<li><i class="icon-fast-forward"></i> icon-fast-forward</li>
<li><i class="icon-step-forward"></i> icon-step-forward</li>
<li><i class="icon-eject"></i> icon-eject</li>
<li><i class="icon-chevron-left"></i> icon-chevron-left</li>
<li><i class="icon-chevron-right"></i> icon-chevron-right</li>
<li><i class="icon-plus-sign"></i> icon-plus-sign</li>
<li><i class="icon-minus-sign"></i> icon-minus-sign</li>
<li><i class="icon-remove-sign"></i> icon-remove-sign</li>
<li><i class="icon-ok-sign"></i> icon-ok-sign</li>
<li><i class="icon-question-sign"></i> icon-question-sign</li>
<li><i class="icon-info-sign"></i> icon-info-sign</li>
<li><i class="icon-screenshot"></i> icon-screenshot</li>
<li><i class="icon-remove-circle"></i> icon-remove-circle</li>
<li><i class="icon-ok-circle"></i> icon-ok-circle</li>
<li><i class="icon-ban-circle"></i> icon-ban-circle</li>
<li><i class="icon-arrow-left"></i> icon-arrow-left</li>
<li><i class="icon-arrow-right"></i> icon-arrow-right</li>
<li><i class="icon-arrow-up"></i> icon-arrow-up</li>
<li><i class="icon-arrow-down"></i> icon-arrow-down</li>
<li><i class="icon-share-alt"></i> icon-share-alt</li>
<li><i class="icon-resize-full"></i> icon-resize-full</li>
<li><i class="icon-resize-small"></i> icon-resize-small</li>
<li><i class="icon-plus"></i> icon-plus</li>
<li><i class="icon-minus"></i> icon-minus</li>
<li><i class="icon-asterisk"></i> icon-asterisk</li>
<li><i class="icon-exclamation-sign"></i> icon-exclamation-sign</li>
<li><i class="icon-gift"></i> icon-gift</li>
<li><i class="icon-leaf"></i> icon-leaf</li>
<li><i class="icon-fire"></i> icon-fire</li>
<li><i class="icon-eye-open"></i> icon-eye-open</li>
<li><i class="icon-eye-close"></i> icon-eye-close</li>
<li><i class="icon-warning-sign"></i> icon-warning-sign</li>
<li><i class="icon-plane"></i> icon-plane</li>
<li><i class="icon-calendar"></i> icon-calendar</li>
<li><i class="icon-random"></i> icon-random</li>
<li><i class="icon-comment"></i> icon-comment</li>
<li><i class="icon-magnet"></i> icon-magnet</li>
<li><i class="icon-chevron-up"></i> icon-chevron-up</li>
<li><i class="icon-chevron-down"></i> icon-chevron-down</li>
<li><i class="icon-retweet"></i> icon-retweet</li>
<li><i class="icon-shopping-cart"></i> icon-shopping-cart</li>
<li><i class="icon-folder-close"></i> icon-folder-close</li>
<li><i class="icon-folder-open"></i> icon-folder-open</li>
<li><i class="icon-resize-vertical"></i> icon-resize-vertical</li>
<li><i class="icon-resize-horizontal"></i> icon-resize-horizontal</li>
<li><i class="icon-hdd"></i> icon-hdd</li>
<li><i class="icon-bullhorn"></i> icon-bullhorn</li>
<li><i class="icon-bell"></i> icon-bell</li>
<li><i class="icon-certificate"></i> icon-certificate</li>
<li><i class="icon-thumbs-up"></i> icon-thumbs-up</li>
<li><i class="icon-thumbs-down"></i> icon-thumbs-down</li>
<li><i class="icon-hand-right"></i> icon-hand-right</li>
<li><i class="icon-hand-left"></i> icon-hand-left</li>
<li><i class="icon-hand-up"></i> icon-hand-up</li>
<li><i class="icon-hand-down"></i> icon-hand-down</li>
<li><i class="icon-circle-arrow-right"></i> icon-circle-arrow-right</li>
<li><i class="icon-circle-arrow-left"></i> icon-circle-arrow-left</li>
<li><i class="icon-circle-arrow-up"></i> icon-circle-arrow-up</li>
<li><i class="icon-circle-arrow-down"></i> icon-circle-arrow-down</li>
<li><i class="icon-globe"></i> icon-globe</li>
<li><i class="icon-wrench"></i> icon-wrench</li>
<li><i class="icon-tasks"></i> icon-tasks</li>
<li><i class="icon-filter"></i> icon-filter</li>
<li><i class="icon-briefcase"></i> icon-briefcase</li>
<li><i class="icon-fullscreen"></i> icon-fullscreen</li>
</ul>
</div>
</div>
</div> <!-- End Container -->
<!-- Footer Area
================================================== -->
<div class="footer-container"><!-- Begin Footer -->
<div class="container">
<div class="row footer-row">
<div class="span3 footer-col">
<h5>About Us</h5>
<img src="img/piccolo-footer-logo.png" alt="Piccolo" /><br /><br />
<address>
<strong>Design Team</strong><br />
123 Main St, Suite 500<br />
New York, NY 12345<br />
</address>
<ul class="social-icons">
<li><a href="#" class="social-icon facebook"></a></li>
<li><a href="#" class="social-icon twitter"></a></li>
<li><a href="#" class="social-icon dribble"></a></li>
<li><a href="#" class="social-icon rss"></a></li>
<li><a href="#" class="social-icon forrst"></a></li>
</ul>
</div>
<div class="span3 footer-col">
<h5>Latest Tweets</h5>
<ul>
<li><a href="#">@room122</a> Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li><a href="#">@room122</a> In interdum felis fermentum ipsum molestie sed porttitor ligula rutrum. Morbi blandit ultricies ultrices.</li>
<li><a href="#">@room122</a> Vivamus nec lectus sed orci molestie molestie. Etiam mattis neque eu orci rutrum aliquam.</li>
</ul>
</div>
<div class="span3 footer-col">
<h5>Latest Posts</h5>
<ul class="post-list">
<li><a href="#">Lorem ipsum dolor sit amet</a></li>
<li><a href="#">Consectetur adipiscing elit est lacus gravida</a></li>
<li><a href="#">Lectus sed orci molestie molestie etiam</a></li>
<li><a href="#">Mattis consectetur adipiscing elit est lacus</a></li>
<li><a href="#">Cras rutrum, massa non blandit convallis est</a></li>
</ul>
</div>
<div class="span3 footer-col">
<h5>Flickr Photos</h5>
<ul class="img-feed">
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
<li><a href="#"><img src="img/gallery/flickr-img-1.jpg" alt="Image Feed"></a></li>
</ul>
</div>
</div>
<div class="row"><!-- Begin Sub Footer -->
<div class="span12 footer-col footer-sub">
<div class="row no-margin">
<div class="span6"><span class="left">Copyright 2012 Piccolo Theme. All rights reserved.</span></div>
<div class="span6">
<span class="right">
<a href="#">Home</a> | <a href="#">Features</a> | <a href="#">Gallery</a> | <a href="#">Blog</a> | <a href="#">Contact</a>
</span>
</div>
</div>
</div>
</div><!-- End Sub Footer -->
</div>
</div><!-- End Footer -->
<!-- Scroll to Top -->
<div id="toTop" class="hidden-phone hidden-tablet">Back to Top</div>
</body>
<!-- Mirrored from medialoot.com/preview/piccolo/features.htm by HTTrack Website Copier/3.x [XR&CO'2014], Sun, 23 Nov 2014 11:48:30 GMT -->
</html>
| {
"content_hash": "c7012fe4eb5593f82d9aa3c3b164a480",
"timestamp": "",
"source": "github",
"line_count": 775,
"max_line_length": 627,
"avg_line_length": 58.42322580645161,
"alnum_prop": 0.5379875436194178,
"repo_name": "kokcito13/strah",
"id": "afa895f3c0df83ed231f091e340b53e2a0398552",
"size": "45285",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "markup/features.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "162450"
},
{
"name": "HTML",
"bytes": "1883642"
},
{
"name": "JavaScript",
"bytes": "471513"
},
{
"name": "PHP",
"bytes": "214595"
},
{
"name": "Ruby",
"bytes": "2073"
}
],
"symlink_target": ""
} |
function Devour( keys )
local caster = keys.caster
local target = keys.target
local ability = keys.ability
local modifier = keys.modifier
ability:ApplyDataDrivenModifier(caster, caster, "modifier_doom_bringer_devour_arena", nil)
caster:SetModifierStackCount("modifier_doom_bringer_devour_arena", caster, target:GetMaxHealth() * ability:GetLevelSpecialValueFor("stolen_health_pct", ability:GetLevel() - 1) * 0.01)
caster:CalculateStatBonus()
local gold = math.max(ability:GetLevelSpecialValueFor("min_bonus_gold", ability:GetLevel() - 1), ((target:GetMinimumGoldBounty() + target:GetMaximumGoldBounty()) / 2) * ability:GetLevelSpecialValueFor("bonus_gold_pct", ability:GetLevel() - 1) * 0.01)
Gold:AddGoldWithMessage(caster, gold)
target:SetMinimumGoldBounty(0)
target:SetMaximumGoldBounty(0)
target:Kill(ability, caster)
--[[
local devour_table = {} --TODO
if devour_table[target:GetUnitName()] then
local ability1 = "doom_bringer_empty1"
local ability2 = "doom_bringer_empty2"
if ability.DevourAbilities then
ability1 = ability.DevourAbilities[1]
ability2 = ability.DevourAbilities[2]
end
local creep1 = target:GetAbilityByIndex(0)
local creep2 = target:GetAbilityByIndex(1)
if creep1 then
ability.DevourAbilities[1] = creep1:GetAbilityName()
local caster1 = ReplaceAbilities(caster, ability1, ability.DevourAbilities[1], false, false)
caster1:SetLevel(creep1:GetLevel())
else
ReplaceAbilities(caster, ability.DevourAbilities[1], "doom_bringer_empty1", false, false)
ability.DevourAbilities[1] = nil
end
if creep2 then
ability.DevourAbilities[2] = creep2:GetAbilityName()
local caster2 = ReplaceAbilities(caster, ability1, ability.DevourAbilities[2], false, false)
caster2:SetLevel(creep2:GetLevel())
else
ReplaceAbilities(caster, ability.DevourAbilities[2], "doom_bringer_empty2", false, false)
ability.DevourAbilities[2] = nil
end
end]]
end | {
"content_hash": "41d9cd0d2934689fb137aad581de4062",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 251,
"avg_line_length": 41.82608695652174,
"alnum_prop": 0.7588357588357588,
"repo_name": "ark120202/aabs",
"id": "882bc8c0c58da7e5895ebe54a287f3296fc08898",
"size": "1924",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "game/scripts/vscripts/heroes/hero_doom_bringer/devour.lua",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "15"
},
{
"name": "CSS",
"bytes": "160627"
},
{
"name": "JavaScript",
"bytes": "1522928"
},
{
"name": "Lua",
"bytes": "1466770"
}
],
"symlink_target": ""
} |
package com.thoughtworks.go.server.service;
import com.thoughtworks.go.config.CaseInsensitiveString;
import com.thoughtworks.go.server.domain.user.Filters;
import com.thoughtworks.go.server.domain.user.PipelineSelections;
import com.thoughtworks.go.server.persistence.PipelineRepository;
import com.thoughtworks.go.util.Clock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class PipelineSelectionsService {
private final Clock clock;
private final PipelineRepository pipelineRepository;
private final GoConfigService goConfigService;
@Autowired
public PipelineSelectionsService(PipelineRepository pipelineRepository, GoConfigService goConfigService, Clock clock) {
this.pipelineRepository = pipelineRepository;
this.goConfigService = goConfigService;
this.clock = clock;
}
public PipelineSelections load(String id, Long userId) {
PipelineSelections pipelineSelections = loadByIdOrUserId(id, userId);
if (pipelineSelections == null) {
pipelineSelections = PipelineSelections.ALL;
}
return pipelineSelections;
}
public long save(String id, Long userId, Filters filters) {
PipelineSelections pipelineSelections = findOrCreateCurrentPipelineSelectionsFor(id, userId);
pipelineSelections.update(filters, clock.currentTime(), userId);
return pipelineRepository.saveSelectedPipelines(pipelineSelections);
}
public void update(String id, Long userId, CaseInsensitiveString pipelineToAdd) {
PipelineSelections currentSelections = findOrCreateCurrentPipelineSelectionsFor(id, userId);
if (currentSelections.ensurePipelineVisible(pipelineToAdd)) {
pipelineRepository.saveSelectedPipelines(currentSelections);
}
}
private PipelineSelections findOrCreateCurrentPipelineSelectionsFor(String id, Long userId) {
PipelineSelections pipelineSelections = loadByIdOrUserId(id, userId);
if (pipelineSelections == null) {
return new PipelineSelections(Filters.defaults(), clock.currentTime(), userId);
}
return pipelineSelections;
}
private PipelineSelections loadByIdOrUserId(String id, Long userId) {
return goConfigService.isSecurityEnabled() ? pipelineRepository.findPipelineSelectionsByUserId(userId) : pipelineRepository.findPipelineSelectionsById(id);
}
}
| {
"content_hash": "b952bfa7c1e4d2a207771dce0cb1cae5",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 163,
"avg_line_length": 38.765625,
"alnum_prop": 0.7601773478436115,
"repo_name": "naveenbhaskar/gocd",
"id": "e92b0c82041645d0de4446661809b145d170c634",
"size": "3082",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "server/src/main/java/com/thoughtworks/go/server/service/PipelineSelectionsService.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6804"
},
{
"name": "CSS",
"bytes": "757466"
},
{
"name": "FreeMarker",
"bytes": "8662"
},
{
"name": "Groovy",
"bytes": "1683044"
},
{
"name": "HTML",
"bytes": "718498"
},
{
"name": "Java",
"bytes": "20573725"
},
{
"name": "JavaScript",
"bytes": "3000785"
},
{
"name": "NSIS",
"bytes": "16898"
},
{
"name": "PLSQL",
"bytes": "2984"
},
{
"name": "PLpgSQL",
"bytes": "6074"
},
{
"name": "PowerShell",
"bytes": "768"
},
{
"name": "Ruby",
"bytes": "2638300"
},
{
"name": "SQLPL",
"bytes": "9330"
},
{
"name": "Shell",
"bytes": "186387"
},
{
"name": "TypeScript",
"bytes": "1471077"
},
{
"name": "XSLT",
"bytes": "183239"
}
],
"symlink_target": ""
} |
/*************************************************************************/
/* label.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "label.h"
#include "core/print_string.h"
#include "core/project_settings.h"
#include "core/translation.h"
void Label::set_autowrap(bool p_autowrap) {
autowrap = p_autowrap;
word_cache_dirty = true;
update();
}
bool Label::has_autowrap() const {
return autowrap;
}
void Label::set_uppercase(bool p_uppercase) {
uppercase = p_uppercase;
word_cache_dirty = true;
update();
}
bool Label::is_uppercase() const {
return uppercase;
}
int Label::get_line_height() const {
return get_font("font")->get_height();
}
void Label::_notification(int p_what) {
if (p_what == NOTIFICATION_TRANSLATION_CHANGED) {
String new_text = tr(text);
if (new_text == xl_text)
return; //nothing new
xl_text = new_text;
regenerate_word_cache();
update();
}
if (p_what == NOTIFICATION_DRAW) {
if (clip) {
VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true);
}
if (word_cache_dirty)
regenerate_word_cache();
RID ci = get_canvas_item();
Size2 string_size;
Size2 size = get_size();
Ref<StyleBox> style = get_stylebox("normal");
Ref<Font> font = get_font("font");
Color font_color = get_color("font_color");
Color font_color_shadow = get_color("font_color_shadow");
bool use_outline = get_constant("shadow_as_outline");
Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
int line_spacing = get_constant("line_spacing");
Color font_outline_modulate = get_color("font_outline_modulate");
style->draw(ci, Rect2(Point2(0, 0), get_size()));
VisualServer::get_singleton()->canvas_item_set_distance_field_mode(get_canvas_item(), font.is_valid() && font->is_distance_field_hint());
int font_h = font->get_height() + line_spacing;
int lines_visible = (size.y + line_spacing) / font_h;
// ceiling to ensure autowrapping does not cut text
int space_w = Math::ceil(font->get_char_size(' ').width);
int chars_total = 0;
int vbegin = 0, vsep = 0;
if (lines_visible > line_count) {
lines_visible = line_count;
}
if (max_lines_visible >= 0 && lines_visible > max_lines_visible) {
lines_visible = max_lines_visible;
}
if (lines_visible > 0) {
switch (valign) {
case VALIGN_TOP: {
//nothing
} break;
case VALIGN_CENTER: {
vbegin = (size.y - (lines_visible * font_h - line_spacing)) / 2;
vsep = 0;
} break;
case VALIGN_BOTTOM: {
vbegin = size.y - (lines_visible * font_h - line_spacing);
vsep = 0;
} break;
case VALIGN_FILL: {
vbegin = 0;
if (lines_visible > 1) {
vsep = (size.y - (lines_visible * font_h - line_spacing)) / (lines_visible - 1);
} else {
vsep = 0;
}
} break;
}
}
WordCache *wc = word_cache;
if (!wc)
return;
int line = 0;
int line_to = lines_skipped + (lines_visible > 0 ? lines_visible : 1);
FontDrawer drawer(font, font_outline_modulate);
while (wc) {
/* handle lines not meant to be drawn quickly */
if (line >= line_to)
break;
if (line < lines_skipped) {
while (wc && wc->char_pos >= 0)
wc = wc->next;
if (wc)
wc = wc->next;
line++;
continue;
}
/* handle lines normally */
if (wc->char_pos < 0) {
//empty line
wc = wc->next;
line++;
continue;
}
WordCache *from = wc;
WordCache *to = wc;
int taken = 0;
int spaces = 0;
while (to && to->char_pos >= 0) {
taken += to->pixel_width;
if (to != from && to->space_count) {
spaces += to->space_count;
}
to = to->next;
}
bool can_fill = to && to->char_pos == WordCache::CHAR_WRAPLINE;
float x_ofs = 0;
switch (align) {
case ALIGN_FILL:
case ALIGN_LEFT: {
x_ofs = style->get_offset().x;
} break;
case ALIGN_CENTER: {
x_ofs = int(size.width - (taken + spaces * space_w)) / 2;
} break;
case ALIGN_RIGHT: {
x_ofs = int(size.width - style->get_margin(MARGIN_RIGHT) - (taken + spaces * space_w));
} break;
}
float y_ofs = style->get_offset().y;
y_ofs += (line - lines_skipped) * font_h + font->get_ascent();
y_ofs += vbegin + line * vsep;
while (from != to) {
// draw a word
int pos = from->char_pos;
if (from->char_pos < 0) {
ERR_PRINT("BUG");
return;
}
if (from->space_count) {
/* spacing */
x_ofs += space_w * from->space_count;
if (can_fill && align == ALIGN_FILL && spaces) {
x_ofs += int((size.width - (taken + space_w * spaces)) / spaces);
}
}
if (font_color_shadow.a > 0) {
int chars_total_shadow = chars_total; //save chars drawn
float x_ofs_shadow = x_ofs;
for (int i = 0; i < from->word_len; i++) {
if (visible_chars < 0 || chars_total_shadow < visible_chars) {
CharType c = xl_text[i + pos];
CharType n = xl_text[i + pos + 1];
if (uppercase) {
c = String::char_uppercase(c);
n = String::char_uppercase(c);
}
float move = font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + shadow_ofs, c, n, font_color_shadow, false);
if (use_outline) {
font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + Vector2(-shadow_ofs.x, shadow_ofs.y), c, n, font_color_shadow, false);
font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + Vector2(shadow_ofs.x, -shadow_ofs.y), c, n, font_color_shadow, false);
font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + Vector2(-shadow_ofs.x, -shadow_ofs.y), c, n, font_color_shadow, false);
}
x_ofs_shadow += move;
chars_total_shadow++;
}
}
}
for (int i = 0; i < from->word_len; i++) {
if (visible_chars < 0 || chars_total < visible_chars) {
CharType c = xl_text[i + pos];
CharType n = xl_text[i + pos + 1];
if (uppercase) {
c = String::char_uppercase(c);
n = String::char_uppercase(c);
}
x_ofs += drawer.draw_char(ci, Point2(x_ofs, y_ofs), c, n, font_color);
chars_total++;
}
}
from = from->next;
}
wc = to ? to->next : 0;
line++;
}
}
if (p_what == NOTIFICATION_THEME_CHANGED) {
word_cache_dirty = true;
update();
}
if (p_what == NOTIFICATION_RESIZED) {
word_cache_dirty = true;
}
}
Size2 Label::get_minimum_size() const {
Size2 min_style = get_stylebox("normal")->get_minimum_size();
// don't want to mutable everything
if (word_cache_dirty)
const_cast<Label *>(this)->regenerate_word_cache();
if (autowrap)
return Size2(1, clip ? 1 : minsize.height) + min_style;
else {
Size2 ms = minsize;
if (clip)
ms.width = 1;
return ms + min_style;
}
}
int Label::get_longest_line_width() const {
Ref<Font> font = get_font("font");
int max_line_width = 0;
int line_width = 0;
for (int i = 0; i < xl_text.size(); i++) {
CharType current = xl_text[i];
if (uppercase)
current = String::char_uppercase(current);
if (current < 32) {
if (current == '\n') {
if (line_width > max_line_width)
max_line_width = line_width;
line_width = 0;
}
} else {
// ceiling to ensure autowrapping does not cut text
int char_width = Math::ceil(font->get_char_size(current, xl_text[i + 1]).width);
line_width += char_width;
}
}
if (line_width > max_line_width)
max_line_width = line_width;
return max_line_width;
}
int Label::get_line_count() const {
if (!is_inside_tree())
return 1;
if (word_cache_dirty)
const_cast<Label *>(this)->regenerate_word_cache();
return line_count;
}
int Label::get_visible_line_count() const {
int line_spacing = get_constant("line_spacing");
int font_h = get_font("font")->get_height() + line_spacing;
int lines_visible = (get_size().height - get_stylebox("normal")->get_minimum_size().height + line_spacing) / font_h;
if (lines_visible > line_count)
lines_visible = line_count;
if (max_lines_visible >= 0 && lines_visible > max_lines_visible)
lines_visible = max_lines_visible;
return lines_visible;
}
void Label::regenerate_word_cache() {
while (word_cache) {
WordCache *current = word_cache;
word_cache = current->next;
memdelete(current);
}
Ref<StyleBox> style = get_stylebox("normal");
int width = autowrap ? (get_size().width - style->get_minimum_size().width) : get_longest_line_width();
Ref<Font> font = get_font("font");
int current_word_size = 0;
int word_pos = 0;
int line_width = 0;
int space_count = 0;
// ceiling to ensure autowrapping does not cut text
int space_width = Math::ceil(font->get_char_size(' ').width);
int line_spacing = get_constant("line_spacing");
line_count = 1;
total_char_cache = 0;
WordCache *last = NULL;
for (int i = 0; i < xl_text.size() + 1; i++) {
CharType current = i < xl_text.length() ? xl_text[i] : ' '; //always a space at the end, so the algo works
if (uppercase)
current = String::char_uppercase(current);
// ranges taken from http://www.unicodemap.org/
// if your language is not well supported, consider helping improve
// the unicode support in Godot.
bool separatable = (current >= 0x2E08 && current <= 0xFAFF) || (current >= 0xFE30 && current <= 0xFE4F);
//current>=33 && (current < 65||current >90) && (current<97||current>122) && (current<48||current>57);
bool insert_newline = false;
int char_width = 0;
if (current < 33) {
if (current_word_size > 0) {
WordCache *wc = memnew(WordCache);
if (word_cache) {
last->next = wc;
} else {
word_cache = wc;
}
last = wc;
wc->pixel_width = current_word_size;
wc->char_pos = word_pos;
wc->word_len = i - word_pos;
wc->space_count = space_count;
current_word_size = 0;
space_count = 0;
}
if (current == '\n') {
insert_newline = true;
} else {
total_char_cache++;
}
if (i < xl_text.length() && xl_text[i] == ' ') {
total_char_cache--; // do not count spaces
if (line_width > 0 || last == NULL || last->char_pos != WordCache::CHAR_WRAPLINE) {
space_count++;
line_width += space_width;
} else {
space_count = 0;
}
}
} else {
// latin characters
if (current_word_size == 0) {
word_pos = i;
}
// ceiling to ensure autowrapping does not cut text
char_width = Math::ceil(font->get_char_size(current, xl_text[i + 1]).width);
current_word_size += char_width;
line_width += char_width;
total_char_cache++;
}
if ((autowrap && (line_width >= width) && ((last && last->char_pos >= 0) || separatable)) || insert_newline) {
if (separatable) {
if (current_word_size > 0) {
WordCache *wc = memnew(WordCache);
if (word_cache) {
last->next = wc;
} else {
word_cache = wc;
}
last = wc;
wc->pixel_width = current_word_size - char_width;
wc->char_pos = word_pos;
wc->word_len = i - word_pos;
wc->space_count = space_count;
current_word_size = char_width;
space_count = 0;
word_pos = i;
}
}
WordCache *wc = memnew(WordCache);
if (word_cache) {
last->next = wc;
} else {
word_cache = wc;
}
last = wc;
wc->pixel_width = 0;
wc->char_pos = insert_newline ? WordCache::CHAR_NEWLINE : WordCache::CHAR_WRAPLINE;
line_width = current_word_size;
line_count++;
space_count = 0;
}
}
if (!autowrap)
minsize.width = width;
if (max_lines_visible > 0 && line_count > max_lines_visible) {
minsize.height = (font->get_height() * max_lines_visible) + (line_spacing * (max_lines_visible - 1));
} else {
minsize.height = (font->get_height() * line_count) + (line_spacing * (line_count - 1));
}
if (!autowrap || !clip) {
//helps speed up some labels that may change a lot, as no resizing is requested. Do not change.
minimum_size_changed();
}
word_cache_dirty = false;
}
void Label::set_align(Align p_align) {
ERR_FAIL_INDEX((int)p_align, 4);
align = p_align;
update();
}
Label::Align Label::get_align() const {
return align;
}
void Label::set_valign(VAlign p_align) {
ERR_FAIL_INDEX((int)p_align, 4);
valign = p_align;
update();
}
Label::VAlign Label::get_valign() const {
return valign;
}
void Label::set_text(const String &p_string) {
if (text == p_string)
return;
text = p_string;
xl_text = tr(p_string);
word_cache_dirty = true;
if (percent_visible < 1)
visible_chars = get_total_character_count() * percent_visible;
update();
}
void Label::set_clip_text(bool p_clip) {
clip = p_clip;
update();
minimum_size_changed();
}
bool Label::is_clipping_text() const {
return clip;
}
String Label::get_text() const {
return text;
}
void Label::set_visible_characters(int p_amount) {
visible_chars = p_amount;
if (get_total_character_count() > 0) {
percent_visible = (float)p_amount / (float)total_char_cache;
}
_change_notify("percent_visible");
update();
}
int Label::get_visible_characters() const {
return visible_chars;
}
void Label::set_percent_visible(float p_percent) {
if (p_percent < 0 || p_percent >= 1) {
visible_chars = -1;
percent_visible = 1;
} else {
visible_chars = get_total_character_count() * p_percent;
percent_visible = p_percent;
}
_change_notify("visible_chars");
update();
}
float Label::get_percent_visible() const {
return percent_visible;
}
void Label::set_lines_skipped(int p_lines) {
lines_skipped = p_lines;
update();
}
int Label::get_lines_skipped() const {
return lines_skipped;
}
void Label::set_max_lines_visible(int p_lines) {
max_lines_visible = p_lines;
update();
}
int Label::get_max_lines_visible() const {
return max_lines_visible;
}
int Label::get_total_character_count() const {
if (word_cache_dirty)
const_cast<Label *>(this)->regenerate_word_cache();
return total_char_cache;
}
void Label::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_align", "align"), &Label::set_align);
ClassDB::bind_method(D_METHOD("get_align"), &Label::get_align);
ClassDB::bind_method(D_METHOD("set_valign", "valign"), &Label::set_valign);
ClassDB::bind_method(D_METHOD("get_valign"), &Label::get_valign);
ClassDB::bind_method(D_METHOD("set_text", "text"), &Label::set_text);
ClassDB::bind_method(D_METHOD("get_text"), &Label::get_text);
ClassDB::bind_method(D_METHOD("set_autowrap", "enable"), &Label::set_autowrap);
ClassDB::bind_method(D_METHOD("has_autowrap"), &Label::has_autowrap);
ClassDB::bind_method(D_METHOD("set_clip_text", "enable"), &Label::set_clip_text);
ClassDB::bind_method(D_METHOD("is_clipping_text"), &Label::is_clipping_text);
ClassDB::bind_method(D_METHOD("set_uppercase", "enable"), &Label::set_uppercase);
ClassDB::bind_method(D_METHOD("is_uppercase"), &Label::is_uppercase);
ClassDB::bind_method(D_METHOD("get_line_height"), &Label::get_line_height);
ClassDB::bind_method(D_METHOD("get_line_count"), &Label::get_line_count);
ClassDB::bind_method(D_METHOD("get_visible_line_count"), &Label::get_visible_line_count);
ClassDB::bind_method(D_METHOD("get_total_character_count"), &Label::get_total_character_count);
ClassDB::bind_method(D_METHOD("set_visible_characters", "amount"), &Label::set_visible_characters);
ClassDB::bind_method(D_METHOD("get_visible_characters"), &Label::get_visible_characters);
ClassDB::bind_method(D_METHOD("set_percent_visible", "percent_visible"), &Label::set_percent_visible);
ClassDB::bind_method(D_METHOD("get_percent_visible"), &Label::get_percent_visible);
ClassDB::bind_method(D_METHOD("set_lines_skipped", "lines_skipped"), &Label::set_lines_skipped);
ClassDB::bind_method(D_METHOD("get_lines_skipped"), &Label::get_lines_skipped);
ClassDB::bind_method(D_METHOD("set_max_lines_visible", "lines_visible"), &Label::set_max_lines_visible);
ClassDB::bind_method(D_METHOD("get_max_lines_visible"), &Label::get_max_lines_visible);
BIND_ENUM_CONSTANT(ALIGN_LEFT);
BIND_ENUM_CONSTANT(ALIGN_CENTER);
BIND_ENUM_CONSTANT(ALIGN_RIGHT);
BIND_ENUM_CONSTANT(ALIGN_FILL);
BIND_ENUM_CONSTANT(VALIGN_TOP);
BIND_ENUM_CONSTANT(VALIGN_CENTER);
BIND_ENUM_CONSTANT(VALIGN_BOTTOM);
BIND_ENUM_CONSTANT(VALIGN_FILL);
ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT_INTL), "set_text", "get_text");
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align");
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "valign", PROPERTY_HINT_ENUM, "Top,Center,Bottom,Fill"), "set_valign", "get_valign");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "autowrap"), "set_autowrap", "has_autowrap");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "clip_text"), "set_clip_text", "is_clipping_text");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "uppercase"), "set_uppercase", "is_uppercase");
ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters", PROPERTY_HINT_RANGE, "-1,128000,1", PROPERTY_USAGE_EDITOR), "set_visible_characters", "get_visible_characters");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "percent_visible", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_percent_visible", "get_percent_visible");
ADD_PROPERTY(PropertyInfo(Variant::INT, "lines_skipped", PROPERTY_HINT_RANGE, "0,999,1"), "set_lines_skipped", "get_lines_skipped");
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_lines_visible", PROPERTY_HINT_RANGE, "-1,999,1"), "set_max_lines_visible", "get_max_lines_visible");
}
Label::Label(const String &p_text) {
align = ALIGN_LEFT;
valign = VALIGN_TOP;
xl_text = "";
word_cache = NULL;
word_cache_dirty = true;
autowrap = false;
line_count = 0;
set_v_size_flags(0);
clip = false;
set_mouse_filter(MOUSE_FILTER_IGNORE);
total_char_cache = 0;
visible_chars = -1;
percent_visible = 1;
lines_skipped = 0;
max_lines_visible = -1;
set_text(p_text);
uppercase = false;
set_v_size_flags(SIZE_SHRINK_CENTER);
}
Label::~Label() {
while (word_cache) {
WordCache *current = word_cache;
word_cache = current->next;
memdelete(current);
}
}
| {
"content_hash": "4b040e4c99b9e26f0bde3e8aeb6f5ed2",
"timestamp": "",
"source": "github",
"line_count": 710,
"max_line_length": 175,
"avg_line_length": 28.17042253521127,
"alnum_prop": 0.6098695065246738,
"repo_name": "NateWardawg/godot",
"id": "6ff2d232f0855fdf08f54478dedb9a3ec8a21c0d",
"size": "20001",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "scene/gui/label.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "6955"
},
{
"name": "Assembly",
"bytes": "372147"
},
{
"name": "C",
"bytes": "20381266"
},
{
"name": "C++",
"bytes": "13469364"
},
{
"name": "GAP",
"bytes": "1100"
},
{
"name": "GDScript",
"bytes": "76536"
},
{
"name": "GLSL",
"bytes": "56673"
},
{
"name": "HTML",
"bytes": "9365"
},
{
"name": "Java",
"bytes": "651705"
},
{
"name": "JavaScript",
"bytes": "5802"
},
{
"name": "Matlab",
"bytes": "2076"
},
{
"name": "Objective-C",
"bytes": "67970"
},
{
"name": "Objective-C++",
"bytes": "125279"
},
{
"name": "Perl",
"bytes": "1930423"
},
{
"name": "Python",
"bytes": "118018"
},
{
"name": "Shell",
"bytes": "3410"
},
{
"name": "XS",
"bytes": "4319"
},
{
"name": "eC",
"bytes": "3710"
}
],
"symlink_target": ""
} |
export var API_KEY = process.env['RIOT_API_KEY']; | {
"content_hash": "f89568dc2dff372b3495454c7eb7e6b0",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 50,
"avg_line_length": 50,
"alnum_prop": 0.7,
"repo_name": "Goyatuzo/LolCalc",
"id": "bc7493cc29b722698739f50fdbdb6fbcc12625c4",
"size": "52",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "RiotAPI/constants.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "945"
},
{
"name": "HTML",
"bytes": "4699"
},
{
"name": "JavaScript",
"bytes": "36735"
}
],
"symlink_target": ""
} |
package es.asgarke.golem.tools;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.Properties;
@Slf4j
public class ParserTool {
public static Optional<Properties> readPropertiesFromFile(File file) {
Properties properties = new Properties();
try (InputStream stream = new FileInputStream(file)) {
properties.load(stream);
return Optional.of(properties);
} catch (Exception e) {
return Optional.empty();
}
}
public static Optional<Properties> readFromStringPath(String path) {
String classpathHeader = "classpath:";
String fileHeader = "file:";
if (path.startsWith(classpathHeader)) {
String actualPath = path.substring(classpathHeader.length());
URL resource = ParserTool.class.getClassLoader().getResource(actualPath);
if (resource != null) {
try {
File file = Paths.get(resource.toURI()).toFile();
return readPropertiesFromFile(file);
} catch (Exception e) {
log.error("Failed to read properties from '{}'", path);
return Optional.empty();
}
} else {
return Optional.empty();
}
} else if (path.startsWith(fileHeader)) {
String actualPath = path.substring(fileHeader.length());
File file = new File(actualPath);
return file.exists() ? readPropertiesFromFile(file) : Optional.empty();
} else {
Optional<Properties> fileOption = readFromStringPath(fileHeader + path);
if (fileOption.isPresent()) {
return fileOption;
} else {
return readFromStringPath(classpathHeader + path);
}
}
}
public static Optional<Integer> readInt(Object obj) {
if (obj instanceof Integer) {
return Optional.of((Integer) obj);
} else if (!(obj instanceof String)) {
return Optional.empty();
} else {
try {
return Optional.of(Integer.parseInt((String) obj));
} catch (Exception e) {
log.warn("Unable to cast as int value: {}", obj, e);
return Optional.empty();
}
}
}
public static Optional<Boolean> readBool(Object obj) {
if (obj instanceof Boolean) {
return Optional.of((boolean) obj);
} else if (!(obj instanceof String)) {
return Optional.empty();
} else {
try {
return Optional.of(Boolean.parseBoolean((String) obj));
} catch (Exception e) {
log.warn("Unable to cast as boolean value: {}", obj, e);
return Optional.empty();
}
}
}
public static Optional<Float> readFloat(Object obj) {
if (obj instanceof Float) {
return Optional.of((Float) obj);
} else if (!(obj instanceof String)) {
return Optional.empty();
} else {
try {
return Optional.of(Float.parseFloat((String) obj));
} catch (Exception e) {
log.warn("Unable to cast as float value: {}", obj, e);
return Optional.empty();
}
}
}
public static Optional<Double> readDouble(Object obj) {
if (obj instanceof Double) {
return Optional.of((Double) obj);
} else if (!(obj instanceof String)) {
return Optional.empty();
} else {
try {
return Optional.of(Double.parseDouble((String) obj));
} catch (Exception e) {
log.warn("Unable to cast as int value: {}", obj, e);
return Optional.empty();
}
}
}
public static <T> T parse(String value, Class<T> clazz) {
return parse(value, clazz, null);
}
public static <T> T parse(String value, Class<T> clazz, ObjectMapper mapper) {
if (value == null || value.isBlank()) {
return null;
} else {
String typeName = clazz.getName();
switch (typeName) {
case "java.lang.String":
return clazz.cast(value);
case "java.lang.Integer":
case "int":
return readInt(value)
.map(clazz::cast)
.orElseThrow(() -> new RuntimeException("Failed to parse int from " + value));
case "java.lang.Boolean":
case "boolean":
return readBool(value)
.map(clazz::cast)
.orElseThrow(() -> new RuntimeException("Failed to parse boolean from " + value));
case "java.lang.Float":
case "float":
return readFloat(value)
.map(clazz::cast)
.orElseThrow(() -> new RuntimeException("Failed to parse boolean from " + value));
case "java.lang.Double":
case "double":
return readDouble(value)
.map(clazz::cast)
.orElseThrow(() -> new RuntimeException("Failed to parse boolean from " + value));
default:
if (mapper == null) {
throw new RuntimeException("Failed to parse to class " + clazz.getName() + " (no object mapper found)");
} else {
try {
return clazz.cast(mapper.readValue(value, clazz));
} catch (IOException e) {
throw new RuntimeException("Failed to parse to class " + clazz.getName(), e);
}
}
}
}
}
}
| {
"content_hash": "161cbcd359e882bbdc4d44398b1e4e62",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 116,
"avg_line_length": 32.21341463414634,
"alnum_prop": 0.6006057164489873,
"repo_name": "apycazo/codex",
"id": "94022d4c6a2bd9b028bd6af3d36825f431cfda95",
"size": "5283",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "codex-golem/src/main/java/es/asgarke/golem/tools/ParserTool.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "144"
},
{
"name": "Gherkin",
"bytes": "4681"
},
{
"name": "Groovy",
"bytes": "1533"
},
{
"name": "HTML",
"bytes": "663"
},
{
"name": "Java",
"bytes": "399946"
},
{
"name": "Kotlin",
"bytes": "14100"
}
],
"symlink_target": ""
} |
local key = ModPath .. ' ' .. RequiredScript
if _G[key] then return else _G[key] = true end
local fs_original_playermanager_init = PlayerManager.init
function PlayerManager:init()
fs_original_playermanager_init(self)
self:fs_reset_max_health()
end
function PlayerManager:fs_reset_max_health()
self.fs_current_max_health = (PlayerDamage._HEALTH_INIT + self:health_skill_addend()) * self:health_skill_multiplier()
end
local fs_original_playermanager_exitvehicle = PlayerManager.exit_vehicle
function PlayerManager:exit_vehicle()
fs_original_playermanager_exitvehicle(self)
managers.interaction.reset_ordered_list()
end
function PlayerManager:fs_max_movement_speed_multiplier()
local multiplier = 1
local armor_penalty = self:mod_movement_penalty(self:body_armor_value('movement', false, 1)) -- TODO: consider armor kit *yawn*
multiplier = multiplier + (armor_penalty - 1)
multiplier = multiplier + (self:upgrade_value('player', 'run_speed_multiplier', 1) - 1)
multiplier = multiplier + (self:upgrade_value('player', 'movement_speed_multiplier', 1) - 1)
if self:has_category_upgrade('player', 'minion_master_speed_multiplier') then
multiplier = multiplier + (self:upgrade_value('player', 'minion_master_speed_multiplier', 1) - 1)
end
local damage_health_ratio = self:get_damage_health_ratio(0.01, 'movement_speed')
multiplier = multiplier * (1 + self:upgrade_value('player', 'movement_speed_damage_health_ratio_multiplier', 0) * damage_health_ratio)
if self:has_category_upgrade('temporary', 'damage_speed_multiplier') then
local damage_speed_multiplier = self:upgrade_value('temporary', 'damage_speed_multiplier', self:upgrade_value('temporary', 'team_damage_speed_multiplier_received', 1))
multiplier = multiplier * ((damage_speed_multiplier[1] - 1) * 0.5 + 1)
end
return multiplier
end
function PlayerManager:has_category_upgrade(category, upgrade)
local upgs_ctg = self._global.upgrades[category]
if upgs_ctg and upgs_ctg[upgrade] then
return true
end
return false
end
local tweak_upg_values = tweak_data.upgrades.values
function PlayerManager:upgrade_value(category, upgrade, default)
local upgs_ctg = self._global.upgrades[category]
if not upgs_ctg then
return default or 0
end
local level = upgs_ctg[upgrade]
if not level then
return default or 0
end
local value = tweak_upg_values[category][upgrade][level]
return value or value ~= false and (default or 0) or false
end
local cached_hostage_bonus_multiplier = {}
function PlayerManager:reset_cached_hostage_bonus_multiplier()
cached_hostage_bonus_multiplier = {}
end
local fs_original_playermanager_gethostagebonusmultiplier = PlayerManager.get_hostage_bonus_multiplier
function PlayerManager:get_hostage_bonus_multiplier(category)
local key = category .. tostring(self._is_local_close_to_hostage)
local result = cached_hostage_bonus_multiplier[key]
if not result then
result = fs_original_playermanager_gethostagebonusmultiplier(self, category)
cached_hostage_bonus_multiplier[key] = result
end
return result
end
local cached_armor = {}
function PlayerManager:body_armor_value(category, override_value, default)
if override_value then
return self:upgrade_value_by_level('player', 'body_armor', category, {})[override_value] or default or 0
else
local result = cached_armor[category]
if not result then
local armor_id, cacheable = managers.blackmarket:equipped_armor(true, true)
local armor_data = tweak_data.blackmarket.armors[armor_id]
result = self:upgrade_value_by_level('player', 'body_armor', category, {})[armor_data.upgrade_level] or default or 0
if cacheable then
cached_armor[category] = result
end
end
return result
end
end
function PlayerManager:get_hostage_bonus_addend(category)
local groupai = managers.groupai
local hostages = groupai and groupai:state():hostage_count() or 0
local minions = self:num_local_minions() or 0
local addend = 0
hostages = hostages + minions
if hostages == 0 then
return 0
end
local hostage_max_num = tweak_data:get_raw_value('upgrades', 'hostage_max_num', category)
if hostage_max_num then
hostages = math.min(hostages, hostage_max_num)
end
addend = addend + self:team_upgrade_value(category, 'hostage_addend', 0)
addend = addend + self:team_upgrade_value(category, 'passive_hostage_addend', 0)
addend = addend + self:upgrade_value('player', 'hostage_' .. category .. '_addend', 0)
addend = addend + self:upgrade_value('player', 'passive_hostage_' .. category .. '_addend', 0)
local local_player = self:local_player()
if self:has_category_upgrade('player', 'close_to_hostage_boost') and self._is_local_close_to_hostage then
addend = addend * tweak_data.upgrades.hostage_near_player_multiplier
end
return addend * hostages
end
function PlayerManager:body_armor_skill_addend(override_armor)
local addend = 0
addend = addend + self:upgrade_value('player', tostring(override_armor or managers.blackmarket:equipped_armor(true, true)) .. '_armor_addend', 0)
addend = addend + self.fs_current_max_health * self:upgrade_value('player', 'armor_increase', 0)
addend = addend + self:upgrade_value('team', 'crew_add_armor', 0)
return addend
end
function PlayerManager:fs_body_armor_skill_multiplier(override_armor)
local multiplier = self.fs_bas_multiplier
multiplier = multiplier + self:team_upgrade_value('armor', 'multiplier', 1)
multiplier = multiplier + self:get_hostage_bonus_multiplier('armor')
multiplier = multiplier + self:upgrade_value('player', tostring(override_armor or managers.blackmarket:equipped_armor(true, true)) .. '_armor_multiplier', 1)
multiplier = multiplier + self:upgrade_value('player', 'chico_armor_multiplier', 1)
return multiplier - 4
end
function PlayerManager:fs_refresh_body_armor_skill_multiplier()
local multiplier = 1
multiplier = multiplier + self:upgrade_value('player', 'tier_armor_multiplier', 1)
multiplier = multiplier + self:upgrade_value('player', 'passive_armor_multiplier', 1)
multiplier = multiplier + self:upgrade_value('player', 'armor_multiplier', 1)
multiplier = multiplier + self:upgrade_value('player', 'perk_armor_loss_multiplier', 1)
self.fs_bas_multiplier = multiplier - 4
end
function PlayerManager:body_armor_skill_multiplier(override_armor)
local multiplier = 1
multiplier = multiplier + self:upgrade_value('player', 'tier_armor_multiplier', 1)
multiplier = multiplier + self:upgrade_value('player', 'passive_armor_multiplier', 1)
multiplier = multiplier + self:upgrade_value('player', 'armor_multiplier', 1)
multiplier = multiplier + self:upgrade_value('player', 'perk_armor_loss_multiplier', 1)
self.fs_bas_multiplier = multiplier - 4
self.body_armor_skill_multiplier = self.fs_body_armor_skill_multiplier
multiplier = multiplier + self:team_upgrade_value('armor', 'multiplier', 1)
multiplier = multiplier + self:get_hostage_bonus_multiplier('armor')
multiplier = multiplier + self:upgrade_value('player', tostring(override_armor or managers.blackmarket:equipped_armor(true, true)) .. '_armor_multiplier', 1)
multiplier = multiplier + self:upgrade_value('player', 'chico_armor_multiplier', 1)
return multiplier - 8
end
| {
"content_hash": "5570694307c64ab2a5f24d27221edba8",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 169,
"avg_line_length": 42.933734939759034,
"alnum_prop": 0.7536130209064122,
"repo_name": "NUTIEisBADYT/NUTIEisBADYTS-PD2-Modpack",
"id": "45afb80ea54249308e851e00abd595fe18d44341",
"size": "7127",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Full Speed Swarm/lua/playermanager.lua",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Lua",
"bytes": "277787"
}
],
"symlink_target": ""
} |
namespace NutzCode.CloudFileSystem.Plugins.OneDrive
{
public class OneDriveRoot : OneDriveDirectory
{
public override string Id => "";
internal string FsName=string.Empty;
public OneDriveRoot(OneDriveFileSystem fs) : base(string.Empty, fs)
{
IsRoot = true;
}
public override string Name => FsName;
}
}
| {
"content_hash": "45bb24cbb24024db0ae5c8e297d01fdb",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 20.05263157894737,
"alnum_prop": 0.6167979002624672,
"repo_name": "maxpiva/CloudFileSystem",
"id": "9402405947ece7aedf1e792f683a4fb830e02cb3",
"size": "383",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "NutzCode.CloudFileSystem.Plugins.OneDrive/OneDriveRoot.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "226128"
}
],
"symlink_target": ""
} |
require "./models/super/Screen"
require "./models/screens/GameScreen"
class GameOverScreen < Screen
def initialize(window)
super(window)
@font = Gosu::Font.new(@window, "System", 36)
end#initialize
def activeUpdate
if @window.button_down?(Gosu::KbSpace)
@window.screenManager.setScreen "gameScreen", GameScreen.new(@window)
@window.screenManager.activate "gameScreen"
end
end#activeUpdate
def activeDraw
@font.draw("Game Over", (@window.width / 2) - 90, (@window.height / 2) - 100, 0, 1, 1, 0xff000000)
@font.draw("Score: #{@window.screenManager.getScreen('gameScreen').score}", (@window.width / 2) - 65, (@window.height / 2) - 60, 0, 1, 1, 0xff000000)
@font.draw("Press Space to Replay", (@window.width / 2) - 160, (@window.height / 2) + 50, 0, 1, 1, 0xff000000)
end#activeDraw
end#GameOverScreen | {
"content_hash": "c0ee72b318cee2f6272aa90c8af79ff8",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 151,
"avg_line_length": 33.44,
"alnum_prop": 0.6889952153110048,
"repo_name": "Noah-Huppert/Intro-To-Programming-14-15",
"id": "198c373a0bb51ca2ca80ac471d794f2b704475ad",
"size": "836",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Spikes/models/screens/GameOverScreen.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "32910"
}
],
"symlink_target": ""
} |
"use strict";
exports.__esModule = true;
exports.wrapWithTypes = wrapWithTypes;
exports.getTypes = getTypes;
exports.runtimeProperty = runtimeProperty;
exports.isReference = isReference;
exports.replaceWithOrRemove = replaceWithOrRemove;
var currentTypes = null;
function wrapWithTypes(types, fn) {
return function () {
var oldTypes = currentTypes;
currentTypes = types;
try {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return fn.apply(this, args);
} finally {
currentTypes = oldTypes;
}
};
}
function getTypes() {
return currentTypes;
}
function runtimeProperty(name) {
var t = getTypes();
return t.memberExpression(t.identifier("regeneratorRuntime"), t.identifier(name), false);
}
function isReference(path) {
return path.isReferenced() || path.parentPath.isAssignmentExpression({ left: path.node });
}
function replaceWithOrRemove(path, replacement) {
if (replacement) {
path.replaceWith(replacement);
} else {
path.remove();
}
} | {
"content_hash": "f6a2ccb43fa78bb1c8caaffdecc0952f",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 92,
"avg_line_length": 22.8125,
"alnum_prop": 0.6831050228310502,
"repo_name": "ocadni/citychrone",
"id": "527f9079a05ede8af9b6d7f6c5a6c6287a8acdb7",
"size": "1277",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".build/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/regenerator-transform/lib/util.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "46395"
},
{
"name": "HTML",
"bytes": "18635"
},
{
"name": "JavaScript",
"bytes": "183571"
},
{
"name": "Jupyter Notebook",
"bytes": "72"
},
{
"name": "Shell",
"bytes": "296"
}
],
"symlink_target": ""
} |
<?php
namespace Robo;
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
use Robo\Traits\TestTasksTrait;
class ShortcutTest extends TestCase
{
use TestTasksTrait;
use Task\Filesystem\Tasks;
use Task\Filesystem\Shortcuts;
use Task\Logfile\Tasks;
use Task\Logfile\Shortcuts;
protected $fixtures;
public function setUp(): void
{
$this->fixtures = new Fixtures();
$this->initTestTasksTrait();
$this->fixtures->createAndCdToSandbox();
}
public function tearDown(): void
{
$this->fixtures->cleanup();
}
public function testCopyDirShortcut()
{
// copy dir with _copyDir shortcut
$result = $this->_copyDir('box', 'bin');
$this->assertTrue($result->wasSuccessful(), $result->getMessage());
$this->assertFileExists('bin');
$this->assertFileExists('bin/robo.txt');
}
public function testMirrorDirShortcut()
{
// mirror dir with _mirrorDir shortcut
$result = $this->_mirrorDir('box', 'bin');
$this->assertTrue($result->wasSuccessful(), $result->getMessage());
$this->assertFileExists('bin');
$this->assertFileExists('bin/robo.txt');
}
public function testTruncateLogShortcut()
{
$result = $this->_truncateLog(['box/robo.txt']);
$this->assertTrue($result->wasSuccessful(), $result->getMessage());
$this->assertFileExists('box/robo.txt');
}
public function testRotateLogShortcut()
{
$result = $this->_rotateLog(['box/robo.txt']);
$this->assertTrue($result->wasSuccessful(), $result->getMessage());
$this->assertFileExists('box/robo.txt');
}
}
| {
"content_hash": "17a669185e45eb94db0e106edb6abb9a",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 75,
"avg_line_length": 28.166666666666668,
"alnum_prop": 0.6218934911242604,
"repo_name": "Codegyre/Robo",
"id": "0555f24adb138765cb73047acb411fc0aed53a1c",
"size": "1690",
"binary": false,
"copies": "2",
"ref": "refs/heads/consolidation-log-3",
"path": "tests/integration/ShortcutTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "360949"
}
],
"symlink_target": ""
} |
package org.broadinstitute.sting.gatk.datasources.rmd;
/**
* Models the entire stream of data.
*/
class EntireStream implements DataStreamSegment {
}
| {
"content_hash": "9f6c21786699813e2f0088dc4042b47f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 54,
"avg_line_length": 17.22222222222222,
"alnum_prop": 0.7612903225806451,
"repo_name": "iontorrent/Torrent-Variant-Caller-stable",
"id": "d5b887295cee321b9e406cd9c21bd60cc8ca6813",
"size": "1285",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/java/src/org/broadinstitute/sting/gatk/datasources/rmd/EntireStream.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "13702"
},
{
"name": "C++",
"bytes": "93650"
},
{
"name": "Java",
"bytes": "7434523"
},
{
"name": "JavaScript",
"bytes": "25002"
},
{
"name": "Perl",
"bytes": "6761"
},
{
"name": "Python",
"bytes": "1510"
},
{
"name": "R",
"bytes": "37286"
},
{
"name": "Scala",
"bytes": "480437"
},
{
"name": "Shell",
"bytes": "901"
},
{
"name": "XML",
"bytes": "8989"
}
],
"symlink_target": ""
} |
using System.Buffers;
namespace Orleans.Networking.Shared
{
internal sealed class SharedMemoryPool
{
public MemoryPool<byte> Pool { get; } = KestrelMemoryPool.Create();
}
}
| {
"content_hash": "82b33031c27eb912c3e20bf3215afbec",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 75,
"avg_line_length": 21.555555555555557,
"alnum_prop": 0.6958762886597938,
"repo_name": "yevhen/orleans",
"id": "5a4551d21ed3cac112d1d0fc1651bb9d46bb283b",
"size": "194",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "src/Orleans.Core/Networking/Shared/SharedMemoryPool.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "8813"
},
{
"name": "C#",
"bytes": "9832087"
},
{
"name": "F#",
"bytes": "2380"
},
{
"name": "PLSQL",
"bytes": "23892"
},
{
"name": "PLpgSQL",
"bytes": "53037"
},
{
"name": "PowerShell",
"bytes": "2267"
},
{
"name": "Shell",
"bytes": "3708"
},
{
"name": "Smalltalk",
"bytes": "1436"
},
{
"name": "TSQL",
"bytes": "22805"
}
],
"symlink_target": ""
} |
package net.kaczmarzyk;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import net.kaczmarzyk.spring.data.jpa.Customer;
import net.kaczmarzyk.spring.data.jpa.CustomerRepository;
import net.kaczmarzyk.spring.data.jpa.domain.GreaterThanOrEqual;
import net.kaczmarzyk.spring.data.jpa.domain.LessThanOrEqual;
import net.kaczmarzyk.spring.data.jpa.web.annotation.And;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author Tomasz Kaczmarzyk
*/
public class ComparableE2eTest extends E2eTestBase {
@Controller
public static class ComparableSpecsController {
@Autowired
CustomerRepository customerRepo;
@RequestMapping(value = "/comparable/customers", params = { "nameAfter", "nameBefore"})
@ResponseBody
public Object findCustomersByNameRange(
@And({
@Spec(path="firstName", params="nameAfter", spec=GreaterThanOrEqual.class),
@Spec(path="firstName", params="nameBefore", spec=LessThanOrEqual.class)
}) Specification<Customer> spec) {
return customerRepo.findAll(spec);
}
@RequestMapping(value = "/comparable/customers", params = { "registeredAfter", "registeredBefore"})
@ResponseBody
public Object findCustomersByRegistrationDateRange(
@And({
@Spec(path="registrationDate", params="registeredAfter", spec=GreaterThanOrEqual.class),
@Spec(path="registrationDate", params="registeredBefore", spec=LessThanOrEqual.class)
}) Specification<Customer> spec) {
return customerRepo.findAll(spec);
}
@RequestMapping(value = "/comparable/customers2", params = { "registeredAfter", "registeredBefore"})
@ResponseBody
public Object findCustomersByRegistrationDateRange_customDateFormat(
@And({
@Spec(path="registrationDate", params="registeredAfter", spec=GreaterThanOrEqual.class, config = { "dd.MM.yyyy" }),
@Spec(path="registrationDate", params="registeredBefore", spec=LessThanOrEqual.class, config = { "dd.MM.yyyy" })
}) Specification<Customer> spec) {
return customerRepo.findAll(spec);
}
}
@Test
public void findsByNameRange() throws Exception {
mockMvc.perform(get("/comparable/customers")
.param("nameAfter", "Homer")
.param("nameBefore", "Mah")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$[0].firstName").value("Homer"))
.andExpect(jsonPath("$[1].firstName").value("Lisa"))
.andExpect(jsonPath("$[2].firstName").value("Maggie"))
.andExpect(jsonPath("$[3]").doesNotExist());
}
@Test
public void filtersByRegistrationDateRange_defaultDateFormat() throws Exception {
mockMvc.perform(get("/comparable/customers")
.param("registeredAfter", "2014-03-20")
.param("registeredBefore", "2014-03-26")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$[0].firstName").value("Marge"))
.andExpect(jsonPath("$[1].firstName").value("Bart"))
.andExpect(jsonPath("$[2].firstName").value("Ned"))
.andExpect(jsonPath("$[3]").doesNotExist());
}
@Test
public void filtersByRegistrationDateRange_customDateFormat() throws Exception {
mockMvc.perform(get("/comparable/customers2")
.param("registeredAfter", "20.03.2014")
.param("registeredBefore", "26.03.2014")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$[0].firstName").value("Marge"))
.andExpect(jsonPath("$[1].firstName").value("Bart"))
.andExpect(jsonPath("$[2].firstName").value("Ned"))
.andExpect(jsonPath("$[3]").doesNotExist());
}
}
| {
"content_hash": "2761a4c0b5a6028d570032edfd73c34e",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 120,
"avg_line_length": 38.678899082568805,
"alnum_prop": 0.7371916508538899,
"repo_name": "DmRomantsov/specification-arg-resolver",
"id": "bf0fa8b3929635d8f20351f4fa7861277c963e93",
"size": "4832",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/net/kaczmarzyk/ComparableE2eTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "318233"
}
],
"symlink_target": ""
} |
<?php
namespace App\Http\Controllers;
use Auth;
class OAuthController extends Controller
{
public function verify($username, $password){
$credentials = [
'username' => $username,
'password' => $password,
];
if (Auth::once($credentials)) {
return Auth::user()->id;
} else {
return false;
}
}
}
| {
"content_hash": "902d00b837a24a7dfbc5b69b0d289adc",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 46,
"avg_line_length": 14.636363636363637,
"alnum_prop": 0.6366459627329193,
"repo_name": "umar-ahmed/AnimalServicesAPI",
"id": "63e94d52abdb84d44b018478575a7f01f01d9ea7",
"size": "322",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Http/Controllers/OAuthController.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "553"
},
{
"name": "HTML",
"bytes": "1104"
},
{
"name": "JavaScript",
"bytes": "503"
},
{
"name": "PHP",
"bytes": "125634"
}
],
"symlink_target": ""
} |
#include "GSlide.h"
#include "GColor.h"
class BlueSlide : public GSlide {
protected:
virtual void onDraw(GContext* ctx) {
ctx->clear(GColor::Make(1, 0, 0, 1));
}
virtual const char* onName() {
return "blue";
}
public:
static GSlide* Create(void*) {
return new BlueSlide;
}
};
GSlide::Registrar BlueSlide_reg(BlueSlide::Create);
| {
"content_hash": "51e9eac5f10956f061b715d5b187a557",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 51,
"avg_line_length": 17.363636363636363,
"alnum_prop": 0.6099476439790575,
"repo_name": "schuylerkylstra/MyDemoCode",
"id": "9d97a18de7fd08f713f7c907ac91e82f1ef8bc09",
"size": "447",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "2DGraphics/final/final/apps/slide/slide_blue.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "33466"
},
{
"name": "C++",
"bytes": "549465"
},
{
"name": "Makefile",
"bytes": "426"
},
{
"name": "Objective-C",
"bytes": "3555"
}
],
"symlink_target": ""
} |
=============================
dj-bgfiles
=============================
.. image:: https://badge.fury.io/py/dj-bgfiles.png
:target: https://badge.fury.io/py/dj-bgfiles
.. image:: https://travis-ci.org/climapulse/dj-bgfiles.png?branch=master
:target: https://travis-ci.org/climapulse/dj-bgfiles
Generate files in the background and allow users to pick them up afterwards using a token.
Documentation
-------------
The "full" documentation is at https://dj-bgfiles.readthedocs.org.
Quickstart
----------
First ensure you're using Django 1.8.4 or up. Next, install dj-bgfiles::
pip install dj-bgfiles
Add it your ``INSTALLED_APPS`` and make sure to run the ``migrate`` command to create the necessary tables.
Features
--------
The most common use case is delivering sizeable data exports or complex reports to users without overloading the web
server, which is why ``bgfiles`` provides tools to:
- Store a file generation/download request
- Process that request later on, e.g. by using Celery or a cron job
- Send a notification to the requester including a secure link to download the file
- And serving the file to the requester (or others if applicable)
Example
-------
In our hypothetical project we want to provide users with the option to generate an xlsx file containing login events. Here's our model::
class LoginEvent(models.Model):
user = models.ForeignKey(User, blank=True, null=True)
succeeded = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True)
def save(self, *args, **kwargs):
self.succeeded = True if self.user_id else False
super(LoginEvent, self).save(*args, **kwargs)
Our export allows a user to specify a timeframe through a form::
class LoginExportFilterForm(models.Model):
from_date = models.DateField()
until_date = models.DateField(required=False)
def apply_filters(self, queryset):
"""Apply the filters to our initial queryset."""
data = self.cleaned_data
queryset = queryset.filter(created_at__gte=data['from_date'])
until_date = data.get('until_date')
if until_date:
queryset = queryset.filter(created_at__lte=until_date)
return queryset
So our view would look like this initially::
def export_login_events(request):
if request.method == 'POST':
form = LoginExportFilterForm(data=request.POST)
if form.is_valid():
# Grab our events
events = LoginEvent.objects.all()
# Apply the filters the user supplied
events = form.apply_filters(events)
# And write everything to an xlsx file and serve it as a HttpResponse
return write_xlsx(events)
else:
form = LoginExportFilterForm()
return render(request, 'reports/login_events_filter.html', context={'form': form})
But overnight, as it happens, our app got really popular so we have a ton of login events. We want to offload the
creation of large files to a background process that'll send a notification to the user when the file's ready with a
link to download it.
Enter ``bgfiles``.
Manually, using a Celery task
#############################
Here's how we could handle this manually using our ``toolbox`` and a Celery task::
from bgfiles import toolbox
def export_login_events(request):
if request.method == 'POST':
form = LoginExportFilterForm(data=request.POST)
if form.is_valid():
# Grab our events
events = LoginEvent.objects.all()
# Apply the filters the user supplied
events = form.apply_filters(events)
# We want to limit online file creation to at most 10000 events
max_nr_events = 10000
nr_events = events.count()
if nr_events <= max_nr_events:
# Ok, deliver our file to the user
return write_xlsx(events)
# The file would be too big. So let's grab our criteria
criteria = request.POST.urlencode()
# The content type is optional
content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
# Now add a file request
with transaction.atomic():
file_request = toolbox.add_request(criteria, file_type='login_events',
requester=request.user, content_type=content_type)
# Schedule a Celery task
export_login_events_task.delay(file_request.id)
# And let the user know we'll get back to them on that
context = {'nr_events': nr_events, 'max_nr_events': max_nr_events}
return render(request, 'reports/delayed_response.html', context=context)
else:
form = LoginExportFilterForm()
return render(request, 'reports/login_events_filter.html', context={'form': form})
When we add a file request, we first marshall our criteria to something our database can store and we can easily
unmarshall later on. We specify a file type to support requests for different types of files and also record the
user that requested the file. The default ``bgfiles`` logic assumes only the user performing the request should be
able to download the file later on.
Anyway, our Celery task to create the file in the background might look like this::
from bgfiles.models import FileRequest
from django.http import QueryDict
@task
def export_login_events_task(file_request_id):
# Grab our request. You might want to lock it or check if it's already been processed in the meanwhile.
request = FileRequest.objects.get(id=file_request_id)
# Restore our criteria
criteria = QueryDict(request.criteria)
# Build our form and apply the filters as specified by the criteria
form = LoginExportFilterForm(data=criteria)
events = LoginEvent.objects.all()
events = form.apply_filters(events)
# Write the events to an xlsx buffer (simplified)
contents = write_xlsx(events)
# Attach the contents to the request and add a filename
toolbox.attach_file(request, contents, filename='login_events.xlsx'):
# Generate a token for the requester of the file
token = toolbox.create_token(request)
# Grab the download url including our token
download_url = reverse('mydownloads:serve', kwargs={'token': token})
# And send out an email containing the link
notifications.send_file_ready(request.requester, download_url, request.filename)
It should be pretty obvious what the above code is doing. Note that restoring our criteria is easy: we simply
instantiate a QueryDict. Yes, there's a bit of code duplication. We'll get to that later on.
Manually, using a cron job
##########################
Let's defer the generation to a cron job that will send out an email to our user. Our view would look the same, except
we won't schedule a Celery task. Our cron logic then might look like this::
from bgfiles import toolbox
from bgfiles.models import FileRequest
from django.http import QueryDict
def process_file_requests():
# Only grab the requests that still need to be processed
requests = FileRequest.objects.to_handle()
# Process each one by delegating to a specific handler
for request in requests:
if request.file_type == 'login_events':
process_login_events(request)
elif request.file_type == 'something_else:
process_something_else(request)
else:
raise Exception('Unsupported file type %s' % request.file_type)
def process_login_events(request):
# Restore our criteria
criteria = QueryDict(request.criteria)
# Build our form and apply the filters as specified by the criteria
form = LoginExportFilterForm(data=criteria)
events = LoginEvent.objects.all()
events = form.apply_filters(events)
# Write the events to an xlsx buffer (simplified)
contents = write_xlsx(events)
# Attach the contents to the request and add a filename
toolbox.attach_file(request, contents, filename='login_events.xlsx'):
# Generate a token for the requester of the file
token = toolbox.create_token(request)
# Get the download url
download_url = reverse('mydownloads:serve', kwargs={'token': token})
# Send out an email containing the link
notifications.send_file_ready(request.requester, download_url, request.filename)
Add a management command to call ``process_file_requests``, drop it in crontab and you're good to go.
But wait! There's more!
Using the FullPattern
#####################
``bgfiles`` includes common patterns to structure your logic and minimize the code duplication. As you can see above
their usage is entirely optional.
In this example we'll use the ``bgfiles.patterns.FullPattern`` to render a template response when the file creation is
delayed and send out an email notification when the file is ready.
Here's our export handler class::
class LoginEventExport(FullPattern):
# These can all be overridden by get_* methods, e.g. get_file_type
file_type = 'login_events'
content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
delayed_template_name = 'reports/delayed_response.html'
email_subject = _('File %(filename)s is ready!')
email_text_message = _('Come and get it: %(download_url)s')
def get_items(self, criteria):
# Our default criteria class provides the request's QueryDict (e.g. request.POST) as `raw` and the
# requester as `user`. This method is used for both online and offline selection of the items we want to
# use.
form = LoginExportFilterForm(data=criteria.raw)
if not form.is_valid():
# If the form is invalid we raise an exception so our view knows about it and can show the errors.
# If the form became invalid while we're offline... well, that shouldn't happen.
raise InvalidForm(form=form)
# Valid form: apply our filters and return our events
return form.apply_filters(LoginEvent.objects.all())
def evaluate_dataset(self, dataset, http_request):
# When we've got our dataset, including our criteria and items, we need to evaluate whether we can
# deliver it right now or need to delay it. Let's use our magic number.
# Note that this is only called during an HTTP request.
dataset.delay = dataset.items.count() > 10000
def write_bytes(self, dataset, buffer):
# This is where we write our dataset to the buffer. What goes on in here depends on your dataset, type of
# file and so on.
Now let's adapt our view to use it::
def export_login_events(request):
if request.method == 'POST':
try:
delayed, response = LoginEventExport('login-events.xlsx').respond_to(request)
return response
except InvalidForm as exc:
form = exc.form
else:
form = LoginExportFilterForm()
return render(request, 'reports/login_events_filter.html', context={'form': form})
Here's what happening:
1. We let our export class handle the response when it's a POST request
2. It builds our dataset by wrapping the criteria (so we can use the same thing for both online and offline file generation) and fetching the items using ``get_items`` based on those criteria
3. It then lets you evaluate the dataset to decide on what to do next
If we don't delay the file creation, the pattern will write our bytes to a ``HttpResponse`` with the specified filename and content type.
But when we *do* delay the creation, it will:
1. Add a ``bgfiles.models.FileRequest`` to the database
2. Ask you to schedule the request using its ``schedule`` method
3. Respond with a template response using the ``delayed_template_name``
The ``schedule`` method does nothing by default, but if you use the included management command you can still have a cron
job process the outstanding requests automatically. If you prefer to use Celery, you can use the ``bgfiles.patterns.celery.ScheduleWithCeleryPattern``
class instead. It subclasses the ``FullPattern`` class.
This has our online part covered, but we still need to adapt our cron job. Here's what's left of it using the pattern::
def process_login_events(request):
LoginEventExport(request.filename).create_file(request)
That's it. The default implementation of ``create_file`` will:
1. Restore our criteria using the ``criteria_class`` specified on our exporter
2. Call ``get_items`` using those criteria
3. Call ``write_bytes`` to generate the file contents
4. Hook up the contents to our ``FileRequest`` and mark it as finished
5. Send out an email notification to the requester
But we can still improve. Read on!
Using the management command
############################
The included management command ``bgfiles`` allows you to clean up expired file requests, whether you use the included patterns or not::
$ python manage.py bgfiles clean --timeout=60 --sleep=1
The above command will clean expired file requests, but will stop after a minute (or close enough) and go to sleep
for a second in between requests. By default it will also ignore file requests that have expired less than an
hour ago as to not interrupt any ongoing last-minute downloads. You can override this using the ``--leeway`` parameter.
You can also use the management command to process outstanding requests. To do this you'll need to register your
exporter in the registry::
from bgfiles.patterns import FullPattern, registry
class LoginEventExport(FullPattern):
# Same as above
# Register our class to process requests for our file type.
# You might want to place this in your AppConfig.ready.
registry.register(LoginEventExport, [LoginEventExport.file_type])
Now all that's needed to process file requests is to call the management command::
$ python manage.py bgfiles process --sleep=1 --timeout=600 --items=20
This will process our outstanding requests by looking up the correct handler in the registry and calling the handler's ``handle``
classmethod which by default will restore a class instance (using the pattern's ``restore`` classmethod) and call its
``create_file`` method.
Serving the file
################
We've included a view you can use to serve the file. It will verify the token is valid, not expired and, by default,
check that the accessing user is also the user that requested the file. It doesn't provide any decent error messages
in case something is wrong, so you might want to wrap it with your own view::
from bgfiles.views import serve_file, SuspiciousToken, SignatureHasExpired, UserIsNotRequester
def serve(request, token):
try:
return serve_file(request, token, require_requester=True, verify_requester=True)
except SuspiciousToken:
# The token is invalid.
# You could reraise this so Django can warn you about this suspicious operation
return render(request, 'errors/naughty.html')
except SignatureHasExpired:
# Actually a subclass of PermissionDenied.
# But you might want to inform the user they're a bit late to the party.
return render(request, 'errors/signature_expired.html')
except UserIsNotRequester:
# Also a PermissionDenied subclass.
# So the user's email was intercepted or they forwarded the mail to someone else.
# Set verify_requester to False to disable this behavior.
return render(request, 'errors/access_denied.html')
Allowing anyone to access a file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That is anyone with a valid token. By default ``bgfiles`` will assume you only want to serve a file to the user that
requested it. If you want to serve the file to anyone with a valid token it's just as easy.
Manually
~~~~~~~~
In our manual example we used ``toolbox.create_token`` to create our token. This embeds the id of the requester in the
token. To create a token anyone can use, use ``toolbox.create_general_token`` instead. Of course, the other token can
also be used by anyone because the verification is done in the view::
# When we only want to serve the file to the requester, we use this:
serve_file(request, token, require_requester=True, verify_requester=True)
# When we want to serve the file to anyone, we use this:
serve_file(request, token, require_requester=False, verify_requester=False)
Using patterns
~~~~~~~~~~~~~~
You can tell the pattern to use "general" tokens by setting the ``requester_only`` class variable to ``False`` or
by letting the ``is_requester_only`` method return ``False``. The changes to the view are the same as above.
Changing the signer
^^^^^^^^^^^^^^^^^^^
By default ``bgfiles`` uses Django's signing module to handle tokens. Configuring the signer can be done by changing settings:
- ``BGFILES_DEFAULT_KEY``: defaults to ``SECRET_KEY``
- ``BGFILES_DEFAULT_SALT``: defaults to ``bgfiles``. **We recommend specifying your own salt.**
- ``BGFILES_DEFAULT_SERIALIZER``: defaults to the ``JSONSerializer`` class included in the toolbox
- ``BGFILES_DEFAULT_MAX_AGE``: defaults to 86400 seconds (or a day)
If you need a custom default `Signer`, you can set ``BGFILES_DEFAULT_SIGNER`` to an instance of your signer class.
Of course, you should think about when to use the default signing method and settings and when to deviate and use a
custom one. Just be sure to use the same signer configuration when creating a token and when accepting a token::
token = toolbox.create_token(request, signer=my_signer)
# And in your view
def serve(request, token):
try:
return serve_file(request, token, require_requester=True, verify_requester=True, signer=my_signer)
except Stuff:
# Error handling goes here
Specifying a custom signer on a pattern class::
class MyExporter(FullPattern):
signer = my_signer
Or::
class MyExporter(FullPattern):
def get_signer(self):
return my_signer
| {
"content_hash": "ce5a6f95b31eee9b738177d18558615a",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 191,
"avg_line_length": 44.59047619047619,
"alnum_prop": 0.6793037163605297,
"repo_name": "climapulse/dj-bgfiles",
"id": "630bafb297658c9bc40d77be8fb21de545aa54b0",
"size": "18728",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.rst",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Makefile",
"bytes": "1247"
},
{
"name": "Python",
"bytes": "89794"
}
],
"symlink_target": ""
} |
package stainless.genc
import stainless.extraction.utils._
class NamedLeonPhase[F, T](val name: String,
val underlying: LeonPipeline[F, T])
(using context: inox.Context) extends LeonPipeline[F, T](context) {
lazy val phases = context.options.findOption(optDebugPhases).map(_.toSet)
lazy val debugTrees: Boolean =
(phases.isEmpty || phases.exists(_.contains(name))) &&
context.reporter.debugSections.contains(DebugSectionTrees)
lazy val debugSizes: Boolean =
(phases.isEmpty || phases.exists(_.contains(name))) &&
context.reporter.debugSections.contains(DebugSectionSizes)
private given givenDebugSection: DebugSectionTrees.type = DebugSectionTrees
override def run(p: F): T = {
if (debugTrees) {
context.reporter.debug("\n" * 2)
context.reporter.debug("=" * 100)
context.reporter.debug(s"Running phase $name on:\n")
context.reporter.debug(p)
}
val res = context.timers.genc.get(name).run {
underlying.run(p)
}
if (debugTrees) {
context.reporter.debug("\n")
context.reporter.debug("-" * 100)
context.reporter.debug(s"Finished running phase $name:\n")
context.reporter.debug(res)
context.reporter.debug("=" * 100)
context.reporter.debug("\n" * 4)
}
if (debugSizes) {
val lines = res.toString.count(_ == '\n') + 1
val size = res match {
case symbols: stainless.extraction.throwing.trees.Symbols => symbols.astSize
case prog: ir.IRs.SIR.Prog => prog.size
case prog: ir.IRs.CIR.Prog => prog.size
case prog: ir.IRs.RIR.Prog => prog.size
case prog: ir.IRs.NIR.Prog => prog.size
case prog: ir.IRs.LIR.Prog => prog.size
case prog: CAST.Tree => prog.size
case _ => 0
}
context.reporter.debug(s"Total number of lines after phase $name: $lines")(using DebugSectionSizes)
context.reporter.debug(s"Total number of AST nodes after phase $name: $size")(using DebugSectionSizes)
}
res
}
}
abstract class UnitPhase[T](context: inox.Context) extends LeonPipeline[T, T](context) {
def apply(p: T): Unit
override def run(p: T) = {
apply(p)
p
}
}
object NoopPhase {
def apply[T](using ctx: inox.Context): LeonPipeline[T, T] =
new LeonPipeline[T, T](ctx) {
override def run(v: T) = v
}
}
| {
"content_hash": "2b230a3c689b2489bfb8d14e63372425",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 108,
"avg_line_length": 32.64383561643836,
"alnum_prop": 0.6374318086445657,
"repo_name": "epfl-lara/stainless",
"id": "681a6dc0e2562988627b77b2206f5c2259075a46",
"size": "2423",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "core/src/main/scala/stainless/genc/LeonPhase.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "206"
},
{
"name": "CSS",
"bytes": "46032"
},
{
"name": "Coq",
"bytes": "37167"
},
{
"name": "Dockerfile",
"bytes": "683"
},
{
"name": "HTML",
"bytes": "4276517"
},
{
"name": "JavaScript",
"bytes": "49474"
},
{
"name": "Nix",
"bytes": "277"
},
{
"name": "Python",
"bytes": "2117"
},
{
"name": "Scala",
"bytes": "3396410"
},
{
"name": "Shell",
"bytes": "22068"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace ExpressMapper
{
public interface ITypeMapper
{
Expression QueryableGeneralExpression { get; }
Func<object, object, object> GetNonGenericMapFunc();
Tuple<List<Expression>, ParameterExpression, ParameterExpression> GetMapExpressions();
void Compile(CompilationTypes compilationtype, bool forceByDemand = false);
}
/// <summary>
/// Interface that implements internals of mapping
/// </summary>
/// <typeparam name="T">source</typeparam>
/// <typeparam name="TN">destination</typeparam>
public interface ITypeMapper<T, TN> : ITypeMapper
{
Expression<Func<T, TN>> QueryableExpression { get; }
TN MapTo(T src, TN dest);
void Ignore<TMember>(Expression<Func<TN, TMember>> left);
void Ignore(PropertyInfo left);
void CaseSensetiveMemberMap(bool caseSensitive);
void CompileTo(CompilationTypes compileType);
void MapMember<TMember, TNMember>(Expression<Func<TN, TNMember>> left, Expression<Func<T, TMember>> right);
void MapMemberFlattened(MemberExpression left, Expression right);
void MapFunction<TMember, TNMember>(Expression<Func<TN, TNMember>> left, Func<T, TMember> right);
void InstantiateFunc(Func<T,TN> constructor);
void Instantiate(Expression<Func<T,TN>> constructor);
void BeforeMap(Action<T,TN> beforeMap);
void AfterMap(Action<T,TN> afterMap);
void Flatten();
CompilationTypes MapperType { get; }
}
}
| {
"content_hash": "622ccf69f0e256e51bbb5cae49da9e5b",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 115,
"avg_line_length": 41.53846153846154,
"alnum_prop": 0.6895061728395062,
"repo_name": "bo-stig-christensen/ExpressMapper",
"id": "a24247f759bafe713b770425e15e343f1c5f8698",
"size": "1622",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ExpressMapper NET40/ITypeMapper.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "487771"
}
],
"symlink_target": ""
} |
<?php
// process image
// code modifed from :
// http://php.net/manual/en/function.imagesetpixel.php */
//
$input = stream_get_line(STDIN, 1000000);
$input = trim($input, "\n"); // remove last carrage return if passed
// check arguments
if (count($input) == 0 || count($argv) < 2)
{
echo "Error; No data passed or argument provided\n";
echo " Syntax; \"printf <binary data> | php binary_to_image.php <output filename>\" \n";
return;
}
// check binary
$regex = "/[^01\\n]+/";
if (preg_match($regex, $input)) {
echo "Error; non-binary data found in stream.\n";
return;
}
// check rows
$arr = explode("\n", $input);
foreach($arr as $curLine => $lineElement) {
echo strlen($lineElement) . " - " .strlen($arr[1]);
if(strlen($lineElement) != strlen($arr[1])) {
echo "Error; not all row lengths are equal.\n";
return;
}
}
// process image stream
$image = imagecreate(strlen($arr[1]), count($arr));
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$black = imagecolorallocate($image, 0x00, 0x00, 0x00);
foreach($arr as $curLine => $lineElement) {
foreach($lineSplit as $pixelkey => $pixelElement) {
if ($pixelElement == "1")
imagesetpixel($image, $pixelkey-1, $curLine, $black);
}
}
imagepng($image, $argv[1]);
imagedestroy($image);
?>
| {
"content_hash": "6fc3221559c3c775ce3393bb6683e674",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 94,
"avg_line_length": 26.62,
"alnum_prop": 0.613824192336589,
"repo_name": "richardagreene/CSG6206-Porfolio",
"id": "9b9a41186478d8c0dfe459fef4d12bac854ab865",
"size": "1331",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Workshop8/binary_to_image.php",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "JavaScript",
"bytes": "1847"
},
{
"name": "PHP",
"bytes": "10137"
},
{
"name": "Perl",
"bytes": "1427"
},
{
"name": "Ruby",
"bytes": "2347"
},
{
"name": "Shell",
"bytes": "5283"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="popup.css">
</head>
<body>
<button id="all-gyms">⚡ All <div class="gold"></div> Gyms ⚡</button>
<button id="show3"><div class="gold"></div><div class="gold"></div><div class="gold"></div></button>
<button id="show4"><div class="gold"></div><div class="gold"></div><div class="gold"></div><div class="gold"></div></button>
<script type="text/javascript" src="popup.js"></script>
</body>
</html> | {
"content_hash": "f5f5800cafeb24bed079d5de42749b1d",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 126,
"avg_line_length": 41.916666666666664,
"alnum_prop": 0.6182902584493042,
"repo_name": "DemonKart/GymhuntrRaids",
"id": "e8b91d72f5f4656a0310a007e0c35d9b3c0e4b4f",
"size": "503",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "popup.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "290"
},
{
"name": "HTML",
"bytes": "503"
},
{
"name": "JavaScript",
"bytes": "4563"
}
],
"symlink_target": ""
} |
export declare const VERSION = "2.8.0";
| {
"content_hash": "3130087202e1321519fc340d2728b2a2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 39,
"avg_line_length": 40,
"alnum_prop": 0.7,
"repo_name": "Ruben-Sten/TeXiFy-IDEA",
"id": "c11abe893dcc6c43128e37398a851381af8a61ff",
"size": "40",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".github/actions/insert-youtrack-link/node_modules/@octokit/plugin-paginate-rest/dist-types/version.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "16907"
},
{
"name": "Java",
"bytes": "174906"
},
{
"name": "Kotlin",
"bytes": "787349"
},
{
"name": "Lex",
"bytes": "7440"
},
{
"name": "Python",
"bytes": "919"
}
],
"symlink_target": ""
} |
% ----------------------------------------------------------------------- %
% Copyright (c) <2015>, <Terence Macquart>
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% 1. Redistributions of source code must retain the above copyright notice, this
% list of conditions and the following disclaimer.
% 2. 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.
%
% 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.
%
% The views and conclusions contained in the software and documentation are those
% of the authors and should not be interpreted as representing official policies,
% either expressed or implied, of the FreeBSD Project.
% ----------------------------------------------------------------------- %
%
%
% ===== ====
% Calculates individual fitness based on Lamination
% parameters RMS error and max absolute error
%
% Fitness = RMSE_MaxAE_LP(LP,Objectives)
%
% ===== ====
function Fitness = RMSE_MaxAE_LP(LP,Objectives)
LP2Match = reshape(cell2mat(Objectives.Table(2:end,3)),12,size(Objectives.Table,1)-1);
ScalingCoef = reshape(cell2mat(Objectives.Table(2:end,4)),12,size(Objectives.Table,1)-1);
Nlam = size(LP2Match,2);
localFit = zeros(Nlam,1);
for ilam = 1 : Nlam
Error = (LP2Match(:,ilam) - LP(:,ilam)).*ScalingCoef(:,ilam);
localFit(ilam) = rms(Error) + max(abs(Error));
end
Fitness = sum(localFit)/Nlam;
end | {
"content_hash": "5a6cff85e8a0c5148fcd8d78661ed06e",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 105,
"avg_line_length": 50.53846153846154,
"alnum_prop": 0.632800608828006,
"repo_name": "TMacquart/OptiBLESS",
"id": "b02f96a6781f8178f22224be776cb5932df3c548",
"size": "2628",
"binary": false,
"copies": "1",
"ref": "refs/heads/Release-1.1.0",
"path": "FitnessFcts/RMSE_MaxAE_LP.m",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "MATLAB",
"bytes": "211006"
}
],
"symlink_target": ""
} |
<?php
/*
*
*/
namespace RDF\JobDefinitionFormatBundle\Model\JDF\Process\PrePress;
use Doctrine\OXM\Mapping as OXM;
/**
* RDF\JobDefinitionFormatBundle\Model\JDF\Process\PrePress\DieDesign
*
* @OXM\XmlEntity(xml="DieDesign")
*/
class DieDesign
{
} | {
"content_hash": "e60143e06de30232ec90a1031488e219",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 69,
"avg_line_length": 14.222222222222221,
"alnum_prop": 0.73046875,
"repo_name": "richardfullmer/RDFJobDefinitionFormatBundle",
"id": "5bf2fa24cd9feb09b799521f51e9ca9bc1638277",
"size": "256",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Model/JDF/Process/PrePress/DieDesign.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "420732"
}
],
"symlink_target": ""
} |
======
Events
======
These examples show you how to create, bind, listen to, and use events in your
applications.
.. toctree::
:maxdepth: 1
binding_events
| {
"content_hash": "eb2b2124583a4eaeba62f482b44d1b37",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 79,
"avg_line_length": 13.833333333333334,
"alnum_prop": 0.6506024096385542,
"repo_name": "jeffblack360/mojito",
"id": "6cc154e6fc66710e78cf6211719d6e55087ab633",
"size": "166",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "docs/dev_guide/code_exs/events.rst",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "71546"
},
{
"name": "JavaScript",
"bytes": "2724195"
},
{
"name": "Python",
"bytes": "72465"
},
{
"name": "Ruby",
"bytes": "32"
},
{
"name": "Shell",
"bytes": "675"
}
],
"symlink_target": ""
} |
layout: page
title: Herrera Trade Conference
date: 2016-05-24
author: Daniel Krueger
tags: weekly links, java
status: published
summary: Donec imperdiet egestas ullamcorper. Integer.
banner: images/banner/people.jpg
booking:
startDate: 11/15/2019
endDate: 11/19/2019
ctyhocn: AVPHDHX
groupCode: HTC
published: true
---
Maecenas laoreet justo orci, rhoncus blandit urna auctor in. Sed consectetur id eros vel facilisis. Nullam interdum sapien fringilla malesuada posuere. Sed sed neque ipsum. Nulla feugiat elit at purus hendrerit pretium. Proin eget urna nisl. Mauris suscipit eros vitae mi lobortis, id fermentum ipsum maximus. Donec varius neque ac ullamcorper accumsan. Etiam sit amet velit ut leo cursus bibendum non eu odio. Nullam laoreet fermentum tellus mollis hendrerit. Curabitur sit amet mi mauris. Donec at erat dapibus dui malesuada venenatis. Phasellus fringilla eros ullamcorper auctor suscipit. Pellentesque tempor felis ac ex aliquet iaculis.
Duis sed egestas diam. Cras accumsan, libero eu tincidunt placerat, justo urna tempus lorem, eget blandit dui turpis a eros. Vivamus vel elementum libero. Phasellus sed mauris et odio maximus porttitor nec sed lectus. Nunc ac luctus magna. Vivamus eget ornare erat. Integer hendrerit tincidunt nunc, et ullamcorper sem finibus sit amet. Morbi iaculis lobortis sodales.
* Cras viverra elit nec mi consectetur, id tempus elit consectetur
* Duis scelerisque felis ut vehicula dictum
* Mauris molestie urna non lorem posuere ultrices.
Sed id malesuada dui. Etiam et nunc et nisl ultricies faucibus non sed metus. Suspendisse fermentum luctus faucibus. Phasellus fermentum nunc ullamcorper orci sodales, non mollis eros bibendum. Nunc ultricies magna sit amet ante imperdiet auctor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras consequat massa at purus eleifend rutrum. Integer dapibus quis justo quis mattis. Phasellus quis tellus suscipit, luctus augue a, tincidunt magna.
| {
"content_hash": "3e8151aa5cddb360964aeba5835223f4",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 640,
"avg_line_length": 85.08695652173913,
"alnum_prop": 0.8140010219724068,
"repo_name": "KlishGroup/prose-pogs",
"id": "d1a65409e3903ed9dbe51a0dc4b83c7e9fbcbdd6",
"size": "1961",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "pogs/A/AVPHDHX/HTC/index.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
/*************************************************************************/
/* primitive_meshes.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef PRIMITIVE_MESHES_H
#define PRIMITIVE_MESHES_H
#include "scene/resources/font.h"
#include "scene/resources/mesh.h"
#include "servers/text_server.h"
///@TODO probably should change a few integers to unsigned integers...
/**
Base class for all the classes in this file, handles a number of code functions that are shared among all meshes.
This class is set apart that it assumes a single surface is always generated for our mesh.
*/
class PrimitiveMesh : public Mesh {
GDCLASS(PrimitiveMesh, Mesh);
private:
RID mesh;
mutable AABB aabb;
AABB custom_aabb;
mutable int array_len = 0;
mutable int index_array_len = 0;
Ref<Material> material;
bool flip_faces = false;
// make sure we do an update after we've finished constructing our object
mutable bool pending_request = true;
void _update() const;
protected:
// assume primitive triangles as the type, correct for all but one and it will change this :)
Mesh::PrimitiveType primitive_type = Mesh::PRIMITIVE_TRIANGLES;
static void _bind_methods();
virtual void _create_mesh_array(Array &p_arr) const {}
void _request_update();
GDVIRTUAL0RC(Array, _create_mesh_array)
public:
virtual int get_surface_count() const override;
virtual int surface_get_array_len(int p_idx) const override;
virtual int surface_get_array_index_len(int p_idx) const override;
virtual Array surface_get_arrays(int p_surface) const override;
virtual TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const override;
virtual Dictionary surface_get_lods(int p_surface) const override;
virtual uint32_t surface_get_format(int p_idx) const override;
virtual Mesh::PrimitiveType surface_get_primitive_type(int p_idx) const override;
virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) override;
virtual Ref<Material> surface_get_material(int p_idx) const override;
virtual int get_blend_shape_count() const override;
virtual StringName get_blend_shape_name(int p_index) const override;
virtual void set_blend_shape_name(int p_index, const StringName &p_name) override;
virtual AABB get_aabb() const override;
virtual RID get_rid() const override;
void set_material(const Ref<Material> &p_material);
Ref<Material> get_material() const;
Array get_mesh_arrays() const;
void set_custom_aabb(const AABB &p_custom);
AABB get_custom_aabb() const;
void set_flip_faces(bool p_enable);
bool get_flip_faces() const;
PrimitiveMesh();
~PrimitiveMesh();
};
/**
Mesh for a simple capsule
*/
class CapsuleMesh : public PrimitiveMesh {
GDCLASS(CapsuleMesh, PrimitiveMesh);
private:
float radius = 0.5;
float height = 2.0;
int radial_segments = 64;
int rings = 8;
protected:
static void _bind_methods();
virtual void _create_mesh_array(Array &p_arr) const override;
public:
static void create_mesh_array(Array &p_arr, float radius, float height, int radial_segments = 64, int rings = 8);
void set_radius(const float p_radius);
float get_radius() const;
void set_height(const float p_height);
float get_height() const;
void set_radial_segments(const int p_segments);
int get_radial_segments() const;
void set_rings(const int p_rings);
int get_rings() const;
CapsuleMesh();
};
/**
A box
*/
class BoxMesh : public PrimitiveMesh {
GDCLASS(BoxMesh, PrimitiveMesh);
private:
Vector3 size = Vector3(1, 1, 1);
int subdivide_w = 0;
int subdivide_h = 0;
int subdivide_d = 0;
protected:
static void _bind_methods();
virtual void _create_mesh_array(Array &p_arr) const override;
public:
static void create_mesh_array(Array &p_arr, Vector3 size, int subdivide_w = 0, int subdivide_h = 0, int subdivide_d = 0);
void set_size(const Vector3 &p_size);
Vector3 get_size() const;
void set_subdivide_width(const int p_divisions);
int get_subdivide_width() const;
void set_subdivide_height(const int p_divisions);
int get_subdivide_height() const;
void set_subdivide_depth(const int p_divisions);
int get_subdivide_depth() const;
BoxMesh();
};
/**
A cylinder
*/
class CylinderMesh : public PrimitiveMesh {
GDCLASS(CylinderMesh, PrimitiveMesh);
private:
float top_radius = 0.5;
float bottom_radius = 0.5;
float height = 2.0;
int radial_segments = 64;
int rings = 4;
bool cap_top = true;
bool cap_bottom = true;
protected:
static void _bind_methods();
virtual void _create_mesh_array(Array &p_arr) const override;
public:
static void create_mesh_array(Array &p_arr, float top_radius, float bottom_radius, float height, int radial_segments = 64, int rings = 4, bool cap_top = true, bool cap_bottom = true);
void set_top_radius(const float p_radius);
float get_top_radius() const;
void set_bottom_radius(const float p_radius);
float get_bottom_radius() const;
void set_height(const float p_height);
float get_height() const;
void set_radial_segments(const int p_segments);
int get_radial_segments() const;
void set_rings(const int p_rings);
int get_rings() const;
void set_cap_top(bool p_cap_top);
bool is_cap_top() const;
void set_cap_bottom(bool p_cap_bottom);
bool is_cap_bottom() const;
CylinderMesh();
};
/*
A flat rectangle, can be used as quad or heightmap.
*/
class PlaneMesh : public PrimitiveMesh {
GDCLASS(PlaneMesh, PrimitiveMesh);
public:
enum Orientation {
FACE_X,
FACE_Y,
FACE_Z,
};
private:
Size2 size = Size2(2.0, 2.0);
int subdivide_w = 0;
int subdivide_d = 0;
Vector3 center_offset;
Orientation orientation = FACE_Y;
protected:
static void _bind_methods();
virtual void _create_mesh_array(Array &p_arr) const override;
public:
void set_size(const Size2 &p_size);
Size2 get_size() const;
void set_subdivide_width(const int p_divisions);
int get_subdivide_width() const;
void set_subdivide_depth(const int p_divisions);
int get_subdivide_depth() const;
void set_center_offset(const Vector3 p_offset);
Vector3 get_center_offset() const;
void set_orientation(const Orientation p_orientation);
Orientation get_orientation() const;
PlaneMesh();
};
VARIANT_ENUM_CAST(PlaneMesh::Orientation)
/*
A flat rectangle, inherits from PlaneMesh but defaults to facing the Z-plane.
*/
class QuadMesh : public PlaneMesh {
GDCLASS(QuadMesh, PlaneMesh);
public:
QuadMesh() {
set_orientation(FACE_Z);
set_size(Size2(1, 1));
}
};
/**
A prism shapen, handy for ramps, triangles, etc.
*/
class PrismMesh : public PrimitiveMesh {
GDCLASS(PrismMesh, PrimitiveMesh);
private:
float left_to_right = 0.5;
Vector3 size = Vector3(1.0, 1.0, 1.0);
int subdivide_w = 0;
int subdivide_h = 0;
int subdivide_d = 0;
protected:
static void _bind_methods();
virtual void _create_mesh_array(Array &p_arr) const override;
public:
void set_left_to_right(const float p_left_to_right);
float get_left_to_right() const;
void set_size(const Vector3 &p_size);
Vector3 get_size() const;
void set_subdivide_width(const int p_divisions);
int get_subdivide_width() const;
void set_subdivide_height(const int p_divisions);
int get_subdivide_height() const;
void set_subdivide_depth(const int p_divisions);
int get_subdivide_depth() const;
PrismMesh();
};
/**
A sphere..
*/
class SphereMesh : public PrimitiveMesh {
GDCLASS(SphereMesh, PrimitiveMesh);
private:
float radius = 0.5;
float height = 1.0;
int radial_segments = 64;
int rings = 32;
bool is_hemisphere = false;
protected:
static void _bind_methods();
virtual void _create_mesh_array(Array &p_arr) const override;
public:
static void create_mesh_array(Array &p_arr, float radius, float height, int radial_segments = 64, int rings = 32, bool is_hemisphere = false);
void set_radius(const float p_radius);
float get_radius() const;
void set_height(const float p_height);
float get_height() const;
void set_radial_segments(const int p_radial_segments);
int get_radial_segments() const;
void set_rings(const int p_rings);
int get_rings() const;
void set_is_hemisphere(const bool p_is_hemisphere);
bool get_is_hemisphere() const;
SphereMesh();
};
/**
Big donut
*/
class TorusMesh : public PrimitiveMesh {
GDCLASS(TorusMesh, PrimitiveMesh);
private:
float inner_radius = 0.5;
float outer_radius = 1.0;
int rings = 64;
int ring_segments = 32;
protected:
static void _bind_methods();
virtual void _create_mesh_array(Array &p_arr) const override;
public:
void set_inner_radius(const float p_inner_radius);
float get_inner_radius() const;
void set_outer_radius(const float p_outer_radius);
float get_outer_radius() const;
void set_rings(const int p_rings);
int get_rings() const;
void set_ring_segments(const int p_ring_segments);
int get_ring_segments() const;
TorusMesh();
};
/**
A single point for use in particle systems
*/
class PointMesh : public PrimitiveMesh {
GDCLASS(PointMesh, PrimitiveMesh)
protected:
virtual void _create_mesh_array(Array &p_arr) const override;
public:
PointMesh();
};
class TubeTrailMesh : public PrimitiveMesh {
GDCLASS(TubeTrailMesh, PrimitiveMesh);
private:
float radius = 0.5;
int radial_steps = 8;
int sections = 5;
float section_length = 0.2;
int section_rings = 3;
Ref<Curve> curve;
void _curve_changed();
protected:
static void _bind_methods();
virtual void _create_mesh_array(Array &p_arr) const override;
public:
void set_radius(const float p_radius);
float get_radius() const;
void set_radial_steps(const int p_radial_steps);
int get_radial_steps() const;
void set_sections(const int p_sections);
int get_sections() const;
void set_section_length(float p_sectionlength);
float get_section_length() const;
void set_section_rings(const int p_section_rings);
int get_section_rings() const;
void set_curve(const Ref<Curve> &p_curve);
Ref<Curve> get_curve() const;
virtual int get_builtin_bind_pose_count() const override;
virtual Transform3D get_builtin_bind_pose(int p_index) const override;
TubeTrailMesh();
};
class RibbonTrailMesh : public PrimitiveMesh {
GDCLASS(RibbonTrailMesh, PrimitiveMesh);
public:
enum Shape {
SHAPE_FLAT,
SHAPE_CROSS
};
private:
float size = 1.0;
int sections = 5;
float section_length = 0.2;
int section_segments = 3;
Shape shape = SHAPE_CROSS;
Ref<Curve> curve;
void _curve_changed();
protected:
static void _bind_methods();
virtual void _create_mesh_array(Array &p_arr) const override;
public:
void set_shape(Shape p_shape);
Shape get_shape() const;
void set_size(const float p_size);
float get_size() const;
void set_sections(const int p_sections);
int get_sections() const;
void set_section_length(float p_sectionlength);
float get_section_length() const;
void set_section_segments(const int p_section_segments);
int get_section_segments() const;
void set_curve(const Ref<Curve> &p_curve);
Ref<Curve> get_curve() const;
virtual int get_builtin_bind_pose_count() const override;
virtual Transform3D get_builtin_bind_pose(int p_index) const override;
RibbonTrailMesh();
};
/**
Text...
*/
class TextMesh : public PrimitiveMesh {
GDCLASS(TextMesh, PrimitiveMesh);
private:
struct ContourPoint {
Vector2 point;
bool sharp = false;
ContourPoint(){};
ContourPoint(const Vector2 &p_pt, bool p_sharp) {
point = p_pt;
sharp = p_sharp;
};
};
struct ContourInfo {
real_t length = 0.0;
bool ccw = true;
ContourInfo(){};
ContourInfo(real_t p_len, bool p_ccw) {
length = p_len;
ccw = p_ccw;
}
};
struct GlyphMeshKey {
uint64_t font_id;
uint32_t gl_id;
bool operator==(const GlyphMeshKey &p_b) const {
return (font_id == p_b.font_id) && (gl_id == p_b.gl_id);
}
GlyphMeshKey(uint64_t p_font_id, uint32_t p_gl_id) {
font_id = p_font_id;
gl_id = p_gl_id;
}
};
struct GlyphMeshKeyHasher {
_FORCE_INLINE_ static uint32_t hash(const GlyphMeshKey &p_a) {
return hash_murmur3_buffer(&p_a, sizeof(GlyphMeshKey));
}
};
struct GlyphMeshData {
Vector<Vector2> triangles;
Vector<Vector<ContourPoint>> contours;
Vector<ContourInfo> contours_info;
Vector2 min_p = Vector2(INFINITY, INFINITY);
Vector2 max_p = Vector2(-INFINITY, -INFINITY);
};
mutable HashMap<GlyphMeshKey, GlyphMeshData, GlyphMeshKeyHasher> cache;
RID text_rid;
mutable Vector<RID> lines_rid;
String text;
String xl_text;
int font_size = 16;
Ref<Font> font_override;
TextServer::AutowrapMode autowrap_mode = TextServer::AUTOWRAP_OFF;
float width = 500.0;
float line_spacing = 0.f;
Point2 lbl_offset;
HorizontalAlignment horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER;
VerticalAlignment vertical_alignment = VERTICAL_ALIGNMENT_CENTER;
bool uppercase = false;
String language;
TextServer::Direction text_direction = TextServer::DIRECTION_AUTO;
TextServer::StructuredTextParser st_parser = TextServer::STRUCTURED_TEXT_DEFAULT;
Array st_args;
real_t depth = 0.05;
real_t pixel_size = 0.01;
real_t curve_step = 0.5;
mutable bool dirty_lines = true;
mutable bool dirty_text = true;
mutable bool dirty_font = true;
mutable bool dirty_cache = true;
void _generate_glyph_mesh_data(const GlyphMeshKey &p_key, const Glyph &p_glyph) const;
void _font_changed();
protected:
static void _bind_methods();
void _notification(int p_what);
virtual void _create_mesh_array(Array &p_arr) const override;
public:
GDVIRTUAL2RC(Array, _structured_text_parser, Array, String)
TextMesh();
~TextMesh();
void set_horizontal_alignment(HorizontalAlignment p_alignment);
HorizontalAlignment get_horizontal_alignment() const;
void set_vertical_alignment(VerticalAlignment p_alignment);
VerticalAlignment get_vertical_alignment() const;
void set_text(const String &p_string);
String get_text() const;
void set_font(const Ref<Font> &p_font);
Ref<Font> get_font() const;
Ref<Font> _get_font_or_default() const;
void set_font_size(int p_size);
int get_font_size() const;
void set_line_spacing(float p_size);
float get_line_spacing() const;
void set_autowrap_mode(TextServer::AutowrapMode p_mode);
TextServer::AutowrapMode get_autowrap_mode() const;
void set_text_direction(TextServer::Direction p_text_direction);
TextServer::Direction get_text_direction() const;
void set_language(const String &p_language);
String get_language() const;
void set_structured_text_bidi_override(TextServer::StructuredTextParser p_parser);
TextServer::StructuredTextParser get_structured_text_bidi_override() const;
void set_structured_text_bidi_override_options(Array p_args);
Array get_structured_text_bidi_override_options() const;
void set_uppercase(bool p_uppercase);
bool is_uppercase() const;
void set_width(real_t p_width);
real_t get_width() const;
void set_depth(real_t p_depth);
real_t get_depth() const;
void set_curve_step(real_t p_step);
real_t get_curve_step() const;
void set_pixel_size(real_t p_amount);
real_t get_pixel_size() const;
void set_offset(const Point2 &p_offset);
Point2 get_offset() const;
};
VARIANT_ENUM_CAST(RibbonTrailMesh::Shape)
#endif // PRIMITIVE_MESHES_H
| {
"content_hash": "92a4981a9373bf381ded51a837934b89",
"timestamp": "",
"source": "github",
"line_count": 650,
"max_line_length": 184,
"avg_line_length": 26.246153846153845,
"alnum_prop": 0.6893903868698711,
"repo_name": "guilhermefelipecgs/godot",
"id": "ee61f0ac55cc01567c7ad46bee52355814a6b7d2",
"size": "17060",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "scene/resources/primitive_meshes.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AIDL",
"bytes": "1633"
},
{
"name": "C",
"bytes": "1045182"
},
{
"name": "C#",
"bytes": "1617601"
},
{
"name": "C++",
"bytes": "39733933"
},
{
"name": "CMake",
"bytes": "606"
},
{
"name": "GAP",
"bytes": "62"
},
{
"name": "GDScript",
"bytes": "66469"
},
{
"name": "GLSL",
"bytes": "844888"
},
{
"name": "Java",
"bytes": "596320"
},
{
"name": "JavaScript",
"bytes": "188917"
},
{
"name": "Kotlin",
"bytes": "93069"
},
{
"name": "Makefile",
"bytes": "1421"
},
{
"name": "Objective-C",
"bytes": "20550"
},
{
"name": "Objective-C++",
"bytes": "395520"
},
{
"name": "PowerShell",
"bytes": "2713"
},
{
"name": "Python",
"bytes": "470837"
},
{
"name": "Shell",
"bytes": "33647"
}
],
"symlink_target": ""
} |
/*
* QuadNodePolarEuclid.h
*
* Created on: 21.05.2014
* Author: Moritz v. Looz ([email protected])
*
* Note: This is similar enough to QuadNode.h that one could merge these two classes.
*/
#ifndef QUADNODEPOLAREUCLID_H_
#define QUADNODEPOLAREUCLID_H_
#include <vector>
#include <algorithm>
#include <functional>
#include <assert.h>
#include "../../auxiliary/Log.h"
#include "../../geometric/HyperbolicSpace.h"
using std::vector;
using std::min;
using std::max;
using std::cos;
namespace NetworKit {
template <class T>
class QuadNodePolarEuclid {
friend class QuadTreeGTest;
private:
double leftAngle;
double minR;
double rightAngle;
double maxR;
Point2D<double> a,b,c,d;
unsigned capacity;
static const unsigned coarsenLimit = 4;
count subTreeSize;
std::vector<T> content;
std::vector<Point2D<double> > positions;
std::vector<double> angles;
std::vector<double> radii;
bool isLeaf;
bool splitTheoretical;
double balance;
index ID;
double lowerBoundR;
public:
std::vector<QuadNodePolarEuclid> children;
QuadNodePolarEuclid() {
//This should never be called.
leftAngle = 0;
rightAngle = 0;
minR = 0;
maxR = 0;
capacity = 20;
isLeaf = true;
subTreeSize = 0;
balance = 0.5;
splitTheoretical = false;
lowerBoundR = maxR;
ID = 0;
}
/**
* Construct a QuadNode for polar coordinates.
*
*
* @param leftAngle Minimal angular coordinate of region, in radians from 0 to 2\pi
* @param rightAngle Maximal angular coordinate of region, in radians from 0 to 2\pi
* @param minR Minimal radial coordinate of region, between 0 and 1
* @param maxR Maximal radial coordinate of region, between 0 and 1
* @param capacity Number of points a leaf cell can store before splitting
* @param minDiameter Minimal diameter of a quadtree node. If the node is already smaller, don't split even if over capacity. Default is 0
* @param splitTheoretical Whether to split in a theoretically optimal way or in a way to decrease measured running times
* @param alpha dispersion Parameter of the point distribution. Only has an effect if theoretical split is true
* @param diagnostics Count how many necessary and unnecessary comparisons happen in leaf cells? Will cause race condition and false sharing in parallel use
*
*/
QuadNodePolarEuclid(double leftAngle, double minR, double rightAngle, double maxR, unsigned capacity = 1000, bool splitTheoretical = false, double balance = 0.5) {
if (balance <= 0 || balance >= 1) throw std::runtime_error("Quadtree balance parameter must be between 0 and 1.");
this->leftAngle = leftAngle;
this->minR = minR;
this->maxR = maxR;
this->rightAngle = rightAngle;
this->a = HyperbolicSpace::polarToCartesian(leftAngle, minR);
this->b = HyperbolicSpace::polarToCartesian(rightAngle, minR);
this->c = HyperbolicSpace::polarToCartesian(rightAngle, maxR);
this->d = HyperbolicSpace::polarToCartesian(leftAngle, maxR);
this->capacity = capacity;
this->splitTheoretical = splitTheoretical;
this->balance = balance;
this->lowerBoundR = maxR;
this->ID = 0;
isLeaf = true;
subTreeSize = 0;
}
void split() {
assert(isLeaf);
//heavy lifting: split up!
double middleAngle, middleR;
if (splitTheoretical) {
//Euclidean space is distributed equally
middleAngle = (rightAngle - leftAngle) / 2 + leftAngle;
middleR = pow(maxR*maxR*(1-balance)+minR*minR*balance, 0.5);
} else {
//median of points
vector<double> sortedAngles = angles;
std::sort(sortedAngles.begin(), sortedAngles.end());
middleAngle = sortedAngles[sortedAngles.size()/2];
vector<double> sortedRadii = radii;
std::sort(sortedRadii.begin(), sortedRadii.end());
middleR = sortedRadii[sortedRadii.size()/2];
}
assert(middleR < maxR);
assert(middleR > minR);
QuadNodePolarEuclid southwest(leftAngle, minR, middleAngle, middleR, capacity, splitTheoretical, balance);
QuadNodePolarEuclid southeast(middleAngle, minR, rightAngle, middleR, capacity, splitTheoretical, balance);
QuadNodePolarEuclid northwest(leftAngle, middleR, middleAngle, maxR, capacity, splitTheoretical, balance);
QuadNodePolarEuclid northeast(middleAngle, middleR, rightAngle, maxR, capacity, splitTheoretical, balance);
children = {southwest, southeast, northwest, northeast};
isLeaf = false;
}
/**
* Add a point at polar coordinates (angle, R) with content input. May split node if capacity is full
*
* @param input arbitrary content, in our case an index
* @param angle angular coordinate of point, between 0 and 2 pi.
* @param R radial coordinate of point, between 0 and 1.
*/
void addContent(T input, double angle, double R) {
assert(this->responsible(angle, R));
if (lowerBoundR > R) lowerBoundR = R;
if (isLeaf) {
if (content.size() + 1 < capacity) {
content.push_back(input);
angles.push_back(angle);
radii.push_back(R);
Point2D<double> pos = HyperbolicSpace::polarToCartesian(angle, R);
positions.push_back(pos);
} else {
split();
for (index i = 0; i < content.size(); i++) {
this->addContent(content[i], angles[i], radii[i]);
}
assert(subTreeSize == content.size());//we have added everything twice
subTreeSize = content.size();
content.clear();
angles.clear();
radii.clear();
positions.clear();
this->addContent(input, angle, R);
}
}
else {
assert(children.size() > 0);
for (index i = 0; i < children.size(); i++) {
if (children[i].responsible(angle, R)) {
children[i].addContent(input, angle, R);
break;
}
}
subTreeSize++;
}
}
/**
* Remove content at polar coordinates (angle, R). May cause coarsening of the quadtree
*
* @param input Content to be removed
* @param angle Angular coordinate
* @param R Radial coordinate
*
* @return True if content was found and removed, false otherwise
*/
bool removeContent(T input, double angle, double R) {
if (!responsible(angle, R)) return false;
if (isLeaf) {
index i = 0;
for (; i < content.size(); i++) {
if (content[i] == input) break;
}
if (i < content.size()) {
assert(angles[i] == angle);
assert(radii[i] == R);
//remove element
content.erase(content.begin()+i);
positions.erase(positions.begin()+i);
angles.erase(angles.begin()+i);
radii.erase(radii.begin()+i);
return true;
} else {
return false;
}
}
else {
bool removed = false;
bool allLeaves = true;
assert(children.size() > 0);
for (index i = 0; i < children.size(); i++) {
if (!children[i].isLeaf) allLeaves = false;
if (children[i].removeContent(input, angle, R)) {
assert(!removed);
removed = true;
}
}
if (removed) subTreeSize--;
//coarsen?
if (removed && allLeaves && size() < coarsenLimit) {
//coarsen!!
//why not assert empty containers and then insert directly?
vector<T> allContent;
vector<Point2D<double> > allPositions;
vector<double> allAngles;
vector<double> allRadii;
for (index i = 0; i < children.size(); i++) {
allContent.insert(allContent.end(), children[i].content.begin(), children[i].content.end());
allPositions.insert(allPositions.end(), children[i].positions.begin(), children[i].positions.end());
allAngles.insert(allAngles.end(), children[i].angles.begin(), children[i].angles.end());
allRadii.insert(allRadii.end(), children[i].radii.begin(), children[i].radii.end());
}
assert(subTreeSize == allContent.size());
assert(subTreeSize == allPositions.size());
assert(subTreeSize == allAngles.size());
assert(subTreeSize == allRadii.size());
children.clear();
content.swap(allContent);
positions.swap(allPositions);
angles.swap(allAngles);
radii.swap(allRadii);
isLeaf = true;
}
return removed;
}
}
/**
* Check whether the region managed by this node lies outside of an Euclidean circle.
*
* @param query Center of the Euclidean query circle, given in Cartesian coordinates
* @param radius Radius of the Euclidean query circle
*
* @return True if the region managed by this node lies completely outside of the circle
*/
bool outOfReach(Point2D<double> query, double radius) const {
double phi, r;
HyperbolicSpace::cartesianToPolar(query, phi, r);
if (responsible(phi, r)) return false;
//get four edge points
double topDistance, bottomDistance, leftDistance, rightDistance;
if (phi < leftAngle || phi > rightAngle) {
topDistance = min(c.distance(query), d.distance(query));
} else {
topDistance = abs(r - maxR);
}
if (topDistance <= radius) return false;
if (phi < leftAngle || phi > rightAngle) {
bottomDistance = min(a.distance(query), b.distance(query));
} else {
bottomDistance = abs(r - minR);
}
if (bottomDistance <= radius) return false;
double minDistanceR = r*cos(abs(phi-leftAngle));
if (minDistanceR > minR && minDistanceR < maxR) {
leftDistance = query.distance(HyperbolicSpace::polarToCartesian(phi, minDistanceR));
} else {
leftDistance = min(a.distance(query), d.distance(query));
}
if (leftDistance <= radius) return false;
minDistanceR = r*cos(abs(phi-rightAngle));
if (minDistanceR > minR && minDistanceR < maxR) {
rightDistance = query.distance(HyperbolicSpace::polarToCartesian(phi, minDistanceR));
} else {
rightDistance = min(b.distance(query), c.distance(query));
}
if (rightDistance <= radius) return false;
return true;
}
/**
* Check whether the region managed by this node lies outside of an Euclidean circle.
* Functionality is the same as in the method above, but it takes polar coordinates instead of Cartesian ones
*
* @param angle_c Angular coordinate of the Euclidean query circle's center
* @param r_c Radial coordinate of the Euclidean query circle's center
* @param radius Radius of the Euclidean query circle
*
* @return True if the region managed by this node lies completely outside of the circle
*/
bool outOfReach(double angle_c, double r_c, double radius) const {
if (responsible(angle_c, r_c)) return false;
Point2D<double> query = HyperbolicSpace::polarToCartesian(angle_c, r_c);
return outOfReach(query, radius);
}
/**
* @param phi Angular coordinate of query point
* @param r_h radial coordinate of query point
*/
std::pair<double, double> EuclideanDistances(double phi, double r) const {
/**
* If the query point is not within the quadnode, the distance minimum is on the border.
* Need to check whether extremum is between corners.
*/
double maxDistance = 0;
double minDistance = std::numeric_limits<double>::max();
if (responsible(phi, r)) minDistance = 0;
auto euclidDistancePolar = [](double phi_a, double r_a, double phi_b, double r_b){
return pow(r_a*r_a+r_b*r_b-2*r_a*r_b*cos(phi_a-phi_b), 0.5);
};
auto updateMinMax = [&minDistance, &maxDistance, phi, r, euclidDistancePolar](double phi_b, double r_b){
double extremalValue = euclidDistancePolar(phi, r, phi_b, r_b);
//assert(extremalValue <= r + r_b);
maxDistance = std::max(extremalValue, maxDistance);
minDistance = std::min(minDistance, extremalValue);
};
/**
* angular boundaries
*/
//left
double extremum = r*cos(this->leftAngle - phi);
if (extremum < maxR && extremum > minR) {
updateMinMax(this->leftAngle, extremum);
}
//right
extremum = r*cos(this->rightAngle - phi);
if (extremum < maxR && extremum > minR) {
updateMinMax(this->leftAngle, extremum);
}
/**
* radial boundaries.
*/
if (phi > leftAngle && phi < rightAngle) {
updateMinMax(phi, maxR);
updateMinMax(phi, minR);
}
if (phi + M_PI > leftAngle && phi + M_PI < rightAngle) {
updateMinMax(phi + M_PI, maxR);
updateMinMax(phi + M_PI, minR);
}
if (phi - M_PI > leftAngle && phi -M_PI < rightAngle) {
updateMinMax(phi - M_PI, maxR);
updateMinMax(phi - M_PI, minR);
}
/**
* corners
*/
updateMinMax(leftAngle, maxR);
updateMinMax(rightAngle, maxR);
updateMinMax(leftAngle, minR);
updateMinMax(rightAngle, minR);
//double shortCutGainMax = maxR + r - maxDistance;
//assert(minDistance <= minR + r);
//assert(maxDistance <= maxR + r);
assert(minDistance < maxDistance);
return std::pair<double, double>(minDistance, maxDistance);
}
/**
* Does the point at (angle, r) fall inside the region managed by this QuadNode?
*
* @param angle Angular coordinate of input point
* @param r Radial coordinate of input points
*
* @return True if input point lies within the region of this QuadNode
*/
bool responsible(double angle, double r) const {
return (angle >= leftAngle && angle < rightAngle && r >= minR && r < maxR);
}
/**
* Get all Elements in this QuadNode or a descendant of it
*
* @return vector of content type T
*/
std::vector<T> getElements() const {
if (isLeaf) {
return content;
} else {
assert(content.size() == 0);
assert(angles.size() == 0);
assert(radii.size() == 0);
vector<T> result;
for (index i = 0; i < children.size(); i++) {
std::vector<T> subresult = children[i].getElements();
result.insert(result.end(), subresult.begin(), subresult.end());
}
return result;
}
}
void getCoordinates(vector<double> &anglesContainer, vector<double> &radiiContainer) const {
assert(angles.size() == radii.size());
if (isLeaf) {
anglesContainer.insert(anglesContainer.end(), angles.begin(), angles.end());
radiiContainer.insert(radiiContainer.end(), radii.begin(), radii.end());
}
else {
assert(content.size() == 0);
assert(angles.size() == 0);
assert(radii.size() == 0);
for (index i = 0; i < children.size(); i++) {
children[i].getCoordinates(anglesContainer, radiiContainer);
}
}
}
/**
* Main query method, get points lying in a Euclidean circle around the center point.
* Optional limits can be given to get a different result or to reduce unnecessary comparisons
*
* Elements are pushed onto a vector which is a required argument. This is done to reduce copying
*
* Safe to call in parallel if diagnostics are disabled
*
* @param center Center of the query circle
* @param radius Radius of the query circle
* @param result Reference to the vector where the results will be stored
* @param minAngle Optional value for the minimum angular coordinate of the query region
* @param maxAngle Optional value for the maximum angular coordinate of the query region
* @param lowR Optional value for the minimum radial coordinate of the query region
* @param highR Optional value for the maximum radial coordinate of the query region
*/
void getElementsInEuclideanCircle(Point2D<double> center, double radius, vector<T> &result, double minAngle=0, double maxAngle=2*M_PI, double lowR=0, double highR = 1) const {
if (minAngle >= rightAngle || maxAngle <= leftAngle || lowR >= maxR || highR < lowerBoundR) return;
if (outOfReach(center, radius)) {
return;
}
if (isLeaf) {
const double rsq = radius*radius;
const double queryX = center[0];
const double queryY = center[1];
const count cSize = content.size();
for (int i=0; i < cSize; i++) {
const double deltaX = positions[i].getX() - queryX;
const double deltaY = positions[i].getY() - queryY;
if (deltaX*deltaX + deltaY*deltaY < rsq) {
result.push_back(content[i]);
}
}
} else {
for (index i = 0; i < children.size(); i++) {
children[i].getElementsInEuclideanCircle(center, radius, result, minAngle, maxAngle, lowR, highR);
}
}
}
count getElementsProbabilistically(Point2D<double> euQuery, std::function<double(double)> prob, bool suppressLeft, vector<T> &result) const {
double phi_q, r_q;
HyperbolicSpace::cartesianToPolar(euQuery, phi_q, r_q);
if (suppressLeft && phi_q > rightAngle) return 0;
TRACE("Getting Euclidean distances");
auto distancePair = EuclideanDistances(phi_q, r_q);
double probUB = prob(distancePair.first);
double probLB = prob(distancePair.second);
assert(probLB <= probUB);
if (probUB > 0.5) probUB = 1;//if we are going to take every second element anyway, no use in calculating expensive jumps
if (probUB == 0) return 0;
//TODO: return whole if probLB == 1
double probdenom = std::log(1-probUB);
if (probdenom == 0) {
DEBUG(probUB, " not zero, but too small too process. Ignoring.");
return 0;
}
TRACE("probUB: ", probUB, ", probdenom: ", probdenom);
count expectedNeighbours = probUB*size();
count candidatesTested = 0;
if (isLeaf) {
const count lsize = content.size();
TRACE("Leaf of size ", lsize);
for (index i = 0; i < lsize; i++) {
//jump!
if (probUB < 1) {
double random = Aux::Random::real();
double delta = std::log(random) / probdenom;
assert(delta == delta);
assert(delta >= 0);
i += delta;
if (i >= lsize) break;
TRACE("Jumped with delta ", delta, " arrived at ", i);
}
assert(i >= 0);
//see where we've arrived
candidatesTested++;
double distance = positions[i].distance(euQuery);
double q = prob(distance);
q = q / probUB; //since the candidate was selected by the jumping process, we have to adjust the probabilities
assert(q <= 1);
assert(q >= 0);
//accept?
double acc = Aux::Random::real();
if (acc < q) {
TRACE("Accepted node ", i, " with probability ", q, ".");
result.push_back(content[i]);
}
}
} else {
if (expectedNeighbours < 4 || probUB < 1/1000) {//select candidates directly instead of calling recursively
TRACE("probUB = ", probUB, ", switching to direct candidate selection.");
assert(probUB < 1);
const count stsize = size();
for (index i = 0; i < stsize; i++) {
double delta = std::log(Aux::Random::real()) / probdenom;
assert(delta >= 0);
i += delta;
TRACE("Jumped with delta ", delta, " arrived at ", i, ". Calling maybeGetKthElement.");
if (i < size()) maybeGetKthElement(probUB, euQuery, prob, i, result);//this could be optimized. As of now, the offset is subtracted separately for each point
else break;
candidatesTested++;
}
} else {//carry on as normal
for (index i = 0; i < children.size(); i++) {
TRACE("Recursively calling child ", i);
candidatesTested += children[i].getElementsProbabilistically(euQuery, prob, suppressLeft, result);
}
}
}
//DEBUG("Expected at most ", expectedNeighbours, " neighbours, got ", result.size() - offset);
return candidatesTested;
}
void maybeGetKthElement(double upperBound, Point2D<double> euQuery, std::function<double(double)> prob, index k, vector<T> &circleDenizens) const {
TRACE("Maybe get element ", k, " with upper Bound ", upperBound);
assert(k < size());
if (isLeaf) {
double acceptance = prob(euQuery.distance(positions[k]))/upperBound;
TRACE("Is leaf, accept with ", acceptance);
if (Aux::Random::real() < acceptance) circleDenizens.push_back(content[k]);
} else {
TRACE("Call recursively.");
index offset = 0;
for (index i = 0; i < children.size(); i++) {
count childsize = children[i].size();
if (k - offset < childsize) {
children[i].maybeGetKthElement(upperBound, euQuery, prob, k - offset, circleDenizens);
break;
}
offset += childsize;
}
}
}
/**
* Shrink all vectors in this subtree to fit the content.
* Call after quadtree construction is complete, causes better memory usage and cache efficiency
*/
void trim() {
content.shrink_to_fit();
positions.shrink_to_fit();
angles.shrink_to_fit();
radii.shrink_to_fit();
if (!isLeaf) {
for (index i = 0; i < children.size(); i++) {
children[i].trim();
}
}
}
/**
* Number of points lying in the region managed by this QuadNode
*/
count size() const {
return isLeaf ? content.size() : subTreeSize;
}
void recount() {
subTreeSize = 0;
for (index i = 0; i < children.size(); i++) {
children[i].recount();
subTreeSize += children[i].size();
}
}
/**
* Height of subtree hanging from this QuadNode
*/
count height() const {
count result = 1;//if leaf node, the children loop will not execute
for (auto child : children) result = std::max(result, child.height()+1);
return result;
}
/**
* Leaf cells in the subtree hanging from this QuadNode
*/
count countLeaves() const {
if (isLeaf) return 1;
count result = 0;
for (index i = 0; i < children.size(); i++) {
result += children[i].countLeaves();
}
return result;
}
double getLeftAngle() const {
return leftAngle;
}
double getRightAngle() const {
return rightAngle;
}
double getMinR() const {
return minR;
}
double getMaxR() const {
return maxR;
}
index getID() const {
return ID;
}
index indexSubtree(index nextID) {
index result = nextID;
assert(children.size() == 4 || children.size() == 0);
for (int i = 0; i < children.size(); i++) {
result = children[i].indexSubtree(result);
}
this->ID = result;
return result+1;
}
index getCellID(double phi, double r) const {
if (!responsible(phi, r)) return NetworKit::none;
if (isLeaf) return getID();
else {
for (int i = 0; i < children.size(); i++) {
index childresult = children[i].getCellID(phi, r);
if (childresult != NetworKit::none) return childresult;
}
throw std::runtime_error("No responsible child node found even though this node is responsible.");
}
}
index getMaxIDInSubtree() const {
if (isLeaf) return getID();
else {
index result = -1;
for (int i = 0; i < 4; i++) {
result = std::max(children[i].getMaxIDInSubtree(), result);
}
return std::max(result, getID());
}
}
count reindex(count offset) {
if (isLeaf)
{
#pragma omp task
{
index p = offset;
std::generate(content.begin(), content.end(), [&p](){return p++;});
}
offset += size();
} else {
for (int i = 0; i < 4; i++) {
offset = children[i].reindex(offset);
}
}
return offset;
}
};
}
#endif /* QUADNODE_H_ */
| {
"content_hash": "26221da2cb13ecabaef0a36954d01c7c",
"timestamp": "",
"source": "github",
"line_count": 697,
"max_line_length": 176,
"avg_line_length": 31.543758967001434,
"alnum_prop": 0.667333757845902,
"repo_name": "fmaschler/networkit",
"id": "cc60907be56fe986e15bff634c9afa966104d145",
"size": "21986",
"binary": false,
"copies": "1",
"ref": "refs/heads/SCD-weighted",
"path": "networkit/cpp/generators/quadtree/QuadNodePolarEuclid.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "10112"
},
{
"name": "C++",
"bytes": "2589116"
},
{
"name": "CSS",
"bytes": "16109"
},
{
"name": "HTML",
"bytes": "10110"
},
{
"name": "JavaScript",
"bytes": "4583"
},
{
"name": "Jupyter Notebook",
"bytes": "35441"
},
{
"name": "Matlab",
"bytes": "238"
},
{
"name": "Python",
"bytes": "606841"
},
{
"name": "Shell",
"bytes": "846"
},
{
"name": "TeX",
"bytes": "5547"
}
],
"symlink_target": ""
} |
package ec.app.majority.func;
import ec.*;
import ec.app.majority.*;
import ec.gp.*;
import ec.util.*;
public class If extends GPNode
{
public String toString() { return "if"; }
public int expectedChildren() { return 3; }
public void eval(final EvolutionState state,
final int thread,
final GPData input,
final ADFStack stack,
final GPIndividual individual,
final Problem problem)
{
children[0].eval(state,thread,input,stack,individual,problem);
MajorityData md = (MajorityData) input;
long y0 = md.data0;
long y1 = md.data1;
children[1].eval(state,thread,input,stack,individual,problem);
long z0 = md.data0;
long z1 = md.data1;
children[2].eval(state,thread,input,stack,individual,problem);
// IF Y THEN Z ELSE MD is
// (Y -> Z) ^ (~Y -> MD)
// (!Y v Z) ^ (Y v MD)
md.data0 = (~y0 | z0) & (y0 | (md.data0));
md.data1 = (~y1 | z1) & (y1 | (md.data1));
}
}
| {
"content_hash": "c75df58b6b0c1a270e4c8e03ca786663",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 70,
"avg_line_length": 25.651162790697676,
"alnum_prop": 0.5394378966455122,
"repo_name": "ashkanent/GP_FitnessSharing",
"id": "962ec8a01bef377024e8553a96aeaf6abef1f7c2",
"size": "1243",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "GP project/ecj/ec/app/majority/func/If.java",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "2932"
},
{
"name": "CSS",
"bytes": "2782"
},
{
"name": "Common Lisp",
"bytes": "2814"
},
{
"name": "HTML",
"bytes": "17214850"
},
{
"name": "Java",
"bytes": "3029278"
},
{
"name": "Makefile",
"bytes": "11830"
},
{
"name": "Rust",
"bytes": "727"
},
{
"name": "Shell",
"bytes": "3784"
},
{
"name": "TeX",
"bytes": "1615946"
}
],
"symlink_target": ""
} |
<div class="projects-container" layout="row">
<md-content layout-padding class="projects-content" flex="30">
<md-list class="projects-list" *ngIf="_projectService.projects">
<md-subheader class="md-no-sticky" flex layout="row">
<div flex>Projects</div>
<div flex>
<select #stageFilter (change)="selectedValue(stageFilter.value)">
<option value="ACTIVE">ACTIVE</option>
<option value="PENDING">PENDING</option>
<option value="HOLD">HOLD</option>
<option value="FINISHED">FINISHED</option>
<option value="ALL">ALL</option>
</select>
</div>
</md-subheader>
<md-progress-circular [style.display]="(_projectService.projects.length == 0) ? 'flex' : 'none'" md-mode="indeterminate"></md-progress-circular>
<md-list-item [style.display]="(_projectService.projects.length > 0) ? 'flex' : 'none'"
*ngFor="#project_item of displayProjects()">
<button md-raised-button class="project-item-button (selected.name == project_item.name) ? 'selected' : ''" flex="100" layout="column" layout-align="center center"
(click)="onListItemClick(project_item)"
>
<div *ngIf="project_item.days_left" class="project-item-days-left">{{project_item.days_left}} <small>days</small></div>
<div *ngIf="!project_item.days_left" class="project-item-days-left"><small>Not started</small></div>
<div class="project-item-name">{{project_item.name}}</div>
</button>
</md-list-item>
</md-list>
</md-content>
<md-progress-circular *ngIf="!selected" md-mode="indeterminate"></md-progress-circular>
<div *ngIf="selected" class="selected-project-view" flex="70" style="overflow-y: auto;">
<md-toolbar class="md-hero" layout="row" layout-align="center center">
<i class="secret-project" md-icon>person</i>
<div> {{selected.name}} </div>
</md-toolbar>
<div class="selected-project-info">
<md-card>
<md-card-title>
<md-card-title-text layout="row">
<span class="md-headline">Tasks</span>
<md-divider inset></md-divider>
</md-card-title-text>
</md-card-title>
<md-card-content>
<md-progress-circular *ngIf="!selected.tasks" md-mode="indeterminate"></md-progress-circular>
<md-list *ngIf="selected.tasks">
<md-list-item *ngFor="#item of selected.tasks">
<md-divider inset></md-divider>
<div flex="70" layout="row" layout-align="start center">
<md-checkbox [checked]="item.status == 'Complete'"></md-checkbox>
<div class="md-list-item-text">
<span class="task-name">{{item.name}}</span>
</div>
</div>
<div class="md-list-item-text" flex="30" style="text-align: right;">
<span class="task-due-date">{{item.due_date}}</span>
</div>
</md-list-item>
</md-list>
</md-card-content>
</md-card>
<md-card>
<md-card-title>
<md-card-title-text layout="row">
<span class="md-headline">Dates</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<md-progress-circular *ngIf="!selected.dates" md-mode="indeterminate"></md-progress-circular>
</md-card-content>
</md-card>
<md-card layout="column">
<md-card-title>
<md-card-title-text layout="row">
<span class="md-headline">Info</span>
</md-card-title-text>
</md-card-title>
<md-card-content style="margin-top: 15px;">
<md-progress-circular *ngIf="!selected.info" md-mode="indeterminate"></md-progress-circular>
<form *ngIf="selected.info" name="infoForm">
<div layout="row">
<md-input-container class="md-block" flex>
<label>City</label>
<input md-input [(value)]="selected.info.city">
</md-input-container>
<md-input-container class="md-block" flex>
<label>State</label>
<input md-input [(value)]="selected.info.state">
</md-input-container>
<md-input-container class="md-block" flex>
<label>Zip</label>
<input md-input [(value)]="selected.info.zip">
</md-input-container>
</div>
</form>
</md-card-content>
</md-card>
<md-card>
<md-card-title>
<md-card-title-text layout="row">
<span class="md-headline">Milestones</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<md-progress-circular *ngIf="!selected.milestones" md-mode="indeterminate"></md-progress-circular>
<md-list *ngIf="selected.milestones">
<md-list-item *ngFor="#item of selected.milestones">
<md-divider inset></md-divider>
<div flex="20" class="md-list-item-text" style="color: green;">
${{item.price}}
</div>
<div flex class="md-list-item-text">
{{item.name}}
</div>
<div flex class="md-list-item-text">
{{item.status}}
</div>
</md-list-item>
</md-list>
</md-card-content>
</md-card>
<md-card>
<md-card-title>
<md-card-title-text layout="row">
<span class="md-headline">Contacts</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<md-progress-circular *ngIf="!selected.contacts" md-mode="indeterminate"></md-progress-circular>
<md-list *ngIf="selected.contacts">
<md-list-item *ngFor="#item of selected.contacts">
<div class="md-list-item-text" flex>
{{item.name}}
</div>
<div class="md-list-item-text" flex>
<a href="mailto:{{item.email}}">{{item.email}}</a>
</div>
<div class="md-list-item-text" flex>
<a href="tel:{{item.phone}}"> {{item.phone}} </a>
</div>
</md-list-item>
</md-list>
</md-card-content>
</md-card>
<md-card>
<md-card-title>
<md-card-title-text layout="row">
<span class="md-headline">Team</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<md-progress-circular *ngIf="!selected.team" md-mode="indeterminate"></md-progress-circular>
<md-list *ngIf="selected.team">
<md-list-item *ngIf="selected.team.builder">
<div flex class="md-list-item-text">Builder</div>
<div flex class="md-list-item-text">{{selected.team.builder.name}}</div>
<div flex class="md-list-item-text">
<a href="mailto:{{selected.team.builder.email}}">{{selected.team.builder.email}}</a>
</div>
<md-divider inset></md-divider>
</md-list-item>
<md-list-item *ngIf="selected.team.data">
<div flex class="md-list-item-text">Data</div>
<div flex class="md-list-item-text">{{selected.team.data.name}}</div>
<div flex class="md-list-item-text">
<a href="mailto:{{selected.team.data.email}}">{{selected.team.data.email}}</a>
</div>
<md-divider inset></md-divider>
</md-list-item>
<md-list-item *ngIf="selected.team.content">
<div flex class="md-list-item-text">Content</div>
<div flex class="md-list-item-text">{{selected.team.content.name}}</div>
<div flex class="md-list-item-text">
<a href="mailto:{{selected.team.content.email}}">{{selected.team.content.email}}</a>
</div>
<md-divider inset></md-divider>
</md-list-item>
<md-list-item *ngIf="selected.team.design">
<div flex class="md-list-item-text">Design</div>
<div flex class="md-list-item-text">{{selected.team.design.name}}</div>
<div flex class="md-list-item-text">
<a href="mailto:{{selected.team.design.email}}">{{selected.team.design.email}}</a>
</div>
<md-divider inset></md-divider>
</md-list-item>
</md-list>
</md-card-content>
</md-card>
<md-card>
<md-card-title>
<md-card-title-text layout="row">
<span class="md-headline">Project Cases</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<md-progress-circular *ngIf="!selected.cases" md-mode="indeterminate"></md-progress-circular>
</md-card-content>
</md-card>
</div>
</div>
</div>
| {
"content_hash": "068d808fbea3129b44d7e578bf0acacf",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 171,
"avg_line_length": 40.16888888888889,
"alnum_prop": 0.5348528435494578,
"repo_name": "woowe/new_dealer_tracker",
"id": "421eaccf8640f127f873ef4da4896bd2a1d611bd",
"size": "9038",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "views/Projects.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1309"
},
{
"name": "HTML",
"bytes": "13775"
},
{
"name": "JavaScript",
"bytes": "33215"
},
{
"name": "TypeScript",
"bytes": "23699"
}
],
"symlink_target": ""
} |
package net.glowstone.constants;
import org.apache.commons.lang3.Validate;
import org.bukkit.Effect;
import org.bukkit.material.MaterialData;
import java.util.Arrays;
/**
* Id mappings for particles.
*/
public final class GlowParticle {
private static final int[] EMPTY = new int[0];
private GlowParticle() {
}
private static final int[] ids = new int[Effect.values().length];
/**
* Get the particle id for a specified Particle.
* @param particle the Particle.
* @return the particle id.
*/
public static int getId(Effect particle) {
Validate.notNull(particle, "particle cannot be null");
return ids[particle.ordinal()];
}
/**
* Convert a MaterialData to an extData array if possible for a particle.
* @param particle the Particle to validate.
* @param material the MaterialData to convert.
* @return The extData array for the particle effect.
* @throws IllegalArgumentException if data is provided incorrectly
*/
public static int[] getData(Effect particle, MaterialData material) {
switch (particle) {
case ITEM_BREAK:
case TILE_BREAK:
case TILE_DUST:
if (material == null) {
throw new IllegalArgumentException("Particle " + particle + " requires material, null provided");
}
if (particle == Effect.ITEM_BREAK) {
// http://wiki.vg/Protocol#Particle
// data "Length depends on particle. "iconcrack" [Effect.ITEM_BREAK] has length of 2, "blockcrack",
// and "blockdust" have lengths of 1, the rest have 0"
// iconcrack_(id)_(data) 36
return new int[]{material.getItemTypeId(), material.getData()};
}
return new int[]{material.getItemTypeId()};
default:
if (material != null && material.getItemTypeId() != 0) {
throw new IllegalArgumentException("Particle " + particle + " does not use material, " + material + " provided");
}
return EMPTY;
}
}
/**
* Determine whether a particle type is considered long distance, meaning
* it has a higher visible range than normal.
* @param particle the Particle.
* @return True if the particle is long distance.
*/
public static boolean isLongDistance(Effect particle) {
return particle == Effect.EXPLOSION ||
particle == Effect.EXPLOSION_LARGE ||
particle == Effect.EXPLOSION_HUGE ||
particle == Effect.MOB_APPEARANCE;
}
private static void set(Effect particle, int id) {
ids[particle.ordinal()] = id;
}
static {
Arrays.fill(ids, -1);
// http://wiki.vg/Protocol#Particle IDs, but keyed by API enum
set(Effect.EXPLOSION, 0); // explode
set(Effect.EXPLOSION_LARGE, 1); // largeexplode
set(Effect.EXPLOSION_HUGE, 2); // hugeexplosion
set(Effect.FIREWORKS_SPARK, 3); // fireworksSpark
set(Effect.BUBBLE, 4); // bubble
set(Effect.SPLASH, 5); // splash
set(Effect.WAKE, 6); // wake
set(Effect.SUSPENDED, 7); // suspended
set(Effect.VOID_FOG, 8); // depthsuspend
set(Effect.CRIT, 9); // crit
set(Effect.MAGIC_CRIT, 10); // magicCrit
set(Effect.PARTICLE_SMOKE, 11); // smoke
set(Effect.LARGE_SMOKE, 12); // largesmoke
set(Effect.POTION_SWIRL, 13); // spell
set(Effect.INSTANT_SPELL, 14); // instantSpell
set(Effect.SPELL, 15); // spell
set(Effect.POTION_SWIRL_TRANSPARENT, 16); // mobSpellAmbient
set(Effect.WITCH_MAGIC, 17); // witchMagic
set(Effect.WATERDRIP, 18); // dripWater
set(Effect.LAVADRIP, 19); // dripLava
set(Effect.VILLAGER_THUNDERCLOUD, 20); // angryVillager
set(Effect.HAPPY_VILLAGER, 21); // happyVillager
set(Effect.SMALL_SMOKE, 22); // townaura
set(Effect.NOTE, 23); // note
set(Effect.PORTAL, 24); // portal
set(Effect.FLYING_GLYPH, 25); // enchantmenttable
set(Effect.FLAME, 26); // flame
set(Effect.LAVA_POP, 27); // lava
set(Effect.FOOTSTEP, 28); // footstep
set(Effect.CLOUD, 29); // cloud
set(Effect.COLOURED_DUST, 30); // reddust
set(Effect.SNOWBALL_BREAK, 31); // snowballpoof
set(Effect.SNOW_SHOVEL, 32); // snowshovel
set(Effect.SLIME, 33); // slime
set(Effect.HEART, 34); // heart
set(Effect.BARRIER, 35); // barrier
set(Effect.ITEM_BREAK, 36); // iconcrack_(id)_(data)
set(Effect.TILE_BREAK, 37); // blockcrack_(id+(data<<12))
set(Effect.TILE_DUST, 38); // blockdust_(id)
set(Effect.WATER_DROPLET, 39); // droplet
set(Effect.ITEM_TAKE, 40); // take
set(Effect.MOB_APPEARANCE, 41); // mobappearance
}
}
| {
"content_hash": "7ea6ae2a866510679b729fa560134569",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 133,
"avg_line_length": 39.904,
"alnum_prop": 0.5908179631114675,
"repo_name": "Postremus/GlowstonePlusPlus",
"id": "ab1ec779a4e0bd3e510cd3c9821395f67ae43f4e",
"size": "4988",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/main/java/net/glowstone/constants/GlowParticle.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "2174592"
},
{
"name": "Python",
"bytes": "1031"
},
{
"name": "Ruby",
"bytes": "335"
},
{
"name": "Shell",
"bytes": "2187"
}
],
"symlink_target": ""
} |
package japicmp.test;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class MethodReturnType {
public int methodReturnTypeUnchanged() {
return 42;
}
public String methodReturnTypeChangesFromIntToString() {
return "";
}
public int methodReturnTypeChangesFromStringToInt() {
return 42;
}
public Map<String, MethodReturnType> methodReturnTypeChangesFromListToMap() {
return Collections.EMPTY_MAP;
}
public int methodReturnTypeChangesFromVoidToInt() {
return 42;
}
}
| {
"content_hash": "93701085ae080e484fee5ede00efee09",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 78,
"avg_line_length": 18.714285714285715,
"alnum_prop": 0.7690839694656488,
"repo_name": "243826/japicmp",
"id": "b8385ccb2229d6ce9fe8153810e23bf72c5c28de",
"size": "524",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "japicmp-testbase/japicmp-test-v2/src/main/java/japicmp/test/MethodReturnType.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1553"
},
{
"name": "Java",
"bytes": "563395"
},
{
"name": "XSLT",
"bytes": "34662"
}
],
"symlink_target": ""
} |
/**
* This code was auto-generated by a Codezu.
*
* Changes to this file may cause incorrect behavior and will be lost if
* the code is regenerated.
*/
package com.mozu.api.urls.commerce.orders;
import com.mozu.api.MozuUrl;
import com.mozu.api.utils.UrlFormatter;
import org.joda.time.DateTime;
public class BillingInfoUrl
{
/**
* Get Resource Url for GetBillingInfo
* @param draft If true, retrieve the draft version of the order, which might include uncommitted changes to the order or its components.
* @param orderId Unique identifier of the order.
* @param responseFields Use this field to include those fields which are not included by default.
* @return String Resource Url
*/
public static MozuUrl getBillingInfoUrl(Boolean draft, String orderId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/billinginfo?draft={draft}&responseFields={responseFields}");
formatter.formatUrl("draft", draft);
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
}
/**
* Get Resource Url for SetBillingInfo
* @param orderId Unique identifier of the order.
* @param responseFields Use this field to include those fields which are not included by default.
* @param updateMode Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."
* @param version System-supplied integer that represents the current version of the order, which prevents users from unintentionally overriding changes to the order. When a user performs an operation for a defined order, the system validates that the version of the updated order matches the version of the order on the server. After the operation completes successfully, the system increments the version number by one.
* @return String Resource Url
*/
public static MozuUrl setBillingInfoUrl(String orderId, String responseFields, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/billinginfo?updatemode={updateMode}&version={version}&responseFields={responseFields}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
}
}
| {
"content_hash": "48297877b7492832fd246539b0789a5d",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 422,
"avg_line_length": 54.3921568627451,
"alnum_prop": 0.7750540735400144,
"repo_name": "lakshmi-nair/mozu-java",
"id": "66bbc39030aa27fcbd298ba7a79c8691b695cfdd",
"size": "2774",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/BillingInfoUrl.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "102"
},
{
"name": "Java",
"bytes": "12841999"
}
],
"symlink_target": ""
} |
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update, render);
function preload() {
game.load.image('fuji', 'assets/pics/atari_fujilogo.png');
}
var fuji: Phaser.Sprite;
var tween: Phaser.Tween;
var b: Phaser.Rectangle;
function create() {
game.stage.backgroundColor = 'rgb(0,0,100)';
fuji = game.add.sprite(game.stage.centerX, game.stage.centerY, 'fuji');
fuji.origin.setTo(0, 0.5);
fuji.rotation = 34;
b = new Phaser.Rectangle(fuji.transform.center.x, fuji.transform.center.y, fuji.width, fuji.height);
//game.add.tween(fuji).to({ rotation: 360 }, 20000, Phaser.Easing.Linear.None, true, 0, true);
}
function update() {
if (game.input.activePointer.justPressed())
{
//fuji.transform.centerOn(game.input.x, game.input.y);
fuji.x = game.input.x;
fuji.y = game.input.y;
}
b.x = fuji.transform.center.x - fuji.transform.halfWidth;
b.y = fuji.transform.center.y - fuji.transform.halfHeight;
}
function render() {
//Phaser.DebugUtils.renderSpriteWorldViewBounds(fuji);
//Phaser.DebugUtils.renderSpriteBounds(fuji);
Phaser.DebugUtils.renderSpriteCorners(fuji);
//Phaser.DebugUtils.renderSpriteWorldView(fuji, 32, 32);
Phaser.DebugUtils.renderRectangle(b, 'rgba(237,20,91,0.3)');
}
})();
| {
"content_hash": "8ae01777e2b6e754ab1741d3c2aee566",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 108,
"avg_line_length": 28.54901960784314,
"alnum_prop": 0.6133241758241759,
"repo_name": "GoodBoyDigital/phaser",
"id": "f28ecb1fed982b0ec7bd1dca0012dddb98f47b3d",
"size": "1511",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "wip/TS Tests/physics/sprite bounds.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "392857"
},
{
"name": "JavaScript",
"bytes": "5951964"
},
{
"name": "PHP",
"bytes": "164394"
},
{
"name": "Shell",
"bytes": "40"
},
{
"name": "TypeScript",
"bytes": "1951713"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>MJPropertiesEnumeration Block Reference</title>
<link rel="stylesheet" href="../css/style.css">
<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
<meta name="generator" content="appledoc 2.2.1 (build 1334)">
</head>
<body class="appledoc">
<header>
<div class="container" class="hide-in-xcode">
<h1 id="library-title">
<a href="../index.html">qudianDoc </a>
</h1>
<p id="developer-home">
<a href="../index.html">qudian</a>
</p>
</div>
</header>
<aside>
<div class="container">
<nav>
<ul id="header-buttons" role="toolbar">
<li><a href="../index.html">Index</a></li>
<li><a href="../hierarchy.html">Hierarchy</a></li>
<li id="on-this-page" role="navigation">
<label>
On This Page
<div class="chevron">
<div class="chevy chevron-left"></div>
<div class="chevy chevron-right"></div>
</div>
<select id="jump-to">
<option value="top">Jump To…</option>
</select>
</label>
</li>
</ul>
</nav>
</div>
</aside>
<article>
<div id="overview_contents" class="container">
<div id="content">
<main role="main">
<h1 class="title">MJPropertiesEnumeration Block Reference</h1>
<div class="section section-specification"><table cellspacing="0"><tbody>
<tr>
<th>Declared in</th>
<td>NSObject+MJProperty.h</td>
</tr>
</tbody></table></div>
<a title="Block Definition" name="instance_methods"></a>
<h4 class="method-subtitle parameter-title">Block Definition</h4>
<h3 class="subsubtitle method-title">MJPropertiesEnumeration</h3>
<div class="method-subsection brief-description">
<p>遍历成员变量用的block</p>
</div>
<code>typedef void (^MJPropertiesEnumeration) (MJProperty *property, BOOL *stop)</code>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<p>遍历成员变量用的block</p>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<code class="declared-in-ref">NSObject+MJProperty.h</code><br />
</div>
</main>
<footer>
<div class="footer-copyright">
<p class="copyright">Copyright © 2016 qudian. All rights reserved. Updated: 2016-11-29</p>
<p class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.2.1 (build 1334)</a>.</p>
</div>
</footer>
</div>
</div>
</article>
<script src="../js/script.js"></script>
</body>
</html> | {
"content_hash": "78352d491ec501a2b63458542c172b28",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 118,
"avg_line_length": 20.729323308270676,
"alnum_prop": 0.5821545157780196,
"repo_name": "AirChen/PythonPractic",
"id": "df3cdd07b5be946970bf4527ca2ebb31d396afec",
"size": "2789",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Django/DjangoDemo/home/templates/Blocks/MJPropertiesEnumeration.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "19945"
},
{
"name": "HTML",
"bytes": "3664286"
},
{
"name": "JavaScript",
"bytes": "87726"
},
{
"name": "Python",
"bytes": "57228"
},
{
"name": "Shell",
"bytes": "6578"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NearForums.Configuration
{
/// <summary>
/// Defines an optional ConfigurationElement, that will be always instanciated but not always defined by the user.
/// </summary>
public interface IOptionalElement
{
bool IsDefined
{
get;
}
}
}
| {
"content_hash": "4de5b0914cecf70de34ec7e9dc3ef226",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 115,
"avg_line_length": 20.333333333333332,
"alnum_prop": 0.6994535519125683,
"repo_name": "jorgebay/nearforums",
"id": "685239c76f165a5514d99d3b700a7194a06984cd",
"size": "368",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "solution/NearForums/Configuration/IOptionalElement.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "113"
},
{
"name": "C#",
"bytes": "600875"
},
{
"name": "CSS",
"bytes": "127293"
},
{
"name": "JavaScript",
"bytes": "117044"
},
{
"name": "Shell",
"bytes": "552"
}
],
"symlink_target": ""
} |
package org.apache.accumulo.core.client.mapreduce.impl;
import java.io.IOException;
import java.math.BigInteger;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.mapreduce.InputTableConfig;
import org.apache.accumulo.core.client.mapreduce.RangeInputSplit;
import org.apache.accumulo.core.client.mock.MockInstance;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Level;
public class SplitUtils {
/**
* Central place to set common split configuration not handled by split constructors. The intention is to make it harder to miss optional setters in future
* refactor.
*/
public static void updateSplit(RangeInputSplit split, Instance instance, InputTableConfig tableConfig, String principal, AuthenticationToken token,
Authorizations auths, Level logLevel) {
split.setInstanceName(instance.getInstanceName());
split.setZooKeepers(instance.getZooKeepers());
split.setMockInstance(instance instanceof MockInstance);
split.setPrincipal(principal);
split.setToken(token);
split.setAuths(auths);
split.setFetchedColumns(tableConfig.getFetchedColumns());
split.setIterators(tableConfig.getIterators());
split.setLogLevel(logLevel);
}
public static float getProgress(ByteSequence start, ByteSequence end, ByteSequence position) {
int maxDepth = Math.min(Math.max(end.length(), start.length()), position.length());
BigInteger startBI = new BigInteger(SplitUtils.extractBytes(start, maxDepth));
BigInteger endBI = new BigInteger(SplitUtils.extractBytes(end, maxDepth));
BigInteger positionBI = new BigInteger(SplitUtils.extractBytes(position, maxDepth));
return (float) (positionBI.subtract(startBI).doubleValue() / endBI.subtract(startBI).doubleValue());
}
public static long getRangeLength(Range range) throws IOException {
Text startRow = range.isInfiniteStartKey() ? new Text(new byte[] {Byte.MIN_VALUE}) : range.getStartKey().getRow();
Text stopRow = range.isInfiniteStopKey() ? new Text(new byte[] {Byte.MAX_VALUE}) : range.getEndKey().getRow();
int maxCommon = Math.min(7, Math.min(startRow.getLength(), stopRow.getLength()));
long diff = 0;
byte[] start = startRow.getBytes();
byte[] stop = stopRow.getBytes();
for (int i = 0; i < maxCommon; ++i) {
diff |= 0xff & (start[i] ^ stop[i]);
diff <<= Byte.SIZE;
}
if (startRow.getLength() != stopRow.getLength())
diff |= 0xff;
return diff + 1;
}
static byte[] extractBytes(ByteSequence seq, int numBytes) {
byte[] bytes = new byte[numBytes + 1];
bytes[0] = 0;
for (int i = 0; i < numBytes; i++) {
if (i >= seq.length())
bytes[i + 1] = 0;
else
bytes[i + 1] = seq.byteAt(i);
}
return bytes;
}
}
| {
"content_hash": "ca58493e6b2c0c1c859b9a93d8e79315",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 157,
"avg_line_length": 38.24050632911393,
"alnum_prop": 0.7196292618338298,
"repo_name": "adamjshook/accumulo",
"id": "d19b49922119e084853e1a0b8690cecb0063eb2b",
"size": "3822",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/SplitUtils.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2423"
},
{
"name": "C++",
"bytes": "1414083"
},
{
"name": "CSS",
"bytes": "5933"
},
{
"name": "Groovy",
"bytes": "1385"
},
{
"name": "HTML",
"bytes": "11698"
},
{
"name": "Java",
"bytes": "20215877"
},
{
"name": "JavaScript",
"bytes": "249594"
},
{
"name": "Makefile",
"bytes": "2865"
},
{
"name": "Perl",
"bytes": "28190"
},
{
"name": "Protocol Buffer",
"bytes": "1325"
},
{
"name": "Python",
"bytes": "729147"
},
{
"name": "Ruby",
"bytes": "211593"
},
{
"name": "Shell",
"bytes": "194340"
},
{
"name": "Thrift",
"bytes": "55653"
}
],
"symlink_target": ""
} |
body {
padding-top: 50px;
padding-bottom: 20px;
}
/* Wrapping element */
/* Set some basic padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}
/* Carousel */
.carousel-caption {
z-index: 10 !important;
}
.carousel-caption p {
font-size: 20px;
line-height: 1.4;
}
@media (min-width: 768px) {
.carousel-caption {
z-index: 10 !important;
}
}
/* hack bootstrap */
.input-group .input-group-btn-right {
left: 1px;
}
.input-group .input-group-btn-right .btn-default {
border-left-width: 0;
}
.input-group .input-group-btn-right .btn-default:focus {
outline: none;
}
.has-error .input-group-btn .btn {
border-color: #a94442;
}
.has-success .input-group-btn .btn {
border-color: #3c763d;
}
input.form-control:focus {
}
| {
"content_hash": "2670a72ab3f13650c1b4ba87d8a06247",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 67,
"avg_line_length": 16.392156862745097,
"alnum_prop": 0.638755980861244,
"repo_name": "grrizzly/eventsourced.net",
"id": "6c36b950689465928402f75857f822d6549fdd96",
"size": "836",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/EventSourced.Net.Web/wwwroot/dist/main.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "195003"
},
{
"name": "CSS",
"bytes": "1675"
},
{
"name": "JavaScript",
"bytes": "15221"
},
{
"name": "Shell",
"bytes": "239"
}
],
"symlink_target": ""
} |
import React from 'react';
import PropTypes from 'prop-types';
import { Button, Tooltip } from 'reactstrap';
const propTypes = {
id: PropTypes.string.isRequired,
icon: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
onClick: PropTypes.func,
tag: PropTypes.string,
href: PropTypes.string
};
class IconButton extends React.Component {
constructor(props) {
super(props);
this.state = {
tooltipOpen: false
};
}
toggle = () => {
this.setState({
tooltipOpen: !this.state.tooltipOpen
});
}
render() {
const className = 'btn-icon';
const btnContent = (
<React.Fragment>
<i className={this.props.icon}></i>
<Tooltip
toggle={this.toggle}
delay={{show: 0, hide: 0}}
target={this.props.id}
placement='bottom'
isOpen={this.state.tooltipOpen}>
{this.props.text}
</Tooltip>
</React.Fragment>
);
if (this.props.tag && this.props.tag == 'a') {
return (
<Button
id={this.props.id}
className={className}
tag="a"
href={this.props.href}
aria-label={this.props.text}
>
{btnContent}
</Button>
);
} else {
return (
<Button
id={this.props.id}
className={className}
onClick={this.props.onClick}
aria-label={this.props.text}
>
{btnContent}
</Button>
);
}
}
}
IconButton.propTypes = propTypes;
export default IconButton;
| {
"content_hash": "7b42fdfe30df4c18aa2b66feeb3b457d",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 50,
"avg_line_length": 22.140845070422536,
"alnum_prop": 0.5527989821882952,
"repo_name": "miurahr/seahub",
"id": "c046aacf34593dc7c93c25cdf51be165844c535e",
"size": "1572",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "frontend/src/components/icon-button.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "231001"
},
{
"name": "HTML",
"bytes": "750509"
},
{
"name": "JavaScript",
"bytes": "2430915"
},
{
"name": "Python",
"bytes": "1500021"
},
{
"name": "Shell",
"bytes": "8856"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_25) on Mon Dec 16 08:10:46 GMT 2013 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Serialized Form (HornetQ JMS Client 2.4.0.Final API)</title>
<meta name="date" content="2013-12-16">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Serialized Form (HornetQ JMS Client 2.4.0.Final API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="overview-summary.html">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li>Use</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-all.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?serialized-form.html" target="_top">Frames</a></li>
<li><a href="serialized-form.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Serialized Form" class="title">Serialized Form</h1>
</div>
<div class="serializedFormContainer">
<ul class="blockList">
<li class="blockList">
<h2 title="Package">Package org.hornetq.jms.client</h2>
<ul class="blockList">
<li class="blockList"><a name="org.hornetq.jms.client.HornetQConnectionFactory">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQConnectionFactory.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQConnectionFactory</a> extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>-2810634789345348326L</dd>
</dl>
<ul class="blockList">
<li class="blockList"><a name="serializedForm">
<!-- -->
</a>
<h3>Serialized Fields</h3>
<ul class="blockList">
<li class="blockList">
<h4>serverLocator</h4>
<pre><a href="http://hornetq.org/hornetq-core-client/apidocs/org/hornetq/api/core/client/ServerLocator.html?is-external=true" title="class or interface in org.hornetq.api.core.client">ServerLocator</a> serverLocator</pre>
</li>
<li class="blockList">
<h4>clientID</h4>
<pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> clientID</pre>
</li>
<li class="blockList">
<h4>dupsOKBatchSize</h4>
<pre>int dupsOKBatchSize</pre>
</li>
<li class="blockList">
<h4>transactionBatchSize</h4>
<pre>int transactionBatchSize</pre>
</li>
<li class="blockListLast">
<h4>readOnly</h4>
<pre>boolean readOnly</pre>
</li>
</ul>
</li>
</ul>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQDestination">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQDestination.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQDestination</a> extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>5027962425462382883L</dd>
</dl>
<ul class="blockList">
<li class="blockList"><a name="serializedForm">
<!-- -->
</a>
<h3>Serialized Fields</h3>
<ul class="blockList">
<li class="blockList">
<h4>name</h4>
<pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name</pre>
<div class="block">The JMS name</div>
</li>
<li class="blockList">
<h4>address</h4>
<pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> address</pre>
<div class="block">The core address</div>
</li>
<li class="blockList">
<h4>simpleAddress</h4>
<pre><a href="http://hornetq.org/hornetq-core-client/apidocs/org/hornetq/api/core/SimpleString.html?is-external=true" title="class or interface in org.hornetq.api.core">SimpleString</a> simpleAddress</pre>
<div class="block">SimpleString version of address</div>
</li>
<li class="blockList">
<h4>temporary</h4>
<pre>boolean temporary</pre>
</li>
<li class="blockListLast">
<h4>queue</h4>
<pre>boolean queue</pre>
</li>
</ul>
</li>
</ul>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQJMSClientBundle_$bundle">
<!-- -->
</a>
<h3>Class org.hornetq.jms.client.HornetQJMSClientBundle_$bundle extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>1L</dd>
</dl>
<ul class="blockList">
<li class="blockList"><a name="serialized_methods">
<!-- -->
</a>
<h3>Serialization Methods</h3>
<ul class="blockList">
<li class="blockListLast"><a name="readResolve()">
<!-- -->
</a>
<h4>readResolve</h4>
<pre>protected org.hornetq.jms.client.HornetQJMSClientBundle_$bundle readResolve()</pre>
</li>
</ul>
</li>
</ul>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQJMSClientLogger_$logger">
<!-- -->
</a>
<h3>Class org.hornetq.jms.client.HornetQJMSClientLogger_$logger extends org.jboss.logging.DelegatingBasicLogger implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>1L</dd>
</dl>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQJMSConnectionFactory">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQJMSConnectionFactory.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQJMSConnectionFactory</a> extends <a href="org/hornetq/jms/client/HornetQConnectionFactory.html" title="class in org.hornetq.jms.client">HornetQConnectionFactory</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>-2810634789345348326L</dd>
</dl>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQQueue">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQQueue.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQQueue</a> extends <a href="org/hornetq/jms/client/HornetQDestination.html" title="class in org.hornetq.jms.client">HornetQDestination</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>-1106092883162295462L</dd>
</dl>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQQueueConnectionFactory">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQQueueConnectionFactory.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQQueueConnectionFactory</a> extends <a href="org/hornetq/jms/client/HornetQConnectionFactory.html" title="class in org.hornetq.jms.client">HornetQConnectionFactory</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>5312455021322463546L</dd>
</dl>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQTemporaryQueue">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQTemporaryQueue.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQTemporaryQueue</a> extends <a href="org/hornetq/jms/client/HornetQQueue.html" title="class in org.hornetq.jms.client">HornetQQueue</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>-4624930377557954624L</dd>
</dl>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQTemporaryTopic">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQTemporaryTopic.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQTemporaryTopic</a> extends <a href="org/hornetq/jms/client/HornetQTopic.html" title="class in org.hornetq.jms.client">HornetQTopic</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>845450764835635266L</dd>
</dl>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQTopic">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQTopic.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQTopic</a> extends <a href="org/hornetq/jms/client/HornetQDestination.html" title="class in org.hornetq.jms.client">HornetQDestination</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>7873614001276404156L</dd>
</dl>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQTopicConnectionFactory">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQTopicConnectionFactory.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQTopicConnectionFactory</a> extends <a href="org/hornetq/jms/client/HornetQConnectionFactory.html" title="class in org.hornetq.jms.client">HornetQConnectionFactory</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>7317051989866548455L</dd>
</dl>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQXAConnectionFactory">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQXAConnectionFactory.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQXAConnectionFactory</a> extends <a href="org/hornetq/jms/client/HornetQConnectionFactory.html" title="class in org.hornetq.jms.client">HornetQConnectionFactory</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>743611571839154115L</dd>
</dl>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQXAQueueConnectionFactory">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQXAQueueConnectionFactory.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQXAQueueConnectionFactory</a> extends <a href="org/hornetq/jms/client/HornetQConnectionFactory.html" title="class in org.hornetq.jms.client">HornetQConnectionFactory</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>8612457847251087454L</dd>
</dl>
</li>
<li class="blockList"><a name="org.hornetq.jms.client.HornetQXATopicConnectionFactory">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/client/HornetQXATopicConnectionFactory.html" title="class in org.hornetq.jms.client">org.hornetq.jms.client.HornetQXATopicConnectionFactory</a> extends <a href="org/hornetq/jms/client/HornetQConnectionFactory.html" title="class in org.hornetq.jms.client">HornetQConnectionFactory</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>-7018290426884419693L</dd>
</dl>
</li>
</ul>
</li>
<li class="blockList">
<h2 title="Package">Package org.hornetq.jms.referenceable</h2>
<ul class="blockList">
<li class="blockList"><a name="org.hornetq.jms.referenceable.SerializableObjectRefAddr">
<!-- -->
</a>
<h3>Class <a href="org/hornetq/jms/referenceable/SerializableObjectRefAddr.html" title="class in org.hornetq.jms.referenceable">org.hornetq.jms.referenceable.SerializableObjectRefAddr</a> extends <a href="http://docs.oracle.com/javase/7/docs/api/javax/naming/RefAddr.html?is-external=true" title="class or interface in javax.naming">RefAddr</a> implements Serializable</h3>
<dl class="nameValue">
<dt>serialVersionUID:</dt>
<dd>9158134548376171898L</dd>
</dl>
<ul class="blockList">
<li class="blockList"><a name="serializedForm">
<!-- -->
</a>
<h3>Serialized Fields</h3>
<ul class="blockList">
<li class="blockListLast">
<h4>bytes</h4>
<pre>byte[] bytes</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="overview-summary.html">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li>Use</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-all.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?serialized-form.html" target="_top">Frames</a></li>
<li><a href="serialized-form.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2013 <a href="http://www.jboss.org/">JBoss, a division of Red Hat</a>. All Rights Reserved.</small></p>
</body>
</html>
| {
"content_hash": "477e472b987597fbd5f182845adc8b21",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 373,
"avg_line_length": 39.545197740113,
"alnum_prop": 0.7133366669047789,
"repo_name": "Dauth/cs3219-JMS",
"id": "ec2c7f920d8c3c866c1500887ac85ab1f19c650a",
"size": "13999",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "hornetq-2.4.0.Final/docs/api/hornetq-jms-client/serialized-form.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "5161"
},
{
"name": "CSS",
"bytes": "141931"
},
{
"name": "HTML",
"bytes": "11041932"
},
{
"name": "Java",
"bytes": "791170"
},
{
"name": "JavaScript",
"bytes": "1436"
},
{
"name": "Python",
"bytes": "2051"
},
{
"name": "Ruby",
"bytes": "1821"
},
{
"name": "Shell",
"bytes": "3130"
}
],
"symlink_target": ""
} |
set(proj LibD)
set(depends "")
ExternalProject_Include_Dependencies(${proj}
PROJECT_VAR proj
DEPENDS_VAR depends
EP_ARGS_VAR ep_args
USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}
)
include(${CMAKE_CURRENT_SOURCE_DIR}/../ArtichokeTestUtility.cmake)
check_variable(proj "LibD")
check_variable(depends "")
check_variable(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} "")
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
message(FATAL_ERROR "Enabling ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} is not supported !")
endif()
# Sanity checks
if(DEFINED LibD_DIR AND NOT EXISTS ${LibD_DIR})
message(FATAL_ERROR "LibD_DIR variable is defined but corresponds to non-existing directory")
endif()
if(NOT DEFINED LibD_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
ExternalProject_Add(${proj}
${ep_args}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Lib
BINARY_DIR ${proj}-build
DOWNLOAD_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
DEPENDS ${depends}
)
set(LibD_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
else()
ExternalProject_Add_Empty(${proj} DEPENDS "${depends}")
endif()
mark_as_superbuild(
VARS LibD_DIR:PATH
LABELS "FIND_PACKAGE"
)
| {
"content_hash": "2f2cd9c703071bda6eabab5fe5d74e38",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 95,
"avg_line_length": 26.444444444444443,
"alnum_prop": 0.7008403361344537,
"repo_name": "commontk/Artichoke",
"id": "341b0afcdbed0a30c0c7166be3d0e7516413c34b",
"size": "1202",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Tests/AddDependencies-Test/TheExternals/TheExternal_LibD.cmake",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CMake",
"bytes": "131367"
}
],
"symlink_target": ""
} |
Newt Programming Language Design - Variables
============================================
Types
-----
The language is statically typed.
The general idea is to have 4 primitive types: `Integer`, `Real`, `Boolean`,
`Character`, along with compund types like `String`, `File`, `Sprite` (for
graphics) etc., as well as user-defined types (discussed in another section).
`Integer` would be an unbounded, unsigned integer type (basically a bignum).
This is so that the student doesn't have to worry about value boundaries.
From my experience, the immediate response to "this number will not fit in an
int" is changing it to a float (double if they remembered that float is not to
be used), instead of expected change to long (or long long in case of C++).
`Real` would be a double precision floating point type or a pair of unbounded
integers for the mantissa and exponent. The former is currently more feasible,
as it is easier to implement and also is good enough for most of the uses and
would actually allow to learn how imprecise floating point computation is.
Real type literals can be given in the form of `1.2`, `.01` or `1e10`.
Form `1.` is not valid, as it is obsolete and often included in languages only
for historical reasons.
`Boolean` is self-explanatory. Boolean values are written `true` and `false`.
`Character` is still being under consideration. The two options are: one byte
using ASCII or two-byte Unicode character (as in Java). The reason for the
former is compatibility with C/C++, while rationale behind the latter may be
"it's 2014, for God's sake!".
Character literals are written with single quotes, like in C++, e.g. `'a'`.
`String` is just an array of characters with `+` operator overloaded for
concatenation and `<`, `==`, `>` etc. for lexicographical comparison of strings.
String literals are written with double quotes, e.g. `"Hello!"`.
Other built-in compound types are explained in their corresponding sections.
### Why `Real`?
Because there is no good way to call a floating point type. Let me explain:
0. `Float` will cause students to use `float` in Java, C/C++ etc. when they
make the transition.
0. `Double`. Double what? Double precision. Compared to what? Good luck
explaining that.
0. `Number`. Isn't integer a number as well? JavaScript solves it by getting
rid of integer data type and leaving `Number` to do everything, which is not
a solution.
0. `Rational`. Brings a fractional representation to mind. Also `Rational pi`
looks ridiculous.
0. `Decimal`. It was a close one. It does bring fixed-point to mind, but that's
not a big enough issue. The only reason `Real` was chosen instead is that it
is actually used by some programming languages (D, for example. Or Pascal).
Thus leaving us with `real`.
### Why not `int`, `real`, `bool` and `char`?
It is still a viable option and may be used in the final version.
### Why not `int`, `real`, `boolean` and `char` (like in Java)?
Because having `boolean` as the only one not shortened makes me cringe.
### But `real` is not shortened either.
How do you make `real` shorten so that it still makes sense?
Definition, initialisation and assignment
--------------------------------------
C-style declarations are kept. So that definition of an integer looks like this:
Integer n;
Initialisation can only be made as definition+assignment. C-like `int n(10);` or
the C++11 `int n{10};` will not be implemented, as they are unnecessary
complications to be introduced to a teaching programming language, especially
that they are not really present in any programming language other than C/C++.
The assignment operator itself is not finally decided yet, but the most feasible
option right now seems to be the Pascal `:=` operator. Why change the `=`?
Because it may be surprisingly confusing to new programmers, as they may
intuitively see it as a symmetrical operator. I've seen that a few times and it
is usually very difficult to explain that it is in fact not the case that `5=a`
is the same as `a=5`, as the belief that the familiar `=` operator is
symmetrical is, if present, really strong.
Another option is a `<-` operator for assignments. Obvious advantage is that
it clearly shows the direction of assignment (which is not the case with `:=`,
which is not that intuitive and only indicates lack of symmetry). Its downside
is that it is not even remotely similar in appereance to the widely used `=`
operator, which may make the transition more problematic.
Thus, for now, an assignment looks like this:
n := 10;
And an initialisation looks like this:
Integer n := 10;
Compound assignment operators like `+=`, `-=` etc. and increment/decrement
operators will probably not be introduced, as they are a complication
unnecessary for a beginner and would double the time spent on implementing
mathematical operations. However, as they are present in all the C-style syntax
languages, a student will learn them at some point anyway and thus they may be
introduced in later versions of the language.
Constants
---------
Constants will be created by using a `Constant` modifier at initialisation.
Like so:
Constant Real pi := 3.14159;
The keyword `Constant` may be changed to `const` if the type names are changed
to `int` etc.
Pointers and references
-----------------------
Pointers and references will probably not be introduced in the first version
of the language, as with the call-by-value for every type (primitive or
compound) they seem unnecessary. They may be introduced later with optional
call-by-reference. Call-by-value vs call-by-reference is discussed in the
'Functions' section.
Arrays
------
Arrays are constant size, however the size doesn't have to be known at compile
time. The C-style array definitions are kept. The square brackets operator to
access a given field of an array is also used. Examples:
Integer nums[10];
Integer n := console.readInteger();
Integer tab[n];
tab[0] := 0;
Array literals are given with curly braces, as in C, like so:
{1, 2, 3}
Allowing for initialisations:
Integer nums[3] = {1, 2, 3};
Integer digits[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
And even constant arrays:
Constant Integer numbers[] = {4, 8, 15, 16, 23, 42};
Still to be decided
-------------------
### Variables
What is the default value for a new variable. For example, what does this print:
Integer n;
console.writeln(n);
Are binary, octal and hexadecimal integer literals part of the language?
Is `Character` type an integer type as well? In other words, should implicit
conversions between `Integer` and `Character` be included in the language?
### Strings
Is `String` type equivalent to a `Character` array? For example, are those
valid:
Character name[] := "Newt";
console.writeln({'N', 'e', 'w', 't'});
Or in other words, is this true:
{'N', 'e', 'w', 't'} == "Newt"
### Arrays
Is reassignment to the entire array allowed? For example, is this valid:
Integer nums[] := {1, 2, 3};
nums := {3, 4, 5};
How is array size mismatch handled? For example, is this valid:
Integer nums[10] := {1, 2, 3};
And if so, what are the resulting values in the array.
Consequently, how is situation like this handled:
Integer nums[] := {1, 2, 3, 4, 5};
nums := {7, 8, 9};
| {
"content_hash": "88612d214604478187a22f05d1c52a2a",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 80,
"avg_line_length": 36.398009950248756,
"alnum_prop": 0.7203389830508474,
"repo_name": "mrozycki/newt-lang-design",
"id": "0b3709759af414cb00b502be338958eed88d11d7",
"size": "7316",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "variables/README.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
set -e
if [ ! -d "build" ]; then
mkdir build
fi
cd build
cmake .. $@
make $MAKEOPTS
cd ..
echo "Executing tests..."
build/tests/integral
build/tests/derivative
echo "Testing done."
| {
"content_hash": "3cd6d2f643670b01ccb046fa4c70d049",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 25,
"avg_line_length": 13.428571428571429,
"alnum_prop": 0.6648936170212766,
"repo_name": "optonaut/control-system-cpp",
"id": "d0ddabad8521f05190d7f61cf312b02c82ae0182",
"size": "201",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "compile.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "6263"
},
{
"name": "CMake",
"bytes": "336"
},
{
"name": "Shell",
"bytes": "201"
}
],
"symlink_target": ""
} |
using System;
using System.IO;
using Gem;
using Microsoft.Win32;
namespace HelperGui
{
public class FilesBrowser : IEntitiesBrowser
{
#region IEntitiesBrowser implementation
public virtual string Browse(string initialPath)
{
var fileDialog = new OpenFileDialog
{
Filter = "All files (*.*)|*.*",
InitialDirectory = GetInitialFolder(initialPath)
};
if (fileDialog.ShowDialog() == true)
{
return fileDialog.FileName;
}
return initialPath;
}
/// <summary>
/// Process the given initial path to a relevant folder name.
/// </summary>
/// <param name="initialPath"></param>
/// <returns></returns>
protected virtual string GetInitialFolder(string initialPath)
{
if (string.IsNullOrEmpty(initialPath))
{
return Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
}
if (Directory.Exists(initialPath))
{
return initialPath;
}
return Path.GetDirectoryName(Utils.StripPath(initialPath));
}
public virtual bool IsValidValue(string path)
{
if (string.IsNullOrEmpty(path))
{
return false;
}
string strippedPath = Utils.StripPath(path);
return File.Exists(strippedPath);
}
#endregion
}
} | {
"content_hash": "42a78cb89efb52b8f14ef929d1c169f3",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 84,
"avg_line_length": 26.112903225806452,
"alnum_prop": 0.5138974675725757,
"repo_name": "adishilo/gem",
"id": "a9bf619f2ee9c3e4226f505f29a205905c75dc1a",
"size": "1621",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "HelperGui/FilesBrowser.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "214144"
}
],
"symlink_target": ""
} |
const _ = require('underscore');
module.exports = {
platformName: 'digital_ocean',
baseUrl: 'https://api.digitalocean.com/v2',
actions: {
list_all_servers: function(req) {
req.options = {
method: 'GET',
uri: `${module.exports.baseUrl}/droplets`
};
},
list_all_images: function(req) {
req.options = {
method: 'GET',
uri: `${module.exports.baseUrl}/images?private=true`
};
},
delete_server: function(req) {
if (!req.body) { throw new Error('Request body not present') }
if (!req.body.server_id) { throw new Error('No target ID specified on req.body to be deleted') }
req.options = {
method: 'DELETE',
uri: `${module.exports.baseUrl}/droplets`,
body: {id: req.body.server_id},
json: true
};
},
get_server: function(req) {
if (!req.body) { throw new Error('Request body not present') }
if (!(req.body.server_id)) {
throw new Error('server_id not specified in req.body to get the pltfm specific info.')
}
req.options = {
method: 'GET',
uri: `${module.exports.baseUrl}/droplets/` + req.body.server_id,
json: true
};
},
get_server_pltfm_specific: function(req) {
if (!req.body) { throw new Error('Request body not present') }
if (!(req.body.server_id)) {
throw new Error('server_id not specified in req.body to get the pltfm specific info.')
}
req.options = {
method: 'GET',
uri: `${module.exports.baseUrl}/droplets/` + req.body.server_id,
json: true
};
},
create_server: function(req) {
if (!req.body) { throw new Error('Request body not present') }
if (!(req.body.name && req.body.region && req.body.size && req.body.image_id)) {
throw new Error('Name, region, size, or image not specified in req.body for the new server to be created.')
}
req.options = {
method: 'POST',
uri: `${module.exports.baseUrl}/droplets`,
body: {
name: req.body.name,
region: req.body.region,
size: req.body.size,
image: req.body.image_id
},
json: true
};
},
reboot_server: function(req) {
req.options = {
method: 'POST',
uri: `${module.exports.baseUrl}/droplets/${req.body.server_id}/actions`,
body: {'type': 'reboot'},
json: true
};
},
power_on_server: function(req) {
req.options = {
method: 'POST',
uri: `${module.exports.baseUrl}/droplets/${req.body.server_id}/actions`,
body: {'type': 'power_on'},
json: true
};
},
power_off_server: function(req) {
req.options = {
method: 'POST',
uri: `${module.exports.baseUrl}/droplets/${req.body.server_id}/actions`,
body: {'type': 'power_off'},
json: true
};
},
shutdown_server: function(req) {
req.options = {
method: 'POST',
uri: `${module.exports.baseUrl}/droplets/${req.body.server_id}/actions`,
body: {'type': 'shutdown'},
json: true
};
}
},
parsers: {
list_all_servers: function (res) {
var parsedData = {
servers: []
};
var resJSON = JSON.parse(res);
if (!resJSON || !resJSON.droplets) {
return parsedData;
}
for (var idx = 0; idx < resJSON.droplets.length; idx++) {
var droplet = resJSON.droplets[idx];
var ip = null;
/* get the public IPv4 address */
for (var ifidx = 0; ifidx < droplet.networks.v4.length; ifidx++) {
if (droplet.networks.v4[ifidx].type === 'public') {
ip = droplet.networks.v4[ifidx].ip_address;
break;
}
}
var server = {
name: droplet.name,
/* assume it's the first ipv4 address */
ip: ip,
server_id: droplet.id,
platform: 'digital_ocean',
platformSpecific: {
imageID: droplet.image.id,
region: droplet.region.slug,
size: droplet.size.slug,
status: droplet.status
}
};
parsedData.servers.push(server);
}
return parsedData;
},
list_all_images: function (res) {
var data = JSON.parse(res);
var response = [];
_.each(data.images, (image) => {
response.push({value: image.id, label: image.name});
});
return response;
},
get_server: function (res) {
var parsedData = {
server: {}
};
var ip = null;
/* get the public IPv4 address */
for (var ifidx = 0; ifidx < res.droplet.networks.v4.length; ifidx++) {
if (res.droplet.networks.v4[ifidx].type === 'public') {
ip = res.droplet.networks.v4[ifidx].ip_address;
break;
}
}
parsedData.server.name = res.droplet.name;
parsedData.server.ip = ip;
parsedData.server.platform = 'digital_ocean';
parsedData.server.platformSpecific = {
imageID: res.droplet.image.id,
region: res.droplet.region.slug,
size: res.droplet.size.slug,
status: res.droplet.status
};
return parsedData;
},
get_server_pltfm_specific: function (res) {
var parsedData = {
server: {}
};
// only grab data we need to create a new server
// which is name region size. image will come from user
parsedData.server.name = res.droplet.name;
parsedData.server.region = res.droplet.region.slug;
parsedData.server.size = res.droplet.size.slug;
return parsedData;
},
create_server: function (res) {
// some implementation
var droplet = res.droplet;
var server = {
name: droplet.name,
/* need to wait to get ip */
ip: null,
server_id: droplet.id,
platform: 'digital_ocean',
platformSpecific: {
imageID: droplet.image.id,
region: droplet.region.slug,
size: droplet.size.slug,
status: droplet.status
}
};
return { server: server };
}
},
authorize: function(req) {
req.options.headers = (function(username, server_id) {
var token = req.token;
return {'Authorization': 'Bearer ' + token};
})();
}
}
| {
"content_hash": "9ededfd9764693a400dcf78c36438d62",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 115,
"avg_line_length": 29.31192660550459,
"alnum_prop": 0.5447574334898279,
"repo_name": "ranebo/project-ipsum",
"id": "0e56f9bc23bbd15bcfc04e64088f42c88f6b8fe0",
"size": "6390",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "server/api/platformConfigs/digitalOceanConfig.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "11889"
},
{
"name": "HTML",
"bytes": "362"
},
{
"name": "JavaScript",
"bytes": "221265"
}
],
"symlink_target": ""
} |
namespace Microsoft.Azure.Management.RecoveryServices.Backup.Models
{
using System.Linq;
/// <summary>
/// Base class for validate operation request.
/// </summary>
public partial class ValidateOperationRequest
{
/// <summary>
/// Initializes a new instance of the ValidateOperationRequest class.
/// </summary>
public ValidateOperationRequest()
{
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
}
}
| {
"content_hash": "a1e0c7ea92813468ca5dc22530f7fdfc",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 90,
"avg_line_length": 25.24,
"alnum_prop": 0.606973058637084,
"repo_name": "yugangw-msft/azure-sdk-for-net",
"id": "17ec06d0a7a125d85a5106f77e45e57579796e60",
"size": "984",
"binary": false,
"copies": "12",
"ref": "refs/heads/master",
"path": "sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/ValidateOperationRequest.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "118"
},
{
"name": "Batchfile",
"bytes": "817"
},
{
"name": "C#",
"bytes": "55680650"
},
{
"name": "CSS",
"bytes": "685"
},
{
"name": "Cucumber",
"bytes": "89597"
},
{
"name": "JavaScript",
"bytes": "1719"
},
{
"name": "PowerShell",
"bytes": "24329"
},
{
"name": "Shell",
"bytes": "45"
}
],
"symlink_target": ""
} |
function(assign_version_property VER_COMPONENT)
file(STRINGS "./include/librealsense2/rs.h" REALSENSE_VERSION_${VER_COMPONENT} REGEX "#define RS2_API_${VER_COMPONENT}_VERSION")
separate_arguments(REALSENSE_VERSION_${VER_COMPONENT})
list(GET REALSENSE_VERSION_${VER_COMPONENT} -1 tmp)
if (tmp LESS 0)
message( FATAL_ERROR "Could not obtain valid Librealsense version ${VER_COMPONENT} component - actual value is ${tmp}" )
endif()
set(REALSENSE_VERSION_${VER_COMPONENT} ${tmp} PARENT_SCOPE)
endfunction()
set(REALSENSE_VERSION_MAJOR -1)
set(REALSENSE_VERSION_MINOR -1)
set(REALSENSE_VERSION_PATCH -1)
assign_version_property(MAJOR)
assign_version_property(MINOR)
assign_version_property(PATCH)
set(REALSENSE_VERSION_STRING ${REALSENSE_VERSION_MAJOR}.${REALSENSE_VERSION_MINOR}.${REALSENSE_VERSION_PATCH})
infoValue(REALSENSE_VERSION_STRING)
if (BUILD_GLSL_EXTENSIONS)
set(REALSENSE-GL_VERSION_STRING ${REALSENSE_VERSION_MAJOR}.${REALSENSE_VERSION_MINOR}.${REALSENSE_VERSION_PATCH})
endif()
| {
"content_hash": "7f8fde52d1f752de01429a88a610e53e",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 132,
"avg_line_length": 48.80952380952381,
"alnum_prop": 0.7551219512195122,
"repo_name": "IntelRealSense/librealsense",
"id": "525a1fe36f30d2db93fe44b2d4bc30d67b6a30b5",
"size": "1494",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CMake/version_config.cmake",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "736"
},
{
"name": "C",
"bytes": "6226973"
},
{
"name": "C#",
"bytes": "541746"
},
{
"name": "C++",
"bytes": "9343375"
},
{
"name": "CMake",
"bytes": "181677"
},
{
"name": "CSS",
"bytes": "9575"
},
{
"name": "Cuda",
"bytes": "38173"
},
{
"name": "Dockerfile",
"bytes": "2393"
},
{
"name": "HTML",
"bytes": "3550"
},
{
"name": "Java",
"bytes": "309233"
},
{
"name": "JavaScript",
"bytes": "480021"
},
{
"name": "MATLAB",
"bytes": "106616"
},
{
"name": "PowerShell",
"bytes": "7989"
},
{
"name": "Python",
"bytes": "485240"
},
{
"name": "ShaderLab",
"bytes": "15538"
},
{
"name": "Shell",
"bytes": "108709"
}
],
"symlink_target": ""
} |
import sys
import os
import re
import gzip
#@lint-avoid-python-3-compatibility-imports
# Make directory for output if it doesn't exist
try:
os.mkdir(sys.argv[2] + "/" + sys.argv[1].split("/")[-2])
except OSError:
pass
# Strip off .gz ending
end = "/".join(sys.argv[1].split("/")[-2:])[:-len(".xml.gz")] + ".txt"
out = open(sys.argv[2] + end, "w")
# Parse and print titles and articles
NONE, HEAD, NEXT, TEXT = 0, 1, 2, 3
MODE = NONE
title_parse = ""
article_parse = []
# FIX: Some parses are mis-parenthesized.
def fix_paren(parse):
if len(parse) < 2:
return parse
if parse[0] == "(" and parse[1] == " ":
return parse[2:-1]
return parse
def get_words(parse):
words = []
for w in parse.split():
if w[-1] == ')':
words.append(w.strip(")"))
if words[-1] == ".":
break
return words
def remove_digits(parse):
return re.sub(r'\d', '#', parse)
for l in gzip.open(sys.argv[1]):
if MODE == HEAD:
title_parse = remove_digits(fix_paren(l.strip()))
MODE = NEXT
if MODE == TEXT:
article_parse.append(remove_digits(fix_paren(l.strip())))
if MODE == NONE and l.strip() == "<HEADLINE>":
MODE = HEAD
if MODE == NEXT and l.strip() == "<P>":
MODE = TEXT
if MODE == TEXT and l.strip() == "</P>":
articles = []
# Annotated gigaword has a poor sentence segmenter.
# Ensure there is a least a period.
for i in range(len(article_parse)):
articles.append(article_parse[i])
if "(. .)" in article_parse[i]:
break
article_parse = "(TOP " + " ".join(articles) + ")"
# title_parse \t article_parse \t title \t article
print >>out, "\t".join([title_parse, article_parse,
" ".join(get_words(title_parse)),
" ".join(get_words(article_parse))])
article_parse = []
MODE = NONE
| {
"content_hash": "459b281d539548bf19a49095d7b3a0b2",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 70,
"avg_line_length": 26.236842105263158,
"alnum_prop": 0.5336008024072216,
"repo_name": "W4ngatang/NAMAS",
"id": "e7ac88b65da255d821b3d5cdcf4c9354adde4973",
"size": "2446",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "dataset/process_agiga.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "Lua",
"bytes": "43927"
},
{
"name": "Python",
"bytes": "15180"
},
{
"name": "Shell",
"bytes": "5698"
}
],
"symlink_target": ""
} |
<?php
namespace Zend\UserModuleTest\Factory\Form;
use Zend\Form\FormElementManager;
use Zend\ServiceManager\ServiceManager;
use Zend\UserModule\Factory\Form\ChangeEmail as ChangeEmailFactory;
use Zend\UserModule\Options\ModuleOptions;
use Zend\UserModule\Mapper\User as UserMapper;
class ChangeEmailFormFactoryTest extends \PHPUnit_Framework_TestCase
{
public function testFactory()
{
$serviceManager = new ServiceManager([
'services' => [
'zenduser_module_options' => new ModuleOptions,
'zenduser_user_mapper' => new UserMapper
]
]);
$formElementManager = new FormElementManager($serviceManager);
$serviceManager->setService('FormElementManager', $formElementManager);
$factory = new ChangeEmailFactory();
$this->assertInstanceOf('Zend\UserModule\Form\ChangeEmail', $factory->__invoke($serviceManager, 'Zend\UserModule\Form\ChangeEmail'));
}
}
| {
"content_hash": "3627692141648b146089fff440f5c5ae",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 141,
"avg_line_length": 34.5,
"alnum_prop": 0.7039337474120083,
"repo_name": "kenkataiwa/ZendUserModule",
"id": "d63dbf5d67133d85301edb3a7bf4a2ca884c0128",
"size": "966",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/Factory/Form/ChangeEmailFormFactoryTest.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "HTML",
"bytes": "3449"
},
{
"name": "PHP",
"bytes": "338255"
}
],
"symlink_target": ""
} |
/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import { shallow } from 'enzyme';
import Error404 from '../index';
describe('<Error404 />', () => {
test('renders', () => {
const staticContext = {};
const wrapper = shallow(<Error404 staticContext={staticContext} />);
expect(wrapper).toMatchSnapshot();
expect(staticContext.missed).toBeTruthy();
});
});
| {
"content_hash": "142be54938547b9be895cde22c02e3cc",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 72,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.6585365853658537,
"repo_name": "thehink/equilab-web",
"id": "31bb8eb55c0035efa0e78859b74753a817ca133d",
"size": "410",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "shared/components/Equilab/Error404/__tests__/Error404.test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10960"
},
{
"name": "JavaScript",
"bytes": "146277"
}
],
"symlink_target": ""
} |
using System.Linq;
using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VSSDK.Tools.VsIdeTesting;
using NuPattern.ComponentModel.Composition;
using NuPattern.Runtime.Composition;
using NuPattern.Runtime.IntegrationTests.SampleVsix;
namespace NuPattern.Runtime.IntegrationTests
{
[TestClass]
public class EventsIntegrationSpec
{
internal static readonly IAssertion Assert = new Assertion();
[TestClass]
public class GivenExportedSourcePublisherAndSubscriber
{
private IComponentModel globalContainer;
private INuPatternCompositionService compositionService;
[TestInitialize]
public void Initialize()
{
this.globalContainer = VsIdeTestHostContext.ServiceProvider.GetService<SComponentModel, IComponentModel>();
this.compositionService = VsIdeTestHostContext.ServiceProvider.GetService<INuPatternCompositionService>();
}
[HostType("VS IDE")]
[TestMethod, TestCategory("Integration")]
public void WhenSourceRaised_ThenSubscriberNotified()
{
//// MefLogger.Log();
var source = this.globalContainer.GetService<EventSource>();
var subscriber = this.globalContainer.GetService<EventSubscriber>();
Assert.Equal(0, subscriber.ChangedProperties.Count);
source.RaisePropertyChanged("Foo");
Assert.Contains("Foo", subscriber.ChangedProperties);
source.RaisePropertyChanged("Bar");
Assert.Contains("Bar", subscriber.ChangedProperties);
}
[HostType("VS IDE")]
[TestMethod, TestCategory("Integration")]
public void WhenRetrievingEventExportMetadata_ThenContainsDescription()
{
var info = this.compositionService
.GetExports<IObservableEvent, IComponentMetadata>()
.Where(x => x.Metadata.ExportingType == typeof(EventPublisher))
.First();
Assert.Equal("Raised when the source property changes", info.Metadata.Description);
}
}
}
}
| {
"content_hash": "96dbbb238248ac5561da9d2383c1d023",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 123,
"avg_line_length": 36.95161290322581,
"alnum_prop": 0.6429506765604539,
"repo_name": "NuPattern/NuPattern",
"id": "1457d02a4412007ee3517843a3f90966ac2f6bea",
"size": "2293",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Src/Runtime/Tests/IntegrationTests/EventsIntegrationSpec.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "9811"
},
{
"name": "C",
"bytes": "649172"
},
{
"name": "C#",
"bytes": "12727061"
},
{
"name": "C++",
"bytes": "2788"
},
{
"name": "Objective-C",
"bytes": "1501"
}
],
"symlink_target": ""
} |
@interface FWTViewController : UIViewController
@end
| {
"content_hash": "a9128ef0dc6d6f207b9fe048d4a6fe80",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 47,
"avg_line_length": 18,
"alnum_prop": 0.8333333333333334,
"repo_name": "FutureWorkshops/FWTMappingKit",
"id": "02be552333f17dd719beecad1e9e66bf888bdb06",
"size": "242",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Example/FWTMappingKit/CPDViewController.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "44417"
},
{
"name": "Ruby",
"bytes": "1262"
}
],
"symlink_target": ""
} |
require "rubygems"
require "rsolr"
require "lib/rsolr-direct.rb"
RSolr::Direct.load_java_libs "./solr"
RSolr.direct_connect(:solr_home => File.expand_path("./solr/example/solr")) do |solr|
response = solr.select(:params => {:q => "*:*"})
puts response.inspect
end | {
"content_hash": "2cbbaead2c39307cc2f0cb52d05b9591",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 85,
"avg_line_length": 26.9,
"alnum_prop": 0.6877323420074349,
"repo_name": "mwmitchell/rsolr-direct",
"id": "c448f2a3193590ed947fe33a1b641d181fec1f5c",
"size": "269",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "example.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "13241"
},
{
"name": "Shell",
"bytes": "4335"
}
],
"symlink_target": ""
} |
import sys
import os
import matplotlib
import numpy
import matplotlib
matplotlib.use('AGG')
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
from matplotlib.ticker import FormatStrFormatter
def getArg(param, default=""):
if (sys.argv.count(param) == 0): return default
i = sys.argv.index(param)
return sys.argv[i + 1]
lastsecs = int(getArg("lastsecs", 240))
fname = sys.argv[1]
try:
tdata = numpy.loadtxt(fname, delimiter=" ")
except:
exit(0)
if len(tdata.shape) < 2 or tdata.shape[0] < 2 or tdata.shape[1] < 2:
print "Too small data - do not try to plot yet."
exit(0)
times = tdata[:, 0]
values = tdata[:, 1]
lastt = max(times)
#majorFormatter = FormatStrFormatter('%.2f')
fig = plt.figure(figsize=(3.5, 2.0))
plt.plot(times[times > lastt - lastsecs], values[times > lastt - lastsecs])
plt.gca().xaxis.set_major_locator( MaxNLocator(nbins = 7, prune = 'lower') )
plt.xlim([max(0, lastt - lastsecs), lastt])
#plt.ylim([lastt - lastsecs, lastt])
plt.gca().yaxis.set_major_locator( MaxNLocator(nbins = 7, prune = 'lower') )
#plt.gca().yaxis.set_major_formatter(majorFormatter)
plt.savefig(fname.replace(".dat", ".png"), format="png", bbox_inches='tight')
| {
"content_hash": "833477a5752b4bcd02f478a635f568e4",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 77,
"avg_line_length": 24.32,
"alnum_prop": 0.6916118421052632,
"repo_name": "antonyms/AntonymPipeline",
"id": "6533ebd6ffefefed3e7df35379937b7a46bd0f6e",
"size": "1235",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "bptf/conf/adminhtml/plots/plotter.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "58295"
},
{
"name": "C++",
"bytes": "3232670"
},
{
"name": "CSS",
"bytes": "3060"
},
{
"name": "Java",
"bytes": "134710"
},
{
"name": "Makefile",
"bytes": "1451"
},
{
"name": "Objective-C++",
"bytes": "60341699"
},
{
"name": "Python",
"bytes": "28435"
},
{
"name": "Shell",
"bytes": "538"
},
{
"name": "TeX",
"bytes": "867"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Workbench.Core.Models;
using Workbench.Core.Nodes;
namespace Workbench.Core.Repeaters
{
internal class VisualizerRepeater
{
private VisualizerRepeaterContext context;
private readonly SolutionSnapshot snapshot;
internal VisualizerRepeater(SolutionSnapshot theSnapshot)
{
this.snapshot = theSnapshot;
}
internal void Process(VisualizerRepeaterContext theContext)
{
this.context = theContext;
if (theContext.Binding.Node.InnerExpression is MultiRepeaterStatementNode repeaterStatement)
{
var statementNode = repeaterStatement.Statement;
if (!this.context.HasRepeaters)
{
ProcessStatement(statementNode);
}
else
{
while (this.context.Next())
{
ProcessStatement(statementNode);
}
}
}
else
{
var statementListNode = (StatementListNode) theContext.Binding.Node.InnerExpression;
foreach (var x in statementListNode.Statements)
{
ProcessStatement(x);
}
}
}
internal VisualizerRepeaterContext CreateContextFrom(VisualizerUpdateContext theContext)
{
return new VisualizerRepeaterContext(theContext);
}
private void ProcessStatement(StatementNode statementNode)
{
if (statementNode.IsIfStatement)
{
ProcessIfStatement((IfStatementNode) statementNode.InnerStatement);
}
else if (statementNode.IsBindingStatement)
{
ProcessCallStatement((CallStatementNode) statementNode.InnerStatement);
}
else
{
throw new NotImplementedException();
}
}
private void ProcessCallStatement(CallStatementNode theCallStatementNode)
{
var visualizer = this.context.GetVisualizerByName(theCallStatementNode.VizualizerName.Name);
var visualizerCall = CreateVisualizerCallFrom(theCallStatementNode);
visualizer.UpdateWith(visualizerCall);
}
private void ProcessIfStatement(IfStatementNode ifStatementNode)
{
if (EvaluateIfStatementCondition(ifStatementNode.Expression))
{
ProcessCallStatement(ifStatementNode.Statement as CallStatementNode);
}
}
private bool EvaluateIfStatementCondition(VisualizerBinaryExpressionNode binaryExpressionNode)
{
var leftValue = EvaluateExpression(binaryExpressionNode.LeftExpression);
var rightValue = EvaluateExpression(binaryExpressionNode.RightExpression);
return EvaluateBinaryExpression(binaryExpressionNode.Operator, leftValue, rightValue);
}
private object EvaluateExpression(VisualizerExpressionNode theExpression)
{
switch (theExpression.InnerExpression)
{
case NumberLiteralNode numberLiteralNode:
return numberLiteralNode.Value;
case ValueReferenceStatementNode valueReferenceStatementNode:
return EvaluateValueReferenceExpression(valueReferenceStatementNode);
case CounterReferenceNode counterReferenceNode:
var counterContext = this.context.GetCounterContextByName(counterReferenceNode.CounterName);
return counterContext.CurrentValue;
case ItemNameNode itemNameNode:
return itemNameNode.Value;
case CharacterLiteralNode characterLiteralNode:
return characterLiteralNode.Value;
default:
throw new NotImplementedException("Unknown visualizer expression");
}
}
private object EvaluateValueReferenceExpression(ValueReferenceStatementNode theValueReferenceExpression)
{
if (theValueReferenceExpression.IsSingletonValue)
{
var singletonVariableName = theValueReferenceExpression.VariableName;
var singletonValue = this.snapshot.GetSingletonLabelByVariableName(singletonVariableName.Name);
return singletonValue.Value;
}
else if (theValueReferenceExpression.IsAggregateValue)
{
var aggregateVariableName = theValueReferenceExpression.VariableName;
var aggregateVariableOffset = theValueReferenceExpression.ValueOffset;
int offsetValue;
if (aggregateVariableOffset.IsLiteral)
offsetValue = aggregateVariableOffset.Literal.Value;
else
{
Debug.Assert(aggregateVariableOffset.IsCounterReference);
var counterReference = aggregateVariableOffset.Counter;
var counterContext = this.context.GetCounterContextByName(counterReference.CounterName);
offsetValue = counterContext.CurrentValue;
}
var aggregateValue = this.snapshot.GetAggregateLabelByVariableName(aggregateVariableName.Name);
return aggregateValue.GetValueAt(offsetValue - 1);
}
else
{
throw new NotImplementedException();
}
}
private VisualizerCall CreateVisualizerCallFrom(CallStatementNode theCallStatementNode)
{
var arguments = new List<CallArgument>();
foreach (var anArgument in theCallStatementNode.Arguments.Arguments)
{
var value = ConvertToValueFrom(anArgument);
arguments.Add(new CallArgument(anArgument.Name.Name, value));
}
return new VisualizerCall(arguments);
}
private string ConvertToValueFrom(CallArgumentNode theArgument)
{
bool isNumeric = int.TryParse(theArgument.Value.GetValue(), out int n);
if (isNumeric) return theArgument.Value.GetValue();
if (theArgument.Name.Name == "x" || theArgument.Name.Name == "y")
{
var counterReference = this.context.GetCounterContextByName(theArgument.Value.GetValue());
return Convert.ToString(counterReference.CurrentValue);
}
else if (theArgument.Value.Inner is ValueReferenceStatementNode valueReferenceNode)
{
return Convert.ToString(EvaluateValueReferenceExpression(valueReferenceNode));
}
else
{
return theArgument.Value.GetValue();
}
}
private bool EvaluateBinaryExpression(OperatorType theOperator, object leftValue, object rightValue)
{
switch (leftValue)
{
case int _:
return EvaluateNumberBinaryExpression(theOperator, Convert.ToInt32(leftValue), rightValue);
case char _:
return EvaluateCharBinaryExpression(theOperator, Convert.ToChar(leftValue), rightValue);
case string _:
return EvaluateStringBinaryExpression(theOperator, Convert.ToString(leftValue), rightValue);
default:
throw new NotImplementedException("Unknown value type.");
}
}
private bool EvaluateStringBinaryExpression(OperatorType theOperator, string leftString, object rightValue)
{
var rightString = rightValue.ToString();
switch (theOperator)
{
case OperatorType.Equals:
return leftString == rightString;
case OperatorType.NotEqual:
return leftString != rightString;
default:
throw new NotImplementedException("Unknown operator.");
}
}
private bool EvaluateCharBinaryExpression(OperatorType theOperator, int leftChar, object rightValue)
{
if (!char.TryParse(rightValue.ToString(), out char rightChar)) return false;
switch (theOperator)
{
case OperatorType.Equals:
return leftChar == rightChar;
case OperatorType.NotEqual:
return leftChar != rightChar;
case OperatorType.Greater:
return leftChar > rightChar;
case OperatorType.GreaterThanOrEqual:
return leftChar >= rightChar;
case OperatorType.Less:
return leftChar < rightChar;
case OperatorType.LessThanOrEqual:
return leftChar <= rightChar;
default:
throw new NotImplementedException("Unknown operator.");
}
}
private bool EvaluateNumberBinaryExpression(OperatorType theOperator, int leftNumber, object rightValue)
{
if (!Int32.TryParse(rightValue.ToString(), out int rightNumber)) return false;
switch (theOperator)
{
case OperatorType.Equals:
return leftNumber == rightNumber;
case OperatorType.NotEqual:
return leftNumber != rightNumber;
case OperatorType.Greater:
return leftNumber > rightNumber;
case OperatorType.GreaterThanOrEqual:
return leftNumber >= rightNumber;
case OperatorType.Less:
return leftNumber < rightNumber;
case OperatorType.LessThanOrEqual:
return leftNumber <= rightNumber;
default:
throw new NotImplementedException("Unknown operator.");
}
}
}
}
| {
"content_hash": "8bc81ee16f15d12fd2a5da01fab423c9",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 115,
"avg_line_length": 38.885185185185186,
"alnum_prop": 0.5769120868654157,
"repo_name": "digitalbricklayer/dyna",
"id": "486514d6e50066c17853c12af3f343d194cef553",
"size": "10501",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/Workbench.Core/Repeaters/VisualizerRepeater.cs",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C#",
"bytes": "463146"
}
],
"symlink_target": ""
} |
<form id="fm-charges" method="post" novalidate>
<input type="hidden" name="chrg_id" value="<?php echo isset($charge->chrg_id) ? $charge->chrg_id : ""; ?>" />
<div id="cc" class="easyui-layout" fit="true" style="height:450px;">
<div data-options="region:'center',title:'Charges'" style="padding:5px;">
<div class="fitem">
<label>Name:</label>
<input name="chrg_name" class="easyui-textbox" required="true" align="right" value="<?php echo isset($charge->chrg_name) ? $charge->chrg_name : ""; ?>">
</div>
<div class="fitem">
<label>Type:</label>
<input name="chrg_type" id="chrg_type" class="" required="true" align="right" value="<?php echo isset($charge->chrg_type) ? $charge->chrg_type : ""; ?>">
</div>
</div>
</form>
<style>
#fm-charges .fitem label { width: 100px; }
</style>
<script>
function init_combobox() {
$("#chrg_type").combobox({
url: "<?php echo site_url('charge_types/getChargeTypesComboBox/'); ?>",
method: 'get',
valueField: 'id',
textField: 'text',
editable: false,
prompt: 'Select Type'
});
}
init_combobox();
</script> | {
"content_hash": "238fb4caf47b9f716331dd80f0947c5e",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 169,
"avg_line_length": 36.628571428571426,
"alnum_prop": 0.531201248049922,
"repo_name": "AsCEX/hardware",
"id": "d11a0b1fcd243a2d82aaab7720119025f725c884",
"size": "1282",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/views/charges/dialog/add.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "506"
},
{
"name": "CSS",
"bytes": "606407"
},
{
"name": "HTML",
"bytes": "5633"
},
{
"name": "JavaScript",
"bytes": "730369"
},
{
"name": "PHP",
"bytes": "1854008"
}
],
"symlink_target": ""
} |
ig.module(
'plusplus.abstractities.door-triggered'
)
.requires(
'plusplus.abstractities.door'
)
.defines(function() {
/**
* Convenience door, opening and closing only when triggered and not with interaction or collision.
* <span class="alert alert-error"><strong>IMPORTANT:</strong> this is an abstract entity that should be extended.</span>
* @class
* @extends ig.Door
* @memberof ig
* @author Collin Hover - collinhover.com
*/
ig.DoorTriggered = ig.Door.extend( /**@lends ig.DoorTriggered.prototype */ {
/**
* Door should not trigger through collisions.
* @override
* @default
*/
triggerable: false,
/**
* Door should not be able to be targeted.
* @override
* @default
*/
targetable: false,
/**
* Door should not auto toggle open/close.
* @override
* @default
*/
autoToggle: false,
/**
* Triggered doors do not care if another entity is colliding with them, they always close.
* @override
*/
getCanClose: function(entity) {
return this.activated && !this.broken && !this.blocked;
}
});
});
| {
"content_hash": "2fd533fa7dc89fe4170fc28eb9c0830b",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 129,
"avg_line_length": 27.51923076923077,
"alnum_prop": 0.49825296995108315,
"repo_name": "philpill/tbgagain",
"id": "2977b8d3a63b35ebf1e9484b5d486abde6f746b6",
"size": "1431",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/lib/plusplus/abstractities/door-triggered.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "12240"
},
{
"name": "HTML",
"bytes": "5084"
},
{
"name": "JavaScript",
"bytes": "1610101"
},
{
"name": "PHP",
"bytes": "2486"
}
],
"symlink_target": ""
} |
[](https://discord.gg/GFt67vr)
# [KeepOurNetFree](https://keepournetfree.github.io/)
[KeepOurNetFree](https://keepournetfree.github.io/) is a website designed to inform about internet rights issues such as net neutrality and privacy, and how to fight back against actions that attempt to strip away these rights.
## If You Want to Contribute
You are more than welcome to contribute, feel free to. Just let us know what you are doing so that we don't reinvent the wheel 9000 times.
* Send one of us a message
* Join us on [Discord](https://discord.gg/GFt67vr)
* Fork this repository on GitHub
* Send a pull request
### Syntax and Standards
* Comment other people's code instead of deleting it, let them delete it
* Avoid "hacky" stuff like embedded hex values
* Keep code readable, example: document.getElementById('derp') use JQuery instead
* Avoid pushing to master unless you absolutely have to, master is live code
* Please for the love of all things sacred comment any scripts you write
## Bugs and Issues
Found a bug or an issue? [Open a new issue](https://github.com/KeepOurNetFree/keepournetfree.github.io/issues) here on GitHub and we will take a look at it as soon possible
## Credits and Legal
This website was jump started using Greyscale Bootstrap. All credit for Greyscale to **David Miller**, Managing Parter at [Iron Summit Media Strategies](http://www.ironsummitmedia.com/), for creating the template.
Start Bootstrap is based on the [Bootstrap](http://getbootstrap.com/) framework created by [Mark Otto](https://twitter.com/mdo) and [Jacob Thorton](https://twitter.com/fat).
Copyright 2013-2015 Iron Summit Media Strategies, LLC. Code released under the [Apache 2.0](https://github.com/IronSummitMedia/startbootstrap-grayscale/blob/gh-pages/LICENSE) license.
| {
"content_hash": "6e3fc9569bdd99111de198c1f62e221c",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 227,
"avg_line_length": 60.516129032258064,
"alnum_prop": 0.7750533049040512,
"repo_name": "KeepOurNetFree/keepournetfree.github.io",
"id": "6e4d74018a0977e8b8eadbc44efec2de08d69201",
"size": "1876",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "7945"
},
{
"name": "HTML",
"bytes": "110136"
},
{
"name": "JavaScript",
"bytes": "8466"
}
],
"symlink_target": ""
} |
<?php if (!defined('IDIR')) { die; }
/**
* geeklog
/**
* geeklog_001 Associate Users
*
* @package ImpEx.geeklog
*
*/
class geeklog_002 extends geeklog_000
{
var $_version = '0.0.1';
var $_dependent = '001';
var $_modulestring = 'Associate Users';
function geeklog_002()
{
}
function init(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
$proceed = $this->check_order($sessionobject,$this->_dependent);
if ($proceed)
{
if($sessionobject->get_session_var('associateperpage') == 0)
{
$sessionobject->add_session_var('associateperpage','25');
}
$displayobject->update_basic('title','Assocatie users');
$displayobject->update_html($displayobject->do_form_header('index','002'));
$displayobject->update_html($displayobject->make_hidden_code('002','WORKING'));
$displayobject->update_html($displayobject->make_hidden_code('associateusers','1'));
$displayobject->update_html($displayobject->make_table_header('Associate Users'));
$displayobject->update_html($displayobject->make_description('<h4>Warning !!</h4> Assosiated users will currently be deleted if you run the import user module twice as it removes users with an importuserid'));
$displayobject->update_html($displayobject->make_description('<p>If you want to associate a geeklog user (in the left column) with an existing vBulletin user,
enter the user id number of the vBulletin user in the box provided, and click the <i>Associate Users</i> button.<br /><br />
To view the list of existing vBulletin users, together with their userid'));
$displayobject->update_html($displayobject->make_input_code('Users per page','associateperpage',$sessionobject->get_session_var('associateperpage'),1,60));
$displayobject->update_html($displayobject->do_form_footer('Continue',''));
$sessionobject->add_session_var('doassociate','0');
$sessionobject->add_session_var('associatestartat','0');
}
else
{
$sessionobject->add_error('notice',
$this->_modulestring,
"$this->_modulestring:init Called when dependent not complete.",
'Call the oduiles in the correct order');
$displayobject->update_html($displayobject->do_form_header('index',''));
$displayobject->update_html($displayobject->make_description('<p>This module is dependent on <i><b>' . $sessionobject->get_module_title($this->_dependent) . '</b></i> cannot run until that is complete.'));
$displayobject->update_html($displayobject->do_form_footer('Continue',''));
$sessionobject->set_session_var('002','FALSE');
$sessionobject->set_session_var('module','000');
}
}
function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
// Turn off the modules display
$displayobject->update_basic('displaymodules','FALSE');
// Get some more usable local vars
$associate_start_at = $sessionobject->get_session_var('associatestartat');
$associate_per_page = $sessionobject->get_session_var('associateperpage');
$target_database_type = $sessionobject->get_session_var('targetdatabasetype');
$target_table_prefix = $sessionobject->get_session_var('targettableprefix');
$source_database_type = $sessionobject->get_session_var('sourcedatabasetype');
$source_table_prefix = $sessionobject->get_session_var('sourcetableprefix');
// Get some usable variables
$associate_users = $sessionobject->get_session_var('associateusers');
$do_associate = $sessionobject->get_session_var('doassociate');
$class_num = substr(get_class($this) , -3);
// Start the timings
if(!$sessionobject->get_session_var($class_num . '_start'))
{
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
// List from the start_at number
if ($associate_users == 1)
{
// Get a list of the geeklog members in this current selection
$userarray = $this->get_geeklog_members_list($Db_source, $source_database_type, $source_table_prefix, $associate_start_at, $associate_per_page);
// Build a list of the ubb users with a box to enter a vB user id into
$displayobject->update_html($displayobject->do_form_header('index','002'));
$displayobject->update_html($displayobject->make_table_header('Association list'));
$displayobject->update_html($displayobject->make_description('Put the exsisting <b>vbulletin user id</b> next to the geeklog user that you wish to associate them with'));
// Set up list variables
$any_more = false;
$counter = 1;
// Build the list
foreach ($userarray as $userid => $username )
{
$displayobject->update_html($displayobject->make_input_code("$counter) Userid - " . $userid . " :: " . $username ,'user_to_ass_' . $userid,'',10));
$any_more = true;
$counter++;
}
// If there are not any more, tell the user and quit out for them.
if(!$any_more)
{
$displayobject->update_html($displayobject->make_description('There are <b>NO</b> more vBulletin users, quit to continue.'));
}
else
{
$sessionobject->set_session_var('associatestartat',$associate_start_at + $associate_per_page);
}
// Continue with the association
$sessionobject->set_session_var('associateusers','0');
$sessionobject->set_session_var('doassociate','1');
$displayobject->update_html($displayobject->make_hidden_code('doassociate','1'));
$displayobject->update_html($displayobject->do_form_footer('Associate',''));
// Quit button
$displayobject->update_html($displayobject->do_form_header('index','002'));
$displayobject->update_html($displayobject->make_hidden_code('associateusers','2'));
$displayobject->update_html($displayobject->make_hidden_code('doassociate','0'));
$displayobject->update_html($displayobject->do_form_footer('Quit',''));
}
// If there are some to assosiate
if ($do_associate == 1)
{
$displayobject->update_html($displayobject->display_now('<p align="center">Associating the users...</p>'));
$users_to_associate = $sessionobject->get_users_to_associate();
foreach ($users_to_associate as $key => $value)
{
if($this->associate_user($Db_target, $target_database_type, $target_table_prefix, substr(key($value),12), current($value)))
{
$displayobject->update_html($displayobject->display_now('<p align="center">geeklog user ' . substr(key($value),12) . ' done.</p>'));
$sessionobject->add_session_var($class_num . '_objects_done',intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1 );
}
else
{
$sessionobject->set_session_var($class_num . '_objects_failed',$sessionobject->get_session_var($class_num . '_objects_failed') + 1 );
$displayobject->update_html($displayobject->display_now('<p align="center">' . substr(key($value),12) . ' NOT done. It is most likely that vBulletin user ' . current($value) . ' dose not exsist.</p>'));
}
}
$sessionobject->delete_users_to_associate();
// Continue with the association
$sessionobject->set_session_var('associateusers','1');
$sessionobject->set_session_var('doassociate','0');
$displayobject->update_html($displayobject->display_now('<p align="center">Continuing with the association.</p>'));
$displayobject->update_html($displayobject->print_redirect('index.php','1'));
}
// Finish the module
if ($associate_users == 2)
{
$sessionobject->set_session_var('002','FINISHED');
$sessionobject->set_session_var('module','000');
$displayobject->update_html($displayobject->display_now('<p align="center">Quitting back to main menu.</p>'));
$displayobject->update_html($displayobject->print_redirect('index.php','1'));
}
}
}// End class
# Autogenerated on : December 3, 2004, 2:46 pm
# By ImpEx-generator 1.4.
/*======================================================================*/
?>
| {
"content_hash": "2dca070462bba64666fc0168a7eda17c",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 212,
"avg_line_length": 39.892857142857146,
"alnum_prop": 0.6775802532293133,
"repo_name": "internetbrands/vbimpex",
"id": "8706740d2fcf7a4704b24cd3e8d1e425f5551ed9",
"size": "8396",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "systems/geeklog/002.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "11340726"
}
],
"symlink_target": ""
} |
package org.apache.spark.util
import java.net.URLClassLoader
import org.scalatest.FunSuite
import org.apache.spark.{LocalSparkContext, SparkContext, SparkException, TestUtils}
import org.apache.spark.util.Utils
class MutableURLClassLoaderSuite extends FunSuite {
val urls2 = List(TestUtils.createJarWithClasses(
classNames = Seq("FakeClass1", "FakeClass2", "FakeClass3"),
toStringValue = "2")).toArray
val urls = List(TestUtils.createJarWithClasses(
classNames = Seq("FakeClass1"),
classNamesWithBase = Seq(("FakeClass2", "FakeClass3")), // FakeClass3 is in parent
toStringValue = "1",
classpathUrls = urls2)).toArray
test("child first") {
val parentLoader = new URLClassLoader(urls2, null)
val classLoader = new ChildFirstURLClassLoader(urls, parentLoader)
val fakeClass = classLoader.loadClass("FakeClass2").newInstance()
val fakeClassVersion = fakeClass.toString
assert(fakeClassVersion === "1")
val fakeClass2 = classLoader.loadClass("FakeClass2").newInstance()
assert(fakeClass.getClass === fakeClass2.getClass)
}
test("parent first") {
val parentLoader = new URLClassLoader(urls2, null)
val classLoader = new MutableURLClassLoader(urls, parentLoader)
val fakeClass = classLoader.loadClass("FakeClass1").newInstance()
val fakeClassVersion = fakeClass.toString
assert(fakeClassVersion === "2")
val fakeClass2 = classLoader.loadClass("FakeClass1").newInstance()
assert(fakeClass.getClass === fakeClass2.getClass)
}
test("child first can fall back") {
val parentLoader = new URLClassLoader(urls2, null)
val classLoader = new ChildFirstURLClassLoader(urls, parentLoader)
val fakeClass = classLoader.loadClass("FakeClass3").newInstance()
val fakeClassVersion = fakeClass.toString
assert(fakeClassVersion === "2")
}
test("child first can fail") {
val parentLoader = new URLClassLoader(urls2, null)
val classLoader = new ChildFirstURLClassLoader(urls, parentLoader)
intercept[java.lang.ClassNotFoundException] {
classLoader.loadClass("FakeClassDoesNotExist").newInstance()
}
}
test("driver sets context class loader in local mode") {
// Test the case where the driver program sets a context classloader and then runs a job
// in local mode. This is what happens when ./spark-submit is called with "local" as the
// master.
val original = Thread.currentThread().getContextClassLoader
val className = "ClassForDriverTest"
val jar = TestUtils.createJarWithClasses(Seq(className))
val contextLoader = new URLClassLoader(Array(jar), Utils.getContextOrSparkClassLoader)
Thread.currentThread().setContextClassLoader(contextLoader)
val sc = new SparkContext("local", "driverLoaderTest")
try {
sc.makeRDD(1 to 5, 2).mapPartitions { x =>
val loader = Thread.currentThread().getContextClassLoader
Class.forName(className, true, loader).newInstance()
Seq().iterator
}.count()
}
catch {
case e: SparkException if e.getMessage.contains("ClassNotFoundException") =>
fail("Local executor could not find class", e)
case t: Throwable => fail("Unexpected exception ", t)
}
sc.stop()
Thread.currentThread().setContextClassLoader(original)
}
}
| {
"content_hash": "9ebdf69678c3a9629b6d445c63a0ddce",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 92,
"avg_line_length": 37.625,
"alnum_prop": 0.720628209000302,
"repo_name": "hengyicai/OnlineAggregationUCAS",
"id": "31e3b7e7bb71befc463404df93728d2b02c9615c",
"size": "4111",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "core/src/test/scala/org/apache/spark/util/MutableURLClassLoaderSuite.scala",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "35774"
},
{
"name": "CSS",
"bytes": "4512"
},
{
"name": "Java",
"bytes": "605689"
},
{
"name": "JavaScript",
"bytes": "21537"
},
{
"name": "Makefile",
"bytes": "6840"
},
{
"name": "Python",
"bytes": "924210"
},
{
"name": "Roff",
"bytes": "5379"
},
{
"name": "SQLPL",
"bytes": "3603"
},
{
"name": "Scala",
"bytes": "6747601"
},
{
"name": "Shell",
"bytes": "141008"
}
],
"symlink_target": ""
} |
package main
import (
"open-match.dev/open-match/examples/functions/golang/backfill/mmf"
)
const (
queryServiceAddr = "open-match-query.open-match.svc.cluster.local:50503" // Address of the QueryService endpoint.
serverPort = 50502 // The port for hosting the Match Function.
)
func main() {
mmf.Start(queryServiceAddr, serverPort)
}
| {
"content_hash": "1923a06f52191eabfb24239296750857",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 117,
"avg_line_length": 28.214285714285715,
"alnum_prop": 0.6531645569620254,
"repo_name": "googleforgames/open-match",
"id": "81583f922f44147f8f9d2fb2218756d5589e57d7",
"size": "1359",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "examples/functions/golang/backfill/main.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2533"
},
{
"name": "Dockerfile",
"bytes": "18102"
},
{
"name": "Go",
"bytes": "649681"
},
{
"name": "HCL",
"bytes": "14223"
},
{
"name": "Makefile",
"bytes": "53436"
},
{
"name": "Mustache",
"bytes": "773"
},
{
"name": "Smarty",
"bytes": "11161"
}
],
"symlink_target": ""
} |
import { FC, ReactElement, useEffect } from 'react';
import {
To, useNavigate, NavigateOptions, useHref,
} from 'react-router-dom';
import { RedirectStatusCode } from '../utils/redirect.js';
import { HttpStatus } from './http-status.js';
/**
* Redirect to the provided location, default statusCode 307 (Temporary redirect)
* @param Redirect Props {
* children?: ReactElement | ReactElement[],
* to: To | URL,
* statusCode: RedirectStatusCode,
* } & NavigateOptions
* @returns HttpStatus
*/
export const Redirect: FC<{
children?: ReactElement | ReactElement[],
to: To | URL,
statusCode?: RedirectStatusCode,
} & NavigateOptions> = ({
to, statusCode = 307, replace, state, preventScrollReset, relative,
}) => {
const navigate = useNavigate();
const href = useHref(to, { relative });
useEffect(() => {
navigate(to, {
replace, state, preventScrollReset, relative,
});
}, []);
return (
<HttpStatus statusCode={statusCode} location={href} relative={relative} />
);
};
| {
"content_hash": "3d87f1994e5f4fdb72962251d51c582a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 81,
"avg_line_length": 29.91176470588235,
"alnum_prop": 0.6705998033431662,
"repo_name": "Atyantik/react-pwa",
"id": "86214c533fbd1a86d030488670b42ce05238aa40",
"size": "1017",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/core/src/components/redirect.tsx",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "2044"
},
{
"name": "TypeScript",
"bytes": "114702"
}
],
"symlink_target": ""
} |
package com.dremio.services.configuration;
import com.dremio.datastore.VersionExtractor;
import com.dremio.datastore.api.LegacyKVStore;
import com.dremio.datastore.api.LegacyKVStoreCreationFunction;
import com.dremio.datastore.api.LegacyKVStoreProvider;
import com.dremio.datastore.api.LegacyStoreBuildingFactory;
import com.dremio.datastore.format.Format;
import com.dremio.services.configuration.proto.ConfigurationEntry;
import com.google.common.base.Preconditions;
/**
* General store to store k/v pairs.
*/
public class ConfigurationStore {
private static final String CONFIG_STORE = "configuration";
private final LegacyKVStore<String, ConfigurationEntry> store;
public ConfigurationStore(final LegacyKVStoreProvider storeProvider) {
Preconditions.checkNotNull(storeProvider, "kvStore provider required");
store = storeProvider.getStore(ConfigurationStoreCreator.class);
}
public void put(String key, ConfigurationEntry value) {
store.put(key, value);
}
public ConfigurationEntry get(String key) {
return store.get(key);
}
public void delete(String key) {
store.delete(key);
}
/**
* Support storage creator.
*/
public static final class ConfigurationStoreCreator implements LegacyKVStoreCreationFunction<String, ConfigurationEntry> {
@Override
public LegacyKVStore<String, ConfigurationEntry> build(LegacyStoreBuildingFactory factory) {
return factory.<String, ConfigurationEntry>newStore()
.name(CONFIG_STORE)
.keyFormat(Format.ofString())
.valueFormat(Format.ofProtostuff(ConfigurationEntry.class))
.versionExtractor(ConfigurationEntryVersionExtractor.class)
.build();
}
}
/**
* Version extractor
*/
public static final class ConfigurationEntryVersionExtractor implements VersionExtractor<ConfigurationEntry> {
@Override
public Long getVersion(ConfigurationEntry value) {
return value.getVersion();
}
@Override
public void setVersion(ConfigurationEntry value, Long tag) {
value.setVersion(tag);
}
@Override
public String getTag(ConfigurationEntry value) {
return value.getTag();
}
@Override
public void setTag(ConfigurationEntry value, String tag) {
value.setTag(tag);
}
}
}
| {
"content_hash": "c74336256daf8875d82427f0854f4030",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 124,
"avg_line_length": 30.144736842105264,
"alnum_prop": 0.7472719336534265,
"repo_name": "dremio/dremio-oss",
"id": "6b8ec8b80f9b21c9f03202d3b4222056a70561ac",
"size": "2901",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "services/configuration/src/main/java/com/dremio/services/configuration/ConfigurationStore.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "47376"
},
{
"name": "Dockerfile",
"bytes": "1668"
},
{
"name": "FreeMarker",
"bytes": "132156"
},
{
"name": "GAP",
"bytes": "15936"
},
{
"name": "HTML",
"bytes": "6544"
},
{
"name": "Java",
"bytes": "39679012"
},
{
"name": "JavaScript",
"bytes": "5439822"
},
{
"name": "Less",
"bytes": "547002"
},
{
"name": "SCSS",
"bytes": "95688"
},
{
"name": "Shell",
"bytes": "16063"
},
{
"name": "TypeScript",
"bytes": "887739"
}
],
"symlink_target": ""
} |
module Ssb.Address where
data Address = Address {host :: String, port :: Int} deriving (Show, Eq)
| {
"content_hash": "cfe300a65012440c60a6c18e2b5656e8",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 25,
"alnum_prop": 0.7,
"repo_name": "bkil-syslogng/haskell-scuttlebutt",
"id": "3504bdd664ea3bab00e610e1e90ec0a63f762864",
"size": "100",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Ssb/Address.hs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Haskell",
"bytes": "9432"
}
],
"symlink_target": ""
} |
#include "postgres.h"
#include "fmgr.h"
#include "mb/pg_wchar.h"
#include "../../Unicode/gbk_to_utf8.map"
#include "../../Unicode/utf8_to_gbk.map"
PG_MODULE_MAGIC;
PG_FUNCTION_INFO_V1(gbk_to_utf8);
PG_FUNCTION_INFO_V1(utf8_to_gbk);
/* ----------
* conv_proc(
* INTEGER, -- source encoding id
* INTEGER, -- destination encoding id
* CSTRING, -- source string (null terminated C string)
* CSTRING, -- destination string (null terminated C string)
* INTEGER -- source string length
* ) returns VOID;
* ----------
*/
Datum
gbk_to_utf8(PG_FUNCTION_ARGS)
{
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4);
CHECK_ENCODING_CONVERSION_ARGS(PG_GBK, PG_UTF8);
LocalToUtf(src, len, dest,
LUmapGBK, lengthof(LUmapGBK),
NULL, 0,
NULL,
PG_GBK);
PG_RETURN_VOID();
}
Datum
utf8_to_gbk(PG_FUNCTION_ARGS)
{
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4);
CHECK_ENCODING_CONVERSION_ARGS(PG_UTF8, PG_GBK);
UtfToLocal(src, len, dest,
ULmapGBK, lengthof(ULmapGBK),
NULL, 0,
NULL,
PG_GBK);
PG_RETURN_VOID();
}
| {
"content_hash": "f4aa154d2c90951b2ab4461d4a7e255c",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 62,
"avg_line_length": 22.17241379310345,
"alnum_prop": 0.6423017107309487,
"repo_name": "ashwinstar/gpdb",
"id": "d6613a0e85100d6f581b7eee00605dd478a7a23a",
"size": "1706",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "3724"
},
{
"name": "Awk",
"bytes": "836"
},
{
"name": "Batchfile",
"bytes": "12768"
},
{
"name": "C",
"bytes": "42705726"
},
{
"name": "C++",
"bytes": "2839973"
},
{
"name": "CMake",
"bytes": "3425"
},
{
"name": "CSS",
"bytes": "7407"
},
{
"name": "Csound Score",
"bytes": "223"
},
{
"name": "DTrace",
"bytes": "3873"
},
{
"name": "Dockerfile",
"bytes": "11990"
},
{
"name": "Emacs Lisp",
"bytes": "3488"
},
{
"name": "Fortran",
"bytes": "14863"
},
{
"name": "GDB",
"bytes": "576"
},
{
"name": "Gherkin",
"bytes": "342783"
},
{
"name": "HTML",
"bytes": "653351"
},
{
"name": "JavaScript",
"bytes": "23969"
},
{
"name": "Lex",
"bytes": "229553"
},
{
"name": "M4",
"bytes": "114378"
},
{
"name": "Makefile",
"bytes": "455445"
},
{
"name": "Objective-C",
"bytes": "38376"
},
{
"name": "PLSQL",
"bytes": "160856"
},
{
"name": "PLpgSQL",
"bytes": "5722287"
},
{
"name": "Perl",
"bytes": "798287"
},
{
"name": "PowerShell",
"bytes": "422"
},
{
"name": "Python",
"bytes": "3267988"
},
{
"name": "Raku",
"bytes": "698"
},
{
"name": "Roff",
"bytes": "32437"
},
{
"name": "Ruby",
"bytes": "81695"
},
{
"name": "SQLPL",
"bytes": "313387"
},
{
"name": "Shell",
"bytes": "453847"
},
{
"name": "TSQL",
"bytes": "3294076"
},
{
"name": "XS",
"bytes": "6983"
},
{
"name": "Yacc",
"bytes": "672568"
},
{
"name": "sed",
"bytes": "1231"
}
],
"symlink_target": ""
} |
<!doctype html>
<title>CodeMirror: Eiffel mode</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../../doc/docs.css">
<link rel="stylesheet" href="../../lib/codemirror.css">
<link rel="stylesheet" href="../../theme/neat.css">
<script src="../../lib/codemirror.js"></script>
<script src="eiffel.js"></script>
<style>
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
.cm-s-default span.cm-arrow { color: red; }
</style>
<div id=nav>
<a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
<ul>
<li><a href="../../index.html">Home</a>
<li><a href="../../doc/manual.html">Manual</a>
<li><a href="https://github.com/codemirror/codemirror">Code</a>
</ul>
<ul>
<li><a href="../index.html">Language modes</a>
<li><a class=active href="#">Eiffel</a>
</ul>
</div>
<article>
<h2>Eiffel mode</h2>
<form><textarea id="code" name="code">
note
description: "[
Project-wide universal properties.
This class is an ancestor to all developer-written classes.
ANY may be customized for individual projects or teams.
]"
library: "Free implementation of ELKS library"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date: 2013-01-25 11:49:00 -0800 (Fri, 25 Jan 2013) $"
revision: "$Revision: 712 $"
class
ANY
feature -- Customization
feature -- Access
generator: STRING
-- Name of current object's generating class
-- (base class of the type of which it is a direct instance)
external
"built_in"
ensure
generator_not_void: Result /= Void
generator_not_empty: not Result.is_empty
end
generating_type: TYPE [detachable like Current]
-- Type of current object
-- (type of which it is a direct instance)
do
Result := {detachable like Current}
ensure
generating_type_not_void: Result /= Void
end
feature -- Status report
conforms_to (other: ANY): BOOLEAN
-- Does type of current object conform to type
-- of `other' (as per Eiffel: The Language, chapter 13)?
require
other_not_void: other /= Void
external
"built_in"
end
same_type (other: ANY): BOOLEAN
-- Is type of current object identical to type of `other'?
require
other_not_void: other /= Void
external
"built_in"
ensure
definition: Result = (conforms_to (other) and
other.conforms_to (Current))
end
feature -- Comparison
is_equal (other: like Current): BOOLEAN
-- Is `other' attached to an object considered
-- equal to current object?
require
other_not_void: other /= Void
external
"built_in"
ensure
symmetric: Result implies other ~ Current
consistent: standard_is_equal (other) implies Result
end
frozen standard_is_equal (other: like Current): BOOLEAN
-- Is `other' attached to an object of the same type
-- as current object, and field-by-field identical to it?
require
other_not_void: other /= Void
external
"built_in"
ensure
same_type: Result implies same_type (other)
symmetric: Result implies other.standard_is_equal (Current)
end
frozen equal (a: detachable ANY; b: like a): BOOLEAN
-- Are `a' and `b' either both void or attached
-- to objects considered equal?
do
if a = Void then
Result := b = Void
else
Result := b /= Void and then
a.is_equal (b)
end
ensure
definition: Result = (a = Void and b = Void) or else
((a /= Void and b /= Void) and then
a.is_equal (b))
end
frozen standard_equal (a: detachable ANY; b: like a): BOOLEAN
-- Are `a' and `b' either both void or attached to
-- field-by-field identical objects of the same type?
-- Always uses default object comparison criterion.
do
if a = Void then
Result := b = Void
else
Result := b /= Void and then
a.standard_is_equal (b)
end
ensure
definition: Result = (a = Void and b = Void) or else
((a /= Void and b /= Void) and then
a.standard_is_equal (b))
end
frozen is_deep_equal (other: like Current): BOOLEAN
-- Are `Current' and `other' attached to isomorphic object structures?
require
other_not_void: other /= Void
external
"built_in"
ensure
shallow_implies_deep: standard_is_equal (other) implies Result
same_type: Result implies same_type (other)
symmetric: Result implies other.is_deep_equal (Current)
end
frozen deep_equal (a: detachable ANY; b: like a): BOOLEAN
-- Are `a' and `b' either both void
-- or attached to isomorphic object structures?
do
if a = Void then
Result := b = Void
else
Result := b /= Void and then a.is_deep_equal (b)
end
ensure
shallow_implies_deep: standard_equal (a, b) implies Result
both_or_none_void: (a = Void) implies (Result = (b = Void))
same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b))
symmetric: Result implies deep_equal (b, a)
end
feature -- Duplication
frozen twin: like Current
-- New object equal to `Current'
-- `twin' calls `copy'; to change copying/twinning semantics, redefine `copy'.
external
"built_in"
ensure
twin_not_void: Result /= Void
is_equal: Result ~ Current
end
copy (other: like Current)
-- Update current object using fields of object attached
-- to `other', so as to yield equal objects.
require
other_not_void: other /= Void
type_identity: same_type (other)
external
"built_in"
ensure
is_equal: Current ~ other
end
frozen standard_copy (other: like Current)
-- Copy every field of `other' onto corresponding field
-- of current object.
require
other_not_void: other /= Void
type_identity: same_type (other)
external
"built_in"
ensure
is_standard_equal: standard_is_equal (other)
end
frozen clone (other: detachable ANY): like other
-- Void if `other' is void; otherwise new object
-- equal to `other'
--
-- For non-void `other', `clone' calls `copy';
-- to change copying/cloning semantics, redefine `copy'.
obsolete
"Use `twin' instead."
do
if other /= Void then
Result := other.twin
end
ensure
equal: Result ~ other
end
frozen standard_clone (other: detachable ANY): like other
-- Void if `other' is void; otherwise new object
-- field-by-field identical to `other'.
-- Always uses default copying semantics.
obsolete
"Use `standard_twin' instead."
do
if other /= Void then
Result := other.standard_twin
end
ensure
equal: standard_equal (Result, other)
end
frozen standard_twin: like Current
-- New object field-by-field identical to `other'.
-- Always uses default copying semantics.
external
"built_in"
ensure
standard_twin_not_void: Result /= Void
equal: standard_equal (Result, Current)
end
frozen deep_twin: like Current
-- New object structure recursively duplicated from Current.
external
"built_in"
ensure
deep_twin_not_void: Result /= Void
deep_equal: deep_equal (Current, Result)
end
frozen deep_clone (other: detachable ANY): like other
-- Void if `other' is void: otherwise, new object structure
-- recursively duplicated from the one attached to `other'
obsolete
"Use `deep_twin' instead."
do
if other /= Void then
Result := other.deep_twin
end
ensure
deep_equal: deep_equal (other, Result)
end
frozen deep_copy (other: like Current)
-- Effect equivalent to that of:
-- `copy' (`other' . `deep_twin')
require
other_not_void: other /= Void
do
copy (other.deep_twin)
ensure
deep_equal: deep_equal (Current, other)
end
feature {NONE} -- Retrieval
frozen internal_correct_mismatch
-- Called from runtime to perform a proper dynamic dispatch on `correct_mismatch'
-- from MISMATCH_CORRECTOR.
local
l_msg: STRING
l_exc: EXCEPTIONS
do
if attached {MISMATCH_CORRECTOR} Current as l_corrector then
l_corrector.correct_mismatch
else
create l_msg.make_from_string ("Mismatch: ")
create l_exc
l_msg.append (generating_type.name)
l_exc.raise_retrieval_exception (l_msg)
end
end
feature -- Output
io: STD_FILES
-- Handle to standard file setup
once
create Result
Result.set_output_default
ensure
io_not_void: Result /= Void
end
out: STRING
-- New string containing terse printable representation
-- of current object
do
Result := tagged_out
ensure
out_not_void: Result /= Void
end
frozen tagged_out: STRING
-- New string containing terse printable representation
-- of current object
external
"built_in"
ensure
tagged_out_not_void: Result /= Void
end
print (o: detachable ANY)
-- Write terse external representation of `o'
-- on standard output.
do
if o /= Void then
io.put_string (o.out)
end
end
feature -- Platform
Operating_environment: OPERATING_ENVIRONMENT
-- Objects available from the operating system
once
create Result
ensure
operating_environment_not_void: Result /= Void
end
feature {NONE} -- Initialization
default_create
-- Process instances of classes with no creation clause.
-- (Default: do nothing.)
do
end
feature -- Basic operations
default_rescue
-- Process exception for routines with no Rescue clause.
-- (Default: do nothing.)
do
end
frozen do_nothing
-- Execute a null action.
do
end
frozen default: detachable like Current
-- Default value of object's type
do
end
frozen default_pointer: POINTER
-- Default value of type `POINTER'
-- (Avoid the need to write `p'.`default' for
-- some `p' of type `POINTER'.)
do
ensure
-- Result = Result.default
end
frozen as_attached: attached like Current
-- Attached version of Current
-- (Can be used during transitional period to convert
-- non-void-safe classes to void-safe ones.)
do
Result := Current
end
invariant
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "text/x-eiffel",
indentUnit: 4,
lineNumbers: true,
theme: "neat"
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-eiffel</code>.</p>
<p> Created by <a href="https://github.com/ynh">YNH</a>.</p>
</article>
| {
"content_hash": "a548b3ba1e7556487f1eb8c7f8d3c6de",
"timestamp": "",
"source": "github",
"line_count": 429,
"max_line_length": 93,
"avg_line_length": 30.72027972027972,
"alnum_prop": 0.5421503907731998,
"repo_name": "jabbrass/brackets-server-1.1",
"id": "346fed9e42b1cd7abff1f0109b7bb765f56aee2b",
"size": "13179",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "brackets-src/src/thirdparty/CodeMirror2/mode/eiffel/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "790697"
},
{
"name": "Clojure",
"bytes": "28"
},
{
"name": "JavaScript",
"bytes": "13907369"
},
{
"name": "Makefile",
"bytes": "2176"
},
{
"name": "PHP",
"bytes": "28796"
},
{
"name": "Ruby",
"bytes": "9030"
},
{
"name": "Shell",
"bytes": "14931"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Docs for page SimpleMimeEntity.php</title>
<link rel="stylesheet" href="../../media/stylesheet.css" />
<script src="../../media/lib/classTree.js"></script>
<link id="webfx-tab-style-sheet" type="text/css" rel="stylesheet" href="../../media/lib/tab.webfx.css" />
<script type="text/javascript" src="../../media/lib/tabpane.js"></script>
<script language="javascript" type="text/javascript" src="../../media/lib/ua.js"></script>
<script language="javascript" type="text/javascript">
var imgPlus = new Image();
var imgMinus = new Image();
imgPlus.src = "../../media/images/plus.gif";
imgMinus.src = "../../media/images/minus.gif";
function showNode(Node){
switch(navigator.family){
case 'nn4':
// Nav 4.x code fork...
var oTable = document.layers["span" + Node];
var oImg = document.layers["img" + Node];
break;
case 'ie4':
// IE 4/5 code fork...
var oTable = document.all["span" + Node];
var oImg = document.all["img" + Node];
break;
case 'gecko':
// Standards Compliant code fork...
var oTable = document.getElementById("span" + Node);
var oImg = document.getElementById("img" + Node);
break;
}
oImg.src = imgMinus.src;
oTable.style.display = "block";
}
function hideNode(Node){
switch(navigator.family){
case 'nn4':
// Nav 4.x code fork...
var oTable = document.layers["span" + Node];
var oImg = document.layers["img" + Node];
break;
case 'ie4':
// IE 4/5 code fork...
var oTable = document.all["span" + Node];
var oImg = document.all["img" + Node];
break;
case 'gecko':
// Standards Compliant code fork...
var oTable = document.getElementById("span" + Node);
var oImg = document.getElementById("img" + Node);
break;
}
oImg.src = imgPlus.src;
oTable.style.display = "none";
}
function nodeIsVisible(Node){
switch(navigator.family){
case 'nn4':
// Nav 4.x code fork...
var oTable = document.layers["span" + Node];
break;
case 'ie4':
// IE 4/5 code fork...
var oTable = document.all["span" + Node];
break;
case 'gecko':
// Standards Compliant code fork...
var oTable = document.getElementById("span" + Node);
break;
}
return (oTable && oTable.style.display == "block");
}
function toggleNodeVisibility(Node){
if (nodeIsVisible(Node)){
hideNode(Node);
}else{
showNode(Node);
}
}
</script>
<!-- template designed by Julien Damon based on PHPEdit's generated templates, and tweaked by Greg Beaver -->
<body bgcolor="#ffffff" >
<h2>File: /vendors/swiftMailer/classes/Swift/Mime/SimpleMimeEntity.php</h2>
<div class="tab-pane" id="tabPane1">
<script type="text/javascript">
tp1 = new WebFXTabPane( document.getElementById( "tabPane1" ) );
</script>
<div class="tab-page" id="Description">
<h2 class="tab">Description</h2>
<!-- ========== Info from phpDoc block ========= -->
<ul>
</ul>
<!-- =========== Used Classes =========== -->
<A NAME='classes_summary'><!-- --></A>
<h3>Classes defined in this file</h3>
<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
<THEAD>
<TR><TD STYLE="width:20%"><h4>CLASS NAME</h4></TD><TD STYLE="width: 80%"><h4>DESCRIPTION</h4></TD></TR>
</THEAD>
<TBODY>
<TR BGCOLOR='white' CLASS='TableRowColor'>
<TD><a href="Swift_Mime_SimpleMimeEntity.html">Swift_Mime_SimpleMimeEntity</a></TD>
<TD>A MIME entity, in a multipart message.</TD>
</TR>
</TBODY>
</TABLE>
</div>
<script type="text/javascript">tp1.addTabPage( document.getElementById( "Description" ) );</script>
<div class="tab-page" id="tabPage1">
<!-- ============ Includes DETAIL =========== -->
<h2 class="tab">Include/Require Statements</h2>
<script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage1" ) );</script>
</div>
<div class="tab-page" id="tabPage2">
<!-- ============ GLOBAL DETAIL =========== -->
<h2 class="tab">Global Variables</h2>
<script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage2" ) );</script>
</div>
<div class="tab-page" id="tabPage3">
<!-- ============ CONSTANT DETAIL =========== -->
<A NAME='constant_detail'></A>
<h2 class="tab">Constants</h2>
<script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage3" ) );</script>
</div>
<div class="tab-page" id="tabPage4">
<!-- ============ FUNCTION DETAIL =========== -->
<h2 class="tab">Functions</h2>
<script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage4" ) );</script>
</div>
</div>
<script type="text/javascript">
//<![CDATA[
setupAllTabs();
//]]>
</script>
<div id="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 20:45:30 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
</div>
</body>
</html>
| {
"content_hash": "d8592ea2c2b95c6770ca069d9c9a21b6",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 135,
"avg_line_length": 32.58181818181818,
"alnum_prop": 0.5861235119047619,
"repo_name": "kmchugh/YiiPlinth",
"id": "b12944c0510440386532a7cd2b226c5ece1e8cb8",
"size": "5376",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "protected/extensions/Email/Mail/doc/Swift/Mime/_vendors---swiftMailer---classes---Swift---Mime---SimpleMimeEntity.php.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "21742"
},
{
"name": "JavaScript",
"bytes": "29206"
},
{
"name": "PHP",
"bytes": "21765471"
},
{
"name": "Shell",
"bytes": "760"
}
],
"symlink_target": ""
} |
layout: lab
num: lab07
ready: true
desc: "arrays of structs, reading from csv files"
submit_cs: https://submit.cs.ucsb.edu/form/project/817
---
# Goals of this lab
The goal of this lab is get more practice with iterating through arrays and linked lists, and applying recursion to solving problems. Continue to practice code tracing to reason about your code. We request that you DO NOT ask the staff to debug your code. They have been specifically instructed not to debug for you, rather to guide in the process.
# Step by Step Instructions: PLEASE READ CAREFULLY!
## Step 1: Getting Started
1. Decide if you are working alone, or working in a pair. Pair programming is OPTIONAL for this lab.
2. If you are working as a pair, go to submit.cs, navigate to this lab page and create a team for you and your pair partner. Choose who will be the first driver and who will start as navigator, and then remember to switch (at least once) during the lab.
3. Go to github and create a git repo for this lab following the naming convention specified in previous labs (this step carries style points, see our feedback on previous labs to understand what we are looking for). If you are working with a partner only one of you needs to create the repo.
4. If you are working with a partner and you are the one who created the github repo, add your partner as a collborator on the repo
5. Decide on initial navigator and driver.
6. Driver, log on to your CSIL account.
7. Open a terminal window and log into the correct machine.
8. Change into your CS 16 directory
Note: Remember to push your work to github at the end of EVERY work session. That way, both partners always have access to the latest version of the code even if the code is being developed on one partner's CoE account.
## Step 2: Obtaining the starter code
This step is similar to lab02, first open terminal and go to the directory where you cloned the starter code in lab02 and pull the latest version of the starter code.
{% include cs16-s17-starter-code.md %}
```
cd ~/cs16/cs16-sp17-starter-code
git pull
```
Clone your github repo in the ~/cs16/ directory. Then cd into your repo directory.
```
cd ../lab07_gaucho_ally
```
Copy the code from your starter code directory to your local lab07 repo using the following command.
```
cp ~/cs16/cs16-sp17-starter-code/lab07/* ./
```
Typing the list (ls) command should show you the following files in your current directory
```
[dimirza@csil-03 lab07-startercode]$ ls
addIntToEndOfListTest.cpp mafTest4.cpp mllfTest7.cpp
arrayFuncs.h Makefile moreArrayFuncs.cpp
linkedListFuncs.cpp mllfTest1.cpp moreArrayFuncs.h
linkedListFuncs.h mllfTest2.cpp moreLinkedListFuncs.cpp
linkedList.h mllfTest3.cpp moreLinkedListFuncs.h
mafTest1.cpp mllfTest4.cpp README.md
mafTest2.cpp mllfTest5.cpp tddFuncs.cpp
mafTest3.cpp mllfTest6.cpp tddFuncs.h
[dimirza@csil-03 lab07-startercode]$
```
## Step 3: Reviewing the files and what your tasks are
Here is a list of your tasks for this lab:
### Step 3a: Familiarize yourself with the big picture
Type "make tests" and you will see some tests pass, but some fail.
You are finished when all the tests pass.
There are only two files that you need to edit this week, and both are based on functions that you worked with in previous labs.
* <code>moreArrayFuncs.cpp</code> contains more functions that deal with arrays. These are in addition to the arrayFuncs.cpp that you worked with before in lab04.
* <code>moreLinkedListFuncs.cpp</code> contains more functions that deal with linked lists. These are in addition to the linkedListFuncs.cpp that you worked with before in lab06.
### Step 3b: Work on the array functions first
Even if you only get these working, this will be an important step in terms of partial credit for this lab. So concentrate on these first.
There are four files that run test cases for the functions in moreArrayFuncs.cpp. These are shown in the following table. In each case, you should work on one file at a time. For example, your first step is:
* type <code>make mafTest1</code> to compile and link mafTest1.cpp
* type <code>./mafTest1</code> to run the program that tests <code>indexOfMax</code> and <code>indexOfMin</code> from moreArrayFuncs.cpp
* edit the code in the file moreArrayFuncs.cpp so that <code>indexOfMax</code> and <code>indexOfMin</code> are correct.
* repeat the steps above until the tests in mafTest1.cpp pass.
* Make sure to push your code to github as you make progress on each part.
Then do the same for the other lines in this table, i.e.. tests mafTest2.cpp through mafTest4.cpp
|file| command to compile|command to run| what it tests
|--- |---|---|---
| mafTest1.cpp| make mafTest1| ./mafTest1| <code>indexOfMax</code> and <code>indexOfMin</code> from moreArrayFuncs.cpp
| mafTest2.cpp| make mafTest2| ./mafTest2| <code>largestValue</code> and <code>smallestValue</code> from moreArrayFuncs.cpp
| mafTest3.cpp| make mafTest3| ./mafTest3| <code>sum</code> from moreArrayFuncs.cpp
| mafTest4.cpp| make mafTest4| ./mafTest4| <code>copyElements</code>, <code>copyOddOnly</code> (*see tip box below), and <code>multiplyPairwise</code> from moreArrayFuncs.cpp
Then, submit your code to submit.cs and see if the tests for the array functions are at least passing on submit.cs. The command for that is listed in step 4 of the lab.
When your array tests pass, you can move on to the linked list part. Or, you can go ahead and move on, and wait to ask for help from a TA.
### Step 3c: COPY A FILE FROM YOUR COMPLETED lab06
The next step is crucial. You need a function from your completed lab06 in order for your lab07 to work.
That function is in the file linkedListFuncs.cpp. Note that in your lab07 directory, those functions are only stubs, but THESE ARE THE SAME FUNCTIONS YOU WROTE IN lab06.
So, you need to use a Unix command to copy the file linkedListFuncs.cpp from your lab06 github directory to your lab07 github directory.
I am NOT going to tell you what that command is. By now, you should know. And if you don't, you should be able to look it up. Also I may ask you about this on the final exam.
Once you've copied that over, push your code to github. Now you are ready for the next step.
### Step 3d: Work on the linked list functions next
Working on the linked list functions below is one of the most important things you can do to prepare for the final exam.
There are seven files that run tests cases for the functions in moreLinkedListFuncs.cpp.
Proceed as you did for the four mafTest1.cpp through mafTest4.cpp files.
|file| command to compile|command to run| what it tests
|--- |---|---|---
| mllfTest1.cpp| make mllfTest1| ./mllfTest1|<code>pointerToMax</code> from moreLinkedListFuncs.cpp
| mllfTest2.cpp| make mllfTest2| ./mllfTest2| <code>pointerToMin</code> from moreLinkedListFuncs.cpp
| mllfTest3.cpp| make mllfTest3| ./mllfTest3| <code>largestValue</code> from moreLinkedListFuncs.cpp
| mllfTest4.cpp| make mllfTest4| ./mllfTest4| <code>smallestValue</code> from moreLinkedListFuncs.cpp
| mllfTest5.cpp| make mllfTest5| ./mllfTest5| <code>sum</code> from moreLinkedListFuncs.cpp
| mllfTest6.cpp| make mllfTest6| ./mllfTest6| <code>deleteNodeIteratively; deleteNodeRecursively</code> from moreLinkedListFuncs.cpp
| mllfTest7.cpp| make mllfTest7| ./mllfTest7| <code>insertNodeToSortedList</code> from moreLinkedListFuncs.cpp
Note: current output of mllfTest6 and mllfTest7 are INCORRECT. You should first write your own test code and implement the functions (deleteNodeIteratively, deleteNodeRecursivelyHelper; insertNodeToSortedList) in moreLinkedListFuncs.cpp to make them work correctly! We will test your code using our own test cases, so don't try to hard code it! Note that these functions are more challenging than the other functions in this lab, so think them through carefully before you start coding.
## Step 4: Checking your work before submitting
When you are finished, you should be able to type <code>make clean</code> and then <code>make tests</code> and see the following output:
```
-bash-4.2$ make clean
/bin/rm -f mafTest1 mafTest2 mafTest3 mafTest4 addIntToEndOfListTest mllfTest1 mllfTest2 mllfTest3 mllfTest4 mllfTest5 mllfTest6 mllfTest7 *.o
-bash-4.2$ make tests
clang++ -Wall -Wno-uninitialized -c -o mafTest1.o mafTest1.cpp
clang++ -Wall -Wno-uninitialized -c -o linkedListFuncs.o linkedListFuncs.cpp
clang++ -Wall -Wno-uninitialized -c -o moreArrayFuncs.o moreArrayFuncs.cpp
clang++ -Wall -Wno-uninitialized -c -o moreLinkedListFuncs.o moreLinkedListFuncs.cpp
clang++ -Wall -Wno-uninitialized -c -o tddFuncs.o tddFuncs.cpp
clang++ -Wall -Wno-uninitialized mafTest1.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o mafTest1
clang++ -Wall -Wno-uninitialized -c -o mafTest2.o mafTest2.cpp
clang++ -Wall -Wno-uninitialized mafTest2.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o mafTest2
clang++ -Wall -Wno-uninitialized -c -o mafTest3.o mafTest3.cpp
clang++ -Wall -Wno-uninitialized mafTest3.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o mafTest3
clang++ -Wall -Wno-uninitialized -c -o mafTest4.o mafTest4.cpp
clang++ -Wall -Wno-uninitialized mafTest4.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o mafTest4
clang++ -Wall -Wno-uninitialized -c -o addIntToEndOfListTest.o addIntToEndOfListTest.cpp
clang++ -Wall -Wno-uninitialized addIntToEndOfListTest.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o addIntToEndOfListTest
clang++ -Wall -Wno-uninitialized -c -o mllfTest1.o mllfTest1.cpp
clang++ -Wall -Wno-uninitialized mllfTest1.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o mllfTest1
clang++ -Wall -Wno-uninitialized -c -o mllfTest2.o mllfTest2.cpp
clang++ -Wall -Wno-uninitialized mllfTest2.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o mllfTest2
clang++ -Wall -Wno-uninitialized -c -o mllfTest3.o mllfTest3.cpp
clang++ -Wall -Wno-uninitialized mllfTest3.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o mllfTest3
clang++ -Wall -Wno-uninitialized -c -o mllfTest4.o mllfTest4.cpp
clang++ -Wall -Wno-uninitialized mllfTest4.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o mllfTest4
clang++ -Wall -Wno-uninitialized -c -o mllfTest5.o mllfTest5.cpp
clang++ -Wall -Wno-uninitialized mllfTest5.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o mllfTest5
clang++ -Wall -Wno-uninitialized -c -o mllfTest6.o mllfTest6.cpp
clang++ -Wall -Wno-uninitialized mllfTest6.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o mllfTest6
clang++ -Wall -Wno-uninitialized -c -o mllfTest7.o mllfTest7.cpp
clang++ -Wall -Wno-uninitialized mllfTest7.o linkedListFuncs.o moreArrayFuncs.o moreLinkedListFuncs.o tddFuncs.o -o mllfTest7
./mafTest1
PASSED: arrayToString(fiveThrees,5)
PASSED: arrayToString(zeros,3)
PASSED: arrayToString(empty,0)
PASSED: arrayToString(primes,5)
PASSED: arrayToString(primes,10)
PASSED: arrayToString(meaning,1)
PASSED: arrayToString(mix1,10)
PASSED: arrayToString(mix2,10)
PASSED: arrayToString(descending,5)
PASSED: indexOfMax(fiveThrees,5)
PASSED: indexOfMax(zeros,3)
PASSED: indexOfMax(primes,1)
PASSED: indexOfMax(primes,5)
PASSED: indexOfMax(primes,10)
PASSED: indexOfMax(meaning,1)
PASSED: indexOfMax(mix1,10)
PASSED: indexOfMax(mix2,10)
PASSED: indexOfMax(mix1,3)
PASSED: indexOfMax(mix2,3)
PASSED: indexOfMax(mix2,1)
PASSED: indexOfMax(mix2,5)
PASSED: indexOfMin(fiveThrees,5)
PASSED: indexOfMin(zeros,3)
PASSED: indexOfMin(primes,5)
PASSED: indexOfMin(primes,10)
PASSED: indexOfMin(meaning,1)
PASSED: indexOfMin(mix1,10)
PASSED: indexOfMin(mix2,10)
PASSED: indexOfMin(mix1,3)
PASSED: indexOfMin(mix2,3)
PASSED: indexOfMin(descending,5)
PASSED: indexOfMin(descending,1)
./mafTest2
PASSED: largestValue(fiveThrees,5)
PASSED: largestValue(zeros,3)
PASSED: largestValue(primes,5)
PASSED: largestValue(primes,10)
PASSED: largestValue(meaning,1)
PASSED: largestValue(mix1,10)
PASSED: largestValue(mix2,10)
PASSED: largestValue(mix1,3)
PASSED: largestValue(mix2,3)
PASSED: largestValue(descending,5)
PASSED: largestValue(descending,1)
PASSED: smallestValue(fiveThrees,5)
PASSED: smallestValue(zeros,3)
PASSED: smallestValue(primes,5)
PASSED: smallestValue(primes,10)
PASSED: smallestValue(meaning,1)
PASSED: smallestValue(mix1,10)
PASSED: smallestValue(mix2,10)
PASSED: smallestValue(mix1,3)
PASSED: smallestValue(mix2,3)
PASSED: smallestValue(descending,5)
PASSED: smallestValue(descending,1)
./mafTest3
PASSED: arrayToString(fiveThrees,5)
PASSED: arrayToString(zeros,3)
PASSED: arrayToString(empty,0)
PASSED: arrayToString(primes,5)
PASSED: arrayToString(primes,10)
PASSED: arrayToString(meaning,1)
PASSED: arrayToString(mix1,10)
PASSED: arrayToString(mix2,10)
PASSED: arrayToString(descending,5)
PASSED: sum(fiveThrees,5)
PASSED: sum(zeros,3)
PASSED: sum(primes,5)
PASSED: sum(primes,10)
PASSED: sum(meaning,1)
PASSED: sum(mix1,10)
PASSED: sum(mix2,10)
PASSED: sum(mix1,3)
PASSED: sum(mix2,3)
PASSED: sum(descending,5)
PASSED: sum(descending,1)
./mafTest4
PASSED: arrayToString(fiveThrees,5)
PASSED: arrayToString(zeros,3)
PASSED: arrayToString(empty,0)
PASSED: arrayToString(primes,5)
PASSED: arrayToString(primes,10)
PASSED: arrayToString(meaning,1)
PASSED: arrayToString(mix1,10)
PASSED: arrayToString(mix2,10)
PASSED: arrayToString(descending,5)
PASSED: arrayToString(primes,10)
PASSED: arrayToString(mix1,10)
PASSED: arrayToString(mix1,10)
PASSED: arrayToString(mix2,10)
PASSED: arrayToString(mix1,10)
PASSED: arrayToString(mix2,10)
PASSED: arrayToString(descending,5)
PASSED: copyOddOnly(a,descending,5)
PASSED: arrayToString(descending,5)
PASSED: arrayToString(a,3)
PASSED: copyOddOnly(a,mix2,10)
PASSED: arrayToString(mix2,10)
PASSED: arrayToString(a,5)
PASSED: arrayToString(fiveThrees,5)
PASSED: arrayToString(zeros,3)
PASSED: arrayToString(primes,5)
PASSED: arrayToString(descending,5)
PASSED: arrayToString(fiveThrees,5)
PASSED: arrayToString(descending,5)
PASSED: arrayToString(a,5)
PASSED: arrayToString(primes,5)
PASSED: arrayToString(descending,5)
PASSED: arrayToString(a,4)
PASSED: arrayToString(primes,7)
PASSED: arrayToString(a,7)
./addIntToEndOfListTest
PASSED: linkedListToString(list)
PASSED: list->head->data == 42
PASSED: list->tail->data == 25
PASSED: list after adding 25
PASSED: list->head->data == 42
PASSED: list->tail->data == 31
PASSED: list after adding 31
PASSED: list->head->data == NULL
PASSED: list->tail->data == NULL)
PASSED: linkedListToString(emptyList)
PASSED:
PASSED: list->head->data == 7
PASSED:
PASSED: list->tail->data == 7)
PASSED: list after adding 7
PASSED: list != NULL
PASSED: list->head == list->tail
PASSED: list after adding -6
PASSED:
PASSED: list->head->data == 7
PASSED:
PASSED: list->tail->data == -6)
./mllfTest1
PASSED: linkedListToString(list)
Testing pointerToMax
PASSED: p!=NULL
PASSED: p->data==61
PASSED: p->next==NULL
PASSED: p==list->tail
PASSED: list->head->data == 42
PASSED: list->tail->data == 25
PASSED: p!=NULL
PASSED: p->data==61
PASSED: p->next->data==25
PASSED: p->next==list->tail
PASSED: list after adding 25
PASSED: list->head->data == 42
PASSED: list->tail->data == 99
PASSED: list after adding 99
PASSED: p!=NULL
PASSED: p->data==99
PASSED: p->next==NULL
PASSED: p==list->tail
./mllfTest2
PASSED: linkedListToString(list)
Testing pointerToMin
PASSED: p!=NULL
PASSED: p->data==42
PASSED: p==list->head
PASSED: list->head->data == 42
PASSED: list->tail->data == 25
PASSED: p!=NULL
PASSED: p->data==25
PASSED: p->next==NULL
PASSED: p==list->tail
PASSED: list after adding 25
PASSED: list->head->data == 42
PASSED: list->tail->data == 99
PASSED: list after adding 99
PASSED: p!=NULL
PASSED: p->data==25
PASSED: p->next==list->tail
./mllfTest3
PASSED: linkedListToString(list)
Testing pointerToMax
PASSED: p!=NULL
PASSED: largestValue(list)
PASSED: p!=NULL
PASSED: largestValue(list)
PASSED: list after adding 25
PASSED: list after adding 99
PASSED: p!=NULL
PASSED: largestValue(list)
./mllfTest4
PASSED: linkedListToString(list)
Testing pointerToMin
PASSED: p!=NULL
PASSED: p->data==42
PASSED: p==list->head
PASSED: list->head->data == 42
PASSED: list->tail->data == 25
PASSED: p!=NULL
PASSED: p->data==25
PASSED: p->next==NULL
PASSED: p==list->tail
PASSED: list after adding 25
PASSED: list->head->data == 42
PASSED: list->tail->data == 99
PASSED: list after adding 99
PASSED: p!=NULL
PASSED: p->data==25
PASSED: p->next==list->tail
./mllfTest5
PASSED: sum(&emptyList)
PASSED: linkedListToString(list)
PASSED: sum(list)
PASSED: list after adding 25
PASSED: sum(list)
./mllfTest6
./mllfTest7
-bash-4.2$
```
Note: You must write your own test code in mllfTest6.cpp and mllfTest7.cpp and make sure you pass those tests
At that point, you are ready to try submitting on the submit.cs system.
## Step 5: Submitting via submit.cs
Here is the command to submit this week's labs:
```
~submit/submit -p 741 *.cpp *.h
```
# Grading Rubric
Some of the points will be awarded based on submit.cs automatic grading. Other points will be assigned after visual code inspection by TAs.
## Submit.cs system automatic points
<table border="1">
<tr><th>Test Group</th><th>Test Name</th><th>Value</th></tr>
<tr><td>mafTest1</td><td><p style="color:green;margin:0;padding:0;">mafTest1</p></td><td>(20 pts)</td></tr>
<tr><td>mafTest2</td><td><p style="color:green;margin:0;padding:0;">./mafTest2</p></td><td>(20 pts)</td></tr>
<tr><td>mafTest3</td><td><p style="color:green;margin:0;padding:0;">./mafTest3</p></td><td>(20 pts)</td></tr>
<tr><td>mafTest4</td><td><p style="color:green;margin:0;padding:0;">./mafTest4</p></td><td>(20 pts)</td></tr>
<tr><td>mllfTest1</td><td><p style="color:green;margin:0;padding:0;">./mllfTest1</p></td><td>(20 pts)</td></tr>
<tr><td>mllfTest2</td><td><p style="color:green;margin:0;padding:0;">./mllfTest2</p></td><td>(20 pts)</td></tr>
<tr><td>mllfTest3</td><td><p style="color:green;margin:0;padding:0;">./mllfTest3</p></td><td>(20 pts)</td></tr>
<tr><td>mllfTest4</td><td><p style="color:green;margin:0;padding:0;">./mllfTest4</p></td><td>(20 pts)</td></tr>
<tr><td>mllfTest5</td><td><p style="color:green;margin:0;padding:0;">./mllfTest5</p></td><td>(20 pts)</td></tr>
<tr><td>mllfTest6</td><td><p style="color:green;margin:0;padding:0;">./mllfTest6</p></td><td>(20 pts)</td></tr>
<tr><td>mllfTest7</td><td><p style="color:green;margin:0;padding:0;">./mllfTest7</p></td><td>(20 pts)</td></tr>
</table>
## Code inspection human-assigned points
* (30 pts) Submitting on time, per instructions
* (90 pts) Code style, including but not limited to:
1. Code can be easily understood by humans familiar with C++ (including both the author(s) of the code, and non-authors of the code.)
2. Code is neatly indented and formatted, following standard code indentation practices for C++ as illustrated in either the textbook, or example code given in lectures and labs
3. Variable names choices are reasonable
4. Code is reasonably "DRY" (as in "don't repeat yourself")—where appropriate, common code is factored out into functions
5. Code is not unnecessarily or unreasonably complex when a simpler solution is available
## An important word about academic honesty and the submit.cs system
We will test your code against other data files too—not just these. So while you might be able to pass the tests on submit.cs now by just doing a hard-coded "cout" of the expected output, that will NOT receive credit.
To be very clear, code like this will pass on submit.cs, BUT REPRESENTS A FORM OF ACADEMIC DISHONESTY since it is an attempt to just "game the system", i.e. to get the tests to pass without really solving the problem.
I would hope this would be obvious, but I have to say it so that there is no ambiguity: hard coding your output is a form of cheating, i.e. a form of "academic dishonesty". Submitting a program of this kind would be subject not only to a reduced grade, but to possible disciplinary penalties. If there is <em>any</em> doubt about this fact, please ask your TA and/or your instructor for clarification.
Please the page <{{page.submit_cs}}>, or the Unix shell commmand listed at that
link (e.g. `~submit/submit -p nnn file1 file2 ... filen`) to
submit your assignment rather than the command listed in the instructions.
| {
"content_hash": "d40ae7eb0d82ed54f1bdb80db7f1e714",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 486,
"avg_line_length": 44.92997811816193,
"alnum_prop": 0.7590220620464618,
"repo_name": "ucsb-cmptgcs-1a-f17/ucsb-cmptgcs-1a-f17.github.io",
"id": "5b798557ae8c13302a0d88b103d1c74b1aa77f9c",
"size": "20537",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_cs16/lab07.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "8810"
},
{
"name": "C++",
"bytes": "64770"
},
{
"name": "CSS",
"bytes": "12151"
},
{
"name": "HTML",
"bytes": "19349"
},
{
"name": "JavaScript",
"bytes": "14636"
},
{
"name": "Makefile",
"bytes": "3248"
},
{
"name": "Ruby",
"bytes": "6019"
},
{
"name": "Shell",
"bytes": "562"
}
],
"symlink_target": ""
} |
import { isMobile, matchWithGroups } from './helpers.js';
import { c as config } from './chunk-e92e3389.js';
import { F as FormElementMixin } from './chunk-17b33cd2.js';
var AM = 'AM';
var PM = 'PM';
var HOUR_FORMAT_24 = '24';
var HOUR_FORMAT_12 = '12';
var defaultTimeFormatter = function defaultTimeFormatter(date, vm) {
return vm.dtf.format(date);
};
var defaultTimeParser = function defaultTimeParser(timeString, vm) {
if (timeString) {
var d = null;
if (vm.computedValue && !isNaN(vm.computedValue)) {
d = new Date(vm.computedValue);
} else {
d = vm.timeCreator();
d.setMilliseconds(0);
}
if (vm.dtf.formatToParts && typeof vm.dtf.formatToParts === 'function') {
var formatRegex = vm.dtf.formatToParts(d).map(function (part) {
if (part.type === 'literal') {
return part.value.replace(/ /g, '\\s?');
} else if (part.type === 'dayPeriod') {
return "((?!=<".concat(part.type, ">)(").concat(vm.amString, "|").concat(vm.pmString, "|").concat(AM, "|").concat(PM, "|").concat(AM.toLowerCase(), "|").concat(PM.toLowerCase(), ")?)");
}
return "((?!=<".concat(part.type, ">)\\d+)");
}).join('');
var timeGroups = matchWithGroups(formatRegex, timeString); // We do a simple validation for the group.
// If it is not valid, it will fallback to Date.parse below
timeGroups.hour = timeGroups.hour ? parseInt(timeGroups.hour, 10) : null;
timeGroups.minute = timeGroups.minute ? parseInt(timeGroups.minute, 10) : null;
timeGroups.second = timeGroups.second ? parseInt(timeGroups.second, 10) : null;
if (timeGroups.hour && timeGroups.hour >= 0 && timeGroups.hour < 24 && timeGroups.minute && timeGroups.minute >= 0 && timeGroups.minute < 59) {
if (timeGroups.dayPeriod && (timeGroups.dayPeriod.toLowerCase() === vm.pmString.toLowerCase() || timeGroups.dayPeriod.toLowerCase() === PM.toLowerCase()) && timeGroups.hour < 12) {
timeGroups.hour += 12;
}
d.setHours(timeGroups.hour);
d.setMinutes(timeGroups.minute);
d.setSeconds(timeGroups.second || 0);
return d;
}
} // Fallback if formatToParts is not supported or if we were not able to parse a valid date
var am = false;
if (vm.hourFormat === HOUR_FORMAT_12) {
var dateString12 = timeString.split(' ');
timeString = dateString12[0];
am = dateString12[1] === vm.amString || dateString12[1] === AM;
}
var time = timeString.split(':');
var hours = parseInt(time[0], 10);
var minutes = parseInt(time[1], 10);
var seconds = vm.enableSeconds ? parseInt(time[2], 10) : 0;
if (isNaN(hours) || hours < 0 || hours > 23 || vm.hourFormat === HOUR_FORMAT_12 && (hours < 1 || hours > 12) || isNaN(minutes) || minutes < 0 || minutes > 59) {
return null;
}
d.setSeconds(seconds);
d.setMinutes(minutes);
if (vm.hourFormat === HOUR_FORMAT_12) {
if (am && hours === 12) {
hours = 0;
} else if (!am && hours !== 12) {
hours += 12;
}
}
d.setHours(hours);
return new Date(d.getTime());
}
return null;
};
var TimepickerMixin = {
mixins: [FormElementMixin],
inheritAttrs: false,
props: {
value: Date,
inline: Boolean,
minTime: Date,
maxTime: Date,
placeholder: String,
editable: Boolean,
disabled: Boolean,
hourFormat: {
type: String,
validator: function validator(value) {
return value === HOUR_FORMAT_24 || value === HOUR_FORMAT_12;
}
},
incrementHours: {
type: Number,
default: 1
},
incrementMinutes: {
type: Number,
default: 1
},
incrementSeconds: {
type: Number,
default: 1
},
timeFormatter: {
type: Function,
default: function _default(date, vm) {
if (typeof config.defaultTimeFormatter === 'function') {
return config.defaultTimeFormatter(date);
} else {
return defaultTimeFormatter(date, vm);
}
}
},
timeParser: {
type: Function,
default: function _default(date, vm) {
if (typeof config.defaultTimeParser === 'function') {
return config.defaultTimeParser(date);
} else {
return defaultTimeParser(date, vm);
}
}
},
mobileNative: {
type: Boolean,
default: function _default() {
return config.defaultTimepickerMobileNative;
}
},
timeCreator: {
type: Function,
default: function _default() {
if (typeof config.defaultTimeCreator === 'function') {
return config.defaultTimeCreator();
} else {
return new Date();
}
}
},
position: String,
unselectableTimes: Array,
openOnFocus: Boolean,
enableSeconds: Boolean,
defaultMinutes: Number,
defaultSeconds: Number,
focusable: {
type: Boolean,
default: true
},
tzOffset: {
type: Number,
default: 0
},
appendToBody: Boolean,
resetOnMeridianChange: {
type: Boolean,
default: false
}
},
data: function data() {
return {
dateSelected: this.value,
hoursSelected: null,
minutesSelected: null,
secondsSelected: null,
meridienSelected: null,
_elementRef: 'input',
AM: AM,
PM: PM,
HOUR_FORMAT_24: HOUR_FORMAT_24,
HOUR_FORMAT_12: HOUR_FORMAT_12
};
},
computed: {
computedValue: {
get: function get() {
return this.dateSelected;
},
set: function set(value) {
this.dateSelected = value;
this.$emit('input', this.dateSelected);
}
},
localeOptions: function localeOptions() {
return new Intl.DateTimeFormat(this.locale, {
hour: 'numeric',
minute: 'numeric',
second: this.enableSeconds ? 'numeric' : undefined
}).resolvedOptions();
},
dtf: function dtf() {
return new Intl.DateTimeFormat(this.locale, {
hour: this.localeOptions.hour || 'numeric',
minute: this.localeOptions.minute || 'numeric',
second: this.enableSeconds ? this.localeOptions.second || 'numeric' : undefined,
// Fixes 12 hour display github.com/buefy/buefy/issues/3418
hourCycle: !this.isHourFormat24 ? 'h12' : 'h23'
});
},
newHourFormat: function newHourFormat() {
return this.hourFormat || (this.localeOptions.hour12 ? HOUR_FORMAT_12 : HOUR_FORMAT_24);
},
sampleTime: function sampleTime() {
var d = this.timeCreator();
d.setHours(10);
d.setSeconds(0);
d.setMinutes(0);
d.setMilliseconds(0);
return d;
},
hourLiteral: function hourLiteral() {
if (this.dtf.formatToParts && typeof this.dtf.formatToParts === 'function') {
var d = this.sampleTime;
var parts = this.dtf.formatToParts(d);
var literal = parts.find(function (part, idx) {
return idx > 0 && parts[idx - 1].type === 'hour';
});
if (literal) {
return literal.value;
}
}
return ':';
},
minuteLiteral: function minuteLiteral() {
if (this.dtf.formatToParts && typeof this.dtf.formatToParts === 'function') {
var d = this.sampleTime;
var parts = this.dtf.formatToParts(d);
var literal = parts.find(function (part, idx) {
return idx > 0 && parts[idx - 1].type === 'minute';
});
if (literal) {
return literal.value;
}
}
return ':';
},
secondLiteral: function secondLiteral() {
if (this.dtf.formatToParts && typeof this.dtf.formatToParts === 'function') {
var d = this.sampleTime;
var parts = this.dtf.formatToParts(d);
var literal = parts.find(function (part, idx) {
return idx > 0 && parts[idx - 1].type === 'second';
});
if (literal) {
return literal.value;
}
}
},
amString: function amString() {
if (this.dtf.formatToParts && typeof this.dtf.formatToParts === 'function') {
var d = this.sampleTime;
d.setHours(10);
var dayPeriod = this.dtf.formatToParts(d).find(function (part) {
return part.type === 'dayPeriod';
});
if (dayPeriod) {
return dayPeriod.value;
}
}
return AM;
},
pmString: function pmString() {
if (this.dtf.formatToParts && typeof this.dtf.formatToParts === 'function') {
var d = this.sampleTime;
d.setHours(20);
var dayPeriod = this.dtf.formatToParts(d).find(function (part) {
return part.type === 'dayPeriod';
});
if (dayPeriod) {
return dayPeriod.value;
}
}
return PM;
},
hours: function hours() {
if (!this.incrementHours || this.incrementHours < 1) throw new Error('Hour increment cannot be null or less than 1.');
var hours = [];
var numberOfHours = this.isHourFormat24 ? 24 : 12;
for (var i = 0; i < numberOfHours; i += this.incrementHours) {
var value = i;
var label = value;
if (!this.isHourFormat24) {
value = i + 1;
label = value;
if (this.meridienSelected === this.amString) {
if (value === 12) {
value = 0;
}
} else if (this.meridienSelected === this.pmString) {
if (value !== 12) {
value += 12;
}
}
}
hours.push({
label: this.formatNumber(label),
value: value
});
}
return hours;
},
minutes: function minutes() {
if (!this.incrementMinutes || this.incrementMinutes < 1) throw new Error('Minute increment cannot be null or less than 1.');
var minutes = [];
for (var i = 0; i < 60; i += this.incrementMinutes) {
minutes.push({
label: this.formatNumber(i, true),
value: i
});
}
return minutes;
},
seconds: function seconds() {
if (!this.incrementSeconds || this.incrementSeconds < 1) throw new Error('Second increment cannot be null or less than 1.');
var seconds = [];
for (var i = 0; i < 60; i += this.incrementSeconds) {
seconds.push({
label: this.formatNumber(i, true),
value: i
});
}
return seconds;
},
meridiens: function meridiens() {
return [this.amString, this.pmString];
},
isMobile: function isMobile$1() {
return this.mobileNative && isMobile.any();
},
isHourFormat24: function isHourFormat24() {
return this.newHourFormat === HOUR_FORMAT_24;
}
},
watch: {
hourFormat: function hourFormat() {
if (this.hoursSelected !== null) {
this.meridienSelected = this.hoursSelected >= 12 ? this.pmString : this.amString;
}
},
locale: function locale() {
// see updateInternalState default
if (!this.value) {
this.meridienSelected = this.amString;
}
},
/**
* When v-model is changed:
* 1. Update internal value.
* 2. If it's invalid, validate again.
*/
value: {
handler: function handler(value) {
this.updateInternalState(value);
!this.isValid && this.$refs.input.checkHtml5Validity();
},
immediate: true
}
},
methods: {
onMeridienChange: function onMeridienChange(value) {
if (this.hoursSelected !== null && this.resetOnMeridianChange) {
this.hoursSelected = null;
this.minutesSelected = null;
this.secondsSelected = null;
this.computedValue = null;
} else if (this.hoursSelected !== null) {
if (value === this.pmString) {
this.hoursSelected += 12;
} else if (value === this.amString) {
this.hoursSelected -= 12;
}
}
this.updateDateSelected(this.hoursSelected, this.minutesSelected, this.enableSeconds ? this.secondsSelected : 0, value);
},
onHoursChange: function onHoursChange(value) {
if (!this.minutesSelected && typeof this.defaultMinutes !== 'undefined') {
this.minutesSelected = this.defaultMinutes;
}
if (!this.secondsSelected && typeof this.defaultSeconds !== 'undefined') {
this.secondsSelected = this.defaultSeconds;
}
this.updateDateSelected(parseInt(value, 10), this.minutesSelected, this.enableSeconds ? this.secondsSelected : 0, this.meridienSelected);
},
onMinutesChange: function onMinutesChange(value) {
if (!this.secondsSelected && this.defaultSeconds) {
this.secondsSelected = this.defaultSeconds;
}
this.updateDateSelected(this.hoursSelected, parseInt(value, 10), this.enableSeconds ? this.secondsSelected : 0, this.meridienSelected);
},
onSecondsChange: function onSecondsChange(value) {
this.updateDateSelected(this.hoursSelected, this.minutesSelected, parseInt(value, 10), this.meridienSelected);
},
updateDateSelected: function updateDateSelected(hours, minutes, seconds, meridiens) {
if (hours != null && minutes != null && (!this.isHourFormat24 && meridiens !== null || this.isHourFormat24)) {
var time = null;
if (this.computedValue && !isNaN(this.computedValue)) {
time = new Date(this.computedValue);
} else {
time = this.timeCreator();
time.setMilliseconds(0);
}
time.setHours(hours);
time.setMinutes(minutes);
time.setSeconds(seconds);
if (!isNaN(time.getTime())) this.computedValue = new Date(time.getTime());
}
},
updateInternalState: function updateInternalState(value) {
if (value) {
this.hoursSelected = value.getHours();
this.minutesSelected = value.getMinutes();
this.secondsSelected = value.getSeconds();
this.meridienSelected = value.getHours() >= 12 ? this.pmString : this.amString;
} else {
this.hoursSelected = null;
this.minutesSelected = null;
this.secondsSelected = null;
this.meridienSelected = this.amString;
}
this.dateSelected = value;
},
isHourDisabled: function isHourDisabled(hour) {
var _this = this;
var disabled = false;
if (this.minTime) {
var minHours = this.minTime.getHours();
var noMinutesAvailable = this.minutes.every(function (minute) {
return _this.isMinuteDisabledForHour(hour, minute.value);
});
disabled = hour < minHours || noMinutesAvailable;
}
if (this.maxTime) {
if (!disabled) {
var maxHours = this.maxTime.getHours();
disabled = hour > maxHours;
}
}
if (this.unselectableTimes) {
if (!disabled) {
var unselectable = this.unselectableTimes.filter(function (time) {
if (_this.enableSeconds && _this.secondsSelected !== null) {
return time.getHours() === hour && time.getMinutes() === _this.minutesSelected && time.getSeconds() === _this.secondsSelected;
} else if (_this.minutesSelected !== null) {
return time.getHours() === hour && time.getMinutes() === _this.minutesSelected;
}
return false;
});
if (unselectable.length > 0) {
disabled = true;
} else {
disabled = this.minutes.every(function (minute) {
return _this.unselectableTimes.filter(function (time) {
return time.getHours() === hour && time.getMinutes() === minute.value;
}).length > 0;
});
}
}
}
return disabled;
},
isMinuteDisabledForHour: function isMinuteDisabledForHour(hour, minute) {
var disabled = false;
if (this.minTime) {
var minHours = this.minTime.getHours();
var minMinutes = this.minTime.getMinutes();
disabled = hour === minHours && minute < minMinutes;
}
if (this.maxTime) {
if (!disabled) {
var maxHours = this.maxTime.getHours();
var maxMinutes = this.maxTime.getMinutes();
disabled = hour === maxHours && minute > maxMinutes;
}
}
return disabled;
},
isMinuteDisabled: function isMinuteDisabled(minute) {
var _this2 = this;
var disabled = false;
if (this.hoursSelected !== null) {
if (this.isHourDisabled(this.hoursSelected)) {
disabled = true;
} else {
disabled = this.isMinuteDisabledForHour(this.hoursSelected, minute);
}
if (this.unselectableTimes) {
if (!disabled) {
var unselectable = this.unselectableTimes.filter(function (time) {
if (_this2.enableSeconds && _this2.secondsSelected !== null) {
return time.getHours() === _this2.hoursSelected && time.getMinutes() === minute && time.getSeconds() === _this2.secondsSelected;
} else {
return time.getHours() === _this2.hoursSelected && time.getMinutes() === minute;
}
});
disabled = unselectable.length > 0;
}
}
}
return disabled;
},
isSecondDisabled: function isSecondDisabled(second) {
var _this3 = this;
var disabled = false;
if (this.minutesSelected !== null) {
if (this.isMinuteDisabled(this.minutesSelected)) {
disabled = true;
} else {
if (this.minTime) {
var minHours = this.minTime.getHours();
var minMinutes = this.minTime.getMinutes();
var minSeconds = this.minTime.getSeconds();
disabled = this.hoursSelected === minHours && this.minutesSelected === minMinutes && second < minSeconds;
}
if (this.maxTime) {
if (!disabled) {
var maxHours = this.maxTime.getHours();
var maxMinutes = this.maxTime.getMinutes();
var maxSeconds = this.maxTime.getSeconds();
disabled = this.hoursSelected === maxHours && this.minutesSelected === maxMinutes && second > maxSeconds;
}
}
}
if (this.unselectableTimes) {
if (!disabled) {
var unselectable = this.unselectableTimes.filter(function (time) {
return time.getHours() === _this3.hoursSelected && time.getMinutes() === _this3.minutesSelected && time.getSeconds() === second;
});
disabled = unselectable.length > 0;
}
}
}
return disabled;
},
/*
* Parse string into date
*/
onChange: function onChange(value) {
var date = this.timeParser(value, this);
this.updateInternalState(date);
if (date && !isNaN(date)) {
this.computedValue = date;
} else {
// Force refresh input value when not valid date
this.computedValue = null;
this.$refs.input.newValue = this.computedValue;
}
},
/*
* Toggle timepicker
*/
toggle: function toggle(active) {
if (this.$refs.dropdown) {
this.$refs.dropdown.isActive = typeof active === 'boolean' ? active : !this.$refs.dropdown.isActive;
}
},
/*
* Close timepicker
*/
close: function close() {
this.toggle(false);
},
/*
* Call default onFocus method and show timepicker
*/
handleOnFocus: function handleOnFocus() {
this.onFocus();
if (this.openOnFocus) {
this.toggle(true);
}
},
/*
* Format date into string 'HH-MM-SS'
*/
formatHHMMSS: function formatHHMMSS(value) {
var date = new Date(value);
if (value && !isNaN(date)) {
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
return this.formatNumber(hours, true) + ':' + this.formatNumber(minutes, true) + ':' + this.formatNumber(seconds, true);
}
return '';
},
/*
* Parse time from string
*/
onChangeNativePicker: function onChangeNativePicker(event) {
var date = event.target.value;
if (date) {
var time = null;
if (this.computedValue && !isNaN(this.computedValue)) {
time = new Date(this.computedValue);
} else {
time = new Date();
time.setMilliseconds(0);
}
var t = date.split(':');
time.setHours(parseInt(t[0], 10));
time.setMinutes(parseInt(t[1], 10));
time.setSeconds(t[2] ? parseInt(t[2], 10) : 0);
this.computedValue = new Date(time.getTime());
} else {
this.computedValue = null;
}
},
formatNumber: function formatNumber(value, prependZero) {
return this.isHourFormat24 || prependZero ? this.pad(value) : value;
},
pad: function pad(value) {
return (value < 10 ? '0' : '') + value;
},
/*
* Format date into string
*/
formatValue: function formatValue(date) {
if (date && !isNaN(date)) {
return this.timeFormatter(date, this);
} else {
return null;
}
},
/**
* Keypress event that is bound to the document.
*/
keyPress: function keyPress(_ref) {
var key = _ref.key;
if (this.$refs.dropdown && this.$refs.dropdown.isActive && (key === 'Escape' || key === 'Esc')) {
this.toggle(false);
}
},
/**
* Emit 'blur' event on dropdown is not active (closed)
*/
onActiveChange: function onActiveChange(value) {
if (!value) {
this.onBlur();
}
}
},
created: function created() {
if (typeof window !== 'undefined') {
document.addEventListener('keyup', this.keyPress);
}
},
beforeDestroy: function beforeDestroy() {
if (typeof window !== 'undefined') {
document.removeEventListener('keyup', this.keyPress);
}
}
};
export { TimepickerMixin as T };
| {
"content_hash": "7073663a973ae7808a415707719cef43",
"timestamp": "",
"source": "github",
"line_count": 729,
"max_line_length": 195,
"avg_line_length": 30.349794238683128,
"alnum_prop": 0.5706666666666667,
"repo_name": "cdnjs/cdnjs",
"id": "78762f2c96d6124a127add10bbc03795ad6f73dc",
"size": "22125",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ajax/libs/buefy/0.9.21/esm/chunk-6e56b8bc.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
function vmstart(vm){
$("#wheel").show();
data = {'name': vm, 'action': 'start'};
$.ajax({
type: "POST",
url: '/vmaction',
data: data,
success: function(data) {
$("#wheel").hide();
if (data.result == 'success') {
$('.top-right').notify({message: { text: "Vm "+vm+" started!!!" }, type: 'success'}).show();
vmstable();
} else {
$('.top-right').notify({message: { text: "VM "+vm+" not started" }, type: 'danger'}).show();
};
}
});
}
function vmstop(vm){
$("#wheel").show();
data = {'name': vm, 'action': 'stop'};
$.ajax({
type: "POST",
url: '/vmaction',
data: data,
success: function(data) {
$("#wheel").hide();
if (data.result == 'success') {
$('.top-right').notify({message: { text: "Vm "+vm+" stopped!!!" }, type: 'success'}).show();
vmstable();
} else {
$('.top-right').notify({message: { text: "VM "+vm+" not stopped" }, type: 'danger'}).show();
};
}
});
}
function vmdelete(vm){
$("#wheel").show();
data = {'name': vm, 'action': 'delete'};
var r = confirm("Are you sure you want to delete this VM?");
if (r != true) {
return ;
}
$.ajax({
type: "POST",
url: '/vmaction',
data: data,
success: function(data) {
$("#wheel").hide();
if (data.result == 'success') {
$('.top-right').notify({message: { text: "Vm "+vm+" deleted!!!" }, type: 'success'}).show();
vmstable();
} else {
$('.top-right').notify({message: { text: "VM "+vm+" not deleted because "+data.reason }, type: 'danger'}).show();
};
}
});
}
function vmcreate(name, profile){
if (name === undefined) {
name = $("#name").val();
}
else if (name == '') {
var name = prompt("Enter vm name or leave blank to autogenerate one");
if (name === null) {
return;
}
}
if (profile === undefined) {
profile = $("#profile").val();
}
var parameters = {};
$.each($('#createvmform').serializeArray(), function() {
parameters[this.name] = this.value;
});
$("#wheel").show();
data = {'name': name, 'action': 'create', 'profile': profile, 'parameters': parameters};
$.ajax({
type: "POST",
url: '/vmaction',
data: data,
success: function(data) {
$("#wheel").hide();
if (data.result == 'success') {
if ( name == '' ) {
name = data.vm
}
$('.top-right').notify({message: { text: "Vm "+name+" created!!!" }, type: 'success'}).show();
} else {
$('.top-right').notify({message: { text: "VM "+name+" not created because "+data.reason }, type: 'danger'}).show();
};
}
});
}
| {
"content_hash": "996d6f81791e678758cb42497030668d",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 131,
"avg_line_length": 30.443298969072163,
"alnum_prop": 0.45038943447341684,
"repo_name": "karmab/kcli",
"id": "8dc736dedb44aa114c9fe3afd90c9b56a1743a26",
"size": "2953",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "kvirt/web/static/js/vmaction.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "27073"
},
{
"name": "Dockerfile",
"bytes": "173"
},
{
"name": "HTML",
"bytes": "59660"
},
{
"name": "JavaScript",
"bytes": "688801"
},
{
"name": "Jinja",
"bytes": "25491"
},
{
"name": "Makefile",
"bytes": "871"
},
{
"name": "Python",
"bytes": "1995130"
},
{
"name": "Shell",
"bytes": "61221"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/mc_file_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"
android:layout_marginLeft="10dp" />
<TextView
android:id="@+id/mc_filelist_filename"
android:layout_marginLeft="20dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="18dp"
android:text="@string/file_about" android:textColor="@color/black"/>
</LinearLayout>
</LinearLayout>
| {
"content_hash": "42184cd9b1cc688895dc360ad38f8207",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 71,
"avg_line_length": 32.65384615384615,
"alnum_prop": 0.7314487632508834,
"repo_name": "lijian17/meeting",
"id": "55f7e18b2118e4fdbceb6c0b9f1d24ed3c74418e",
"size": "849",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "会议管理系统/res/layout/meet_detail_list_item.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "101990"
}
],
"symlink_target": ""
} |
import { isBlank, isPresent, isFunction } from 'angular2/src/facade/lang';
import { BaseException } from 'angular2/src/facade/exceptions';
import { Map } from 'angular2/src/facade/collection';
import { PromiseWrapper } from 'angular2/src/facade/async';
import { RouteRule, RedirectRule, PathMatch } from './rules';
import { Route, AsyncRoute, AuxRoute, Redirect } from '../route_config/route_config_impl';
import { AsyncRouteHandler } from './route_handlers/async_route_handler';
import { SyncRouteHandler } from './route_handlers/sync_route_handler';
import { ParamRoutePath } from './route_paths/param_route_path';
import { RegexRoutePath } from './route_paths/regex_route_path';
/**
* A `RuleSet` is responsible for recognizing routes for a particular component.
* It is consumed by `RouteRegistry`, which knows how to recognize an entire hierarchy of
* components.
*/
export class RuleSet {
constructor() {
this.rulesByName = new Map();
// map from name to rule
this.auxRulesByName = new Map();
// map from starting path to rule
this.auxRulesByPath = new Map();
// TODO: optimize this into a trie
this.rules = [];
// the rule to use automatically when recognizing or generating from this rule set
this.defaultRule = null;
}
/**
* Configure additional rules in this rule set from a route definition
* @returns {boolean} true if the config is terminal
*/
config(config) {
let handler;
if (isPresent(config.name) && config.name[0].toUpperCase() != config.name[0]) {
let suggestedName = config.name[0].toUpperCase() + config.name.substring(1);
throw new BaseException(`Route "${config.path}" with name "${config.name}" does not begin with an uppercase letter. Route names should be CamelCase like "${suggestedName}".`);
}
if (config instanceof AuxRoute) {
handler = new SyncRouteHandler(config.component, config.data);
let routePath = this._getRoutePath(config);
let auxRule = new RouteRule(routePath, handler, config.name);
this.auxRulesByPath.set(routePath.toString(), auxRule);
if (isPresent(config.name)) {
this.auxRulesByName.set(config.name, auxRule);
}
return auxRule.terminal;
}
let useAsDefault = false;
if (config instanceof Redirect) {
let routePath = this._getRoutePath(config);
let redirector = new RedirectRule(routePath, config.redirectTo);
this._assertNoHashCollision(redirector.hash, config.path);
this.rules.push(redirector);
return true;
}
if (config instanceof Route) {
handler = new SyncRouteHandler(config.component, config.data);
useAsDefault = isPresent(config.useAsDefault) && config.useAsDefault;
}
else if (config instanceof AsyncRoute) {
handler = new AsyncRouteHandler(config.loader, config.data);
useAsDefault = isPresent(config.useAsDefault) && config.useAsDefault;
}
let routePath = this._getRoutePath(config);
let newRule = new RouteRule(routePath, handler, config.name);
this._assertNoHashCollision(newRule.hash, config.path);
if (useAsDefault) {
if (isPresent(this.defaultRule)) {
throw new BaseException(`Only one route can be default`);
}
this.defaultRule = newRule;
}
this.rules.push(newRule);
if (isPresent(config.name)) {
this.rulesByName.set(config.name, newRule);
}
return newRule.terminal;
}
/**
* Given a URL, returns a list of `RouteMatch`es, which are partial recognitions for some route.
*/
recognize(urlParse) {
var solutions = [];
this.rules.forEach((routeRecognizer) => {
var pathMatch = routeRecognizer.recognize(urlParse);
if (isPresent(pathMatch)) {
solutions.push(pathMatch);
}
});
// handle cases where we are routing just to an aux route
if (solutions.length == 0 && isPresent(urlParse) && urlParse.auxiliary.length > 0) {
return [PromiseWrapper.resolve(new PathMatch(null, null, urlParse.auxiliary))];
}
return solutions;
}
recognizeAuxiliary(urlParse) {
var routeRecognizer = this.auxRulesByPath.get(urlParse.path);
if (isPresent(routeRecognizer)) {
return [routeRecognizer.recognize(urlParse)];
}
return [PromiseWrapper.resolve(null)];
}
hasRoute(name) { return this.rulesByName.has(name); }
componentLoaded(name) {
return this.hasRoute(name) && isPresent(this.rulesByName.get(name).handler.componentType);
}
loadComponent(name) {
return this.rulesByName.get(name).handler.resolveComponentType();
}
generate(name, params) {
var rule = this.rulesByName.get(name);
if (isBlank(rule)) {
return null;
}
return rule.generate(params);
}
generateAuxiliary(name, params) {
var rule = this.auxRulesByName.get(name);
if (isBlank(rule)) {
return null;
}
return rule.generate(params);
}
_assertNoHashCollision(hash, path) {
this.rules.forEach((rule) => {
if (hash == rule.hash) {
throw new BaseException(`Configuration '${path}' conflicts with existing route '${rule.path}'`);
}
});
}
_getRoutePath(config) {
if (isPresent(config.regex)) {
if (isFunction(config.serializer)) {
return new RegexRoutePath(config.regex, config.serializer);
}
else {
throw new BaseException(`Route provides a regex property, '${config.regex}', but no serializer property`);
}
}
if (isPresent(config.path)) {
// Auxiliary routes do not have a slash at the start
let path = (config instanceof AuxRoute && config.path.startsWith('/')) ?
config.path.substring(1) :
config.path;
return new ParamRoutePath(path);
}
throw new BaseException('Route must provide either a path or regex property');
}
}
| {
"content_hash": "7a085ce485d26dbe150f6baf2b732c45",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 187,
"avg_line_length": 42.86577181208054,
"alnum_prop": 0.6148426491310475,
"repo_name": "liufeng2015/LeifD3",
"id": "b7fa7aa1cdf47bdc78932cf4d1ff753279613111",
"size": "6387",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "node_modules/angular2/es6/prod/src/router/rules/rule_set.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1233"
},
{
"name": "HTML",
"bytes": "2642"
},
{
"name": "JavaScript",
"bytes": "43234"
},
{
"name": "TypeScript",
"bytes": "2"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "b7c61d5a9fed414366b5d393ce49db96",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "4366c6f83081d041fb67ffcd7fcc739536bec5a3",
"size": "187",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Myrtales/Myrtaceae/Metrosideros/Metrosideros regelii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
'use strict';
export * from './mi-glyphicon.directive.js'; | {
"content_hash": "56e70a25b3ab5b56932f3902825eb686",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 44,
"avg_line_length": 19.666666666666668,
"alnum_prop": 0.6949152542372882,
"repo_name": "AVykhrystyuk/Make-it-app",
"id": "05d13e551aaac94bec2267c51ee012409e96dbbb",
"size": "59",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/common/directives/mi-glyphicon/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11909"
},
{
"name": "HTML",
"bytes": "45772"
},
{
"name": "JavaScript",
"bytes": "63697"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.