Skip to content

Instantly share code, notes, and snippets.

@torazuka
torazuka / Nebasec.java
Last active August 29, 2015 13:57
第19回オフラインリアルタイムどう書く(Java解答)
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.Test;
@torazuka
torazuka / NotFork.java
Last active August 29, 2015 13:56
第18回オフラインリアルタイムどう書くの解答(Java)
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
class Register {
int power;
@torazuka
torazuka / Scheherazade.java
Created January 9, 2014 16:14
第17回オフラインリアルタイムどう書く参考問題の解答
import static org.junit.Assert.assertEquals;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
/**
* Question: http://nabetani.sakura.ne.jp/hena/ord17scheherazade/
@torazuka
torazuka / Boseg.java
Created January 1, 2014 17:20
第16回オフラインリアルタイムどう書くのJava解答(nidouchiさんの解答の再実装)
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
/***
* Question: http://nabetani.sakura.ne.jp/hena/ord16boseg/ -- this answer is a
@torazuka
torazuka / file_colour.diag
Created November 10, 2013 17:51
The file include tree of memory directory in JVM HotSpot
blockdiag {
default_fontsize = 14;
allocation [color = "#ff0000"];
generation, heap, iterator, memRegion, resourceArea, space, watermark [color = "#ff9900"];
// include generation
generationSpec, compactPermGen, genCollectedHeap, "generation.inline", "genOopClosures.inline", permGen, sharedHeap, tenuredGeneration [color = "#ffff00"];
// include iterator
genOopClosures, permGen [color = "#ffff00"];
// include memRegion
@torazuka
torazuka / classes.diag
Created November 10, 2013 17:23
The class inheritance tree of memory directory in JVM HotSpot
blockdiag {
default_fontsize = 14;
ResourceObj -> AllocatedObj;
AllocStats, ReallocMark -> StackObj;
Chunk, Arena -> CHeapObj;
SharedHeap [color = "#FFFFFF"];
GenClosure -> StackObj;
GenCollectedHeap -> SharedHeap -> CollectedHeap -> CHeapObj;
@torazuka
torazuka / AllStatic_tree.diag
Created November 10, 2013 17:05
The important class inheritance trees of the allocation.hpp(JVM HotSpot)
blockdiag {
default_fontsize = 14;
AllStatic [color = "#FF9999"];
Universe -> AllStatic;
oopFactory -> AllStatic;
GenMarkSweep -> MarkSweep -> AllStatic;
HeapInspection -> AllStatic;
@torazuka
torazuka / Elebubo.java
Last active December 27, 2015 05:38
第15回オフラインリアルタイムどう書くのJava解答
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import org.junit.Test;
enum Rune {
U(3, new char[] { '1', '0', '1' }, new char[] { '1', '1', '1' }), N(3,
new char[] { '1', '1', '1' }, new char[] { '1', '0', '1' }), S(3,
@torazuka
torazuka / HuntingMonster.java
Created September 30, 2013 15:04
第14回オフラインリアルタイムどう書くのJava解答
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
enum Arm {
a, c, e, g, i, k;
}
enum Monster {
B(Arm.a, Arm.c), D(Arm.c, Arm.e), F(Arm.e, Arm.g), H(Arm.g, Arm.i), J(
@torazuka
torazuka / Rotdice.java
Last active December 19, 2015 10:19
第12回オフラインリアルタイムどう書く(Java解答)
import java.util.ArrayList;
import java.util.List;
enum Direction {
E {
@Override
Dice go(Dice d) {
return d.goEast();
}
},