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 eu.crembo; | |
/** | |
* Bounded buffer problem. | |
* <p/> | |
* 2 Consumers and 2 Producers. | |
* Producers puts items into buffer - make sure it doesn't put into full buffer. | |
* Consumer uses items from buffer - make sure it doesn't take from empty buffer. | |
*/ | |
public class Main { |
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 eu.crembo; | |
/** | |
* Created by Crembo on 2014-05-13. | |
*/ | |
public class Task3 { | |
public static final int LIMIT = 50000; | |
public static final int CONSUMER_NUM = 2; | |
public static final int PRODUCER_NUM = 2; |
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 eu.crembo; | |
import java.util.ArrayList; | |
/** | |
* Bounded buffer problem. | |
* <p/> | |
* 2 Consumers and 2 Producers. | |
* Producers puts items into buffer - make sure it doesn't put into full buffer. | |
* Consumer uses items from buffer - make sure it doesn't take from empty buffer. |
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
/** | |
* Put an item into the bounded buffer | |
* | |
* @param itm | |
* @throws InterruptedException | |
*/ | |
public void put(int itm) throws InterruptedException { | |
enter(); | |
boolean acquired = false; |
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 eu.crembo; | |
/** | |
* Created by Crembo on 2014-05-13. | |
*/ | |
public class Task3 { | |
public static final int LIMIT = 100; | |
public static final int NUM = 3; | |
public static BoundedBuffer b; |
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 eu.crembo; | |
/** | |
* Bounded buffer problem. | |
* <p/> | |
* 2 Consumers and 2 Producers. | |
* Producers puts items into buffer - make sure it doesn't put into full buffer. | |
* Consumer uses items from buffer - make sure it doesn't take from empty buffer. | |
*/ | |
public class Task2 { |
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
require 'fileutils' | |
if ARGV[0].nil? || ARGV[1].nil? | |
puts 'Must define where to and from to copy', | |
'Usage: movejars <from> <to>', | |
'May use . to say "current folder"' | |
exit 0 | |
end | |
$from = ARGV[0].dup |
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
<?hh | |
ini_set('memory_limit','2048M'); | |
$start = microtime(true); | |
/* The Computer Language Benchmarks Game | |
http://benchmarksgame.alioth.debian.org/ | |
contributed by Peter Baltruschat | |
modified by Levi Cameron | |
modified by Craig Russell | |
*/ |
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
final Collection<Sample> allByBarcode = sampleService.byBarcode(groupRequest.getSamples(), currentUser); | |
if (!allByBarcode.isEmpty()) { | |
Group group = new Group(); | |
group.setName(groupRequest.getName()); | |
group.setSamples(allByBarcode); | |
group.setType(groupRequest.getType()); | |
group.setOwner(currentUser); |
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
@Override | |
public Set<Sample> samplesFromGroups(Collection<Long> ids) { | |
return repository.findAllByIdIn(ids) // get all groups | |
.stream() | |
.map(Group::getSamples) // get samples of each group | |
.flatMap(Set::stream) // flatten into a single set of samples | |
.collect(toSet()); | |
} | |
@Override |
OlderNewer