This file contains 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 fupfin; | |
import java.util.NoSuchElementException; | |
/** | |
* A base class of simple value container that represents optional values. You can | |
* use subclass Some<A> for some existent values or None for non existent values. | |
* This is java version of scala Option class. | |
* | |
* @author [email protected] |
This file contains 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 fupfin; | |
public class Tuples { | |
private Tuples() {} | |
public static <T1, T2> Tuple2<T1, T2> tuple(T1 v1, T2 v2) { | |
return new Tuple2<T1, T2>(v1, v2); | |
} |
This file contains 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 org.fupfin.insight.event1; | |
import java.lang.reflect.Array; | |
public abstract class AbstractArrayRotator<T> implements ArrayRotator<T>{ | |
@Override | |
public T[] rotateRight(T[] source, int step) { | |
if(isValidArguments(source, step)) | |
throw new IllegalArgumentException("step value have to be not negative number : " + step); |
This file contains 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 org.fupfin.insight.event1b; | |
import java.util.Arrays; | |
import java.util.concurrent.RecursiveAction; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.concurrent.ForkJoinPool; | |
public class SetPartitioner { |
This file contains 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 org.fupfin.insight.event2a; | |
public interface FactorialZeroTailCounter { | |
/** | |
* n!의 결과에서 뒷부분 0의 개수와 그 앞자리 수의 수를 반환한다. | |
* @param n 팩토리얼을 계산하려는 수 | |
* @return 끝자리 0의 개수와 그 앞자리 수 | |
*/ | |
public Result count(int n); |
This file contains 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 org.fupfin.insight.evnet2b; | |
import java.util.LinkedList; | |
import java.util.List; | |
import org.fupfin.insight.evnet2b.WordGraphBuilder.WordGraph; | |
public abstract class AbstractPathFinder implements PathFinder { | |
protected WordGraph graph; |
This file contains 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 com.fupfin.euler.problem2 | |
import scala.collection.immutable.Stream._ | |
import scala.collection.GenIterable | |
object Problem2 { | |
def fib(max: Int): Stream[Int] = 1 #:: 2 #:: fib(1, 2, max) | |
private def fib(v1:Int, v2:Int, max:Int): Stream[Int] = if(v1 + v2 <= max) (v1 + v2) #:: fib(v2, v1 + v2, max) else Empty | |
def sum(that:GenIterable[Int], p: Int => Boolean): Int = { |
This file contains 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
<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.springframework.samples</groupId> | |
<artifactId>myfirstspring</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<properties> | |
<!-- Generic properties --> |
This file contains 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
import static java.lang.System.out; | |
import com.google.code.jyield.*; | |
public class GeneratorDemo { | |
public static void main(String args[]) { | |
for(int n: YieldUtils.toIterable(take(25, sequenceOf(integers())))) | |
out.println(n); | |
} | |
public static Generator<Integer> take(int count, Generator<Integer> source) { |
This file contains 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 com.fupfin.groovybase64 | |
import java.nio.ByteBuffer | |
class Base64 { | |
static RAW_CHUNK_SIZE = 3 | |
static ENC_CHUNK_SIZE = 4 | |
static encChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes() |
OlderNewer