content stringlengths 263 5.24M | pred_label stringclasses 1
value | pred_score_pos float64 0.6 1 |
|---|---|---|
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
numPoints=1001;
var numGrad=1;
var xRange=6;
var xStep;
var graph = new Graph(context,-4,4,-10,10,275,210,450,350);
graph.drawgrid(1,0.2,2,0.5);
graph.drawaxes('x','y');
var xA = new Array();
var yA = new Array();
// ... | __label__POS | 0.842617 |
<?php
declare(strict_types=1);
namespace popp\ch13\batch04;
class Venue extends DomainObject
{
private ?SpaceCollection $spaces = null;
public function __construct(int $id, private string $name)
{
parent::__construct($id);
}
public function getSpaces(): SpaceCollection
{
if... | __label__POS | 0.845427 |
<?php
declare(strict_types=1);
namespace popp\ch04\batch03;
use popp\ch04\batch02\ShopProduct;
use popp\ch04\batch02\BookProduct;
use popp\ch04\batch02\CdProduct;
class Runner
{
public static function run()
{
// runner code here
print ShopProduct::AVAILABLE;
}
public static function... | __label__POS | 0.66887 |
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var numPoints=1001;
var numGrad=50;
var xRange=6;
var xStep;
var graph = new Graph(context,-4,4,-10,10,275,210,450,350);
graph.drawgrid(1,0.2,2,0.5);
graph.drawaxes('x','y');
var xA = new Array();
var yA = new Array();
... | __label__POS | 0.946832 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
//var graph = new Graph(context,-4,4,-10,10,275,210,450,350);
//var graph = new Graph(context,-2.5,2.5,-10,10,275,210,450,350);
//var graph = new Graph(context,-3,3,0,20,275,380,480,350);
var graph = new Graph(context,-3,3,0,1,... | __label__POS | 0.731834 |
<?php
declare(strict_types=1);
namespace popp\ch13\batch04;
class Event extends DomainObject
{
public function __construct(int $id, private string $name, private int $start, private int $duration, private Space $space)
{
parent::__construct($id);
}
public function setStart(int $start): void... | __label__POS | 0.870526 |
<?php
declare(strict_types=1);
namespace popp\ch04\batch08;
class Runner
{
public static function run()
{
$logger = create_function(
'$product',
'print " logging ({$product->name})\n";'
);
$processor = new ProcessSale();
$processor->registerCallback(... | __label__POS | 0.785585 |
//class String, for char arrays
// -- from _C++ for Lazy Programmers_
#include <cstring>
#include <iostream>
#include "string.h"
using namespace std;
const String& String::operator= (const String& other)
{
if (this == &other) return *this; //never assign *this to itself
if (contents_) delete[] contents... | __label__POS | 0.940018 |
<?php
declare(strict_types=1);
namespace popp\ch13\batch04;
class ObjectWatcher
{
/* listing 13.24 */
// ObjectWatcher
private array $all = [];
private array $dirty = [];
private array $new = [];
private array $delete = []; // unused in this example
private static ?ObjectWatcher $instance =... | __label__POS | 0.750965 |
<?php
declare(strict_types=1);
namespace popp\ch13\batch04;
abstract class Mapper
{
protected \PDO $pdo;
public function __construct()
{
$reg = Registry::instance();
$this->pdo = $reg->getPdo();
}
public function find(int $id): DomainObject
{
$old = $this->getFromMap... | __label__POS | 0.78896 |
using chapter_11.Engine.Input;
using Microsoft.Xna.Framework.Input;
using System.Collections.Generic;
namespace chapter_11.Input
{
public class DevInputMapper : BaseInputMapper
{
public override IEnumerable<BaseInputCommand> GetKeyboardState(KeyboardState state)
{
var commands = ne... | __label__POS | 0.889262 |
//class String, for char arrays
// -- from _C++ for Lazy Programmers_
#include <cstring>
#include <iostream>
#include "string.h"
using namespace std;
const String& String::operator= (String&& other) //move =
{
if (this == &other) return *this; //never assign *this to itself
if (contents_) delete[] cont... | __label__POS | 0.866215 |
public class GasTank
{
private double thickness;
private double diffusivity;
private double initialT;
private double boundaryT;
public GasTank(double thickness, double diffusivity,
double initialT, double boundaryT) {
this.thickness = thickness;
this.diffusivity = diffusiv... | __label__POS | 0.701565 |
<?php
declare(strict_types=1);
/* listing 05.11 */
namespace popp\ch05\batch04;
/* /listing 05.11 */
use popp\ch05\batch04\util\InSame;
use popp\ch05\batch04\client\FromClient;
use popp\ch05\batch04\util as util;
use popp\ch05\batch04\util\Debug;
use popp\ch05\batch04\util\Lister;
// need to include this non-namesp... | __label__POS | 0.709447 |
//Program to demonstrate stack, with exceptions
// -- from _C++ for Lazy Programmers_
#include <iostream>
#include "stack.h"
using namespace std;
char getAnswer (const char* question); //Ask question, get a (char) answer
void destroyAndPrint (Stack&); //Take everything off stack, and
... | __label__POS | 0.960223 |
using chapter_11.Engine.Objects;
using chapter_11.Engine.States;
using Microsoft.Xna.Framework;
namespace chapter_11.States.Gameplay
{
public class GameplayEvents : BaseGameStateEvent
{
public class PlayerShootsBullets : GameplayEvents { }
public class PlayerShootsMissile : GameplayEvents { }
... | __label__POS | 0.949177 |
using chapter_11.Engine.Input;
using Microsoft.Xna.Framework.Input;
using System.Collections.Generic;
namespace chapter_11.Input
{
public class GameplayInputMapper : BaseInputMapper
{
public override IEnumerable<BaseInputCommand> GetKeyboardState(KeyboardState state)
{
var commands... | __label__POS | 0.936287 |
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void rungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.getNumEqns();
double s;
double q[];
double dq1[] = new double[numEqn... | __label__POS | 0.839229 |
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var satellite;
var earth;
var G = 1;
var M = 1000000; // earth's mass
var t0, t, dt;
var r, x0, y0, omega, omegaE;
var angle = 0;
var angleE = 0;
window.onload = init;
function init() {
// create a stationary earth
earth ... | __label__POS | 0.665305 |
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var earth;
var satellite;
var t0, t, dt;
var r, x0, y0, omega;
var angle = 0;
window.onload = init;
function init() {
// create a stationary earth
earth = new Ball(70,'#0099ff',1000000,0,true,true);
earth.pos2D = new Vec... | __label__POS | 0.668663 |
using Microsoft.Xna.Framework;
using System;
namespace chapter_11.Engine.Particles.EmitterTypes
{
public class CircleEmitterType : IEmitterType
{
public float Radius { get; private set; }
private RandomNumberGenerator _rnd = new RandomNumberGenerator();
public CircleEmitterType(float... | __label__POS | 0.931447 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
namespace chapter_11.Engine.Objects.Collisions
{
public class SegmentAABBCollisionDetector<A>
where A : BaseGameObject
{
private A _passiveObject;
public SegmentAABBCollisionDetector(A passiveObject)
... | __label__POS | 0.991037 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
<?php
namespace popp\ch11\batch01;
class Runner
{
public static function run4()
{
$_REQUEST['form_input'] = "print file_get_contents('/etc/passwd');";
/* listing 11.01 */
$form_input = $_REQUEST['form_input'];
// contains: "print file_get_contents('/etc/passwd');"
eval($form_i... | __label__POS | 0.616591 |
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void rungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.getNumEqns();
double s;
double q[];
double dq1[] = new double[numEqn... | __label__POS | 0.839229 |
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System.Linq;
namespace chapter_11.Engine.Objects.Animations
{
public class Animation
{
private List<AnimationFrame> _frames = new List<AnimationFrame>();
private int _animationAge = 0;
private int _lifespan = -1;
... | __label__POS | 0.919088 |
<?php
declare(strict_types = 1);
namespace popp\ch13\batch05;
use popp\ch13\batch04\Registry;
abstract class Mapper
{
protected $pdo = null;
public function __construct()
{
$reg = Registry::instance();
$this->pdo = $reg->getPdo();
}
private function getFromMap($id)
{
... | __label__POS | 0.81123 |
<?php
declare(strict_types=1);
namespace popp\ch11\batch08;
/* listing 11.42 */
abstract class CompositeUnit extends Unit
{
// ...
/* /listing 11.42 */
private array $units = [];
public function getComposite(): Unit
{
return $this;
}
public function units(): array
{
ret... | __label__POS | 0.67396 |
<?php
declare(strict_types=1);
namespace popp\ch11\parse;
class MarkParse
{
private $expression;
private $operand;
private $interpreter;
public function __construct(string $statement)
{
$this->compile($statement);
}
public function evaluate(string $input)
{
$context ... | __label__POS | 0.971694 |
<?php
declare(strict_types = 1);
namespace popp\ch13\batch01;
class Venue extends DomainObject
{
private $name;
private $spaces=null;
public function __construct($id, $name)
{
$this->name = $name;
parent::__construct($id);
}
/* listing 13.11 */
// Venue
public function ... | __label__POS | 0.768902 |
<?php
declare(strict_types=1);
namespace popp\ch11\parse;
abstract class Parser
{
protected $debug = false;
protected $discard = false;
protected $name;
public function __construct(string $name = null)
{
if (is_null($name)) {
$this->name = get_class($this);
} else {
... | __label__POS | 0.623262 |
<?php
declare(strict_types=1);
namespace popp\ch11\parse;
class Scanner
{
public const WORD = 1;
public const QUOTE = 2;
public const APOS = 3;
public const WHITESPACE = 6;
public const EOL = 8;
public const CHAR = 99;
public const EOF = ... | __label__POS | 0.67717 |
<?php
declare(strict_types=1);
namespace popp\ch11\batch07;
/* listing 11.40 */
abstract class CompositeUnit extends Unit
{
// ...
/* /listing 11.40 */
private array $units = [];
public function getComposite(): Unit
{
return $this;
}
public function units(): array
{
retu... | __label__POS | 0.866828 |
using chapter_11.Engine.Input;
using Microsoft.Xna.Framework.Input;
using System.Collections.Generic;
namespace chapter_11.Input
{
public class DevInputMapper : BaseInputMapper
{
public override IEnumerable<BaseInputCommand> GetKeyboardState(KeyboardState state)
{
var commands = ne... | __label__POS | 0.93218 |
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void rungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.getNumEqns();
double s;
double q[];
double dq1[] = new double[numEqn... | __label__POS | 0.839229 |
function Vector2D(x,y) {
this.x = x;
this.y = y;
}
// PUBLIC METHODS
Vector2D.prototype = {
lengthSquared: function(){
return this.x*this.x + this.y*this.y;
},
length: function(){
return Math.sqrt(this.lengthSquared());
},
angle: function(){
return Math.atan2(this.y,this.x);
},
clone: function... | __label__POS | 0.7039 |
<?php
declare(strict_types = 1);
namespace popp\ch13\batch01;
/* listing 13.01 */
abstract class Mapper
{
protected $pdo;
public function __construct()
{
$reg = Registry::instance();
$this->pdo = $reg->getPdo();
}
public function find(int $id): DomainObject
{
$this->s... | __label__POS | 0.7653 |
<?php
declare(strict_types = 1);
namespace popp\ch13\batch04;
abstract class Collection implements \Iterator
{
protected $mapper;
protected $total = 0;
protected $raw = [];
private $result;
private $pointer = 0;
private $objects = [];
public function __construct(array $raw = [], Mapper $... | __label__POS | 0.724377 |
<?php
declare(strict_types = 1);
namespace popp\ch13\batch04;
class Venue extends DomainObject
{
private $name;
private $spaces = null;
public function __construct(int $id, string $name)
{
$this->name = $name;
parent::__construct($id);
}
public function getSpaces(): SpaceCol... | __label__POS | 0.9116 |
using chapter_11.Objects;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
namespace chapter_11.States.Gameplay
{
public class ChopperGenerator
{
private bool _generateLeft = true;
private Vector2 _leftVector = new Vector2(-... | __label__POS | 0.60244 |
function Forces(){
}
// STATIC METHODS
Forces.zeroForce = function() {
return (new Vector2D(0,0));
}
Forces.constantGravity = function(m,g){
return new Vector2D(0,m*g);
}
Forces.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces.electric = function(k,q1,q2,r){
retu... | __label__POS | 0.755573 |
using chapter_11.Engine.Input;
using Microsoft.Xna.Framework.Input;
using System.Collections.Generic;
namespace chapter_11.Input
{
public class GameplayInputMapper : BaseInputMapper
{
public override IEnumerable<BaseInputCommand> GetKeyboardState(KeyboardState state)
{
var commands... | __label__POS | 0.987902 |
//class Date -- functions
// -- from _C++ for Lazy Programmers_
#include "date.h"
bool isLeapYear (int year)
{
//If a year is divisible by 4, it's a leap year
//Except if it's also divisible by 100, it's not
//Except if it's also divisible by 400, it is
//Not simple, but there it is
bool result ... | __label__POS | 0.906707 |
<?php
declare(strict_types = 1);
namespace popp\ch13\batch04;
class Space extends DomainObject
{
private $name;
private $venue = null;
public function __construct(int $id, string $name, Venue $venue = null)
{
$this->name = $name;
parent::__construct($id);
$this->venue = $venue... | __label__POS | 0.829358 |
<?php
declare(strict_types = 1);
namespace popp\ch13\batch04;
class Event extends DomainObject
{
private $start;
private $duration;
private $name;
private $space;
public function __construct(int $id, string $name, int $start, int $duration, Space $space)
{
parent::__construct($id);
... | __label__POS | 0.879039 |
function Forces(){
}
// STATIC METHODS
Forces.zeroForce = function() {
return (new Vector2D(0,0));
}
Forces.constantGravity = function(m,g){
return new Vector2D(0,m*g);
}
Forces.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces.linearDrag = function(k,vel){
var fo... | __label__POS | 0.850164 |
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void rungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.getNumEqns();
double s;
double q[];
double dq1[] = new double[numEqn... | __label__POS | 0.839229 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
<?php
declare(strict_types = 1);
namespace popp\ch13\batch04;
class ObjectWatcher
{
/* listing 13.22 */
// ObjectWatcher
private $all = [];
private $dirty = [];
private $new = [];
private $delete = []; // unused in this example
private static $instance = null;
/* /listing 13.22 */
priv... | __label__POS | 0.799964 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
function Vector2D(x,y) {
this.x = x;
this.y = y;
}
// PUBLIC METHODS
Vector2D.prototype = {
lengthSquared: function(){
return this.x*this.x + this.y*this.y;
},
length: function(){
return Math.sqrt(this.lengthSquared());
},
angle: function(){
return Math.atan2(this.y,this.x);
},
clone: function... | __label__POS | 0.7039 |
function Forces(){
}
// STATIC METHODS
Forces.zeroForce = function() {
return (new Vector2D(0,0));
}
Forces.constantGravity = function(m,g){
return new Vector2D(0,m*g);
}
Forces.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces.gravityModified = function(G,m1,m2,r,... | __label__POS | 0.752657 |
//Program to illustrate a few char-array functions
// -- from _C++ for Lazy Programmers_
#include <iostream>
using namespace std;
enum {MAX_LINE_LENGTH=255};
bool getYOrNAnswer (const char question[]);
unsigned int myStrlen (const char str[]);
int main ()
{
bool letsRepeat; ... | __label__POS | 0.997078 |
<?php
declare(strict_types = 1);
namespace popp\ch13\batch04;
abstract class Mapper
{
protected $pdo;
public function __construct()
{
$reg = Registry::instance();
$this->pdo = $reg->getPdo();
}
public function find(int $id): DomainObject
{
$old = $this->getFromMap($id... | __label__POS | 0.864126 |
//Program to illustrate a few char-array functions
// -- from _C++ for Lazy Programmers_
#include <iostream>
using namespace std;
//Ways to copy source to destination
void myStrcpy1 (char* destination, const char* source);
void myStrcpy2 (char* destination, const char* source);
void myStrcpy3 (char* destination, co... | __label__POS | 0.789229 |
function Vector2D(x,y) {
this.x = x;
this.y = y;
}
// PUBLIC METHODS
Vector2D.prototype = {
lengthSquared: function(){
return this.x*this.x + this.y*this.y;
},
length: function(){
return Math.sqrt(this.lengthSquared());
},
angle: function(){
return Math.atan2(this.y,this.x);
},
clone: function... | __label__POS | 0.684017 |
using Microsoft.Xna.Framework;
using System;
namespace chapter_11.Engine.Particles.EmitterTypes
{
public class CircleEmitterType : IEmitterType
{
public float Radius { get; private set; }
private RandomNumberGenerator _rnd = new RandomNumberGenerator();
public CircleEmitterType(float... | __label__POS | 0.931447 |
function Forces(){
}
// STATIC METHODS
Forces.zeroForce = function() {
return (new Vector2D(0,0));
}
Forces.constantGravity = function(m,g){
return new Vector2D(0,m*g);
}
Forces.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces.gravityModified = function(G,m1,m2,r,... | __label__POS | 0.752657 |
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System.Linq;
namespace chapter_11.Engine.Objects.Animations
{
public class Animation
{
private List<AnimationFrame> _frames = new List<AnimationFrame>();
private int _animationAge = 0;
private int _lifespan = -1;
... | __label__POS | 0.919088 |
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.utils.Align;
/**
* Convenience class for creating custom Action objects
* for use with Scene... | __label__POS | 0.892671 |
function Vector2D(x,y) {
this.x = x;
this.y = y;
}
// PUBLIC METHODS
Vector2D.prototype = {
lengthSquared: function(){
return this.x*this.x + this.y*this.y;
},
length: function(){
return Math.sqrt(this.lengthSquared());
},
angle: function(){
return Math.atan2(this.y,this.x);
},
clone: function... | __label__POS | 0.684017 |
function Forces(){
}
// STATIC METHODS
Forces.zeroForce = function() {
return (new Vector2D(0,0));
}
Forces.constantGravity = function(m,g){
return new Vector2D(0,m*g);
}
Forces.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces.gravityModified = function(G,m1,m2,r,... | __label__POS | 0.752657 |
<?php
declare(strict_types = 1);
namespace userthing\util;
use userthing\persist\UserStore;
use userthing\domain\User;
class ValidatorTest extends \PHPUnit_Framework_TestCase
{
private $validator;
public function setUp()
{
$store = new UserStore();
$store->addUser("bob williams", "bob@ex... | __label__POS | 0.74127 |
function Forces3D(){
}
// STATIC METHODS
Forces3D.zeroForce = function() {
return (new Vector3D(0,0,0));
}
Forces3D.constantGravity = function(m,g){
return new Vector3D(0,m*g,0);
}
Forces3D.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces3D.gravityModified = funct... | __label__POS | 0.769055 |
<?php
namespace popp\ch11\batch01;
class Runner
{
public static function run()
{
/* listing 11.04 */
$context = new InterpreterContext();
$literal = new LiteralExpression('four');
$literal->interpret($context);
print $context->lookup($literal) . "\n";
/* /listing 11.04 */
}... | __label__POS | 0.730244 |
//Program to do some things with ranged loops
// -- from _C++ for Lazy Programmers_
#include <iostream>
#include <vector>
#include <string>
#include <list>
using namespace std;
int main ()
{
//printing sequences using range-based for-loops
cout << "Just going to print some sequences:\n";
vector<str... | __label__POS | 0.975336 |
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.utils.Align;
/**
* Convenience class for creating custom Action objects
* for use with SceneSegment and Scene classes.
*/
public class Scen... | __label__POS | 0.888365 |
<?php
declare(strict_types = 1);
namespace popp\ch11\batch08;
/* listing 11.40 */
abstract class CompositeUnit extends Unit
{
// ...
/* /listing 11.40 */
private $units = [];
public function getComposite(): Unit
{
return $this;
}
public function units(): array
{
return $... | __label__POS | 0.7594 |
//List class tester with iterator, const_iterator
// -- from _C++ for Lazy Programmers_
#include <iostream>
#include <cassert>
#include <string>
#include "list.h"
using namespace std;
//Used to test move ctor/=
template<typename T>
List<T> makeListToTestMoveCtor(const T& e)
{
List<T> L; L.push_front(e); return L;
... | __label__POS | 0.941441 |
<?php
declare(strict_types=1);
namespace popp\ch11\parse;
class MarkParse
{
private $expression;
private $operand;
private $interpreter;
public function __construct(string $statement)
{
$this->compile($statement);
}
public function evaluate(string $input)
{
$context =... | __label__POS | 0.971694 |
unit Declarations;
{********************************}
{ This unit defines the classes }
{********************************}
interface
type
TCustomer = class
private
fID: Integer;
fName: string;
fDiscountRate: Double;
fBalance: Currency;
public
property ID: integer read fID write fID;
pr... | __label__POS | 0.85821 |
<?php
declare(strict_types=1);
namespace popp\ch11\parse;
abstract class Parser
{
protected $debug = false;
protected $discard = false;
protected $name;
public function __construct(string $name = null)
{
if (is_null($name)) {
$this->name = get_class($this);
} else {
... | __label__POS | 0.688191 |
//Program to use find, copy, sort, copy_if
// -- from _C++ for Lazy Programmers_
#include <vector>
#include <list>
#include <algorithm>
#include <cassert>
#include <iterator> //for ostream_iterator
#include <iostream>
using namespace std;
bool isEven (int i) { return i % 2 == 0; }
int main()
{
//Try out f... | __label__POS | 0.964854 |
function Vector2D(x,y) {
this.x = x;
this.y = y;
}
// PUBLIC METHODS
Vector2D.prototype = {
lengthSquared: function(){
return this.x*this.x + this.y*this.y;
},
length: function(){
return Math.sqrt(this.lengthSquared());
},
angle: function(){
return Math.atan2(this.y,this.x);
},
clone: function... | __label__POS | 0.684017 |
function Forces(){
}
// STATIC METHODS
Forces.zeroForce = function() {
return (new Vector2D(0,0));
}
Forces.constantGravity = function(m,g){
return new Vector2D(0,m*g);
}
Forces.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces.gravityModified = function(G,m1,m2,r,... | __label__POS | 0.752657 |
<?php
declare(strict_types = 1);
namespace popp\ch11\batch07;
/* listing 11.38 */
abstract class CompositeUnit extends Unit
{
// ...
/* /listing 11.38 */
private $units = [];
public function getComposite(): Unit
{
return $this;
}
public function units(): array
{
return $t... | __label__POS | 0.898269 |
//A (partial) game with killer robots
// meant to demonstrate use of file I/O
//This loads 3 points and prints a report
// -- from _C++ for Lazy Programmers_
#include <iostream>
#include <fstream> //1. include <fstream>
using namespace std;
struct Point2D { int x_=0, y_=0; };
int main ()
{
... | __label__POS | 0.821437 |
using chapter_08.Engine.States;
using Microsoft.Xna.Framework.Audio;
using System;
using System.Collections.Generic;
namespace chapter_08.Engine.Sound
{
public class SoundManager
{
private int _soundtrackIndex = -1;
private List<SoundEffectInstance> _soundtracks = new List<SoundEffectInstance... | __label__POS | 0.9498 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
function Forces(){
}
// STATIC METHODS
Forces.zeroForce = function() {
return (new Vector2D(0,0));
}
Forces.constantGravity = function(m,g){
return new Vector2D(0,m*g);
}
Forces.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces.linearDrag = function(k,vel){
var fo... | __label__POS | 0.853613 |
function Vector2D(x,y) {
this.x = x;
this.y = y;
}
// PUBLIC METHODS
Vector2D.prototype = {
lengthSquared: function(){
return this.x*this.x + this.y*this.y;
},
length: function(){
return Math.sqrt(this.lengthSquared());
},
angle: function(){
return Math.atan2(this.y,this.x);
},
clone: function... | __label__POS | 0.721863 |
function Forces(){
}
// STATIC METHODS
Forces.zeroForce = function() {
return (new Vector2D(0,0));
}
Forces.constantGravity = function(m,g){
return new Vector2D(0,m*g);
}
Forces.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces.linearDrag = function(k,vel){
var fo... | __label__POS | 0.850164 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
(in-package :com.gigamonkeys.mp3-database)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Load database
(defparameter *mp3-schema*
(make-schema
'((:file string)
(:genre interned-string "Unknown")
(:artist interned-string "Unknown")
(:album intern... | __label__POS | 0.875013 |
function Vector2D(x,y) {
this.x = x;
this.y = y;
}
// PUBLIC METHODS
Vector2D.prototype = {
lengthSquared: function(){
return this.x*this.x + this.y*this.y;
},
length: function(){
return Math.sqrt(this.lengthSquared());
},
angle: function(){
return Math.atan2(this.y,this.x);
},
clone: function... | __label__POS | 0.721863 |
import com.badlogic.gdx.scenes.scene2d.Stage;
public class Card extends DragAndDropActor
{
public static String[] rankNames = {"A", "2", "3", "4",
"5", "6", "7", "8", "9", "10", "J", "Q", "K"};
public static String[] suitNames = {"Clubs", "Hearts", "Spades", "Diamonds"};
private int rankValue;... | __label__POS | 0.705005 |
function Forces(){
}
// STATIC METHODS
Forces.zeroForce = function() {
return (new Vector2D(0,0));
}
Forces.constantGravity = function(m,g){
return new Vector2D(0,m*g);
}
Forces.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces.electric = function(k,q1,q2,r){
retu... | __label__POS | 0.755573 |
function Vector2D(x,y) {
this.x = x;
this.y = y;
}
// PUBLIC METHODS
Vector2D.prototype = {
lengthSquared: function(){
return this.x*this.x + this.y*this.y;
},
length: function(){
return Math.sqrt(this.lengthSquared());
},
angle: function(){
return Math.atan2(this.y,this.x);
},
clone: function... | __label__POS | 0.684017 |
unit Model.Interfaces;
interface
uses
Model.Declarations, System.Generics.Collections, Model.ProSu.Interfaces;
type
IDatabaseInterface = interface
['{DDE3E13A-0EC5-4712-B068-9B510977CF71}']
function GetCustomerList: TObjectList<TCustomer>;
function GetCustomerFromName(const nameStr: string): TCustomer;... | __label__POS | 0.799955 |
function Forces(){
}
// STATIC METHODS
Forces.zeroForce = function() {
return (new Vector2D(0,0));
}
Forces.constantGravity = function(m,g){
return new Vector2D(0,m*g);
}
Forces.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces.gravityModified = function(G,m1,m2,r,... | __label__POS | 0.752657 |
unit Model.Declarations;
interface
uses
Model.ProSu.InterfaceActions, Model.ProSu.Interfaces;
type
TCustomer = class
private
fID: Integer;
fName: string;
fDiscountRate: Double;
fBalance: Currency;
public
property ID: integer read fID write fID;
property Name: string read fName write f... | __label__POS | 0.914765 |
function Forces3D(){
}
// STATIC METHODS
Forces3D.zeroForce = function() {
return (new Vector3D(0,0,0));
}
Forces3D.constantGravity = function(m,g){
return new Vector3D(0,m*g,0);
}
Forces3D.gravity = function(G,m1,m2,r){
return r.multiply(-G*m1*m2/(r.lengthSquared()*r.length()));
}
Forces3D.gravityModified = funct... | __label__POS | 0.769055 |
unit Model.Interfaces;
interface
uses
Model.Declarations, System.Generics.Collections, Model.ProSu.Interfaces;
type
IDatabaseInterface = interface
['{DDE3E13A-0EC5-4712-B068-9B510977CF71}']
function GetCustomerList: TObjectList<TCustomer>;
function GetCustomerFromName(const nameStr: string): TCustomer;... | __label__POS | 0.778931 |
using chapter_07.Engine.States;
using Microsoft.Xna.Framework.Audio;
using System;
using System.Collections.Generic;
namespace chapter_07.Engine.Sound
{
public class SoundManager
{
private int _soundtrackIndex = -1;
private List<SoundEffectInstance> _soundtracks = new List<SoundEffectInstance... | __label__POS | 0.950044 |
unit Model.Declarations;
interface
uses
Model.ProSu.InterfaceActions, Model.ProSu.Interfaces;
type
TCustomer = class
private
fID: Integer;
fName: string;
fDiscountRate: Double;
fBalance: Currency;
public
property ID: integer read fID write fID;
property Name: string read fName write f... | __label__POS | 0.920316 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.