- unix: fork, execve
- windows:CreateProcess
- unix: exit / kill
- windows: ExitProcess / TerminateProcess
| package ws10; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.Iterator; | |
| import java.util.List; | |
| import java.util.Map; | |
| import java.util.Set; | |
| public class Application { |
| package klausur; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.HashSet; | |
| import java.util.List; | |
| import java.util.Map; | |
| import java.util.Set; | |
| public class Pruefung { |
| import java.util.ArrayList; | |
| public interface Permutation extends Iterable<Integer>{ | |
| // Build a new Permutation by composition of this and other | |
| public Permutation compose(Permutation other); | |
| // Get element of Permutation at index | |
| public Integer sigma(Integer index); | |
| import java.util.Arrays; | |
| import java.util.List; | |
| public class Test { | |
| /** | |
| * @author Ben Rexin <[email protected] | |
| */ | |
| public static void main(String[] args) { | |
| List<Integer> array = Arrays.asList(1,2,3,4); | |
| System.out.println(sum(array)); | |
| } |
| package aufgabe2 | |
| object App { | |
| def sort[T <% Ordered[T]](arg1:T, arg2:T, args:T*) = (arg1 +: arg2 +: args).sortWith(_<_) | |
| case class PointI(x:Int, y:Int) extends Ordered[PointI] { | |
| def compare(that:PointI):Int = x compare that.x match { | |
| case i if i == 0 => y compare that.y | |
| case i => i | |
| } |
| $ gem install ffi -v '0.6.3' | |
| Building native extensions. This could take a while... | |
| ERROR: Error installing ffi: | |
| ERROR: Failed to build gem native extension. | |
| /Users/ben/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb | |
| extconf.rb:6: Use RbConfig instead of obsolete and deprecated Config. | |
| checking for ffi.h in /usr/local/include... no | |
| checking for rb_thread_blocking_region()... yes | |
| creating extconf.h |
| # If not running interactively, don't do anything | |
| [ -z "$PS1" ] && return | |
| # don't put duplicate lines in the history. See bash(1) for more options | |
| export HISTCONTROL=ignoredups | |
| # ... and ignore same sucessive entries. | |
| export HISTCONTROL=ignoreboth | |
| # check the window size after each command and, if necessary, | |
| # update the values of LINES and COLUMNS. |
| class Matrix[T: Numeric: Manifest](val xDim:Int, val yDim:Int, private val data:Array[T]) { | |
| require(data.size == xDim*yDim, "provided data dosn't match required dimensions") | |
| val numeric = implicitly[Numeric[T]] | |
| val manifest:Manifest[T] = implicitly | |
| //... | |
| override def toString = "Matrix[%s](%s)" format (manifest, data.grouped(xDim).map( "(%s)" format _.mkString(", ") ).mkString(", ")) | |
| } | |
| object Matrix { |
| package aufgabe5 | |
| class Matrix[T](val xDim:Int, val yDim:Int, protected val data:Array[T])(implicit num : Numeric[T], m : Manifest[T]) { | |
| val numeric = num | |
| val manifest = m | |
| def apply(x:Int, y:Int):T = | |
| if (x < 0 || x >= xDim || y < 0 || y >= yDim) | |
| numeric.zero | |
| else |