id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
8a0731e9-0fe2-4c0b-923d-62a5ce0888cb | @Override
public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {
g.setColor(Color.darkGray);
g.fillRect(0, 0, container.getWidth(), container.getHeight());
tileMap.render(container, game, g);
} |
56a328d9-0f63-4fd5-86e7-636bc18c9eb7 | @Override
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
ga.inputReceiver.reactToInput(container, delta);
} |
60588ede-9a01-4ad2-8007-a20d4539157f | public InputReceiver() {
} |
171411ff-3532-4480-b2c2-45287f6753ed | public void reactToInput(GameContainer container, int delta) {
input = container.getInput();
universalInput(container);
} |
ba1f70e3-563a-49ee-8fa1-a2e5a3b2cd10 | private void universalInput(GameContainer container) {
if (input.isKeyPressed(Input.KEY_ESCAPE)) {
container.exit();
}
} |
5734d6c3-4b80-40bb-95c3-221dda3391f6 | public static void init(GameContainer container, StateBasedGame game) throws SlickException {
//Tiles
t9Grass = new Image("res/texture.png");
} |
9e6bd077-aff3-4395-aa3d-901b666f596f | public static Image getT9Grass() {
return t9Grass;
} |
c92f4443-2807-4ee2-9c5b-ffb907d9c59d | @RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formatt... |
ddf57f47-8e63-4bfb-974f-87dbb2c8c129 | public String getOpis() {
return opis;
} |
0899c680-2c7d-4ffd-a231-4a52f490368f | public Set<PozycjaZlecenia> getPozycjeZlecenia() {
return pozycjeZlecenia;
} |
7db5d20b-2812-4b3a-a6e0-520e87e808fb | public void setPozycjeZlecenia(Set<PozycjaZlecenia> pozycjeZlecenia) {
this.pozycjeZlecenia = pozycjeZlecenia;
} |
c697897c-26d4-4502-b8a8-b9fadd318dc8 | public void setOpis(String opis) {
this.opis = opis;
} |
996c77e7-0c40-4acf-9049-8ed36667711d | public StatusZlecennia getStatusZlecenia() {
return statusZlecenia;
} |
a08feb5b-2a1a-486f-ad7b-5f97a75fe4a9 | public void setStatusZlecenia(StatusZlecennia statusZlecenia) {
this.statusZlecenia = statusZlecenia;
} |
308449bd-c5de-413b-b5f4-852ad8059d72 | public TypSprzetu getTypSprzetu() {
return typSprzetu;
} |
fa0a9636-a549-481d-bb10-6382c742ecb2 | public void setTypSprzetu(TypSprzetu typSprzetu) {
this.typSprzetu = typSprzetu;
} |
037e1f9e-be48-47f2-ac25-cab0edd2a988 | public static long getSerialversionuid() {
return serialVersionUID;
} |
91b85dd1-6efe-43fe-b58c-3c5bf008c7a6 | public PK getId() {
return id;
} |
3d1ece56-a463-4235-8db2-9fb57ea8a6ae | protected void setId(final PK id) {
this.id = id;
} |
5c557bc3-cf59-4f9d-8545-af2d1878e8c1 | public boolean isNew() {
return null == getId();
} |
ba5f4435-9c0c-44cc-b290-ab4a0419ac79 | @Override
public String toString() {
return String.format("Entity of type %s with id: %s", this.getClass().getName(), getId());
} |
2b45d5fd-d4a9-4b06-9a99-87d9b542cc3f | @Override
public boolean equals(Object obj) {
if (null == obj) {
return false;
}
if (this == obj) {
return true;
}
if (!getClass().equals(obj.getClass())) {
return false;
}
AbstractPersistable<?> that = (AbstractPersistable<?>) obj;
return null == this.getId() ? fal... |
6bf3b04d-7d1f-4578-9334-ff93032677de | @Override
public int hashCode() {
int hashCode = 17;
hashCode += null == getId() ? 0 : getId().hashCode() * 31;
return hashCode;
} |
ab44ce99-3dc4-4193-9b9d-20e160248661 | @Column(name ="opis", nullable = false, length=255)
public String getOpis() {
return opis;
} |
3ab33705-bc33-4e85-8e55-20e4b730b0b8 | public void setOpis(String opis) {
this.opis = opis;
} |
895e4b40-a393-4170-9a3e-b1b601226d23 | public BigDecimal getKoszt() {
return koszt;
} |
c6691fde-413b-44a9-b02b-6a785127fa54 | public void setKoszt(BigDecimal koszt) {
this.koszt = koszt;
} |
21418531-cefb-4a09-8388-619ac4732fbc | public Iterable<Zlecenie> findAll() {
return zlecenieRepository.findAll();
} |
25feadac-e07b-4cba-a640-1e70244b7b2b | public Zlecenie save(Zlecenie t) {
return zlecenieRepository.save(t);
} |
9c923d58-2002-4ceb-b15b-8b7e8ee9883b | public void delete(Long id) {
zlecenieRepository.delete(id);
} |
2084d274-5876-49e7-97c8-507e59f8b3b3 | public Zlecenie findOne(Long id) {
return zlecenieRepository.findOne(id);
} |
d5d4684f-7ed5-44cf-8096-5671815eab5a | @RequestMapping(value = "/zlecenia", method = RequestMethod.GET)
public String list(Model model) {
logger.info("Lista zlecen");
model.addAttribute("zlecenia",zleceniaService.findAll());
return "zlecenia/list";
} |
b8d2b6e4-1c40-4392-8f6c-d797ce9acbf2 | @RequestMapping(value="/welcome", method = RequestMethod.GET)
public String printWelcome(ModelMap model, Principal principal ) {
String name = principal.getName();
model.addAttribute("username", name);
model.addAttribute("message", "Spring Security Custom Form example");
return "login/hello";
} |
46a09745-d8d4-4d5d-922e-be29c8fb10a9 | @RequestMapping(value="/login", method = RequestMethod.GET)
public String login(ModelMap model) {
return "login/login";
} |
ee817b3c-1e89-40cf-be79-fc6f8063d957 | @RequestMapping(value="/loginfailed", method = RequestMethod.GET)
public String loginerror(ModelMap model) {
model.addAttribute("error", "true");
return "login/login";
} |
6808a531-e418-4a36-9c6b-2f82593bbc2d | @RequestMapping(value="/logout", method = RequestMethod.GET)
public String logout(ModelMap model) {
return "login/login";
} |
c37ec72d-da36-4e79-a7bc-da49a4beafdd | public static void main(String[] args) throws IOException{
try ( BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));) {
String file1 = rd.readLine();
String file2 = rd.readLine();
String file3 = rd.readLine();
FileInputStream file1Input = ... |
13e7ba46-5703-47bb-9948-2b1d59673b6f | public static boolean checkTelNumber(String telNumber)
{
if(telNumber.matches("^\\+\\d{12}")) {
return true;
} else if(telNumber.matches("^\\+\\d*\\(\\d{3}\\)\\d+") && telNumber.matches(".{15}")) {
return true;
} else if (telNumber.matches("^\\+\\d*\\(\\d{3}\\)\\d*\\-... |
883e2eb4-0c5d-4f24-81f7-806fb04b239d | public ArrayList<Horse> getHorses()
{
return horses;
} |
35f6c0dd-d2a2-4341-b34b-081a1294692e | public void run() {
for (int i = 1; i <= 100 ; i++)
{
move();
print();
try
{
Thread.sleep(500);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
} |
45edd226-1ca6-4fac-a457-77d30098bad1 | public void move() {
for (Horse horse: getHorses())
{
horse.move();
}
} |
3abcf63a-a5f0-4e65-b738-0b94b026f1cf | public void print() {
for (Horse horse : getHorses())
{
horse.print();
}
System.out.println();
System.out.println();
} |
8a1ab015-1a60-4cb4-bca1-0723ed94466d | public Horse getWinner() {
double distance = 0;
Horse winner = null;
for (Horse horse : horses)
{
double tmp = horse.getDistance();
if (tmp > distance) {
distance = tmp;
winner = horse;
}
}
return winn... |
26898119-9716-405c-a986-e901f545ee9d | public void printWinner() {
System.out.println("Winner is " + getWinner().getName() + "!");
} |
3d4555d1-e895-4efa-86ac-fce2925bd4c9 | public static void main(String[] args)
{
game = new Hippodrome();
game.getHorses().add(new Horse("Joey", 3, 0));
game.getHorses().add(new Horse("Monica", 3, 0));
game.getHorses().add(new Horse("Ross", 3, 0));
game.run();
game.printWinner();
} |
d530af3b-475c-49c2-962f-5c72fe1dd9f8 | public Horse(String name, double speed, double distance) {
this.name = name;
this.speed = speed;
this.distance = distance;
} |
3b3ce886-d5ea-40dc-a03a-58117bc3e785 | public String getName()
{
return name;
} |
d303790b-2f8b-438a-b2c9-987c8951d695 | public double getDistance()
{
return distance;
} |
5284fdcf-adf5-4250-9fe0-79eb3abdf011 | public void move() {
distance += speed * Math.random();
} |
4a025896-7a5e-4cb7-b75c-18fdbaa88f67 | public void print() {
for (int i = 0; i < (int) getDistance(); i++)
{
System.out.print(".");
}
System.out.print(getName());
System.out.println();
} |
b9c7bb27-8a29-4e96-a220-29f99e4f28e2 | public TicTacToe(int fieldSize) {
this.fieldSize = fieldSize;
this.field = new char[fieldSize][fieldSize];
} |
f01ee663-c1da-4300-b543-661c83444ec1 | public void fillField () {
int spot = 1;
for (int i = 0; i < fieldSize; i++) {
for (int j = 0; j < fieldSize; j++) {
field[i][j] =(char)spot++;
}
}
} |
d6fe5918-361a-4760-8b9c-28da44592984 | public void showField() {
for (int i = 0; i < fieldSize; i++) {
for (int j = 0; j < fieldSize; j++) {
if (Character.isLetter(field[i] [j])) {
System.out.print("[ " + field[i][j] + " ]");
} else {
System.out.print("[ " + (int) f... |
0d8ee2a7-0f87-4279-9d94-c308db1ab42b | public void move(int spot, char symbol) {
switch (spot) {
case 1 : field[0][0] = symbol;
break;
case 2 : field[0][1] = symbol;
break;
case 3 : field[0][2] = symbol;
break;
case 4 : field[1][0] = symbol;
... |
7e9e88ea-bf42-44a8-be0b-936e7127e17c | public boolean checkFreeCell(int spot) {
boolean freeCell = false;
for (int i = 0; i < fieldSize; i++) {
for (int j = 0; j < fieldSize; j++) {
if (field[i][j] == (char) spot) {
freeCell = true;
break;
}
}
... |
583ee2f4-39dd-48cc-9aae-405b64fb3a17 | public char checkWinner(char symbol) {
char winner = ' ';
//horizontal
if (field[0][0] == symbol && field[0][1] == symbol && field[0][2] == symbol ||
field[1][0] == symbol && field[1][1] == symbol && field[1][2] == symbol ||
field[2][0] == symbol && field[2][1] ... |
6478d23c-4a9a-4329-bf5a-3fd3b6f5dc6d | public void play() {
int spot;
Scanner in = new Scanner(System.in);
System.out.println("Game Start!");
fillField();
showField();
do {
//move X
if(gameAvailable) {
System.out.println("Player 'X', enter your move ( 1 - 9 ):");
... |
55207825-6e19-4de7-a568-8b308b978951 | public static void main(String[] args) {
new TicTacToe(DEFAULT_FIELD_SIZE).play();
} |
e80d9b9c-7820-467d-a848-86b502977d35 | public Perlin1dTest() {
} |
e5362e90-f8be-45dd-a35c-bcb7eb8e2457 | @BeforeClass
public static void setUpClass() {
} |
c12354a8-7f7c-4c7f-b467-7c293dc0d180 | @AfterClass
public static void tearDownClass() {
} |
9a441a53-0b39-486b-99e7-2db4c3dc4525 | @Before
public void setUp() {
} |
4916a75f-170e-4294-9cac-ae8d63b286cd | @After
public void tearDown() {
} |
67e801c7-92b4-4277-a587-c26358c294dd | @Test
public void testCreateTiledArray() {
System.out.println("createTiledArray");
CosineInterpolator cosInterp = new CosineInterpolator();
LinearInterpolator linInterp = new LinearInterpolator();
for (int i = 0; i < 100; i++) {
int size = 500;
double p = Math... |
692b90f4-0741-45e8-81de-7cddbf1a58d8 | @Test
public void testCreateArray() {
System.out.println("createArray");
CosineInterpolator cosInterp = new CosineInterpolator();
LinearInterpolator linInterp = new LinearInterpolator();
for (int i = 0; i < 100; i++) {
int size = 500;
double p = Math.random() ... |
8d3a7035-a269-4223-af1f-a890861c868b | public GifSequenceWriter(
ImageOutputStream outputStream,
int imageType,
int timeBetweenFramesMS,
boolean loopContinuously) throws IIOException, IOException {
// my method to create a writer
gifWriter = getWriter();
imageWriteParam = gifWriter.getD... |
9ff2f437-8e37-4a28-ac95-d8417e09320b | public void writeToSequence(RenderedImage img) throws IOException {
gifWriter.writeToSequence(
new IIOImage(
img,
null,
imageMetaData),
imageWriteParam);
} |
c0b2a89c-a83c-4e45-8f2f-fc73528058d2 | public void close() throws IOException {
gifWriter.endWriteSequence();
} |
3a419c58-dad3-43f8-8e4a-8623251dcdb3 | private static ImageWriter getWriter() throws IIOException {
Iterator<ImageWriter> iter = ImageIO.getImageWritersBySuffix("gif");
if (!iter.hasNext()) {
throw new IIOException("No GIF Image Writers Exist");
} else {
return iter.next();
}
} |
83b95c40-b619-447e-bc6e-868814a77b31 | private static IIOMetadataNode getNode(
IIOMetadataNode rootNode,
String nodeName) {
int nNodes = rootNode.getLength();
for (int i = 0; i < nNodes; i++) {
if (rootNode.item(i).getNodeName().compareToIgnoreCase(nodeName)
== 0) {
retu... |
4a80b7c1-7dfa-4afe-afe3-6f58b12b248e | public static void main(String[] args) throws Exception {
if (args.length > 1) {
// grab the output image type from the first image in the sequence
BufferedImage firstImage = ImageIO.read(new File(args[0]));
// create a new BufferedOutputStream with the last argument
... |
ee8271f9-1f97-451f-a75d-567e96708566 | public Perlin2d(double persistence, int octaves, int seed, Interpolator interpolator) {
this.seed = seed;
this.octaves = octaves;
this.persistence = persistence;
this.interpolator = interpolator;
setPrimes(seed);
} |
572b1157-d4e8-4c1a-89d2-00dc1eefb65f | public Perlin2d(double persistence, int octaves, int seed) {
this.seed = seed;
this.octaves = octaves;
this.persistence = persistence;
interpolator = new CosineInterpolator();
setPrimes(seed);
} |
3c5fad4e-e6a3-4eeb-9716-1c2225e8a1ff | public double[][] tile(double[][] noise) {
int w = noise.length / 2;
int h = noise[0].length / 2;
double[][] tiled = new double[w][h];
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
int x = i + w;
int y = j + h;
dou... |
7e87bc6e-0120-43ef-9647-94bc8dbe2ad4 | public double[][] createTiledArray(int width, int height) {
double[][] tiledNoise = tile(createRawArray(width * 2, height * 2));
clamp(tiledNoise);
return tiledNoise;
} |
6fed6a78-9275-4612-ac38-f97121beff9c | public double[][] createArray(int width, int height) {
double[][] noise = createRawArray(width, height);
clamp(noise);
return noise;
} |
e5e618cd-461d-4472-bbd4-f47fa6bfcfe9 | private double[][] createRawArray(int width, int height) {
double[][] y = new double[width][height];
final int regionWidth = 3;
int smallSeed = Math.abs(seed / 1000);
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
double nx = 1.0 * i / wi... |
83b59089-55e3-4cba-8d09-e3ac3625f5e3 | private void clamp(double[][] noise) {
int w = noise.length;
int h = noise[0].length;
double max = -1, min = 1;
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
max = Math.max(max, noise[i][j]);
min = Math.min(min, noise[i][j]);
... |
a3f0b55a-780d-46a5-9e6f-7f54cce2b8f9 | private void setPrimes(int seed) {
p1s = new int[octaves];
p2s = new int[octaves];
p3s = new int[octaves];
for (int i = 0; i < octaves; ++i) {
Random ran = new Random(i + seed);
p1s[i] = BigInteger.probablePrime(23, ran).intValue();
p2s[i] = BigInteger... |
18736016-93c3-4577-9be0-e6d14b36edb8 | private double perlinNoise2(double x, double y) {
double total = 0;
int f = 1;
double a = 1;
for (int i = 0; i < octaves; ++i) {
p1 = p1s[i];
p2 = p2s[i];
p3 = p3s[i];
total += interpolatedNoise2(x * f, y * f) * a;
f *= 2;
... |
ac2a79c8-127b-445c-a364-083b27f85792 | private double noise2(int x, int y) {
int n = x + y * 101;
n = (n << 13) ^ n;
return (1.0 - ((n * (n * n * p1 + p2) + p3) & 0x7fffffff) / 1073741824.0);
} |
6cd565b6-0293-42e1-917e-aa7e24355a79 | private double smoothedNoise2(int x, int y) {
double corners = (noise2(x - 1, y - 1) + noise2(x + 1, y - 1) + noise2(x - 1, y + 1) + noise2(x + 1, y + 1)) / 16;
double sides = (noise2(x - 1, y) + noise2(x + 1, y) + noise2(x, y - 1) + noise2(x, y + 1)) / 8;
double center = noise2(x, y) / 4;
... |
08e2d04d-479e-46c2-81cb-f21f9c2cad71 | private double interpolatedNoise2(double x, double y) {
int intX = (int) x;
int intY = (int) y;
double fractionalX = x - intX;
double fractionalY = y - intY;
double v1 = smoothedNoise2(intX, intY);
double v2 = smoothedNoise2(intX + 1, intY);
double v3 = smoothedN... |
d76dcc9b-7335-4c79-99ba-61a5cda99766 | private double interpolate(double v1, double v2, double fractionalX) {
return interpolator.interpolate(v1, v2, fractionalX);
} |
0abe5c56-d948-4e67-bc82-a39721a11f87 | public Perlin1d(double persistence, int octaves, int seed, Interpolator interpolator) {
this.seed = seed;
this.octaves = octaves;
this.persistence = persistence;
this.interpolator = interpolator;
setPrimes(seed);
} |
17d1db16-bfee-4ced-a7e2-e2be48a2ad9b | public Perlin1d(double persistence, int octaves, int seed) {
this.seed = seed;
this.octaves = octaves;
this.persistence = persistence;
interpolator = new CosineInterpolator();
setPrimes(seed);
} |
846a16a8-a790-4058-ae6b-090b869e894b | public double[] tile(double[] noise) {
//treat noise as a function with domain -t to t, where t = noise.length / 2
//i.e. noise[0] = f(-t), noise[noise.length-1] = f(t)
int t = noise.length / 2;
double[] tiled = new double[t];
for (int z = 0; z < t; z++) {
tiled[z] = ... |
6da73879-b2ee-4164-99a5-108e0bcab78d | public double[] createTiledArray(int size) {
double[] tiledNoise = tile(createRawArray(size * 2));
clamp(tiledNoise);
return tiledNoise;
} |
8152d4e8-ffe3-46ec-8c52-8839a5e929cb | public double[] createArray(int size) {
double[] noise = createRawArray(size);
clamp(noise);
return noise;
} |
8b5e8e71-781e-4f82-95c5-f83118a3bad9 | private double[] createRawArray(int size) {
double[] y = new double[size];
final int regionWidth = 3;
int smallSeed = Math.abs(seed / 1000);
for (int i = 0; i < size; i++) {
double nx = 1.0 * i / size * regionWidth;
y[i] = perlinNoise1(smallSeed + nx);
}
... |
1e221784-ab97-44e0-a807-1921b9ad184d | private void clamp(double[] noise) {
int size = noise.length;
double max = -1, min = 1;
for (int i = 0; i < size; i++) {
max = Math.max(max, noise[i]);
min = Math.min(min, noise[i]);
}
double range = max - min;
for (int i = 0; i < size; i++) {
... |
8e27eca5-53ee-4f78-8d5d-fa908e142100 | private void setPrimes(int seed) {
p1s = new int[octaves];
p2s = new int[octaves];
p3s = new int[octaves];
for (int i = 0; i < octaves; ++i) {
Random ran = new Random(i + seed);
p1s[i] = BigInteger.probablePrime(23, ran).intValue();
p2s[i] = BigInteger... |
2f568a68-782c-4c6c-9a23-81cd6fc55950 | private double perlinNoise1(double x) {
double total = 0;
int f = 1;
double a = 1;
for (int i = 0; i < octaves; ++i) {
//set this octave's primes. this saves on array lookups
p1 = p1s[i];
p2 = p2s[i];
p3 = p3s[i];
total += inter... |
e5894fb7-eb84-4851-9e2f-29801a43f7b6 | private double noise1(int x) {
x = (x << 13) ^ x;
return (1.0 - ((x * (x * x * p1 + p2) + p3) & 0x7fffffff) / 1073741824.0);
} |
e058d2c3-af06-4eb1-9151-d8e8a6f5218d | private double smoothedNoise1(int x) {
return noise1(x) / 2 + noise1(x - 1) / 4 + noise1(x + 1) / 4;
} |
1f81a562-c7d3-4674-9e8e-53a2f1641ea1 | private double interpolatedNoise1(double x) {
int intX = (int) x;
double fractionalX = x - intX;
double v1 = smoothedNoise1(intX);
double v2 = smoothedNoise1(intX + 1);
return interpolate(v1, v2, fractionalX);
} |
5341a0cd-785b-4fd7-99fe-d0a2a756eb39 | private double interpolate(double v1, double v2, double fractionalX) {
return interpolator.interpolate(v1, v2, fractionalX);
} |
f153d7b3-5412-491c-83ac-8b179be33d71 | public static void main(String[] args) {
drawTiled1d();
drawTiled2d();
drawTiled1dAnimated();
} |
bbc6c640-cf1c-4001-b95c-f544ad2c6531 | public static void drawTiled1d() {
int displayWidth = 800;
int displayHeight = 600;
int displayBufferHeight = 20;
int size = 5000;
double p = .5;
int seed = (int) (Integer.MAX_VALUE * Math.random());
int n = 5;
Perlin1d pn = new Perlin1d(p, n, seed);
... |
57fcadee-0b28-4be3-8870-7a76b8da0ab3 | @Override
public void paintComponent(Graphics g) {
g.drawImage(result, 0, 0, null);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.