repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
doanduyhai/killrvideo-java
src/main/java/killrvideo/events/CassandraMutationError.java
// Path: src/main/java/killrvideo/utils/ExceptionUtils.java // public class ExceptionUtils { // // public static final String mergeStackTrace(Throwable throwable) { // StringJoiner joiner = new StringJoiner("\n\t", "\n", "\n"); // joiner.add(throwable.getMessage()); // Arrays.asList(throwab...
import com.google.protobuf.GeneratedMessageV3; import killrvideo.utils.ExceptionUtils;
package killrvideo.events; /** * Error bean to be published in BUS. * * @author DataStax evangelist team. */ public class CassandraMutationError { /** * Failed Protobuf requests. */ public final GeneratedMessageV3 request; /** * Related exception in code. */ public final...
// Path: src/main/java/killrvideo/utils/ExceptionUtils.java // public class ExceptionUtils { // // public static final String mergeStackTrace(Throwable throwable) { // StringJoiner joiner = new StringJoiner("\n\t", "\n", "\n"); // joiner.add(throwable.getMessage()); // Arrays.asList(throwab...
builder.append(ExceptionUtils.mergeStackTrace(throwable));
doanduyhai/killrvideo-java
src/main/java/killrvideo/entity/CommentsByUser.java
// Path: src/main/java/killrvideo/utils/TypeConverter.java // public class TypeConverter { // // public static Timestamp instantToTimeStamp(Instant instant) { // return Timestamp.newBuilder() // .setSeconds(instant.getEpochSecond()) // .setNanos(instant.getNano()).build(); /...
import static java.util.UUID.fromString; import java.io.Serializable; import java.util.Date; import java.util.UUID; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.Length; import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotati...
package killrvideo.entity; /** * Pojo representing DTO for table 'comments_by_user' * * @author DataStax evangelist team. */ @Table(keyspace = Schema.KEYSPACE, name = Schema.TABLENAME_COMMENTS_BY_USER) public class CommentsByUser implements Serializable, Schema { /** Serial. */ private static final ...
// Path: src/main/java/killrvideo/utils/TypeConverter.java // public class TypeConverter { // // public static Timestamp instantToTimeStamp(Instant instant) { // return Timestamp.newBuilder() // .setSeconds(instant.getEpochSecond()) // .setNanos(instant.getNano()).build(); /...
.setCommentId(TypeConverter.uuidToTimeUuid(commentid))
doanduyhai/killrvideo-java
src/main/java/killrvideo/events/CassandraMutationErrorHandler.java
// Path: src/main/java/killrvideo/configuration/KillrVideoConfiguration.java // @Configuration // public class KillrVideoConfiguration { // // // --- Global Infos // // @Value("${killrvideo.application.name:KillrVideo}") // private String applicationName; // // @Value("${killrvideo.applica...
import java.io.FileNotFoundException; import java.io.PrintWriter; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import com.google.common.eventbus.Subscribe; ...
package killrvideo.events; /** * Catch exceptions and create a {@link CassandraMutationError} in EventBus. * * @author DataStax evangelist team. */ @Component public class CassandraMutationErrorHandler { /** LOGGER for the class. */ private static Logger LOGGER = LoggerFactory.getLogger(CassandraMuta...
// Path: src/main/java/killrvideo/configuration/KillrVideoConfiguration.java // @Configuration // public class KillrVideoConfiguration { // // // --- Global Infos // // @Value("${killrvideo.application.name:KillrVideo}") // private String applicationName; // // @Value("${killrvideo.applica...
private KillrVideoConfiguration config;
doanduyhai/killrvideo-java
src/main/java/killrvideo/entity/VideoPlaybackStats.java
// Path: src/main/java/killrvideo/utils/TypeConverter.java // public class TypeConverter { // // public static Timestamp instantToTimeStamp(Instant instant) { // return Timestamp.newBuilder() // .setSeconds(instant.getEpochSecond()) // .setNanos(instant.getNano()).build(); /...
import java.io.Serializable; import java.util.Optional; import java.util.UUID; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; import killrvideo.statistics.StatisticsServiceOuterClass.PlayStats; imp...
package killrvideo.entity; /** * Pojo representing DTO for table 'video_playback_stats'. * * @author DataStax evangelist team. */ @Table(keyspace = Schema.KEYSPACE, name = Schema.TABLENAME_PLAYBACK_STATS) public class VideoPlaybackStats implements Serializable { /** Serial. */ private static final long...
// Path: src/main/java/killrvideo/utils/TypeConverter.java // public class TypeConverter { // // public static Timestamp instantToTimeStamp(Instant instant) { // return Timestamp.newBuilder() // .setSeconds(instant.getEpochSecond()) // .setNanos(instant.getNano()).build(); /...
.setVideoId(TypeConverter.uuidToUuid(videoid))
Pedro12909/RexCord
src/test/java/utils/XmlParserTest.java
// Path: src/main/java/model/Configuration.java // public final class Configuration { // // /** // * token // */ // private String token; // // /** // * prefix // */ // private String prefix; // // /** // * banned commands // */ // private String bannedCommands; ...
import model.Configuration; import org.junit.Test; import java.io.IOException; import static org.junit.Assert.*;
package utils; /** * Created by thales minussi on 28/09/17. * https://github.com/tminussi */ public class XmlParserTest { @Test public void parseXmlShouldReturnConfiguration() throws IOException {
// Path: src/main/java/model/Configuration.java // public final class Configuration { // // /** // * token // */ // private String token; // // /** // * prefix // */ // private String prefix; // // /** // * banned commands // */ // private String bannedCommands; ...
Configuration configuration = XmlParser.parseXml("config/example_config.xml", Configuration.class);
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONParser.java
// Path: src/main/java/org/json/JSONString.java // public interface JSONString { // // /** // * The toJSONString method allows a class to produce its own JSON // * serialization. // * // * @return String representation of JSON object // * */ // String toJSONString(); // // }
import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONString;
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed u...
// Path: src/main/java/org/json/JSONString.java // public interface JSONString { // // /** // * The toJSONString method allows a class to produce its own JSON // * serialization. // * // * @return String representation of JSON object // * */ // String toJSONString(); // // } // Pat...
return new JSONString() {
skyscreamer/JSONassert
src/test/java/org/skyscreamer/jsonassert/JSONCompareTest.java
// Path: src/main/java/org/skyscreamer/jsonassert/JSONCompare.java // public static JSONCompareResult compareJSON(String expectedStr, String actualStr, JSONComparator comparator) // throws JSONException { // Object expected = JSONParser.parseJSON(expectedStr); // Object actual = JSONParser.parseJSON(act...
import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.skyscreamer.jsonassert.JSONCompare.compareJSON; import static org.skyscreamer.jsonassert.JSONCompareMode.LENIENT; import s...
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed u...
// Path: src/main/java/org/skyscreamer/jsonassert/JSONCompare.java // public static JSONCompareResult compareJSON(String expectedStr, String actualStr, JSONComparator comparator) // throws JSONException { // Object expected = JSONParser.parseJSON(expectedStr); // Object actual = JSONParser.parseJSON(act...
assertTrue(compareJSON("[]", "[]", LENIENT).passed());
skyscreamer/JSONassert
src/test/java/org/skyscreamer/jsonassert/JSONAssertTest.java
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java // public class CustomComparator extends DefaultComparator { // // private final Collection<Customization> customizations; // // public CustomComparator(JSONCompareMode mode, Customization... customizations) { // super...
import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.skyscreamer.jsonassert.JSONCompareMode.LENIENT; import static org.skyscreamer.jsonassert.JSONCompareMode.NON_EXTENSIBLE; import static org.skyscreamer.jsonassert.JSONCompareMode.STRICT; import static org.skyscreamer.jsonas...
expected = new JSONObject(); actual = new JSONObject(); expected.put("id", Integer.valueOf(12345)); actual.put("id", Double.valueOf(12346)); performAssertEqualsTestForMessageVerification(expected, actual, STRICT); } @Test public void testAssertEqualsJSON...
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java // public class CustomComparator extends DefaultComparator { // // private final Collection<Customization> customizations; // // public CustomComparator(JSONCompareMode mode, Customization... customizations) { // super...
new CustomComparator(
skyscreamer/JSONassert
src/test/java/org/skyscreamer/jsonassert/JSONAssertTest.java
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java // public class CustomComparator extends DefaultComparator { // // private final Collection<Customization> customizations; // // public CustomComparator(JSONCompareMode mode, Customization... customizations) { // super...
import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.skyscreamer.jsonassert.JSONCompareMode.LENIENT; import static org.skyscreamer.jsonassert.JSONCompareMode.NON_EXTENSIBLE; import static org.skyscreamer.jsonassert.JSONCompareMode.STRICT; import static org.skyscreamer.jsonas...
new Customization("entry.id", new RegularExpressionValueMatcher<Object>("\\d")) )); } private void testPass(String expected, String actual, JSONCompareMode compareMode) throws JSONException { String message = expected + " == " + actual + " ("...
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java // public class CustomComparator extends DefaultComparator { // // private final Collection<Customization> customizations; // // public CustomComparator(JSONCompareMode mode, Customization... customizations) { // super...
if(expected instanceof String && actual instanceof String && strictMode instanceof JSONComparator) {
skyscreamer/JSONassert
src/test/java/org/skyscreamer/jsonassert/JSONCustomComparatorTest.java
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java // public class CustomComparator extends DefaultComparator { // // private final Collection<Customization> customizations; // // public CustomComparator(JSONCompareMode mode, Customization... customizations) { // super...
import org.json.JSONException; import org.junit.Test; import org.skyscreamer.jsonassert.comparator.CustomComparator; import org.skyscreamer.jsonassert.comparator.JSONComparator; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.skyscreamer.jsonassert.JSONCompare.c...
" \"bar\": {\n" + " \"baz\": \"actual\"\n" + " }\n" + " }\n" + " }\n" + "}"; String rootDeepWildcardExpected = "{\n" + " \"baz\": \"expected\",\n" + " \"root\": {\n" + " \"baz\": \"e...
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java // public class CustomComparator extends DefaultComparator { // // private final Collection<Customization> customizations; // // public CustomComparator(JSONCompareMode mode, Customization... customizations) { // super...
JSONComparator jsonCmp = new CustomComparator(JSONCompareMode.STRICT, new Customization("first", comparator));
skyscreamer/JSONassert
src/test/java/org/skyscreamer/jsonassert/JSONCustomComparatorTest.java
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java // public class CustomComparator extends DefaultComparator { // // private final Collection<Customization> customizations; // // public CustomComparator(JSONCompareMode mode, Customization... customizations) { // super...
import org.json.JSONException; import org.junit.Test; import org.skyscreamer.jsonassert.comparator.CustomComparator; import org.skyscreamer.jsonassert.comparator.JSONComparator; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.skyscreamer.jsonassert.JSONCompare.c...
" \"bar\": {\n" + " \"baz\": \"actual\"\n" + " }\n" + " }\n" + " }\n" + "}"; String rootDeepWildcardExpected = "{\n" + " \"baz\": \"expected\",\n" + " \"root\": {\n" + " \"baz\": \"e...
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java // public class CustomComparator extends DefaultComparator { // // private final Collection<Customization> customizations; // // public CustomComparator(JSONCompareMode mode, Customization... customizations) { // super...
JSONComparator jsonCmp = new CustomComparator(JSONCompareMode.STRICT, new Customization("first", comparator));
skyscreamer/JSONassert
src/test/java/org/skyscreamer/jsonassert/JSONCustomComparatorTest.java
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java // public class CustomComparator extends DefaultComparator { // // private final Collection<Customization> customizations; // // public CustomComparator(JSONCompareMode mode, Customization... customizations) { // super...
import org.json.JSONException; import org.junit.Test; import org.skyscreamer.jsonassert.comparator.CustomComparator; import org.skyscreamer.jsonassert.comparator.JSONComparator; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.skyscreamer.jsonassert.JSONCompare.c...
" \"baz\": \"actual\"\n" + " }\n" + " }\n" + " }\n" + "}"; String rootDeepWildcardExpected = "{\n" + " \"baz\": \"expected\",\n" + " \"root\": {\n" + " \"baz\": \"expected\",\n" + " \"...
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java // public class CustomComparator extends DefaultComparator { // // private final Collection<Customization> customizations; // // public CustomComparator(JSONCompareMode mode, Customization... customizations) { // super...
JSONCompareResult result = compareJSON(expected, actual, jsonCmp);
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONAssert.java
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/JSONComparator.java // public interface JSONComparator { // // /** // * Compares two {@link JSONObject}s and returns the result of the comparison in a {@link JSONCompareResult} object. // * // * @param expected the expected JSON object // ...
import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.skyscreamer.jsonassert.comparator.JSONComparator;
assertNotEquals("", expectedStr, actualStr, compareMode); } /** * Asserts that the JSONArray provided does not match the expected string. If it is it throws an * {@link AssertionError}. * * @param message Error message to be displayed in case of assertion failure * @param...
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/JSONComparator.java // public interface JSONComparator { // // /** // * Compares two {@link JSONObject}s and returns the result of the comparison in a {@link JSONCompareResult} object. // * // * @param expected the expected JSON object // ...
public static void assertEquals(String expectedStr, String actualStr, JSONComparator comparator)
stalk-io/stalk-server
src/main/java/io/stalk/common/server/RedisNodeManager.java
// Path: src/main/java/io/stalk/common/server/ServerNodeManager.java // interface SERVER { // // String NODE = "server:node"; // String NODE_BY_CHANNEL = "server:nodeByChannel"; // String OK = "server:Ok"; // // } // // Path: src/main/java/io/stalk/common/server/map/NodeMap.java // public interface NodeM...
import io.stalk.common.server.ServerNodeManager.SERVER; import io.stalk.common.server.map.NodeMap; import io.stalk.common.server.map.NodeRegistry; import io.stalk.common.server.node.RedisPoolNode; import org.vertx.java.core.eventbus.Message; import org.vertx.java.core.json.JsonArray; import org.vertx.java.core.json.Jso...
package io.stalk.common.server; public class RedisNodeManager extends AbstractNodeManager<RedisPoolNode> { private boolean isOk = false; public RedisNodeManager() { super(); } public RedisNodeManager(Logger logger) { super(); if (logger != null) activeLogger(logger); } ...
// Path: src/main/java/io/stalk/common/server/ServerNodeManager.java // interface SERVER { // // String NODE = "server:node"; // String NODE_BY_CHANNEL = "server:nodeByChannel"; // String OK = "server:Ok"; // // } // // Path: src/main/java/io/stalk/common/server/map/NodeMap.java // public interface NodeM...
protected NodeMap<RedisPoolNode> initNodeMap() {
stalk-io/stalk-server
src/main/java/io/stalk/common/server/RedisNodeManager.java
// Path: src/main/java/io/stalk/common/server/ServerNodeManager.java // interface SERVER { // // String NODE = "server:node"; // String NODE_BY_CHANNEL = "server:nodeByChannel"; // String OK = "server:Ok"; // // } // // Path: src/main/java/io/stalk/common/server/map/NodeMap.java // public interface NodeM...
import io.stalk.common.server.ServerNodeManager.SERVER; import io.stalk.common.server.map.NodeMap; import io.stalk.common.server.map.NodeRegistry; import io.stalk.common.server.node.RedisPoolNode; import org.vertx.java.core.eventbus.Message; import org.vertx.java.core.json.JsonArray; import org.vertx.java.core.json.Jso...
package io.stalk.common.server; public class RedisNodeManager extends AbstractNodeManager<RedisPoolNode> { private boolean isOk = false; public RedisNodeManager() { super(); } public RedisNodeManager(Logger logger) { super(); if (logger != null) activeLogger(logger); } ...
// Path: src/main/java/io/stalk/common/server/ServerNodeManager.java // interface SERVER { // // String NODE = "server:node"; // String NODE_BY_CHANNEL = "server:nodeByChannel"; // String OK = "server:Ok"; // // } // // Path: src/main/java/io/stalk/common/server/map/NodeMap.java // public interface NodeM...
return new NodeRegistry<RedisPoolNode>();
stalk-io/stalk-server
src/main/java/io/stalk/common/server/RedisNodeManager.java
// Path: src/main/java/io/stalk/common/server/ServerNodeManager.java // interface SERVER { // // String NODE = "server:node"; // String NODE_BY_CHANNEL = "server:nodeByChannel"; // String OK = "server:Ok"; // // } // // Path: src/main/java/io/stalk/common/server/map/NodeMap.java // public interface NodeM...
import io.stalk.common.server.ServerNodeManager.SERVER; import io.stalk.common.server.map.NodeMap; import io.stalk.common.server.map.NodeRegistry; import io.stalk.common.server.node.RedisPoolNode; import org.vertx.java.core.eventbus.Message; import org.vertx.java.core.json.JsonArray; import org.vertx.java.core.json.Jso...
} } DEBUG("refreshNode - size : %d ", nodes.getKeys().size()); if (nodes.getKeys().size() > 0) { isOk = true; } else { isOk = false; } } @Override public void messageHandle(Message<JsonObject> message) { String action =...
// Path: src/main/java/io/stalk/common/server/ServerNodeManager.java // interface SERVER { // // String NODE = "server:node"; // String NODE_BY_CHANNEL = "server:nodeByChannel"; // String OK = "server:Ok"; // // } // // Path: src/main/java/io/stalk/common/server/map/NodeMap.java // public interface NodeM...
case SERVER.OK:
stalk-io/stalk-server
src/main/java/io/stalk/common/oauth/utils/OpenIdConsumer.java
// Path: src/main/java/io/stalk/common/oauth/Profile.java // public class Profile { // // private String name; // private String link; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // ...
import io.stalk.common.oauth.Profile; import java.util.HashMap; import java.util.Map;
* @param scope * @return Generated Request Token URL * @throws Exception */ public static String getRequestTokenURL(final String requestTokenUrl, final String returnTo, final String realm, final String ...
// Path: src/main/java/io/stalk/common/oauth/Profile.java // public class Profile { // // private String name; // private String link; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // ...
public static Profile getUserInfo(final Map<String, String> requestParams) {
stalk-io/stalk-server
src/main/java/io/stalk/common/server/ServerNodeManager.java
// Path: src/main/java/io/stalk/common/server/map/ConsistentHash.java // public class ConsistentHash<T> implements NodeMap<T> { // // public static final int NUMBER_OF_REPLICAS = 100; // // private final HashMap<String, Long[]> keyMap = new HashMap<String, Long[]>(); // // private final HashFunction hash...
import io.stalk.common.server.map.ConsistentHash; import io.stalk.common.server.map.NodeMap; import io.stalk.common.server.node.ServerNode; import org.vertx.java.core.eventbus.Message; import org.vertx.java.core.json.JsonArray; import org.vertx.java.core.json.JsonObject; import org.vertx.java.core.logging.Logger; impor...
package io.stalk.common.server; public class ServerNodeManager extends AbstractNodeManager<ServerNode> { interface SERVER { String NODE = "server:node"; String NODE_BY_CHANNEL = "server:nodeByChannel"; String OK = "server:Ok"; } private boolean isOk = false; private HashMa...
// Path: src/main/java/io/stalk/common/server/map/ConsistentHash.java // public class ConsistentHash<T> implements NodeMap<T> { // // public static final int NUMBER_OF_REPLICAS = 100; // // private final HashMap<String, Long[]> keyMap = new HashMap<String, Long[]>(); // // private final HashFunction hash...
protected NodeMap<ServerNode> initNodeMap() {
stalk-io/stalk-server
src/main/java/io/stalk/common/server/ServerNodeManager.java
// Path: src/main/java/io/stalk/common/server/map/ConsistentHash.java // public class ConsistentHash<T> implements NodeMap<T> { // // public static final int NUMBER_OF_REPLICAS = 100; // // private final HashMap<String, Long[]> keyMap = new HashMap<String, Long[]>(); // // private final HashFunction hash...
import io.stalk.common.server.map.ConsistentHash; import io.stalk.common.server.map.NodeMap; import io.stalk.common.server.node.ServerNode; import org.vertx.java.core.eventbus.Message; import org.vertx.java.core.json.JsonArray; import org.vertx.java.core.json.JsonObject; import org.vertx.java.core.logging.Logger; impor...
package io.stalk.common.server; public class ServerNodeManager extends AbstractNodeManager<ServerNode> { interface SERVER { String NODE = "server:node"; String NODE_BY_CHANNEL = "server:nodeByChannel"; String OK = "server:Ok"; } private boolean isOk = false; private HashMa...
// Path: src/main/java/io/stalk/common/server/map/ConsistentHash.java // public class ConsistentHash<T> implements NodeMap<T> { // // public static final int NUMBER_OF_REPLICAS = 100; // // private final HashMap<String, Long[]> keyMap = new HashMap<String, Long[]>(); // // private final HashFunction hash...
return new ConsistentHash<ServerNode>();
stalk-io/stalk-server
src/main/java/io/stalk/common/oauth/strategy/Hybrid.java
// Path: src/main/java/io/stalk/common/oauth/OAuthConfig.java // public class OAuthConfig { // // private final String _consumerKey; // private final String _consumerSecret; // private final String _callbackUrl; // private final String _signatureMethod; // private final String _transportName;...
import io.stalk.common.oauth.OAuthConfig; import io.stalk.common.oauth.exception.SocialAuthConfigurationException; import io.stalk.common.oauth.exception.SocialAuthException; import io.stalk.common.oauth.utils.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Map;
package io.stalk.common.oauth.strategy; public class Hybrid implements OAuthStrategyBase { private Map<String, String> endpoints; private String scope; private String providerId; private OAuthConsumer oauth; private String successUrl;
// Path: src/main/java/io/stalk/common/oauth/OAuthConfig.java // public class OAuthConfig { // // private final String _consumerKey; // private final String _consumerSecret; // private final String _callbackUrl; // private final String _signatureMethod; // private final String _transportName;...
public Hybrid(final OAuthConfig config, final Map<String, String> endpoints) {
stalk-io/stalk-server
src/main/java/io/stalk/common/oauth/strategy/OAuth1.java
// Path: src/main/java/io/stalk/common/oauth/OAuthConfig.java // public class OAuthConfig { // // private final String _consumerKey; // private final String _consumerSecret; // private final String _callbackUrl; // private final String _signatureMethod; // private final String _transportName;...
import io.stalk.common.oauth.OAuthConfig; import io.stalk.common.oauth.exception.SocialAuthException; import io.stalk.common.oauth.utils.*; import java.util.Map;
package io.stalk.common.oauth.strategy; public class OAuth1 implements OAuthStrategyBase { private OAuthConsumer oauth; private Map<String, String> endpoints; private String scope; private String providerId; private String successUrl;
// Path: src/main/java/io/stalk/common/oauth/OAuthConfig.java // public class OAuthConfig { // // private final String _consumerKey; // private final String _consumerSecret; // private final String _callbackUrl; // private final String _signatureMethod; // private final String _transportName;...
public OAuth1(final OAuthConfig config, final Map<String, String> endpoints) {
stalk-io/stalk-server
src/main/java/io/stalk/common/oauth/strategy/OAuth1.java
// Path: src/main/java/io/stalk/common/oauth/OAuthConfig.java // public class OAuthConfig { // // private final String _consumerKey; // private final String _consumerSecret; // private final String _callbackUrl; // private final String _signatureMethod; // private final String _transportName;...
import io.stalk.common.oauth.OAuthConfig; import io.stalk.common.oauth.exception.SocialAuthException; import io.stalk.common.oauth.utils.*; import java.util.Map;
this.providerId = config.getId(); this.successUrl = config.get_callbackUrl(); } @Override public RequestToken getLoginRedirectURL() throws Exception { AccessGrant requestToken = oauth.getRequestToken( endpoints.get(Constants.OAUTH_REQUEST_TOKEN_URL), successUr...
// Path: src/main/java/io/stalk/common/oauth/OAuthConfig.java // public class OAuthConfig { // // private final String _consumerKey; // private final String _consumerSecret; // private final String _callbackUrl; // private final String _signatureMethod; // private final String _transportName;...
throw new SocialAuthException("Request token is null");
stalk-io/stalk-server
src/main/java/io/stalk/server/MonitorServer.java
// Path: src/main/java/io/stalk/server/verticle/SampleVerticle.java // public class SampleVerticle extends AbstractVerticle{ // @Override // void start(JsonObject appConfig) { // System.out.println("ABCDE --------------------------------") ; // } // // @Override // public void handle(Messag...
import io.stalk.server.verticle.SampleVerticle; import org.vertx.java.core.Handler; import org.vertx.java.core.buffer.Buffer; import org.vertx.java.core.eventbus.EventBus; import org.vertx.java.core.http.HttpClient; import org.vertx.java.core.http.HttpClientResponse; import org.vertx.java.core.http.HttpServer; import o...
package io.stalk.server; /** * Simple sample Verticle Application for dev. */ public class MonitorServer extends Server{ private HttpClient client; private EventBus eb; private Logger logger; @Override void start(JsonObject appConfig, HttpServer server) {
// Path: src/main/java/io/stalk/server/verticle/SampleVerticle.java // public class SampleVerticle extends AbstractVerticle{ // @Override // void start(JsonObject appConfig) { // System.out.println("ABCDE --------------------------------") ; // } // // @Override // public void handle(Messag...
container.deployWorkerVerticle(SampleVerticle.class.getName(),new JsonObject(),1,false);
stalk-io/stalk-server
src/main/java/io/stalk/common/oauth/provider/AuthProvider.java
// Path: src/main/java/io/stalk/common/oauth/Profile.java // public class Profile { // // private String name; // private String link; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // ...
import io.stalk.common.oauth.Profile; import io.stalk.common.oauth.strategy.RequestToken; import io.stalk.common.oauth.utils.AccessGrant; import java.util.Map;
package io.stalk.common.oauth.provider; public interface AuthProvider { String EXT_NAMESPACE = "http://specs.openid.net/extensions/oauth/1.0"; String EMAIL = "email"; String COUNTRY = "country"; String LANGUAGE = "language"; String FULL_NAME = "fullname"; String NICK_NAME = "nic...
// Path: src/main/java/io/stalk/common/oauth/Profile.java // public class Profile { // // private String name; // private String link; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // ...
public RequestToken getLoginRedirectURL() throws Exception;
stalk-io/stalk-server
src/main/java/io/stalk/common/oauth/provider/AuthProvider.java
// Path: src/main/java/io/stalk/common/oauth/Profile.java // public class Profile { // // private String name; // private String link; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // ...
import io.stalk.common.oauth.Profile; import io.stalk.common.oauth.strategy.RequestToken; import io.stalk.common.oauth.utils.AccessGrant; import java.util.Map;
package io.stalk.common.oauth.provider; public interface AuthProvider { String EXT_NAMESPACE = "http://specs.openid.net/extensions/oauth/1.0"; String EMAIL = "email"; String COUNTRY = "country"; String LANGUAGE = "language"; String FULL_NAME = "fullname"; String NICK_NAME = "nic...
// Path: src/main/java/io/stalk/common/oauth/Profile.java // public class Profile { // // private String name; // private String link; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // ...
public Profile connect(AccessGrant requestToken, Map<String, String> requestParams) throws Exception;
stalk-io/stalk-server
src/main/java/io/stalk/common/oauth/provider/AuthProvider.java
// Path: src/main/java/io/stalk/common/oauth/Profile.java // public class Profile { // // private String name; // private String link; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // ...
import io.stalk.common.oauth.Profile; import io.stalk.common.oauth.strategy.RequestToken; import io.stalk.common.oauth.utils.AccessGrant; import java.util.Map;
package io.stalk.common.oauth.provider; public interface AuthProvider { String EXT_NAMESPACE = "http://specs.openid.net/extensions/oauth/1.0"; String EMAIL = "email"; String COUNTRY = "country"; String LANGUAGE = "language"; String FULL_NAME = "fullname"; String NICK_NAME = "nic...
// Path: src/main/java/io/stalk/common/oauth/Profile.java // public class Profile { // // private String name; // private String link; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // ...
public Profile connect(AccessGrant requestToken, Map<String, String> requestParams) throws Exception;
stalk-io/stalk-server
src/main/java/io/stalk/server/verticle/SubscribeManager.java
// Path: src/main/java/io/stalk/server/MessageServer.java // public class MessageServer extends Server{ // // private EventBus eb; // private ConcurrentMap<String, String> sessionStore; // private String channel; // // @Override // void start(final JsonObject appConfig, HttpServer server) { // //...
import io.stalk.server.MessageServer; import org.vertx.java.core.eventbus.Message; import org.vertx.java.core.json.JsonObject;
package io.stalk.server.verticle; public class SubscribeManager extends AbstractVerticle{ @Override void start(JsonObject appConfig) { JsonObject redisConf = appConfig.getObject("redis-address"); new Thread( new SubscribeThread( vertx.eventBus(), ...
// Path: src/main/java/io/stalk/server/MessageServer.java // public class MessageServer extends Server{ // // private EventBus eb; // private ConcurrentMap<String, String> sessionStore; // private String channel; // // @Override // void start(final JsonObject appConfig, HttpServer server) { // //...
MessageServer.class.getName()
stalk-io/stalk-server
src/main/java/io/stalk/common/oauth/utils/HttpUtil.java
// Path: src/main/java/io/stalk/common/oauth/exception/SocialAuthException.java // public class SocialAuthException extends Exception { // // /** // * // */ // private static final long serialVersionUID = -6856436294292027306L; // // public SocialAuthException() { // super(); //...
import io.stalk.common.oauth.exception.SocialAuthException; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.uti...
package io.stalk.common.oauth.utils; public class HttpUtil { private static int timeoutValue = 0; public static void setConnectionTimeout(final int timeout) { timeoutValue = timeout; } public static String encodeURIComponent(final String value) throws Exception { if (va...
// Path: src/main/java/io/stalk/common/oauth/exception/SocialAuthException.java // public class SocialAuthException extends Exception { // // /** // * // */ // private static final long serialVersionUID = -6856436294292027306L; // // public SocialAuthException() { // super(); //...
throw new SocialAuthException(wow.getMessage(), wow);
stalk-io/stalk-server
src/main/java/io/stalk/common/oauth/strategy/RequestToken.java
// Path: src/main/java/io/stalk/common/oauth/utils/AccessGrant.java // public class AccessGrant implements Serializable { // // private static final long serialVersionUID = -7120362372191191930L; // private String key; // private String secret; // private String providerId; // private Map<Str...
import io.stalk.common.oauth.utils.AccessGrant;
package io.stalk.common.oauth.strategy; public class RequestToken { private String url;
// Path: src/main/java/io/stalk/common/oauth/utils/AccessGrant.java // public class AccessGrant implements Serializable { // // private static final long serialVersionUID = -7120362372191191930L; // private String key; // private String secret; // private String providerId; // private Map<Str...
private AccessGrant accessGrant;
stalk-io/stalk-server
src/main/java/io/stalk/common/oauth/strategy/OAuth2.java
// Path: src/main/java/io/stalk/common/oauth/OAuthConfig.java // public class OAuthConfig { // // private final String _consumerKey; // private final String _consumerSecret; // private final String _callbackUrl; // private final String _signatureMethod; // private final String _transportName;...
import io.stalk.common.oauth.OAuthConfig; import io.stalk.common.oauth.exception.SocialAuthException; import io.stalk.common.oauth.utils.*; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java....
package io.stalk.common.oauth.strategy; public class OAuth2 implements OAuthStrategyBase { private OAuthConsumer oauth; private Map<String, String> endpoints; private String scope; private String providerId; private String successUrl; private String accessTokenParameterName;
// Path: src/main/java/io/stalk/common/oauth/OAuthConfig.java // public class OAuthConfig { // // private final String _consumerKey; // private final String _consumerSecret; // private final String _callbackUrl; // private final String _signatureMethod; // private final String _transportName;...
public OAuth2(final OAuthConfig config, final Map<String, String> endpoints) {
stalk-io/stalk-server
src/main/java/io/stalk/common/oauth/strategy/OAuth2.java
// Path: src/main/java/io/stalk/common/oauth/OAuthConfig.java // public class OAuthConfig { // // private final String _consumerKey; // private final String _consumerSecret; // private final String _callbackUrl; // private final String _signatureMethod; // private final String _transportName;...
import io.stalk.common.oauth.OAuthConfig; import io.stalk.common.oauth.exception.SocialAuthException; import io.stalk.common.oauth.utils.*; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java....
sb.append("&display=popup"); sb.append("&redirect_uri=").append(this.successUrl); if (scope != null) { sb.append("&scope=").append(scope); } String url = sb.toString(); System.out.println("Redirection to following URL should happen : " + url); ...
// Path: src/main/java/io/stalk/common/oauth/OAuthConfig.java // public class OAuthConfig { // // private final String _consumerKey; // private final String _consumerSecret; // private final String _callbackUrl; // private final String _signatureMethod; // private final String _transportName;...
throw new SocialAuthException("Verification code is null");
biointec/halvade
halvade_upload_tool/src/be/ugent/intec/halvade/uploader/input/BaseFileReader.java
// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java // public class Logger { // /* // * levels of debugging // * 0: INFO // * 1: DEBUG // * 2: EXCEPTION // * 3:ALL // */ // private static int LEVEL = 0; // private static final int EXCEPTION = 2; // ...
import be.ugent.intec.halvade.uploader.Logger; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.zip.GZIPInputStream; import org.apache...
return new BufferedReader(new InputStreamReader(hdfsIn)); } else { if(file.endsWith(".gz")) { GZIPInputStream gzip = new GZIPInputStream(new FileInputStream(file), BUFFERSIZE); return new BufferedReader(new InputStreamReader(gzip)); ...
// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java // public class Logger { // /* // * levels of debugging // * 0: INFO // * 1: DEBUG // * 2: EXCEPTION // * 3:ALL // */ // private static int LEVEL = 0; // private static final int EXCEPTION = 2; // ...
Logger.INFO("error occured: " + ex.getMessage());
biointec/halvade
halvade/src/be/ugent/intec/halvade/tools/BWAMemInstance.java
// Path: halvade/src/be/ugent/intec/halvade/hadoop/mapreduce/HalvadeCounters.java // public enum HalvadeCounters { // TIME_BWA_ALN, // TIME_BWA_MEM, // TIME_BOWTIE2, // TIME_CUSHAW2, // TIME_BWA_SAMPE, // TIME_STAR, // TIME_STAR_REF, // TIME_STAR_BUILD, // TIME_ELPREP, // TIME_BE...
import be.ugent.intec.halvade.hadoop.mapreduce.HalvadeCounters; import java.io.IOException; import java.io.InputStream; import org.apache.hadoop.mapreduce.Mapper; import be.ugent.intec.halvade.utils.*; import java.net.URISyntaxException; import org.apache.hadoop.mapreduce.Mapper.Context;
pbw.startProcess(null, System.err); // check if alive. if(!pbw.isAlive()) throw new ProcessException("BWA mem", pbw.getExitState()); pbw.getSTDINWriter(); // make a SAMstream handler ssh = new SAMStreamHandler(instance, context, false); ssh.start(); ...
// Path: halvade/src/be/ugent/intec/halvade/hadoop/mapreduce/HalvadeCounters.java // public enum HalvadeCounters { // TIME_BWA_ALN, // TIME_BWA_MEM, // TIME_BOWTIE2, // TIME_CUSHAW2, // TIME_BWA_SAMPE, // TIME_STAR, // TIME_STAR_REF, // TIME_STAR_BUILD, // TIME_ELPREP, // TIME_BE...
context.getCounter(HalvadeCounters.TIME_BWA_MEM).increment(pbw.getExecutionTime());
biointec/halvade
halvade/src/be/ugent/intec/halvade/utils/HalvadeFileUtils.java
// Path: halvade/src/be/ugent/intec/halvade/hadoop/mapreduce/HalvadeCounters.java // public enum HalvadeCounters { // TIME_BWA_ALN, // TIME_BWA_MEM, // TIME_BOWTIE2, // TIME_CUSHAW2, // TIME_BWA_SAMPE, // TIME_STAR, // TIME_STAR_REF, // TIME_STAR_BUILD, // TIME_ELPREP, // TIME_BE...
import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapreduce.TaskInputOutputContext; import be.ugent.intec.halvade.hadoop.mapreduce.HalvadeCounters; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URI;...
// attempt to download .idx file if(fs.exists(new Path(hdfssite + ".idx"))) downloadFileWithLock(fs, lock, hdfssite + ".idx", refDir + name + ".idx", context.getConfiguration()); } } catch (InterruptedException ex) { Logger...
// Path: halvade/src/be/ugent/intec/halvade/hadoop/mapreduce/HalvadeCounters.java // public enum HalvadeCounters { // TIME_BWA_ALN, // TIME_BWA_MEM, // TIME_BOWTIE2, // TIME_CUSHAW2, // TIME_BWA_SAMPE, // TIME_STAR, // TIME_STAR_REF, // TIME_STAR_BUILD, // TIME_ELPREP, // TIME_BE...
public static boolean removeLocalFile(String filename, TaskInputOutputContext context, HalvadeCounters counter) {
biointec/halvade
halvade/src/be/ugent/intec/halvade/hadoop/partitioners/GenomeSJSortComparator.java
// Path: halvade/src/be/ugent/intec/halvade/hadoop/datatypes/GenomeSJ.java // public class GenomeSJ implements WritableComparable<GenomeSJ> { // protected int type; // -2 = overhang length, -1 = sj string, 2 = count per key region // protected int secondary_key; // // public void setOverhang(int overhang)...
import be.ugent.intec.halvade.hadoop.datatypes.GenomeSJ; import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.WritableComparator;
/* * Copyright (C) 2014 ddecap * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed...
// Path: halvade/src/be/ugent/intec/halvade/hadoop/datatypes/GenomeSJ.java // public class GenomeSJ implements WritableComparable<GenomeSJ> { // protected int type; // -2 = overhang length, -1 = sj string, 2 = count per key region // protected int secondary_key; // // public void setOverhang(int overhang)...
super(GenomeSJ.class, true);
biointec/halvade
halvade_upload_tool/src/be/ugent/intec/halvade/uploader/input/FileReaderFactory.java
// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java // public class Logger { // /* // * levels of debugging // * 0: INFO // * 1: DEBUG // * 2: EXCEPTION // * 3:ALL // */ // private static int LEVEL = 0; // private static final int EXCEPTION = 2; // ...
import be.ugent.intec.halvade.uploader.Logger; import java.io.IOException; import java.util.ArrayList; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.TimeUnit;
} return allReaders; } public static BaseFileReader createFileReader(boolean fromHDFS, String fileA, String fileB, boolean interleaved) throws IOException { if (fileB == null) { return new SingleFastQReader(fromHDFS, fileA, interleaved); } else { retu...
// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java // public class Logger { // /* // * levels of debugging // * 0: INFO // * 1: DEBUG // * 2: EXCEPTION // * 3:ALL // */ // private static int LEVEL = 0; // private static final int EXCEPTION = 2; // ...
Logger.EXCEPTION(ex);
biointec/halvade
halvade/src/be/ugent/intec/halvade/hadoop/partitioners/GenomeSJGroupingComparator.java
// Path: halvade/src/be/ugent/intec/halvade/hadoop/datatypes/GenomeSJ.java // public class GenomeSJ implements WritableComparable<GenomeSJ> { // protected int type; // -2 = overhang length, -1 = sj string, 2 = count per key region // protected int secondary_key; // // public void setOverhang(int overhang)...
import be.ugent.intec.halvade.hadoop.datatypes.GenomeSJ; import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.WritableComparator;
/* * Copyright (C) 2014 ddecap * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed...
// Path: halvade/src/be/ugent/intec/halvade/hadoop/datatypes/GenomeSJ.java // public class GenomeSJ implements WritableComparable<GenomeSJ> { // protected int type; // -2 = overhang length, -1 = sj string, 2 = count per key region // protected int secondary_key; // // public void setOverhang(int overhang)...
super(GenomeSJ.class, true);
biointec/halvade
halvade_upload_tool/src/be/ugent/intec/halvade/uploader/input/SingleFastQReader.java
// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java // public class Logger { // /* // * levels of debugging // * 0: INFO // * 1: DEBUG // * 2: EXCEPTION // * 3:ALL // */ // private static int LEVEL = 0; // private static final int EXCEPTION = 2; // ...
import be.ugent.intec.halvade.uploader.Logger; import static be.ugent.intec.halvade.uploader.input.BaseFileReader.getReader; import java.io.BufferedReader; import java.io.IOException;
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package be.ugent.intec.halvade.uploader.input; /** * * @author ddecap */ public class SingleFastQReader extends BaseFileReader { ...
// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java // public class Logger { // /* // * levels of debugging // * 0: INFO // * 1: DEBUG // * 2: EXCEPTION // * 3:ALL // */ // private static int LEVEL = 0; // private static final int EXCEPTION = 2; // ...
readerA = getReader(fromHDFS, fileA);
biointec/halvade
halvade_upload_tool/src/be/ugent/intec/halvade/uploader/input/SingleFastQReader.java
// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java // public class Logger { // /* // * levels of debugging // * 0: INFO // * 1: DEBUG // * 2: EXCEPTION // * 3:ALL // */ // private static int LEVEL = 0; // private static final int EXCEPTION = 2; // ...
import be.ugent.intec.halvade.uploader.Logger; import static be.ugent.intec.halvade.uploader.input.BaseFileReader.getReader; import java.io.BufferedReader; import java.io.IOException;
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package be.ugent.intec.halvade.uploader.input; /** * * @author ddecap */ public class SingleFastQReader extends BaseFileReader { ...
// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java // public class Logger { // /* // * levels of debugging // * 0: INFO // * 1: DEBUG // * 2: EXCEPTION // * 3:ALL // */ // private static int LEVEL = 0; // private static final int EXCEPTION = 2; // ...
Logger.DEBUG("Single: " + toStr + (isInterleaved ? " interleaved" : ""));
biointec/halvade
halvade_upload_tool/src/be/ugent/intec/halvade/uploader/input/PairedFastQReader.java
// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java // public class Logger { // /* // * levels of debugging // * 0: INFO // * 1: DEBUG // * 2: EXCEPTION // * 3:ALL // */ // private static int LEVEL = 0; // private static final int EXCEPTION = 2; // ...
import be.ugent.intec.halvade.uploader.Logger; import java.io.BufferedReader; import java.io.IOException;
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package be.ugent.intec.halvade.uploader.input; /** * * @author ddecap */ public class PairedFastQReader extends BaseFileReader { ...
// Path: halvade_upload_tool/src/be/ugent/intec/halvade/uploader/Logger.java // public class Logger { // /* // * levels of debugging // * 0: INFO // * 1: DEBUG // * 2: EXCEPTION // * 3:ALL // */ // private static int LEVEL = 0; // private static final int EXCEPTION = 2; // ...
Logger.DEBUG("Paired: " + toStr);
biointec/halvade
halvade/src/be/ugent/intec/halvade/hadoop/mapreduce/BWAMemMapper.java
// Path: halvade/src/be/ugent/intec/halvade/tools/BWAMemInstance.java // public class BWAMemInstance extends AlignerInstance { // // private static BWAMemInstance instance; // private ProcessBuilderWrapper pbw; // private SAMStreamHandler ssh; // private String taskId; // /** // * // ...
import be.ugent.intec.halvade.hadoop.datatypes.ChromosomeRegion; import java.io.IOException; import org.apache.hadoop.io.Text; import be.ugent.intec.halvade.tools.BWAMemInstance; import be.ugent.intec.halvade.utils.Logger; import org.seqdoop.hadoop_bam.SAMRecordWritable; import java.net.URISyntaxException; import org.a...
/* * Copyright (C) 2014 ddecap * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed...
// Path: halvade/src/be/ugent/intec/halvade/tools/BWAMemInstance.java // public class BWAMemInstance extends AlignerInstance { // // private static BWAMemInstance instance; // private ProcessBuilderWrapper pbw; // private SAMStreamHandler ssh; // private String taskId; // /** // * // ...
((BWAMemInstance)instance).feedLine(value.toString());
danisola/restify
url/src/main/java/com/danisola/restify/url/ParsedUrl.java
// Path: url/src/main/java/com/danisola/restify/url/preconditions/Preconditions.java // public static void checkState(boolean expression, String errorMessageFormat, Object ... args) { // if (!expression) { // throw new IllegalStateException(String.format(errorMessageFormat, args)); // } // }
import java.util.ArrayList; import java.util.Collections; import java.util.List; import static com.danisola.restify.url.preconditions.Preconditions.checkState;
List<NameValuePair> getParameters() { return parameters; } static ParsedUrl parseUrl(String url) { String path, queryString; int questionIndex = url.indexOf("?"); if (questionIndex >= 0) { path = url.substring(0, questionIndex); queryString = url.su...
// Path: url/src/main/java/com/danisola/restify/url/preconditions/Preconditions.java // public static void checkState(boolean expression, String errorMessageFormat, Object ... args) { // if (!expression) { // throw new IllegalStateException(String.format(errorMessageFormat, args)); // } // } // Path: ...
checkState(equalsIndex > 0, "Parameters are not well formatted: %s", query);
danisola/restify
servlet/src/test/java/com/danisola/restify/servlet/utils/TestCallback.java
// Path: url/src/main/java/com/danisola/restify/url/RestUrl.java // public class RestUrl { // // final String errorMessage; // final VarType[] types; // final Object[] values; // // static RestUrl invalidRestUrl(String errorMsg) { // return new RestUrl(null, null, errorMsg); // } // // ...
import com.danisola.restify.url.RestUrl;
package com.danisola.restify.servlet.utils; public interface TestCallback { void onMethodCalled(Method method);
// Path: url/src/main/java/com/danisola/restify/url/RestUrl.java // public class RestUrl { // // final String errorMessage; // final VarType[] types; // final Object[] values; // // static RestUrl invalidRestUrl(String errorMsg) { // return new RestUrl(null, null, errorMsg); // } // // ...
void onInvalidUrl(RestUrl url);
danisola/restify
url/src/main/java/com/danisola/restify/url/RestParser.java
// Path: url/src/main/java/com/danisola/restify/url/types/Opt.java // public class Opt<T> implements VarType<T> { // // public static <T> Opt<T> opt(VarType<T> varType) { // return new Opt<>(varType); // } // // private final VarType<T> varType; // // private Opt(VarType<T> varType) { // ...
import com.danisola.restify.url.types.Opt; import com.danisola.restify.url.types.VarType; import java.net.MalformedURLException; import java.net.URL; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import static com.danisola.restify.url.ParsedUrl.parseParams; import static com.dan...
package com.danisola.restify.url; /** * A URL parser that produces {@link ParsedUrl}. It does not throw any exceptions in case the parsed URLs are found to * be incorrect, but the resulting {@link RestUrl} will be invalid. * * <p>Instances of this class are immutable and thus thread-safe.</p> */ public class R...
// Path: url/src/main/java/com/danisola/restify/url/types/Opt.java // public class Opt<T> implements VarType<T> { // // public static <T> Opt<T> opt(VarType<T> varType) { // return new Opt<>(varType); // } // // private final VarType<T> varType; // // private Opt(VarType<T> varType) { // ...
private final VarType[] pathTypes;
danisola/restify
url/src/main/java/com/danisola/restify/url/RestParser.java
// Path: url/src/main/java/com/danisola/restify/url/types/Opt.java // public class Opt<T> implements VarType<T> { // // public static <T> Opt<T> opt(VarType<T> varType) { // return new Opt<>(varType); // } // // private final VarType<T> varType; // // private Opt(VarType<T> varType) { // ...
import com.danisola.restify.url.types.Opt; import com.danisola.restify.url.types.VarType; import java.net.MalformedURLException; import java.net.URL; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import static com.danisola.restify.url.ParsedUrl.parseParams; import static com.dan...
package com.danisola.restify.url; /** * A URL parser that produces {@link ParsedUrl}. It does not throw any exceptions in case the parsed URLs are found to * be incorrect, but the resulting {@link RestUrl} will be invalid. * * <p>Instances of this class are immutable and thus thread-safe.</p> */ public class R...
// Path: url/src/main/java/com/danisola/restify/url/types/Opt.java // public class Opt<T> implements VarType<T> { // // public static <T> Opt<T> opt(VarType<T> varType) { // return new Opt<>(varType); // } // // private final VarType<T> varType; // // private Opt(VarType<T> varType) { // ...
return RestUrl.invalidRestUrl("Url is null");
danisola/restify
url/src/main/java/com/danisola/restify/url/RestParser.java
// Path: url/src/main/java/com/danisola/restify/url/types/Opt.java // public class Opt<T> implements VarType<T> { // // public static <T> Opt<T> opt(VarType<T> varType) { // return new Opt<>(varType); // } // // private final VarType<T> varType; // // private Opt(VarType<T> varType) { // ...
import com.danisola.restify.url.types.Opt; import com.danisola.restify.url.types.VarType; import java.net.MalformedURLException; import java.net.URL; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import static com.danisola.restify.url.ParsedUrl.parseParams; import static com.dan...
try { return parse(new URL(url)); } catch (MalformedURLException e) { return RestUrl.invalidRestUrl("Url is malformed"); } } /** * Parses the given URL. * * @return the {@link RestUrl} that represents the given URL. */ public RestUrl pars...
// Path: url/src/main/java/com/danisola/restify/url/types/Opt.java // public class Opt<T> implements VarType<T> { // // public static <T> Opt<T> opt(VarType<T> varType) { // return new Opt<>(varType); // } // // private final VarType<T> varType; // // private Opt(VarType<T> varType) { // ...
RestUrl restUrl = RestUrl.restUrl(new VarType[numVars], new Object[numVars]);
danisola/restify
url/src/main/java/com/danisola/restify/url/RestParser.java
// Path: url/src/main/java/com/danisola/restify/url/types/Opt.java // public class Opt<T> implements VarType<T> { // // public static <T> Opt<T> opt(VarType<T> varType) { // return new Opt<>(varType); // } // // private final VarType<T> varType; // // private Opt(VarType<T> varType) { // ...
import com.danisola.restify.url.types.Opt; import com.danisola.restify.url.types.VarType; import java.net.MalformedURLException; import java.net.URL; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import static com.danisola.restify.url.ParsedUrl.parseParams; import static com.dan...
} /** * Parses the given path and query. * * @return the {@link RestUrl} that represents the given URL. */ public RestUrl parse(String path, String queryString) { if (path == null) { return RestUrl.invalidRestUrl("Url is null"); } RestUrl restUrl = R...
// Path: url/src/main/java/com/danisola/restify/url/types/Opt.java // public class Opt<T> implements VarType<T> { // // public static <T> Opt<T> opt(VarType<T> varType) { // return new Opt<>(varType); // } // // private final VarType<T> varType; // // private Opt(VarType<T> varType) { // ...
List<NameValuePair> valuePairs = parseParams(queryString);
danisola/restify
url/src/main/java/com/danisola/restify/url/RestParser.java
// Path: url/src/main/java/com/danisola/restify/url/types/Opt.java // public class Opt<T> implements VarType<T> { // // public static <T> Opt<T> opt(VarType<T> varType) { // return new Opt<>(varType); // } // // private final VarType<T> varType; // // private Opt(VarType<T> varType) { // ...
import com.danisola.restify.url.types.Opt; import com.danisola.restify.url.types.VarType; import java.net.MalformedURLException; import java.net.URL; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import static com.danisola.restify.url.ParsedUrl.parseParams; import static com.dan...
} String paramValue = valuePair.getValue(); Matcher paramMatcher = paramVar.getValuePattern().matcher(paramValue); if (!paramMatcher.matches()) { return RestUrl.invalidRestUrl("Parameter '" + paramName + "=" + paramValue + "' does not match pattern"); ...
// Path: url/src/main/java/com/danisola/restify/url/types/Opt.java // public class Opt<T> implements VarType<T> { // // public static <T> Opt<T> opt(VarType<T> varType) { // return new Opt<>(varType); // } // // private final VarType<T> varType; // // private Opt(VarType<T> varType) { // ...
if (!(varType instanceof Opt)) {
danisola/restify
url/src/main/java/com/danisola/restify/url/RestUrl.java
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/preconditions/Preco...
import com.danisola.restify.url.types.VarType; import static com.danisola.restify.url.preconditions.Preconditions.checkArgumentNotNullOrEmpty; import static com.danisola.restify.url.preconditions.Preconditions.checkState;
package com.danisola.restify.url; /** * A REST representation of an URL. Allows to get access to the variables defined in the {@link RestParser} that has * generated it. * * <p>Instances of this class are immutable and thus thread-safe.</p> */ public class RestUrl { final String errorMessage;
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/preconditions/Preco...
final VarType[] types;
danisola/restify
url/src/main/java/com/danisola/restify/url/RestUrl.java
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/preconditions/Preco...
import com.danisola.restify.url.types.VarType; import static com.danisola.restify.url.preconditions.Preconditions.checkArgumentNotNullOrEmpty; import static com.danisola.restify.url.preconditions.Preconditions.checkState;
package com.danisola.restify.url; /** * A REST representation of an URL. Allows to get access to the variables defined in the {@link RestParser} that has * generated it. * * <p>Instances of this class are immutable and thus thread-safe.</p> */ public class RestUrl { final String errorMessage; final Var...
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/preconditions/Preco...
checkArgumentNotNullOrEmpty(variableId);
danisola/restify
url/src/main/java/com/danisola/restify/url/RestUrl.java
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/preconditions/Preco...
import com.danisola.restify.url.types.VarType; import static com.danisola.restify.url.preconditions.Preconditions.checkArgumentNotNullOrEmpty; import static com.danisola.restify.url.preconditions.Preconditions.checkState;
package com.danisola.restify.url; /** * A REST representation of an URL. Allows to get access to the variables defined in the {@link RestParser} that has * generated it. * * <p>Instances of this class are immutable and thus thread-safe.</p> */ public class RestUrl { final String errorMessage; final Var...
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/preconditions/Preco...
checkState(isValid(), "Variables are not accessible for invalid URLs");
danisola/restify
url/src/main/java/com/danisola/restify/url/types/AbstractVarType.java
// Path: url/src/main/java/com/danisola/restify/url/preconditions/Preconditions.java // public static String checkArgumentNotNullOrEmpty(String string) { // if (string == null || string.isEmpty()) { // throw new IllegalArgumentException("Argument cannot be null or empty"); // } // return string; // ...
import static com.danisola.restify.url.preconditions.Preconditions.checkArgumentNotNullOrEmpty;
package com.danisola.restify.url.types; public abstract class AbstractVarType<T> implements VarType<T> { private final String id; private final String varPatternStr; protected AbstractVarType(String id) { this(id, ".*?"); } protected AbstractVarType(String id, String pattern) {
// Path: url/src/main/java/com/danisola/restify/url/preconditions/Preconditions.java // public static String checkArgumentNotNullOrEmpty(String string) { // if (string == null || string.isEmpty()) { // throw new IllegalArgumentException("Argument cannot be null or empty"); // } // return string; // ...
this.id = checkArgumentNotNullOrEmpty(id);
danisola/restify
url/src/main/java/com/danisola/restify/url/types/StrVar.java
// Path: url/src/main/java/com/danisola/restify/url/preconditions/Preconditions.java // public static void checkArgument(boolean expression, String errorMessage) { // if (!expression) { // throw new IllegalArgumentException(errorMessage); // } // }
import static com.danisola.restify.url.preconditions.Preconditions.checkArgument;
package com.danisola.restify.url.types; public class StrVar extends AbstractVarType<String> { public static StrVar strVar(String id) { return new StrVar(id); } public static StrVar strVar(String id, String regex) { return new StrVar(id, regex); } private StrVar(String id) { ...
// Path: url/src/main/java/com/danisola/restify/url/preconditions/Preconditions.java // public static void checkArgument(boolean expression, String errorMessage) { // if (!expression) { // throw new IllegalArgumentException(errorMessage); // } // } // Path: url/src/main/java/com/danisola/restify/url/t...
checkArgument(value != null, "Argument cannot be null");
danisola/restify
servlet/src/test/java/com/danisola/restify/servlet/utils/TestServlet.java
// Path: url/src/main/java/com/danisola/restify/url/RestUrl.java // public class RestUrl { // // final String errorMessage; // final VarType[] types; // final Object[] values; // // static RestUrl invalidRestUrl(String errorMsg) { // return new RestUrl(null, null, errorMsg); // } // // ...
import com.danisola.restify.servlet.*; import com.danisola.restify.url.RestUrl; import com.danisola.restify.url.types.VarType; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException;
package com.danisola.restify.servlet.utils; public class TestServlet extends RestServlet implements Delete, Get, Head, Options, Post, Put, Trace { private final TestCallback callback;
// Path: url/src/main/java/com/danisola/restify/url/RestUrl.java // public class RestUrl { // // final String errorMessage; // final VarType[] types; // final Object[] values; // // static RestUrl invalidRestUrl(String errorMsg) { // return new RestUrl(null, null, errorMsg); // } // // ...
public TestServlet(TestCallback callback, String pattern, VarType... types) {
danisola/restify
servlet/src/test/java/com/danisola/restify/servlet/utils/TestServlet.java
// Path: url/src/main/java/com/danisola/restify/url/RestUrl.java // public class RestUrl { // // final String errorMessage; // final VarType[] types; // final Object[] values; // // static RestUrl invalidRestUrl(String errorMsg) { // return new RestUrl(null, null, errorMsg); // } // // ...
import com.danisola.restify.servlet.*; import com.danisola.restify.url.RestUrl; import com.danisola.restify.url.types.VarType; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException;
package com.danisola.restify.servlet.utils; public class TestServlet extends RestServlet implements Delete, Get, Head, Options, Post, Put, Trace { private final TestCallback callback; public TestServlet(TestCallback callback, String pattern, VarType... types) { super(pattern, types); this....
// Path: url/src/main/java/com/danisola/restify/url/RestUrl.java // public class RestUrl { // // final String errorMessage; // final VarType[] types; // final Object[] values; // // static RestUrl invalidRestUrl(String errorMsg) { // return new RestUrl(null, null, errorMsg); // } // // ...
public void delete(HttpServletRequest req, HttpServletResponse res, RestUrl url) throws ServletException, IOException {
danisola/restify
url/src/main/java/com/danisola/restify/url/ParamVar.java
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // }
import com.danisola.restify.url.types.VarType; import java.util.regex.Pattern;
package com.danisola.restify.url; class ParamVar { private final String name;
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // Path: url/src/main/java/com/danisola/restify/url/ParamVar.java import ...
private final VarType[] types;
danisola/restify
url/src/main/java/com/danisola/restify/url/types/StrArrayVar.java
// Path: url/src/main/java/com/danisola/restify/url/preconditions/Preconditions.java // public static String checkArgumentNotNullOrEmpty(String string) { // if (string == null || string.isEmpty()) { // throw new IllegalArgumentException("Argument cannot be null or empty"); // } // return string; // ...
import static com.danisola.restify.url.preconditions.Preconditions.checkArgumentNotNullOrEmpty;
package com.danisola.restify.url.types; public class StrArrayVar extends AbstractVarType<String[]> { public static StrArrayVar strArrayVar(String id) { return new StrArrayVar(id); } public static StrArrayVar strArrayVar(String id, String regex) { return new StrArrayVar(id, regex); } ...
// Path: url/src/main/java/com/danisola/restify/url/preconditions/Preconditions.java // public static String checkArgumentNotNullOrEmpty(String string) { // if (string == null || string.isEmpty()) { // throw new IllegalArgumentException("Argument cannot be null or empty"); // } // return string; // ...
return checkArgumentNotNullOrEmpty(value).split(",");
danisola/restify
url/src/test/java/com/danisola/restify/url/UrlRestifyBenchmark.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import com.google.caliper.Runner; import com.google.caliper.SimpleBenchmark; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.types.IntVar.intVar; import static com.danisola.restify.url.types.StrVar.strVar;
package com.danisola.restify.url; public class UrlRestifyBenchmark extends SimpleBenchmark { public RestParser timeCreatingParser(int reps) {
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
RestParser parser = null;
danisola/restify
url/src/test/java/com/danisola/restify/url/UrlRestifyBenchmark.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import com.google.caliper.Runner; import com.google.caliper.SimpleBenchmark; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.types.IntVar.intVar; import static com.danisola.restify.url.types.StrVar.strVar;
package com.danisola.restify.url; public class UrlRestifyBenchmark extends SimpleBenchmark { public RestParser timeCreatingParser(int reps) { RestParser parser = null; for (int i = 0; i < reps; i++) {
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
parser = parser("/leagues/{}/teams/{}/players?age={}", strVar("leagueId"), strVar("teamId"),
danisola/restify
url/src/test/java/com/danisola/restify/url/UrlRestifyBenchmark.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import com.google.caliper.Runner; import com.google.caliper.SimpleBenchmark; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.types.IntVar.intVar; import static com.danisola.restify.url.types.StrVar.strVar;
package com.danisola.restify.url; public class UrlRestifyBenchmark extends SimpleBenchmark { public RestParser timeCreatingParser(int reps) { RestParser parser = null; for (int i = 0; i < reps; i++) { parser = parser("/leagues/{}/teams/{}/players?age={}", strVar("leagueId"), strVar("...
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
intVar("playerAge"));
danisola/restify
url/src/test/java/com/danisola/restify/url/RestParserTest.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import org.junit.Test; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.types.IntVar.intVar; import static com.danisola.restify.url.types.StrVar.strVar;
package com.danisola.restify.url; public class RestParserTest { @Test(expected = IllegalStateException.class) public void whenParameterValueHasNoVariableThenExceptionIsThrown() {
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
parser("/countries/{}?city=lon", strVar("GB"));
danisola/restify
url/src/test/java/com/danisola/restify/url/RestParserTest.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import org.junit.Test; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.types.IntVar.intVar; import static com.danisola.restify.url.types.StrVar.strVar;
package com.danisola.restify.url; public class RestParserTest { @Test(expected = IllegalStateException.class) public void whenParameterValueHasNoVariableThenExceptionIsThrown() {
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
parser("/countries/{}?city=lon", strVar("GB"));
danisola/restify
url/src/test/java/com/danisola/restify/url/RestParserTest.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import org.junit.Test; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.types.IntVar.intVar; import static com.danisola.restify.url.types.StrVar.strVar;
parser("/country/{}#economy", strVar("countryId")); } @Test(expected = IllegalStateException.class) public void whenMoreVariablesThanTypesThenExceptionIsThrown() { parser("/country/{}/city/{}", strVar("countryId")); } @Test(expected = IllegalStateException.class) public void wh...
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
parser("/country?countryId=}&population={}", strVar("countryId"), intVar("population"));
danisola/restify
url/src/main/java/com/danisola/restify/url/NameValuePair.java
// Path: url/src/main/java/com/danisola/restify/url/preconditions/Preconditions.java // public static String checkArgumentNotNullOrEmpty(String string) { // if (string == null || string.isEmpty()) { // throw new IllegalArgumentException("Argument cannot be null or empty"); // } // return string; // ...
import static com.danisola.restify.url.preconditions.Preconditions.checkArgumentNotNullOrEmpty;
package com.danisola.restify.url; class NameValuePair { private final String name; private final String value; public NameValuePair(String name, String value) {
// Path: url/src/main/java/com/danisola/restify/url/preconditions/Preconditions.java // public static String checkArgumentNotNullOrEmpty(String string) { // if (string == null || string.isEmpty()) { // throw new IllegalArgumentException("Argument cannot be null or empty"); // } // return string; // ...
this.name = checkArgumentNotNullOrEmpty(name);
danisola/restify
url/src/main/java/com/danisola/restify/url/RestParserFactory.java
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/ParsedUrl.java // s...
import com.danisola.restify.url.types.VarType; import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; import static com.danisola.restify.url.ParsedUrl.parseUrl; import static com.danisola.restify.url.preconditions.Preconditions.checkArgument; import static com.danisola.restify.url.preconditions...
package com.danisola.restify.url; /** * Generates instances of {@link RestParser}. */ public class RestParserFactory { private static final String VAR_MARKER = "{}"; private static final int VAR_MARKER_LENGTH = VAR_MARKER.length(); private static final Pattern MARKER_VALIDATOR = Pattern.compile(".*?(...
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/ParsedUrl.java // s...
public static RestParser parser(String pattern, VarType... types) {
danisola/restify
url/src/main/java/com/danisola/restify/url/RestParserFactory.java
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/ParsedUrl.java // s...
import com.danisola.restify.url.types.VarType; import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; import static com.danisola.restify.url.ParsedUrl.parseUrl; import static com.danisola.restify.url.preconditions.Preconditions.checkArgument; import static com.danisola.restify.url.preconditions...
package com.danisola.restify.url; /** * Generates instances of {@link RestParser}. */ public class RestParserFactory { private static final String VAR_MARKER = "{}"; private static final int VAR_MARKER_LENGTH = VAR_MARKER.length(); private static final Pattern MARKER_VALIDATOR = Pattern.compile(".*?(...
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/ParsedUrl.java // s...
ParsedUrl parsedUrl = parseUrl(pattern);
danisola/restify
url/src/main/java/com/danisola/restify/url/RestParserFactory.java
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/ParsedUrl.java // s...
import com.danisola.restify.url.types.VarType; import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; import static com.danisola.restify.url.ParsedUrl.parseUrl; import static com.danisola.restify.url.preconditions.Preconditions.checkArgument; import static com.danisola.restify.url.preconditions...
package com.danisola.restify.url; /** * Generates instances of {@link RestParser}. */ public class RestParserFactory { private static final String VAR_MARKER = "{}"; private static final int VAR_MARKER_LENGTH = VAR_MARKER.length(); private static final Pattern MARKER_VALIDATOR = Pattern.compile(".*?(...
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/ParsedUrl.java // s...
checkState(newTypesIndex > typesIndex, "Parameter '%s' has no variables in its value", pair.getName());
danisola/restify
url/src/main/java/com/danisola/restify/url/RestParserFactory.java
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/ParsedUrl.java // s...
import com.danisola.restify.url.types.VarType; import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; import static com.danisola.restify.url.ParsedUrl.parseUrl; import static com.danisola.restify.url.preconditions.Preconditions.checkArgument; import static com.danisola.restify.url.preconditions...
Pattern paramValuePattern = Pattern.compile(sb.toString()); paramVars[i] = new ParamVar(pair.getName(), paramTypes, paramValuePattern); paramVarCounter += newTypesIndex - typesIndex; typesIndex = newTypesIndex; } final int numVars = pathTypes.length + par...
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/ParsedUrl.java // s...
checkArgumentNotNullOrEmpty(pattern);
danisola/restify
url/src/main/java/com/danisola/restify/url/RestParserFactory.java
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/ParsedUrl.java // s...
import com.danisola.restify.url.types.VarType; import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; import static com.danisola.restify.url.ParsedUrl.parseUrl; import static com.danisola.restify.url.preconditions.Preconditions.checkArgument; import static com.danisola.restify.url.preconditions...
paramVars[i] = new ParamVar(pair.getName(), paramTypes, paramValuePattern); paramVarCounter += newTypesIndex - typesIndex; typesIndex = newTypesIndex; } final int numVars = pathTypes.length + paramVarCounter; checkState(numVars == numTypes, "The number of var...
// Path: url/src/main/java/com/danisola/restify/url/types/VarType.java // public interface VarType<T> { // // public String getId(); // // public String getVarPattern(); // // public T convert(String value) throws Exception; // } // // Path: url/src/main/java/com/danisola/restify/url/ParsedUrl.java // s...
checkArgument(!pattern.endsWith("/"), "Patterns must not end with /");
danisola/restify
url/src/test/java/com/danisola/restify/url/RestUrlTest.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import org.junit.Test; import java.net.URL; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.matchers.IsInvalid.isInvalid; import static com.danisola.restify.url.matchers.IsValid.isValid; import static com.danisola.restify.url.types.FloatVar.floatVar; import static...
package com.danisola.restify.url; public class RestUrlTest { @Test public void whenMultipleParametersAreRequestedThenItsValuesAreCorrect() {
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
RestParser parser = parser("/{}/{}?float={}&str={}&int={}",
danisola/restify
url/src/test/java/com/danisola/restify/url/RestUrlTest.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import org.junit.Test; import java.net.URL; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.matchers.IsInvalid.isInvalid; import static com.danisola.restify.url.matchers.IsValid.isValid; import static com.danisola.restify.url.types.FloatVar.floatVar; import static...
package com.danisola.restify.url; public class RestUrlTest { @Test public void whenMultipleParametersAreRequestedThenItsValuesAreCorrect() { RestParser parser = parser("/{}/{}?float={}&str={}&int={}",
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
strVar("first"), strVar("second"), floatVar("float"), strVar("str"), intVar("int"));
danisola/restify
url/src/test/java/com/danisola/restify/url/RestUrlTest.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import org.junit.Test; import java.net.URL; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.matchers.IsInvalid.isInvalid; import static com.danisola.restify.url.matchers.IsValid.isValid; import static com.danisola.restify.url.types.FloatVar.floatVar; import static...
package com.danisola.restify.url; public class RestUrlTest { @Test public void whenMultipleParametersAreRequestedThenItsValuesAreCorrect() { RestParser parser = parser("/{}/{}?float={}&str={}&int={}",
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
strVar("first"), strVar("second"), floatVar("float"), strVar("str"), intVar("int"));
danisola/restify
url/src/test/java/com/danisola/restify/url/RestUrlTest.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import org.junit.Test; import java.net.URL; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.matchers.IsInvalid.isInvalid; import static com.danisola.restify.url.matchers.IsValid.isValid; import static com.danisola.restify.url.types.FloatVar.floatVar; import static...
package com.danisola.restify.url; public class RestUrlTest { @Test public void whenMultipleParametersAreRequestedThenItsValuesAreCorrect() { RestParser parser = parser("/{}/{}?float={}&str={}&int={}",
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
strVar("first"), strVar("second"), floatVar("float"), strVar("str"), intVar("int"));
danisola/restify
url/src/test/java/com/danisola/restify/url/RestUrlTest.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import org.junit.Test; import java.net.URL; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.matchers.IsInvalid.isInvalid; import static com.danisola.restify.url.matchers.IsValid.isValid; import static com.danisola.restify.url.types.FloatVar.floatVar; import static...
package com.danisola.restify.url; public class RestUrlTest { @Test public void whenMultipleParametersAreRequestedThenItsValuesAreCorrect() { RestParser parser = parser("/{}/{}?float={}&str={}&int={}", strVar("first"), strVar("second"), floatVar("float"), strVar("str"), intVar("int")...
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
assertThat(url, isValid());
danisola/restify
url/src/test/java/com/danisola/restify/url/RestUrlTest.java
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
import org.junit.Test; import java.net.URL; import static com.danisola.restify.url.RestParserFactory.parser; import static com.danisola.restify.url.matchers.IsInvalid.isInvalid; import static com.danisola.restify.url.matchers.IsValid.isValid; import static com.danisola.restify.url.types.FloatVar.floatVar; import static...
@Test public void whenCompositeParamsAreDefinedThenItsValuesAreCorrect() { RestParser parser = parser("/battleship/shoot?square={}{}", strVar("char", "[A-L]"), intVar("num", "[0-9]")); RestUrl url = parser.parse("http://www.games.com/battleship/shoot?square=B7"); assertTh...
// Path: url/src/main/java/com/danisola/restify/url/RestParserFactory.java // public static RestParser parser(String pattern, VarType... types) { // checkPattern(pattern); // // final int numTypes = types.length; // ParsedUrl parsedUrl = parseUrl(pattern); // StringBuilder sb = new StringBuilder(); // ...
assertThat(url, isInvalid());
theblindr/blindr
app/src/com/lesgens/blindr/controllers/Controller.java
// Path: app/src/com/lesgens/blindr/models/City.java // public class City implements IDestination{ // // private String name; // // public City(String name) { // this.name = name; // } // // public String getName(){ // return name; // } // // public String getId(){ // return name; // } // } // // P...
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import com.checkin.avatargenerator.AvatarGenerator; import com.facebook.Session; import com.lesgens.blindr.models.City; import com.lesgens.b...
package com.lesgens.blindr.controllers; public class Controller { private City city;
// Path: app/src/com/lesgens/blindr/models/City.java // public class City implements IDestination{ // // private String name; // // public City(String name) { // this.name = name; // } // // public String getName(){ // return name; // } // // public String getId(){ // return name; // } // } // // P...
private HashMap<String, User> users;
theblindr/blindr
app/src/com/lesgens/blindr/controllers/Controller.java
// Path: app/src/com/lesgens/blindr/models/City.java // public class City implements IDestination{ // // private String name; // // public City(String name) { // this.name = name; // } // // public String getName(){ // return name; // } // // public String getId(){ // return name; // } // } // // P...
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import com.checkin.avatargenerator.AvatarGenerator; import com.facebook.Session; import com.lesgens.blindr.models.City; import com.lesgens.b...
package com.lesgens.blindr.controllers; public class Controller { private City city; private HashMap<String, User> users; private Session session; private User myselfUser;
// Path: app/src/com/lesgens/blindr/models/City.java // public class City implements IDestination{ // // private String name; // // public City(String name) { // this.name = name; // } // // public String getName(){ // return name; // } // // public String getId(){ // return name; // } // } // // P...
private ArrayList<Match> matches;
theblindr/blindr
app/src/com/lesgens/blindr/controllers/Controller.java
// Path: app/src/com/lesgens/blindr/models/City.java // public class City implements IDestination{ // // private String name; // // public City(String name) { // this.name = name; // } // // public String getName(){ // return name; // } // // public String getId(){ // return name; // } // } // // P...
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import com.checkin.avatargenerator.AvatarGenerator; import com.facebook.Session; import com.lesgens.blindr.models.City; import com.lesgens.b...
public void setSession(Session session) { this.session = session; } public void setMyOwnUser(User user){ this.myselfUser = user; } public User getMyself(){ return myselfUser; } public String getMyId(){ return myselfUser.getId().substring(0, myselfUser.getId().indexOf(".")); } public void setMatches...
// Path: app/src/com/lesgens/blindr/models/City.java // public class City implements IDestination{ // // private String name; // // public City(String name) { // this.name = name; // } // // public String getName(){ // return name; // } // // public String getId(){ // return name; // } // } // // P...
dimensionAvatar = Utils.dpInPixels(context, 50);
theblindr/blindr
app/src/com/lesgens/blindr/listeners/EventsListener.java
// Path: app/src/com/lesgens/blindr/models/Event.java // public abstract class Event { // // // private UUID id; // private Timestamp timestamp; // private IDestination destination; // private User sourceUser; // private String realName; // private String fakeName; // // public Event(UUID id, Timestamp tim...
import java.util.List; import com.lesgens.blindr.models.Event; import com.lesgens.blindr.models.Match; import com.lesgens.blindr.models.User;
package com.lesgens.blindr.listeners; public interface EventsListener { public void onEventsReceived(List<Event> events);
// Path: app/src/com/lesgens/blindr/models/Event.java // public abstract class Event { // // // private UUID id; // private Timestamp timestamp; // private IDestination destination; // private User sourceUser; // private String realName; // private String fakeName; // // public Event(UUID id, Timestamp tim...
public void onOldMatchesReceives(List<Match> matches);
theblindr/blindr
app/src/com/lesgens/blindr/listeners/EventsListener.java
// Path: app/src/com/lesgens/blindr/models/Event.java // public abstract class Event { // // // private UUID id; // private Timestamp timestamp; // private IDestination destination; // private User sourceUser; // private String realName; // private String fakeName; // // public Event(UUID id, Timestamp tim...
import java.util.List; import com.lesgens.blindr.models.Event; import com.lesgens.blindr.models.Match; import com.lesgens.blindr.models.User;
package com.lesgens.blindr.listeners; public interface EventsListener { public void onEventsReceived(List<Event> events); public void onOldMatchesReceives(List<Match> matches); public void onUserHistoryReceived(List<Event> events);
// Path: app/src/com/lesgens/blindr/models/Event.java // public abstract class Event { // // // private UUID id; // private Timestamp timestamp; // private IDestination destination; // private User sourceUser; // private String realName; // private String fakeName; // // public Event(UUID id, Timestamp tim...
public void onUserLiked(User user, String userFakeName);
theblindr/blindr
app/src/com/grio/fbphotopicker/FBPhotoPickerActivity.java
// Path: app/src/com/lesgens/blindr/views/CustomYesNoDialog.java // public class CustomYesNoDialog extends Dialog implements // android.view.View.OnClickListener { // // public Button yes, no; // // public CustomYesNoDialog(Context context) { // super(context); // } // // @Override // protected void onCreate(...
import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; ...
} mAlbumsList.setAdapter(new FBAlbumArrayAdapter(mContext, 0, fbAlbums)); mAlbumsList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> pare...
// Path: app/src/com/lesgens/blindr/views/CustomYesNoDialog.java // public class CustomYesNoDialog extends Dialog implements // android.view.View.OnClickListener { // // public Button yes, no; // // public CustomYesNoDialog(Context context) { // super(context); // } // // @Override // protected void onCreate(...
CustomYesNoDialog dialog = new CustomYesNoDialog(FBPhotoPickerActivity.this){
theblindr/blindr
app/src/com/lesgens/blindr/models/Match.java
// Path: app/src/com/lesgens/blindr/controllers/Controller.java // public class Controller { // private City city; // private HashMap<String, User> users; // private Session session; // private User myselfUser; // private ArrayList<Match> matches; // private int dimensionAvatar; // // private static Controller ...
import java.sql.Timestamp; import java.util.UUID; import com.lesgens.blindr.controllers.Controller;
package com.lesgens.blindr.models; public class Match extends Event{ private Boolean isMutual; private String fakeName; public Match(UUID id, Timestamp timestamp, IDestination destination, User user) { this(id, timestamp, destination, user, false, null, null); } public Match(UUID id, Timestamp timestamp...
// Path: app/src/com/lesgens/blindr/controllers/Controller.java // public class Controller { // private City city; // private HashMap<String, User> users; // private Session session; // private User myselfUser; // private ArrayList<Match> matches; // private int dimensionAvatar; // // private static Controller ...
if(!getUser().getId().equals(Controller.getInstance().getMyself().getId())){
theblindr/blindr
app/src/com/jeremyfeinstein/slidingmenu/lib/CustomViewBehind.java
// Path: app/src/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java // public interface CanvasTransformer { // // /** // * Transform canvas. // * // * @param canvas the canvas // * @param percentOpen the percent open // */ // public void transformCanvas(Canvas canvas, float percentOpen); // }
import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.MotionEv...
package com.jeremyfeinstein.slidingmenu.lib; public class CustomViewBehind extends ViewGroup { private static final String TAG = "CustomViewBehind"; private static final int MARGIN_THRESHOLD = 48; // dips private int mTouchMode = SlidingMenu.TOUCHMODE_MARGIN; private CustomViewAbove mViewAbove; private View...
// Path: app/src/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java // public interface CanvasTransformer { // // /** // * Transform canvas. // * // * @param canvas the canvas // * @param percentOpen the percent open // */ // public void transformCanvas(Canvas canvas, float percentOpen); // } // Path: ...
private CanvasTransformer mTransformer;
theblindr/blindr
app/src/com/lesgens/blindr/views/SlideshowView.java
// Path: app/src/com/lesgens/blindr/ImageViewerActivity.java // public class ImageViewerActivity extends Activity implements OnClickListener{ // // public static void show(Context context, Bitmap bitmap) { // Intent i = new Intent(context, ImageViewerActivity.class); // FileOutputStream out = null; // try { // ...
import java.util.ArrayList; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; import android.wi...
mPicturesContainer = (LinearLayout) view.findViewById(R.id.pictures_container); mDotsContainer = (LinearLayout) view.findViewById(R.id.dots_container); mDotsContainer.setPadding(0, -mDotsSize*2, 0, 0); mImages = new ArrayList<Bitmap>(); mSelectedItem = -1; } private void initAttrs(AttributeSet attrs){ T...
// Path: app/src/com/lesgens/blindr/ImageViewerActivity.java // public class ImageViewerActivity extends Activity implements OnClickListener{ // // public static void show(Context context, Bitmap bitmap) { // Intent i = new Intent(context, ImageViewerActivity.class); // FileOutputStream out = null; // try { // ...
ImageViewerActivity.show(getContext(), getSelectedImage());
theblindr/blindr
app/src/com/lesgens/blindr/WelcomeToBlindrPageFragment.java
// Path: app/src/com/lesgens/blindr/controllers/Controller.java // public class Controller { // private City city; // private HashMap<String, User> users; // private Session session; // private User myselfUser; // private ArrayList<Match> matches; // private int dimensionAvatar; // // private static Controller ...
import com.lesgens.blindr.controllers.Controller; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView;
package com.lesgens.blindr; public class WelcomeToBlindrPageFragment extends Fragment implements OnClickListener { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup v = (ViewGroup) inflater.inflate( R.layout.welcome_to_blindr, containe...
// Path: app/src/com/lesgens/blindr/controllers/Controller.java // public class Controller { // private City city; // private HashMap<String, User> users; // private Session session; // private User myselfUser; // private ArrayList<Match> matches; // private int dimensionAvatar; // // private static Controller ...
((ImageView) v.findViewById(R.id.avatar)).setImageBitmap(Controller.getInstance().getMyself().getAvatar());
darrenfoong/candc
src/lexicon/Categories.java
// Path: src/io/Preface.java // public class Preface { // public static void readPreface(BufferedReader in) throws IOException { // String line = in.readLine(); // // if (line == null || line.charAt(0) != '#') { // throw new IllegalArgumentException("File does not start with the mandatory preface."); // } //...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import io.Preface; import utils.ByteWrapper; import utils.ShortWrapper;
public String getString(String plainCategoryString) { return markedupStrings.get(plainCategoryString); } public String getPlainString(String markedupString) { return plainCategoryStrings.get(markedupString); } public Category getCategory(String plainCategoryString) { return markedupCategories.get(plainCat...
// Path: src/io/Preface.java // public class Preface { // public static void readPreface(BufferedReader in) throws IOException { // String line = in.readLine(); // // if (line == null || line.charAt(0) != '#') { // throw new IllegalArgumentException("File does not start with the mandatory preface."); // } //...
Preface.readPreface(in);
darrenfoong/candc
src/lexicon/Categories.java
// Path: src/io/Preface.java // public class Preface { // public static void readPreface(BufferedReader in) throws IOException { // String line = in.readLine(); // // if (line == null || line.charAt(0) != '#') { // throw new IllegalArgumentException("File does not start with the mandatory preface."); // } //...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import io.Preface; import utils.ByteWrapper; import utils.ShortWrapper;
if ( tokens.length != 1 ) { throw new Error("error parsing plain cat line in markedup"); } plainCatString = tokens[0]; state = States.MARKEDUP; break; case MARKEDUP: tokens = (line.trim()).split("\\s+"); if ( tokens.length != 2 ) { throw new Error("error par...
// Path: src/io/Preface.java // public class Preface { // public static void readPreface(BufferedReader in) throws IOException { // String line = in.readLine(); // // if (line == null || line.charAt(0) != '#') { // throw new IllegalArgumentException("File does not start with the mandatory preface."); // } //...
cat.reorderVariables(seenVariables, new ByteWrapper((byte) (0)));
darrenfoong/candc
src/lexicon/Categories.java
// Path: src/io/Preface.java // public class Preface { // public static void readPreface(BufferedReader in) throws IOException { // String line = in.readLine(); // // if (line == null || line.charAt(0) != '#') { // throw new IllegalArgumentException("File does not start with the mandatory preface."); // } //...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import io.Preface; import utils.ByteWrapper; import utils.ShortWrapper;
} markedupCatString = tokens[1]; cat = parse(markedupCatString); seenVariables = new byte[VarID.NUM_VARS]; Arrays.fill(seenVariables, VarID.NONE); cat.reorderVariables(seenVariables, new ByteWrapper((byte) (0))); markedupStrings.put(plainCatString, markedupCatString)...
// Path: src/io/Preface.java // public class Preface { // public static void readPreface(BufferedReader in) throws IOException { // String line = in.readLine(); // // if (line == null || line.charAt(0) != '#') { // throw new IllegalArgumentException("File does not start with the mandatory preface."); // } //...
ShortWrapper numJuliaSlots = new ShortWrapper((short) (0));
darrenfoong/candc
src/chart_parser/Candidate.java
// Path: src/utils/Hash.java // public class Hash { // /* // * comment from C&C: shift value to multiply by with each additional // * component of the hash function; this number is normally selected to be // * a smallish prime; 31 and 37 seem to work well // */ // private final static long INC = 92821; // pr...
import utils.Hash;
package chart_parser; public class Candidate implements Comparable<Candidate> { int k; // choice point int leftIndex; // index into left k-best array int rightIndex; // index into right k-best array double score; // sum of the scores of the two children public Candidate(int k, int leftIndex, int rightIndex, dou...
// Path: src/utils/Hash.java // public class Hash { // /* // * comment from C&C: shift value to multiply by with each additional // * component of the hash function; this number is normally selected to be // * a smallish prime; 31 and 37 seem to work well // */ // private final static long INC = 92821; // pr...
Hash h = new Hash(k);
darrenfoong/candc
src/cat_combination/DependencyStringWords.java
// Path: src/utils/Hash.java // public class Hash { // /* // * comment from C&C: shift value to multiply by with each additional // * component of the hash function; this number is normally selected to be // * a smallish prime; 31 and 37 seem to work well // */ // private final static long INC = 92821; // pr...
import utils.Hash;
package cat_combination; // used by the oracle decoder and IgnoreDepsEval class which stores // which dependencies are ignored by the evaluate script; we have to // store heads and fillers as strings, not sentence indices public class DependencyStringWords implements Comparable<DependencyStringWords> { private fina...
// Path: src/utils/Hash.java // public class Hash { // /* // * comment from C&C: shift value to multiply by with each additional // * component of the hash function; this number is normally selected to be // * a smallish prime; 31 and 37 seem to work well // */ // private final static long INC = 92821; // pr...
Hash h = new Hash(relID);
darrenfoong/candc
src/lexicon/Category.java
// Path: src/utils/ByteWrapper.java // public class ByteWrapper { // public byte value; // // public ByteWrapper(byte value) { // this.value = value; // } // } // // Path: src/utils/Hash.java // public class Hash { // /* // * comment from C&C: shift value to multiply by with each additional // * component o...
import utils.ByteWrapper; import utils.Hash;
package lexicon; public class Category { public static final byte BWD_SLASH = 0; public static final byte FWD_SLASH = 1; public byte var; public final short relID; public final short lrange;
// Path: src/utils/ByteWrapper.java // public class ByteWrapper { // public byte value; // // public ByteWrapper(byte value) { // this.value = value; // } // } // // Path: src/utils/Hash.java // public class Hash { // /* // * comment from C&C: shift value to multiply by with each additional // * component o...
private final Hash equivalenceHash;
darrenfoong/candc
src/lexicon/Category.java
// Path: src/utils/ByteWrapper.java // public class ByteWrapper { // public byte value; // // public ByteWrapper(byte value) { // this.value = value; // } // } // // Path: src/utils/Hash.java // public class Hash { // /* // * comment from C&C: shift value to multiply by with each additional // * component o...
import utils.ByteWrapper; import utils.Hash;
this.unificationHash = new Hash(other.unificationHash); this.equivalenceHash = isComplex() ? eHashComplex() : eHashBasic(); // need to call eHash method again since the feature may have changed from other } /* * uses the constructor above; upper-case first letter since this is * effectively a constructor;...
// Path: src/utils/ByteWrapper.java // public class ByteWrapper { // public byte value; // // public ByteWrapper(byte value) { // this.value = value; // } // } // // Path: src/utils/Hash.java // public class Hash { // /* // * comment from C&C: shift value to multiply by with each additional // * component o...
public void reorderVariables(byte[] seenVariables, ByteWrapper nextVarID) {
darrenfoong/candc
src/model/Weights.java
// Path: src/io/Preface.java // public class Preface { // public static void readPreface(BufferedReader in) throws IOException { // String line = in.readLine(); // // if (line == null || line.charAt(0) != '#') { // throw new IllegalArgumentException("File does not start with the mandatory preface."); // } //...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import io.Preface;
package model; public class Weights { private double[] weights; private double logp; private double depnn; public Weights() { } public Weights(String weightsFile, int numFeatures) throws IOException { this.weights = new double[numFeatures]; if (!weightsFile.equals("zero")) { readWeights(weightsFile);...
// Path: src/io/Preface.java // public class Preface { // public static void readPreface(BufferedReader in) throws IOException { // String line = in.readLine(); // // if (line == null || line.charAt(0) != '#') { // throw new IllegalArgumentException("File does not start with the mandatory preface."); // } //...
Preface.readPreface(in);
darrenfoong/candc
src/training/ConjNode.java
// Path: src/utils/NumericalFunctions.java // public class NumericalFunctions { // public static double addLogs(double x, double y) { // if (y <= x) { // return x + Math.log1p(Math.exp(y - x)); // } else { // return y + Math.log1p(Math.exp(x - y)); // } // } // // /* // * e^x + e^y = e^z - need to sol...
import utils.NumericalFunctions;
// and viterbi // scores on // disj nodes } else { inside = leftChild.score; } } else { inside = 0.0; } for (int i = 0; i < features.length; i++) { inside += features[i].getLambda(); } return inside; } // also calculates the feature expectations public void calcOutside(double...
// Path: src/utils/NumericalFunctions.java // public class NumericalFunctions { // public static double addLogs(double x, double y) { // if (y <= x) { // return x + Math.log1p(Math.exp(y - x)); // } else { // return y + Math.log1p(Math.exp(x - y)); // } // } // // /* // * e^x + e^y = e^z - need to sol...
leftChild.outside = NumericalFunctions.addLogs(
darrenfoong/candc
src/training/DisjNode.java
// Path: src/utils/NumericalFunctions.java // public class NumericalFunctions { // public static double addLogs(double x, double y) { // if (y <= x) { // return x + Math.log1p(Math.exp(y - x)); // } else { // return y + Math.log1p(Math.exp(x - y)); // } // } // // /* // * e^x + e^y = e^z - need to sol...
import utils.NumericalFunctions;
if (viterbiScore > maxScore) { maxScore = viterbiScore; maxNode = node; } } } if (maxNode != null) { maxNode.viterbiMarker = true; // mark the conjNode as being in the // highest scoring derivation } else { throw new Error("shld always have a maxNode!"); } score = maxScore; // ...
// Path: src/utils/NumericalFunctions.java // public class NumericalFunctions { // public static double addLogs(double x, double y) { // if (y <= x) { // return x + Math.log1p(Math.exp(y - x)); // } else { // return y + Math.log1p(Math.exp(x - y)); // } // } // // /* // * e^x + e^y = e^z - need to sol...
score = NumericalFunctions
darrenfoong/candc
src/cat_combination/IgnoreDepsEval.java
// Path: src/io/Sentence.java // public class Sentence { // public ArrayList<String> words; // public ArrayList<String> postags; // public ArrayList<ArrayList<Supertag>> multiSupertags; // public ArrayList<Integer> wordIDs; // public ArrayList<Integer> postagIDs; // public ArrayList<Category> outputSupertags; // ...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import io.Sentence; import lexicon.Relations;
package cat_combination; /* * an object of this class is used by the max F-score oracle decoder; * it takes a dependency as input and outputs 1 if the dependency is * ignored by the evaluate script; the ignored dependencies are read * in as separate text files depending on their type */ public class IgnoreDeps...
// Path: src/io/Sentence.java // public class Sentence { // public ArrayList<String> words; // public ArrayList<String> postags; // public ArrayList<ArrayList<Supertag>> multiSupertags; // public ArrayList<Integer> wordIDs; // public ArrayList<Integer> postagIDs; // public ArrayList<Category> outputSupertags; // ...
Relations relations;
darrenfoong/candc
src/training/Forest.java
// Path: src/utils/NumericalFunctions.java // public class NumericalFunctions { // public static double addLogs(double x, double y) { // if (y <= x) { // return x + Math.log1p(Math.exp(y - x)); // } else { // return y + Math.log1p(Math.exp(x - y)); // } // } // // /* // * e^x + e^y = e^z - need to sol...
import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import utils.NumericalFunctions;
// System.out.println("root score: " + score + " gold: " + // root.goldMarker()); if (score > maxScore) { maxScore = score; maxRoot = root; } } } // System.out.println("viterbi max value: " + maxScore); return maxRoot; } public double calcInside(boolean gold) { for (int i = 0...
// Path: src/utils/NumericalFunctions.java // public class NumericalFunctions { // public static double addLogs(double x, double y) { // if (y <= x) { // return x + Math.log1p(Math.exp(y - x)); // } else { // return y + Math.log1p(Math.exp(x - y)); // } // } // // /* // * e^x + e^y = e^z - need to sol...
logZ = NumericalFunctions.addLogs(logZ, root.score);
darrenfoong/candc
src/model/Lexicon.java
// Path: src/io/Preface.java // public class Preface { // public static void readPreface(BufferedReader in) throws IOException { // String line = in.readLine(); // // if (line == null || line.charAt(0) != '#') { // throw new IllegalArgumentException("File does not start with the mandatory preface."); // } //...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; import io.Preface;
package model; public class Lexicon { private HashMap<String,Integer> lexicon; // map from words and pos as strings to IDs public Lexicon(String file) throws IOException { this.lexicon = new HashMap<String,Integer>(); readWordPosFile(file); } public int getID(String word) { // returns -1 if word not in ...
// Path: src/io/Preface.java // public class Preface { // public static void readPreface(BufferedReader in) throws IOException { // String line = in.readLine(); // // if (line == null || line.charAt(0) != '#') { // throw new IllegalArgumentException("File does not start with the mandatory preface."); // } //...
Preface.readPreface(in);
darrenfoong/candc
src/lexicon/CategoryJSlotPair.java
// Path: src/utils/Hash.java // public class Hash { // /* // * comment from C&C: shift value to multiply by with each additional // * component of the hash function; this number is normally selected to be // * a smallish prime; 31 and 37 seem to work well // */ // private final static long INC = 92821; // pr...
import utils.Hash;
package lexicon; /* * keys for one of the hashMaps in Relations */ public class CategoryJSlotPair { public String catString; public short slot; public CategoryJSlotPair(String catString, short slot) { this.catString = catString; this.slot = slot; } @Override public int hashCode() {
// Path: src/utils/Hash.java // public class Hash { // /* // * comment from C&C: shift value to multiply by with each additional // * component of the hash function; this number is normally selected to be // * a smallish prime; 31 and 37 seem to work well // */ // private final static long INC = 92821; // pr...
Hash h = new Hash(catString.hashCode());
darrenfoong/candc
src/training/Feature.java
// Path: src/utils/NumericalFunctions.java // public class NumericalFunctions { // public static double addLogs(double x, double y) { // if (y <= x) { // return x + Math.log1p(Math.exp(y - x)); // } else { // return y + Math.log1p(Math.exp(x - y)); // } // } // // /* // * e^x + e^y = e^z - need to sol...
import utils.NumericalFunctions;
this.empiricalValue = 0.0; } public void perceptronUpdate() { lambda += lambdaUpdate; lambdaUpdate = 0.0; cumulativeLambda += lambda; } public void perceptronUpdateFast(int numTrainInstances) { double oldLambda = lambda; lambda += lambdaUpdate; lambdaUpdate = 0.0; cumulativeLambda += oldLambda *...
// Path: src/utils/NumericalFunctions.java // public class NumericalFunctions { // public static double addLogs(double x, double y) { // if (y <= x) { // return x + Math.log1p(Math.exp(y - x)); // } else { // return y + Math.log1p(Math.exp(x - y)); // } // } // // /* // * e^x + e^y = e^z - need to sol...
lambda += NumericalFunctions.adaGradUpdate(gradient, sumGradSquared, learningRate);