org.xerial.util
Class Algorithm

java.lang.Object
  extended by org.xerial.util.Algorithm

public class Algorithm
extends Object

プログラミングに便利なAlgorithm群を定義

Author:
leo

Method Summary
static
<E> void
add(Collection<E> c, E[] array)
          arrayのそれぞれの値を、逐次cに追加する。
static
<E> void
add(List<E> container, Collection<E> input)
          inputのそれぞれの要素を、逐次containerに追加する
static int boolToInt(boolean flag)
          boolean値を数値に変換
static
<E extends Comparable<E>>
int
lexicographicalCompare(Iterable<E> f1, Iterable<E> f2)
          辞書順に比較を行う。
static
<E extends Comparable<E>>
MinMax<E>
minmax(E e1, E e2)
          2つの入力の大小のペアを計算する
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

minmax

public static <E extends Comparable<E>> MinMax<E> minmax(E e1,
                                                         E e2)
2つの入力の大小のペアを計算する

Type Parameters:
E - Comparable Interfaceを実装したクラス
Parameters:
e1 -
e2 -
Returns:
MinMax

lexicographicalCompare

public static <E extends Comparable<E>> int lexicographicalCompare(Iterable<E> f1,
                                                                   Iterable<E> f2)
辞書順に比較を行う。

Type Parameters:
E - compareToが実装されているクラス
Parameters:
f1 -
f2 -
Returns:
negative value : f1 < f2, 0 : f1 == f2, positive value : f1 > f2

boolToInt

public static int boolToInt(boolean flag)
boolean値を数値に変換

Parameters:
flag -
Returns:
true:1, false:0

add

public static <E> void add(Collection<E> c,
                           E[] array)
arrayのそれぞれの値を、逐次cに追加する。

Type Parameters:
E - 任意の型
Parameters:
c - 代入先のCollection
array - 代入元配列

add

public static <E> void add(List<E> container,
                           Collection<E> input)
inputのそれぞれの要素を、逐次containerに追加する

Type Parameters:
E -
Parameters:
container -
input -


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.1 Japan License.