This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import java.util.Arrays; | |
import java.util.Date; | |
import java.util.List; | |
import org.junit.Test; | |
import test.entity.Bar; | |
import test.entity.Foo; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test.entity; | |
import java.util.List; | |
import com.google.code.morphia.annotations.Embedded; | |
@Embedded | |
public class Bar { | |
private long id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testSerliazingMapByMessagePack(){ | |
Map<String, Object> map = new HashMap<String, Object>(); | |
map.put("int", 1); | |
map.put("long", 1L); | |
map.put("date", new Date()); | |
map.put("string", "test"); | |
byte[] buffer = MessagePack.pack(map); | |
for (byte b : buffer) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'jmx4r' | |
import java.lang.management.ManagementFactory | |
import javax.management.ObjectName | |
class MBeanRegister < JMX::DynamicMBean | |
operation "regster mbean script" | |
parameter :string, "mbean class name" | |
parameter :string, "object name" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.wrap_trap.scala.examples | |
object ImplicitConversionTest { | |
def main(args : Array[String]) : Unit = { | |
val s1 : String = "Foo" | |
val i : Int = s1 // compile error 'type mismatch; found : String required: Int' without string2Int | |
System.out.println("i: " + i); | |
} | |
implicit def string2Int(str: String) : Int = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.wrap_trap.scala.examples | |
object OrderedComparableTest { | |
def main(args : Array[String]) : Unit = { | |
val s1 : String = "Hoge" | |
val s2 : String = "Bar" | |
System.out.println(new Sample1[String](s1).compare(s2)) | |
System.out.println(new Sample2[String](s1).compare(s2)) // 'Implicit conversions found: s1 => augmentString(s1)' | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.wrap_trap.scala.examples | |
import java.util.Comparator | |
object OrderedCompareTest { | |
def main(args : Array[String]) : Unit = { | |
System.out.println("called main") | |
System.out.println( | |
compareAB(new OrderedClass(2), new OrderedClass(1))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.wrap_trap.scala.examples | |
import java.util.Comparator | |
object OrderedCompareTest2 { | |
def main(args : Array[String]) : Unit = { | |
System.out.println("called main") | |
// compile error when disabling nonOrderedClassToComparable Method. | |
// No implicit Ordering defined for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.wrap_trap.utils.rbtree | |
object RedBlackTree { | |
object Color extends Enumeration { | |
val Red, Black = Value | |
} | |
class Hash[K, V] {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AbstractNode | |
@@root = nil | |
def initialize(n, keys, parent) | |
@slot = n | |
@keys = keys | |
@parent = parent | |
@@root = self unless @@root | |
end |
OlderNewer